Re: BUG #3686: Incorrect numeric type conversion to long in plpythonu

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #3686: Incorrect numeric type conversion to long in plpythonu
Дата
Msg-id 17901.1193008527@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #3686: Incorrect numeric type conversion to long in plpythonu  ("Sergi" <sergi.vladykin@googlemail.com>)
Список pgsql-bugs
"Sergi" <sergi.vladykin@googlemail.com> writes:
> Problem is that numeric type converts to pythons long
> incorrectly. Here is the simple script that shows this.

The reason you're having a problem is that plpython translates PG's
numeric datatype to Python Float type, and thus the precision is
lost before the long() function ever sees it.

We can't fix this by translating to Long instead, since that would lose
fractional digits.

We could consider translating to the Decimal type proposed in PEP 327
http://www.python.org/dev/peps/pep-0327/
however it appears that that's only standard in Python 2.4 and later
which makes it rather a large portability problem.  I have no idea
what sort of backwards-compatibility issues such a change would
create, either ...

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #3682: Incomplete database restore
Следующее
От: "Gary Chambers"
Дата:
Сообщение: Re: BUG #3682: Incomplete database restore