Formatting query output - Mailing list pgsql-general

From Pedro Miguel Frazao Fernandes Ferreira
Subject Formatting query output
Date
Msg-id 3DBD5014.7060809@ualg.pt
Whole thread Raw
Responses Re: Formatting query output  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
Hi All,

I am using libpq to interface PostgreSQL with Matlab.
My question is about formatting query results:

If I have a table field which is of type float8 and I insert, for
example, a value of 4503599627370496, when I do a select on this table
field I get 4.5035996273705e+15.

The query result is rounded. When I use libpq's PQgetvalue() this is the
value I get. PQftype() correctly indicates a float8. How can I get the
actual (503599627370496) value by doing a direct query to this field
(maintaining PQftype() float8 result) ?

I can do it whit PostgreSQL function to_char() but the field type will
be set to some CHAR based type. I woul like to have the actual value
along with a PQftype() float8 result.

Thanks for any help.

Pedro M. Ferreira
--
----------------------------------------------------------------------
Pedro Miguel Frazao Fernandes Ferreira
Universidade do Algarve
Faculdade de Ciencias e Tecnologia
Campus de Gambelas
8000-117 Faro
Portugal
Tel./Fax:  (+351) 289 800950 / 289 819403
http://w3.ualg.pt/~pfrazao


pgsql-general by date:

Previous
From: "Johnson, Shaunn"
Date:
Subject: cast numeric to char
Next
From: Darren Ferguson
Date:
Subject: Re: cast numeric to char