It seems I've hit SQLITE_LIMIT_FUNCTION_ARG = 32. After some debugging, it appears to be due to a js

It seems I've hit SQLITE_LIMIT_FUNCTION_ARG = 32. After some debugging, it appears to be due to a json_array() that is pulling around 34 columns :

select json_array("id", "location_type", "name", "status", "brand_id", "address", "google_maps_url" /* , ... */)
from location;


The query is generated via Drizzle Query API (https://orm.drizzle.team/docs/rqb) so it uses json_array for the nested items.
Unfortunately all of them are pretty legitimate columns...I guess I'll have to find some columns I can do without.

It seems that regular sqlite has a limit of 100 arguments (https://www.sqlite.org/limits.html). Any particular reason why D1 has settled on a limit of 32? I found this: https://github.com/cloudflare/workerd/commit/cfe19fdd962c2898dcb4a4bd0c4e1b2a60949f74
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
GitHub
Also adding a test to demonstrate a json_object query that requires the higher limit
Was this page helpful?