macro_rules! pg_magic_func {
    () => { ... };
}
Expand description

Create the Pg_magic_func required by PGX in extensions.

Note: Generally pg_module_magic is preferred, and results in this macro being called. This macro should only be directly called in advanced use cases.

Creates a “magic block” that describes the capabilities of the extension to Postgres at runtime. From the Dynamic Loading section of the upstream documentation:

To ensure that a dynamically loaded object file is not loaded into an incompatible server, PostgreSQL checks that the file contains a “magic block” with the appropriate contents. This allows the server to detect obvious incompatibilities, such as code compiled for a different major version of PostgreSQL. To include a magic block, write this in one (and only one) of the module source files, after having included the header fmgr.h:

PG_MODULE_MAGIC;

Acknowledgements

This macro was initially inspired from the pg_module macro by Daniel Fagnan and expanded by Benjamin Fry.