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-2006, PostgreSQL Global Development Group
18 * Portions Copyright (c) 1994, Regents of the University of California
21 * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.269 2006/04/15 17:45:34 tgl 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 Bitmapset */
56 #define COMPARE_BITMAPSET_FIELD(fldname) \
58 if (!bms_equal(a->fldname, b->fldname)) \
62 /* Compare a field that is a pointer to a C string, or perhaps NULL */
63 #define COMPARE_STRING_FIELD(fldname) \
65 if (!equalstr(a->fldname, b->fldname)) \
69 /* Macro for comparing string fields that might be NULL */
70 #define equalstr(a, b) \
71 (((a) != NULL && (b) != NULL) ? (strcmp(a, b) == 0) : (a) == (b))
73 /* Compare a field that is a pointer to a simple palloc'd object of size sz */
74 #define COMPARE_POINTER_FIELD(fldname, sz) \
76 if (memcmp(a->fldname, b->fldname, (sz)) != 0) \
82 * Stuff from primnodes.h
86 _equalAlias(Alias *a, Alias *b)
88 COMPARE_STRING_FIELD(aliasname);
89 COMPARE_NODE_FIELD(colnames);
95 _equalRangeVar(RangeVar *a, RangeVar *b)
97 COMPARE_STRING_FIELD(catalogname);
98 COMPARE_STRING_FIELD(schemaname);
99 COMPARE_STRING_FIELD(relname);
100 COMPARE_SCALAR_FIELD(inhOpt);
101 COMPARE_SCALAR_FIELD(istemp);
102 COMPARE_NODE_FIELD(alias);
108 * We don't need an _equalExpr because Expr is an abstract supertype which
109 * should never actually get instantiated. Also, since it has no common
110 * fields except NodeTag, there's no need for a helper routine to factor
111 * out comparing the common fields...
115 _equalVar(Var *a, Var *b)
117 COMPARE_SCALAR_FIELD(varno);
118 COMPARE_SCALAR_FIELD(varattno);
119 COMPARE_SCALAR_FIELD(vartype);
120 COMPARE_SCALAR_FIELD(vartypmod);
121 COMPARE_SCALAR_FIELD(varlevelsup);
122 COMPARE_SCALAR_FIELD(varnoold);
123 COMPARE_SCALAR_FIELD(varoattno);
129 _equalConst(Const *a, Const *b)
131 COMPARE_SCALAR_FIELD(consttype);
132 COMPARE_SCALAR_FIELD(constlen);
133 COMPARE_SCALAR_FIELD(constisnull);
134 COMPARE_SCALAR_FIELD(constbyval);
137 * We treat all NULL constants of the same type as equal. Someday this
138 * might need to change? But datumIsEqual doesn't work on nulls, so...
142 return datumIsEqual(a->constvalue, b->constvalue,
143 a->constbyval, a->constlen);
147 _equalParam(Param *a, Param *b)
149 COMPARE_SCALAR_FIELD(paramkind);
150 COMPARE_SCALAR_FIELD(paramtype);
152 switch (a->paramkind)
155 COMPARE_STRING_FIELD(paramname);
160 COMPARE_SCALAR_FIELD(paramid);
163 elog(ERROR, "unrecognized paramkind: %d",
171 _equalAggref(Aggref *a, Aggref *b)
173 COMPARE_SCALAR_FIELD(aggfnoid);
174 COMPARE_SCALAR_FIELD(aggtype);
175 COMPARE_NODE_FIELD(target);
176 COMPARE_SCALAR_FIELD(agglevelsup);
177 COMPARE_SCALAR_FIELD(aggstar);
178 COMPARE_SCALAR_FIELD(aggdistinct);
184 _equalArrayRef(ArrayRef *a, ArrayRef *b)
186 COMPARE_SCALAR_FIELD(refrestype);
187 COMPARE_SCALAR_FIELD(refarraytype);
188 COMPARE_SCALAR_FIELD(refelemtype);
189 COMPARE_NODE_FIELD(refupperindexpr);
190 COMPARE_NODE_FIELD(reflowerindexpr);
191 COMPARE_NODE_FIELD(refexpr);
192 COMPARE_NODE_FIELD(refassgnexpr);
198 _equalFuncExpr(FuncExpr *a, FuncExpr *b)
200 COMPARE_SCALAR_FIELD(funcid);
201 COMPARE_SCALAR_FIELD(funcresulttype);
202 COMPARE_SCALAR_FIELD(funcretset);
205 * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
206 * that are equal() to both explicit and implicit coercions.
208 if (a->funcformat != b->funcformat &&
209 a->funcformat != COERCE_DONTCARE &&
210 b->funcformat != COERCE_DONTCARE)
213 COMPARE_NODE_FIELD(args);
219 _equalOpExpr(OpExpr *a, OpExpr *b)
221 COMPARE_SCALAR_FIELD(opno);
224 * Special-case opfuncid: it is allowable for it to differ if one node
225 * contains zero and the other doesn't. This just means that the one node
226 * isn't as far along in the parse/plan pipeline and hasn't had the
227 * opfuncid cache filled yet.
229 if (a->opfuncid != b->opfuncid &&
234 COMPARE_SCALAR_FIELD(opresulttype);
235 COMPARE_SCALAR_FIELD(opretset);
236 COMPARE_NODE_FIELD(args);
242 _equalDistinctExpr(DistinctExpr *a, DistinctExpr *b)
244 COMPARE_SCALAR_FIELD(opno);
247 * Special-case opfuncid: it is allowable for it to differ if one node
248 * contains zero and the other doesn't. This just means that the one node
249 * isn't as far along in the parse/plan pipeline and hasn't had the
250 * opfuncid cache filled yet.
252 if (a->opfuncid != b->opfuncid &&
257 COMPARE_SCALAR_FIELD(opresulttype);
258 COMPARE_SCALAR_FIELD(opretset);
259 COMPARE_NODE_FIELD(args);
265 _equalScalarArrayOpExpr(ScalarArrayOpExpr *a, ScalarArrayOpExpr *b)
267 COMPARE_SCALAR_FIELD(opno);
270 * Special-case opfuncid: it is allowable for it to differ if one node
271 * contains zero and the other doesn't. This just means that the one node
272 * isn't as far along in the parse/plan pipeline and hasn't had the
273 * opfuncid cache filled yet.
275 if (a->opfuncid != b->opfuncid &&
280 COMPARE_SCALAR_FIELD(useOr);
281 COMPARE_NODE_FIELD(args);
287 _equalBoolExpr(BoolExpr *a, BoolExpr *b)
289 COMPARE_SCALAR_FIELD(boolop);
290 COMPARE_NODE_FIELD(args);
296 _equalSubLink(SubLink *a, SubLink *b)
298 COMPARE_SCALAR_FIELD(subLinkType);
299 COMPARE_NODE_FIELD(testexpr);
300 COMPARE_NODE_FIELD(operName);
301 COMPARE_NODE_FIELD(subselect);
307 _equalSubPlan(SubPlan *a, SubPlan *b)
309 COMPARE_SCALAR_FIELD(subLinkType);
310 COMPARE_NODE_FIELD(testexpr);
311 COMPARE_NODE_FIELD(paramIds);
312 /* should compare plans, but have to settle for comparing plan IDs */
313 COMPARE_SCALAR_FIELD(plan_id);
314 COMPARE_NODE_FIELD(rtable);
315 COMPARE_SCALAR_FIELD(useHashTable);
316 COMPARE_SCALAR_FIELD(unknownEqFalse);
317 COMPARE_NODE_FIELD(setParam);
318 COMPARE_NODE_FIELD(parParam);
319 COMPARE_NODE_FIELD(args);
325 _equalFieldSelect(FieldSelect *a, FieldSelect *b)
327 COMPARE_NODE_FIELD(arg);
328 COMPARE_SCALAR_FIELD(fieldnum);
329 COMPARE_SCALAR_FIELD(resulttype);
330 COMPARE_SCALAR_FIELD(resulttypmod);
336 _equalFieldStore(FieldStore *a, FieldStore *b)
338 COMPARE_NODE_FIELD(arg);
339 COMPARE_NODE_FIELD(newvals);
340 COMPARE_NODE_FIELD(fieldnums);
341 COMPARE_SCALAR_FIELD(resulttype);
347 _equalRelabelType(RelabelType *a, RelabelType *b)
349 COMPARE_NODE_FIELD(arg);
350 COMPARE_SCALAR_FIELD(resulttype);
351 COMPARE_SCALAR_FIELD(resulttypmod);
354 * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
355 * that are equal() to both explicit and implicit coercions.
357 if (a->relabelformat != b->relabelformat &&
358 a->relabelformat != COERCE_DONTCARE &&
359 b->relabelformat != COERCE_DONTCARE)
366 _equalConvertRowtypeExpr(ConvertRowtypeExpr *a, ConvertRowtypeExpr *b)
368 COMPARE_NODE_FIELD(arg);
369 COMPARE_SCALAR_FIELD(resulttype);
372 * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
373 * that are equal() to both explicit and implicit coercions.
375 if (a->convertformat != b->convertformat &&
376 a->convertformat != COERCE_DONTCARE &&
377 b->convertformat != COERCE_DONTCARE)
384 _equalCaseExpr(CaseExpr *a, CaseExpr *b)
386 COMPARE_SCALAR_FIELD(casetype);
387 COMPARE_NODE_FIELD(arg);
388 COMPARE_NODE_FIELD(args);
389 COMPARE_NODE_FIELD(defresult);
395 _equalCaseWhen(CaseWhen *a, CaseWhen *b)
397 COMPARE_NODE_FIELD(expr);
398 COMPARE_NODE_FIELD(result);
404 _equalCaseTestExpr(CaseTestExpr *a, CaseTestExpr *b)
406 COMPARE_SCALAR_FIELD(typeId);
407 COMPARE_SCALAR_FIELD(typeMod);
413 _equalArrayExpr(ArrayExpr *a, ArrayExpr *b)
415 COMPARE_SCALAR_FIELD(array_typeid);
416 COMPARE_SCALAR_FIELD(element_typeid);
417 COMPARE_NODE_FIELD(elements);
418 COMPARE_SCALAR_FIELD(multidims);
424 _equalRowExpr(RowExpr *a, RowExpr *b)
426 COMPARE_NODE_FIELD(args);
427 COMPARE_SCALAR_FIELD(row_typeid);
430 * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
431 * that are equal() to both explicit and implicit coercions.
433 if (a->row_format != b->row_format &&
434 a->row_format != COERCE_DONTCARE &&
435 b->row_format != COERCE_DONTCARE)
442 _equalRowCompareExpr(RowCompareExpr *a, RowCompareExpr *b)
444 COMPARE_SCALAR_FIELD(rctype);
445 COMPARE_NODE_FIELD(opnos);
446 COMPARE_NODE_FIELD(opclasses);
447 COMPARE_NODE_FIELD(largs);
448 COMPARE_NODE_FIELD(rargs);
454 _equalCoalesceExpr(CoalesceExpr *a, CoalesceExpr *b)
456 COMPARE_SCALAR_FIELD(coalescetype);
457 COMPARE_NODE_FIELD(args);
463 _equalMinMaxExpr(MinMaxExpr *a, MinMaxExpr *b)
465 COMPARE_SCALAR_FIELD(minmaxtype);
466 COMPARE_SCALAR_FIELD(op);
467 COMPARE_NODE_FIELD(args);
473 _equalNullIfExpr(NullIfExpr *a, NullIfExpr *b)
475 COMPARE_SCALAR_FIELD(opno);
478 * Special-case opfuncid: it is allowable for it to differ if one node
479 * contains zero and the other doesn't. This just means that the one node
480 * isn't as far along in the parse/plan pipeline and hasn't had the
481 * opfuncid cache filled yet.
483 if (a->opfuncid != b->opfuncid &&
488 COMPARE_SCALAR_FIELD(opresulttype);
489 COMPARE_SCALAR_FIELD(opretset);
490 COMPARE_NODE_FIELD(args);
496 _equalNullTest(NullTest *a, NullTest *b)
498 COMPARE_NODE_FIELD(arg);
499 COMPARE_SCALAR_FIELD(nulltesttype);
505 _equalBooleanTest(BooleanTest *a, BooleanTest *b)
507 COMPARE_NODE_FIELD(arg);
508 COMPARE_SCALAR_FIELD(booltesttype);
514 _equalCoerceToDomain(CoerceToDomain *a, CoerceToDomain *b)
516 COMPARE_NODE_FIELD(arg);
517 COMPARE_SCALAR_FIELD(resulttype);
518 COMPARE_SCALAR_FIELD(resulttypmod);
521 * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
522 * that are equal() to both explicit and implicit coercions.
524 if (a->coercionformat != b->coercionformat &&
525 a->coercionformat != COERCE_DONTCARE &&
526 b->coercionformat != COERCE_DONTCARE)
533 _equalCoerceToDomainValue(CoerceToDomainValue *a, CoerceToDomainValue *b)
535 COMPARE_SCALAR_FIELD(typeId);
536 COMPARE_SCALAR_FIELD(typeMod);
542 _equalSetToDefault(SetToDefault *a, SetToDefault *b)
544 COMPARE_SCALAR_FIELD(typeId);
545 COMPARE_SCALAR_FIELD(typeMod);
551 _equalTargetEntry(TargetEntry *a, TargetEntry *b)
553 COMPARE_NODE_FIELD(expr);
554 COMPARE_SCALAR_FIELD(resno);
555 COMPARE_STRING_FIELD(resname);
556 COMPARE_SCALAR_FIELD(ressortgroupref);
557 COMPARE_SCALAR_FIELD(resorigtbl);
558 COMPARE_SCALAR_FIELD(resorigcol);
559 COMPARE_SCALAR_FIELD(resjunk);
565 _equalRangeTblRef(RangeTblRef *a, RangeTblRef *b)
567 COMPARE_SCALAR_FIELD(rtindex);
573 _equalJoinExpr(JoinExpr *a, JoinExpr *b)
575 COMPARE_SCALAR_FIELD(jointype);
576 COMPARE_SCALAR_FIELD(isNatural);
577 COMPARE_NODE_FIELD(larg);
578 COMPARE_NODE_FIELD(rarg);
579 COMPARE_NODE_FIELD(using);
580 COMPARE_NODE_FIELD(quals);
581 COMPARE_NODE_FIELD(alias);
582 COMPARE_SCALAR_FIELD(rtindex);
588 _equalFromExpr(FromExpr *a, FromExpr *b)
590 COMPARE_NODE_FIELD(fromlist);
591 COMPARE_NODE_FIELD(quals);
598 * Stuff from relation.h
602 _equalPathKeyItem(PathKeyItem *a, PathKeyItem *b)
604 COMPARE_NODE_FIELD(key);
605 COMPARE_SCALAR_FIELD(sortop);
611 _equalRestrictInfo(RestrictInfo *a, RestrictInfo *b)
613 COMPARE_NODE_FIELD(clause);
614 COMPARE_SCALAR_FIELD(is_pushed_down);
615 COMPARE_SCALAR_FIELD(outerjoin_delayed);
616 COMPARE_BITMAPSET_FIELD(required_relids);
619 * We ignore all the remaining fields, since they may not be set yet, and
620 * should be derivable from the clause anyway.
627 _equalOuterJoinInfo(OuterJoinInfo *a, OuterJoinInfo *b)
629 COMPARE_BITMAPSET_FIELD(min_lefthand);
630 COMPARE_BITMAPSET_FIELD(min_righthand);
631 COMPARE_SCALAR_FIELD(is_full_join);
632 COMPARE_SCALAR_FIELD(lhs_strict);
638 _equalInClauseInfo(InClauseInfo *a, InClauseInfo *b)
640 COMPARE_BITMAPSET_FIELD(lefthand);
641 COMPARE_BITMAPSET_FIELD(righthand);
642 COMPARE_NODE_FIELD(sub_targetlist);
648 _equalAppendRelInfo(AppendRelInfo *a, AppendRelInfo *b)
650 COMPARE_SCALAR_FIELD(parent_relid);
651 COMPARE_SCALAR_FIELD(child_relid);
652 COMPARE_SCALAR_FIELD(parent_reltype);
653 COMPARE_SCALAR_FIELD(child_reltype);
654 COMPARE_NODE_FIELD(col_mappings);
655 COMPARE_NODE_FIELD(translated_vars);
656 COMPARE_SCALAR_FIELD(parent_reloid);
663 * Stuff from parsenodes.h
667 _equalQuery(Query *a, Query *b)
669 COMPARE_SCALAR_FIELD(commandType);
670 COMPARE_SCALAR_FIELD(querySource);
671 COMPARE_SCALAR_FIELD(canSetTag);
672 COMPARE_NODE_FIELD(utilityStmt);
673 COMPARE_SCALAR_FIELD(resultRelation);
674 COMPARE_NODE_FIELD(into);
675 COMPARE_SCALAR_FIELD(intoHasOids);
676 COMPARE_SCALAR_FIELD(intoOnCommit);
677 COMPARE_STRING_FIELD(intoTableSpaceName);
678 COMPARE_SCALAR_FIELD(hasAggs);
679 COMPARE_SCALAR_FIELD(hasSubLinks);
680 COMPARE_NODE_FIELD(rtable);
681 COMPARE_NODE_FIELD(jointree);
682 COMPARE_NODE_FIELD(rowMarks);
683 COMPARE_SCALAR_FIELD(forUpdate);
684 COMPARE_SCALAR_FIELD(rowNoWait);
685 COMPARE_NODE_FIELD(targetList);
686 COMPARE_NODE_FIELD(groupClause);
687 COMPARE_NODE_FIELD(havingQual);
688 COMPARE_NODE_FIELD(distinctClause);
689 COMPARE_NODE_FIELD(sortClause);
690 COMPARE_NODE_FIELD(limitOffset);
691 COMPARE_NODE_FIELD(limitCount);
692 COMPARE_NODE_FIELD(setOperations);
693 COMPARE_NODE_FIELD(resultRelations);
699 _equalInsertStmt(InsertStmt *a, InsertStmt *b)
701 COMPARE_NODE_FIELD(relation);
702 COMPARE_NODE_FIELD(cols);
703 COMPARE_NODE_FIELD(targetList);
704 COMPARE_NODE_FIELD(selectStmt);
710 _equalDeleteStmt(DeleteStmt *a, DeleteStmt *b)
712 COMPARE_NODE_FIELD(relation);
713 COMPARE_NODE_FIELD(whereClause);
714 COMPARE_NODE_FIELD(usingClause);
720 _equalUpdateStmt(UpdateStmt *a, UpdateStmt *b)
722 COMPARE_NODE_FIELD(relation);
723 COMPARE_NODE_FIELD(targetList);
724 COMPARE_NODE_FIELD(whereClause);
725 COMPARE_NODE_FIELD(fromClause);
731 _equalSelectStmt(SelectStmt *a, SelectStmt *b)
733 COMPARE_NODE_FIELD(distinctClause);
734 COMPARE_NODE_FIELD(into);
735 COMPARE_NODE_FIELD(intoColNames);
736 COMPARE_SCALAR_FIELD(intoHasOids);
737 COMPARE_SCALAR_FIELD(intoOnCommit);
738 COMPARE_STRING_FIELD(intoTableSpaceName);
739 COMPARE_NODE_FIELD(targetList);
740 COMPARE_NODE_FIELD(fromClause);
741 COMPARE_NODE_FIELD(whereClause);
742 COMPARE_NODE_FIELD(groupClause);
743 COMPARE_NODE_FIELD(havingClause);
744 COMPARE_NODE_FIELD(sortClause);
745 COMPARE_NODE_FIELD(limitOffset);
746 COMPARE_NODE_FIELD(limitCount);
747 COMPARE_NODE_FIELD(lockingClause);
748 COMPARE_SCALAR_FIELD(op);
749 COMPARE_SCALAR_FIELD(all);
750 COMPARE_NODE_FIELD(larg);
751 COMPARE_NODE_FIELD(rarg);
757 _equalSetOperationStmt(SetOperationStmt *a, SetOperationStmt *b)
759 COMPARE_SCALAR_FIELD(op);
760 COMPARE_SCALAR_FIELD(all);
761 COMPARE_NODE_FIELD(larg);
762 COMPARE_NODE_FIELD(rarg);
763 COMPARE_NODE_FIELD(colTypes);
769 _equalAlterTableStmt(AlterTableStmt *a, AlterTableStmt *b)
771 COMPARE_NODE_FIELD(relation);
772 COMPARE_NODE_FIELD(cmds);
773 COMPARE_SCALAR_FIELD(relkind);
779 _equalAlterTableCmd(AlterTableCmd *a, AlterTableCmd *b)
781 COMPARE_SCALAR_FIELD(subtype);
782 COMPARE_STRING_FIELD(name);
783 COMPARE_NODE_FIELD(def);
784 COMPARE_NODE_FIELD(transform);
785 COMPARE_SCALAR_FIELD(behavior);
791 _equalAlterDomainStmt(AlterDomainStmt *a, AlterDomainStmt *b)
793 COMPARE_SCALAR_FIELD(subtype);
794 COMPARE_NODE_FIELD(typename);
795 COMPARE_STRING_FIELD(name);
796 COMPARE_NODE_FIELD(def);
797 COMPARE_SCALAR_FIELD(behavior);
803 _equalGrantStmt(GrantStmt *a, GrantStmt *b)
805 COMPARE_SCALAR_FIELD(is_grant);
806 COMPARE_SCALAR_FIELD(objtype);
807 COMPARE_NODE_FIELD(objects);
808 COMPARE_NODE_FIELD(privileges);
809 COMPARE_NODE_FIELD(grantees);
810 COMPARE_SCALAR_FIELD(grant_option);
811 COMPARE_SCALAR_FIELD(behavior);
817 _equalPrivGrantee(PrivGrantee *a, PrivGrantee *b)
819 COMPARE_STRING_FIELD(rolname);
825 _equalFuncWithArgs(FuncWithArgs *a, FuncWithArgs *b)
827 COMPARE_NODE_FIELD(funcname);
828 COMPARE_NODE_FIELD(funcargs);
834 _equalGrantRoleStmt(GrantRoleStmt *a, GrantRoleStmt *b)
836 COMPARE_NODE_FIELD(granted_roles);
837 COMPARE_NODE_FIELD(grantee_roles);
838 COMPARE_SCALAR_FIELD(is_grant);
839 COMPARE_SCALAR_FIELD(admin_opt);
840 COMPARE_STRING_FIELD(grantor);
841 COMPARE_SCALAR_FIELD(behavior);
847 _equalDeclareCursorStmt(DeclareCursorStmt *a, DeclareCursorStmt *b)
849 COMPARE_STRING_FIELD(portalname);
850 COMPARE_SCALAR_FIELD(options);
851 COMPARE_NODE_FIELD(query);
857 _equalClosePortalStmt(ClosePortalStmt *a, ClosePortalStmt *b)
859 COMPARE_STRING_FIELD(portalname);
865 _equalClusterStmt(ClusterStmt *a, ClusterStmt *b)
867 COMPARE_NODE_FIELD(relation);
868 COMPARE_STRING_FIELD(indexname);
874 _equalCopyStmt(CopyStmt *a, CopyStmt *b)
876 COMPARE_NODE_FIELD(relation);
877 COMPARE_NODE_FIELD(attlist);
878 COMPARE_SCALAR_FIELD(is_from);
879 COMPARE_STRING_FIELD(filename);
880 COMPARE_NODE_FIELD(options);
886 _equalCreateStmt(CreateStmt *a, CreateStmt *b)
888 COMPARE_NODE_FIELD(relation);
889 COMPARE_NODE_FIELD(tableElts);
890 COMPARE_NODE_FIELD(inhRelations);
891 COMPARE_NODE_FIELD(constraints);
892 COMPARE_SCALAR_FIELD(hasoids);
893 COMPARE_SCALAR_FIELD(oncommit);
894 COMPARE_STRING_FIELD(tablespacename);
900 _equalInhRelation(InhRelation *a, InhRelation *b)
902 COMPARE_NODE_FIELD(relation);
903 COMPARE_SCALAR_FIELD(including_defaults);
909 _equalDefineStmt(DefineStmt *a, DefineStmt *b)
911 COMPARE_SCALAR_FIELD(kind);
912 COMPARE_SCALAR_FIELD(oldstyle);
913 COMPARE_NODE_FIELD(defnames);
914 COMPARE_NODE_FIELD(args);
915 COMPARE_NODE_FIELD(definition);
921 _equalDropStmt(DropStmt *a, DropStmt *b)
923 COMPARE_NODE_FIELD(objects);
924 COMPARE_SCALAR_FIELD(removeType);
925 COMPARE_SCALAR_FIELD(behavior);
926 COMPARE_SCALAR_FIELD(missing_ok);
932 _equalTruncateStmt(TruncateStmt *a, TruncateStmt *b)
934 COMPARE_NODE_FIELD(relations);
935 COMPARE_SCALAR_FIELD(behavior);
941 _equalCommentStmt(CommentStmt *a, CommentStmt *b)
943 COMPARE_SCALAR_FIELD(objtype);
944 COMPARE_NODE_FIELD(objname);
945 COMPARE_NODE_FIELD(objargs);
946 COMPARE_STRING_FIELD(comment);
952 _equalFetchStmt(FetchStmt *a, FetchStmt *b)
954 COMPARE_SCALAR_FIELD(direction);
955 COMPARE_SCALAR_FIELD(howMany);
956 COMPARE_STRING_FIELD(portalname);
957 COMPARE_SCALAR_FIELD(ismove);
963 _equalIndexStmt(IndexStmt *a, IndexStmt *b)
965 COMPARE_STRING_FIELD(idxname);
966 COMPARE_NODE_FIELD(relation);
967 COMPARE_STRING_FIELD(accessMethod);
968 COMPARE_STRING_FIELD(tableSpace);
969 COMPARE_NODE_FIELD(indexParams);
970 COMPARE_NODE_FIELD(whereClause);
971 COMPARE_NODE_FIELD(rangetable);
972 COMPARE_SCALAR_FIELD(unique);
973 COMPARE_SCALAR_FIELD(primary);
974 COMPARE_SCALAR_FIELD(isconstraint);
980 _equalCreateFunctionStmt(CreateFunctionStmt *a, CreateFunctionStmt *b)
982 COMPARE_SCALAR_FIELD(replace);
983 COMPARE_NODE_FIELD(funcname);
984 COMPARE_NODE_FIELD(parameters);
985 COMPARE_NODE_FIELD(returnType);
986 COMPARE_NODE_FIELD(options);
987 COMPARE_NODE_FIELD(withClause);
993 _equalFunctionParameter(FunctionParameter *a, FunctionParameter *b)
995 COMPARE_STRING_FIELD(name);
996 COMPARE_NODE_FIELD(argType);
997 COMPARE_SCALAR_FIELD(mode);
1003 _equalAlterFunctionStmt(AlterFunctionStmt *a, AlterFunctionStmt *b)
1005 COMPARE_NODE_FIELD(func);
1006 COMPARE_NODE_FIELD(actions);
1012 _equalRemoveFuncStmt(RemoveFuncStmt *a, RemoveFuncStmt *b)
1014 COMPARE_SCALAR_FIELD(kind);
1015 COMPARE_NODE_FIELD(name);
1016 COMPARE_NODE_FIELD(args);
1017 COMPARE_SCALAR_FIELD(behavior);
1023 _equalRemoveOpClassStmt(RemoveOpClassStmt *a, RemoveOpClassStmt *b)
1025 COMPARE_NODE_FIELD(opclassname);
1026 COMPARE_STRING_FIELD(amname);
1027 COMPARE_SCALAR_FIELD(behavior);
1033 _equalRenameStmt(RenameStmt *a, RenameStmt *b)
1035 COMPARE_SCALAR_FIELD(renameType);
1036 COMPARE_NODE_FIELD(relation);
1037 COMPARE_NODE_FIELD(object);
1038 COMPARE_NODE_FIELD(objarg);
1039 COMPARE_STRING_FIELD(subname);
1040 COMPARE_STRING_FIELD(newname);
1046 _equalAlterObjectSchemaStmt(AlterObjectSchemaStmt *a, AlterObjectSchemaStmt *b)
1048 COMPARE_SCALAR_FIELD(objectType);
1049 COMPARE_NODE_FIELD(relation);
1050 COMPARE_NODE_FIELD(object);
1051 COMPARE_NODE_FIELD(objarg);
1052 COMPARE_STRING_FIELD(addname);
1053 COMPARE_STRING_FIELD(newschema);
1059 _equalAlterOwnerStmt(AlterOwnerStmt *a, AlterOwnerStmt *b)
1061 COMPARE_SCALAR_FIELD(objectType);
1062 COMPARE_NODE_FIELD(relation);
1063 COMPARE_NODE_FIELD(object);
1064 COMPARE_NODE_FIELD(objarg);
1065 COMPARE_STRING_FIELD(addname);
1066 COMPARE_STRING_FIELD(newowner);
1072 _equalRuleStmt(RuleStmt *a, RuleStmt *b)
1074 COMPARE_NODE_FIELD(relation);
1075 COMPARE_STRING_FIELD(rulename);
1076 COMPARE_NODE_FIELD(whereClause);
1077 COMPARE_SCALAR_FIELD(event);
1078 COMPARE_SCALAR_FIELD(instead);
1079 COMPARE_NODE_FIELD(actions);
1080 COMPARE_SCALAR_FIELD(replace);
1086 _equalNotifyStmt(NotifyStmt *a, NotifyStmt *b)
1088 COMPARE_NODE_FIELD(relation);
1094 _equalListenStmt(ListenStmt *a, ListenStmt *b)
1096 COMPARE_NODE_FIELD(relation);
1102 _equalUnlistenStmt(UnlistenStmt *a, UnlistenStmt *b)
1104 COMPARE_NODE_FIELD(relation);
1110 _equalTransactionStmt(TransactionStmt *a, TransactionStmt *b)
1112 COMPARE_SCALAR_FIELD(kind);
1113 COMPARE_NODE_FIELD(options);
1114 COMPARE_STRING_FIELD(gid);
1120 _equalCompositeTypeStmt(CompositeTypeStmt *a, CompositeTypeStmt *b)
1122 COMPARE_NODE_FIELD(typevar);
1123 COMPARE_NODE_FIELD(coldeflist);
1129 _equalViewStmt(ViewStmt *a, ViewStmt *b)
1131 COMPARE_NODE_FIELD(view);
1132 COMPARE_NODE_FIELD(aliases);
1133 COMPARE_NODE_FIELD(query);
1134 COMPARE_SCALAR_FIELD(replace);
1140 _equalLoadStmt(LoadStmt *a, LoadStmt *b)
1142 COMPARE_STRING_FIELD(filename);
1148 _equalCreateDomainStmt(CreateDomainStmt *a, CreateDomainStmt *b)
1150 COMPARE_NODE_FIELD(domainname);
1151 COMPARE_NODE_FIELD(typename);
1152 COMPARE_NODE_FIELD(constraints);
1158 _equalCreateOpClassStmt(CreateOpClassStmt *a, CreateOpClassStmt *b)
1160 COMPARE_NODE_FIELD(opclassname);
1161 COMPARE_STRING_FIELD(amname);
1162 COMPARE_NODE_FIELD(datatype);
1163 COMPARE_NODE_FIELD(items);
1164 COMPARE_SCALAR_FIELD(isDefault);
1170 _equalCreateOpClassItem(CreateOpClassItem *a, CreateOpClassItem *b)
1172 COMPARE_SCALAR_FIELD(itemtype);
1173 COMPARE_NODE_FIELD(name);
1174 COMPARE_NODE_FIELD(args);
1175 COMPARE_SCALAR_FIELD(number);
1176 COMPARE_SCALAR_FIELD(recheck);
1177 COMPARE_NODE_FIELD(storedtype);
1183 _equalCreatedbStmt(CreatedbStmt *a, CreatedbStmt *b)
1185 COMPARE_STRING_FIELD(dbname);
1186 COMPARE_NODE_FIELD(options);
1192 _equalAlterDatabaseStmt(AlterDatabaseStmt *a, AlterDatabaseStmt *b)
1194 COMPARE_STRING_FIELD(dbname);
1195 COMPARE_NODE_FIELD(options);
1201 _equalAlterDatabaseSetStmt(AlterDatabaseSetStmt *a, AlterDatabaseSetStmt *b)
1203 COMPARE_STRING_FIELD(dbname);
1204 COMPARE_STRING_FIELD(variable);
1205 COMPARE_NODE_FIELD(value);
1211 _equalDropdbStmt(DropdbStmt *a, DropdbStmt *b)
1213 COMPARE_STRING_FIELD(dbname);
1214 COMPARE_SCALAR_FIELD(missing_ok);
1220 _equalVacuumStmt(VacuumStmt *a, VacuumStmt *b)
1222 COMPARE_SCALAR_FIELD(vacuum);
1223 COMPARE_SCALAR_FIELD(full);
1224 COMPARE_SCALAR_FIELD(analyze);
1225 COMPARE_SCALAR_FIELD(freeze);
1226 COMPARE_SCALAR_FIELD(verbose);
1227 COMPARE_NODE_FIELD(relation);
1228 COMPARE_NODE_FIELD(va_cols);
1234 _equalExplainStmt(ExplainStmt *a, ExplainStmt *b)
1236 COMPARE_NODE_FIELD(query);
1237 COMPARE_SCALAR_FIELD(verbose);
1238 COMPARE_SCALAR_FIELD(analyze);
1244 _equalCreateSeqStmt(CreateSeqStmt *a, CreateSeqStmt *b)
1246 COMPARE_NODE_FIELD(sequence);
1247 COMPARE_NODE_FIELD(options);
1253 _equalAlterSeqStmt(AlterSeqStmt *a, AlterSeqStmt *b)
1255 COMPARE_NODE_FIELD(sequence);
1256 COMPARE_NODE_FIELD(options);
1262 _equalVariableSetStmt(VariableSetStmt *a, VariableSetStmt *b)
1264 COMPARE_STRING_FIELD(name);
1265 COMPARE_NODE_FIELD(args);
1266 COMPARE_SCALAR_FIELD(is_local);
1272 _equalVariableShowStmt(VariableShowStmt *a, VariableShowStmt *b)
1274 COMPARE_STRING_FIELD(name);
1280 _equalVariableResetStmt(VariableResetStmt *a, VariableResetStmt *b)
1282 COMPARE_STRING_FIELD(name);
1288 _equalCreateTableSpaceStmt(CreateTableSpaceStmt *a, CreateTableSpaceStmt *b)
1290 COMPARE_STRING_FIELD(tablespacename);
1291 COMPARE_STRING_FIELD(owner);
1292 COMPARE_STRING_FIELD(location);
1298 _equalDropTableSpaceStmt(DropTableSpaceStmt *a, DropTableSpaceStmt *b)
1300 COMPARE_STRING_FIELD(tablespacename);
1306 _equalCreateTrigStmt(CreateTrigStmt *a, CreateTrigStmt *b)
1308 COMPARE_STRING_FIELD(trigname);
1309 COMPARE_NODE_FIELD(relation);
1310 COMPARE_NODE_FIELD(funcname);
1311 COMPARE_NODE_FIELD(args);
1312 COMPARE_SCALAR_FIELD(before);
1313 COMPARE_SCALAR_FIELD(row);
1314 if (strcmp(a->actions, b->actions) != 0) /* in-line string field */
1316 COMPARE_SCALAR_FIELD(isconstraint);
1317 COMPARE_SCALAR_FIELD(deferrable);
1318 COMPARE_SCALAR_FIELD(initdeferred);
1319 COMPARE_NODE_FIELD(constrrel);
1325 _equalDropPropertyStmt(DropPropertyStmt *a, DropPropertyStmt *b)
1327 COMPARE_NODE_FIELD(relation);
1328 COMPARE_STRING_FIELD(property);
1329 COMPARE_SCALAR_FIELD(removeType);
1330 COMPARE_SCALAR_FIELD(behavior);
1336 _equalCreatePLangStmt(CreatePLangStmt *a, CreatePLangStmt *b)
1338 COMPARE_STRING_FIELD(plname);
1339 COMPARE_NODE_FIELD(plhandler);
1340 COMPARE_NODE_FIELD(plvalidator);
1341 COMPARE_SCALAR_FIELD(pltrusted);
1347 _equalDropPLangStmt(DropPLangStmt *a, DropPLangStmt *b)
1349 COMPARE_STRING_FIELD(plname);
1350 COMPARE_SCALAR_FIELD(behavior);
1356 _equalCreateRoleStmt(CreateRoleStmt *a, CreateRoleStmt *b)
1358 COMPARE_SCALAR_FIELD(stmt_type);
1359 COMPARE_STRING_FIELD(role);
1360 COMPARE_NODE_FIELD(options);
1366 _equalAlterRoleStmt(AlterRoleStmt *a, AlterRoleStmt *b)
1368 COMPARE_STRING_FIELD(role);
1369 COMPARE_NODE_FIELD(options);
1370 COMPARE_SCALAR_FIELD(action);
1376 _equalAlterRoleSetStmt(AlterRoleSetStmt *a, AlterRoleSetStmt *b)
1378 COMPARE_STRING_FIELD(role);
1379 COMPARE_STRING_FIELD(variable);
1380 COMPARE_NODE_FIELD(value);
1386 _equalDropRoleStmt(DropRoleStmt *a, DropRoleStmt *b)
1388 COMPARE_NODE_FIELD(roles);
1389 COMPARE_SCALAR_FIELD(missing_ok);
1395 _equalLockStmt(LockStmt *a, LockStmt *b)
1397 COMPARE_NODE_FIELD(relations);
1398 COMPARE_SCALAR_FIELD(mode);
1399 COMPARE_SCALAR_FIELD(nowait);
1405 _equalConstraintsSetStmt(ConstraintsSetStmt *a, ConstraintsSetStmt *b)
1407 COMPARE_NODE_FIELD(constraints);
1408 COMPARE_SCALAR_FIELD(deferred);
1414 _equalReindexStmt(ReindexStmt *a, ReindexStmt *b)
1416 COMPARE_SCALAR_FIELD(kind);
1417 COMPARE_NODE_FIELD(relation);
1418 COMPARE_STRING_FIELD(name);
1419 COMPARE_SCALAR_FIELD(do_system);
1420 COMPARE_SCALAR_FIELD(do_user);
1426 _equalCreateSchemaStmt(CreateSchemaStmt *a, CreateSchemaStmt *b)
1428 COMPARE_STRING_FIELD(schemaname);
1429 COMPARE_STRING_FIELD(authid);
1430 COMPARE_NODE_FIELD(schemaElts);
1436 _equalCreateConversionStmt(CreateConversionStmt *a, CreateConversionStmt *b)
1438 COMPARE_NODE_FIELD(conversion_name);
1439 COMPARE_STRING_FIELD(for_encoding_name);
1440 COMPARE_STRING_FIELD(to_encoding_name);
1441 COMPARE_NODE_FIELD(func_name);
1442 COMPARE_SCALAR_FIELD(def);
1448 _equalCreateCastStmt(CreateCastStmt *a, CreateCastStmt *b)
1450 COMPARE_NODE_FIELD(sourcetype);
1451 COMPARE_NODE_FIELD(targettype);
1452 COMPARE_NODE_FIELD(func);
1453 COMPARE_SCALAR_FIELD(context);
1459 _equalDropCastStmt(DropCastStmt *a, DropCastStmt *b)
1461 COMPARE_NODE_FIELD(sourcetype);
1462 COMPARE_NODE_FIELD(targettype);
1463 COMPARE_SCALAR_FIELD(behavior);
1469 _equalPrepareStmt(PrepareStmt *a, PrepareStmt *b)
1471 COMPARE_STRING_FIELD(name);
1472 COMPARE_NODE_FIELD(argtypes);
1473 COMPARE_NODE_FIELD(argtype_oids);
1474 COMPARE_NODE_FIELD(query);
1480 _equalExecuteStmt(ExecuteStmt *a, ExecuteStmt *b)
1482 COMPARE_STRING_FIELD(name);
1483 COMPARE_NODE_FIELD(into);
1484 COMPARE_SCALAR_FIELD(into_contains_oids);
1485 COMPARE_SCALAR_FIELD(into_has_oids);
1486 COMPARE_SCALAR_FIELD(into_on_commit);
1487 COMPARE_STRING_FIELD(into_tbl_space);
1488 COMPARE_NODE_FIELD(params);
1494 _equalDeallocateStmt(DeallocateStmt *a, DeallocateStmt *b)
1496 COMPARE_STRING_FIELD(name);
1502 _equalDropOwnedStmt(DropOwnedStmt * a, DropOwnedStmt * b)
1504 COMPARE_NODE_FIELD(roles);
1505 COMPARE_SCALAR_FIELD(behavior);
1511 _equalReassignOwnedStmt(ReassignOwnedStmt * a, ReassignOwnedStmt * b)
1513 COMPARE_NODE_FIELD(roles);
1514 COMPARE_NODE_FIELD(newrole);
1520 _equalAExpr(A_Expr *a, A_Expr *b)
1522 COMPARE_SCALAR_FIELD(kind);
1523 COMPARE_NODE_FIELD(name);
1524 COMPARE_NODE_FIELD(lexpr);
1525 COMPARE_NODE_FIELD(rexpr);
1526 COMPARE_SCALAR_FIELD(location);
1532 _equalColumnRef(ColumnRef *a, ColumnRef *b)
1534 COMPARE_NODE_FIELD(fields);
1535 COMPARE_SCALAR_FIELD(location);
1541 _equalParamRef(ParamRef *a, ParamRef *b)
1543 COMPARE_SCALAR_FIELD(number);
1549 _equalAConst(A_Const *a, A_Const *b)
1551 if (!equal(&a->val, &b->val)) /* hack for in-line Value field */
1553 COMPARE_NODE_FIELD(typename);
1559 _equalFuncCall(FuncCall *a, FuncCall *b)
1561 COMPARE_NODE_FIELD(funcname);
1562 COMPARE_NODE_FIELD(args);
1563 COMPARE_SCALAR_FIELD(agg_star);
1564 COMPARE_SCALAR_FIELD(agg_distinct);
1565 COMPARE_SCALAR_FIELD(location);
1571 _equalAIndices(A_Indices *a, A_Indices *b)
1573 COMPARE_NODE_FIELD(lidx);
1574 COMPARE_NODE_FIELD(uidx);
1580 _equalA_Indirection(A_Indirection *a, A_Indirection *b)
1582 COMPARE_NODE_FIELD(arg);
1583 COMPARE_NODE_FIELD(indirection);
1589 _equalResTarget(ResTarget *a, ResTarget *b)
1591 COMPARE_STRING_FIELD(name);
1592 COMPARE_NODE_FIELD(indirection);
1593 COMPARE_NODE_FIELD(val);
1594 COMPARE_SCALAR_FIELD(location);
1600 _equalTypeName(TypeName *a, TypeName *b)
1602 COMPARE_NODE_FIELD(names);
1603 COMPARE_SCALAR_FIELD(typeid);
1604 COMPARE_SCALAR_FIELD(timezone);
1605 COMPARE_SCALAR_FIELD(setof);
1606 COMPARE_SCALAR_FIELD(pct_type);
1607 COMPARE_SCALAR_FIELD(typmod);
1608 COMPARE_NODE_FIELD(arrayBounds);
1609 COMPARE_SCALAR_FIELD(location);
1615 _equalTypeCast(TypeCast *a, TypeCast *b)
1617 COMPARE_NODE_FIELD(arg);
1618 COMPARE_NODE_FIELD(typename);
1624 _equalSortBy(SortBy *a, SortBy *b)
1626 COMPARE_SCALAR_FIELD(sortby_kind);
1627 COMPARE_NODE_FIELD(useOp);
1628 COMPARE_NODE_FIELD(node);
1634 _equalRangeSubselect(RangeSubselect *a, RangeSubselect *b)
1636 COMPARE_NODE_FIELD(subquery);
1637 COMPARE_NODE_FIELD(alias);
1643 _equalRangeFunction(RangeFunction *a, RangeFunction *b)
1645 COMPARE_NODE_FIELD(funccallnode);
1646 COMPARE_NODE_FIELD(alias);
1647 COMPARE_NODE_FIELD(coldeflist);
1653 _equalIndexElem(IndexElem *a, IndexElem *b)
1655 COMPARE_STRING_FIELD(name);
1656 COMPARE_NODE_FIELD(expr);
1657 COMPARE_NODE_FIELD(opclass);
1663 _equalColumnDef(ColumnDef *a, ColumnDef *b)
1665 COMPARE_STRING_FIELD(colname);
1666 COMPARE_NODE_FIELD(typename);
1667 COMPARE_SCALAR_FIELD(inhcount);
1668 COMPARE_SCALAR_FIELD(is_local);
1669 COMPARE_SCALAR_FIELD(is_not_null);
1670 COMPARE_NODE_FIELD(raw_default);
1671 COMPARE_STRING_FIELD(cooked_default);
1672 COMPARE_NODE_FIELD(constraints);
1673 COMPARE_NODE_FIELD(support);
1679 _equalConstraint(Constraint *a, Constraint *b)
1681 COMPARE_SCALAR_FIELD(contype);
1682 COMPARE_STRING_FIELD(name);
1683 COMPARE_NODE_FIELD(raw_expr);
1684 COMPARE_STRING_FIELD(cooked_expr);
1685 COMPARE_NODE_FIELD(keys);
1686 COMPARE_STRING_FIELD(indexspace);
1692 _equalDefElem(DefElem *a, DefElem *b)
1694 COMPARE_STRING_FIELD(defname);
1695 COMPARE_NODE_FIELD(arg);
1701 _equalLockingClause(LockingClause *a, LockingClause *b)
1703 COMPARE_NODE_FIELD(lockedRels);
1704 COMPARE_SCALAR_FIELD(forUpdate);
1705 COMPARE_SCALAR_FIELD(nowait);
1711 _equalRangeTblEntry(RangeTblEntry *a, RangeTblEntry *b)
1713 COMPARE_SCALAR_FIELD(rtekind);
1714 COMPARE_SCALAR_FIELD(relid);
1715 COMPARE_NODE_FIELD(subquery);
1716 COMPARE_NODE_FIELD(funcexpr);
1717 COMPARE_NODE_FIELD(funccoltypes);
1718 COMPARE_NODE_FIELD(funccoltypmods);
1719 COMPARE_SCALAR_FIELD(jointype);
1720 COMPARE_NODE_FIELD(joinaliasvars);
1721 COMPARE_NODE_FIELD(alias);
1722 COMPARE_NODE_FIELD(eref);
1723 COMPARE_SCALAR_FIELD(inh);
1724 COMPARE_SCALAR_FIELD(inFromCl);
1725 COMPARE_SCALAR_FIELD(requiredPerms);
1726 COMPARE_SCALAR_FIELD(checkAsUser);
1732 _equalSortClause(SortClause *a, SortClause *b)
1734 COMPARE_SCALAR_FIELD(tleSortGroupRef);
1735 COMPARE_SCALAR_FIELD(sortop);
1741 _equalFkConstraint(FkConstraint *a, FkConstraint *b)
1743 COMPARE_STRING_FIELD(constr_name);
1744 COMPARE_NODE_FIELD(pktable);
1745 COMPARE_NODE_FIELD(fk_attrs);
1746 COMPARE_NODE_FIELD(pk_attrs);
1747 COMPARE_SCALAR_FIELD(fk_matchtype);
1748 COMPARE_SCALAR_FIELD(fk_upd_action);
1749 COMPARE_SCALAR_FIELD(fk_del_action);
1750 COMPARE_SCALAR_FIELD(deferrable);
1751 COMPARE_SCALAR_FIELD(initdeferred);
1752 COMPARE_SCALAR_FIELD(skip_validation);
1759 * Stuff from pg_list.h
1763 _equalList(List *a, List *b)
1769 * Try to reject by simple scalar checks before grovelling through all the
1772 COMPARE_SCALAR_FIELD(type);
1773 COMPARE_SCALAR_FIELD(length);
1776 * We place the switch outside the loop for the sake of efficiency; this
1777 * may not be worth doing...
1782 forboth(item_a, a, item_b, b)
1784 if (!equal(lfirst(item_a), lfirst(item_b)))
1789 forboth(item_a, a, item_b, b)
1791 if (lfirst_int(item_a) != lfirst_int(item_b))
1796 forboth(item_a, a, item_b, b)
1798 if (lfirst_oid(item_a) != lfirst_oid(item_b))
1803 elog(ERROR, "unrecognized list node type: %d",
1805 return false; /* keep compiler quiet */
1809 * If we got here, we should have run out of elements of both lists
1811 Assert(item_a == NULL);
1812 Assert(item_b == NULL);
1818 * Stuff from value.h
1822 _equalValue(Value *a, Value *b)
1824 COMPARE_SCALAR_FIELD(type);
1829 COMPARE_SCALAR_FIELD(val.ival);
1834 COMPARE_STRING_FIELD(val.str);
1840 elog(ERROR, "unrecognized node type: %d", (int) a->type);
1849 * returns whether two nodes are equal
1852 equal(void *a, void *b)
1860 * note that a!=b, so only one of them can be NULL
1862 if (a == NULL || b == NULL)
1866 * are they the same type of nodes?
1868 if (nodeTag(a) != nodeTag(b))
1877 retval = _equalAlias(a, b);
1880 retval = _equalRangeVar(a, b);
1883 retval = _equalVar(a, b);
1886 retval = _equalConst(a, b);
1889 retval = _equalParam(a, b);
1892 retval = _equalAggref(a, b);
1895 retval = _equalArrayRef(a, b);
1898 retval = _equalFuncExpr(a, b);
1901 retval = _equalOpExpr(a, b);
1903 case T_DistinctExpr:
1904 retval = _equalDistinctExpr(a, b);
1906 case T_ScalarArrayOpExpr:
1907 retval = _equalScalarArrayOpExpr(a, b);
1910 retval = _equalBoolExpr(a, b);
1913 retval = _equalSubLink(a, b);
1916 retval = _equalSubPlan(a, b);
1919 retval = _equalFieldSelect(a, b);
1922 retval = _equalFieldStore(a, b);
1925 retval = _equalRelabelType(a, b);
1927 case T_ConvertRowtypeExpr:
1928 retval = _equalConvertRowtypeExpr(a, b);
1931 retval = _equalCaseExpr(a, b);
1934 retval = _equalCaseWhen(a, b);
1936 case T_CaseTestExpr:
1937 retval = _equalCaseTestExpr(a, b);
1940 retval = _equalArrayExpr(a, b);
1943 retval = _equalRowExpr(a, b);
1945 case T_RowCompareExpr:
1946 retval = _equalRowCompareExpr(a, b);
1948 case T_CoalesceExpr:
1949 retval = _equalCoalesceExpr(a, b);
1952 retval = _equalMinMaxExpr(a, b);
1955 retval = _equalNullIfExpr(a, b);
1958 retval = _equalNullTest(a, b);
1961 retval = _equalBooleanTest(a, b);
1963 case T_CoerceToDomain:
1964 retval = _equalCoerceToDomain(a, b);
1966 case T_CoerceToDomainValue:
1967 retval = _equalCoerceToDomainValue(a, b);
1969 case T_SetToDefault:
1970 retval = _equalSetToDefault(a, b);
1973 retval = _equalTargetEntry(a, b);
1976 retval = _equalRangeTblRef(a, b);
1979 retval = _equalFromExpr(a, b);
1982 retval = _equalJoinExpr(a, b);
1989 retval = _equalPathKeyItem(a, b);
1991 case T_RestrictInfo:
1992 retval = _equalRestrictInfo(a, b);
1994 case T_OuterJoinInfo:
1995 retval = _equalOuterJoinInfo(a, b);
1997 case T_InClauseInfo:
1998 retval = _equalInClauseInfo(a, b);
2000 case T_AppendRelInfo:
2001 retval = _equalAppendRelInfo(a, b);
2006 retval = _equalList(a, b);
2014 retval = _equalValue(a, b);
2021 retval = _equalQuery(a, b);
2024 retval = _equalInsertStmt(a, b);
2027 retval = _equalDeleteStmt(a, b);
2030 retval = _equalUpdateStmt(a, b);
2033 retval = _equalSelectStmt(a, b);
2035 case T_SetOperationStmt:
2036 retval = _equalSetOperationStmt(a, b);
2038 case T_AlterTableStmt:
2039 retval = _equalAlterTableStmt(a, b);
2041 case T_AlterTableCmd:
2042 retval = _equalAlterTableCmd(a, b);
2044 case T_AlterDomainStmt:
2045 retval = _equalAlterDomainStmt(a, b);
2048 retval = _equalGrantStmt(a, b);
2050 case T_GrantRoleStmt:
2051 retval = _equalGrantRoleStmt(a, b);
2053 case T_DeclareCursorStmt:
2054 retval = _equalDeclareCursorStmt(a, b);
2056 case T_ClosePortalStmt:
2057 retval = _equalClosePortalStmt(a, b);
2060 retval = _equalClusterStmt(a, b);
2063 retval = _equalCopyStmt(a, b);
2066 retval = _equalCreateStmt(a, b);
2069 retval = _equalInhRelation(a, b);
2072 retval = _equalDefineStmt(a, b);
2075 retval = _equalDropStmt(a, b);
2077 case T_TruncateStmt:
2078 retval = _equalTruncateStmt(a, b);
2081 retval = _equalCommentStmt(a, b);
2084 retval = _equalFetchStmt(a, b);
2087 retval = _equalIndexStmt(a, b);
2089 case T_CreateFunctionStmt:
2090 retval = _equalCreateFunctionStmt(a, b);
2092 case T_FunctionParameter:
2093 retval = _equalFunctionParameter(a, b);
2095 case T_AlterFunctionStmt:
2096 retval = _equalAlterFunctionStmt(a, b);
2098 case T_RemoveFuncStmt:
2099 retval = _equalRemoveFuncStmt(a, b);
2101 case T_RemoveOpClassStmt:
2102 retval = _equalRemoveOpClassStmt(a, b);
2105 retval = _equalRenameStmt(a, b);
2107 case T_AlterObjectSchemaStmt:
2108 retval = _equalAlterObjectSchemaStmt(a, b);
2110 case T_AlterOwnerStmt:
2111 retval = _equalAlterOwnerStmt(a, b);
2114 retval = _equalRuleStmt(a, b);
2117 retval = _equalNotifyStmt(a, b);
2120 retval = _equalListenStmt(a, b);
2122 case T_UnlistenStmt:
2123 retval = _equalUnlistenStmt(a, b);
2125 case T_TransactionStmt:
2126 retval = _equalTransactionStmt(a, b);
2128 case T_CompositeTypeStmt:
2129 retval = _equalCompositeTypeStmt(a, b);
2132 retval = _equalViewStmt(a, b);
2135 retval = _equalLoadStmt(a, b);
2137 case T_CreateDomainStmt:
2138 retval = _equalCreateDomainStmt(a, b);
2140 case T_CreateOpClassStmt:
2141 retval = _equalCreateOpClassStmt(a, b);
2143 case T_CreateOpClassItem:
2144 retval = _equalCreateOpClassItem(a, b);
2146 case T_CreatedbStmt:
2147 retval = _equalCreatedbStmt(a, b);
2149 case T_AlterDatabaseStmt:
2150 retval = _equalAlterDatabaseStmt(a, b);
2152 case T_AlterDatabaseSetStmt:
2153 retval = _equalAlterDatabaseSetStmt(a, b);
2156 retval = _equalDropdbStmt(a, b);
2159 retval = _equalVacuumStmt(a, b);
2162 retval = _equalExplainStmt(a, b);
2164 case T_CreateSeqStmt:
2165 retval = _equalCreateSeqStmt(a, b);
2167 case T_AlterSeqStmt:
2168 retval = _equalAlterSeqStmt(a, b);
2170 case T_VariableSetStmt:
2171 retval = _equalVariableSetStmt(a, b);
2173 case T_VariableShowStmt:
2174 retval = _equalVariableShowStmt(a, b);
2176 case T_VariableResetStmt:
2177 retval = _equalVariableResetStmt(a, b);
2179 case T_CreateTableSpaceStmt:
2180 retval = _equalCreateTableSpaceStmt(a, b);
2182 case T_DropTableSpaceStmt:
2183 retval = _equalDropTableSpaceStmt(a, b);
2185 case T_CreateTrigStmt:
2186 retval = _equalCreateTrigStmt(a, b);
2188 case T_DropPropertyStmt:
2189 retval = _equalDropPropertyStmt(a, b);
2191 case T_CreatePLangStmt:
2192 retval = _equalCreatePLangStmt(a, b);
2194 case T_DropPLangStmt:
2195 retval = _equalDropPLangStmt(a, b);
2197 case T_CreateRoleStmt:
2198 retval = _equalCreateRoleStmt(a, b);
2200 case T_AlterRoleStmt:
2201 retval = _equalAlterRoleStmt(a, b);
2203 case T_AlterRoleSetStmt:
2204 retval = _equalAlterRoleSetStmt(a, b);
2206 case T_DropRoleStmt:
2207 retval = _equalDropRoleStmt(a, b);
2210 retval = _equalLockStmt(a, b);
2212 case T_ConstraintsSetStmt:
2213 retval = _equalConstraintsSetStmt(a, b);
2216 retval = _equalReindexStmt(a, b);
2218 case T_CheckPointStmt:
2221 case T_CreateSchemaStmt:
2222 retval = _equalCreateSchemaStmt(a, b);
2224 case T_CreateConversionStmt:
2225 retval = _equalCreateConversionStmt(a, b);
2227 case T_CreateCastStmt:
2228 retval = _equalCreateCastStmt(a, b);
2230 case T_DropCastStmt:
2231 retval = _equalDropCastStmt(a, b);
2234 retval = _equalPrepareStmt(a, b);
2237 retval = _equalExecuteStmt(a, b);
2239 case T_DeallocateStmt:
2240 retval = _equalDeallocateStmt(a, b);
2242 case T_DropOwnedStmt:
2243 retval = _equalDropOwnedStmt(a, b);
2246 case T_ReassignOwnedStmt:
2247 retval = _equalReassignOwnedStmt(a, b);
2251 retval = _equalAExpr(a, b);
2254 retval = _equalColumnRef(a, b);
2257 retval = _equalParamRef(a, b);
2260 retval = _equalAConst(a, b);
2263 retval = _equalFuncCall(a, b);
2266 retval = _equalAIndices(a, b);
2268 case T_A_Indirection:
2269 retval = _equalA_Indirection(a, b);
2272 retval = _equalResTarget(a, b);
2275 retval = _equalTypeCast(a, b);
2278 retval = _equalSortBy(a, b);
2280 case T_RangeSubselect:
2281 retval = _equalRangeSubselect(a, b);
2283 case T_RangeFunction:
2284 retval = _equalRangeFunction(a, b);
2287 retval = _equalTypeName(a, b);
2290 retval = _equalIndexElem(a, b);
2293 retval = _equalColumnDef(a, b);
2296 retval = _equalConstraint(a, b);
2299 retval = _equalDefElem(a, b);
2301 case T_LockingClause:
2302 retval = _equalLockingClause(a, b);
2304 case T_RangeTblEntry:
2305 retval = _equalRangeTblEntry(a, b);
2308 retval = _equalSortClause(a, b);
2311 /* GroupClause is equivalent to SortClause */
2312 retval = _equalSortClause(a, b);
2314 case T_FkConstraint:
2315 retval = _equalFkConstraint(a, b);
2318 retval = _equalPrivGrantee(a, b);
2320 case T_FuncWithArgs:
2321 retval = _equalFuncWithArgs(a, b);
2325 elog(ERROR, "unrecognized node type: %d",
2327 retval = false; /* keep compiler quiet */