postgres/src
Heikki Linnakangas 285613c60a libpq: Add min/max_protocol_version connection options
All supported version of the PostgreSQL server send the
NegotiateProtocolVersion message when an unsupported minor protocol
version is requested by a client. But many other applications that
implement the PostgreSQL protocol (connection poolers, or other
databases) do not, and the same is true for PostgreSQL server versions
older than 9.3. Connecting to such other applications thus fails if a
client requests a protocol version different than 3.0.

This patch adds a max_protocol_version connection option to libpq that
specifies the protocol version that libpq should request from the
server. Currently only 3.0 is supported, but that will change in a
future commit that bumps the protocol version. Even after that version
bump the default will likely stay 3.0 for the time being. Once more of
the ecosystem supports the NegotiateProtocolVersion message we might
want to change the default to the latest minor version.

This also adds the similar min_protocol_version connection option, to
allow the client to specify that connecting should fail if a lower
protocol version is attempted by the server. This can be used to
ensure that certain protocol features are used, which can be
particularly useful if those features impact security.

Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Robert Haas <robertmhaas@gmail.com> (earlier versions)
Discussion: https://www.postgresql.org/message-id/CAGECzQTfc_O%2BHXqAo5_-xG4r3EFVsTefUeQzSvhEyyLDba-O9w@mail.gmail.com
Discussion: https://www.postgresql.org/message-id/CAGECzQRbAGqJnnJJxTdKewTsNOovUt4bsx3NFfofz3m2j-t7tA@mail.gmail.com
2025-04-02 16:41:45 +03:00
..
backend Add support for NOT ENFORCED in foreign key constraints 2025-04-02 13:36:44 +02:00
bin Add support for NOT ENFORCED in foreign key constraints 2025-04-02 13:36:44 +02:00
common Fix integer-overflow problem in scram_SaltedPassword() 2025-03-26 17:46:51 +09:00
fe_utils Fix accidentally-harmless thinko in psqlscan_test_variable(). 2025-03-31 12:16:32 -04:00
include libpq: Add min/max_protocol_version connection options 2025-04-02 16:41:45 +03:00
interfaces libpq: Add min/max_protocol_version connection options 2025-04-02 16:41:45 +03:00
makefiles aio: Add liburing dependency 2025-03-26 19:45:32 -04:00
pl Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
port Add timingsafe_bcmp(), for constant-time memory comparison 2025-04-02 15:32:40 +03:00
template thread-safety: gmtime_r(), localtime_r() 2024-08-23 07:43:04 +02:00
test libpq: Add min/max_protocol_version connection options 2025-04-02 16:41:45 +03:00
timezone pg_noreturn to replace pg_attribute_noreturn() 2025-03-13 12:37:26 +01:00
tools Introduce a SQL-callable function array_sort(anyarray). 2025-04-01 18:03:55 -04:00
tutorial Doc: simplify the tutorial's window-function examples. 2025-01-21 14:43:21 -05:00
.gitignore
DEVELOPERS
Makefile
Makefile.global.in aio: Add liburing dependency 2025-03-26 19:45:32 -04:00
Makefile.shlib
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00
nls-global.mk