]> granicus.if.org Git - postgresql/blobdiff - src/backend/nodes/outfuncs.c
Support UPDATE/DELETE WHERE CURRENT OF cursor_name, per SQL standard.
[postgresql] / src / backend / nodes / outfuncs.c
index 9247bb00d2a0e37e7cabc0f3cb2e31d86160dfb2..869905f0cc548e01b42ecf74f314bbc850b43597 100644 (file)
@@ -3,12 +3,12 @@
  * outfuncs.c
  *       Output functions for Postgres tree nodes.
  *
- * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.215 2003/08/04 00:43:19 momjian Exp $
+ *       $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.310 2007/06/11 01:16:22 tgl Exp $
  *
  * NOTES
  *       Every node type that can appear in stored rules' parsetrees *must*
@@ -24,7 +24,6 @@
 #include <ctype.h>
 
 #include "lib/stringinfo.h"
-#include "nodes/parsenodes.h"
 #include "nodes/plannodes.h"
 #include "nodes/relation.h"
 #include "utils/datum.h"
        (appendStringInfo(str, " :" CppAsString(fldname) " "), \
         _outNode(str, node->fldname))
 
-/* Write an integer-list field */
-#define WRITE_INTLIST_FIELD(fldname) \
-       (appendStringInfo(str, " :" CppAsString(fldname) " "), \
-        _outIntList(str, node->fldname))
-
-/* Write an OID-list field */
-#define WRITE_OIDLIST_FIELD(fldname) \
-       (appendStringInfo(str, " :" CppAsString(fldname) " "), \
-        _outOidList(str, node->fldname))
-
 /* Write a bitmapset field */
 #define WRITE_BITMAPSET_FIELD(fldname) \
        (appendStringInfo(str, " :" CppAsString(fldname) " "), \
@@ -123,14 +112,13 @@ _outToken(StringInfo str, char *s)
        }
 
        /*
-        * Look for characters or patterns that are treated specially by
-        * read.c (either in pg_strtok() or in nodeRead()), and therefore need
-        * protective backslash.
+        * Look for characters or patterns that are treated specially by read.c
+        * (either in pg_strtok() or in nodeRead()), and therefore need a
+        * protective backslash.
         */
        /* These characters only need to be quoted at the start of the string */
        if (*s == '<' ||
                *s == '\"' ||
-               *s == '@' ||
                isdigit((unsigned char) *s) ||
                ((*s == '+' || *s == '-') &&
                 (isdigit((unsigned char) s[1]) || s[1] == '.')))
@@ -146,33 +134,40 @@ _outToken(StringInfo str, char *s)
        }
 }
 
-/*
- * _outIntList -
- *        converts a List of integers
- */
 static void
-_outIntList(StringInfo str, List *list)
+_outList(StringInfo str, List *node)
 {
-       List       *l;
+       ListCell   *lc;
 
        appendStringInfoChar(str, '(');
-       foreach(l, list)
-               appendStringInfo(str, " %d", lfirsti(l));
-       appendStringInfoChar(str, ')');
-}
 
-/*
- * _outOidList -
- *        converts a List of OIDs
- */
-static void
-_outOidList(StringInfo str, List *list)
-{
-       List       *l;
+       if (IsA(node, IntList))
+               appendStringInfoChar(str, 'i');
+       else if (IsA(node, OidList))
+               appendStringInfoChar(str, 'o');
+
+       foreach(lc, node)
+       {
+               /*
+                * For the sake of backward compatibility, we emit a slightly
+                * different whitespace format for lists of nodes vs. other types of
+                * lists. XXX: is this necessary?
+                */
+               if (IsA(node, List))
+               {
+                       _outNode(str, lfirst(lc));
+                       if (lnext(lc))
+                               appendStringInfoChar(str, ' ');
+               }
+               else if (IsA(node, IntList))
+                       appendStringInfo(str, " %d", lfirst_int(lc));
+               else if (IsA(node, OidList))
+                       appendStringInfo(str, " %u", lfirst_oid(lc));
+               else
+                       elog(ERROR, "unrecognized list node type: %d",
+                                (int) node->type);
+       }
 
-       appendStringInfoChar(str, '(');
-       foreach(l, list)
-               appendStringInfo(str, " %u", lfirsto(l));
        appendStringInfoChar(str, ')');
 }
 
@@ -180,16 +175,18 @@ _outOidList(StringInfo str, List *list)
  * _outBitmapset -
  *        converts a bitmap set of integers
  *
- * Note: for historical reasons, the output is formatted exactly like
- * an integer List would be.
+ * Note: the output format is "(b int int ...)", similar to an integer List.
+ * Currently bitmapsets do not appear in any node type that is stored in
+ * rules, so there is no support in readfuncs.c for reading this format.
  */
 static void
