Re: [GENERAL] unary operators, precedence, grouping

2007-03-10 Thread Tom Lane
"woger151" <[EMAIL PROTECTED]> 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://ww

[GENERAL] unary operators, precedence, grouping

2007-03-10 Thread woger151
I defined a function, count_nonnull, to return 1 if not null, 0 otherwise. Then I defined a corresponding unary operator <~~. I wanted it for expressions like <~~ item_1 + <~~ item_2. But because precedence of user-defined ops is pretty low, I had to rewrite this as <~~(item_1) + <~~(item_2), w