Re: alternative to PG_CATCH

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Subject: Re: alternative to PG_CATCH
Date: 2019-11-06 14:49:30
Message-ID: 27116.1573051770@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> writes:
> On 2019-11-04 16:01, Tom Lane wrote:
>> Now that I've actually looked at the patched code, there's a far
>> more severe problem with it. Namely, that use of PG_FINALLY
>> means that the "finally" segment is run without having popped
>> the error context stack, which means that any error thrown
>> within that segment will sigsetjmp right back to the top,
>> resulting in an infinite loop. (Well, not infinite, because
>> it'll crash out once the error nesting depth limit is hit.)
>> We *must* pop the stack before running recovery code.

> I can confirm that that indeed happens. :(

> Here is a patch to fix it.

This seems all right from here. Since PG_RE_THROW() is guaranteed
noreturn, I personally wouldn't have bothered with an "else" after it,
but that's just stylistic.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-11-06 14:54:25 Re: define bool in pgtypeslib_extern.h
Previous Message Masahiko Sawada 2019-11-06 14:36:29 Re: [HACKERS] Block level parallel vacuum