Re: Shouldn't "WHEN (OLD.* IS DISTINCT FROM NEW.*)" clause be independent from data type?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, "'pinker *EXTERN*'" <pinker(at)onet(dot)eu>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Shouldn't "WHEN (OLD.* IS DISTINCT FROM NEW.*)" clause be independent from data type?
Date: 2015-09-17 14:34:06
Message-ID: 6733.1442500446@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> writes:
> On 09/17/2015 06:54 AM, Tom Lane wrote:
>> Well, that's true: the parser actually looks up the operator named "<>"
>> for the given data types, and IS DISTINCT FROM is just a prefilter on
>> that to do the right thing with nulls. So because type point has an
>> operator that's physically named "<>", that case works.

> If you use '<>' explicitly, otherwise:
> test=> select '(1,2)'::point is distinct from '(1,3)'::point;
> ERROR: operator does not exist: point = point

Ah, sorry, actually what IS [NOT] DISTINCT FROM looks up is the "="
operator. The core point remains, though, that this is a name-based
lookup rather than an opclass-based one. I'd like to get us moved
over to using opclass-based lookups for all cases where the system
currently assumes that operators named "=" or "<>" necessarily behave
in a particular way. However, that would leave point and some of the
other weirder datatypes even further out in the cold than they are now.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2015-09-17 14:47:52 Re: Shouldn't "WHEN (OLD.* IS DISTINCT FROM NEW.*)" clause be independent from data type?
Previous Message Adrian Klaver 2015-09-17 14:14:47 Re: Shouldn't "WHEN (OLD.* IS DISTINCT FROM NEW.*)" clause be independent from data type?