pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: matthew.p.kusnierz@jpmorgan.com
To: pgsql-bugs@postgresql.org
Subject: BUG #7501: Unique index fails to check uniqueness on nulls
Date: Thu, 23 Aug 2012 09:38:06 +0000
Message-ID: <E1T4Tra-0003VA-Lv@wrigleys.postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      7501
Logged by:          Matt Kusnierz
Email address:      matthew.p.kusnierz@jpmorgan.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!





view thread (2+ messages)  latest in thread

Message-ID: <E1T4Tra-0003VA-Lv@wrigleys.postgresql.org>
Permalink:  ../E1T4Tra-0003VA-Lv@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/E1T4Tra-0003VA-Lv@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: matthew.p.kusnierz@jpmorgan.com
  Subject: Re: BUG #7501: Unique index fails to check uniqueness on nulls
  In-Reply-To: <E1T4Tra-0003VA-Lv@wrigleys.postgresql.org>
  References: <E1T4Tra-0003VA-Lv@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox