{"action":"created","issue":{"url":"https://api.github.com/repos/jackc/pgx/issues/421","repository_url":"https://api.github.com/repos/jackc/pgx","labels_url":"https://api.github.com/repos/jackc/pgx/issues/421/labels{/name}","comments_url":"https://api.github.com/repos/jackc/pgx/issues/421/comments","events_url":"https://api.github.com/repos/jackc/pgx/issues/421/events","html_url":"https://github.com/jackc/pgx/issues/421","id":322506710,"number":421,"title":"Expose connection transaction state","user":{"login":"erikgrinaker","id":644420,"avatar_url":"https://avatars2.githubusercontent.com/u/644420?v=4","gravatar_id":"","url":"https://api.github.com/users/erikgrinaker","html_url":"https://github.com/erikgrinaker","followers_url":"https://api.github.com/users/erikgrinaker/followers","following_url":"https://api.github.com/users/erikgrinaker/following{/other_user}","gists_url":"https://api.github.com/users/erikgrinaker/gists{/gist_id}","starred_url":"https://api.github.com/users/erikgrinaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erikgrinaker/subscriptions","organizations_url":"https://api.github.com/users/erikgrinaker/orgs","repos_url":"https://api.github.com/users/erikgrinaker/repos","events_url":"https://api.github.com/users/erikgrinaker/events{/privacy}","received_events_url":"https://api.github.com/users/erikgrinaker/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-12T12:14:49Z","updated_at":"2018-05-12T13:53:07Z","closed_at":null,"author_association":"NONE","body":"It would be useful to know the state of the current transaction, e.g. if it is aborted due to a previous error.\r\n\r\nAs far as I can tell, this state is already tracked in `Conn.txStatus`, but not available through a public interface. If possible, it would be great to have this exposed through the relevant `Tx`, although a method on the `Conn` struct would be fine as well."},"comment":{"url":"https://api.github.com/repos/jackc/pgx/issues/comments/388556793","html_url":"https://github.com/jackc/pgx/issues/421#issuecomment-388556793","issue_url":"https://api.github.com/repos/jackc/pgx/issues/421","id":388556793,"user":{"login":"erikgrinaker","id":644420,"avatar_url":"https://avatars2.githubusercontent.com/u/644420?v=4","gravatar_id":"","url":"https://api.github.com/users/erikgrinaker","html_url":"https://github.com/erikgrinaker","followers_url":"https://api.github.com/users/erikgrinaker/followers","following_url":"https://api.github.com/users/erikgrinaker/following{/other_user}","gists_url":"https://api.github.com/users/erikgrinaker/gists{/gist_id}","starred_url":"https://api.github.com/users/erikgrinaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erikgrinaker/subscriptions","organizations_url":"https://api.github.com/users/erikgrinaker/orgs","repos_url":"https://api.github.com/users/erikgrinaker/repos","events_url":"https://api.github.com/users/erikgrinaker/events{/privacy}","received_events_url":"https://api.github.com/users/erikgrinaker/received_events","type":"User","site_admin":false},"created_at":"2018-05-12T13:53:07Z","updated_at":"2018-05-12T13:53:07Z","author_association":"NONE","body":"I'm afraid not, it returns `TxStatusInProgress` when the transaction is aborted due to error. It looks like it only takes into account the final commit/rollback state, not the preceeding states such as those returned by `PQtransactionStatus`:\r\n\r\n> The status can be PQTRANS_IDLE (currently idle), PQTRANS_ACTIVE (a command is in progress), PQTRANS_INTRANS (idle, in a valid transaction block), or PQTRANS_INERROR (idle, in a failed transaction block). PQTRANS_UNKNOWN is reported if the connection is bad. PQTRANS_ACTIVE is reported only when a query has been sent to the server and not yet completed."}}
{"actor":{"display_login":"erikgrinaker"}}