Our protocol doc describes protocol negotiation message will send latest minor version. However that field is a 4-byte one. The actual implementation sends full version including the major part:

static void
SendNegotiateProtocolVersion(List *unrecognized_protocol_options)
{
    StringInfoData buf;
    ListCell   *lc;

    pq_beginmessage(&buf, PqMsg_NegotiateProtocolVersion);
    pq_sendint32(&buf, FrontendProtocol);
    pq_sendint32(&buf, list_length(unrecognized_protocol_options));
    foreach(lc, unrecognized_protocol_options)
        pq_sendstring(&buf, lfirst(lc));
    pq_endmessage(&buf);

    /* no need to flush, some other message will follow */
}

The patch included just clarifies this behavior by removing "minor" from "newest minor version".

From 1bb00e792fbefa1dcf6e72fddb7baac1400c4dee Mon Sep 17 00:00:00 2001
From: Ning Sun <[email protected]>
Date: Sat, 6 Jun 2026 18:51:59 -0700
Subject: [PATCH] Protocol negotiation sends full version instead of minor

---
 doc/src/sgml/protocol.sgml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml
index 49f81676712..87dbc09af07 100644
--- a/doc/src/sgml/protocol.sgml
+++ b/doc/src/sgml/protocol.sgml
@@ -602,8 +602,8 @@
        <para>
         The server does not support the minor protocol version requested
         by the client, but does support an earlier version of the protocol;
-        this message indicates the highest supported minor version.  This
-        message will also be sent if the client requested unsupported protocol
+        this message indicates the highest supported version. This message
+        will also be sent if the client requested unsupported protocol
         options (i.e., beginning with <literal>_pq_.</literal>) in the
         startup packet.
        </para>
@@ -5450,8 +5450,8 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;"
        <term>Int32</term>
        <listitem>
         <para>
-         Newest minor protocol version supported by the server
-         for the major protocol version requested by the client.
+         Newest protocol version supported by the server for the
+         major protocol version requested by the client.
         </para>
        </listitem>
       </varlistentry>
-- 
2.54.0

Reply via email to