]> granicus.if.org Git - postgresql/commitdiff
Changed debug options:
authorJan Wieck <JanWieck@Yahoo.com>
Tue, 11 May 1999 09:06:35 +0000 (09:06 +0000)
committerJan Wieck <JanWieck@Yahoo.com>
Tue, 11 May 1999 09:06:35 +0000 (09:06 +0000)
-d4 now prints compressed trees from nodeToString()
-d5 prints pretty trees via nodeDisplay()

new pg_options: pretty_plan, pretty_parse, pretty_rewritten

Jan

src/backend/tcop/postgres.c
src/backend/utils/misc/trace.c
src/include/utils/trace.h

index 24b2303ee9dbf17146615e194e02e49da13b4457..0a1a45b4dbf7348875c6fd9de387cd97bea0e259 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.111 1999/05/09 23:31:47 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.112 1999/05/11 09:06:31 wieck Exp $
  *
  * NOTES
  *       this is the "main" module of the postgres backend and
 #define DebugPrintQuery                pg_options[TRACE_QUERY]
 #define DebugPrintPlan         pg_options[TRACE_PLAN]
 #define DebugPrintParse                pg_options[TRACE_PARSE]
+#define DebugPrintRewrittenParsetree \
+                                                       pg_options[TRACE_REWRITTEN]
+#define DebugPPrintPlan                pg_options[TRACE_PRETTY_PLAN]
+#define DebugPPrintParse       pg_options[TRACE_PRETTY_PARSE]
+#define DebugPPrintRewrittenParsetree \
+                                                       pg_options[TRACE_PRETTY_REWRITTEN]
 #define ShowParserStats                pg_options[TRACE_PARSERSTATS]
 #define ShowPlannerStats       pg_options[TRACE_PLANNERSTATS]
 #define ShowExecutorStats      pg_options[TRACE_EXECUTORSTATS]
-#define DebugPrintRewrittenParsetree \
-                                                       pg_options[TRACE_REWRITTEN]
 #ifdef LOCK_MGR_DEBUG
 #define LockDebug                      pg_options[TRACE_LOCKS]
 #endif
@@ -474,10 +478,15 @@ pg_parse_and_plan(char *query_string,     /* string to execute */
        {
                querytree = querytree_list->qtrees[i];
 
-               if (DebugPrintParse)
+               if (DebugPrintParse || DebugPPrintParse)
                {
-                       TPRINTF(TRACE_PARSE, "parser outputs:");
-                       nodeDisplay(querytree);
+                       if (DebugPPrintParse) {
+                               TPRINTF(TRACE_PRETTY_PARSE, "parser outputs:");
+                               nodeDisplay(querytree);
+                       } else {
+                               TPRINTF(TRACE_PARSE, "parser outputs:");
+                               printf("\n%s\n\n", nodeToString(querytree));
+                       }
                }
 
                /* don't rewrite utilites, just dump 'em into new_list */
@@ -545,14 +554,23 @@ pg_parse_and_plan(char *query_string,     /* string to execute */
                }
        }
 
-       if (DebugPrintRewrittenParsetree)
+       if (DebugPrintRewrittenParsetree || DebugPPrintRewrittenParsetree)
        {
-               TPRINTF(TRACE_REWRITTEN, "after rewriting:");
+               if (DebugPPrintRewrittenParsetree) {
+                       TPRINTF(TRACE_PRETTY_REWRITTEN, "after rewriting:");
 
-               for (i = 0; i < querytree_list->len; i++)
-               {
-                       nodeDisplay(querytree_list->qtrees[i]);
-                       printf("\n");
+                       for (i = 0; i < querytree_list->len; i++)
+                       {
+                               nodeDisplay(querytree_list->qtrees[i]);
+                               printf("\n");
+                       }
+               } else {
+                       TPRINTF(TRACE_REWRITTEN, "after rewriting:");
+
+                       for (i = 0; i < querytree_list->len; i++)
+                       {
+                               printf("\n%s\n\n", nodeToString(querytree_list->qtrees[i]));
+                       }
                }
        }
 
@@ -608,10 +626,15 @@ pg_parse_and_plan(char *query_string,     /* string to execute */
                         *      also for queries in functions.  DZ - 27-8-1996
                         * ----------------
                         */
-                       if (DebugPrintPlan)
+                       if (DebugPrintPlan || DebugPPrintPlan)
                        {
-                               TPRINTF(TRACE_PLAN, "plan:");
-                               nodeDisplay(plan);
+                               if (DebugPPrintPlan) {
+                                       TPRINTF(TRACE_PRETTY_PLAN, "plan:");
+                                       nodeDisplay(plan);
+                               } else {
+                                       TPRINTF(TRACE_PLAN, "plan:");
+                                       printf("\n%s\n\n", nodeToString(plan));
+                               }
                        }
 #endif
                }
@@ -747,10 +770,15 @@ pg_exec_query_dest(char *query_string,    /* string to execute */
                         *      print plan if debugging
                         * ----------------
                         */
-                       if (DebugPrintPlan)
+                       if (DebugPrintPlan || DebugPPrintPlan)
                        {
-                               TPRINTF(TRACE_PLAN, "plan:");
-                               nodeDisplay(plan);
+                               if (DebugPPrintPlan) {
+                                       TPRINTF(TRACE_PRETTY_PLAN, "plan:");
+                                       nodeDisplay(plan);
+                               } else {
+                                       TPRINTF(TRACE_PLAN, "plan:");
+                                       printf("\n%s\n\n", nodeToString(plan));
+                               }
                        }
 #endif
 
@@ -1047,6 +1075,12 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
                                        DebugPrintPlan = true;
                                        DebugPrintRewrittenParsetree = true;
                                }
+                               if (DebugLvl >= 5)
+                               {
+                                       DebugPPrintParse = true;
+                                       DebugPPrintPlan = true;
+                                       DebugPPrintRewrittenParsetree = true;
+                               }
                                break;
 
                        case 'E':
@@ -1510,7 +1544,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
        if (!IsUnderPostmaster)
        {
                puts("\nPOSTGRES backend interactive interface ");
-               puts("$Revision: 1.111 $ $Date: 1999/05/09 23:31:47 $\n");
+               puts("$Revision: 1.112 $ $Date: 1999/05/11 09:06:31 $\n");
        }
 
        /* ----------------
index 51070ba7caf87393a1ce0752dbe6b90b9efb13d8..1f96065c9efa0d34933ca750fe859d386bf04f6f 100644 (file)
@@ -53,6 +53,9 @@ static char *opt_names[] = {
        "plan",
        "parse",
        "rewritten",
+       "pretty_plan",
+       "pretty_parse",
+       "pretty_rewritten",
        "parserstats",
        "plannerstats",
        "executorstats",
index 52bc301a0a2e4eb501c6926b434c7450c7833878..4695e865aa7de3f595cb099eda8bb37ee2e40d5f 100644 (file)
@@ -49,6 +49,9 @@ enum pg_option_enum
        TRACE_PLAN,
        TRACE_PARSE,
        TRACE_REWRITTEN,
+       TRACE_PRETTY_PLAN,                      /* indented multiline versions of trees */
+       TRACE_PRETTY_PARSE,
+       TRACE_PRETTY_REWRITTEN,
        TRACE_PARSERSTATS,
        TRACE_PLANNERSTATS,
        TRACE_EXECUTORSTATS,