Version
main
Platform
Subsystem
sqlite
What steps will reproduce the bug?
import { DatabaseSync } from 'node:sqlite';
const db = new DatabaseSync(':memory:');
db.exec('CREATE TABLE t (id INTEGER PRIMARY KEY)');
const result = db
.prepare('INSERT INTO t VALUES (?)')
.run(9007199254740993n);
console.log(result);
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
It should use the documented integer-conversion behavior: throw ERR_OUT_OF_RANGE by default
It should return a BigInt when BigInt reading is enabled.
What do you see instead?
{ changes: 1, lastInsertRowid: 9007199254740992 }
sqlite3_last_insert_rowid() returns the correct 64-bit integer, but StatementSync.run() converts it directly to a JavaScript Number, silently rounding values beyond the safe-integer range.
Additional information
No response
Version
main
Platform
Subsystem
sqlite
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
It should use the documented integer-conversion behavior: throw
ERR_OUT_OF_RANGEby defaultIt should return a
BigIntwhen BigInt reading is enabled.What do you see instead?
{ changes: 1, lastInsertRowid: 9007199254740992 }sqlite3_last_insert_rowid()returns the correct 64-bit integer, butStatementSync.run()converts it directly to a JavaScriptNumber, silently rounding values beyond the safe-integer range.Additional information
No response