mirror of
https://github.com/postgres/postgres.git
synced 2025-06-27 23:21:58 +03:00
PL/Python: Fix tests for older Python versions
Commit 8561e4840c
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.
This commit is contained in:
@ -95,7 +95,8 @@ CONTEXT: Traceback (most recent call last):
|
|||||||
PL/Python function "transaction_test4"
|
PL/Python function "transaction_test4"
|
||||||
-- commit inside subtransaction (prohibited)
|
-- commit inside subtransaction (prohibited)
|
||||||
DO LANGUAGE plpythonu $$
|
DO LANGUAGE plpythonu $$
|
||||||
with plpy.subtransaction():
|
s = plpy.subtransaction()
|
||||||
|
s.enter()
|
||||||
plpy.commit()
|
plpy.commit()
|
||||||
$$;
|
$$;
|
||||||
WARNING: forcibly aborting a subtransaction that has not been exited
|
WARNING: forcibly aborting a subtransaction that has not been exited
|
||||||
|
@ -79,7 +79,8 @@ SELECT transaction_test4();
|
|||||||
|
|
||||||
-- commit inside subtransaction (prohibited)
|
-- commit inside subtransaction (prohibited)
|
||||||
DO LANGUAGE plpythonu $$
|
DO LANGUAGE plpythonu $$
|
||||||
with plpy.subtransaction():
|
s = plpy.subtransaction()
|
||||||
|
s.enter()
|
||||||
plpy.commit()
|
plpy.commit()
|
||||||
$$;
|
$$;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user