-_outBitmapset(StringInfo str, Bitmapset * bms)
+_outBitmapset(StringInfo str, Bitmapset *bms)
 {
        Bitmapset  *tmpset;
        int                     x;
 
        appendStringInfoChar(str, '(');
+       appendStringInfoChar(str, 'b');
        tmpset = bms_copy(bms);
        while ((x = bms_first_member(tmpset)) >= 0)
                appendStringInfo(str, " %d", x);
@@ -237,6 +234,25 @@ _outDatum(StringInfo str, Datum value, int typlen, bool typbyval)
  *     Stuff from plannodes.h
  */
 
+static void
+_outPlannedStmt(StringInfo str, PlannedStmt *node)
+{
+       WRITE_NODE_TYPE("PLANNEDSTMT");
+
+       WRITE_ENUM_FIELD(commandType, CmdType);
+       WRITE_BOOL_FIELD(canSetTag);
+       WRITE_NODE_FIELD(planTree);
+       WRITE_NODE_FIELD(rtable);
+       WRITE_NODE_FIELD(resultRelations);
+       WRITE_NODE_FIELD(utilityStmt);
+       WRITE_NODE_FIELD(intoClause);
+       WRITE_NODE_FIELD(subplans);
+       WRITE_BITMAPSET_FIELD(rewindPlanIDs);
+       WRITE_NODE_FIELD(returningLists);
+       WRITE_NODE_FIELD(rowMarks);
+       WRITE_INT_FIELD(nParamExec);
+}
+
 /*
  * print the basic stuff of all nodes that inherit from Plan
  */
@@ -254,7 +270,6 @@ _outPlanInfo(StringInfo str, Plan *node)
        WRITE_NODE_FIELD(initPlan);
        WRITE_BITMAPSET_FIELD(extParam);
        WRITE_BITMAPSET_FIELD(allParam);
-       WRITE_INT_FIELD(nParamExec);
 }
 
 /*
@@ -310,6 +325,26 @@ _outAppend(StringInfo str, Append *node)
        WRITE_BOOL_FIELD(isTarget);
 }
 
+static void
+_outBitmapAnd(StringInfo str, BitmapAnd *node)
+{
+       WRITE_NODE_TYPE("BITMAPAND");
+
+       _outPlanInfo(str, (Plan *) node);
+
+       WRITE_NODE_FIELD(bitmapplans);
+}
+
+static void
+_outBitmapOr(StringInfo str, BitmapOr *node)
+{
+       WRITE_NODE_TYPE("BITMAPOR");
+
+       _outPlanInfo(str, (Plan *) node);
+
+       WRITE_NODE_FIELD(bitmapplans);
+}
+
 static void
 _outScan(StringInfo str, Scan *node)
 {
@@ -333,10 +368,36 @@ _outIndexScan(StringInfo str, IndexScan *node)
 
        _outScanInfo(str, (Scan *) node);
 
-       WRITE_OIDLIST_FIELD(indxid);
-       WRITE_NODE_FIELD(indxqual);
-       WRITE_NODE_FIELD(indxqualorig);
-       WRITE_ENUM_FIELD(indxorderdir, ScanDirection);
+       WRITE_OID_FIELD(indexid);
+       WRITE_NODE_FIELD(indexqual);
+       WRITE_NODE_FIELD(indexqualorig);
+       WRITE_NODE_FIELD(indexstrategy);
+       WRITE_NODE_FIELD(indexsubtype);
+       WRITE_ENUM_FIELD(indexorderdir, ScanDirection);
+}
+
+static void
+_outBitmapIndexScan(StringInfo str, BitmapIndexScan *node)
+{
+       WRITE_NODE_TYPE("BITMAPINDEXSCAN");
+
+       _outScanInfo(str, (Scan *) node);
+
+       WRITE_OID_FIELD(indexid);
+       WRITE_NODE_FIELD(indexqual);
+       WRITE_NODE_FIELD(indexqualorig);
+       WRITE_NODE_FIELD(indexstrategy);
+       WRITE_NODE_FIELD(indexsubtype);
+}
+
+static void
+_outBitmapHeapScan(StringInfo str, BitmapHeapScan *node)
+{
+       WRITE_NODE_TYPE("BITMAPHEAPSCAN");
+
+       _outScanInfo(str, (Scan *) node);
+
+       WRITE_NODE_FIELD(bitmapqualorig);
 }
 
 static void
@@ -346,7 +407,7 @@ _outTidScan(StringInfo str, TidScan *node)
 
        _outScanInfo(str, (Scan *) node);
 
-       WRITE_NODE_FIELD(tideval);
+       WRITE_NODE_FIELD(tidquals);
 }
 
 static void
@@ -357,6 +418,7 @@ _outSubqueryScan(StringInfo str, SubqueryScan *node)
        _outScanInfo(str, (Scan *) node);
 
        WRITE_NODE_FIELD(subplan);
+       WRITE_NODE_FIELD(subrtable);
 }
 
 static void
@@ -365,6 +427,21 @@ _outFunctionScan(StringInfo str, FunctionScan *node)
        WRITE_NODE_TYPE("FUNCTIONSCAN");
 
        _outScanInfo(str, (Scan *) node);
+
+       WRITE_NODE_FIELD(funcexpr);
+       WRITE_NODE_FIELD(funccolnames);
+       WRITE_NODE_FIELD(funccoltypes);
+       WRITE_NODE_FIELD(funccoltypmods);
+}
+
+static void
+_outValuesScan(StringInfo str, ValuesScan *node)
+{
+       WRITE_NODE_TYPE("VALUESSCAN");
+
+       _outScanInfo(str, (Scan *) node);
+
+       WRITE_NODE_FIELD(values_lists);
 }
 
 static void
@@ -386,11 +463,28 @@ _outNestLoop(StringInfo str, NestLoop *node)
 static void
 _outMergeJoin(StringInfo str, MergeJoin *node)
 {
+       int                     numCols;
+       int                     i;
+
        WRITE_NODE_TYPE("MERGEJOIN");
 
        _outJoinPlanInfo(str, (Join *) node);
 
        WRITE_NODE_FIELD(mergeclauses);
+
+       numCols = list_length(node->mergeclauses);
+
+       appendStringInfo(str, " :mergeFamilies");
+       for (i = 0; i < numCols; i++)
+               appendStringInfo(str, " %u", node->mergeFamilies[i]);
+
+       appendStringInfo(str, " :mergeStrategies");
+       for (i = 0; i < numCols; i++)
+               appendStringInfo(str, " %d", node->mergeStrategies[i]);
+
+       appendStringInfo(str, " :mergeNullsFirst");
+       for (i = 0; i < numCols; i++)
+               appendStringInfo(str, " %d", (int) node->mergeNullsFirst[i]);
 }
 
 static void
@@ -429,6 +523,10 @@ _outGroup(StringInfo str, Group *node)
        appendStringInfo(str, " :grpColIdx");
        for (i = 0; i < node->numCols; i++)
                appendStringInfo(str, " %d", node->grpColIdx[i]);
+
+       appendStringInfo(str, " :grpOperators");
+       for (i = 0; i < node->numCols; i++)
+               appendStringInfo(str, " %u", node->grpOperators[i]);
 }
 
 static void
@@ -457,6 +555,10 @@ _outSort(StringInfo str, Sort *node)
        appendStringInfo(str, " :sortOperators");
        for (i = 0; i < node->numCols; i++)
                appendStringInfo(str, " %u", node->sortOperators[i]);
+
+       appendStringInfo(str, " :nullsFirst");
+       for (i = 0; i < node->numCols; i++)
+               appendStringInfo(str, " %s", booltostr(node->nullsFirst[i]));
 }
 
 static void
@@ -473,6 +575,10 @@ _outUnique(StringInfo str, Unique *node)
        appendStringInfo(str, " :uniqColIdx");
        for (i = 0; i < node->numCols; i++)
                appendStringInfo(str, " %d", node->uniqColIdx[i]);
+
+       appendStringInfo(str, " :uniqOperators");
+       for (i = 0; i < node->numCols; i++)
+               appendStringInfo(str, " %u", node->uniqOperators[i]);
 }
 
 static void
@@ -491,6 +597,10 @@ _outSetOp(StringInfo str, SetOp *node)
        for (i = 0; i < node->numCols; i++)
                appendStringInfo(str, " %d", node->dupColIdx[i]);
 
+       appendStringInfo(str, " :dupOperators");
+       for (i = 0; i < node->numCols; i++)
+               appendStringInfo(str, " %d", node->dupOperators[i]);
+
        WRITE_INT_FIELD(flagColIdx);
 }
 
@@ -511,8 +621,6 @@ _outHash(StringInfo str, Hash *node)
        WRITE_NODE_TYPE("HASH");
 
        _outPlanInfo(str, (Plan *) node);
-
-       WRITE_NODE_FIELD(hashkeys);
 }
 
 /*****************************************************************************
@@ -521,21 +629,6 @@ _outHash(StringInfo str, Hash *node)
  *
  *****************************************************************************/
 
-static void
-_outResdom(StringInfo str, Resdom *node)
-{
-       WRITE_NODE_TYPE("RESDOM");
-
-       WRITE_INT_FIELD(resno);
-       WRITE_OID_FIELD(restype);
-       WRITE_INT_FIELD(restypmod);
-       WRITE_STRING_FIELD(resname);
-       WRITE_UINT_FIELD(ressortgroupref);
-       WRITE_OID_FIELD(resorigtbl);
-       WRITE_INT_FIELD(resorigcol);
-       WRITE_BOOL_FIELD(resjunk);
-}
-
 static void
 _outAlias(StringInfo str, Alias *node)
 {
@@ -561,6 +654,18 @@ _outRangeVar(StringInfo str, RangeVar *node)
        WRITE_NODE_FIELD(alias);
 }
 
