Re: trap for any exception

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Sabin Coanda <sabin(dot)coanda(at)deuromedia(dot)ro>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: trap for any exception
Date: 2007-11-15 15:35:01
Message-ID: 20071115073257.O23226@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, 15 Nov 2007, Sabin Coanda wrote:

> Hi there,
>
> I'd like to build a PL/pgSQL function which is able to generic trap any
> error, and interpret it.
>
> 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
> ?

Won't OTHERS catch most of what you want?

From the 8.2 docs:
"The special condition name OTHERS matches every error type except
QUERY_CANCELED. (It is possible, but often unwise, to trap QUERY_CANCELED
by name.)"

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jean-David Beyer 2007-11-15 16:05:44 Is there anything special about pg_dump's compression?
Previous Message Sabin Coanda 2007-11-15 13:54:13 Re: trap for any exception