Skip to content

Commit

Permalink
Optimize redundant pgpass parsing in case password is explicitly set
Browse files Browse the repository at this point in the history
  • Loading branch information
aalekseevx authored and jackc committed Feb 28, 2023
1 parent 754c573 commit 1e11356
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,9 @@ func ParseConfigWithOptions(connString string, options ParseConfigOptions) (*Con
config.TLSConfig = fallbacks[0].TLSConfig
config.Fallbacks = fallbacks[1:]

passfile, err := pgpassfile.ReadPassfile(settings["passfile"])
if err == nil {
if config.Password == "" {
if config.Password == "" {
passfile, err := pgpassfile.ReadPassfile(settings["passfile"])
if err == nil {
host := config.Host
if network, _ := NetworkAddress(config.Host, config.Port); network == "unix" {
host = "localhost"
Expand Down

0 comments on commit 1e11356

Please sign in to comment.