Skip to content

fix: don't drop the Describe response on deferred transactions#1231

Merged
levkk merged 1 commit into
pgdogdev:mainfrom
Kerem-Kurt:fix/deferred-transaction-describe
Jul 19, 2026
Merged

fix: don't drop the Describe response on deferred transactions#1231
levkk merged 1 commit into
pgdogdev:mainfrom
Kerem-Kurt:fix/deferred-transaction-describe

Conversation

@Kerem-Kurt

Copy link
Copy Markdown
Contributor

Fixes #1196.

Problem

When the query parser defers a transaction-control statement (BEGIN/COMMIT/ROLLBACK) because no server is attached yet, extended_transaction_reply builds the reply but ignores the client's Describe. Extended-protocol clients (tokio-postgres and friends) get no ParameterDescription/NoData and abort with unexpected message from server.

Fix

Answer the Describe. Always sending NoData isn't enough: a statement describe ('S') must be answered with ParameterDescription first. tokio-postgres sends one while preparing and expects ParameterDescription before anything else.
So:

  • statement DescribeParameterDescription + NoData
  • portal DescribeNoData

matching the extended-query protocol for utility statements (no params, no rows).

Tests

The existing tokio_postgres tests only run SELECT/INSERT/COPY, so nothing exercised transaction control over the extended protocol. Added tokio_postgres/transaction.rs, plus protocol-level unit tests in query_engine/test/extended_transaction.rs.

@CLAassistant

CLAassistant commented Jul 17, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Fixes pgdogdev#1196.

A deferred BEGIN/COMMIT/ROLLBACK now answers the client's Describe message
(ParameterDescription + NoData for a statement, NoData for a portal) instead
of dropping it, which broke extended-protocol clients.
@Kerem-Kurt
Kerem-Kurt force-pushed the fix/deferred-transaction-describe branch from f1eac90 to 506553d Compare July 19, 2026 00:48
@Kerem-Kurt

Copy link
Copy Markdown
Contributor Author

Rebased onto latest main.
Pre-rebase failure for reference (orphaned by the rebase now): Actions/runs/29613579718

Turns out my branch was a commit behind and missing #1232 (hot mutex in comms), which lines up with that checkout timeout in test_schema_sharding. Pretty sure it was unrelated to this change, so hopefully the rebase sorts it out. Hope it's green now

@levkk
levkk merged commit d909a93 into pgdogdev:main Jul 19, 2026
44 checks passed
@levkk

levkk commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

Good stuff, thanks!

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.

Deferred BEGIN over extended protocol drops the Describe response → client gets "unexpected message from server"

3 participants