From e096a14b3e85dee0c53c4cf5077289b0619c0796 Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Sat, 12 May 2018 10:33:08 -0500 Subject: [PATCH] Return proper error in Tx.CopyFrom when tx has failed --- tx.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tx.go b/tx.go index 092e62c8..a1e67766 100644 --- a/tx.go +++ b/tx.go @@ -241,6 +241,9 @@ func (tx *Tx) QueryRowEx(ctx context.Context, sql string, options *QueryExOption // CopyFrom delegates to the underlying *Conn func (tx *Tx) CopyFrom(tableName Identifier, columnNames []string, rowSrc CopyFromSource) (int, error) { + if tx.Status() == TxStatusInFailure { + return 0, ErrTxInFailure + } if tx.Status() != TxStatusInProgress { return 0, ErrTxClosed }