Home Explore Blog CI



postgresql

58th chunk of `doc/src/sgml/ref/psql-ref.sgml`
b1e8920fec096bc03470e3595670ff8e8d2949c98782b4eb0000000100000fa5
 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 current query buffer is empty, the most recently sent query
        is re-executed instead.
        </para>
        </listitem>
      </varlistentry>


      <varlistentry id="app-psql-meta-command-x">
        <term><literal>\x [ <replaceable class="parameter">on</replaceable> | <replaceable class="parameter">off</replaceable> | <replaceable class="parameter">auto</replaceable> ]</literal></term>
        <listitem>
        <para>
        Sets or toggles expanded table formatting mode. As such it is equivalent to
        <literal>\pset expanded</literal>.
       </para>
       </listitem>
      </varlistentry>


      <varlistentry id="app-psql-meta-command-z">
        <term><literal>\z[Sx] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
        <listitem>
        <para>
        Lists tables, views and sequences with their
        associated access privileges.
        If a <replaceable class="parameter">pattern</replaceable> is
        specified, only tables, views and sequences whose names match the
        pattern are listed.  By default only user-created objects are shown;
        supply a pattern or the <literal>S</literal> modifier to include
        system objects.
        If <literal>x</literal> is appended to the command name, the results
        are displayed in expanded mode.
        </para>

        <para>
        This is an alias for <command>\dp</command> (<quote>display
        privileges</quote>).
        </para>
        </listitem>
      </varlistentry>


      <varlistentry id="app-psql-meta-command-exclamation-mark">
        <term><literal>\! [ <replaceable class="parameter">command</replaceable> ]</literal></term>
        <listitem>
        <para>
        With no argument, escapes to a sub-shell; <application>psql</application>
        resumes when the sub-shell exits.  With an argument, executes the
        shell command <replaceable class="parameter">command</replaceable>.
        </para>

        <para>
        Unlike most other meta-commands, the entire remainder of the line is
        always taken to be the argument(s) of <command>\!</command>, and neither
        variable interpolation nor backquote expansion are performed in the
        arguments.  The rest of the line is simply passed literally to the
        shell.
        </para>
        </listitem>
      </varlistentry>


      <varlistentry id="app-psql-meta-command-question-mark">
        <term><literal>\? [ <replaceable class="parameter">topic</replaceable> ]</literal></term>
        <listitem>
        <para>
        Shows help information. The optional
        <replaceable class="parameter">topic</replaceable> parameter
        (defaulting to <literal>commands</literal>) selects which part of <application>psql</application> is
        explained: <literal>commands</literal> describes <application>psql</application>'s
        backslash commands; <literal>options</literal> describes the command-line

Title: psql Meta-Commands: \watch (continued), \x, \z, \!, and \?
Summary
This section describes the \watch meta-command for repeated query execution, the \x meta-command for toggling expanded table formatting, \z for listing tables/views/sequences with access privileges (alias for \dp), \! for escaping to a sub-shell or executing a shell command, and \? for displaying help information on various psql topics.