From eefdbba0629b1ddeb6bf1c2bf1b8858d16b79c8d Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Wed, 6 Jul 2005 22:44:49 +0000 Subject: [PATCH] Currently, nonfatal warnings are not trapped (as they should be) by plperl - the attached small patch remedies that omission, and adds a small regression test for error and warning output - the new regression input and expected output are in separate attached files. Andrew Dunstan --- src/pl/plperl/GNUmakefile | 2 +- src/pl/plperl/expected/plperl_elog.out | 29 ++++++++++++++++++++++++++ src/pl/plperl/plperl.c | 2 +- src/pl/plperl/sql/plperl_elog.sql | 23 ++++++++++++++++++++ 4 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 src/pl/plperl/expected/plperl_elog.out create mode 100644 src/pl/plperl/sql/plperl_elog.sql diff --git a/src/pl/plperl/GNUmakefile b/src/pl/plperl/GNUmakefile index e9334d033e..c7c8fa58c3 100644 --- a/src/pl/plperl/GNUmakefile +++ b/src/pl/plperl/GNUmakefile @@ -1,5 +1,5 @@ # Makefile for PL/Perl -# $PostgreSQL: pgsql/src/pl/plperl/GNUmakefile,v 1.23 2005/07/06 22:33:39 momjian Exp $ +# $PostgreSQL: pgsql/src/pl/plperl/GNUmakefile,v 1.24 2005/07/06 22:44:49 momjian Exp $ subdir = src/pl/plperl top_builddir = ../../.. diff --git a/src/pl/plperl/expected/plperl_elog.out b/src/pl/plperl/expected/plperl_elog.out new file mode 100644 index 0000000000..578c3e0b6c --- /dev/null +++ b/src/pl/plperl/expected/plperl_elog.out @@ -0,0 +1,29 @@ +-- test warnings and errors from plperl +create or replace function perl_elog(text) returns void language plperl as $$ + + my $msg = shift; + elog(NOTICE,$msg); + +$$; +select perl_elog('explicit elog'); +NOTICE: explicit elog + perl_elog +----------- + +(1 row) + +create or replace function perl_warn(text) returns void language plperl as $$ + + my $msg = shift; + warn($msg); + +$$; +select perl_warn('implicit elog via warn'); +NOTICE: implicit elog via warn at (eval 7) line 4. + + perl_warn +----------- + +(1 row) + + diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index f05197ea4e..b543963d19 100644 --- a/src/pl/plperl/plperl.c +++ b/src/pl/plperl/plperl.c @@ -33,7 +33,7 @@ * ENHANCEMENTS, OR MODIFICATIONS. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.80 2005/07/06 22:33:39 momjian Exp $ + * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.81 2005/07/06 22:44:49 momjian Exp $ * **********************************************************************/ diff --git a/src/pl/plperl/sql/plperl_elog.sql b/src/pl/plperl/sql/plperl_elog.sql new file mode 100644 index 0000000000..47cb742d3f --- /dev/null +++ b/src/pl/plperl/sql/plperl_elog.sql @@ -0,0 +1,23 @@ +-- test warnings and errors from plperl + +create or replace function perl_elog(text) returns void language plperl as $$ + + my $msg = shift; + elog(NOTICE,$msg); + +$$; + +select perl_elog('explicit elog'); + +create or replace function perl_warn(text) returns void language plperl as $$ + + my $msg = shift; + warn($msg); + +$$; + +select perl_warn('implicit elog via warn'); + + + + -- 2.40.0