Skip to content

Bound-parameter limits: chunk IN lists and multi-row inserts #57

Open

Description

@artile

Signal

D1 allows 100 bound parameters per statement. SQLite allows 32,766 by default. We want the dialect capability to carry this limit, and the builder to split work that exceeds it, or refuse it with a clear error.

Why (MyRemotely)

  • 20 createMany call sites. Some insert hundreds of rows (passcode generation, imports from Rentvine).
  • Many id IN (...) reads with long id lists.
  • Today a large statement fails at the server. The failure comes late and the error is vague.

Proposed shape

  • insertInto(T).values(rows): the dialect splits it into N statements. They run in one batch or one transaction, so the write stays atomic.
  • inArray(col, ids) with more ids than the limit: compile error by default. chunked opt-in runs N queries and joins the decoded rows.
  • QueryBuilderError with reason TooManyParameters and the count.

Part of #52: the CAFE-stack roadmap signal from MyRemotely. This shows the direction we want, and it is not a demand. We can send a PR if you accept the idea.

Activity

  1. Makisuo commented on Oct 25, 2026

    @Makisuo
    Contributor

    Partly addressed by #119: d1Dialect carries D1's 100-binding limit (sqliteDialect: 32,766), and a statement over it fails at compile time with a QueryBuilderError naming the count, not at the server. Splitting long IN lists and multi-row inserts into several statements is still open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions