Re: [Util] Warn and Remove Invalid GUCs - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: [Util] Warn and Remove Invalid GUCs
Date
Msg-id CAKFQuwaJbu8p6d1x-xXSMy5bfv1xL0B_U4mQdXQsfWDe9fS--w@mail.gmail.com
Whole thread Raw
In response to Re: [Util] Warn and Remove Invalid GUCs  (Greg Sabino Mullane <htamfids@gmail.com>)
List pgsql-hackers
On Thu, May 22, 2025 at 1:20 PM Greg Sabino Mullane <htamfids@gmail.com> wrote:
On Thu, May 22, 2025 at 12:45 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "lpgsql.bogus = 1" .

[ shrug... ] How do you know that's a bogus prefix?  It could perfectly well be a fully valid setting for an extension that
the installation doesn't choose to preload.

Well, we do have ways to view all *potential* extensions. I find myself more sympathetic to the OP than the others here, as I think it's a good idea to display a warning for a potentially misspelled GUC prefix (but do nothing else - certainly not remove it!). Will such a warning be seen? Perhaps not, but that's a risk any warning message has to face. And obviously there could be false positives if an extension decides to name their GUCs something other than pg_available_extensions()->name but hopefully that's a rare case (and shame on them if so.)

We don't have proper server variables for applications and non-extensions to use in things like RLS so choosing a non-extension-registered prefix is a perfectly valid thing to do.  Maybe it would seldom be done in the config file, and be nominally reserved for SET/set_config, but it is still valid.

IMO, an improvement in this area would revolve around not making people type out setting names manually at all.  If they don't type them they cannot typo them.  Again, this also only improves the config file setup, but why not add pre-made configuration samples in a subdirectory that people can either copy/paste individually; or setup a default include_dir directive for contrib and people can place the "sample" files into the live "contrib.d" directory making them no longer just samples but live configuration that can then be edited without having to type names - just remove comment symbols (maybe) and change values.

David J.

pgsql-hackers by date:

Previous
From: Melanie Plageman
Date:
Subject: Re: Log connection establishment timings
Next
From: "David G. Johnston"
Date:
Subject: Re: [Util] Warn and Remove Invalid GUCs