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

From Curt Sampson
Subject Re: Check Constraints and pg_dump
Date
Msg-id Pine.NEB.4.58.0403030823490.5580@angelic-vtfw.cvpn.cynic.net
Whole thread Raw
In response to Re: Check Constraints and pg_dump  (Robert Treat <xzilla@users.sourceforge.net>)
List 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
alllight.  --XTC
 


pgsql-hackers by date:

Previous
From: "Simon Riggs"
Date:
Subject: Re: Out of space situation and WAL log pre-allocation (was Tablespaces)
Next
From: 帅猛
Date:
Subject: docs on tsearch2