Обсуждение: Re: [PATCHES] binary operators on integers

Поиск
Список
Период
Сортировка

Re: [PATCHES] binary operators on integers

От
Tom Lane
Дата:
Peter Eisentraut <peter_e@gmx.net> writes:
> This patch was installed, with xor as "#".  The parser still needs work.  
> Besides the known issue of "|", this also parses funny:

> => select 5 & ~ 6;
> ERROR:  Unable to identify a right operator '&' for type 'int4'

I think we're kind of stuck on that, at least in terms of a solution
specifically for ~ --- I don't think we should be wiring knowledge of
whether specific operators are prefix/suffix/infix into the grammar.

It might perhaps be possible to tweak the grammar so that
operand operator operator operand

is generically resolved as
operand infix-op (prefix-op operand)

and not
(operand postfix-op) infix-op operand

the way it is now.  Given that postfix operators are relatively seldom
used, this seems a more sensible default --- but I suppose somewhere out
there is an application that will break.  (At least it probably won't
break silently.)

Comments anyone?
        regards, tom lane