Re: BUG #7501: Unique index fails to check uniqueness on nulls - Mailing list pgsql-bugs

From Jeff Davis
Subject Re: BUG #7501: Unique index fails to check uniqueness on nulls
Date
Msg-id 1345740325.16150.3.camel@jdavis
Whole thread Raw
In response to BUG #7501: Unique index fails to check uniqueness on nulls  (matthew.p.kusnierz@jpmorgan.com)
List pgsql-bugs
On Thu, 2012-08-23 at 09:38 +0000, matthew.p.kusnierz@jpmorgan.com
wrote:
> Multi-column unique indexes allow duplicate rows to be inserted if any of
> the indexed columns are inserted with a null.

That is mandated in the SQL spec, and is documented here:

"For the purpose of a unique constraint, null values are not considered
equal."

 -- http://www.postgresql.org/docs/9.2/static/sql-createtable.html

NULLs can be confusing, I know.

Regards,
    Jeff Davis

pgsql-bugs by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: BUG #7502: ALTER COLUMN TYPE processed even if column type matches
Next
From: Tom Lane
Date:
Subject: Re: BUG #7502: ALTER COLUMN TYPE processed even if column type matches