Request: SQLite IN-list chunking still exceeds the statement-wide parameter limit
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- sqlite, typescript
- Área
- database
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 3.9k
- Forks
- 268
- Merge medio
- 1 d 2 h
- PR fusionados (30 d)
- 206
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de TanStack/db
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
Los mantenedores suelen responder en 1 día
-
Reusable queries: standalone descriptor resolution and nested alias composition limitsPosiblemente ocupada @KyleAMathews la tomó hace 1 día. Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
electric-db-collection: on-demand + persistence fails after relaunch with "Snapshot requests are not supported in full mode"Posiblemente ocupada @KyleAMathews la tomó hace 2 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
TanStack/db#2056 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
TanStack/db#1972 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de TanStack/db
Issues similares
-
[Bug]: Server git tests sign fixture commits with the developer's key when run from the repo rootAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
melgarafael/DeskcommCRM#2657 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
MystenLabs/MemWal#1163 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Mondriaan
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
knaw-huc/textannoviz#709 ·
Los mantenedores suelen responder en 1 día
-
billion-context-pi
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
ranxianglei/billion-context#2521 · 3 comentarios ·
Los mantenedores suelen responder en 1 día