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"
Suppose, it could be fixed by additional check in PLy_function_handler near line
947 :
if (proc->is_setof) {
...
}
else if (PyIter_Check(plrv))
{
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("returned object should be iterated"),
errdetail("PL/Python returns iterable object in non-setof returning
context")));
}
Peter Eisentraut wrote:
On ons, 2009-11-04 at 16:02 +0200, Peter Eisentraut wrote:
Here is a patch to support arrays in PL/Python as parameters and
return values.
Slightly updated version with fixed reference counting.
------------------------------------------------------------------------
--
Teodor Sigaev E-mail: teo...@sigaev.ru
WWW: http://www.sigaev.ru/
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers