Re: Proposition to use '==' as synonym for 'IS NOT DISTINCT FROM' - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Proposition to use '==' as synonym for 'IS NOT DISTINCT FROM'
Date
Msg-id 15327.1572271659@sss.pgh.pa.us
Whole thread Raw
In response to Re: Proposition to use '==' as synonym for 'IS NOT DISTINCT FROM'  (Andrew Dunstan <andrew.dunstan@2ndquadrant.com>)
Responses Re: Proposition to use '==' as synonym for 'IS NOT DISTINCT FROM'  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:
> On 10/28/19 8:37 AM, Robert Haas wrote:
>> I certainly agree with that. I do think, though, that IS DISTINCT FROM
>> is a terribly verbose thing to have to write all the time.  It's not
>> that bad when you write a query that contains one instance of it, but
>> I've both seen and written queries where you need to use it a bunch of
>> times, and that can get really annoying. 

> How about instead of new operators we just provide a nice shorthand way
> of saying these? e.g. ARE and AINT :-)

The thing about providing a shorthand that looks like an operator is
that then people will try to use it as an operator, and we'll be having
to explain why constructs like "ORDER BY ==" or "x == ANY (SELECT ...)"
don't work.  Or else make them work, but I think you'll find that
that moves this task well outside the easy-finger-exercise category.

I kind of like AINT ;-) ... although adding two new short,
fully-reserved words is likely to cause push-back from people
whose schemas get broken by that.

A more practical answer might be to allow these to be abbreviated
along the lines of

    x DIST y
    x NOT DIST y

if we're willing to make DIST a fully reserved word.
It's possible that we could make

    x IS DIST y
    x IS NOT DIST y

work without fully reserving DIST, but I've not tried it.

Of course neither of those ideas is as short as "==", but
I think we should put some weight on not breaking things.
I do not believe Robert's position that nobody will complain
if we break extensions' use of "==" just to save some typing.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Asif Rehman
Date:
Subject: Re: WIP/PoC for parallel backup
Next
From: Anastasia Lubennikova
Date:
Subject: Re: pg_upgrade fails with non-standard ACL