Skip to content

Commit e6a854d

Browse files
author
Thomas G. Lockhart
committed
Add some more node print routines for debugging only
(inside of #ifdef PARSEDEBUG blocks).
1 parent 52dd4cf commit e6a854d

File tree

1 file changed

+61
-2
lines changed

1 file changed

+61
-2
lines changed

src/backend/nodes/outfuncs.c

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.34 1998/04/27 02:58:05 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.35 1998/05/09 23:46:35 thomas Exp $
1111
*
1212
* NOTES
1313
* Every (plan) node in POSTGRES has an associated "out" routine which
@@ -45,6 +45,10 @@
4545
#include "catalog/pg_type.h"
4646
#include "lib/stringinfo.h"
4747

48+
#ifdef PARSEDEBUG
49+
#include "../parse.h"
50+
#endif
51+
4852
static void _outDatum(StringInfo str, Datum value, Oid type);
4953
static void _outNode(StringInfo str, void *obj);
5054

@@ -107,6 +111,26 @@ _outIndexStmt(StringInfo str, IndexStmt *node)
107111
appendStringInfo(str, (node->unique ? "true" : "false"));
108112
}
109113

114+
#ifdef PARSEDEBUG
115+
static void
116+
_outSelectStmt(StringInfo str, SelectStmt *node)
117+
{
118+
appendStringInfo(str, "SELECT");
119+
120+
appendStringInfo(str, " :where ");
121+
_outNode(str, node->whereClause);
122+
}
123+
124+
static void
125+
_outFuncCall(StringInfo str, FuncCall *node)
126+
{
127+
appendStringInfo(str, "FUNCTION ");
128+
appendStringInfo(str, node->funcname);
129+
appendStringInfo(str, " :args ");
130+
_outNode(str, node->args);
131+
}
132+
#endif
133+
110134
static void
111135
_outColumnDef(StringInfo str, ColumnDef *node)
112136
{
@@ -1534,7 +1558,31 @@ static void
15341558
_outAExpr(StringInfo str, A_Expr *node)
15351559
{
15361560
appendStringInfo(str, "EXPR ");
1537-
appendStringInfo(str, node->opname);
1561+
#ifdef PARSEDEBUG
1562+
switch (node->oper)
1563+
{
1564+
case AND:
1565+
appendStringInfo(str, "AND");
1566+
break;
1567+
case OR:
1568+
appendStringInfo(str, "OR");
1569+
break;
1570+
case NOT:
1571+
appendStringInfo(str, "NOT");
1572+
break;
1573+
case ISNULL:
1574+
appendStringInfo(str, "ISNULL");
1575+
break;
1576+
case NOTNULL:
1577+
appendStringInfo(str, "NOTNULL");
1578+
break;
1579+
default:
1580+
#endif
1581+
appendStringInfo(str, node->opname);
1582+
#ifdef PARSEDEBUG
1583+
break;
1584+
}
1585+
#endif
15381586
_outNode(str, node->lexpr);
15391587
_outNode(str, node->rexpr);
15401588
return;
@@ -1634,6 +1682,17 @@ _outNode(StringInfo str, void *obj)
16341682
_outIndexElem(str, obj);
16351683
break;
16361684

1685+
#ifdef PARSEDEBUG
1686+
case T_VariableSetStmt:
1687+
break;
1688+
case T_SelectStmt:
1689+
_outSelectStmt(str, obj);
1690+
break;
1691+
case T_FuncCall:
1692+
_outFuncCall(str, obj);
1693+
break;
1694+
#endif
1695+
16371696
case T_Query:
16381697
_outQuery(str, obj);
16391698
break;

0 commit comments

Comments
 (0)