From: | Teodor Sigaev <teodor(at)sigaev(dot)ru> |
---|---|
To: | Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>, Peter Eisentraut <peter_e(at)gmx(dot)net> |
Subject: | PlPython bug in 9.0/8.4.4 |
Date: | 2010-06-08 09:37:20 |
Message-ID: | 4C0E0F50.3080006@sigaev.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
The way to reproduce:
CREATE OR REPLACE FUNCTION foobar(a integer[])
RETURNS SETOF int8 AS
$$
def getplan(name, query, args):
if SD.has_key(name):
plpy.warning("Using cached plan %s" % name)
return SD[name]
plpy.warning("Prepare plan %s" % name);
plan = plpy.prepare(query, args)
plpy.warning("Plan %s prepared" % name);
SD[name] = plan
return plan
for s in a:
userPlan = getplan('fooplan', 'select 1', []);
rrr = plpy.execute(plan, []) # variable plan isn't defined!
ret = s
yield ret
$$
LANGUAGE 'plpythonu';
On 9.0beta2 (instead of correct message "<type 'exceptions.NameError'>: global
name 'plan' is not defined"):
postgres=# select foobar('{1,2,3}');
WARNING: Prepare plan fooplan
CONTEXT: PL/Python function "foobar"
WARNING: PL/Python: plpy.SPIError: unrecognized error in PLy_spi_prepare
CONTEXT: PL/Python function "foobar"
ERROR: error fetching next item from iterator
CONTEXT: PL/Python function "foobar"
postgres=# select foobar('{1,2,3}');
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!?>
Log:
TRAP: FailedAssertion("!(edata->elevel == 20)", File: "elog.c", Line: 1280)
8.4.4 haves essentially the same bug.
--
Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/
From | Date | Subject | |
---|---|---|---|
Next Message | Rob Wultsch | 2010-06-08 09:50:23 | Re: Functional dependencies and GROUP BY |
Previous Message | Peter Eisentraut | 2010-06-08 09:32:00 | Re: Functional dependencies and GROUP BY |