55 *
66 * Copyright (c) 1994, Regents of the University of California
77 *
8- * $Id: outfuncs.c,v 1.75 1999/02/18 00:49:14 momjian Exp $
8+ * $Id: outfuncs.c,v 1.76 1999/02/23 08:01:47 thomas Exp $
99 *
1010 * NOTES
1111 * Every (plan) node in POSTGRES has an associated "out" routine which
4242#include "catalog/pg_type.h"
4343#include "lib/stringinfo.h"
4444
45- #ifdef PARSEDEBUG
4645#include "../parse.h"
47- #endif
4846
4947static void _outDatum (StringInfo str ,Datum value ,Oid type );
5048static void _outNode (StringInfo str ,void * obj );
@@ -109,7 +107,6 @@ _outIndexStmt(StringInfo str, IndexStmt *node)
109107node -> unique ?"true" :"false" );
110108}
111109
112- #ifdef PARSEDEBUG
113110static void
114111_outSelectStmt (StringInfo str ,SelectStmt * node )
115112{
@@ -124,8 +121,6 @@ _outFuncCall(StringInfo str, FuncCall *node)
124121_outNode (str ,node -> args );
125122}
126123
127- #endif
128-
129124static void
130125_outColumnDef (StringInfo str ,ColumnDef * node )
131126{
@@ -1293,7 +1288,6 @@ static void
12931288_outAExpr (StringInfo str ,A_Expr * node )
12941289{
12951290appendStringInfo (str ,"EXPR " );
1296- #ifdef PARSEDEBUG
12971291switch (node -> oper )
12981292{
12991293case AND :
@@ -1312,12 +1306,9 @@ _outAExpr(StringInfo str, A_Expr *node)
13121306appendStringInfo (str ,"NOTNULL" );
13131307break ;
13141308default :
1315- #endif
13161309appendStringInfo (str ,stringStringInfo (node -> opname ));
1317- #ifdef PARSEDEBUG
13181310break ;
13191311}
1320- #endif
13211312_outNode (str ,node -> lexpr );
13221313_outNode (str ,node -> rexpr );
13231314return ;
@@ -1350,6 +1341,24 @@ _outIdent(StringInfo str, Ident *node)
13501341return ;
13511342}
13521343
1344+ static void
1345+ _outAttr (StringInfo str ,Attr * node )
1346+ {
1347+ List * l ;
1348+
1349+ appendStringInfo (str ," ATTR \"%s\" " ,stringStringInfo (node -> relname ));
1350+
1351+ appendStringInfo (str ,"(" );
1352+ foreach (l ,node -> attrs )
1353+ {
1354+ _outNode (str ,lfirst (l ));
1355+ if (lnext (l ))
1356+ appendStringInfo (str ,"," );
1357+ }
1358+ appendStringInfo (str ,")" );
1359+ return ;
1360+ }
1361+
13531362static void
13541363_outAConst (StringInfo str ,A_Const * node )
13551364{
@@ -1465,18 +1474,6 @@ _outNode(StringInfo str, void *obj)
14651474case T_IndexElem :
14661475_outIndexElem (str ,obj );
14671476break ;
1468-
1469- #ifdef PARSEDEBUG
1470- case T_VariableSetStmt :
1471- break ;
1472- case T_SelectStmt :
1473- _outSelectStmt (str ,obj );
1474- break ;
1475- case T_FuncCall :
1476- _outFuncCall (str ,obj );
1477- break ;
1478- #endif
1479-
14801477case T_Query :
14811478_outQuery (str ,obj );
14821479break ;
@@ -1659,6 +1656,19 @@ _outNode(StringInfo str, void *obj)
16591656case T_CaseWhen :
16601657_outCaseWhen (str ,obj );
16611658break ;
1659+
1660+ case T_VariableSetStmt :
1661+ break ;
1662+ case T_SelectStmt :
1663+ _outSelectStmt (str ,obj );
1664+ break ;
1665+ case T_FuncCall :
1666+ _outFuncCall (str ,obj );
1667+ break ;
1668+ case T_Attr :
1669+ _outAttr (str ,obj );
1670+ break ;
1671+
16621672default :
16631673elog (NOTICE ,"_outNode: don't know how to print type %d " ,
16641674nodeTag (obj ));