greenplum-db/plcontainer

ERROR Cannot reraise exception

BaiShaoqi opened this issue · 2 comments

Expected behavior

ERROR:  plpy.Error: type "test" does not exist (plpython.c:4960)
CONTEXT:  Traceback (most recent call last):
  PL/Python function "invalid_type_reraised", line 6, in <module>
    plpy.error(str(ex))
PL/Python function "invalid_type_reraised"

Actual behavior

ERROR: type "test" does not exist

Step to reproduce the behavior

CREATE TABLE users (
	fname text not null,
	lname text not null,
	username text,
	userid serial,
	PRIMARY KEY(lname, fname)
	) ;

INSERT INTO users (fname, lname, username) VALUES ('jane', 'doe', 'j_doe');
INSERT INTO users (fname, lname, username) VALUES ('john', 'doe', 'johnd');
INSERT INTO users (fname, lname, username) VALUES ('willem', 'doe', 'w_doe');
INSERT INTO users (fname, lname, username) VALUES ('rick', 'smith', 'slash');

CREATE FUNCTION invalid_type_reraised(a text) RETURNS text
AS $$
# container: plc_python_shared
if "plan" not in SD:
    q = "SELECT fname FROM users WHERE lname = $1"
    try:
        SD["plan"] = plpy.prepare(q, [ "test" ])
    except plpy.SPIError, ex:
        plpy.error(str(ex))
rv = plpy.execute(SD["plan"], [ a ])
if len(rv):
    return rv[0]["fname"]
return None
$$ LANGUAGE plcontainer;

SELECT invalid_type_reraised('rick');

We have created an issue in Pivotal Tracker to manage this. Unfortunately, the Pivotal Tracker project is private so you may be unable to view the contents of the story.

The labels on this github issue will be updated when the story is started.

This is dup to #411
Closed