Re: [PATCH] PGSERVICEFILE as part of a normal connection string

Ryo Kanbayashi <kanbayashi.dev@gmail.com>

From: Ryo Kanbayashi <kanbayashi.dev@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Torsten Förtsch <tfoertsch123@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2025-06-15T12:02:31Z
Lists: pgsql-hackers

Attachments

On Tue, Jun 10, 2025 at 4:30 PM Michael Paquier <michael@paquier.xyz> wrote:
>
> On Mon, Jun 09, 2025 at 10:25:26PM +0900, Ryo Kanbayashi wrote:
> >> This could be a patch built on top of the introduction of the core API
> >> for the service file.
> >
> > :)
>
> >> - Perhaps a shortcut for PROMPT?
> >
> > I will kindly take a rain check on this one :)
>
> I am not sure to understand what you mean here, but let's discard this
> idea as it is also possible to use %:name: in a psql's prompt with the
> new variable you are introducing.

OK ^^;

> +        Defaults to <filename>~/.pg_service.conf</filename>, or
> +        <filename>%APPDATA%\postgresql\.pg_service.conf</filename> on
> +        Microsoft Windows.
>
> I don't think that this sentence is true.  The parameter does not
> default to these values.  The connection logic would fall back to
> these files if the parameter is not defined, and the parameter knows
> nothing about them.

OK.
I removed the sentence.

> --- a/src/interfaces/libpq/exports.txt
> +++ b/src/interfaces/libpq/exports.txt
> @@ -206,8 +206,9 @@ PQsocketPoll              203
>  PQsetChunkedRowsMode      204
>  PQgetCurrentTimeUSec      205
>  PQservice                 206
> -PQsetAuthDataHook         207
> -PQgetAuthDataHook         208
> -PQdefaultAuthDataHook     209
> -PQfullProtocolVersion     210
> -appendPQExpBufferVA       211
> +PQserviceFile             207
> +PQsetAuthDataHook         208
> +PQgetAuthDataHook         209
> +PQdefaultAuthDataHook     210
> +PQfullProtocolVersion     211
> +appendPQExpBufferVA       212
>
> The new one goes to the bottom AFAIK.

OK.

> The patch can be split into multiple pieces:
> - Core libpq changes with API and tests.
> - psql changes.

OK.
I splited our patch to above 2 pieces.

> +# "service" param included service file (invalid)
> +# including contents of pg_service_valid.conf and a nested service option
>
> "Service file with service defined (invalid)."
>
> +# "servicefile" param included service file (invalid)
> +# including contents of pg_service_valid.conf and a nested servicefile option
>
> "Service file with servicefile defined (invalid)."

OK

Thanks for review :)

---
Great Regards,
Ryo Kanbayashi

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. psql: Add variable SERVICEFILE

  2. libpq: Add "servicefile" connection option

  3. libpq: Add TAP test for nested service file

  4. libpq: Fix some issues in TAP tests for service files

  5. docs: Fix column count attribute in table

  6. libpq: Add TAP tests for service files and names