Request: SQLite IN-list chunking still exceeds the statement-wide parameter limit
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- sqlite, typescript
- 领域
- database
调研方向
Start by tracing the SQLite persistence compiler from adapter.loadSubset and reproduce the issue with the Node SQLite harness using a variable limit of 999. Inspect how composed predicates contribute bound parameters, including index expressions and partial-index predicates. Done means each executed statement stays within SQLite’s parameter limit while preserving typed comparisons, bigint precision, and literal arrays in index definitions.
由索引模型根据 Issue 内容生成。
描述
Problem
The SQLite persistence compiler splits large IN arrays into smaller clauses joined with OR, but keeps all their bound parameters in one SQL statement.
SQLite's bound-parameter limit applies to the entire statement. Splitting the clauses therefore does not prevent the limit from being exceeded.
Multiple smaller IN predicates can also exceed the limit when composed into one query.
Versions
@tanstack/db-sqlite-persistence-core:0.4.0@tanstack/browser-db-sqlite-persistence:0.2.25@tanstack/db:0.11.0
The same compilation strategy is present in upstream main inspected on October 2, 2026.
Reproduction
Use a SQLite-backed adapter with the connection's variable limit set to 999. For example, our Node SQLite harness uses:
new DatabaseSync(':memory:', {
limits: { variableNumber: 999 },
})
After initializing a collection, request:
import { IR } from '@tanstack/db'
const ids = Array.from({ length: 1_000 }, (_, i) => `issue-${i}`)
await adapter.loadSubset(collectionId, {
where: new IR.Func('or', [
new IR.Func('in', [
new IR.PropRef(['issueId']),
new IR.Value(ids),
]),
new IR.Func('in', [
new IR.PropRef(['relatedIssueId']),
new IR.Value(ids),
]),
]),
})
Source inspection shows that this produces approximately 2,000 list parameters in one statement, despite the internal chunking. That exceeds the configured limit.
Expected behavior
Bound the total number of parameters in each executed statement, including parameters from composed predicates.
Downstream workaround
We bind each list as one JSON array and compile runtime predicates as:
field IN (SELECT value FROM json_each(?))
An alternative implementation would also be welcome. Important compatibility requirements include preserving typed comparisons and signed 64-bit bigint precision.
Index expressions and partial-index predicates need separate handling: SQLite does not permit these subqueries in index definitions.
Existing downstream tests cover 50,582 IDs across two fields, bigint values beyond JavaScript's safe-integer range, and literal arrays in index definitions. They were not rerun for this source-inspection report.
#810 concerns Electric HTTP request-size limits; this report concerns local SQLite statement parameters.
- 主要语言
- TypeScript
- 星标
- 3.9k
- 派生
- 268
- 平均合并
- 1 天 4 小时
- 30 天内合并 PR
- 178
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TanStack/db 的其他 Issue
-
Persisted on-demand Electric collection enters error after a committed transaction waits across subset hydration可能已有人在做 @alec-watts 于 1 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 45/100
维护者通常 1 天内回复
-
SQLite persistence silently serializes Temporal values as {}, breaking hydration and subset queries可能已有人在做 @KyleAMathews 于 1 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 50/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 30/100
维护者通常 1 天内回复
-
useLiveInfiniteQuery commits an empty first render over a synchronously loaded collection (useLiveQuery doesn't)可能已有人在做 @KyleAMathews 于 1 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 72/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 85/100
Comfy-Org/ComfyUI_frontend#20346 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 90/100
decentralized-identity/didwebvh-ts#203 ·
维护者通常 1 天内回复
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
难度 2/5 1-3 小时 新手友好度 65/100
lingdojo/kana-dojo#31791 · 1 条评论 · 5 个 reaction ·
维护者通常 1 天内回复
-
Telegram webhook: line breaks lost since switch to rich messages可能已有人在做 @Kshot3000 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
github_actions security
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复