Hello.

At Tue, 9 Jun 2026 11:23:32 +0900, Yugo Nagata <[email protected]> wrote in 
> Based on my reading, the current behavior does not seem to match that
> description. However, if reporting the end LSN is intentional, perhaps
> the documentation should be updated to clarify that.

Looking at the existing code, PostgreSQL appears to use the start LSN
for most record types, except for a few special cases such as COMMIT
records.

As for logical decoding messages, their contents are not sent to the
subscriber in the first place. Even if they were, the subscriber would
only use them to advance its received LSN. From that perspective,
PostgreSQL does not seem to care whether the LSN associated with a
message record refers to the beginning or the end of the WAL record.

Of course, this raises the question of whether any existing extension
relies on the current behavior. I don't know the answer to that.

That said, the documentation says:

https://www.postgresql.org/docs/devel/protocol-logicalrep-message-formats.html

> Message 
....
>    Int64 (XLogRecPtr)
>      The LSN of the logical decoding message.

The value currently comes from XLogRecordBuffer.endptr, which is
passed to logicalmsg_decode(). If the documentation is correct, then
it seems to me that this should instead use origptr.

Regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center


Reply via email to