Re: Proposition to use '==' as synonym for 'IS NOT DISTINCT FROM'

Поиск
Список
Период
Сортировка
От Geoff Winkless
Тема Re: Proposition to use '==' as synonym for 'IS NOT DISTINCT FROM'
Дата
Msg-id CAEzk6ffDsV04J-OdE0qLLtkfBpNhqp-i1d3vc7E-vj7M8sgA5Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Proposition to use '==' as synonym for 'IS NOT DISTINCT FROM'  (Andrew Dunstan <andrew.dunstan@2ndquadrant.com>)
Список pgsql-hackers
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



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

Предыдущее
От: Thunder
Дата:
Сообщение: Re:Re:Re: [BUG] standby node can not provide service even itreplays all log files
Следующее
От: Asif Rehman
Дата:
Сообщение: Re: WIP/PoC for parallel backup