Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5057010

Browse files
Jan WieckJan Wieck
Jan Wieck
authored and
Jan Wieck
committed
Changed debug options:
-d4 now prints compressed trees from nodeToString()-d5 prints pretty trees via nodeDisplay()new pg_options: pretty_plan, pretty_parse, pretty_rewrittenJan
1 parent1ba362f commit5057010

File tree

3 files changed

+59
-19
lines changed

3 files changed

+59
-19
lines changed

‎src/backend/tcop/postgres.c

Lines changed: 53 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.111 1999/05/09 23:31:47 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.112 1999/05/11 09:06:31 wieck Exp $
1111
*
1212
* NOTES
1313
* this is the "main" module of the postgres backend and
@@ -103,11 +103,15 @@
103103
#defineDebugPrintQuerypg_options[TRACE_QUERY]
104104
#defineDebugPrintPlanpg_options[TRACE_PLAN]
105105
#defineDebugPrintParsepg_options[TRACE_PARSE]
106+
#defineDebugPrintRewrittenParsetree \
107+
pg_options[TRACE_REWRITTEN]
108+
#defineDebugPPrintPlanpg_options[TRACE_PRETTY_PLAN]
109+
#defineDebugPPrintParsepg_options[TRACE_PRETTY_PARSE]
110+
#defineDebugPPrintRewrittenParsetree \
111+
pg_options[TRACE_PRETTY_REWRITTEN]
106112
#defineShowParserStatspg_options[TRACE_PARSERSTATS]
107113
#defineShowPlannerStatspg_options[TRACE_PLANNERSTATS]
108114
#defineShowExecutorStatspg_options[TRACE_EXECUTORSTATS]
109-
#defineDebugPrintRewrittenParsetree \
110-
pg_options[TRACE_REWRITTEN]
111115
#ifdefLOCK_MGR_DEBUG
112116
#defineLockDebugpg_options[TRACE_LOCKS]
113117
#endif
@@ -474,10 +478,15 @@ pg_parse_and_plan(char *query_string,/* string to execute */
474478
{
475479
querytree=querytree_list->qtrees[i];
476480

477-
if (DebugPrintParse)
481+
if (DebugPrintParse||DebugPPrintParse)
478482
{
479-
TPRINTF(TRACE_PARSE,"parser outputs:");
480-
nodeDisplay(querytree);
483+
if (DebugPPrintParse) {
484+
TPRINTF(TRACE_PRETTY_PARSE,"parser outputs:");
485+
nodeDisplay(querytree);
486+
}else {
487+
TPRINTF(TRACE_PARSE,"parser outputs:");
488+
printf("\n%s\n\n",nodeToString(querytree));
489+
}
481490
}
482491

483492
/* don't rewrite utilites, just dump 'em into new_list */
@@ -545,14 +554,23 @@ pg_parse_and_plan(char *query_string,/* string to execute */
545554
}
546555
}
547556

548-
if (DebugPrintRewrittenParsetree)
557+
if (DebugPrintRewrittenParsetree||DebugPPrintRewrittenParsetree)
549558
{
550-
TPRINTF(TRACE_REWRITTEN,"after rewriting:");
559+
if (DebugPPrintRewrittenParsetree) {
560+
TPRINTF(TRACE_PRETTY_REWRITTEN,"after rewriting:");
551561

552-
for (i=0;i<querytree_list->len;i++)
553-
{
554-
nodeDisplay(querytree_list->qtrees[i]);
555-
printf("\n");
562+
for (i=0;i<querytree_list->len;i++)
563+
{
564+
nodeDisplay(querytree_list->qtrees[i]);
565+
printf("\n");
566+
}
567+
}else {
568+
TPRINTF(TRACE_REWRITTEN,"after rewriting:");
569+
570+
for (i=0;i<querytree_list->len;i++)
571+
{
572+
printf("\n%s\n\n",nodeToString(querytree_list->qtrees[i]));
573+
}
556574
}
557575
}
558576

@@ -608,10 +626,15 @@ pg_parse_and_plan(char *query_string,/* string to execute */
608626
*also for queries in functions.DZ - 27-8-1996
609627
* ----------------
610628
*/
611-
if (DebugPrintPlan)
629+
if (DebugPrintPlan||DebugPPrintPlan)
612630
{
613-
TPRINTF(TRACE_PLAN,"plan:");
614-
nodeDisplay(plan);
631+
if (DebugPPrintPlan) {
632+
TPRINTF(TRACE_PRETTY_PLAN,"plan:");
633+
nodeDisplay(plan);
634+
}else {
635+
TPRINTF(TRACE_PLAN,"plan:");
636+
printf("\n%s\n\n",nodeToString(plan));
637+
}
615638
}
616639
#endif
617640
}
@@ -747,10 +770,15 @@ pg_exec_query_dest(char *query_string,/* string to execute */
747770
*print plan if debugging
748771
* ----------------
749772
*/
750-
if (DebugPrintPlan)
773+
if (DebugPrintPlan||DebugPPrintPlan)
751774
{
752-
TPRINTF(TRACE_PLAN,"plan:");
753-
nodeDisplay(plan);
775+
if (DebugPPrintPlan) {
776+
TPRINTF(TRACE_PRETTY_PLAN,"plan:");
777+
nodeDisplay(plan);
778+
}else {
779+
TPRINTF(TRACE_PLAN,"plan:");
780+
printf("\n%s\n\n",nodeToString(plan));
781+
}
754782
}
755783
#endif
756784

@@ -1047,6 +1075,12 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
10471075
DebugPrintPlan= true;
10481076
DebugPrintRewrittenParsetree= true;
10491077
}
1078+
if (DebugLvl >=5)
1079+
{
1080+
DebugPPrintParse= true;
1081+
DebugPPrintPlan= true;
1082+
DebugPPrintRewrittenParsetree= true;
1083+
}
10501084
break;
10511085

10521086
case'E':
@@ -1510,7 +1544,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
15101544
if (!IsUnderPostmaster)
15111545
{
15121546
puts("\nPOSTGRES backend interactive interface ");
1513-
puts("$Revision: 1.111 $ $Date: 1999/05/09 23:31:47 $\n");
1547+
puts("$Revision: 1.112 $ $Date: 1999/05/11 09:06:31 $\n");
15141548
}
15151549

15161550
/* ----------------

‎src/backend/utils/misc/trace.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ static char *opt_names[] = {
5353
"plan",
5454
"parse",
5555
"rewritten",
56+
"pretty_plan",
57+
"pretty_parse",
58+
"pretty_rewritten",
5659
"parserstats",
5760
"plannerstats",
5861
"executorstats",

‎src/include/utils/trace.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ enum pg_option_enum
4949
TRACE_PLAN,
5050
TRACE_PARSE,
5151
TRACE_REWRITTEN,
52+
TRACE_PRETTY_PLAN,/* indented multiline versions of trees */
53+
TRACE_PRETTY_PARSE,
54+
TRACE_PRETTY_REWRITTEN,
5255
TRACE_PARSERSTATS,
5356
TRACE_PLANNERSTATS,
5457
TRACE_EXECUTORSTATS,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp