Re: Neither column can be NULL if the column is part of the combination of primary key columns?

Поиск
Список
Период
Сортировка
От Jaime Casanova
Тема Re: Neither column can be NULL if the column is part of the combination of primary key columns?
Дата
Msg-id c2d9e70e05091611156a62504a@mail.gmail.com
обсуждение исходный текст
Ответ на Neither column can be NULL if the column is part of the combination of primary key columns?  (Emi Lu <emilu@cs.concordia.ca>)
Список pgsql-general
>
> To allow *col2* to be NULL and make record combination (col1, col2)
> unique, I should setup
> unique (col1, col2) ?
>
> Thanks,
> Emi
>

no, you must create a partial unique index...

create unique index indice_col2 on table(col1, col2) where col2 is not null;

--
Atentamente,
Jaime Casanova
(DBA: DataBase Aniquilator ;)

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

Предыдущее
От: Russ Brown
Дата:
Сообщение: Re: Replication
Следующее
От: Bill Moseley
Дата:
Сообщение: Setting WHERE on a VIEW with aggregate function.