pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #8586: Misleading fe_sendauth error message
5+ messages / 3 participants
[nested] [flat]
* BUG #8586: Misleading fe_sendauth error message
@ 2013-11-11 03:44 mle+tools@mega-nerd.com
0 siblings, 1 reply; 5+ messages in thread
From: mle+tools@mega-nerd.com @ 2013-11-11 03:44 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 8586
Logged by: Erik de Castro Lopo
Email address: mle+tools@mega-nerd.com
PostgreSQL version: 9.3.1
Operating system: Debian GNU LInux
Description:
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?
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: BUG #8586: Misleading fe_sendauth error message
@ 2013-11-11 04:11 Tom Lane <tgl@sss.pgh.pa.us>
parent: mle+tools@mega-nerd.com
0 siblings, 1 reply; 5+ messages in thread
From: Tom Lane @ 2013-11-11 04:11 UTC (permalink / raw)
To: mle+tools@mega-nerd.com; +Cc: pgsql-bugs
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.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: BUG #8586: Misleading fe_sendauth error message
@ 2013-11-11 04:19 Erik de Castro Lopo <mle+tools@mega-nerd.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 5+ messages in thread
From: Erik de Castro Lopo @ 2013-11-11 04:19 UTC (permalink / raw)
To: pgsql-bugs; +Cc: Tom Lane <tgl@sss.pgh.pa.us>
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
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: BUG #8586: Misleading fe_sendauth error message
@ 2013-11-11 04:26 Tom Lane <tgl@sss.pgh.pa.us>
parent: Erik de Castro Lopo <mle+tools@mega-nerd.com>
0 siblings, 1 reply; 5+ messages in thread
From: Tom Lane @ 2013-11-11 04:26 UTC (permalink / raw)
To: Erik de Castro Lopo <mle+tools@mega-nerd.com>; +Cc: pgsql-bugs
Erik de Castro Lopo <mle+tools@mega-nerd.com> writes:
> 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.
No, you are mistaken. The .pgpass file provides a password given
a user/dbname/host/port to be connected to. It is not the source
of any data other than the password.
You might want to look into the "service file" feature, which does
allow various connection parameters to be provided from a single name.
http://www.postgresql.org/docs/9.3/static/libpq-pgservice.html
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: BUG #8586: Misleading fe_sendauth error message
@ 2013-11-11 04:36 Erik de Castro Lopo <mle+tools@mega-nerd.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 5+ messages in thread
From: Erik de Castro Lopo @ 2013-11-11 04:36 UTC (permalink / raw)
To: pgsql-bugs; +Cc: Tom Lane <tgl@sss.pgh.pa.us>
Tom Lane wrote:
> Erik de Castro Lopo <mle+tools@mega-nerd.com> writes:
> > 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.
>
> No, you are mistaken. The .pgpass file provides a password given
> a user/dbname/host/port to be connected to. It is not the source
> of any data other than the password.
>
> You might want to look into the "service file" feature, which does
> allow various connection parameters to be provided from a single name.
>
> http://www.postgresql.org/docs/9.3/static/libpq-pgservice.html
Thanks, that looks like a better solution that the PGPASSFILE.
Cheers,
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
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2013-11-11 04:36 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-11-11 03:44 BUG #8586: Misleading fe_sendauth error message mle+tools@mega-nerd.com
2013-11-11 04:11 ` Tom Lane <tgl@sss.pgh.pa.us>
2013-11-11 04:19 ` Erik de Castro Lopo <mle+tools@mega-nerd.com>
2013-11-11 04:26 ` Tom Lane <tgl@sss.pgh.pa.us>
2013-11-11 04:36 ` Erik de Castro Lopo <mle+tools@mega-nerd.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox