Skip to content

[BUG]: Callstack exceeded for large inserts #1702

@0ximjosh

Description

@0ximjosh

What version of drizzle-orm are you using?

0.29.2

What version of drizzle-kit are you using?

0.20.6

Describe the Bug

SQL for inserts with multiple values are generated via recursion, the call stack can be quickly exhausted with large enough inserts. This particularly becomes an issue when dealing with batched data, or seeding large sums of data into a database. Instead of a separate reproduction repo, I went ahead and added a planetscale example to the drizzle-orm repo here. To see the bug in action, go to examples/planetscale and run pnpm seed after adding pscale credentials for a drizzle connector & installing the packages. (you may need to add the folder to the pnpm workspace to get it to behave properly).

On my machine, this is happening at 100k records, although I have reports that this is also happening with around 10k records on aws lambdas.

Expected behavior

Callstack should not be exceeded

Environment & setup

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingqb/crud

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions