v1-0001-Make-sure-all-GUCs-in-.conf.sample-are-commented-.patch

application/octet-stream

Filename: v1-0001-Make-sure-all-GUCs-in-.conf.sample-are-commented-.patch
Type: application/octet-stream
Part: 0
Message: Uncommented GUC in postgresql.conf.sample

Patch

Format: format-patch
Series: patch v1-0001
Subject: Make sure all GUCs in .conf.sample are commented out
File+
src/backend/utils/misc/postgresql.conf.sample 1 1
src/test/modules/test_misc/t/003_check_guc.pl 5 1
From 9d49d5e8c863d6c9c9c89dbdde384852100df12b Mon Sep 17 00:00:00 2001
From: Daniel Gustafsson <dgustafsson@postgresql.org>
Date: Fri, 14 Nov 2025 14:48:26 +0100
Subject: [PATCH v1] Make sure all GUCs in .conf.sample are commented out

All GUCs in postgresql.conf.sample should be set to the default
value and be commented out.  Fix one instance of an uncommented
GUC and add a test to catch future omissions.

Backpatch to 18 where autovacuum_worker_slots was added.

Author: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: tbd
Discussion: https://postgr.es/m/tbd
Backpatch-through: 18
---
 src/backend/utils/misc/postgresql.conf.sample | 2 +-
 src/test/modules/test_misc/t/003_check_guc.pl | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index 08bcef50c19..bafb8459f5d 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -688,7 +688,7 @@
 
 #autovacuum = on			# Enable autovacuum subprocess?  'on'
 					# requires track_counts to also be on.
-autovacuum_worker_slots = 16	# autovacuum worker slots to allocate
+#autovacuum_worker_slots = 16	# autovacuum worker slots to allocate
 					# (change requires restart)
 #autovacuum_max_workers = 3		# max number of autovacuum subprocesses
 #autovacuum_naptime = 1min		# time between autovacuum runs
diff --git a/src/test/modules/test_misc/t/003_check_guc.pl b/src/test/modules/test_misc/t/003_check_guc.pl
index 5ae23192a47..713d244a815 100644
--- a/src/test/modules/test_misc/t/003_check_guc.pl
+++ b/src/test/modules/test_misc/t/003_check_guc.pl
@@ -56,7 +56,7 @@ while (my $line = <$contents>)
 	# file.
 	# - Valid configuration options are followed immediately by " = ",
 	# with one space before and after the equal sign.
-	if ($line =~ m/^#?([_[:alnum:]]+) = .*/)
+	if ($line =~ m/^#([_[:alnum:]]+) = .*/)
 	{
 		# Lower-case conversion matters for some of the GUCs.
 		my $param_name = lc($1);
@@ -69,7 +69,11 @@ while (my $line = <$contents>)
 		# Update the list of GUCs found in the sample file, for the
 		# follow-up tests.
 		push @gucs_in_file, $param_name;
+
+		next;
 	}
+	# Make sure each line starts with either a # or whitespace
+	ok(0, 'missing # in postgresql.conf.sample') if ($line =~ m/^[^#\s]/);
 }
 
 close $contents;
-- 
2.39.3 (Apple Git-146)