[Dbix-class] Temporarily turn off table constraints in Postgresql?
Darren Duncan
darren at DarrenDuncan.net
Sat Jun 30 05:55:25 GMT 2007
At 5:40 PM -0700 6/29/07, Dennis Daupert wrote:
>I have tables that mutually reference one another, which prevents
>initial addition of data to the tables. EG:
>
>"page_content_version_fkey" FOREIGN KEY (content_version, id)
>REFERENCES content(version, page) ON UPDATE CASCADE ON DELETE CASCADE
>
>"content_page_fkey" FOREIGN KEY (page) REFERENCES page(id) ON UPDATE
>CASCADE ON DELETE CASCADE
>
>Is there a way to temporarily disengage or silence or otherwise
>render harmless those constraints to allow the data load? Postgresql
>81
>
>I tried running the data load inside a transaction, but no joy.
>
>/dennis
Why remove the constraints at all? Just update both tables in a
single statement. Assuming that the constraints only assert between
statement boundaries, then you won't have a problem. -- Darren Duncan
More information about the Dbix-class
mailing list