aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r--src/backend/tcop/postgres.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 2b393fd0430..4e4d06ba3a8 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -622,8 +622,10 @@ pg_parse_query(const char *query_string)
if (log_parser_stats)
ShowUsage("PARSER STATISTICS");
-#ifdef COPY_PARSE_PLAN_TREES
+#ifdef DEBUG_NODE_TESTS_ENABLED
+
/* Optional debugging check: pass raw parsetrees through copyObject() */
+ if (Debug_copy_parse_plan_trees)
{
List *new_list = copyObject(raw_parsetree_list);
@@ -633,13 +635,12 @@ pg_parse_query(const char *query_string)
else
raw_parsetree_list = new_list;
}
-#endif
/*
* Optional debugging check: pass raw parsetrees through
* outfuncs/readfuncs
*/
-#ifdef WRITE_READ_PARSE_PLAN_TREES
+ if (Debug_write_read_parse_plan_trees)
{
char *str = nodeToStringWithLocations(raw_parsetree_list);
List *new_list = stringToNodeWithLocations(str);
@@ -651,7 +652,8 @@ pg_parse_query(const char *query_string)
else
raw_parsetree_list = new_list;
}
-#endif
+
+#endif /* DEBUG_NODE_TESTS_ENABLED */
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
@@ -826,8 +828,10 @@ pg_rewrite_query(Query *query)
if (log_parser_stats)
ShowUsage("REWRITER STATISTICS");
-#ifdef COPY_PARSE_PLAN_TREES
+#ifdef DEBUG_NODE_TESTS_ENABLED
+
/* Optional debugging check: pass querytree through copyObject() */
+ if (Debug_copy_parse_plan_trees)
{
List *new_list;
@@ -838,10 +842,9 @@ pg_rewrite_query(Query *query)
else
querytree_list = new_list;
}
-#endif
-#ifdef WRITE_READ_PARSE_PLAN_TREES
/* Optional debugging check: pass querytree through outfuncs/readfuncs */
+ if (Debug_write_read_parse_plan_trees)
{
List *new_list = NIL;
ListCell *lc;
@@ -868,7 +871,8 @@ pg_rewrite_query(Query *query)
else
querytree_list = new_list;
}
-#endif
+
+#endif /* DEBUG_NODE_TESTS_ENABLED */
if (Debug_print_rewritten)
elog_node_display(LOG, "rewritten parse tree", querytree_list,
@@ -906,8 +910,10 @@ pg_plan_query(Query *querytree, const char *query_string, int cursorOptions,
if (log_planner_stats)
ShowUsage("PLANNER STATISTICS");
-#ifdef COPY_PARSE_PLAN_TREES
+#ifdef DEBUG_NODE_TESTS_ENABLED
+
/* Optional debugging check: pass plan tree through copyObject() */
+ if (Debug_copy_parse_plan_trees)
{
PlannedStmt *new_plan = copyObject(plan);
@@ -923,10 +929,9 @@ pg_plan_query(Query *querytree, const char *query_string, int cursorOptions,
#endif
plan = new_plan;
}
-#endif
-#ifdef WRITE_READ_PARSE_PLAN_TREES
/* Optional debugging check: pass plan tree through outfuncs/readfuncs */
+ if (Debug_write_read_parse_plan_trees)
{
char *str;
PlannedStmt *new_plan;
@@ -947,7 +952,8 @@ pg_plan_query(Query *querytree, const char *query_string, int cursorOptions,
#endif
plan = new_plan;
}
-#endif
+
+#endif /* DEBUG_NODE_TESTS_ENABLED */
/*
* Print plan if debugging.