-
Notifications
You must be signed in to change notification settings - Fork 853
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
feat: add prefer execParams option #1172
base: master
Are you sure you want to change the base?
Conversation
Adds an option to skip the DescribeStatement step when the statement cache has been disabled. This reduces the number of round trips to the server by one.
This feature is more subtle than it at first appears. I have recent knowledge of this because I have added this execution mode to pgx v5 a few weeks ago. In short, the binary format cannot be used without perfect knowledge of the parameter OIDs. Otherwise there can be data corruption with certain types such as Go |
@jackc Thanks for looking into this. I did not know that there was already an implementation for it in v5. That is interesting. The point regarding the date/timestamp parameters is a good one. I should have checked that. I kind of assumed that date and timestamp would be sent using the text format by default. A couple of questions regarding this:
And would you be open to an implementation in 4.x that takes the ambiguity of |
Yes, it always uses the text format. I am not confident in being able to safely determine that a type is unambiguous. I did not anticipate the problems with date / timestamp until a test detected the data corruption and I suspect there are more subtle pitfalls that would slip through. For example, it would seem that Go Maybe that particular case is solvable, maybe not. But I'd rather error on the side of caution when the potential errors can lead to silent data corruption. |
Adds an option to skip the DescribeStatement step when the statement cache has been disabled. This reduces the number of round trips to the server by one. Instead the driver will do:
The option has been enabled by default in this PR to verify that all tests succeed when this option is enabled. This should probably be changed to default off before merging to prevent an unexpected change in behavior.