Re: factorial function/phase out postfix operators?

Поиск
Список
Период
Сортировка
От Vik Fearing
Тема Re: factorial function/phase out postfix operators?
Дата
Msg-id a020d7ba-7694-28d1-ba46-aafd316be237@postgresfriends.org
обсуждение исходный текст
Ответ на Re: factorial function/phase out postfix operators?  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: factorial function/phase out postfix operators?  (Robert Haas <robertmhaas@gmail.com>)
Re: factorial function/phase out postfix operators?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 5/19/20 4:22 PM, Robert Haas wrote:
> On Tue, May 19, 2020 at 9:51 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Uh ... what exactly would be the point of that?  The real reason to do
>> this at all is not that we have it in for '!', but that we want to
>> drop the possibility of postfix operators from the grammar altogether,
>> which will remove a boatload of ambiguity.
> 
> The ambiguity doesn't come from the mere existence of postfix
> operators. It comes from the fact that, when we lex the input, we
> can't tell whether a particular operator that we happen to encounter
> is prefix, infix, or postfix. So hard-coding, for example, a rule that
> '!' is always a postfix operator and anything else is never a postfix
> operator is sufficient to solve the key problems. Then "SELECT a ! b"
> can only be a postfix operator application followed by a column
> labeling, a "SELECT a + b" can only be the application of an infix
> operator.

So if I make a complex UDT where a NOT operator makes a lot of sense[*],
why wouldn't I be allowed to make a prefix operator ! for it?  All for
what?  That one person in the corner over there who doesn't want to
rewrite their query to use factorial() instead?

I'm -1 on keeping ! around as a hard-coded postfix operator.


[*] I don't have a concrete example in mind, just this abstract one.
-- 
Vik Fearing



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

Предыдущее
От: Christoph Berg
Дата:
Сообщение: Re: ldap tls test fails in some environments
Следующее
От: Fujii Masao
Дата:
Сообщение: Re: pg_stat_wal_receiver and flushedUpto/writtenUpto