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:
parent
2b792ab094
commit
f498704346
@ -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()
|
||||
$$;
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user