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  <[EMAIL PROTECTED]>   +81 90 7737 2974   http://www.NetBSD.org
    Don't you know, in this new Dark Age, we're all light.  --XTC

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to