Skip to content

feat(sqlite): option to avoid pushing parameters to the stack #57932

Closed as not planned

Description

@aidant

What is the problem this feature will solve?

At the moment the only way to pass sqlite anonymous parameters is via the stack. This presents a problem as you can encounter a RangeError: Maximum call stack size exceeded when passing parameters.

Example
node --stack-size=50 # lowered to simulate the exception 
import { DatabaseSync } from 'node:sqlite'

const numbers = Array.from({ length: 1000 }, (_, index) => index)

console.log(
  JSON.parse( 
    new DatabaseSync(':memory:')
      .prepare(`select json_array(${numbers.map(() => '?')}) as numbers`)
      .get(...numbers).numbers
  )
)

What is the feature you are proposing to solve the problem?

Consider providing functionality for binding anonymous parameters to SQLite queries without having to place them on the stack.

What alternatives have you considered?

No response

Activity

  1. cjihrig commented on Apr 19, 2025

    @cjihrig
    Contributor

    Two questions:

    1. Is this causing a real problem, or is this hypothetical? The current approach seems fine for reasonable queries.
    2. If you have run into a real problem, how has it been solved by other Node.js SQLite libraries?
  2. aidant commented on Apr 19, 2025

    @aidant
    ContributorAuthor
    1. This is not causing a real problem, it's just hypothetical at the moment.
    2. I've run into a similar problem before in a query builder where I was pushing fragments to an array using sql.push(...fragments) and the alternative in that scenario is for (const fragment of fragments) sql.push(fragment).
  3. jlarmstrongiv commented on Apr 30, 2025

    @jlarmstrongiv

    That’s great to know! I regularly have queries where I insert thousands of variables. I usually just hit the SQLite limit of 2000 columns per table.

  4. added
    sqliteIssues and PRs related to the SQLite subsystem.
    on May 6, 2025
  5. github-actions commented on Nov 3, 2025

    @github-actions
    Contributor

    There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the never-stale Issues and PRs exempt from automated stale handling. label or close this issue if it should be closed. If not, the issue will be automatically closed 6 months after the last non-automated comment.
    For more information on how the project manages feature requests, please consult the feature request management document.

  6. added
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Nov 3, 2025
  7. github-actions commented on Dec 4, 2025

    @github-actions
    Contributor

    There has been no activity on this feature request and it is being closed. If you feel closing this issue is not the right thing to do, please leave a comment.

    For more information on how the project manages feature requests, please consult the feature request management document.

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

    feature requestIssues requesting new Node.js features.sqliteIssues and PRs related to the SQLite subsystem.staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions