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

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Shouldn't "WHEN (OLD.* IS DISTINCT FROM NEW.*)" clause be independent from data type?
Дата
Msg-id 55FAD298.4090607@aklaver.com
обсуждение исходный текст
Ответ на Re: Shouldn't "WHEN (OLD.* IS DISTINCT FROM NEW.*)" clause be independent from data type?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Shouldn't "WHEN (OLD.* IS DISTINCT FROM NEW.*)" clause be independent from data type?
Список pgsql-general
On 09/17/2015 07:34 AM, Tom Lane wrote:
> Adrian Klaver <adrian.klaver@aklaver.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.

So the docs should be changed?

As they stand now:

http://www.postgresql.org/docs/9.4/interactive/functions-comparison.html

"For non-null inputs, IS DISTINCT FROM is the same as the <> operator. "

That did not indicate to me the '=' was important to IS DISTINCT ON.
Then again I may need more attention from the clue stick:)

  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
>


--
Adrian Klaver
adrian.klaver@aklaver.com


В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Shouldn't "WHEN (OLD.* IS DISTINCT FROM NEW.*)" clause be independent from data type?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Shouldn't "WHEN (OLD.* IS DISTINCT FROM NEW.*)" clause be independent from data type?