nodejs / nodejs/node

sqlite integer parameters should not be bound as doubles

オープン
#63,826 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

question sqlite
主要言語
JavaScript
スター
122k
フォーク
37.3k
平均マージ
4日 2時間
マージ済み PR(30日)
283

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

src/node_sqlite.cc のリンク先のパラメータバインディングコードから始め、提供された DatabaseSync の例で問題を再現します。SQLite が受け取る前に数値パラメータがどのように分類されるかを確認します。整数パラメータで SQLite の整数演算が行われ、報告された readBigInts の動作が回帰テストでカバーされれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, node.js, sqlite
領域
databases
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
68/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。