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

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Fix incorrect assignment of InvalidXLogRecPtr to a non-LSN variable.
Date: 2025-11-12 08:23:13
Message-ID: CAHGQGwHKHuR5NGnGxU3+ebz7cbC1ZAR=AgG4Bueq==Lj6iX8Sw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I noticed that pg_logical_slot_get_changes_guts() assigns InvalidXLogRecPtr
to the local variable upto_nchanges, even though it's not LSN variable
(i.e., its type is int32, not XLogRecPtr). While this causes no functional issue
since InvalidXLogRecPtr is defined as 0, it's semantically incorrect.

I propose fixing this by setting upto_nchanges to 0 instead of
InvalidXLogRecPtr.
Attached is a patch implementing this change.

Regards,

--
Fujii Masao

Attachment Content-Type Size
v1-0001-Fix-incorrect-assignment-of-InvalidXLogRecPtr-to-.patch application/octet-stream 1.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ajin Cherian 2025-11-12 08:24:18 Re: Improve pg_sync_replication_slots() to wait for primary to advance
Previous Message Michael Paquier 2025-11-12 08:15:15 Re: BUG #19095: Test if function exit() is used fail when linked static