1
1
/**********************************************************************
2
2
* plperl.c - perl as a procedural language for PostgreSQL
3
3
*
4
- * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.166 2010/02/14 18:42:18 rhaas Exp $
4
+ * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.167 2010/02/15 22:23:25 alvherre Exp $
5
5
*
6
6
**********************************************************************/
7
7
@@ -413,13 +413,9 @@ select_perl_context(bool trusted)
413
413
414
414
eval_pv ("PostgreSQL::InServer::SPI::bootstrap()" , FALSE);
415
415
if (SvTRUE (ERRSV ))
416
- {
417
416
ereport (ERROR ,
418
- (errcode (ERRCODE_INTERNAL_ERROR ),
419
- errmsg ("%s" , strip_trailing_ws (SvPV_nolen (ERRSV ))),
420
- errdetail ("While executing PostgreSQL::InServer::SPI::bootstrap" )));
421
- }
422
-
417
+ (errmsg ("%s" , strip_trailing_ws (SvPV_nolen (ERRSV ))),
418
+ errdetail ("While executing PostgreSQL::InServer::SPI::bootstrap." )));
423
419
}
424
420
425
421
/*
@@ -553,15 +549,13 @@ plperl_init_interp(void)
553
549
if (perl_parse (plperl , plperl_init_shared_libs ,
554
550
nargs , embedding , NULL ) != 0 )
555
551
ereport (ERROR ,
556
- (errcode (ERRCODE_INTERNAL_ERROR ),
557
- errmsg ("while parsing perl initialization" ),
558
- errdetail ("%s" , strip_trailing_ws (SvPV_nolen (ERRSV ))) ));
552
+ (errmsg ("%s" , strip_trailing_ws (SvPV_nolen (ERRSV ))),
553
+ errcontext ("While parsing perl initialization." )));
559
554
560
555
if (perl_run (plperl ) != 0 )
561
556
ereport (ERROR ,
562
- (errcode (ERRCODE_INTERNAL_ERROR ),
563
- errmsg ("while running perl initialization" ),
564
- errdetail ("%s" , strip_trailing_ws (SvPV_nolen (ERRSV ))) ));
557
+ (errmsg ("%s" , strip_trailing_ws (SvPV_nolen (ERRSV ))),
558
+ errcontext ("While running perl initialization." )));
565
559
566
560
#ifdef WIN32
567
561
@@ -691,24 +685,17 @@ plperl_trusted_init(void)
691
685
/* not safe, so disallow all trusted funcs */
692
686
eval_pv (PLC_SAFE_BAD , FALSE);
693
687
if (SvTRUE (ERRSV ))
694
- {
695
688
ereport (ERROR ,
696
- (errcode (ERRCODE_INTERNAL_ERROR ),
697
- errmsg ("while executing PLC_SAFE_BAD" ),
698
- errdetail ("%s" , strip_trailing_ws (SvPV_nolen (ERRSV ))) ));
699
- }
700
-
689
+ (errmsg ("%s" , strip_trailing_ws (SvPV_nolen (ERRSV ))),
690
+ errcontext ("While executing PLC_SAFE_BAD." )));
701
691
}
702
692
else
703
693
{
704
694
eval_pv (PLC_SAFE_OK , FALSE);
705
695
if (SvTRUE (ERRSV ))
706
- {
707
696
ereport (ERROR ,
708
- (errcode (ERRCODE_INTERNAL_ERROR ),
709
- errmsg ("while executing PLC_SAFE_OK" ),
710
- errdetail ("%s" , strip_trailing_ws (SvPV_nolen (ERRSV ))) ));
711
- }
697
+ (errmsg ("%s" , strip_trailing_ws (SvPV_nolen (ERRSV ))),
698
+ errcontext ("While executing PLC_SAFE_OK." )));
712
699
713
700
if (GetDatabaseEncoding () == PG_UTF8 )
714
701
{
@@ -719,12 +706,9 @@ plperl_trusted_init(void)
719
706
*/
720
707
eval_pv ("my $a=chr(0x100); return $a =~ /\\xa9/i" , FALSE);
721
708
if (SvTRUE (ERRSV ))
722
- {
723
709
ereport (ERROR ,
724
- (errcode (ERRCODE_INTERNAL_ERROR ),
725
- errmsg ("while executing utf8fix" ),
726
- errdetail ("%s" , strip_trailing_ws (SvPV_nolen (ERRSV ))) ));
727
- }
710
+ (errmsg ("%s" , strip_trailing_ws (SvPV_nolen (ERRSV ))),
711
+ errcontext ("While executing utf8fix." )));
728
712
}
729
713
730
714
/* switch to the safe require opcode */
@@ -742,12 +726,9 @@ plperl_trusted_init(void)
742
726
SPAGAIN ;
743
727
744
728
if (SvTRUE (ERRSV ))
745
- {
746
729
ereport (ERROR ,
747
- (errcode (ERRCODE_INTERNAL_ERROR ),
748
- errmsg ("while executing plperl.on_plperl_init" ),
749
- errdetail ("%s" , strip_trailing_ws (SvPV_nolen (ERRSV ))) ));
750
- }
730
+ (errmsg ("%s" , strip_trailing_ws (SvPV_nolen (ERRSV ))),
731
+ errcontext ("While executing plperl.on_plperl_init." )));
751
732
}
752
733
753
734
}
@@ -761,12 +742,9 @@ plperl_untrusted_init(void)
761
742
{
762
743
eval_pv (plperl_on_plperlu_init , FALSE);
763
744
if (SvTRUE (ERRSV ))
764
- {
765
745
ereport (ERROR ,
766
- (errcode (ERRCODE_INTERNAL_ERROR ),
767
- errmsg ("while executing plperl.on_plperlu_init" ),
768
- errdetail ("%s" , strip_trailing_ws (SvPV_nolen (ERRSV ))) ));
769
- }
746
+ (errmsg ("%s" , strip_trailing_ws (SvPV_nolen (ERRSV ))),
747
+ errcontext ("While executing plperl.on_plperlu_init." )));
770
748
}
771
749
}
772
750
@@ -1299,18 +1277,14 @@ plperl_create_sub(plperl_proc_desc *prodesc, char *s, Oid fn_oid)
1299
1277
LEAVE ;
1300
1278
1301
1279
if (SvTRUE (ERRSV ))
1302
- {
1303
1280
ereport (ERROR ,
1304
1281
(errcode (ERRCODE_SYNTAX_ERROR ),
1305
1282
errmsg ("%s" , strip_trailing_ws (SvPV_nolen (ERRSV )))));
1306
- }
1307
1283
1308
1284
if (!subref )
1309
- {
1310
1285
ereport (ERROR ,
1311
- (errcode (ERRCODE_INTERNAL_ERROR ),
1312
- errmsg ("didn't get a GLOB from compiling %s via %s" , prodesc -> proname , compile_sub )));
1313
- }
1286
+ (errmsg ("didn't get a GLOB from compiling %s via %s" ,
1287
+ prodesc -> proname , compile_sub )));
1314
1288
1315
1289
prodesc -> reference = newSVsv (subref );
1316
1290
0 commit comments