BUG #13683: Problem with recursive call plpython function

From: a(dot)n(dot)d(at)inbox(dot)ru
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #13683: Problem with recursive call plpython function
Date: 2015-10-15 13:58:04
Message-ID: 20151015135804.3019.31908@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 13683
Logged by: Andrey Chernyakov
Email address: a(dot)n(dot)d(at)inbox(dot)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(at)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

Browse pgsql-bugs by date

  From Date Subject
Next Message Amit Kapila 2015-10-15 14:28:59 Re: PQexec() hangs on OOM
Previous Message boyko yordanov 2015-10-15 11:37:07 Re: BUG #13680: PostgreSQL backend process crashes on jsonb_object_agg() in plpgsql recursive function