Re: adding support for zero-attribute unique/etc keys - Mailing list pgsql-hackers

From Albe Laurenz
Subject Re: adding support for zero-attribute unique/etc keys
Date
Msg-id A737B7A37273E048B164557ADEF4A58B057D6289@ntex2010i.host.magwien.gv.at
Whole thread Raw
In response to Re: adding support for zero-attribute unique/etc keys  (Darren Duncan <darren@darrenduncan.net>)
List pgsql-hackers
Darren Duncan wrote:
> Consider the context however.  We're talking about a UNIQUE constraint and so
> what we want to do is prevent the existence of multiple tuples in a relation
> that are the same for some defined subset of their attributes.  I would argue
> that logically, and commonsensically, two tuples with no attributes are the
> same, and hence a set of distinct tuples having zero attributes could have no
> more than one member, and so a UNIQUE constraint over zero attributes would say
> the relation can't have more than one tuple.  So unless someone wants to argue
> that two tuples with no attributes are not the same, my interpretation makes
> more sense and is clearly the one to follow. -- Darren Duncan

What you propose is not an interpretation, but an extension
of the standard.  I'm not certain about that "clearly" either;
intuition is a questionable guideline when it comes to the
standard:

SELECT 'Things that feel equal are '      || CASE WHEN NULL = NULL THEN '' ELSE 'not always ' END      || 'equal';
          ?column?
 
---------------------------------------------Things that feel equal are not always equal
(1 row)

Yours,
Laurenz Albe

pgsql-hackers by date:

Previous
From: Atri Sharma
Date:
Subject: Re: GSoC project : K-medoids clustering in Madlib
Next
From: Thom Brown
Date:
Subject: Re: GSoC project : K-medoids clustering in Madlib