Re: adding support for zero-attribute unique/etc keys

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Darren Duncan *EXTERN*" <darren(at)darrenduncan(dot)net>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: adding support for zero-attribute unique/etc keys
Date: 2013-03-27 09:56:47
Message-ID: A737B7A37273E048B164557ADEF4A58B057D6289@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thom Brown 2013-03-27 10:14:43 Re: GSoC project : K-medoids clustering in Madlib
Previous Message Atri Sharma 2013-03-27 09:08:40 Re: GSoC project : K-medoids clustering in Madlib