From ec52b886d1dd8c08993b391753d450488e18f330 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Thu, 17 Jun 2021 16:37:13 +0200 Subject: [PATCH] Update plpython_subtransaction alternative expected files The original patch only targeted Python 2.6 and newer, since that is what we have supported in PostgreSQL 13 and newer. For older branches, we need to fix it up for older Python versions. --- src/pl/plpython/expected/plpython_subtransaction.out | 2 +- src/pl/plpython/expected/plpython_subtransaction_0.out | 9 ++++++--- src/pl/plpython/expected/plpython_subtransaction_5.out | 9 ++++++--- src/pl/plpython/sql/plpython_subtransaction.sql | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/pl/plpython/expected/plpython_subtransaction.out b/src/pl/plpython/expected/plpython_subtransaction.out index d9a830dfcc6..2a3253684f5 100644 --- a/src/pl/plpython/expected/plpython_subtransaction.out +++ b/src/pl/plpython/expected/plpython_subtransaction.out @@ -239,7 +239,7 @@ AS $$ try: with plpy.subtransaction() as s: s.__exit__(None, None, None) -except ValueError as e: +except ValueError, e: raise ValueError(e) $$ LANGUAGE plpythonu; SELECT subtransaction_exit_without_enter(); diff --git a/src/pl/plpython/expected/plpython_subtransaction_0.out b/src/pl/plpython/expected/plpython_subtransaction_0.out index cc6d9c0e93d..b9abf84f323 100644 --- a/src/pl/plpython/expected/plpython_subtransaction_0.out +++ b/src/pl/plpython/expected/plpython_subtransaction_0.out @@ -222,11 +222,14 @@ ERROR: could not compile PL/Python function "subtransaction_enter_subtransactio DETAIL: SyntaxError: invalid syntax (line 3) CREATE FUNCTION subtransaction_exit_subtransaction_in_with() RETURNS void AS $$ -with plpy.subtransaction() as s: - s.__exit__(None, None, None) +try: + with plpy.subtransaction() as s: + s.__exit__(None, None, None) +except ValueError, e: + raise ValueError(e) $$ LANGUAGE plpythonu; ERROR: could not compile PL/Python function "subtransaction_exit_subtransaction_in_with" -DETAIL: SyntaxError: invalid syntax (line 3) +DETAIL: SyntaxError: invalid syntax (line 4) SELECT subtransaction_exit_without_enter(); ERROR: ValueError: this subtransaction has not been entered CONTEXT: Traceback (most recent call last): diff --git a/src/pl/plpython/expected/plpython_subtransaction_5.out b/src/pl/plpython/expected/plpython_subtransaction_5.out index c3be1302680..854d763a951 100644 --- a/src/pl/plpython/expected/plpython_subtransaction_5.out +++ b/src/pl/plpython/expected/plpython_subtransaction_5.out @@ -222,11 +222,14 @@ ERROR: could not compile PL/Python function "subtransaction_enter_subtransactio DETAIL: SyntaxError: invalid syntax (, line 3) CREATE FUNCTION subtransaction_exit_subtransaction_in_with() RETURNS void AS $$ -with plpy.subtransaction() as s: - s.__exit__(None, None, None) +try: + with plpy.subtransaction() as s: + s.__exit__(None, None, None) +except ValueError, e: + raise ValueError(e) $$ LANGUAGE plpythonu; ERROR: could not compile PL/Python function "subtransaction_exit_subtransaction_in_with" -DETAIL: SyntaxError: invalid syntax (, line 3) +DETAIL: SyntaxError: invalid syntax (, line 4) SELECT subtransaction_exit_without_enter(); ERROR: ValueError: this subtransaction has not been entered CONTEXT: Traceback (most recent call last): diff --git a/src/pl/plpython/sql/plpython_subtransaction.sql b/src/pl/plpython/sql/plpython_subtransaction.sql index 572930f8bf2..ebd3c6e4167 100644 --- a/src/pl/plpython/sql/plpython_subtransaction.sql +++ b/src/pl/plpython/sql/plpython_subtransaction.sql @@ -161,7 +161,7 @@ AS $$ try: with plpy.subtransaction() as s: s.__exit__(None, None, None) -except ValueError as e: +except ValueError, e: raise ValueError(e) $$ LANGUAGE plpythonu;