public inbox for [email protected]  
help / color / mirror / Atom feed
From: Ning Sun <[email protected]>
To: [email protected]
Subject: [PATCH] Correct the version sent in protocol negotiation
Date: Sun, 7 Jun 2026 10:00:09 +0800
Message-ID: <[email protected]> (raw)

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".



Attachments:

  [text/x-patch] 0001-Protocol-negotiation-sends-full-version-instead-of-m.patch (1.5K, 2-0001-Protocol-negotiation-sends-full-version-instead-of-m.patch)
  download | inline diff:
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



view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: [PATCH] Correct the version sent in protocol negotiation
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox