Re: Raw parse tree is not dumped to log

Chao Li <li.evan.chao@gmail.com>

From: Chao Li <li.evan.chao@gmail.com>
To: Tatsuo Ishii <ishii@postgresql.org>
Cc: pgsql-hackers@postgresql.org
Date: 2025-08-18T02:08:19Z
Lists: pgsql-hackers

Attachments

Hi Tatsuo san,

Thank you very much for your review.

On 2025/8/16 13:56, Tatsuo Ishii wrote:
> I have looked into this patch.
>
> diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
> index 20ccb2d6b54..4370e8307f2 100644
> --- a/doc/src/sgml/config.sgml
> +++ b/doc/src/sgml/config.sgml
>
> Around line 7407 of config.sgml:
>
>
> I think you should add "the resulting raw parse tree" before "the
> resulting parse tree" since the paragraph refers to the each item in
> the varlistentry above.

Updated.


> --- 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_raw_parse)
> +		elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
> +						  Debug_pretty_print);
> +
>
> I'm tempted to change "if (Debug_print_raw_parse)" to:
>
> 	if (unlikely(Debug_print_raw_parse))
>
> But as we have similar if-statements elsewhere
> (e.g. Debug_print_parse), maybe we should keep it for a separate
> commit.
>
I have added "unlikely" here. For other places, I can use a separate 
commit to add "unlikely".


Best regards,

--

Chao Li (Evan)

------------------------------
HighGo Software Inc.
https://www.highgo.com/

Commits

  1. Allow to log raw parse tree.