From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | pinker <pinker(at)onet(dot)eu> |
Cc: | "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 13:39:54 |
Message-ID: | CAKFQuwYic=CLzSgWdGOe49oXkOWmYMdudemmEKyCuEC=ZW8qOg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Sep 17, 2015 at 9:14 AM, pinker <pinker(at)onet(dot)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
> <http://www.postgresql.org/docs/9.4/static/sql-createtrigger.html>.
> 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.
From | Date | Subject | |
---|---|---|---|
Next Message | pinker | 2015-09-17 13:44:05 | Re: Shouldn't "WHEN (OLD.* IS DISTINCT FROM NEW.*)" clause be independent from data type? |
Previous Message | Adrian Klaver | 2015-09-17 13:39:21 | Re: Shouldn't "WHEN (OLD.* IS DISTINCT FROM NEW.*)" clause be independent from data type? |