Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qpGVZ-004xmM-Eq for pgsql-general@arkaria.postgresql.org; Sat, 07 Oct 2023 23:14:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qpGVX-002Yit-Bi for pgsql-general@arkaria.postgresql.org; Sat, 07 Oct 2023 23:14:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qpGVX-002YiV-0F for pgsql-general@lists.postgresql.org; Sat, 07 Oct 2023 23:14:51 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qpGVV-000pvL-5y for pgsql-general@lists.postgresql.org; Sat, 07 Oct 2023 23:14:51 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 397NEkiM3202244; Sat, 7 Oct 2023 19:14:46 -0400 From: Tom Lane To: Steve Baldwin cc: "pgsql-generallists.postgresql.org" Subject: Re: psql trying twice to connect to local DB In-reply-to: References: Comments: In-reply-to Steve Baldwin message dated "Sun, 08 Oct 2023 09:44:13 +1100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3202242.1696720486.1@sss.pgh.pa.us> Date: Sat, 07 Oct 2023 19:14:46 -0400 Message-ID: <3202243.1696720486@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Steve Baldwin 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