Re: Uncommented GUC in postgresql.conf.sample

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Uncommented GUC in postgresql.conf.sample
Date: 2025-11-14 15:20:41
Message-ID: a31234a8-3790-424c-9d57-240caf216d65@dunslane.net
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2025-11-14 15:30:33 Re: Uncommented GUC in postgresql.conf.sample
Previous Message Mircea Cadariu 2025-11-14 15:10:32 Re: pgsql: Drop unnamed portal immediately after execution to completion