Home Explore Blog CI



postgresql

44th chunk of `doc/src/sgml/ref/psql-ref.sgml`
ca6e62934d64b96c8b8ad4d891735b696bef03fc10c3d2840000000100000fa7
 </varlistentry>

      <varlistentry id="app-psql-meta-command-lo-list">
        <term><literal>\lo_list[x+]</literal></term>
        <listitem>
        <para>
        Shows a list of all <productname>PostgreSQL</productname>
        large objects currently stored in the database,
        along with any comments provided for them.
        If <literal>x</literal> is appended to the command name, the results
        are displayed in expanded mode.
        If <literal>+</literal> is appended to the command name,
        each large object is listed with its associated permissions,
        if any.
        </para>
        </listitem>
      </varlistentry>

      <varlistentry id="app-psql-meta-command-lo-unlink">
        <term><literal>\lo_unlink <replaceable class="parameter">loid</replaceable></literal></term>

        <listitem>
        <para>
        Deletes the large object with <acronym>OID</acronym>
        <replaceable class="parameter">loid</replaceable> from the
        database.
        </para>

        <tip>
        <para>
        Use <command>\lo_list</command> to find out the large object's
        <acronym>OID</acronym>.
        </para>
        </tip>
        </listitem>
      </varlistentry>


      <varlistentry id="app-psql-meta-command-out">
        <term><literal>\o</literal> or <literal>\out [ <replaceable class="parameter">filename</replaceable> ]</literal></term>
        <term><literal>\o</literal> or <literal>\out [ |<replaceable class="parameter">command</replaceable> ]</literal></term>
        <listitem>
        <para>
        Arranges to save future query results to the file <replaceable
        class="parameter">filename</replaceable> or pipe future results
        to the shell command <replaceable
        class="parameter">command</replaceable>. If no argument is
        specified, the query output is reset to the standard output.
        </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>

        <para>
        <quote>Query results</quote> includes all tables, command
        responses, and notices obtained from the database server, as
        well as output of various backslash commands that query the
        database (such as <command>\d</command>); but not error
        messages.
        </para>

        <tip>
        <para>
        To intersperse text output in between query results, use
        <command>\qecho</command>.
        </para>
        </tip>
        </listitem>
      </varlistentry>


      <varlistentry id="app-psql-meta-command-print">
        <term><literal>\p</literal> or <literal>\print</literal></term>
        <listitem>
        <para>
        Print the current query buffer to the standard output.
        If the current query buffer is empty, the most recently executed query
        is printed instead.
        </para>
        </listitem>
      </varlistentry>

      <varlistentry id="app-psql-meta-command-parse">
        <term><literal>\parse <replaceable class="parameter">statement_name</replaceable></literal></term>
        <listitem>
        <para>
         Creates a prepared statement from the current query buffer, based on
         the name of a destination prepared-statement object. An empty string
         denotes the unnamed prepared statement.
        </para>

        <para>
         Example:
<programlisting>
SELECT $1 \parse stmt1
</programlisting>
        </para>

        <para>
         This command causes the extended query protocol to be used, unlike
         normal <application>psql</application> operation, which uses the
         simple query protocol. A
         <xref linkend="protocol-message-formats-Parse"/>
         message

Title: psql Meta-Commands: \lo_list, \lo_unlink, \o/\out, \p/\print, \parse
Summary
This section describes several psql meta-commands. `\lo_list` lists large objects with optional expanded mode and permissions. `\lo_unlink` deletes a large object. `\o` or `\out` saves future query results to a file or pipes them to a shell command. `\p` or `\print` prints the current query buffer or the most recently executed query. `\parse` creates a prepared statement from the current query buffer.