Home Explore Blog CI



postgresql

57th chunk of `doc/src/sgml/ref/psql-ref.sgml`
13fc045081eac09007e365aa3a91ad64536ae36c63bb96170000000100000fa0
 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 default values.
        See <xref linkend="app-psql-variables"/> below.
        </para>
        </listitem>
      </varlistentry>


      <varlistentry id="app-psql-meta-command-write">
        <term><literal>\w</literal> or <literal>\write</literal> <replaceable class="parameter">filename</replaceable></term>
        <term><literal>\w</literal> or <literal>\write</literal> <literal>|</literal><replaceable class="parameter">command</replaceable></term>
        <listitem>
        <para>
        Writes the current query buffer to the file <replaceable
        class="parameter">filename</replaceable> or pipes it to the shell
        command <replaceable class="parameter">command</replaceable>.
        If the current query buffer is empty, the most recently executed query
        is written instead.
        </para>

        <para>
        If the argument begins with <literal>|</literal>, then the entire remainder
        of the line is taken to be
        the <replaceable class="parameter">command</replaceable> to execute,
        and neither variable interpolation nor backquote expansion are
        performed in it.  The rest of the line is simply passed literally to
        the shell.
        </para>
        </listitem>
      </varlistentry>


      <varlistentry id="app-psql-meta-command-warn">
        <term><literal>\warn <replaceable class="parameter">text</replaceable> [ ... ]</literal></term>
        <listitem>
        <para>
        This command is identical to <command>\echo</command> except
        that the output will be written to <application>psql</application>'s
        standard error channel, rather than standard output.
        </para>
        </listitem>
      </varlistentry>


      <varlistentry id="app-psql-meta-command-watch">
        <term><literal>\watch [ i[nterval]=<replaceable class="parameter">seconds</replaceable> ] [ c[ount]=<replaceable class="parameter">times</replaceable> ] [ m[in_rows]=<replaceable class="parameter">rows</replaceable> ] [ <replaceable class="parameter">seconds</replaceable> ]</literal></term>
        <listitem>
        <para>
        Repeatedly execute the current query buffer (as <literal>\g</literal> does)
        until interrupted, or the query fails, or the execution count limit
        (if given) is reached, or the query no longer returns the minimum number
        of rows. Wait the specified number of seconds (default 2) between executions.
        The default wait can be changed with the variable
        <xref linkend="app-psql-variables-watch-interval"/>).
        For backwards compatibility,
        <replaceable class="parameter">seconds</replaceable> can be specified
        with or without an <literal>interval=</literal> prefix.
        Each query result is
        displayed with a header that includes the <literal>\pset title</literal>
        string (if any), the time as of query start, and the delay interval.
        </para>
        <para>
        If the

Title: psql Meta-Commands: \timing, \unset, \w (write), \warn, and \watch
Summary
This section details the \timing meta-command for toggling SQL statement timing display, \unset for deleting psql variables (or resetting them to default), \w (or \write) for writing the current query buffer to a file or piping it to a shell command, \warn for echoing text to standard error, and \watch for repeatedly executing the current query buffer with a specified interval and conditions.