+static void
+_outIntoClause(StringInfo str, IntoClause *node)
+{
+       WRITE_NODE_TYPE("INTOCLAUSE");
+
+       WRITE_NODE_FIELD(rel);
+       WRITE_NODE_FIELD(colNames);
+       WRITE_NODE_FIELD(options);
+       WRITE_ENUM_FIELD(onCommit, OnCommitAction);
+       WRITE_STRING_FIELD(tableSpaceName);
+}
+
 static void
 _outVar(StringInfo str, Var *node)
 {
@@ -581,6 +686,7 @@ _outConst(StringInfo str, Const *node)
        WRITE_NODE_TYPE("CONST");
 
        WRITE_OID_FIELD(consttype);
+       WRITE_INT_FIELD(consttypmod);
        WRITE_INT_FIELD(constlen);
        WRITE_BOOL_FIELD(constbyval);
        WRITE_BOOL_FIELD(constisnull);
@@ -597,10 +703,10 @@ _outParam(StringInfo str, Param *node)
 {
        WRITE_NODE_TYPE("PARAM");
 
-       WRITE_INT_FIELD(paramkind);
+       WRITE_ENUM_FIELD(paramkind, ParamKind);
        WRITE_INT_FIELD(paramid);
-       WRITE_STRING_FIELD(paramname);
        WRITE_OID_FIELD(paramtype);
+       WRITE_INT_FIELD(paramtypmod);
 }
 
 static void
@@ -610,7 +716,7 @@ _outAggref(StringInfo str, Aggref *node)
 
        WRITE_OID_FIELD(aggfnoid);
        WRITE_OID_FIELD(aggtype);
-       WRITE_NODE_FIELD(target);
+       WRITE_NODE_FIELD(args);
        WRITE_UINT_FIELD(agglevelsup);
        WRITE_BOOL_FIELD(aggstar);
        WRITE_BOOL_FIELD(aggdistinct);
@@ -621,9 +727,9 @@ _outArrayRef(StringInfo str, ArrayRef *node)
 {
        WRITE_NODE_TYPE("ARRAYREF");
 
-       WRITE_OID_FIELD(refrestype);
        WRITE_OID_FIELD(refarraytype);
        WRITE_OID_FIELD(refelemtype);
+       WRITE_INT_FIELD(reftypmod);
        WRITE_NODE_FIELD(refupperindexpr);
        WRITE_NODE_FIELD(reflowerindexpr);
        WRITE_NODE_FIELD(refexpr);
@@ -631,7 +737,7 @@ _outArrayRef(StringInfo str, ArrayRef *node)
 }
 
 static void
-_outFuncExpr(StringInfo str, FuncExpr * node)
+_outFuncExpr(StringInfo str, FuncExpr *node)
 {
        WRITE_NODE_TYPE("FUNCEXPR");
 
@@ -643,7 +749,7 @@ _outFuncExpr(StringInfo str, FuncExpr * node)
 }
 
 static void
-_outOpExpr(StringInfo str, OpExpr * node)
+_outOpExpr(StringInfo str, OpExpr *node)
 {
        WRITE_NODE_TYPE("OPEXPR");
 
@@ -655,7 +761,7 @@ _outOpExpr(StringInfo str, OpExpr * node)
 }
 
 static void
-_outDistinctExpr(StringInfo str, DistinctExpr * node)
+_outDistinctExpr(StringInfo str, DistinctExpr *node)
 {
        WRITE_NODE_TYPE("DISTINCTEXPR");
 
@@ -667,7 +773,7 @@ _outDistinctExpr(StringInfo str, DistinctExpr * node)
 }
 
 static void
-_outScalarArrayOpExpr(StringInfo str, ScalarArrayOpExpr * node)
+_outScalarArrayOpExpr(StringInfo str, ScalarArrayOpExpr *node)
 {
        WRITE_NODE_TYPE("SCALARARRAYOPEXPR");
 
@@ -678,7 +784,7 @@ _outScalarArrayOpExpr(StringInfo str, ScalarArrayOpExpr * node)
 }
 
 static void
-_outBoolExpr(StringInfo str, BoolExpr * node)
+_outBoolExpr(StringInfo str, BoolExpr *node)
 {
        char       *opstr = NULL;
 
@@ -709,10 +815,8 @@ _outSubLink(StringInfo str, SubLink *node)
        WRITE_NODE_TYPE("SUBLINK");
 
        WRITE_ENUM_FIELD(subLinkType, SubLinkType);
-       WRITE_BOOL_FIELD(useOr);
-       WRITE_NODE_FIELD(lefthand);
+       WRITE_NODE_FIELD(testexpr);
        WRITE_NODE_FIELD(operName);
-       WRITE_OIDLIST_FIELD(operOids);
        WRITE_NODE_FIELD(subselect);
 }
 
@@ -722,16 +826,14 @@ _outSubPlan(StringInfo str, SubPlan *node)
        WRITE_NODE_TYPE("SUBPLAN");
 
        WRITE_ENUM_FIELD(subLinkType, SubLinkType);
-       WRITE_BOOL_FIELD(useOr);
-       WRITE_NODE_FIELD(exprs);
-       WRITE_INTLIST_FIELD(paramIds);
-       WRITE_NODE_FIELD(plan);
+       WRITE_NODE_FIELD(testexpr);
+       WRITE_NODE_FIELD(paramIds);
        WRITE_INT_FIELD(plan_id);
-       WRITE_NODE_FIELD(rtable);
+       WRITE_OID_FIELD(firstColType);
        WRITE_BOOL_FIELD(useHashTable);
        WRITE_BOOL_FIELD(unknownEqFalse);
-       WRITE_INTLIST_FIELD(setParam);
-       WRITE_INTLIST_FIELD(parParam);
+       WRITE_NODE_FIELD(setParam);
+       WRITE_NODE_FIELD(parParam);
        WRITE_NODE_FIELD(args);
 }
 
@@ -746,6 +848,17 @@ _outFieldSelect(StringInfo str, FieldSelect *node)
        WRITE_INT_FIELD(resulttypmod);
 }
 
+static void
+_outFieldStore(StringInfo str, FieldStore *node)
+{
+       WRITE_NODE_TYPE("FIELDSTORE");
+
+       WRITE_NODE_FIELD(arg);
+       WRITE_NODE_FIELD(newvals);
+       WRITE_NODE_FIELD(fieldnums);
+       WRITE_OID_FIELD(resulttype);
+}
+
 static void
 _outRelabelType(StringInfo str, RelabelType *node)
 {
@@ -757,6 +870,39 @@ _outRelabelType(StringInfo str, RelabelType *node)
        WRITE_ENUM_FIELD(relabelformat, CoercionForm);
 }
 
+static void
+_outCoerceViaIO(StringInfo str, CoerceViaIO *node)
+{
+       WRITE_NODE_TYPE("COERCEVIAIO");
+
+       WRITE_NODE_FIELD(arg);
+       WRITE_OID_FIELD(resulttype);
+       WRITE_ENUM_FIELD(coerceformat, CoercionForm);
+}
+
+static void
+_outArrayCoerceExpr(StringInfo str, ArrayCoerceExpr *node)
+{
+       WRITE_NODE_TYPE("ARRAYCOERCEEXPR");
+
+       WRITE_NODE_FIELD(arg);
+       WRITE_OID_FIELD(elemfuncid);
+       WRITE_OID_FIELD(resulttype);
+       WRITE_INT_FIELD(resulttypmod);
+       WRITE_BOOL_FIELD(isExplicit);
+       WRITE_ENUM_FIELD(coerceformat, CoercionForm);
+}
+
+static void
+_outConvertRowtypeExpr(StringInfo str, ConvertRowtypeExpr *node)
+{
+       WRITE_NODE_TYPE("CONVERTROWTYPEEXPR");
+
+       WRITE_NODE_FIELD(arg);
+       WRITE_OID_FIELD(resulttype);
+       WRITE_ENUM_FIELD(convertformat, CoercionForm);
+}
+
 static void
 _outCaseExpr(StringInfo str, CaseExpr *node)
 {
@@ -778,18 +924,49 @@ _outCaseWhen(StringInfo str, CaseWhen *node)
 }
 
 static void
-_outArrayExpr(StringInfo str, ArrayExpr * node)
+_outCaseTestExpr(StringInfo str, CaseTestExpr *node)
+{
+       WRITE_NODE_TYPE("CASETESTEXPR");
+
+       WRITE_OID_FIELD(typeId);
+       WRITE_INT_FIELD(typeMod);
+}
+
+static void
+_outArrayExpr(StringInfo str, ArrayExpr *node)
 {
        WRITE_NODE_TYPE("ARRAY");
 
        WRITE_OID_FIELD(array_typeid);
        WRITE_OID_FIELD(element_typeid);
        WRITE_NODE_FIELD(elements);
-       WRITE_INT_FIELD(ndims);
+       WRITE_BOOL_FIELD(multidims);
+}
+
+static void
+_outRowExpr(StringInfo str, RowExpr *node)
+{
+       WRITE_NODE_TYPE("ROW");
+
+       WRITE_NODE_FIELD(args);
+       WRITE_OID_FIELD(row_typeid);
+       WRITE_ENUM_FIELD(row_format, CoercionForm);
 }
 
 static void
-_outCoalesceExpr(StringInfo str, CoalesceExpr * node)
+_outRowCompareExpr(StringInfo str, RowCompareExpr *node)
+{
+       WRITE_NODE_TYPE("ROWCOMPARE");
+
+       WRITE_ENUM_FIELD(rctype, RowCompareType);
+       WRITE_NODE_FIELD(opnos);
+       WRITE_NODE_FIELD(opfamilies);
+       WRITE_NODE_FIELD(largs);
+       WRITE_NODE_FIELD(rargs);
+}
+
+static void
+_outCoalesceExpr(StringInfo str, CoalesceExpr *node)
 {
        WRITE_NODE_TYPE("COALESCE");
 
@@ -798,7 +975,32 @@ _outCoalesceExpr(StringInfo str, CoalesceExpr * node)
 }
 
 static void
