Re: alter user set local_preload_libraries.

Поиск
Список
Период
Сортировка
От Kyotaro HORIGUCHI
Тема Re: alter user set local_preload_libraries.
Дата
Msg-id 20140901.205159.127327934.horiguchi.kyotaro@lab.ntt.co.jp
обсуждение исходный текст
Ответ на Re: alter user set local_preload_libraries.  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: alter user set local_preload_libraries.  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
Hello,

> > I found this issue when trying per-pg_user (role) loading of
> > auto_analyze and some tweaking tool. It is not necessarily set by
> > the user by own, but the function to decide whether to load some
> > module by the session-user would be usable, at least, as for me:)
> 
> I think we could just set local_preload_libraries to PGC_USERSET and
> document that subsequent changes won't take effect.  That's the same way
> session_preload_libraries works.  That would avoid inventing another
> very specialized GUC context.

It is enough for me. Since the only advantage of
PGC_BACKEND_USERSET is the capability to inhibit in-session
modification and I don't see another use case for it, I have no
objection for your opinion.

> If you're interested in improving this area, I also suggest you read the
> thread of
> <http://www.postgresql.org/message-id/1349829917.29682.5.camel@vanquo.pezone.net>.

Although I don't understand even after reading this why
local_preload_libraries was PGC_SUSET, there seems to be no
reason it should be so.

The attached patch simply changes the context for local_... to
PGC_USERSET and edits the doc.

regards,

-- 
Kyotaro Horiguchi
NTT Open Source Software Center
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 49547ee..8803709 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -6052,14 +6052,16 @@ SET XML OPTION { DOCUMENT | CONTENT };      <listitem>       <para>        This variable
specifiesone 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.  This option is effective only when it
+        is set at session start via <command>ALTER USER ... SET</> command (or
+        postgresq.conf) so changing this variable after the start of a
+        particular session has no effect.  If a specified library is not        found, the connection attempt will
fail.      </para>       <para>
 
-        This option can be set by any user.  Because of that, the libraries
-        that can be loaded are restricted to those appearing in the
+        Since non-supersers are allowed to set it, the libraries that can be
+        loaded are restricted to those appearing in the        <filename>plugins</> subdirectory of the installation's
      standard library directory.  (It is the database administrator's        responsibility to ensure that only
<quote>safe</>libraries
 
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index a8a17c2..f128f32 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -2895,7 +2895,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
sharedlibraries to preload into each backend."),            NULL,            GUC_LIST_INPUT | GUC_LIST_QUOTE 

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Decoding of (nearly) empty transactions and regression tests
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: pg_receivexlog and replication slots