sqlite integer parameters should not be bound as doubles
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 122k
- Forks
- 37.3k
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 283
Description
Version
v26.2.0
Platform
Darwin rocksteady 25.5.0 Darwin Kernel Version 25.5.0: Mon Apr 27 20:40:51 PDT 2026; root:xnu-12377.121.6~2/RELEASE_ARM64_T8112 arm64
Subsystem
sqlite
What steps will reproduce the bug?
I am assuming parameters that are number are always bound as type double, but integers should be bound as type integer so that SQLite performs integer arithmetic and returns a type of integer instead of a type of double.
const db = new DatabaseSync(':memory:', { readBigInts: true });
const big = db.prepare('select 2 * 2');
const bigResult = big.all();
const notBig = db.prepare('select 2 * ?');
const notResult = notBig.all(2);
This is the offending code in nodejs:
https://github.com/nodejs/node/blob/19c46abbefdb8711b913d7237b3c1299367f87d7/src/node_sqlite.cc#L2703
How often does it reproduce? Is there a required condition?
Every time
What is the expected behavior? Why is that the expected behavior?
Integers should be bound as integers not double as they are integers.
What do you see instead?
Integers being bound as double.
Additional information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/node_sqlite.cc at the linked parameter-binding code and reproduce the issue with the provided DatabaseSync examples. Verify how numeric parameters are classified before SQLite receives them. Done means integer parameters produce SQLite integer arithmetic and the reported readBigInts behavior is covered by regression testing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js, sqlite
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100