Re: BUG #19598: pg_waldump: -s/-e accept out-of-range WAL locations and silently use the low 32 bits - Mailing list pgsql-bugs

From Zexin Li
Subject Re: BUG #19598: pg_waldump: -s/-e accept out-of-range WAL locations and silently use the low 32 bits
Date
Msg-id CAAP6ZkSUSRvv1ue_eZABzDvWB=UGgGn3WFd85DT4cxuSC-_y=w@mail.gmail.com
Whole thread
List pgsql-bugs
On Sun, Aug 10, 2026, Fujii Masao wrote:
> The main change from v2 is that pg_lsn_in_safe() now also uses
> pg_parse_lsn(), leaving only the backend-specific soft-error handling
> there. This avoids duplicating the LSN syntax checks.

Thank you for the review. v3 looks good to me.

Regards,
Zexin Li

On Mon, Aug 10, 2026 02:47 PM, Fujii Masao <masao.fujii@gmail.com> wrote:
On Fri, Aug 7, 2026 at 10:58 AM Zexin Li <lizi.openmind@gmail.com> wrote:
> The helper is pg_parse_lsn() in the new src/common/pg_parse_lsn.c,
> with the same rules as the backend's pg_lsn_in_safe(): one to eight
> hex digits, a slash, one to eight hex digits, and nothing else.
> pg_waldump's static helper from v1 moves there, and pg_recvlogical
> (-I/-E) and pg_receivewal (-E) now go through it as well.

> * The backend's pg_lsn_in_safe() is left untouched for now.

Thanks for updating the patch!

Attached is a revised version. It keeps the v2 approach of adding
pg_parse_lsn() in src/common and using it for user-supplied LSN
command-line options in pg_waldump, pg_recvlogical, and
pg_receivewal.

The main change from v2 is that pg_lsn_in_safe() now also uses
pg_parse_lsn(), leaving only the backend-specific soft-error handling
there. This avoids duplicating the LSN syntax checks.

Thought?

Regards,

--
Fujii Masao

pgsql-bugs by date:

Previous
From: Rui Zhao
Date:
Subject: Re: BUG #19483: pg_upgrade fails with orphan records in pg_init_priv catalog table
Next
From: PG Bug reporting form
Date:
Subject: BUG #19615: COVAR_POP / COVAR_SAMP / REGR_SXY return 0.0 instead of NaN