aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/misc/guc_tables.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2024-08-01 09:37:44 +0200
committerPeter Eisentraut <peter@eisentraut.org>2024-08-01 10:09:18 +0200
commita292c98d62ddc0ad681f772ab91bf68ee399cb4b (patch)
tree331bcd4483c3f0b006b29e1fa094396fc599855a /src/backend/utils/misc/guc_tables.c
parenta67da49e1d983fc7662f7854e9eec5debbd14446 (diff)
downloadpostgresql-a292c98d62ddc0ad681f772ab91bf68ee399cb4b.tar.gz
postgresql-a292c98d62ddc0ad681f772ab91bf68ee399cb4b.zip
Convert node test compile-time settings into run-time parameters
This converts COPY_PARSE_PLAN_TREES WRITE_READ_PARSE_PLAN_TREES RAW_EXPRESSION_COVERAGE_TEST into run-time parameters debug_copy_parse_plan_trees debug_write_read_parse_plan_trees debug_raw_expression_coverage_test They can be activated for tests using PG_TEST_INITDB_EXTRA_OPTS. The compile-time symbols are kept for build farm compatibility, but they now just determine the default value of the run-time settings. Furthermore, support for these settings is not compiled in at all unless assertions are enabled, or the new symbol DEBUG_NODE_TESTS_ENABLED is defined at compile time, or any of the legacy compile-time setting symbols are defined. So there is no run-time overhead in production builds. (This is similar to the handling of DISCARD_CACHES_ENABLED.) Discussion: https://www.postgresql.org/message-id/flat/30747bd8-f51e-4e0c-a310-a6e2c37ec8aa%40eisentraut.org
Diffstat (limited to 'src/backend/utils/misc/guc_tables.c')
-rw-r--r--src/backend/utils/misc/guc_tables.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index 6a623f5f342..74a38bb2458 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -493,6 +493,12 @@ bool Debug_print_parse = false;
bool Debug_print_rewritten = false;
bool Debug_pretty_print = true;
+#ifdef DEBUG_NODE_TESTS_ENABLED
+bool Debug_copy_parse_plan_trees;
+bool Debug_write_read_parse_plan_trees;
+bool Debug_raw_expression_coverage_test;
+#endif
+
bool log_parser_stats = false;
bool log_planner_stats = false;
bool log_executor_stats = false;
@@ -1294,6 +1300,59 @@ struct config_bool ConfigureNamesBool[] =
false,
NULL, NULL, NULL
},
+#ifdef DEBUG_NODE_TESTS_ENABLED
+ {
+ {"debug_copy_parse_plan_trees", PGC_SUSET, DEVELOPER_OPTIONS,
+ gettext_noop("Set this to force all parse and plan trees to be passed through "
+ "copyObject(), to facilitate catching errors and omissions in "
+ "copyObject()."),
+ NULL,
+ GUC_NOT_IN_SAMPLE
+ },
+ &Debug_copy_parse_plan_trees,
+/* support for legacy compile-time setting */
+#ifdef COPY_PARSE_PLAN_TREES
+ true,
+#else
+ false,
+#endif
+ NULL, NULL, NULL
+ },
+ {
+ {"debug_write_read_parse_plan_trees", PGC_SUSET, DEVELOPER_OPTIONS,
+ gettext_noop("Set this to force all parse and plan trees to be passed through "
+ "outfuncs.c/readfuncs.c, to facilitate catching errors and omissions in "
+ "those modules."),
+ NULL,
+ GUC_NOT_IN_SAMPLE
+ },
+ &Debug_write_read_parse_plan_trees,
+/* support for legacy compile-time setting */
+#ifdef WRITE_READ_PARSE_PLAN_TREES
+ true,
+#else
+ false,
+#endif
+ NULL, NULL, NULL
+ },
+ {
+ {"debug_raw_expression_coverage_test", PGC_SUSET, DEVELOPER_OPTIONS,
+ gettext_noop("Set this to force all raw parse trees for DML statements to be scanned "
+ "by raw_expression_tree_walker(), to facilitate catching errors and "
+ "omissions in that function."),
+ NULL,
+ GUC_NOT_IN_SAMPLE
+ },
+ &Debug_raw_expression_coverage_test,
+/* support for legacy compile-time setting */
+#ifdef RAW_EXPRESSION_COVERAGE_TEST
+ true,
+#else
+ false,
+#endif
+ NULL, NULL, NULL
+ },
+#endif /* DEBUG_NODE_TESTS_ENABLED */
{
{"debug_print_parse", PGC_USERSET, LOGGING_WHAT,
gettext_noop("Logs each query's parse tree."),