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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Proposition to use '==' as synonym for 'IS NOT DISTINCT FROM'
Дата
Msg-id 15327.1572271659@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Proposition to use '==' as synonym for 'IS NOT DISTINCT FROM'  (Andrew Dunstan <andrew.dunstan@2ndquadrant.com>)
Ответы Re: Proposition to use '==' as synonym for 'IS NOT DISTINCT FROM'
Список 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 по дате отправления:

Предыдущее
От: Asif Rehman
Дата:
Сообщение: Re: WIP/PoC for parallel backup
Следующее
От: Anastasia Lubennikova
Дата:
Сообщение: Re: pg_upgrade fails with non-standard ACL