Home Explore Blog CI



postgresql

2nd chunk of `doc/src/sgml/ref/pg_dump.sgml`
923723dc891d6f903289a240caaa2b97dc4619ff877f8ce30000000100000fa0
 restored. The most flexible output file formats are
   the <quote>custom</quote> format (<option>-Fc</option>) and the
   <quote>directory</quote> format (<option>-Fd</option>). They allow
   for selection and reordering of all archived items, support parallel
   restoration, and are compressed by default. The <quote>directory</quote>
   format is the only format that supports parallel dumps.
  </para>

  <para>
   While running <application>pg_dump</application>, one should examine the
   output for any warnings (printed on standard error), especially in
   light of the limitations listed below.
  </para>

 </refsect1>

 <refsect1 id="pg-dump-options">
  <title>Options</title>

  <para>
    The following command-line options control the content and
    format of the output.

    <variablelist>
     <varlistentry>
      <term><replaceable class="parameter">dbname</replaceable></term>
      <listitem>
       <para>
        Specifies the name of the database to be dumped.  If this is
        not specified, the environment variable
        <envar>PGDATABASE</envar> is used.  If that is not set, the
        user name specified for the connection is used.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-a</option></term>
      <term><option>--data-only</option></term>
      <listitem>
       <para>
        Dump only the data, not the schema (data definitions) or statistics.
        Table data, large objects, and sequence values are dumped.
       </para>

       <para>
        This option is similar to, but for historical reasons not identical
        to, specifying <option>--section=data</option>.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-b</option></term>
      <term><option>--large-objects</option></term>
      <term><option>--blobs</option> (deprecated)</term>
      <listitem>
       <para>
        Include large objects in the dump.  This is the default behavior
        except when <option>--schema</option>, <option>--table</option>,
        <option>--schema-only</option>, <option>--statistics-only</option>, or
        <option>--no-data</option> is specified.  The <option>-b</option>
        switch is therefore only useful to add large objects to dumps where a
        specific schema or table has been requested.  Note that large objects
        are considered data and therefore will be included when
        <option>--data-only</option> is used, but not when
        <option>--schema-only</option> or <option>--statistics-only</option>
        is.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-B</option></term>
      <term><option>--no-large-objects</option></term>
      <term><option>--no-blobs</option> (deprecated)</term>
      <listitem>
       <para>
        Exclude large objects in the dump.
       </para>

       <para>
        When both <option>-b</option> and <option>-B</option> are given, the behavior
        is to output large objects, when data is being dumped, see the
        <option>-b</option> documentation.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-c</option></term>
      <term><option>--clean</option></term>
      <listitem>
       <para>
        Output commands to <command>DROP</command> all the dumped
        database objects prior to outputting the commands for creating them.
        This option is useful when the restore is to overwrite an existing
        database.  If any of the objects do not exist in the destination
        database, ignorable error messages will be reported during
        restore, unless <option>--if-exists</option> is also specified.
       </para>

       <para>
        This option is ignored when emitting an archive (non-text) output
        file.  For the archive formats, you can specify the option when you
        call <command>pg_restore</command>.
       </para>
      </listitem>
 

Title: pg_dump Options: Controlling Output Content and Format
Summary
This section details the command-line options for pg_dump that control the content and format of the output. Options include specifying the database name (dbname), dumping only data (--data-only), including or excluding large objects (--large-objects, --no-large-objects), and outputting commands to drop database objects before creating them (--clean). The --clean option is ignored for archive output files and must be specified during pg_restore.