From: | Szymon Guz <mabewlun(at)gmail(dot)com> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | Ronan Dunklau <rdunklau(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [PATCH] Fix conversion for Decimal arguments in plpython functions |
Date: | 2013-06-26 20:47:47 |
Message-ID: | CAFjNrYt6o61d-TqoL=yFfHrVSy6o2Tqq-joCsn54CZPsYYPZBg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 26 June 2013 22:08, Szymon Guz <mabewlun(at)gmail(dot)com> wrote:
> On 26 June 2013 21:59, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
>
>> On 6/26/13 7:03 AM, Szymon Guz wrote:
>> > 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.
>>
>> Could the setup of the decimal.Decimal constructor be moved into
>> PLyDecimal_FromNumeric() and kept in a static pointer? I'd rather not
>> clutter up the main initialization routine.
>>
>>
Attached patch has all changes against trunk code.
There is added a function for conversion from Postgres numeric to Python
Decimal. The Decimal type is taken from cdecimal.Decimal, if it is
available. It is an external library, quite fast, but may be not available.
If it is not available, then decimal.Decimal will be used. It is in
standard Python library, however it is rather slow.
The initialization is done in the conversion function, the pointer to a
proper Decimal constructor is stored as static variable inside the function
and is lazy initialized.
The documentation is updated.
Tests for python 2 and 3 have been added. They work only with standard
decimal.Decimal, as the type is printed in the *.out files. I think there
is nothing we can do with that now.
regards,
Szymon
Attachment | Content-Type | Size |
---|---|---|
plpython_decimal_v5.patch | application/octet-stream | 9.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Selena Deckelmann | 2013-06-26 21:32:24 | Re: Kudos for Reviewers -- straw poll |
Previous Message | Peter Eisentraut | 2013-06-26 20:46:50 | Re: MD5 aggregate |