Uncommented GUC in postgresql.conf.sample

Started by Daniel Gustafsson5 months ago9 messageshackers
Jump to latest
#1Daniel Gustafsson
daniel@yesql.se

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

Attachments:

v1-0001-Make-sure-all-GUCs-in-.conf.sample-are-commented-.patchapplication/octet-stream; name=v1-0001-Make-sure-all-GUCs-in-.conf.sample-are-commented-.patch; x-unix-mode=0644Download+6-3
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Daniel Gustafsson (#1)
Re: Uncommented GUC in postgresql.conf.sample

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

#3Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#2)
Re: Uncommented GUC in postgresql.conf.sample

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.

#4Nathan Bossart
nathandbossart@gmail.com
In reply to: Tom Lane (#2)
Re: Uncommented GUC in postgresql.conf.sample

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

#5Andrew Dunstan
andrew@dunslane.net
In reply to: Daniel Gustafsson (#1)
Re: Uncommented GUC in postgresql.conf.sample

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

#6Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Andrew Dunstan (#5)
Re: Uncommented GUC in postgresql.conf.sample

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/

#7Nathan Bossart
nathandbossart@gmail.com
In reply to: Nathan Bossart (#4)
Re: Uncommented GUC in postgresql.conf.sample

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

#8Nathan Bossart
nathandbossart@gmail.com
In reply to: Nathan Bossart (#7)
Re: Uncommented GUC in postgresql.conf.sample

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

#9Daniel Gustafsson
daniel@yesql.se
In reply to: Andrew Dunstan (#5)
Re: Uncommented GUC in postgresql.conf.sample

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