jackc / jackc/pgx

How can we tell if pgx.Rows don't get closed?

Open
#2,058 4 comments 2 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
14.3k
Forks
1.1k
Avg merge
6d 9h
Merged PRs (30d)
11

Description

**Is your feature request related to a problem? Please describe.**
When using db.Query and returning pgx.Rows to other functions it can sometimes get lost and not be closed. The connections eventually pile up and the app stops responding to new requests.

**Describe the solution you'd like**
I don't know if this could be a linting fix potentially, where it could tell that the rows don't get closed, or if there could be some kind of message that there are no connections left available (though that would catch the issue after its already an issue I guess..). Not sure, but would be nice to be able to tell if we are potentially leaking connections.

Contributor guide

Open the contributing guide

Research direction

Start by examining the db.Query entry point and how pgx.Rows are passed to other functions. Clarify whether the project should provide linting or runtime diagnostics, then define the relevant tests and acceptance criteria for detecting an unclosed rows value.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.