Re: psql trying twice to connect to local DB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Steve Baldwin <steve(dot)baldwin(at)gmail(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: psql trying twice to connect to local DB
Date: 2023-10-07 23:14:46
Message-ID: 3202243.1696720486@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Steve Baldwin <steve(dot)baldwin(at)gmail(dot)com> writes:
> If I make a connection to that DB from most clients I see log entries like
> this:
> ...
> If however I use psql I see two connection log entries - sometimes almost a
> second apart. For example:

These log entries show that you're using password-based authentication.
I believe what is happening is that psql tries to connect, discovers
that it needs a password, and then tries again after it's got a
password. The delay would correspond to the time for you to type
your password (I take it you're a fast typist).

If you don't like the extra log entries, there's a command-line
switch that forces psql to prompt for password before connecting
the first time. Of course, that might result in prompting for
a password that's not really needed.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2023-10-08 02:39:38 Re: psql trying twice to connect to local DB
Previous Message Steve Baldwin 2023-10-07 23:13:06 Re: psql trying twice to connect to local DB