BUG #15025: PSQL CLI - inconsistency when both -d and -U supplies ausername - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #15025: PSQL CLI - inconsistency when both -d and -U supplies ausername
Date
Msg-id 20180123130013.7407.24749@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #15025: PSQL CLI - inconsistency when both -d and -Usupplies a username
List 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"


pgsql-bugs by date:

Previous
From: "JOSEPH Michel (EXT AMARIS)"
Date:
Subject: RE: Problem running post-install step.
Next
From: Rainer Orth
Date:
Subject: Conflicting declarations for b64_encode etc. on Solaris 11.4 Beta