New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prepared statement contains too many placeholders #9132
Comments
Is this only in the context of a transaction, or also on individual Prisma Client queries? |
Hi @janpio, ran a few more tests and it's inside the
It's failing on a |
Seems related to: #6693, but for MySQL. |
Hello I'm having the same issue with createMany. I'm using MariaDB, I'm migrating from typeorm and was using mysql2 package. with that setup it does work. Do you think this is related to the underlying driver Prisma is using? |
I have the same error with a single update call: await prisma.segmentData.update({
where: { id: segmentId },
data: {
lastActiveAt: new Date(),
customers: { disconnect: { id: customerId } },
},
}); This is my model: model SegmentData {
id Int @id @default(autoincrement()) @db.UnsignedInt
storeId Int @db.UnsignedInt
name String? @db.VarChar(255)
segmentType SegmentData_segmentType
lastActiveAt DateTime @db.DateTime(0)
blueLinkId Int? @db.UnsignedInt
isDynamic Boolean @default(false)
blueLink BlueLink? @relation(fields: [blueLinkId], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "fk_SegmentData_BlueLink1")
store Store @relation(fields: [storeId], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "fk_SegmentData_Store1")
campaignSegments CampaignSegment[]
filters SegmentFilter[]
customers Customer[] @relation("CustomerToSegment")
autoPilotTasks AutoPilotTask[] @relation("SegmentToAutoPilotTask")
@@unique([storeId, segmentType, blueLinkId], map: "segmentStoreTypeBlueLink_UNIQUE")
@@index([blueLinkId], map: "fk_SegmentData_BlueLink1")
} This is the error:
|
Same issue. Version 2.27, createMany throws same error. |
This has been fixed in Prisma 3.4.0. You will need to upgrade to benefit from this improvement. |
It works in 3.4.0 indeed. Thanks! |
Just to say @janpio, I'm not sure that the solution is actually working as expected. With Prisma const results = await prisma.$transaction([
// ... other options
prisma.foo.createMany(...)
]); Where the What I'm finding is that no error is thrown, but the data is not actually written to the database 😬 . Is this definitely working as expected for other people on this thread? I wonder if wrapping in |
I would have expected others to report similar issues before if the plain use case would still not work. I think the best way forward here is for you to create a new bug report issue and provide all the information it asks for - optimally a minimal reproduction as well. Then we can look into this. Thanks. |
Bug description
When creating many 1000s of rows (in my case also inside a transaction) in a MySQL database we hit:
I don't think these is an obvious workaround in the Prisma ecosystem.
How to reproduce
You can reproduce this with a large Prisma transaction given your available schema.
In my case this looks like:
Expected behavior
I think this is more like a feature request, but I'd expect the
createMany
or$transaction
to allow some opportunity to support abatchSize
/chunkSize
/transactionChunk
, like for example Knex BatchInsert or Sequelize Batch CreatePrisma information
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: