Re: Patch to add support for text/int arrays for plpythonu

From: "Valtonen, Hannu" <hannu(dot)valtonen(at)hut(dot)fi>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patch to add support for text/int arrays for plpythonu
Date: 2009-04-26 16:05:47
Message-ID: 49F4865B.2060901@hut.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 4/26/09 6:23 PM, Tom Lane wrote:
> Why in the world would you confine the feature to just two data types?
> This seems like a fundamentally incorrect approach.
>
>
The reason why I wrote it that way is because that's the way plpythonu's
conversion to python and back is set up.

Without my patch it currently knows how to convert BOOLOID, FLOAT4OID,
FLOAT8OID, NUMERICOID, INT2OID, INT4OID, INT8OID from pgsql form to
python form and back again as function return types. All the rest of the
pgsql types are converted into python strings with 1:1 textual
representation from pgsql. (This includes all array types)

What my patch basically changes is that instead of making an INT4/TEXT
array a python string, it converts them to python list()'s with
corresponding types. The rest are still being converted into python
strings. So I started with INT[] and TEXT[] because those were the ones
I actually needed myself but extending conversion support to for example
to FLOATs/NUMERICs wouldn't be that hard.

It also basically corresponds with postgresql/src/pl/plpython/TODO's:
"* Allow arrays as function arguments and return values. (almost done)"

- Hannu

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Grzegorz Jaskiewicz 2009-04-26 16:25:59 Re: GCC 4.4 compiler warnings
Previous Message Tom Lane 2009-04-26 15:23:24 Re: Patch to add support for text/int arrays for plpythonu