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

From David G. Johnston
Subject Re: Shouldn't "WHEN (OLD.* IS DISTINCT FROM NEW.*)" clause be independent from data type?
Date
Msg-id CAKFQuwYic=CLzSgWdGOe49oXkOWmYMdudemmEKyCuEC=ZW8qOg@mail.gmail.com
Whole thread Raw
In response to Shouldn't "WHEN (OLD.* IS DISTINCT FROM NEW.*)" clause be independent from data type?  (pinker <pinker@onet.eu>)
List 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 by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Shouldn't "WHEN (OLD.* IS DISTINCT FROM NEW.*)" clause be independent from data type?
Next
From: pinker
Date:
Subject: Re: Shouldn't "WHEN (OLD.* IS DISTINCT FROM NEW.*)" clause be independent from data type?