Re: BUG #8586: Misleading fe_sendauth error message

From: Erik de Castro Lopo <mle+tools(at)mega-nerd(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: BUG #8586: Misleading fe_sendauth error message
Date: 2013-11-11 04:19:38
Message-ID: 20131111151938.36cb6bcaf4b83b70b0d068aa@mega-nerd.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tom Lane wrote:

> mle+tools(at)mega-nerd(dot)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/

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2013-11-11 04:26:18 Re: BUG #8586: Misleading fe_sendauth error message
Previous Message Tom Lane 2013-11-11 04:11:56 Re: BUG #8586: Misleading fe_sendauth error message