Skip to content

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

Description

@semihbkgr

db.Exec and db.Query share the same multi-statement loop and trip the same "not enough args" check, but the error messages disagree on the second number.

Repro

_, errExec := db.Exec("SELECT ?; SELECT ?", "hello")
_, errQuery := db.Query("SELECT ?; SELECT ?", "hello")
fmt.Println(errExec)
fmt.Println(errQuery)

Output:

not enough args to execute query: want 1 got 1
not enough args to execute query: want 1 got 0

The two paths use the same check len(args)-start < na but format different numbers in the error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions