Re: Precedence of % - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Precedence of %
Date
Msg-id 23326.1117859855@sss.pgh.pa.us
Whole thread Raw
In response to Precedence of %  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Precedence of %
List pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Does anyone understand why the precedence of % is strange:
>     test=> select -25 % -10;

It's treating it as ((-25) %) - (10), which is probably not so
surprising given the relative precedence of % and - ... though
I have to admit I'm not totally clear why it's not (-(25 %)) - (10)
instead.

We could maybe hack the precedence of the productions for prefix/postfix
%, but I wonder if it wouldn't be smarter to remove 'em altogether
(along with the two existing unary % operators).
        regards, tom lane


pgsql-hackers by date:

Previous
From: Neil Conway
Date:
Subject: Re: need help
Next
From: Hans-Jürgen Schönig
Date:
Subject: Re: executing OS programs from pg