By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,728 Members | 1,134 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,728 IT Pros & Developers. It's quick & easy.

pg_dump and circular dependency

P: n/a
Table A has a CHECK constraint testing boolean function F.
Function F has a SELECT from Table A.

In my manual build script, I create the table, then the function, and then at the very end of the script to I do an ALTER TABLE ADD CHECK.

pg_dump appears to put the CHECK constraint as a clause in the CREATE TABLE statement. Now I'm in trouble, because whichever of the table or the function is read in first by pg_restore refers to an object that hasn't been created yet. The restore fails.

I suppose I can replace the CHECK with an explicit trigger (that uses an exception) and then pg_dump will get the creation sequence correct. Is there another way?

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 22 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
an****@pillette.com writes:
Table A has a CHECK constraint testing boolean function F.
Function F has a SELECT from Table A. In my manual build script, I create the table, then the function, and then at the very end of the script to I do an ALTER TABLE ADD CHECK. I suppose I can replace the CHECK with an explicit trigger (that uses an exception) and then pg_dump will get the creation sequence correct. Is there another way?


In 7.4 you could create the function first using SET
check_function_bodies = false. 7.5 will have a proper solution...
pg_dump can now actually detect reference circularities and fix them
by using ALTER ...

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.