Re: BUG #4040: psql should provide option to not prompt for password

From: Martin Pitt <martin(at)piware(dot)de>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4040: psql should provide option to not prompt for password
Date: 2008-03-17 17:07:28
Message-ID: 20080317170728.GB19155@piware.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tom Lane [2008-03-17 10:48 -0400]:
> Martin Pitt <martin(at)piware(dot)de> writes:
> > if (PQstatus(pset.db) == CONNECTION_BAD &&
> > PQconnectionNeedsPassword(pset.db) &&
> > - password == NULL &&
> > + password == NULL && !getenv("PGPASSWORD") &&
> > !feof(stdin))
> > {
> > PQfinish(pset.db);
>
> What exactly do you think that accomplishes? AFAICS
> PQconnectionNeedsPassword can't possibly return true if there was a
> password available from PGPASSWORD (regardless of whether it was
> correct or not).

I don't claim to understand the complete code behind
PQconnectionNeedsPassword(). I just found that in at least 8.3RC1,
this did return True if pg_hba.conf set password authentication and
none was provided. I tried every trick that came into my mind,
redirecting stdin, using PGPASSWORD, and I think even a fake empty
.pgpass file, nothing worked.

Martin
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2008-03-17 17:13:08 Re: BUG #4040: psql should provide option to not prompt for password
Previous Message Peter Eisentraut 2008-03-17 17:05:25 Re: BUG #4040: psql should provide option to not prompt for password