]> granicus.if.org Git - postgresql/blobdiff - src/backend/nodes/copyfuncs.c
Fix the plan-invalidation mechanism to treat regclass constants that refer to
[postgresql] / src / backend / nodes / copyfuncs.c
index 90983e6db0ba53339c9410de907c8b402ea4beff..c6393effcd649006f5c3519b58059b08a6767736 100644 (file)
  * be handled easily in a simple depth-first traversal.
  *
  *
- * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.286 2004/06/18 06:13:28 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.383 2007/10/11 18:05:26 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
 
 #include "postgres.h"
 
-#include "nodes/parsenodes.h"
 #include "nodes/plannodes.h"
 #include "nodes/relation.h"
 #include "utils/datum.h"
  * ****************************************************************
  */
 
+/*
+ * _copyPlannedStmt
+ */
+static PlannedStmt *
+_copyPlannedStmt(PlannedStmt *from)
+{
+       PlannedStmt        *newnode = makeNode(PlannedStmt);
+
+       COPY_SCALAR_FIELD(commandType);
+       COPY_SCALAR_FIELD(canSetTag);
+       COPY_NODE_FIELD(planTree);
+       COPY_NODE_FIELD(rtable);
+       COPY_NODE_FIELD(resultRelations);
+       COPY_NODE_FIELD(utilityStmt);
+       COPY_NODE_FIELD(intoClause);
+       COPY_NODE_FIELD(subplans);
+       COPY_BITMAPSET_FIELD(rewindPlanIDs);
+       COPY_NODE_FIELD(returningLists);
+       COPY_NODE_FIELD(rowMarks);
+       COPY_NODE_FIELD(relationOids);
+       COPY_SCALAR_FIELD(nParamExec);
+
+       return newnode;
+}
+
 /*
  * CopyPlanFields
  *
@@ -85,7 +109,6 @@ CopyPlanFields(Plan *from, Plan *newnode)
        COPY_NODE_FIELD(initPlan);
        COPY_BITMAPSET_FIELD(extParam);
        COPY_BITMAPSET_FIELD(allParam);
-       COPY_SCALAR_FIELD(nParamExec);
 }
 
 /*
@@ -148,6 +171,48 @@ _copyAppend(Append *from)
        return newnode;
 }
 
+/*
+ * _copyBitmapAnd
+ */
+static BitmapAnd *
+_copyBitmapAnd(BitmapAnd *from)
+{
+       BitmapAnd  *newnode = makeNode(BitmapAnd);
+
+       /*
+        * copy node superclass fields
+        */
+       CopyPlanFields((Plan *) from, (Plan *) newnode);
+
+       /*
+        * copy remainder of node
+        */
+       COPY_NODE_FIELD(bitmapplans);
+
+       return newnode;
+}
+
+/*
+ * _copyBitmapOr
+ */
+static BitmapOr *
+_copyBitmapOr(BitmapOr *from)
+{
+       BitmapOr   *newnode = makeNode(BitmapOr);
+
+       /*
+        * copy node superclass fields
+        */
+       CopyPlanFields((Plan *) from, (Plan *) newnode);
+
+       /*
+        * copy remainder of node
+        */
+       COPY_NODE_FIELD(bitmapplans);
+
+       return newnode;
+}
+
 
 /*
  * CopyScanFields
@@ -211,13 +276,58 @@ _copyIndexScan(IndexScan *from)
        /*
         * copy remainder of node
         */
-       COPY_NODE_FIELD(indxid);
-       COPY_NODE_FIELD(indxqual);
-       COPY_NODE_FIELD(indxqualorig);
-       COPY_NODE_FIELD(indxstrategy);
-       COPY_NODE_FIELD(indxsubtype);
-       COPY_NODE_FIELD(indxlossy);
-       COPY_SCALAR_FIELD(indxorderdir);
+       COPY_SCALAR_FIELD(indexid);
+       COPY_NODE_FIELD(indexqual);
+       COPY_NODE_FIELD(indexqualorig);
+       COPY_NODE_FIELD(indexstrategy);
+       COPY_NODE_FIELD(indexsubtype);
+       COPY_SCALAR_FIELD(indexorderdir);
+
+       return newnode;
+}
+
+/*
+ * _copyBitmapIndexScan
+ */
+static BitmapIndexScan *
+_copyBitmapIndexScan(BitmapIndexScan *from)
+{
+       BitmapIndexScan *newnode = makeNode(BitmapIndexScan);
+
+       /*
+        * copy node superclass fields
+        */
+       CopyScanFields((Scan *) from, (Scan *) newnode);
+
+       /*
+        * copy remainder of node
+        */
+       COPY_SCALAR_FIELD(indexid);
+       COPY_NODE_FIELD(indexqual);
+       COPY_NODE_FIELD(indexqualorig);
+       COPY_NODE_FIELD(indexstrategy);
+       COPY_NODE_FIELD(indexsubtype);
+
+       return newnode;
+}
+
+/*
+ * _copyBitmapHeapScan
+ */
+static BitmapHeapScan *
+_copyBitmapHeapScan(BitmapHeapScan *from)
+{
+       BitmapHeapScan *newnode = makeNode(BitmapHeapScan);
+
+       /*
+        * copy node superclass fields
+        */
+       CopyScanFields((Scan *) from, (Scan *) newnode);
+
+       /*
+        * copy remainder of node
+        */
+       COPY_NODE_FIELD(bitmapqualorig);
 
        return newnode;
 }
@@ -238,7 +348,7 @@ _copyTidScan(TidScan *from)
        /*
         * copy remainder of node
         */
-       COPY_NODE_FIELD(tideval);
+       COPY_NODE_FIELD(tidquals);
 
        return newnode;
 }
@@ -260,6 +370,7 @@ _copySubqueryScan(SubqueryScan *from)
         * copy remainder of node
         */
        COPY_NODE_FIELD(subplan);
+       COPY_NODE_FIELD(subrtable);
 
        return newnode;
 }
@@ -277,6 +388,35 @@ _copyFunctionScan(FunctionScan *from)
         */
        CopyScanFields((Scan *) from, (Scan *) newnode);
 
+       /*
+        * copy remainder of node
+        */
+       COPY_NODE_FIELD(funcexpr);
+       COPY_NODE_FIELD(funccolnames);
+       COPY_NODE_FIELD(funccoltypes);
+       COPY_NODE_FIELD(funccoltypmods);
+
+       return newnode;
+}
+
+/*
+ * _copyValuesScan
+ */
+static ValuesScan *
+_copyValuesScan(ValuesScan *from)
+{
+       ValuesScan *newnode = makeNode(ValuesScan);
+
+       /*
+        * copy node superclass fields
+        */
+       CopyScanFields((Scan *) from, (Scan *) newnode);
+
+       /*
+        * copy remainder of node
+        */
+       COPY_NODE_FIELD(values_lists);
+
        return newnode;
 }
 
@@ -337,6 +477,7 @@ static MergeJoin *
 _copyMergeJoin(MergeJoin *from)
 {
        MergeJoin  *newnode = makeNode(MergeJoin);
+       int                     numCols;
 
        /*
         * copy node superclass fields
@@ -347,6 +488,10 @@ _copyMergeJoin(MergeJoin *from)
         * copy remainder of node
         */
        COPY_NODE_FIELD(mergeclauses);
+       numCols = list_length(from->mergeclauses);
+       COPY_POINTER_FIELD(mergeFamilies, numCols * sizeof(Oid));
+       COPY_POINTER_FIELD(mergeStrategies, numCols * sizeof(int));
+       COPY_POINTER_FIELD(mergeNullsFirst, numCols * sizeof(bool));
 
        return newnode;
 }
@@ -406,6 +551,7 @@ _copySort(Sort *from)
        COPY_SCALAR_FIELD(numCols);
        COPY_POINTER_FIELD(sortColIdx, from->numCols * sizeof(AttrNumber));
        COPY_POINTER_FIELD(sortOperators, from->numCols * sizeof(Oid));
+       COPY_POINTER_FIELD(nullsFirst, from->numCols * sizeof(bool));
 
        return newnode;
 }
@@ -423,6 +569,7 @@ _copyGroup(Group *from)
 
        COPY_SCALAR_FIELD(numCols);
        COPY_POINTER_FIELD(grpColIdx, from->numCols * sizeof(AttrNumber));
+       COPY_POINTER_FIELD(grpOperators, from->numCols * sizeof(Oid));
 
        return newnode;
 }
@@ -440,7 +587,10 @@ _copyAgg(Agg *from)
        COPY_SCALAR_FIELD(aggstrategy);
        COPY_SCALAR_FIELD(numCols);
        if (from->numCols > 0)
