Getting float values out of PostgreSQL
Posted
by skymander
on Stack Overflow
See other posts from Stack Overflow
or by skymander
Published on 2010-06-08T00:20:07Z
Indexed on
2010/06/08
0:22 UTC
Read the original article
Hit count: 589
postgresql
I am having trouble retrieving float/real values out of PostgreSQL.
For example, I would like to store: 123456789123456, the retrieve that exact same number with a select statement.
table tbl (num real) insert into tbl(num) values('123456789123456');
As it is now, if I "select num from tbl" the result is "1.23457e+14" If I run "select CAST(num AS numeric) as num from tbl" the result is 123457000000000 If I run "select CAST(num AS float) as num from tbl" the result is 123456788103168 (where did this number come from)
How on earth can I select the value and get "123456789123456" as the result?
Thanks so much in advance
© Stack Overflow or respective owner