-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Error if prepared statement name isn't unique #1813
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
Comments
I think it does! |
(Note: |
Hi, we have a logging system in our microservices infrastructure that passes request unique id through services and also to postgresql queries. For that we add a /* cid: ${request_id} */ in the query. This "fix" breaks this possibility. Any advice? |
@schrizsz That wouldn’t have worked before this fix either. This fix just makes it apparent. If you want to continue using named prepared statements but also delete them for new requests, you have to associate a client with a request, run Maybe setting the application name would work better if you were intending to go that far? |
This is more an admission of incompetence on my part than anything, but on a number of occasions I've copy-pasted a query like this...
...and tweaked the query but forgotten to change the name:
Typically, this results in subtle errors, by returning plausible but incorrect data.
I wonder if
pg
could help here by storing thetext
of a query that specifies aname
, and erroring if it encounters another query with the same name but different text? Arguably not the library's job, but if my experience is anything to go by it could save a few developers from tearing their hair out, and deepen their gratitude towards this wonderful project.Does that seem like a worthwhile addition? If so I'd be glad to try and rustle up a PR. Thank you!
The text was updated successfully, but these errors were encountered: