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.96) (envelope-from ) id 1wV0vj-001cC4-0v for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Jun 2026 05:47:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wV0vi-00535o-0T for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Jun 2026 05:47:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wV0vh-00535g-2m for pgsql-hackers@lists.postgresql.org; Thu, 04 Jun 2026 05:47:45 +0000 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wV0vf-000000011YA-10gM for pgsql-hackers@lists.postgresql.org; Thu, 04 Jun 2026 05:47:44 +0000 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-8423efad617so142476b3a.0 for ; Wed, 03 Jun 2026 22:47:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780552062; x=1781156862; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=hQRn/k2kW4e2O9W0zsTKmr7e3amKoN5P4wva51XfBYw=; b=VvAxNP9tR6DoIRSMV7iwKHxCjBLA/wDhevuXGb3tsfwDeRcvguMgMCbsUejASWA8rm b9GKE1HsIQNRjdtHyjff7ODLUKGfT+/DSJ1lg/3tYfohU587EnrVfC4itM+4d9MDoXC5 cUM7vZ1NKMT3l6nWs4xYSJN8/dkssr/WB/moLoWYKB6YpfpA2q9PQutmRMYQuyh/D7fK XkNImTWdVSnEC5junu4ChjTxJgt6Iz228O4jEByDL9z601g1jJmcBI42d/Qfofj6H6uW cd+f8AMWMtD4FXTVviVxPIoIn7i9fKHZ5tmeZhAiUTsT/VmXw0UDDkFd8NK3gyf1Uk9U QAmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780552062; x=1781156862; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=hQRn/k2kW4e2O9W0zsTKmr7e3amKoN5P4wva51XfBYw=; b=sdynLiZK78zCi8kMxvmh/JVmo1yviMIPXRvfOaUsgFEzNn05xu0AM3D4Yl/IuFp4b3 a8WhuA1ogu3DMBjxv6Rnq0XC1Wk6ZqbA6PnecC+Fc+2/g4BtHhgyvyCLYD+piWQCaXgu xA+H8PGdP4Rc4Vo4bAMS3hDO8axh5QqiSB9ZjEt09pZr2EsylUd0P+qHfRTiEz1HV0EQ phcvtx1XwhU5JfsJkERimpKkGoBDLjm4ru10JSdjsXfPx1pfkFHJg0h/VvHq3Et7Vd8a Nt6bf/rRc1M+LBAr7uqslSywk7BzI734VK/Q7YMDSWrgQiidUAYeikf3d0hhcZlA8BpX QPZQ== X-Gm-Message-State: AOJu0Ywh+DNONuov6I8luDf3b1IE2BpLYCiK0QXL+LlWNA4lkVC7ExPX v5LeRYyY1K+xmz3CjJXv/Jhaeo+3TxWqfo0kbZkU6keraMLEuDtIYiHu X-Gm-Gg: Acq92OEKLJMR+O+fUazBrwGIYt28LJtlCssopin8FPanWaCZ9s427JgKs/Ws6vAPDiI mRUYg4YWYQy4mRVqzhtXI5tCOk956P18o4ipGmGyEjncb7kpEuPbrF/O936sfSQzFsFPqoteZQi peh7BBoDj1/CCgQ1GHnAqXNr0z2xafWqvoQTXFNJ/pcL6NY8BU3wiSvap+cLmW19QsazdZZyY1F IpDx+xN0wnk5CJyfCqC6Qt223MvFCR0/wbeCCDNij86tX2PMrpXutskGkUInQoS72BpnymWsRjA RMLn9tdadU0Fk2UIQSGfDqmX3BhLpkJ2F9VHs3MOG7aPDv9YQ1vCEsQWAo7b1v8fBUr+XDz9mCh JBTlw6b+2pMuJ2EVmx+alEK+N8Xhfu2e14paogDrlog53/fTsWYn4sMItfCDF+POfkYNq/uBXux gyileOvbpTTyXtKeCCt2TSU3fRrtHWPX7xcsYjQqK8/0k= X-Received: by 2002:a05:6a00:1c89:b0:842:2efa:5fac with SMTP id d2e1a72fcca58-84284a85991mr6368762b3a.0.1780552061836; Wed, 03 Jun 2026 22:47:41 -0700 (PDT) Received: from smtpclient.apple ([185.135.79.161]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84282374300sm5741351b3a.20.2026.06.03.22.47.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Jun 2026 22:47:41 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.600.51.1.1\)) Subject: Re: SERVICEFILE shows wrong file after servicefile fallback From: Chao Li In-Reply-To: Date: Thu, 4 Jun 2026 13:47:04 +0800 Cc: Postgres hackers , tfoertsch123@gmail.com, kanbayashi.dev@gmail.com Content-Transfer-Encoding: quoted-printable Message-Id: References: <59DD1652-4EB5-449B-8DE3-959F06561A96@gmail.com> To: Michael Paquier X-Mailer: Apple Mail (2.3864.600.51.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Jun 4, 2026, at 12:47, Michael Paquier wrote: >=20 > On Tue, Jun 02, 2026 at 09:42:23PM +0800, Chao Li wrote: >> While testing =E2=80=9Cpsql: Add variable SERVICEFILE=E2=80=9D, I = found a small >> issue where SERVICEFILE may show the wrong value. >>=20 >> While tracing the code, I noticed there is a fallback path. If the >> service file specified in the connection string does not contain the >> requested service, libpq falls back to pg_service.conf. So I tested >> the following case: >=20 > Right, as of the default file in PGSYSCONFDIR. This qualifies as an > open item for v19. >=20 >> I think the bug was actually introduced by the previous commit >> 092f3c63efc6. In parseServiceFile(), if the service file has already >> been set in the connection options, it refuses to update the value, >> so the fallback service file is not synced to the connection >> options. Then SERVICEFILE is read from the connection options, which >> still contain the original file specified on the command line. So, >> SERVICEFILE just makes the bug visible. >=20 > Yep, it looks like you are right here. It does not make sense to show > in SERVICEFILE the file that has been skipped in favor of the second > default in PGSYSCONFDIR. We need to show the latter. An \echo of=20 > SERVICEFILE is an interesting way to show your point. Why not. >=20 > Thanks for the report, will fix. > -- > Michael Thanks for confirming. I just added it to the Open Item list. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/