Re: [HACKERS] adding import in pl/python function

2013-05-27 Thread Szymon Guz
On 28 May 2013 01:55, Peter Eisentraut wrote: > On Mon, 2013-05-27 at 20:43 -0300, Claudio Freire wrote: > > On Mon, May 27, 2013 at 8:13 PM, Peter Eisentraut > wrote: > > > On Fri, 2013-05-24 at 16:46 -0300, Claudio Freire wrote: > > >> Well, it's easy. > > >> > > >> Instead of PLyFloat_FromNum

Re: [HACKERS] adding import in pl/python function

2013-05-27 Thread Peter Eisentraut
On Mon, 2013-05-27 at 20:43 -0300, Claudio Freire wrote: > On Mon, May 27, 2013 at 8:13 PM, Peter Eisentraut wrote: > > On Fri, 2013-05-24 at 16:46 -0300, Claudio Freire wrote: > >> Well, it's easy. > >> > >> Instead of PLyFloat_FromNumeric[0], you can make a > >> PLyDecimal_FromNumeric. > > > > P

Re: [HACKERS] adding import in pl/python function

2013-05-27 Thread Claudio Freire
On Mon, May 27, 2013 at 8:13 PM, Peter Eisentraut wrote: > On Fri, 2013-05-24 at 16:46 -0300, Claudio Freire wrote: >> Well, it's easy. >> >> Instead of PLyFloat_FromNumeric[0], you can make a >> PLyDecimal_FromNumeric. > > Please send a patch. This would be a welcome addition. I can write it b

Re: [HACKERS] adding import in pl/python function

2013-05-27 Thread Peter Eisentraut
On Fri, 2013-05-24 at 16:46 -0300, Claudio Freire wrote: > Well, it's easy. > > Instead of PLyFloat_FromNumeric[0], you can make a > PLyDecimal_FromNumeric. Please send a patch. This would be a welcome addition. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make

Re: [HACKERS] adding import in pl/python function

2013-05-24 Thread Szymon Guz
On 24 May 2013 21:46, Claudio Freire wrote: > On Fri, May 24, 2013 at 4:22 PM, Szymon Guz wrote: > > Hm... maybe you're right. I think I don't understand fully how the > > procedures are executed, and I need to read more to get it. > > > Well, it's easy. > > Instead of PLyFloat_FromNumeric[0], y

Re: [HACKERS] adding import in pl/python function

2013-05-24 Thread Claudio Freire
On Fri, May 24, 2013 at 4:22 PM, Szymon Guz wrote: > Hm... maybe you're right. I think I don't understand fully how the > procedures are executed, and I need to read more to get it. Well, it's easy. Instead of PLyFloat_FromNumeric[0], you can make a PLyDecimal_FromNumeric. There, you'd do with

Re: [HACKERS] adding import in pl/python function

2013-05-24 Thread Szymon Guz
On 24 May 2013 21:14, Claudio Freire wrote: > On Fri, May 24, 2013 at 4:10 PM, Szymon Guz wrote: > > > > I'm thinking about something else. We could convert it into Decimal > > (http://docs.python.org/2/library/decimal.html) class in Python. > > Unfortunately this class requires import like `fro

Re: [HACKERS] adding import in pl/python function

2013-05-24 Thread Claudio Freire
On Fri, May 24, 2013 at 4:10 PM, Szymon Guz wrote: > > I'm thinking about something else. We could convert it into Decimal > (http://docs.python.org/2/library/decimal.html) class in Python. > Unfortunately this class requires import like `from decimal import Decimal` > from a standard Python libra

[HACKERS] adding import in pl/python function

2013-05-24 Thread Szymon Guz
Hi, I'm wondering if it would be OK to change the procedure code before execution. I'm thinking about adding magically an import at the beginning of a function. Currently numeric arguments passed to the procedure are converted into floats. This is not good, as it causes loss of information. The p