MaxConns int32 conversion can overflow for an implausible STEAMPIPE_MAX_PARALLEL value
config.MaxConns = int32(db_common.MaxDbConnections()) can silently overflow for an implausibly large STEAMPIPE_MAX_PARALLEL/--max-parallel value.
Where: pkg/db/db_client/db_client_connect.go, establishConnectionPool.
What happens today: db_common.MaxDbConnections() reads STEAMPIPE_MAX_PARALLEL/--max-parallel straight from viper with no upper bound, then it's cast directly to int32. A value above math.MaxInt32 (~2.1 billion) wraps to an arbitrary (possibly negative) int32, which pgxpool would receive as MaxConns.
What a fix would change for users: the practical fix is to validate/clamp STEAMPIPE_MAX_PARALLEL at the point it's read (or when the flag/env var is parsed), returning a clear error or clamping to a sane maximum, rather than letting an absurd value reach pgxpool.Config at all.
What analysis is needed before fixing: what a sane upper bound actually is (postgres' own max_connections is typically in the low thousands), and whether that validation belongs in db_common.MaxDbConnections() itself or in flag/env parsing.
Generated with Claude Code
Source: turbot/steampipe