Skip to content

tx: regression test for Rollback after mid-query connection close (#2557)#2591

Merged
jackc merged 1 commit into
jackc:masterfrom
AlisinaDevelo:test/tx-rollback-conn-closed
Jun 30, 2026
Merged

tx: regression test for Rollback after mid-query connection close (#2557)#2591
jackc merged 1 commit into
jackc:masterfrom
AlisinaDevelo:test/tx-rollback-conn-closed

Conversation

@AlisinaDevelo

Copy link
Copy Markdown
Contributor

Follow-up to #2559. That PR added pgconn.ErrConnClosed and a pgconn-level test, but #2557 was filed against the pgx.Tx layer and there's no test covering that path.

This adds one: begin a tx, cancel an Exec mid-flight so the underlying conn closes, then assert the first Rollback is errors.Is(err, pgconn.ErrConnClosed) and not ErrTxClosed, and a second Rollback returns ErrTxClosed. No production code change.

Tested against Postgres 17 with -race, -count=20, no flakes.

jackc added a commit that referenced this pull request Jun 30, 2026
tx: regression test for Rollback after mid-query connection close (#2557)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jackc jackc merged commit d64ab64 into jackc:master Jun 30, 2026
15 of 28 checks passed
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