Tom Lane wrote:
>Rod Taylor <pg@rbt.ca> writes:
>
>
>>Well.. the second one will be much slower when the foreign keys verify.
>>Primary, unique constraints I'll buy in the create statement. Check
>>constraints and defaults are a little fuzzier.
>>
>>
>
>FK, primary, and unique constraints are already split out from the
>CREATE TABLE for performance reasons. We could think about folding them
>back in in a schema-only dump, but in a full dump I don't think it's
>negotiable --- you really want to load the table data before you install
>these constraints.
>
>
IMHO here we have opposite requirements: The dump/restore process should
run as fast as possible, so constraints have to be generated separately,
but pg_dump is also used to reengineer and slightly modify the schema,
where it's helpful if definitions are grouped. I've been asked for
complete schema extraction features in pgAdmin3, and I replied 'use
pg_dump'. It seems that pg_dump tries to serve both requirements, being
a compromise where two dedicated tools could do it better.
Regards,
Andreas