Header And Logo

PostgreSQL
| The world's most advanced open source database.

execdebug.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * execdebug.h
00004  *    #defines governing debugging behaviour in the executor
00005  *
00006  * XXX this is all pretty old and crufty.  Newer code tends to use elog()
00007  * for debug printouts, because that's more flexible than printf().
00008  *
00009  *
00010  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00011  * Portions Copyright (c) 1994, Regents of the University of California
00012  *
00013  * src/include/executor/execdebug.h
00014  *
00015  *-------------------------------------------------------------------------
00016  */
00017 #ifndef EXECDEBUG_H
00018 #define EXECDEBUG_H
00019 
00020 #include "executor/executor.h"
00021 #include "nodes/print.h"
00022 
00023 /* ----------------------------------------------------------------
00024  *      debugging defines.
00025  *
00026  *      If you want certain debugging behaviour, then #define
00027  *      the variable to 1. No need to explicitly #undef by default,
00028  *      since we can use -D compiler options to enable features.
00029  *      - thomas 1999-02-20
00030  * ----------------------------------------------------------------
00031  */
00032 
00033 /* ----------------
00034  *      EXEC_NESTLOOPDEBUG is a flag which turns on debugging of the
00035  *      nest loop node by NL_printf() and ENL_printf() in nodeNestloop.c
00036  * ----------------
00037 #undef EXEC_NESTLOOPDEBUG
00038  */
00039 
00040 /* ----------------
00041  *      EXEC_EVALDEBUG is a flag which turns on debugging of
00042  *      ExecEval and ExecTargetList() stuff by EV_printf() in execQual.c
00043  * ----------------
00044 #undef EXEC_EVALDEBUG
00045  */
00046 
00047 /* ----------------
00048  *      EXEC_SORTDEBUG is a flag which turns on debugging of
00049  *      the ExecSort() stuff by SO_printf() in nodeSort.c
00050  * ----------------
00051 #undef EXEC_SORTDEBUG
00052  */
00053 
00054 /* ----------------
00055  *      EXEC_MERGEJOINDEBUG is a flag which turns on debugging of
00056  *      the ExecMergeJoin() stuff by MJ_printf() in nodeMergejoin.c
00057  * ----------------
00058 #undef EXEC_MERGEJOINDEBUG
00059  */
00060 
00061 /* ----------------------------------------------------------------
00062  *      #defines controlled by above definitions
00063  *
00064  *      Note: most of these are "incomplete" because I didn't
00065  *            need the ones not defined.  More should be added
00066  *            only as necessary -cim 10/26/89
00067  * ----------------------------------------------------------------
00068  */
00069 #define T_OR_F(b)               ((b) ? "true" : "false")
00070 #define NULL_OR_TUPLE(slot)     (TupIsNull(slot) ? "null" : "a tuple")
00071 
00072 /* ----------------
00073  *      nest loop debugging defines
00074  * ----------------
00075  */
00076 #ifdef EXEC_NESTLOOPDEBUG
00077 #define NL_nodeDisplay(l)               nodeDisplay(l)
00078 #define NL_printf(s)                    printf(s)
00079 #define NL1_printf(s, a)                printf(s, a)
00080 #define ENL1_printf(message)            printf("ExecNestLoop: %s\n", message)
00081 #else
00082 #define NL_nodeDisplay(l)
00083 #define NL_printf(s)
00084 #define NL1_printf(s, a)
00085 #define ENL1_printf(message)
00086 #endif   /* EXEC_NESTLOOPDEBUG */
00087 
00088 /* ----------------
00089  *      exec eval / target list debugging defines
00090  * ----------------
00091  */
00092 #ifdef EXEC_EVALDEBUG
00093 #define EV_nodeDisplay(l)               nodeDisplay(l)
00094 #define EV_printf(s)                    printf(s)
00095 #define EV1_printf(s, a)                printf(s, a)
00096 #else
00097 #define EV_nodeDisplay(l)
00098 #define EV_printf(s)
00099 #define EV1_printf(s, a)
00100 #endif   /* EXEC_EVALDEBUG */
00101 
00102 /* ----------------
00103  *      sort node debugging defines
00104  * ----------------
00105  */
00106 #ifdef EXEC_SORTDEBUG
00107 #define SO_nodeDisplay(l)               nodeDisplay(l)
00108 #define SO_printf(s)                    printf(s)
00109 #define SO1_printf(s, p)                printf(s, p)
00110 #else
00111 #define SO_nodeDisplay(l)
00112 #define SO_printf(s)
00113 #define SO1_printf(s, p)
00114 #endif   /* EXEC_SORTDEBUG */
00115 
00116 /* ----------------
00117  *      merge join debugging defines
00118  * ----------------
00119  */
00120 #ifdef EXEC_MERGEJOINDEBUG
00121 
00122 #define MJ_nodeDisplay(l)               nodeDisplay(l)
00123 #define MJ_printf(s)                    printf(s)
00124 #define MJ1_printf(s, p)                printf(s, p)
00125 #define MJ2_printf(s, p1, p2)           printf(s, p1, p2)
00126 #define MJ_debugtup(slot)               debugtup(slot, NULL)
00127 #define MJ_dump(state)                  ExecMergeTupleDump(state)
00128 #define MJ_DEBUG_COMPARE(res) \
00129   MJ1_printf("  MJCompare() returns %d\n", (res))
00130 #define MJ_DEBUG_QUAL(clause, res) \
00131   MJ2_printf("  ExecQual(%s, econtext) returns %s\n", \
00132              CppAsString(clause), T_OR_F(res))
00133 #define MJ_DEBUG_PROC_NODE(slot) \
00134   MJ2_printf("  %s = ExecProcNode(...) returns %s\n", \
00135              CppAsString(slot), NULL_OR_TUPLE(slot))
00136 #else
00137 
00138 #define MJ_nodeDisplay(l)
00139 #define MJ_printf(s)
00140 #define MJ1_printf(s, p)
00141 #define MJ2_printf(s, p1, p2)
00142 #define MJ_debugtup(slot)
00143 #define MJ_dump(state)
00144 #define MJ_DEBUG_COMPARE(res)
00145 #define MJ_DEBUG_QUAL(clause, res)
00146 #define MJ_DEBUG_PROC_NODE(slot)
00147 #endif   /* EXEC_MERGEJOINDEBUG */
00148 
00149 #endif   /* ExecDebugIncluded */