Fix compatibility with Perl 5.36

Resolves: #2092426
This commit is contained in:
Honza Horak 2022-06-06 15:59:49 +02:00
parent 2e3ea50177
commit 8b4a2d7268
2 changed files with 69 additions and 1 deletions

View File

@ -0,0 +1,61 @@
From eb39610f82679e015dd990a3fbba1c62e399c32a Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Wed, 1 Jun 2022 16:15:47 -0400
Subject: [PATCH] Fix pl/perl test case so it will still work under Perl 5.36.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Perl 5.36 has reclassified the warning condition that this test
case used, so that the expected error fails to appear. Tweak
the test so it instead exercises a case that's handled the same
way in all Perl versions of interest.
This appears to meet our standards for back-patching into
out-of-support branches: it changes no user-visible behavior
but enables testing of old branches with newer tools.
Hence, back-patch as far as 9.2.
Dagfinn Ilmari Mannsåker, per report from Jitka Plesníková.
Discussion: https://postgr.es/m/564579.1654093326@sss.pgh.pa.us
---
src/pl/plperl/expected/plperl.out | 6 +++---
src/pl/plperl/sql/plperl.sql | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/pl/plperl/expected/plperl.out b/src/pl/plperl/expected/plperl.out
index d8a1ff5dd8..e3d7c8896a 100644
--- a/src/pl/plperl/expected/plperl.out
+++ b/src/pl/plperl/expected/plperl.out
@@ -724,9 +724,9 @@ DO $do$ use strict; my $name = "foo"; my $ref = $$name; $do$ LANGUAGE plperl;
ERROR: Can't use string ("foo") as a SCALAR ref while "strict refs" in use at line 1.
CONTEXT: PL/Perl anonymous code block
-- check that we can "use warnings" (in this case to turn a warn into an error)
--- yields "ERROR: Useless use of sort in scalar context."
-DO $do$ use warnings FATAL => qw(void) ; my @y; my $x = sort @y; 1; $do$ LANGUAGE plperl;
-ERROR: Useless use of sort in scalar context at line 1.
+-- yields "ERROR: Useless use of sort in void context."
+DO $do$ use warnings FATAL => qw(void) ; my @y; sort @y; 1; $do$ LANGUAGE plperl;
+ERROR: Useless use of sort in void context at line 1.
CONTEXT: PL/Perl anonymous code block
-- make sure functions marked as VOID without an explicit return work
CREATE OR REPLACE FUNCTION myfuncs() RETURNS void AS $$
diff --git a/src/pl/plperl/sql/plperl.sql b/src/pl/plperl/sql/plperl.sql
index b0d950b230..bb0b8ce4cb 100644
--- a/src/pl/plperl/sql/plperl.sql
+++ b/src/pl/plperl/sql/plperl.sql
@@ -469,8 +469,8 @@ DO $$ use blib; $$ LANGUAGE plperl;
DO $do$ use strict; my $name = "foo"; my $ref = $$name; $do$ LANGUAGE plperl;
-- check that we can "use warnings" (in this case to turn a warn into an error)
--- yields "ERROR: Useless use of sort in scalar context."
-DO $do$ use warnings FATAL => qw(void) ; my @y; my $x = sort @y; 1; $do$ LANGUAGE plperl;
+-- yields "ERROR: Useless use of sort in void context."
+DO $do$ use warnings FATAL => qw(void) ; my @y; sort @y; 1; $do$ LANGUAGE plperl;
-- make sure functions marked as VOID without an explicit return work
CREATE OR REPLACE FUNCTION myfuncs() RETURNS void AS $$
--
2.35.1

View File

@ -65,7 +65,7 @@ Summary: PostgreSQL client programs
Name: postgresql
%global majorversion 14
Version: %{majorversion}.3
Release: 3%{?dist}
Release: 4%{?dist}
# The PostgreSQL license is very similar to other MIT licenses, but the OSI
# recognizes it as an independent license, so we do as well.
@ -120,6 +120,8 @@ Patch12: postgresql-no-libecpg.patch
Patch14: postgresql-pgcrypto-openssl3-tests.patch
# Fix compatibility with Python 3.11
Patch15: postgresql-SPI-s-handling-of-errors-during-transaction-comm.patch
# Fix compatibility with Perl 5.36
Patch16: postgresql-pl-perl-test-case.patch
BuildRequires: make
BuildRequires: gcc
@ -438,6 +440,7 @@ goal of accelerating analytics queries.
%patch10 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
# We used to run autoconf here, but there's no longer any real need to,
# since Postgres ships with a reasonably modern configure script.
@ -1256,6 +1259,10 @@ make -C postgresql-setup-%{setup_version} check
%changelog
* Mon Jun 06 2022 Honza Horak <hhorak@redhat.com> - 14.3-4
- Fix compatibility with Perl 5.36
Resolves: #2092426
* Mon Jun 06 2022 Honza Horak <hhorak@redhat.com> - 14.3-3
- Fix handling of errors during transaction with Python 3.11
Resolves: #2023272