[patch] PL/Python is too lossy with floats

Поиск
Список
Период
Сортировка
От Marko Kreen
Тема [patch] PL/Python is too lossy with floats
Дата
Msg-id 20150303143216.GA12187@gmail.com
обсуждение исходный текст
Ответы Re: [patch] PL/Python is too lossy with floats  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
PL/Python uses str(v) to convert float data, but is lossy
by design.  Only repr(v) is guaranteed to have enough
precision to make floats roundtrip properly:

  https://docs.python.org/2/library/functions.html#func-repr
  https://docs.python.org/2/library/functions.html#str

Example:

  $ python
  >>> repr(100100100.654321)
  '100100100.654321'
  >>> str(100100100.654321)
  '100100100.654'

Attached patch uses PyObject_Repr() for float data.

As it's annoying-to-debug problem and the patch is simple,
perhaps it's worth backporting?

--
marko


Вложения

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

Предыдущее
От: Jan de Visser
Дата:
Сообщение: Re: Idea: closing the loop for "pg_ctl reload"
Следующее
От: Tom Lane
Дата:
Сообщение: Re: autogenerated column names + views are a dump hazard