summaryrefslogtreecommitdiff
path: root/src/pl/plpython/sql
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-01-08 11:39:28 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2016-01-08 11:39:28 -0500
commita66c1fcdd7e4291561c5cdebc1d02784050260e2 (patch)
tree10e252f4cddf5e42a2cab0d77bed5407c2e044b7 /src/pl/plpython/sql
parent6a1a44037b63e1c0e51dd2ca7374191c2f5362b1 (diff)
PL/Python: Make tests pass with Python 3.5
The error message wording for AttributeError has changed in Python 3.5. For the plpython_error test, add a new expected file. In the plpython_subtransaction test, we didn't really care what the exception is, only that it is something coming from Python. So use a generic exception instead, which has a message that doesn't vary across versions. Back-patch of commit f16d52269a196f7f303abe3b978d95ade265f05f, which was previously back-patched into 9.2-9.4, but missed 9.5.
Diffstat (limited to 'src/pl/plpython/sql')
-rw-r--r--src/pl/plpython/sql/plpython_subtransaction.sql4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pl/plpython/sql/plpython_subtransaction.sql b/src/pl/plpython/sql/plpython_subtransaction.sql
index 9ad6377c7cd..3c188e3dd2d 100644
--- a/src/pl/plpython/sql/plpython_subtransaction.sql
+++ b/src/pl/plpython/sql/plpython_subtransaction.sql
@@ -23,7 +23,7 @@ try:
if what_error == "SPI":
plpy.execute("INSERT INTO subtransaction_tbl VALUES ('oops')")
elif what_error == "Python":
- plpy.attribute_error
+ raise Exception("Python exception")
except:
exc = False
subxact.__exit__(*sys.exc_info())
@@ -53,7 +53,7 @@ with plpy.subtransaction():
if what_error == "SPI":
plpy.execute("INSERT INTO subtransaction_tbl VALUES ('oops')")
elif what_error == "Python":
- plpy.attribute_error
+ raise Exception("Python exception")
$$ LANGUAGE plpythonu;
SELECT subtransaction_ctx_test();