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/