Re: Unique Index

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Alex <alex(at)meerkatsoft(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Unique Index
Date: 2005-01-19 15:19:59
Message-ID: 20050119071649.H54178@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Thu, 20 Jan 2005, Alex wrote:

> i have a unique index on a table over multiple columns. If now one of
> the records has a null value in one of the indexed columns i can insert
> the same record multiple times.
>
> Is this a problem within postgres or expected?

Expected. NULLs are effectively not considered as the same for the
purposes of UNIQUE.

The predicate basically functions as:

2) If there are no two rows in T such that the value of each column
in one row is non-null and is equal to the value of the cor-
responding column in the other row according to Subclause 8.2,
"<comparison predicate>", then the result of the <unique predi-
cate> is true; otherwise, the result of the <unique predicate>
is false.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Roman Neuhauser 2005-01-19 15:30:48 Re: Infinite recursion detected... How do I prevent that?
Previous Message Nefnifi, Kasem 2005-01-19 15:02:53 stored procedure from oracle to pgsql