You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
D1 limits page: missing compound SELECT (5) and result-set column (100) limits; function-argument limit listed as 32 but D1 allows 127 #34596
Disclaimer: Claude helped me setup the content for this but it describes real issues I encountered while developing. Would be nice for D1 docs to have those limitations mentioned somewhere so LLMs at least try to avoid/verify what they do.
The limits table leaves out two limits that D1 enforces, and gets one number wrong. We found this when a query
that passed our local tests (bun:sqlite, which uses SQLite's default limits) failed in production with too many terms in compound SELECT. We checked the limits page first and the limit isn't on it.
Measured on 2026-10-25 against a remote D1 database with read-only queries through wrangler d1 execute --remote
(wrangler 4.149.0). Local D1 (--local) gives exactly the same results:
Limit
On the page
What D1 enforces
Error past the limit
Terms in a compound SELECT (UNION / UNION ALL / …)
not listed
5
too many terms in compound SELECT
Columns in a result set
not listed (only "columns per table: 100")
100
too many columns in result set
Arguments per SQL function
32
127
too many arguments on function max
LIKE / GLOB pattern length
50 bytes
50 bytes ✓
LIKE or GLOB pattern too complex
Reproduction
-- 5 terms work, 6 fail
select 1 union all select 1 union all select 1 union all select 1 union all select 1;
select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1;
-- → too many terms in compound SELECT: SQLITE_ERROR [code: 7500]
-- 100 columns work, 101 fail
select 1,2,3, … ,101;
-- → too many columns in result set: SQLITE_ERROR
-- 33 and 127 arguments work, 128 fails (the page says 32)
select max(1,2, … ,127); -- ok
select max(1,2, … ,128);
-- → too many arguments on function max at offset 7: SQLITE_ERROR
What changes are you suggesting?
Add Maximum terms in a compound SELECT: 5.
Change "columns per table" to cover result sets too, e.g. Maximum columns in a table or result set: 100.
SQLite's SQLITE_LIMIT_COLUMN also covers the terms in ORDER BY, GROUP BY and the SET clause of an UPDATE, so those may be worth stating too.
Change Maximum arguments per SQL function to 127, or explain where 32 applies.
Ideally, list every sqlite3_limit() value D1 sets. These limits are far lower than SQLite's defaults
(e.g. 500 compound terms, 2000 columns), and the usual way to run D1 queries in unit tests, a local SQLite
library, uses those defaults. So the published table is the only warning a developer gets before a query
fails in production.
Activity