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

2008-05-07 Thread Bruce Momjian
Peter Eisentraut wrote: > Am Montag, 17. M?rz 2008 schrieb Mika Fischer: > > 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. > > Something like ssh's BatchMode would be nic

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

2008-05-07 Thread Bruce Momjian
Tom Lane wrote: > Alvaro Herrera <[EMAIL PROTECTED]> writes: > > BTW while reading the psql manpage I noticed this statement: > > >A popular application of this facility is to refer to the last > >inserted OID in subsequent statements to build a foreign key > >scenario. >

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

2008-03-17 Thread Tom Lane
Alvaro Herrera <[EMAIL PROTECTED]> writes: > BTW while reading the psql manpage I noticed this statement: >A popular application of this facility is to refer to the last >inserted OID in subsequent statements to build a foreign key >scenario. > (This refers to :foo inter

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

2008-03-17 Thread Peter Eisentraut
Am Montag, 17. März 2008 schrieb Mika Fischer: > 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. Something like ssh's BatchMode would be nice. -- Sent via pgsql-bugs mailing

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

2008-03-17 Thread Alvaro Herrera
Peter Eisentraut wrote: > Am Montag, 17. März 2008 schrieb Tom Lane: > > It's not, IMHO.  You don't even know if the local database is where the > > user is intending to connect to.  Moreover this presupposes some rather > > obsolete ideas about what connection parameters might need to be given > >

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

2008-03-17 Thread Martin Pitt
Tom Lane [2008-03-17 10:48 -0400]: > Martin Pitt <[EMAIL PROTECTED]> writes: > > if (PQstatus(pset.db) == CONNECTION_BAD && > > PQconnectionNeedsPassword(pset.db) && > > - password == NULL && > > + password == NULL && !getenv("PGPA

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

2008-03-17 Thread Peter Eisentraut
Am Montag, 17. März 2008 schrieb Tom Lane: > It's not, IMHO.  You don't even know if the local database is where the > user is intending to connect to.  Moreover this presupposes some rather > obsolete ideas about what connection parameters might need to be given > on the command line. "psql " to

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

2008-03-17 Thread Mika Fischer
* Tom Lane <[EMAIL PROTECTED]> [2008-03-17 14:44]: > "Mika Fischer" <[EMAIL PROTECTED]> writes: > > 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 an

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

2008-03-17 Thread Mika Fischer
* Alvaro Herrera <[EMAIL PROTECTED]> [2008-03-17 15:43]: > Hmm, why do you need to connect to a database? Some time ago I came up > with this: > > _postgres() > { > local cur; > COMPREPLY=() > cur=${COMP_WORDS[COMP_CWORD]} > prev=${COMP_WORDS[COMP_CWORD-1]} >

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

2008-03-17 Thread Mika Fischer
* Tom Lane <[EMAIL PROTECTED]> [2008-03-17 15:28]: > Mika Fischer <[EMAIL PROTECTED]> writes: > > What the current code does is: > > Run "psql -l" to get the list of local databases, and > > run "psql -qtc 'select usename from pg_user' template1" to get the list > > of users. If this fails the syst

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

2008-03-17 Thread Tom Lane
Mika Fischer <[EMAIL PROTECTED]> writes: > * Tom Lane <[EMAIL PROTECTED]> [2008-03-17 15:28]: >> Something that might be more useful is to see if there's a connection >> service file >> http://developer.postgresql.org/pgdocs/postgres/libpq-pgservice.html >> and offer the names of service entries in

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

2008-03-17 Thread Tom Lane
Martin Pitt <[EMAIL PROTECTED]> writes: > if (PQstatus(pset.db) == CONNECTION_BAD && > PQconnectionNeedsPassword(pset.db) && > - password == NULL && > + password == NULL && !getenv("PGPASSWORD") && > !

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

2008-03-17 Thread Alvaro Herrera
Mika Fischer wrote: > 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. Hmm, why do you need to connect to

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

2008-03-17 Thread Gurjeet Singh
On Mon, Mar 17, 2008 at 7:34 PM, Martin Pitt <[EMAIL PROTECTED]> wrote: > Mika Fischer [2008-03-17 10:19 +]: > > Description:psql should provide option to not prompt for > password > > Details: > > > > Hi, > > > > I'm currently working on the bash-completion package. The problem with >

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

2008-03-17 Thread Tom Lane
Mika Fischer <[EMAIL PROTECTED]> writes: > What the current code does is: > Run "psql -l" to get the list of local databases, and > run "psql -qtc 'select usename from pg_user' template1" to get the list > of users. If this fails the system users are used for completion. > I'm not at all a Postgre

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

2008-03-17 Thread Martin Pitt
Mika Fischer [2008-03-17 10:19 +]: > 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 whe

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

2008-03-17 Thread Tom Lane
"Mika Fischer" <[EMAIL PROTECTED]> writes: > 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 t

[BUGS] BUG #4040: psql should provide option to not prompt for password

2008-03-17 Thread Mika Fischer
The following bug has been logged online: Bug reference: 4040 Logged by: Mika Fischer Email address: [EMAIL PROTECTED] PostgreSQL version: 8.3.0 Operating system: Ubuntu Linux 8.4 beta Description:psql should provide option to not prompt for password Details: Hi, I