-_outNullIfExpr(StringInfo str, NullIfExpr * node)
+_outMinMaxExpr(StringInfo str, MinMaxExpr *node)
+{
+       WRITE_NODE_TYPE("MINMAX");
+
+       WRITE_OID_FIELD(minmaxtype);
+       WRITE_ENUM_FIELD(op, MinMaxOp);
+       WRITE_NODE_FIELD(args);
+}
+
+static void
+_outXmlExpr(StringInfo str, XmlExpr *node)
+{
+       WRITE_NODE_TYPE("XMLEXPR");
+       
+       WRITE_ENUM_FIELD(op, XmlExprOp);
+       WRITE_STRING_FIELD(name);
+       WRITE_NODE_FIELD(named_args);
+       WRITE_NODE_FIELD(arg_names);
+       WRITE_NODE_FIELD(args);
+       WRITE_ENUM_FIELD(xmloption, XmlOptionType);
+       WRITE_OID_FIELD(type);
+       WRITE_INT_FIELD(typmod);
+}
+
+static void
+_outNullIfExpr(StringInfo str, NullIfExpr *node)
 {
        WRITE_NODE_TYPE("NULLIFEXPR");
 
@@ -828,7 +1030,7 @@ _outBooleanTest(StringInfo str, BooleanTest *node)
 }
 
 static void
-_outCoerceToDomain(StringInfo str, CoerceToDomain * node)
+_outCoerceToDomain(StringInfo str, CoerceToDomain *node)
 {
        WRITE_NODE_TYPE("COERCETODOMAIN");
 
@@ -839,7 +1041,7 @@ _outCoerceToDomain(StringInfo str, CoerceToDomain * node)
 }
 
 static void
-_outCoerceToDomainValue(StringInfo str, CoerceToDomainValue * node)
+_outCoerceToDomainValue(StringInfo str, CoerceToDomainValue *node)
 {
        WRITE_NODE_TYPE("COERCETODOMAINVALUE");
 
@@ -848,7 +1050,7 @@ _outCoerceToDomainValue(StringInfo str, CoerceToDomainValue * node)
 }
 
 static void
-_outSetToDefault(StringInfo str, SetToDefault * node)
+_outSetToDefault(StringInfo str, SetToDefault *node)
 {
        WRITE_NODE_TYPE("SETTODEFAULT");
 
@@ -856,13 +1058,27 @@ _outSetToDefault(StringInfo str, SetToDefault * node)
        WRITE_INT_FIELD(typeMod);
 }
 
+static void
+_outCurrentOfExpr(StringInfo str, CurrentOfExpr *node)
+{
+       WRITE_NODE_TYPE("CURRENTOFEXPR");
+
+       WRITE_UINT_FIELD(cvarno);
+       WRITE_STRING_FIELD(cursor_name);
+}
+
 static void
 _outTargetEntry(StringInfo str, TargetEntry *node)
 {
        WRITE_NODE_TYPE("TARGETENTRY");
 
-       WRITE_NODE_FIELD(resdom);
        WRITE_NODE_FIELD(expr);
+       WRITE_INT_FIELD(resno);
+       WRITE_STRING_FIELD(resname);
+       WRITE_UINT_FIELD(ressortgroupref);
+       WRITE_OID_FIELD(resorigtbl);
+       WRITE_INT_FIELD(resorigcol);
+       WRITE_BOOL_FIELD(resjunk);
 }
 
 static void
@@ -939,9 +1155,6 @@ _outPath(StringInfo str, Path *node)
        _outPathInfo(str, (Path *) node);
 }
 
-/*
- *     IndexPath is a subclass of Path.
- */
 static void
 _outIndexPath(StringInfo str, IndexPath *node)
 {
@@ -950,10 +1163,47 @@ _outIndexPath(StringInfo str, IndexPath *node)
        _outPathInfo(str, (Path *) node);
 
        WRITE_NODE_FIELD(indexinfo);
-       WRITE_NODE_FIELD(indexqual);
-       WRITE_NODE_FIELD(indexjoinclauses);
+       WRITE_NODE_FIELD(indexclauses);
+       WRITE_NODE_FIELD(indexquals);
+       WRITE_BOOL_FIELD(isjoininner);
        WRITE_ENUM_FIELD(indexscandir, ScanDirection);
-       WRITE_FLOAT_FIELD(rows, "%.2f");
+       WRITE_FLOAT_FIELD(indextotalcost, "%.2f");
+       WRITE_FLOAT_FIELD(indexselectivity, "%.4f");
+       WRITE_FLOAT_FIELD(rows, "%.0f");
+}
+
+static void
+_outBitmapHeapPath(StringInfo str, BitmapHeapPath *node)
+{
+       WRITE_NODE_TYPE("BITMAPHEAPPATH");
+
+       _outPathInfo(str, (Path *) node);
+
+       WRITE_NODE_FIELD(bitmapqual);
+       WRITE_BOOL_FIELD(isjoininner);
+       WRITE_FLOAT_FIELD(rows, "%.0f");
+}
+
+static void
+_outBitmapAndPath(StringInfo str, BitmapAndPath *node)
+{
+       WRITE_NODE_TYPE("BITMAPANDPATH");
+
+       _outPathInfo(str, (Path *) node);
+
+       WRITE_NODE_FIELD(bitmapquals);
+       WRITE_FLOAT_FIELD(bitmapselectivity, "%.4f");
+}
+
+static void
+_outBitmapOrPath(StringInfo str, BitmapOrPath *node)
+{
+       WRITE_NODE_TYPE("BITMAPORPATH");
+
+       _outPathInfo(str, (Path *) node);
+
+       WRITE_NODE_FIELD(bitmapquals);
+       WRITE_FLOAT_FIELD(bitmapselectivity, "%.4f");
 }
 
 static void
@@ -963,7 +1213,7 @@ _outTidPath(StringInfo str, TidPath *node)
 
        _outPathInfo(str, (Path *) node);
 
-       WRITE_NODE_FIELD(tideval);
+       WRITE_NODE_FIELD(tidquals);
 }
 
 static void
@@ -977,18 +1227,17 @@ _outAppendPath(StringInfo str, AppendPath *node)
 }
 
 static void
-_outResultPath(StringInfo str, ResultPath * node)
+_outResultPath(StringInfo str, ResultPath *node)
 {
        WRITE_NODE_TYPE("RESULTPATH");
 
        _outPathInfo(str, (Path *) node);
 
-       WRITE_NODE_FIELD(subpath);
-       WRITE_NODE_FIELD(constantqual);
+       WRITE_NODE_FIELD(quals);
 }
 
 static void
-_outMaterialPath(StringInfo str, MaterialPath * node)
+_outMaterialPath(StringInfo str, MaterialPath *node)
 {
        WRITE_NODE_TYPE("MATERIALPATH");
 
@@ -998,14 +1247,14 @@ _outMaterialPath(StringInfo str, MaterialPath * node)
 }
 
 static void
-_outUniquePath(StringInfo str, UniquePath * node)
+_outUniquePath(StringInfo str, UniquePath *node)
 {
        WRITE_NODE_TYPE("UNIQUEPATH");
 
        _outPathInfo(str, (Path *) node);
 
        WRITE_NODE_FIELD(subpath);
-       WRITE_BOOL_FIELD(use_hash);
+       WRITE_ENUM_FIELD(umethod, UniquePathMethod);
        WRITE_FLOAT_FIELD(rows, "%.0f");
 }
 
@@ -1040,12 +1289,142 @@ _outHashPath(StringInfo str, HashPath *node)
 }
 
 static void
