Re: Warning about invalid .pgpass passwords

Fujii Masao <masao.fujii@gmail.com>

From: Fujii Masao <masao.fujii@gmail.com>
To: Bruce Momjian <bruce@momjian.us>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Alvaro Herrera <alvherre@commandprompt.com>, Eamonn Martin <mas01em@gold.ac.uk>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2010-03-10T03:31:56Z
Lists: pgsql-hackers
On Wed, Mar 10, 2010 at 11:52 AM, Bruce Momjian <bruce@momjian.us> wrote:
> The attached patch reports the fact that .pgpass was used if the libpq
> connection fails:

+	/*
+	 *	If the connection failed, we should mention that
+	 *	we got the password from .pgpass in case that
+	 *	password is wrong.
+	 */
+	if (conn->used_dot_pgpass && conn->password_needed)
+		appendPQExpBufferStr(&conn->errorMessage,
+			libpq_gettext("(password retrieved from .pgpass)\n"));

I think that this should be in PQconnectPoll() rather than connectDBComplete().
Otherwise, only when we make a connection to the server in a nonblocking manner
(i.e., use PQconnectStart() and PQconnectPoll()), that HINT message is
not output.
This looks odd for me. Thought?

Regards,

-- 
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center