This may apply to Unix versions as well but I have not tried.
Anyway, I am using C# to create a GUI front end to pg_dump and I am
using the PGPASSWORD environment variable to set the password like this:
System.Environment.SetEnvironmentVariable("PGPASSWORD", myargs.password);
This works fine and pg_dump.exe executes happily. But now here is the issue:
When I pass a database name that does not exist after setting the
password via the environment variable instead of writing the database
not found error to standard error, it prompts for the password and
causes the C# program to lock. Now the chance of it getting a bad
database name is slim, but it could happen if a database is deleted and
the list is not refreshed. I am not forcing it to display the password
prompt with -W by the way.
Shouldn't it write the database not found error to standard error
instead of prompting for the password?
If I purposely pass other bad arguments after setting the password it
does not display the password prompt in the command window. I noticed
this because during development I am showing the process window and for
production it of course will be hidden.
I notices this on the 8.3 version of pg_dump, but probably applies to
others as well.
Has anyone else noticed this?
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend