Change pg_lsn_in_internal() to use soft error reporting
authorMichael Paquier <michael@paquier.xyz>
Fri, 5 Sep 2025 03:59:29 +0000 (12:59 +0900)
committerMichael Paquier <michael@paquier.xyz>
Fri, 5 Sep 2025 03:59:29 +0000 (12:59 +0900)
commitae453120085f7da8f4082bb912e9668410cdccab
tree726212430b8e7a3b36203737781d251d8dcf2dac
parentd814d7fc3d5257ae258b502229fc7ca97c97270a
Change pg_lsn_in_internal() to use soft error reporting

pg_lsn includes pg_lsn_in_internal() for the purpose of parsing a LSN
position for the GUC recovery_target_lsn (21f428ebde39).  It relies on a
boolean called "have_error" that would be set when the LSN parsing
fails, then let its callers handle any errors.

d9f7f5d32f20 has added support for soft error reporting.  This commit
removes some boilerplate code and switches the routine to use soft error
reporting directly, giving to the callers of pg_lsn_in_internal()
the possibility to be fed the error message generated on failure.

pg_lsn_in_internal() routine is renamed to pg_lsn_in_safe(), for
consistency with other similar routines that are given an escontext.

Author: Amul Sul <sulamul@gmail.com>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Discussion: https://postgr.es/m/CAAJ_b96No5h5tRuR+KhcC44YcYUCw8WAHuLoqqyyop8_k3+JDQ@mail.gmail.com
src/backend/access/transam/xlogrecovery.c
src/backend/utils/adt/pg_lsn.c
src/include/utils/pg_lsn.h