From c8a9da960c019e809ab07f5b44d44dffa73bb2d3 Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Mon, 13 Jul 2020 22:48:28 -0500 Subject: [PATCH] Revert "stdlib: close connection on Tx commit or rollback that doesn't end Tx" This reverts commit 2583134306da7d77427188acc1163aa636e28904. This fix should actually be on the main Tx implementation. --- stdlib/sql.go | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/stdlib/sql.go b/stdlib/sql.go index 119ce00c..a45750ac 100644 --- a/stdlib/sql.go +++ b/stdlib/sql.go @@ -716,23 +716,9 @@ type wrapTx struct { tx pgx.Tx } -func (wtx wrapTx) Commit() error { - pgxConn := wtx.tx.Conn() - err := wtx.tx.Commit(wtx.ctx) - if err != nil && pgxConn.PgConn().TxStatus() != 'I' { - _ = pgxConn.Close(wtx.ctx) // already have error to return - } - return err -} +func (wtx wrapTx) Commit() error { return wtx.tx.Commit(wtx.ctx) } -func (wtx wrapTx) Rollback() error { - pgxConn := wtx.tx.Conn() - err := wtx.tx.Rollback(wtx.ctx) - if err != nil && pgxConn.PgConn().TxStatus() != 'I' { - _ = pgxConn.Close(wtx.ctx) // already have error to return - } - return err -} +func (wtx wrapTx) Rollback() error { return wtx.tx.Rollback(wtx.ctx) } type fakeTx struct{}