-
Notifications
You must be signed in to change notification settings - Fork 110
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
Numeric type is broken for small negative values #210
Comments
Thanks for the fix! pggen still uses v4 and string conversion was needed for using numerics in composite types due to a pggen bug jschaf/pggen#102 |
In an ironic turn of fate (as the pggen author), I had to skip pgtype v1.14.1 which includes fdca434. Upgrading pgtype to v1.14.1 caused one of our tests to fail. A Postgres numeric value of 50 was decoded into a float64 as 5. Interestingly, it only broke a few tests so it's probably subtle. I'll try to reproduce to see if it's something we're doing or something in pgtype. |
@jackc This looks like a pretty bad bug. I think pgtype.Numeric to float64 conversion is wrong for all values with an exponent of 1 divisible by 10, meaning |
Thanks @jschaf. Fix is merged and new release |
pgtype.Numeric
does not work correctly for small negative values, e.g.-0.000123
Results in:
0.00-123
instead of-0.000123
The text was updated successfully, but these errors were encountered: