On 7/15/05, Andrus <eetasoft(at)online(dot)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