Commit f4987043 authored by Peter Eisentraut's avatar Peter Eisentraut

PL/Python: Fix tests for older Python versions

Commit 8561e484 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.
parent 2b792ab0
......@@ -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
......
......@@ -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()
$$;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment