Обсуждение: Uncommented GUC in postgresql.conf.sample

Поиск
Список
Период
Сортировка

Uncommented GUC in postgresql.conf.sample

От
Daniel Gustafsson
Дата:
When looking at the nearby suggestion to add deprecation comment for md5 in the
.conf.sample, I happened to notice that autovacuum_worker_slots isn't commented
out it the sample file.

AFAIK all GUCs in the sample file should be set to their defaults and left
commented out.  The attached does that for autovacuum_worker_slots and adds a
trivial test to test_misc to catch it (and modifies the existing test which
would've caught it). Or is there a case for leaving uncommented?

--
Daniel Gustafsson


Вложения

Re: Uncommented GUC in postgresql.conf.sample

От
Tom Lane
Дата:
Daniel Gustafsson <daniel@yesql.se> writes:
> When looking at the nearby suggestion to add deprecation comment for md5 in the
> .conf.sample, I happened to notice that autovacuum_worker_slots isn't commented
> out it the sample file.

> AFAIK all GUCs in the sample file should be set to their defaults and left
> commented out.

Yes, that is surely a bug.  It should be fixed and back-patched.

            regards, tom lane



Re: Uncommented GUC in postgresql.conf.sample

От
Bruce Momjian
Дата:
On Fri, Nov 14, 2025 at 09:44:42AM -0500, Tom Lane wrote:
> Daniel Gustafsson <daniel@yesql.se> writes:
> > When looking at the nearby suggestion to add deprecation comment for md5 in the
> > .conf.sample, I happened to notice that autovacuum_worker_slots isn't commented
> > out it the sample file.
> 
> > AFAIK all GUCs in the sample file should be set to their defaults and left
> > commented out.
> 
> Yes, that is surely a bug.  It should be fixed and back-patched.

Yes, but again, be aware that only new initdb's will see this change. 
People doing a diff against an old postgresql.conf file and a new
initdb's postgresql.conf.sample in the same major release might see this
change and think they did it.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Do not let urgent matters crowd out time for investment in the future.



Re: Uncommented GUC in postgresql.conf.sample

От
Nathan Bossart
Дата:
On Fri, Nov 14, 2025 at 09:44:42AM -0500, Tom Lane wrote:
> Daniel Gustafsson <daniel@yesql.se> writes:
>> When looking at the nearby suggestion to add deprecation comment for md5 in the
>> .conf.sample, I happened to notice that autovacuum_worker_slots isn't commented
>> out it the sample file.
> 
>> AFAIK all GUCs in the sample file should be set to their defaults and left
>> commented out.
> 
> Yes, that is surely a bug.  It should be fixed and back-patched.

That's my bad.  +1 for fixing and back-patching.

-- 
nathan



Re: Uncommented GUC in postgresql.conf.sample

От
Andrew Dunstan
Дата:


On 2025-11-14 Fr 9:06 AM, Daniel Gustafsson wrote:
When looking at the nearby suggestion to add deprecation comment for md5 in the
.conf.sample, I happened to notice that autovacuum_worker_slots isn't commented
out it the sample file.

AFAIK all GUCs in the sample file should be set to their defaults and left
commented out.  The attached does that for autovacuum_worker_slots and adds a
trivial test to test_misc to catch it (and modifies the existing test which
would've caught it). Or is there a case for leaving uncommented?


I don't think so.


+    # Make sure each line starts with either a # or whitespace
+    ok(0, 'missing # in postgresql.conf.sample') if ($line =~ m/^[^#\s]/);


This would probably be better written something like:

# non-blank lines must start with a # as the first non-blank character
unlike($line, qr/^\s*[^#\s]/, 'missing # in postgresql.conf.sample');


This will catch more error cases (e.g. a line that starts with spaces and then has a non-#). Also, "ok(0,...)" is a pattern you pretty much never want. My formulation will give better diagnostics if the test fails.

OTOH, if you want to skip a lot of ok's in the regress_log file, you can do something like:


fail("$line missing initial # in postgresql.conf.sample") if $line =~ /^\s*[^#\s]/;



cheers


andrew


--
Andrew Dunstan
EDB: https://www.enterprisedb.com

Re: Uncommented GUC in postgresql.conf.sample

От
Álvaro Herrera
Дата:
On 2025-Nov-14, Andrew Dunstan wrote:

> OTOH, if you want to skip a lot of ok's in the regress_log file, you can do
> something like:
> 
> fail("$line missing initial # in postgresql.conf.sample") if $line =~
> /^\s*[^#\s]/;

Yeah, I'm pretty confident we don't want one "ok" per correct line in
the sample file :-)

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"I'm always right, but sometimes I'm more right than other times."
                                                  (Linus Torvalds)
https://lore.kernel.org/git/Pine.LNX.4.58.0504150753440.7211@ppc970.osdl.org/



Re: Uncommented GUC in postgresql.conf.sample

От
Nathan Bossart
Дата:
On Fri, Nov 14, 2025 at 08:57:46AM -0600, Nathan Bossart wrote:
> That's my bad.  +1 for fixing and back-patching.

Since it's my bug, I'll go ahead and apply the fix.  I'll leave the new
test to you, though (unless you'd rather me take that, too).

-- 
nathan



Re: Uncommented GUC in postgresql.conf.sample

От
Nathan Bossart
Дата:
On Fri, Nov 14, 2025 at 01:01:08PM -0600, Nathan Bossart wrote:
> Since it's my bug, I'll go ahead and apply the fix.

Committed.

-- 
nathan



Re: Uncommented GUC in postgresql.conf.sample

От
Daniel Gustafsson
Дата:
> On 14 Nov 2025, at 16:20, Andrew Dunstan <andrew@dunslane.net> wrote:

> OTOH, if you want to skip a lot of ok's in the regress_log file, you can do something like:
>
> fail("$line missing initial # in postgresql.conf.sample") if $line =~ /^\s*[^#\s]/;

Went ahead with a change along this line to keep the test log noise down.
Thanks for review!

--
Daniel Gustafsson