Skip to content

fix: settle a cancelled pipelined statement after a cached plan error - #124

Closed
okomarov wants to merge 7 commits into
mainfrom
fix/cancelled-retry-settles
Closed

okomarov wants to merge 7 commits into
mainfrom
fix/cancelled-retry-settles

Conversation

@okomarov

@okomarov okomarov commented Oct 16, 2026 •

Copy link
Copy Markdown

Closes #123
Closes #130

A cancelled pipelined prepared statement that hit a cached plan error was sent to retry(), which dropped it without settling, so the promise hung. It is no longer retried and rejects with the server's error.

Query.cancel() now marks the query's own rejection as handled, so cancelling a query you do not await no longer raises an unhandled rejection; awaiting it still delivers the error.

…ter a cached plan error

A cancelled query that hit a cached-plan error was sent to retry(), and submit() drops cancelled queries without settling them, so the promise hung. A cancelled query now ends with the server's error.
… and the server error as cause

The cancelled query is not retried; it now ends like every other cancel path, and the cached plan error stays reachable as cause. The README example called pg_sleep without parentheses and now says what a cancelled query rejects with.
Reverts the 57014 rejection for a cancelled retried query while that choice is reconsidered; the query ends with the server error again.
…ndled rejection

Query.cancel() attaches a no-op rejection handler to the query's own promise, through Promise.prototype.then so a query that has not been executed is not started. Code that awaits the query still receives the error. The cancelled cached-plan case keeps the server's error, and the README now says what a cancelled query rejects with.
@okomarov

Copy link
Copy Markdown
Author

Landed on main as 2a2866e (#123) and 6c588ef (#130).

@okomarov okomarov closed this Oct 17, 2026
@okomarov
okomarov deleted the fix/cancelled-retry-settles branch October 17, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant