Re: psql trying twice to connect to local DB

Поиск
Список
Период
Сортировка
От Ron
Тема Re: psql trying twice to connect to local DB
Дата
Msg-id f45275ac-6562-14a5-150f-e1d7e034441c@gmail.com
обсуждение исходный текст
Ответ на psql trying twice to connect to local DB  (Steve Baldwin <steve.baldwin@gmail.com>)
Список 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",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",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",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",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",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",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",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.

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: psql trying twice to connect to local DB
Следующее
От: "Peter J. Holzer"
Дата:
Сообщение: Re: Multiple inserts with two levels of foreign keys