Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VfiyX-0006sw-6U for pgsql-bugs@arkaria.postgresql.org; Mon, 11 Nov 2013 04:19:45 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VfiyW-00040B-9o for pgsql-bugs@arkaria.postgresql.org; Mon, 11 Nov 2013 04:19:44 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VfiyV-000404-8j for pgsql-bugs@postgresql.org; Mon, 11 Nov 2013 04:19:43 +0000 Received: from hendrix.mega-nerd.net ([203.206.230.162]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VfiyS-0003K1-KP for pgsql-bugs@postgresql.org; Mon, 11 Nov 2013 04:19:42 +0000 Received: from rollins.mnn (pharoah-vpn [10.9.8.2]) by hendrix.mega-nerd.net (Postfix) with SMTP id CBF9E106EA4; Mon, 11 Nov 2013 15:19:38 +1100 (EST) Date: Mon, 11 Nov 2013 15:19:38 +1100 From: Erik de Castro Lopo To: pgsql-bugs@postgresql.org Cc: Tom Lane Subject: Re: BUG #8586: Misleading fe_sendauth error message Message-Id: <20131111151938.36cb6bcaf4b83b70b0d068aa@mega-nerd.com> In-Reply-To: <23565.1384143116@sss.pgh.pa.us> References: <23565.1384143116@sss.pgh.pa.us> Reply-To: pgsql-bugs@postgresql.org Organization: Erik Conspiracy Secret Labs X-Mailer: Sylpheed 3.4.0beta6 (GTK+ 2.24.22; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -0.0 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Tom Lane wrote: > mle+tools@mega-nerd.com writes: > > Running the command: > > PGPASSFILE=pgpass psql --no-password --username myname mydb > > --command="\dt" > > works fine if the port number in the pgpass file is correct, but if the port > > number is incorrect the error message is: > > psql: fe_sendauth: no password supplied > > which is highly misleading. Surely the error message should be "connection > > refused" or some such? > > I'm not sure how we could improve that. If the port number in the > password file doesn't match the intended connection, that means the > entry doesn't apply to this connection. We can hardly issue error > messages on the basis of the presence of unrelated entries in a > .pgpass file. So what the code is seeing is that the server demanded > a password (or so I'd assume), and it did not have one to give. I haven't read the code, but my guess is that psql does the following: a) Grabs the user and database name from command line. b) Looks up dbname in pgpassfile to get host and port number etc. c) Connects to host:port and uses supplied username/password. When the connect fails in step c), the error should be "connection failed". Is this not how it should work? Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/ -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs