Re: Precedence of %

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Precedence of %
Date: 2005-06-04 15:38:05
Message-ID: 200506041538.j54Fc5d18589@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> We could possibly fix this by fooling with the precedence of the
> productions for postfix '%', but I'm worried that that would have
> unintended side-effects. What I'd like to propose instead is that
> we remove prefix and postfix '%' entirely --- and also '^', which
> is the only other hard-wired operator that appears in all three
> forms in the grammar. There are no actual uses of prefix or postfix
> '^' in pg_operator, so that loses us nothing. Prefix and postfix '%'
> exist, but only for the float8 datatype, not anything else; and I
> can't imagine a good reason to write those rather than trunc() or
> round(). (Quick: which is which, and how would you remember?)

Agreed. I didn't know we even supported unary % and ~, and I doubt
anyone else did either. We just need to mark it as a non-backward
compatible change in CVS commit so I mention it in the release notes.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2005-06-04 15:41:18 Re: pgsql: Fix NUMERIC modulus to properly truncate
Previous Message Tom Lane 2005-06-04 15:31:18 Re: Precedence of %