Home Explore Blog CI



postgresql

21th chunk of `doc/src/sgml/libpq.sgml`
62479b0924e12f9660f00fc78b654c39d43263a522e7f7780000000100000fad
 </listitem>
     </varlistentry>

     <varlistentry id="libpq-connect-client-encoding" xreflabel="client_encoding">
      <term><literal>client_encoding</literal></term>
      <listitem>
      <para>
       This sets the <varname>client_encoding</varname>
       configuration parameter for this connection.  In addition to
       the values accepted by the corresponding server option, you
       can use <literal>auto</literal> to determine the right
       encoding from the current locale in the client
       (<envar>LC_CTYPE</envar> environment variable on Unix
       systems).
      </para>
      </listitem>
     </varlistentry>

     <varlistentry id="libpq-connect-options" xreflabel="options">
      <term><literal>options</literal></term>
      <listitem>
       <para>
        Specifies command-line options to send to the server at connection
        start.  For example, setting this to <literal>-c geqo=off</literal>
        or <literal>--geqo=off</literal> sets the session's value of the
        <varname>geqo</varname> parameter to <literal>off</literal>.
        Spaces within this string are considered to
        separate command-line arguments, unless escaped with a backslash
        (<literal>\</literal>); write <literal>\\</literal> to represent a literal
        backslash.  For a detailed discussion of the available
        options, consult <xref linkend="runtime-config"/>.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="libpq-connect-application-name" xreflabel="application_name">
      <term><literal>application_name</literal></term>
      <listitem>
       <para>
        Specifies a value for the <xref linkend="guc-application-name"/>
        configuration parameter.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="libpq-connect-fallback-application-name" xreflabel="fallback_application_name">
      <term><literal>fallback_application_name</literal></term>
      <listitem>
       <para>
        Specifies a fallback value for the <xref
        linkend="guc-application-name"/> configuration parameter.
        This value will be used if no value has been given for
        <literal>application_name</literal> via a connection parameter or the
        <envar>PGAPPNAME</envar> environment variable.  Specifying
        a fallback name is useful in generic utility programs that
        wish to set a default application name but allow it to be
        overridden by the user.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="libpq-keepalives" xreflabel="keepalives">
      <term><literal>keepalives</literal></term>
      <listitem>
       <para>
        Controls whether client-side TCP keepalives are used. The default
        value is 1, meaning on, but you can change this to 0, meaning off,
        if keepalives are not wanted.  This parameter is ignored for
        connections made via a Unix-domain socket.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="libpq-keepalives-idle" xreflabel="keepalives_idle">
      <term><literal>keepalives_idle</literal></term>
      <listitem>
       <para>
        Controls the number of seconds of inactivity after which TCP should
        send a keepalive message to the server.  A value of zero uses the
        system default. This parameter is ignored for connections made via a
        Unix-domain socket, or if keepalives are disabled.
        It is only supported on systems where <symbol>TCP_KEEPIDLE</symbol> or
        an equivalent socket option is available, and on Windows; on other
        systems, it has no effect.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="libpq-keepalives-interval" xreflabel="keepalives_interval">
      <term><literal>keepalives_interval</literal></term>
      <listitem>
       <para>
        Controls the number of seconds after which a TCP keepalive message
        that is not acknowledged by the server should be retransmitted.

Title: Connection Parameters: Client Encoding, Options, Application Names, and Keepalives
Summary
This section continues the description of libpq connection parameters. It revisits 'client_encoding' and explains 'options' for sending command-line options to the server at connection start, detailing how to escape spaces and backslashes. It introduces 'application_name' and 'fallback_application_name' for setting the application name configuration parameter, with the latter providing a default that can be overridden. Finally, it covers TCP keepalive parameters: 'keepalives' to enable/disable keepalives, 'keepalives_idle' to set the inactivity period before sending a keepalive message, and 'keepalives_interval' to control retransmission frequency of unacknowledged keepalive messages.