[PyGreSQL] Binding decimal.Decimal

Christoph Zwerschke cito at online.de
Mon Sep 15 15:18:41 EDT 2008


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.

But complete support for decimal.Decimal, i.e. returning decimal.Decimal 
for numeric types, needs some additions to pgmodule.c as well.

-- Christoph


More information about the PyGreSQL mailing list