Re: [PATCH] plpythonu datatype conversion improvements

From: Hannu Krosing <hannu(at)2ndQuadrant(dot)com>
To: Caleb Welton <cwelton(at)greenplum(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] plpythonu datatype conversion improvements
Date: 2009-09-09 21:45:35
Message-ID: 1252532735.4080.31.camel@hvost1700
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 2009-05-27 at 14:25 -0700, Caleb Welton wrote:
> Yes, in Python >= 2.4 there is the Decimal datatype.
>
> However, unlike the other mappings employed by plpythonu, Decimal
> requires an import statement to be in scope.

adding it as already-imported module should not be hard

I think that moving to saner mappings should at least be discussed

and even if it is not in scope for the user-defined function body there
is nothing that prevents one from using it for conversion.

The Decimal _type_ needs not to be in scope for using Decimal
_instances_

maybe this should/could be controlled by a GUC.

btw, can we currently use funtions in setting GUC parameters ?

if we can , then we could define some python environment initializing
function and then do

ALTER USER xxx SET pyinit = initialise_python_for_xxx()

> -Caleb
>
> On 5/27/09 2:07 PM, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> > On Wednesday 27 May 2009 21:53:31 Caleb Welton wrote:
> >> ... My own
> >> feeling on the matter is that PyFloat is the wrong mapping
> for numeric, but
> >> I didn't want to muddy this patch by changing that.
>
> > Yeah, that one had me wondering for a while as well, but as
> you say it is
> > better to address that separately.
>
> That was making me itch as well, in my very cursory look at
> the patch.
> Does Python have a saner mapping for it?
>
> regards, tom lane
>
--
Hannu Krosing http://www.2ndQuadrant.com
PostgreSQL Scalability and Availability
Services, Consulting and Training

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2009-09-09 22:24:19 Bug in aggregates in windowing context
Previous Message decibel 2009-09-09 21:23:40 Re: RfD: more powerful "any" types