Re: Check Constraints and pg_dump

From: Curt Sampson <cjs(at)cynic(dot)net>
To: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Check Constraints and pg_dump
Date: 2004-03-02 23:25:07
Message-ID: Pine.NEB.4.58.0403030823490.5580@angelic-vtfw.cvpn.cynic.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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(at)cynic(dot)net> +81 90 7737 2974 http://www.NetBSD.org
Don't you know, in this new Dark Age, we're all light. --XTC

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2004-03-03 00:01:11 Re: WAL Optimisation - configuration and usage
Previous Message Simon Riggs 2004-03-02 22:53:09 Re: Out of space situation and WAL log pre-allocation (was Tablespaces)