You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Natural values don't fit into an sql database #1031
This fails to round-trip for naturals bigger than a Word64.
I would argue that this instance should be removed.
If you don't need naturals that big, then just use the Word64 instance instead.
If you do, then you expect them to roundtrip.
Good catch, thanks! Removing the instance seems right, given that we don't provide an instance for Integer and there doesn't appear to be a truly unbounded number type. MySQL supports 65 digits in numeric, and Postgres supports 1000 digits, which are both huge but not infinite.
sqlType _ =SqlNumeric3220-- need to make this field big enough to handle Rational to Mumber string conversion for ODBC
but there are lots of rational numbers which can't be represented exactly this way. In particular, anything with more than 20 decimal places, anything with more than 32 significant figures, and also any fraction with a denominator which has prime factors other than 2 or 5 (such as 1/3).
Activity
parsonsmatt commentedon Feb 10, 2020
Good catch, thanks! Removing the instance seems right, given that we don't provide an instance for
Integerand there doesn't appear to be a truly unbounded number type. MySQL supports 65 digits innumeric, and Postgres supports 1000 digits, which are both huge but not infinite.hdgarrood commentedon Feb 18, 2020
I think by this argument the
Rationalinstances should be considered for removal, too? CurrentlyRationalis represented asnumeric(32,20):persistent/persistent/Database/Persist/Sql/Class.hs
Lines 490 to 491 in 6d134f7
but there are lots of rational numbers which can't be represented exactly this way. In particular, anything with more than 20 decimal places, anything with more than 32 significant figures, and also any fraction with a denominator which has prime factors other than 2 or 5 (such as 1/3).
NorfairKing commentedon Feb 18, 2020
Yes, please remove them too!
NorfairKing commentedon Feb 18, 2020
You could still have
Ratio Int32maybe..