Re: alternative to PG_CATCH - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: alternative to PG_CATCH
Date
Msg-id 538cbf41-c2f6-7e66-9770-df81c3e5a2d4@2ndquadrant.com
Whole thread Raw
In response to Re: alternative to PG_CATCH  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 2019-11-06 15:49, Tom Lane wrote:
> Peter Eisentraut <peter.eisentraut@2ndquadrant.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.

Committed, without the "else".

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: btkimurayuzk
Date:
Subject: Re: Resume vacuum and autovacuum from interruption and cancellation
Next
From: Julien Rouhaud
Date:
Subject: Re: Collation versioning