Re: [GENERAL] Unary Operators

2013-11-08 Thread Tom Lane
Andreas Ulbrich writes: > In the documentation I can't find, that / is not possible as an unary > operator. > Are there any restrictions. Yeah, if you look in the bison grammar you'll find out that the operators with special precedence are hard-wired as to which syntaxes are allowed: + -

Re: [GENERAL] Unary Operators

2013-09-19 Thread Andreas Ulbrich
On 18.09.2013 02:17, David Johnston wrote: Andreas Ulbrich wrote create operator ^- (leftarg = float, procedure = reciproce); works too, but create operator / (leftarg = float, procedure = reciproce); not. Do you mean the "^" operator or the "^-" operator? Rowan claims that "^" does not in fac

Re: [GENERAL] Unary Operators

2013-09-17 Thread David Johnston
Andreas Ulbrich wrote > create operator ^- (leftarg = float, procedure = reciproce); > works too, but > create operator / (leftarg = float, procedure = reciproce); > not. Do you mean the "^" operator or the "^-" operator? Rowan claims that "^" does not in fact work here... Rowan Collins wro

Re: [GENERAL] Unary Operators

2013-09-17 Thread Rowan Collins
On 15/09/2013 19:32, Andreas Ulbrich wrote: Salvete! I have the following problem. I'd like to define the operator symbol / as a left unary operator for reciprocal value of a number. I did this with a C-function and all the stuff around, but it does not work. Hiere is an extract and simplified

[GENERAL] Unary Operators

2013-09-15 Thread Andreas Ulbrich
Salvete! I have the following problem. I'd like to define the operator symbol / as a left unary operator for reciprocal value of a number. I did this with a C-function and all the stuff around, but it does not work. Hiere is an extract and simplified example with the same error message as in m

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