Skip to content

(feat): Support PostgreSQL protocol 3.2 negotiation for frontend clients#926

Open
sarajmunjal wants to merge 1 commit intopgdogdev:mainfrom
sarajmunjal:issue-578
Open

(feat): Support PostgreSQL protocol 3.2 negotiation for frontend clients#926
sarajmunjal wants to merge 1 commit intopgdogdev:mainfrom
sarajmunjal:issue-578

Conversation

@sarajmunjal
Copy link
Copy Markdown

@sarajmunjal sarajmunjal commented Apr 23, 2026

This PR adds frontend-side PostgreSQL protocol 3.2 support to PgDog - addressing #578.

PgDog now accepts 3.2 startup requests, negotiates newer 3.x minor versions down with NegotiateProtocolVersion, reports unsupported pq.* startup options in that response, and returns cancel keys / BackendKeyData in the right shape for the negotiated protocol. Backend connections to PostgreSQL are unchanged.

What changed

  • added protocol version parsing/negotiation and NegotiateProtocolVersion
  • updated startup parsing for 3.2, 3.3+ -> 3.2, and pq.* option reporting
  • updated BackendKeyData / CancelRequest handling for protocol-dependent secret lengths
  • generated client cancel keys based on the negotiated frontend protocol version
  • added unit and integration coverage for negotiation and extended cancel-key behavior
  • added an independent psql 18 smoke test pinned to exact 3.0 and 3.2

Compatibility

3.0 clients continue to work
3.2 clients are accepted directly
newer 3.x minor versions negotiate down to 3.2
non-3.x major versions remain unsupported

Verification

Ran locally:

cargo fmt --all
cargo test -p pgdog --lib --no-run
cargo test -p rust --test mod --no-run
cargo test -p rust --test mod integration::protocol_version:: -- --nocapture
bash integration/complex/protocol_version/run.sh

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 23, 2026

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants