From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Konstantin Izmailov <pgfizm(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: "money" binary representation |
Date: | 2009-11-16 05:10:37 |
Message-ID: | 2019.1258348237@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Konstantin Izmailov <pgfizm(at)gmail(dot)com> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Konstantin Izmailov | 2009-11-16 05:10:44 | Re: "money" binary representation |
Previous Message | John R Pierce | 2009-11-16 04:38:55 | Re: "money" binary representation |