docs: Update phrase on message lengths in the protocol

The reasoning for why all the message formats are parseable without
the explicit message length field is anachronistic; the real reason is
that protocol version 2 did not have a message length field. There's
nothing wrong with relying on the message length, like we do in the
CopyData messags, even though it often still makes sense to have
length fields for individual parts in messages.

Discussion: https://www.postgresql.org/message-id/02a4eed2-98f0-4796-9d4f-12128ff44fe0@iki.fi
This commit is contained in:
Heikki Linnakangas 2025-04-02 15:32:33 +03:00
parent a6285b150a
commit 85d799ba8a

View File

@ -3624,10 +3624,10 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;"
indicate that it can be sent by a frontend (F), a backend (B), or both
(F & B).
Notice that although each message includes a byte count at the beginning,
the message format is defined so that the message end can be found without
reference to the byte count. This aids validity checking. (The CopyData
message is an exception, because it forms part of a data stream; the contents
of any individual CopyData message cannot be interpretable on their own.)
most messages are defined so that the message end can be found without
reference to the byte count. This is for historical reasons, as the
original, now-obsolete protocol version 2 did not have an explicit length
field. It also aids validity checking though.
</para>
<variablelist>