]> granicus.if.org Git - postgresql/commitdiff
Add semicolons to eval'd strings to hide a minor Perl behavioral change.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 3 Jun 2013 18:19:44 +0000 (14:19 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 3 Jun 2013 18:19:44 +0000 (14:19 -0400)
"eval q{foo}" used to complain that the error was on line 2 of the eval'd
string, because eval internally tacked on "\n;" so that the end of the
erroneous command was indeed on line 2.  But as of Perl 5.18 it more
sanely says that the error is on line 1.  To avoid Perl-version-dependent
regression test results, use "eval q{foo;}" instead in the two places
where this matters.  Per buildfarm.

Since people might try to use newer Perl versions with older PG releases,
back-patch as far as 9.0 where these test cases were added.

src/pl/plperl/expected/plperl.out
src/pl/plperl/expected/plperl_init.out
src/pl/plperl/sql/plperl.sql
src/pl/plperl/sql/plperl_init.sql

index 24b537be11ba5667bcabbb51467bb934e71f3735..6771437c72c3e12fb6fdef4864c5b636db94784f 100644 (file)
@@ -573,8 +573,8 @@ DO $$ open my $fh, "</nonesuch"; $$ LANGUAGE plperl;
 ERROR:  'open' trapped by operation mask at line 1.
 CONTEXT:  PL/Perl anonymous code block
 -- check that eval is allowed and eval'd restricted ops are caught
-DO $$ eval q{chdir '.'}; warn "Caught: $@"; $$ LANGUAGE plperl;
-WARNING:  Caught: 'chdir' trapped by operation mask at line 2.
+DO $$ eval q{chdir '.';}; warn "Caught: $@"; $$ LANGUAGE plperl;
+WARNING:  Caught: 'chdir' trapped by operation mask at line 1.
 CONTEXT:  PL/Perl anonymous code block
 -- check that compiling do (dofile opcode) is allowed
 -- but that executing it for a file not already loaded (via require) dies
index 4a04dbd6f37d43fab912206c1dd23ea89d0be11d..f9dab03dafa9de5e6c63688938dd5fbe51c1020b 100644 (file)
@@ -1,14 +1,14 @@
 -- test plperl.on_plperl_init errors are fatal
 -- Avoid need for custom_variable_classes = 'plperl'
 LOAD 'plperl';
-SET SESSION plperl.on_plperl_init = ' system("/nonesuch") ';
+SET SESSION plperl.on_plperl_init = ' system("/nonesuch"); ';
 SHOW plperl.on_plperl_init;
- plperl.on_plperl_init 
------------------------
-  system("/nonesuch") 
+ plperl.on_plperl_init  
+------------------------
+  system("/nonesuch"); 
 (1 row)
 
 DO $$ warn 42 $$ language plperl;
-ERROR:  'system' trapped by operation mask at line 2.
+ERROR:  'system' trapped by operation mask at line 1.
 CONTEXT:  while executing plperl.on_plperl_init
 PL/Perl anonymous code block
index 7f02b2fe225ae97d69b26f5db16a623f8a78414c..dace848e838c7d8f196f5b567246f8e6862d7520 100644 (file)
@@ -373,7 +373,7 @@ DO $$ qx("/nonesuch"); $$ LANGUAGE plperl;
 DO $$ open my $fh, "</nonesuch"; $$ LANGUAGE plperl;
 
 -- check that eval is allowed and eval'd restricted ops are caught
-DO $$ eval q{chdir '.'}; warn "Caught: $@"; $$ LANGUAGE plperl;
+DO $$ eval q{chdir '.';}; warn "Caught: $@"; $$ LANGUAGE plperl;
 
 -- check that compiling do (dofile opcode) is allowed
 -- but that executing it for a file not already loaded (via require) dies
index f6a32b9bae4792ab449ef62cdb717384adca6bd8..50288cb41568e73d404bccb33404757ad1ba737e 100644 (file)
@@ -3,7 +3,7 @@
 -- Avoid need for custom_variable_classes = 'plperl'
 LOAD 'plperl';
 
-SET SESSION plperl.on_plperl_init = ' system("/nonesuch") ';
+SET SESSION plperl.on_plperl_init = ' system("/nonesuch"); ';
 
 SHOW plperl.on_plperl_init;