diff options
author | Peter Eisentraut | 2018-01-22 17:09:52 +0000 |
---|---|---|
committer | Peter Eisentraut | 2018-01-22 17:09:52 +0000 |
commit | f498704346a4ce4953fc5f837cacb545b3166ee1 (patch) | |
tree | 8b2fc5014d9d9651b5c7ef6ea9e975b1a374a5e5 | |
parent | 2b792ab094415f351abd5854de5cefb023931a85 (diff) |
PL/Python: Fix tests for older Python versions
Commit 8561e4840c81f7e345be2df170839846814fa004 neglected to handle
older Python versions that don't support the "with" statement. So write
the tests in a way that older versions can handle as well.
-rw-r--r-- | src/pl/plpython/expected/plpython_transaction.out | 5 | ||||
-rw-r--r-- | src/pl/plpython/sql/plpython_transaction.sql | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/pl/plpython/expected/plpython_transaction.out b/src/pl/plpython/expected/plpython_transaction.out index 1fadc69b63..6f6dfadf9c 100644 --- a/src/pl/plpython/expected/plpython_transaction.out +++ b/src/pl/plpython/expected/plpython_transaction.out @@ -95,8 +95,9 @@ CONTEXT: Traceback (most recent call last): PL/Python function "transaction_test4" -- commit inside subtransaction (prohibited) DO LANGUAGE plpythonu $$ -with plpy.subtransaction(): - plpy.commit() +s = plpy.subtransaction() +s.enter() +plpy.commit() $$; WARNING: forcibly aborting a subtransaction that has not been exited ERROR: cannot commit while a subtransaction is active diff --git a/src/pl/plpython/sql/plpython_transaction.sql b/src/pl/plpython/sql/plpython_transaction.sql index 36c7b2ef38..b337d4e300 100644 --- a/src/pl/plpython/sql/plpython_transaction.sql +++ b/src/pl/plpython/sql/plpython_transaction.sql @@ -79,8 +79,9 @@ SELECT transaction_test4(); -- commit inside subtransaction (prohibited) DO LANGUAGE plpythonu $$ -with plpy.subtransaction(): - plpy.commit() +s = plpy.subtransaction() +s.enter() +plpy.commit() $$; |