Re: UNIQUE boolean: only one row may be "true"

Поиск
Список
Период
Сортировка
От chester c young
Тема Re: UNIQUE boolean: only one row may be "true"
Дата
Msg-id 20030506172604.92026.qmail@web12708.mail.yahoo.com
обсуждение исходный текст
Ответ на UNIQUE boolean: only one row may be "true"  (Randall Lucas <rlucas@tercent.net>)
Список 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 по дате отправления:

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: UNIQUE boolean: only one row may be "true"
Следующее
От: Michael A Nachbaur
Дата:
Сообщение: Re: pgsql Replication Proxy (was Re: Replication for a