yesodweb/persistent — Issue #56: No PersistValue-constructor for exact numerics
Author: hreinhardt
Created: 2012-02-11 11:39:59+00:00
State: open

I'm trying to run the following raw query with persistent-postgresql:
```
select avg(score) from votes
```

But it fails with:
```
Incompatible {errSQLType = "numeric", errHaskellType = "Int64", errMessage = "types incompatible"}
```

The problem is that avg(score) has a return type of *numeric*, but Persistent tries to convert it to a PersistInt64.
The postgresql-simple library will only allow a conversion of *numeric* to *(Ratio Integer)*, so it throws an exception.

I think the best solution would be to add a new constructor to PersistValue that can store a *(Ratio Integer)*.