-
-
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
Return Error From Postgres Float Deserialization #3944
Conversation
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.
Thanks for opening this PR 👍. Overall I'm happy with the suggestion to return a more useful error in this situation. I've made some suggestions how we could improve this in a more general way. With these suggestions applied + a test case for the new error I would be happy to merge this.
It would be great if that could also adjust the code in these impl: https://github.com/diesel-rs/diesel/blob/bc263afa1765f650d9c4bf36c40536ff95b9cade/diesel/src/pg/types/integers.rs#L45-L63 ( (although that's not necessary for merging this PR)
There is a bit more discussion on this topic in #3868
Converted the code to a specific error message as you requested - had to do some weird stuff to coerce the compiler to build correctly with OK(...?) (the compiler suggested it). |
If the change is ok I can look into writing a test case. |
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.
Thanks for updating the code. I've noticed an issue that I missed while proposing this solution. I've left a comment how to fix that. Otherwise this approach looks good now.
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.
In terms of changes this looks fine now, so good work 👍
I would like to have a test for this before merging (put it into diesel_tests
, should create a table, and query as the wrong type + check for this error) + this likely requires an entry in the changelog (See the Changelog.md
file for this).
7d66f66
to
ee46bed
Compare
Hi - sorry I haven't had a chance to work on this further. I saw that you have continued this on so thanks for that. I have been very busy at work and was unable to work on writing tests. |
Bencher
Bencher - Continuous Benchmarking View Public Perf Page Docs | Repo | Chat | Help |
Bencher
Bencher - Continuous Benchmarking View Public Perf Page Docs | Repo | Chat | Help |
Bencher
Bencher - Continuous Benchmarking View Public Perf Page Docs | Repo | Chat | Help |
No worries about that. It's great that submitted that PR at all. |
To just leave a comment here: I've found a performance regression in this commit regarding to certain benchmarks while running it locally. I'm currently investigating options to workaround this regression. |
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 :)
I'd benefit from this this soon as well as I will run another round of schema Int4 -> Int8 migration and I wouldn't want #3868 to occur again - any way I can help with the benchmark regression thing?
Bencher
Click to view all benchmark results
Bencher - Continuous Benchmarking View Public Perf Page Docs | Repo | Chat | Help |
Bencher
Click to view all benchmark results
Bencher - Continuous Benchmarking View Public Perf Page Docs | Repo | Chat | Help |
Bencher
Click to view all benchmark results
Bencher - Continuous Benchmarking View Public Perf Page Docs | Repo | Chat | Help |
@Ten0 I've pushed my local experimentation here: weiznich@5ef08d9 As far as I remember there was a ~5% instruction count regression for queryable_by_name queries on postgres. Some of the added attributes makes things slightly better. It likely just needs another round of local benchmarking to validate the results, I just run out of time back then and forgot about it. |
Thanks! 😊 (Also if you have a quick recommendation on a good tool to look at the generated assembly that would be great, otherwise I'll find a way for this.) |
You should be able to run the benchmarks via There is also a "fast_run" feature that disables some of the benchmarks. Criterion also allows to store and use explicit baselines, which is useful for comparing to a specific version. |
…rror non_exhaustive
* Add tests * Add changelog entry * Adjust impls for integers as well
68c0e8f
to
255c256
Compare
I've done some more benchmarks locally and I'm now quite certain that the regression in instruction count does not make the code measurably slower. At least |
* Mark the error branches as cold to help the compiler optimising for the other case * Mark some functions as inline Both changes have been benchmarked and have shown minor performance improvements
255c256
to
c19ace7
Compare
I had an error where I was getting the debug assertion panic on a table and I had no idea what field was causing the issue. Here's a modification I made to ensure that any deserialization errors get passed up the chain with the field name without panicking in order to properly diagnose where my issue is happening.
I don't know if his is wanted or not, but thought I'd make the PR in case it is. Happy to do more modifications if necessary.