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

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: "TJ O'Donnell" <tjo(at)acm(dot)org>
Subject: Re: plpython returns integer[] fails for multi-dimensional array
Date: 2010-12-21 23:32:44
Message-ID: 201012211532.45086.adrian.klaver@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tuesday 21 December 2010 2:48:16 pm TJ O'Donnell wrote:
> In postgresql-9.0.1 I have to modify my plpython functions that return
> arrays. It seems one dimesional arrays are handled properly, but not
> 2-dimensional arrays.
>
> create or replace function atest() returns integer[] as $eopy$
> a = list()
> a.append(1)
> a.append(2)
> a.append(3)
> #return a works fine
> b = list()
> b.append(a)
> b.append(a)
> # error
> return b
> $eopy$ language plpythonu
>
>
> select atest() gives
> obtest=# select atest();
> ERROR: invalid input syntax for integer: "[1, 2, 3]"
> CONTEXT: while creating return value
> PL/Python function "atest"
>
> How can I return multi-dimensional arrays in plpython?
>
> TJ O'Donnell

Maybe:
create or replace function atest() returns integer[][]

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-12-21 23:49:03 Re: libpq sendQuery -- getResult not returning until all queries complete
Previous Message Satoshi Nagayasu 2010-12-21 23:31:14 Re: Understanding PG9.0 streaming replication feature