mirror of
https://github.com/jackc/pgx.git
synced 2025-05-31 11:42:24 +00:00
bail early if preloading rows.Next() results in rows.Err()
This commit is contained in:
parent
576f99a35e
commit
e75d315079
@ -304,6 +304,10 @@ func (c *Conn) QueryContext(ctx context.Context, query string, argsV []driver.Na
|
||||
|
||||
// Preload first row because otherwise we won't know what columns are available when database/sql asks.
|
||||
more := rows.Next()
|
||||
if err = rows.Err(); err != nil {
|
||||
rows.Close()
|
||||
return nil, err
|
||||
}
|
||||
return &Rows{conn: c, rows: rows, skipNext: true, skipNextMore: more}, nil
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user