Trapping PL/Perl spi_query_exec errors - Mailing list pgsql-general

From Worky Workerson
Subject Trapping PL/Perl spi_query_exec errors
Date
Msg-id ce4072df0611220835v64ccf4bck929fbfd08c9c25f6@mail.gmail.com
Whole thread Raw
Responses Re: Trapping PL/Perl spi_query_exec errors  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
This is probably a really basic question, but how do I trap when
spi_query_exec returns an error in PL/Perl?  I would expect to be able
to use the return value to determine an error condition, however I get
the message:

ERROR:  error from Perl function: relation "foo" does not exist at line 7.

where line 7 looks like:

my $rv = spi_query_exec('select count(*) from foo');

Alternatively, I would expect to be able to trap it with eval, however
the trusted PL/Perl does not support eval.

Thanks!

pgsql-general by date:

Previous
From: Tony Caduto
Date:
Subject: Re: Data transfer between databases over the Internet
Next
From: Jack Orenstein
Date:
Subject: Buffer overflow in psql