Re: plpython returns integer[] fails for multi-dimensional array

From: "TJ O'Donnell" <tjo(at)acm(dot)org>
To: adrian(dot)klaver(at)gmail(dot)com
Cc: pgsql-general(at)postgresql(dot)org, Peter Geoghegan <peter(dot)geoghegan86(at)gmail(dot)com>, Thom Brown <thom(at)linux(dot)com>
Subject: Re: plpython returns integer[] fails for multi-dimensional array
Date: 2010-12-22 01:30:59
Message-ID: AANLkTi=s0oBcYrsqLGU9Mafi3iO7y5zkW+CdzqNYrGZo@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In previous versions (8.x) for plpython fn returning integer[]
I created (had to create) a string in the proper SQL format {
{1,2,3}, {4,5,6} }
and returned that. It worked fine.

I LIKE the ability to not have to do that in 9.0
but I CAN'T return and string like { {1,2,3}, {4,5,6} } for a fn that
returns integer[]
AND I can't return a two-dimensional array. Not a happy 9.0 camper.

Anyone know of any plans to 9.0 plpython to support multi-dimensional arrays?

TJ O'Donnell

On Tue, Dec 21, 2010 at 4:02 PM, Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> wrote:
> On Tuesday 21 December 2010 3:25:48 pm Peter Geoghegan wrote:
>> On 21 December 2010 23:17, Thom Brown <thom(at)linux(dot)com> wrote:
>> > Are you sure that "a" returns okay in that scenario.  You're using a
>> > list.  Shouldn't you be using an array?  Like: a = []
>>
>> a =[] actually declares an empty list in Python. You can return a list
>> or a tuple from a pl/python function in 9.0 and it will be interpreted
>> as an array at the SQL call site. You cannot in prior versions.
>>
>> --
>> Regards,
>> Peter Geoghegan
>
> Digging into the source for plpython seems to show it only supports one
> dimensional arrays. When I tried my previous example on a 9.0.1 instance it
> kept changing integer[][] to integer[].
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)gmail(dot)com
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2010-12-22 01:36:14 Re: Cannot unsubscribe
Previous Message Fujii Masao 2010-12-22 01:28:50 Re: Understanding PG9.0 streaming replication feature