Re: How to create unique constraint on NULL columns - Mailing list pgsql-general

From Dawid Kuroczko
Subject Re: How to create unique constraint on NULL columns
Date
Msg-id 758d5e7f05071506247317c18e@mail.gmail.com
Whole thread Raw
In response to How to create unique constraint on NULL columns  ("Andrus" <eetasoft@online.ee>)
List 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 by date:

Previous
From: "Andrus"
Date:
Subject: uncompressing pgAdmin backup file in windows
Next
From: ketan shah
Date:
Subject: how to insert '\\' in postgres database using java