Re: spi and error messages - Mailing list pgsql-sql

From Michael Fuhr
Subject Re: spi and error messages
Date
Msg-id 20070530141349.GA76707@winnie.fuhr.org
Whole thread Raw
In response to spi and error messages  ("Bart Degryse" <Bart.Degryse@indicator.be>)
Responses perlu: did I find a bug, or did I make one?  ("Bart Degryse" <Bart.Degryse@indicator.be>)
List pgsql-sql
On Wed, May 30, 2007 at 09:33:40AM +0200, Bart Degryse wrote:
> In general how should I catch the error message generated if one
> of the spi functions (spi_exec_query, spi_query, spi_fetchrow,
> spi_prepare,...) fails?

In PL/Perl functions you can use eval to catch errors just as you
would in an ordinary Perl script:

eval { do something };
if ($@) { handle the error }

-- 
Michael Fuhr


pgsql-sql by date:

Previous
From: "Bart Degryse"
Date:
Subject: spi and error messages
Next
From: Gerardo Herzig
Date:
Subject: logging amount rows retrieved?