BUG #13683: Problem with recursive call plpython function - Mailing list pgsql-bugs

From a.n.d@inbox.ru
Subject BUG #13683: Problem with recursive call plpython function
Date
Msg-id 20151015135804.3019.31908@wrigleys.postgresql.org
Whole thread Raw
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      13683
Logged by:          Andrey Chernyakov
Email address:      a.n.d@inbox.ru
PostgreSQL version: 9.4.1
Operating system:   RHEL 6.3
Description:

Exception "could not compile PL/Python function" on "create or replace
function ... language plpythonu" after recursive call plpython function.

Example:
[andrey@devbase ~]$ psql
psql (9.4.1)
Type "help" for help.

postgres=# create or replace function a(i integer) returns integer as
postgres-# $$
postgres$# if i > 42:
postgres$#     return i
postgres$# return plpy.execute("select a(%s)" % (i+1))[0]['a']
postgres$# $$ language plpythonu;
CREATE FUNCTION
postgres=#
postgres=# select a(0);
 a
----
 43
(1 row)

postgres=# create or replace function b() returns void as
postgres-# $$
postgres$# pass
postgres$# $$ language plpythonu;
ERROR:  could not compile PL/Python function "b"
DETAIL:  KeyError: 'i'

I am using plpython with python2.7

pgsql-bugs by date:

Previous
From: boyko yordanov
Date:
Subject: Re: BUG #13680: PostgreSQL backend process crashes on jsonb_object_agg() in plpgsql recursive function
Next
From: boyko yordanov
Date:
Subject: Re: BUG #13680: PostgreSQL backend process crashes on jsonb_object_agg() in plpgsql recursive function