]> granicus.if.org Git - postgresql/blobdiff - src/backend/nodes/equalfuncs.c
Change the planner-to-executor API so that the planner tells the executor
[postgresql] / src / backend / nodes / equalfuncs.c
index 9a787381cc8a53936027cc4e95d59f94e0a1d12f..fafd8ae5468a058b4880e915559a00fcc99b324f 100644 (file)
  * either.     This might need to be fixed someday.
  *
  *
- * 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/equalfuncs.c,v 1.229 2004/08/22 00:08:28 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.295 2007/01/10 18:06:03 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
 
 #include "postgres.h"
 
-#include "nodes/params.h"
-#include "nodes/parsenodes.h"
 #include "nodes/relation.h"
 #include "utils/datum.h"
 
  *     Stuff from primnodes.h
  */
 
-static bool
-_equalResdom(Resdom *a, Resdom *b)
-{
-       COMPARE_SCALAR_FIELD(resno);
-       COMPARE_SCALAR_FIELD(restype);
-       COMPARE_SCALAR_FIELD(restypmod);
-       COMPARE_STRING_FIELD(resname);
-       COMPARE_SCALAR_FIELD(ressortgroupref);
-       COMPARE_SCALAR_FIELD(resorigtbl);
-       COMPARE_SCALAR_FIELD(resorigcol);
-       COMPARE_SCALAR_FIELD(resjunk);
-
-       return true;
-}
-
 static bool
 _equalAlias(Alias *a, Alias *b)
 {
@@ -150,8 +133,7 @@ _equalConst(Const *a, Const *b)
 
        /*
         * We treat all NULL constants of the same type as equal. Someday this
-        * might need to change?  But datumIsEqual doesn't work on nulls,
-        * so...
+        * might need to change?  But datumIsEqual doesn't work on nulls, so...
         */
        if (a->constisnull)
                return true;
@@ -163,21 +145,9 @@ static bool
 _equalParam(Param *a, Param *b)
 {
        COMPARE_SCALAR_FIELD(paramkind);
+       COMPARE_SCALAR_FIELD(paramid);
        COMPARE_SCALAR_FIELD(paramtype);
-
-       switch (a->paramkind)
-       {
-               case PARAM_NAMED:
-                       COMPARE_STRING_FIELD(paramname);
-                       break;
-               case PARAM_NUM:
-               case PARAM_EXEC:
-                       COMPARE_SCALAR_FIELD(paramid);
-                       break;
-               default:
-                       elog(ERROR, "unrecognized paramkind: %d",
-                                a->paramkind);
-       }
+       COMPARE_SCALAR_FIELD(paramtypmod);
 
        return true;
 }
@@ -187,7 +157,7 @@ _equalAggref(Aggref *a, Aggref *b)
 {
        COMPARE_SCALAR_FIELD(aggfnoid);
        COMPARE_SCALAR_FIELD(aggtype);
-       COMPARE_NODE_FIELD(target);
+       COMPARE_NODE_FIELD(args);
        COMPARE_SCALAR_FIELD(agglevelsup);
        COMPARE_SCALAR_FIELD(aggstar);
        COMPARE_SCALAR_FIELD(aggdistinct);
@@ -217,8 +187,8 @@ _equalFuncExpr(FuncExpr *a, FuncExpr *b)
        COMPARE_SCALAR_FIELD(funcretset);
 
        /*
-        * Special-case COERCE_DONTCARE, so that planner can build coercion
-        * nodes that are equal() to both explicit and implicit coercions.
+        * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
+        * that are equal() to both explicit and implicit coercions.
         */
        if (a->funcformat != b->funcformat &&
                a->funcformat != COERCE_DONTCARE &&
@@ -237,9 +207,9 @@ _equalOpExpr(OpExpr *a, OpExpr *b)
 
        /*
         * Special-case opfuncid: it is allowable for it to differ if one node
-        * contains zero and the other doesn't.  This just means that the one
-        * node isn't as far along in the parse/plan pipeline and hasn't had
-        * the opfuncid cache filled yet.
+        * contains zero and the other doesn't.  This just means that the one node
+        * isn't as far along in the parse/plan pipeline and hasn't had the
+        * opfuncid cache filled yet.
         */
        if (a->opfuncid != b->opfuncid &&
                a->opfuncid != 0 &&
@@ -260,9 +230,9 @@ _equalDistinctExpr(DistinctExpr *a, DistinctExpr *b)
 
        /*
         * Special-case opfuncid: it is allowable for it to differ if one node
-        * contains zero and the other doesn't.  This just means that the one
-        * node isn't as far along in the parse/plan pipeline and hasn't had
-        * the opfuncid cache filled yet.
+        * contains zero and the other doesn't.  This just means that the one node
+        * isn't as far along in the parse/plan pipeline and hasn't had the
+        * opfuncid cache filled yet.
         */
        if (a->opfuncid != b->opfuncid &&
                a->opfuncid != 0 &&
@@ -283,9 +253,9 @@ _equalScalarArrayOpExpr(ScalarArrayOpExpr *a, ScalarArrayOpExpr *b)
 
        /*
         * Special-case opfuncid: it is allowable for it to differ if one node
-        * contains zero and the other doesn't.  This just means that the one
-        * node isn't as far along in the parse/plan pipeline and hasn't had
-        * the opfuncid cache filled yet.
+        * contains zero and the other doesn't.  This just means that the one node
+        * isn't as far along in the parse/plan pipeline and hasn't had the
+        * opfuncid cache filled yet.
         */
        if (a->opfuncid != b->opfuncid &&
                a->opfuncid != 0 &&
@@ -311,10 +281,8 @@ static bool
 _equalSubLink(SubLink *a, SubLink *b)
 {
        COMPARE_SCALAR_FIELD(subLinkType);
-       COMPARE_SCALAR_FIELD(useOr);
-       COMPARE_NODE_FIELD(lefthand);
+       COMPARE_NODE_FIELD(testexpr);
        COMPARE_NODE_FIELD(operName);
-       COMPARE_NODE_FIELD(operOids);
        COMPARE_NODE_FIELD(subselect);
 
        return true;
@@ -324,8 +292,7 @@ static bool
 _equalSubPlan(SubPlan *a, SubPlan *b)
 {
        COMPARE_SCALAR_FIELD(subLinkType);
-       COMPARE_SCALAR_FIELD(useOr);
-       COMPARE_NODE_FIELD(exprs);
+       COMPARE_NODE_FIELD(testexpr);
        COMPARE_NODE_FIELD(paramIds);
        /* should compare plans, but have to settle for comparing plan IDs */
        COMPARE_SCALAR_FIELD(plan_id);
@@ -369,8 +336,8 @@ _equalRelabelType(RelabelType *a, RelabelType *b)
        COMPARE_SCALAR_FIELD(resulttypmod);
 
        /*
-        * Special-case COERCE_DONTCARE, so that planner can build coercion
-        * nodes that are equal() to both explicit and implicit coercions.
+        * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
+        * that are equal() to both explicit and implicit coercions.
         */
        if (a->relabelformat != b->relabelformat &&
                a->relabelformat != COERCE_DONTCARE &&
@@ -380,6 +347,24 @@ _equalRelabelType(RelabelType *a, RelabelType *b)
        return true;
 }
 
+static bool
+_equalConvertRowtypeExpr(ConvertRowtypeExpr *a, ConvertRowtypeExpr *b)
+{
+       COMPARE_NODE_FIELD(arg);
+       COMPARE_SCALAR_FIELD(resulttype);
+
+       /*
+        * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
+        * that are equal() to both explicit and implicit coercions.
+        */
+       if (a->convertformat != b->convertformat &&
+               a->convertformat != COERCE_DONTCARE &&
+               b->convertformat != COERCE_DONTCARE)
+               return false;
+
+       return true;
+}
+
 static bool
 _equalCaseExpr(CaseExpr *a, CaseExpr *b)
 {
@@ -427,8 +412,8 @@ _equalRowExpr(RowExpr *a, RowExpr *b)
        COMPARE_SCALAR_FIELD(row_typeid);
 
        /*
-        * Special-case COERCE_DONTCARE, so that planner can build coercion
-        * nodes that are equal() to both explicit and implicit coercions.
+        * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
+        * that are equal() to both explicit and implicit coercions.
         */
        if (a->row_format != b->row_format &&
                a->row_format != COERCE_DONTCARE &&
@@ -438,6 +423,18 @@ _equalRowExpr(RowExpr *a, RowExpr *b)
        return true;
 }
 
+static bool
+_equalRowCompareExpr(RowCompareExpr *a, RowCompareExpr *b)
+{
+       COMPARE_SCALAR_FIELD(rctype);
+       COMPARE_NODE_FIELD(opnos);
+       COMPARE_NODE_FIELD(opfamilies);
+       COMPARE_NODE_FIELD(largs);
+       COMPARE_NODE_FIELD(rargs);
+
+       return true;
+}
+
 static bool
 _equalCoalesceExpr(CoalesceExpr *a, CoalesceExpr *b)
 {
@@ -447,6 +444,28 @@ _equalCoalesceExpr(CoalesceExpr *a, CoalesceExpr *b)
        return true;
 }
 
+static bool
+_equalMinMaxExpr(MinMaxExpr *a, MinMaxExpr *b)
+{
+       COMPARE_SCALAR_FIELD(minmaxtype);
+       COMPARE_SCALAR_FIELD(op);
+       COMPARE_NODE_FIELD(args);
+
+       return true;
+}
+
+static bool
+_equalXmlExpr(XmlExpr *a, XmlExpr *b)
+{
+       COMPARE_SCALAR_FIELD(op);
+       COMPARE_STRING_FIELD(name);
+       COMPARE_NODE_FIELD(named_args);
+       COMPARE_NODE_FIELD(arg_names);
+       COMPARE_NODE_FIELD(args);
+
+       return true;
+}
+
 static bool
 _equalNullIfExpr(NullIfExpr *a, NullIfExpr *b)
 {
@@ -454,9 +473,9 @@ _equalNullIfExpr(NullIfExpr *a, NullIfExpr *b)
 
        /*
         * Special-case opfuncid: it is allowable for it to differ if one node
-        * contains zero and the other doesn't.  This just means that the one
-        * node isn't as far along in the parse/plan pipeline and hasn't had
-        * the opfuncid cache filled yet.
+        * contains zero and the other doesn't.  This just means that the one node
+        * isn't as far along in the parse/plan pipeline and hasn't had the
+        * opfuncid cache filled yet.
         */
        if (a->opfuncid != b->opfuncid &&
                a->opfuncid != 0 &&
@@ -496,8 +515,8 @@ _equalCoerceToDomain(CoerceToDomain *a, CoerceToDomain *b)
        COMPARE_SCALAR_FIELD(resulttypmod);
 
        /*
-        * Special-case COERCE_DONTCARE, so that planner can build coercion
-        * nodes that are equal() to both explicit and implicit coercions.
+        * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
+        * that are equal() to both explicit and implicit coercions.
         */
        if (a->coercionformat != b->coercionformat &&
                a->coercionformat != COERCE_DONTCARE &&
@@ -528,8 +547,13 @@ _equalSetToDefault(SetToDefault *a, SetToDefault *b)
 static bool
 _equalTargetEntry(TargetEntry *a, TargetEntry *b)
 {
-       COMPARE_NODE_FIELD(resdom);
        COMPARE_NODE_FIELD(expr);
+       COMPARE_SCALAR_FIELD(resno);
+       COMPARE_STRING_FIELD(resname);
+       COMPARE_SCALAR_FIELD(ressortgroupref);
+       COMPARE_SCALAR_FIELD(resorigtbl);
+       COMPARE_SCALAR_FIELD(resorigcol);
+       COMPARE_SCALAR_FIELD(resjunk);
 
        return true;
 }
@@ -576,6 +600,7 @@ _equalPathKeyItem(PathKeyItem *a, PathKeyItem *b)
 {
        COMPARE_NODE_FIELD(key);
        COMPARE_SCALAR_FIELD(sortop);
+       COMPARE_SCALAR_FIELD(nulls_first);
 
        return true;
 }
@@ -585,21 +610,24 @@ _equalRestrictInfo(RestrictInfo *a, RestrictInfo *b)
 {
        COMPARE_NODE_FIELD(clause);
        COMPARE_SCALAR_FIELD(is_pushed_down);
-       COMPARE_SCALAR_FIELD(valid_everywhere);
+       COMPARE_SCALAR_FIELD(outerjoin_delayed);
+       COMPARE_BITMAPSET_FIELD(required_relids);
 
        /*
-        * We ignore all the remaining fields, since they may not be set yet,
-        * and should be derivable from the clause anyway.
+        * We ignore all the remaining fields, since they may not be set yet, and
+        * should be derivable from the clause anyway.
         */
 
        return true;
 }
 
 static bool
-_equalJoinInfo(JoinInfo *a, JoinInfo *b)
+_equalOuterJoinInfo(OuterJoinInfo *a, OuterJoinInfo *b)
 {
-       COMPARE_BITMAPSET_FIELD(unjoined_relids);
-       COMPARE_NODE_FIELD(jinfo_restrictinfo);
+       COMPARE_BITMAPSET_FIELD(min_lefthand);
+       COMPARE_BITMAPSET_FIELD(min_righthand);
+       COMPARE_SCALAR_FIELD(is_full_join);
+       COMPARE_SCALAR_FIELD(lhs_strict);
 
        return true;
 }
@@ -610,6 +638,21 @@ _equalInClauseInfo(InClauseInfo *a, InClauseInfo *b)
        COMPARE_BITMAPSET_FIELD(lefthand);
        COMPARE_BITMAPSET_FIELD(righthand);
        COMPARE_NODE_FIELD(sub_targetlist);
+       COMPARE_NODE_FIELD(in_operators);
+
+       return true;
+}
+
+static bool
+_equalAppendRelInfo(AppendRelInfo *a, AppendRelInfo *b)
+{
+       COMPARE_SCALAR_FIELD(parent_relid);
+       COMPARE_SCALAR_FIELD(child_relid);
+       COMPARE_SCALAR_FIELD(parent_reltype);
+       COMPARE_SCALAR_FIELD(child_reltype);
+       COMPARE_NODE_FIELD(col_mappings);
+       COMPARE_NODE_FIELD(translated_vars);
+       COMPARE_SCALAR_FIELD(parent_reloid);
 
        return true;
 }
@@ -628,30 +671,26 @@ _equalQuery(Query *a, Query *b)
        COMPARE_NODE_FIELD(utilityStmt);
        COMPARE_SCALAR_FIELD(resultRelation);
        COMPARE_NODE_FIELD(into);
-       COMPARE_SCALAR_FIELD(intoHasOids);
+       COMPARE_NODE_FIELD(intoOptions);
+       COMPARE_SCALAR_FIELD(intoOnCommit);
+       COMPARE_STRING_FIELD(intoTableSpaceName);
        COMPARE_SCALAR_FIELD(hasAggs);
        COMPARE_SCALAR_FIELD(hasSubLinks);
        COMPARE_NODE_FIELD(rtable);
        COMPARE_NODE_FIELD(jointree);
-       COMPARE_NODE_FIELD(rowMarks);
        COMPARE_NODE_FIELD(targetList);
+       COMPARE_NODE_FIELD(returningList);
        COMPARE_NODE_FIELD(groupClause);
        COMPARE_NODE_FIELD(havingQual);
        COMPARE_NODE_FIELD(distinctClause);
        COMPARE_NODE_FIELD(sortClause);
        COMPARE_NODE_FIELD(limitOffset);
        COMPARE_NODE_FIELD(limitCount);
+       COMPARE_NODE_FIELD(rowMarks);
        COMPARE_NODE_FIELD(setOperations);
        COMPARE_NODE_FIELD(resultRelations);
-       COMPARE_NODE_FIELD(in_info_list);
-       COMPARE_SCALAR_FIELD(hasJoinRTEs);
+       COMPARE_NODE_FIELD(returningLists);
 
-       /*
-        * We do not check the other planner internal fields: base_rel_list,
-        * other_rel_list, join_rel_list, equi_key_list, query_pathkeys. They
-        * might not be set yet, and in any case they should be derivable from
-        * the other fields.
-        */
        return true;
 }
 
@@ -660,8 +699,8 @@ _equalInsertStmt(InsertStmt *a, InsertStmt *b)
 {
        COMPARE_NODE_FIELD(relation);
        COMPARE_NODE_FIELD(cols);
-       COMPARE_NODE_FIELD(targetList);
        COMPARE_NODE_FIELD(selectStmt);
+       COMPARE_NODE_FIELD(returningList);
 
        return true;
 }
@@ -670,7 +709,9 @@ static bool
 _equalDeleteStmt(DeleteStmt *a, DeleteStmt *b)
 {
        COMPARE_NODE_FIELD(relation);
+       COMPARE_NODE_FIELD(usingClause);
        COMPARE_NODE_FIELD(whereClause);
+       COMPARE_NODE_FIELD(returningList);
 
        return true;
 }
@@ -682,6 +723,7 @@ _equalUpdateStmt(UpdateStmt *a, UpdateStmt *b)
        COMPARE_NODE_FIELD(targetList);
        COMPARE_NODE_FIELD(whereClause);
        COMPARE_NODE_FIELD(fromClause);
+       COMPARE_NODE_FIELD(returningList);
 
        return true;
 }
@@ -692,16 +734,19 @@ _equalSelectStmt(SelectStmt *a, SelectStmt *b)
        COMPARE_NODE_FIELD(distinctClause);
        COMPARE_NODE_FIELD(into);
        COMPARE_NODE_FIELD(intoColNames);
-       COMPARE_SCALAR_FIELD(intoHasOids);
+       COMPARE_NODE_FIELD(intoOptions);
+       COMPARE_SCALAR_FIELD(intoOnCommit);
+       COMPARE_STRING_FIELD(intoTableSpaceName);
        COMPARE_NODE_FIELD(targetList);
        COMPARE_NODE_FIELD(fromClause);
        COMPARE_NODE_FIELD(whereClause);
        COMPARE_NODE_FIELD(groupClause);
        COMPARE_NODE_FIELD(havingClause);
+       COMPARE_NODE_FIELD(valuesLists);
        COMPARE_NODE_FIELD(sortClause);
        COMPARE_NODE_FIELD(limitOffset);
        COMPARE_NODE_FIELD(limitCount);
-       COMPARE_NODE_FIELD(forUpdate);
+       COMPARE_NODE_FIELD(lockingClause);
        COMPARE_SCALAR_FIELD(op);
        COMPARE_SCALAR_FIELD(all);
        COMPARE_NODE_FIELD(larg);
@@ -718,6 +763,7 @@ _equalSetOperationStmt(SetOperationStmt *a, SetOperationStmt *b)
        COMPARE_NODE_FIELD(larg);
        COMPARE_NODE_FIELD(rarg);
        COMPARE_NODE_FIELD(colTypes);
+       COMPARE_NODE_FIELD(colTypmods);
 
        return true;
 }
@@ -773,8 +819,7 @@ _equalGrantStmt(GrantStmt *a, GrantStmt *b)
 static bool
 _equalPrivGrantee(PrivGrantee *a, PrivGrantee *b)
 {
-       COMPARE_STRING_FIELD(username);
-       COMPARE_STRING_FIELD(groupname);
+       COMPARE_STRING_FIELD(rolname);
 
        return true;
 }
@@ -788,6 +833,19 @@ _equalFuncWithArgs(FuncWithArgs *a, FuncWithArgs *b)
        return true;
 }
 
+static bool
+_equalGrantRoleStmt(GrantRoleStmt *a, GrantRoleStmt *b)
+{
+       COMPARE_NODE_FIELD(granted_roles);
+       COMPARE_NODE_FIELD(grantee_roles);
+       COMPARE_SCALAR_FIELD(is_grant);
+       COMPARE_SCALAR_FIELD(admin_opt);
+       COMPARE_STRING_FIELD(grantor);
+       COMPARE_SCALAR_FIELD(behavior);
+
+       return true;
+}
+
 static bool
 _equalDeclareCursorStmt(DeclareCursorStmt *a, DeclareCursorStmt *b)
 {
@@ -819,6 +877,7 @@ static bool
 _equalCopyStmt(CopyStmt *a, CopyStmt *b)
 {
        COMPARE_NODE_FIELD(relation);
+       COMPARE_NODE_FIELD(query);
        COMPARE_NODE_FIELD(attlist);
        COMPARE_SCALAR_FIELD(is_from);
        COMPARE_STRING_FIELD(filename);
@@ -834,7 +893,7 @@ _equalCreateStmt(CreateStmt *a, CreateStmt *b)
        COMPARE_NODE_FIELD(tableElts);
        COMPARE_NODE_FIELD(inhRelations);
        COMPARE_NODE_FIELD(constraints);
-       COMPARE_SCALAR_FIELD(hasoids);
+       COMPARE_NODE_FIELD(options);
        COMPARE_SCALAR_FIELD(oncommit);
        COMPARE_STRING_FIELD(tablespacename);
 
@@ -845,7 +904,7 @@ static bool
 _equalInhRelation(InhRelation *a, InhRelation *b)
 {
        COMPARE_NODE_FIELD(relation);
-       COMPARE_SCALAR_FIELD(including_defaults);
+       COMPARE_NODE_FIELD(options);
 
        return true;
 }
@@ -854,7 +913,9 @@ static bool
 _equalDefineStmt(DefineStmt *a, DefineStmt *b)
 {
        COMPARE_SCALAR_FIELD(kind);
+       COMPARE_SCALAR_FIELD(oldstyle);
        COMPARE_NODE_FIELD(defnames);
+       COMPARE_NODE_FIELD(args);
        COMPARE_NODE_FIELD(definition);
 
        return true;
@@ -866,6 +927,7 @@ _equalDropStmt(DropStmt *a, DropStmt *b)
        COMPARE_NODE_FIELD(objects);
        COMPARE_SCALAR_FIELD(removeType);
        COMPARE_SCALAR_FIELD(behavior);
+       COMPARE_SCALAR_FIELD(missing_ok);
 
        return true;
 }
@@ -873,7 +935,8 @@ _equalDropStmt(DropStmt *a, DropStmt *b)
 static bool
 _equalTruncateStmt(TruncateStmt *a, TruncateStmt *b)
 {
-       COMPARE_NODE_FIELD(relation);
+       COMPARE_NODE_FIELD(relations);
+       COMPARE_SCALAR_FIELD(behavior);
 
        return true;
 }
@@ -908,11 +971,13 @@ _equalIndexStmt(IndexStmt *a, IndexStmt *b)
        COMPARE_STRING_FIELD(accessMethod);
        COMPARE_STRING_FIELD(tableSpace);
        COMPARE_NODE_FIELD(indexParams);
+       COMPARE_NODE_FIELD(options);
        COMPARE_NODE_FIELD(whereClause);
        COMPARE_NODE_FIELD(rangetable);
        COMPARE_SCALAR_FIELD(unique);
        COMPARE_SCALAR_FIELD(primary);
        COMPARE_SCALAR_FIELD(isconstraint);
+       COMPARE_SCALAR_FIELD(concurrent);
 
        return true;
 }
@@ -935,16 +1000,16 @@ _equalFunctionParameter(FunctionParameter *a, FunctionParameter *b)
 {
        COMPARE_STRING_FIELD(name);
        COMPARE_NODE_FIELD(argType);
+       COMPARE_SCALAR_FIELD(mode);
 
        return true;
 }
 
 static bool
-_equalRemoveAggrStmt(RemoveAggrStmt *a, RemoveAggrStmt *b)
+_equalAlterFunctionStmt(AlterFunctionStmt *a, AlterFunctionStmt *b)
 {
-       COMPARE_NODE_FIELD(aggname);
-       COMPARE_NODE_FIELD(aggtype);
-       COMPARE_SCALAR_FIELD(behavior);
+       COMPARE_NODE_FIELD(func);
+       COMPARE_NODE_FIELD(actions);
 
        return true;
 }
@@ -952,19 +1017,11 @@ _equalRemoveAggrStmt(RemoveAggrStmt *a, RemoveAggrStmt *b)
 static bool
 _equalRemoveFuncStmt(RemoveFuncStmt *a, RemoveFuncStmt *b)
 {
-       COMPARE_NODE_FIELD(funcname);
-       COMPARE_NODE_FIELD(args);
-       COMPARE_SCALAR_FIELD(behavior);
-
-       return true;
-}
-
-static bool
-_equalRemoveOperStmt(RemoveOperStmt *a, RemoveOperStmt *b)
-{
-       COMPARE_NODE_FIELD(opname);
+       COMPARE_SCALAR_FIELD(kind);
+       COMPARE_NODE_FIELD(name);
        COMPARE_NODE_FIELD(args);
        COMPARE_SCALAR_FIELD(behavior);
+       COMPARE_SCALAR_FIELD(missing_ok);
 
        return true;
 }
@@ -975,6 +1032,7 @@ _equalRemoveOpClassStmt(RemoveOpClassStmt *a, RemoveOpClassStmt *b)
        COMPARE_NODE_FIELD(opclassname);
        COMPARE_STRING_FIELD(amname);
        COMPARE_SCALAR_FIELD(behavior);
+       COMPARE_SCALAR_FIELD(missing_ok);
 
        return true;
 }
@@ -982,12 +1040,25 @@ _equalRemoveOpClassStmt(RemoveOpClassStmt *a, RemoveOpClassStmt *b)
 static bool
 _equalRenameStmt(RenameStmt *a, RenameStmt *b)
 {
+       COMPARE_SCALAR_FIELD(renameType);
        COMPARE_NODE_FIELD(relation);
        COMPARE_NODE_FIELD(object);
        COMPARE_NODE_FIELD(objarg);
        COMPARE_STRING_FIELD(subname);
        COMPARE_STRING_FIELD(newname);
-       COMPARE_SCALAR_FIELD(renameType);
+
+       return true;
+}
+
+static bool
+_equalAlterObjectSchemaStmt(AlterObjectSchemaStmt *a, AlterObjectSchemaStmt *b)
+{
+       COMPARE_SCALAR_FIELD(objectType);
+       COMPARE_NODE_FIELD(relation);
+       COMPARE_NODE_FIELD(object);
+       COMPARE_NODE_FIELD(objarg);
+       COMPARE_STRING_FIELD(addname);
+       COMPARE_STRING_FIELD(newschema);
 
        return true;
 }
@@ -995,12 +1066,12 @@ _equalRenameStmt(RenameStmt *a, RenameStmt *b)
 static bool
 _equalAlterOwnerStmt(AlterOwnerStmt *a, AlterOwnerStmt *b)
 {
+       COMPARE_SCALAR_FIELD(objectType);
        COMPARE_NODE_FIELD(relation);
        COMPARE_NODE_FIELD(object);
        COMPARE_NODE_FIELD(objarg);
        COMPARE_STRING_FIELD(addname);
        COMPARE_STRING_FIELD(newowner);
-       COMPARE_SCALAR_FIELD(objectType);
 
        return true;
 }
@@ -1048,6 +1119,7 @@ _equalTransactionStmt(TransactionStmt *a, TransactionStmt *b)
 {
        COMPARE_SCALAR_FIELD(kind);
        COMPARE_NODE_FIELD(options);
+       COMPARE_STRING_FIELD(gid);
 
        return true;
 }
@@ -1094,6 +1166,7 @@ static bool
 _equalCreateOpClassStmt(CreateOpClassStmt *a, CreateOpClassStmt *b)
 {
        COMPARE_NODE_FIELD(opclassname);
+       COMPARE_NODE_FIELD(opfamilyname);
        COMPARE_STRING_FIELD(amname);
        COMPARE_NODE_FIELD(datatype);
        COMPARE_NODE_FIELD(items);
@@ -1124,6 +1197,15 @@ _equalCreatedbStmt(CreatedbStmt *a, CreatedbStmt *b)
        return true;
 }
 
+static bool
+_equalAlterDatabaseStmt(AlterDatabaseStmt *a, AlterDatabaseStmt *b)
+{
+       COMPARE_STRING_FIELD(dbname);
+       COMPARE_NODE_FIELD(options);
+
+       return true;
+}
+
 static bool
 _equalAlterDatabaseSetStmt(AlterDatabaseSetStmt *a, AlterDatabaseSetStmt *b)
 {
@@ -1138,6 +1220,7 @@ static bool
 _equalDropdbStmt(DropdbStmt *a, DropdbStmt *b)
 {
        COMPARE_STRING_FIELD(dbname);
+       COMPARE_SCALAR_FIELD(missing_ok);
 
        return true;
 }
@@ -1148,8 +1231,8 @@ _equalVacuumStmt(VacuumStmt *a, VacuumStmt *b)
        COMPARE_SCALAR_FIELD(vacuum);
        COMPARE_SCALAR_FIELD(full);
        COMPARE_SCALAR_FIELD(analyze);
-       COMPARE_SCALAR_FIELD(freeze);
        COMPARE_SCALAR_FIELD(verbose);
+       COMPARE_SCALAR_FIELD(freeze_min_age);
        COMPARE_NODE_FIELD(relation);
        COMPARE_NODE_FIELD(va_cols);
 
@@ -1224,6 +1307,7 @@ static bool
 _equalDropTableSpaceStmt(DropTableSpaceStmt *a, DropTableSpaceStmt *b)
 {
        COMPARE_STRING_FIELD(tablespacename);
+       COMPARE_SCALAR_FIELD(missing_ok);
 
        return true;
 }
@@ -1254,6 +1338,7 @@ _equalDropPropertyStmt(DropPropertyStmt *a, DropPropertyStmt *b)
        COMPARE_STRING_FIELD(property);
        COMPARE_SCALAR_FIELD(removeType);
        COMPARE_SCALAR_FIELD(behavior);
+       COMPARE_SCALAR_FIELD(missing_ok);
 
        return true;
 }
@@ -1274,32 +1359,35 @@ _equalDropPLangStmt(DropPLangStmt *a, DropPLangStmt *b)
 {
        COMPARE_STRING_FIELD(plname);
        COMPARE_SCALAR_FIELD(behavior);
+       COMPARE_SCALAR_FIELD(missing_ok);
 
        return true;
 }
 
 static bool
-_equalCreateUserStmt(CreateUserStmt *a, CreateUserStmt *b)
+_equalCreateRoleStmt(CreateRoleStmt *a, CreateRoleStmt *b)
 {
-       COMPARE_STRING_FIELD(user);
+       COMPARE_SCALAR_FIELD(stmt_type);
+       COMPARE_STRING_FIELD(role);
        COMPARE_NODE_FIELD(options);
 
        return true;
 }
 
 static bool
-_equalAlterUserStmt(AlterUserStmt *a, AlterUserStmt *b)
+_equalAlterRoleStmt(AlterRoleStmt *a, AlterRoleStmt *b)
 {
-       COMPARE_STRING_FIELD(user);
+       COMPARE_STRING_FIELD(role);
        COMPARE_NODE_FIELD(options);
+       COMPARE_SCALAR_FIELD(action);
 
        return true;
 }
 
 static bool
-_equalAlterUserSetStmt(AlterUserSetStmt *a, AlterUserSetStmt *b)
+_equalAlterRoleSetStmt(AlterRoleSetStmt *a, AlterRoleSetStmt *b)
 {
-       COMPARE_STRING_FIELD(user);
+       COMPARE_STRING_FIELD(role);
        COMPARE_STRING_FIELD(variable);
        COMPARE_NODE_FIELD(value);
 
@@ -1307,9 +1395,10 @@ _equalAlterUserSetStmt(AlterUserSetStmt *a, AlterUserSetStmt *b)
 }
 
 static bool
-_equalDropUserStmt(DropUserStmt *a, DropUserStmt *b)
+_equalDropRoleStmt(DropRoleStmt *a, DropRoleStmt *b)
 {
-       COMPARE_NODE_FIELD(users);
+       COMPARE_NODE_FIELD(roles);
+       COMPARE_SCALAR_FIELD(missing_ok);
 
        return true;
 }
@@ -1333,41 +1422,14 @@ _equalConstraintsSetStmt(ConstraintsSetStmt *a, ConstraintsSetStmt *b)
        return true;
 }
 
-static bool
-_equalCreateGroupStmt(CreateGroupStmt *a, CreateGroupStmt *b)
-{
-       COMPARE_STRING_FIELD(name);
-       COMPARE_NODE_FIELD(options);
-
-       return true;
-}
-
-static bool
-_equalAlterGroupStmt(AlterGroupStmt *a, AlterGroupStmt *b)
-{
-       COMPARE_STRING_FIELD(name);
-       COMPARE_SCALAR_FIELD(action);
-       COMPARE_NODE_FIELD(listUsers);
-
-       return true;
-}
-
-static bool
-_equalDropGroupStmt(DropGroupStmt *a, DropGroupStmt *b)
-{
-       COMPARE_STRING_FIELD(name);
-
-       return true;
-}
-
 static bool
 _equalReindexStmt(ReindexStmt *a, ReindexStmt *b)
 {
        COMPARE_SCALAR_FIELD(kind);
        COMPARE_NODE_FIELD(relation);
        COMPARE_STRING_FIELD(name);
-       COMPARE_SCALAR_FIELD(force);
-       COMPARE_SCALAR_FIELD(all);
+       COMPARE_SCALAR_FIELD(do_system);
+       COMPARE_SCALAR_FIELD(do_user);
 
        return true;
 }
@@ -1377,7 +1439,6 @@ _equalCreateSchemaStmt(CreateSchemaStmt *a, CreateSchemaStmt *b)
 {
        COMPARE_STRING_FIELD(schemaname);
        COMPARE_STRING_FIELD(authid);
-       COMPARE_STRING_FIELD(tablespacename);
        COMPARE_NODE_FIELD(schemaElts);
 
        return true;
@@ -1412,6 +1473,7 @@ _equalDropCastStmt(DropCastStmt *a, DropCastStmt *b)
        COMPARE_NODE_FIELD(sourcetype);
        COMPARE_NODE_FIELD(targettype);
        COMPARE_SCALAR_FIELD(behavior);
+       COMPARE_SCALAR_FIELD(missing_ok);
 
        return true;
 }
@@ -1432,6 +1494,9 @@ _equalExecuteStmt(ExecuteStmt *a, ExecuteStmt *b)
 {
        COMPARE_STRING_FIELD(name);
        COMPARE_NODE_FIELD(into);
+       COMPARE_NODE_FIELD(intoOptions);
+       COMPARE_SCALAR_FIELD(into_on_commit);
+       COMPARE_STRING_FIELD(into_tbl_space);
        COMPARE_NODE_FIELD(params);
 
        return true;
@@ -1445,10 +1510,23 @@ _equalDeallocateStmt(DeallocateStmt *a, DeallocateStmt *b)
        return true;
 }
 
+static bool
+_equalDropOwnedStmt(DropOwnedStmt *a, DropOwnedStmt *b)
+{
+       COMPARE_NODE_FIELD(roles);
+       COMPARE_SCALAR_FIELD(behavior);
 
-/*
- * stuff from parsenodes.h
- */
+       return true;
+}
+
+static bool
+_equalReassignOwnedStmt(ReassignOwnedStmt *a, ReassignOwnedStmt *b)
+{
+       COMPARE_NODE_FIELD(roles);
+       COMPARE_NODE_FIELD(newrole);
+
+       return true;
+}
 
 static bool
 _equalAExpr(A_Expr *a, A_Expr *b)
@@ -1457,6 +1535,7 @@ _equalAExpr(A_Expr *a, A_Expr *b)
        COMPARE_NODE_FIELD(name);
        COMPARE_NODE_FIELD(lexpr);
        COMPARE_NODE_FIELD(rexpr);
+       COMPARE_SCALAR_FIELD(location);
 
        return true;
 }
@@ -1465,6 +1544,7 @@ static bool
 _equalColumnRef(ColumnRef *a, ColumnRef *b)
 {
        COMPARE_NODE_FIELD(fields);
+       COMPARE_SCALAR_FIELD(location);
 
        return true;
 }
@@ -1494,6 +1574,7 @@ _equalFuncCall(FuncCall *a, FuncCall *b)
        COMPARE_NODE_FIELD(args);
        COMPARE_SCALAR_FIELD(agg_star);
        COMPARE_SCALAR_FIELD(agg_distinct);
+       COMPARE_SCALAR_FIELD(location);
 
        return true;
 }
@@ -1522,6 +1603,7 @@ _equalResTarget(ResTarget *a, ResTarget *b)
        COMPARE_STRING_FIELD(name);
        COMPARE_NODE_FIELD(indirection);
        COMPARE_NODE_FIELD(val);
+       COMPARE_SCALAR_FIELD(location);
 
        return true;
 }
@@ -1534,8 +1616,10 @@ _equalTypeName(TypeName *a, TypeName *b)
        COMPARE_SCALAR_FIELD(timezone);
        COMPARE_SCALAR_FIELD(setof);
        COMPARE_SCALAR_FIELD(pct_type);
-       COMPARE_SCALAR_FIELD(typmod);
+       COMPARE_NODE_FIELD(typmods);
+       COMPARE_SCALAR_FIELD(typemod);
        COMPARE_NODE_FIELD(arrayBounds);
+       COMPARE_SCALAR_FIELD(location);
 
        return true;
 }
@@ -1552,7 +1636,8 @@ _equalTypeCast(TypeCast *a, TypeCast *b)
 static bool
 _equalSortBy(SortBy *a, SortBy *b)
 {
-       COMPARE_SCALAR_FIELD(sortby_kind);
+       COMPARE_SCALAR_FIELD(sortby_dir);
+       COMPARE_SCALAR_FIELD(sortby_nulls);
        COMPARE_NODE_FIELD(useOp);
        COMPARE_NODE_FIELD(node);
 
@@ -1584,6 +1669,8 @@ _equalIndexElem(IndexElem *a, IndexElem *b)
        COMPARE_STRING_FIELD(name);
        COMPARE_NODE_FIELD(expr);
        COMPARE_NODE_FIELD(opclass);
+       COMPARE_SCALAR_FIELD(ordering);
+       COMPARE_SCALAR_FIELD(nulls_ordering);
 
        return true;
 }
@@ -1599,7 +1686,6 @@ _equalColumnDef(ColumnDef *a, ColumnDef *b)
        COMPARE_NODE_FIELD(raw_default);
        COMPARE_STRING_FIELD(cooked_default);
        COMPARE_NODE_FIELD(constraints);
-       COMPARE_NODE_FIELD(support);
 
        return true;
 }
@@ -1612,6 +1698,7 @@ _equalConstraint(Constraint *a, Constraint *b)
        COMPARE_NODE_FIELD(raw_expr);
        COMPARE_STRING_FIELD(cooked_expr);
        COMPARE_NODE_FIELD(keys);
+       COMPARE_NODE_FIELD(options);
        COMPARE_STRING_FIELD(indexspace);
 
        return true;
@@ -1626,6 +1713,16 @@ _equalDefElem(DefElem *a, DefElem *b)
        return true;
 }
 
