bitemyapp / bitemyapp/esqueleto
sum_ causes a runtime type error
- Dominant language
- Haskell
- Stars
- 399
- Forks
- 107
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 1
Description
Original issue filed here: https://github.com/prowdsponsor/esqueleto/issues/148
Updated repro here: https://github.com/jkachmar/esqueleto-sum-err
Error message:
```
Migrating: CREATe TABLE "number"("id" SERIAL8 PRIMARY KEY UNIQUE,"value" INT8 NOT NULL)
[Debug#SQL] CREATe TABLE "number"("id" SERIAL8 PRIMARY KEY UNIQUE,"value" INT8 NOT NULL); []
[Debug#SQL] INSERT INTO "number"("value") VALUES(?) RETURNING "id"; [PersistInt64 5]
[Debug#SQL] INSERT INTO "number"("value") VALUES(?) RETURNING "id"; [PersistInt64 22]
[Debug#SQL] SELECT SUM("number"."value")
FROM "number"
; []
esqueleto-sum-err: PersistMarshalError "int Expected Integer, received: PersistRational (27 % 1)"
make: *** [test] Error 1
```
Copying the original issue text:
> sum_'s type is (PersistField a, PersistField b) => expr (Value a) -> expr (Value (Maybe b)). But sum of course cannot return any type. In Postgres, it returns numeric for bigints, which is represented as PersistRational.
This seems like a good candidate for #50
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.