+       {
                COPY_POINTER_FIELD(grpColIdx, from->numCols * sizeof(AttrNumber));
+               COPY_POINTER_FIELD(grpOperators, from->numCols * sizeof(Oid));
+       }
        COPY_SCALAR_FIELD(numGroups);
 
        return newnode;
@@ -464,6 +614,7 @@ _copyUnique(Unique *from)
         */
        COPY_SCALAR_FIELD(numCols);
        COPY_POINTER_FIELD(uniqColIdx, from->numCols * sizeof(AttrNumber));
+       COPY_POINTER_FIELD(uniqOperators, from->numCols * sizeof(Oid));
 
        return newnode;
 }
@@ -507,6 +658,7 @@ _copySetOp(SetOp *from)
        COPY_SCALAR_FIELD(cmd);
        COPY_SCALAR_FIELD(numCols);
        COPY_POINTER_FIELD(dupColIdx, from->numCols * sizeof(AttrNumber));
+       COPY_POINTER_FIELD(dupOperators, from->numCols * sizeof(Oid));
        COPY_SCALAR_FIELD(flagColIdx);
 
        return newnode;
@@ -539,26 +691,6 @@ _copyLimit(Limit *from)
  * ****************************************************************
  */
 
-/*
- * _copyResdom
- */
-static Resdom *
-_copyResdom(Resdom *from)
-{
-       Resdom     *newnode = makeNode(Resdom);
-
-       COPY_SCALAR_FIELD(resno);
-       COPY_SCALAR_FIELD(restype);
-       COPY_SCALAR_FIELD(restypmod);
-       COPY_STRING_FIELD(resname);
-       COPY_SCALAR_FIELD(ressortgroupref);
-       COPY_SCALAR_FIELD(resorigtbl);
-       COPY_SCALAR_FIELD(resorigcol);
-       COPY_SCALAR_FIELD(resjunk);
-
-       return newnode;
-}
-
 /*
  * _copyAlias
  */
@@ -591,6 +723,23 @@ _copyRangeVar(RangeVar *from)
        return newnode;
 }
 
+/*
+ * _copyIntoClause
+ */
+static IntoClause *
+_copyIntoClause(IntoClause *from)
+{
+       IntoClause   *newnode = makeNode(IntoClause);
+
+       COPY_NODE_FIELD(rel);
+       COPY_NODE_FIELD(colNames);
+       COPY_NODE_FIELD(options);
+       COPY_SCALAR_FIELD(onCommit);
+       COPY_STRING_FIELD(tableSpaceName);
+
+       return newnode;
+}
+
 /*
  * We don't need a _copyExpr because Expr is an abstract supertype which
  * should never actually get instantiated.     Also, since it has no common
@@ -626,6 +775,7 @@ _copyConst(Const *from)
        Const      *newnode = makeNode(Const);
 
        COPY_SCALAR_FIELD(consttype);
+       COPY_SCALAR_FIELD(consttypmod);
        COPY_SCALAR_FIELD(constlen);
 
        if (from->constbyval || from->constisnull)
@@ -662,8 +812,8 @@ _copyParam(Param *from)
 
        COPY_SCALAR_FIELD(paramkind);
        COPY_SCALAR_FIELD(paramid);
-       COPY_STRING_FIELD(paramname);
        COPY_SCALAR_FIELD(paramtype);
+       COPY_SCALAR_FIELD(paramtypmod);
 
        return newnode;
 }
@@ -678,7 +828,7 @@ _copyAggref(Aggref *from)
 
        COPY_SCALAR_FIELD(aggfnoid);
        COPY_SCALAR_FIELD(aggtype);
-       COPY_NODE_FIELD(target);
+       COPY_NODE_FIELD(args);
        COPY_SCALAR_FIELD(agglevelsup);
        COPY_SCALAR_FIELD(aggstar);
        COPY_SCALAR_FIELD(aggdistinct);
@@ -694,9 +844,9 @@ _copyArrayRef(ArrayRef *from)
 {
        ArrayRef   *newnode = makeNode(ArrayRef);
 
-       COPY_SCALAR_FIELD(refrestype);
        COPY_SCALAR_FIELD(refarraytype);
        COPY_SCALAR_FIELD(refelemtype);
+       COPY_SCALAR_FIELD(reftypmod);
        COPY_NODE_FIELD(refupperindexpr);
        COPY_NODE_FIELD(reflowerindexpr);
        COPY_NODE_FIELD(refexpr);
@@ -795,10 +945,8 @@ _copySubLink(SubLink *from)
        SubLink    *newnode = makeNode(SubLink);
 
        COPY_SCALAR_FIELD(subLinkType);
-       COPY_SCALAR_FIELD(useOr);
-       COPY_NODE_FIELD(lefthand);
+       COPY_NODE_FIELD(testexpr);
        COPY_NODE_FIELD(operName);
-       COPY_NODE_FIELD(operOids);
        COPY_NODE_FIELD(subselect);
 
        return newnode;
@@ -813,12 +961,10 @@ _copySubPlan(SubPlan *from)
        SubPlan    *newnode = makeNode(SubPlan);
 
        COPY_SCALAR_FIELD(subLinkType);
-       COPY_SCALAR_FIELD(useOr);
-       COPY_NODE_FIELD(exprs);
+       COPY_NODE_FIELD(testexpr);
        COPY_NODE_FIELD(paramIds);
-       COPY_NODE_FIELD(plan);
        COPY_SCALAR_FIELD(plan_id);
-       COPY_NODE_FIELD(rtable);
+       COPY_SCALAR_FIELD(firstColType);
        COPY_SCALAR_FIELD(useHashTable);
        COPY_SCALAR_FIELD(unknownEqFalse);
        COPY_NODE_FIELD(setParam);
@@ -876,6 +1022,54 @@ _copyRelabelType(RelabelType *from)
        return newnode;
 }
 
+/*
+ * _copyCoerceViaIO
+ */
+static CoerceViaIO *
+_copyCoerceViaIO(CoerceViaIO *from)
+{
+       CoerceViaIO   *newnode = makeNode(CoerceViaIO);
+
+       COPY_NODE_FIELD(arg);
+       COPY_SCALAR_FIELD(resulttype);
+       COPY_SCALAR_FIELD(coerceformat);
+
+       return newnode;
+}
+
+/*
+ * _copyArrayCoerceExpr
+ */
+static ArrayCoerceExpr *
+_copyArrayCoerceExpr(ArrayCoerceExpr *from)
+{
+       ArrayCoerceExpr   *newnode = makeNode(ArrayCoerceExpr);
+
+       COPY_NODE_FIELD(arg);
+       COPY_SCALAR_FIELD(elemfuncid);
+       COPY_SCALAR_FIELD(resulttype);
+       COPY_SCALAR_FIELD(resulttypmod);
+       COPY_SCALAR_FIELD(isExplicit);
+       COPY_SCALAR_FIELD(coerceformat);
+
+       return newnode;
+}
+
+/*
+ * _copyConvertRowtypeExpr
+ */
+static ConvertRowtypeExpr *
+_copyConvertRowtypeExpr(ConvertRowtypeExpr *from)
+{
+       ConvertRowtypeExpr *newnode = makeNode(ConvertRowtypeExpr);
+
+       COPY_NODE_FIELD(arg);
+       COPY_SCALAR_FIELD(resulttype);
+       COPY_SCALAR_FIELD(convertformat);
+
+       return newnode;
+}
+
 /*
  * _copyCaseExpr
  */
@@ -942,7 +1136,7 @@ _copyArrayExpr(ArrayExpr *from)
 static RowExpr *
 _copyRowExpr(RowExpr *from)
 {
-       RowExpr  *newnode = makeNode(RowExpr);
+       RowExpr    *newnode = makeNode(RowExpr);
 
        COPY_NODE_FIELD(args);
        COPY_SCALAR_FIELD(row_typeid);
@@ -951,6 +1145,23 @@ _copyRowExpr(RowExpr *from)
        return newnode;
 }
 
+/*
+ * _copyRowCompareExpr
+ */
+static RowCompareExpr *
+_copyRowCompareExpr(RowCompareExpr *from)
+{
+       RowCompareExpr *newnode = makeNode(RowCompareExpr);
+
+       COPY_SCALAR_FIELD(rctype);
+       COPY_NODE_FIELD(opnos);
+       COPY_NODE_FIELD(opfamilies);
+       COPY_NODE_FIELD(largs);
+       COPY_NODE_FIELD(rargs);
+
+       return newnode;
+}
+
 /*
  * _copyCoalesceExpr
  */
