pgsql: Add optional parameter to PG_TRY() macros
Add optional parameter to PG_TRY() macros
This commit back-patches v16-era commit 112f0225d into v15 and v14.
We need this now because the back-patches of daafcbd11 expect PG_TRY()
to take an optional parameter, and it doesn't. We'd missed that
problem in testing because it only happens in the MINGW-64 code path.
With pgsql-release's concurrence, I'm putting this into v14 too.
We're not currently planning any more releases of v14, but fix it
there anyway to save trouble for anyone needing to build v14
in future.
Author: David Rowley
Discussion: /messages/by-id/CAApHDvqWGMdB_pATeUqE=JCtNqNxObPOJ00jFEa2_sZ20j_Wvg@mail.gmail.com
Branch
------
REL_14_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/853b35f35b1c3e5b80d392568659662632e7eba8
Modified Files
--------------
src/include/utils/elog.h | 44 ++++++++++++++++++++++++++------------------
1 file changed, 26 insertions(+), 18 deletions(-)
On Wed, 11 Nov 2026 at 10:12, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Add optional parameter to PG_TRY() macros
There's no public discussion about it, and I didn't think it critical
enough to open a new thread about. I believe the newly added
PG_PERL_TRY() macros would need a ##__VA_ARGS__ suffix on all the
local variables, else we'd get shadow warnings if we ever nested
PG_PERL_TRYs.
David
David Rowley <dgrowleyml@gmail.com> writes:
There's no public discussion about it, and I didn't think it critical
enough to open a new thread about. I believe the newly added
PG_PERL_TRY() macros would need a ##__VA_ARGS__ suffix on all the
local variables, else we'd get shadow warnings if we ever nested
PG_PERL_TRYs.
We would get some warnings for that anyway, because we don't have the
ability to change the name of the variable that Perl's dJMPENV macro
creates. So I didn't bother for the variables that are specific to
PG_PERL_TRY. The case I was mainly worried about was not gettimg
shadow warnings for PG_PERL_TRY nested within PG_TRY, which is a
pattern that exists now; so it's worth having the ##__VA_ARGS__
business on the variables that would conflict with PG_TRY.
regards, tom lane