pgsql: Fix incorrect assignment of InvalidXLogRecPtr to a non-LSN varia

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix incorrect assignment of InvalidXLogRecPtr to a non-LSN varia
Date: 2025-11-12 23:48:46
Message-ID: E1vJKZy-006JTK-0h@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix incorrect assignment of InvalidXLogRecPtr to a non-LSN variable.

pg_logical_slot_get_changes_guts() previously assigned InvalidXLogRecPtr to
the local variable upto_nchanges, which is of type int32, not XLogRecPtr.
While this caused no functional issue since InvalidXLogRecPtr is defined as 0,
it was semantically incorrect.

This commit fixes the issue by updating pg_logical_slot_get_changes_guts()
to set upto_nchanges to 0 instead of InvalidXLogRecPtr.

No backpatch is needed, as the previous behavior was harmless.

Author: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Reviewed-by: Steven Niu <niushiji(at)gmail(dot)com>
Reviewed-by: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAHGQGwHKHuR5NGnGxU3+ebz7cbC1ZAR=AgG4Bueq==Lj6iX8Sw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/705601c5aeab56aef62dd69ac2b7acf662f08e9c

Modified Files
--------------
src/backend/replication/logical/logicalfuncs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2025-11-13 03:43:12 pgsql: Replace off_t by pgoff_t in I/O routines
Previous Message Nathan Bossart 2025-11-12 21:13:28 pgsql: Remove obsolete autovacuum comment.