Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T4Trd-0008Bt-5C for pgsql-bugs@postgresql.org; Thu, 23 Aug 2012 09:38:09 +0000 Received: from mahout.postgresql.org ([98.129.198.123]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T4Trb-0003kp-Uz for pgsql-bugs@postgresql.org; Thu, 23 Aug 2012 09:38:08 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T4Trb-0004e3-1U for pgsql-bugs@postgresql.org; Thu, 23 Aug 2012 09:38:07 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1T4Tra-0003VA-Lv for pgsql-bugs@postgresql.org; Thu, 23 Aug 2012 09:38:06 +0000 Date: Thu, 23 Aug 2012 09:38:06 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #7501: Unique index fails to check uniqueness on nulls To: pgsql-bugs@postgresql.org From: matthew.p.kusnierz@jpmorgan.com X-Pg-Spam-Score: -2.1 (--) X-Archive-Number: 201208/173 X-Sequence-Number: 33897 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!