pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Fuhr <mike@fuhr.org>
To: Bart Degryse <Bart.Degryse@indicator.be>
Cc: pgsql-sql@postgresql.org
Subject: Re: spi and error messages
Date: Wed, 30 May 2007 08:13:49 -0600
Message-ID: <20070530141349.GA76707@winnie.fuhr.org> (raw)
In-Reply-To: <465D44F3.A3DD.0030.0@indicator.be>
References: <465D44F3.A3DD.0030.0@indicator.be>

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



view thread (2+ messages)

Message-ID: <20070530141349.GA76707@winnie.fuhr.org>
Permalink:  ../20070530141349.GA76707@winnie.fuhr.org/
Also on:    postgresql.org/message-id/20070530141349.GA76707@winnie.fuhr.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mike@fuhr.org, Bart.Degryse@indicator.be
  Subject: Re: spi and error messages
  In-Reply-To: <20070530141349.GA76707@winnie.fuhr.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox