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!