@@ -965,6 +1176,41 @@ _copyCoalesceExpr(CoalesceExpr *from)
        return newnode;
 }
 
+/*
+ * _copyMinMaxExpr
+ */
+static MinMaxExpr *
+_copyMinMaxExpr(MinMaxExpr *from)
+{
+       MinMaxExpr *newnode = makeNode(MinMaxExpr);
+
+       COPY_SCALAR_FIELD(minmaxtype);
+       COPY_SCALAR_FIELD(op);
+       COPY_NODE_FIELD(args);
+
+       return newnode;
+}
+
+/*
+ * _copyXmlExpr
+ */
+static XmlExpr *
+_copyXmlExpr(XmlExpr *from)
+{
+       XmlExpr *newnode = makeNode(XmlExpr);
+
+       COPY_SCALAR_FIELD(op);
+       COPY_STRING_FIELD(name);
+       COPY_NODE_FIELD(named_args);
+       COPY_NODE_FIELD(arg_names);
+       COPY_NODE_FIELD(args);
+       COPY_SCALAR_FIELD(xmloption);
+       COPY_SCALAR_FIELD(type);
+       COPY_SCALAR_FIELD(typmod);
+
+       return newnode;
+}
+
 /*
  * _copyNullIfExpr (same as OpExpr)
  */
@@ -1054,6 +1300,21 @@ _copySetToDefault(SetToDefault *from)
        return newnode;
 }
 
+/*
+ * _copyCurrentOfExpr
+ */
+static CurrentOfExpr *
+_copyCurrentOfExpr(CurrentOfExpr *from)
+{
+       CurrentOfExpr *newnode = makeNode(CurrentOfExpr);
+
+       COPY_SCALAR_FIELD(cvarno);
+       COPY_STRING_FIELD(cursor_name);
+       COPY_SCALAR_FIELD(cursor_param);
+
+       return newnode;
+}
+
 /*
  * _copyTargetEntry
  */
@@ -1062,8 +1323,13 @@ _copyTargetEntry(TargetEntry *from)
 {
        TargetEntry *newnode = makeNode(TargetEntry);
 
-       COPY_NODE_FIELD(resdom);
        COPY_NODE_FIELD(expr);
+       COPY_SCALAR_FIELD(resno);
+       COPY_STRING_FIELD(resname);
+       COPY_SCALAR_FIELD(ressortgroupref);
+       COPY_SCALAR_FIELD(resorigtbl);
+       COPY_SCALAR_FIELD(resorigcol);
+       COPY_SCALAR_FIELD(resjunk);
 
        return newnode;
 }
@@ -1124,15 +1390,18 @@ _copyFromExpr(FromExpr *from)
  */
 
 /*
- * _copyPathKeyItem
+ * _copyPathKey
  */
-static PathKeyItem *
-_copyPathKeyItem(PathKeyItem *from)
+static PathKey *
+_copyPathKey(PathKey *from)
 {
-       PathKeyItem *newnode = makeNode(PathKeyItem);
+       PathKey *newnode = makeNode(PathKey);
 
-       COPY_NODE_FIELD(key);
-       COPY_SCALAR_FIELD(sortop);
+       /* EquivalenceClasses are never moved, so just shallow-copy the pointer */
+       COPY_SCALAR_FIELD(pk_eclass);
+       COPY_SCALAR_FIELD(pk_opfamily);
+       COPY_SCALAR_FIELD(pk_strategy);
+       COPY_SCALAR_FIELD(pk_nulls_first);
 
        return newnode;
 }
@@ -1147,27 +1416,27 @@ _copyRestrictInfo(RestrictInfo *from)
 
        COPY_NODE_FIELD(clause);
        COPY_SCALAR_FIELD(is_pushed_down);
-       COPY_SCALAR_FIELD(valid_everywhere);
+       COPY_SCALAR_FIELD(outerjoin_delayed);
        COPY_SCALAR_FIELD(can_join);
+       COPY_SCALAR_FIELD(pseudoconstant);
        COPY_BITMAPSET_FIELD(clause_relids);
+       COPY_BITMAPSET_FIELD(required_relids);
        COPY_BITMAPSET_FIELD(left_relids);
        COPY_BITMAPSET_FIELD(right_relids);
        COPY_NODE_FIELD(orclause);
+       /* EquivalenceClasses are never copied, so shallow-copy the pointers */
+       COPY_SCALAR_FIELD(parent_ec);
        COPY_SCALAR_FIELD(eval_cost);
        COPY_SCALAR_FIELD(this_selec);
-       COPY_SCALAR_FIELD(mergejoinoperator);
-       COPY_SCALAR_FIELD(left_sortop);
-       COPY_SCALAR_FIELD(right_sortop);
-
-       /*
-        * Do not copy pathkeys, since they'd not be canonical in a copied
-        * query
-        */
-       newnode->left_pathkey = NIL;
-       newnode->right_pathkey = NIL;
-
-       COPY_SCALAR_FIELD(left_mergescansel);
-       COPY_SCALAR_FIELD(right_mergescansel);
+       COPY_NODE_FIELD(mergeopfamilies);
+       /* EquivalenceClasses are never copied, so shallow-copy the pointers */
+       COPY_SCALAR_FIELD(left_ec);
+       COPY_SCALAR_FIELD(right_ec);
+       COPY_SCALAR_FIELD(left_em);
+       COPY_SCALAR_FIELD(right_em);
+       /* MergeScanSelCache isn't a Node, so hard to copy; just reset cache */
+       newnode->scansel_cache = NIL;
+       COPY_SCALAR_FIELD(outer_is_left);
        COPY_SCALAR_FIELD(hashjoinoperator);
        COPY_SCALAR_FIELD(left_bucketsize);
        COPY_SCALAR_FIELD(right_bucketsize);
@@ -1176,15 +1445,20 @@ _copyRestrictInfo(RestrictInfo *from)
 }
 
 /*
- * _copyJoinInfo
+ * _copyOuterJoinInfo
  */
-static JoinInfo *
-_copyJoinInfo(JoinInfo *from)
+static OuterJoinInfo *
+_copyOuterJoinInfo(OuterJoinInfo *from)
 {
-       JoinInfo   *newnode = makeNode(JoinInfo);
+       OuterJoinInfo *newnode = makeNode(OuterJoinInfo);
 
-       COPY_BITMAPSET_FIELD(unjoined_relids);
-       COPY_NODE_FIELD(jinfo_restrictinfo);
+       COPY_BITMAPSET_FIELD(min_lefthand);
+       COPY_BITMAPSET_FIELD(min_righthand);
+       COPY_BITMAPSET_FIELD(syn_lefthand);
+       COPY_BITMAPSET_FIELD(syn_righthand);
+       COPY_SCALAR_FIELD(is_full_join);
+       COPY_SCALAR_FIELD(lhs_strict);
+       COPY_SCALAR_FIELD(delay_upper_joins);
 
        return newnode;
 }
@@ -1200,6 +1474,26 @@ _copyInClauseInfo(InClauseInfo *from)
        COPY_BITMAPSET_FIELD(lefthand);
        COPY_BITMAPSET_FIELD(righthand);
        COPY_NODE_FIELD(sub_targetlist);
+       COPY_NODE_FIELD(in_operators);
+
+       return newnode;
+}
+
+/*
+ * _copyAppendRelInfo
+ */
+static AppendRelInfo *
+_copyAppendRelInfo(AppendRelInfo *from)
+{
+       AppendRelInfo *newnode = makeNode(AppendRelInfo);
+
+       COPY_SCALAR_FIELD(parent_relid);
+       COPY_SCALAR_FIELD(child_relid);
+       COPY_SCALAR_FIELD(parent_reltype);
+       COPY_SCALAR_FIELD(child_reltype);
+       COPY_NODE_FIELD(col_mappings);
+       COPY_NODE_FIELD(translated_vars);
+       COPY_SCALAR_FIELD(parent_reloid);
 
        return newnode;
 }
@@ -1218,7 +1512,9 @@ _copyRangeTblEntry(RangeTblEntry *from)
        COPY_SCALAR_FIELD(relid);
        COPY_NODE_FIELD(subquery);
        COPY_NODE_FIELD(funcexpr);
-       COPY_NODE_FIELD(coldeflist);
+       COPY_NODE_FIELD(funccoltypes);
+       COPY_NODE_FIELD(funccoltypmods);
+       COPY_NODE_FIELD(values_lists);
        COPY_SCALAR_FIELD(jointype);
        COPY_NODE_FIELD(joinaliasvars);
        COPY_NODE_FIELD(alias);
