Skip site navigation (1) Skip section navigation (2)

Re: BUG #2975: UNIQUE INDEX doesn't work

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Steven Lambert <s(dot)lambert(at)madeware(dot)nl>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2975: UNIQUE INDEX doesn't work
Date: 2007-02-14 14:48:10
Message-ID: (view raw or whole thread)
Lists: pgsql-bugs
On Wed, Feb 14, 2007 at 10:01:58AM +0100, Steven Lambert wrote:
> You are right, the index has more columns and one of them have most of the
> time the value NULL.
> It is the date when the record has been "deleted"

See "Unique Constraints" in the documentation, in particular the
last paragraph:

"However, null values are not considered equal in this comparison.
That means even in the presence of a unique constraint it is possible
to store duplicate rows that contain a null value in at least one
of the constrained columns."

This has been discussed before; search the archives for words like
"null", "unique", and "comparison" or "compare".

Michael Fuhr

In response to

pgsql-bugs by date

Next:From: DNSDate: 2007-02-14 16:28:18
Subject: Postgresql 8.1.8 Initdb not started
Previous:From: Filippo TosoDate: 2007-02-14 12:49:43
Subject: Re: BUG #2993: The program "postgres" is needed by initdb but was not found ...

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group