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

From: matthew(dot)p(dot)kusnierz(at)jpmorgan(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #7501: Unique index fails to check uniqueness on nulls
Date: 2012-08-23 09:38:06
Message-ID: E1T4Tra-0003VA-Lv@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 7501
Logged by: Matt Kusnierz
Email address: matthew(dot)p(dot)kusnierz(at)jpmorgan(dot)com
PostgreSQL version: 9.0.4
Operating system: Windows XP
Description:

Multi-column unique indexes allow duplicate rows to be inserted if any of
the indexed columns are inserted with a null.

For example:

create table foo (a varchar(10) null, b varchar(10) null);
create unique index uix on foo (a, b);

insert into foo (a, b) values ('abc', null);
insert into foo (a, b) values ('abc', null);

Clearly the second insert should fail with an ERROR: duplicate key value
violates unique constraint "uix"

But this does not occur!

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Denis Kolesnik 2012-08-23 12:14:02 the bug #7499 is not more a bug, but my missunderstanding (RESOLVED INVALID)
Previous Message Craig Ringer 2012-08-23 02:36:56 Re: bug #7499 additional comments