Re: Check Constraints and pg_dump
Curt Sampson <cjs@cynic.net>
From: Curt Sampson <cjs@cynic.net>
To: Robert Treat <xzilla@users.sourceforge.net>
Cc: pgsql-hackers@postgresql.org
Date: 2004-03-02T23:25:07Z
Lists: pgsql-hackers
On Tue, 2 Mar 2004, Robert Treat wrote:
> Wouldn't a FK on both tables be the appropriate schema? With the FK on
> contract being deffered?
Unfortunately, it appears that an FK must reference a unique column. So this:
ALTER TABLE contract ADD CONSTRAINT contract_must_have_a_plan
FOREIGN KEY ( contract_id ) REFERENCES plan ( contract_id )
INITIALLY DEFERRED;
produces the error message:
UNIQUE constraint matching given keys for referenced table "plan" not found
Since a plan may have more than one contract.
cjs
--
Curt Sampson <cjs@cynic.net> +81 90 7737 2974 http://www.NetBSD.org
Don't you know, in this new Dark Age, we're all light. --XTC