Re: spi and error messages

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Bart Degryse <Bart(dot)Degryse(at)indicator(dot)be>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: spi and error messages
Date: 2007-05-30 14:13:49
Message-ID: 20070530141349.GA76707@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Trigve Siver 2007-05-30 15:56:45 slow query execution
Previous Message Gerardo Herzig 2007-05-30 13:44:06 logging amount rows retrieved?