Home Explore Blog CI



postgresql

5th chunk of `doc/src/sgml/config.sgml`
a4c32aeb1f1100cc3dd6cb67d6fcbcd304ab5debbff5fa940000000100000fa5
 is_local)</function>
       (see <xref linkend="functions-admin-set"/>).
      </para>
     </listitem>
    </itemizedlist>

    <para>
     In addition, the system view <link
     linkend="view-pg-settings"><structname>pg_settings</structname></link> can be
     used to view and change session-local values:
    </para>

    <itemizedlist>
     <listitem>
      <para>
       Querying this view is similar to using <command>SHOW ALL</command> but
       provides more detail.  It is also more flexible, since it's possible
       to specify filter conditions or join against other relations.
      </para>
     </listitem>

     <listitem>
      <para>
       Using <command>UPDATE</command> on this view, specifically
       updating the <structname>setting</structname> column, is the equivalent
       of issuing <command>SET</command> commands.  For example, the equivalent of
<programlisting>
SET configuration_parameter TO DEFAULT;
</programlisting>
       is:
<programlisting>
UPDATE pg_settings SET setting = reset_val WHERE name = 'configuration_parameter';
</programlisting>
      </para>
     </listitem>
    </itemizedlist>

   </sect2>

   <sect2 id="config-setting-shell">
    <title>Parameter Interaction via the Shell</title>

     <para>
      In addition to setting global defaults or attaching
      overrides at the database or role level, you can pass settings to
      <productname>PostgreSQL</productname> via shell facilities.
      Both the server and <application>libpq</application> client library
      accept parameter values via the shell.
     </para>

     <itemizedlist>
      <listitem>
      <para>
       During server startup, parameter settings can be
       passed to the <command>postgres</command> command via the
       <option>-c name=value</option> command-line parameter, or its equivalent
       <option>--name=value</option> variation.  For example,
<programlisting>
postgres -c log_connections=all --log-destination='syslog'
</programlisting>
       Settings provided in this way override those set via
       <filename>postgresql.conf</filename> or <command>ALTER SYSTEM</command>,
       so they cannot be changed globally without restarting the server.
     </para>
    </listitem>

    <listitem>
     <para>
      When starting a client session via <application>libpq</application>,
      parameter settings can be
      specified using the <envar>PGOPTIONS</envar> environment variable.
      Settings established in this way constitute defaults for the life
      of the session, but do not affect other sessions.
      For historical reasons, the format of <envar>PGOPTIONS</envar> is
      similar to that used when launching the <command>postgres</command>
      command; specifically, the <option>-c</option>, or prepended
      <literal>--</literal>, before the name must be specified. For example,
<programlisting>
env PGOPTIONS="-c geqo=off --statement-timeout=5min" psql
</programlisting>
     </para>

     <para>
      Other clients and libraries might provide their own mechanisms,
      via the shell or otherwise, that allow the user to alter session
      settings without direct use of SQL commands.
     </para>
    </listitem>
   </itemizedlist>

   </sect2>

   <sect2 id="config-includes">
    <title>Managing Configuration File Contents</title>

     <para>
      <productname>PostgreSQL</productname> provides several features for breaking
      down complex <filename>postgresql.conf</filename> files into sub-files.
      These features are especially useful when managing multiple servers
      with related, but not identical, configurations.
     </para>

     <para>
      <indexterm>
       <primary><literal>include</literal></primary>
       <secondary>in configuration file</secondary>
      </indexterm>
      In addition to individual parameter settings,
      the <filename>postgresql.conf</filename> file can contain <firstterm>include
      directives</firstterm>, which specify another file to read and process

Title: SQL Parameter Interaction via pg_settings View and Shell Interaction
Summary
This section details how to use the pg_settings view to query and update session-local configuration values, equating UPDATE commands on the 'setting' column to SET commands. It also covers parameter settings via the shell, using the -c option during server startup for the postgres command and the PGOPTIONS environment variable for libpq client sessions. These shell-specified settings override configuration file settings.