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 <[email protected]>
Discussion: https://postgr.es/m/[email protected]

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(+)

Reply via email to