-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Turso Driver Adapter: Including _count leads to error #23566
Copy link
Copy link
Closed
Labels
bug/2-confirmedBug has been reproduced and confirmed.Bug has been reproduced and confirmed.kind/bugA reported bug.A reported bug.topic: @prisma/adapter-libsql / Tursotopic: driverAdapterstopic: wasm
Milestone
Description
Bug description
When using Turso and attempting to generate an aggregated count, an error similar to the following is thrown
PrismaClientKnownRequestError:
Invalid `prisma.topic.findMany()` invocation:
Inconsistent column data: Conversion failed: expected a either an i64 or a f64 in column '_aggr_count_tools', found null
I think this error is thrown if the count for a specific relation equals 0.
This is the same as #23140 but that one was closed without solution.
How to reproduce
With a Turso setup, run a query similar to the following:
const topics = await prisma.topic.findMany({
include: {
_count: {
select: {
tools: true,
},
},
},
})Expected behavior
No response
Prisma information
model Tool {
id Int @id @default(autoincrement())
name String
slug String @unique
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
topics Topic[]
}
model Topic {
id Int @id @default(autoincrement())
name String
slug String @unique
tools Tool[]
}Environment & setup
- OS: macOS
- Database: Turso (LibSQL)
- Bun 1.0.25
Prisma Version
5.11.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bug/2-confirmedBug has been reproduced and confirmed.Bug has been reproduced and confirmed.kind/bugA reported bug.A reported bug.topic: @prisma/adapter-libsql / Tursotopic: driverAdapterstopic: wasm