Formatting query output

From: Pedro Miguel Frazao Fernandes Ferreira <pfrazao(at)ualg(dot)pt>
To: pgsql-general(at)postgresql(dot)org
Subject: Formatting query output
Date: 2002-10-28 14:56:20
Message-ID: 3DBD5014.7060809@ualg.pt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ben-Nes Michael 2002-10-28 15:00:00 What is the max var I can pass to Function ?
Previous Message Darren Ferguson 2002-10-28 14:56:05 Re: cast numeric to char