Skip to content

Commit f498704

Browse files
committed
PL/Python: Fix tests for older Python versions
Commit 8561e48 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.
1 parent 2b792ab commit f498704

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/pl/plpython/expected/plpython_transaction.out

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ CONTEXT: Traceback (most recent call last):
9595
PL/Python function "transaction_test4"
9696
-- commit inside subtransaction (prohibited)
9797
DO LANGUAGE plpythonu $$
98-
with plpy.subtransaction():
99-
plpy.commit()
98+
s = plpy.subtransaction()
99+
s.enter()
100+
plpy.commit()
100101
$$;
101102
WARNING: forcibly aborting a subtransaction that has not been exited
102103
ERROR: cannot commit while a subtransaction is active

src/pl/plpython/sql/plpython_transaction.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ SELECT transaction_test4();
7979

8080
-- commit inside subtransaction (prohibited)
8181
DO LANGUAGE plpythonu $$
82-
with plpy.subtransaction():
83-
plpy.commit()
82+
s = plpy.subtransaction()
83+
s.enter()
84+
plpy.commit()
8485
$$;
8586

8687

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy