Skip to content

Commit 584e35d

Browse files
committed
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
1 parent 2a3f274 commit 584e35d

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

doc/src/sgml/config.sgml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6292,8 +6292,9 @@ SET XML OPTION { DOCUMENT | CONTENT };
62926292
<listitem>
62936293
<para>
62946294
This variable specifies one or more shared libraries that are to be
6295-
preloaded at connection start. This parameter cannot be changed after
6296-
the start of a particular session. If a specified library is not
6295+
preloaded at connection start.
6296+
The parameter value only takes effect at the start of the connection.
6297+
Subsequent changes have no effect. If a specified library is not
62976298
found, the connection attempt will fail.
62986299
</para>
62996300

@@ -6311,7 +6312,17 @@ SET XML OPTION { DOCUMENT | CONTENT };
63116312
</para>
63126313

63136314
<para>
6314-
Unless a module is specifically designed to be used in this way by
6315+
The intent of this feature is to allow unprivileged users to load
6316+
debugging or performance-measurement libraries into specific sessions
6317+
without requiring an explicit <command>LOAD</> command. To that end,
6318+
it would be typical to set this parameter using
6319+
the <envar>PGOPTIONS</envar> environment variable on the client or by
6320+
using
6321+
<command>ALTER ROLE SET</>.
6322+
</para>
6323+
6324+
<para>
6325+
However, unless a module is specifically designed to be used in this way by
63156326
non-superusers, this is usually not the right setting to use. Look
63166327
at <xref linkend="guc-session-preload-libraries"> instead.
63176328
</para>

src/backend/utils/misc/guc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2920,7 +2920,7 @@ static struct config_string ConfigureNamesString[] =
29202920
},
29212921

29222922
{
2923-
{"local_preload_libraries", PGC_BACKEND, CLIENT_CONN_PRELOAD,
2923+
{"local_preload_libraries", PGC_USERSET, CLIENT_CONN_PRELOAD,
29242924
gettext_noop("Lists unprivileged shared libraries to preload into each backend."),
29252925
NULL,
29262926
GUC_LIST_INPUT | GUC_LIST_QUOTE

0 commit comments

Comments
 (0)