Home Explore Blog CI



postgresql

56th chunk of `doc/src/sgml/ref/psql-ref.sgml`
b9906c3ad57cc558216e1fd278da63b1b63cd525fdc0ab4c0000000100000fa0
       All queries executed while a pipeline is ongoing use the extended
        query protocol. Queries are appended to the pipeline when ending with
        a semicolon. The meta-commands <literal>\bind</literal>,
        <literal>\bind_named</literal>, <literal>\close</literal> or
        <literal>\parse</literal> can be used in an ongoing pipeline. While
        a pipeline is ongoing, <literal>\sendpipeline</literal> will append
        the current query buffer to the pipeline. Other meta-commands like
        <literal>\g</literal>, <literal>\gx</literal> or
        <literal>\gdesc</literal> are not allowed in pipeline mode.
       </para>

       <para>
        <command>\flushrequest</command> appends a flush command to the
        pipeline, allowing to read results with
        <command>\getresults</command> without issuing a sync or ending the
        pipeline. <command>\getresults</command> will automatically push
        unsent data to the server. <command>\flush</command> can be used to
        manually push unsent data.
       </para>

       <para>
        <command>\getresults</command> accepts an optional
        <replaceable class="parameter">number_results</replaceable> parameter.
        If provided, only the first
        <replaceable class="parameter">number_results</replaceable> pending
        results will be read. If not provided or <literal>0</literal>, all
        pending results are read.
       </para>

       <para>
        When pipeline mode is active, a dedicated prompt variable is available
        to report the pipeline status.
        See <xref linkend="app-psql-prompting-p-uc"/> for more details
       </para>

       <para>
        Example:
<programlisting>
\startpipeline
SELECT * FROM pg_class;
SELECT 1 \bind \sendpipeline
\flushrequest
\getresults
\endpipeline
</programlisting>
       </para>

      </listitem>
     </varlistentry>


      <varlistentry id="app-psql-meta-command-t-lc">
        <term><literal>\t</literal></term>
        <listitem>
        <para>
        Toggles the display of output column name headings and row count
        footer. This command is equivalent to <literal>\pset
        tuples_only</literal> and is provided for convenience.
        </para>
        </listitem>
      </varlistentry>


      <varlistentry id="app-psql-meta-command-t-uc">
        <term><literal>\T <replaceable class="parameter">table_options</replaceable></literal></term>
        <listitem>
        <para>
        Specifies attributes to be placed within the
        <sgmltag>table</sgmltag> tag in <acronym>HTML</acronym>
        output format. This command is equivalent to <literal>\pset
        tableattr <replaceable
        class="parameter">table_options</replaceable></literal>.
        </para>
        </listitem>
      </varlistentry>


      <varlistentry id="app-psql-meta-command-timing">
       <term><literal>\timing [ <replaceable class="parameter">on</replaceable> | <replaceable class="parameter">off</replaceable> ]</literal></term>
        <listitem>
        <para>
         With a parameter, turns displaying of how long each SQL statement
         takes on or off.  Without a parameter, toggles the display between
         on and off.  The display is in milliseconds; intervals longer than
         1 second are also shown in minutes:seconds format, with hours and
         days fields added if needed.
        </para>
       </listitem>
      </varlistentry>


      <varlistentry id="app-psql-meta-command-unset">
        <term><literal>\unset <replaceable class="parameter">name</replaceable></literal></term>

        <listitem>
        <para>
        Unsets (deletes) the <application>psql</application> variable <replaceable
        class="parameter">name</replaceable>.
        </para>

        <para>
        Most variables that control <application>psql</application>'s behavior
        cannot be unset; instead, an <literal>\unset</literal> command is interpreted
        as setting them to their

Title: psql Meta-Commands: Pipelining Continued, \t, \T, \timing, and \unset
Summary
This section continues the description of psql's pipelining meta-commands, explaining how to flush and retrieve results using \flushrequest and \getresults. It provides an example of using pipelining. Then, it describes the \t meta-command for toggling output column headers, \T for setting HTML table attributes, \timing for toggling SQL statement timing display, and \unset for deleting psql variables.