pg_dump | pg_sql: insert commands and foreign key constraints

From: William Garrison <postgres(at)mobydisk(dot)com>
To: Postgres General List <pgsql-general(at)postgresql(dot)org>
Subject: pg_dump | pg_sql: insert commands and foreign key constraints
Date: 2008-09-23 17:03:25
Message-ID: 48D9215D.9060303@mobydisk.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have several .SQL files created from pg_dump, and I find that when I
feed them into psql that I get tons of foreign key errors because the
INSERT statements in the dump are not in the correct order. After
reading the docs, mailing lists, and googling, I see posts saying this
problem was fixed back in the 7.x days. I'm using postgres 8.2.9. This
database doesn't do any "unusual" foreign key constraints like check
constraints, functions in the constraints, or circular foreign keys.
From the looks of the SQL dump, it is just simply in the wrong order
(it might even be alphabetical... the first table starts with c. But I
haven't looked at the entire 26GB dump to see if that is the case).

Since I did a data only dump, I think my only option is to create the
schema, manually disable all the constraints, then restore, then
re-enable the constraints. I'm looking for 2 things:

1) other workarounds
2) someone else who can confirm that this bug is either fixed, or not
fixed. If it is supposedly fixed, then I guess I need to make a smaller
version of my database to demonstrate the problem.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alan Hodgson 2008-09-23 17:59:57 Re: pg_dump | pg_sql: insert commands and foreign key constraints
Previous Message William Garrison 2008-09-23 16:58:29 Re: Error in ALTER DATABASE command