add missing pgx pool release for QueryRow

pull/1079/head
Rulin Tang 2021-08-19 23:17:12 +08:00 committed by Jack Christensen
parent 23b4656fc5
commit c9e271df29
1 changed files with 2 additions and 1 deletions

View File

@ -96,7 +96,7 @@ type Config struct {
// AfterConnect is called after a connection is established, but before it is added to the pool.
AfterConnect func(context.Context, *pgx.Conn) error
// BeforeAcquire is called before before a connection is acquired from the pool. It must return true to allow the
// BeforeAcquire is called before a connection is acquired from the pool. It must return true to allow the
// acquision or false to indicate that the connection should be destroyed and a different connection should be
// acquired.
BeforeAcquire func(context.Context, *pgx.Conn) bool
@ -458,6 +458,7 @@ func (p *Pool) QueryRow(ctx context.Context, sql string, args ...interface{}) pg
if err != nil {
return errRow{err: err}
}
defer c.Release()
row := c.QueryRow(ctx, sql, args...)
return c.getPoolRow(row)