Re: [HACKERS] Unary % operator is broken in current sources

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane)
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Unary % operator is broken in current sources
Date: 1999-03-21 02:25:19
Message-ID: 199903210225.VAA04636@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> These used to work:
>
> regression=> select %f.f1 FROM FLOAT8_TBL f;
> ERROR: parser: parse error at or near "%"
> regression=> select f.f1 % FROM FLOAT8_TBL f;
> ERROR: parser: parse error at or near "from"
>
> This is causing the float8 regress test to fail.
>
> I suspect this has to do with Bruce's recent hacking on operator
> associativity.

I see. I see the same problem with / and +:

test=> select %f.f1 FROM FLOAT8_TBL f;
ERROR: parser: parse error at or near "%"
test=> select /f.f1 FROM FLOAT8_TBL f;
ERROR: parser: parse error at or near "/"
test=> select +f.f1 FROM FLOAT8_TBL f;
ERROR: parser: parse error at or near "+"

\do % shows:

test=> \do %
op|left_arg|right_arg|result |description
--+--------+---------+-------+-------------------
% | |float8 |float8 |truncate to integer
% |float8 | |float8 |truncate to integer
% |int2 |int2 |int2 |modulus
% |int2 |int4 |int4 |modulus
% |int4 |int2 |int4 |modulus
% |int4 |int4 |int4 |modulus
% |numeric |numeric |numeric|modulus
(7 rows)

OK, I made the change. It works now with special entries for %4 and 4%
in the grammer, similar to our handling of -4:

regression=> select %f.f1 FROM FLOAT8_TBL f;
?column?
---------------------
0
-34
-1004
-1.2345678901234e+200
0
(5 rows)

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-03-21 02:51:54 Re: [HACKERS] Unary % operator is broken in current sources
Previous Message Bruce Momjian 1999-03-21 02:07:30 Re: [HACKERS] 6.5 Features list