Re: PG_RE_THROW is mandatory (was Re: jsonpath) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: PG_RE_THROW is mandatory (was Re: jsonpath)
Date
Msg-id 28675.1549470418@sss.pgh.pa.us
Whole thread Raw
In response to PG_RE_THROW is mandatory (was Re: jsonpath)  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: PG_RE_THROW is mandatory (was Re: jsonpath)  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> elog.h claims that PG_RE_THROW is "optional":

>  * (The braces are not actually necessary, but are recommended so that
>  * pgindent will indent the construct nicely.)  The error recovery code
>  * can optionally do PG_RE_THROW() to propagate the same error outwards.

> This is obviously wrong; while we have a couple of codesites that omit
> it, it's not a generally available coding pattern.  I think we should
> amend that comment.  I propose: "The error recovery code must normally
> do PG_RE_THROW() to propagate the error outwards; failure to do so may
> leave the system in an inconsistent state for further processing."

Well, it can either do PG_RE_THROW or do a (sub)transaction abort.
Some level of throw-catching code has to do the latter eventually.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: PG_RE_THROW is mandatory (was Re: jsonpath)
Next
From: Andres Freund
Date:
Subject: Re: Don't deform column-by-column in composite_to_json