-
-
Notifications
You must be signed in to change notification settings - Fork 90
Add proper support for Decimal
#194
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
Conversation
|
Hi @madsodgaard, generally I'm open to accept this change. However there are a number of things that I would like to see, if we want to continue:
I'm happy to help at every step of the way, if you need help :) |
|
@fabianfett I have added conformance to |
fabianfett
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Generally we should probably rework PostgresNumeric in the future... But let's ask @gwynne for a review as well!
PostgresNumeric for DecimalDecimal
gwynne
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned about the change in the public API behavior - will this break code at runtime for people who are currently storing Decimals in TEXT columns? Can we add a test or two which explicitly demonstrates this scenario, for both reading (select) and writing (insert/update)? (Ideally we'd have the test both here at the raw Postgres level operating directly on these API and also in FluentBenchmarker ensuring the behavior is stable for the common usage.)
|
@gwynne It should not. I added a integration test to this library for testing string serialization. |
Codecov Report
@@ Coverage Diff @@
## main #194 +/- ##
==========================================
+ Coverage 36.13% 42.21% +6.08%
==========================================
Files 115 116 +1
Lines 7788 7826 +38
==========================================
+ Hits 2814 3304 +490
+ Misses 4974 4522 -452
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
gwynne
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'm sufficiently satisfied that this is backwards-compatible - I'm not 100%, but I'm mindful of being a bit paranoid, and given that text-column round-tripping still works, I can't think of any actual objection that warrants holding back this long-overdue missing functionality 🙂
|
Merging as semver-minor - though there are no new public APIs, just in case my paranoia isn't completely pointless it gives just a tiny bit of extra wiggle room 🤷♀️ |
|
Thanks again for the excellent work on this, @madsodgaard! |
|
These changes are now available in 1.7.0 |
Fixes an issue when trying to decode/encode
numericcolumns asDecimal, that would result in an error such as:server: column "balance" is of type numeric but expression is of type text (transformAssignedExpr).