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.
16 * NOTE: it is intentional that parse location fields (in nodes that have
17 * one) are not compared. This is because we want, for example, a variable
18 * "x" to be considered equal() to another reference to "x" in the query.
21 * Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
22 * Portions Copyright (c) 1994, Regents of the University of California
25 * src/backend/nodes/equalfuncs.c
27 *-------------------------------------------------------------------------
32 #include "nodes/relation.h"
33 #include "utils/datum.h"
37 * Macros to simplify comparison of different kinds of fields. Use these
38 * wherever possible to reduce the chance for silly typos. Note that these
39 * hard-wire the convention that the local variables in an Equal routine are
43 /* Compare a simple scalar field (int, float, bool, enum, etc) */
44 #define COMPARE_SCALAR_FIELD(fldname) \
46 if (a->fldname != b->fldname) \
50 /* Compare a field that is a pointer to some kind of Node or Node tree */
51 #define COMPARE_NODE_FIELD(fldname) \
53 if (!equal(a->fldname, b->fldname)) \
57 /* Compare a field that is a pointer to a Bitmapset */
58 #define COMPARE_BITMAPSET_FIELD(fldname) \
60 if (!bms_equal(a->fldname, b->fldname)) \
64 /* Compare a field that is a pointer to a C string, or perhaps NULL */
65 #define COMPARE_STRING_FIELD(fldname) \
67 if (!equalstr(a->fldname, b->fldname)) \
71 /* Macro for comparing string fields that might be NULL */
72 #define equalstr(a, b) \
73 (((a) != NULL && (b) != NULL) ? (strcmp(a, b) == 0) : (a) == (b))
75 /* Compare a field that is a pointer to a simple palloc'd object of size sz */
76 #define COMPARE_POINTER_FIELD(fldname, sz) \
78 if (memcmp(a->fldname, b->fldname, (sz)) != 0) \
82 /* Compare a parse location field (this is a no-op, per note above) */
83 #define COMPARE_LOCATION_FIELD(fldname) \
88 * Stuff from primnodes.h
92 _equalAlias(Alias *a, Alias *b)
94 COMPARE_STRING_FIELD(aliasname);
95 COMPARE_NODE_FIELD(colnames);
101 _equalRangeVar(RangeVar *a, RangeVar *b)
103 COMPARE_STRING_FIELD(catalogname);
104 COMPARE_STRING_FIELD(schemaname);
105 COMPARE_STRING_FIELD(relname);
106 COMPARE_SCALAR_FIELD(inhOpt);
107 COMPARE_SCALAR_FIELD(relpersistence);
108 COMPARE_NODE_FIELD(alias);
109 COMPARE_LOCATION_FIELD(location);
115 _equalIntoClause(IntoClause *a, IntoClause *b)
117 COMPARE_NODE_FIELD(rel);
118 COMPARE_NODE_FIELD(colNames);
119 COMPARE_NODE_FIELD(options);
120 COMPARE_SCALAR_FIELD(onCommit);
121 COMPARE_STRING_FIELD(tableSpaceName);
127 * We don't need an _equalExpr because Expr is an abstract supertype which
128 * should never actually get instantiated. Also, since it has no common
129 * fields except NodeTag, there's no need for a helper routine to factor
130 * out comparing the common fields...
134 _equalVar(Var *a, Var *b)
136 COMPARE_SCALAR_FIELD(varno);
137 COMPARE_SCALAR_FIELD(varattno);
138 COMPARE_SCALAR_FIELD(vartype);
139 COMPARE_SCALAR_FIELD(vartypmod);
140 COMPARE_SCALAR_FIELD(varcollid);
141 COMPARE_SCALAR_FIELD(varlevelsup);
142 COMPARE_SCALAR_FIELD(varnoold);
143 COMPARE_SCALAR_FIELD(varoattno);
144 COMPARE_LOCATION_FIELD(location);
150 _equalConst(Const *a, Const *b)
152 COMPARE_SCALAR_FIELD(consttype);
153 COMPARE_SCALAR_FIELD(consttypmod);
154 COMPARE_SCALAR_FIELD(constcollid);
155 COMPARE_SCALAR_FIELD(constlen);
156 COMPARE_SCALAR_FIELD(constisnull);
157 COMPARE_SCALAR_FIELD(constbyval);
158 COMPARE_LOCATION_FIELD(location);
161 * We treat all NULL constants of the same type as equal. Someday this
162 * might need to change? But datumIsEqual doesn't work on nulls, so...
166 return datumIsEqual(a->constvalue, b->constvalue,
167 a->constbyval, a->constlen);
171 _equalParam(Param *a, Param *b)
173 COMPARE_SCALAR_FIELD(paramkind);
174 COMPARE_SCALAR_FIELD(paramid);
175 COMPARE_SCALAR_FIELD(paramtype);
176 COMPARE_SCALAR_FIELD(paramtypmod);
177 COMPARE_SCALAR_FIELD(paramcollid);
178 COMPARE_LOCATION_FIELD(location);
184 _equalAggref(Aggref *a, Aggref *b)
186 COMPARE_SCALAR_FIELD(aggfnoid);
187 COMPARE_SCALAR_FIELD(aggtype);
188 COMPARE_SCALAR_FIELD(aggcollid);
189 COMPARE_SCALAR_FIELD(inputcollid);
190 COMPARE_NODE_FIELD(args);
191 COMPARE_NODE_FIELD(aggorder);
192 COMPARE_NODE_FIELD(aggdistinct);
193 COMPARE_SCALAR_FIELD(aggstar);
194 COMPARE_SCALAR_FIELD(agglevelsup);
195 COMPARE_LOCATION_FIELD(location);
201 _equalWindowFunc(WindowFunc *a, WindowFunc *b)
203 COMPARE_SCALAR_FIELD(winfnoid);
204 COMPARE_SCALAR_FIELD(wintype);
205 COMPARE_SCALAR_FIELD(wincollid);
206 COMPARE_SCALAR_FIELD(inputcollid);
207 COMPARE_NODE_FIELD(args);
208 COMPARE_SCALAR_FIELD(winref);
209 COMPARE_SCALAR_FIELD(winstar);
210 COMPARE_SCALAR_FIELD(winagg);
211 COMPARE_LOCATION_FIELD(location);
217 _equalArrayRef(ArrayRef *a, ArrayRef *b)
219 COMPARE_SCALAR_FIELD(refarraytype);
220 COMPARE_SCALAR_FIELD(refelemtype);
221 COMPARE_SCALAR_FIELD(reftypmod);
222 COMPARE_SCALAR_FIELD(refcollid);
223 COMPARE_NODE_FIELD(refupperindexpr);
224 COMPARE_NODE_FIELD(reflowerindexpr);
225 COMPARE_NODE_FIELD(refexpr);
226 COMPARE_NODE_FIELD(refassgnexpr);
232 _equalFuncExpr(FuncExpr *a, FuncExpr *b)
234 COMPARE_SCALAR_FIELD(funcid);
235 COMPARE_SCALAR_FIELD(funcresulttype);
236 COMPARE_SCALAR_FIELD(funcretset);
239 * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
240 * that are equal() to both explicit and implicit coercions.
242 if (a->funcformat != b->funcformat &&
243 a->funcformat != COERCE_DONTCARE &&
244 b->funcformat != COERCE_DONTCARE)
247 COMPARE_SCALAR_FIELD(funccollid);
248 COMPARE_SCALAR_FIELD(inputcollid);
249 COMPARE_NODE_FIELD(args);
250 COMPARE_LOCATION_FIELD(location);
256 _equalNamedArgExpr(NamedArgExpr *a, NamedArgExpr *b)
258 COMPARE_NODE_FIELD(arg);
259 COMPARE_STRING_FIELD(name);
260 COMPARE_SCALAR_FIELD(argnumber);
261 COMPARE_LOCATION_FIELD(location);
267 _equalOpExpr(OpExpr *a, OpExpr *b)
269 COMPARE_SCALAR_FIELD(opno);
272 * Special-case opfuncid: it is allowable for it to differ if one node
273 * contains zero and the other doesn't. This just means that the one node
274 * isn't as far along in the parse/plan pipeline and hasn't had the
275 * opfuncid cache filled yet.
277 if (a->opfuncid != b->opfuncid &&
282 COMPARE_SCALAR_FIELD(opresulttype);
283 COMPARE_SCALAR_FIELD(opretset);
284 COMPARE_SCALAR_FIELD(opcollid);
285 COMPARE_SCALAR_FIELD(inputcollid);
286 COMPARE_NODE_FIELD(args);
287 COMPARE_LOCATION_FIELD(location);
293 _equalDistinctExpr(DistinctExpr *a, DistinctExpr *b)
295 COMPARE_SCALAR_FIELD(opno);
298 * Special-case opfuncid: it is allowable for it to differ if one node
299 * contains zero and the other doesn't. This just means that the one node
300 * isn't as far along in the parse/plan pipeline and hasn't had the
301 * opfuncid cache filled yet.
303 if (a->opfuncid != b->opfuncid &&
308 COMPARE_SCALAR_FIELD(opresulttype);
309 COMPARE_SCALAR_FIELD(opretset);
310 COMPARE_SCALAR_FIELD(opcollid);
311 COMPARE_SCALAR_FIELD(inputcollid);
312 COMPARE_NODE_FIELD(args);
313 COMPARE_LOCATION_FIELD(location);
319 _equalNullIfExpr(NullIfExpr *a, NullIfExpr *b)
321 COMPARE_SCALAR_FIELD(opno);
324 * Special-case opfuncid: it is allowable for it to differ if one node
325 * contains zero and the other doesn't. This just means that the one node
326 * isn't as far along in the parse/plan pipeline and hasn't had the
327 * opfuncid cache filled yet.
329 if (a->opfuncid != b->opfuncid &&
334 COMPARE_SCALAR_FIELD(opresulttype);
335 COMPARE_SCALAR_FIELD(opretset);
336 COMPARE_SCALAR_FIELD(opcollid);
337 COMPARE_SCALAR_FIELD(inputcollid);
338 COMPARE_NODE_FIELD(args);
339 COMPARE_LOCATION_FIELD(location);
345 _equalScalarArrayOpExpr(ScalarArrayOpExpr *a, ScalarArrayOpExpr *b)
347 COMPARE_SCALAR_FIELD(opno);
350 * Special-case opfuncid: it is allowable for it to differ if one node
351 * contains zero and the other doesn't. This just means that the one node
352 * isn't as far along in the parse/plan pipeline and hasn't had the
353 * opfuncid cache filled yet.
355 if (a->opfuncid != b->opfuncid &&
360 COMPARE_SCALAR_FIELD(useOr);
361 COMPARE_SCALAR_FIELD(inputcollid);
362 COMPARE_NODE_FIELD(args);
363 COMPARE_LOCATION_FIELD(location);
369 _equalBoolExpr(BoolExpr *a, BoolExpr *b)
371 COMPARE_SCALAR_FIELD(boolop);
372 COMPARE_NODE_FIELD(args);
373 COMPARE_LOCATION_FIELD(location);
379 _equalSubLink(SubLink *a, SubLink *b)
381 COMPARE_SCALAR_FIELD(subLinkType);
382 COMPARE_NODE_FIELD(testexpr);
383 COMPARE_NODE_FIELD(operName);
384 COMPARE_NODE_FIELD(subselect);
385 COMPARE_LOCATION_FIELD(location);
391 _equalSubPlan(SubPlan *a, SubPlan *b)
393 COMPARE_SCALAR_FIELD(subLinkType);
394 COMPARE_NODE_FIELD(testexpr);
395 COMPARE_NODE_FIELD(paramIds);
396 COMPARE_SCALAR_FIELD(plan_id);
397 COMPARE_STRING_FIELD(plan_name);
398 COMPARE_SCALAR_FIELD(firstColType);
399 COMPARE_SCALAR_FIELD(firstColTypmod);
400 COMPARE_SCALAR_FIELD(firstColCollation);
401 COMPARE_SCALAR_FIELD(useHashTable);
402 COMPARE_SCALAR_FIELD(unknownEqFalse);
403 COMPARE_NODE_FIELD(setParam);
404 COMPARE_NODE_FIELD(parParam);
405 COMPARE_NODE_FIELD(args);
406 COMPARE_SCALAR_FIELD(startup_cost);
407 COMPARE_SCALAR_FIELD(per_call_cost);
413 _equalAlternativeSubPlan(AlternativeSubPlan *a, AlternativeSubPlan *b)
415 COMPARE_NODE_FIELD(subplans);
421 _equalFieldSelect(FieldSelect *a, FieldSelect *b)
423 COMPARE_NODE_FIELD(arg);
424 COMPARE_SCALAR_FIELD(fieldnum);
425 COMPARE_SCALAR_FIELD(resulttype);
426 COMPARE_SCALAR_FIELD(resulttypmod);
427 COMPARE_SCALAR_FIELD(resultcollid);
433 _equalFieldStore(FieldStore *a, FieldStore *b)
435 COMPARE_NODE_FIELD(arg);
436 COMPARE_NODE_FIELD(newvals);
437 COMPARE_NODE_FIELD(fieldnums);
438 COMPARE_SCALAR_FIELD(resulttype);
444 _equalRelabelType(RelabelType *a, RelabelType *b)
446 COMPARE_NODE_FIELD(arg);
447 COMPARE_SCALAR_FIELD(resulttype);
448 COMPARE_SCALAR_FIELD(resulttypmod);
449 COMPARE_SCALAR_FIELD(resultcollid);
452 * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
453 * that are equal() to both explicit and implicit coercions.
455 if (a->relabelformat != b->relabelformat &&
456 a->relabelformat != COERCE_DONTCARE &&
457 b->relabelformat != COERCE_DONTCARE)
460 COMPARE_LOCATION_FIELD(location);
466 _equalCoerceViaIO(CoerceViaIO *a, CoerceViaIO *b)
468 COMPARE_NODE_FIELD(arg);
469 COMPARE_SCALAR_FIELD(resulttype);
470 COMPARE_SCALAR_FIELD(resultcollid);
473 * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
474 * that are equal() to both explicit and implicit coercions.
476 if (a->coerceformat != b->coerceformat &&
477 a->coerceformat != COERCE_DONTCARE &&
478 b->coerceformat != COERCE_DONTCARE)
481 COMPARE_LOCATION_FIELD(location);
487 _equalArrayCoerceExpr(ArrayCoerceExpr *a, ArrayCoerceExpr *b)
489 COMPARE_NODE_FIELD(arg);
490 COMPARE_SCALAR_FIELD(elemfuncid);
491 COMPARE_SCALAR_FIELD(resulttype);
492 COMPARE_SCALAR_FIELD(resulttypmod);
493 COMPARE_SCALAR_FIELD(resultcollid);
494 COMPARE_SCALAR_FIELD(isExplicit);
497 * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
498 * that are equal() to both explicit and implicit coercions.
500 if (a->coerceformat != b->coerceformat &&
501 a->coerceformat != COERCE_DONTCARE &&
502 b->coerceformat != COERCE_DONTCARE)
505 COMPARE_LOCATION_FIELD(location);
511 _equalConvertRowtypeExpr(ConvertRowtypeExpr *a, ConvertRowtypeExpr *b)
513 COMPARE_NODE_FIELD(arg);
514 COMPARE_SCALAR_FIELD(resulttype);
517 * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
518 * that are equal() to both explicit and implicit coercions.
520 if (a->convertformat != b->convertformat &&
521 a->convertformat != COERCE_DONTCARE &&
522 b->convertformat != COERCE_DONTCARE)
525 COMPARE_LOCATION_FIELD(location);
531 _equalCollateExpr(CollateExpr *a, CollateExpr *b)
533 COMPARE_NODE_FIELD(arg);
534 COMPARE_SCALAR_FIELD(collOid);
535 COMPARE_LOCATION_FIELD(location);
541 _equalCaseExpr(CaseExpr *a, CaseExpr *b)
543 COMPARE_SCALAR_FIELD(casetype);
544 COMPARE_SCALAR_FIELD(casecollid);
545 COMPARE_NODE_FIELD(arg);
546 COMPARE_NODE_FIELD(args);
547 COMPARE_NODE_FIELD(defresult);
548 COMPARE_LOCATION_FIELD(location);
554 _equalCaseWhen(CaseWhen *a, CaseWhen *b)
556 COMPARE_NODE_FIELD(expr);
557 COMPARE_NODE_FIELD(result);
558 COMPARE_LOCATION_FIELD(location);
564 _equalCaseTestExpr(CaseTestExpr *a, CaseTestExpr *b)
566 COMPARE_SCALAR_FIELD(typeId);
567 COMPARE_SCALAR_FIELD(typeMod);
568 COMPARE_SCALAR_FIELD(collation);
574 _equalArrayExpr(ArrayExpr *a, ArrayExpr *b)
576 COMPARE_SCALAR_FIELD(array_typeid);
577 COMPARE_SCALAR_FIELD(array_collid);
578 COMPARE_SCALAR_FIELD(element_typeid);
579 COMPARE_NODE_FIELD(elements);
580 COMPARE_SCALAR_FIELD(multidims);
581 COMPARE_LOCATION_FIELD(location);
587 _equalRowExpr(RowExpr *a, RowExpr *b)
589 COMPARE_NODE_FIELD(args);
590 COMPARE_SCALAR_FIELD(row_typeid);
593 * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
594 * that are equal() to both explicit and implicit coercions.
596 if (a->row_format != b->row_format &&
597 a->row_format != COERCE_DONTCARE &&
598 b->row_format != COERCE_DONTCARE)
601 COMPARE_NODE_FIELD(colnames);
602 COMPARE_LOCATION_FIELD(location);
608 _equalRowCompareExpr(RowCompareExpr *a, RowCompareExpr *b)
610 COMPARE_SCALAR_FIELD(rctype);
611 COMPARE_NODE_FIELD(opnos);
612 COMPARE_NODE_FIELD(opfamilies);
613 COMPARE_NODE_FIELD(inputcollids);
614 COMPARE_NODE_FIELD(largs);
615 COMPARE_NODE_FIELD(rargs);
621 _equalCoalesceExpr(CoalesceExpr *a, CoalesceExpr *b)
623 COMPARE_SCALAR_FIELD(coalescetype);
624 COMPARE_SCALAR_FIELD(coalescecollid);
625 COMPARE_NODE_FIELD(args);
626 COMPARE_LOCATION_FIELD(location);
632 _equalMinMaxExpr(MinMaxExpr *a, MinMaxExpr *b)
634 COMPARE_SCALAR_FIELD(minmaxtype);
635 COMPARE_SCALAR_FIELD(minmaxcollid);
636 COMPARE_SCALAR_FIELD(inputcollid);
637 COMPARE_SCALAR_FIELD(op);
638 COMPARE_NODE_FIELD(args);
639 COMPARE_LOCATION_FIELD(location);
645 _equalXmlExpr(XmlExpr *a, XmlExpr *b)
647 COMPARE_SCALAR_FIELD(op);
648 COMPARE_STRING_FIELD(name);
649 COMPARE_NODE_FIELD(named_args);
650 COMPARE_NODE_FIELD(arg_names);
651 COMPARE_NODE_FIELD(args);
652 COMPARE_SCALAR_FIELD(xmloption);
653 COMPARE_SCALAR_FIELD(type);
654 COMPARE_SCALAR_FIELD(typmod);
655 COMPARE_LOCATION_FIELD(location);
661 _equalNullTest(NullTest *a, NullTest *b)
663 COMPARE_NODE_FIELD(arg);
664 COMPARE_SCALAR_FIELD(nulltesttype);
665 COMPARE_SCALAR_FIELD(argisrow);
671 _equalBooleanTest(BooleanTest *a, BooleanTest *b)
673 COMPARE_NODE_FIELD(arg);
674 COMPARE_SCALAR_FIELD(booltesttype);
680 _equalCoerceToDomain(CoerceToDomain *a, CoerceToDomain *b)
682 COMPARE_NODE_FIELD(arg);
683 COMPARE_SCALAR_FIELD(resulttype);
684 COMPARE_SCALAR_FIELD(resulttypmod);
685 COMPARE_SCALAR_FIELD(resultcollid);
688 * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
689 * that are equal() to both explicit and implicit coercions.
691 if (a->coercionformat != b->coercionformat &&
692 a->coercionformat != COERCE_DONTCARE &&
693 b->coercionformat != COERCE_DONTCARE)
696 COMPARE_LOCATION_FIELD(location);
702 _equalCoerceToDomainValue(CoerceToDomainValue *a, CoerceToDomainValue *b)
704 COMPARE_SCALAR_FIELD(typeId);
705 COMPARE_SCALAR_FIELD(typeMod);
706 COMPARE_SCALAR_FIELD(collation);
707 COMPARE_LOCATION_FIELD(location);
713 _equalSetToDefault(SetToDefault *a, SetToDefault *b)
715 COMPARE_SCALAR_FIELD(typeId);
716 COMPARE_SCALAR_FIELD(typeMod);
717 COMPARE_SCALAR_FIELD(collation);
718 COMPARE_LOCATION_FIELD(location);
724 _equalCurrentOfExpr(CurrentOfExpr *a, CurrentOfExpr *b)
726 COMPARE_SCALAR_FIELD(cvarno);
727 COMPARE_STRING_FIELD(cursor_name);
728 COMPARE_SCALAR_FIELD(cursor_param);
734 _equalTargetEntry(TargetEntry *a, TargetEntry *b)
736 COMPARE_NODE_FIELD(expr);
737 COMPARE_SCALAR_FIELD(resno);
738 COMPARE_STRING_FIELD(resname);
739 COMPARE_SCALAR_FIELD(ressortgroupref);
740 COMPARE_SCALAR_FIELD(resorigtbl);
741 COMPARE_SCALAR_FIELD(resorigcol);
742 COMPARE_SCALAR_FIELD(resjunk);
748 _equalRangeTblRef(RangeTblRef *a, RangeTblRef *b)
750 COMPARE_SCALAR_FIELD(rtindex);
756 _equalJoinExpr(JoinExpr *a, JoinExpr *b)
758 COMPARE_SCALAR_FIELD(jointype);
759 COMPARE_SCALAR_FIELD(isNatural);
760 COMPARE_NODE_FIELD(larg);
761 COMPARE_NODE_FIELD(rarg);
762 COMPARE_NODE_FIELD(usingClause);
763 COMPARE_NODE_FIELD(quals);
764 COMPARE_NODE_FIELD(alias);
765 COMPARE_SCALAR_FIELD(rtindex);
771 _equalFromExpr(FromExpr *a, FromExpr *b)
773 COMPARE_NODE_FIELD(fromlist);
774 COMPARE_NODE_FIELD(quals);
781 * Stuff from relation.h
785 _equalPathKey(PathKey *a, PathKey *b)
788 * This is normally used on non-canonicalized PathKeys, so must chase up
789 * to the topmost merged EquivalenceClass and see if those are the same
790 * (by pointer equality).
792 EquivalenceClass *a_eclass;
793 EquivalenceClass *b_eclass;
795 a_eclass = a->pk_eclass;
796 while (a_eclass->ec_merged)
797 a_eclass = a_eclass->ec_merged;
798 b_eclass = b->pk_eclass;
799 while (b_eclass->ec_merged)
800 b_eclass = b_eclass->ec_merged;
801 if (a_eclass != b_eclass)
803 COMPARE_SCALAR_FIELD(pk_opfamily);
804 COMPARE_SCALAR_FIELD(pk_strategy);
805 COMPARE_SCALAR_FIELD(pk_nulls_first);
811 _equalRestrictInfo(RestrictInfo *a, RestrictInfo *b)
813 COMPARE_NODE_FIELD(clause);
814 COMPARE_SCALAR_FIELD(is_pushed_down);
815 COMPARE_SCALAR_FIELD(outerjoin_delayed);
816 COMPARE_BITMAPSET_FIELD(required_relids);
817 COMPARE_BITMAPSET_FIELD(nullable_relids);
820 * We ignore all the remaining fields, since they may not be set yet, and
821 * should be derivable from the clause anyway.
828 _equalPlaceHolderVar(PlaceHolderVar *a, PlaceHolderVar *b)
831 * We intentionally do not compare phexpr. Two PlaceHolderVars with the
832 * same ID and levelsup should be considered equal even if the contained
833 * expressions have managed to mutate to different states. One way in
834 * which that can happen is that initplan sublinks would get replaced by
835 * differently-numbered Params when sublink folding is done. (The end
836 * result of such a situation would be some unreferenced initplans, which
837 * is annoying but not really a problem.)
839 * COMPARE_NODE_FIELD(phexpr);
841 COMPARE_BITMAPSET_FIELD(phrels);
842 COMPARE_SCALAR_FIELD(phid);
843 COMPARE_SCALAR_FIELD(phlevelsup);
849 _equalSpecialJoinInfo(SpecialJoinInfo *a, SpecialJoinInfo *b)
851 COMPARE_BITMAPSET_FIELD(min_lefthand);
852 COMPARE_BITMAPSET_FIELD(min_righthand);
853 COMPARE_BITMAPSET_FIELD(syn_lefthand);
854 COMPARE_BITMAPSET_FIELD(syn_righthand);
855 COMPARE_SCALAR_FIELD(jointype);
856 COMPARE_SCALAR_FIELD(lhs_strict);
857 COMPARE_SCALAR_FIELD(delay_upper_joins);
858 COMPARE_NODE_FIELD(join_quals);
864 _equalAppendRelInfo(AppendRelInfo *a, AppendRelInfo *b)
866 COMPARE_SCALAR_FIELD(parent_relid);
867 COMPARE_SCALAR_FIELD(child_relid);
868 COMPARE_SCALAR_FIELD(parent_reltype);
869 COMPARE_SCALAR_FIELD(child_reltype);
870 COMPARE_NODE_FIELD(translated_vars);
871 COMPARE_SCALAR_FIELD(parent_reloid);
877 _equalPlaceHolderInfo(PlaceHolderInfo *a, PlaceHolderInfo *b)
879 COMPARE_SCALAR_FIELD(phid);
880 COMPARE_NODE_FIELD(ph_var);
881 COMPARE_BITMAPSET_FIELD(ph_eval_at);
882 COMPARE_BITMAPSET_FIELD(ph_needed);
883 COMPARE_BITMAPSET_FIELD(ph_may_need);
884 COMPARE_SCALAR_FIELD(ph_width);
891 * Stuff from parsenodes.h
895 _equalQuery(Query *a, Query *b)
897 COMPARE_SCALAR_FIELD(commandType);
898 COMPARE_SCALAR_FIELD(querySource);
899 COMPARE_SCALAR_FIELD(canSetTag);
900 COMPARE_NODE_FIELD(utilityStmt);
901 COMPARE_SCALAR_FIELD(resultRelation);
902 COMPARE_NODE_FIELD(intoClause);
903 COMPARE_SCALAR_FIELD(hasAggs);
904 COMPARE_SCALAR_FIELD(hasWindowFuncs);
905 COMPARE_SCALAR_FIELD(hasSubLinks);
906 COMPARE_SCALAR_FIELD(hasDistinctOn);
907 COMPARE_SCALAR_FIELD(hasRecursive);
908 COMPARE_SCALAR_FIELD(hasModifyingCTE);
909 COMPARE_SCALAR_FIELD(hasForUpdate);
910 COMPARE_NODE_FIELD(cteList);
911 COMPARE_NODE_FIELD(rtable);
912 COMPARE_NODE_FIELD(jointree);
913 COMPARE_NODE_FIELD(targetList);
914 COMPARE_NODE_FIELD(returningList);
915 COMPARE_NODE_FIELD(groupClause);
916 COMPARE_NODE_FIELD(havingQual);
917 COMPARE_NODE_FIELD(windowClause);
918 COMPARE_NODE_FIELD(distinctClause);
919 COMPARE_NODE_FIELD(sortClause);
920 COMPARE_NODE_FIELD(limitOffset);
921 COMPARE_NODE_FIELD(limitCount);
922 COMPARE_NODE_FIELD(rowMarks);
923 COMPARE_NODE_FIELD(setOperations);
924 COMPARE_NODE_FIELD(constraintDeps);
930 _equalInsertStmt(InsertStmt *a, InsertStmt *b)
932 COMPARE_NODE_FIELD(relation);
933 COMPARE_NODE_FIELD(cols);
934 COMPARE_NODE_FIELD(selectStmt);
935 COMPARE_NODE_FIELD(returningList);
936 COMPARE_NODE_FIELD(withClause);
942 _equalDeleteStmt(DeleteStmt *a, DeleteStmt *b)
944 COMPARE_NODE_FIELD(relation);
945 COMPARE_NODE_FIELD(usingClause);
946 COMPARE_NODE_FIELD(whereClause);
947 COMPARE_NODE_FIELD(returningList);
948 COMPARE_NODE_FIELD(withClause);
954 _equalUpdateStmt(UpdateStmt *a, UpdateStmt *b)
956 COMPARE_NODE_FIELD(relation);
957 COMPARE_NODE_FIELD(targetList);
958 COMPARE_NODE_FIELD(whereClause);
959 COMPARE_NODE_FIELD(fromClause);
960 COMPARE_NODE_FIELD(returningList);
961 COMPARE_NODE_FIELD(withClause);
967 _equalSelectStmt(SelectStmt *a, SelectStmt *b)
969 COMPARE_NODE_FIELD(distinctClause);
970 COMPARE_NODE_FIELD(intoClause);
971 COMPARE_NODE_FIELD(targetList);
972 COMPARE_NODE_FIELD(fromClause);
973 COMPARE_NODE_FIELD(whereClause);
974 COMPARE_NODE_FIELD(groupClause);
975 COMPARE_NODE_FIELD(havingClause);
976 COMPARE_NODE_FIELD(windowClause);
977 COMPARE_NODE_FIELD(withClause);
978 COMPARE_NODE_FIELD(valuesLists);
979 COMPARE_NODE_FIELD(sortClause);
980 COMPARE_NODE_FIELD(limitOffset);
981 COMPARE_NODE_FIELD(limitCount);
982 COMPARE_NODE_FIELD(lockingClause);
983 COMPARE_SCALAR_FIELD(op);
984 COMPARE_SCALAR_FIELD(all);
985 COMPARE_NODE_FIELD(larg);
986 COMPARE_NODE_FIELD(rarg);
992 _equalSetOperationStmt(SetOperationStmt *a, SetOperationStmt *b)
994 COMPARE_SCALAR_FIELD(op);
995 COMPARE_SCALAR_FIELD(all);
996 COMPARE_NODE_FIELD(larg);
997 COMPARE_NODE_FIELD(rarg);
998 COMPARE_NODE_FIELD(colTypes);
999 COMPARE_NODE_FIELD(colTypmods);
1000 COMPARE_NODE_FIELD(colCollations);
1001 COMPARE_NODE_FIELD(groupClauses);
1007 _equalAlterTableStmt(AlterTableStmt *a, AlterTableStmt *b)
1009 COMPARE_NODE_FIELD(relation);
1010 COMPARE_NODE_FIELD(cmds);
1011 COMPARE_SCALAR_FIELD(relkind);
1017 _equalAlterTableCmd(AlterTableCmd *a, AlterTableCmd *b)
1019 COMPARE_SCALAR_FIELD(subtype);
1020 COMPARE_STRING_FIELD(name);
1021 COMPARE_NODE_FIELD(def);
1022 COMPARE_SCALAR_FIELD(behavior);
1023 COMPARE_SCALAR_FIELD(missing_ok);
1029 _equalAlterDomainStmt(AlterDomainStmt *a, AlterDomainStmt *b)
1031 COMPARE_SCALAR_FIELD(subtype);
1032 COMPARE_NODE_FIELD(typeName);
1033 COMPARE_STRING_FIELD(name);
1034 COMPARE_NODE_FIELD(def);
1035 COMPARE_SCALAR_FIELD(behavior);
1041 _equalGrantStmt(GrantStmt *a, GrantStmt *b)
1043 COMPARE_SCALAR_FIELD(is_grant);
1044 COMPARE_SCALAR_FIELD(targtype);
1045 COMPARE_SCALAR_FIELD(objtype);
1046 COMPARE_NODE_FIELD(objects);
1047 COMPARE_NODE_FIELD(privileges);
1048 COMPARE_NODE_FIELD(grantees);
1049 COMPARE_SCALAR_FIELD(grant_option);
1050 COMPARE_SCALAR_FIELD(behavior);
1056 _equalPrivGrantee(PrivGrantee *a, PrivGrantee *b)
1058 COMPARE_STRING_FIELD(rolname);
1064 _equalFuncWithArgs(FuncWithArgs *a, FuncWithArgs *b)
1066 COMPARE_NODE_FIELD(funcname);
1067 COMPARE_NODE_FIELD(funcargs);
1073 _equalAccessPriv(AccessPriv *a, AccessPriv *b)
1075 COMPARE_STRING_FIELD(priv_name);
1076 COMPARE_NODE_FIELD(cols);
1082 _equalGrantRoleStmt(GrantRoleStmt *a, GrantRoleStmt *b)
1084 COMPARE_NODE_FIELD(granted_roles);
1085 COMPARE_NODE_FIELD(grantee_roles);
1086 COMPARE_SCALAR_FIELD(is_grant);
1087 COMPARE_SCALAR_FIELD(admin_opt);
1088 COMPARE_STRING_FIELD(grantor);
1089 COMPARE_SCALAR_FIELD(behavior);
1095 _equalAlterDefaultPrivilegesStmt(AlterDefaultPrivilegesStmt *a, AlterDefaultPrivilegesStmt *b)
1097 COMPARE_NODE_FIELD(options);
1098 COMPARE_NODE_FIELD(action);
1104 _equalDeclareCursorStmt(DeclareCursorStmt *a, DeclareCursorStmt *b)
1106 COMPARE_STRING_FIELD(portalname);
1107 COMPARE_SCALAR_FIELD(options);
1108 COMPARE_NODE_FIELD(query);
1114 _equalClosePortalStmt(ClosePortalStmt *a, ClosePortalStmt *b)
1116 COMPARE_STRING_FIELD(portalname);
1122 _equalClusterStmt(ClusterStmt *a, ClusterStmt *b)
1124 COMPARE_NODE_FIELD(relation);
1125 COMPARE_STRING_FIELD(indexname);
1126 COMPARE_SCALAR_FIELD(verbose);
1132 _equalCopyStmt(CopyStmt *a, CopyStmt *b)
1134 COMPARE_NODE_FIELD(relation);
1135 COMPARE_NODE_FIELD(query);
1136 COMPARE_NODE_FIELD(attlist);
1137 COMPARE_SCALAR_FIELD(is_from);
1138 COMPARE_STRING_FIELD(filename);
1139 COMPARE_NODE_FIELD(options);
1145 _equalCreateStmt(CreateStmt *a, CreateStmt *b)
1147 COMPARE_NODE_FIELD(relation);
1148 COMPARE_NODE_FIELD(tableElts);
1149 COMPARE_NODE_FIELD(inhRelations);
1150 COMPARE_NODE_FIELD(ofTypename);
1151 COMPARE_NODE_FIELD(constraints);
1152 COMPARE_NODE_FIELD(options);
1153 COMPARE_SCALAR_FIELD(oncommit);
1154 COMPARE_STRING_FIELD(tablespacename);
1155 COMPARE_SCALAR_FIELD(if_not_exists);
1161 _equalInhRelation(InhRelation *a, InhRelation *b)
1163 COMPARE_NODE_FIELD(relation);
1164 COMPARE_SCALAR_FIELD(options);
1170 _equalDefineStmt(DefineStmt *a, DefineStmt *b)
1172 COMPARE_SCALAR_FIELD(kind);
1173 COMPARE_SCALAR_FIELD(oldstyle);
1174 COMPARE_NODE_FIELD(defnames);
1175 COMPARE_NODE_FIELD(args);
1176 COMPARE_NODE_FIELD(definition);
1182 _equalDropStmt(DropStmt *a, DropStmt *b)
1184 COMPARE_NODE_FIELD(objects);
1185 COMPARE_SCALAR_FIELD(removeType);
1186 COMPARE_SCALAR_FIELD(behavior);
1187 COMPARE_SCALAR_FIELD(missing_ok);
1193 _equalTruncateStmt(TruncateStmt *a, TruncateStmt *b)
1195 COMPARE_NODE_FIELD(relations);
1196 COMPARE_SCALAR_FIELD(restart_seqs);
1197 COMPARE_SCALAR_FIELD(behavior);
1203 _equalCommentStmt(CommentStmt *a, CommentStmt *b)
1205 COMPARE_SCALAR_FIELD(objtype);
1206 COMPARE_NODE_FIELD(objname);
1207 COMPARE_NODE_FIELD(objargs);
1208 COMPARE_STRING_FIELD(comment);
1214 _equalSecLabelStmt(SecLabelStmt *a, SecLabelStmt *b)
1216 COMPARE_SCALAR_FIELD(objtype);
1217 COMPARE_NODE_FIELD(objname);
1218 COMPARE_NODE_FIELD(objargs);
1219 COMPARE_STRING_FIELD(provider);
1220 COMPARE_STRING_FIELD(label);
1226 _equalFetchStmt(FetchStmt *a, FetchStmt *b)
1228 COMPARE_SCALAR_FIELD(direction);
1229 COMPARE_SCALAR_FIELD(howMany);
1230 COMPARE_STRING_FIELD(portalname);
1231 COMPARE_SCALAR_FIELD(ismove);
1237 _equalIndexStmt(IndexStmt *a, IndexStmt *b)
1239 COMPARE_STRING_FIELD(idxname);
1240 COMPARE_NODE_FIELD(relation);
1241 COMPARE_STRING_FIELD(accessMethod);
1242 COMPARE_STRING_FIELD(tableSpace);
1243 COMPARE_NODE_FIELD(indexParams);
1244 COMPARE_NODE_FIELD(options);
1245 COMPARE_NODE_FIELD(whereClause);
1246 COMPARE_NODE_FIELD(excludeOpNames);
1247 COMPARE_SCALAR_FIELD(indexOid);
1248 COMPARE_SCALAR_FIELD(oldNode);
1249 COMPARE_SCALAR_FIELD(unique);
1250 COMPARE_SCALAR_FIELD(primary);
1251 COMPARE_SCALAR_FIELD(isconstraint);
1252 COMPARE_SCALAR_FIELD(deferrable);
1253 COMPARE_SCALAR_FIELD(initdeferred);
1254 COMPARE_SCALAR_FIELD(concurrent);
1260 _equalCreateFunctionStmt(CreateFunctionStmt *a, CreateFunctionStmt *b)
1262 COMPARE_SCALAR_FIELD(replace);
1263 COMPARE_NODE_FIELD(funcname);
1264 COMPARE_NODE_FIELD(parameters);
1265 COMPARE_NODE_FIELD(returnType);
1266 COMPARE_NODE_FIELD(options);
1267 COMPARE_NODE_FIELD(withClause);
1273 _equalFunctionParameter(FunctionParameter *a, FunctionParameter *b)
1275 COMPARE_STRING_FIELD(name);
1276 COMPARE_NODE_FIELD(argType);
1277 COMPARE_SCALAR_FIELD(mode);
1278 COMPARE_NODE_FIELD(defexpr);
1284 _equalAlterFunctionStmt(AlterFunctionStmt *a, AlterFunctionStmt *b)
1286 COMPARE_NODE_FIELD(func);
1287 COMPARE_NODE_FIELD(actions);
1293 _equalRemoveFuncStmt(RemoveFuncStmt *a, RemoveFuncStmt *b)
1295 COMPARE_SCALAR_FIELD(kind);
1296 COMPARE_NODE_FIELD(name);
1297 COMPARE_NODE_FIELD(args);
1298 COMPARE_SCALAR_FIELD(behavior);
1299 COMPARE_SCALAR_FIELD(missing_ok);
1305 _equalDoStmt(DoStmt *a, DoStmt *b)
1307 COMPARE_NODE_FIELD(args);
1313 _equalRemoveOpClassStmt(RemoveOpClassStmt *a, RemoveOpClassStmt *b)
1315 COMPARE_NODE_FIELD(opclassname);
1316 COMPARE_STRING_FIELD(amname);
1317 COMPARE_SCALAR_FIELD(behavior);
1318 COMPARE_SCALAR_FIELD(missing_ok);
1324 _equalRemoveOpFamilyStmt(RemoveOpFamilyStmt *a, RemoveOpFamilyStmt *b)
1326 COMPARE_NODE_FIELD(opfamilyname);
1327 COMPARE_STRING_FIELD(amname);
1328 COMPARE_SCALAR_FIELD(behavior);
1329 COMPARE_SCALAR_FIELD(missing_ok);
1335 _equalRenameStmt(RenameStmt *a, RenameStmt *b)
1337 COMPARE_SCALAR_FIELD(renameType);
1338 COMPARE_NODE_FIELD(relation);
1339 COMPARE_NODE_FIELD(object);
1340 COMPARE_NODE_FIELD(objarg);
1341 COMPARE_STRING_FIELD(subname);
1342 COMPARE_STRING_FIELD(newname);
1343 COMPARE_SCALAR_FIELD(behavior);
1349 _equalAlterObjectSchemaStmt(AlterObjectSchemaStmt *a, AlterObjectSchemaStmt *b)
1351 COMPARE_SCALAR_FIELD(objectType);
1352 COMPARE_NODE_FIELD(relation);
1353 COMPARE_NODE_FIELD(object);
1354 COMPARE_NODE_FIELD(objarg);
1355 COMPARE_STRING_FIELD(addname);
1356 COMPARE_STRING_FIELD(newschema);
1362 _equalAlterOwnerStmt(AlterOwnerStmt *a, AlterOwnerStmt *b)
1364 COMPARE_SCALAR_FIELD(objectType);
1365 COMPARE_NODE_FIELD(relation);
1366 COMPARE_NODE_FIELD(object);
1367 COMPARE_NODE_FIELD(objarg);
1368 COMPARE_STRING_FIELD(addname);
1369 COMPARE_STRING_FIELD(newowner);
1375 _equalRuleStmt(RuleStmt *a, RuleStmt *b)
1377 COMPARE_NODE_FIELD(relation);
1378 COMPARE_STRING_FIELD(rulename);
1379 COMPARE_NODE_FIELD(whereClause);
1380 COMPARE_SCALAR_FIELD(event);
1381 COMPARE_SCALAR_FIELD(instead);
1382 COMPARE_NODE_FIELD(actions);
1383 COMPARE_SCALAR_FIELD(replace);
1389 _equalNotifyStmt(NotifyStmt *a, NotifyStmt *b)
1391 COMPARE_STRING_FIELD(conditionname);
1392 COMPARE_STRING_FIELD(payload);
1398 _equalListenStmt(ListenStmt *a, ListenStmt *b)
1400 COMPARE_STRING_FIELD(conditionname);
1406 _equalUnlistenStmt(UnlistenStmt *a, UnlistenStmt *b)
1408 COMPARE_STRING_FIELD(conditionname);
1414 _equalTransactionStmt(TransactionStmt *a, TransactionStmt *b)
1416 COMPARE_SCALAR_FIELD(kind);
1417 COMPARE_NODE_FIELD(options);
1418 COMPARE_STRING_FIELD(gid);
1424 _equalCompositeTypeStmt(CompositeTypeStmt *a, CompositeTypeStmt *b)
1426 COMPARE_NODE_FIELD(typevar);
1427 COMPARE_NODE_FIELD(coldeflist);
1433 _equalCreateEnumStmt(CreateEnumStmt *a, CreateEnumStmt *b)
1435 COMPARE_NODE_FIELD(typeName);
1436 COMPARE_NODE_FIELD(vals);
1442 _equalAlterEnumStmt(AlterEnumStmt *a, AlterEnumStmt *b)
1444 COMPARE_NODE_FIELD(typeName);
1445 COMPARE_STRING_FIELD(newVal);
1446 COMPARE_STRING_FIELD(newValNeighbor);
1447 COMPARE_SCALAR_FIELD(newValIsAfter);
1453 _equalViewStmt(ViewStmt *a, ViewStmt *b)
1455 COMPARE_NODE_FIELD(view);
1456 COMPARE_NODE_FIELD(aliases);
1457 COMPARE_NODE_FIELD(query);
1458 COMPARE_SCALAR_FIELD(replace);
1464 _equalLoadStmt(LoadStmt *a, LoadStmt *b)
1466 COMPARE_STRING_FIELD(filename);
1472 _equalCreateDomainStmt(CreateDomainStmt *a, CreateDomainStmt *b)
1474 COMPARE_NODE_FIELD(domainname);
1475 COMPARE_NODE_FIELD(typeName);
1476 COMPARE_NODE_FIELD(collClause);
1477 COMPARE_NODE_FIELD(constraints);
1483 _equalCreateOpClassStmt(CreateOpClassStmt *a, CreateOpClassStmt *b)
1485 COMPARE_NODE_FIELD(opclassname);
1486 COMPARE_NODE_FIELD(opfamilyname);
1487 COMPARE_STRING_FIELD(amname);
1488 COMPARE_NODE_FIELD(datatype);
1489 COMPARE_NODE_FIELD(items);
1490 COMPARE_SCALAR_FIELD(isDefault);
1496 _equalCreateOpClassItem(CreateOpClassItem *a, CreateOpClassItem *b)
1498 COMPARE_SCALAR_FIELD(itemtype);
1499 COMPARE_NODE_FIELD(name);
1500 COMPARE_NODE_FIELD(args);
1501 COMPARE_SCALAR_FIELD(number);
1502 COMPARE_NODE_FIELD(order_family);
1503 COMPARE_NODE_FIELD(class_args);
1504 COMPARE_NODE_FIELD(storedtype);
1510 _equalCreateOpFamilyStmt(CreateOpFamilyStmt *a, CreateOpFamilyStmt *b)
1512 COMPARE_NODE_FIELD(opfamilyname);
1513 COMPARE_STRING_FIELD(amname);
1519 _equalAlterOpFamilyStmt(AlterOpFamilyStmt *a, AlterOpFamilyStmt *b)
1521 COMPARE_NODE_FIELD(opfamilyname);
1522 COMPARE_STRING_FIELD(amname);
1523 COMPARE_SCALAR_FIELD(isDrop);
1524 COMPARE_NODE_FIELD(items);
1530 _equalCreatedbStmt(CreatedbStmt *a, CreatedbStmt *b)
1532 COMPARE_STRING_FIELD(dbname);
1533 COMPARE_NODE_FIELD(options);
1539 _equalAlterDatabaseStmt(AlterDatabaseStmt *a, AlterDatabaseStmt *b)
1541 COMPARE_STRING_FIELD(dbname);
1542 COMPARE_NODE_FIELD(options);
1548 _equalAlterDatabaseSetStmt(AlterDatabaseSetStmt *a, AlterDatabaseSetStmt *b)
1550 COMPARE_STRING_FIELD(dbname);
1551 COMPARE_NODE_FIELD(setstmt);
1557 _equalDropdbStmt(DropdbStmt *a, DropdbStmt *b)
1559 COMPARE_STRING_FIELD(dbname);
1560 COMPARE_SCALAR_FIELD(missing_ok);
1566 _equalVacuumStmt(VacuumStmt *a, VacuumStmt *b)
1568 COMPARE_SCALAR_FIELD(options);
1569 COMPARE_SCALAR_FIELD(freeze_min_age);
1570 COMPARE_SCALAR_FIELD(freeze_table_age);
1571 COMPARE_NODE_FIELD(relation);
1572 COMPARE_NODE_FIELD(va_cols);
1578 _equalExplainStmt(ExplainStmt *a, ExplainStmt *b)
1580 COMPARE_NODE_FIELD(query);
1581 COMPARE_NODE_FIELD(options);
1587 _equalCreateSeqStmt(CreateSeqStmt *a, CreateSeqStmt *b)
1589 COMPARE_NODE_FIELD(sequence);
1590 COMPARE_NODE_FIELD(options);
1591 COMPARE_SCALAR_FIELD(ownerId);
1597 _equalAlterSeqStmt(AlterSeqStmt *a, AlterSeqStmt *b)
1599 COMPARE_NODE_FIELD(sequence);
1600 COMPARE_NODE_FIELD(options);
1606 _equalVariableSetStmt(VariableSetStmt *a, VariableSetStmt *b)
1608 COMPARE_SCALAR_FIELD(kind);
1609 COMPARE_STRING_FIELD(name);
1610 COMPARE_NODE_FIELD(args);
1611 COMPARE_SCALAR_FIELD(is_local);
1617 _equalVariableShowStmt(VariableShowStmt *a, VariableShowStmt *b)
1619 COMPARE_STRING_FIELD(name);
1625 _equalDiscardStmt(DiscardStmt *a, DiscardStmt *b)
1627 COMPARE_SCALAR_FIELD(target);
1633 _equalCreateTableSpaceStmt(CreateTableSpaceStmt *a, CreateTableSpaceStmt *b)
1635 COMPARE_STRING_FIELD(tablespacename);
1636 COMPARE_STRING_FIELD(owner);
1637 COMPARE_STRING_FIELD(location);
1643 _equalDropTableSpaceStmt(DropTableSpaceStmt *a, DropTableSpaceStmt *b)
1645 COMPARE_STRING_FIELD(tablespacename);
1646 COMPARE_SCALAR_FIELD(missing_ok);
1652 _equalAlterTableSpaceOptionsStmt(AlterTableSpaceOptionsStmt *a,
1653 AlterTableSpaceOptionsStmt *b)
1655 COMPARE_STRING_FIELD(tablespacename);
1656 COMPARE_NODE_FIELD(options);
1657 COMPARE_SCALAR_FIELD(isReset);
1663 _equalCreateExtensionStmt(CreateExtensionStmt *a, CreateExtensionStmt *b)
1665 COMPARE_STRING_FIELD(extname);
1666 COMPARE_SCALAR_FIELD(if_not_exists);
1667 COMPARE_NODE_FIELD(options);
1673 _equalAlterExtensionStmt(AlterExtensionStmt *a, AlterExtensionStmt *b)
1675 COMPARE_STRING_FIELD(extname);
1676 COMPARE_NODE_FIELD(options);
1682 _equalAlterExtensionContentsStmt(AlterExtensionContentsStmt *a, AlterExtensionContentsStmt *b)
1684 COMPARE_STRING_FIELD(extname);
1685 COMPARE_SCALAR_FIELD(action);
1686 COMPARE_SCALAR_FIELD(objtype);
1687 COMPARE_NODE_FIELD(objname);
1688 COMPARE_NODE_FIELD(objargs);
1694 _equalCreateFdwStmt(CreateFdwStmt *a, CreateFdwStmt *b)
1696 COMPARE_STRING_FIELD(fdwname);
1697 COMPARE_NODE_FIELD(func_options);
1698 COMPARE_NODE_FIELD(options);
1704 _equalAlterFdwStmt(AlterFdwStmt *a, AlterFdwStmt *b)
1706 COMPARE_STRING_FIELD(fdwname);
1707 COMPARE_NODE_FIELD(func_options);
1708 COMPARE_NODE_FIELD(options);
1714 _equalDropFdwStmt(DropFdwStmt *a, DropFdwStmt *b)
1716 COMPARE_STRING_FIELD(fdwname);
1717 COMPARE_SCALAR_FIELD(missing_ok);
1718 COMPARE_SCALAR_FIELD(behavior);
1724 _equalCreateForeignServerStmt(CreateForeignServerStmt *a, CreateForeignServerStmt *b)
1726 COMPARE_STRING_FIELD(servername);
1727 COMPARE_STRING_FIELD(servertype);
1728 COMPARE_STRING_FIELD(version);
1729 COMPARE_STRING_FIELD(fdwname);
1730 COMPARE_NODE_FIELD(options);
1736 _equalAlterForeignServerStmt(AlterForeignServerStmt *a, AlterForeignServerStmt *b)
1738 COMPARE_STRING_FIELD(servername);
1739 COMPARE_STRING_FIELD(version);
1740 COMPARE_NODE_FIELD(options);
1741 COMPARE_SCALAR_FIELD(has_version);
1747 _equalDropForeignServerStmt(DropForeignServerStmt *a, DropForeignServerStmt *b)
1749 COMPARE_STRING_FIELD(servername);
1750 COMPARE_SCALAR_FIELD(missing_ok);
1751 COMPARE_SCALAR_FIELD(behavior);
1757 _equalCreateUserMappingStmt(CreateUserMappingStmt *a, CreateUserMappingStmt *b)
1759 COMPARE_STRING_FIELD(username);
1760 COMPARE_STRING_FIELD(servername);
1761 COMPARE_NODE_FIELD(options);
1767 _equalAlterUserMappingStmt(AlterUserMappingStmt *a, AlterUserMappingStmt *b)
1769 COMPARE_STRING_FIELD(username);
1770 COMPARE_STRING_FIELD(servername);
1771 COMPARE_NODE_FIELD(options);
1777 _equalDropUserMappingStmt(DropUserMappingStmt *a, DropUserMappingStmt *b)
1779 COMPARE_STRING_FIELD(username);
1780 COMPARE_STRING_FIELD(servername);
1781 COMPARE_SCALAR_FIELD(missing_ok);
1787 _equalCreateForeignTableStmt(CreateForeignTableStmt *a, CreateForeignTableStmt *b)
1789 if (!_equalCreateStmt(&a->base, &b->base))
1792 COMPARE_STRING_FIELD(servername);
1793 COMPARE_NODE_FIELD(options);
1799 _equalCreateTrigStmt(CreateTrigStmt *a, CreateTrigStmt *b)
1801 COMPARE_STRING_FIELD(trigname);
1802 COMPARE_NODE_FIELD(relation);
1803 COMPARE_NODE_FIELD(funcname);
1804 COMPARE_NODE_FIELD(args);
1805 COMPARE_SCALAR_FIELD(row);
1806 COMPARE_SCALAR_FIELD(timing);
1807 COMPARE_SCALAR_FIELD(events);
1808 COMPARE_NODE_FIELD(columns);
1809 COMPARE_NODE_FIELD(whenClause);
1810 COMPARE_SCALAR_FIELD(isconstraint);
1811 COMPARE_SCALAR_FIELD(deferrable);
1812 COMPARE_SCALAR_FIELD(initdeferred);
1813 COMPARE_NODE_FIELD(constrrel);
1819 _equalDropPropertyStmt(DropPropertyStmt *a, DropPropertyStmt *b)
1821 COMPARE_NODE_FIELD(relation);
1822 COMPARE_STRING_FIELD(property);
1823 COMPARE_SCALAR_FIELD(removeType);
1824 COMPARE_SCALAR_FIELD(behavior);
1825 COMPARE_SCALAR_FIELD(missing_ok);
1831 _equalCreatePLangStmt(CreatePLangStmt *a, CreatePLangStmt *b)
1833 COMPARE_SCALAR_FIELD(replace);
1834 COMPARE_STRING_FIELD(plname);
1835 COMPARE_NODE_FIELD(plhandler);
1836 COMPARE_NODE_FIELD(plinline);
1837 COMPARE_NODE_FIELD(plvalidator);
1838 COMPARE_SCALAR_FIELD(pltrusted);
1844 _equalDropPLangStmt(DropPLangStmt *a, DropPLangStmt *b)
1846 COMPARE_STRING_FIELD(plname);
1847 COMPARE_SCALAR_FIELD(behavior);
1848 COMPARE_SCALAR_FIELD(missing_ok);
1854 _equalCreateRoleStmt(CreateRoleStmt *a, CreateRoleStmt *b)
1856 COMPARE_SCALAR_FIELD(stmt_type);
1857 COMPARE_STRING_FIELD(role);
1858 COMPARE_NODE_FIELD(options);
1864 _equalAlterRoleStmt(AlterRoleStmt *a, AlterRoleStmt *b)
1866 COMPARE_STRING_FIELD(role);
1867 COMPARE_NODE_FIELD(options);
1868 COMPARE_SCALAR_FIELD(action);
1874 _equalAlterRoleSetStmt(AlterRoleSetStmt *a, AlterRoleSetStmt *b)
1876 COMPARE_STRING_FIELD(role);
1877 COMPARE_STRING_FIELD(database);
1878 COMPARE_NODE_FIELD(setstmt);
1884 _equalDropRoleStmt(DropRoleStmt *a, DropRoleStmt *b)
1886 COMPARE_NODE_FIELD(roles);
1887 COMPARE_SCALAR_FIELD(missing_ok);
1893 _equalLockStmt(LockStmt *a, LockStmt *b)
1895 COMPARE_NODE_FIELD(relations);
1896 COMPARE_SCALAR_FIELD(mode);
1897 COMPARE_SCALAR_FIELD(nowait);
1903 _equalConstraintsSetStmt(ConstraintsSetStmt *a, ConstraintsSetStmt *b)
1905 COMPARE_NODE_FIELD(constraints);
1906 COMPARE_SCALAR_FIELD(deferred);
1912 _equalReindexStmt(ReindexStmt *a, ReindexStmt *b)
1914 COMPARE_SCALAR_FIELD(kind);
1915 COMPARE_NODE_FIELD(relation);
1916 COMPARE_STRING_FIELD(name);
1917 COMPARE_SCALAR_FIELD(do_system);
1918 COMPARE_SCALAR_FIELD(do_user);
1924 _equalCreateSchemaStmt(CreateSchemaStmt *a, CreateSchemaStmt *b)
1926 COMPARE_STRING_FIELD(schemaname);
1927 COMPARE_STRING_FIELD(authid);
1928 COMPARE_NODE_FIELD(schemaElts);
1934 _equalCreateConversionStmt(CreateConversionStmt *a, CreateConversionStmt *b)
1936 COMPARE_NODE_FIELD(conversion_name);
1937 COMPARE_STRING_FIELD(for_encoding_name);
1938 COMPARE_STRING_FIELD(to_encoding_name);
1939 COMPARE_NODE_FIELD(func_name);
1940 COMPARE_SCALAR_FIELD(def);
1946 _equalCreateCastStmt(CreateCastStmt *a, CreateCastStmt *b)
1948 COMPARE_NODE_FIELD(sourcetype);
1949 COMPARE_NODE_FIELD(targettype);
1950 COMPARE_NODE_FIELD(func);
1951 COMPARE_SCALAR_FIELD(context);
1952 COMPARE_SCALAR_FIELD(inout);
1958 _equalDropCastStmt(DropCastStmt *a, DropCastStmt *b)
1960 COMPARE_NODE_FIELD(sourcetype);
1961 COMPARE_NODE_FIELD(targettype);
1962 COMPARE_SCALAR_FIELD(behavior);
1963 COMPARE_SCALAR_FIELD(missing_ok);
1969 _equalPrepareStmt(PrepareStmt *a, PrepareStmt *b)
1971 COMPARE_STRING_FIELD(name);
1972 COMPARE_NODE_FIELD(argtypes);
1973 COMPARE_NODE_FIELD(query);
1979 _equalExecuteStmt(ExecuteStmt *a, ExecuteStmt *b)
1981 COMPARE_STRING_FIELD(name);
1982 COMPARE_NODE_FIELD(into);
1983 COMPARE_NODE_FIELD(params);
1989 _equalDeallocateStmt(DeallocateStmt *a, DeallocateStmt *b)
1991 COMPARE_STRING_FIELD(name);
1997 _equalDropOwnedStmt(DropOwnedStmt *a, DropOwnedStmt *b)
1999 COMPARE_NODE_FIELD(roles);
2000 COMPARE_SCALAR_FIELD(behavior);
2006 _equalReassignOwnedStmt(ReassignOwnedStmt *a, ReassignOwnedStmt *b)
2008 COMPARE_NODE_FIELD(roles);
2009 COMPARE_NODE_FIELD(newrole);
2015 _equalAlterTSDictionaryStmt(AlterTSDictionaryStmt *a, AlterTSDictionaryStmt *b)
2017 COMPARE_NODE_FIELD(dictname);
2018 COMPARE_NODE_FIELD(options);
2024 _equalAlterTSConfigurationStmt(AlterTSConfigurationStmt *a,
2025 AlterTSConfigurationStmt *b)
2027 COMPARE_NODE_FIELD(cfgname);
2028 COMPARE_NODE_FIELD(tokentype);
2029 COMPARE_NODE_FIELD(dicts);
2030 COMPARE_SCALAR_FIELD(override);
2031 COMPARE_SCALAR_FIELD(replace);
2032 COMPARE_SCALAR_FIELD(missing_ok);
2038 _equalAExpr(A_Expr *a, A_Expr *b)
2040 COMPARE_SCALAR_FIELD(kind);
2041 COMPARE_NODE_FIELD(name);
2042 COMPARE_NODE_FIELD(lexpr);
2043 COMPARE_NODE_FIELD(rexpr);
2044 COMPARE_LOCATION_FIELD(location);
2050 _equalColumnRef(ColumnRef *a, ColumnRef *b)
2052 COMPARE_NODE_FIELD(fields);
2053 COMPARE_LOCATION_FIELD(location);
2059 _equalParamRef(ParamRef *a, ParamRef *b)
2061 COMPARE_SCALAR_FIELD(number);
2062 COMPARE_LOCATION_FIELD(location);
2068 _equalAConst(A_Const *a, A_Const *b)
2070 if (!equal(&a->val, &b->val)) /* hack for in-line Value field */
2072 COMPARE_LOCATION_FIELD(location);
2078 _equalFuncCall(FuncCall *a, FuncCall *b)
2080 COMPARE_NODE_FIELD(funcname);
2081 COMPARE_NODE_FIELD(args);
2082 COMPARE_NODE_FIELD(agg_order);
2083 COMPARE_SCALAR_FIELD(agg_star);
2084 COMPARE_SCALAR_FIELD(agg_distinct);
2085 COMPARE_SCALAR_FIELD(func_variadic);
2086 COMPARE_NODE_FIELD(over);
2087 COMPARE_LOCATION_FIELD(location);
2093 _equalAStar(A_Star *a, A_Star *b)
2099 _equalAIndices(A_Indices *a, A_Indices *b)
2101 COMPARE_NODE_FIELD(lidx);
2102 COMPARE_NODE_FIELD(uidx);
2108 _equalA_Indirection(A_Indirection *a, A_Indirection *b)
2110 COMPARE_NODE_FIELD(arg);
2111 COMPARE_NODE_FIELD(indirection);
2117 _equalA_ArrayExpr(A_ArrayExpr *a, A_ArrayExpr *b)
2119 COMPARE_NODE_FIELD(elements);
2120 COMPARE_LOCATION_FIELD(location);
2126 _equalResTarget(ResTarget *a, ResTarget *b)
2128 COMPARE_STRING_FIELD(name);
2129 COMPARE_NODE_FIELD(indirection);
2130 COMPARE_NODE_FIELD(val);
2131 COMPARE_LOCATION_FIELD(location);
2137 _equalTypeName(TypeName *a, TypeName *b)
2139 COMPARE_NODE_FIELD(names);
2140 COMPARE_SCALAR_FIELD(typeOid);
2141 COMPARE_SCALAR_FIELD(setof);
2142 COMPARE_SCALAR_FIELD(pct_type);
2143 COMPARE_NODE_FIELD(typmods);
2144 COMPARE_SCALAR_FIELD(typemod);
2145 COMPARE_NODE_FIELD(arrayBounds);
2146 COMPARE_LOCATION_FIELD(location);
2152 _equalTypeCast(TypeCast *a, TypeCast *b)
2154 COMPARE_NODE_FIELD(arg);
2155 COMPARE_NODE_FIELD(typeName);
2156 COMPARE_LOCATION_FIELD(location);
2162 _equalCollateClause(CollateClause *a, CollateClause *b)
2164 COMPARE_NODE_FIELD(arg);
2165 COMPARE_NODE_FIELD(collname);
2166 COMPARE_LOCATION_FIELD(location);
2172 _equalSortBy(SortBy *a, SortBy *b)
2174 COMPARE_NODE_FIELD(node);
2175 COMPARE_SCALAR_FIELD(sortby_dir);
2176 COMPARE_SCALAR_FIELD(sortby_nulls);
2177 COMPARE_NODE_FIELD(useOp);
2178 COMPARE_LOCATION_FIELD(location);
2184 _equalWindowDef(WindowDef *a, WindowDef *b)
2186 COMPARE_STRING_FIELD(name);
2187 COMPARE_STRING_FIELD(refname);
2188 COMPARE_NODE_FIELD(partitionClause);
2189 COMPARE_NODE_FIELD(orderClause);
2190 COMPARE_SCALAR_FIELD(frameOptions);
2191 COMPARE_NODE_FIELD(startOffset);
2192 COMPARE_NODE_FIELD(endOffset);
2193 COMPARE_LOCATION_FIELD(location);
2199 _equalRangeSubselect(RangeSubselect *a, RangeSubselect *b)
2201 COMPARE_NODE_FIELD(subquery);
2202 COMPARE_NODE_FIELD(alias);
2208 _equalRangeFunction(RangeFunction *a, RangeFunction *b)
2210 COMPARE_NODE_FIELD(funccallnode);
2211 COMPARE_NODE_FIELD(alias);
2212 COMPARE_NODE_FIELD(coldeflist);
2218 _equalIndexElem(IndexElem *a, IndexElem *b)
2220 COMPARE_STRING_FIELD(name);
2221 COMPARE_NODE_FIELD(expr);
2222 COMPARE_STRING_FIELD(indexcolname);
2223 COMPARE_NODE_FIELD(collation);
2224 COMPARE_NODE_FIELD(opclass);
2225 COMPARE_SCALAR_FIELD(ordering);
2226 COMPARE_SCALAR_FIELD(nulls_ordering);
2232 _equalColumnDef(ColumnDef *a, ColumnDef *b)
2234 COMPARE_STRING_FIELD(colname);
2235 COMPARE_NODE_FIELD(typeName);
2236 COMPARE_SCALAR_FIELD(inhcount);
2237 COMPARE_SCALAR_FIELD(is_local);
2238 COMPARE_SCALAR_FIELD(is_not_null);
2239 COMPARE_SCALAR_FIELD(is_from_type);
2240 COMPARE_SCALAR_FIELD(storage);
2241 COMPARE_NODE_FIELD(raw_default);
2242 COMPARE_NODE_FIELD(cooked_default);
2243 COMPARE_NODE_FIELD(collClause);
2244 COMPARE_SCALAR_FIELD(collOid);
2245 COMPARE_NODE_FIELD(constraints);
2251 _equalConstraint(Constraint *a, Constraint *b)
2253 COMPARE_SCALAR_FIELD(contype);
2254 COMPARE_STRING_FIELD(conname);
2255 COMPARE_SCALAR_FIELD(deferrable);
2256 COMPARE_SCALAR_FIELD(initdeferred);
2257 COMPARE_LOCATION_FIELD(location);
2258 COMPARE_NODE_FIELD(raw_expr);
2259 COMPARE_STRING_FIELD(cooked_expr);
2260 COMPARE_NODE_FIELD(keys);
2261 COMPARE_NODE_FIELD(exclusions);
2262 COMPARE_NODE_FIELD(options);
2263 COMPARE_STRING_FIELD(indexname);
2264 COMPARE_STRING_FIELD(indexspace);
2265 COMPARE_STRING_FIELD(access_method);
2266 COMPARE_NODE_FIELD(where_clause);
2267 COMPARE_NODE_FIELD(pktable);
2268 COMPARE_NODE_FIELD(fk_attrs);
2269 COMPARE_NODE_FIELD(pk_attrs);
2270 COMPARE_SCALAR_FIELD(fk_matchtype);
2271 COMPARE_SCALAR_FIELD(fk_upd_action);
2272 COMPARE_SCALAR_FIELD(fk_del_action);
2273 COMPARE_SCALAR_FIELD(skip_validation);
2274 COMPARE_SCALAR_FIELD(initially_valid);
2280 _equalDefElem(DefElem *a, DefElem *b)
2282 COMPARE_STRING_FIELD(defnamespace);
2283 COMPARE_STRING_FIELD(defname);
2284 COMPARE_NODE_FIELD(arg);
2285 COMPARE_SCALAR_FIELD(defaction);
2291 _equalLockingClause(LockingClause *a, LockingClause *b)
2293 COMPARE_NODE_FIELD(lockedRels);
2294 COMPARE_SCALAR_FIELD(forUpdate);
2295 COMPARE_SCALAR_FIELD(noWait);
2301 _equalRangeTblEntry(RangeTblEntry *a, RangeTblEntry *b)
2303 COMPARE_SCALAR_FIELD(rtekind);
2304 COMPARE_SCALAR_FIELD(relid);
2305 COMPARE_SCALAR_FIELD(relkind);
2306 COMPARE_NODE_FIELD(subquery);
2307 COMPARE_SCALAR_FIELD(jointype);
2308 COMPARE_NODE_FIELD(joinaliasvars);
2309 COMPARE_NODE_FIELD(funcexpr);
2310 COMPARE_NODE_FIELD(funccoltypes);
2311 COMPARE_NODE_FIELD(funccoltypmods);
2312 COMPARE_NODE_FIELD(funccolcollations);
2313 COMPARE_NODE_FIELD(values_lists);
2314 COMPARE_NODE_FIELD(values_collations);
2315 COMPARE_STRING_FIELD(ctename);
2316 COMPARE_SCALAR_FIELD(ctelevelsup);
2317 COMPARE_SCALAR_FIELD(self_reference);
2318 COMPARE_NODE_FIELD(ctecoltypes);
2319 COMPARE_NODE_FIELD(ctecoltypmods);
2320 COMPARE_NODE_FIELD(ctecolcollations);
2321 COMPARE_NODE_FIELD(alias);
2322 COMPARE_NODE_FIELD(eref);
2323 COMPARE_SCALAR_FIELD(inh);
2324 COMPARE_SCALAR_FIELD(inFromCl);
2325 COMPARE_SCALAR_FIELD(requiredPerms);
2326 COMPARE_SCALAR_FIELD(checkAsUser);
2327 COMPARE_BITMAPSET_FIELD(selectedCols);
2328 COMPARE_BITMAPSET_FIELD(modifiedCols);
2334 _equalSortGroupClause(SortGroupClause *a, SortGroupClause *b)
2336 COMPARE_SCALAR_FIELD(tleSortGroupRef);
2337 COMPARE_SCALAR_FIELD(eqop);
2338 COMPARE_SCALAR_FIELD(sortop);
2339 COMPARE_SCALAR_FIELD(nulls_first);
2340 COMPARE_SCALAR_FIELD(hashable);
2346 _equalWindowClause(WindowClause *a, WindowClause *b)
2348 COMPARE_STRING_FIELD(name);
2349 COMPARE_STRING_FIELD(refname);
2350 COMPARE_NODE_FIELD(partitionClause);
2351 COMPARE_NODE_FIELD(orderClause);
2352 COMPARE_SCALAR_FIELD(frameOptions);
2353 COMPARE_NODE_FIELD(startOffset);
2354 COMPARE_NODE_FIELD(endOffset);
2355 COMPARE_SCALAR_FIELD(winref);
2356 COMPARE_SCALAR_FIELD(copiedOrder);
2362 _equalRowMarkClause(RowMarkClause *a, RowMarkClause *b)
2364 COMPARE_SCALAR_FIELD(rti);
2365 COMPARE_SCALAR_FIELD(forUpdate);
2366 COMPARE_SCALAR_FIELD(noWait);
2367 COMPARE_SCALAR_FIELD(pushedDown);
2373 _equalWithClause(WithClause *a, WithClause *b)
2375 COMPARE_NODE_FIELD(ctes);
2376 COMPARE_SCALAR_FIELD(recursive);
2377 COMPARE_LOCATION_FIELD(location);
2383 _equalCommonTableExpr(CommonTableExpr *a, CommonTableExpr *b)
2385 COMPARE_STRING_FIELD(ctename);
2386 COMPARE_NODE_FIELD(aliascolnames);
2387 COMPARE_NODE_FIELD(ctequery);
2388 COMPARE_LOCATION_FIELD(location);
2389 COMPARE_SCALAR_FIELD(cterecursive);
2390 COMPARE_SCALAR_FIELD(cterefcount);
2391 COMPARE_NODE_FIELD(ctecolnames);
2392 COMPARE_NODE_FIELD(ctecoltypes);
2393 COMPARE_NODE_FIELD(ctecoltypmods);
2394 COMPARE_NODE_FIELD(ctecolcollations);
2400 _equalXmlSerialize(XmlSerialize *a, XmlSerialize *b)
2402 COMPARE_SCALAR_FIELD(xmloption);
2403 COMPARE_NODE_FIELD(expr);
2404 COMPARE_NODE_FIELD(typeName);
2405 COMPARE_LOCATION_FIELD(location);
2411 * Stuff from pg_list.h
2415 _equalList(List *a, List *b)
2421 * Try to reject by simple scalar checks before grovelling through all the
2424 COMPARE_SCALAR_FIELD(type);
2425 COMPARE_SCALAR_FIELD(length);
2428 * We place the switch outside the loop for the sake of efficiency; this
2429 * may not be worth doing...
2434 forboth(item_a, a, item_b, b)
2436 if (!equal(lfirst(item_a), lfirst(item_b)))
2441 forboth(item_a, a, item_b, b)
2443 if (lfirst_int(item_a) != lfirst_int(item_b))
2448 forboth(item_a, a, item_b, b)
2450 if (lfirst_oid(item_a) != lfirst_oid(item_b))
2455 elog(ERROR, "unrecognized list node type: %d",
2457 return false; /* keep compiler quiet */
2461 * If we got here, we should have run out of elements of both lists
2463 Assert(item_a == NULL);
2464 Assert(item_b == NULL);
2470 * Stuff from value.h
2474 _equalValue(Value *a, Value *b)
2476 COMPARE_SCALAR_FIELD(type);
2481 COMPARE_SCALAR_FIELD(val.ival);
2486 COMPARE_STRING_FIELD(val.str);
2492 elog(ERROR, "unrecognized node type: %d", (int) a->type);
2501 * returns whether two nodes are equal
2504 equal(void *a, void *b)
2512 * note that a!=b, so only one of them can be NULL
2514 if (a == NULL || b == NULL)
2518 * are they the same type of nodes?
2520 if (nodeTag(a) != nodeTag(b))
2529 retval = _equalAlias(a, b);
2532 retval = _equalRangeVar(a, b);
2535 retval = _equalIntoClause(a, b);
2538 retval = _equalVar(a, b);
2541 retval = _equalConst(a, b);
2544 retval = _equalParam(a, b);
2547 retval = _equalAggref(a, b);
2550 retval = _equalWindowFunc(a, b);
2553 retval = _equalArrayRef(a, b);
2556 retval = _equalFuncExpr(a, b);
2558 case T_NamedArgExpr:
2559 retval = _equalNamedArgExpr(a, b);
2562 retval = _equalOpExpr(a, b);
2564 case T_DistinctExpr:
2565 retval = _equalDistinctExpr(a, b);
2568 retval = _equalNullIfExpr(a, b);
2570 case T_ScalarArrayOpExpr:
2571 retval = _equalScalarArrayOpExpr(a, b);
2574 retval = _equalBoolExpr(a, b);
2577 retval = _equalSubLink(a, b);
2580 retval = _equalSubPlan(a, b);
2582 case T_AlternativeSubPlan:
2583 retval = _equalAlternativeSubPlan(a, b);
2586 retval = _equalFieldSelect(a, b);
2589 retval = _equalFieldStore(a, b);
2592 retval = _equalRelabelType(a, b);
2595 retval = _equalCoerceViaIO(a, b);
2597 case T_ArrayCoerceExpr:
2598 retval = _equalArrayCoerceExpr(a, b);
2600 case T_ConvertRowtypeExpr:
2601 retval = _equalConvertRowtypeExpr(a, b);
2604 retval = _equalCollateExpr(a, b);
2607 retval = _equalCaseExpr(a, b);
2610 retval = _equalCaseWhen(a, b);
2612 case T_CaseTestExpr:
2613 retval = _equalCaseTestExpr(a, b);
2616 retval = _equalArrayExpr(a, b);
2619 retval = _equalRowExpr(a, b);
2621 case T_RowCompareExpr:
2622 retval = _equalRowCompareExpr(a, b);
2624 case T_CoalesceExpr:
2625 retval = _equalCoalesceExpr(a, b);
2628 retval = _equalMinMaxExpr(a, b);
2631 retval = _equalXmlExpr(a, b);
2634 retval = _equalNullTest(a, b);
2637 retval = _equalBooleanTest(a, b);
2639 case T_CoerceToDomain:
2640 retval = _equalCoerceToDomain(a, b);
2642 case T_CoerceToDomainValue:
2643 retval = _equalCoerceToDomainValue(a, b);
2645 case T_SetToDefault:
2646 retval = _equalSetToDefault(a, b);
2648 case T_CurrentOfExpr:
2649 retval = _equalCurrentOfExpr(a, b);
2652 retval = _equalTargetEntry(a, b);
2655 retval = _equalRangeTblRef(a, b);
2658 retval = _equalFromExpr(a, b);
2661 retval = _equalJoinExpr(a, b);
2668 retval = _equalPathKey(a, b);
2670 case T_RestrictInfo:
2671 retval = _equalRestrictInfo(a, b);
2673 case T_PlaceHolderVar:
2674 retval = _equalPlaceHolderVar(a, b);
2676 case T_SpecialJoinInfo:
2677 retval = _equalSpecialJoinInfo(a, b);
2679 case T_AppendRelInfo:
2680 retval = _equalAppendRelInfo(a, b);
2682 case T_PlaceHolderInfo:
2683 retval = _equalPlaceHolderInfo(a, b);
2689 retval = _equalList(a, b);
2697 retval = _equalValue(a, b);
2704 retval = _equalQuery(a, b);
2707 retval = _equalInsertStmt(a, b);
2710 retval = _equalDeleteStmt(a, b);
2713 retval = _equalUpdateStmt(a, b);
2716 retval = _equalSelectStmt(a, b);
2718 case T_SetOperationStmt:
2719 retval = _equalSetOperationStmt(a, b);
2721 case T_AlterTableStmt:
2722 retval = _equalAlterTableStmt(a, b);
2724 case T_AlterTableCmd:
2725 retval = _equalAlterTableCmd(a, b);
2727 case T_AlterDomainStmt:
2728 retval = _equalAlterDomainStmt(a, b);
2731 retval = _equalGrantStmt(a, b);
2733 case T_GrantRoleStmt:
2734 retval = _equalGrantRoleStmt(a, b);
2736 case T_AlterDefaultPrivilegesStmt:
2737 retval = _equalAlterDefaultPrivilegesStmt(a, b);
2739 case T_DeclareCursorStmt:
2740 retval = _equalDeclareCursorStmt(a, b);
2742 case T_ClosePortalStmt:
2743 retval = _equalClosePortalStmt(a, b);
2746 retval = _equalClusterStmt(a, b);
2749 retval = _equalCopyStmt(a, b);
2752 retval = _equalCreateStmt(a, b);
2755 retval = _equalInhRelation(a, b);
2758 retval = _equalDefineStmt(a, b);
2761 retval = _equalDropStmt(a, b);
2763 case T_TruncateStmt:
2764 retval = _equalTruncateStmt(a, b);
2767 retval = _equalCommentStmt(a, b);
2769 case T_SecLabelStmt:
2770 retval = _equalSecLabelStmt(a, b);
2773 retval = _equalFetchStmt(a, b);
2776 retval = _equalIndexStmt(a, b);
2778 case T_CreateFunctionStmt:
2779 retval = _equalCreateFunctionStmt(a, b);
2781 case T_FunctionParameter:
2782 retval = _equalFunctionParameter(a, b);
2784 case T_AlterFunctionStmt:
2785 retval = _equalAlterFunctionStmt(a, b);
2787 case T_RemoveFuncStmt:
2788 retval = _equalRemoveFuncStmt(a, b);
2791 retval = _equalDoStmt(a, b);
2793 case T_RemoveOpClassStmt:
2794 retval = _equalRemoveOpClassStmt(a, b);
2796 case T_RemoveOpFamilyStmt:
2797 retval = _equalRemoveOpFamilyStmt(a, b);
2800 retval = _equalRenameStmt(a, b);
2802 case T_AlterObjectSchemaStmt:
2803 retval = _equalAlterObjectSchemaStmt(a, b);
2805 case T_AlterOwnerStmt:
2806 retval = _equalAlterOwnerStmt(a, b);
2809 retval = _equalRuleStmt(a, b);
2812 retval = _equalNotifyStmt(a, b);
2815 retval = _equalListenStmt(a, b);
2817 case T_UnlistenStmt:
2818 retval = _equalUnlistenStmt(a, b);
2820 case T_TransactionStmt:
2821 retval = _equalTransactionStmt(a, b);
2823 case T_CompositeTypeStmt:
2824 retval = _equalCompositeTypeStmt(a, b);
2826 case T_CreateEnumStmt:
2827 retval = _equalCreateEnumStmt(a, b);
2829 case T_AlterEnumStmt:
2830 retval = _equalAlterEnumStmt(a, b);
2833 retval = _equalViewStmt(a, b);
2836 retval = _equalLoadStmt(a, b);
2838 case T_CreateDomainStmt:
2839 retval = _equalCreateDomainStmt(a, b);
2841 case T_CreateOpClassStmt:
2842 retval = _equalCreateOpClassStmt(a, b);
2844 case T_CreateOpClassItem:
2845 retval = _equalCreateOpClassItem(a, b);
2847 case T_CreateOpFamilyStmt:
2848 retval = _equalCreateOpFamilyStmt(a, b);
2850 case T_AlterOpFamilyStmt:
2851 retval = _equalAlterOpFamilyStmt(a, b);
2853 case T_CreatedbStmt:
2854 retval = _equalCreatedbStmt(a, b);
2856 case T_AlterDatabaseStmt:
2857 retval = _equalAlterDatabaseStmt(a, b);
2859 case T_AlterDatabaseSetStmt:
2860 retval = _equalAlterDatabaseSetStmt(a, b);
2863 retval = _equalDropdbStmt(a, b);
2866 retval = _equalVacuumStmt(a, b);
2869 retval = _equalExplainStmt(a, b);
2871 case T_CreateSeqStmt:
2872 retval = _equalCreateSeqStmt(a, b);
2874 case T_AlterSeqStmt:
2875 retval = _equalAlterSeqStmt(a, b);
2877 case T_VariableSetStmt:
2878 retval = _equalVariableSetStmt(a, b);
2880 case T_VariableShowStmt:
2881 retval = _equalVariableShowStmt(a, b);
2884 retval = _equalDiscardStmt(a, b);
2886 case T_CreateTableSpaceStmt:
2887 retval = _equalCreateTableSpaceStmt(a, b);
2889 case T_DropTableSpaceStmt:
2890 retval = _equalDropTableSpaceStmt(a, b);
2892 case T_AlterTableSpaceOptionsStmt:
2893 retval = _equalAlterTableSpaceOptionsStmt(a, b);
2895 case T_CreateExtensionStmt:
2896 retval = _equalCreateExtensionStmt(a, b);
2898 case T_AlterExtensionStmt:
2899 retval = _equalAlterExtensionStmt(a, b);
2901 case T_AlterExtensionContentsStmt:
2902 retval = _equalAlterExtensionContentsStmt(a, b);
2904 case T_CreateFdwStmt:
2905 retval = _equalCreateFdwStmt(a, b);
2907 case T_AlterFdwStmt:
2908 retval = _equalAlterFdwStmt(a, b);
2911 retval = _equalDropFdwStmt(a, b);
2913 case T_CreateForeignServerStmt:
2914 retval = _equalCreateForeignServerStmt(a, b);
2916 case T_AlterForeignServerStmt:
2917 retval = _equalAlterForeignServerStmt(a, b);
2919 case T_DropForeignServerStmt:
2920 retval = _equalDropForeignServerStmt(a, b);
2922 case T_CreateUserMappingStmt:
2923 retval = _equalCreateUserMappingStmt(a, b);
2925 case T_AlterUserMappingStmt:
2926 retval = _equalAlterUserMappingStmt(a, b);
2928 case T_DropUserMappingStmt:
2929 retval = _equalDropUserMappingStmt(a, b);
2931 case T_CreateForeignTableStmt:
2932 retval = _equalCreateForeignTableStmt(a, b);
2934 case T_CreateTrigStmt:
2935 retval = _equalCreateTrigStmt(a, b);
2937 case T_DropPropertyStmt:
2938 retval = _equalDropPropertyStmt(a, b);
2940 case T_CreatePLangStmt:
2941 retval = _equalCreatePLangStmt(a, b);
2943 case T_DropPLangStmt:
2944 retval = _equalDropPLangStmt(a, b);
2946 case T_CreateRoleStmt:
2947 retval = _equalCreateRoleStmt(a, b);
2949 case T_AlterRoleStmt:
2950 retval = _equalAlterRoleStmt(a, b);
2952 case T_AlterRoleSetStmt:
2953 retval = _equalAlterRoleSetStmt(a, b);
2955 case T_DropRoleStmt:
2956 retval = _equalDropRoleStmt(a, b);
2959 retval = _equalLockStmt(a, b);
2961 case T_ConstraintsSetStmt:
2962 retval = _equalConstraintsSetStmt(a, b);
2965 retval = _equalReindexStmt(a, b);
2967 case T_CheckPointStmt:
2970 case T_CreateSchemaStmt:
2971 retval = _equalCreateSchemaStmt(a, b);
2973 case T_CreateConversionStmt:
2974 retval = _equalCreateConversionStmt(a, b);
2976 case T_CreateCastStmt:
2977 retval = _equalCreateCastStmt(a, b);
2979 case T_DropCastStmt:
2980 retval = _equalDropCastStmt(a, b);
2983 retval = _equalPrepareStmt(a, b);
2986 retval = _equalExecuteStmt(a, b);
2988 case T_DeallocateStmt:
2989 retval = _equalDeallocateStmt(a, b);
2991 case T_DropOwnedStmt:
2992 retval = _equalDropOwnedStmt(a, b);
2994 case T_ReassignOwnedStmt:
2995 retval = _equalReassignOwnedStmt(a, b);
2997 case T_AlterTSDictionaryStmt:
2998 retval = _equalAlterTSDictionaryStmt(a, b);
3000 case T_AlterTSConfigurationStmt:
3001 retval = _equalAlterTSConfigurationStmt(a, b);
3005 retval = _equalAExpr(a, b);
3008 retval = _equalColumnRef(a, b);
3011 retval = _equalParamRef(a, b);
3014 retval = _equalAConst(a, b);
3017 retval = _equalFuncCall(a, b);
3020 retval = _equalAStar(a, b);
3023 retval = _equalAIndices(a, b);
3025 case T_A_Indirection:
3026 retval = _equalA_Indirection(a, b);
3029 retval = _equalA_ArrayExpr(a, b);
3032 retval = _equalResTarget(a, b);
3035 retval = _equalTypeCast(a, b);
3037 case T_CollateClause:
3038 retval = _equalCollateClause(a, b);
3041 retval = _equalSortBy(a, b);
3044 retval = _equalWindowDef(a, b);
3046 case T_RangeSubselect:
3047 retval = _equalRangeSubselect(a, b);
3049 case T_RangeFunction:
3050 retval = _equalRangeFunction(a, b);
3053 retval = _equalTypeName(a, b);
3056 retval = _equalIndexElem(a, b);
3059 retval = _equalColumnDef(a, b);
3062 retval = _equalConstraint(a, b);
3065 retval = _equalDefElem(a, b);
3067 case T_LockingClause:
3068 retval = _equalLockingClause(a, b);
3070 case T_RangeTblEntry:
3071 retval = _equalRangeTblEntry(a, b);
3073 case T_SortGroupClause:
3074 retval = _equalSortGroupClause(a, b);
3076 case T_WindowClause:
3077 retval = _equalWindowClause(a, b);
3079 case T_RowMarkClause:
3080 retval = _equalRowMarkClause(a, b);
3083 retval = _equalWithClause(a, b);
3085 case T_CommonTableExpr:
3086 retval = _equalCommonTableExpr(a, b);
3089 retval = _equalPrivGrantee(a, b);
3091 case T_FuncWithArgs:
3092 retval = _equalFuncWithArgs(a, b);
3095 retval = _equalAccessPriv(a, b);
3097 case T_XmlSerialize:
3098 retval = _equalXmlSerialize(a, b);
3102 elog(ERROR, "unrecognized node type: %d",
3104 retval = false; /* keep compiler quiet */