Re: PostgresSQL 10 | Driver 42.2.5 | Float Conversion Issue

Поиск
Список
Период
Сортировка
От Vladimir Sitnikov
Тема Re: PostgresSQL 10 | Driver 42.2.5 | Float Conversion Issue
Дата
Msg-id CAB=Je-H8NiTt_+roUXzv=UiL6QWG-7QzihMVvpXrwyq8FLuo3w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: PostgresSQL 10 | Driver 42.2.5 | Float Conversion Issue  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: PostgresSQL 10 | Driver 42.2.5 | Float Conversion Issue  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-jdbc
Tom>The SQL standard

The documentation says that PostgreSQL implements IEEE Standard 754.

1234567 is exactly representable in IEEE (e.g. see https://www.exploringbinary.com/floating-point-converter/ ),
so I would expect the database should keep the value intact.

1234567 is exactly representable in both float4 and numeric, so it is surprising that 1234567::float4::numeric::text yields 1234570 in PG 12.2

----

In case that matters, pgjdbc does send pass extra_float_digits=2 in the initial packet, then it upgrades to extra_float_digist=3 in case server version is 9.0+
I did try removing that parameter, and it does not resolve 1234567::float4::numeric::text issue

Vladimir

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: PostgresSQL 10 | Driver 42.2.5 | Float Conversion Issue
Следующее
От: Tom Lane
Дата:
Сообщение: Re: PostgresSQL 10 | Driver 42.2.5 | Float Conversion Issue