Skip to content

fix: surface unhandled native result statuses on the query callback - #3765

Open
official-burak wants to merge 1 commit into
brianc:masterfrom
official-burak:fix/pg-native-unhandled-result-status
Open

fix: surface unhandled native result statuses on the query callback#3765
official-burak wants to merge 1 commit into
brianc:masterfrom
official-burak:fix/pg-native-unhandled-result-status

Conversation

@official-burak

@official-burak official-burak commented Sep 2, 2026

Copy link
Copy Markdown

Thanks for the careful write-up in #3758. COPY through the native client, and other unhandled libpq statuses, finished with no result object, so the query callback looked like success while res was undefined. The server error never reached that callback, which made the aborted transaction hard to explain.

This emits a Result for COPY statuses, matching the JS driver, and reports unrecognized statuses on the query itself. NativeQuery also treats a missing result as an error instead of success.

Fixes #3758

Unhandled libpq statuses never reached the query callback, so callers saw undefined instead of the server error.

@brianc brianc left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreicate the PR! I am curious if there's a way you can write an integration test that actually hits a postgres backend to go through the error path vs. just relying on stubs & unit tests to stress the behavior? I appreciate the tests, but sometimes there can be a situation in which too many things are mocked & the actual error can get re-introduced if the internals change.

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.

pg-native: unhandled libpq result status drops the result and the server's error

2 participants