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/



Wed, 6 Oct 1999 21:53:02 +0200 (CEST)
Peter Eisentraut <peter_e@gmx.net>
Re: [HACKERS] psql Week 1
-----BEGIN PGP SIGNED MESSAGE-----

>>>>> "Peter" == Peter Eisentraut <peter_e@gmx.net> writes:

    Peter> (This is still not ideal since the new database might not
    Peter> require a password, but there is no way to read the
    Peter> pg_hba.conf from the front end obviously.)

Couldn't you just prompt for the password *after* the backend
complains about needing it?

roland
- -- 
		       PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD                  Custom Software Solutions
roberts@panix.com                      76-15 113th Street, Apt 3B
rbroberts@acm.org                          Forest Hills, NY 11375

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3a
Charset: noconv
Comment: Processed by Mailcrypt 3.5.4, an Emacs/PGP interface

iQCVAwUBN/wSyuoW38lmvDvNAQFa9gP/YMZ9yN7OgR1N+2O2wkSAfmqHRGBocwis
zw5qg+U/mJop+1OWX6bujY3oOk2GypQGSppCkWgvV5j7sDeBLJ5cNczQLepqZxHB
ABYMAaRr6jE7JPLHua1lWxmp58CIPGz9wp1niLRap2UeFE0jgCUa3z3TsnzkgcmS
UCaMV9kLlVE=
=p2+8
-----END PGP SIGNATURE-----

06 Oct 1999 23:26:03 -0400
Roland Roberts <roberts@panix.com>
Re: [HACKERS] psql Week 1