@@ -1257,6 +1553,7 @@ _copySortClause(SortClause *from)
 
        COPY_SCALAR_FIELD(tleSortGroupRef);
        COPY_SCALAR_FIELD(sortop);
+       COPY_SCALAR_FIELD(nulls_first);
 
        return newnode;
 }
@@ -1268,6 +1565,19 @@ _copyGroupClause(GroupClause *from)
 
        COPY_SCALAR_FIELD(tleSortGroupRef);
        COPY_SCALAR_FIELD(sortop);
+       COPY_SCALAR_FIELD(nulls_first);
+
+       return newnode;
+}
+
+static RowMarkClause *
+_copyRowMarkClause(RowMarkClause *from)
+{
+       RowMarkClause *newnode = makeNode(RowMarkClause);
+
+       COPY_SCALAR_FIELD(rti);
+       COPY_SCALAR_FIELD(forUpdate);
+       COPY_SCALAR_FIELD(noWait);
 
        return newnode;
 }
@@ -1281,6 +1591,7 @@ _copyAExpr(A_Expr *from)
        COPY_NODE_FIELD(name);
        COPY_NODE_FIELD(lexpr);
        COPY_NODE_FIELD(rexpr);
+       COPY_SCALAR_FIELD(location);
 
        return newnode;
 }
@@ -1291,6 +1602,7 @@ _copyColumnRef(ColumnRef *from)
        ColumnRef  *newnode = makeNode(ColumnRef);
 
        COPY_NODE_FIELD(fields);
+       COPY_SCALAR_FIELD(location);
 
        return newnode;
 }
@@ -1345,6 +1657,7 @@ _copyFuncCall(FuncCall *from)
        COPY_NODE_FIELD(args);
        COPY_SCALAR_FIELD(agg_star);
        COPY_SCALAR_FIELD(agg_distinct);
+       COPY_SCALAR_FIELD(location);
 
        return newnode;
 }
@@ -1379,6 +1692,7 @@ _copyResTarget(ResTarget *from)
        COPY_STRING_FIELD(name);
        COPY_NODE_FIELD(indirection);
        COPY_NODE_FIELD(val);
+       COPY_SCALAR_FIELD(location);
 
        return newnode;
 }
@@ -1393,8 +1707,10 @@ _copyTypeName(TypeName *from)
        COPY_SCALAR_FIELD(timezone);
        COPY_SCALAR_FIELD(setof);
        COPY_SCALAR_FIELD(pct_type);
-       COPY_SCALAR_FIELD(typmod);
+       COPY_NODE_FIELD(typmods);
+       COPY_SCALAR_FIELD(typemod);
        COPY_NODE_FIELD(arrayBounds);
+       COPY_SCALAR_FIELD(location);
 
        return newnode;
 }
@@ -1402,9 +1718,10 @@ _copyTypeName(TypeName *from)
 static SortBy *
 _copySortBy(SortBy *from)
 {
-       SortBy *newnode = makeNode(SortBy);
+       SortBy     *newnode = makeNode(SortBy);
 
-       COPY_SCALAR_FIELD(sortby_kind);
+       COPY_SCALAR_FIELD(sortby_dir);
+       COPY_SCALAR_FIELD(sortby_nulls);
        COPY_NODE_FIELD(useOp);
        COPY_NODE_FIELD(node);
 
@@ -1453,6 +1770,8 @@ _copyIndexElem(IndexElem *from)
        COPY_STRING_FIELD(name);
        COPY_NODE_FIELD(expr);
        COPY_NODE_FIELD(opclass);
+       COPY_SCALAR_FIELD(ordering);
+       COPY_SCALAR_FIELD(nulls_ordering);
 
        return newnode;
 }
@@ -1470,7 +1789,6 @@ _copyColumnDef(ColumnDef *from)
        COPY_NODE_FIELD(raw_default);
        COPY_STRING_FIELD(cooked_default);
        COPY_NODE_FIELD(constraints);
-       COPY_NODE_FIELD(support);
 
        return newnode;
 }
@@ -1485,6 +1803,8 @@ _copyConstraint(Constraint *from)
        COPY_NODE_FIELD(raw_expr);
        COPY_STRING_FIELD(cooked_expr);
        COPY_NODE_FIELD(keys);
+       COPY_NODE_FIELD(options);
+       COPY_STRING_FIELD(indexspace);
 
        return newnode;
 }
@@ -1500,6 +1820,30 @@ _copyDefElem(DefElem *from)
        return newnode;
 }
 
+static LockingClause *
+_copyLockingClause(LockingClause *from)
+{
+       LockingClause *newnode = makeNode(LockingClause);
+
+       COPY_NODE_FIELD(lockedRels);
+       COPY_SCALAR_FIELD(forUpdate);
+       COPY_SCALAR_FIELD(noWait);
+
+       return newnode;
+}
+
+static XmlSerialize *
+_copyXmlSerialize(XmlSerialize *from)
+{
+       XmlSerialize *newnode = makeNode(XmlSerialize);
+
+       COPY_SCALAR_FIELD(xmloption);
+       COPY_NODE_FIELD(expr);
+       COPY_NODE_FIELD(typename);
+
+       return newnode;
+}
+
 static Query *
 _copyQuery(Query *from)
 {
@@ -1510,33 +1854,21 @@ _copyQuery(Query *from)
        COPY_SCALAR_FIELD(canSetTag);
        COPY_NODE_FIELD(utilityStmt);
        COPY_SCALAR_FIELD(resultRelation);
-       COPY_NODE_FIELD(into);
-       COPY_SCALAR_FIELD(intoHasOids);
+       COPY_NODE_FIELD(intoClause);
        COPY_SCALAR_FIELD(hasAggs);
        COPY_SCALAR_FIELD(hasSubLinks);
        COPY_NODE_FIELD(rtable);
        COPY_NODE_FIELD(jointree);
-       COPY_NODE_FIELD(rowMarks);
        COPY_NODE_FIELD(targetList);
+       COPY_NODE_FIELD(returningList);
        COPY_NODE_FIELD(groupClause);
        COPY_NODE_FIELD(havingQual);
        COPY_NODE_FIELD(distinctClause);
        COPY_NODE_FIELD(sortClause);
        COPY_NODE_FIELD(limitOffset);
        COPY_NODE_FIELD(limitCount);
+       COPY_NODE_FIELD(rowMarks);
        COPY_NODE_FIELD(setOperations);
-       COPY_NODE_FIELD(resultRelations);
-       COPY_NODE_FIELD(in_info_list);
-       COPY_SCALAR_FIELD(hasJoinRTEs);
-
-       /*
-        * We do not copy the other planner internal fields: base_rel_list,
-        * other_rel_list, join_rel_list, equi_key_list, query_pathkeys. That
-        * would get us into copying RelOptInfo/Path trees, which we don't
-        * want to do.  It is necessary to copy in_info_list and hasJoinRTEs
-        * for the benefit of inheritance_planner(), which may try to copy a
-        * Query in which these are already set.
-        */
 
        return newnode;
 }
@@ -1548,8 +1880,8 @@ _copyInsertStmt(InsertStmt *from)
 
        COPY_NODE_FIELD(relation);
        COPY_NODE_FIELD(cols);
-       COPY_NODE_FIELD(targetList);
        COPY_NODE_FIELD(selectStmt);
+       COPY_NODE_FIELD(returningList);
 
        return newnode;
 }
@@ -1560,7 +1892,9 @@ _copyDeleteStmt(DeleteStmt *from)
        DeleteStmt *newnode = makeNode(DeleteStmt);
 
        COPY_NODE_FIELD(relation);
+       COPY_NODE_FIELD(usingClause);
        COPY_NODE_FIELD(whereClause);
+       COPY_NODE_FIELD(returningList);
 
        return newnode;
 }
@@ -1574,6 +1908,7 @@ _copyUpdateStmt(UpdateStmt *from)
        COPY_NODE_FIELD(targetList);
        COPY_NODE_FIELD(whereClause);
        COPY_NODE_FIELD(fromClause);
+       COPY_NODE_FIELD(returningList);
 
        return newnode;
 }
@@ -1584,18 +1919,17 @@ _copySelectStmt(SelectStmt *from)
        SelectStmt *newnode = makeNode(SelectStmt);
 
        COPY_NODE_FIELD(distinctClause);
-       COPY_NODE_FIELD(into);
-       COPY_NODE_FIELD(intoColNames);
-       COPY_SCALAR_FIELD(intoHasOids);
+       COPY_NODE_FIELD(intoClause);
        COPY_NODE_FIELD(targetList);
        COPY_NODE_FIELD(fromClause);
        COPY_NODE_FIELD(whereClause);
        COPY_NODE_FIELD(groupClause);
        COPY_NODE_FIELD(havingClause);
