On Mon, 28 Oct 2019 at 13:31, Andrew Dunstan
<andrew.dunstan@2ndquadrant.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