Martin Pitt <martin(at)piware(dot)de> writes:
> if (PQstatus(pset.db) == CONNECTION_BAD &&
> PQconnectionNeedsPassword(pset.db) &&
> - password == NULL &&
> + password == NULL && !getenv("PGPASSWORD") &&
> !feof(stdin))
> {
> PQfinish(pset.db);
What exactly do you think that accomplishes? AFAICS
PQconnectionNeedsPassword can't possibly return true if there was a
password available from PGPASSWORD (regardless of whether it was
correct or not).
regards, tom lane