-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attempting to serialize BigDecimal::from_str("10000.16")
fails on PG
#1044
Comments
/cc @rubdos |
10 000 is suspicious since pg stores numeric values in base 10k |
When I encountered this issue, the error I got was: error importing: DatabaseError("invalid digit in external "numeric" value") |
The representation I get for |
The fix is relatively trivial. Just improving our test coverage and making sure this doesn't affect numbers after the decimal point as well |
When serializing a numeric column, we need to take a decimal value and convert it to a list of its digits in base 10k. The serialization code had a bug when the first digit was exactly `10000`, resulting in the digits being `[10000, ...]` instead of `[1, 0, ...]`. This bug only affected the integral part, as the decimal portion uses different logic in order ot strip trailing zeroes. Fixes #1044.
When serializing a numeric column, we need to take a decimal value and convert it to a list of its digits in base 10k. The serialization code had a bug when the first digit was exactly `10000`, resulting in the digits being `[10000, ...]` instead of `[1, 0, ...]`. This bug only affected the integral part, as the decimal portion uses different logic in order ot strip trailing zeroes. Fixes #1044.
When serializing a numeric column, we need to take a decimal value and convert it to a list of its digits in base 10k. The serialization code had a bug when the first digit was exactly `10000`, resulting in the digits being `[10000, ...]` instead of `[1, 0, ...]`. This bug only affected the integral part, as the decimal portion uses different logic in order ot strip trailing zeroes. Fixes diesel-rs#1044.
To reproduce:
The text was updated successfully, but these errors were encountered: