| 1 |
/*------------------------------------------------------------------------- |
| 2 |
* |
| 3 |
* execdebug.h |
| 4 |
* #defines governing debugging behaviour in the executor |
| 5 |
* |
| 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(). |
| 8 |
* |
| 9 |
* |
| 10 |
* Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group |
| 11 |
* Portions Copyright (c) 1994, Regents of the University of California |
| 12 |
* |
| 13 |
* src/include/executor/execdebug.h |
| 14 |
* |
| 15 |
*------------------------------------------------------------------------- |
| 16 |
*/ |
| 17 |
#ifndef EXECDEBUG_H |
| 18 |
#define EXECDEBUG_H |
| 19 |
|
| 20 |
#include "executor/executor.h" |
| 21 |
#include "nodes/print.h" |
| 22 |
|
| 23 |
/* ---------------------------------------------------------------- |
| 24 |
* debugging defines. |
| 25 |
* |
| 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 |
* ---------------------------------------------------------------- |
| 31 |
*/ |
| 32 |
|
| 33 |
/* ---------------- |
| 34 |
* EXEC_NESTLOOPDEBUG is a flag which turns on debugging of the |
| 35 |
* nest loop node by NL_printf() and ENL_printf() in nodeNestloop.c |
| 36 |
* ---------------- |
| 37 |
#undef EXEC_NESTLOOPDEBUG |
| 38 |
*/ |
| 39 |
|
| 40 |
/* ---------------- |
| 41 |
* EXEC_SORTDEBUG is a flag which turns on debugging of |
| 42 |
* the ExecSort() stuff by SO_printf() in nodeSort.c |
| 43 |
* ---------------- |
| 44 |
#undef EXEC_SORTDEBUG |
| 45 |
*/ |
| 46 |
|
| 47 |
/* ---------------- |
| 48 |
* EXEC_MERGEJOINDEBUG is a flag which turns on debugging of |
| 49 |
* the ExecMergeJoin() stuff by MJ_printf() in nodeMergejoin.c |
| 50 |
* ---------------- |
| 51 |
#undef EXEC_MERGEJOINDEBUG |
| 52 |
*/ |
| 53 |
|
| 54 |
/* ---------------------------------------------------------------- |
| 55 |
* #defines controlled by above definitions |
| 56 |
* |
| 57 |
* Note: most of these are "incomplete" because I didn't |
| 58 |
* need the ones not defined. More should be added |
| 59 |
* only as necessary -cim 10/26/89 |
| 60 |
* ---------------------------------------------------------------- |
| 61 |
*/ |
| 62 |
#define T_OR_F(b) ((b) ? "true" : "false") |
| 63 |
#define NULL_OR_TUPLE(slot) (TupIsNull(slot) ? "null" : "a tuple") |
| 64 |
|
| 65 |
/* ---------------- |
| 66 |
* nest loop debugging defines |
| 67 |
* ---------------- |
| 68 |
*/ |
| 69 |
#ifdef EXEC_NESTLOOPDEBUG |
| 70 |
#define NL_nodeDisplay(l) nodeDisplay(l) |
| 71 |
#define NL_printf(s) printf(s) |
| 72 |
#define NL1_printf(s, a) printf(s, a) |
| 73 |
#define ENL1_printf(message) printf("ExecNestLoop: %s\n", message) |
| 74 |
#else |
| 75 |
#define NL_nodeDisplay(l) |
| 76 |
#define NL_printf(s) |
| 77 |
#define NL1_printf(s, a) |
| 78 |
#define ENL1_printf(message) |
| 79 |
#endif /* EXEC_NESTLOOPDEBUG */ |
| 80 |
|
| 81 |
/* ---------------- |
| 82 |
* sort node debugging defines |
| 83 |
* ---------------- |
| 84 |
*/ |
| 85 |
#ifdef EXEC_SORTDEBUG |
| 86 |
#define SO_nodeDisplay(l) nodeDisplay(l) |
| 87 |
#define SO_printf(s) printf(s) |
| 88 |
#define SO1_printf(s, p) printf(s, p) |
| 89 |
#define SO2_printf(s, p1, p2) printf(s, p1, p2) |
| 90 |
#else |
| 91 |
#define SO_nodeDisplay(l) |
| 92 |
#define SO_printf(s) |
| 93 |
#define SO1_printf(s, p) |
| 94 |
#define SO2_printf(s, p1, p2) |
| 95 |
#endif /* EXEC_SORTDEBUG */ |
| 96 |
|
| 97 |
/* ---------------- |
| 98 |
* merge join debugging defines |
| 99 |
* ---------------- |
| 100 |
*/ |
| 101 |
#ifdef EXEC_MERGEJOINDEBUG |
| 102 |
|
| 103 |
#define MJ_nodeDisplay(l) nodeDisplay(l) |
| 104 |
#define MJ_printf(s) printf(s) |
| 105 |
#define MJ1_printf(s, p) printf(s, p) |
| 106 |
#define MJ2_printf(s, p1, p2) printf(s, p1, p2) |
| 107 |
#define MJ_debugtup(slot) debugtup(slot, NULL) |
| 108 |
#define MJ_dump(state) ExecMergeTupleDump(state) |
| 109 |
#define MJ_DEBUG_COMPARE(res) \ |
| 110 |
MJ1_printf(" MJCompare() returns %d\n", (res)) |
| 111 |
#define MJ_DEBUG_QUAL(clause, res) \ |
| 112 |
MJ2_printf(" ExecQual(%s, econtext) returns %s\n", \ |
| 113 |
CppAsString(clause), T_OR_F(res)) |
| 114 |
#define MJ_DEBUG_PROC_NODE(slot) \ |
| 115 |
MJ2_printf(" %s = ExecProcNode(...) returns %s\n", \ |
| 116 |
CppAsString(slot), NULL_OR_TUPLE(slot)) |
| 117 |
#else |
| 118 |
|
| 119 |
#define MJ_nodeDisplay(l) |
| 120 |
#define MJ_printf(s) |
| 121 |
#define MJ1_printf(s, p) |
| 122 |
#define MJ2_printf(s, p1, p2) |
| 123 |
#define MJ_debugtup(slot) |
| 124 |
#define MJ_dump(state) |
| 125 |
#define MJ_DEBUG_COMPARE(res) |
| 126 |
#define MJ_DEBUG_QUAL(clause, res) |
| 127 |
#define MJ_DEBUG_PROC_NODE(slot) |
| 128 |
#endif /* EXEC_MERGEJOINDEBUG */ |
| 129 |
|
| 130 |
#endif /* EXECDEBUG_H */ |