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.