-
Notifications
You must be signed in to change notification settings - Fork 2.1k
include _count leads to error when using Turso #23140
Copy link
Copy link
Closed as not planned
Labels
bug/0-unknownBug is new, does not have information for reproduction or reproduction could not be confirmed.Bug is new, does not have information for reproduction or reproduction could not be confirmed.kind/bugA reported bug.A reported bug.topic: @prisma/adapter-libsql / Tursotopic: driverAdapters
Description
Bug description
When using Turso and attempting to generate an aggregated count, an error similar to the following is thrown
Invalid `prisma.property.findUnique()` invocation:
Inconsistent column data: Conversion failed: expected a either an i64 or a f64 in column '_aggr_count_leases', found null"
This does not occur locally nor when querying a simple SQLite DB
How to reproduce
With a Turso setup, run a query similar to the following
const property = await prisma.property.findUnique({
where: { id, managers: { some: { managerId } } },
include: {
_count: {
select: {
apartments: true,
}
},
},
});Expected behavior
No response
Prisma information
generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters"]
binaryTargets = ["native", "debian-openssl-1.1.x"]
output = "./generated/client"
}
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
model Property {
id String @id @default(uuid())
// ...
managers ManagesProperty[]
apartments Apartment[]
}
model Apartment {
id String @id @default(uuid())
// ...
propertyId String
property Property @relation(fields: [propertyId], references: [id])
leases ApartmentLease[]
}
model ApartmentLease {
id String @id @default(uuid())
apartment Apartment @relation(fields: [apartmentId], references: [id])
apartmentId String
lease Lease @relation(fields: [leaseId], references: [id])
leaseId String
}
model Lease {
id String @id @default(uuid())
// ...
from DateTime
to DateTime
apartments ApartmentLease[]
}Environment & setup
- Database: Turso (LibSQL)
- Bun 1.0.25
Prisma Version
5.5.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bug/0-unknownBug is new, does not have information for reproduction or reproduction could not be confirmed.Bug is new, does not have information for reproduction or reproduction could not be confirmed.kind/bugA reported bug.A reported bug.topic: @prisma/adapter-libsql / Tursotopic: driverAdapters