Re: How to create unique constraint on NULL columns

Поиск
Список
Период
Сортировка
От Dawid Kuroczko
Тема Re: How to create unique constraint on NULL columns
Дата
Msg-id 758d5e7f05071506247317c18e@mail.gmail.com
обсуждение исходный текст
Ответ на How to create unique constraint on NULL columns  ("Andrus" <eetasoft@online.ee>)
Список pgsql-general
On 7/15/05, Andrus <eetasoft@online.ee> wrote:
> CREATE TABLE test( col1 CHAR NOT NULL, col2 CHAR,
>   UNIQUE (col1, col2) );
> INSERT INTO test VALUES ( '1', NULL );
> INSERT INTO test VALUES ( '1', NULL );
> does NOT cause error!
>
> How to create constraint so that NULL values are treated equal and second
> insert is rejected ?

Please read:
http://www.postgresql.org/docs/8.0/interactive/indexes-unique.html
...or this list archives.

In short: NULL is not equal to NULL.  NULL is a state, not a value.

   Regards,
      Dawid

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

Предыдущее
От: "Andrus"
Дата:
Сообщение: uncompressing pgAdmin backup file in windows
Следующее
От: ketan shah
Дата:
Сообщение: how to insert '\\' in postgres database using java