fix: Exec returns wrong arg count in "not enough args" error#1396
Open
semihbkgr wants to merge 1 commit into
Open
fix: Exec returns wrong arg count in "not enough args" error#1396semihbkgr wants to merge 1 commit into
semihbkgr wants to merge 1 commit into
Conversation
Exec was formatting len(args) (original total) while Query formats len(args)-start (remaining). For "SELECT ?; SELECT ?" with one arg, Exec produced "want 1 got 1"; Query correctly produced "want 1 got 0". Aligned both sites and added a regression test. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
otoolep
reviewed
May 10, 2026
| } | ||
| defer db.Close() | ||
|
|
||
| const want = "not enough args to execute query: want 1 got 0" |
Contributor
There was a problem hiding this comment.
Unless there are other tests like this in the codebase, this test is brittle and doesn't add much value. The fix is a good idea, but this test is more trouble than it's worth. IMHO.
The right way to test errors is to create type errors and ensure that the right type comes back -- but that is much bigger change and I'm not proposing it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Aligns the
Exec"not enough args" message withQuery's. Adds a regression test covering both paths.Fixes #1395