*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: outfuncs.c,v 1.75 1999/02/18 00:49:14 momjian Exp $
+ * $Id: outfuncs.c,v 1.76 1999/02/23 08:01:47 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);
node->unique ? "true" : "false");
}
-#ifdef PARSEDEBUG
static void
_outSelectStmt(StringInfo str, SelectStmt *node)
{
_outNode(str, node->args);
}
-#endif
-
static void
_outColumnDef(StringInfo str, ColumnDef *node)
{
_outAExpr(StringInfo str, A_Expr *node)
{
appendStringInfo(str, "EXPR ");
-#ifdef PARSEDEBUG
switch (node->oper)
{
case AND:
appendStringInfo(str, "NOTNULL");
break;
default:
-#endif
appendStringInfo(str, stringStringInfo(node->opname));
-#ifdef PARSEDEBUG
break;
}
-#endif
_outNode(str, node->lexpr);
_outNode(str, node->rexpr);
return;
return;
}
+static void
+_outAttr(StringInfo str, Attr *node)
+{
+ List *l;
+
+ appendStringInfo(str, " ATTR \"%s\" ", stringStringInfo(node->relname));
+
+ appendStringInfo(str, "(");
+ foreach(l, node->attrs)
+ {
+ _outNode(str, lfirst(l));
+ if (lnext(l))
+ appendStringInfo(str, ",");
+ }
+ appendStringInfo(str, ")");
+ return;
+}
+
static void
_outAConst(StringInfo str, A_Const *node)
{
case T_IndexElem:
_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;
case T_CaseWhen:
_outCaseWhen(str, obj);
break;
+
+ case T_VariableSetStmt:
+ break;
+ case T_SelectStmt:
+ _outSelectStmt(str, obj);
+ break;
+ case T_FuncCall:
+ _outFuncCall(str, obj);
+ break;
+ case T_Attr:
+ _outAttr(str, obj);
+ break;
+
default:
elog(NOTICE, "_outNode: don't know how to print type %d ",
nodeTag(obj));