RE: unique constraint - bug? - Mailing list pgsql-general

From Mikheev, Vadim
Subject RE: unique constraint - bug?
Date
Msg-id 8F4C99C66D04D4118F580090272A7A23018C66@SECTORBASE1
Whole thread Raw
In response to unique constraint - bug?  (Merrill Oveson <merrill@actarg.com>)
List pgsql-general
>                                 unique (a, b, c)
>                         );
>
>                         insert into letter values('1','2','3');
>                         insert into letter values('1','2','3');
>
>                         insert into letter (a,c) values ('1','3');
>                         insert into letter (a,c) values ('1','3');
>
> Notice that the second insert of ('1','2','3') yields an
> error message, which is the correct behavior - (that is the unique
> constaint is working), while the last insert of ('1','3') does not yield
> an error message - (that is the unique constraint doesn't work in this
> case - I think it should).

NULL != NULL - ie you can't say that both keys are equal.
(That's why PK constraint disallow NULLs...)

Vadim

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Does CREATE FUNCTION... WITH (ISCACHABLE) work?
Next
From: Tom Lane
Date:
Subject: Re: unique constraint - bug?