On Mon, Feb 06, 2023 at 04:23:02PM +0900, Michael Paquier wrote:
> On top of that, I have noticed an extra combination that would not
> make sense and that could be checked with the SQL queries:
> GUC_DISALLOW_IN_FILE implies GUC_NOT_IN_SAMPLE.  The opposite may not
> be true, though, as some developer GUCs are marked as
> GUC_NOT_IN_SAMPLE but they are allowed in a file.  The only exception
> to that currently is config_file.  It is just a special case whose
> value is enforced at startup and it can be passed down as an option
> switch via the postgres binary, still it seems like it would be better
> to also mark it as GUC_NOT_IN_SAMPLE?  This is done in 0002, only for
> HEAD, as that would be a new check.

0001 has been applied to clean up the existing situation.  Remains
0002, that I am letting sleep to see if there's interest for it, or
perhaps more ideas around it.
--
Michael
From ab73606a127fca6199baef6e92a6c621a49bf070 Mon Sep 17 00:00:00 2001
From: Michael Paquier <mich...@paquier.xyz>
Date: Mon, 6 Feb 2023 16:17:08 +0900
Subject: [PATCH v3 2/2] Add new GUC test checking that DISALLOW_IN_FILE =>
 NOT_IN_SAMPLE

---
 src/backend/utils/misc/guc_tables.c | 2 +-
 src/test/regress/expected/guc.out   | 9 +++++++++
 src/test/regress/sql/guc.sql        | 5 +++++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index b46e3b8c55..fcc0aacfac 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -4291,7 +4291,7 @@ struct config_string ConfigureNamesString[] =
 		{"config_file", PGC_POSTMASTER, FILE_LOCATIONS,
 			gettext_noop("Sets the server's main configuration file."),
 			NULL,
-			GUC_DISALLOW_IN_FILE | GUC_SUPERUSER_ONLY
+			GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE | GUC_SUPERUSER_ONLY
 		},
 		&ConfigFileName,
 		NULL,
diff --git a/src/test/regress/expected/guc.out b/src/test/regress/expected/guc.out
index 127c953297..c7170d0446 100644
--- a/src/test/regress/expected/guc.out
+++ b/src/test/regress/expected/guc.out
@@ -838,6 +838,7 @@ SELECT pg_settings_get_flags('does_not_exist');
 (1 row)
 
 CREATE TABLE tab_settings_flags AS SELECT name, category,
+    'DISALLOW_IN_FILE' = ANY(flags) AS disallow_in_file,
     'EXPLAIN'          = ANY(flags) AS explain,
     'NO_RESET'         = ANY(flags) AS no_reset,
     'NO_RESET_ALL'     = ANY(flags) AS no_reset_all,
@@ -887,4 +888,12 @@ SELECT name FROM tab_settings_flags
 ------
 (0 rows)
 
+-- DISALLOW_IN_FILE implies NOT_IN_SAMPLE.
+SELECT name FROM tab_settings_flags
+  WHERE disallow_in_file AND NOT not_in_sample
+  ORDER BY 1;
+ name 
+------
+(0 rows)
+
 DROP TABLE tab_settings_flags;
diff --git a/src/test/regress/sql/guc.sql b/src/test/regress/sql/guc.sql
index dc79761955..37982008b0 100644
--- a/src/test/regress/sql/guc.sql
+++ b/src/test/regress/sql/guc.sql
@@ -323,6 +323,7 @@ set default_with_oids to t;
 SELECT pg_settings_get_flags(NULL);
 SELECT pg_settings_get_flags('does_not_exist');
 CREATE TABLE tab_settings_flags AS SELECT name, category,
+    'DISALLOW_IN_FILE' = ANY(flags) AS disallow_in_file,
     'EXPLAIN'          = ANY(flags) AS explain,
     'NO_RESET'         = ANY(flags) AS no_reset,
     'NO_RESET_ALL'     = ANY(flags) AS no_reset_all,
@@ -352,4 +353,8 @@ SELECT name FROM tab_settings_flags
 SELECT name FROM tab_settings_flags
   WHERE no_reset AND NOT no_reset_all
   ORDER BY 1;
+-- DISALLOW_IN_FILE implies NOT_IN_SAMPLE.
+SELECT name FROM tab_settings_flags
+  WHERE disallow_in_file AND NOT not_in_sample
+  ORDER BY 1;
 DROP TABLE tab_settings_flags;
-- 
2.39.1

Attachment: signature.asc
Description: PGP signature

Reply via email to