From: | Geoff Winkless <pgsqladmin(at)geoff(dot)dj> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Proposition to use '==' as synonym for 'IS NOT DISTINCT FROM' |
Date: | 2019-10-28 13:57:32 |
Message-ID: | CAEzk6ffDsV04J-OdE0qLLtkfBpNhqp-i1d3vc7E-vj7M8sgA5Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, 28 Oct 2019 at 13:31, Andrew Dunstan
<andrew(dot)dunstan(at)2ndquadrant(dot)com> wrote:
> How about instead of new operators we just provide a nice shorthand way
> of saying these? e.g. ARE and AINT :-)
Seems to me like this is something that those users who want it can
implement for themselves with little to no effort without forcing the
change on everyone else.
CREATE OR REPLACE FUNCTION fnnotdistinctfrom(anyelement, anyelement)
RETURNS boolean LANGUAGE SQL AS $_$
SELECT CASE WHEN $1 IS NOT DISTINCT FROM $2 THEN true ELSE false END;
$_$;
CREATE OR REPLACE FUNCTION fndistinctfrom(anyelement, anyelement)
RETURNS boolean LANGUAGE SQL AS $_$
SELECT CASE WHEN $1 IS DISTINCT FROM $2 THEN true ELSE false END;
$_$;
CREATE OPERATOR == (
PROCEDURE = fnnotdistinctfrom,
LEFTARG=anyelement,
RIGHTARG=anyelement,
NEGATOR = =!
);
CREATE OPERATOR =! (
PROCEDURE = fndistinctfrom,
LEFTARG = anyelement,
RIGHTARG = anyelement,
NEGATOR = ==
);
I'm at a loss to understand why anyone would want to implement what is
basically a personal preference for syntactic sugar at the system
level. There's not even the advantage of other-system-compatibility.
Geoff
From | Date | Subject | |
---|---|---|---|
Next Message | Asif Rehman | 2019-10-28 14:03:33 | Re: WIP/PoC for parallel backup |
Previous Message | Thunder | 2019-10-28 13:54:51 | Re:Re:Re: [BUG] standby node can not provide service even it replays all log files |