]> granicus.if.org Git - postgresql/commitdiff
PL/Python: Fix tests for older Python versions
authorPeter Eisentraut <peter_e@gmx.net>
Mon, 22 Jan 2018 17:09:52 +0000 (12:09 -0500)
committerPeter Eisentraut <peter_e@gmx.net>
Mon, 22 Jan 2018 17:09:52 +0000 (12:09 -0500)
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.

src/pl/plpython/expected/plpython_transaction.out
src/pl/plpython/sql/plpython_transaction.sql

index 1fadc69b6364ad8dc7336217651af8f6c61a5359..6f6dfadf9c3949d463bb19b75a06515e296c314d 100644 (file)
@@ -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
index 36c7b2ef385420bf86e2939f31127c05d9ea548a..b337d4e3006ddcb304c813afff71cf7f837bd71c 100644 (file)
@@ -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()
 $$;