Fix error when using BatchResults.Exec
...on a select that returns an error after some rows. This was initially found in by a failure with CockroachDB because it seems to send a RowDescription before an error even when no rows are returned. PostgreSQL doesn't.
This commit is contained in:
@@ -139,7 +139,10 @@ func (br *batchResults) Exec() (pgconn.CommandTag, error) {
|
||||
}
|
||||
|
||||
commandTag, err := br.mrr.ResultReader().Close()
|
||||
br.err = err
|
||||
if err != nil {
|
||||
br.err = err
|
||||
br.mrr.Close()
|
||||
}
|
||||
|
||||
if br.conn.batchTracer != nil {
|
||||
br.conn.batchTracer.TraceBatchQuery(br.ctx, br.conn, TraceBatchQueryData{
|
||||
|
||||
Reference in New Issue
Block a user