postgresql/src
Jacob Champion 4966bd3ed9 libpq: Grease the protocol by default
Send PG_PROTOCOL_GREASE and _pq_.test_protocol_negotiation, which were
introduced in commit d8d7c5dc8, by default, and fail the connection if
the server attempts to claim support for them. The hope is to provide
feedback to noncompliant implementations and gain confidence in our
ability to advance the protocol. (See the other commit for details.)

To help end users navigate the situation, a link to our documentation
that explains the behavior is displayed. We append this to the error
message when the NegotiateProtocolVersion response is incorrect, or when
the peer sends an error during startup that appears to be grease-
related.

It's still possible for users to connect to servers that don't support
protocol negotiation, by adding max_protocol_version=3.0 to their
connection strings. Only the default connection behavior is impacted.

This commit is tracked as a PG19 open item and will be reverted before
RC1. (The implementation here doesn't handle negotiation with later
server versions, so it can't be released into the wild as a
five-year-supported feature. But an improved implementation might be
able to do so, in the future...)

Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Co-authored-by: Jacob Champion <jacob.champion@enterprisedb.com>
Discussion: https://postgr.es/m/DDPR5BPWH1RJ.1LWAK6QAURVAY%40jeltef.nl
2026-02-23 10:48:20 -08:00
..
backend Restore AIX support. 2026-02-23 13:34:22 -05:00
bin Disallow CR and LF in database, role, and tablespace names 2026-02-23 11:19:13 -05:00
common meson: allow disabling building/installation of static libraries. 2026-02-23 16:45:40 +01:00
fe_utils Disallow CR and LF in database, role, and tablespace names 2026-02-23 11:19:13 -05:00
include Restore AIX support. 2026-02-23 13:34:22 -05:00
interfaces libpq: Grease the protocol by default 2026-02-23 10:48:20 -08:00
makefiles Restore AIX support. 2026-02-23 13:34:22 -05:00
pl Fix additional fallthrough warnings from clang 2026-02-23 07:40:19 +01:00
port Restore AIX support. 2026-02-23 13:34:22 -05:00
template Restore AIX support. 2026-02-23 13:34:22 -05:00
test libpq: Grease the protocol by default 2026-02-23 10:48:20 -08:00
timezone Use fallthrough attribute instead of comment 2026-02-19 08:51:12 +01:00
tools Restore AIX support. 2026-02-23 13:34:22 -05:00
tutorial Force standard_conforming_strings to always be ON. 2026-01-21 15:08:38 -05:00
.gitignore
DEVELOPERS
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
Makefile.global.in tests: Add a test C++ extension module 2026-01-20 16:42:30 +01:00
Makefile.shlib Restore AIX support. 2026-02-23 13:34:22 -05:00
meson.build Update copyright for 2026 2026-01-01 13:24:10 -05:00
nls-global.mk Fix update-po for the PGXS case 2025-10-16 20:21:05 +02:00