Hi,
When "debug_print_parse" is "on", only the Query structure tree is dumped, the raw parse tree is not dumped to log. In some cases, viewing raw parse trees are also helpful. It is very hard to view a tree by watching variables in a debugger, so I added the following code in my local:
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 0cecd464902..ff456d1d94e 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -649,6 +649,10 @@ pg_parse_query(const char *query_string)
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
+ if (Debug_print_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
return raw_parsetree_list;
}
Before submitting this trivial patch, I still want to confirm with the community if it's intentional to not dump raw parse tree? If we really don't want to dump raw parse tree again "debug_print_parse", are you ok to add a new option "debug_print_raw_parse"?
Chao Li (Evan)
------------------------------