Home Explore Blog CI



postgresql

14th chunk of `doc/src/sgml/ref/pg_dump.sgml`
76035ae67a4a2d005135b52f81dfaa7946efabd75a50d94b0000000100000fbb
 The second keyword specifies the type
        of object to be filtered using the pattern:
        <itemizedlist>
         <listitem>
          <para>
           <literal>extension</literal>: extensions. This works like the
           <option>-e</option>/<option>--extension</option> or
           <option>--exclude-extension</option> option.
          </para>
         </listitem>
         <listitem>
          <para>
           <literal>foreign_data</literal>: data on foreign servers. This works like
           the <option>--include-foreign-data</option> option. This keyword can
           only be used with the <literal>include</literal> keyword.
          </para>
         </listitem>
         <listitem>
          <para>
           <literal>table</literal>: tables. This works like the
           <option>-t</option>/<option>--table</option> or
           <option>-T</option>/<option>--exclude-table</option> option.
          </para>
         </listitem>
         <listitem>
          <para>
           <literal>table_and_children</literal>: tables including any partitions
           or inheritance child tables. This works like the
           <option>--table-and-children</option> or
           <option>--exclude-table-and-children</option> option.
          </para>
         </listitem>
         <listitem>
          <para>
           <literal>table_data</literal>: table data of any tables matching
           <replaceable>pattern</replaceable>. This works like the
           <option>--exclude-table-data</option> option. This keyword can only
           be used with the <literal>exclude</literal> keyword.
          </para>
         </listitem>
         <listitem>
          <para>
           <literal>table_data_and_children</literal>: table data of any tables
           matching <replaceable>pattern</replaceable> as well as any partitions
           or inheritance children of the table(s). This works like the
           <option>--exclude-table-data-and-children</option> option. This
           keyword can only be used with the <literal>exclude</literal> keyword.
          </para>
         </listitem>
         <listitem>
          <para>
           <literal>schema</literal>: schemas. This works like the
           <option>-n</option>/<option>--schema</option> or
           <option>-N</option>/<option>--exclude-schema</option> option.
          </para>
         </listitem>
        </itemizedlist>
       </para>

       <para>
        Lines starting with <literal>#</literal> are considered comments and
        ignored. Comments can be placed after an object pattern row as well.
        Blank lines are also ignored. See <xref linkend="app-psql-patterns"/>
        for how to perform quoting in patterns.
       </para>

       <para>
        Example files are listed below in the <xref linkend="pg-dump-examples"/>
        section.
       </para>

      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>--if-exists</option></term>
      <listitem>
       <para>
        Use <literal>DROP ... IF EXISTS</literal> commands to drop objects
        in <option>--clean</option> mode.  This suppresses <quote>does not
        exist</quote> errors that might otherwise be reported.  This
        option is not valid unless <option>--clean</option> is also
        specified.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>--include-foreign-data=<replaceable class="parameter">foreignserver</replaceable></option></term>
      <listitem>
       <para>
        Dump the data for any foreign table with a foreign server
        matching <replaceable class="parameter">foreignserver</replaceable>
        pattern. Multiple foreign servers can be selected by writing multiple
        <option>--include-foreign-data</option> switches.
        Also, the <replaceable class="parameter">foreignserver</replaceable> parameter is
        interpreted as a pattern according to the same rules used by
        <application>psql</application>'s

Title: pg_dump Options: `--filter` (Continued) and `--if-exists`, `--include-foreign-data`
Summary
This section continues describing the `--filter` option for pg_dump, detailing the object types (extension, foreign_data, table, table_and_children, table_data, table_data_and_children, schema) that can be filtered and their corresponding pg_dump options. It also explains that lines starting with '#' are treated as comments and ignored, and refers to examples in the pg_dump examples section. Furthermore, it describes the `--if-exists` option, which adds `DROP ... IF EXISTS` commands in `--clean` mode, and the `--include-foreign-data` option, which dumps data for foreign tables matching a specified foreign server pattern, allowing multiple servers to be selected.