Home Explore Blog CI



postgresql

40th chunk of `doc/src/sgml/ref/psql-ref.sgml`
3addd484d7db5b91f562b44d946b0af3832b0493a616de770000000100000fd0
 </para>
        </listitem>
      </varlistentry>


      <varlistentry id="app-psql-meta-command-gx">
        <term><literal>\gx [ (<replaceable class="parameter">option</replaceable>=<replaceable class="parameter">value</replaceable> [...]) ] [ <replaceable class="parameter">filename</replaceable> ]</literal></term>
        <term><literal>\gx [ (<replaceable class="parameter">option</replaceable>=<replaceable class="parameter">value</replaceable> [...]) ] [ |<replaceable class="parameter">command</replaceable> ]</literal></term>
        <listitem>
        <para>
        <literal>\gx</literal> is equivalent to <literal>\g</literal>, except
        that it forces expanded output mode for this query, as
        if <literal>expanded=on</literal> were included in the list of
        <literal>\pset</literal> options.  See also <literal>\x</literal>.
        </para>
        </listitem>
      </varlistentry>


      <varlistentry id="app-psql-meta-command-help">
        <term><literal>\h</literal> or <literal>\help</literal> <literal>[ <replaceable class="parameter">command</replaceable> ]</literal></term>
        <listitem>
        <para>
        Gives syntax help on the specified <acronym>SQL</acronym>
        command. If <replaceable class="parameter">command</replaceable>
        is not specified, then <application>psql</application> will list
        all the commands for which syntax help is available. If
        <replaceable class="parameter">command</replaceable> is an
        asterisk (<literal>*</literal>), then syntax help on all
        <acronym>SQL</acronym> commands is shown.
        </para>

        <para>
        Unlike most other meta-commands, the entire remainder of the line is
        always taken to be the argument(s) of <command>\help</command>, and neither
        variable interpolation nor backquote expansion are performed in the
        arguments.
        </para>

        <note>
        <para>
        To simplify typing, commands that consists of several words do
        not have to be quoted. Thus it is fine to type <userinput>\help
        alter table</userinput>.
        </para>
        </note>
        </listitem>
      </varlistentry>


      <varlistentry id="app-psql-meta-command-html">
        <term><literal>\H</literal> or <literal>\html</literal></term>
        <listitem>
        <para>
        Turns on <acronym>HTML</acronym> query output format. If the
        <acronym>HTML</acronym> format is already on, it is switched
        back to the default aligned text format. This command is for
        compatibility and convenience, but see <command>\pset</command>
        about setting other output options.
        </para>
        </listitem>
      </varlistentry>


      <varlistentry id="app-psql-meta-command-include">
        <term><literal>\i</literal> or <literal>\include</literal> <replaceable class="parameter">filename</replaceable></term>
        <listitem>
        <para>
        Reads input from the file <replaceable
        class="parameter">filename</replaceable> and executes it as
        though it had been typed on the keyboard.
        </para>
        <para>
        If <replaceable>filename</replaceable> is <literal>-</literal>
        (hyphen), then standard input is read until an EOF indication
        or <command>\q</command> meta-command.  This can be used to intersperse
        interactive input with input from files.  Note that Readline behavior
        will be used only if it is active at the outermost level.
        </para>
        <note>
        <para>
        If you want to see the lines on the screen as they are read you
        must set the variable <varname>ECHO</varname> to
        <literal>all</literal>.
        </para>
        </note>
        </listitem>
      </varlistentry>


      <varlistentry id="psql-metacommand-if">
        <term><literal>\if</literal> <replaceable class="parameter">expression</replaceable></term>
        <term><literal>\elif</literal> <replaceable class="parameter">expression</replaceable></term>

Title: psql Meta-Commands: \gx, \help, \html, \include, and \if
Summary
This section details the `psql` meta-commands `\gx`, `\help`, `\html`, `\include`, and `\if`. * `\gx`: Forces expanded output mode for a query, equivalent to `\g` with `expanded=on`. * `\help`: Provides syntax help for SQL commands. If no command is specified, it lists available commands; if `*` is used, it shows help for all SQL commands. The entire line is taken as arguments, without variable interpolation or backquote expansion. * `\html`: Toggles HTML query output format. It switches back to the default aligned text format if HTML is already on. This command is for compatibility and convenience, but see `\pset` about setting other output options. * `\include`: Reads and executes input from a specified file as if typed on the keyboard. Using `-` as the filename reads from standard input until EOF or `\q`. Readline behavior is only active at the outermost level. * `\if`: Conditional command.