Re: Raw parse tree is not dumped to log
От | Tender Wang |
---|---|
Тема | Re: Raw parse tree is not dumped to log |
Дата | |
Msg-id | CAHewXNk2gKMDWZnqcWM7tYqsP+vZva1oy_K=QOuXNPK3GwMGTA@mail.gmail.com обсуждение исходный текст |
Ответ на | Raw parse tree is not dumped to log (Chao Li <li.evan.chao@gmail.com>) |
Список | pgsql-hackers |
Chao Li <li.evan.chao@gmail.com> 于2025年8月1日周五 13:44写道:
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:
When I debug the code, I care more about Query structure, debug_print_parse is enough for me.
In the debugger, various tools are available, including nodeToString() and Python scripts.
I usually use the gdbpg tools in [1]. But it was too old. It can't support the newest version well.
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"?
If you want to add this, I prefer to "debug_print_raw_parse". You should also add documentation to explain this new GUC.
Thanks,
Tender Wang
В списке pgsql-hackers по дате отправления: