pgsql: libpq: Fix "servicefile" after fallback to system service file

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: libpq: Fix "servicefile" after fallback to system service file
Date: 2026-06-04 06:21:21
Message-ID: E1wV1SD-000zyg-2x@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

libpq: Fix "servicefile" after fallback to system service file

When "servicefile" is specified in a connection string but the requested
service is not found in this file, libpq falls back to a default file,
pg_service.conf in PGSYSCONFDIR. The "servicefile" option was missing
an update in this case, causing an incorrect value to be reported,
impacting SERVICEFILE in psql, for example.

An extra update of the option is added in this commit, based on the
actual file where the service name has been found. A test is added to
cover this problem.

Oversight in 092f3c63efc6.

Author: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Discussion: https://postgr.es/m/59DD1652-4EB5-449B-8DE3-959F06561A96@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/90354030b8fceecef9a1908fdefcccf0e02823fb

Modified Files
--------------
src/interfaces/libpq/fe-connect.c | 12 ++++++++++++
src/interfaces/libpq/t/006_service.pl | 8 ++++++++
2 files changed, 20 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2026-06-04 09:17:40 pgsql: Fix cross-leftover pollution in FOR PORTION OF insert triggers
Previous Message Bruce Momjian 2026-06-03 18:21:26 pgsql: doc PG 19 relnotes: merge pg_upgrade LO metadata items