+       COPY_NODE_FIELD(valuesLists);
        COPY_NODE_FIELD(sortClause);
        COPY_NODE_FIELD(limitOffset);
        COPY_NODE_FIELD(limitCount);
-       COPY_NODE_FIELD(forUpdate);
+       COPY_NODE_FIELD(lockingClause);
        COPY_SCALAR_FIELD(op);
        COPY_SCALAR_FIELD(all);
        COPY_NODE_FIELD(larg);
@@ -1614,6 +1948,7 @@ _copySetOperationStmt(SetOperationStmt *from)
        COPY_NODE_FIELD(larg);
        COPY_NODE_FIELD(rarg);
        COPY_NODE_FIELD(colTypes);
+       COPY_NODE_FIELD(colTypmods);
 
        return newnode;
 }
@@ -1625,6 +1960,7 @@ _copyAlterTableStmt(AlterTableStmt *from)
 
        COPY_NODE_FIELD(relation);
        COPY_NODE_FIELD(cmds);
+       COPY_SCALAR_FIELD(relkind);
 
        return newnode;
 }
@@ -1678,8 +2014,7 @@ _copyPrivGrantee(PrivGrantee *from)
 {
        PrivGrantee *newnode = makeNode(PrivGrantee);
 
-       COPY_STRING_FIELD(username);
-       COPY_STRING_FIELD(groupname);
+       COPY_STRING_FIELD(rolname);
 
        return newnode;
 }
@@ -1695,6 +2030,21 @@ _copyFuncWithArgs(FuncWithArgs *from)
        return newnode;
 }
 
+static GrantRoleStmt *
+_copyGrantRoleStmt(GrantRoleStmt *from)
+{
+       GrantRoleStmt *newnode = makeNode(GrantRoleStmt);
+
+       COPY_NODE_FIELD(granted_roles);
+       COPY_NODE_FIELD(grantee_roles);
+       COPY_SCALAR_FIELD(is_grant);
+       COPY_SCALAR_FIELD(admin_opt);
+       COPY_STRING_FIELD(grantor);
+       COPY_SCALAR_FIELD(behavior);
+
+       return newnode;
+}
+
 static DeclareCursorStmt *
 _copyDeclareCursorStmt(DeclareCursorStmt *from)
 {
@@ -1734,6 +2084,7 @@ _copyCopyStmt(CopyStmt *from)
        CopyStmt   *newnode = makeNode(CopyStmt);
 
        COPY_NODE_FIELD(relation);
+       COPY_NODE_FIELD(query);
        COPY_NODE_FIELD(attlist);
        COPY_SCALAR_FIELD(is_from);
        COPY_STRING_FIELD(filename);
@@ -1751,7 +2102,7 @@ _copyCreateStmt(CreateStmt *from)
        COPY_NODE_FIELD(tableElts);
        COPY_NODE_FIELD(inhRelations);
        COPY_NODE_FIELD(constraints);
-       COPY_SCALAR_FIELD(hasoids);
+       COPY_NODE_FIELD(options);
        COPY_SCALAR_FIELD(oncommit);
        COPY_STRING_FIELD(tablespacename);
 
@@ -1764,7 +2115,7 @@ _copyInhRelation(InhRelation *from)
        InhRelation *newnode = makeNode(InhRelation);
 
        COPY_NODE_FIELD(relation);
-       COPY_SCALAR_FIELD(including_defaults);
+       COPY_NODE_FIELD(options);
 
        return newnode;
 }
@@ -1775,7 +2126,9 @@ _copyDefineStmt(DefineStmt *from)
        DefineStmt *newnode = makeNode(DefineStmt);
 
        COPY_SCALAR_FIELD(kind);
+       COPY_SCALAR_FIELD(oldstyle);
        COPY_NODE_FIELD(defnames);
+       COPY_NODE_FIELD(args);
        COPY_NODE_FIELD(definition);
 
        return newnode;
@@ -1789,6 +2142,7 @@ _copyDropStmt(DropStmt *from)
        COPY_NODE_FIELD(objects);
        COPY_SCALAR_FIELD(removeType);
        COPY_SCALAR_FIELD(behavior);
+       COPY_SCALAR_FIELD(missing_ok);
 
        return newnode;
 }
@@ -1798,7 +2152,8 @@ _copyTruncateStmt(TruncateStmt *from)
 {
        TruncateStmt *newnode = makeNode(TruncateStmt);
 
-       COPY_NODE_FIELD(relation);
+       COPY_NODE_FIELD(relations);
+       COPY_SCALAR_FIELD(behavior);
 
        return newnode;
 }
@@ -1839,11 +2194,13 @@ _copyIndexStmt(IndexStmt *from)
        COPY_STRING_FIELD(accessMethod);
        COPY_STRING_FIELD(tableSpace);
        COPY_NODE_FIELD(indexParams);
+       COPY_NODE_FIELD(options);
+       COPY_STRING_FIELD(src_options);
        COPY_NODE_FIELD(whereClause);
-       COPY_NODE_FIELD(rangetable);
        COPY_SCALAR_FIELD(unique);
        COPY_SCALAR_FIELD(primary);
        COPY_SCALAR_FIELD(isconstraint);
+       COPY_SCALAR_FIELD(concurrent);
 
        return newnode;
 }
@@ -1870,18 +2227,18 @@ _copyFunctionParameter(FunctionParameter *from)
 
        COPY_STRING_FIELD(name);
        COPY_NODE_FIELD(argType);
+       COPY_SCALAR_FIELD(mode);
 
        return newnode;
 }
 
-static RemoveAggrStmt *
-_copyRemoveAggrStmt(RemoveAggrStmt *from)
+static AlterFunctionStmt *
+_copyAlterFunctionStmt(AlterFunctionStmt *from)
 {
-       RemoveAggrStmt *newnode = makeNode(RemoveAggrStmt);
+       AlterFunctionStmt *newnode = makeNode(AlterFunctionStmt);
 
-       COPY_NODE_FIELD(aggname);
-       COPY_NODE_FIELD(aggtype);
-       COPY_SCALAR_FIELD(behavior);
+       COPY_NODE_FIELD(func);
+       COPY_NODE_FIELD(actions);
 
        return newnode;
 }
@@ -1891,33 +2248,37 @@ _copyRemoveFuncStmt(RemoveFuncStmt *from)
 {
        RemoveFuncStmt *newnode = makeNode(RemoveFuncStmt);
 
-       COPY_NODE_FIELD(funcname);
+       COPY_SCALAR_FIELD(kind);
+       COPY_NODE_FIELD(name);
        COPY_NODE_FIELD(args);
        COPY_SCALAR_FIELD(behavior);
+       COPY_SCALAR_FIELD(missing_ok);
 
        return newnode;
 }
 
-static RemoveOperStmt *
-_copyRemoveOperStmt(RemoveOperStmt *from)
+static RemoveOpClassStmt *
+_copyRemoveOpClassStmt(RemoveOpClassStmt *from)
 {
-       RemoveOperStmt *newnode = makeNode(RemoveOperStmt);
+       RemoveOpClassStmt *newnode = makeNode(RemoveOpClassStmt);
 
-       COPY_NODE_FIELD(opname);
-       COPY_NODE_FIELD(args);
+       COPY_NODE_FIELD(opclassname);
+       COPY_STRING_FIELD(amname);
        COPY_SCALAR_FIELD(behavior);
+       COPY_SCALAR_FIELD(missing_ok);
 
        return newnode;
 }
 
-static RemoveOpClassStmt *
-_copyRemoveOpClassStmt(RemoveOpClassStmt *from)
+static RemoveOpFamilyStmt *
+_copyRemoveOpFamilyStmt(RemoveOpFamilyStmt *from)
 {
-       RemoveOpClassStmt *newnode = makeNode(RemoveOpClassStmt);
+       RemoveOpFamilyStmt *newnode = makeNode(RemoveOpFamilyStmt);
 
-       COPY_NODE_FIELD(opclassname);
+       COPY_NODE_FIELD(opfamilyname);
        COPY_STRING_FIELD(amname);
        COPY_SCALAR_FIELD(behavior);
+       COPY_SCALAR_FIELD(missing_ok);
 
        return newnode;
 }
