1 /*-------------------------------------------------------------------------
4 * Equality functions to compare node trees.
6 * NOTE: we currently support comparing all node types found in parse
7 * trees. We do not support comparing executor state trees; there
8 * is no need for that, and no point in maintaining all the code that
9 * would be needed. We also do not support comparing Path trees, mainly
10 * because the circular linkages between RelOptInfo and Path nodes can't
11 * be handled easily in a simple depth-first traversal.
13 * Currently, in fact, equal() doesn't know how to compare Plan trees
14 * either. This might need to be fixed someday.
17 * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
18 * Portions Copyright (c) 1994, Regents of the University of California
21 * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.190 2003/03/20 07:02:08 momjian Exp $
23 *-------------------------------------------------------------------------
28 #include "nodes/params.h"
29 #include "nodes/parsenodes.h"
30 #include "nodes/relation.h"
31 #include "utils/datum.h"
35 * Macros to simplify comparison of different kinds of fields. Use these
36 * wherever possible to reduce the chance for silly typos. Note that these
37 * hard-wire the convention that the local variables in an Equal routine are
41 /* Compare a simple scalar field (int, float, bool, enum, etc) */
42 #define COMPARE_SCALAR_FIELD(fldname) \
44 if (a->fldname != b->fldname) \
48 /* Compare a field that is a pointer to some kind of Node or Node tree */
49 #define COMPARE_NODE_FIELD(fldname) \
51 if (!equal(a->fldname, b->fldname)) \
55 /* Compare a field that is a pointer to a list of integers */
56 #define COMPARE_INTLIST_FIELD(fldname) \
58 if (!equali(a->fldname, b->fldname)) \
62 /* Compare a field that is a pointer to a list of Oids */
63 #define COMPARE_OIDLIST_FIELD(fldname) \
65 if (!equalo(a->fldname, b->fldname)) \
69 /* Compare a field that is a pointer to a Bitmapset */
70 #define COMPARE_BITMAPSET_FIELD(fldname) \
72 if (!bms_equal(a->fldname, b->fldname)) \
76 /* Compare a field that is a pointer to a C string, or perhaps NULL */
77 #define COMPARE_STRING_FIELD(fldname) \
79 if (!equalstr(a->fldname, b->fldname)) \
83 /* Macro for comparing string fields that might be NULL */
84 #define equalstr(a, b) \
85 (((a) != NULL && (b) != NULL) ? (strcmp(a, b) == 0) : (a) == (b))
87 /* Compare a field that is a pointer to a simple palloc'd object of size sz */
88 #define COMPARE_POINTER_FIELD(fldname, sz) \
90 if (memcmp(a->fldname, b->fldname, (sz)) != 0) \
96 * Stuff from primnodes.h
100 _equalResdom(Resdom *a, Resdom *b)
102 COMPARE_SCALAR_FIELD(resno);
103 COMPARE_SCALAR_FIELD(restype);
104 COMPARE_SCALAR_FIELD(restypmod);
105 COMPARE_STRING_FIELD(resname);
106 COMPARE_SCALAR_FIELD(ressortgroupref);
107 COMPARE_SCALAR_FIELD(reskey);
108 COMPARE_SCALAR_FIELD(reskeyop);
109 COMPARE_SCALAR_FIELD(resjunk);
115 _equalAlias(Alias *a, Alias *b)
117 COMPARE_STRING_FIELD(aliasname);
118 COMPARE_NODE_FIELD(colnames);
124 _equalRangeVar(RangeVar *a, RangeVar *b)
126 COMPARE_STRING_FIELD(catalogname);
127 COMPARE_STRING_FIELD(schemaname);
128 COMPARE_STRING_FIELD(relname);
129 COMPARE_SCALAR_FIELD(inhOpt);
130 COMPARE_SCALAR_FIELD(istemp);
131 COMPARE_NODE_FIELD(alias);
137 * We don't need an _equalExpr because Expr is an abstract supertype which
138 * should never actually get instantiated. Also, since it has no common
139 * fields except NodeTag, there's no need for a helper routine to factor
140 * out comparing the common fields...
144 _equalVar(Var *a, Var *b)
146 COMPARE_SCALAR_FIELD(varno);
147 COMPARE_SCALAR_FIELD(varattno);
148 COMPARE_SCALAR_FIELD(vartype);
149 COMPARE_SCALAR_FIELD(vartypmod);
150 COMPARE_SCALAR_FIELD(varlevelsup);
151 COMPARE_SCALAR_FIELD(varnoold);
152 COMPARE_SCALAR_FIELD(varoattno);
158 _equalConst(Const *a, Const *b)
160 COMPARE_SCALAR_FIELD(consttype);
161 COMPARE_SCALAR_FIELD(constlen);
162 COMPARE_SCALAR_FIELD(constisnull);
163 COMPARE_SCALAR_FIELD(constbyval);
166 * We treat all NULL constants of the same type as equal. Someday this
167 * might need to change? But datumIsEqual doesn't work on nulls,
172 return datumIsEqual(a->constvalue, b->constvalue,
173 a->constbyval, a->constlen);
177 _equalParam(Param *a, Param *b)
179 COMPARE_SCALAR_FIELD(paramkind);
180 COMPARE_SCALAR_FIELD(paramtype);
182 switch (a->paramkind)
185 COMPARE_STRING_FIELD(paramname);
189 COMPARE_SCALAR_FIELD(paramid);
192 elog(ERROR, "_equalParam: Invalid paramkind value: %d",
200 _equalAggref(Aggref *a, Aggref *b)
202 COMPARE_SCALAR_FIELD(aggfnoid);
203 COMPARE_SCALAR_FIELD(aggtype);
204 COMPARE_NODE_FIELD(target);
205 COMPARE_SCALAR_FIELD(aggstar);
206 COMPARE_SCALAR_FIELD(aggdistinct);
212 _equalArrayRef(ArrayRef *a, ArrayRef *b)
214 COMPARE_SCALAR_FIELD(refrestype);
215 COMPARE_SCALAR_FIELD(refattrlength);
216 COMPARE_SCALAR_FIELD(refelemlength);
217 COMPARE_SCALAR_FIELD(refelembyval);
218 COMPARE_SCALAR_FIELD(refelemalign);
219 COMPARE_NODE_FIELD(refupperindexpr);
220 COMPARE_NODE_FIELD(reflowerindexpr);
221 COMPARE_NODE_FIELD(refexpr);
222 COMPARE_NODE_FIELD(refassgnexpr);
228 _equalFuncExpr(FuncExpr *a, FuncExpr *b)
230 COMPARE_SCALAR_FIELD(funcid);
231 COMPARE_SCALAR_FIELD(funcresulttype);
232 COMPARE_SCALAR_FIELD(funcretset);
234 * Special-case COERCE_DONTCARE, so that pathkeys can build coercion
235 * nodes that are equal() to both explicit and implicit coercions.
237 if (a->funcformat != b->funcformat &&
238 a->funcformat != COERCE_DONTCARE &&
239 b->funcformat != COERCE_DONTCARE)
242 COMPARE_NODE_FIELD(args);
248 _equalOpExpr(OpExpr *a, OpExpr *b)
250 COMPARE_SCALAR_FIELD(opno);
252 * Special-case opfuncid: it is allowable for it to differ if one
253 * node contains zero and the other doesn't. This just means that the
254 * one node isn't as far along in the parse/plan pipeline and hasn't
255 * had the opfuncid cache filled yet.
257 if (a->opfuncid != b->opfuncid &&
262 COMPARE_SCALAR_FIELD(opresulttype);
263 COMPARE_SCALAR_FIELD(opretset);
264 COMPARE_NODE_FIELD(args);
270 _equalDistinctExpr(DistinctExpr *a, DistinctExpr *b)
272 COMPARE_SCALAR_FIELD(opno);
274 * Special-case opfuncid: it is allowable for it to differ if one
275 * node contains zero and the other doesn't. This just means that the
276 * one node isn't as far along in the parse/plan pipeline and hasn't
277 * had the opfuncid cache filled yet.
279 if (a->opfuncid != b->opfuncid &&
284 COMPARE_SCALAR_FIELD(opresulttype);
285 COMPARE_SCALAR_FIELD(opretset);
286 COMPARE_NODE_FIELD(args);
292 _equalBoolExpr(BoolExpr *a, BoolExpr *b)
294 COMPARE_SCALAR_FIELD(boolop);
295 COMPARE_NODE_FIELD(args);
301 _equalSubLink(SubLink *a, SubLink *b)
303 COMPARE_SCALAR_FIELD(subLinkType);
304 COMPARE_SCALAR_FIELD(useOr);
305 COMPARE_NODE_FIELD(lefthand);
306 COMPARE_NODE_FIELD(operName);
307 COMPARE_OIDLIST_FIELD(operOids);
308 COMPARE_NODE_FIELD(subselect);
314 _equalSubPlan(SubPlan *a, SubPlan *b)
316 COMPARE_SCALAR_FIELD(subLinkType);
317 COMPARE_SCALAR_FIELD(useOr);
318 COMPARE_NODE_FIELD(exprs);
319 COMPARE_INTLIST_FIELD(paramIds);
320 /* should compare plans, but have to settle for comparing plan IDs */
321 COMPARE_SCALAR_FIELD(plan_id);
322 COMPARE_NODE_FIELD(rtable);
323 COMPARE_SCALAR_FIELD(useHashTable);
324 COMPARE_SCALAR_FIELD(unknownEqFalse);
325 COMPARE_INTLIST_FIELD(setParam);
326 COMPARE_INTLIST_FIELD(parParam);
327 COMPARE_NODE_FIELD(args);
333 _equalFieldSelect(FieldSelect *a, FieldSelect *b)
335 COMPARE_NODE_FIELD(arg);
336 COMPARE_SCALAR_FIELD(fieldnum);
337 COMPARE_SCALAR_FIELD(resulttype);
338 COMPARE_SCALAR_FIELD(resulttypmod);
344 _equalRelabelType(RelabelType *a, RelabelType *b)
346 COMPARE_NODE_FIELD(arg);
347 COMPARE_SCALAR_FIELD(resulttype);
348 COMPARE_SCALAR_FIELD(resulttypmod);
350 * Special-case COERCE_DONTCARE, so that pathkeys can build coercion
351 * nodes that are equal() to both explicit and implicit coercions.
353 if (a->relabelformat != b->relabelformat &&
354 a->relabelformat != COERCE_DONTCARE &&
355 b->relabelformat != COERCE_DONTCARE)
362 _equalCaseExpr(CaseExpr *a, CaseExpr *b)
364 COMPARE_SCALAR_FIELD(casetype);
365 COMPARE_NODE_FIELD(arg);
366 COMPARE_NODE_FIELD(args);
367 COMPARE_NODE_FIELD(defresult);
373 _equalCaseWhen(CaseWhen *a, CaseWhen *b)
375 COMPARE_NODE_FIELD(expr);
376 COMPARE_NODE_FIELD(result);
382 _equalCoalesceExpr(CoalesceExpr *a, CoalesceExpr *b)
384 COMPARE_SCALAR_FIELD(coalescetype);
385 COMPARE_NODE_FIELD(args);
391 _equalNullIfExpr(NullIfExpr *a, NullIfExpr *b)
393 COMPARE_SCALAR_FIELD(opno);
395 * Special-case opfuncid: it is allowable for it to differ if one
396 * node contains zero and the other doesn't. This just means that the
397 * one node isn't as far along in the parse/plan pipeline and hasn't
398 * had the opfuncid cache filled yet.
400 if (a->opfuncid != b->opfuncid &&
405 COMPARE_SCALAR_FIELD(opresulttype);
406 COMPARE_SCALAR_FIELD(opretset);
407 COMPARE_NODE_FIELD(args);
413 _equalNullTest(NullTest *a, NullTest *b)
415 COMPARE_NODE_FIELD(arg);
416 COMPARE_SCALAR_FIELD(nulltesttype);
422 _equalBooleanTest(BooleanTest *a, BooleanTest *b)
424 COMPARE_NODE_FIELD(arg);
425 COMPARE_SCALAR_FIELD(booltesttype);
431 _equalCoerceToDomain(CoerceToDomain *a, CoerceToDomain *b)
433 COMPARE_NODE_FIELD(arg);
434 COMPARE_SCALAR_FIELD(resulttype);
435 COMPARE_SCALAR_FIELD(resulttypmod);
437 * Special-case COERCE_DONTCARE, so that pathkeys can build coercion
438 * nodes that are equal() to both explicit and implicit coercions.
440 if (a->coercionformat != b->coercionformat &&
441 a->coercionformat != COERCE_DONTCARE &&
442 b->coercionformat != COERCE_DONTCARE)
449 _equalCoerceToDomainValue(CoerceToDomainValue *a, CoerceToDomainValue *b)
451 COMPARE_SCALAR_FIELD(typeId);
452 COMPARE_SCALAR_FIELD(typeMod);
458 _equalTargetEntry(TargetEntry *a, TargetEntry *b)
460 COMPARE_NODE_FIELD(resdom);
461 COMPARE_NODE_FIELD(expr);
467 _equalRangeTblRef(RangeTblRef *a, RangeTblRef *b)
469 COMPARE_SCALAR_FIELD(rtindex);
475 _equalJoinExpr(JoinExpr *a, JoinExpr *b)
477 COMPARE_SCALAR_FIELD(jointype);
478 COMPARE_SCALAR_FIELD(isNatural);
479 COMPARE_NODE_FIELD(larg);
480 COMPARE_NODE_FIELD(rarg);
481 COMPARE_NODE_FIELD(using);
482 COMPARE_NODE_FIELD(quals);
483 COMPARE_NODE_FIELD(alias);
484 COMPARE_SCALAR_FIELD(rtindex);
490 _equalFromExpr(FromExpr *a, FromExpr *b)
492 COMPARE_NODE_FIELD(fromlist);
493 COMPARE_NODE_FIELD(quals);
500 * Stuff from relation.h
504 _equalPathKeyItem(PathKeyItem *a, PathKeyItem *b)
506 COMPARE_NODE_FIELD(key);
507 COMPARE_SCALAR_FIELD(sortop);
513 _equalRestrictInfo(RestrictInfo *a, RestrictInfo *b)
515 COMPARE_NODE_FIELD(clause);
516 COMPARE_SCALAR_FIELD(ispusheddown);
518 * We ignore subclauseindices, eval_cost, this_selec, left/right_relids,
519 * left/right_pathkey, and left/right_bucketsize, since they may not be
520 * set yet, and should be derivable from the clause anyway. Probably it's
521 * not really necessary to compare any of these remaining fields ...
523 COMPARE_SCALAR_FIELD(mergejoinoperator);
524 COMPARE_SCALAR_FIELD(left_sortop);
525 COMPARE_SCALAR_FIELD(right_sortop);
526 COMPARE_SCALAR_FIELD(hashjoinoperator);
532 _equalJoinInfo(JoinInfo *a, JoinInfo *b)
534 COMPARE_BITMAPSET_FIELD(unjoined_relids);
535 COMPARE_NODE_FIELD(jinfo_restrictinfo);
541 _equalInClauseInfo(InClauseInfo *a, InClauseInfo *b)
543 COMPARE_BITMAPSET_FIELD(lefthand);
544 COMPARE_BITMAPSET_FIELD(righthand);
545 COMPARE_NODE_FIELD(sub_targetlist);
552 * Stuff from parsenodes.h
556 _equalQuery(Query *a, Query *b)
558 COMPARE_SCALAR_FIELD(commandType);
559 COMPARE_SCALAR_FIELD(querySource);
560 COMPARE_NODE_FIELD(utilityStmt);
561 COMPARE_SCALAR_FIELD(resultRelation);
562 COMPARE_NODE_FIELD(into);
563 COMPARE_SCALAR_FIELD(hasAggs);
564 COMPARE_SCALAR_FIELD(hasSubLinks);
565 COMPARE_NODE_FIELD(rtable);
566 COMPARE_NODE_FIELD(jointree);
567 COMPARE_INTLIST_FIELD(rowMarks);
568 COMPARE_NODE_FIELD(targetList);
569 COMPARE_NODE_FIELD(groupClause);
570 COMPARE_NODE_FIELD(havingQual);
571 COMPARE_NODE_FIELD(distinctClause);
572 COMPARE_NODE_FIELD(sortClause);
573 COMPARE_NODE_FIELD(limitOffset);
574 COMPARE_NODE_FIELD(limitCount);
575 COMPARE_NODE_FIELD(setOperations);
576 COMPARE_INTLIST_FIELD(resultRelations);
577 COMPARE_NODE_FIELD(in_info_list);
578 COMPARE_SCALAR_FIELD(hasJoinRTEs);
581 * We do not check the other planner internal fields: base_rel_list,
582 * other_rel_list, join_rel_list, equi_key_list, query_pathkeys.
583 * They might not be set yet, and in any case they should be derivable
584 * from the other fields.
590 _equalInsertStmt(InsertStmt *a, InsertStmt *b)
592 COMPARE_NODE_FIELD(relation);
593 COMPARE_NODE_FIELD(cols);
594 COMPARE_NODE_FIELD(targetList);
595 COMPARE_NODE_FIELD(selectStmt);
601 _equalDeleteStmt(DeleteStmt *a, DeleteStmt *b)
603 COMPARE_NODE_FIELD(relation);
604 COMPARE_NODE_FIELD(whereClause);
610 _equalUpdateStmt(UpdateStmt *a, UpdateStmt *b)
612 COMPARE_NODE_FIELD(relation);
613 COMPARE_NODE_FIELD(targetList);
614 COMPARE_NODE_FIELD(whereClause);
615 COMPARE_NODE_FIELD(fromClause);
621 _equalSelectStmt(SelectStmt *a, SelectStmt *b)
623 COMPARE_NODE_FIELD(distinctClause);
624 COMPARE_NODE_FIELD(into);
625 COMPARE_NODE_FIELD(intoColNames);
626 COMPARE_NODE_FIELD(targetList);
627 COMPARE_NODE_FIELD(fromClause);
628 COMPARE_NODE_FIELD(whereClause);
629 COMPARE_NODE_FIELD(groupClause);
630 COMPARE_NODE_FIELD(havingClause);
631 COMPARE_NODE_FIELD(sortClause);
632 COMPARE_NODE_FIELD(limitOffset);
633 COMPARE_NODE_FIELD(limitCount);
634 COMPARE_NODE_FIELD(forUpdate);
635 COMPARE_SCALAR_FIELD(op);
636 COMPARE_SCALAR_FIELD(all);
637 COMPARE_NODE_FIELD(larg);
638 COMPARE_NODE_FIELD(rarg);
644 _equalSetOperationStmt(SetOperationStmt *a, SetOperationStmt *b)
646 COMPARE_SCALAR_FIELD(op);
647 COMPARE_SCALAR_FIELD(all);
648 COMPARE_NODE_FIELD(larg);
649 COMPARE_NODE_FIELD(rarg);
650 COMPARE_OIDLIST_FIELD(colTypes);
656 _equalAlterTableStmt(AlterTableStmt *a, AlterTableStmt *b)
658 COMPARE_SCALAR_FIELD(subtype);
659 COMPARE_NODE_FIELD(relation);
660 COMPARE_STRING_FIELD(name);
661 COMPARE_NODE_FIELD(def);
662 COMPARE_SCALAR_FIELD(behavior);
668 _equalAlterDomainStmt(AlterDomainStmt *a, AlterDomainStmt *b)
670 COMPARE_SCALAR_FIELD(subtype);
671 COMPARE_NODE_FIELD(typename);
672 COMPARE_STRING_FIELD(name);
673 COMPARE_NODE_FIELD(def);
674 COMPARE_SCALAR_FIELD(behavior);
680 _equalGrantStmt(GrantStmt *a, GrantStmt *b)
682 COMPARE_SCALAR_FIELD(is_grant);
683 COMPARE_SCALAR_FIELD(objtype);
684 COMPARE_NODE_FIELD(objects);
685 COMPARE_INTLIST_FIELD(privileges);
686 COMPARE_NODE_FIELD(grantees);
687 COMPARE_SCALAR_FIELD(grant_option);
688 COMPARE_SCALAR_FIELD(behavior);
694 _equalPrivGrantee(PrivGrantee *a, PrivGrantee *b)
696 COMPARE_STRING_FIELD(username);
697 COMPARE_STRING_FIELD(groupname);
703 _equalFuncWithArgs(FuncWithArgs *a, FuncWithArgs *b)
705 COMPARE_NODE_FIELD(funcname);
706 COMPARE_NODE_FIELD(funcargs);
712 _equalInsertDefault(InsertDefault *a, InsertDefault *b)
718 _equalDeclareCursorStmt(DeclareCursorStmt *a, DeclareCursorStmt *b)
720 COMPARE_STRING_FIELD(portalname);
721 COMPARE_SCALAR_FIELD(options);
722 COMPARE_NODE_FIELD(query);
728 _equalClosePortalStmt(ClosePortalStmt *a, ClosePortalStmt *b)
730 COMPARE_STRING_FIELD(portalname);
736 _equalClusterStmt(ClusterStmt *a, ClusterStmt *b)
738 COMPARE_NODE_FIELD(relation);
739 COMPARE_STRING_FIELD(indexname);
745 _equalCopyStmt(CopyStmt *a, CopyStmt *b)
747 COMPARE_NODE_FIELD(relation);
748 COMPARE_NODE_FIELD(attlist);
749 COMPARE_SCALAR_FIELD(is_from);
750 COMPARE_STRING_FIELD(filename);
751 COMPARE_NODE_FIELD(options);
757 _equalCreateStmt(CreateStmt *a, CreateStmt *b)
759 COMPARE_NODE_FIELD(relation);
760 COMPARE_NODE_FIELD(tableElts);
761 COMPARE_NODE_FIELD(inhRelations);
762 COMPARE_NODE_FIELD(constraints);
763 COMPARE_SCALAR_FIELD(hasoids);
764 COMPARE_SCALAR_FIELD(oncommit);
770 _equalDefineStmt(DefineStmt *a, DefineStmt *b)
772 COMPARE_SCALAR_FIELD(kind);
773 COMPARE_NODE_FIELD(defnames);
774 COMPARE_NODE_FIELD(definition);
780 _equalDropStmt(DropStmt *a, DropStmt *b)
782 COMPARE_NODE_FIELD(objects);
783 COMPARE_SCALAR_FIELD(removeType);
784 COMPARE_SCALAR_FIELD(behavior);
790 _equalTruncateStmt(TruncateStmt *a, TruncateStmt *b)
792 COMPARE_NODE_FIELD(relation);
798 _equalCommentStmt(CommentStmt *a, CommentStmt *b)
800 COMPARE_SCALAR_FIELD(objtype);
801 COMPARE_NODE_FIELD(objname);
802 COMPARE_NODE_FIELD(objargs);
803 COMPARE_STRING_FIELD(comment);
809 _equalFetchStmt(FetchStmt *a, FetchStmt *b)
811 COMPARE_SCALAR_FIELD(direction);
812 COMPARE_SCALAR_FIELD(howMany);
813 COMPARE_STRING_FIELD(portalname);
814 COMPARE_SCALAR_FIELD(ismove);
820 _equalIndexStmt(IndexStmt *a, IndexStmt *b)
822 COMPARE_STRING_FIELD(idxname);
823 COMPARE_NODE_FIELD(relation);
824 COMPARE_STRING_FIELD(accessMethod);
825 COMPARE_NODE_FIELD(indexParams);
826 COMPARE_NODE_FIELD(whereClause);
827 COMPARE_NODE_FIELD(rangetable);
828 COMPARE_SCALAR_FIELD(unique);
829 COMPARE_SCALAR_FIELD(primary);
830 COMPARE_SCALAR_FIELD(isconstraint);
836 _equalCreateFunctionStmt(CreateFunctionStmt *a, CreateFunctionStmt *b)
838 COMPARE_SCALAR_FIELD(replace);
839 COMPARE_NODE_FIELD(funcname);
840 COMPARE_NODE_FIELD(argTypes);
841 COMPARE_NODE_FIELD(returnType);
842 COMPARE_NODE_FIELD(options);
843 COMPARE_NODE_FIELD(withClause);
849 _equalRemoveAggrStmt(RemoveAggrStmt *a, RemoveAggrStmt *b)
851 COMPARE_NODE_FIELD(aggname);
852 COMPARE_NODE_FIELD(aggtype);
853 COMPARE_SCALAR_FIELD(behavior);
859 _equalRemoveFuncStmt(RemoveFuncStmt *a, RemoveFuncStmt *b)
861 COMPARE_NODE_FIELD(funcname);
862 COMPARE_NODE_FIELD(args);
863 COMPARE_SCALAR_FIELD(behavior);
869 _equalRemoveOperStmt(RemoveOperStmt *a, RemoveOperStmt *b)
871 COMPARE_NODE_FIELD(opname);
872 COMPARE_NODE_FIELD(args);
873 COMPARE_SCALAR_FIELD(behavior);
879 _equalRemoveOpClassStmt(RemoveOpClassStmt *a, RemoveOpClassStmt *b)
881 COMPARE_NODE_FIELD(opclassname);
882 COMPARE_STRING_FIELD(amname);
883 COMPARE_SCALAR_FIELD(behavior);
889 _equalRenameStmt(RenameStmt *a, RenameStmt *b)
891 COMPARE_NODE_FIELD(relation);
892 COMPARE_STRING_FIELD(oldname);
893 COMPARE_STRING_FIELD(newname);
894 COMPARE_SCALAR_FIELD(renameType);
900 _equalRuleStmt(RuleStmt *a, RuleStmt *b)
902 COMPARE_NODE_FIELD(relation);
903 COMPARE_STRING_FIELD(rulename);
904 COMPARE_NODE_FIELD(whereClause);
905 COMPARE_SCALAR_FIELD(event);
906 COMPARE_SCALAR_FIELD(instead);
907 COMPARE_NODE_FIELD(actions);
908 COMPARE_SCALAR_FIELD(replace);
914 _equalNotifyStmt(NotifyStmt *a, NotifyStmt *b)
916 COMPARE_NODE_FIELD(relation);
922 _equalListenStmt(ListenStmt *a, ListenStmt *b)
924 COMPARE_NODE_FIELD(relation);
930 _equalUnlistenStmt(UnlistenStmt *a, UnlistenStmt *b)
932 COMPARE_NODE_FIELD(relation);
938 _equalTransactionStmt(TransactionStmt *a, TransactionStmt *b)
940 COMPARE_SCALAR_FIELD(kind);
941 COMPARE_NODE_FIELD(options);
947 _equalCompositeTypeStmt(CompositeTypeStmt *a, CompositeTypeStmt *b)
949 COMPARE_NODE_FIELD(typevar);
950 COMPARE_NODE_FIELD(coldeflist);
956 _equalViewStmt(ViewStmt *a, ViewStmt *b)
958 COMPARE_NODE_FIELD(view);
959 COMPARE_NODE_FIELD(aliases);
960 COMPARE_NODE_FIELD(query);
961 COMPARE_SCALAR_FIELD(replace);
967 _equalLoadStmt(LoadStmt *a, LoadStmt *b)
969 COMPARE_STRING_FIELD(filename);
975 _equalCreateDomainStmt(CreateDomainStmt *a, CreateDomainStmt *b)
977 COMPARE_NODE_FIELD(domainname);
978 COMPARE_NODE_FIELD(typename);
979 COMPARE_NODE_FIELD(constraints);
985 _equalCreateOpClassStmt(CreateOpClassStmt *a, CreateOpClassStmt *b)
987 COMPARE_NODE_FIELD(opclassname);
988 COMPARE_STRING_FIELD(amname);
989 COMPARE_NODE_FIELD(datatype);
990 COMPARE_NODE_FIELD(items);
991 COMPARE_SCALAR_FIELD(isDefault);
997 _equalCreateOpClassItem(CreateOpClassItem *a, CreateOpClassItem *b)
999 COMPARE_SCALAR_FIELD(itemtype);
1000 COMPARE_NODE_FIELD(name);
1001 COMPARE_NODE_FIELD(args);
1002 COMPARE_SCALAR_FIELD(number);
1003 COMPARE_SCALAR_FIELD(recheck);
1004 COMPARE_NODE_FIELD(storedtype);
1010 _equalCreatedbStmt(CreatedbStmt *a, CreatedbStmt *b)
1012 COMPARE_STRING_FIELD(dbname);
1013 COMPARE_NODE_FIELD(options);
1019 _equalAlterDatabaseSetStmt(AlterDatabaseSetStmt *a, AlterDatabaseSetStmt *b)
1021 COMPARE_STRING_FIELD(dbname);
1022 COMPARE_STRING_FIELD(variable);
1023 COMPARE_NODE_FIELD(value);
1029 _equalDropdbStmt(DropdbStmt *a, DropdbStmt *b)
1031 COMPARE_STRING_FIELD(dbname);
1037 _equalVacuumStmt(VacuumStmt *a, VacuumStmt *b)
1039 COMPARE_SCALAR_FIELD(vacuum);
1040 COMPARE_SCALAR_FIELD(full);
1041 COMPARE_SCALAR_FIELD(analyze);
1042 COMPARE_SCALAR_FIELD(freeze);
1043 COMPARE_SCALAR_FIELD(verbose);
1044 COMPARE_NODE_FIELD(relation);
1045 COMPARE_NODE_FIELD(va_cols);
1051 _equalExplainStmt(ExplainStmt *a, ExplainStmt *b)
1053 COMPARE_NODE_FIELD(query);
1054 COMPARE_SCALAR_FIELD(verbose);
1055 COMPARE_SCALAR_FIELD(analyze);
1061 _equalCreateSeqStmt(CreateSeqStmt *a, CreateSeqStmt *b)
1063 COMPARE_NODE_FIELD(sequence);
1064 COMPARE_NODE_FIELD(options);
1070 _equalAlterSeqStmt(AlterSeqStmt *a, AlterSeqStmt *b)
1072 COMPARE_NODE_FIELD(sequence);
1073 COMPARE_NODE_FIELD(options);
1079 _equalVariableSetStmt(VariableSetStmt *a, VariableSetStmt *b)
1081 COMPARE_STRING_FIELD(name);
1082 COMPARE_NODE_FIELD(args);
1083 COMPARE_SCALAR_FIELD(is_local);
1089 _equalVariableShowStmt(VariableShowStmt *a, VariableShowStmt *b)
1091 COMPARE_STRING_FIELD(name);
1097 _equalVariableResetStmt(VariableResetStmt *a, VariableResetStmt *b)
1099 COMPARE_STRING_FIELD(name);
1105 _equalCreateTrigStmt(CreateTrigStmt *a, CreateTrigStmt *b)
1107 COMPARE_STRING_FIELD(trigname);
1108 COMPARE_NODE_FIELD(relation);
1109 COMPARE_NODE_FIELD(funcname);
1110 COMPARE_NODE_FIELD(args);
1111 COMPARE_SCALAR_FIELD(before);
1112 COMPARE_SCALAR_FIELD(row);
1113 if (strcmp(a->actions, b->actions) != 0) /* in-line string field */
1115 COMPARE_SCALAR_FIELD(isconstraint);
1116 COMPARE_SCALAR_FIELD(deferrable);
1117 COMPARE_SCALAR_FIELD(initdeferred);
1118 COMPARE_NODE_FIELD(constrrel);
1124 _equalDropPropertyStmt(DropPropertyStmt *a, DropPropertyStmt *b)
1126 COMPARE_NODE_FIELD(relation);
1127 COMPARE_STRING_FIELD(property);
1128 COMPARE_SCALAR_FIELD(removeType);
1129 COMPARE_SCALAR_FIELD(behavior);
1135 _equalCreatePLangStmt(CreatePLangStmt *a, CreatePLangStmt *b)
1137 COMPARE_STRING_FIELD(plname);
1138 COMPARE_NODE_FIELD(plhandler);
1139 COMPARE_NODE_FIELD(plvalidator);
1140 COMPARE_SCALAR_FIELD(pltrusted);
1146 _equalDropPLangStmt(DropPLangStmt *a, DropPLangStmt *b)
1148 COMPARE_STRING_FIELD(plname);
1149 COMPARE_SCALAR_FIELD(behavior);
1155 _equalCreateUserStmt(CreateUserStmt *a, CreateUserStmt *b)
1157 COMPARE_STRING_FIELD(user);
1158 COMPARE_NODE_FIELD(options);
1164 _equalAlterUserStmt(AlterUserStmt *a, AlterUserStmt *b)
1166 COMPARE_STRING_FIELD(user);
1167 COMPARE_NODE_FIELD(options);
1173 _equalAlterUserSetStmt(AlterUserSetStmt *a, AlterUserSetStmt *b)
1175 COMPARE_STRING_FIELD(user);
1176 COMPARE_STRING_FIELD(variable);
1177 COMPARE_NODE_FIELD(value);
1183 _equalDropUserStmt(DropUserStmt *a, DropUserStmt *b)
1185 COMPARE_NODE_FIELD(users);
1191 _equalLockStmt(LockStmt *a, LockStmt *b)
1193 COMPARE_NODE_FIELD(relations);
1194 COMPARE_SCALAR_FIELD(mode);
1200 _equalConstraintsSetStmt(ConstraintsSetStmt *a, ConstraintsSetStmt *b)
1202 COMPARE_NODE_FIELD(constraints);
1203 COMPARE_SCALAR_FIELD(deferred);
1209 _equalCreateGroupStmt(CreateGroupStmt *a, CreateGroupStmt *b)
1211 COMPARE_STRING_FIELD(name);
1212 COMPARE_NODE_FIELD(options);
1218 _equalAlterGroupStmt(AlterGroupStmt *a, AlterGroupStmt *b)
1220 COMPARE_STRING_FIELD(name);
1221 COMPARE_SCALAR_FIELD(action);
1222 COMPARE_NODE_FIELD(listUsers);
1228 _equalDropGroupStmt(DropGroupStmt *a, DropGroupStmt *b)
1230 COMPARE_STRING_FIELD(name);
1236 _equalReindexStmt(ReindexStmt *a, ReindexStmt *b)
1238 COMPARE_SCALAR_FIELD(kind);
1239 COMPARE_NODE_FIELD(relation);
1240 COMPARE_STRING_FIELD(name);
1241 COMPARE_SCALAR_FIELD(force);
1242 COMPARE_SCALAR_FIELD(all);
1248 _equalCreateSchemaStmt(CreateSchemaStmt *a, CreateSchemaStmt *b)
1250 COMPARE_STRING_FIELD(schemaname);
1251 COMPARE_STRING_FIELD(authid);
1252 COMPARE_NODE_FIELD(schemaElts);
1258 _equalCreateConversionStmt(CreateConversionStmt *a, CreateConversionStmt *b)
1260 COMPARE_NODE_FIELD(conversion_name);
1261 COMPARE_STRING_FIELD(for_encoding_name);
1262 COMPARE_STRING_FIELD(to_encoding_name);
1263 COMPARE_NODE_FIELD(func_name);
1264 COMPARE_SCALAR_FIELD(def);
1270 _equalCreateCastStmt(CreateCastStmt *a, CreateCastStmt *b)
1272 COMPARE_NODE_FIELD(sourcetype);
1273 COMPARE_NODE_FIELD(targettype);
1274 COMPARE_NODE_FIELD(func);
1275 COMPARE_SCALAR_FIELD(context);
1281 _equalDropCastStmt(DropCastStmt *a, DropCastStmt *b)
1283 COMPARE_NODE_FIELD(sourcetype);
1284 COMPARE_NODE_FIELD(targettype);
1285 COMPARE_SCALAR_FIELD(behavior);
1291 _equalPrepareStmt(PrepareStmt *a, PrepareStmt *b)
1293 COMPARE_STRING_FIELD(name);
1294 COMPARE_NODE_FIELD(argtypes);
1295 COMPARE_OIDLIST_FIELD(argtype_oids);
1296 COMPARE_NODE_FIELD(query);
1302 _equalExecuteStmt(ExecuteStmt *a, ExecuteStmt *b)
1304 COMPARE_STRING_FIELD(name);
1305 COMPARE_NODE_FIELD(into);
1306 COMPARE_NODE_FIELD(params);
1312 _equalDeallocateStmt(DeallocateStmt *a, DeallocateStmt *b)
1314 COMPARE_STRING_FIELD(name);
1321 * stuff from parsenodes.h
1325 _equalAExpr(A_Expr *a, A_Expr *b)
1327 COMPARE_SCALAR_FIELD(kind);
1328 COMPARE_NODE_FIELD(name);
1329 COMPARE_NODE_FIELD(lexpr);
1330 COMPARE_NODE_FIELD(rexpr);
1336 _equalColumnRef(ColumnRef *a, ColumnRef *b)
1338 COMPARE_NODE_FIELD(fields);
1339 COMPARE_NODE_FIELD(indirection);
1345 _equalParamRef(ParamRef *a, ParamRef *b)
1347 COMPARE_SCALAR_FIELD(number);
1348 COMPARE_NODE_FIELD(fields);
1349 COMPARE_NODE_FIELD(indirection);
1355 _equalAConst(A_Const *a, A_Const *b)
1357 if (!equal(&a->val, &b->val)) /* hack for in-line Value field */
1359 COMPARE_NODE_FIELD(typename);
1365 _equalFuncCall(FuncCall *a, FuncCall *b)
1367 COMPARE_NODE_FIELD(funcname);
1368 COMPARE_NODE_FIELD(args);
1369 COMPARE_SCALAR_FIELD(agg_star);
1370 COMPARE_SCALAR_FIELD(agg_distinct);
1376 _equalAIndices(A_Indices *a, A_Indices *b)
1378 COMPARE_NODE_FIELD(lidx);
1379 COMPARE_NODE_FIELD(uidx);
1385 _equalExprFieldSelect(ExprFieldSelect *a, ExprFieldSelect *b)
1387 COMPARE_NODE_FIELD(arg);
1388 COMPARE_NODE_FIELD(fields);
1389 COMPARE_NODE_FIELD(indirection);
1395 _equalResTarget(ResTarget *a, ResTarget *b)
1397 COMPARE_STRING_FIELD(name);
1398 COMPARE_NODE_FIELD(indirection);
1399 COMPARE_NODE_FIELD(val);
1405 _equalTypeName(TypeName *a, TypeName *b)
1407 COMPARE_NODE_FIELD(names);
1408 COMPARE_SCALAR_FIELD(typeid);
1409 COMPARE_SCALAR_FIELD(timezone);
1410 COMPARE_SCALAR_FIELD(setof);
1411 COMPARE_SCALAR_FIELD(pct_type);
1412 COMPARE_SCALAR_FIELD(typmod);
1413 COMPARE_NODE_FIELD(arrayBounds);
1419 _equalTypeCast(TypeCast *a, TypeCast *b)
1421 COMPARE_NODE_FIELD(arg);
1422 COMPARE_NODE_FIELD(typename);
1428 _equalSortGroupBy(SortGroupBy *a, SortGroupBy *b)
1430 COMPARE_NODE_FIELD(useOp);
1431 COMPARE_NODE_FIELD(node);
1437 _equalRangeSubselect(RangeSubselect *a, RangeSubselect *b)
1439 COMPARE_NODE_FIELD(subquery);
1440 COMPARE_NODE_FIELD(alias);
1446 _equalRangeFunction(RangeFunction *a, RangeFunction *b)
1448 COMPARE_NODE_FIELD(funccallnode);
1449 COMPARE_NODE_FIELD(alias);
1450 COMPARE_NODE_FIELD(coldeflist);
1456 _equalIndexElem(IndexElem *a, IndexElem *b)
1458 COMPARE_STRING_FIELD(name);
1459 COMPARE_NODE_FIELD(funcname);
1460 COMPARE_NODE_FIELD(args);
1461 COMPARE_NODE_FIELD(opclass);
1467 _equalColumnDef(ColumnDef *a, ColumnDef *b)
1469 COMPARE_STRING_FIELD(colname);
1470 COMPARE_NODE_FIELD(typename);
1471 COMPARE_SCALAR_FIELD(inhcount);
1472 COMPARE_SCALAR_FIELD(is_local);
1473 COMPARE_SCALAR_FIELD(is_not_null);
1474 COMPARE_NODE_FIELD(raw_default);
1475 COMPARE_STRING_FIELD(cooked_default);
1476 COMPARE_NODE_FIELD(constraints);
1477 COMPARE_NODE_FIELD(support);
1483 _equalConstraint(Constraint *a, Constraint *b)
1485 COMPARE_SCALAR_FIELD(contype);
1486 COMPARE_STRING_FIELD(name);
1487 COMPARE_NODE_FIELD(raw_expr);
1488 COMPARE_STRING_FIELD(cooked_expr);
1489 COMPARE_NODE_FIELD(keys);
1495 _equalDefElem(DefElem *a, DefElem *b)
1497 COMPARE_STRING_FIELD(defname);
1498 COMPARE_NODE_FIELD(arg);
1504 _equalRangeTblEntry(RangeTblEntry *a, RangeTblEntry *b)
1506 COMPARE_SCALAR_FIELD(rtekind);
1507 COMPARE_SCALAR_FIELD(relid);
1508 COMPARE_NODE_FIELD(subquery);
1509 COMPARE_NODE_FIELD(funcexpr);
1510 COMPARE_NODE_FIELD(coldeflist);
1511 COMPARE_SCALAR_FIELD(jointype);
1512 COMPARE_NODE_FIELD(joinaliasvars);
1513 COMPARE_NODE_FIELD(alias);
1514 COMPARE_NODE_FIELD(eref);
1515 COMPARE_SCALAR_FIELD(inh);
1516 COMPARE_SCALAR_FIELD(inFromCl);
1517 COMPARE_SCALAR_FIELD(checkForRead);
1518 COMPARE_SCALAR_FIELD(checkForWrite);
1519 COMPARE_SCALAR_FIELD(checkAsUser);
1525 _equalSortClause(SortClause *a, SortClause *b)
1527 COMPARE_SCALAR_FIELD(tleSortGroupRef);
1528 COMPARE_SCALAR_FIELD(sortop);
1534 _equalFkConstraint(FkConstraint *a, FkConstraint *b)
1536 COMPARE_STRING_FIELD(constr_name);
1537 COMPARE_NODE_FIELD(pktable);
1538 COMPARE_NODE_FIELD(fk_attrs);
1539 COMPARE_NODE_FIELD(pk_attrs);
1540 COMPARE_SCALAR_FIELD(fk_matchtype);
1541 COMPARE_SCALAR_FIELD(fk_upd_action);
1542 COMPARE_SCALAR_FIELD(fk_del_action);
1543 COMPARE_SCALAR_FIELD(deferrable);
1544 COMPARE_SCALAR_FIELD(initdeferred);
1545 COMPARE_SCALAR_FIELD(skip_validation);
1552 * Stuff from pg_list.h
1556 _equalValue(Value *a, Value *b)
1558 COMPARE_SCALAR_FIELD(type);
1563 COMPARE_SCALAR_FIELD(val.ival);
1568 COMPARE_STRING_FIELD(val.str);
1574 elog(ERROR, "_equalValue: unknown node type %d", a->type);
1583 * returns whether two nodes are equal
1586 equal(void *a, void *b)
1588 bool retval = false;
1594 * note that a!=b, so only one of them can be NULL
1596 if (a == NULL || b == NULL)
1600 * are they the same type of nodes?
1602 if (nodeTag(a) != nodeTag(b))
1611 retval = _equalResdom(a, b);
1614 retval = _equalAlias(a, b);
1617 retval = _equalRangeVar(a, b);
1620 retval = _equalVar(a, b);
1623 retval = _equalConst(a, b);
1626 retval = _equalParam(a, b);
1629 retval = _equalAggref(a, b);
1632 retval = _equalArrayRef(a, b);
1635 retval = _equalFuncExpr(a, b);
1638 retval = _equalOpExpr(a, b);
1640 case T_DistinctExpr:
1641 retval = _equalDistinctExpr(a, b);
1644 retval = _equalBoolExpr(a, b);
1647 retval = _equalSubLink(a, b);
1650 retval = _equalSubPlan(a, b);
1653 retval = _equalFieldSelect(a, b);
1656 retval = _equalRelabelType(a, b);
1659 retval = _equalCaseExpr(a, b);
1662 retval = _equalCaseWhen(a, b);
1664 case T_CoalesceExpr:
1665 retval = _equalCoalesceExpr(a, b);
1668 retval = _equalNullIfExpr(a, b);
1671 retval = _equalNullTest(a, b);
1674 retval = _equalBooleanTest(a, b);
1676 case T_CoerceToDomain:
1677 retval = _equalCoerceToDomain(a, b);
1679 case T_CoerceToDomainValue:
1680 retval = _equalCoerceToDomainValue(a, b);
1683 retval = _equalTargetEntry(a, b);
1686 retval = _equalRangeTblRef(a, b);
1689 retval = _equalFromExpr(a, b);
1692 retval = _equalJoinExpr(a, b);
1699 retval = _equalPathKeyItem(a, b);
1701 case T_RestrictInfo:
1702 retval = _equalRestrictInfo(a, b);
1705 retval = _equalJoinInfo(a, b);
1707 case T_InClauseInfo:
1708 retval = _equalInClauseInfo(a, b);
1716 List *la = (List *) a;
1717 List *lb = (List *) b;
1721 * Try to reject by length check before we grovel through
1722 * all the elements...
1724 if (length(la) != length(lb))
1728 if (!equal(lfirst(l), lfirst(lb)))
1741 retval = _equalValue(a, b);
1748 retval = _equalQuery(a, b);
1751 retval = _equalInsertStmt(a, b);
1754 retval = _equalDeleteStmt(a, b);
1757 retval = _equalUpdateStmt(a, b);
1760 retval = _equalSelectStmt(a, b);
1762 case T_SetOperationStmt:
1763 retval = _equalSetOperationStmt(a, b);
1765 case T_AlterTableStmt:
1766 retval = _equalAlterTableStmt(a, b);
1768 case T_AlterDomainStmt:
1769 retval = _equalAlterDomainStmt(a, b);
1772 retval = _equalGrantStmt(a, b);
1774 case T_DeclareCursorStmt:
1775 retval = _equalDeclareCursorStmt(a, b);
1777 case T_ClosePortalStmt:
1778 retval = _equalClosePortalStmt(a, b);
1781 retval = _equalClusterStmt(a, b);
1784 retval = _equalCopyStmt(a, b);
1787 retval = _equalCreateStmt(a, b);
1790 retval = _equalDefineStmt(a, b);
1793 retval = _equalDropStmt(a, b);
1795 case T_TruncateStmt:
1796 retval = _equalTruncateStmt(a, b);
1799 retval = _equalCommentStmt(a, b);
1802 retval = _equalFetchStmt(a, b);
1805 retval = _equalIndexStmt(a, b);
1807 case T_CreateFunctionStmt:
1808 retval = _equalCreateFunctionStmt(a, b);
1810 case T_RemoveAggrStmt:
1811 retval = _equalRemoveAggrStmt(a, b);
1813 case T_RemoveFuncStmt:
1814 retval = _equalRemoveFuncStmt(a, b);
1816 case T_RemoveOperStmt:
1817 retval = _equalRemoveOperStmt(a, b);
1819 case T_RemoveOpClassStmt:
1820 retval = _equalRemoveOpClassStmt(a, b);
1823 retval = _equalRenameStmt(a, b);
1826 retval = _equalRuleStmt(a, b);
1829 retval = _equalNotifyStmt(a, b);
1832 retval = _equalListenStmt(a, b);
1834 case T_UnlistenStmt:
1835 retval = _equalUnlistenStmt(a, b);
1837 case T_TransactionStmt:
1838 retval = _equalTransactionStmt(a, b);
1840 case T_CompositeTypeStmt:
1841 retval = _equalCompositeTypeStmt(a, b);
1844 retval = _equalViewStmt(a, b);
1847 retval = _equalLoadStmt(a, b);
1849 case T_CreateDomainStmt:
1850 retval = _equalCreateDomainStmt(a, b);
1852 case T_CreateOpClassStmt:
1853 retval = _equalCreateOpClassStmt(a, b);
1855 case T_CreateOpClassItem:
1856 retval = _equalCreateOpClassItem(a, b);
1858 case T_CreatedbStmt:
1859 retval = _equalCreatedbStmt(a, b);
1861 case T_AlterDatabaseSetStmt:
1862 retval = _equalAlterDatabaseSetStmt(a, b);
1865 retval = _equalDropdbStmt(a, b);
1868 retval = _equalVacuumStmt(a, b);
1871 retval = _equalExplainStmt(a, b);
1873 case T_CreateSeqStmt:
1874 retval = _equalCreateSeqStmt(a, b);
1876 case T_AlterSeqStmt:
1877 retval = _equalAlterSeqStmt(a, b);
1879 case T_VariableSetStmt:
1880 retval = _equalVariableSetStmt(a, b);
1882 case T_VariableShowStmt:
1883 retval = _equalVariableShowStmt(a, b);
1885 case T_VariableResetStmt:
1886 retval = _equalVariableResetStmt(a, b);
1888 case T_CreateTrigStmt:
1889 retval = _equalCreateTrigStmt(a, b);
1891 case T_DropPropertyStmt:
1892 retval = _equalDropPropertyStmt(a, b);
1894 case T_CreatePLangStmt:
1895 retval = _equalCreatePLangStmt(a, b);
1897 case T_DropPLangStmt:
1898 retval = _equalDropPLangStmt(a, b);
1900 case T_CreateUserStmt:
1901 retval = _equalCreateUserStmt(a, b);
1903 case T_AlterUserStmt:
1904 retval = _equalAlterUserStmt(a, b);
1906 case T_AlterUserSetStmt:
1907 retval = _equalAlterUserSetStmt(a, b);
1909 case T_DropUserStmt:
1910 retval = _equalDropUserStmt(a, b);
1913 retval = _equalLockStmt(a, b);
1915 case T_ConstraintsSetStmt:
1916 retval = _equalConstraintsSetStmt(a, b);
1918 case T_CreateGroupStmt:
1919 retval = _equalCreateGroupStmt(a, b);
1921 case T_AlterGroupStmt:
1922 retval = _equalAlterGroupStmt(a, b);
1924 case T_DropGroupStmt:
1925 retval = _equalDropGroupStmt(a, b);
1928 retval = _equalReindexStmt(a, b);
1930 case T_CheckPointStmt:
1933 case T_CreateSchemaStmt:
1934 retval = _equalCreateSchemaStmt(a, b);
1936 case T_CreateConversionStmt:
1937 retval = _equalCreateConversionStmt(a, b);
1939 case T_CreateCastStmt:
1940 retval = _equalCreateCastStmt(a, b);
1942 case T_DropCastStmt:
1943 retval = _equalDropCastStmt(a, b);
1946 retval = _equalPrepareStmt(a, b);
1949 retval = _equalExecuteStmt(a, b);
1951 case T_DeallocateStmt:
1952 retval = _equalDeallocateStmt(a, b);
1956 retval = _equalAExpr(a, b);
1959 retval = _equalColumnRef(a, b);
1962 retval = _equalParamRef(a, b);
1965 retval = _equalAConst(a, b);
1968 retval = _equalFuncCall(a, b);
1971 retval = _equalAIndices(a, b);
1973 case T_ExprFieldSelect:
1974 retval = _equalExprFieldSelect(a, b);
1977 retval = _equalResTarget(a, b);
1980 retval = _equalTypeCast(a, b);
1983 retval = _equalSortGroupBy(a, b);
1985 case T_RangeSubselect:
1986 retval = _equalRangeSubselect(a, b);
1988 case T_RangeFunction:
1989 retval = _equalRangeFunction(a, b);
1992 retval = _equalTypeName(a, b);
1995 retval = _equalIndexElem(a, b);
1998 retval = _equalColumnDef(a, b);
2001 retval = _equalConstraint(a, b);
2004 retval = _equalDefElem(a, b);
2006 case T_RangeTblEntry:
2007 retval = _equalRangeTblEntry(a, b);
2010 retval = _equalSortClause(a, b);
2013 /* GroupClause is equivalent to SortClause */
2014 retval = _equalSortClause(a, b);
2016 case T_FkConstraint:
2017 retval = _equalFkConstraint(a, b);
2020 retval = _equalPrivGrantee(a, b);
2022 case T_FuncWithArgs:
2023 retval = _equalFuncWithArgs(a, b);
2025 case T_InsertDefault:
2026 retval = _equalInsertDefault(a, b);
2030 elog(WARNING, "equal: don't know whether nodes of type %d are equal",