Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Order of inserts in dump file

Status
Not open for further replies.

pgosse

Programmer
Sep 26, 2001
42
0
0
CA
Hi everyone. I've got a quick question regarding the order of insert statements generated by pg_dump.

Here's my pg_dump statement:

pg_dump -v -D cms -f cms.data.dump

For the most part everything works okay, but it seems to be buggering up some of the relationships when it's doing the dump.

For example, I have a table cms_areas which has the primary key a_id, and a field named parent which is a foreign key to a_id in the same table.

Now, when restoring from the dump file I got an error and upon examination of the contents of the file I noticed that some of the inserts are ordered incorrectly.

For example, the row with a_id=25 and parent=1 is executed before the row with a_id=1 and parent=null.

Obviously this will not work, since the first insert requires a foreign key which is not yet present.

It only seemed to happen in a few places and I was able to fix it with minimal effort by manually reordering the inserts in the dump file, but it seems strange that pg_dump would ignore this relationship when creating the dump file.

Can anyone give me any advice as to what could be causing this?

Cheers,
Pablo


Also, I want to pass along huge props to people on this list who have been an indispensable resource as I developed our CMS (Leland123 and Rycamor are two who immediately come to mind; to anyone whose name I can't recall right now your help equally was and is appreciated). You guys will probably see an item or two ticked off your "wish lists" in the near future. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top