Header And Logo

PostgreSQL
| The world's most advanced open source database.

equalfuncs.c

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * equalfuncs.c
00004  *    Equality functions to compare node trees.
00005  *
00006  * NOTE: we currently support comparing all node types found in parse
00007  * trees.  We do not support comparing executor state trees; there
00008  * is no need for that, and no point in maintaining all the code that
00009  * would be needed.  We also do not support comparing Path trees, mainly
00010  * because the circular linkages between RelOptInfo and Path nodes can't
00011  * be handled easily in a simple depth-first traversal.
00012  *
00013  * Currently, in fact, equal() doesn't know how to compare Plan trees
00014  * either.  This might need to be fixed someday.
00015  *
00016  * NOTE: it is intentional that parse location fields (in nodes that have
00017  * one) are not compared.  This is because we want, for example, a variable
00018  * "x" to be considered equal() to another reference to "x" in the query.
00019  *
00020  *
00021  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00022  * Portions Copyright (c) 1994, Regents of the University of California
00023  *
00024  * IDENTIFICATION
00025  *    src/backend/nodes/equalfuncs.c
00026  *
00027  *-------------------------------------------------------------------------
00028  */
00029 
00030 #include "postgres.h"
00031 
00032 #include "nodes/relation.h"
00033 #include "utils/datum.h"
00034 
00035 
00036 /*
00037  * Macros to simplify comparison of different kinds of fields.  Use these
00038  * wherever possible to reduce the chance for silly typos.  Note that these
00039  * hard-wire the convention that the local variables in an Equal routine are
00040  * named 'a' and 'b'.
00041  */
00042 
00043 /* Compare a simple scalar field (int, float, bool, enum, etc) */
00044 #define COMPARE_SCALAR_FIELD(fldname) \
00045     do { \
00046         if (a->fldname != b->fldname) \
00047             return false; \
00048     } while (0)
00049 
00050 /* Compare a field that is a pointer to some kind of Node or Node tree */
00051 #define COMPARE_NODE_FIELD(fldname) \
00052     do { \
00053         if (!equal(a->fldname, b->fldname)) \
00054             return false; \
00055     } while (0)
00056 
00057 /* Compare a field that is a pointer to a Bitmapset */
00058 #define COMPARE_BITMAPSET_FIELD(fldname) \
00059     do { \
00060         if (!bms_equal(a->fldname, b->fldname)) \
00061             return false; \
00062     } while (0)
00063 
00064 /* Compare a field that is a pointer to a C string, or perhaps NULL */
00065 #define COMPARE_STRING_FIELD(fldname) \
00066     do { \
00067         if (!equalstr(a->fldname, b->fldname)) \
00068             return false; \
00069     } while (0)
00070 
00071 /* Macro for comparing string fields that might be NULL */
00072 #define equalstr(a, b)  \
00073     (((a) != NULL && (b) != NULL) ? (strcmp(a, b) == 0) : (a) == (b))
00074 
00075 /* Compare a field that is a pointer to a simple palloc'd object of size sz */
00076 #define COMPARE_POINTER_FIELD(fldname, sz) \
00077     do { \
00078         if (memcmp(a->fldname, b->fldname, (sz)) != 0) \
00079             return false; \
00080     } while (0)
00081 
00082 /* Compare a parse location field (this is a no-op, per note above) */
00083 #define COMPARE_LOCATION_FIELD(fldname) \
00084     ((void) 0)
00085 
00086 /* Compare a CoercionForm field (also a no-op, per comment in primnodes.h) */
00087 #define COMPARE_COERCIONFORM_FIELD(fldname) \
00088     ((void) 0)
00089 
00090 
00091 /*
00092  *  Stuff from primnodes.h
00093  */
00094 
00095 static bool
00096 _equalAlias(const Alias *a, const Alias *b)
00097 {
00098     COMPARE_STRING_FIELD(aliasname);
00099     COMPARE_NODE_FIELD(colnames);
00100 
00101     return true;
00102 }
00103 
00104 static bool
00105 _equalRangeVar(const RangeVar *a, const RangeVar *b)
00106 {
00107     COMPARE_STRING_FIELD(catalogname);
00108     COMPARE_STRING_FIELD(schemaname);
00109     COMPARE_STRING_FIELD(relname);
00110     COMPARE_SCALAR_FIELD(inhOpt);
00111     COMPARE_SCALAR_FIELD(relpersistence);
00112     COMPARE_NODE_FIELD(alias);
00113     COMPARE_LOCATION_FIELD(location);
00114 
00115     return true;
00116 }
00117 
00118 static bool
00119 _equalIntoClause(const IntoClause *a, const IntoClause *b)
00120 {
00121     COMPARE_NODE_FIELD(rel);
00122     COMPARE_NODE_FIELD(colNames);
00123     COMPARE_NODE_FIELD(options);
00124     COMPARE_SCALAR_FIELD(onCommit);
00125     COMPARE_STRING_FIELD(tableSpaceName);
00126     COMPARE_NODE_FIELD(viewQuery);
00127     COMPARE_SCALAR_FIELD(skipData);
00128 
00129     return true;
00130 }
00131 
00132 /*
00133  * We don't need an _equalExpr because Expr is an abstract supertype which
00134  * should never actually get instantiated.  Also, since it has no common
00135  * fields except NodeTag, there's no need for a helper routine to factor
00136  * out comparing the common fields...
00137  */
00138 
00139 static bool
00140 _equalVar(const Var *a, const Var *b)
00141 {
00142     COMPARE_SCALAR_FIELD(varno);
00143     COMPARE_SCALAR_FIELD(varattno);
00144     COMPARE_SCALAR_FIELD(vartype);
00145     COMPARE_SCALAR_FIELD(vartypmod);
00146     COMPARE_SCALAR_FIELD(varcollid);
00147     COMPARE_SCALAR_FIELD(varlevelsup);
00148     COMPARE_SCALAR_FIELD(varnoold);
00149     COMPARE_SCALAR_FIELD(varoattno);
00150     COMPARE_LOCATION_FIELD(location);
00151 
00152     return true;
00153 }
00154 
00155 static bool
00156 _equalConst(const Const *a, const Const *b)
00157 {
00158     COMPARE_SCALAR_FIELD(consttype);
00159     COMPARE_SCALAR_FIELD(consttypmod);
00160     COMPARE_SCALAR_FIELD(constcollid);
00161     COMPARE_SCALAR_FIELD(constlen);
00162     COMPARE_SCALAR_FIELD(constisnull);
00163     COMPARE_SCALAR_FIELD(constbyval);
00164     COMPARE_LOCATION_FIELD(location);
00165 
00166     /*
00167      * We treat all NULL constants of the same type as equal. Someday this
00168      * might need to change?  But datumIsEqual doesn't work on nulls, so...
00169      */
00170     if (a->constisnull)
00171         return true;
00172     return datumIsEqual(a->constvalue, b->constvalue,
00173                         a->constbyval, a->constlen);
00174 }
00175 
00176 static bool
00177 _equalParam(const Param *a, const Param *b)
00178 {
00179     COMPARE_SCALAR_FIELD(paramkind);
00180     COMPARE_SCALAR_FIELD(paramid);
00181     COMPARE_SCALAR_FIELD(paramtype);
00182     COMPARE_SCALAR_FIELD(paramtypmod);
00183     COMPARE_SCALAR_FIELD(paramcollid);
00184     COMPARE_LOCATION_FIELD(location);
00185 
00186     return true;
00187 }
00188 
00189 static bool
00190 _equalAggref(const Aggref *a, const Aggref *b)
00191 {
00192     COMPARE_SCALAR_FIELD(aggfnoid);
00193     COMPARE_SCALAR_FIELD(aggtype);
00194     COMPARE_SCALAR_FIELD(aggcollid);
00195     COMPARE_SCALAR_FIELD(inputcollid);
00196     COMPARE_NODE_FIELD(args);
00197     COMPARE_NODE_FIELD(aggorder);
00198     COMPARE_NODE_FIELD(aggdistinct);
00199     COMPARE_SCALAR_FIELD(aggstar);
00200     COMPARE_SCALAR_FIELD(agglevelsup);
00201     COMPARE_LOCATION_FIELD(location);
00202 
00203     return true;
00204 }
00205 
00206 static bool
00207 _equalWindowFunc(const WindowFunc *a, const WindowFunc *b)
00208 {
00209     COMPARE_SCALAR_FIELD(winfnoid);
00210     COMPARE_SCALAR_FIELD(wintype);
00211     COMPARE_SCALAR_FIELD(wincollid);
00212     COMPARE_SCALAR_FIELD(inputcollid);
00213     COMPARE_NODE_FIELD(args);
00214     COMPARE_SCALAR_FIELD(winref);
00215     COMPARE_SCALAR_FIELD(winstar);
00216     COMPARE_SCALAR_FIELD(winagg);
00217     COMPARE_LOCATION_FIELD(location);
00218 
00219     return true;
00220 }
00221 
00222 static bool
00223 _equalArrayRef(const ArrayRef *a, const ArrayRef *b)
00224 {
00225     COMPARE_SCALAR_FIELD(refarraytype);
00226     COMPARE_SCALAR_FIELD(refelemtype);
00227     COMPARE_SCALAR_FIELD(reftypmod);
00228     COMPARE_SCALAR_FIELD(refcollid);
00229     COMPARE_NODE_FIELD(refupperindexpr);
00230     COMPARE_NODE_FIELD(reflowerindexpr);
00231     COMPARE_NODE_FIELD(refexpr);
00232     COMPARE_NODE_FIELD(refassgnexpr);
00233 
00234     return true;
00235 }
00236 
00237 static bool
00238 _equalFuncExpr(const FuncExpr *a, const FuncExpr *b)
00239 {
00240     COMPARE_SCALAR_FIELD(funcid);
00241     COMPARE_SCALAR_FIELD(funcresulttype);
00242     COMPARE_SCALAR_FIELD(funcretset);
00243     COMPARE_SCALAR_FIELD(funcvariadic);
00244     COMPARE_COERCIONFORM_FIELD(funcformat);
00245     COMPARE_SCALAR_FIELD(funccollid);
00246     COMPARE_SCALAR_FIELD(inputcollid);
00247     COMPARE_NODE_FIELD(args);
00248     COMPARE_LOCATION_FIELD(location);
00249 
00250     return true;
00251 }
00252 
00253 static bool
00254 _equalNamedArgExpr(const NamedArgExpr *a, const NamedArgExpr *b)
00255 {
00256     COMPARE_NODE_FIELD(arg);
00257     COMPARE_STRING_FIELD(name);
00258     COMPARE_SCALAR_FIELD(argnumber);
00259     COMPARE_LOCATION_FIELD(location);
00260 
00261     return true;
00262 }
00263 
00264 static bool
00265 _equalOpExpr(const OpExpr *a, const OpExpr *b)
00266 {
00267     COMPARE_SCALAR_FIELD(opno);
00268 
00269     /*
00270      * Special-case opfuncid: it is allowable for it to differ if one node
00271      * contains zero and the other doesn't.  This just means that the one node
00272      * isn't as far along in the parse/plan pipeline and hasn't had the
00273      * opfuncid cache filled yet.
00274      */
00275     if (a->opfuncid != b->opfuncid &&
00276         a->opfuncid != 0 &&
00277         b->opfuncid != 0)
00278         return false;
00279 
00280     COMPARE_SCALAR_FIELD(opresulttype);
00281     COMPARE_SCALAR_FIELD(opretset);
00282     COMPARE_SCALAR_FIELD(opcollid);
00283     COMPARE_SCALAR_FIELD(inputcollid);
00284     COMPARE_NODE_FIELD(args);
00285     COMPARE_LOCATION_FIELD(location);
00286 
00287     return true;
00288 }
00289 
00290 static bool
00291 _equalDistinctExpr(const DistinctExpr *a, const DistinctExpr *b)
00292 {
00293     COMPARE_SCALAR_FIELD(opno);
00294 
00295     /*
00296      * Special-case opfuncid: it is allowable for it to differ if one node
00297      * contains zero and the other doesn't.  This just means that the one node
00298      * isn't as far along in the parse/plan pipeline and hasn't had the
00299      * opfuncid cache filled yet.
00300      */
00301     if (a->opfuncid != b->opfuncid &&
00302         a->opfuncid != 0 &&
00303         b->opfuncid != 0)
00304         return false;
00305 
00306     COMPARE_SCALAR_FIELD(opresulttype);
00307     COMPARE_SCALAR_FIELD(opretset);
00308     COMPARE_SCALAR_FIELD(opcollid);
00309     COMPARE_SCALAR_FIELD(inputcollid);
00310     COMPARE_NODE_FIELD(args);
00311     COMPARE_LOCATION_FIELD(location);
00312 
00313     return true;
00314 }
00315 
00316 static bool
00317 _equalNullIfExpr(const NullIfExpr *a, const NullIfExpr *b)
00318 {
00319     COMPARE_SCALAR_FIELD(opno);
00320 
00321     /*
00322      * Special-case opfuncid: it is allowable for it to differ if one node
00323      * contains zero and the other doesn't.  This just means that the one node
00324      * isn't as far along in the parse/plan pipeline and hasn't had the
00325      * opfuncid cache filled yet.
00326      */
00327     if (a->opfuncid != b->opfuncid &&
00328         a->opfuncid != 0 &&
00329         b->opfuncid != 0)
00330         return false;
00331 
00332     COMPARE_SCALAR_FIELD(opresulttype);
00333     COMPARE_SCALAR_FIELD(opretset);
00334     COMPARE_SCALAR_FIELD(opcollid);
00335     COMPARE_SCALAR_FIELD(inputcollid);
00336     COMPARE_NODE_FIELD(args);
00337     COMPARE_LOCATION_FIELD(location);
00338 
00339     return true;
00340 }
00341 
00342 static bool
00343 _equalScalarArrayOpExpr(const ScalarArrayOpExpr *a, const ScalarArrayOpExpr *b)
00344 {
00345     COMPARE_SCALAR_FIELD(opno);
00346 
00347     /*
00348      * Special-case opfuncid: it is allowable for it to differ if one node
00349      * contains zero and the other doesn't.  This just means that the one node
00350      * isn't as far along in the parse/plan pipeline and hasn't had the
00351      * opfuncid cache filled yet.
00352      */
00353     if (a->opfuncid != b->opfuncid &&
00354         a->opfuncid != 0 &&
00355         b->opfuncid != 0)
00356         return false;
00357 
00358     COMPARE_SCALAR_FIELD(useOr);
00359     COMPARE_SCALAR_FIELD(inputcollid);
00360     COMPARE_NODE_FIELD(args);
00361     COMPARE_LOCATION_FIELD(location);
00362 
00363     return true;
00364 }
00365 
00366 static bool
00367 _equalBoolExpr(const BoolExpr *a, const BoolExpr *b)
00368 {
00369     COMPARE_SCALAR_FIELD(boolop);
00370     COMPARE_NODE_FIELD(args);
00371     COMPARE_LOCATION_FIELD(location);
00372 
00373     return true;
00374 }
00375 
00376 static bool
00377 _equalSubLink(const SubLink *a, const SubLink *b)
00378 {
00379     COMPARE_SCALAR_FIELD(subLinkType);
00380     COMPARE_NODE_FIELD(testexpr);
00381     COMPARE_NODE_FIELD(operName);
00382     COMPARE_NODE_FIELD(subselect);
00383     COMPARE_LOCATION_FIELD(location);
00384 
00385     return true;
00386 }
00387 
00388 static bool
00389 _equalSubPlan(const SubPlan *a, const SubPlan *b)
00390 {
00391     COMPARE_SCALAR_FIELD(subLinkType);
00392     COMPARE_NODE_FIELD(testexpr);
00393     COMPARE_NODE_FIELD(paramIds);
00394     COMPARE_SCALAR_FIELD(plan_id);
00395     COMPARE_STRING_FIELD(plan_name);
00396     COMPARE_SCALAR_FIELD(firstColType);
00397     COMPARE_SCALAR_FIELD(firstColTypmod);
00398     COMPARE_SCALAR_FIELD(firstColCollation);
00399     COMPARE_SCALAR_FIELD(useHashTable);
00400     COMPARE_SCALAR_FIELD(unknownEqFalse);
00401     COMPARE_NODE_FIELD(setParam);
00402     COMPARE_NODE_FIELD(parParam);
00403     COMPARE_NODE_FIELD(args);
00404     COMPARE_SCALAR_FIELD(startup_cost);
00405     COMPARE_SCALAR_FIELD(per_call_cost);
00406 
00407     return true;
00408 }
00409 
00410 static bool
00411 _equalAlternativeSubPlan(const AlternativeSubPlan *a, const AlternativeSubPlan *b)
00412 {
00413     COMPARE_NODE_FIELD(subplans);
00414 
00415     return true;
00416 }
00417 
00418 static bool
00419 _equalFieldSelect(const FieldSelect *a, const FieldSelect *b)
00420 {
00421     COMPARE_NODE_FIELD(arg);
00422     COMPARE_SCALAR_FIELD(fieldnum);
00423     COMPARE_SCALAR_FIELD(resulttype);
00424     COMPARE_SCALAR_FIELD(resulttypmod);
00425     COMPARE_SCALAR_FIELD(resultcollid);
00426 
00427     return true;
00428 }
00429 
00430 static bool
00431 _equalFieldStore(const FieldStore *a, const FieldStore *b)
00432 {
00433     COMPARE_NODE_FIELD(arg);
00434     COMPARE_NODE_FIELD(newvals);
00435     COMPARE_NODE_FIELD(fieldnums);
00436     COMPARE_SCALAR_FIELD(resulttype);
00437 
00438     return true;
00439 }
00440 
00441 static bool
00442 _equalRelabelType(const RelabelType *a, const RelabelType *b)
00443 {
00444     COMPARE_NODE_FIELD(arg);
00445     COMPARE_SCALAR_FIELD(resulttype);
00446     COMPARE_SCALAR_FIELD(resulttypmod);
00447     COMPARE_SCALAR_FIELD(resultcollid);
00448     COMPARE_COERCIONFORM_FIELD(relabelformat);
00449     COMPARE_LOCATION_FIELD(location);
00450 
00451     return true;
00452 }
00453 
00454 static bool
00455 _equalCoerceViaIO(const CoerceViaIO *a, const CoerceViaIO *b)
00456 {
00457     COMPARE_NODE_FIELD(arg);
00458     COMPARE_SCALAR_FIELD(resulttype);
00459     COMPARE_SCALAR_FIELD(resultcollid);
00460     COMPARE_COERCIONFORM_FIELD(coerceformat);
00461     COMPARE_LOCATION_FIELD(location);
00462 
00463     return true;
00464 }
00465 
00466 static bool
00467 _equalArrayCoerceExpr(const ArrayCoerceExpr *a, const ArrayCoerceExpr *b)
00468 {
00469     COMPARE_NODE_FIELD(arg);
00470     COMPARE_SCALAR_FIELD(elemfuncid);
00471     COMPARE_SCALAR_FIELD(resulttype);
00472     COMPARE_SCALAR_FIELD(resulttypmod);
00473     COMPARE_SCALAR_FIELD(resultcollid);
00474     COMPARE_SCALAR_FIELD(isExplicit);
00475     COMPARE_COERCIONFORM_FIELD(coerceformat);
00476     COMPARE_LOCATION_FIELD(location);
00477 
00478     return true;
00479 }
00480 
00481 static bool
00482 _equalConvertRowtypeExpr(const ConvertRowtypeExpr *a, const ConvertRowtypeExpr *b)
00483 {
00484     COMPARE_NODE_FIELD(arg);
00485     COMPARE_SCALAR_FIELD(resulttype);
00486     COMPARE_COERCIONFORM_FIELD(convertformat);
00487     COMPARE_LOCATION_FIELD(location);
00488 
00489     return true;
00490 }
00491 
00492 static bool
00493 _equalCollateExpr(const CollateExpr *a, const CollateExpr *b)
00494 {
00495     COMPARE_NODE_FIELD(arg);
00496     COMPARE_SCALAR_FIELD(collOid);
00497     COMPARE_LOCATION_FIELD(location);
00498 
00499     return true;
00500 }
00501 
00502 static bool
00503 _equalCaseExpr(const CaseExpr *a, const CaseExpr *b)
00504 {
00505     COMPARE_SCALAR_FIELD(casetype);
00506     COMPARE_SCALAR_FIELD(casecollid);
00507     COMPARE_NODE_FIELD(arg);
00508     COMPARE_NODE_FIELD(args);
00509     COMPARE_NODE_FIELD(defresult);
00510     COMPARE_LOCATION_FIELD(location);
00511 
00512     return true;
00513 }
00514 
00515 static bool
00516 _equalCaseWhen(const CaseWhen *a, const CaseWhen *b)
00517 {
00518     COMPARE_NODE_FIELD(expr);
00519     COMPARE_NODE_FIELD(result);
00520     COMPARE_LOCATION_FIELD(location);
00521 
00522     return true;
00523 }
00524 
00525 static bool
00526 _equalCaseTestExpr(const CaseTestExpr *a, const CaseTestExpr *b)
00527 {
00528     COMPARE_SCALAR_FIELD(typeId);
00529     COMPARE_SCALAR_FIELD(typeMod);
00530     COMPARE_SCALAR_FIELD(collation);
00531 
00532     return true;
00533 }
00534 
00535 static bool
00536 _equalArrayExpr(const ArrayExpr *a, const ArrayExpr *b)
00537 {
00538     COMPARE_SCALAR_FIELD(array_typeid);
00539     COMPARE_SCALAR_FIELD(array_collid);
00540     COMPARE_SCALAR_FIELD(element_typeid);
00541     COMPARE_NODE_FIELD(elements);
00542     COMPARE_SCALAR_FIELD(multidims);
00543     COMPARE_LOCATION_FIELD(location);
00544 
00545     return true;
00546 }
00547 
00548 static bool
00549 _equalRowExpr(const RowExpr *a, const RowExpr *b)
00550 {
00551     COMPARE_NODE_FIELD(args);
00552     COMPARE_SCALAR_FIELD(row_typeid);
00553     COMPARE_COERCIONFORM_FIELD(row_format);
00554     COMPARE_NODE_FIELD(colnames);
00555     COMPARE_LOCATION_FIELD(location);
00556 
00557     return true;
00558 }
00559 
00560 static bool
00561 _equalRowCompareExpr(const RowCompareExpr *a, const RowCompareExpr *b)
00562 {
00563     COMPARE_SCALAR_FIELD(rctype);
00564     COMPARE_NODE_FIELD(opnos);
00565     COMPARE_NODE_FIELD(opfamilies);
00566     COMPARE_NODE_FIELD(inputcollids);
00567     COMPARE_NODE_FIELD(largs);
00568     COMPARE_NODE_FIELD(rargs);
00569 
00570     return true;
00571 }
00572 
00573 static bool
00574 _equalCoalesceExpr(const CoalesceExpr *a, const CoalesceExpr *b)
00575 {
00576     COMPARE_SCALAR_FIELD(coalescetype);
00577     COMPARE_SCALAR_FIELD(coalescecollid);
00578     COMPARE_NODE_FIELD(args);
00579     COMPARE_LOCATION_FIELD(location);
00580 
00581     return true;
00582 }
00583 
00584 static bool
00585 _equalMinMaxExpr(const MinMaxExpr *a, const MinMaxExpr *b)
00586 {
00587     COMPARE_SCALAR_FIELD(minmaxtype);
00588     COMPARE_SCALAR_FIELD(minmaxcollid);
00589     COMPARE_SCALAR_FIELD(inputcollid);
00590     COMPARE_SCALAR_FIELD(op);
00591     COMPARE_NODE_FIELD(args);
00592     COMPARE_LOCATION_FIELD(location);
00593 
00594     return true;
00595 }
00596 
00597 static bool
00598 _equalXmlExpr(const XmlExpr *a, const XmlExpr *b)
00599 {
00600     COMPARE_SCALAR_FIELD(op);
00601     COMPARE_STRING_FIELD(name);
00602     COMPARE_NODE_FIELD(named_args);
00603     COMPARE_NODE_FIELD(arg_names);
00604     COMPARE_NODE_FIELD(args);
00605     COMPARE_SCALAR_FIELD(xmloption);
00606     COMPARE_SCALAR_FIELD(type);
00607     COMPARE_SCALAR_FIELD(typmod);
00608     COMPARE_LOCATION_FIELD(location);
00609 
00610     return true;
00611 }
00612 
00613 static bool
00614 _equalNullTest(const NullTest *a, const NullTest *b)
00615 {
00616     COMPARE_NODE_FIELD(arg);
00617     COMPARE_SCALAR_FIELD(nulltesttype);
00618     COMPARE_SCALAR_FIELD(argisrow);
00619 
00620     return true;
00621 }
00622 
00623 static bool
00624 _equalBooleanTest(const BooleanTest *a, const BooleanTest *b)
00625 {
00626     COMPARE_NODE_FIELD(arg);
00627     COMPARE_SCALAR_FIELD(booltesttype);
00628 
00629     return true;
00630 }
00631 
00632 static bool
00633 _equalCoerceToDomain(const CoerceToDomain *a, const CoerceToDomain *b)
00634 {
00635     COMPARE_NODE_FIELD(arg);
00636     COMPARE_SCALAR_FIELD(resulttype);
00637     COMPARE_SCALAR_FIELD(resulttypmod);
00638     COMPARE_SCALAR_FIELD(resultcollid);
00639     COMPARE_COERCIONFORM_FIELD(coercionformat);
00640     COMPARE_LOCATION_FIELD(location);
00641 
00642     return true;
00643 }
00644 
00645 static bool
00646 _equalCoerceToDomainValue(const CoerceToDomainValue *a, const CoerceToDomainValue *b)
00647 {
00648     COMPARE_SCALAR_FIELD(typeId);
00649     COMPARE_SCALAR_FIELD(typeMod);
00650     COMPARE_SCALAR_FIELD(collation);
00651     COMPARE_LOCATION_FIELD(location);
00652 
00653     return true;
00654 }
00655 
00656 static bool
00657 _equalSetToDefault(const SetToDefault *a, const SetToDefault *b)
00658 {
00659     COMPARE_SCALAR_FIELD(typeId);
00660     COMPARE_SCALAR_FIELD(typeMod);
00661     COMPARE_SCALAR_FIELD(collation);
00662     COMPARE_LOCATION_FIELD(location);
00663 
00664     return true;
00665 }
00666 
00667 static bool
00668 _equalCurrentOfExpr(const CurrentOfExpr *a, const CurrentOfExpr *b)
00669 {
00670     COMPARE_SCALAR_FIELD(cvarno);
00671     COMPARE_STRING_FIELD(cursor_name);
00672     COMPARE_SCALAR_FIELD(cursor_param);
00673 
00674     return true;
00675 }
00676 
00677 static bool
00678 _equalTargetEntry(const TargetEntry *a, const TargetEntry *b)
00679 {
00680     COMPARE_NODE_FIELD(expr);
00681     COMPARE_SCALAR_FIELD(resno);
00682     COMPARE_STRING_FIELD(resname);
00683     COMPARE_SCALAR_FIELD(ressortgroupref);
00684     COMPARE_SCALAR_FIELD(resorigtbl);
00685     COMPARE_SCALAR_FIELD(resorigcol);
00686     COMPARE_SCALAR_FIELD(resjunk);
00687 
00688     return true;
00689 }
00690 
00691 static bool
00692 _equalRangeTblRef(const RangeTblRef *a, const RangeTblRef *b)
00693 {
00694     COMPARE_SCALAR_FIELD(rtindex);
00695 
00696     return true;
00697 }
00698 
00699 static bool
00700 _equalJoinExpr(const JoinExpr *a, const JoinExpr *b)
00701 {
00702     COMPARE_SCALAR_FIELD(jointype);
00703     COMPARE_SCALAR_FIELD(isNatural);
00704     COMPARE_NODE_FIELD(larg);
00705     COMPARE_NODE_FIELD(rarg);
00706     COMPARE_NODE_FIELD(usingClause);
00707     COMPARE_NODE_FIELD(quals);
00708     COMPARE_NODE_FIELD(alias);
00709     COMPARE_SCALAR_FIELD(rtindex);
00710 
00711     return true;
00712 }
00713 
00714 static bool
00715 _equalFromExpr(const FromExpr *a, const FromExpr *b)
00716 {
00717     COMPARE_NODE_FIELD(fromlist);
00718     COMPARE_NODE_FIELD(quals);
00719 
00720     return true;
00721 }
00722 
00723 
00724 /*
00725  * Stuff from relation.h
00726  */
00727 
00728 static bool
00729 _equalPathKey(const PathKey *a, const PathKey *b)
00730 {
00731     /* We assume pointer equality is sufficient to compare the eclasses */
00732     COMPARE_SCALAR_FIELD(pk_eclass);
00733     COMPARE_SCALAR_FIELD(pk_opfamily);
00734     COMPARE_SCALAR_FIELD(pk_strategy);
00735     COMPARE_SCALAR_FIELD(pk_nulls_first);
00736 
00737     return true;
00738 }
00739 
00740 static bool
00741 _equalRestrictInfo(const RestrictInfo *a, const RestrictInfo *b)
00742 {
00743     COMPARE_NODE_FIELD(clause);
00744     COMPARE_SCALAR_FIELD(is_pushed_down);
00745     COMPARE_SCALAR_FIELD(outerjoin_delayed);
00746     COMPARE_BITMAPSET_FIELD(required_relids);
00747     COMPARE_BITMAPSET_FIELD(outer_relids);
00748     COMPARE_BITMAPSET_FIELD(nullable_relids);
00749 
00750     /*
00751      * We ignore all the remaining fields, since they may not be set yet, and
00752      * should be derivable from the clause anyway.
00753      */
00754 
00755     return true;
00756 }
00757 
00758 static bool
00759 _equalPlaceHolderVar(const PlaceHolderVar *a, const PlaceHolderVar *b)
00760 {
00761     /*
00762      * We intentionally do not compare phexpr.  Two PlaceHolderVars with the
00763      * same ID and levelsup should be considered equal even if the contained
00764      * expressions have managed to mutate to different states.  One way in
00765      * which that can happen is that initplan sublinks would get replaced by
00766      * differently-numbered Params when sublink folding is done.  (The end
00767      * result of such a situation would be some unreferenced initplans, which
00768      * is annoying but not really a problem.)
00769      *
00770      * COMPARE_NODE_FIELD(phexpr);
00771      */
00772     COMPARE_BITMAPSET_FIELD(phrels);
00773     COMPARE_SCALAR_FIELD(phid);
00774     COMPARE_SCALAR_FIELD(phlevelsup);
00775 
00776     return true;
00777 }
00778 
00779 static bool
00780 _equalSpecialJoinInfo(const SpecialJoinInfo *a, const SpecialJoinInfo *b)
00781 {
00782     COMPARE_BITMAPSET_FIELD(min_lefthand);
00783     COMPARE_BITMAPSET_FIELD(min_righthand);
00784     COMPARE_BITMAPSET_FIELD(syn_lefthand);
00785     COMPARE_BITMAPSET_FIELD(syn_righthand);
00786     COMPARE_SCALAR_FIELD(jointype);
00787     COMPARE_SCALAR_FIELD(lhs_strict);
00788     COMPARE_SCALAR_FIELD(delay_upper_joins);
00789     COMPARE_NODE_FIELD(join_quals);
00790 
00791     return true;
00792 }
00793 
00794 static bool
00795 _equalLateralJoinInfo(const LateralJoinInfo *a, const LateralJoinInfo *b)
00796 {
00797     COMPARE_SCALAR_FIELD(lateral_rhs);
00798     COMPARE_BITMAPSET_FIELD(lateral_lhs);
00799 
00800     return true;
00801 }
00802 
00803 static bool
00804 _equalAppendRelInfo(const AppendRelInfo *a, const AppendRelInfo *b)
00805 {
00806     COMPARE_SCALAR_FIELD(parent_relid);
00807     COMPARE_SCALAR_FIELD(child_relid);
00808     COMPARE_SCALAR_FIELD(parent_reltype);
00809     COMPARE_SCALAR_FIELD(child_reltype);
00810     COMPARE_NODE_FIELD(translated_vars);
00811     COMPARE_SCALAR_FIELD(parent_reloid);
00812 
00813     return true;
00814 }
00815 
00816 static bool
00817 _equalPlaceHolderInfo(const PlaceHolderInfo *a, const PlaceHolderInfo *b)
00818 {
00819     COMPARE_SCALAR_FIELD(phid);
00820     COMPARE_NODE_FIELD(ph_var);
00821     COMPARE_BITMAPSET_FIELD(ph_eval_at);
00822     COMPARE_BITMAPSET_FIELD(ph_needed);
00823     COMPARE_BITMAPSET_FIELD(ph_may_need);
00824     COMPARE_SCALAR_FIELD(ph_width);
00825 
00826     return true;
00827 }
00828 
00829 
00830 /*
00831  * Stuff from parsenodes.h
00832  */
00833 
00834 static bool
00835 _equalQuery(const Query *a, const Query *b)
00836 {
00837     COMPARE_SCALAR_FIELD(commandType);
00838     COMPARE_SCALAR_FIELD(querySource);
00839     /* we intentionally ignore queryId, since it might not be set */
00840     COMPARE_SCALAR_FIELD(canSetTag);
00841     COMPARE_NODE_FIELD(utilityStmt);
00842     COMPARE_SCALAR_FIELD(resultRelation);
00843     COMPARE_SCALAR_FIELD(hasAggs);
00844     COMPARE_SCALAR_FIELD(hasWindowFuncs);
00845     COMPARE_SCALAR_FIELD(hasSubLinks);
00846     COMPARE_SCALAR_FIELD(hasDistinctOn);
00847     COMPARE_SCALAR_FIELD(hasRecursive);
00848     COMPARE_SCALAR_FIELD(hasModifyingCTE);
00849     COMPARE_SCALAR_FIELD(hasForUpdate);
00850     COMPARE_NODE_FIELD(cteList);
00851     COMPARE_NODE_FIELD(rtable);
00852     COMPARE_NODE_FIELD(jointree);
00853     COMPARE_NODE_FIELD(targetList);
00854     COMPARE_NODE_FIELD(returningList);
00855     COMPARE_NODE_FIELD(groupClause);
00856     COMPARE_NODE_FIELD(havingQual);
00857     COMPARE_NODE_FIELD(windowClause);
00858     COMPARE_NODE_FIELD(distinctClause);
00859     COMPARE_NODE_FIELD(sortClause);
00860     COMPARE_NODE_FIELD(limitOffset);
00861     COMPARE_NODE_FIELD(limitCount);
00862     COMPARE_NODE_FIELD(rowMarks);
00863     COMPARE_NODE_FIELD(setOperations);
00864     COMPARE_NODE_FIELD(constraintDeps);
00865 
00866     return true;
00867 }
00868 
00869 static bool
00870 _equalInsertStmt(const InsertStmt *a, const InsertStmt *b)
00871 {
00872     COMPARE_NODE_FIELD(relation);
00873     COMPARE_NODE_FIELD(cols);
00874     COMPARE_NODE_FIELD(selectStmt);
00875     COMPARE_NODE_FIELD(returningList);
00876     COMPARE_NODE_FIELD(withClause);
00877 
00878     return true;
00879 }
00880 
00881 static bool
00882 _equalDeleteStmt(const DeleteStmt *a, const DeleteStmt *b)
00883 {
00884     COMPARE_NODE_FIELD(relation);
00885     COMPARE_NODE_FIELD(usingClause);
00886     COMPARE_NODE_FIELD(whereClause);
00887     COMPARE_NODE_FIELD(returningList);
00888     COMPARE_NODE_FIELD(withClause);
00889 
00890     return true;
00891 }
00892 
00893 static bool
00894 _equalUpdateStmt(const UpdateStmt *a, const UpdateStmt *b)
00895 {
00896     COMPARE_NODE_FIELD(relation);
00897     COMPARE_NODE_FIELD(targetList);
00898     COMPARE_NODE_FIELD(whereClause);
00899     COMPARE_NODE_FIELD(fromClause);
00900     COMPARE_NODE_FIELD(returningList);
00901     COMPARE_NODE_FIELD(withClause);
00902 
00903     return true;
00904 }
00905 
00906 static bool
00907 _equalSelectStmt(const SelectStmt *a, const SelectStmt *b)
00908 {
00909     COMPARE_NODE_FIELD(distinctClause);
00910     COMPARE_NODE_FIELD(intoClause);
00911     COMPARE_NODE_FIELD(targetList);
00912     COMPARE_NODE_FIELD(fromClause);
00913     COMPARE_NODE_FIELD(whereClause);
00914     COMPARE_NODE_FIELD(groupClause);
00915     COMPARE_NODE_FIELD(havingClause);
00916     COMPARE_NODE_FIELD(windowClause);
00917     COMPARE_NODE_FIELD(valuesLists);
00918     COMPARE_NODE_FIELD(sortClause);
00919     COMPARE_NODE_FIELD(limitOffset);
00920     COMPARE_NODE_FIELD(limitCount);
00921     COMPARE_NODE_FIELD(lockingClause);
00922     COMPARE_NODE_FIELD(withClause);
00923     COMPARE_SCALAR_FIELD(op);
00924     COMPARE_SCALAR_FIELD(all);
00925     COMPARE_NODE_FIELD(larg);
00926     COMPARE_NODE_FIELD(rarg);
00927 
00928     return true;
00929 }
00930 
00931 static bool
00932 _equalSetOperationStmt(const SetOperationStmt *a, const SetOperationStmt *b)
00933 {
00934     COMPARE_SCALAR_FIELD(op);
00935     COMPARE_SCALAR_FIELD(all);
00936     COMPARE_NODE_FIELD(larg);
00937     COMPARE_NODE_FIELD(rarg);
00938     COMPARE_NODE_FIELD(colTypes);
00939     COMPARE_NODE_FIELD(colTypmods);
00940     COMPARE_NODE_FIELD(colCollations);
00941     COMPARE_NODE_FIELD(groupClauses);
00942 
00943     return true;
00944 }
00945 
00946 static bool
00947 _equalAlterTableStmt(const AlterTableStmt *a, const AlterTableStmt *b)
00948 {
00949     COMPARE_NODE_FIELD(relation);
00950     COMPARE_NODE_FIELD(cmds);
00951     COMPARE_SCALAR_FIELD(relkind);
00952     COMPARE_SCALAR_FIELD(missing_ok);
00953 
00954     return true;
00955 }
00956 
00957 static bool
00958 _equalAlterTableCmd(const AlterTableCmd *a, const AlterTableCmd *b)
00959 {
00960     COMPARE_SCALAR_FIELD(subtype);
00961     COMPARE_STRING_FIELD(name);
00962     COMPARE_NODE_FIELD(def);
00963     COMPARE_SCALAR_FIELD(behavior);
00964     COMPARE_SCALAR_FIELD(missing_ok);
00965 
00966     return true;
00967 }
00968 
00969 static bool
00970 _equalAlterDomainStmt(const AlterDomainStmt *a, const AlterDomainStmt *b)
00971 {
00972     COMPARE_SCALAR_FIELD(subtype);
00973     COMPARE_NODE_FIELD(typeName);
00974     COMPARE_STRING_FIELD(name);
00975     COMPARE_NODE_FIELD(def);
00976     COMPARE_SCALAR_FIELD(behavior);
00977     COMPARE_SCALAR_FIELD(missing_ok);
00978 
00979     return true;
00980 }
00981 
00982 static bool
00983 _equalGrantStmt(const GrantStmt *a, const GrantStmt *b)
00984 {
00985     COMPARE_SCALAR_FIELD(is_grant);
00986     COMPARE_SCALAR_FIELD(targtype);
00987     COMPARE_SCALAR_FIELD(objtype);
00988     COMPARE_NODE_FIELD(objects);
00989     COMPARE_NODE_FIELD(privileges);
00990     COMPARE_NODE_FIELD(grantees);
00991     COMPARE_SCALAR_FIELD(grant_option);
00992     COMPARE_SCALAR_FIELD(behavior);
00993 
00994     return true;
00995 }
00996 
00997 static bool
00998 _equalPrivGrantee(const PrivGrantee *a, const PrivGrantee *b)
00999 {
01000     COMPARE_STRING_FIELD(rolname);
01001 
01002     return true;
01003 }
01004 
01005 static bool
01006 _equalFuncWithArgs(const FuncWithArgs *a, const FuncWithArgs *b)
01007 {
01008     COMPARE_NODE_FIELD(funcname);
01009     COMPARE_NODE_FIELD(funcargs);
01010 
01011     return true;
01012 }
01013 
01014 static bool
01015 _equalAccessPriv(const AccessPriv *a, const AccessPriv *b)
01016 {
01017     COMPARE_STRING_FIELD(priv_name);
01018     COMPARE_NODE_FIELD(cols);
01019 
01020     return true;
01021 }
01022 
01023 static bool
01024 _equalGrantRoleStmt(const GrantRoleStmt *a, const GrantRoleStmt *b)
01025 {
01026     COMPARE_NODE_FIELD(granted_roles);
01027     COMPARE_NODE_FIELD(grantee_roles);
01028     COMPARE_SCALAR_FIELD(is_grant);
01029     COMPARE_SCALAR_FIELD(admin_opt);
01030     COMPARE_STRING_FIELD(grantor);
01031     COMPARE_SCALAR_FIELD(behavior);
01032 
01033     return true;
01034 }
01035 
01036 static bool
01037 _equalAlterDefaultPrivilegesStmt(const AlterDefaultPrivilegesStmt *a, const AlterDefaultPrivilegesStmt *b)
01038 {
01039     COMPARE_NODE_FIELD(options);
01040     COMPARE_NODE_FIELD(action);
01041 
01042     return true;
01043 }
01044 
01045 static bool
01046 _equalDeclareCursorStmt(const DeclareCursorStmt *a, const DeclareCursorStmt *b)
01047 {
01048     COMPARE_STRING_FIELD(portalname);
01049     COMPARE_SCALAR_FIELD(options);
01050     COMPARE_NODE_FIELD(query);
01051 
01052     return true;
01053 }
01054 
01055 static bool
01056 _equalClosePortalStmt(const ClosePortalStmt *a, const ClosePortalStmt *b)
01057 {
01058     COMPARE_STRING_FIELD(portalname);
01059 
01060     return true;
01061 }
01062 
01063 static bool
01064 _equalClusterStmt(const ClusterStmt *a, const ClusterStmt *b)
01065 {
01066     COMPARE_NODE_FIELD(relation);
01067     COMPARE_STRING_FIELD(indexname);
01068     COMPARE_SCALAR_FIELD(verbose);
01069 
01070     return true;
01071 }
01072 
01073 static bool
01074 _equalCopyStmt(const CopyStmt *a, const CopyStmt *b)
01075 {
01076     COMPARE_NODE_FIELD(relation);
01077     COMPARE_NODE_FIELD(query);
01078     COMPARE_NODE_FIELD(attlist);
01079     COMPARE_SCALAR_FIELD(is_from);
01080     COMPARE_SCALAR_FIELD(is_program);
01081     COMPARE_STRING_FIELD(filename);
01082     COMPARE_NODE_FIELD(options);
01083 
01084     return true;
01085 }
01086 
01087 static bool
01088 _equalCreateStmt(const CreateStmt *a, const CreateStmt *b)
01089 {
01090     COMPARE_NODE_FIELD(relation);
01091     COMPARE_NODE_FIELD(tableElts);
01092     COMPARE_NODE_FIELD(inhRelations);
01093     COMPARE_NODE_FIELD(ofTypename);
01094     COMPARE_NODE_FIELD(constraints);
01095     COMPARE_NODE_FIELD(options);
01096     COMPARE_SCALAR_FIELD(oncommit);
01097     COMPARE_STRING_FIELD(tablespacename);
01098     COMPARE_SCALAR_FIELD(if_not_exists);
01099 
01100     return true;
01101 }
01102 
01103 static bool
01104 _equalTableLikeClause(const TableLikeClause *a, const TableLikeClause *b)
01105 {
01106     COMPARE_NODE_FIELD(relation);
01107     COMPARE_SCALAR_FIELD(options);
01108 
01109     return true;
01110 }
01111 
01112 static bool
01113 _equalDefineStmt(const DefineStmt *a, const DefineStmt *b)
01114 {
01115     COMPARE_SCALAR_FIELD(kind);
01116     COMPARE_SCALAR_FIELD(oldstyle);
01117     COMPARE_NODE_FIELD(defnames);
01118     COMPARE_NODE_FIELD(args);
01119     COMPARE_NODE_FIELD(definition);
01120 
01121     return true;
01122 }
01123 
01124 static bool
01125 _equalDropStmt(const DropStmt *a, const DropStmt *b)
01126 {
01127     COMPARE_NODE_FIELD(objects);
01128     COMPARE_NODE_FIELD(arguments);
01129     COMPARE_SCALAR_FIELD(removeType);
01130     COMPARE_SCALAR_FIELD(behavior);
01131     COMPARE_SCALAR_FIELD(missing_ok);
01132     COMPARE_SCALAR_FIELD(concurrent);
01133 
01134     return true;
01135 }
01136 
01137 static bool
01138 _equalTruncateStmt(const TruncateStmt *a, const TruncateStmt *b)
01139 {
01140     COMPARE_NODE_FIELD(relations);
01141     COMPARE_SCALAR_FIELD(restart_seqs);
01142     COMPARE_SCALAR_FIELD(behavior);
01143 
01144     return true;
01145 }
01146 
01147 static bool
01148 _equalCommentStmt(const CommentStmt *a, const CommentStmt *b)
01149 {
01150     COMPARE_SCALAR_FIELD(objtype);
01151     COMPARE_NODE_FIELD(objname);
01152     COMPARE_NODE_FIELD(objargs);
01153     COMPARE_STRING_FIELD(comment);
01154 
01155     return true;
01156 }
01157 
01158 static bool
01159 _equalSecLabelStmt(const SecLabelStmt *a, const SecLabelStmt *b)
01160 {
01161     COMPARE_SCALAR_FIELD(objtype);
01162     COMPARE_NODE_FIELD(objname);
01163     COMPARE_NODE_FIELD(objargs);
01164     COMPARE_STRING_FIELD(provider);
01165     COMPARE_STRING_FIELD(label);
01166 
01167     return true;
01168 }
01169 
01170 static bool
01171 _equalFetchStmt(const FetchStmt *a, const FetchStmt *b)
01172 {
01173     COMPARE_SCALAR_FIELD(direction);
01174     COMPARE_SCALAR_FIELD(howMany);
01175     COMPARE_STRING_FIELD(portalname);
01176     COMPARE_SCALAR_FIELD(ismove);
01177 
01178     return true;
01179 }
01180 
01181 static bool
01182 _equalIndexStmt(const IndexStmt *a, const IndexStmt *b)
01183 {
01184     COMPARE_STRING_FIELD(idxname);
01185     COMPARE_NODE_FIELD(relation);
01186     COMPARE_STRING_FIELD(accessMethod);
01187     COMPARE_STRING_FIELD(tableSpace);
01188     COMPARE_NODE_FIELD(indexParams);
01189     COMPARE_NODE_FIELD(options);
01190     COMPARE_NODE_FIELD(whereClause);
01191     COMPARE_NODE_FIELD(excludeOpNames);
01192     COMPARE_STRING_FIELD(idxcomment);
01193     COMPARE_SCALAR_FIELD(indexOid);
01194     COMPARE_SCALAR_FIELD(oldNode);
01195     COMPARE_SCALAR_FIELD(unique);
01196     COMPARE_SCALAR_FIELD(primary);
01197     COMPARE_SCALAR_FIELD(isconstraint);
01198     COMPARE_SCALAR_FIELD(deferrable);
01199     COMPARE_SCALAR_FIELD(initdeferred);
01200     COMPARE_SCALAR_FIELD(concurrent);
01201 
01202     return true;
01203 }
01204 
01205 static bool
01206 _equalCreateFunctionStmt(const CreateFunctionStmt *a, const CreateFunctionStmt *b)
01207 {
01208     COMPARE_SCALAR_FIELD(replace);
01209     COMPARE_NODE_FIELD(funcname);
01210     COMPARE_NODE_FIELD(parameters);
01211     COMPARE_NODE_FIELD(returnType);
01212     COMPARE_NODE_FIELD(options);
01213     COMPARE_NODE_FIELD(withClause);
01214 
01215     return true;
01216 }
01217 
01218 static bool
01219 _equalFunctionParameter(const FunctionParameter *a, const FunctionParameter *b)
01220 {
01221     COMPARE_STRING_FIELD(name);
01222     COMPARE_NODE_FIELD(argType);
01223     COMPARE_SCALAR_FIELD(mode);
01224     COMPARE_NODE_FIELD(defexpr);
01225 
01226     return true;
01227 }
01228 
01229 static bool
01230 _equalAlterFunctionStmt(const AlterFunctionStmt *a, const AlterFunctionStmt *b)
01231 {
01232     COMPARE_NODE_FIELD(func);
01233     COMPARE_NODE_FIELD(actions);
01234 
01235     return true;
01236 }
01237 
01238 static bool
01239 _equalDoStmt(const DoStmt *a, const DoStmt *b)
01240 {
01241     COMPARE_NODE_FIELD(args);
01242 
01243     return true;
01244 }
01245 
01246 static bool
01247 _equalRenameStmt(const RenameStmt *a, const RenameStmt *b)
01248 {
01249     COMPARE_SCALAR_FIELD(renameType);
01250     COMPARE_SCALAR_FIELD(relationType);
01251     COMPARE_NODE_FIELD(relation);
01252     COMPARE_NODE_FIELD(object);
01253     COMPARE_NODE_FIELD(objarg);
01254     COMPARE_STRING_FIELD(subname);
01255     COMPARE_STRING_FIELD(newname);
01256     COMPARE_SCALAR_FIELD(behavior);
01257     COMPARE_SCALAR_FIELD(missing_ok);
01258 
01259     return true;
01260 }
01261 
01262 static bool
01263 _equalAlterObjectSchemaStmt(const AlterObjectSchemaStmt *a, const AlterObjectSchemaStmt *b)
01264 {
01265     COMPARE_SCALAR_FIELD(objectType);
01266     COMPARE_NODE_FIELD(relation);
01267     COMPARE_NODE_FIELD(object);
01268     COMPARE_NODE_FIELD(objarg);
01269     COMPARE_STRING_FIELD(newschema);
01270     COMPARE_SCALAR_FIELD(missing_ok);
01271 
01272     return true;
01273 }
01274 
01275 static bool
01276 _equalAlterOwnerStmt(const AlterOwnerStmt *a, const AlterOwnerStmt *b)
01277 {
01278     COMPARE_SCALAR_FIELD(objectType);
01279     COMPARE_NODE_FIELD(relation);
01280     COMPARE_NODE_FIELD(object);
01281     COMPARE_NODE_FIELD(objarg);
01282     COMPARE_STRING_FIELD(newowner);
01283 
01284     return true;
01285 }
01286 
01287 static bool
01288 _equalRuleStmt(const RuleStmt *a, const RuleStmt *b)
01289 {
01290     COMPARE_NODE_FIELD(relation);
01291     COMPARE_STRING_FIELD(rulename);
01292     COMPARE_NODE_FIELD(whereClause);
01293     COMPARE_SCALAR_FIELD(event);
01294     COMPARE_SCALAR_FIELD(instead);
01295     COMPARE_NODE_FIELD(actions);
01296     COMPARE_SCALAR_FIELD(replace);
01297 
01298     return true;
01299 }
01300 
01301 static bool
01302 _equalNotifyStmt(const NotifyStmt *a, const NotifyStmt *b)
01303 {
01304     COMPARE_STRING_FIELD(conditionname);
01305     COMPARE_STRING_FIELD(payload);
01306 
01307     return true;
01308 }
01309 
01310 static bool
01311 _equalListenStmt(const ListenStmt *a, const ListenStmt *b)
01312 {
01313     COMPARE_STRING_FIELD(conditionname);
01314 
01315     return true;
01316 }
01317 
01318 static bool
01319 _equalUnlistenStmt(const UnlistenStmt *a, const UnlistenStmt *b)
01320 {
01321     COMPARE_STRING_FIELD(conditionname);
01322 
01323     return true;
01324 }
01325 
01326 static bool
01327 _equalTransactionStmt(const TransactionStmt *a, const TransactionStmt *b)
01328 {
01329     COMPARE_SCALAR_FIELD(kind);
01330     COMPARE_NODE_FIELD(options);
01331     COMPARE_STRING_FIELD(gid);
01332 
01333     return true;
01334 }
01335 
01336 static bool
01337 _equalCompositeTypeStmt(const CompositeTypeStmt *a, const CompositeTypeStmt *b)
01338 {
01339     COMPARE_NODE_FIELD(typevar);
01340     COMPARE_NODE_FIELD(coldeflist);
01341 
01342     return true;
01343 }
01344 
01345 static bool
01346 _equalCreateEnumStmt(const CreateEnumStmt *a, const CreateEnumStmt *b)
01347 {
01348     COMPARE_NODE_FIELD(typeName);
01349     COMPARE_NODE_FIELD(vals);
01350 
01351     return true;
01352 }
01353 
01354 static bool
01355 _equalCreateRangeStmt(const CreateRangeStmt *a, const CreateRangeStmt *b)
01356 {
01357     COMPARE_NODE_FIELD(typeName);
01358     COMPARE_NODE_FIELD(params);
01359 
01360     return true;
01361 }
01362 
01363 static bool
01364 _equalAlterEnumStmt(const AlterEnumStmt *a, const AlterEnumStmt *b)
01365 {
01366     COMPARE_NODE_FIELD(typeName);
01367     COMPARE_STRING_FIELD(newVal);
01368     COMPARE_STRING_FIELD(newValNeighbor);
01369     COMPARE_SCALAR_FIELD(newValIsAfter);
01370     COMPARE_SCALAR_FIELD(skipIfExists);
01371 
01372     return true;
01373 }
01374 
01375 static bool
01376 _equalViewStmt(const ViewStmt *a, const ViewStmt *b)
01377 {
01378     COMPARE_NODE_FIELD(view);
01379     COMPARE_NODE_FIELD(aliases);
01380     COMPARE_NODE_FIELD(query);
01381     COMPARE_SCALAR_FIELD(replace);
01382     COMPARE_NODE_FIELD(options);
01383 
01384     return true;
01385 }
01386 
01387 static bool
01388 _equalLoadStmt(const LoadStmt *a, const LoadStmt *b)
01389 {
01390     COMPARE_STRING_FIELD(filename);
01391 
01392     return true;
01393 }
01394 
01395 static bool
01396 _equalCreateDomainStmt(const CreateDomainStmt *a, const CreateDomainStmt *b)
01397 {
01398     COMPARE_NODE_FIELD(domainname);
01399     COMPARE_NODE_FIELD(typeName);
01400     COMPARE_NODE_FIELD(collClause);
01401     COMPARE_NODE_FIELD(constraints);
01402 
01403     return true;
01404 }
01405 
01406 static bool
01407 _equalCreateOpClassStmt(const CreateOpClassStmt *a, const CreateOpClassStmt *b)
01408 {
01409     COMPARE_NODE_FIELD(opclassname);
01410     COMPARE_NODE_FIELD(opfamilyname);
01411     COMPARE_STRING_FIELD(amname);
01412     COMPARE_NODE_FIELD(datatype);
01413     COMPARE_NODE_FIELD(items);
01414     COMPARE_SCALAR_FIELD(isDefault);
01415 
01416     return true;
01417 }
01418 
01419 static bool
01420 _equalCreateOpClassItem(const CreateOpClassItem *a, const CreateOpClassItem *b)
01421 {
01422     COMPARE_SCALAR_FIELD(itemtype);
01423     COMPARE_NODE_FIELD(name);
01424     COMPARE_NODE_FIELD(args);
01425     COMPARE_SCALAR_FIELD(number);
01426     COMPARE_NODE_FIELD(order_family);
01427     COMPARE_NODE_FIELD(class_args);
01428     COMPARE_NODE_FIELD(storedtype);
01429 
01430     return true;
01431 }
01432 
01433 static bool
01434 _equalCreateOpFamilyStmt(const CreateOpFamilyStmt *a, const CreateOpFamilyStmt *b)
01435 {
01436     COMPARE_NODE_FIELD(opfamilyname);
01437     COMPARE_STRING_FIELD(amname);
01438 
01439     return true;
01440 }
01441 
01442 static bool
01443 _equalAlterOpFamilyStmt(const AlterOpFamilyStmt *a, const AlterOpFamilyStmt *b)
01444 {
01445     COMPARE_NODE_FIELD(opfamilyname);
01446     COMPARE_STRING_FIELD(amname);
01447     COMPARE_SCALAR_FIELD(isDrop);
01448     COMPARE_NODE_FIELD(items);
01449 
01450     return true;
01451 }
01452 
01453 static bool
01454 _equalCreatedbStmt(const CreatedbStmt *a, const CreatedbStmt *b)
01455 {
01456     COMPARE_STRING_FIELD(dbname);
01457     COMPARE_NODE_FIELD(options);
01458 
01459     return true;
01460 }
01461 
01462 static bool
01463 _equalAlterDatabaseStmt(const AlterDatabaseStmt *a, const AlterDatabaseStmt *b)
01464 {
01465     COMPARE_STRING_FIELD(dbname);
01466     COMPARE_NODE_FIELD(options);
01467 
01468     return true;
01469 }
01470 
01471 static bool
01472 _equalAlterDatabaseSetStmt(const AlterDatabaseSetStmt *a, const AlterDatabaseSetStmt *b)
01473 {
01474     COMPARE_STRING_FIELD(dbname);
01475     COMPARE_NODE_FIELD(setstmt);
01476 
01477     return true;
01478 }
01479 
01480 static bool
01481 _equalDropdbStmt(const DropdbStmt *a, const DropdbStmt *b)
01482 {
01483     COMPARE_STRING_FIELD(dbname);
01484     COMPARE_SCALAR_FIELD(missing_ok);
01485 
01486     return true;
01487 }
01488 
01489 static bool
01490 _equalVacuumStmt(const VacuumStmt *a, const VacuumStmt *b)
01491 {
01492     COMPARE_SCALAR_FIELD(options);
01493     COMPARE_SCALAR_FIELD(freeze_min_age);
01494     COMPARE_SCALAR_FIELD(freeze_table_age);
01495     COMPARE_NODE_FIELD(relation);
01496     COMPARE_NODE_FIELD(va_cols);
01497 
01498     return true;
01499 }
01500 
01501 static bool
01502 _equalExplainStmt(const ExplainStmt *a, const ExplainStmt *b)
01503 {
01504     COMPARE_NODE_FIELD(query);
01505     COMPARE_NODE_FIELD(options);
01506 
01507     return true;
01508 }
01509 
01510 static bool
01511 _equalCreateTableAsStmt(const CreateTableAsStmt *a, const CreateTableAsStmt *b)
01512 {
01513     COMPARE_NODE_FIELD(query);
01514     COMPARE_NODE_FIELD(into);
01515     COMPARE_SCALAR_FIELD(relkind);
01516     COMPARE_SCALAR_FIELD(is_select_into);
01517 
01518     return true;
01519 }
01520 
01521 static bool
01522 _equalRefreshMatViewStmt(const RefreshMatViewStmt *a, const RefreshMatViewStmt *b)
01523 {
01524     COMPARE_SCALAR_FIELD(skipData);
01525     COMPARE_NODE_FIELD(relation);
01526 
01527     return true;
01528 }
01529 
01530 static bool
01531 _equalCreateSeqStmt(const CreateSeqStmt *a, const CreateSeqStmt *b)
01532 {
01533     COMPARE_NODE_FIELD(sequence);
01534     COMPARE_NODE_FIELD(options);
01535     COMPARE_SCALAR_FIELD(ownerId);
01536 
01537     return true;
01538 }
01539 
01540 static bool
01541 _equalAlterSeqStmt(const AlterSeqStmt *a, const AlterSeqStmt *b)
01542 {
01543     COMPARE_NODE_FIELD(sequence);
01544     COMPARE_NODE_FIELD(options);
01545     COMPARE_SCALAR_FIELD(missing_ok);
01546 
01547     return true;
01548 }
01549 
01550 static bool
01551 _equalVariableSetStmt(const VariableSetStmt *a, const VariableSetStmt *b)
01552 {
01553     COMPARE_SCALAR_FIELD(kind);
01554     COMPARE_STRING_FIELD(name);
01555     COMPARE_NODE_FIELD(args);
01556     COMPARE_SCALAR_FIELD(is_local);
01557 
01558     return true;
01559 }
01560 
01561 static bool
01562 _equalVariableShowStmt(const VariableShowStmt *a, const VariableShowStmt *b)
01563 {
01564     COMPARE_STRING_FIELD(name);
01565 
01566     return true;
01567 }
01568 
01569 static bool
01570 _equalDiscardStmt(const DiscardStmt *a, const DiscardStmt *b)
01571 {
01572     COMPARE_SCALAR_FIELD(target);
01573 
01574     return true;
01575 }
01576 
01577 static bool
01578 _equalCreateTableSpaceStmt(const CreateTableSpaceStmt *a, const CreateTableSpaceStmt *b)
01579 {
01580     COMPARE_STRING_FIELD(tablespacename);
01581     COMPARE_STRING_FIELD(owner);
01582     COMPARE_STRING_FIELD(location);
01583 
01584     return true;
01585 }
01586 
01587 static bool
01588 _equalDropTableSpaceStmt(const DropTableSpaceStmt *a, const DropTableSpaceStmt *b)
01589 {
01590     COMPARE_STRING_FIELD(tablespacename);
01591     COMPARE_SCALAR_FIELD(missing_ok);
01592 
01593     return true;
01594 }
01595 
01596 static bool
01597 _equalAlterTableSpaceOptionsStmt(const AlterTableSpaceOptionsStmt *a,
01598                                  const AlterTableSpaceOptionsStmt *b)
01599 {
01600     COMPARE_STRING_FIELD(tablespacename);
01601     COMPARE_NODE_FIELD(options);
01602     COMPARE_SCALAR_FIELD(isReset);
01603 
01604     return true;
01605 }
01606 
01607 static bool
01608 _equalCreateExtensionStmt(const CreateExtensionStmt *a, const CreateExtensionStmt *b)
01609 {
01610     COMPARE_STRING_FIELD(extname);
01611     COMPARE_SCALAR_FIELD(if_not_exists);
01612     COMPARE_NODE_FIELD(options);
01613 
01614     return true;
01615 }
01616 
01617 static bool
01618 _equalAlterExtensionStmt(const AlterExtensionStmt *a, const AlterExtensionStmt *b)
01619 {
01620     COMPARE_STRING_FIELD(extname);
01621     COMPARE_NODE_FIELD(options);
01622 
01623     return true;
01624 }
01625 
01626 static bool
01627 _equalAlterExtensionContentsStmt(const AlterExtensionContentsStmt *a, const AlterExtensionContentsStmt *b)
01628 {
01629     COMPARE_STRING_FIELD(extname);
01630     COMPARE_SCALAR_FIELD(action);
01631     COMPARE_SCALAR_FIELD(objtype);
01632     COMPARE_NODE_FIELD(objname);
01633     COMPARE_NODE_FIELD(objargs);
01634 
01635     return true;
01636 }
01637 
01638 static bool
01639 _equalCreateFdwStmt(const CreateFdwStmt *a, const CreateFdwStmt *b)
01640 {
01641     COMPARE_STRING_FIELD(fdwname);
01642     COMPARE_NODE_FIELD(func_options);
01643     COMPARE_NODE_FIELD(options);
01644 
01645     return true;
01646 }
01647 
01648 static bool
01649 _equalAlterFdwStmt(const AlterFdwStmt *a, const AlterFdwStmt *b)
01650 {
01651     COMPARE_STRING_FIELD(fdwname);
01652     COMPARE_NODE_FIELD(func_options);
01653     COMPARE_NODE_FIELD(options);
01654 
01655     return true;
01656 }
01657 
01658 static bool
01659 _equalCreateForeignServerStmt(const CreateForeignServerStmt *a, const CreateForeignServerStmt *b)
01660 {
01661     COMPARE_STRING_FIELD(servername);
01662     COMPARE_STRING_FIELD(servertype);
01663     COMPARE_STRING_FIELD(version);
01664     COMPARE_STRING_FIELD(fdwname);
01665     COMPARE_NODE_FIELD(options);
01666 
01667     return true;
01668 }
01669 
01670 static bool
01671 _equalAlterForeignServerStmt(const AlterForeignServerStmt *a, const AlterForeignServerStmt *b)
01672 {
01673     COMPARE_STRING_FIELD(servername);
01674     COMPARE_STRING_FIELD(version);
01675     COMPARE_NODE_FIELD(options);
01676     COMPARE_SCALAR_FIELD(has_version);
01677 
01678     return true;
01679 }
01680 
01681 static bool
01682 _equalCreateUserMappingStmt(const CreateUserMappingStmt *a, const CreateUserMappingStmt *b)
01683 {
01684     COMPARE_STRING_FIELD(username);
01685     COMPARE_STRING_FIELD(servername);
01686     COMPARE_NODE_FIELD(options);
01687 
01688     return true;
01689 }
01690 
01691 static bool
01692 _equalAlterUserMappingStmt(const AlterUserMappingStmt *a, const AlterUserMappingStmt *b)
01693 {
01694     COMPARE_STRING_FIELD(username);
01695     COMPARE_STRING_FIELD(servername);
01696     COMPARE_NODE_FIELD(options);
01697 
01698     return true;
01699 }
01700 
01701 static bool
01702 _equalDropUserMappingStmt(const DropUserMappingStmt *a, const DropUserMappingStmt *b)
01703 {
01704     COMPARE_STRING_FIELD(username);
01705     COMPARE_STRING_FIELD(servername);
01706     COMPARE_SCALAR_FIELD(missing_ok);
01707 
01708     return true;
01709 }
01710 
01711 static bool
01712 _equalCreateForeignTableStmt(const CreateForeignTableStmt *a, const CreateForeignTableStmt *b)
01713 {
01714     if (!_equalCreateStmt(&a->base, &b->base))
01715         return false;
01716 
01717     COMPARE_STRING_FIELD(servername);
01718     COMPARE_NODE_FIELD(options);
01719 
01720     return true;
01721 }
01722 
01723 static bool
01724 _equalCreateTrigStmt(const CreateTrigStmt *a, const CreateTrigStmt *b)
01725 {
01726     COMPARE_STRING_FIELD(trigname);
01727     COMPARE_NODE_FIELD(relation);
01728     COMPARE_NODE_FIELD(funcname);
01729     COMPARE_NODE_FIELD(args);
01730     COMPARE_SCALAR_FIELD(row);
01731     COMPARE_SCALAR_FIELD(timing);
01732     COMPARE_SCALAR_FIELD(events);
01733     COMPARE_NODE_FIELD(columns);
01734     COMPARE_NODE_FIELD(whenClause);
01735     COMPARE_SCALAR_FIELD(isconstraint);
01736     COMPARE_SCALAR_FIELD(deferrable);
01737     COMPARE_SCALAR_FIELD(initdeferred);
01738     COMPARE_NODE_FIELD(constrrel);
01739 
01740     return true;
01741 }
01742 
01743 static bool
01744 _equalCreateEventTrigStmt(const CreateEventTrigStmt *a, const CreateEventTrigStmt *b)
01745 {
01746     COMPARE_STRING_FIELD(trigname);
01747     COMPARE_SCALAR_FIELD(eventname);
01748     COMPARE_NODE_FIELD(funcname);
01749     COMPARE_NODE_FIELD(whenclause);
01750 
01751     return true;
01752 }
01753 
01754 static bool
01755 _equalAlterEventTrigStmt(const AlterEventTrigStmt *a, const AlterEventTrigStmt *b)
01756 {
01757     COMPARE_STRING_FIELD(trigname);
01758     COMPARE_SCALAR_FIELD(tgenabled);
01759 
01760     return true;
01761 }
01762 
01763 static bool
01764 _equalCreatePLangStmt(const CreatePLangStmt *a, const CreatePLangStmt *b)
01765 {
01766     COMPARE_SCALAR_FIELD(replace);
01767     COMPARE_STRING_FIELD(plname);
01768     COMPARE_NODE_FIELD(plhandler);
01769     COMPARE_NODE_FIELD(plinline);
01770     COMPARE_NODE_FIELD(plvalidator);
01771     COMPARE_SCALAR_FIELD(pltrusted);
01772 
01773     return true;
01774 }
01775 
01776 static bool
01777 _equalCreateRoleStmt(const CreateRoleStmt *a, const CreateRoleStmt *b)
01778 {
01779     COMPARE_SCALAR_FIELD(stmt_type);
01780     COMPARE_STRING_FIELD(role);
01781     COMPARE_NODE_FIELD(options);
01782 
01783     return true;
01784 }
01785 
01786 static bool
01787 _equalAlterRoleStmt(const AlterRoleStmt *a, const AlterRoleStmt *b)
01788 {
01789     COMPARE_STRING_FIELD(role);
01790     COMPARE_NODE_FIELD(options);
01791     COMPARE_SCALAR_FIELD(action);
01792 
01793     return true;
01794 }
01795 
01796 static bool
01797 _equalAlterRoleSetStmt(const AlterRoleSetStmt *a, const AlterRoleSetStmt *b)
01798 {
01799     COMPARE_STRING_FIELD(role);
01800     COMPARE_STRING_FIELD(database);
01801     COMPARE_NODE_FIELD(setstmt);
01802 
01803     return true;
01804 }
01805 
01806 static bool
01807 _equalDropRoleStmt(const DropRoleStmt *a, const DropRoleStmt *b)
01808 {
01809     COMPARE_NODE_FIELD(roles);
01810     COMPARE_SCALAR_FIELD(missing_ok);
01811 
01812     return true;
01813 }
01814 
01815 static bool
01816 _equalLockStmt(const LockStmt *a, const LockStmt *b)
01817 {
01818     COMPARE_NODE_FIELD(relations);
01819     COMPARE_SCALAR_FIELD(mode);
01820     COMPARE_SCALAR_FIELD(nowait);
01821 
01822     return true;
01823 }
01824 
01825 static bool
01826 _equalConstraintsSetStmt(const ConstraintsSetStmt *a, const ConstraintsSetStmt *b)
01827 {
01828     COMPARE_NODE_FIELD(constraints);
01829     COMPARE_SCALAR_FIELD(deferred);
01830 
01831     return true;
01832 }
01833 
01834 static bool
01835 _equalReindexStmt(const ReindexStmt *a, const ReindexStmt *b)
01836 {
01837     COMPARE_SCALAR_FIELD(kind);
01838     COMPARE_NODE_FIELD(relation);
01839     COMPARE_STRING_FIELD(name);
01840     COMPARE_SCALAR_FIELD(do_system);
01841     COMPARE_SCALAR_FIELD(do_user);
01842 
01843     return true;
01844 }
01845 
01846 static bool
01847 _equalCreateSchemaStmt(const CreateSchemaStmt *a, const CreateSchemaStmt *b)
01848 {
01849     COMPARE_STRING_FIELD(schemaname);
01850     COMPARE_STRING_FIELD(authid);
01851     COMPARE_NODE_FIELD(schemaElts);
01852     COMPARE_SCALAR_FIELD(if_not_exists);
01853 
01854     return true;
01855 }
01856 
01857 static bool
01858 _equalCreateConversionStmt(const CreateConversionStmt *a, const CreateConversionStmt *b)
01859 {
01860     COMPARE_NODE_FIELD(conversion_name);
01861     COMPARE_STRING_FIELD(for_encoding_name);
01862     COMPARE_STRING_FIELD(to_encoding_name);
01863     COMPARE_NODE_FIELD(func_name);
01864     COMPARE_SCALAR_FIELD(def);
01865 
01866     return true;
01867 }
01868 
01869 static bool
01870 _equalCreateCastStmt(const CreateCastStmt *a, const CreateCastStmt *b)
01871 {
01872     COMPARE_NODE_FIELD(sourcetype);
01873     COMPARE_NODE_FIELD(targettype);
01874     COMPARE_NODE_FIELD(func);
01875     COMPARE_SCALAR_FIELD(context);
01876     COMPARE_SCALAR_FIELD(inout);
01877 
01878     return true;
01879 }
01880 
01881 static bool
01882 _equalPrepareStmt(const PrepareStmt *a, const PrepareStmt *b)
01883 {
01884     COMPARE_STRING_FIELD(name);
01885     COMPARE_NODE_FIELD(argtypes);
01886     COMPARE_NODE_FIELD(query);
01887 
01888     return true;
01889 }
01890 
01891 static bool
01892 _equalExecuteStmt(const ExecuteStmt *a, const ExecuteStmt *b)
01893 {
01894     COMPARE_STRING_FIELD(name);
01895     COMPARE_NODE_FIELD(params);
01896 
01897     return true;
01898 }
01899 
01900 static bool
01901 _equalDeallocateStmt(const DeallocateStmt *a, const DeallocateStmt *b)
01902 {
01903     COMPARE_STRING_FIELD(name);
01904 
01905     return true;
01906 }
01907 
01908 static bool
01909 _equalDropOwnedStmt(const DropOwnedStmt *a, const DropOwnedStmt *b)
01910 {
01911     COMPARE_NODE_FIELD(roles);
01912     COMPARE_SCALAR_FIELD(behavior);
01913 
01914     return true;
01915 }
01916 
01917 static bool
01918 _equalReassignOwnedStmt(const ReassignOwnedStmt *a, const ReassignOwnedStmt *b)
01919 {
01920     COMPARE_NODE_FIELD(roles);
01921     COMPARE_STRING_FIELD(newrole);
01922 
01923     return true;
01924 }
01925 
01926 static bool
01927 _equalAlterTSDictionaryStmt(const AlterTSDictionaryStmt *a, const AlterTSDictionaryStmt *b)
01928 {
01929     COMPARE_NODE_FIELD(dictname);
01930     COMPARE_NODE_FIELD(options);
01931 
01932     return true;
01933 }
01934 
01935 static bool
01936 _equalAlterTSConfigurationStmt(const AlterTSConfigurationStmt *a,
01937                                const AlterTSConfigurationStmt *b)
01938 {
01939     COMPARE_NODE_FIELD(cfgname);
01940     COMPARE_NODE_FIELD(tokentype);
01941     COMPARE_NODE_FIELD(dicts);
01942     COMPARE_SCALAR_FIELD(override);
01943     COMPARE_SCALAR_FIELD(replace);
01944     COMPARE_SCALAR_FIELD(missing_ok);
01945 
01946     return true;
01947 }
01948 
01949 static bool
01950 _equalAExpr(const A_Expr *a, const A_Expr *b)
01951 {
01952     COMPARE_SCALAR_FIELD(kind);
01953     COMPARE_NODE_FIELD(name);
01954     COMPARE_NODE_FIELD(lexpr);
01955     COMPARE_NODE_FIELD(rexpr);
01956     COMPARE_LOCATION_FIELD(location);
01957 
01958     return true;
01959 }
01960 
01961 static bool
01962 _equalColumnRef(const ColumnRef *a, const ColumnRef *b)
01963 {
01964     COMPARE_NODE_FIELD(fields);
01965     COMPARE_LOCATION_FIELD(location);
01966 
01967     return true;
01968 }
01969 
01970 static bool
01971 _equalParamRef(const ParamRef *a, const ParamRef *b)
01972 {
01973     COMPARE_SCALAR_FIELD(number);
01974     COMPARE_LOCATION_FIELD(location);
01975 
01976     return true;
01977 }
01978 
01979 static bool
01980 _equalAConst(const A_Const *a, const A_Const *b)
01981 {
01982     if (!equal(&a->val, &b->val))       /* hack for in-line Value field */
01983         return false;
01984     COMPARE_LOCATION_FIELD(location);
01985 
01986     return true;
01987 }
01988 
01989 static bool
01990 _equalFuncCall(const FuncCall *a, const FuncCall *b)
01991 {
01992     COMPARE_NODE_FIELD(funcname);
01993     COMPARE_NODE_FIELD(args);
01994     COMPARE_NODE_FIELD(agg_order);
01995     COMPARE_SCALAR_FIELD(agg_star);
01996     COMPARE_SCALAR_FIELD(agg_distinct);
01997     COMPARE_SCALAR_FIELD(func_variadic);
01998     COMPARE_NODE_FIELD(over);
01999     COMPARE_LOCATION_FIELD(location);
02000 
02001     return true;
02002 }
02003 
02004 static bool
02005 _equalAStar(const A_Star *a, const A_Star *b)
02006 {
02007     return true;
02008 }
02009 
02010 static bool
02011 _equalAIndices(const A_Indices *a, const A_Indices *b)
02012 {
02013     COMPARE_NODE_FIELD(lidx);
02014     COMPARE_NODE_FIELD(uidx);
02015 
02016     return true;
02017 }
02018 
02019 static bool
02020 _equalA_Indirection(const A_Indirection *a, const A_Indirection *b)
02021 {
02022     COMPARE_NODE_FIELD(arg);
02023     COMPARE_NODE_FIELD(indirection);
02024 
02025     return true;
02026 }
02027 
02028 static bool
02029 _equalA_ArrayExpr(const A_ArrayExpr *a, const A_ArrayExpr *b)
02030 {
02031     COMPARE_NODE_FIELD(elements);
02032     COMPARE_LOCATION_FIELD(location);
02033 
02034     return true;
02035 }
02036 
02037 static bool
02038 _equalResTarget(const ResTarget *a, const ResTarget *b)
02039 {
02040     COMPARE_STRING_FIELD(name);
02041     COMPARE_NODE_FIELD(indirection);
02042     COMPARE_NODE_FIELD(val);
02043     COMPARE_LOCATION_FIELD(location);
02044 
02045     return true;
02046 }
02047 
02048 static bool
02049 _equalTypeName(const TypeName *a, const TypeName *b)
02050 {
02051     COMPARE_NODE_FIELD(names);
02052     COMPARE_SCALAR_FIELD(typeOid);
02053     COMPARE_SCALAR_FIELD(setof);
02054     COMPARE_SCALAR_FIELD(pct_type);
02055     COMPARE_NODE_FIELD(typmods);
02056     COMPARE_SCALAR_FIELD(typemod);
02057     COMPARE_NODE_FIELD(arrayBounds);
02058     COMPARE_LOCATION_FIELD(location);
02059 
02060     return true;
02061 }
02062 
02063 static bool
02064 _equalTypeCast(const TypeCast *a, const TypeCast *b)
02065 {
02066     COMPARE_NODE_FIELD(arg);
02067     COMPARE_NODE_FIELD(typeName);
02068     COMPARE_LOCATION_FIELD(location);
02069 
02070     return true;
02071 }
02072 
02073 static bool
02074 _equalCollateClause(const CollateClause *a, const CollateClause *b)
02075 {
02076     COMPARE_NODE_FIELD(arg);
02077     COMPARE_NODE_FIELD(collname);
02078     COMPARE_LOCATION_FIELD(location);
02079 
02080     return true;
02081 }
02082 
02083 static bool
02084 _equalSortBy(const SortBy *a, const SortBy *b)
02085 {
02086     COMPARE_NODE_FIELD(node);
02087     COMPARE_SCALAR_FIELD(sortby_dir);
02088     COMPARE_SCALAR_FIELD(sortby_nulls);
02089     COMPARE_NODE_FIELD(useOp);
02090     COMPARE_LOCATION_FIELD(location);
02091 
02092     return true;
02093 }
02094 
02095 static bool
02096 _equalWindowDef(const WindowDef *a, const WindowDef *b)
02097 {
02098     COMPARE_STRING_FIELD(name);
02099     COMPARE_STRING_FIELD(refname);
02100     COMPARE_NODE_FIELD(partitionClause);
02101     COMPARE_NODE_FIELD(orderClause);
02102     COMPARE_SCALAR_FIELD(frameOptions);
02103     COMPARE_NODE_FIELD(startOffset);
02104     COMPARE_NODE_FIELD(endOffset);
02105     COMPARE_LOCATION_FIELD(location);
02106 
02107     return true;
02108 }
02109 
02110 static bool
02111 _equalRangeSubselect(const RangeSubselect *a, const RangeSubselect *b)
02112 {
02113     COMPARE_SCALAR_FIELD(lateral);
02114     COMPARE_NODE_FIELD(subquery);
02115     COMPARE_NODE_FIELD(alias);
02116 
02117     return true;
02118 }
02119 
02120 static bool
02121 _equalRangeFunction(const RangeFunction *a, const RangeFunction *b)
02122 {
02123     COMPARE_SCALAR_FIELD(lateral);
02124     COMPARE_NODE_FIELD(funccallnode);
02125     COMPARE_NODE_FIELD(alias);
02126     COMPARE_NODE_FIELD(coldeflist);
02127 
02128     return true;
02129 }
02130 
02131 static bool
02132 _equalIndexElem(const IndexElem *a, const IndexElem *b)
02133 {
02134     COMPARE_STRING_FIELD(name);
02135     COMPARE_NODE_FIELD(expr);
02136     COMPARE_STRING_FIELD(indexcolname);
02137     COMPARE_NODE_FIELD(collation);
02138     COMPARE_NODE_FIELD(opclass);
02139     COMPARE_SCALAR_FIELD(ordering);
02140     COMPARE_SCALAR_FIELD(nulls_ordering);
02141 
02142     return true;
02143 }
02144 
02145 static bool
02146 _equalColumnDef(const ColumnDef *a, const ColumnDef *b)
02147 {
02148     COMPARE_STRING_FIELD(colname);
02149     COMPARE_NODE_FIELD(typeName);
02150     COMPARE_SCALAR_FIELD(inhcount);
02151     COMPARE_SCALAR_FIELD(is_local);
02152     COMPARE_SCALAR_FIELD(is_not_null);
02153     COMPARE_SCALAR_FIELD(is_from_type);
02154     COMPARE_SCALAR_FIELD(storage);
02155     COMPARE_NODE_FIELD(raw_default);
02156     COMPARE_NODE_FIELD(cooked_default);
02157     COMPARE_NODE_FIELD(collClause);
02158     COMPARE_SCALAR_FIELD(collOid);
02159     COMPARE_NODE_FIELD(constraints);
02160     COMPARE_NODE_FIELD(fdwoptions);
02161 
02162     return true;
02163 }
02164 
02165 static bool
02166 _equalConstraint(const Constraint *a, const Constraint *b)
02167 {
02168     COMPARE_SCALAR_FIELD(contype);
02169     COMPARE_STRING_FIELD(conname);
02170     COMPARE_SCALAR_FIELD(deferrable);
02171     COMPARE_SCALAR_FIELD(initdeferred);
02172     COMPARE_LOCATION_FIELD(location);
02173     COMPARE_SCALAR_FIELD(is_no_inherit);
02174     COMPARE_NODE_FIELD(raw_expr);
02175     COMPARE_STRING_FIELD(cooked_expr);
02176     COMPARE_NODE_FIELD(keys);
02177     COMPARE_NODE_FIELD(exclusions);
02178     COMPARE_NODE_FIELD(options);
02179     COMPARE_STRING_FIELD(indexname);
02180     COMPARE_STRING_FIELD(indexspace);
02181     COMPARE_STRING_FIELD(access_method);
02182     COMPARE_NODE_FIELD(where_clause);
02183     COMPARE_NODE_FIELD(pktable);
02184     COMPARE_NODE_FIELD(fk_attrs);
02185     COMPARE_NODE_FIELD(pk_attrs);
02186     COMPARE_SCALAR_FIELD(fk_matchtype);
02187     COMPARE_SCALAR_FIELD(fk_upd_action);
02188     COMPARE_SCALAR_FIELD(fk_del_action);
02189     COMPARE_NODE_FIELD(old_conpfeqop);
02190     COMPARE_SCALAR_FIELD(skip_validation);
02191     COMPARE_SCALAR_FIELD(initially_valid);
02192 
02193     return true;
02194 }
02195 
02196 static bool
02197 _equalDefElem(const DefElem *a, const DefElem *b)
02198 {
02199     COMPARE_STRING_FIELD(defnamespace);
02200     COMPARE_STRING_FIELD(defname);
02201     COMPARE_NODE_FIELD(arg);
02202     COMPARE_SCALAR_FIELD(defaction);
02203 
02204     return true;
02205 }
02206 
02207 static bool
02208 _equalLockingClause(const LockingClause *a, const LockingClause *b)
02209 {
02210     COMPARE_NODE_FIELD(lockedRels);
02211     COMPARE_SCALAR_FIELD(strength);
02212     COMPARE_SCALAR_FIELD(noWait);
02213 
02214     return true;
02215 }
02216 
02217 static bool
02218 _equalRangeTblEntry(const RangeTblEntry *a, const RangeTblEntry *b)
02219 {
02220     COMPARE_SCALAR_FIELD(rtekind);
02221     COMPARE_SCALAR_FIELD(relid);
02222     COMPARE_SCALAR_FIELD(relkind);
02223     COMPARE_NODE_FIELD(subquery);
02224     COMPARE_SCALAR_FIELD(security_barrier);
02225     COMPARE_SCALAR_FIELD(jointype);
02226     COMPARE_NODE_FIELD(joinaliasvars);
02227     COMPARE_NODE_FIELD(funcexpr);
02228     COMPARE_NODE_FIELD(funccoltypes);
02229     COMPARE_NODE_FIELD(funccoltypmods);
02230     COMPARE_NODE_FIELD(funccolcollations);
02231     COMPARE_NODE_FIELD(values_lists);
02232     COMPARE_NODE_FIELD(values_collations);
02233     COMPARE_STRING_FIELD(ctename);
02234     COMPARE_SCALAR_FIELD(ctelevelsup);
02235     COMPARE_SCALAR_FIELD(self_reference);
02236     COMPARE_NODE_FIELD(ctecoltypes);
02237     COMPARE_NODE_FIELD(ctecoltypmods);
02238     COMPARE_NODE_FIELD(ctecolcollations);
02239     COMPARE_NODE_FIELD(alias);
02240     COMPARE_NODE_FIELD(eref);
02241     COMPARE_SCALAR_FIELD(lateral);
02242     COMPARE_SCALAR_FIELD(inh);
02243     COMPARE_SCALAR_FIELD(inFromCl);
02244     COMPARE_SCALAR_FIELD(requiredPerms);
02245     COMPARE_SCALAR_FIELD(checkAsUser);
02246     COMPARE_BITMAPSET_FIELD(selectedCols);
02247     COMPARE_BITMAPSET_FIELD(modifiedCols);
02248 
02249     return true;
02250 }
02251 
02252 static bool
02253 _equalSortGroupClause(const SortGroupClause *a, const SortGroupClause *b)
02254 {
02255     COMPARE_SCALAR_FIELD(tleSortGroupRef);
02256     COMPARE_SCALAR_FIELD(eqop);
02257     COMPARE_SCALAR_FIELD(sortop);
02258     COMPARE_SCALAR_FIELD(nulls_first);
02259     COMPARE_SCALAR_FIELD(hashable);
02260 
02261     return true;
02262 }
02263 
02264 static bool
02265 _equalWindowClause(const WindowClause *a, const WindowClause *b)
02266 {
02267     COMPARE_STRING_FIELD(name);
02268     COMPARE_STRING_FIELD(refname);
02269     COMPARE_NODE_FIELD(partitionClause);
02270     COMPARE_NODE_FIELD(orderClause);
02271     COMPARE_SCALAR_FIELD(frameOptions);
02272     COMPARE_NODE_FIELD(startOffset);
02273     COMPARE_NODE_FIELD(endOffset);
02274     COMPARE_SCALAR_FIELD(winref);
02275     COMPARE_SCALAR_FIELD(copiedOrder);
02276 
02277     return true;
02278 }
02279 
02280 static bool
02281 _equalRowMarkClause(const RowMarkClause *a, const RowMarkClause *b)
02282 {
02283     COMPARE_SCALAR_FIELD(rti);
02284     COMPARE_SCALAR_FIELD(strength);
02285     COMPARE_SCALAR_FIELD(noWait);
02286     COMPARE_SCALAR_FIELD(pushedDown);
02287 
02288     return true;
02289 }
02290 
02291 static bool
02292 _equalWithClause(const WithClause *a, const WithClause *b)
02293 {
02294     COMPARE_NODE_FIELD(ctes);
02295     COMPARE_SCALAR_FIELD(recursive);
02296     COMPARE_LOCATION_FIELD(location);
02297 
02298     return true;
02299 }
02300 
02301 static bool
02302 _equalCommonTableExpr(const CommonTableExpr *a, const CommonTableExpr *b)
02303 {
02304     COMPARE_STRING_FIELD(ctename);
02305     COMPARE_NODE_FIELD(aliascolnames);
02306     COMPARE_NODE_FIELD(ctequery);
02307     COMPARE_LOCATION_FIELD(location);
02308     COMPARE_SCALAR_FIELD(cterecursive);
02309     COMPARE_SCALAR_FIELD(cterefcount);
02310     COMPARE_NODE_FIELD(ctecolnames);
02311     COMPARE_NODE_FIELD(ctecoltypes);
02312     COMPARE_NODE_FIELD(ctecoltypmods);
02313     COMPARE_NODE_FIELD(ctecolcollations);
02314 
02315     return true;
02316 }
02317 
02318 static bool
02319 _equalXmlSerialize(const XmlSerialize *a, const XmlSerialize *b)
02320 {
02321     COMPARE_SCALAR_FIELD(xmloption);
02322     COMPARE_NODE_FIELD(expr);
02323     COMPARE_NODE_FIELD(typeName);
02324     COMPARE_LOCATION_FIELD(location);
02325 
02326     return true;
02327 }
02328 
02329 /*
02330  * Stuff from pg_list.h
02331  */
02332 
02333 static bool
02334 _equalList(const List *a, const List *b)
02335 {
02336     const ListCell *item_a;
02337     const ListCell *item_b;
02338 
02339     /*
02340      * Try to reject by simple scalar checks before grovelling through all the
02341      * list elements...
02342      */
02343     COMPARE_SCALAR_FIELD(type);
02344     COMPARE_SCALAR_FIELD(length);
02345 
02346     /*
02347      * We place the switch outside the loop for the sake of efficiency; this
02348      * may not be worth doing...
02349      */
02350     switch (a->type)
02351     {
02352         case T_List:
02353             forboth(item_a, a, item_b, b)
02354             {
02355                 if (!equal(lfirst(item_a), lfirst(item_b)))
02356                     return false;
02357             }
02358             break;
02359         case T_IntList:
02360             forboth(item_a, a, item_b, b)
02361             {
02362                 if (lfirst_int(item_a) != lfirst_int(item_b))
02363                     return false;
02364             }
02365             break;
02366         case T_OidList:
02367             forboth(item_a, a, item_b, b)
02368             {
02369                 if (lfirst_oid(item_a) != lfirst_oid(item_b))
02370                     return false;
02371             }
02372             break;
02373         default:
02374             elog(ERROR, "unrecognized list node type: %d",
02375                  (int) a->type);
02376             return false;       /* keep compiler quiet */
02377     }
02378 
02379     /*
02380      * If we got here, we should have run out of elements of both lists
02381      */
02382     Assert(item_a == NULL);
02383     Assert(item_b == NULL);
02384 
02385     return true;
02386 }
02387 
02388 /*
02389  * Stuff from value.h
02390  */
02391 
02392 static bool
02393 _equalValue(const Value *a, const Value *b)
02394 {
02395     COMPARE_SCALAR_FIELD(type);
02396 
02397     switch (a->type)
02398     {
02399         case T_Integer:
02400             COMPARE_SCALAR_FIELD(val.ival);
02401             break;
02402         case T_Float:
02403         case T_String:
02404         case T_BitString:
02405             COMPARE_STRING_FIELD(val.str);
02406             break;
02407         case T_Null:
02408             /* nothing to do */
02409             break;
02410         default:
02411             elog(ERROR, "unrecognized node type: %d", (int) a->type);
02412             break;
02413     }
02414 
02415     return true;
02416 }
02417 
02418 /*
02419  * equal
02420  *    returns whether two nodes are equal
02421  */
02422 bool
02423 equal(const void *a, const void *b)
02424 {
02425     bool        retval;
02426 
02427     if (a == b)
02428         return true;
02429 
02430     /*
02431      * note that a!=b, so only one of them can be NULL
02432      */
02433     if (a == NULL || b == NULL)
02434         return false;
02435 
02436     /*
02437      * are they the same type of nodes?
02438      */
02439     if (nodeTag(a) != nodeTag(b))
02440         return false;
02441 
02442     switch (nodeTag(a))
02443     {
02444             /*
02445              * PRIMITIVE NODES
02446              */
02447         case T_Alias:
02448             retval = _equalAlias(a, b);
02449             break;
02450         case T_RangeVar:
02451             retval = _equalRangeVar(a, b);
02452             break;
02453         case T_IntoClause:
02454             retval = _equalIntoClause(a, b);
02455             break;
02456         case T_Var:
02457             retval = _equalVar(a, b);
02458             break;
02459         case T_Const:
02460             retval = _equalConst(a, b);
02461             break;
02462         case T_Param:
02463             retval = _equalParam(a, b);
02464             break;
02465         case T_Aggref:
02466             retval = _equalAggref(a, b);
02467             break;
02468         case T_WindowFunc:
02469             retval = _equalWindowFunc(a, b);
02470             break;
02471         case T_ArrayRef:
02472             retval = _equalArrayRef(a, b);
02473             break;
02474         case T_FuncExpr:
02475             retval = _equalFuncExpr(a, b);
02476             break;
02477         case T_NamedArgExpr:
02478             retval = _equalNamedArgExpr(a, b);
02479             break;
02480         case T_OpExpr:
02481             retval = _equalOpExpr(a, b);
02482             break;
02483         case T_DistinctExpr:
02484             retval = _equalDistinctExpr(a, b);
02485             break;
02486         case T_NullIfExpr:
02487             retval = _equalNullIfExpr(a, b);
02488             break;
02489         case T_ScalarArrayOpExpr:
02490             retval = _equalScalarArrayOpExpr(a, b);
02491             break;
02492         case T_BoolExpr:
02493             retval = _equalBoolExpr(a, b);
02494             break;
02495         case T_SubLink:
02496             retval = _equalSubLink(a, b);
02497             break;
02498         case T_SubPlan:
02499             retval = _equalSubPlan(a, b);
02500             break;
02501         case T_AlternativeSubPlan:
02502             retval = _equalAlternativeSubPlan(a, b);
02503             break;
02504         case T_FieldSelect:
02505             retval = _equalFieldSelect(a, b);
02506             break;
02507         case T_FieldStore:
02508             retval = _equalFieldStore(a, b);
02509             break;
02510         case T_RelabelType:
02511             retval = _equalRelabelType(a, b);
02512             break;
02513         case T_CoerceViaIO:
02514             retval = _equalCoerceViaIO(a, b);
02515             break;
02516         case T_ArrayCoerceExpr:
02517             retval = _equalArrayCoerceExpr(a, b);
02518             break;
02519         case T_ConvertRowtypeExpr:
02520             retval = _equalConvertRowtypeExpr(a, b);
02521             break;
02522         case T_CollateExpr:
02523             retval = _equalCollateExpr(a, b);
02524             break;
02525         case T_CaseExpr:
02526             retval = _equalCaseExpr(a, b);
02527             break;
02528         case T_CaseWhen:
02529             retval = _equalCaseWhen(a, b);
02530             break;
02531         case T_CaseTestExpr:
02532             retval = _equalCaseTestExpr(a, b);
02533             break;
02534         case T_ArrayExpr:
02535             retval = _equalArrayExpr(a, b);
02536             break;
02537         case T_RowExpr:
02538             retval = _equalRowExpr(a, b);
02539             break;
02540         case T_RowCompareExpr:
02541             retval = _equalRowCompareExpr(a, b);
02542             break;
02543         case T_CoalesceExpr:
02544             retval = _equalCoalesceExpr(a, b);
02545             break;
02546         case T_MinMaxExpr:
02547             retval = _equalMinMaxExpr(a, b);
02548             break;
02549         case T_XmlExpr:
02550             retval = _equalXmlExpr(a, b);
02551             break;
02552         case T_NullTest:
02553             retval = _equalNullTest(a, b);
02554             break;
02555         case T_BooleanTest:
02556             retval = _equalBooleanTest(a, b);
02557             break;
02558         case T_CoerceToDomain:
02559             retval = _equalCoerceToDomain(a, b);
02560             break;
02561         case T_CoerceToDomainValue:
02562             retval = _equalCoerceToDomainValue(a, b);
02563             break;
02564         case T_SetToDefault:
02565             retval = _equalSetToDefault(a, b);
02566             break;
02567         case T_CurrentOfExpr:
02568             retval = _equalCurrentOfExpr(a, b);
02569             break;
02570         case T_TargetEntry:
02571             retval = _equalTargetEntry(a, b);
02572             break;
02573         case T_RangeTblRef:
02574             retval = _equalRangeTblRef(a, b);
02575             break;
02576         case T_FromExpr:
02577             retval = _equalFromExpr(a, b);
02578             break;
02579         case T_JoinExpr:
02580             retval = _equalJoinExpr(a, b);
02581             break;
02582 
02583             /*
02584              * RELATION NODES
02585              */
02586         case T_PathKey:
02587             retval = _equalPathKey(a, b);
02588             break;
02589         case T_RestrictInfo:
02590             retval = _equalRestrictInfo(a, b);
02591             break;
02592         case T_PlaceHolderVar:
02593             retval = _equalPlaceHolderVar(a, b);
02594             break;
02595         case T_SpecialJoinInfo:
02596             retval = _equalSpecialJoinInfo(a, b);
02597             break;
02598         case T_LateralJoinInfo:
02599             retval = _equalLateralJoinInfo(a, b);
02600             break;
02601         case T_AppendRelInfo:
02602             retval = _equalAppendRelInfo(a, b);
02603             break;
02604         case T_PlaceHolderInfo:
02605             retval = _equalPlaceHolderInfo(a, b);
02606             break;
02607 
02608         case T_List:
02609         case T_IntList:
02610         case T_OidList:
02611             retval = _equalList(a, b);
02612             break;
02613 
02614         case T_Integer:
02615         case T_Float:
02616         case T_String:
02617         case T_BitString:
02618         case T_Null:
02619             retval = _equalValue(a, b);
02620             break;
02621 
02622             /*
02623              * PARSE NODES
02624              */
02625         case T_Query:
02626             retval = _equalQuery(a, b);
02627             break;
02628         case T_InsertStmt:
02629             retval = _equalInsertStmt(a, b);
02630             break;
02631         case T_DeleteStmt:
02632             retval = _equalDeleteStmt(a, b);
02633             break;
02634         case T_UpdateStmt:
02635             retval = _equalUpdateStmt(a, b);
02636             break;
02637         case T_SelectStmt:
02638             retval = _equalSelectStmt(a, b);
02639             break;
02640         case T_SetOperationStmt:
02641             retval = _equalSetOperationStmt(a, b);
02642             break;
02643         case T_AlterTableStmt:
02644             retval = _equalAlterTableStmt(a, b);
02645             break;
02646         case T_AlterTableCmd:
02647             retval = _equalAlterTableCmd(a, b);
02648             break;
02649         case T_AlterDomainStmt:
02650             retval = _equalAlterDomainStmt(a, b);
02651             break;
02652         case T_GrantStmt:
02653             retval = _equalGrantStmt(a, b);
02654             break;
02655         case T_GrantRoleStmt:
02656             retval = _equalGrantRoleStmt(a, b);
02657             break;
02658         case T_AlterDefaultPrivilegesStmt:
02659             retval = _equalAlterDefaultPrivilegesStmt(a, b);
02660             break;
02661         case T_DeclareCursorStmt:
02662             retval = _equalDeclareCursorStmt(a, b);
02663             break;
02664         case T_ClosePortalStmt:
02665             retval = _equalClosePortalStmt(a, b);
02666             break;
02667         case T_ClusterStmt:
02668             retval = _equalClusterStmt(a, b);
02669             break;
02670         case T_CopyStmt:
02671             retval = _equalCopyStmt(a, b);
02672             break;
02673         case T_CreateStmt:
02674             retval = _equalCreateStmt(a, b);
02675             break;
02676         case T_TableLikeClause:
02677             retval = _equalTableLikeClause(a, b);
02678             break;
02679         case T_DefineStmt:
02680             retval = _equalDefineStmt(a, b);
02681             break;
02682         case T_DropStmt:
02683             retval = _equalDropStmt(a, b);
02684             break;
02685         case T_TruncateStmt:
02686             retval = _equalTruncateStmt(a, b);
02687             break;
02688         case T_CommentStmt:
02689             retval = _equalCommentStmt(a, b);
02690             break;
02691         case T_SecLabelStmt:
02692             retval = _equalSecLabelStmt(a, b);
02693             break;
02694         case T_FetchStmt:
02695             retval = _equalFetchStmt(a, b);
02696             break;
02697         case T_IndexStmt:
02698             retval = _equalIndexStmt(a, b);
02699             break;
02700         case T_CreateFunctionStmt:
02701             retval = _equalCreateFunctionStmt(a, b);
02702             break;
02703         case T_FunctionParameter:
02704             retval = _equalFunctionParameter(a, b);
02705             break;
02706         case T_AlterFunctionStmt:
02707             retval = _equalAlterFunctionStmt(a, b);
02708             break;
02709         case T_DoStmt:
02710             retval = _equalDoStmt(a, b);
02711             break;
02712         case T_RenameStmt:
02713             retval = _equalRenameStmt(a, b);
02714             break;
02715         case T_AlterObjectSchemaStmt:
02716             retval = _equalAlterObjectSchemaStmt(a, b);
02717             break;
02718         case T_AlterOwnerStmt:
02719             retval = _equalAlterOwnerStmt(a, b);
02720             break;
02721         case T_RuleStmt:
02722             retval = _equalRuleStmt(a, b);
02723             break;
02724         case T_NotifyStmt:
02725             retval = _equalNotifyStmt(a, b);
02726             break;
02727         case T_ListenStmt:
02728             retval = _equalListenStmt(a, b);
02729             break;
02730         case T_UnlistenStmt:
02731             retval = _equalUnlistenStmt(a, b);
02732             break;
02733         case T_TransactionStmt:
02734             retval = _equalTransactionStmt(a, b);
02735             break;
02736         case T_CompositeTypeStmt:
02737             retval = _equalCompositeTypeStmt(a, b);
02738             break;
02739         case T_CreateEnumStmt:
02740             retval = _equalCreateEnumStmt(a, b);
02741             break;
02742         case T_CreateRangeStmt:
02743             retval = _equalCreateRangeStmt(a, b);
02744             break;
02745         case T_AlterEnumStmt:
02746             retval = _equalAlterEnumStmt(a, b);
02747             break;
02748         case T_ViewStmt:
02749             retval = _equalViewStmt(a, b);
02750             break;
02751         case T_LoadStmt:
02752             retval = _equalLoadStmt(a, b);
02753             break;
02754         case T_CreateDomainStmt:
02755             retval = _equalCreateDomainStmt(a, b);
02756             break;
02757         case T_CreateOpClassStmt:
02758             retval = _equalCreateOpClassStmt(a, b);
02759             break;
02760         case T_CreateOpClassItem:
02761             retval = _equalCreateOpClassItem(a, b);
02762             break;
02763         case T_CreateOpFamilyStmt:
02764             retval = _equalCreateOpFamilyStmt(a, b);
02765             break;
02766         case T_AlterOpFamilyStmt:
02767             retval = _equalAlterOpFamilyStmt(a, b);
02768             break;
02769         case T_CreatedbStmt:
02770             retval = _equalCreatedbStmt(a, b);
02771             break;
02772         case T_AlterDatabaseStmt:
02773             retval = _equalAlterDatabaseStmt(a, b);
02774             break;
02775         case T_AlterDatabaseSetStmt:
02776             retval = _equalAlterDatabaseSetStmt(a, b);
02777             break;
02778         case T_DropdbStmt:
02779             retval = _equalDropdbStmt(a, b);
02780             break;
02781         case T_VacuumStmt:
02782             retval = _equalVacuumStmt(a, b);
02783             break;
02784         case T_ExplainStmt:
02785             retval = _equalExplainStmt(a, b);
02786             break;
02787         case T_CreateTableAsStmt:
02788             retval = _equalCreateTableAsStmt(a, b);
02789             break;
02790         case T_RefreshMatViewStmt:
02791             retval = _equalRefreshMatViewStmt(a, b);
02792             break;
02793         case T_CreateSeqStmt:
02794             retval = _equalCreateSeqStmt(a, b);
02795             break;
02796         case T_AlterSeqStmt:
02797             retval = _equalAlterSeqStmt(a, b);
02798             break;
02799         case T_VariableSetStmt:
02800             retval = _equalVariableSetStmt(a, b);
02801             break;
02802         case T_VariableShowStmt:
02803             retval = _equalVariableShowStmt(a, b);
02804             break;
02805         case T_DiscardStmt:
02806             retval = _equalDiscardStmt(a, b);
02807             break;
02808         case T_CreateTableSpaceStmt:
02809             retval = _equalCreateTableSpaceStmt(a, b);
02810             break;
02811         case T_DropTableSpaceStmt:
02812             retval = _equalDropTableSpaceStmt(a, b);
02813             break;
02814         case T_AlterTableSpaceOptionsStmt:
02815             retval = _equalAlterTableSpaceOptionsStmt(a, b);
02816             break;
02817         case T_CreateExtensionStmt:
02818             retval = _equalCreateExtensionStmt(a, b);
02819             break;
02820         case T_AlterExtensionStmt:
02821             retval = _equalAlterExtensionStmt(a, b);
02822             break;
02823         case T_AlterExtensionContentsStmt:
02824             retval = _equalAlterExtensionContentsStmt(a, b);
02825             break;
02826         case T_CreateFdwStmt:
02827             retval = _equalCreateFdwStmt(a, b);
02828             break;
02829         case T_AlterFdwStmt:
02830             retval = _equalAlterFdwStmt(a, b);
02831             break;
02832         case T_CreateForeignServerStmt:
02833             retval = _equalCreateForeignServerStmt(a, b);
02834             break;
02835         case T_AlterForeignServerStmt:
02836             retval = _equalAlterForeignServerStmt(a, b);
02837             break;
02838         case T_CreateUserMappingStmt:
02839             retval = _equalCreateUserMappingStmt(a, b);
02840             break;
02841         case T_AlterUserMappingStmt:
02842             retval = _equalAlterUserMappingStmt(a, b);
02843             break;
02844         case T_DropUserMappingStmt:
02845             retval = _equalDropUserMappingStmt(a, b);
02846             break;
02847         case T_CreateForeignTableStmt:
02848             retval = _equalCreateForeignTableStmt(a, b);
02849             break;
02850         case T_CreateTrigStmt:
02851             retval = _equalCreateTrigStmt(a, b);
02852             break;
02853         case T_CreateEventTrigStmt:
02854             retval = _equalCreateEventTrigStmt(a, b);
02855             break;
02856         case T_AlterEventTrigStmt:
02857             retval = _equalAlterEventTrigStmt(a, b);
02858             break;
02859         case T_CreatePLangStmt:
02860             retval = _equalCreatePLangStmt(a, b);
02861             break;
02862         case T_CreateRoleStmt:
02863             retval = _equalCreateRoleStmt(a, b);
02864             break;
02865         case T_AlterRoleStmt:
02866             retval = _equalAlterRoleStmt(a, b);
02867             break;
02868         case T_AlterRoleSetStmt:
02869             retval = _equalAlterRoleSetStmt(a, b);
02870             break;
02871         case T_DropRoleStmt:
02872             retval = _equalDropRoleStmt(a, b);
02873             break;
02874         case T_LockStmt:
02875             retval = _equalLockStmt(a, b);
02876             break;
02877         case T_ConstraintsSetStmt:
02878             retval = _equalConstraintsSetStmt(a, b);
02879             break;
02880         case T_ReindexStmt:
02881             retval = _equalReindexStmt(a, b);
02882             break;
02883         case T_CheckPointStmt:
02884             retval = true;
02885             break;
02886         case T_CreateSchemaStmt:
02887             retval = _equalCreateSchemaStmt(a, b);
02888             break;
02889         case T_CreateConversionStmt:
02890             retval = _equalCreateConversionStmt(a, b);
02891             break;
02892         case T_CreateCastStmt:
02893             retval = _equalCreateCastStmt(a, b);
02894             break;
02895         case T_PrepareStmt:
02896             retval = _equalPrepareStmt(a, b);
02897             break;
02898         case T_ExecuteStmt:
02899             retval = _equalExecuteStmt(a, b);
02900             break;
02901         case T_DeallocateStmt:
02902             retval = _equalDeallocateStmt(a, b);
02903             break;
02904         case T_DropOwnedStmt:
02905             retval = _equalDropOwnedStmt(a, b);
02906             break;
02907         case T_ReassignOwnedStmt:
02908             retval = _equalReassignOwnedStmt(a, b);
02909             break;
02910         case T_AlterTSDictionaryStmt:
02911             retval = _equalAlterTSDictionaryStmt(a, b);
02912             break;
02913         case T_AlterTSConfigurationStmt:
02914             retval = _equalAlterTSConfigurationStmt(a, b);
02915             break;
02916 
02917         case T_A_Expr:
02918             retval = _equalAExpr(a, b);
02919             break;
02920         case T_ColumnRef:
02921             retval = _equalColumnRef(a, b);
02922             break;
02923         case T_ParamRef:
02924             retval = _equalParamRef(a, b);
02925             break;
02926         case T_A_Const:
02927             retval = _equalAConst(a, b);
02928             break;
02929         case T_FuncCall:
02930             retval = _equalFuncCall(a, b);
02931             break;
02932         case T_A_Star:
02933             retval = _equalAStar(a, b);
02934             break;
02935         case T_A_Indices:
02936             retval = _equalAIndices(a, b);
02937             break;
02938         case T_A_Indirection:
02939             retval = _equalA_Indirection(a, b);
02940             break;
02941         case T_A_ArrayExpr:
02942             retval = _equalA_ArrayExpr(a, b);
02943             break;
02944         case T_ResTarget:
02945             retval = _equalResTarget(a, b);
02946             break;
02947         case T_TypeCast:
02948             retval = _equalTypeCast(a, b);
02949             break;
02950         case T_CollateClause:
02951             retval = _equalCollateClause(a, b);
02952             break;
02953         case T_SortBy:
02954             retval = _equalSortBy(a, b);
02955             break;
02956         case T_WindowDef:
02957             retval = _equalWindowDef(a, b);
02958             break;
02959         case T_RangeSubselect:
02960             retval = _equalRangeSubselect(a, b);
02961             break;
02962         case T_RangeFunction:
02963             retval = _equalRangeFunction(a, b);
02964             break;
02965         case T_TypeName:
02966             retval = _equalTypeName(a, b);
02967             break;
02968         case T_IndexElem:
02969             retval = _equalIndexElem(a, b);
02970             break;
02971         case T_ColumnDef:
02972             retval = _equalColumnDef(a, b);
02973             break;
02974         case T_Constraint:
02975             retval = _equalConstraint(a, b);
02976             break;
02977         case T_DefElem:
02978             retval = _equalDefElem(a, b);
02979             break;
02980         case T_LockingClause:
02981             retval = _equalLockingClause(a, b);
02982             break;
02983         case T_RangeTblEntry:
02984             retval = _equalRangeTblEntry(a, b);
02985             break;
02986         case T_SortGroupClause:
02987             retval = _equalSortGroupClause(a, b);
02988             break;
02989         case T_WindowClause:
02990             retval = _equalWindowClause(a, b);
02991             break;
02992         case T_RowMarkClause:
02993             retval = _equalRowMarkClause(a, b);
02994             break;
02995         case T_WithClause:
02996             retval = _equalWithClause(a, b);
02997             break;
02998         case T_CommonTableExpr:
02999             retval = _equalCommonTableExpr(a, b);
03000             break;
03001         case T_PrivGrantee:
03002             retval = _equalPrivGrantee(a, b);
03003             break;
03004         case T_FuncWithArgs:
03005             retval = _equalFuncWithArgs(a, b);
03006             break;
03007         case T_AccessPriv:
03008             retval = _equalAccessPriv(a, b);
03009             break;
03010         case T_XmlSerialize:
03011             retval = _equalXmlSerialize(a, b);
03012             break;
03013 
03014         default:
03015             elog(ERROR, "unrecognized node type: %d",
03016                  (int) nodeTag(a));
03017             retval = false;     /* keep compiler quiet */
03018             break;
03019     }
03020 
03021     return retval;
03022 }