-_outPathKeyItem(StringInfo str, PathKeyItem *node)
+_outPlannerGlobal(StringInfo str, PlannerGlobal *node)
 {
-       WRITE_NODE_TYPE("PATHKEYITEM");
+       WRITE_NODE_TYPE("PLANNERGLOBAL");
 
-       WRITE_NODE_FIELD(key);
-       WRITE_OID_FIELD(sortop);
+       /* NB: this isn't a complete set of fields */
+       WRITE_NODE_FIELD(paramlist);
+       WRITE_NODE_FIELD(subplans);
+       WRITE_NODE_FIELD(subrtables);
+       WRITE_BITMAPSET_FIELD(rewindPlanIDs);
+       WRITE_NODE_FIELD(finalrtable);
+}
+
+static void
+_outPlannerInfo(StringInfo str, PlannerInfo *node)
+{
+       WRITE_NODE_TYPE("PLANNERINFO");
+
+       /* NB: this isn't a complete set of fields */
+       WRITE_NODE_FIELD(parse);
+       WRITE_NODE_FIELD(glob);
+       WRITE_UINT_FIELD(query_level);
+       WRITE_NODE_FIELD(join_rel_list);
+       WRITE_NODE_FIELD(resultRelations);
+       WRITE_NODE_FIELD(returningLists);
+       WRITE_NODE_FIELD(init_plans);
+       WRITE_NODE_FIELD(eq_classes);
+       WRITE_NODE_FIELD(canon_pathkeys);
+       WRITE_NODE_FIELD(left_join_clauses);
+       WRITE_NODE_FIELD(right_join_clauses);
+       WRITE_NODE_FIELD(full_join_clauses);
+       WRITE_NODE_FIELD(oj_info_list);
+       WRITE_NODE_FIELD(in_info_list);
+       WRITE_NODE_FIELD(append_rel_list);
+       WRITE_NODE_FIELD(query_pathkeys);
+       WRITE_NODE_FIELD(group_pathkeys);
+       WRITE_NODE_FIELD(sort_pathkeys);
+       WRITE_FLOAT_FIELD(total_table_pages, "%.0f");
+       WRITE_FLOAT_FIELD(tuple_fraction, "%.4f");
+       WRITE_BOOL_FIELD(hasJoinRTEs);
+       WRITE_BOOL_FIELD(hasOuterJoins);
+       WRITE_BOOL_FIELD(hasHavingQual);
+       WRITE_BOOL_FIELD(hasPseudoConstantQuals);
+}
+
+static void
+_outRelOptInfo(StringInfo str, RelOptInfo *node)
+{
+       WRITE_NODE_TYPE("RELOPTINFO");
+
+       /* NB: this isn't a complete set of fields */
+       WRITE_ENUM_FIELD(reloptkind, RelOptKind);
+       WRITE_BITMAPSET_FIELD(relids);
+       WRITE_FLOAT_FIELD(rows, "%.0f");
+       WRITE_INT_FIELD(width);
+       WRITE_NODE_FIELD(reltargetlist);
+       WRITE_NODE_FIELD(pathlist);
+       WRITE_NODE_FIELD(cheapest_startup_path);
+       WRITE_NODE_FIELD(cheapest_total_path);
+       WRITE_NODE_FIELD(cheapest_unique_path);
+       WRITE_UINT_FIELD(relid);
+       WRITE_ENUM_FIELD(rtekind, RTEKind);
+       WRITE_INT_FIELD(min_attr);
+       WRITE_INT_FIELD(max_attr);
+       WRITE_NODE_FIELD(indexlist);
+       WRITE_UINT_FIELD(pages);
+       WRITE_FLOAT_FIELD(tuples, "%.0f");
+       WRITE_NODE_FIELD(subplan);
+       WRITE_NODE_FIELD(subrtable);
+       WRITE_NODE_FIELD(baserestrictinfo);
+       WRITE_NODE_FIELD(joininfo);
+       WRITE_BOOL_FIELD(has_eclass_joins);
+       WRITE_BITMAPSET_FIELD(index_outer_relids);
+       WRITE_NODE_FIELD(index_inner_paths);
+}
+
+static void
+_outIndexOptInfo(StringInfo str, IndexOptInfo *node)
+{
+       WRITE_NODE_TYPE("INDEXOPTINFO");
+
+       /* NB: this isn't a complete set of fields */
+       WRITE_OID_FIELD(indexoid);
+       /* Do NOT print rel field, else infinite recursion */
+       WRITE_UINT_FIELD(pages);
+       WRITE_FLOAT_FIELD(tuples, "%.0f");
+       WRITE_INT_FIELD(ncolumns);
+       WRITE_NODE_FIELD(indexprs);
+       WRITE_NODE_FIELD(indpred);
+       WRITE_BOOL_FIELD(predOK);
+       WRITE_BOOL_FIELD(unique);
+}
+
+static void
+_outEquivalenceClass(StringInfo str, EquivalenceClass *node)
+{
+       /*
+        * To simplify reading, we just chase up to the topmost merged EC and
+        * print that, without bothering to show the merge-ees separately.
+        */
+       while (node->ec_merged)
+               node = node->ec_merged;
+
+       WRITE_NODE_TYPE("EQUIVALENCECLASS");
+
+       WRITE_NODE_FIELD(ec_opfamilies);
+       WRITE_NODE_FIELD(ec_members);
+       WRITE_NODE_FIELD(ec_sources);
+       WRITE_NODE_FIELD(ec_derives);
+       WRITE_BITMAPSET_FIELD(ec_relids);
+       WRITE_BOOL_FIELD(ec_has_const);
+       WRITE_BOOL_FIELD(ec_has_volatile);
+       WRITE_BOOL_FIELD(ec_below_outer_join);
+       WRITE_BOOL_FIELD(ec_broken);
+}
+
+static void
+_outEquivalenceMember(StringInfo str, EquivalenceMember *node)
+{
+       WRITE_NODE_TYPE("EQUIVALENCEMEMBER");
+
+       WRITE_NODE_FIELD(em_expr);
+       WRITE_BITMAPSET_FIELD(em_relids);
+       WRITE_BOOL_FIELD(em_is_const);
+       WRITE_BOOL_FIELD(em_is_child);
+       WRITE_OID_FIELD(em_datatype);
+}
+
+static void
+_outPathKey(StringInfo str, PathKey *node)
+{
+       WRITE_NODE_TYPE("PATHKEY");
+
+       WRITE_NODE_FIELD(pk_eclass);
+       WRITE_OID_FIELD(pk_opfamily);
+       WRITE_INT_FIELD(pk_strategy);
+       WRITE_BOOL_FIELD(pk_nulls_first);
 }
 
 static void
@@ -1055,35 +1434,79 @@ _outRestrictInfo(StringInfo str, RestrictInfo *node)
 
        /* NB: this isn't a complete set of fields */
        WRITE_NODE_FIELD(clause);
-       WRITE_BOOL_FIELD(ispusheddown);
-       WRITE_NODE_FIELD(subclauseindices);
+       WRITE_BOOL_FIELD(is_pushed_down);
+       WRITE_BOOL_FIELD(outerjoin_delayed);
+       WRITE_BOOL_FIELD(can_join);
+       WRITE_BOOL_FIELD(pseudoconstant);
+       WRITE_BITMAPSET_FIELD(clause_relids);
+       WRITE_BITMAPSET_FIELD(required_relids);
        WRITE_BITMAPSET_FIELD(left_relids);
        WRITE_BITMAPSET_FIELD(right_relids);
-       WRITE_OID_FIELD(mergejoinoperator);
-       WRITE_OID_FIELD(left_sortop);
-       WRITE_OID_FIELD(right_sortop);
-       WRITE_NODE_FIELD(left_pathkey);
-       WRITE_NODE_FIELD(right_pathkey);
+       WRITE_NODE_FIELD(orclause);
+       /* don't write parent_ec, leads to infinite recursion in plan tree dump */
+       WRITE_NODE_FIELD(mergeopfamilies);
+       /* don't write left_ec, leads to infinite recursion in plan tree dump */
+       /* don't write right_ec, leads to infinite recursion in plan tree dump */
+       WRITE_NODE_FIELD(left_em);
+       WRITE_NODE_FIELD(right_em);
+       WRITE_BOOL_FIELD(outer_is_left);
        WRITE_OID_FIELD(hashjoinoperator);
 }
 
 static void
-_outJoinInfo(StringInfo str, JoinInfo *node)
+_outInnerIndexscanInfo(StringInfo str, InnerIndexscanInfo *node)
 {
-       WRITE_NODE_TYPE("JOININFO");
+       WRITE_NODE_TYPE("INNERINDEXSCANINFO");
+       WRITE_BITMAPSET_FIELD(other_relids);
+       WRITE_BOOL_FIELD(isouterjoin);
+       WRITE_NODE_FIELD(cheapest_startup_innerpath);
+       WRITE_NODE_FIELD(cheapest_total_innerpath);
+}
+
+static void
+_outOuterJoinInfo(StringInfo str, OuterJoinInfo *node)
+{
+       WRITE_NODE_TYPE("OUTERJOININFO");
 
-       WRITE_BITMAPSET_FIELD(unjoined_relids);
-       WRITE_NODE_FIELD(jinfo_restrictinfo);
+       WRITE_BITMAPSET_FIELD(min_lefthand);
+       WRITE_BITMAPSET_FIELD(min_righthand);
+       WRITE_BOOL_FIELD(is_full_join);
+       WRITE_BOOL_FIELD(lhs_strict);
+       WRITE_BOOL_FIELD(delay_upper_joins);
 }
 
 static void
