From: | Tender Wang <tndrwang(at)gmail(dot)com> |
---|---|
To: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Raw parse tree is not dumped to log |
Date: | 2025-08-01 06:24:33 |
Message-ID: | CAHewXNk2gKMDWZnqcWM7tYqsP+vZva1oy_K=QOuXNPK3GwMGTA@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Chao Li <li(dot)evan(dot)chao(at)gmail(dot)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.
[1] https://github.com/tvondra/gdbpg
>
> 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
From | Date | Subject | |
---|---|---|---|
Next Message | shveta malik | 2025-08-01 06:32:06 | Re: Improve pg_sync_replication_slots() to wait for primary to advance |
Previous Message | Chao Li | 2025-08-01 06:16:01 | When creating index, why pointing to old version of tuple |