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 14:04:35
Message-ID: 20080317140435.GA19155@piware.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Mika Fischer [2008-03-17 10:19 +0000]:
> Description: psql should provide option to not prompt for password
> Details:
>
> Hi,
>
> I'm currently working on the bash-completion package. The problem with
> postgresql is that psql cannot safely be called because there is no way to
> know whether it will prompt for a password and there is also no way to avoid
> the prompt.
>
> Needless to say a password prompt is very bad in the context of
> tab-completion.
>
> Ideally, psql should provide an option --no-password which would cause it to
> never promt for a password, and in case one is needed, fail as if a wrong
> one was given.
>
> However if you can think of an easier way to accomplish this, I'd be
> grateful for pointers.

Indeed I have a similar problem. I use psql to probe for actual
availability of cluster startup in the integration scripts (pg_ctl
does not provide that) and also stumbled over this.

Earlier versions did not prompt if PGPASSWD was supplied, 8.3 changed
this behaviour. That's why I applied the attached patch to the
Debian/Ubuntu packages to restore the older behaviour, which works
pretty well.

I already proposed that some months ago [1], but didn't get very far.

Martin

[1] http://www.mail-archive.com/pgsql-bugs(at)postgresql(dot)org/msg18440.html

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

Attachment Content-Type Size
04-psql-passwordprompt.patch text/x-diff 595 bytes

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2008-03-17 14:26:30 Re: BUG #4040: psql should provide option to not prompt for password
Previous Message Mika Fischer 2008-03-17 13:55:27 Re: BUG #4040: psql should provide option to not prompt for password