Skip to content

Postgresql: Large double precision float values cause panic #3923

@DekzVt

Description

@DekzVt

Bug description

Prisma client panics on queries of float values over ~ 7.922e+28

How to reproduce

I had originally tried this on version prisma version 2.1.3:
anything over ~9.223e+18

  1. Connect prisma to a table with a column of type "Double Precision" (float8)
  2. Use a FindMany, FindOne, or $queryRaw to query on that table
  3. Manually (sql) set a float value on one of the tables as 7.922e+28. This value should return from query as intended
  4. Manually (sql) set a float value as 7.923e+28. This value will cause a panic with the error message:
"Invalid `prisma.stat.findOne()` invocation in\n/app/src/allTypes/queries/....
 PANIC: f64 is not a Decimal: Error { message: "Invalid decimal: overflow from scale mismatch" }
 This is a non-recoverable error which probably happens when the Prisma Query Engine has a panic."

Expected behavior

Large decimal values should return as in step 3 of 'How to reproduce'.

Prisma information

Table/Column in question looks like:

model Stat {
  ...
  healthPoints Float? @map("health_points")
  ...
  @map("stat")
}

Environment & setup

  • OS: Linux Debian (node:14-buster-slim docker image)
  • Database: PostgreSQL
  • Node.js version: 14
  • Prisma version: 2.9.0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions