Skip to content
Merged
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
2 changes: 2 additions & 0 deletions connection_details.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ type ConnectionDetails struct {
RawOptions string
// TracerProvider is the OpenTelemetry tracer provider to use for tracing SQL calls.
TracerProvider trace.TracerProvider
// AllowMinPool enables min pool enforcement.
AllowMinPool bool
}

var dialectX = regexp.MustCompile(`\S+://`)
Expand Down
2 changes: 1 addition & 1 deletion connection_instrumented.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func openPotentiallyInstrumentedConnection(ctx context.Context, c dialect, dsn s
}
)
// If "pool_min_conns" is set in the DSN, it means that we use the pgx pool feature flag.
if strings.Contains(dsn, "pool_min_conns=") && (CanonicalDialect(driver) == nameCockroach || CanonicalDialect(driver) == namePostgreSQL) {
if c.Details().AllowMinPool && strings.Contains(dsn, "pool_min_conns=") && (CanonicalDialect(driver) == nameCockroach || CanonicalDialect(driver) == namePostgreSQL) {
pool, err := pgxpool.New(ctx, dsn)
if err != nil {
return nil, nil, err
Expand Down