-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
prisma/prisma-engines
#4771Labels
bug/2-confirmedBug has been reproduced and confirmed.Bug has been reproduced and confirmed.kind/bugA reported bug.A reported bug.tech/enginesIssue for tech Engines.Issue for tech Engines.topic: floating point typesTopic related to floating point types and precision lossTopic related to floating point types and precision losstopic: joinstopic: relationJoins
Milestone
Description
Bug description
When using relationLoadStrategy: 'join' in MySQL, retrieving nested models with Decimal fields seem to convert decimal values to floats.
How to reproduce
https://github.com/michaelhays/prisma-relationjoins-decimal
See these lines for what gets logged.
console.log(queryResult) // 95993.57
console.log(joinResult) // 95993.57000000001Prisma information
generator client {
provider = "prisma-client-js"
previewFeatures = ["relationJoins"]
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
model FirstModel {
id Int @id @default(autoincrement())
secondModels SecondModel[]
}
model SecondModel {
id Int @id @default(autoincrement())
value Decimal
firstModelId Int
firstModel FirstModel @relation(fields: [firstModelId], references: [id])
@@index([firstModelId])
}const joinResult = (await prisma.firstModel.findFirstOrThrow({
relationLoadStrategy: 'join',
include: { secondModels: true },
})).secondModels[0].valueEnvironment & setup
- OS: Linux, Fedora 39
- Database: MySQL
- Node.js version: v20.11.0
Prisma Version
prisma : 5.10.2
@prisma/client : 5.10.2
Computed binaryTarget : rhel-openssl-3.0.x
Operating System : linux
Architecture : x64
Node.js : v20.11.0
Query Engine (Node-API) : libquery-engine 5a9203d0590c951969e85a7d07215503f4672eb9 (at node_modules/@prisma/engines/libquery_engine-rhel-openssl-3.0.x.so.node)
Schema Engine : schema-engine-cli 5a9203d0590c951969e85a7d07215503f4672eb9 (at node_modules/@prisma/engines/schema-engine-rhel-openssl-3.0.x)
Schema Wasm : @prisma/prisma-schema-wasm 5.10.0-34.5a9203d0590c951969e85a7d07215503f4672eb9
Default Engines Hash : 5a9203d0590c951969e85a7d07215503f4672eb9
Studio : 0.499.0
Preview Features : relationJoins
maxb94, planklmar and Darrellbor
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.tech/enginesIssue for tech Engines.Issue for tech Engines.topic: floating point typesTopic related to floating point types and precision lossTopic related to floating point types and precision losstopic: joinstopic: relationJoins