diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2014-12-22 23:05:46 -0500 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2014-12-22 23:05:46 -0500 |
commit | 584e35d17c00b69d598522d3cf321fbd9b7dbd03 (patch) | |
tree | f1d1c2aac00be7186e6d87d2aa87c5b24a9f6f5d | |
parent | 2a3f2743f200dbcdd412a00ff69f30d3e34b662b (diff) | |
download | postgresql-584e35d17c00b69d598522d3cf321fbd9b7dbd03.tar.gz postgresql-584e35d17c00b69d598522d3cf321fbd9b7dbd03.zip |
Change local_preload_libraries to PGC_USERSET
This allows it to be used with ALTER ROLE SET.
Although the old setting of PGC_BACKEND prevented changes after session
start, after discussion it was more useful to allow ALTER ROLE SET
instead and just document that changes during a session have no effect.
This is similar to how session_preload_libraries works already.
An alternative would be to change things to allow PGC_BACKEND and
PGC_SU_BACKEND settings to be changed by ALTER ROLE SET. But that might
need further research (e.g., log_connections would probably not work).
based on patch by Kyotaro Horiguchi
-rw-r--r-- | doc/src/sgml/config.sgml | 17 | ||||
-rw-r--r-- | src/backend/utils/misc/guc.c | 2 |
2 files changed, 15 insertions, 4 deletions
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 48ae3e41f9c..6bcb106518e 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -6292,8 +6292,9 @@ SET XML OPTION { DOCUMENT | CONTENT }; <listitem> <para> This variable specifies one or more shared libraries that are to be - preloaded at connection start. This parameter cannot be changed after - the start of a particular session. If a specified library is not + preloaded at connection start. + The parameter value only takes effect at the start of the connection. + Subsequent changes have no effect. If a specified library is not found, the connection attempt will fail. </para> @@ -6311,7 +6312,17 @@ SET XML OPTION { DOCUMENT | CONTENT }; </para> <para> - Unless a module is specifically designed to be used in this way by + The intent of this feature is to allow unprivileged users to load + debugging or performance-measurement libraries into specific sessions + without requiring an explicit <command>LOAD</> command. To that end, + it would be typical to set this parameter using + the <envar>PGOPTIONS</envar> environment variable on the client or by + using + <command>ALTER ROLE SET</>. + </para> + + <para> + However, unless a module is specifically designed to be used in this way by non-superusers, this is usually not the right setting to use. Look at <xref linkend="guc-session-preload-libraries"> instead. </para> diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index b1bff7f3500..77c34949d69 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -2920,7 +2920,7 @@ static struct config_string ConfigureNamesString[] = }, { - {"local_preload_libraries", PGC_BACKEND, CLIENT_CONN_PRELOAD, + {"local_preload_libraries", PGC_USERSET, CLIENT_CONN_PRELOAD, gettext_noop("Lists unprivileged shared libraries to preload into each backend."), NULL, GUC_LIST_INPUT | GUC_LIST_QUOTE |