Re: psql trying twice to connect to local DB

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: psql trying twice to connect to local DB
Date: 2023-10-08 02:39:38
Message-ID: f45275ac-6562-14a5-150f-e1d7e034441c@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/7/23 17:44, Steve Baldwin wrote:
> I have a local DB (15.2) running in a docker container.
>
> If I make a connection to that DB from most clients I see log entries like
> this:
>
> 2023-10-07 22:32:26.518 UTC,,,16278,"172.21.0.1:33192
> <http://172.21.0.1:33192>",6521dc7a.3f96,1,"",2023-10-07 22:32:26
> UTC,,0,LOG,00000,"connection received: host=172.21.0.1
> port=33192",,,,,,,,,"","not initialized",,0
> 2023-10-07 22:32:26.529
> UTC,"b2bc_owner","b2bcreditonline",16278,"172.21.0.1:33192
> <http://172.21.0.1:33192>",6521dc7a.3f96,2,"authentication",2023-10-07
> 22:32:26 UTC,4/340,0,LOG,00000,"connection authenticated:
> identity=""b2bc_owner"" method=scram-sha-256
> (/var/lib/postgresql/data/pg_hba.conf:100)",,,,,,,,,"","client backend",,0
> 2023-10-07 22:32:26.529
> UTC,"b2bc_owner","b2bcreditonline",16278,"172.21.0.1:33192
> <http://172.21.0.1:33192>",6521dc7a.3f96,3,"authentication",2023-10-07
> 22:32:26 UTC,4/340,0,LOG,00000,"connection authorized: user=b2bc_owner
> database=b2bcreditonline application_name=crystal",,,,,,,,,"","client
> backend",,0
>
> If however I use psql I see two connection log entries - sometimes almost
> a second apart. For example:
>
> 2023-10-07 22:33:16.214 UTC,,,16431,"172.21.0.1:48550
> <http://172.21.0.1:48550>",6521dcac.402f,1,"",2023-10-07 22:33:16
> UTC,,0,LOG,00000,"connection received: host=172.21.0.1
> port=48550",,,,,,,,,"","not initialized",,0
> 2023-10-07 22:33:17.130 UTC,,,16432,"172.21.0.1:48558
> <http://172.21.0.1:48558>",6521dcad.4030,1,"",2023-10-07 22:33:17
> UTC,,0,LOG,00000,"connection received: host=172.21.0.1
> port=48558",,,,,,,,,"","not initialized",,0
> 2023-10-07 22:33:17.151
> UTC,"b2bc_owner","b2bcreditonline",16432,"172.21.0.1:48558
> <http://172.21.0.1:48558>",6521dcad.4030,2,"authentication",2023-10-07
> 22:33:17 UTC,4/354,0,LOG,00000,"connection authenticated:
> identity=""b2bc_owner"" method=scram-sha-256
> (/var/lib/postgresql/data/pg_hba.conf:100)",,,,,,,,,"","client backend",,0
> 2023-10-07 22:33:17.152
> UTC,"b2bc_owner","b2bcreditonline",16432,"172.21.0.1:48558
> <http://172.21.0.1:48558>",6521dcad.4030,3,"authentication",2023-10-07
> 22:33:17 UTC,4/354,0,LOG,00000,"connection authorized: user=b2bc_owner
> database=b2bcreditonline application_name=psql",,,,,,,,,"","client backend",,0
>
> The version of psql is 15.4.
>
> Obviously this isn't a major problem, but I'm curious if I've got
> something configured incorrectly, or just something I missed from the docs.

As follow-up to Tom's response: create a .pgpass file with an entry for
b2bc_owner.  There might still be two entries, but the time between the two
of them should be instantaneous.

--
Born in Arizona, moved to Babylonia.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter J. Holzer 2023-10-08 09:02:05 Re: Multiple inserts with two levels of foreign keys
Previous Message Tom Lane 2023-10-07 23:14:46 Re: psql trying twice to connect to local DB