Add some more node print routines for debugging only
authorThomas G. Lockhart
Sat, 9 May 1998 23:46:35 +0000 (23:46 +0000)
committerThomas G. Lockhart
Sat, 9 May 1998 23:46:35 +0000 (23:46 +0000)
 (inside of #ifdef PARSEDEBUG blocks).

src/backend/nodes/outfuncs.c

index d322c8ee3e2d8eae4f2ddb7f32d52525b10468d0..c29730db2fe14e15458d46b7d8ab08da4c09163b 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.34 1998/04/27 02:58:05 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.35 1998/05/09 23:46:35 thomas Exp $
  *
  * NOTES
  *   Every (plan) node in POSTGRES has an associated "out" routine which
 #include "catalog/pg_type.h"
 #include "lib/stringinfo.h"
 
+#ifdef PARSEDEBUG
+#include "../parse.h"
+#endif
+
 static void _outDatum(StringInfo str, Datum value, Oid type);
 static void _outNode(StringInfo str, void *obj);
 
@@ -107,6 +111,26 @@ _outIndexStmt(StringInfo str, IndexStmt *node)
    appendStringInfo(str, (node->unique ? "true" : "false"));
 }
 
+#ifdef PARSEDEBUG
+static void
+_outSelectStmt(StringInfo str, SelectStmt *node)
+{
+   appendStringInfo(str, "SELECT");
+
+   appendStringInfo(str, " :where ");
+   _outNode(str, node->whereClause);
+}
+
+static void
+_outFuncCall(StringInfo str, FuncCall *node)
+{
+   appendStringInfo(str, "FUNCTION ");
+   appendStringInfo(str, node->funcname);
+   appendStringInfo(str, " :args ");
+   _outNode(str, node->args);
+}
+#endif
+
 static void
 _outColumnDef(StringInfo str, ColumnDef *node)
 {
@@ -1534,7 +1558,31 @@ static void
 _outAExpr(StringInfo str, A_Expr *node)
 {
    appendStringInfo(str, "EXPR ");
-   appendStringInfo(str, node->opname);
+#ifdef PARSEDEBUG
+   switch (node->oper)
+   {
+       case AND:
+           appendStringInfo(str, "AND");
+           break;
+       case OR:
+           appendStringInfo(str, "OR");
+           break;
+       case NOT:
+           appendStringInfo(str, "NOT");
+           break;
+       case ISNULL:
+           appendStringInfo(str, "ISNULL");
+           break;
+       case NOTNULL:
+           appendStringInfo(str, "NOTNULL");
+           break;
+       default:
+#endif
+           appendStringInfo(str, node->opname);
+#ifdef PARSEDEBUG
+           break;
+   }
+#endif
    _outNode(str, node->lexpr);
    _outNode(str, node->rexpr);
    return;
@@ -1634,6 +1682,17 @@ _outNode(StringInfo str, void *obj)
                _outIndexElem(str, obj);
                break;
 
+#ifdef PARSEDEBUG
+           case T_VariableSetStmt:
+               break;
+           case T_SelectStmt:
+               _outSelectStmt(str, obj);
+               break;
+           case T_FuncCall:
+               _outFuncCall(str, obj);
+               break;
+#endif
+
            case T_Query:
                _outQuery(str, obj);
                break;