Re: BUG #2931: Can't capture pg_dump Password prompt

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Michael Schmidt <MichaelMSchmidt(at)msn(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2931: Can't capture pg_dump Password prompt
Date: 2007-01-27 16:06:21
Message-ID: 45BB787D.5040801@hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Michael Schmidt wrote:
> The following bug has been logged online:
>
> Bug reference: 2931
> Logged by: Michael Schmidt
> Email address: MichaelMSchmidt(at)msn(dot)com
> PostgreSQL version: 8.2
> Operating system: Windows XP Pro
> Description: Can't capture pg_dump Password prompt
> Details:
>
> I have a Java user app that allows database backup and restore by accessing
> pg_dump and pg_restore. With PostgreSQL version 8.1, I was able to capture
> the Password: prompt on stderr, which allowed me to send to password at the
> proper time. This no longer works with PostgreSQL 8.2. I've worked on this
> for three days and even wrote a separate Java app to test various PostgreSQL
> utilities, posting results on the General list (got no help there). I
> further confirmed the behavior by redirecting stderr from Windows cmd.exe.
> Although the password prompt appears on the screen, it does not appear to be
> in either stdout or stderr. For Windows command prompt, the following was
> used:
> pg_dump.exe -Upostgres --host=localhost --port=5432 -W -v
> --file=E:\Backup\test.bak npbase 2>>log.txt
>
> As expected from using -v, a nice log of output was present in log.txt but
> not the "Password: " prompt. I will supply the Java test app if you like.
>
>
> If the prompt is, in fact, being output on stderr, it cannot be accessed
> from either cmd.exe or Java. If it has been changed, documentation on how
> to access it would be useful for app developers.

This is not a bug, it's a feature ;-) It's written to the console, not
to the standard stream. If you launch the tools externally and want to
pass the password, you should either use the pgpass.conf file, or set
the PGPASSWORD (this is safe on Win32).

//Magnus

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Magnus Hagander 2007-01-27 17:40:45 Re: BUG #2934: INSTALL FAILURE - failed to set permissions
Previous Message Magnus Hagander 2007-01-27 16:02:38 Re: BUG #2934: INSTALL FAILURE - failed to set permissions