Skip to content

Conversation

@blathers-crl
Copy link

@blathers-crl blathers-crl bot commented Jan 5, 2026

Backport 1/1 commits from #160377 on behalf of @ZhouXing19.


Fixes #158771

Previously, when using the extended protocol (Parse/Bind/Describe/Execute/Sync) to call a PL/pgSQL procedure containing COMMIT statements, CockroachDB would send extra RowDescription messages after the COMMIT, causing the JDBC driver to throw NoSuchElementException due to unexpected message sequences.

This change fixes the message flow to match JDBC driver expectations when procedures execute COMMIT statements internally. The fix ensures that the proper sequence of PostgreSQL wire protocol messages is sent, preventing the driver from entering an inconsistent state.

For reference, PG's code for describe portal message: https://github.com/postgres/postgres/blob/451c43974f8e199097d97624a4952ad0973cea61/src/backend/tcop/postgres.c#L2731

Release Notes (Bug Fix): Fixed compatibility issue with JDBC driver when calling PL/pgSQL procedures containing COMMIT statements via prepared statements. The driver would previously throw NoSuchElementException due to unexpected PostgreSQL wire protocol message sequences.


Release justification: low-risk bug fix.

@blathers-crl blathers-crl bot requested review from a team as code owners January 5, 2026 22:50
@blathers-crl blathers-crl bot added blathers-backport This is a backport that Blathers created automatically. O-robot Originated from a bot. labels Jan 5, 2026
@blathers-crl blathers-crl bot requested review from mgartner and removed request for a team January 5, 2026 22:50
@blathers-crl
Copy link
Author

blathers-crl bot commented Jan 5, 2026

Thanks for opening a backport.

Before merging, please confirm that the change does not break backwards compatibility and otherwise complies with the backport policy. Include a brief release justification in the PR description explaining why the backport is appropriate. All backports must be reviewed by the TL for the owning area. While the stricter LTS policy does not yet apply, please exercise judgment and consider gating non-critical changes behind a disabled-by-default feature flag when appropriate.

@blathers-crl blathers-crl bot added backport Label PR's that are backports to older release branches T-sql-queries SQL Queries Team labels Jan 5, 2026
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@yuzefovich yuzefovich requested review from michae2 and removed request for ZhouXing19, mgartner and yuzefovich January 5, 2026 23:42
@michae2 michae2 requested a review from mw5h January 7, 2026 23:28
…ements

Previously, when using the extended protocol
(Parse/Bind/Describe/Execute/Sync) to call a PL/pgSQL procedure
containing COMMIT statements, CockroachDB would send extra
RowDescription messages after the COMMIT, causing the JDBC driver to
throw NoSuchElementException due to unexpected message sequences.

This change fixes the message flow to match JDBC driver expectations
when procedures execute COMMIT statements internally. The fix ensures
that the proper sequence of PostgreSQL wire protocol messages is sent,
preventing the driver from entering an inconsistent state.

Fixes #158771

Release Notes (Bug Fix): Fixed compatibility issue with JDBC driver when
calling PL/pgSQL procedures containing COMMIT statements via prepared
statements. The driver would previously throw NoSuchElementException due
to unexpected PostgreSQL wire protocol message sequences.
@yuzefovich yuzefovich force-pushed the blathers/backport-release-26.1-160377 branch from 8e6667b to 5930789 Compare January 17, 2026 06:51
@yuzefovich yuzefovich merged commit 306ad3f into release-26.1 Jan 17, 2026
19 checks passed
@yuzefovich yuzefovich deleted the blathers/backport-release-26.1-160377 branch January 17, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Label PR's that are backports to older release branches blathers-backport This is a backport that Blathers created automatically. O-robot Originated from a bot. T-sql-queries SQL Queries Team target-release-26.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants