Skip to content

fix: Exec returns wrong arg count in "not enough args" error#1396

Open
semihbkgr wants to merge 1 commit into
mattn:masterfrom
semihbkgr:fix-exec-not-enough-args-message
Open

fix: Exec returns wrong arg count in "not enough args" error#1396
semihbkgr wants to merge 1 commit into
mattn:masterfrom
semihbkgr:fix-exec-not-enough-args-message

Conversation

@semihbkgr
Copy link
Copy Markdown

Aligns the Exec "not enough args" message with Query's. Adds a regression test covering both paths.

Fixes #1395

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>
Comment thread sqlite3_test.go
}
defer db.Close()

const want = "not enough args to execute query: want 1 got 0"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

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.

Exec returns wrong arg count in "not enough args" error

2 participants