<FromGitter>
<hfjallemark> Anyone know how to map Postgres numeric types? Getting this error: `PG::ResultSet#read returned a PG::Numeric. A (Float64 | Nil) was expected.` for a field `field origin_x : Float64`
<FromGitter>
<drujensen> what is the type set in the migration?
<FromGitter>
<drujensen> looks like we need to call `to_f64` to get a Float64 back
<FromGitter>
<hfjallemark> The type is: `origin_x NUMERIC (20,10) NULL`
<FromGitter>
<hfjallemark> Right, some conversion needs to happen.. but it looks like it has to be done in Granite because it throws the error before I get a chance to do any conversion.
<FromGitter>
<drujensen> yes, I think we need to look at this closer. The drivers used to only return crystal base types. If they are now returning driver specific types, we will have to have driver specific casting in Granite
<FromGitter>
<drujensen> We have a ticket to support custom types. this probably needs to be something we work on sooner rather than later
<FromGitter>
<drujensen> @Blacksmoke16 oh, so we also need to import BigRational for precision. hhmm
<FromGitter>
<Blacksmoke16> the issue there is the pg adapter shard
<FromGitter>
<Blacksmoke16> thats a similar error to what i was getting when trying to do the UUID support
<FromGitter>
<Blacksmoke16> in that he's declaring his field as `field origin_x : Float64`
<FromGitter>
<Blacksmoke16> but its returning the pg adapter type `PG::Numeric` so he should just have to set his type on his field to `PG::Numeric`
<FromGitter>
<drujensen> does that work?
<FromGitter>
<Blacksmoke16> it should, thats how its represented in the pg shard
<FromGitter>
<eliasjpr> By specifying both, we can do the casting or attempt to do the casting using Crystal type.as(other_type), also it will allow us to create the DB table structure with specific DB types if the user wants more control over that. This is something that I have seen in Hibernate (Java ORM) and many other ORMs