aggregate query returns SUM as strings instead of integers
See original GitHub issueI dont know if it is normal, or if there is something I am doing wrong, but the sums returned by my query below are in strings even if the datatype of nbrEleves field is integer. Why? The query is run against a postgres database.
Point.aggregate('nbrEleves', 'SUM', {plain: false, where: {codecs: codecs}, order: '"codeSecteur" ASC', group:["codeSecteur", "codeWork"], attributes:['codeSecteur', 'codeWork']})
Issue Analytics
- State:
- Created 8 years ago
- Reactions:2
- Comments:12 (4 by maintainers)
Top Results From Across the Web
Why SUM(`column`) returns a string instead of an integer?
It's neither Laravel or PDO issue. According to MySQL manual, SUM() returns a DECIMAL value for exact-value arguments ( integer or DECIMAL )....
Read more >$sum (aggregation) — MongoDB Manual
Calculates and returns the collective sum of numeric values. $sum ignores non-numeric values. $sum is available in these stages:.
Read more >Documentation: 9.2: Aggregate Functions
In particular, sum of no rows returns null, not zero as one might expect, and array_agg returns null rather than an empty array...
Read more >Using cast inside sum or outside ? - Microsoft Q&A
In my opinion, if you have 1000 numbers, for example, then it is better to have a single cast instead of 1000 casts....
Read more >Aggregate Functions
An aggregate function always returns exactly one row, even when the input contains zero rows. Typically, if the input contained zero rows, the...
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

@janmeier Thank you. I tried it like this but it did not work (my
instance.update({bigint: value})and myraw queriesare still returning strings):Any Ideas?
Still having the same issue on sequelize version “5.22.4”