Fix xslt_process() to ensure that it inserts a NULL terminator after the
[PostgreSQL.git] / src / include / executor / execdebug.h
blobafb63f56d5257b85fd892dec767b0e0033dc6c53
1 /*-------------------------------------------------------------------------
3 * execdebug.h
4 * #defines governing debugging behaviour in the executor
6 * XXX this is all pretty old and crufty. Newer code tends to use elog()
7 * for debug printouts, because that's more flexible than printf().
10 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
11 * Portions Copyright (c) 1994, Regents of the University of California
13 * $PostgreSQL$
15 *-------------------------------------------------------------------------
17 #ifndef EXECDEBUG_H
18 #define EXECDEBUG_H
20 #include "executor/executor.h"
21 #include "nodes/print.h"
23 /* ----------------------------------------------------------------
24 * debugging defines.
26 * If you want certain debugging behaviour, then #define
27 * the variable to 1. No need to explicitly #undef by default,
28 * since we can use -D compiler options to enable features.
29 * - thomas 1999-02-20
30 * ----------------------------------------------------------------
33 /* ----------------
34 * EXEC_TUPLECOUNT is a #define which causes the
35 * executor to keep track of tuple counts. This might be
36 * causing some problems with the decstation stuff so
37 * you might want to undefine this if you are doing work
38 * on the decs - cim 10/20/89
39 * ----------------
40 #undef EXEC_TUPLECOUNT
43 /* ----------------
44 * EXEC_NESTLOOPDEBUG is a flag which turns on debugging of the
45 * nest loop node by NL_printf() and ENL_printf() in nodeNestloop.c
46 * ----------------
47 #undef EXEC_NESTLOOPDEBUG
50 /* ----------------
51 * EXEC_EVALDEBUG is a flag which turns on debugging of
52 * ExecEval and ExecTargetList() stuff by EV_printf() in execQual.c
53 * ----------------
54 #undef EXEC_EVALDEBUG
57 /* ----------------
58 * EXEC_SORTDEBUG is a flag which turns on debugging of
59 * the ExecSort() stuff by SO_printf() in nodeSort.c
60 * ----------------
61 #undef EXEC_SORTDEBUG
64 /* ----------------
65 * EXEC_MERGEJOINDEBUG is a flag which turns on debugging of
66 * the ExecMergeJoin() stuff by MJ_printf() in nodeMergejoin.c
67 * ----------------
68 #undef EXEC_MERGEJOINDEBUG
71 /* ----------------------------------------------------------------
72 * #defines controlled by above definitions
74 * Note: most of these are "incomplete" because I didn't
75 * need the ones not defined. More should be added
76 * only as necessary -cim 10/26/89
77 * ----------------------------------------------------------------
79 #define T_OR_F(b) ((b) ? "true" : "false")
80 #define NULL_OR_TUPLE(slot) (TupIsNull(slot) ? "null" : "a tuple")
83 /* ----------------
84 * tuple count debugging defines
85 * ----------------
87 #ifdef EXEC_TUPLECOUNT
88 extern int NTupleProcessed;
89 extern int NTupleRetrieved;
90 extern int NTupleReplaced;
91 extern int NTupleAppended;
92 extern int NTupleDeleted;
93 extern int NIndexTupleProcessed;
94 extern int NIndexTupleInserted;
96 #define IncrRetrieved() NTupleRetrieved++
97 #define IncrAppended() NTupleAppended++
98 #define IncrDeleted() NTupleDeleted++
99 #define IncrReplaced() NTupleReplaced++
100 #define IncrInserted() NTupleInserted++
101 #define IncrProcessed() NTupleProcessed++
102 #define IncrIndexProcessed() NIndexTupleProcessed++
103 #define IncrIndexInserted() NIndexTupleInserted++
104 #else
105 /* stop compiler warnings */
106 #define IncrRetrieved() (void)(0)
107 #define IncrAppended() (void)(0)
108 #define IncrDeleted() (void)(0)
109 #define IncrReplaced() (void)(0)
110 #define IncrInserted() (void)(0)
111 #define IncrProcessed() (void)(0)
112 #define IncrIndexProcessed() (void)(0)
113 #define IncrIndexInserted() (void)(0)
114 #endif /* EXEC_TUPLECOUNT */
116 /* ----------------
117 * nest loop debugging defines
118 * ----------------
120 #ifdef EXEC_NESTLOOPDEBUG
121 #define NL_nodeDisplay(l) nodeDisplay(l)
122 #define NL_printf(s) printf(s)
123 #define NL1_printf(s, a) printf(s, a)
124 #define ENL1_printf(message) printf("ExecNestLoop: %s\n", message)
125 #else
126 #define NL_nodeDisplay(l)
127 #define NL_printf(s)
128 #define NL1_printf(s, a)
129 #define ENL1_printf(message)
130 #endif /* EXEC_NESTLOOPDEBUG */
132 /* ----------------
133 * exec eval / target list debugging defines
134 * ----------------
136 #ifdef EXEC_EVALDEBUG
137 #define EV_nodeDisplay(l) nodeDisplay(l)
138 #define EV_printf(s) printf(s)
139 #define EV1_printf(s, a) printf(s, a)
140 #else
141 #define EV_nodeDisplay(l)
142 #define EV_printf(s)
143 #define EV1_printf(s, a)
144 #endif /* EXEC_EVALDEBUG */
146 /* ----------------
147 * sort node debugging defines
148 * ----------------
150 #ifdef EXEC_SORTDEBUG
151 #define SO_nodeDisplay(l) nodeDisplay(l)
152 #define SO_printf(s) printf(s)
153 #define SO1_printf(s, p) printf(s, p)
154 #else
155 #define SO_nodeDisplay(l)
156 #define SO_printf(s)
157 #define SO1_printf(s, p)
158 #endif /* EXEC_SORTDEBUG */
160 /* ----------------
161 * merge join debugging defines
162 * ----------------
164 #ifdef EXEC_MERGEJOINDEBUG
166 #define MJ_nodeDisplay(l) nodeDisplay(l)
167 #define MJ_printf(s) printf(s)
168 #define MJ1_printf(s, p) printf(s, p)
169 #define MJ2_printf(s, p1, p2) printf(s, p1, p2)
170 #define MJ_debugtup(slot) debugtup(slot, NULL)
171 #define MJ_dump(state) ExecMergeTupleDump(state)
172 #define MJ_DEBUG_COMPARE(res) \
173 MJ1_printf(" MJCompare() returns %d\n", (res))
174 #define MJ_DEBUG_QUAL(clause, res) \
175 MJ2_printf(" ExecQual(%s, econtext) returns %s\n", \
176 CppAsString(clause), T_OR_F(res))
177 #define MJ_DEBUG_PROC_NODE(slot) \
178 MJ2_printf(" %s = ExecProcNode(...) returns %s\n", \
179 CppAsString(slot), NULL_OR_TUPLE(slot))
180 #else
182 #define MJ_nodeDisplay(l)
183 #define MJ_printf(s)
184 #define MJ1_printf(s, p)
185 #define MJ2_printf(s, p1, p2)
186 #define MJ_debugtup(slot)
187 #define MJ_dump(state)
188 #define MJ_DEBUG_COMPARE(res)
189 #define MJ_DEBUG_QUAL(clause, res)
190 #define MJ_DEBUG_PROC_NODE(slot)
191 #endif /* EXEC_MERGEJOINDEBUG */
193 #endif /* ExecDebugIncluded */