Home Explore Blog CI



postgresql

8th chunk of `doc/src/sgml/ref/pg_restore.sgml`
022d5d3eaeacef4de7c9f889107bf1a2ec8eeed348bf0c9d0000000100000fc6
 restore as a single transaction (that is, wrap the
        emitted commands in <command>BEGIN</command>/<command>COMMIT</command>).  This
        ensures that either all the commands complete successfully, or no
        changes are applied. This option implies
        <option>--exit-on-error</option>.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>--disable-triggers</option></term>
      <listitem>
       <para>
        This option is relevant only when performing a restore without schema.
        It instructs <application>pg_restore</application> to execute commands
        to temporarily disable triggers on the target tables while
        the data is restored.  Use this if you have referential
        integrity checks or other triggers on the tables that you
        do not want to invoke during data restore.
       </para>

       <para>
        Presently, the commands emitted for
        <option>--disable-triggers</option> must be done as superuser.  So you
        should also specify a superuser name with <option>-S</option> or,
        preferably, run <application>pg_restore</application> as a
        <productname>PostgreSQL</productname> superuser.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>--enable-row-security</option></term>
      <listitem>
       <para>
        This option is relevant only when restoring the contents of a table
        which has row security.  By default, <application>pg_restore</application> will set
        <xref linkend="guc-row-security"/> to off, to ensure
        that all data is restored in to the table.  If the user does not have
        sufficient privileges to bypass row security, then an error is thrown.
        This parameter instructs <application>pg_restore</application> to set
        <xref linkend="guc-row-security"/> to on instead, allowing the user to attempt to restore
        the contents of the table with row security enabled.  This might still
        fail if the user does not have the right to insert the rows from the
        dump into the table.
       </para>

       <para>
        Note that this option currently also requires the dump be in <command>INSERT</command>
        format, as <command>COPY FROM</command> does not support row security.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>--exclude-database=<replaceable class="parameter">pattern</replaceable></option></term>
      <listitem>
       <para>
        Do not restore databases whose name matches
        <replaceable class="parameter">pattern</replaceable>.
        Multiple patterns can be excluded by writing multiple
        <option>--exclude-database</option> switches.  The
        <replaceable class="parameter">pattern</replaceable> parameter is
        interpreted as a pattern according to the same rules used by
        <application>psql</application>'s <literal>\d</literal>
        commands (see <xref linkend="app-psql-patterns"/>),
        so multiple databases can also be excluded by writing wildcard
        characters in the pattern.  When using wildcards, be careful to
        quote the pattern if needed to prevent shell wildcard expansion.
       </para>
       <para>
        This option is only relevant when restoring from an archive made using <application>pg_dumpall</application>.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>--filter=<replaceable class="parameter">filename</replaceable></option></term>
      <listitem>
       <para>
        Specify a filename from which to read patterns for objects excluded
        or included from restore. The patterns are interpreted according to the
        same rules as
        <option>-n</option>/<option>--schema</option> for including objects in schemas,
        <option>-N</option>/<option>--exclude-schema</option> for excluding objects in schemas,
        <option>-P</option>/<option>--function</option>

Title: pg_restore Options: Transactions (cont.), Disabling Triggers (cont.), Row Security, Excluding Databases, and Filters
Summary
This section describes additional pg_restore options. It discusses executing a restore within a single transaction, the use of superuser privileges when disabling triggers, enabling row security during table content restoration, excluding databases based on a pattern (relevant for pg_dumpall archives), and filtering objects for inclusion or exclusion using a file.