Respect the DecodeOpts inside a transaction#74
Conversation
|
FYI: I force pushed to add a test |
lpil
left a comment
There was a problem hiding this comment.
Thank you! Left some notes inline, and if you could update the changelog also that would be fab!
| Res = case Pool of | ||
| {single_connection, Conn} -> | ||
| pgo_handler:extended_query(Conn, Sql, Arguments, #{}); | ||
| DecodeOpts = element(11, Conn), |
There was a problem hiding this comment.
I think this is a conn as defined in pgo_internal. Perhaps we could use the record field access syntax by importing that header file (which would be the less fragile way to do this rather than use tuple indexing). That said, I think this module is not part of PGO's public API, so I don't know if we can use it.
@tsloughter Do you have any guidance here?
Looking at the definition of extended_query/5 it's not clear to me why it takes the decode options twice, once in the conn and once as the 4th argument. Is there a way to either get the function to use the decode options from the conn, or for our code to get the decode options out of the conn?
| assert returned.rows == ["neo"] | ||
|
|
||
| Ok(returned) | ||
| }) |
There was a problem hiding this comment.
Split this into a new test please, and add a comment explaining what is being tested
The decode options were not passed through to the
pgo_handler:extended_querycall, which cause queries done inside a transaction or the transaction call itself not to respect therows_as_mapssetting.I have 0 experience in Erlang and don't know how to do this. Please feel free to correct me if I'm doing something silly.
Basically trying to pass down the
DecodeOptsfrom theConndown to theextended_querycall.fixes #69