1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-02 11:44:50 +03:00

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.
This commit is contained in:
Peter Eisentraut 2018-01-22 12:09:52 -05:00
parent 2b792ab094
commit f498704346
2 changed files with 6 additions and 4 deletions

View File

@ -95,8 +95,9 @@ 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()
plpy.commit() s.enter()
plpy.commit()
$$; $$;
WARNING: forcibly aborting a subtransaction that has not been exited WARNING: forcibly aborting a subtransaction that has not been exited
ERROR: cannot commit while a subtransaction is active ERROR: cannot commit while a subtransaction is active

View File

@ -79,8 +79,9 @@ SELECT transaction_test4();
-- commit inside subtransaction (prohibited) -- commit inside subtransaction (prohibited)
DO LANGUAGE plpythonu $$ DO LANGUAGE plpythonu $$
with plpy.subtransaction(): s = plpy.subtransaction()
plpy.commit() s.enter()
plpy.commit()
$$; $$;