-
-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sum on Int
property returns error
#92
Comments
This seems like a bug in https://github.com/vapor/postgresql. (Looking into it)
This is a Fluent thing. You should check that the query count returns > 0 before trying to run aggregates. |
I suspect vapor/postgres-kit#102 will fix, but won't be able to test for a bit. You can try by doing:
|
Just tested, and that PR indeed solves the issue! Thanks Tanner. |
Fixed in PostgreSQL 1.0.2 |
Assuming I have the following model that conforms to
PostgreSQLStringModel
:Calling:
return Transaction.query(on: req).sum(\.amount)
Gives the following error:
Could not decode Int: 0x0001000000000000000e (NUMERIC).
I'm doing something wrong? The
.sum
method should return the sum for all the properties on that column, correct? Btw, the error when the table was empty was different than the error when the table had some records in it.The text was updated successfully, but these errors were encountered: