Re: [PATCH] PGSERVICEFILE as part of a normal connection string
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Ryo Kanbayashi <kanbayashi.dev@gmail.com>
Cc: Torsten Förtsch <tfoertsch123@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2025-07-10T05:21:38Z
Lists: pgsql-hackers
Attachments
- v13-0001-libpq-Add-servicefile-connection-option.patch (text/x-diff) patch v13-0001
- v13-0002-psql-Add-SERVICEFILE-variable.patch (text/x-diff) patch v13-0002
On Wed, Jul 09, 2025 at 04:31:31PM +0900, Michael Paquier wrote:
> Attached is a rebased version of the rest, with the recent stanza
> related to fef6da9e9c87 taken into account. 0002 still has a change
> that should be in 0001: I have not really touched the structure of the
> two remaining patches yet.
+ /* If service was found successfully, set servicefile option if not already set */
+ if (*group_found && result == 0)
+ {
+ for (i = 0; options[i].keyword; i++)
+ {
+ if (strcmp(options[i].keyword, "servicefile") != 0)
+ continue;
+
+ if (options[i].val != NULL)
+ break;
+
+ options[i].val = strdup(serviceFile);
+ if (options[i].val == NULL)
+ {
+ libpq_append_error(errorMessage, "out of memory");
+ return 3;
+ }
+ break;
There was a bug here: if the new value cannot be strdup'd, we would
miss the fclose() of the exit path, so this cannot return directly.
It is possible to set the status to a new value instead, then break.
After that, I have applied a few cosmetic tweaks here and there, and
attached is what I have staged for commit, minus proper commit
messages. The new TAP tests have some WIN32-specific things, and I
won't be able to look at the buildfarm if I were to apply things
today, so this will have to wait until the beginning of next week.
The CI is happy with it, so at least we are one checkbox down.
--
Michael
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
psql: Add variable SERVICEFILE
- 6b1c4d326b06 19 (unreleased) landed
-
libpq: Add "servicefile" connection option
- 092f3c63efc6 19 (unreleased) landed
-
libpq: Add TAP test for nested service file
- df286a5b830a 19 (unreleased) landed
-
libpq: Fix some issues in TAP tests for service files
- 2c7bd2ba507e 18.0 landed
-
docs: Fix column count attribute in table
- ea3f9b6da34a 18.0 cited
-
libpq: Add TAP tests for service files and names
- 72c2f36d5727 18.0 landed