Skip to content
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

query.sum() doesn't work #56

Closed
MihaelIsaev opened this issue May 8, 2018 · 1 comment
Closed

query.sum() doesn't work #56

MihaelIsaev opened this issue May 8, 2018 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@MihaelIsaev
Copy link
Member

I already described that in vapor/fluent-postgres-driver#50

It throws error

[ ERROR ] PostgreSQLError.binaryFloatingPoint: Could not decode Double from binary data type: NUMERIC.

doesn't matter which column type set in the database, I tried with bigint and double precision

@tanner0101 tanner0101 added this to the 1.0.0 milestone Jun 2, 2018
@tanner0101 tanner0101 added the enhancement New feature or request label Jun 2, 2018
@tanner0101 tanner0101 self-assigned this Jun 2, 2018
@tanner0101
Copy link
Member

Fixed and added a test in #72. Thanks for reporting!

let conn = try PostgreSQLConnection.makeTest(transport: .cleartext)
struct Sum: Decodable {
    var sum: Double
}
let rows = try conn.query("SELECT SUM(3.14) as sum", decoding: Sum.self).wait()
switch rows.count {
case 1:
    XCTAssertEqual(rows[0].sum, 3.14)
default: XCTFail("invalid row count")
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants