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 1qpJhs-005AFh-Jy for pgsql-general@arkaria.postgresql.org; Sun, 08 Oct 2023 02:39:48 +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 1qpJho-003XxH-S6 for pgsql-general@arkaria.postgresql.org; Sun, 08 Oct 2023 02:39:45 +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 1qpJho-003Xx9-Dz for pgsql-general@lists.postgresql.org; Sun, 08 Oct 2023 02:39:45 +0000 Received: from mail-yb1-xb31.google.com ([2607:f8b0:4864:20::b31]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qpJhm-000rG5-19 for pgsql-general@lists.postgresql.org; Sun, 08 Oct 2023 02:39:44 +0000 Received: by mail-yb1-xb31.google.com with SMTP id 3f1490d57ef6-d77ad095f13so3593064276.2 for ; Sat, 07 Oct 2023 19:39:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696732779; x=1697337579; darn=lists.postgresql.org; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=KPyxX4q2c3WnqNXVAAZ+F3hRCnFiI5O5rVIVj/SpyoM=; b=dvvRQ0vNIyGAR8xZtFPvyFV5ILqtS1Q2a+nU/aRfdabKZoiFfnzPzexh/VdVBJ5K+i boGYk4RioMH0X0ATQrZr8/ZAI4U/WYsfKZfvv0peibuvsb/um7J4dVQNCGTEV49qzCsc UimIx7BGpn348Cv8aL62runbQqG/r/4tecoR6ta+IREkYg2t9APba3Xz1qLfvw/qGZ5z ouwMDU/UWuJ6Av3dhsCr9aZQSPQu6HFdFVVyDgOuY0b4sdl8St88FdkZWTeE8Yb7J5VC 5gH9eTZNI3+vhR8FhqUIYOC3g2ICa4HTUjJEQQ3fONbvJpep+EpIJa94Jj+MPYXE17aQ uX/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696732779; x=1697337579; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=KPyxX4q2c3WnqNXVAAZ+F3hRCnFiI5O5rVIVj/SpyoM=; b=WUAZfMV+ju9d7UCtkV99+KiFi7el3eD5O3yxPAortGzYr+JS9nyJO7GGusmOhz7OLm BE6z3LVufirusg0BYBsA0JVQDfj6aWcqy+TODmn+gd/Ps+TbWbn2khZhtyP2qNZeJCaI 2mU0AQyHuRMBjIwl4j9pU00Onw3agF8ll+Vx83zrRqF80S1bRfwSon5vq614BYARJxQT 2V58xyQynaFoUPPkdjp94W2LPrUbBVPrDfMQ7cZtZKvB+wYmC2xzdWGbMnwHBr+GsGrt E1m2LnPPwoEIdAVEI1keme/uxbWj43GtS4VHeGBCOepqUmjPDLfSfzi/DpBWwN4zkU8g pLcg== X-Gm-Message-State: AOJu0Yxk47zXKD4bF4un2/iCsLigpRdWISuQXlnK5Fft7jNb6eYR0trm CMx/yVy6xkBLOGjzMj/QeLDnopH1c7A= X-Google-Smtp-Source: AGHT+IHC9yic0A07tz9WMb6R/Ss+pfX/HB7csPVImOwb+Ptdd7WPkqdXSf0mKt0leb4UAweVOFNtgw== X-Received: by 2002:a25:a044:0:b0:d32:cd49:2469 with SMTP id x62-20020a25a044000000b00d32cd492469mr10397721ybh.24.1696732779229; Sat, 07 Oct 2023 19:39:39 -0700 (PDT) Received: from ?IPV6:2600:1700:bd2c:b810:44ea:c589:675a:83fb? ([2600:1700:bd2c:b810:44ea:c589:675a:83fb]) by smtp.googlemail.com with ESMTPSA id 20-20020a250514000000b00d071631665fsm2121870ybf.59.2023.10.07.19.39.38 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 07 Oct 2023 19:39:38 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------j5isuK9Sl8ysVpH8NFCNCtrj" Message-ID: Date: Sat, 7 Oct 2023 21:39:38 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: psql trying twice to connect to local DB Content-Language: en-US To: pgsql-general@lists.postgresql.org References: From: Ron In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------j5isuK9Sl8ysVpH8NFCNCtrj Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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. --------------j5isuK9Sl8ysVpH8NFCNCtrj Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit 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.
--------------j5isuK9Sl8ysVpH8NFCNCtrj--