Home Explore Blog CI



postgresql

59th chunk of `doc/src/sgml/ref/psql-ref.sgml`
2e04ae255da191e2d780e28aca47cf30f80bfb6ce21c938e0000000100000fa5
   </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
        options that can be passed to <application>psql</application>;
        and <literal>variables</literal> shows help about <application>psql</application> configuration
        variables.
        </para>
        </listitem>
      </varlistentry>


      <varlistentry id="app-psql-meta-command-semicolon">
        <term><literal>\;</literal></term>
        <listitem>
        <para>
        Backslash-semicolon is not a meta-command in the same way as the
        preceding commands; rather, it simply causes a semicolon to be
        added to the query buffer without any further processing.
        </para>

        <para>
        Normally, <application>psql</application> will dispatch an SQL command to the
        server as soon as it reaches the command-ending semicolon, even if
        more input remains on the current line.  Thus for example entering
<programlisting>
select 1; select 2; select 3;
</programlisting>
        will result in the three SQL commands being individually sent to
        the server, with each one's results being displayed before
        continuing to the next command.  However, a semicolon entered
        as <literal>\;</literal> will not trigger command processing, so that the
        command before it and the one after are effectively combined and
        sent to the server in one request.  So for example
<programlisting>
select 1\; select 2\; select 3;
</programlisting>
        results in sending the three SQL commands to the server in a single
        request, when the non-backslashed semicolon is reached.
        The server executes such a request as a single transaction,
        unless there are explicit <command>BEGIN</command>/<command>COMMIT</command>
        commands included in the string to divide it into multiple
        transactions.  (See <xref linkend="protocol-flow-multi-statement"/>
        for more details about how the server handles multi-query strings.)
        </para>
        </listitem>
      </varlistentry>

    </variablelist>
  </para>

  <refsect3 id="app-psql-patterns" xreflabel="Patterns">
   <title>Patterns</title>

   <indexterm>
    <primary>patterns</primary>
    <secondary>in psql and pg_dump</secondary>
   </indexterm>

  <para>
   The various <literal>\d</literal> commands accept a <replaceable
   class="parameter">pattern</replaceable> parameter to specify the
   object name(s) to be displayed.  In the simplest case, a pattern
   is just the exact name of the object.  The characters within a
   pattern are normally folded to lower case, just as in SQL names;
   for example, <literal>\dt FOO</literal> will display the table named
   <literal>foo</literal>.  As in SQL names, placing double quotes around
   a pattern stops folding to lower case.  Should you need to include
   an actual double quote character in a pattern, write it as a pair
   of double quotes within a double-quote sequence; again this is in
   accord with the rules for SQL quoted identifiers.  For example,
   <literal>\dt

Title: psql Meta-Commands: \?, and \; (Semicolon), Patterns
Summary
This section details the \? meta-command for displaying help, explaining how to specify the help topic. It then describes the special behavior of the \; meta-command, which allows semicolons to be added to the query buffer without triggering command execution. The section concludes with an introduction to patterns used in \d commands for specifying object names, including case folding and the use of double quotes.