Re: BUG #15025: PSQL CLI - inconsistency when both -d and -U supplies a username

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: akos(at)elegran(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15025: PSQL CLI - inconsistency when both -d and -U supplies a username
Date: 2018-01-28 20:36:33
Message-ID: 20180128203633.GC4380@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sun, Jan 28, 2018 at 03:30:54PM -0500, Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > On Sun, Jan 28, 2018 at 02:38:46PM -0500, Tom Lane wrote:
> >> Isn't it possible to get the URI parse
> >> results back out of libpq?
>
> > Well, there is PQuser(), but you need to pass a connection struct to
> > that, and before you connect you don't have one.
>
> Yeah, but we normally don't prompt for password till after a failed
> connection attempt, at which point we can get the info. So I propose
> something like the attached.
>
> There's room for debate about what we ought to do when -W (--password) is
> specified, but I think that that's not really that exciting because the
> only real use-cases for it are noninteractive applications that aren't
> going to care what the prompt is. So in the startup.c case I have it
> just offering the neutral "Password: " prompt always. In the \c case,
> I left it using the same initial username as it was before, because the
> odds that that's right seem considerably higher with \c. You can still
> fool it by giving a URI dbname to \c, so maybe there's an argument for
> lobotomizing the initial prompt in \c too, but I didn't do that here.

Oh, I wasn't aware a failed login left us with a 'conn'.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2018-01-28 21:05:40 Re: BUG #15025: PSQL CLI - inconsistency when both -d and -U supplies a username
Previous Message Tom Lane 2018-01-28 20:30:54 Re: BUG #15025: PSQL CLI - inconsistency when both -d and -U supplies a username