pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: psql trying twice to connect to local DB
Date: Sat, 7 Oct 2023 21:39:38 -0500
Message-ID: <f45275ac-6562-14a5-150f-e1d7e034441c@gmail.com> (raw)
In-Reply-To: <CAKE1AiZLfCmvpb5EspiKn0AHRt7KBLgcNmG9kH3CQcEAxHcV2w@mail.gmail.com>
References: <CAKE1AiZLfCmvpb5EspiKn0AHRt7KBLgcNmG9kH3CQcEAxHcV2w@mail.gmail.com>

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.

view thread (4+ messages)

Message-ID: <f45275ac-6562-14a5-150f-e1d7e034441c@gmail.com>
Permalink:  ../f45275ac-6562-14a5-150f-e1d7e034441c@gmail.com/
Also on:    postgresql.org/message-id/f45275ac-6562-14a5-150f-e1d7e034441c@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ronljohnsonjr@gmail.com
  Subject: Re: psql trying twice to connect to local DB
  In-Reply-To: <f45275ac-6562-14a5-150f-e1d7e034441c@gmail.com>
  References: <CAKE1AiZLfCmvpb5EspiKn0AHRt7KBLgcNmG9kH3CQcEAxHcV2w@mail.gmail.com> <f45275ac-6562-14a5-150f-e1d7e034441c@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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