Home Explore Blog CI



postgresql

64th chunk of `doc/src/sgml/ref/psql-ref.sgml`
8d9d9b3e171f419709c7df997657b7cc587835b771063e740000000100000fa1
  <varlistentry id="app-psql-variables-echo">
        <term><varname>ECHO</varname></term>
        <listitem>
        <para>
        If set to <literal>all</literal>, all nonempty input lines are printed
        to standard output as they are read.  (This does not apply to lines
        read interactively.)  To select this behavior on program
        start-up, use the switch <option>-a</option>. If set to
        <literal>queries</literal>,
        <application>psql</application> prints each query to standard output
        as it is sent to the server. The switch to select this behavior is
        <option>-e</option>. If set to <literal>errors</literal>, then only
        failed queries are displayed on standard error output. The switch
        for this behavior is <option>-b</option>. If set to
        <literal>none</literal> (the default), then no queries are displayed.
        </para>
        </listitem>
      </varlistentry>

      <varlistentry id="app-psql-variables-echo-hidden">
        <term><varname>ECHO_HIDDEN</varname></term>
        <listitem>
        <para>
        When this variable is set to <literal>on</literal> and a backslash command
        queries the database, the query is first shown.
        This feature helps you to study
        <productname>PostgreSQL</productname> internals and provide
        similar functionality in your own programs. (To select this behavior
        on program start-up, use the switch <option>-E</option>.)  If you set
        this variable to the value <literal>noexec</literal>, the queries are
        just shown but are not actually sent to the server and executed.
        The default value is <literal>off</literal>.
        </para>
        </listitem>
      </varlistentry>

      <varlistentry id="app-psql-variables-encoding">
        <term><varname>ENCODING</varname></term>
        <listitem>
        <para>
        The current client character set encoding.
        This is set every time you connect to a database (including
        program start-up), and when you change the encoding
        with <literal>\encoding</literal>, but it can be changed or unset.
        </para>
        </listitem>
      </varlistentry>

      <varlistentry id="app-psql-variables-error">
       <term><varname>ERROR</varname></term>
       <listitem>
        <para>
         <literal>true</literal> if the last SQL query failed, <literal>false</literal> if
         it succeeded.  See also <varname>SQLSTATE</varname>.
        </para>
       </listitem>
      </varlistentry>

      <varlistentry id="app-psql-variables-fetch-count">
        <term><varname>FETCH_COUNT</varname></term>
        <listitem>
        <para>
        If this variable is set to an integer value greater than zero,
        the results of <command>SELECT</command> queries are fetched
        and displayed in groups of that many rows, rather than the
        default behavior of collecting the entire result set before
        display.  Therefore only a
        limited amount of memory is used, regardless of the size of
        the result set.  Settings of 100 to 1000 are commonly used
        when enabling this feature.
        Keep in mind that when using this feature, a query might
        fail after having already displayed some rows.
        </para>

        <tip>
        <para>
        Although you can use any output format with this feature,
        the default <literal>aligned</literal> format tends to look bad
        because each group of <varname>FETCH_COUNT</varname> rows
        will be formatted separately, leading to varying column
        widths across the row groups.  The other output formats work better.
        </para>
        </tip>
        </listitem>
      </varlistentry>

      <varlistentry id="app-psql-variables-hide-tableam">
        <term><varname>HIDE_TABLEAM</varname></term>
        <listitem>
        <para>
         If this variable is set to <literal>true</literal>, a table's access
         method details are

Title: psql Special Variables: ECHO_HIDDEN, ENCODING, ERROR, FETCH_COUNT, HIDE_TABLEAM
Summary
This section details several specially treated variables in psql, including ECHO_HIDDEN, which shows the queries underlying backslash commands; ENCODING, which reflects the current client character set; ERROR, which indicates the success or failure of the last SQL query; FETCH_COUNT, which controls the number of rows fetched and displayed at a time for SELECT queries; and HIDE_TABLEAM, which hides table access method details.