| От | Tom Lane |
|---|---|
| Тема | Re: "money" binary representation |
| Дата | |
| Msg-id | 2019.1258348237@sss.pgh.pa.us обсуждение |
| Ответ на | "money" binary representation (Konstantin Izmailov <pgfizm@gmail.com>) |
| Список | pgsql-general |
Konstantin Izmailov <pgfizm@gmail.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
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера