mirror of https://github.com/jackc/pgx.git
parent
c8a9da960c
commit
9b480f4785
3
tx.go
3
tx.go
|
@ -157,6 +157,9 @@ func (tx *dbTx) Commit(ctx context.Context) error {
|
|||
commandTag, err := tx.conn.Exec(ctx, "commit")
|
||||
tx.closed = true
|
||||
if err != nil {
|
||||
if tx.conn.PgConn().TxStatus() != 'I' {
|
||||
_ = tx.conn.Close(ctx) // already have error to return
|
||||
}
|
||||
return err
|
||||
}
|
||||
if string(commandTag) == "ROLLBACK" {
|
||||
|
|
Loading…
Reference in New Issue