-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
Closed
Labels
sqliteIssues and PRs related to the SQLite subsystem.Issues and PRs related to the SQLite subsystem.
Description
Version
v24.5.0
Platform
Linux dev 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64 GNU/Linux
Subsystem
sqlite
What steps will reproduce the bug?
test("numbered question mark parameters", () => {
const db = new DatabaseSync(":memory:")
db.exec(`CREATE TABLE TestInsertTable (arg1, arg2);`)
const statement = db.prepare(`
INSERT INTO TestInsertTable (arg1) VALUES (?1);`)
statement.run("asdf") // This line fails.
statement.run({ "?1": "asdf" }) // This line succeeds.
})
How often does it reproduce? Is there a required condition?
It's always reproducible.
What is the expected behavior? Why is that the expected behavior?
Numbered question mark parameters are positional parameters and they should be bound left-to-right from ?1 to SQLITE_MAX_VARIABLE_NUMBER.
Please refer to https://www.sqlite.org/lang_expr.html#varparam
In Node.js' implementation, however, they are bound as named parameters.
I verified that in other implementations (e.g. Python), they are correctly bound as positional parameters (as a tuple or array) and do not require passing the {"?1": value, ...} object, which defeats the purpose of the numbered question mark parameters.
What do you see instead?
Sqlite exception: Error: column index out of range
Additional information
Metadata
Metadata
Assignees
Labels
sqliteIssues and PRs related to the SQLite subsystem.Issues and PRs related to the SQLite subsystem.