Unable to read <null> decimal with SQLite
See original GitHub issueBug description
Having the following field in a SQLite database:
scheduled_distance NUMERIC (6, 3)
and in schema.prisma:
scheduledDistance Decimal? @map("scheduled_distance")
will give:
Invalid `prisma.race.findMany()` invocation:\n\n\n
Inconsistent column data: Conversion failed: Value NUMERIC(6,3) not supported
in case a record contains a null
value for this column.
So e.g. value 806.982
, 806
works, but null
gives the above error. Note I mean actual null
not a "null"
string.
As it is an optional column null
should be possible.
How to reproduce
See bug description.
Expected behavior
Rows with e.g. null
to be read successfully.
Prisma information
See bug description.
Environment & setup
- OS: Mac OS
- Database: SQLite
- Node.js version: v17.6.0
Prisma Version
3.11.0
Issue Analytics
- State:
- Created a year ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
SQLite not storing decimals correctly - Stack Overflow
there is no other type in SQLite. there is only "Text", "Integer", "Real" and "Blob" also in SQLite it says integer can have...
Read more >Division by decimals wrongly returning a rounded int ... - SQLite
I just had this issue where a division by 2 decimals is rounding some numbers if they don't have a floating point in...
Read more >SQLite Transaction Explained By Practical Examples
Learn how to deal with SQLite transactions by using the BEGIN TRANSACTION, ... CREATE TABLE accounts ( account_no INTEGER NOT NULL, balance DECIMAL...
Read more >Part 4, add a model to an ASP.NET Core MVC app
Use the scaffolding tool to produce Create , Read , Update , and Delete ... You may not be able to enter decimal...
Read more >How to Import a Tab Delimited File with SQLite - Medium
INSERT failed: NOT NULL constraint failed: sales.listid (*columns' names*) ... smallint not null,qtysold smallint not null,pricepaid decimal(8,2),commission ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@janpio good point indeed… I introspected with older version some time ago. So probably good to see if latest version is doing that as well.
But if the database is
scheduled_distance NUMERIC (6, 3)
, which is not actually valid for SQL from what you wrote, why should it introspect this asDecimal?
? Wouldn’t it be better to not introspect that field then?