On Thu, Apr 30, 2020 at 12:04 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
PG Bug reporting form <noreply@postgresql.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.)