Re: [HACKERS] psql Week 1 - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [HACKERS] psql Week 1
Date
Msg-id Pine.LNX.4.10.9910062151220.1744-100000@peter-e.yi.org
Whole thread Raw
List pgsql-hackers
On Oct 5, Roland Roberts mentioned:

>     Peter> * \connect now asks for password when appropriate
> 
> Does this include the initial connect?  I has password authentication
> enabled and think it would be nice if psql just prompted me rather
> than failed....

There was a design flaw in psql in that the -u switch always asked for
username *and* password. Those are essentially two separate things: Do you
want a different username than the default? and Do you need to enter a
password because you use that as authentication?

I resolved that by adding a switch -U to specifiy username and -P to
request a password prompt. If and only if you start psql with -P you will
get a password prompt any time you reconnect. (This is still not ideal
since the new database might not require a password, but there is no way
to read the pg_hba.conf from the front end obviously.) For backward
compatibility the -u switch essentially simulates "-U ? -P". (Username "?"
means prompt for username. You guys don't use question marks as username,
do you?)

I hope that solves it.

-- 
Peter Eisentraut - peter_e@gmx.net
http://yi.org/peter-e/




pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: AW: [HACKERS] psql Week 1
Next
From: Peter Eisentraut
Date:
Subject: Re: psql and comments