Jani Averbach <jaa@jaa.iki.fi> writes:
> the following won't work:
> 4) Dump only data from just created 8.0 database:
> pg_dump \
> "--data-only" \
> "--column-inserts" \
> "--use-set-session-authorization" \
> new_db > new_db.data-only.dump
> 5) Re-Create the new_db:
> dropdb new_db; createdb new_db
> CreateDBSchema.sh new_db
> 6) Try to reload data which was dumped from new ver 8.0 database:
> psql new_db < new_db.data-only.dump
> This will fail with lots of these kinds of errors:
> ERROR: insert or update on table "mytable"
> violates foreign key constraint "mytable_myattr_fkey"
Try it with --disable-triggers.
> Or have I found an ordering bug with pg_dump
> when you are doing "--data-only" dumps?
No. pg_dump can't guarantee a safe order for loading data when there
are pre-existing foreign key constraints in place (since the constraints
could be circular, and it wouldn't necessarily know what they are anyway).
So it doesn't try. You have to use --disable-triggers instead.
regards, tom lane