Re: pgsql: Modularize log_connections output

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: "Daniel Westermann (DWE)" <daniel(dot)westermann(at)dbi-services(dot)com>
Cc: "pgsql-committers(at)lists(dot)postgresql(dot)org" <pgsql-committers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: Modularize log_connections output
Date: 2025-03-12 16:07:24
Message-ID: CAAKRu_ZHECM5htitn09XyssxmQF9Jkpw+7EK4g5_VqEpkfQPBg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Thanks for taking a look!

On Wed, Mar 12, 2025 at 11:50 AM Daniel Westermann (DWE)
<daniel(dot)westermann(at)dbi-services(dot)com> wrote:
>
>
> great, thanks for this. One question:
>
> >The current log_connections options are 'receipt', 'authentication', and
> >'authorization'. The empty string disables all connection logging. 'all'
> >enables all available connection logging.
>
> ... shouldn't this be added to tab completion as well?
>
> postgres=# alter system set log_connections TO DEFAULT

Because it is now a string GUC, there isn't a facility for tab
completion. Enum and boolean GUCs have a defined set of options which
can be provided as options for tab completion. Because string GUCs
don't have to have a set of defined options, they don't have tab
completion (AFAIK). For example, you couldn't have a defined set of
options for log_line_prefix.

There are a subset of the string GUCs that do have predefined options
which they validate in their check hooks. Many of these are GUCs which
can accept some combination of options -- so they don't fit well into
the enum GUC type (for example, debug_io_direct).

While writing this feature, I did consider if we should add a new GUC
type PGC_SET [1] which would back GUCs that accept any subset of a
predefined set of options. This would allow us to have tab completion.
I didn't end up doing this because I felt tab completion was the only
advantage it would provide this patch and it would be a big code
change, but it is definitely something to consider in the future.

- Melanie

[1] https://www.postgresql.org/message-id/CAAKRu_a5-7sUP%2BQ6YD5emQYS1w7ffBDUNf-NMbcxR-dpOdGehw%40mail.gmail.com

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2025-03-12 16:36:40 Re: pgsql: Modularize log_connections output
Previous Message Daniel Westermann (DWE) 2025-03-12 15:50:32 Re: pgsql: Modularize log_connections output