Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id B0BE02E2D49 for ; Fri, 16 Nov 2007 03:57:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 42808-07 for ; Fri, 16 Nov 2007 03:56:49 -0400 (AST) Received: from interscan.indicator.com (mail.indicator.be [193.121.199.3]) by postgresql.org (Postfix) with ESMTP id 428DF2E2D4B for ; Fri, 16 Nov 2007 03:56:50 -0400 (AST) Received: from webaccess.indicator.be ([10.100.1.7]) by interscan.indicator.com with InterScan Message Security Suite; Fri, 16 Nov 2007 08:54:34 +0100 Received: from DOMEXT-MTA by webaccess.indicator.bewith Novell_GroupWise; Fri, 16 Nov 2007 08:56:48 +0100 Message-Id: <473D5B47.A3DD.0030.0@indicator.be> X-Mailer: Novell GroupWise Internet Agent 7.0.1 Date: Fri, 16 Nov 2007 08:56:40 +0100 From: "Bart Degryse" To: Subject: Re: trap for any exception References: <20071115103448.S32121@megazone.bigpanda.com> In-Reply-To: <20071115103448.S32121@megazone.bigpanda.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=__Part77510028.0__=" X-imss-version: 2.049 X-imss-result: Passed X-imss-approveListMatch: *@indicator.be X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/85 X-Sequence-Number: 29613 --=__Part77510028.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable I think you should carefully read what the manual tells about PL/pgSQL = (http://www.postgresql.org/docs/8.2/static/plpgsql.html) and especially = about Trapping Errors (http://www.postgresql.org/docs/8.2/static/plpgsql-co= ntrol-structures.html#PLPGSQL-ERROR-TRAPPING).=20 >>> Stephan Szabo 2007-11-15 19:36 >>> On Thu, 15 Nov 2007, Sabin Coanda wrote: > > > > I read 37.7.5. Trapping Errors, but the syntax requires to write > > explicitly the exception condition, and not a generic one. > > > > Is it possible to build a generic trap or do you know a workaround for > > that ? > > > Sorry, I found the OTHERS condition that trap any error. > > But the question still remains to find how could I interpret it and = found > the error code and message ? I think you'll want to look at SQLSTATE and SQLERRM inside the exception handler. ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org ( http://archives.postgresql.= org/ ) --=__Part77510028.0__= Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Description: HTML
I think you should carefully read what the manual tells = about PL/pgSQL (http://www.postgresql.org/docs/8.2/static/plpgsql.html) = and especially about Trapping Errors (htt= p://www.postgresql.org/docs/8.2/static/plpgsql-control-structures.html#PLPG= SQL-ERROR-TRAPPING).

>>> Stephan Szabo <sszabo@megazone.bigpanda.com> = 2007-11-15 19:36 >>>
On Thu, 15 Nov 2007, Sabin Coanda = wrote:

> >
> > I read 37.7.5. Trapping Errors, but = the syntax requires to write
> > explicitly the exception = condition, and not a generic one.
> >
> > Is it possible = to build a generic trap or do you know a workaround for
> > that = ?
> >
> Sorry, I found the OTHERS condition that trap any = error.
>
> But the question still remains to find how could I = interpret it and found
> the error code and message ?

I think = you'll want to look at SQLSTATE and SQLERRM inside the exception
handler= .

---------------------------(end of broadcast)---------------------= ------
TIP 4: Have you searched our list archives?

  &n= bsp;            http://archives.postgresql.org=
--=__Part77510028.0__=--