@@ -1927,12 +2288,42 @@ _copyRenameStmt(RenameStmt *from)
 {
        RenameStmt *newnode = makeNode(RenameStmt);
 
+       COPY_SCALAR_FIELD(renameType);
        COPY_NODE_FIELD(relation);
        COPY_NODE_FIELD(object);
        COPY_NODE_FIELD(objarg);
        COPY_STRING_FIELD(subname);
        COPY_STRING_FIELD(newname);
-       COPY_SCALAR_FIELD(renameType);
+
+       return newnode;
+}
+
+static AlterObjectSchemaStmt *
+_copyAlterObjectSchemaStmt(AlterObjectSchemaStmt *from)
+{
+       AlterObjectSchemaStmt *newnode = makeNode(AlterObjectSchemaStmt);
+
+       COPY_SCALAR_FIELD(objectType);
+       COPY_NODE_FIELD(relation);
+       COPY_NODE_FIELD(object);
+       COPY_NODE_FIELD(objarg);
+       COPY_STRING_FIELD(addname);
+       COPY_STRING_FIELD(newschema);
+
+       return newnode;
+}
+
+static AlterOwnerStmt *
+_copyAlterOwnerStmt(AlterOwnerStmt *from)
+{
+       AlterOwnerStmt *newnode = makeNode(AlterOwnerStmt);
+
+       COPY_SCALAR_FIELD(objectType);
+       COPY_NODE_FIELD(relation);
+       COPY_NODE_FIELD(object);
+       COPY_NODE_FIELD(objarg);
+       COPY_STRING_FIELD(addname);
+       COPY_STRING_FIELD(newowner);
 
        return newnode;
 }
@@ -1990,6 +2381,7 @@ _copyTransactionStmt(TransactionStmt *from)
 
        COPY_SCALAR_FIELD(kind);
        COPY_NODE_FIELD(options);
+       COPY_STRING_FIELD(gid);
 
        return newnode;
 }
@@ -2005,6 +2397,17 @@ _copyCompositeTypeStmt(CompositeTypeStmt *from)
        return newnode;
 }
 
+static CreateEnumStmt *
+_copyCreateEnumStmt(CreateEnumStmt *from)
+{
+       CreateEnumStmt *newnode = makeNode(CreateEnumStmt);
+
+       COPY_NODE_FIELD(typename);
+       COPY_NODE_FIELD(vals);
+
+       return newnode;
+}
+
 static ViewStmt *
 _copyViewStmt(ViewStmt *from)
 {
@@ -2046,6 +2449,7 @@ _copyCreateOpClassStmt(CreateOpClassStmt *from)
        CreateOpClassStmt *newnode = makeNode(CreateOpClassStmt);
 
        COPY_NODE_FIELD(opclassname);
+       COPY_NODE_FIELD(opfamilyname);
        COPY_STRING_FIELD(amname);
        COPY_NODE_FIELD(datatype);
        COPY_NODE_FIELD(items);
@@ -2064,11 +2468,36 @@ _copyCreateOpClassItem(CreateOpClassItem *from)
        COPY_NODE_FIELD(args);
        COPY_SCALAR_FIELD(number);
        COPY_SCALAR_FIELD(recheck);
+       COPY_NODE_FIELD(class_args);
        COPY_NODE_FIELD(storedtype);
 
        return newnode;
 }
 
+static CreateOpFamilyStmt *
+_copyCreateOpFamilyStmt(CreateOpFamilyStmt *from)
+{
+       CreateOpFamilyStmt *newnode = makeNode(CreateOpFamilyStmt);
+
+       COPY_NODE_FIELD(opfamilyname);
+       COPY_STRING_FIELD(amname);
+
+       return newnode;
+}
+
+static AlterOpFamilyStmt *
+_copyAlterOpFamilyStmt(AlterOpFamilyStmt *from)
+{
+       AlterOpFamilyStmt *newnode = makeNode(AlterOpFamilyStmt);
+
+       COPY_NODE_FIELD(opfamilyname);
+       COPY_STRING_FIELD(amname);
+       COPY_SCALAR_FIELD(isDrop);
+       COPY_NODE_FIELD(items);
+
+       return newnode;
+}
+
 static CreatedbStmt *
 _copyCreatedbStmt(CreatedbStmt *from)
 {
@@ -2080,13 +2509,13 @@ _copyCreatedbStmt(CreatedbStmt *from)
        return newnode;
 }
 
-static AlterDbOwnerStmt *
-_copyAlterDbOwnerStmt(AlterDbOwnerStmt *from)
+static AlterDatabaseStmt *
+_copyAlterDatabaseStmt(AlterDatabaseStmt *from)
 {
-       AlterDbOwnerStmt *newnode = makeNode(AlterDbOwnerStmt);
+       AlterDatabaseStmt *newnode = makeNode(AlterDatabaseStmt);
 
        COPY_STRING_FIELD(dbname);
-       COPY_STRING_FIELD(uname);
+       COPY_NODE_FIELD(options);
 
        return newnode;
 }
@@ -2097,8 +2526,7 @@ _copyAlterDatabaseSetStmt(AlterDatabaseSetStmt *from)
        AlterDatabaseSetStmt *newnode = makeNode(AlterDatabaseSetStmt);
 
        COPY_STRING_FIELD(dbname);
-       COPY_STRING_FIELD(variable);
-       COPY_NODE_FIELD(value);
+       COPY_NODE_FIELD(setstmt);
 
        return newnode;
 }
@@ -2109,6 +2537,7 @@ _copyDropdbStmt(DropdbStmt *from)
        DropdbStmt *newnode = makeNode(DropdbStmt);
 
        COPY_STRING_FIELD(dbname);
+       COPY_SCALAR_FIELD(missing_ok);
 
        return newnode;
 }
@@ -2121,8 +2550,8 @@ _copyVacuumStmt(VacuumStmt *from)
        COPY_SCALAR_FIELD(vacuum);
        COPY_SCALAR_FIELD(full);
        COPY_SCALAR_FIELD(analyze);
-       COPY_SCALAR_FIELD(freeze);
        COPY_SCALAR_FIELD(verbose);
+       COPY_SCALAR_FIELD(freeze_min_age);
        COPY_NODE_FIELD(relation);
        COPY_NODE_FIELD(va_cols);
 
@@ -2148,7 +2577,6 @@ _copyCreateSeqStmt(CreateSeqStmt *from)
 
        COPY_NODE_FIELD(sequence);
        COPY_NODE_FIELD(options);
-       COPY_STRING_FIELD(tablespacename);
 
        return newnode;
 }
@@ -2169,6 +2597,7 @@ _copyVariableSetStmt(VariableSetStmt *from)
 {
        VariableSetStmt *newnode = makeNode(VariableSetStmt);
 
+       COPY_SCALAR_FIELD(kind);
        COPY_STRING_FIELD(name);
        COPY_NODE_FIELD(args);
        COPY_SCALAR_FIELD(is_local);
@@ -2186,12 +2615,12 @@ _copyVariableShowStmt(VariableShowStmt *from)
        return newnode;
 }
 
-static VariableResetStmt *
-_copyVariableResetStmt(VariableResetStmt *from)
+static DiscardStmt *
+_copyDiscardStmt(DiscardStmt *from)
 {
-       VariableResetStmt *newnode = makeNode(VariableResetStmt);
+       DiscardStmt *newnode = makeNode(DiscardStmt);
 
-       COPY_STRING_FIELD(name);
+       COPY_SCALAR_FIELD(target);
 
        return newnode;
 }
@@ -2214,6 +2643,7 @@ _copyDropTableSpaceStmt(DropTableSpaceStmt *from)
        DropTableSpaceStmt *newnode = makeNode(DropTableSpaceStmt);
 
        COPY_STRING_FIELD(tablespacename);
+       COPY_SCALAR_FIELD(missing_ok);
 
        return newnode;
 }
@@ -2247,6 +2677,7 @@ _copyDropPropertyStmt(DropPropertyStmt *from)
        COPY_STRING_FIELD(property);
        COPY_SCALAR_FIELD(removeType);
        COPY_SCALAR_FIELD(behavior);
+       COPY_SCALAR_FIELD(missing_ok);
 
        return newnode;
 }
@@ -2271,50 +2702,53 @@ _copyDropPLangStmt(DropPLangStmt *from)
 
        COPY_STRING_FIELD(plname);
        COPY_SCALAR_FIELD(behavior);
+       COPY_SCALAR_FIELD(missing_ok);
 
        return newnode;
 }
 
-static CreateUserStmt *
-_copyCreateUserStmt(CreateUserStmt *from)
+static CreateRoleStmt *
+_copyCreateRoleStmt(CreateRoleStmt *from)
 {
-       CreateUserStmt *newnode = makeNode(CreateUserStmt);
+       CreateRoleStmt *newnode = makeNode(CreateRoleStmt);
 
-       COPY_STRING_FIELD(user);
+       COPY_SCALAR_FIELD(stmt_type);
+       COPY_STRING_FIELD(role);
        COPY_NODE_FIELD(options);
 
        return newnode;
 }
 
