Sequelize sum function always rounding to 4 decimal point
See original GitHub issueIssue Description
like the title. I’m using DataTypes.DECIMAL(36, 18),
as the dataType
What was unclear/insufficient/not covered in the documentation
I could find any documentation why sum function always rounding to 4 decimal point.
If possible: Provide some suggestion on how we can enhance the docs
Additional context
Add any other context or screenshots about the issue here.
Issue Template Checklist
Is this issue dialect-specific?
- I don’t know.
Would you be willing to resolve this issue by submitting a Pull Request?
- No, I don’t have the time and I wouldn’t even know how to start.
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Sequelize sum function always rounding to 4 decimal point
I'm using sequelize v5 and I found that my sum function always return with 4 decimal point, even with manual query (using mysql...
Read more >Avoid rounding off decimal data, when using SUM function
4 Answers ... The SUM function don't round the result. The data type float is an approximate one and calculation can result in...
Read more >Sequelize Aggregate Functions (MIN, MAX, SUM, COUNT, etc ...
In this tutorial, I'm going to give some examples of how to use aggregate functions with Sequelize.js. Database Models and Assocations. For this ......
Read more >Datatypes - Manual | Sequelize
GEOMETRY('POINT', 4326) // Spatial column with geometry type and SRID. PostgreSQL (with PostGIS) or MySQL only. The BLOB datatype allows you to insert...
Read more >Data Types - Sequelize
Below is a series of support table describing which SQL Type is used for each Sequelize DataType. info. Most of our DataTypes also...
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 Free
Top 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
You can use like this [sequelize.fn(‘ROUND’, sequelize.fn(‘SUM’, sequelize.col(‘col’)),2), ‘col’] col: is table column name 2: after decimal how much precision you need
Allowing Sequelize to see the dataType of the column and using that in the SUM would be great and sounds like a valid feature request to me. I think it would be nice if you could make a new feature request for that here
Since it’s currently documented that the default fallback is a float and that there is a valid workaround I will close this issue.