Re: PL/Python array support
| От | Teodor Sigaev |
|---|---|
| Тема | Re: PL/Python array support |
| Дата | |
| Msg-id | 4AFD7F62.3010901@sigaev.ru обсуждение исходный текст |
| Ответ на | Re: PL/Python array support (Peter Eisentraut <peter_e@gmx.net>) |
| Ответы |
Re: PL/Python array support
|
| Список | 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@sigaev.ru
WWW: http://www.sigaev.ru/
В списке pgsql-hackers по дате отправления: