[SYNC][2203LTS-NEXT] SYNC the branches 2203lts 2209 and master

Add and cherrypick commit from master and sync with all branches.
This commit is contained in:
bzhaoop 2022-08-01 19:42:27 +08:00
parent 423049e686
commit 6280f04946
2 changed files with 64 additions and 1 deletions

View File

@ -0,0 +1,56 @@
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();

View File

@ -32,7 +32,7 @@ Summary: PostgreSQL client programs
Name: postgresql Name: postgresql
%global majorversion 13 %global majorversion 13
Version: %{majorversion}.3 Version: %{majorversion}.3
Release: 5 Release: 6
# The PostgreSQL license is very similar to other MIT licenses, but the OSI # The PostgreSQL license is very similar to other MIT licenses, but the OSI
# recognizes it as an independent license, so we do as well. # recognizes it as an independent license, so we do as well.
@ -78,6 +78,7 @@ Patch10: postgresql-no-libecpg.patch
Patch11: postgresql-datalayout-mismatch-on-s390.patch Patch11: postgresql-datalayout-mismatch-on-s390.patch
Patch12: CVE-2021-23214.patch Patch12: CVE-2021-23214.patch
Patch13: CVE-2021-23222.patch Patch13: CVE-2021-23222.patch
Patch14: postgresql-subtransaction-test.patch
BuildRequires: gcc BuildRequires: gcc
BuildRequires: perl(ExtUtils::MakeMaker) glibc-devel bison flex gawk BuildRequires: perl(ExtUtils::MakeMaker) glibc-devel bison flex gawk
@ -352,6 +353,7 @@ goal of accelerating analytics queries.
%patch11 -p1 %patch11 -p1
%patch12 -p1 %patch12 -p1
%patch13 -p1 %patch13 -p1
%patch14 -p1
# We used to run autoconf here, but there's no longer any real need to, # We used to run autoconf here, but there's no longer any real need to,
# since Postgres ships with a reasonably modern configure script. # since Postgres ships with a reasonably modern configure script.
@ -1238,6 +1240,11 @@ make -C postgresql-setup-%{setup_version} check
%changelog %changelog
* Mon Aug 1 2022 bzhaoop <bzhaojyathousandy@gmail.com> - 13.3-6
- Porting "Fix subtransaction test failed" from master branch
- Fri May 6 2022 caodongxia <caodongxia@h-partners.com> - 13.3-4
- sync the same line with master
* Fri Mar 11 2022 wangkai <wangkai385@huawei.com> - 13.3-5 * Fri Mar 11 2022 wangkai <wangkai385@huawei.com> - 13.3-5
- Fix CVE-2021-23214 CVE-2021-23222 - Fix CVE-2021-23214 CVE-2021-23222