Re: Table Constraints with NULL values

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David Allardyce" <dave(at)pod13(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Table Constraints with NULL values
Date: 2001-10-20 03:51:37
Message-ID: 11619.1003549897@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"David Allardyce" <dave(at)pod13(dot)net> writes:
> ... If they had defined uniqueness as "all rows
> must be distinct" then two all null rows would violate the uniqueness
> constraint. Not the behavior I want at all.

Er, why not? You're essentially arguing that the UNIQUE constraint
should treat nulls as equal, so I'd think two all-null rows should be
considered equal too. I do not see how you can consistently maintain
that (x,NULL) equals (x,NULL) but (NULL,NULL) doesn't equal (NULL,NULL).

But we have been around the maypole on this question several times
before, with no permanent resolution --- the plain fact is that the
spec isn't very clearly written. Useful data would be tests
demonstrating how other systems (Oracle, DB2, etc) interpret the issue.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Aasmund Midttun Godal 2001-10-20 11:15:48 Re: oid's in views.
Previous Message David Allardyce 2001-10-20 02:14:29 Re: Table Constraints with NULL values