-
Notifications
You must be signed in to change notification settings - Fork 222
Support unnamed prepared statements #635
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
Hm, this breaks the ruby prepared statement tests - missed that locally 🤦 |
1fe6f24
to
c3a1ce5
Compare
Hi @levkk, What's the procedure to update the pgcat-ci container image? I would like to install golang to run the golang test-suite in this PR to validate prepared statements work with the golang pg driver 🙏 Should I make a separate PR for updating the docker files? |
Hello. I think you can just install golang in CI, we use Circle. If needed, you could also make a separate PR. |
Yeah, just seems like circle pulls Thanks! |
Thank you for the merge of golang in pgcat-ci, @levkk - Looks like the tests are passing now. Let me know what you think of this PR, and whether there is anything I'm overlooking. I've deployed a build of this branch on our internal test setup and our queries are now going through. |
Looks great, thank you! |
Want to call out the pgbouncer currently doesn't support caching unnamed statements like this so thank you for adding that! |
I think we will want to put this feature behind a config. Unnamed prepared statements are used by many clients to send regular (unprepared) queries to the database. They are typically sent in one burst of Also, it will introduce unexpected new behavior, as we will now be using caching query plans for unnamed prepared statements and that may have negative performance consequences (unlikely but possible due to suboptimal cached plans) |
This PR fixes a minor issue we've encountered when using the standard golang postgres driver. It uses unnamed prepared statements to do one-off parameterized queries via QueryContext - these are often failing with
could not query: pq: unnamed prepared statement does not exist
errors.The current logic effectively results in unnamed prepared statements being 'disabled' - they do not get cached and pre-prepared on bind and therefore fail if PARSE and BIND are distributed across two different servers.
PR includes;