Re: partial unique constraint

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: partial unique constraint
Дата
Msg-id 24888.1081264623@sss.pgh.pa.us
обсуждение исходный текст
Ответ на partial unique constraint  (Robert Treat <xzilla@users.sourceforge.net>)
Ответы Re: partial unique constraint  (Robert Treat <xzilla@users.sourceforge.net>)
Список pgsql-sql
Robert Treat <xzilla@users.sourceforge.net> writes:
> Trying to come up with the proper syntax to meet the following criteria:
> create table foo (bar integer, baz boolean UNIQUE (bar, baz = true)); 

The correct way to do it is with a separate CREATE INDEX command:

create table foo (bar integer, baz boolean);
create unique index fooi on foo (bar) where baz = true;

Personally I'd spell that last as just "where baz" ...
        regards, tom lane


В списке pgsql-sql по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: could not devise a query plan
Следующее
От: Achilleus Mantzios
Дата:
Сообщение: Re: partial unique constraint