Ayush Vatsa <[email protected]> writes:
> My use case is that I’m building an experimental extension that will be
> installed only in a few
> databases. I want the hooks initialized by this extension to apply only to
> those specific
> databases, while all other databases should continue with the default
> PostgreSQL behavior.

If you don't name the extension in shared_preload_libraries, it
will not be loaded into the postmaster, but only into individual
sessions.  The ways the latter can happen are

* session_preload_libraries or local_preload_libraries GUC
* explicit LOAD command
* creation of a C function that references that library
* calling of a C function that references that library

Extensions per se don't have anything to do with this,
except to the extent that an extension's creation script
might do some of the above actions.

You might be able to get what you want by doing

ALTER DATABASE db SET session_preload_libraries = 'your-library'

for each DB you want it to be active in.  If it exposes any SQL
objects you'd also need to issue CREATE EXTENSION in each DB.

                        regards, tom lane


Reply via email to