-_outInClauseInfo(StringInfo str, InClauseInfo * node)
+_outInClauseInfo(StringInfo str, InClauseInfo *node)
 {
        WRITE_NODE_TYPE("INCLAUSEINFO");
 
        WRITE_BITMAPSET_FIELD(lefthand);
        WRITE_BITMAPSET_FIELD(righthand);
        WRITE_NODE_FIELD(sub_targetlist);
+       WRITE_NODE_FIELD(in_operators);
+}
+
+static void
+_outAppendRelInfo(StringInfo str, AppendRelInfo *node)
+{
+       WRITE_NODE_TYPE("APPENDRELINFO");
+
+       WRITE_UINT_FIELD(parent_relid);
+       WRITE_UINT_FIELD(child_relid);
+       WRITE_OID_FIELD(parent_reltype);
+       WRITE_OID_FIELD(child_reltype);
+       WRITE_NODE_FIELD(col_mappings);
+       WRITE_NODE_FIELD(translated_vars);
+       WRITE_OID_FIELD(parent_reloid);
+}
+
+static void
+_outPlannerParamItem(StringInfo str, PlannerParamItem *node)
+{
+       WRITE_NODE_TYPE("PLANNERPARAMITEM");
+
+       WRITE_NODE_FIELD(item);
+       WRITE_UINT_FIELD(abslevel);
 }
 
 /*****************************************************************************
@@ -1095,30 +1518,33 @@ _outInClauseInfo(StringInfo str, InClauseInfo * node)
 static void
 _outCreateStmt(StringInfo str, CreateStmt *node)
 {
-       WRITE_NODE_TYPE("CREATE");
+       WRITE_NODE_TYPE("CREATESTMT");
 
        WRITE_NODE_FIELD(relation);
        WRITE_NODE_FIELD(tableElts);
        WRITE_NODE_FIELD(inhRelations);
        WRITE_NODE_FIELD(constraints);
-       WRITE_BOOL_FIELD(hasoids);
+       WRITE_NODE_FIELD(options);
        WRITE_ENUM_FIELD(oncommit, OnCommitAction);
+       WRITE_STRING_FIELD(tablespacename);
 }
 
 static void
 _outIndexStmt(StringInfo str, IndexStmt *node)
 {
-       WRITE_NODE_TYPE("INDEX");
+       WRITE_NODE_TYPE("INDEXSTMT");
 
        WRITE_STRING_FIELD(idxname);
        WRITE_NODE_FIELD(relation);
        WRITE_STRING_FIELD(accessMethod);
+       WRITE_STRING_FIELD(tableSpace);
        WRITE_NODE_FIELD(indexParams);
+       WRITE_NODE_FIELD(options);
        WRITE_NODE_FIELD(whereClause);
-       WRITE_NODE_FIELD(rangetable);
        WRITE_BOOL_FIELD(unique);
        WRITE_BOOL_FIELD(primary);
        WRITE_BOOL_FIELD(isconstraint);
+       WRITE_BOOL_FIELD(concurrent);
 }
 
 static void
@@ -1130,7 +1556,7 @@ _outNotifyStmt(StringInfo str, NotifyStmt *node)
 }
 
 static void
-_outDeclareCursorStmt(StringInfo str, DeclareCursorStmt * node)
+_outDeclareCursorStmt(StringInfo str, DeclareCursorStmt *node)
 {
        WRITE_NODE_TYPE("DECLARECURSOR");
 
@@ -1144,8 +1570,22 @@ _outSelectStmt(StringInfo str, SelectStmt *node)
 {
        WRITE_NODE_TYPE("SELECT");
 
-       /* XXX this is pretty durn incomplete */
+       WRITE_NODE_FIELD(distinctClause);
+       WRITE_NODE_FIELD(intoClause);
+       WRITE_NODE_FIELD(targetList);
+       WRITE_NODE_FIELD(fromClause);
        WRITE_NODE_FIELD(whereClause);
+       WRITE_NODE_FIELD(groupClause);
+       WRITE_NODE_FIELD(havingClause);
+       WRITE_NODE_FIELD(valuesLists);
+       WRITE_NODE_FIELD(sortClause);
+       WRITE_NODE_FIELD(limitOffset);
+       WRITE_NODE_FIELD(limitCount);
+       WRITE_NODE_FIELD(lockingClause);
+       WRITE_ENUM_FIELD(op, SetOperation);
+       WRITE_BOOL_FIELD(all);
+       WRITE_NODE_FIELD(larg);
+       WRITE_NODE_FIELD(rarg);
 }
 
 static void
@@ -1157,6 +1597,36 @@ _outFuncCall(StringInfo str, FuncCall *node)
        WRITE_NODE_FIELD(args);
        WRITE_BOOL_FIELD(agg_star);
        WRITE_BOOL_FIELD(agg_distinct);
+       WRITE_INT_FIELD(location);
+}
+
+static void
+_outDefElem(StringInfo str, DefElem *node)
+{
+       WRITE_NODE_TYPE("DEFELEM");
+
+       WRITE_STRING_FIELD(defname);
+       WRITE_NODE_FIELD(arg);
+}
+
+static void
+_outLockingClause(StringInfo str, LockingClause *node)
+{
+       WRITE_NODE_TYPE("LOCKINGCLAUSE");
+
+       WRITE_NODE_FIELD(lockedRels);
+       WRITE_BOOL_FIELD(forUpdate);
+       WRITE_BOOL_FIELD(noWait);
+}
+
+static void
+_outXmlSerialize(StringInfo str, XmlSerialize *node)
+{
+       WRITE_NODE_TYPE("XMLSERIALIZE");
+
+       WRITE_ENUM_FIELD(xmloption, XmlOptionType);
+       WRITE_NODE_FIELD(expr);
+       WRITE_NODE_FIELD(typename);
 }
 
 static void
@@ -1172,7 +1642,6 @@ _outColumnDef(StringInfo str, ColumnDef *node)
        WRITE_NODE_FIELD(raw_default);
        WRITE_STRING_FIELD(cooked_default);
        WRITE_NODE_FIELD(constraints);
-       WRITE_NODE_FIELD(support);
 }
 
 static void
@@ -1185,8 +1654,10 @@ _outTypeName(StringInfo str, TypeName *node)
        WRITE_BOOL_FIELD(timezone);
        WRITE_BOOL_FIELD(setof);
        WRITE_BOOL_FIELD(pct_type);
-       WRITE_INT_FIELD(typmod);
+       WRITE_NODE_FIELD(typmods);
+       WRITE_INT_FIELD(typemod);
        WRITE_NODE_FIELD(arrayBounds);
+       WRITE_INT_FIELD(location);
 }
 
 static void
@@ -1206,6 +1677,8 @@ _outIndexElem(StringInfo str, IndexElem *node)
        WRITE_STRING_FIELD(name);
        WRITE_NODE_FIELD(expr);
        WRITE_NODE_FIELD(opclass);
+       WRITE_ENUM_FIELD(ordering, SortByDir);
+       WRITE_ENUM_FIELD(nulls_ordering, SortByNulls);
 }
 
 static void
@@ -1220,9 +1693,9 @@ _outQuery(StringInfo str, Query *node)
        /*
         * Hack to work around missing outfuncs routines for a lot of the
         * utility-statement node types.  (The only one we actually *need* for
-        * rules support is NotifyStmt.)  Someday we ought to support 'em all,
-        * but for the meantime do this to avoid getting lots of warnings when
-        * running with debug_print_parse on.
+        * rules support is NotifyStmt.)  Someday we ought to support 'em all, but
+        * for the meantime do this to avoid getting lots of warnings when running
+        * with debug_print_parse on.
         */
        if (node->utilityStmt)
        {
@@ -1243,23 +1716,21 @@ _outQuery(StringInfo str, Query *node)
                appendStringInfo(str, " :utilityStmt <>");
 
        WRITE_INT_FIELD(resultRelation);
-       WRITE_NODE_FIELD(into);
+       WRITE_NODE_FIELD(intoClause);
        WRITE_BOOL_FIELD(hasAggs);
        WRITE_BOOL_FIELD(hasSubLinks);
        WRITE_NODE_FIELD(rtable);
        WRITE_NODE_FIELD(jointree);
-       WRITE_INTLIST_FIELD(rowMarks);
        WRITE_NODE_FIELD(targetList);
+       WRITE_NODE_FIELD(returningList);
        WRITE_NODE_FIELD(groupClause);
        WRITE_NODE_FIELD(havingQual);
        WRITE_NODE_FIELD(distinctClause);
        WRITE_NODE_FIELD(sortClause);
        WRITE_NODE_FIELD(limitOffset);
        WRITE_NODE_FIELD(limitCount);
+       WRITE_NODE_FIELD(rowMarks);
        WRITE_NODE_FIELD(setOperations);
-       WRITE_INTLIST_FIELD(resultRelations);
-
-       /* planner-internal fields are not written out */
 }
 
 static void
