Re: BUG #16405: Exception P0004 not caught in EXCEPTION WHEN OTHERS

From: Jacob Crell <jacobcrell(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16405: Exception P0004 not caught in EXCEPTION WHEN OTHERS
Date: 2020-04-30 17:15:32
Message-ID: CADvKwnZ0GecpHSx9Oo92tqCDfXM=NZC1FRrJH-HEy1g-tGkpJg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thanks for the reply Tom! Makes sense.

On Thu, Apr 30, 2020 at 12:04 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> > Excepted Behavior: P0004 exception is caught in EXCEPTION WHEN OTHERS,
> > function returns text 'Hit the Other exception block'.
> > Actual Behavior: P0004 exception is raised and remains uncaught.
>
> That's intentional, per the documentation [1]:
>
> The special condition name OTHERS matches every error type except
> QUERY_CANCELED and ASSERT_FAILURE. (It is possible, but often unwise,
> to trap those two error types by name.)
>
> regards, tom lane
>
> [1]
> https://www.postgresql.org/docs/current/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Francisco Olarte 2020-04-30 18:19:47 Re: BUG #16403: set_bit function does not have expected effect
Previous Message Tom Lane 2020-04-30 17:04:25 Re: BUG #16405: Exception P0004 not caught in EXCEPTION WHEN OTHERS