Re: UNIQUE boolean: only one row may be "true" - Mailing list pgsql-sql

From chester c young
Subject Re: UNIQUE boolean: only one row may be "true"
Date
Msg-id 20030506172604.92026.qmail@web12708.mail.yahoo.com
Whole thread Raw
In response to UNIQUE boolean: only one row may be "true"  (Randall Lucas <rlucas@tercent.net>)
List pgsql-sql
> How shall I create a constraint such that only one row may be 'true'?

Instead of, or along with your pg boolean, use a C type boolean where
true is 1 and false is null: ... col_tf int check( col_tf = 1 || col_tf is null ) unique, ...
a kludge to be sure, but works

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com



pgsql-sql by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: UNIQUE boolean: only one row may be "true"
Next
From: Michael A Nachbaur
Date:
Subject: Re: pgsql Replication Proxy (was Re: Replication for a