@@ -1269,6 +1740,7 @@ _outSortClause(StringInfo str, SortClause *node)
 
        WRITE_UINT_FIELD(tleSortGroupRef);
        WRITE_OID_FIELD(sortop);
+       WRITE_BOOL_FIELD(nulls_first);
 }
 
 static void
@@ -1278,6 +1750,17 @@ _outGroupClause(StringInfo str, GroupClause *node)
 
        WRITE_UINT_FIELD(tleSortGroupRef);
        WRITE_OID_FIELD(sortop);
+       WRITE_BOOL_FIELD(nulls_first);
+}
+
+static void
+_outRowMarkClause(StringInfo str, RowMarkClause *node)
+{
+       WRITE_NODE_TYPE("ROWMARKCLAUSE");
+
+       WRITE_UINT_FIELD(rti);
+       WRITE_BOOL_FIELD(forUpdate);
+       WRITE_BOOL_FIELD(noWait);
 }
 
 static void
@@ -1289,7 +1772,8 @@ _outSetOperationStmt(StringInfo str, SetOperationStmt *node)
        WRITE_BOOL_FIELD(all);
        WRITE_NODE_FIELD(larg);
        WRITE_NODE_FIELD(rarg);
-       WRITE_OIDLIST_FIELD(colTypes);
+       WRITE_NODE_FIELD(colTypes);
+       WRITE_NODE_FIELD(colTypmods);
 }
 
 static void
@@ -1313,7 +1797,11 @@ _outRangeTblEntry(StringInfo str, RangeTblEntry *node)
                        break;
                case RTE_FUNCTION:
                        WRITE_NODE_FIELD(funcexpr);
-                       WRITE_NODE_FIELD(coldeflist);
+                       WRITE_NODE_FIELD(funccoltypes);
+                       WRITE_NODE_FIELD(funccoltypmods);
+                       break;
+               case RTE_VALUES:
+                       WRITE_NODE_FIELD(values_lists);
                        break;
                case RTE_JOIN:
                        WRITE_ENUM_FIELD(jointype, JoinType);
@@ -1326,8 +1814,7 @@ _outRangeTblEntry(StringInfo str, RangeTblEntry *node)
 
        WRITE_BOOL_FIELD(inh);
        WRITE_BOOL_FIELD(inFromCl);
-       WRITE_BOOL_FIELD(checkForRead);
-       WRITE_BOOL_FIELD(checkForWrite);
+       WRITE_UINT_FIELD(requiredPerms);
        WRITE_OID_FIELD(checkAsUser);
 }
 
@@ -1373,6 +1860,10 @@ _outAExpr(StringInfo str, A_Expr *node)
                        appendStringInfo(str, " OF ");
                        WRITE_NODE_FIELD(name);
                        break;
+               case AEXPR_IN:
+                       appendStringInfo(str, " IN ");
+                       WRITE_NODE_FIELD(name);
+                       break;
                default:
                        appendStringInfo(str, " ??");
                        break;
@@ -1380,6 +1871,7 @@ _outAExpr(StringInfo str, A_Expr *node)
 
        WRITE_NODE_FIELD(lexpr);
        WRITE_NODE_FIELD(rexpr);
+       WRITE_INT_FIELD(location);
 }
 
 static void
@@ -1393,10 +1885,10 @@ _outValue(StringInfo str, Value *value)
                case T_Float:
 
                        /*
-                        * We assume the value is a valid numeric literal and so does
-                        * not need quoting.
+                        * We assume the value is a valid numeric literal and so does not
+                        * need quoting.
                         */
-                       appendStringInfo(str, "%s", value->val.str);
+                       appendStringInfoString(str, value->val.str);
                        break;
                case T_String:
                        appendStringInfoChar(str, '"');
@@ -1405,7 +1897,7 @@ _outValue(StringInfo str, Value *value)
                        break;
                case T_BitString:
                        /* internal representation already has leading 'b' */
-                       appendStringInfo(str, "%s", value->val.str);
+                       appendStringInfoString(str, value->val.str);
                        break;
                default:
                        elog(ERROR, "unrecognized node type: %d", (int) value->type);
@@ -1419,7 +1911,7 @@ _outColumnRef(StringInfo str, ColumnRef *node)
        WRITE_NODE_TYPE("COLUMNREF");
 
        WRITE_NODE_FIELD(fields);
-       WRITE_NODE_FIELD(indirection);
+       WRITE_INT_FIELD(location);
 }
 
 static void
@@ -1428,29 +1920,47 @@ _outParamRef(StringInfo str, ParamRef *node)
        WRITE_NODE_TYPE("PARAMREF");
 
        WRITE_INT_FIELD(number);
-       WRITE_NODE_FIELD(fields);
-       WRITE_NODE_FIELD(indirection);
 }
 
 static void
 _outAConst(StringInfo str, A_Const *node)
 {
-       WRITE_NODE_TYPE("CONST ");
+       WRITE_NODE_TYPE("A_CONST");
 
+       appendStringInfo(str, " :val ");
        _outValue(str, &(node->val));
        WRITE_NODE_FIELD(typename);
 }
 
 static void
-_outExprFieldSelect(StringInfo str, ExprFieldSelect *node)
+_outA_Indices(StringInfo str, A_Indices *node)
+{
+       WRITE_NODE_TYPE("A_INDICES");
+
+       WRITE_NODE_FIELD(lidx);
+       WRITE_NODE_FIELD(uidx);
+}
+
+static void
+_outA_Indirection(StringInfo str, A_Indirection *node)
 {
-       WRITE_NODE_TYPE("EXPRFIELDSELECT");
+       WRITE_NODE_TYPE("A_INDIRECTION");
 
        WRITE_NODE_FIELD(arg);
-       WRITE_NODE_FIELD(fields);
        WRITE_NODE_FIELD(indirection);
 }
 
