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?

3
  • PG is effectively useless on Windows, IMO Jan 23, 2018 at 21:06
  • @NeilMcGuigan can you please provide cases in order to support your point? 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.
    – Venryx
    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);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.