Subject: [PATCH] Correct the version sent in protocol negotiation

From: Ning Sun <[email-masked]>
Date: Sun, 7 Jun 2026 10:00:09 +0800

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-masked]>
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

---

From: Laurenz Albe <[email-masked]>
Date: Sun, 07 Jun 2026 07:06:55 +0200

> The patch included just clarifies this behavior by removing "minor" from 

To my understanding, the "minor version" is the entire version *including*
the last number, like 18.4 (and not only .4).

In this, I seem to be in agreement with
https://www.postgresql.org/support/versioning/

To me, removing the "minor" makes the text less clear.  If we change that
at all, perhaps a wording like "the full version, including the minor
release" would remove any ambiguity.

Yours,
Laurenz Albe

---

From: Ning Sun <[email-masked]>
Date: Sun, 7 Jun 2026 15:40:37 +0800

I see. The "minor version"  has its own meaning in postgres context.

That makes sense. Thank you for clarification, Laurenz.