pg_dump and circular dependency

From: andrew(at)pillette(dot)com
To: pgsql-general(at)postgresql(dot)org
Subject: pg_dump and circular dependency
Date: 2004-02-16 22:28:49
Message-ID: 200402162228.i1GMSnE11453@pillette.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Troy Campano 2004-02-17 00:07:13 Re: [ADMIN] create ONE database beyond between 2 server
Previous Message Stephan Szabo 2004-02-16 21:56:58 Re: Cascade delete triggers change user credentials