-static AlterUserStmt *
-_copyAlterUserStmt(AlterUserStmt *from)
+static AlterRoleStmt *
+_copyAlterRoleStmt(AlterRoleStmt *from)
 {
-       AlterUserStmt *newnode = makeNode(AlterUserStmt);
+       AlterRoleStmt *newnode = makeNode(AlterRoleStmt);
 
-       COPY_STRING_FIELD(user);
+       COPY_STRING_FIELD(role);
        COPY_NODE_FIELD(options);
+       COPY_SCALAR_FIELD(action);
 
        return newnode;
 }
 
-static AlterUserSetStmt *
-_copyAlterUserSetStmt(AlterUserSetStmt *from)
+static AlterRoleSetStmt *
+_copyAlterRoleSetStmt(AlterRoleSetStmt *from)
 {
-       AlterUserSetStmt *newnode = makeNode(AlterUserSetStmt);
+       AlterRoleSetStmt *newnode = makeNode(AlterRoleSetStmt);
 
-       COPY_STRING_FIELD(user);
-       COPY_STRING_FIELD(variable);
-       COPY_NODE_FIELD(value);
+       COPY_STRING_FIELD(role);
+       COPY_NODE_FIELD(setstmt);
 
        return newnode;
 }
 
-static DropUserStmt *
-_copyDropUserStmt(DropUserStmt *from)
+static DropRoleStmt *
+_copyDropRoleStmt(DropRoleStmt *from)
 {
-       DropUserStmt *newnode = makeNode(DropUserStmt);
+       DropRoleStmt *newnode = makeNode(DropRoleStmt);
 
-       COPY_NODE_FIELD(users);
+       COPY_NODE_FIELD(roles);
+       COPY_SCALAR_FIELD(missing_ok);
 
        return newnode;
 }
@@ -2342,39 +2776,6 @@ _copyConstraintsSetStmt(ConstraintsSetStmt *from)
        return newnode;
 }
 
-static CreateGroupStmt *
-_copyCreateGroupStmt(CreateGroupStmt *from)
-{
-       CreateGroupStmt *newnode = makeNode(CreateGroupStmt);
-
-       COPY_STRING_FIELD(name);
-       COPY_NODE_FIELD(options);
-
-       return newnode;
-}
-
-static AlterGroupStmt *
-_copyAlterGroupStmt(AlterGroupStmt *from)
-{
-       AlterGroupStmt *newnode = makeNode(AlterGroupStmt);
-
-       COPY_STRING_FIELD(name);
-       COPY_SCALAR_FIELD(action);
-       COPY_NODE_FIELD(listUsers);
-
-       return newnode;
-}
-
-static DropGroupStmt *
-_copyDropGroupStmt(DropGroupStmt *from)
-{
-       DropGroupStmt *newnode = makeNode(DropGroupStmt);
-
-       COPY_STRING_FIELD(name);
-
-       return newnode;
-}
-
 static ReindexStmt *
 _copyReindexStmt(ReindexStmt *from)
 {
@@ -2383,8 +2784,8 @@ _copyReindexStmt(ReindexStmt *from)
        COPY_SCALAR_FIELD(kind);
        COPY_NODE_FIELD(relation);
        COPY_STRING_FIELD(name);
-       COPY_SCALAR_FIELD(force);
-       COPY_SCALAR_FIELD(all);
+       COPY_SCALAR_FIELD(do_system);
+       COPY_SCALAR_FIELD(do_user);
 
        return newnode;
 }
@@ -2396,7 +2797,6 @@ _copyCreateSchemaStmt(CreateSchemaStmt *from)
 
        COPY_STRING_FIELD(schemaname);
        COPY_STRING_FIELD(authid);
-       COPY_STRING_FIELD(tablespacename);
        COPY_NODE_FIELD(schemaElts);
 
        return newnode;
@@ -2437,6 +2837,7 @@ _copyDropCastStmt(DropCastStmt *from)
        COPY_NODE_FIELD(sourcetype);
        COPY_NODE_FIELD(targettype);
        COPY_SCALAR_FIELD(behavior);
+       COPY_SCALAR_FIELD(missing_ok);
 
        return newnode;
 }
@@ -2448,7 +2849,6 @@ _copyPrepareStmt(PrepareStmt *from)
 
        COPY_STRING_FIELD(name);
        COPY_NODE_FIELD(argtypes);
-       COPY_NODE_FIELD(argtype_oids);
        COPY_NODE_FIELD(query);
 
        return newnode;
@@ -2476,6 +2876,27 @@ _copyDeallocateStmt(DeallocateStmt *from)
        return newnode;
 }
 
+static DropOwnedStmt *
+_copyDropOwnedStmt(DropOwnedStmt *from)
+{
+       DropOwnedStmt *newnode = makeNode(DropOwnedStmt);
+
+       COPY_NODE_FIELD(roles);
+       COPY_SCALAR_FIELD(behavior);
+
+       return newnode;
+}
+
+static ReassignOwnedStmt *
+_copyReassignOwnedStmt(ReassignOwnedStmt *from)
+{
+       ReassignOwnedStmt *newnode = makeNode(ReassignOwnedStmt);
+
+       COPY_NODE_FIELD(roles);
+       COPY_SCALAR_FIELD(newrole);
+
+       return newnode;
+}
 
 /* ****************************************************************
  *                                     pg_list.h copy functions
@@ -2494,9 +2915,9 @@ _copyDeallocateStmt(DeallocateStmt *from)
 static List *
 _copyList(List *from)
 {
-       List            *new;
-       ListCell        *curr_old;
-       ListCell        *prev_new;
+       List       *new;
+       ListCell   *curr_old;
+       ListCell   *prev_new;
 
        Assert(list_length(from) >= 1);
 
@@ -2571,6 +2992,9 @@ copyObject(void *from)
                        /*
                         * PLAN NODES
                         */
+               case T_PlannedStmt:
+                       retval = _copyPlannedStmt(from);
+                       break;
                case T_Plan:
                        retval = _copyPlan(from);
                        break;
@@ -2580,6 +3004,12 @@ copyObject(void *from)
                case T_Append:
                        retval = _copyAppend(from);
                        break;
+               case T_BitmapAnd:
+                       retval = _copyBitmapAnd(from);
+                       break;
+               case T_BitmapOr:
+                       retval = _copyBitmapOr(from);
+                       break;
                case T_Scan:
                        retval = _copyScan(from);
                        break;
@@ -2589,6 +3019,12 @@ copyObject(void *from)
                case T_IndexScan:
                        retval = _copyIndexScan(from);
                        break;
+               case T_BitmapIndexScan:
+                       retval = _copyBitmapIndexScan(from);
+                       break;
+               case T_BitmapHeapScan:
+                       retval = _copyBitmapHeapScan(from);
+                       break;
                case T_TidScan:
                        retval = _copyTidScan(from);
                        break;
@@ -2598,6 +3034,9 @@ copyObject(void *from)
                case T_FunctionScan:
                        retval = _copyFunctionScan(from);
                        break;
+               case T_ValuesScan:
+                       retval = _copyValuesScan(from);
+                       break;
                case T_Join:
                        retval = _copyJoin(from);
                        break;
@@ -2638,15 +3077,15 @@ copyObject(void *from)
                        /*
                         * PRIMITIVE NODES
                         */
-               case T_Resdom:
-                       retval = _copyResdom(from);
-                       break;
                case T_Alias:
                        retval = _copyAlias(from);
                        break;
                case T_RangeVar:
                        retval = _copyRangeVar(from);
                        break;
+               case T_IntoClause:
+                       retval = _copyIntoClause(from);
+                       break;
                case T_Var:
                        retval = _copyVar(from);
                        break;
@@ -2692,6 +3131,15 @@ copyObject(void *from)
                case T_RelabelType:
                        retval = _copyRelabelType(from);
                        break;
+               case T_CoerceViaIO:
+                       retval = _copyCoerceViaIO(from);
+                       break;
+               case T_ArrayCoerceExpr:
+                       retval = _copyArrayCoerceExpr(from);
+                       break;
+               case T_ConvertRowtypeExpr:
+                       retval = _copyConvertRowtypeExpr(from);
+                       break;
                case T_CaseExpr:
                        retval = _copyCaseExpr(from);
                        break;
@@ -2707,9 +3155,18 @@ copyObject(void *from)
                case T_RowExpr:
                        retval = _copyRowExpr(from);
                        break;
