-
Notifications
You must be signed in to change notification settings - Fork 272
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: commit_comment
option for prepending a SQL comment to a COMMIT
statement
#669
feat: commit_comment
option for prepending a SQL comment to a COMMIT
statement
#669
Conversation
Thank you. I have some questions:
|
I think we should go with |
@josevalim I just pushed updates to add docs + validate against SQL injection. For testing the validation flow, should that live in |
SOunds good yeah |
Alright @josevalim just pushed up a unit test. I think this is ready for another review. |
Should this be named differently? |
lib/postgrex/protocol.ex
Outdated
@@ -537,16 +540,19 @@ defmodule Postgrex.Protocol do | |||
{:ok, Postgrex.Result.t(), state} | |||
| {DBConnection.status(), state} | |||
| {:disconnect, %RuntimeError{}, state} | |||
| {:disconnect, %DBConnection.ConnectionError{} | Postgrex.Error.t(), state} | |||
| {:disconnect, | |||
%DBConnection.ConnectionError{} | Postgrex.Error.t() | Postgrex.QueryError.t(), |
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.
Let's return Postgrex.Error. It is not worth introducing a new exception type only for this case. WDYT? :)
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.
Fine with me!
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.
We can also return a RuntimeError if you prefer.
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.
Went with Postgrex.Error in af319f9
Co-authored-by: José Valim <jose.valim@gmail.com>
💚 💙 💜 💛 ❤️ |
We're using this option at @knocklabs to inject comments for all transactions executed via the
Ecto.Repo.transaction/2
callback, which is gives us more granular insight into transaction performance in our RDS performance insights dashboard. We'd like to upstream it!I wasn't sure where to add unit test coverage for this, if anywhere. Nor was I sure how I should try to sanitize the input, if at all.
More context in the ecto-elixir Google Group discussion here: https://groups.google.com/g/elixir-ecto/c/vUImb5ZX_CI