← Back to team overview

anewt-developers team mailing list archive

[Bug 370360] Re: PostgreSQL result: numeric column type

 

My point is: PostgreSQL does NOT convert the value to float. It is just
a bigint, only the result from pg_field_type() will return 'numeric'.
The string is just a bigint. But since anewt sees 'numeric' and thinks
thats a float, it will convert it to a float with less precision.

The following code:

$rs = pg_query('SELECT SUM(large_value*9999999) FROM sometable');
$rs = pg_query($sql);
echo pg_field_type($rs, 0);
$value = pg_fetch_result($rs, 0);
echo $value;
echo (float)$value;  // <-- this is what anewt does

Will return the following output (adjusted for whitespace):

numeric
107629173119941611714
1.0762917311994E+20

Which proves that some precision is lost.

Only when I made the input one factor larger did postgres complain about
an overflow.

-- 
PostgreSQL result: numeric column type
https://bugs.launchpad.net/bugs/370360
You received this bug notification because you are a member of Anewt
developers, which is subscribed to Anewt.



References