Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 1B18F2E2D59 for ; Thu, 15 Nov 2007 14:36:36 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 52797-09 for ; Thu, 15 Nov 2007 14:36:33 -0400 (AST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by postgresql.org (Postfix) with ESMTP id 3F6232E2D7C for ; Thu, 15 Nov 2007 14:36:33 -0400 (AST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 266A935D2B; Thu, 15 Nov 2007 10:36:32 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 24C6A35D26; Thu, 15 Nov 2007 10:36:32 -0800 (PST) Date: Thu, 15 Nov 2007 10:36:32 -0800 (PST) From: Stephan Szabo To: Sabin Coanda Cc: pgsql-sql@postgresql.org Subject: Re: trap for any exception In-Reply-To: Message-ID: <20071115103448.S32121@megazone.bigpanda.com> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/81 X-Sequence-Number: 29609 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.