Re: [PATCH] Fix conversion for Decimal arguments in plpython functions - Mailing list pgsql-hackers

From Szymon Guz
Subject Re: [PATCH] Fix conversion for Decimal arguments in plpython functions
Date
Msg-id CAFjNrYuZW_1zPs1SJtJJAPSdnGZ=r4S7Ks4rE1yVa0-JVrHQMA@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Fix conversion for Decimal arguments in plpython functions  (Ronan Dunklau <rdunklau@gmail.com>)
Responses Re: [PATCH] Fix conversion for Decimal arguments in plpython functions
List pgsql-hackers
On 26 June 2013 12:04, Ronan Dunklau <rdunklau@gmail.com> wrote:
It seems like you confused me with steve :)


Hi Ronan,
Oh, yes. I'm sorry for that :) 
 
The patch applies cleanly, and the regression tests pass on python2 when cdecimal is not installed. When it is, the type info returned for the converted numeric value is cdecimal.Decimal instead of decimal.Decimal.

The regression tests expected output have not been modified for python3, and as such they fail on the type conversions.

I am a bit confused with the use of PyModule_GetDict: shouldn't PyObj_GetAttrString be used directly instead ? Moreover, the reference count in the current implementation might be off: the reference count for the decimal module is never decreased, while the reference count to the module dict is, when the docs say it returns a borrowed reference.

Please find a patch that fixes both issues.


Thanks for the patch. I assume you generated that from clean trunk, and it includes all the changes (mine and yours) right?

I've checked the patch, everything looks great.
I've attached it to this email with changed name, just for consistent naming in commitfest app.

thanks,
Szymon

Attachment

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Review: Patch to compute Max LSN of Data Pages
Next
From: Ants Aasma
Date:
Subject: Re: Bloom Filter lookup for hash joins