You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pgx apparently closes rows when all rows are read and I guess because of this defer seems not needed. But this shouldn't be the case since function might stop before iterating all the rows. Is this a bug or feature?
// Next prepares the next row for reading. It returns true if there is another
// row and false if no more rows are available. It automatically closes rows
// when all rows are read.
Next() bool
Code below does not give any errs
varpgxPool*pgxpool.PoolfuncmissingClosePgxPool() {
rows, err:=pgxPool.Query(context.Background(), "SELECT username FROM users") // want "Rows/Stmt/NamedStmt was not closed"iferr!=nil {
log.Fatal(err)
}
forrows.Next() {
}
}
The text was updated successfully, but these errors were encountered:
Pgx apparently closes rows when all rows are read and I guess because of this defer seems not needed. But this shouldn't be the case since function might stop before iterating all the rows. Is this a bug or feature?
Code below does not give any errs
The text was updated successfully, but these errors were encountered: