2
0

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:
Jack Christensen
2023-04-20 21:43:59 -05:00
parent a23a423f55
commit 6defa2a607
2 changed files with 25 additions and 1 deletions
+4 -1
View File
@@ -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{