1 Star 0 Fork 41

wuzx/postgresql

forked from src-openEuler/postgresql 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
postgresql-subtransaction-test.patch 2.67 KB
一键复制 编辑 原始数据 按行查看 历史
caodongxia 提交于 2022-05-06 15:50 . fix subtransaction test failed
Fix subtransaction test for Python 3.10
Starting with Python 3.10, the stacktrace looks differently:
- PL/Python function "subtransaction_exit_subtransaction_in_with", line 3, in <module>
- s.__exit__(None, None, None)
+ PL/Python function "subtransaction_exit_subtransaction_in_with", line 2, in <module>
+ with plpy.subtransaction() as s:
Using try/except specifically makes the error look always the same.
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1959080
diff -up postgresql-13.2/src/pl/plpython/expected/plpython_subtransaction.out.patchnew postgresql-13.2/src/pl/plpython/expected/plpython_subtransaction.out
--- postgresql-13.2/src/pl/plpython/expected/plpython_subtransaction.out.patchnew 2021-02-08 22:54:11.000000000 +0100
+++ postgresql-13.2/src/pl/plpython/expected/plpython_subtransaction.out 2021-05-11 21:04:25.085586012 +0200
@@ -171,8 +171,11 @@ with plpy.subtransaction() as s:
$$ LANGUAGE plpythonu;
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 as e:
+ raise ValueError(e)
$$ LANGUAGE plpythonu;
SELECT subtransaction_exit_without_enter();
ERROR: ValueError: this subtransaction has not been entered
@@ -224,8 +227,8 @@ PL/Python function "subtransaction_enter
SELECT subtransaction_exit_subtransaction_in_with();
ERROR: ValueError: this subtransaction has already been exited
CONTEXT: Traceback (most recent call last):
- PL/Python function "subtransaction_exit_subtransaction_in_with", line 3, in <module>
- s.__exit__(None, None, None)
+ PL/Python function "subtransaction_exit_subtransaction_in_with", line 6, in <module>
+ raise ValueError(e)
PL/Python function "subtransaction_exit_subtransaction_in_with"
-- Make sure we don't get a "current transaction is aborted" error
SELECT 1 as test;
diff -up postgresql-13.2/src/pl/plpython/sql/plpython_subtransaction.sql.patchnew postgresql-13.2/src/pl/plpython/sql/plpython_subtransaction.sql
--- postgresql-13.2/src/pl/plpython/sql/plpython_subtransaction.sql.patchnew 2021-02-08 22:54:11.000000000 +0100
+++ postgresql-13.2/src/pl/plpython/sql/plpython_subtransaction.sql 2021-05-11 21:02:34.386415376 +0200
@@ -121,8 +121,11 @@ $$ LANGUAGE plpythonu;
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 as e:
+ raise ValueError(e)
$$ LANGUAGE plpythonu;
SELECT subtransaction_exit_without_enter();
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wuzx065891/postgresql.git
git@gitee.com:wuzx065891/postgresql.git
wuzx065891
postgresql
postgresql
master

搜索帮助