3

I'm running Postgresql on Windows 10 and trying to install custom extension (https://github.com/eulerto/wal2json) for logical decoding.

However, I have to build and install this extension manually. While building is possible via Visual Studio I can't find a way how to install extension via pgxs. Pgxs seems to be missing in Postgresql distribution package for Windows and I can't find a viable way how to create extension.

pg_config --pgxs shows the following path:

C:/Program Files/PostgreSQL/10/lib/pgxs/src/makefiles/pgxs.mk

but this path doesn't exist.

Does anybody know how to install Postgresql extensions from source code on Windows?

asked Jan 23, 2018 at 9:00
3
  • PG is effectively useless on Windows, IMO Commented Jan 23, 2018 at 21:06
  • @NeilMcGuigan can you please provide cases in order to support your point? Commented Jan 29, 2019 at 11:41
  • For people seeking the wal2json Windows binary (who don't want to compile from source), I found binaries provided here: striim.com/docs/smsgc/en/smsgc-how-to-guides/… After downloading, I just copied the dll file into the C:\Program Files\PostgreSQL\VERSION\lib folder, and restarted PostgreSQL. Commented Feb 5, 2021 at 13:08

1 Answer 1

4

Apparently, I somehow got confused about extensions.

It appeared that everything is much simpler: I just copied compiled dll to postgresql lib folder and everything worked.

Detailed information about how to compile PostgreSQL extensions on Windows can be found here: https://blog.2ndquadrant.com/compiling-postgresql-extensions-visual-studio-windows/

I'd like to add a note about PGDLLEXPORT. For extensions to work you should add PGDLLEXPORT before two procedures: _PG_init and _PG_output_plugin_init. So code will look like:

PGDLLEXPORT extern void _PG_init(void);
PGDLLEXPORT extern void _PG_output_plugin_init(OutputPluginCallbacks *cb);
answered Jan 24, 2018 at 6:41

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.