Re: plperl tests fail with latest Perl 5.36

Поиск
Список
Период
Сортировка
От Dagfinn Ilmari Mannsåker
Тема Re: plperl tests fail with latest Perl 5.36
Дата
Msg-id 87bkvcmn9i.fsf@wibble.ilmari.org
обсуждение исходный текст
Ответ на plperl tests fail with latest Perl 5.36  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: plperl tests fail with latest Perl 5.36  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:

> Apparently 5.36 rejiggers warning classifications in a way that breaks
> one of our test cases.  Perhaps we should switch it to some other
> warning-triggering condition.

The simplest thing is to actually use sort in void context,
i.e. removing the `my $x = ` part from the test, see the attached.

Tested on 5.36.0 and 5.8.9.

- ilmari

From e8ab5acf49c9e78a523beb01b37bcd506665f254 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilmari@ilmari.org>
Date: Wed, 1 Jun 2022 16:07:48 +0100
Subject: [PATCH] Fix plperl test for change of warning category in perl 5.36

The warning about using in scalar context is now in the 'scalar'
category, not 'void'.  Actually use sort in void context to keep the
warning in the same category across perl versions.
---
 src/pl/plperl/expected/plperl.out | 4 ++--
 src/pl/plperl/sql/plperl.sql      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/pl/plperl/expected/plperl.out b/src/pl/plperl/expected/plperl.out
index d8a1ff5dd8..aa02bcd5bb 100644
--- a/src/pl/plperl/expected/plperl.out
+++ b/src/pl/plperl/expected/plperl.out
@@ -725,8 +725,8 @@ ERROR:  Can't use string ("foo") as a SCALAR ref while "strict refs" in use at l
 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.
+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..ab222366cd 100644
--- a/src/pl/plperl/sql/plperl.sql
+++ b/src/pl/plperl/sql/plperl.sql
@@ -470,7 +470,7 @@ 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;
+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.30.2


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jacob Champion
Дата:
Сообщение: Re: [PoC] Let libpq reject unexpected authentication requests
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: support for MERGE