[Haskell-cafe] How to store Fixed data type in the database with persistent ?

s9gf4ult at gmail.com s9gf4ult at gmail.com
Sat Jan 26 07:21:02 CET 2013


> According to the documentation, SQLite stores whatever you give it,
> paying very little heed to the declared type.  If you get SQLite to
> *compare* two numbers, it will at that point *convert* them to doubles
> in order to carry out the comparison.  This is quite separate from the
> question of what it can store.

CREATE TABLE t1(val);
sqlite> insert into t1 values ('24.24242424')
   ...> ;
sqlite> insert into t1 values ('24.24242423')
   ...> ;
sqlite> select * from t1 order by val;
24.24242423
24.24242424
sqlite> select * from t1 order by val desc;
24.24242424
24.24242423
sqlite> select sum(val) from t1;
48.48484847

it seems Sqlite can work with arbitrary percission data, very good ! 
Persistent must have ability to store Fixed.



More information about the Haskell-Cafe mailing list