Skip to content

Commit

Permalink
Fix *dbTx.Exec not checking if it is already closed
Browse files Browse the repository at this point in the history
  • Loading branch information
jackc committed Feb 24, 2024
1 parent 1d07b8b commit 7d882f9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ func (tx *dbTx) Rollback(ctx context.Context) error {

// Exec delegates to the underlying *Conn
func (tx *dbTx) Exec(ctx context.Context, sql string, arguments ...interface{}) (commandTag pgconn.CommandTag, err error) {
if tx.closed {
return pgconn.CommandTag{}, ErrTxClosed
}

return tx.conn.Exec(ctx, sql, arguments...)
}

Expand Down

0 comments on commit 7d882f9

Please sign in to comment.