]> granicus.if.org Git - postgresql/commitdiff
Currently, nonfatal warnings are not trapped (as they should be) by
authorBruce Momjian <bruce@momjian.us>
Wed, 6 Jul 2005 22:33:39 +0000 (22:33 +0000)
committerBruce Momjian <bruce@momjian.us>
Wed, 6 Jul 2005 22:33:39 +0000 (22:33 +0000)
plperl - the attached small patch remedies that omission.

Andrew Dunstan

src/pl/plperl/GNUmakefile
src/pl/plperl/plperl.c

index 20dd73207004aed29f52c26907ba0711e49a26ba..e9334d033eeb242dbd8882c9a75dddb381d4a366 100644 (file)
@@ -1,5 +1,5 @@
 # Makefile for PL/Perl
-# $PostgreSQL: pgsql/src/pl/plperl/GNUmakefile,v 1.22 2005/05/24 17:07:41 tgl Exp $
+# $PostgreSQL: pgsql/src/pl/plperl/GNUmakefile,v 1.23 2005/07/06 22:33:39 momjian Exp $
 
 subdir = src/pl/plperl
 top_builddir = ../../..
@@ -37,7 +37,7 @@ OBJS = plperl.o spi_internal.o SPI.o
 SHLIB_LINK = $(perl_embed_ldflags) $(BE_DLLLIBS)
 
 REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-language=plperl
-REGRESS = plperl plperl_trigger plperl_shared
+REGRESS = plperl plperl_trigger plperl_shared plperl_elog
 
 include $(top_srcdir)/src/Makefile.shlib
 
index eaee0f79722a0c8a8073f6dfd03efad18ab79f6f..f05197ea4e99bf712d10b21c8a8841957ec1753e 100644 (file)
@@ -33,7 +33,7 @@
  *       ENHANCEMENTS, OR MODIFICATIONS.
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.79 2005/07/03 21:56:16 tgl Exp $
+ *       $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.80 2005/07/06 22:33:39 momjian Exp $
  *
  **********************************************************************/
 
@@ -190,6 +190,8 @@ plperl_init_interp(void)
                "", "-e",
                /* all one string follows (no commas please) */
                "SPI::bootstrap(); use vars qw(%_SHARED);"
+               "sub ::plperl_warn { my $msg = shift; &elog(&NOTICE, $msg); } "
+               "$SIG{__WARN__} = \\&::plperl_warn; "
                "sub ::mkunsafefunc {return eval(qq[ sub { $_[0] $_[1] } ]); }"
        };
 
@@ -197,6 +199,8 @@ plperl_init_interp(void)
                "", "-e",
                /* all one string follows (no commas please) */
                "SPI::bootstrap(); use vars qw(%_SHARED);"
+               "sub ::plperl_warn { my $msg = shift; &elog(&NOTICE, $msg); } "
+               "$SIG{__WARN__} = \\&::plperl_warn; "
                "sub ::mkunsafefunc {return eval("
                "qq[ sub { use strict; $_[0] $_[1] } ]); }"
        };