diff --git a/src/common/backend/nodes/print.cpp b/src/common/backend/nodes/print.cpp index 069bd8bcd..e58e0a3b3 100644 --- a/src/common/backend/nodes/print.cpp +++ b/src/common/backend/nodes/print.cpp @@ -242,7 +242,7 @@ char* pretty_format_node_dump(const char* dump) */ void format_debug_print_plan(char *force_line, int index, int length) { - if (u_sess->attr.attr_sql.Debug_print_plan) { + if (u_sess->attr.attr_sql.Debug_print_plan && u_sess->attr.attr_common.log_min_messages <= LOG) { char *result = NULL; char *encrypt = NULL; char *decrypt = NULL; diff --git a/src/gausskernel/process/tcop/postgres.cpp b/src/gausskernel/process/tcop/postgres.cpp index 90bccae11..65cfd7275 100755 --- a/src/gausskernel/process/tcop/postgres.cpp +++ b/src/gausskernel/process/tcop/postgres.cpp @@ -1107,7 +1107,7 @@ static List* pg_rewrite_query(Query* query) List* querytree_list = NIL; PGSTAT_INIT_TIME_RECORD(); - if (u_sess->attr.attr_sql.Debug_print_parse) + if (u_sess->attr.attr_sql.Debug_print_parse && u_sess->attr.attr_common.log_min_messages <= LOG) elog_node_display(LOG, "parse tree", query, u_sess->attr.attr_sql.Debug_pretty_print); if (u_sess->attr.attr_common.log_parser_stats) @@ -1221,7 +1221,7 @@ static List* pg_rewrite_query(Query* query) } #endif - if (u_sess->attr.attr_sql.Debug_print_rewritten) + if (u_sess->attr.attr_sql.Debug_print_rewritten && u_sess->attr.attr_common.log_min_messages <= LOG) elog_node_display(LOG, "rewritten parse tree", querytree_list, u_sess->attr.attr_sql.Debug_pretty_print); return querytree_list; @@ -1317,7 +1317,7 @@ PlannedStmt* pg_plan_query(Query* querytree, int cursorOptions, ParamListInfo bo /* * Print plan if debugging. */ - if (u_sess->attr.attr_sql.Debug_print_plan) + if (u_sess->attr.attr_sql.Debug_print_plan && u_sess->attr.attr_common.log_min_messages <= LOG) elog_node_display(LOG, "plan", plan, u_sess->attr.attr_sql.Debug_pretty_print); if (!underExplain)