From: | Teodor Sigaev <teodor(at)sigaev(dot)ru> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: PL/Python array support |
Date: | 2009-11-13 15:46:42 |
Message-ID: | 4AFD7F62.3010901@sigaev.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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: teodor(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2009-11-13 15:46:49 | Re: next CommitFest |
Previous Message | Florian G. Pflug | 2009-11-13 15:46:32 | Re: Check constraint on domain over an array not executed for array literals |