8000 Fix subtransaction test for Python 3.10 · postgres/postgres@6b6fbfd · GitHub
[go: up one dir, main page]

Skip to content

Commit 6b6fbfd

Browse files

Original file line numberDiff line numberDiff line change
@@ -236,8 +236,11 @@ with plpy.subtransaction() as s:
236236
$$ LANGUAGE plpythonu;
237237
CREATE FUNCTION subtransaction_exit_subtransaction_in_with() RETURNS void
238238
AS $$
239-
with plpy.subtransaction() as s:
240-
s.__exit__(None, None, None)
239+
try:
240+
with plpy.subtransaction() as s:
241+
s.__exit__(None, None, None)
242+
except ValueError as e:
243+
raise ValueError(e)
241244
$$ LANGUAGE plpythonu;
242245
SELECT subtransaction_exit_without_enter();
243246
ERROR: ValueError: this subtransaction has not been entered
@@ -289,8 +292,8 @@ PL/Python function "subtransaction_enter_subtransaction_in_with"
289292
SELECT subtransaction_exit_subtransaction_in_with();
290293
ERROR: ValueError: this subtransaction has already been exited
291294
CONTEXT: Traceback (most recent call last):
292-
PL/Python function "subtransaction_exit_subtransaction_in_with", line 3, in <module>
293-
s.__exit__(None, None, None)
295+
PL/Python function "subtransaction_exit_subtransaction_in_with", line 6, in <module>
296+
raise ValueError(e)
294297
PL/Python function "subtransaction_exit_subtransaction_in_with"
295298
-- Make sure we don't get a "current transaction is aborted" error
296299
SELECT 1 as test;
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,11 @@ $$ LANGUAGE plpythonu;
158158

159159
CREATE FUNCTION subtransaction_exit_subtransaction_in_with() RETURNS void
160160
AS $$
161-
with plpy.subtransaction() as s:
162-
s.__exit__(None, None, None)
161+
try:
162+
with plpy.subtransaction() as s:
163+
s.__exit__(None, None, None)
164+
except ValueError as e:
165+
raise ValueError(e)
163166
$$ LANGUAGE plpythonu;
164167

165168
SELECT subtransaction_exit_without_enter();