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

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Shouldn't "WHEN (OLD.* IS DISTINCT FROM NEW.*)" clause be independent from data type?
Дата
Msg-id CAKFQuwYic=CLzSgWdGOe49oXkOWmYMdudemmEKyCuEC=ZW8qOg@mail.gmail.com
обсуждение исходный текст
Ответ на Shouldn't "WHEN (OLD.* IS DISTINCT FROM NEW.*)" clause be independent from data type?  (pinker <pinker@onet.eu>)
Список pgsql-general
On Thu, Sep 17, 2015 at 9:14 AM, pinker <pinker@onet.eu> wrote:
I've tried to write audit trigger which fires only when data changed, so I used "WHEN (OLD.* IS DISTINCT FROM NEW.*)" clause as described in documentation. Should this clause be independent from data type? because an error occurs when I'm trying to modify row with point data type: ERROR: could not identify an equality operator for type point Example:

Why the point (and geometric operators in general) use "=~" - w/ meaning "same as?" - instead of (as opposed to in addition to) a regular "=" - w/ meaning "equals?" - I cannot say but because of this when IS DISTINCT tries to locate a operator/function to use for its equality comparison it fails.  The main problem seems to be indexing and secondarily the added confusion that introducing a new operator would cause.

It should be possible to define a new operator, "=(point, point)" with the appropriate settings to make this work in your specific case.  Such a setup ideally would be on the Wiki (and maybe one is...haven't looked) for others to references.  A PGXN extension would also be a good choice for distribution.  It doesn't seem easy or important enough to add to core.

David J.

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

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