Skip to content

Don't clear password if directly set on pq.Config#1302

Merged
arp242 merged 1 commit intomasterfrom
pwd
Mar 30, 2026
Merged

Don't clear password if directly set on pq.Config#1302
arp242 merged 1 commit intomasterfrom
pwd

Conversation

@arp242
Copy link
Copy Markdown
Collaborator

@arp242 arp242 commented Mar 30, 2026

cfg.isset() depends on the logic in newConfig(), so if that was set outside of PGPASSWORD or password= it would never be set.

PostgreSQL does not accept empty passwords:

(0)=# alter user pqgopassword with password '';
NOTICE:  empty string is not a valid password, clearing password
Time: 10.785 ms

So okay to just test for != ""

Also do the same for krbspn and krbsrvname.

Fixes #1301

cfg.isset() depends on the logic in newConfig(), so if that was set
outside of PGPASSWORD or password= it would never be set.

PostgreSQL does not accept empty passwords:

	(0)=# alter user pqgopassword with password '';
	NOTICE:  empty string is not a valid password, clearing password
	Time: 10.785 ms

So okay to just test for != ""

Also do the same for krbspn and krbsrvname.

Fixes #1301
@arp242 arp242 merged commit e0a292e into master Mar 30, 2026
13 checks passed
@arp242 arp242 deleted the pwd branch March 30, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Password in Config is ignored

1 participant