Re: Table Constraints with NULL values - Mailing list pgsql-sql

From Tom Lane
Subject Re: Table Constraints with NULL values
Date
Msg-id 11619.1003549897@sss.pgh.pa.us
Whole thread Raw
In response to Re: Table Constraints with NULL values  ("David Allardyce" <dave@pod13.net>)
List pgsql-sql
"David Allardyce" <dave@pod13.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


pgsql-sql by date:

Previous
From: "David Allardyce"
Date:
Subject: Re: Table Constraints with NULL values
Next
From: "Dinesh Parikh"
Date:
Subject: Query On Case structure