Add server support for "plugin" libraries that can be used for add-on tasks
Tom Lane <tgl@sss.pgh.pa.us>
Add server support for "plugin" libraries that can be used for add-on tasks such as debugging and performance measurement. This consists of two features: a table of "rendezvous variables" that allows separately-loaded shared libraries to communicate, and a new GUC setting "local_preload_libraries" that allows libraries to be loaded into specific sessions without explicit cooperation from the client application. To make local_preload_libraries as flexible as possible, we do not restrict its use to superusers; instead, it is restricted to load only libraries stored in $libdir/plugins/. The existing LOAD command has also been modified to allow non-superusers to LOAD libraries stored in this directory. This patch also renames the existing GUC variable preload_libraries to shared_preload_libraries (after a suggestion by Simon Riggs) and does some code refactoring in dfmgr.c to improve clarity. Korry Douglas, with a little help from Tom Lane.
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/config.sgml | modified | +59 −4 |
| doc/src/sgml/ref/load.sgml | modified | +14 −1 |
| src/backend/postmaster/postmaster.c | modified | +2 −2 |
| src/backend/tcop/postgres.c | modified | +7 −1 |
| src/backend/tcop/utility.c | modified | +3 −6 |
| src/backend/utils/fmgr/dfmgr.c | modified | +192 −78 |
| src/backend/utils/init/miscinit.c | modified | +53 −12 |
| src/backend/utils/misc/guc.c | modified | +13 −3 |
| src/backend/utils/misc/postgresql.conf.sample | modified | +2 −1 |
| src/include/fmgr.h | modified | +3 −2 |
| src/include/miscadmin.h | modified | +5 −3 |