Re: Add ldapservice connection parameter

From: Steven Niu <niushiji(at)gmail(dot)com>
To: Andrew Jackson <andrewjackson947(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add ldapservice connection parameter
Date: 2026-01-12 06:08:17
Message-ID: MN2PR15MB30213505F098E47A780B6EF6A781A@MN2PR15MB3021.namprd15.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

From: Andrew Jackson <andrewjackson947(at)gmail(dot)com>
Sent: Monday, January 12, 2026 10:50
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Add ldapservice connection parameter

Currently there exists, only in pg_service.conf, the ability to look
up connection parameters from a centralized LDAP server. This patch
expands the usability of this by allowing it to be specified directly in
a connection string instead of only in a pg_service.conf file.

Hi, Andrew,

I have one question, if LDAP has higher priority, we should put the its code to be before "service" logic, like:

+ if (ldapservice != NULL && strncmp(ldapservice, "ldap", 4) == 0) {
+ if (!ldapServiceLookup(ldapservice, options, errorMessage))
+ return 0; // return if LDAP processing succeeds.

/*
* We have to special-case the environment variable PGSERVICE here, since
* this is and should be called before inserting environment defaults for
* other connection options.
*/
if (service == NULL)
service = getenv("PGSERVICE");

/* If no service name given, nothing to do */
if (service == NULL)
return 0;

This will be consistent with how PG processes the pg_service.conf file.
See https://www.postgresql.org/docs/18/libpq-ldap.html
"Processing of pg_service.conf is terminated after a successful LDAP lookup, but is continued if the LDAP server cannot be contacted."

Thanks,
Steven

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2026-01-12 06:34:04 Re: Proposal: Conflict log history table for Logical Replication
Previous Message shveta malik 2026-01-12 06:01:02 Re: [Patch] add new parameter to pg_replication_origin_session_setup