2
0

Fix pipeline batch results not closing pipeline

when error occurs while reading directly from results instead of using
a callback.

https://github.com/jackc/pgx/issues/1578
This commit is contained in:
Jack Christensen
2023-04-20 20:58:04 -05:00
parent 67f2a41587
commit 09371981f9
3 changed files with 33 additions and 15 deletions
+2 -6
View File
@@ -381,17 +381,13 @@ func (br *pipelineBatchResults) Close() error {
}
}()
if br.err != nil {
return br.err
}
if br.lastRows != nil && br.lastRows.err != nil {
if br.err == nil && br.lastRows != nil && br.lastRows.err != nil {
br.err = br.lastRows.err
return br.err
}
if br.closed {
return nil
return br.err
}
// Read and run fn for all remaining items