jackc / pgx

PostgreSQL driver and toolkit for Go
MIT License
10.83k stars 845 forks source link

rows.Close() is not required #2170

Open gromas opened 1 day ago

gromas commented 1 day ago

https://github.com/jackc/pgx/blob/b9e2b20fb13a7eb8e6bf105c074c291b349b6dec/rows.go#L471

rows.Close() is not required while we have defer rows.Close() above

felix-roehrich commented 22 hours ago

rows.Close() may change the result of rows.Err() so this is not equivalent, rather with this an error may go unnoticed.