Re: Each foo must have a bar

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: David Fetter <david(at)fetter(dot)org>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Each foo must have a bar
Date: 2006-02-11 21:59:48
Message-ID: 20060211215948.GA61030@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Feb 11, 2006 at 12:56:36PM -0800, David Fetter wrote:
> I'm trying to figure out how to enforce the following. Table foo has
> a primary key. Table bar has a foreign key to foo. So far so good.
> I'd also like to say, "for each row in foo, there must be at least one
> row in bar."

Possibly something involving CREATE CONSTRAINT TRIGGER, specifying
DEFERRABLE INITIALLY DEFERRED? The documentation says it's not for
general use; I've used it only in simple experiments so I'm not
sure how problematic it could be. Anybody?

--
Michael Fuhr

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Fetter 2006-02-11 22:52:14 Re: Each foo must have a bar
Previous Message David Fetter 2006-02-11 20:56:36 Each foo must have a bar