Re: pg_restore man page question - Mailing list pgsql-general

From David G. Johnston
Subject Re: pg_restore man page question
Date
Msg-id CAKFQuwZLGKE3Q2fn9t8Dded2WJK20T37A4YHHXJSBgyoUdv2hQ@mail.gmail.com
Whole thread Raw
In response to pg_restore man page question  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Responses Re: pg_restore man page question  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
List pgsql-general
On Mon, Mar 7, 2016 at 10:17 AM, Karsten Hilbert <Karsten.Hilbert@gmx.net> wrote:
The man page of pg_restore says

        --disable-triggers
                This option is relevant only when performing a
                data-only restore. It instructs pg_restore to execute
                commands to temporarily disable triggers on the
                target tables while the data is reloaded. [...]

This hint seems overly narrow: when doing a restore of schema
PLUS data (IOW, not a schema-only restore) it should apply,
too, shouldn't it ?

Otherwise it would suggest that pg_restore does this:

- restore basic table structure
- restore data
- restore constraints and triggers and ...

... ​indexes​
 

​Why is the surprising?  When restoring everything it is able to "cheat" since it knows that what it is restoring is a self-consistent state of being and as such there is no need or desire to fire triggers, check constraints, or maintain indexes, as the data is being loaded.  I'm not positive on the exact mechanics but observation and Josh's comment cross-thread support this explanation.

It can be readily checked by passing the --list option to pg_restore.

David J.

pgsql-general by date:

Previous
From: Geoff Winkless
Date:
Subject: Re: index problems (again)
Next
From: Karsten Hilbert
Date:
Subject: Re: pg_restore man page question