Skip to content

Commit

Permalink
fix(pkg/pgsql/server): close row readers to release resources
Browse files Browse the repository at this point in the history
Signed-off-by: Stefano Scafiti <[email protected]>
  • Loading branch information
ostafen committed Aug 7, 2024
1 parent 76cd08a commit 8b5f651
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/pgsql/server/query_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ func (s *session) query(st *sql.SelectStmt, parameters []*schema.NamedParam, res
if err != nil {
return err
}
defer reader.Close()

cols, err := reader.Columns(s.ctx)
if err != nil {
Expand Down Expand Up @@ -372,10 +373,13 @@ func (s *session) inferParamAndResultCols(stmt sql.SQLStmt) ([]sql.ColDescriptor
if err != nil {
return nil, nil, err
}

resCols, err = rr.Columns(s.ctx)
if err != nil {
return nil, nil, err
}

rr.Close()
}

r, err := s.db.InferParametersPrepared(s.ctx, s.tx, stmt)
Expand Down

0 comments on commit 8b5f651

Please sign in to comment.