Re: [PATCHES] binary operators on integers - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCHES] binary operators on integers
Date
Msg-id 25906.972423039@sss.pgh.pa.us
Whole thread Raw
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: richard excite
Date:
Subject: Re: Two-phase commit
Next
From: Tom Lane
Date:
Subject: Re: Re: how to access backend pid from libpq ?