Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Fix pl/perl test case so it will still work under Perl 5.36.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 1 Jun 2022 20:15:47 +0000 (16:15 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 1 Jun 2022 20:15:47 +0000 (16:15 -0400)
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
src/pl/plperl/sql/plperl.sql

index 14df5f42dfe4acffd4fbd6d854e5968274059edf..2a6fa903f9fd8195eb6206584d55642b78c52eca 100644 (file)
@@ -644,9 +644,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 $$
index dc6b1694644c55e993bd78419f6f3be04ca4a011..f255eedd05cecde385645ecdc705075f7875e76d 100644 (file)
@@ -420,8 +420,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 $$