Closed natanrolnik closed 6 years ago
Could not decode Int: 0x0001000000000000000e (NUMERIC).
This seems like a bug in https://github.com/vapor/postgresql. (Looking into it)
Btw, the error when the table was empty was different than the error when the table had some records in it.
This is a Fluent thing. You should check that the query count returns > 0 before trying to run aggregates.
I suspect https://github.com/vapor/postgresql/pull/102 will fix, but won't be able to test for a bit. You can try by doing:
swift package edit PostgreSQL --revision numeric-int
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.