Skip to content

Commit

Permalink
Enable failover efforts when pg_hba.conf disallows non-ssl connections
Browse files Browse the repository at this point in the history
This could be a fix the allows for a resolution of #68 and [#1581](jackc/pgx#1581). 

By breaking retries on error code 28000 we do not continue the functionality of libpq. This should allow for a more similar experience without breaking changes made in #68.
  • Loading branch information
bck01215 authored and jackc committed Jun 24, 2023
1 parent 1e11356 commit d361e70
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pgconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func ConnectConfig(octx context.Context, config *Config) (pgConn *PgConn, err er
const ERRCODE_INVALID_CATALOG_NAME = "3D000" // db does not exist
const ERRCODE_INSUFFICIENT_PRIVILEGE = "42501" // missing connect privilege
if pgerr.Code == ERRCODE_INVALID_PASSWORD ||
pgerr.Code == ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION ||
pgerr.Code == ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION && strings.Contains(pgerr.Message, "SSL on") ||
pgerr.Code == ERRCODE_INVALID_CATALOG_NAME ||
pgerr.Code == ERRCODE_INSUFFICIENT_PRIVILEGE {
break
Expand Down

0 comments on commit d361e70

Please sign in to comment.