pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bruce Momjian <bruce@momjian.us>
Cc: akos@elegran.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15025: PSQL CLI - inconsistency when both -d and -U supplies a username
Date: Sun, 28 Jan 2018 14:38:46 -0500
Message-ID: <29202.1517168326@sss.pgh.pa.us> (raw)
In-Reply-To: <20180128034832.GD9153@momjian.us>
References: <20180123130013.7407.24749@wrigleys.postgresql.org>
	<20180128034832.GD9153@momjian.us>

Bruce Momjian <bruce@momjian.us> writes:
> 	psql -d "postgresql://user2@momjian.us/test" -U user1
> -->	Password for user user1:
> but it wants the user2 password.

> It doesn't matter whether -U is first or last, it always prompts for the
> -U user, but connects as the -d user.

Bleah.

> Because the URI is parsed by libpq, I don't think we can do any better
> than just suppress the user name in the password prompt when a URI is
> used.

That doesn't seem very user-friendly at all.  I think that the most
correct behavior in this case would be to throw an error because of the
conflicting command line parameters.  Now admittedly, psql doesn't throw
an error for

	psql -U alice -U bob

so maybe just silently making a choice is OK, but we need to be clear
as to which choice we made.  Isn't it possible to get the URI parse
results back out of libpq?

			regards, tom lane




view thread (8+ messages)  latest in thread

Message-ID: <29202.1517168326@sss.pgh.pa.us>
Permalink:  ../29202.1517168326@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29202.1517168326@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, bruce@momjian.us, akos@elegran.com
  Subject: Re: BUG #15025: PSQL CLI - inconsistency when both -d and -U supplies a username
  In-Reply-To: <29202.1517168326@sss.pgh.pa.us>
  References: <20180123130013.7407.24749@wrigleys.postgresql.org> <20180128034832.GD9153@momjian.us> <29202.1517168326@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox