Constraint Problem

From: Ron St-Pierre <rstpierre(at)syscor(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Constraint Problem
Date: 2002-11-02 17:36:45
Message-ID: 3DC40D2D.3070409@syscor.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I want to create a constraint that's a little different, but don't know
how to implement it. I have an intermediate table with a compound PK and
a boolean 'ysnDefault' column:

comanyID INTEGER REFERENCES companies,
assocationID INTEGER REFERENCES associations,
ysnDefault BOOLEAN

I just want to constrain the ysnDefault field to only allow one TRUE
value for any companyID/associationID pair, with no restrictions on the
number of FALSES.

At first glance I thought it would be easy, but I can't see how to do
it. Any suggestions?

Thanks
Ron

Responses

Browse pgsql-general by date

  From Date Subject
Next Message am 2002-11-02 19:33:43 Re: Cursors: getting the number of tuples; moving backwards
Previous Message Greg Patnude 2002-11-02 17:08:06 Re: Inserting streamed data