pg_dump and ON DELETE CASCADE problem - Mailing list pgsql-general

From CG
Subject pg_dump and ON DELETE CASCADE problem
Date
Msg-id 680164.33710.qm@web37904.mail.mud.yahoo.com
Whole thread Raw
Responses Re: pg_dump and ON DELETE CASCADE problem  (Craig Ringer <craig@postnewspapers.com.au>)
List pgsql-general
Hi all,
 
We're using PostgreSQL 8.4 ... We do our nightly database backups with pg_dump. I was doing a test restore and I encountered some data during the reload that was in a table against the conditions of a foreign key constraint. I run my restores with the "-e" option to halt on errors, so this data halted the restore... I went to check the running database and the row in question had been deleted.
 
I had defined the foreign key to cascade on delete, and I imagine that during the dump the delete occurred on the master table. Perhaps the keyed table had already been dumped so when it came time to dump the master table, the referencing row was not there to be dumped. One would imagine that PostgreSQL would have protections for that sort of thing...
 
Can you think of how I can protect against this in the future?
 
CG

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Problem with SET CONSTRAINTS some_constraint_fkey DEFERRED
Next
From: Radcon Entec
Date:
Subject: pgAdmin in 8.4 installation uses tools from 8.3 installation