[PyGreSQL] Binding decimal.Decimal

Gregory Golberg grisha at snaplogic.org
Tue Sep 16 00:42:03 EDT 2008


Christoph Zwerschke wrote:
> Gregory Golberg schrieb:
> >> What exactly did you do to get this error? Pygres should play nice 
> >> with Decimals, the only problem is that it treats them are binary floats.
> >>   
> > This happened when I ran a cursor.execute() and used Decimals for 
> > parameters
>
> Ah, ok. This can be fixed quite easily, by adding decimal.Decimal to the 
> list of number types in pgdb._quote.
>   
Is that a read-only field or can it be tweaked by a caller of pgdb?
> But complete support for decimal.Decimal, i.e. returning decimal.Decimal 
> for numeric types, needs some additions to pgmodule.c as well.
>   

This definitely needs doing, though, as using arbitrary-precision math 
with databases is important.

-g
-------------- next part --------------
A non-text attachment was scrubbed...
Name: grisha.vcf
Type: text/x-vcard
Size: 274 bytes
Desc: not available
Url : http://mailman.vex.net/pipermail/pygresql/attachments/20080915/1c433868/attachment.vcf 


More information about the PyGreSQL mailing list