From 70293e946e60bb7eb58f74656667458406a1b461 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 d36aac127bb..d578c099d03 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 97ee42b5a9a..45b57c2e77f 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 e172e98f86a..881d832560a 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;