Re: [HACKERS] Unary % operator is broken in current sources - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] Unary % operator is broken in current sources
Date
Msg-id 199903210225.VAA04636@candle.pha.pa.us
Whole thread Raw
In response to Unary % operator is broken in current sources  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Unary % operator is broken in current sources
List 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_TBLf;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+2000
    (5 rows)
 

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


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] 6.5 Features list
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Unary % operator is broken in current sources