Search Postgresql Archives

Re: "money" binary representation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Konstantin Izmailov <pgfizm@xxxxxxxxx> writes:
> I'm trying to read "money" field using PQgetvalue (PostgreSQL 8.3.7). The
> function returns 9 bytes, smth like 0h 0h 0h 0h 0h 0h 14h 0h 0h, for the
> value '$50.2'. I could not find description anywhere on how to convert the
> binary data into, for example, a double precision number.

> Would you please help me find a method of converting binary "money" data
> into a double precision?

It's a binary integer, either int4 or int8 depending on which PG version
you're working with, measured in pennies (or whatever the minimum unit
of your currency is).  So that should correspond to 5020.

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux