Postgresql on Windows and custom extensions

postgresql

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?

Best Answer

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);