Raw parse tree is not dumped to log

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Raw parse tree is not dumped to log
Date: 2025-08-01 05:43:51
Message-ID: CAEoWx2mcO0Gpo4vd8kPMAFWeJLSp0MeUUnaLdE1x0tSVd-VzUw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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)
------------------------------
HighGo Software Inc.
https://www.highgo.com/

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2025-08-01 05:44:22 Re: Dropping publication breaks logical replication
Previous Message Ashutosh Bapat 2025-08-01 05:24:41 Dropping publication breaks logical replication