Re: unique constraint - bug?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: unique constraint - bug?
Date: 2000-07-20 14:25:07
Message-ID: 24455.964103107@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Oliver Elphick" <olly(at)lfix(dot)co(dot)uk> writes:
> Tom Lane wrote:
>> Two nulls are never considered equal, therefore the unique constraint
>> does not trigger.

> I think you are not interpreting this right:

> A unique constraint is satisfied if and only if no two rows in
> a table have the same non-null values in the unique columns.

> I think it means that nulls are to be left out of account in the
> comparison.

Hmm. What then of

a, b, c
a, NULL, c

If I "ignore the null" then these two rows are equal as well.

Still, you're right that it's a little more ambiguously worded than
I thought. Can anyone check how other DBMSs handle this?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2000-07-20 14:52:49 Re: Re: [HACKERS] 8Ko limitation
Previous Message Andreas Tille 2000-07-20 14:10:28 Re: Migrating from MS SQL server