|
7 | 7 | *
|
8 | 8 | *
|
9 | 9 | * 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 $ |
11 | 11 | *
|
12 | 12 | * NOTES
|
13 | 13 | * this is the "main" module of the postgres backend and
|
|
103 | 103 | #define DebugPrintQuery pg_options[TRACE_QUERY]
|
104 | 104 | #define DebugPrintPlan pg_options[TRACE_PLAN]
|
105 | 105 | #define DebugPrintParse pg_options[TRACE_PARSE]
|
| 106 | +#define DebugPrintRewrittenParsetree \ |
| 107 | + pg_options[TRACE_REWRITTEN] |
| 108 | +#define DebugPPrintPlan pg_options[TRACE_PRETTY_PLAN] |
| 109 | +#define DebugPPrintParse pg_options[TRACE_PRETTY_PARSE] |
| 110 | +#define DebugPPrintRewrittenParsetree \ |
| 111 | + pg_options[TRACE_PRETTY_REWRITTEN] |
106 | 112 | #define ShowParserStats pg_options[TRACE_PARSERSTATS]
|
107 | 113 | #define ShowPlannerStats pg_options[TRACE_PLANNERSTATS]
|
108 | 114 | #define ShowExecutorStats pg_options[TRACE_EXECUTORSTATS]
|
109 |
| -#define DebugPrintRewrittenParsetree \ |
110 |
| - pg_options[TRACE_REWRITTEN] |
111 | 115 | #ifdef LOCK_MGR_DEBUG
|
112 | 116 | #define LockDebug pg_options[TRACE_LOCKS]
|
113 | 117 | #endif
|
@@ -474,10 +478,15 @@ pg_parse_and_plan(char *query_string, /* string to execute */
|
474 | 478 | {
|
475 | 479 | querytree = querytree_list->qtrees[i];
|
476 | 480 |
|
477 |
| - if (DebugPrintParse) |
| 481 | + if (DebugPrintParse || DebugPPrintParse) |
478 | 482 | {
|
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 | + } |
481 | 490 | }
|
482 | 491 |
|
483 | 492 | /* don't rewrite utilites, just dump 'em into new_list */
|
@@ -545,14 +554,23 @@ pg_parse_and_plan(char *query_string, /* string to execute */
|
545 | 554 | }
|
546 | 555 | }
|
547 | 556 |
|
548 |
| - if (DebugPrintRewrittenParsetree) |
| 557 | + if (DebugPrintRewrittenParsetree || DebugPPrintRewrittenParsetree) |
549 | 558 | {
|
550 |
| - TPRINTF(TRACE_REWRITTEN, "after rewriting:"); |
| 559 | + if (DebugPPrintRewrittenParsetree) { |
| 560 | + TPRINTF(TRACE_PRETTY_REWRITTEN, "after rewriting:"); |
551 | 561 |
|
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 | + } |
556 | 574 | }
|
557 | 575 | }
|
558 | 576 |
|
@@ -608,10 +626,15 @@ pg_parse_and_plan(char *query_string, /* string to execute */
|
608 | 626 | * also for queries in functions. DZ - 27-8-1996
|
609 | 627 | * ----------------
|
610 | 628 | */
|
611 |
| - if (DebugPrintPlan) |
| 629 | + if (DebugPrintPlan || DebugPPrintPlan) |
612 | 630 | {
|
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 | + } |
615 | 638 | }
|
616 | 639 | #endif
|
617 | 640 | }
|
@@ -747,10 +770,15 @@ pg_exec_query_dest(char *query_string, /* string to execute */
|
747 | 770 | * print plan if debugging
|
748 | 771 | * ----------------
|
749 | 772 | */
|
750 |
| - if (DebugPrintPlan) |
| 773 | + if (DebugPrintPlan || DebugPPrintPlan) |
751 | 774 | {
|
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 | + } |
754 | 782 | }
|
755 | 783 | #endif
|
756 | 784 |
|
@@ -1047,6 +1075,12 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
|
1047 | 1075 | DebugPrintPlan = true;
|
1048 | 1076 | DebugPrintRewrittenParsetree = true;
|
1049 | 1077 | }
|
| 1078 | + if (DebugLvl >= 5) |
| 1079 | + { |
| 1080 | + DebugPPrintParse = true; |
| 1081 | + DebugPPrintPlan = true; |
| 1082 | + DebugPPrintRewrittenParsetree = true; |
| 1083 | + } |
1050 | 1084 | break;
|
1051 | 1085 |
|
1052 | 1086 | case 'E':
|
@@ -1510,7 +1544,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
|
1510 | 1544 | if (!IsUnderPostmaster)
|
1511 | 1545 | {
|
1512 | 1546 | 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"); |
1514 | 1548 | }
|
1515 | 1549 |
|
1516 | 1550 | /* ----------------
|
|
0 commit comments