prisma / studio

🎙️ The easiest way to explore and manipulate your data in all of your Prisma projects.
https://www.prisma.io/studio
1.81k stars 45 forks source link

`Decimal` Precision Error #1223

Open jessehansen opened 3 months ago

jessehansen commented 3 months ago

Bug description

Specific values are losing precision when typed into Decimal fields in Prisma Studio. Some example values: 83261.85 and 97.43.

See also https://github.com/prisma/prisma/issues/20881

How to reproduce

Create a model with a decimal field, and enter a value of 83261.85 into a new record. Refresh, and see that 83261.85000000001 was persisted.

Expected behavior

Entering a value in prisma studio should persist that value, and not a different value.

Prisma information

Sample Schema:

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "postgresql"
  url      = "postgresql://local:local@localhost:5434/test_things?schema=public"
}

model ThingWithDecimal {
  id     Int     @id @default(autoincrement())
  amount Decimal
}

Environment & setup

Prisma logs

No response