Home Explore Blog CI



postgresql

33th chunk of `doc/src/sgml/libpq.sgml`
12d9943d5d450f11b8fa78efca4dd08aa5572afd72462f750000000100000fa2
 can be used by foreign-data
        wrappers or similar middleware to enable pass-through SCRAM
        authentication. See <xref
        linkend="postgres-fdw-options-connection-management"/> for one such
        implementation.  It is not meant to be specified directly by users or
        client applications.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="libpq-connect-service" xreflabel="service">
      <term><literal>service</literal></term>
      <listitem>
       <para>
        Service name to use for additional parameters.  It specifies a service
        name in <filename>pg_service.conf</filename> that holds additional connection parameters.
        This allows applications to specify only a service name so connection parameters
        can be centrally maintained. See <xref linkend="libpq-pgservice"/>.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="libpq-connect-target-session-attrs" xreflabel="target_session_attrs">
      <term><literal>target_session_attrs</literal></term>
      <listitem>
       <para>
        This option determines whether the session must have certain
        properties to be acceptable.  It's typically used in combination
        with multiple host names to select the first acceptable alternative
        among several hosts.  There are six modes:

        <variablelist>
         <varlistentry>
          <term><literal>any</literal> (default)</term>
          <listitem>
           <para>
            any successful connection is acceptable
           </para>
          </listitem>
         </varlistentry>

         <varlistentry>
          <term><literal>read-write</literal></term>
          <listitem>
           <para>
            session must accept read-write transactions by default (that
            is, the server must not be in hot standby mode and
            the <varname>default_transaction_read_only</varname> parameter
            must be <literal>off</literal>)
           </para>
          </listitem>
         </varlistentry>

         <varlistentry>
          <term><literal>read-only</literal></term>
          <listitem>
           <para>
            session must not accept read-write transactions by default (the
            converse)
           </para>
          </listitem>
         </varlistentry>

         <varlistentry>
          <term><literal>primary</literal></term>
          <listitem>
           <para>
            server must not be in hot standby mode
           </para>
          </listitem>
         </varlistentry>

         <varlistentry>
          <term><literal>standby</literal></term>
          <listitem>
           <para>
            server must be in hot standby mode
           </para>
          </listitem>
         </varlistentry>

         <varlistentry>
          <term><literal>prefer-standby</literal></term>
          <listitem>
           <para>
            first try to find a standby server, but if none of the listed
            hosts is a standby server, try again in <literal>any</literal>
            mode
           </para>
          </listitem>
         </varlistentry>
        </variablelist>
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="libpq-connect-load-balance-hosts" xreflabel="load_balance_hosts">
      <term><literal>load_balance_hosts</literal></term>
      <listitem>
       <para>
        Controls the order in which the client tries to connect to the available
        hosts and addresses. Once a connection attempt is successful no other
        hosts and addresses will be tried. This parameter is typically used in
        combination with multiple host names or a DNS record that returns
        multiple IPs. This parameter can be used in combination with
        <xref linkend="libpq-connect-target-session-attrs"/>
        to, for example, load balance over standby servers only. Once successfully
        connected, subsequent queries on the returned connection will

Title: Connection Parameters: Service Name and Target Session Attributes
Summary
This section describes connection parameters related to service names and target session attributes. The 'service' parameter specifies a service name from pg_service.conf, allowing centralized management of connection parameters. The 'target_session_attrs' parameter defines required session properties, used with multiple host names to select an acceptable alternative. It offers modes like 'any', 'read-write', 'read-only', 'primary', 'standby', and 'prefer-standby' to specify the desired server state (e.g., hot standby status, read-only transaction acceptance).