You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Negative number cannot be entered as string to Decimal input #5508
I'm trying to create a new record in an SQLite table where one of the fields is of type Decimal. If I pass a negative number as string to create function, I get the following error from Prisma:
Argument initialBalance: Got invalid value '-65.7' on prisma.createOneCashBox. Provided String, expected Decimal.
It works if I pass it the same value as number or Decimal. Positive string values also work without any problems.
How to reproduce
Steps to reproduce the behavior:
Define a table with Decimal field.
Try to pass a negative string value when creating a new record in this table (e.g. -65.7).
So I would assume Prisma should be able to process any numeric value entered as either string, number or Decimal when creating a new record with Decimal field.
Activity
pantharshit00 commentedon Feb 8, 2021
I can confirm this. Looks like a bug in our string casting logic.
fix(client): negative decimal. Closes #5508
Jolg42 commentedon Feb 9, 2021
Thanks a lot for reporting 🙏
This issue is fixed in the latest dev version of
@prisma/client.It will be part of the next
2.17.0release.