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

From Robert Treat
Subject Re: Check Constraints and pg_dump
Date
Msg-id 200403020945.03031.xzilla@users.sourceforge.net
Whole thread Raw
In response to Re: Check Constraints and pg_dump  (Curt Sampson <cjs@cynic.net>)
Responses Re: Check Constraints and pg_dump  (Bruno Wolff III <bruno@wolff.to>)
Re: Check Constraints and pg_dump  (Curt Sampson <cjs@cynic.net>)
List pgsql-hackers
On Monday 01 March 2004 22:59, Curt Sampson wrote:
> On Mon, 1 Mar 2004, Tom Lane wrote:
> > Curt Sampson <cjs@cynic.net> writes:
> > > Can you explain how to do this? There is no reference to a plan in the
> > > contract table; the constraint just checks to see that, if a contract
> > > exists, there is at least one plan referencing that contract.
> > > There is of course a foreign key constraint used in the plan table to
> > > make sure that the contract exists.
> >
> > If so, how would it be possible to create a plan before creating the
> > contract?  I don't think the OP's requirements are clearly thought out.
>
> You create the contract and its first plan at the same time, inserting
> the plan first. It works fine.
>
<snip>
> > In the meantime, if what's wanted is a one-time check at row insertion,
> > the right way to express that behavior is with an ON INSERT trigger.
>
> That's not an adequate check; it would allow you later to delete the
> plan without deleting the contract.
>

Wouldn't a FK on both tables be the appropriate schema?  With the FK on 
contract being deffered?

Robert Treat
-- 
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL


pgsql-hackers by date:

Previous
From: ivan
Date:
Subject: Re: lib for clients
Next
From: Stephan Szabo
Date:
Subject: Re: [PATCHES] Foreign key type checking patch