Skip to content

Commit ff9c26d

Browse files
committed
Make OpenDBFromPool docs explicit about closing the *sql.DB
#2295
1 parent 0f77a2d commit ff9c26d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

stdlib/sql.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ func OpenDB(config pgx.ConnConfig, opts ...OptionOpenDB) *sql.DB {
216216

217217
// OpenDBFromPool creates a new *sql.DB from the given *pgxpool.Pool. Note that this method automatically sets the
218218
// maximum number of idle connections in *sql.DB to zero, since they must be managed from the *pgxpool.Pool. This is
219-
// required to avoid acquiring all the connections from the pgxpool and starving any direct users of the pgxpool.
219+
// required to avoid acquiring all the connections from the pgxpool and starving any direct users of the pgxpool. Note
220+
// that closing the returned *sql.DB will not close the *pgxpool.Pool.
220221
func OpenDBFromPool(pool *pgxpool.Pool, opts ...OptionOpenDB) *sql.DB {
221222
c := GetPoolConnector(pool, opts...)
222223
db := sql.OpenDB(c)

0 commit comments

Comments
 (0)