Skip site navigation (1) Skip section navigation (2)

Re: Password prompting business

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Password prompting business
Date: 2009-02-22 15:14:03
Message-ID: 10630.1235315643@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> The feof(stdin) test is there from a time when the prompt when to stdout 
> and the input came from stdin.  Now it would usually not have any effect 
> unless the program reads from stdin before connecting to the database, 
> which doesn't happen, as far as I can tell.

> Unless I'm reading this wrong, we should probably remove this.

+1

> Anyway, a way to prevent a password prompt would still be useful.  This 
> should then be applicable to all client tools.  I can imagine that we 
> either add a command-line option (-w would mirror -W well) or do this 
> automatically when stdin and/or stdout is not a terminal.  I'm not sure 
> if the latter can be made to work safely, though.

The entire point of the current arrangement is that it works when stdin
or stdout is not the terminal (eg, you've got psql in a pipe).  So I
don't think you can make any changes on that basis without breaking more
use-cases than you solve.

Of the two use-cases mentioned in the messages you link to, I don't find
the first one convincing (what is actually wanted there is a "pg_ping"
utility); but the tab-completion-support example does seem like a case
where failure is preferable to issuing a password prompt.  And there is
not really any good way for psql itself to distinguish this from
ordinary pipe cases.  So a -w switch is probably the right answer.

			regards, tom lane

In response to

pgsql-hackers by date

Next:From: Hiroshi SaitoDate: 2009-02-22 15:33:43
Subject: Re: regression test crashes at tsearch
Previous:From: Tom LaneDate: 2009-02-22 14:52:55
Subject: Re: some broken on pg_stat_user_functions

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group