Re: Unique Index

From: "Dann Corbit" <DCorbit(at)connx(dot)com>
To: "Stephan Szabo" <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Greg Stark" <gsstark(at)mit(dot)edu>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Unique Index
Date: 2005-01-20 19:41:28
Message-ID: D425483C2C5C9F49B5B7A41F89441547055828@postal.corporate.connx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Would the constraint not be satisfied if each combination (including
NULL) were not also forced to be unique?

I maintain that the constraint is still satisfied.

So, it is satisfied if I stuff thousands of NULL values in there.

And it is satisfied if I only allow a single NULL value.

With multiple columns, it might be set such that each combination must
be unique, like binary counting.

Let me also state that I agree: allowing null values in a unique index
is ludicrous. But if it is allowed, I think forcing the combinations to
be single valued makes more sense than allowing any number of them.

-----Original Message-----
From: Stephan Szabo [mailto:sszabo(at)megazone(dot)bigpanda(dot)com]
Sent: Thursday, January 20, 2005 11:14 AM
To: Dann Corbit
Cc: Tom Lane; Greg Stark; pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Unique Index

On Thu, 20 Jan 2005, Dann Corbit wrote:

> It is clear to me that only allowing a single null value will not
> violate the explanation below.

Given two rows in T with one column each
(NULL), (NULL)

Find two rows such that the value of each column in one row is non-null
and equal to the value of the corresponding column in the other row
according to 8.2. If there are no such rows the unique predicate returns
true (ie the constraint is satisfied).

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Stark 2005-01-20 19:54:34 Re: Unique Index
Previous Message Frank D. Engel, Jr. 2005-01-20 19:26:43 Re: Unique Index