prisma: [PostgreSQL] Cannot create or update row with large Decimal value within `numeric` range
Bug description
I have a schema with a model which has a Decimal
value. When I try to create or update an entry passing as value a large number such as Prisma.Decimal('93431006234343600001')
, the operation fails with the following error
Error parsing GraphQL query: query parse error: Parse error at 3:12
number too large to fit in target type
How to reproduce
I have created a reproduction repo which can be found at https://github.com/codazzo/prisma-decimal-precision-repro
Expected behavior
My understanding is that with a Decimal
type I should be able to run
await prisma.entry.create({
data: {
value: new Prisma.Decimal('93431006234343600001')
}
})
Note that I am able to find
any entities that hold large values from the DB.
If the value is 93431006234343600001
in the DB, I can successfully call prisma.entry.findUnique()
and get the value back.
Prisma information
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Entry {
id Int @id @default(autoincrement())
value Decimal
}
Environment & setup
OS: macOS Big Sur 11.6.2 Kernel Version 20.6.0 Database: PostgreSQL 14.1 Node version: v16.9.1
Prisma Version
prisma : 3.8.1
@prisma/client : 3.8.1
Current platform : darwin-arm64
Query Engine (Node-API) : libquery-engine 34df67547cf5598f5a6cd3eb45f14ee70c3fb86f (at node_modules/@prisma/engines/libquery_engine-darwin-arm64.dylib.node)
Migration Engine : migration-engine-cli 34df67547cf5598f5a6cd3eb45f14ee70c3fb86f (at node_modules/@prisma/engines/migration-engine-darwin-arm64)
Introspection Engine : introspection-core 34df67547cf5598f5a6cd3eb45f14ee70c3fb86f (at node_modules/@prisma/engines/introspection-engine-darwin-arm64)
Format Binary : prisma-fmt 34df67547cf5598f5a6cd3eb45f14ee70c3fb86f (at node_modules/@prisma/engines/prisma-fmt-darwin-arm64)
Default Engines Hash : 34df67547cf5598f5a6cd3eb45f14ee70c3fb86f
Studio : 0.452.0
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 16 (7 by maintainers)
I’m hitting this problem too, and with BigInt column type.
Please add some basic test cases for this and fix it asap, basically all big number support is broken.
Do we have any update on this or a progress update here? A project I am working on is blocked by this.
Any update here? I am completely blocked from using large numbers with prisma.