docs: Add a new section and a table listing protocol versions
authorHeikki Linnakangas
Wed, 2 Apr 2025 13:41:51 +0000 (16:41 +0300)
committerHeikki Linnakangas
Wed, 2 Apr 2025 13:41:51 +0000 (16:41 +0300)
Move the discussion on protocol versions and version negotiation to a
new "Protocol versions" section. Add a table listing all the different
protocol versions, starting from the obsolete protocol version 2, and
the PostgreSQL versions that support each.

Discussion: https://www.postgresql.org/message-id/69f53970-1d55-4165-9151-6fb524e36af9@iki.fi

doc/src/sgml/protocol.sgml

index 4dab0cb4923ab5679d3dcdf1d62a09c565128719..d73e4d6dbdf0086bc41b1267fd57b33dfe22ffad 100644 (file)
   PostgreSQL version 18. The server and the libpq
   client library are backwards compatible with protocol version 3.0,
   implemented in PostgreSQL 7.4 and later.
-  For descriptions of earlier protocol versions, see previous releases of the
-  PostgreSQL documentation.
-
-  A single server
-  can support multiple protocol versions.  The initial startup-request
-  message tells the server which protocol version the client is attempting to
-  use.  If the major version requested by the client is not supported by
-  the server, the connection will be rejected (for example, this would occur
-  if the client requested protocol version 4.0, which does not exist as of
-  this writing).  If the minor version requested by the client is not
-  supported by the server (e.g., the client requests version 3.2, but the
-  server supports only 3.0), the server may either reject the connection or
-  may respond with a NegotiateProtocolVersion message containing the highest
-  minor protocol version which it supports.  The client may then choose either
-  to continue with the connection using the specified protocol version or
-  to abort the connection.
-
-  The protocol negotiation was introduced in
-  PostgreSQL version 9.3.21. Earlier versions would
-  reject the connection if the client requested a minor version that was not
-  supported by the server.
  
 
   
     server versions; the text format is usually the more portable choice.
    
   
+
+  
+   Protocol versions
+
+   
+    The current, latest version of the protocol is version 3.2. However, for
+    backwards compatibility with old server versions and middleware that don't
+    support the version negotiation yet, libpq still uses protocol version 3.0
+    by default.
+   
+
+   
+    A single server can support multiple protocol versions.  The initial
+    startup-request message tells the server which protocol version the client
+    is attempting to use.  If the major version requested by the client is not
+    supported by the server, the connection will be rejected (for example,
+    this would occur if the client requested protocol version 4.0, which does
+    not exist as of this writing).  If the minor version requested by the
+    client is not supported by the server (e.g., the client requests version
+    3.2, but the server supports only 3.0), the server may either reject the
+    connection or may respond with a NegotiateProtocolVersion message
+    containing the highest minor protocol version which it supports.  The
+    client may then choose either to continue with the connection using the
+    specified protocol version or to abort the connection.
+   
+
+   
+    The protocol negotiation was introduced in
+    PostgreSQL version 9.3.21. Earlier versions
+    would reject the connection if the client requested a minor version that
+    was not supported by the server.
+   
+
+   
+    Protocol versions
+
+    
+     
+      
+       Version
+       Supported by
+       Description
+      
+     
+
+     
+      
+      3.2
+      PostgreSQL 18 and later
+      Current latest version. The secret key used in query
+        cancellation was enlarged from 4 bytes to a variable length field. The
+        BackendKeyData message was changed to accomodate that, and the CancelRequest
+        message was redefined to have a variable length payload.
+      
+      
+      
+      3.1
+      -
+      Reserved. Version 3.1 has not been used by any PostgreSQL
+        version, but it was skipped because old versions of the popular
+        pgbouncer application had a bug in the protocol negotiation which made
+        it incorrectly claim that it supported version 3.1.
+      
+      
+      
+      3.0
+      PostgreSQL 7.4 and later
+      
+      
+      2.0
+      up to PostgreSQL 13
+      See previous releases of
+      the PostgreSQL documentation for
+      details
+      
+     
+    
+   
+