Re: BUG #7501: Unique index fails to check uniqueness on nulls

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: matthew(dot)p(dot)kusnierz(at)jpmorgan(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #7501: Unique index fails to check uniqueness on nulls
Date: 2012-08-23 16:45:25
Message-ID: 1345740325.16150.3.camel@jdavis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, 2012-08-23 at 09:38 +0000, matthew(dot)p(dot)kusnierz(at)jpmorgan(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2012-08-23 17:55:12 Re: BUG #7502: ALTER COLUMN TYPE processed even if column type matches
Previous Message Alvaro Herrera 2012-08-23 15:43:51 Re: BUG #7502: ALTER COLUMN TYPE processed even if column type matches