Re: PL/Python array support

Peter Eisentraut <peter_e@gmx.net>

From: Peter Eisentraut <peter_e@gmx.net>
To: Teodor Sigaev <teodor@sigaev.ru>
Cc: pgsql-hackers@postgresql.org
Date: 2009-11-19T22:00:24Z
Lists: pgsql-hackers

Attachments

On fre, 2009-11-13 at 18:46 +0300, Teodor Sigaev wrote:
> CREATE OR REPLACE FUNCTION incr(stuff int[]) RETURNS int[] AS $$
> for x in stuff:
>      yield x+1
> $$
> LANGUAGE 'plpythonu';
> 
> # select incr(ARRAY[1,2,3]);
> ERROR:  invalid memory alloc request size 18446744073709551608
> CONTEXT:  while creating return value
> PL/Python function "incr"

Fixed with additional error check and regression test.  (The problem
could be more simply demonstrated by returning any non-sequence from the
function.)  Thanks for catching it.