Re: Two round for Client Authentication

David G. Johnston <david.g.johnston@gmail.com>

From: "David G. Johnston" <david.g.johnston@gmail.com>
To: Yinjie Lin <exialin37@gmail.com>
Cc: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2018-06-14T04:56:55Z
Lists: pgsql-hackers
On Wednesday, June 13, 2018, Yinjie Lin <exialin37@gmail.com> wrote:
>
> Why are there two such progresses forked? I think one round should be
> enough, like when using pgAdmin.
>

You can use the --password option to prevent it.

"""
This option is never essential, since psql will automatically prompt for a
password if the server demands password authentication. However, psql will
waste a connection attempt finding out that the server wants a password. In
some cases it is worth typing -W to avoid the extra connection attempt.
"""

In pgAdmin you've saved a password to the profile so the initial attempt
uses it.  psql doesn't have a similar capability.  Though I am unsure
whether the use of .pgpass would make any difference here...

David J.