Search Postgresql Archives

Re: unary operators, precedence, grouping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"woger151" <woger151@xxxxxxxxxxxxxxxx> writes:
> Why wouldn't <~~(item_1) + <~~(item_2) be parsed as (<~~(item_1)) + 
> (<~~(item_2))?

Because it's parsed as
	<~~ ( (item_1) + ( <~~ (item_2) ) )
"+" binds more tightly than any non-built-in operator, per the
precedence chart in the manual:
http://www.postgresql.org/docs/8.2/static/sql-syntax-lexical.html#SQL-PRECEDENCE
so this interpretation is preferred over the alternative
	( <~~ (item_1) ) + ( <~~ (item_2) )
Those are the only two possibilities without getting into right-unary
operators, which the parser is generally designed not to do if it can
avoid it.

			regards, tom lane


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux