> Raul Chirea <[EMAIL PROTECTED]> writes:
> > So, it seems to be a parser difficulty (bug) to correctly determine
> > the type of a numeric constant with decimals (like 99.9).
> 
> Yes.  You can find more about this in the pgsql-hackers archives.
> We've been aware of the problem for a while but are unsure as yet
> how to solve it without breaking other cases --- ie, cases where
> you *do* want such a constant to be treated as float not numeric.
> 
> For the moment, we have left the behavior as it's always been in
> Postgres (ie, undecorated non-integral constants are taken to be
> 'float8'), so as not to break existing applications.

Yikes:
        
        test=> create table tab1(x numeric);
        CREATE
        test=> insert into tab1 values (1);
        INSERT 20937 1
        test=> update tab1 set x=4 where x=5;
        UPDATE 0
        test=> update tab1 set x=4.0 where x=5;
        UPDATE 0
        test=> update tab1 set x=4 where x=5.0;
        ERROR:  Unable to identify an operator '=' for types 'numeric' and
        'float8'
                You will have to retype this query using an explicit cast
        test=> 

This is terrible.  I can't imagine how people use this without terrible
problems.  Why don't we get more bug reports about this?

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  [EMAIL PROTECTED]               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Reply via email to