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.
This commit is contained in:
Peter Eisentraut 2021-06-17 16:37:13 +02:00
parent 25c171f322
commit ba529a6ff4
4 changed files with 14 additions and 8 deletions

View File

@ -239,7 +239,7 @@ AS $$
try: try:
with plpy.subtransaction() as s: with plpy.subtransaction() as s:
s.__exit__(None, None, None) s.__exit__(None, None, None)
except ValueError as e: except ValueError, e:
raise ValueError(e) raise ValueError(e)
$$ LANGUAGE plpythonu; $$ LANGUAGE plpythonu;
SELECT subtransaction_exit_without_enter(); SELECT subtransaction_exit_without_enter();

View File

@ -222,11 +222,14 @@ ERROR: could not compile PL/Python function "subtransaction_enter_subtransactio
DETAIL: SyntaxError: invalid syntax (line 3) DETAIL: SyntaxError: invalid syntax (line 3)
CREATE FUNCTION subtransaction_exit_subtransaction_in_with() RETURNS void CREATE FUNCTION subtransaction_exit_subtransaction_in_with() RETURNS void
AS $$ AS $$
with plpy.subtransaction() as s: try:
s.__exit__(None, None, None) with plpy.subtransaction() as s:
s.__exit__(None, None, None)
except ValueError, e:
raise ValueError(e)
$$ LANGUAGE plpythonu; $$ LANGUAGE plpythonu;
ERROR: could not compile PL/Python function "subtransaction_exit_subtransaction_in_with" 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(); SELECT subtransaction_exit_without_enter();
ERROR: ValueError: this subtransaction has not been entered ERROR: ValueError: this subtransaction has not been entered
CONTEXT: Traceback (most recent call last): CONTEXT: Traceback (most recent call last):

View File

@ -222,11 +222,14 @@ ERROR: could not compile PL/Python function "subtransaction_enter_subtransactio
DETAIL: SyntaxError: invalid syntax (<string>, line 3) DETAIL: SyntaxError: invalid syntax (<string>, line 3)
CREATE FUNCTION subtransaction_exit_subtransaction_in_with() RETURNS void CREATE FUNCTION subtransaction_exit_subtransaction_in_with() RETURNS void
AS $$ AS $$
with plpy.subtransaction() as s: try:
s.__exit__(None, None, None) with plpy.subtransaction() as s:
s.__exit__(None, None, None)
except ValueError, e:
raise ValueError(e)
$$ LANGUAGE plpythonu; $$ LANGUAGE plpythonu;
ERROR: could not compile PL/Python function "subtransaction_exit_subtransaction_in_with" ERROR: could not compile PL/Python function "subtransaction_exit_subtransaction_in_with"
DETAIL: SyntaxError: invalid syntax (<string>, line 3) DETAIL: SyntaxError: invalid syntax (<string>, line 4)
SELECT subtransaction_exit_without_enter(); SELECT subtransaction_exit_without_enter();
ERROR: ValueError: this subtransaction has not been entered ERROR: ValueError: this subtransaction has not been entered
CONTEXT: Traceback (most recent call last): CONTEXT: Traceback (most recent call last):

View File

@ -161,7 +161,7 @@ AS $$
try: try:
with plpy.subtransaction() as s: with plpy.subtransaction() as s:
s.__exit__(None, None, None) s.__exit__(None, None, None)
except ValueError as e: except ValueError, e:
raise ValueError(e) raise ValueError(e)
$$ LANGUAGE plpythonu; $$ LANGUAGE plpythonu;