Home Explore Blog CI



postgresql

9th chunk of `doc/src/sgml/ref/pg_dump.sgml`
b8d520e030eba4fa52c5090b754498e913ebc99c0b14be130000000100000fa0
 according to the same rules used by
        <application>psql</application>'s <literal>\d</literal> commands
        (see <xref linkend="app-psql-patterns"/>),
        so multiple tables can also be selected by writing wildcard characters
        in the pattern.  When using wildcards, be careful to quote the pattern
        if needed to prevent the shell from expanding the wildcards;  see
        <xref linkend="pg-dump-examples"/> below.
       </para>

       <para>
        As well as tables, this option can be used to dump the definition of matching
        views, materialized views, foreign tables, and sequences.  It will not dump the
        contents of views or materialized views, and the contents of foreign tables will
        only be dumped if the corresponding foreign server is specified with
        <option>--include-foreign-data</option>.
       </para>

       <para>
        The <option>-n</option> and <option>-N</option> switches have no effect when
        <option>-t</option> is used, because tables selected by <option>-t</option> will
        be dumped regardless of those switches, and non-table objects will not
        be dumped.
       </para>

       <note>
        <para>
         When <option>-t</option> is specified, <application>pg_dump</application>
         makes no attempt to dump any other database objects that the selected
         table(s) might depend upon. Therefore, there is no guarantee
         that the results of a specific-table dump can be successfully
         restored by themselves into a clean database.
        </para>
       </note>

      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-T <replaceable class="parameter">pattern</replaceable></option></term>
      <term><option>--exclude-table=<replaceable class="parameter">pattern</replaceable></option></term>
      <listitem>
       <para>
        Do not dump any tables matching <replaceable
        class="parameter">pattern</replaceable>.  The pattern is
        interpreted according to the same rules as for <option>-t</option>.
        <option>-T</option> can be given more than once to exclude tables
        matching any of several patterns.
       </para>

       <para>
        When both <option>-t</option> and <option>-T</option> are given, the behavior
        is to dump just the tables that match at least one <option>-t</option>
        switch but no <option>-T</option> switches.  If <option>-T</option> appears
        without <option>-t</option>, then tables matching <option>-T</option> are
        excluded from what is otherwise a normal dump.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-v</option></term>
      <term><option>--verbose</option></term>
      <listitem>
       <para>
        Specifies verbose mode.  This will cause
        <application>pg_dump</application> to output detailed object
        comments and start/stop times to the dump file, and progress
        messages to standard error.
        Repeating the option causes additional debug-level messages
        to appear on standard error.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
       <term><option>-V</option></term>
       <term><option>--version</option></term>
       <listitem>
       <para>
       Print the <application>pg_dump</application> version and exit.
       </para>
       </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-x</option></term>
      <term><option>--no-privileges</option></term>
      <term><option>--no-acl</option></term>
      <listitem>
       <para>
        Prevent dumping of access privileges (grant/revoke commands).
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-Z <replaceable class="parameter">level</replaceable></option></term>
      <term><option>-Z <replaceable class="parameter">method</replaceable></option>[:<replaceable>detail</replaceable>]</term>

Title: pg_dump Options: Table Selection Details, Exclusion, Verbose Mode, Version, and Privileges
Summary
This section continues the pg_dump options discussion, focusing on `-t/--table` and its interaction with `-n` and `-N` (which have no effect). It notes that `-t` doesn't dump dependent objects, potentially leading to restore failures in a clean database. Next, `-T/--exclude-table` excludes tables matching a given pattern (using the same rules as `-t`). It elaborates on the combined use of `-t` and `-T`, where only tables matching `-t` but not `-T` are dumped. `-v/--verbose` enables verbose mode, providing detailed comments and progress messages. Repeated use increases debug-level messages. `-V/--version` prints the pg_dump version and exits. Finally, `-x/--no-privileges/--no-acl` prevents the dumping of access privileges.