PostgreSQL 8.0.0rc1
DBD::PgSPI 0.02
Perl 5.8.6
FreeBSD 4.10-STABLE, Solaris 9

More error handling problems with plperl -- this time when using
DBD::PgSPI.  If a function executes a query that raises an error,
subsequent functions that haven't been loaded yet will fail.  I
think this problem got fixed for code that uses spi_exec_query().

CREATE OR REPLACE FUNCTION test1() RETURNS TEXT AS $$
use DBD::PgSPI;
my @v = $pg_dbh->selectrow_array("SELECT syntax_error");
return $v[0];
$$ LANGUAGE plperlu;

CREATE OR REPLACE FUNCTION test2() RETURNS TEXT AS $$
use DBD::PgSPI;
my @v = $pg_dbh->selectrow_array("SELECT 'this works'");
return $v[0];
$$ LANGUAGE plperlu;

SELECT test1();
ERROR:  column "syntax_error" does not exist
CONTEXT:  SQL statement "SELECT syntax_error"

SELECT test2();
ERROR:  creation of Perl function failed:       (in cleanup) Undefined 
subroutine &DBD::_::db::mkunsafefunc called at 
/usr/local/lib/perl5/site_perl/5.8.6/i386-freebsd/DBI.pm line 1529.

LOAD 'plperl';  -- or reconnect
SELECT test2();
   test2    
------------
 this works
(1 row)

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Reply via email to