+static bool
+_equalLockingClause(LockingClause *a, LockingClause *b)
+{
+       COMPARE_NODE_FIELD(lockedRels);
+       COMPARE_SCALAR_FIELD(forUpdate);
+       COMPARE_SCALAR_FIELD(noWait);
+
+       return true;
+}
+
 static bool
 _equalRangeTblEntry(RangeTblEntry *a, RangeTblEntry *b)
 {
@@ -1633,7 +1730,9 @@ _equalRangeTblEntry(RangeTblEntry *a, RangeTblEntry *b)
        COMPARE_SCALAR_FIELD(relid);
        COMPARE_NODE_FIELD(subquery);
        COMPARE_NODE_FIELD(funcexpr);
-       COMPARE_NODE_FIELD(coldeflist);
+       COMPARE_NODE_FIELD(funccoltypes);
+       COMPARE_NODE_FIELD(funccoltypmods);
+       COMPARE_NODE_FIELD(values_lists);
        COMPARE_SCALAR_FIELD(jointype);
        COMPARE_NODE_FIELD(joinaliasvars);
        COMPARE_NODE_FIELD(alias);
@@ -1651,6 +1750,17 @@ _equalSortClause(SortClause *a, SortClause *b)
 {
        COMPARE_SCALAR_FIELD(tleSortGroupRef);
        COMPARE_SCALAR_FIELD(sortop);
+       COMPARE_SCALAR_FIELD(nulls_first);
+
+       return true;
+}
+
+static bool
+_equalRowMarkClause(RowMarkClause *a, RowMarkClause *b)
+{
+       COMPARE_SCALAR_FIELD(rti);
+       COMPARE_SCALAR_FIELD(forUpdate);
+       COMPARE_SCALAR_FIELD(noWait);
 
        return true;
 }
@@ -1680,19 +1790,19 @@ _equalFkConstraint(FkConstraint *a, FkConstraint *b)
 static bool
 _equalList(List *a, List *b)
 {
-       ListCell *item_a;
-       ListCell *item_b;
+       ListCell   *item_a;
+       ListCell   *item_b;
 
        /*
-        * Try to reject by simple scalar checks before grovelling through
-        * all the list elements...
+        * Try to reject by simple scalar checks before grovelling through all the
+        * list elements...
         */
        COMPARE_SCALAR_FIELD(type);
        COMPARE_SCALAR_FIELD(length);
 
        /*
-        * We place the switch outside the loop for the sake of
-        * efficiency; this may not be worth doing...
+        * We place the switch outside the loop for the sake of efficiency; this
+        * may not be worth doing...
         */
        switch (a->type)
        {
@@ -1791,9 +1901,6 @@ equal(void *a, void *b)
                        /*
                         * PRIMITIVE NODES
                         */
-               case T_Resdom:
-                       retval = _equalResdom(a, b);
-                       break;
                case T_Alias:
                        retval = _equalAlias(a, b);
                        break;
@@ -1845,6 +1952,9 @@ equal(void *a, void *b)
                case T_RelabelType:
                        retval = _equalRelabelType(a, b);
                        break;
+               case T_ConvertRowtypeExpr:
+                       retval = _equalConvertRowtypeExpr(a, b);
+                       break;
                case T_CaseExpr:
                        retval = _equalCaseExpr(a, b);
                        break;
@@ -1860,9 +1970,18 @@ equal(void *a, void *b)
                case T_RowExpr:
                        retval = _equalRowExpr(a, b);
                        break;
+               case T_RowCompareExpr:
+                       retval = _equalRowCompareExpr(a, b);
+                       break;
                case T_CoalesceExpr:
                        retval = _equalCoalesceExpr(a, b);
                        break;
+               case T_MinMaxExpr:
+                       retval = _equalMinMaxExpr(a, b);
+                       break;
+               case T_XmlExpr:
+                       retval = _equalXmlExpr(a, b);
+                       break;
                case T_NullIfExpr:
                        retval = _equalNullIfExpr(a, b);
                        break;
@@ -1903,12 +2022,15 @@ equal(void *a, void *b)
                case T_RestrictInfo:
                        retval = _equalRestrictInfo(a, b);
                        break;
-               case T_JoinInfo:
-                       retval = _equalJoinInfo(a, b);
+               case T_OuterJoinInfo:
+                       retval = _equalOuterJoinInfo(a, b);
                        break;
                case T_InClauseInfo:
                        retval = _equalInClauseInfo(a, b);
                        break;
+               case T_AppendRelInfo:
+                       retval = _equalAppendRelInfo(a, b);
+                       break;
                case T_List:
                case T_IntList:
                case T_OidList:
@@ -1956,6 +2078,9 @@ equal(void *a, void *b)
                case T_GrantStmt:
                        retval = _equalGrantStmt(a, b);
                        break;
+               case T_GrantRoleStmt:
+                       retval = _equalGrantRoleStmt(a, b);
+                       break;
                case T_DeclareCursorStmt:
                        retval = _equalDeclareCursorStmt(a, b);
                        break;
@@ -1998,21 +2123,21 @@ equal(void *a, void *b)
                case T_FunctionParameter:
                        retval = _equalFunctionParameter(a, b);
                        break;
-               case T_RemoveAggrStmt:
-                       retval = _equalRemoveAggrStmt(a, b);
+               case T_AlterFunctionStmt:
+                       retval = _equalAlterFunctionStmt(a, b);
                        break;
                case T_RemoveFuncStmt:
                        retval = _equalRemoveFuncStmt(a, b);
                        break;
-               case T_RemoveOperStmt:
-                       retval = _equalRemoveOperStmt(a, b);
-                       break;
                case T_RemoveOpClassStmt:
                        retval = _equalRemoveOpClassStmt(a, b);
                        break;
                case T_RenameStmt:
                        retval = _equalRenameStmt(a, b);
                        break;
+               case T_AlterObjectSchemaStmt:
+                       retval = _equalAlterObjectSchemaStmt(a, b);
+                       break;
                case T_AlterOwnerStmt:
                        retval = _equalAlterOwnerStmt(a, b);
                        break;
@@ -2052,6 +2177,9 @@ equal(void *a, void *b)
                case T_CreatedbStmt:
                        retval = _equalCreatedbStmt(a, b);
                        break;
+               case T_AlterDatabaseStmt:
+                       retval = _equalAlterDatabaseStmt(a, b);
+                       break;
                case T_AlterDatabaseSetStmt:
                        retval = _equalAlterDatabaseSetStmt(a, b);
                        break;
@@ -2097,17 +2225,17 @@ equal(void *a, void *b)
                case T_DropPLangStmt:
                        retval = _equalDropPLangStmt(a, b);
                        break;
-               case T_CreateUserStmt:
-                       retval = _equalCreateUserStmt(a, b);
+               case T_CreateRoleStmt:
+                       retval = _equalCreateRoleStmt(a, b);
                        break;
-               case T_AlterUserStmt:
-                       retval = _equalAlterUserStmt(a, b);
+               case T_AlterRoleStmt:
+                       retval = _equalAlterRoleStmt(a, b);
                        break;
-               case T_AlterUserSetStmt:
-                       retval = _equalAlterUserSetStmt(a, b);
+               case T_AlterRoleSetStmt:
+                       retval = _equalAlterRoleSetStmt(a, b);
                        break;
-               case T_DropUserStmt:
-                       retval = _equalDropUserStmt(a, b);
+               case T_DropRoleStmt:
+                       retval = _equalDropRoleStmt(a, b);
                        break;
                case T_LockStmt:
                        retval = _equalLockStmt(a, b);
@@ -2115,15 +2243,6 @@ equal(void *a, void *b)
                case T_ConstraintsSetStmt:
                        retval = _equalConstraintsSetStmt(a, b);
                        break;
-               case T_CreateGroupStmt:
-                       retval = _equalCreateGroupStmt(a, b);
-                       break;
-               case T_AlterGroupStmt:
-                       retval = _equalAlterGroupStmt(a, b);
-                       break;
-               case T_DropGroupStmt:
-                       retval = _equalDropGroupStmt(a, b);
-                       break;
                case T_ReindexStmt:
                        retval = _equalReindexStmt(a, b);
                        break;
@@ -2151,6 +2270,13 @@ equal(void *a, void *b)
                case T_DeallocateStmt:
                        retval = _equalDeallocateStmt(a, b);
                        break;
+               case T_DropOwnedStmt:
+                       retval = _equalDropOwnedStmt(a, b);
+                       break;
+
+               case T_ReassignOwnedStmt:
+                       retval = _equalReassignOwnedStmt(a, b);
+                       break;
 
                case T_A_Expr:
                        retval = _equalAExpr(a, b);
@@ -2203,6 +2329,9 @@ equal(void *a, void *b)
                case T_DefElem:
                        retval = _equalDefElem(a, b);
                        break;
+               case T_LockingClause:
+                       retval = _equalLockingClause(a, b);
+                       break;
                case T_RangeTblEntry:
                        retval = _equalRangeTblEntry(a, b);
                        break;
@@ -2213,6 +2342,9 @@ equal(void *a, void *b)
                        /* GroupClause is equivalent to SortClause */
                        retval = _equalSortClause(a, b);
                        break;
+               case T_RowMarkClause:
+                       retval = _equalRowMarkClause(a, b);
+                       break;
                case T_FkConstraint:
                        retval = _equalFkConstraint(a, b);
                        break;