"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