Thread
-
Re: Uncommented GUC in postgresql.conf.sample
Andrew Dunstan <andrew@dunslane.net> — 2025-11-14T15:20:41Z
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