Re: Constraint Problem - Mailing list pgsql-general

From Tom Lane
Subject Re: Constraint Problem
Date
Msg-id 15394.1067795295@sss.pgh.pa.us
Whole thread Raw
In response to Constraint Problem  (Ron St-Pierre <rstpierre@syscor.com>)
Responses Re: Constraint Problem  (Ron St-Pierre <rstpierre@syscor.com>)
Re: Constraint Problem  (Ron St-Pierre <rstpierre@syscor.com>)
List pgsql-general
Ron St-Pierre <rstpierre@syscor.com> writes:
> 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.

You could do that with a partial unique index.  There is an example
at the bottom of
http://www.postgresql.org/docs/7.3/static/indexes-partial.html

            regards, tom lane

pgsql-general by date:

Previous
From: Ron St-Pierre
Date:
Subject: Constraint Problem
Next
From: Ryan Mack
Date:
Subject: PostgreSQL License Question