+               case T_RowCompareExpr:
+                       retval = _copyRowCompareExpr(from);
+                       break;
                case T_CoalesceExpr:
                        retval = _copyCoalesceExpr(from);
                        break;
+               case T_MinMaxExpr:
+                       retval = _copyMinMaxExpr(from);
+                       break;
+               case T_XmlExpr:
+                       retval = _copyXmlExpr(from);
+                       break;
                case T_NullIfExpr:
                        retval = _copyNullIfExpr(from);
                        break;
@@ -2728,6 +3185,9 @@ copyObject(void *from)
                case T_SetToDefault:
                        retval = _copySetToDefault(from);
                        break;
+               case T_CurrentOfExpr:
+                       retval = _copyCurrentOfExpr(from);
+                       break;
                case T_TargetEntry:
                        retval = _copyTargetEntry(from);
                        break;
@@ -2744,18 +3204,21 @@ copyObject(void *from)
                        /*
                         * RELATION NODES
                         */
-               case T_PathKeyItem:
-                       retval = _copyPathKeyItem(from);
+               case T_PathKey:
+                       retval = _copyPathKey(from);
                        break;
                case T_RestrictInfo:
                        retval = _copyRestrictInfo(from);
                        break;
-               case T_JoinInfo:
-                       retval = _copyJoinInfo(from);
+               case T_OuterJoinInfo:
+                       retval = _copyOuterJoinInfo(from);
                        break;
                case T_InClauseInfo:
                        retval = _copyInClauseInfo(from);
                        break;
+               case T_AppendRelInfo:
+                       retval = _copyAppendRelInfo(from);
+                       break;
 
                        /*
                         * VALUE NODES
@@ -2774,10 +3237,10 @@ copyObject(void *from)
                case T_List:
                        retval = _copyList(from);
                        break;
+
                        /*
-                        * Lists of integers and OIDs don't need to be
-                        * deep-copied, so we perform a shallow copy via
-                        * list_copy()
+                        * Lists of integers and OIDs don't need to be deep-copied, so we
+                        * perform a shallow copy via list_copy()
                         */
                case T_IntList:
                case T_OidList:
@@ -2817,6 +3280,9 @@ copyObject(void *from)
                case T_GrantStmt:
                        retval = _copyGrantStmt(from);
                        break;
+               case T_GrantRoleStmt:
+                       retval = _copyGrantRoleStmt(from);
+                       break;
                case T_DeclareCursorStmt:
                        retval = _copyDeclareCursorStmt(from);
                        break;
@@ -2859,21 +3325,27 @@ copyObject(void *from)
                case T_FunctionParameter:
                        retval = _copyFunctionParameter(from);
                        break;
-               case T_RemoveAggrStmt:
-                       retval = _copyRemoveAggrStmt(from);
+               case T_AlterFunctionStmt:
+                       retval = _copyAlterFunctionStmt(from);
                        break;
                case T_RemoveFuncStmt:
                        retval = _copyRemoveFuncStmt(from);
                        break;
-               case T_RemoveOperStmt:
-                       retval = _copyRemoveOperStmt(from);
-                       break;
                case T_RemoveOpClassStmt:
                        retval = _copyRemoveOpClassStmt(from);
                        break;
+               case T_RemoveOpFamilyStmt:
+                       retval = _copyRemoveOpFamilyStmt(from);
+                       break;
                case T_RenameStmt:
                        retval = _copyRenameStmt(from);
                        break;
+               case T_AlterObjectSchemaStmt:
+                       retval = _copyAlterObjectSchemaStmt(from);
+                       break;
+               case T_AlterOwnerStmt:
+                       retval = _copyAlterOwnerStmt(from);
+                       break;
                case T_RuleStmt:
                        retval = _copyRuleStmt(from);
                        break;
@@ -2892,6 +3364,9 @@ copyObject(void *from)
                case T_CompositeTypeStmt:
                        retval = _copyCompositeTypeStmt(from);
                        break;
+               case T_CreateEnumStmt:
+                       retval = _copyCreateEnumStmt(from);
+                       break;
                case T_ViewStmt:
                        retval = _copyViewStmt(from);
                        break;
@@ -2907,11 +3382,17 @@ copyObject(void *from)
                case T_CreateOpClassItem:
                        retval = _copyCreateOpClassItem(from);
                        break;
+               case T_CreateOpFamilyStmt:
+                       retval = _copyCreateOpFamilyStmt(from);
+                       break;
+               case T_AlterOpFamilyStmt:
+                       retval = _copyAlterOpFamilyStmt(from);
+                       break;
                case T_CreatedbStmt:
                        retval = _copyCreatedbStmt(from);
                        break;
-               case T_AlterDbOwnerStmt:
-                       retval = _copyAlterDbOwnerStmt(from);
+               case T_AlterDatabaseStmt:
+                       retval = _copyAlterDatabaseStmt(from);
                        break;
                case T_AlterDatabaseSetStmt:
                        retval = _copyAlterDatabaseSetStmt(from);
@@ -2937,8 +3418,8 @@ copyObject(void *from)
                case T_VariableShowStmt:
                        retval = _copyVariableShowStmt(from);
                        break;
-               case T_VariableResetStmt:
-                       retval = _copyVariableResetStmt(from);
+               case T_DiscardStmt:
+                       retval = _copyDiscardStmt(from);
                        break;
                case T_CreateTableSpaceStmt:
                        retval = _copyCreateTableSpaceStmt(from);
@@ -2958,17 +3439,17 @@ copyObject(void *from)
                case T_DropPLangStmt:
                        retval = _copyDropPLangStmt(from);
                        break;
-               case T_CreateUserStmt:
-                       retval = _copyCreateUserStmt(from);
+               case T_CreateRoleStmt:
+                       retval = _copyCreateRoleStmt(from);
                        break;
-               case T_AlterUserStmt:
-                       retval = _copyAlterUserStmt(from);
+               case T_AlterRoleStmt:
+                       retval = _copyAlterRoleStmt(from);
                        break;
-               case T_AlterUserSetStmt:
-                       retval = _copyAlterUserSetStmt(from);
+               case T_AlterRoleSetStmt:
+                       retval = _copyAlterRoleSetStmt(from);
                        break;
-               case T_DropUserStmt:
-                       retval = _copyDropUserStmt(from);
+               case T_DropRoleStmt:
+                       retval = _copyDropRoleStmt(from);
                        break;
                case T_LockStmt:
                        retval = _copyLockStmt(from);
@@ -2976,15 +3457,6 @@ copyObject(void *from)
                case T_ConstraintsSetStmt:
                        retval = _copyConstraintsSetStmt(from);
                        break;
-               case T_CreateGroupStmt:
-                       retval = _copyCreateGroupStmt(from);
-                       break;
-               case T_AlterGroupStmt:
-                       retval = _copyAlterGroupStmt(from);
-                       break;
-               case T_DropGroupStmt:
-                       retval = _copyDropGroupStmt(from);
-                       break;
                case T_ReindexStmt:
                        retval = _copyReindexStmt(from);
                        break;
@@ -3012,6 +3484,12 @@ copyObject(void *from)
                case T_DeallocateStmt:
                        retval = _copyDeallocateStmt(from);
                        break;
+               case T_DropOwnedStmt:
+                       retval = _copyDropOwnedStmt(from);
+                       break;
+               case T_ReassignOwnedStmt:
+                       retval = _copyReassignOwnedStmt(from);
+                       break;
 
                case T_A_Expr:
                        retval = _copyAExpr(from);
@@ -3064,6 +3542,9 @@ copyObject(void *from)
                case T_DefElem:
                        retval = _copyDefElem(from);
                        break;
+               case T_LockingClause:
+                       retval = _copyLockingClause(from);
+                       break;
                case T_RangeTblEntry:
                        retval = _copyRangeTblEntry(from);
                        break;
@@ -3073,6 +3554,9 @@ copyObject(void *from)
                case T_GroupClause:
                        retval = _copyGroupClause(from);
                        break;
+               case T_RowMarkClause:
+                       retval = _copyRowMarkClause(from);
+                       break;
                case T_FkConstraint:
                        retval = _copyFkConstraint(from);
                        break;
@@ -3082,6 +3566,9 @@ copyObject(void *from)
                case T_FuncWithArgs:
                        retval = _copyFuncWithArgs(from);
                        break;
+               case T_XmlSerialize:
+                       retval = _copyXmlSerialize(from);
+                       break;
 
                default:
                        elog(ERROR, "unrecognized node type: %d", (int) nodeTag(from));