Re: Constraints & pg_dump - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Constraints & pg_dump
Date
Msg-id 21995.1079508980@sss.pgh.pa.us
Whole thread Raw
In response to Re: Constraints & pg_dump  (Josh Berkus <josh@agliodbs.com>)
Responses Re: Constraints & pg_dump  (Andrew Dunstan <andrew@dunslane.net>)
Re: Constraints & pg_dump  (Josh Berkus <josh@agliodbs.com>)
List pgsql-hackers
Josh Berkus <josh@agliodbs.com> writes:
>> Isn't this already solved by dumping in dependency order?

> Nope.   Problem is, the table depends on the function, and the function 
> depends on the table.   pg_dump (in 7.4.1, at least) will dump the table 
> first, *with the constraint*, and then the function ... causing table 
> creation to fail.

Um ... by "already" I meant "in CVS tip", not "in 7.4.*".  So I'm not
quite sure whether your issue is still live or not.  But I'll guess
anyway:

> And this isn't come cross-table function either; the constraint that they're 
> implementing is partial uniqueness, which is appropriate for a constraint.  

Is it?  Our present handling of CHECK constraints cannot reasonably be
thought to support anything but row-local constraints.  If they're using
a function to make an end-run around the check that prohibits subselects
in CHECK constraints, then their problems are much more serious than
whether pg_dump dumps the database in an order that manages to avoid
failure.  That kind of constraint just plain does not work, because it
won't get rechecked when the implicitly referenced rows change.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Constraints & pg_dump
Next
From: "Dave Page"
Date:
Subject: Re: Doxygen?