Re: Check Constraints and pg_dump - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Check Constraints and pg_dump
Date
Msg-id 11619.1077803699@sss.pgh.pa.us
Whole thread Raw
In response to Check Constraints and pg_dump  (Jonathan Scott <jwscott@vanten.com>)
Responses Re: Check Constraints and pg_dump  (Jonathan Scott <jwscott@vanten.com>)
Re: Check Constraints and pg_dump  (Curt Sampson <cjs@cynic.net>)
List pgsql-hackers
Jonathan Scott <jwscott@vanten.com> writes:
> The functions and tables create just fine, but when it gets to the
> COPY part of the sql script, it tries to load tables in what really is
> the wrong order. The check constraint is making sure there is a "plan"
> before there is a "contract", yet pg_dump is trying to load the
> contract table before there is anything in the plan table.

Shouldn't you be using a foreign key for that?

I don't see any reasonable way that pg_dump can be expected to
understand that a check constraint expresses a relationship between two
tables.  The semantics of check constraints aren't right for it anyway.

All else being equal, I think the tables will be loaded in OID order,
so a possible workaround is to create the plan table first.  But an
FK seems like a better answer.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Karel Zak
Date:
Subject: ORDER BY different locales
Next
From: Tom Lane
Date:
Subject: Re: ORDER BY different locales