BUG #15025: PSQL CLI - inconsistency when both -d and -U supplies a username
The Post Office <noreply@postgresql.org>
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: akos@elegran.com
Date: 2018-01-23T13:00:13Z
Lists: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 15025
Logged by: Akos Vandra
Email address: akos@elegran.com
PostgreSQL version: 9.5.4
Operating system: Debian
Description:
Repro:
case 1: psql -U other_user -d "postgresql://some_user@host/db"
case 2: psql -d "postgresql://some_user@host/db" -U other_user
Expectation:
Use whatever is given later:
case 1: log in as user
case 2: log in as other_user
Actual:
case 1: logs in as user
case 2:
- the password prompt asks for the pw of user
- psql uses the password given to log in with other_user
- if the pw is correct for user, or incorrect it displays that the
password is incorrect for other_user
- if the password is correct for other_user, it connects to the db as
other_user
$ psql "postgresql://user@host/db" -U other_user
Password for user other_user:
psql: FATAL: password authentication failed for user "user"
FATAL: password authentication failed for user "user"
Commits
-
Avoid misleading psql password prompt when username is multiply specified.
- 15be27460191 11.0 landed