pgsql: libpq: Add "servicefile" connection option

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: libpq: Add "servicefile" connection option
Date: 2025-07-13 07:53:34
Message-ID: E1uarWg-0063jR-25@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

libpq: Add "servicefile" connection option

This commit adds the possibility to specify a service file in a
connection string, using a new option called "servicefile". The parsing
of the service file happens so as things are done in this order of
priority:
- The servicefile connection option.
- Environment variable PGSERVICEFILE.
- Default path, depending on the HOME environment.

Note that in the last default case, we need to fill in "servicefile" for
the connection's PQconninfoOption to let clients know which service file
has been used for the connection. Some TAP tests are added, with a few
tweaks required for Windows when using URIs or connection option values,
for the location paths.

Author: Torsten Förtsch <tfoertsch123(at)gmail(dot)com>
Co-authored-by: Ryo Kanbayashi <kanbayashi(dot)dev(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAKkG4_nCjx3a_F3gyXHSPWxD8Sd8URaM89wey7fG_9g7KBkOCQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/092f3c63efc6a6ce235cfbed45bd05b739de8540

Modified Files
--------------
doc/src/sgml/libpq.sgml | 24 +++++++----
src/interfaces/libpq/fe-connect.c | 54 ++++++++++++++++++++++--
src/interfaces/libpq/libpq-int.h | 2 +
src/interfaces/libpq/t/006_service.pl | 79 ++++++++++++++++++++++++++++++++++-
4 files changed, 146 insertions(+), 13 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2025-07-13 17:52:41 pgsql: In username-map substitution, cope with more than one \1.
Previous Message Michael Paquier 2025-07-13 02:21:20 Re: pgsql: injection_points: Add injection_points_list()