Re: Uncommented GUC in postgresql.conf.sample - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: Uncommented GUC in postgresql.conf.sample
Date
Msg-id a31234a8-3790-424c-9d57-240caf216d65@dunslane.net
Whole thread Raw
In response to Uncommented GUC in postgresql.conf.sample  (Daniel Gustafsson <daniel@yesql.se>)
Responses Re: Uncommented GUC in postgresql.conf.sample
Re: Uncommented GUC in postgresql.conf.sample
List pgsql-hackers


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

pgsql-hackers by date:

Previous
From: Mircea Cadariu
Date:
Subject: Re: pgsql: Drop unnamed portal immediately after execution to completion
Next
From: Boris Mironov
Date:
Subject: Re: Idea to enhance pgbench by more modes to generate data (multi-TXNs, UNNEST, COPY BINARY)