Home Explore Blog CI



postgresql

43th chunk of `doc/src/sgml/ref/psql-ref.sgml`
59e0fc752368c5c421d11ea21ebdf93e4c970b1b8312d2ac0000000100000fa0
 class="parameter">pattern</replaceable></link> ]</literal></term>
        <listitem>
        <para>
        List the databases in the server and show their names, owners,
        character set encodings, and access privileges.
        If <replaceable class="parameter">pattern</replaceable> is specified,
        only databases whose names match the pattern are listed.
        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, database
        sizes, default tablespaces, and descriptions are also displayed.
        (Size information is only available for databases that the current
        user can connect to.)
        </para>
        </listitem>
      </varlistentry>


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

        <listitem>
        <para>
        Reads the large object with <acronym>OID</acronym> <replaceable
        class="parameter">loid</replaceable> from the database and
        writes it to <replaceable
        class="parameter">filename</replaceable>. Note that this is
        subtly different from the server function
        <function>lo_export</function>, which acts with the permissions
        of the user that the database server runs as and on the server's
        file system.
        </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-lo-import">
        <term><literal>\lo_import <replaceable class="parameter">filename</replaceable> [ <replaceable class="parameter">comment</replaceable> ]</literal></term>

        <listitem>
        <para>
        Stores the file into a <productname>PostgreSQL</productname>
        large object. Optionally, it associates the given
        comment with the object. Example:
<programlisting>
foo=&gt; <userinput>\lo_import '/home/peter/pictures/photo.xcf' 'a picture of me'</userinput>
lo_import 152801
</programlisting>
        The response indicates that the large object received object
        ID 152801, which can be used to access the newly-created large
        object in the future. For the sake of readability, it is
        recommended to always associate a human-readable comment with
        every object. Both OIDs and comments can be viewed with the
        <command>\lo_list</command> command.
        </para>

        <para>
        Note that this command is subtly different from the server-side
        <function>lo_import</function> because it acts as the local user
        on the local file system, rather than the server's user and file
        system.
        </para>
        </listitem>
      </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.
       

Title: psql Meta-Commands: \l, \lo_export, \lo_import, \lo_list, \lo_unlink
Summary
This section details the psql meta-commands for large objects and database listing. `\l` or `\list` lists databases with options for expanded mode and details. `\lo_export` exports a large object to a file. `\lo_import` imports a file into a large object, optionally with a comment. `\lo_list` lists large objects with optional expanded mode and permissions. `\lo_unlink` deletes a large object.