Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pgxpool/errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package pgxpool

import "errors"

var ErrInfiniteAcquireLoop = errors.New("pgxpool: detected infinite loop acquiring connection; likely bug in PrepareConn or BeforeAcquire hook")
3 changes: 1 addition & 2 deletions pgxpool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package pgxpool

import (
"context"
"errors"
"math/rand/v2"
"runtime"
"strconv"
Expand Down Expand Up @@ -652,7 +651,7 @@ func (p *Pool) Acquire(ctx context.Context) (c *Conn, err error) {

return cr.getConn(p, res), nil
}
return nil, errors.New("pgxpool: detected infinite loop acquiring connection; likely bug in PrepareConn or BeforeAcquire hook")
return nil, ErrInfiniteAcquireLoop
}

// AcquireFunc acquires a *Conn and calls f with that *Conn. ctx will only affect the Acquire. It has no effect on the
Expand Down