Closed wojtekmach closed 5 years ago
So Postgrex returning {:ok, %DBConnection{}, %{command: :commit}}
for begin made me think there's something wrong, but maybe it's a Postgrex bug (that it sets command to commit) or just how it works.
Come to think of it, there's nothing wrong with logging {:ok, %DBConnection{}, result}
as opposed to {:ok, result}
that I was proposing above, and in fact it might be desirable to log the connection we got from the pool. So I think it's fine to keep it as is, but let me know otherwise!
The reason begin has a 3 tuple is that we always log data structures that we create, this was intentionally added to support lower level functions, like begin, commit, rollback. We rolled back the public API but kept logs so they could become public.
Starting from last, for
commit
we have correct log entry:{:ok, %{command: :commit}} = log_entry.result
For first entry, however, we have
{:ok, %DBConnection{}, %{command: :commit}} = log_entry.result
. I'd expect the same shape of result,{:ok, result}
where result corresponds to begin query.This isn't Postgrex specific and I'm seeing the same thing on MyXQL.