Request: SQLite IN-list chunking still exceeds the statement-wide parameter limit
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- sqlite, typescript
- Lĩnh vực
- database
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 3.9k
- Fork
- 268
- Merge trung bình
- 1 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 193
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của TanStack/db
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Debounce and throttle paced mutations allow concurrent persistence despite the documented single-flight contractCó thể đã có người làm @KyleAMathews đã nhận hôm nay. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
TanStack/db#1972 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Effect-TS/effect#8881 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Discover carries headerEdges that nothing reads since #1914 moved E0507/E0517 to the compiler graphĐang mởtech-debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
mail processing verified
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 7 ngày
-
Add: Channel 5 (Singapore) SDĐang mởcheck:passed streams:add
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
OpenSlides/OpenSlides#7180 ·