+static void
+_outResTarget(StringInfo str, ResTarget *node)
+{
+       WRITE_NODE_TYPE("RESTARGET");
+
+       WRITE_STRING_FIELD(name);
+       WRITE_NODE_FIELD(indirection);
+       WRITE_NODE_FIELD(val);
+       WRITE_INT_FIELD(location);
+}
+
 static void
 _outConstraint(StringInfo str, Constraint *node)
 {
@@ -1464,6 +1974,15 @@ _outConstraint(StringInfo str, Constraint *node)
                case CONSTR_PRIMARY:
                        appendStringInfo(str, "PRIMARY_KEY");
                        WRITE_NODE_FIELD(keys);
+                       WRITE_NODE_FIELD(options);
+                       WRITE_STRING_FIELD(indexspace);
+                       break;
+
+               case CONSTR_UNIQUE:
+                       appendStringInfo(str, "UNIQUE");
+                       WRITE_NODE_FIELD(keys);
+                       WRITE_NODE_FIELD(options);
+                       WRITE_STRING_FIELD(indexspace);
                        break;
 
                case CONSTR_CHECK:
@@ -1482,11 +2001,6 @@ _outConstraint(StringInfo str, Constraint *node)
                        appendStringInfo(str, "NOT_NULL");
                        break;
 
-               case CONSTR_UNIQUE:
-                       appendStringInfo(str, "UNIQUE");
-                       WRITE_NODE_FIELD(keys);
-                       break;
-
                default:
                        appendStringInfo(str, "<unrecognized_constraint>");
                        break;
@@ -1519,24 +2033,9 @@ static void
 _outNode(StringInfo str, void *obj)
 {
        if (obj == NULL)
-       {
                appendStringInfo(str, "<>");
-               return;
-       }
-
-       if (IsA(obj, List))
-       {
-               List       *l;
-
-               appendStringInfoChar(str, '(');
-               foreach(l, (List *) obj)
-               {
-                       _outNode(str, lfirst(l));
-                       if (lnext(l))
-                               appendStringInfoChar(str, ' ');
-               }
-               appendStringInfoChar(str, ')');
-       }
+       else if (IsA(obj, List) ||IsA(obj, IntList) || IsA(obj, OidList))
+               _outList(str, obj);
        else if (IsA(obj, Integer) ||
                         IsA(obj, Float) ||
                         IsA(obj, String) ||
@@ -1550,6 +2049,9 @@ _outNode(StringInfo str, void *obj)
                appendStringInfoChar(str, '{');
                switch (nodeTag(obj))
                {
+                       case T_PlannedStmt:
+                               _outPlannedStmt(str, obj);
+                               break;
                        case T_Plan:
                                _outPlan(str, obj);
                                break;
@@ -1559,6 +2061,12 @@ _outNode(StringInfo str, void *obj)
                        case T_Append:
                                _outAppend(str, obj);
                                break;
+                       case T_BitmapAnd:
+                               _outBitmapAnd(str, obj);
+                               break;
+                       case T_BitmapOr:
+                               _outBitmapOr(str, obj);
+                               break;
                        case T_Scan:
                                _outScan(str, obj);
                                break;
@@ -1568,6 +2076,12 @@ _outNode(StringInfo str, void *obj)
                        case T_IndexScan:
                                _outIndexScan(str, obj);
                                break;
+                       case T_BitmapIndexScan:
+                               _outBitmapIndexScan(str, obj);
+                               break;
+                       case T_BitmapHeapScan:
+                               _outBitmapHeapScan(str, obj);
+                               break;
                        case T_TidScan:
                                _outTidScan(str, obj);
                                break;
@@ -1577,6 +2091,9 @@ _outNode(StringInfo str, void *obj)
                        case T_FunctionScan:
                                _outFunctionScan(str, obj);
                                break;
+                       case T_ValuesScan:
+                               _outValuesScan(str, obj);
+                               break;
                        case T_Join:
                                _outJoin(str, obj);
                                break;
@@ -1613,15 +2130,15 @@ _outNode(StringInfo str, void *obj)
                        case T_Hash:
                                _outHash(str, obj);
                                break;
-                       case T_Resdom:
-                               _outResdom(str, obj);
-                               break;
                        case T_Alias:
                                _outAlias(str, obj);
                                break;
                        case T_RangeVar:
                                _outRangeVar(str, obj);
                                break;
+                       case T_IntoClause:
+                               _outIntoClause(str, obj);
+                               break;
                        case T_Var:
                                _outVar(str, obj);
                                break;
@@ -1661,21 +2178,48 @@ _outNode(StringInfo str, void *obj)
                        case T_FieldSelect:
                                _outFieldSelect(str, obj);
                                break;
+                       case T_FieldStore:
+                               _outFieldStore(str, obj);
+                               break;
                        case T_RelabelType:
                                _outRelabelType(str, obj);
                                break;
+                       case T_CoerceViaIO:
+                               _outCoerceViaIO(str, obj);
+                               break;
+                       case T_ArrayCoerceExpr:
+                               _outArrayCoerceExpr(str, obj);
+                               break;
+                       case T_ConvertRowtypeExpr:
+                               _outConvertRowtypeExpr(str, obj);
+                               break;
                        case T_CaseExpr:
                                _outCaseExpr(str, obj);
                                break;
                        case T_CaseWhen:
                                _outCaseWhen(str, obj);
                                break;
+                       case T_CaseTestExpr:
+                               _outCaseTestExpr(str, obj);
+                               break;
                        case T_ArrayExpr:
                                _outArrayExpr(str, obj);
                                break;
+                       case T_RowExpr:
+                               _outRowExpr(str, obj);
+                               break;
+                       case T_RowCompareExpr:
+                               _outRowCompareExpr(str, obj);
+                               break;
                        case T_CoalesceExpr:
                                _outCoalesceExpr(str, obj);
                                break;
+                       case T_MinMaxExpr:
+                               _outMinMaxExpr(str, obj);
+                               break;
+                       case T_XmlExpr:
+                               _outXmlExpr(str, obj);
+                               break;
                        case T_NullIfExpr:
                                _outNullIfExpr(str, obj);
                                break;
@@ -1694,6 +2238,9 @@ _outNode(StringInfo str, void *obj)
                        case T_SetToDefault:
                                _outSetToDefault(str, obj);
                                break;
+                       case T_CurrentOfExpr:
+                               _outCurrentOfExpr(str, obj);
+                               break;
                        case T_TargetEntry:
                                _outTargetEntry(str, obj);
                                break;
@@ -1713,6 +2260,15 @@ _outNode(StringInfo str, void *obj)
                        case T_IndexPath:
                                _outIndexPath(str, obj);
                                break;
+                       case T_BitmapHeapPath:
+                               _outBitmapHeapPath(str, obj);
+                               break;
+                       case T_BitmapAndPath:
+                               _outBitmapAndPath(str, obj);
+                               break;
+                       case T_BitmapOrPath:
+                               _outBitmapOrPath(str, obj);
+                               break;
                        case T_TidPath:
                                _outTidPath(str, obj);
                                break;
@@ -1737,18 +2293,45 @@ _outNode(StringInfo str, void *obj)
                        case T_HashPath:
                                _outHashPath(str, obj);
                                break;
-                       case T_PathKeyItem:
-                               _outPathKeyItem(str, obj);
+                       case T_PlannerGlobal:
+                               _outPlannerGlobal(str, obj);
+                               break;
+                       case T_PlannerInfo:
+                               _outPlannerInfo(str, obj);
+                               break;
+                       case T_RelOptInfo:
+                               _outRelOptInfo(str, obj);
+                               break;
+                       case T_IndexOptInfo:
+                               _outIndexOptInfo(str, obj);
+                               break;
+                       case T_EquivalenceClass:
+                               _outEquivalenceClass(str, obj);
+                               break;
+                       case T_EquivalenceMember:
+                               _outEquivalenceMember(str, obj);
+                               break;
+                       case T_PathKey:
+                               _outPathKey(str, obj);
                                break;
                        case T_RestrictInfo:
                                _outRestrictInfo(str, obj);
                                break;
-                       case T_JoinInfo:
-                               _outJoinInfo(str, obj);
+                       case T_InnerIndexscanInfo:
+                               _outInnerIndexscanInfo(str, obj);
+                               break;
+                       case T_OuterJoinInfo:
+                               _outOuterJoinInfo(str, obj);
                                break;
                        case T_InClauseInfo:
                                _outInClauseInfo(str, obj);
                                break;
+                       case T_AppendRelInfo:
+                               _outAppendRelInfo(str, obj);
+                               break;
+                       case T_PlannerParamItem:
+                               _outPlannerParamItem(str, obj);
+                               break;
 
                        case T_CreateStmt:
                                _outCreateStmt(str, obj);
@@ -1786,6 +2369,9 @@ _outNode(StringInfo str, void *obj)
                        case T_GroupClause:
                                _outGroupClause(str, obj);
                                break;
+                       case T_RowMarkClause:
+                               _outRowMarkClause(str, obj);
+                               break;
                        case T_SetOperationStmt:
                                _outSetOperationStmt(str, obj);
                                break;
@@ -1804,8 +2390,14 @@ _outNode(StringInfo str, void *obj)
                        case T_A_Const:
                                _outAConst(str, obj);
                                break;
-                       case T_ExprFieldSelect:
-                               _outExprFieldSelect(str, obj);
+                       case T_A_Indices:
+                               _outA_Indices(str, obj);
+                               break;
+                       case T_A_Indirection:
+                               _outA_Indirection(str, obj);
+                               break;
+                       case T_ResTarget:
+                               _outResTarget(str, obj);
                                break;
                        case T_Constraint:
                                _outConstraint(str, obj);
@@ -1816,13 +2408,21 @@ _outNode(StringInfo str, void *obj)
                        case T_FuncCall:
                                _outFuncCall(str, obj);
                                break;
+                       case T_DefElem:
+                               _outDefElem(str, obj);
+                               break;
+                       case T_LockingClause:
+                               _outLockingClause(str, obj);
+                               break;
+                       case T_XmlSerialize:
+                               _outXmlSerialize(str, obj);
+                               break;
 
                        default:
 
                                /*
-                                * This should be an ERROR, but it's too useful to be able
-                                * to dump structures that _outNode only understands part
-                                * of.
+                                * This should be an ERROR, but it's too useful to be able to
+                                * dump structures that _outNode only understands part of.
                                 */
                                elog(WARNING, "could not dump unrecognized node type: %d",
                                         (int) nodeTag(obj));