1 /*-------------------------------------------------------------------------
2  *
3  * equalfuncs.c
4  *	  Equality functions to compare node trees.
5  *
6  * NOTE: we currently support comparing all node types found in parse
7  * trees.  We do not support comparing executor state trees; there
8  * is no need for that, and no point in maintaining all the code that
9  * would be needed.  We also do not support comparing Path trees, mainly
10  * because the circular linkages between RelOptInfo and Path nodes can't
11  * be handled easily in a simple depth-first traversal.
12  *
13  * Currently, in fact, equal() doesn't know how to compare Plan trees
14  * either.  This might need to be fixed someday.
15  *
16  * NOTE: it is intentional that parse location fields (in nodes that have
17  * one) are not compared.  This is because we want, for example, a variable
18  * "x" to be considered equal() to another reference to "x" in the query.
19  *
20  *
21  * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
22  * Portions Copyright (c) 1994, Regents of the University of California
23  *
24  * IDENTIFICATION
25  *	  src/backend/nodes/equalfuncs.c
26  *
27  *-------------------------------------------------------------------------
28  */
29 
30 #include "postgres.h"
31 
32 #include "miscadmin.h"
33 #include "nodes/extensible.h"
34 #include "nodes/pathnodes.h"
35 #include "utils/datum.h"
36 
37 
38 /*
39  * Macros to simplify comparison of different kinds of fields.  Use these
40  * wherever possible to reduce the chance for silly typos.  Note that these
41  * hard-wire the convention that the local variables in an Equal routine are
42  * named 'a' and 'b'.
43  */
44 
45 /* Compare a simple scalar field (int, float, bool, enum, etc) */
46 #define COMPARE_SCALAR_FIELD(fldname) \
47 	do { \
48 		if (a->fldname != b->fldname) \
49 			return false; \
50 	} while (0)
51 
52 /* Compare a field that is a pointer to some kind of Node or Node tree */
53 #define COMPARE_NODE_FIELD(fldname) \
54 	do { \
55 		if (!equal(a->fldname, b->fldname)) \
56 			return false; \
57 	} while (0)
58 
59 /* Compare a field that is a pointer to a Bitmapset */
60 #define COMPARE_BITMAPSET_FIELD(fldname) \
61 	do { \
62 		if (!bms_equal(a->fldname, b->fldname)) \
63 			return false; \
64 	} while (0)
65 
66 /* Compare a field that is a pointer to a C string, or perhaps NULL */
67 #define COMPARE_STRING_FIELD(fldname) \
68 	do { \
69 		if (!equalstr(a->fldname, b->fldname)) \
70 			return false; \
71 	} while (0)
72 
73 /* Macro for comparing string fields that might be NULL */
74 #define equalstr(a, b)	\
75 	(((a) != NULL && (b) != NULL) ? (strcmp(a, b) == 0) : (a) == (b))
76 
77 /* Compare a field that is a pointer to a simple palloc'd object of size sz */
78 #define COMPARE_POINTER_FIELD(fldname, sz) \
79 	do { \
80 		if (memcmp(a->fldname, b->fldname, (sz)) != 0) \
81 			return false; \
82 	} while (0)
83 
84 /* Compare a parse location field (this is a no-op, per note above) */
85 #define COMPARE_LOCATION_FIELD(fldname) \
86 	((void) 0)
87 
88 /* Compare a CoercionForm field (also a no-op, per comment in primnodes.h) */
89 #define COMPARE_COERCIONFORM_FIELD(fldname) \
90 	((void) 0)
91 
92 
93 /*
94  *	Stuff from primnodes.h
95  */
96 
97 static bool
98 _equalAlias(const Alias *a, const Alias *b)
99 {
100 	COMPARE_STRING_FIELD(aliasname);
101 	COMPARE_NODE_FIELD(colnames);
102 
103 	return true;
104 }
105 
106 static bool
107 _equalRangeVar(const RangeVar *a, const RangeVar *b)
108 {
109 	COMPARE_STRING_FIELD(catalogname);
110 	COMPARE_STRING_FIELD(schemaname);
111 	COMPARE_STRING_FIELD(relname);
112 	COMPARE_SCALAR_FIELD(inh);
113 	COMPARE_SCALAR_FIELD(relpersistence);
114 	COMPARE_NODE_FIELD(alias);
115 	COMPARE_LOCATION_FIELD(location);
116 
117 	return true;
118 }
119 
120 static bool
121 _equalTableFunc(const TableFunc *a, const TableFunc *b)
122 {
123 	COMPARE_NODE_FIELD(ns_uris);
124 	COMPARE_NODE_FIELD(ns_names);
125 	COMPARE_NODE_FIELD(docexpr);
126 	COMPARE_NODE_FIELD(rowexpr);
127 	COMPARE_NODE_FIELD(colnames);
128 	COMPARE_NODE_FIELD(coltypes);
129 	COMPARE_NODE_FIELD(coltypmods);
130 	COMPARE_NODE_FIELD(colcollations);
131 	COMPARE_NODE_FIELD(colexprs);
132 	COMPARE_NODE_FIELD(coldefexprs);
133 	COMPARE_BITMAPSET_FIELD(notnulls);
134 	COMPARE_SCALAR_FIELD(ordinalitycol);
135 	COMPARE_LOCATION_FIELD(location);
136 
137 	return true;
138 }
139 
140 static bool
141 _equalIntoClause(const IntoClause *a, const IntoClause *b)
142 {
143 	COMPARE_NODE_FIELD(rel);
144 	COMPARE_NODE_FIELD(colNames);
145 	COMPARE_STRING_FIELD(accessMethod);
146 	COMPARE_NODE_FIELD(options);
147 	COMPARE_SCALAR_FIELD(onCommit);
148 	COMPARE_STRING_FIELD(tableSpaceName);
149 	COMPARE_NODE_FIELD(viewQuery);
150 	COMPARE_SCALAR_FIELD(skipData);
151 
152 	return true;
153 }
154 
155 /*
156  * We don't need an _equalExpr because Expr is an abstract supertype which
157  * should never actually get instantiated.  Also, since it has no common
158  * fields except NodeTag, there's no need for a helper routine to factor
159  * out comparing the common fields...
160  */
161 
162 static bool
163 _equalVar(const Var *a, const Var *b)
164 {
165 	COMPARE_SCALAR_FIELD(varno);
166 	COMPARE_SCALAR_FIELD(varattno);
167 	COMPARE_SCALAR_FIELD(vartype);
168 	COMPARE_SCALAR_FIELD(vartypmod);
169 	COMPARE_SCALAR_FIELD(varcollid);
170 	COMPARE_SCALAR_FIELD(varlevelsup);
171 
172 	/*
173 	 * varnosyn/varattnosyn are intentionally ignored here, because Vars with
174 	 * different syntactic identifiers are semantically the same as long as
175 	 * their varno/varattno match.
176 	 */
177 	COMPARE_LOCATION_FIELD(location);
178 
179 	return true;
180 }
181 
182 static bool
183 _equalConst(const Const *a, const Const *b)
184 {
185 	COMPARE_SCALAR_FIELD(consttype);
186 	COMPARE_SCALAR_FIELD(consttypmod);
187 	COMPARE_SCALAR_FIELD(constcollid);
188 	COMPARE_SCALAR_FIELD(constlen);
189 	COMPARE_SCALAR_FIELD(constisnull);
190 	COMPARE_SCALAR_FIELD(constbyval);
191 	COMPARE_LOCATION_FIELD(location);
192 
193 	/*
194 	 * We treat all NULL constants of the same type as equal. Someday this
195 	 * might need to change?  But datumIsEqual doesn't work on nulls, so...
196 	 */
197 	if (a->constisnull)
198 		return true;
199 	return datumIsEqual(a->constvalue, b->constvalue,
200 						a->constbyval, a->constlen);
201 }
202 
203 static bool
204 _equalParam(const Param *a, const Param *b)
205 {
206 	COMPARE_SCALAR_FIELD(paramkind);
207 	COMPARE_SCALAR_FIELD(paramid);
208 	COMPARE_SCALAR_FIELD(paramtype);
209 	COMPARE_SCALAR_FIELD(paramtypmod);
210 	COMPARE_SCALAR_FIELD(paramcollid);
211 	COMPARE_LOCATION_FIELD(location);
212 
213 	return true;
214 }
215 
216 static bool
217 _equalAggref(const Aggref *a, const Aggref *b)
218 {
219 	COMPARE_SCALAR_FIELD(aggfnoid);
220 	COMPARE_SCALAR_FIELD(aggtype);
221 	COMPARE_SCALAR_FIELD(aggcollid);
222 	COMPARE_SCALAR_FIELD(inputcollid);
223 	/* ignore aggtranstype since it might not be set yet */
224 	COMPARE_NODE_FIELD(aggargtypes);
225 	COMPARE_NODE_FIELD(aggdirectargs);
226 	COMPARE_NODE_FIELD(args);
227 	COMPARE_NODE_FIELD(aggorder);
228 	COMPARE_NODE_FIELD(aggdistinct);
229 	COMPARE_NODE_FIELD(aggfilter);
230 	COMPARE_SCALAR_FIELD(aggstar);
231 	COMPARE_SCALAR_FIELD(aggvariadic);
232 	COMPARE_SCALAR_FIELD(aggkind);
233 	COMPARE_SCALAR_FIELD(agglevelsup);
234 	COMPARE_SCALAR_FIELD(aggsplit);
235 	COMPARE_LOCATION_FIELD(location);
236 
237 	return true;
238 }
239 
240 static bool
241 _equalGroupingFunc(const GroupingFunc *a, const GroupingFunc *b)
242 {
243 	COMPARE_NODE_FIELD(args);
244 
245 	/*
246 	 * We must not compare the refs or cols field
247 	 */
248 
249 	COMPARE_SCALAR_FIELD(agglevelsup);
250 	COMPARE_LOCATION_FIELD(location);
251 
252 	return true;
253 }
254 
255 static bool
256 _equalWindowFunc(const WindowFunc *a, const WindowFunc *b)
257 {
258 	COMPARE_SCALAR_FIELD(winfnoid);
259 	COMPARE_SCALAR_FIELD(wintype);
260 	COMPARE_SCALAR_FIELD(wincollid);
261 	COMPARE_SCALAR_FIELD(inputcollid);
262 	COMPARE_NODE_FIELD(args);
263 	COMPARE_NODE_FIELD(aggfilter);
264 	COMPARE_SCALAR_FIELD(winref);
265 	COMPARE_SCALAR_FIELD(winstar);
266 	COMPARE_SCALAR_FIELD(winagg);
267 	COMPARE_LOCATION_FIELD(location);
268 
269 	return true;
270 }
271 
272 static bool
273 _equalSubscriptingRef(const SubscriptingRef *a, const SubscriptingRef *b)
274 {
275 	COMPARE_SCALAR_FIELD(refcontainertype);
276 	COMPARE_SCALAR_FIELD(refelemtype);
277 	COMPARE_SCALAR_FIELD(reftypmod);
278 	COMPARE_SCALAR_FIELD(refcollid);
279 	COMPARE_NODE_FIELD(refupperindexpr);
280 	COMPARE_NODE_FIELD(reflowerindexpr);
281 	COMPARE_NODE_FIELD(refexpr);
282 	COMPARE_NODE_FIELD(refassgnexpr);
283 
284 	return true;
285 }
286 
287 static bool
288 _equalFuncExpr(const FuncExpr *a, const FuncExpr *b)
289 {
290 	COMPARE_SCALAR_FIELD(funcid);
291 	COMPARE_SCALAR_FIELD(funcresulttype);
292 	COMPARE_SCALAR_FIELD(funcretset);
293 	COMPARE_SCALAR_FIELD(funcvariadic);
294 	COMPARE_COERCIONFORM_FIELD(funcformat);
295 	COMPARE_SCALAR_FIELD(funccollid);
296 	COMPARE_SCALAR_FIELD(inputcollid);
297 	COMPARE_NODE_FIELD(args);
298 	COMPARE_LOCATION_FIELD(location);
299 
300 	return true;
301 }
302 
303 static bool
304 _equalNamedArgExpr(const NamedArgExpr *a, const NamedArgExpr *b)
305 {
306 	COMPARE_NODE_FIELD(arg);
307 	COMPARE_STRING_FIELD(name);
308 	COMPARE_SCALAR_FIELD(argnumber);
309 	COMPARE_LOCATION_FIELD(location);
310 
311 	return true;
312 }
313 
314 static bool
315 _equalOpExpr(const OpExpr *a, const OpExpr *b)
316 {
317 	COMPARE_SCALAR_FIELD(opno);
318 
319 	/*
320 	 * Special-case opfuncid: it is allowable for it to differ if one node
321 	 * contains zero and the other doesn't.  This just means that the one node
322 	 * isn't as far along in the parse/plan pipeline and hasn't had the
323 	 * opfuncid cache filled yet.
324 	 */
325 	if (a->opfuncid != b->opfuncid &&
326 		a->opfuncid != 0 &&
327 		b->opfuncid != 0)
328 		return false;
329 
330 	COMPARE_SCALAR_FIELD(opresulttype);
331 	COMPARE_SCALAR_FIELD(opretset);
332 	COMPARE_SCALAR_FIELD(opcollid);
333 	COMPARE_SCALAR_FIELD(inputcollid);
334 	COMPARE_NODE_FIELD(args);
335 	COMPARE_LOCATION_FIELD(location);
336 
337 	return true;
338 }
339 
340 static bool
341 _equalDistinctExpr(const DistinctExpr *a, const DistinctExpr *b)
342 {
343 	COMPARE_SCALAR_FIELD(opno);
344 
345 	/*
346 	 * Special-case opfuncid: it is allowable for it to differ if one node
347 	 * contains zero and the other doesn't.  This just means that the one node
348 	 * isn't as far along in the parse/plan pipeline and hasn't had the
349 	 * opfuncid cache filled yet.
350 	 */
351 	if (a->opfuncid != b->opfuncid &&
352 		a->opfuncid != 0 &&
353 		b->opfuncid != 0)
354 		return false;
355 
356 	COMPARE_SCALAR_FIELD(opresulttype);
357 	COMPARE_SCALAR_FIELD(opretset);
358 	COMPARE_SCALAR_FIELD(opcollid);
359 	COMPARE_SCALAR_FIELD(inputcollid);
360 	COMPARE_NODE_FIELD(args);
361 	COMPARE_LOCATION_FIELD(location);
362 
363 	return true;
364 }
365 
366 static bool
367 _equalNullIfExpr(const NullIfExpr *a, const NullIfExpr *b)
368 {
369 	COMPARE_SCALAR_FIELD(opno);
370 
371 	/*
372 	 * Special-case opfuncid: it is allowable for it to differ if one node
373 	 * contains zero and the other doesn't.  This just means that the one node
374 	 * isn't as far along in the parse/plan pipeline and hasn't had the
375 	 * opfuncid cache filled yet.
376 	 */
377 	if (a->opfuncid != b->opfuncid &&
378 		a->opfuncid != 0 &&
379 		b->opfuncid != 0)
380 		return false;
381 
382 	COMPARE_SCALAR_FIELD(opresulttype);
383 	COMPARE_SCALAR_FIELD(opretset);
384 	COMPARE_SCALAR_FIELD(opcollid);
385 	COMPARE_SCALAR_FIELD(inputcollid);
386 	COMPARE_NODE_FIELD(args);
387 	COMPARE_LOCATION_FIELD(location);
388 
389 	return true;
390 }
391 
392 static bool
393 _equalScalarArrayOpExpr(const ScalarArrayOpExpr *a, const ScalarArrayOpExpr *b)
394 {
395 	COMPARE_SCALAR_FIELD(opno);
396 
397 	/*
398 	 * Special-case opfuncid: it is allowable for it to differ if one node
399 	 * contains zero and the other doesn't.  This just means that the one node
400 	 * isn't as far along in the parse/plan pipeline and hasn't had the
401 	 * opfuncid cache filled yet.
402 	 */
403 	if (a->opfuncid != b->opfuncid &&
404 		a->opfuncid != 0 &&
405 		b->opfuncid != 0)
406 		return false;
407 
408 	COMPARE_SCALAR_FIELD(useOr);
409 	COMPARE_SCALAR_FIELD(inputcollid);
410 	COMPARE_NODE_FIELD(args);
411 	COMPARE_LOCATION_FIELD(location);
412 
413 	return true;
414 }
415 
416 static bool
417 _equalBoolExpr(const BoolExpr *a, const BoolExpr *b)
418 {
419 	COMPARE_SCALAR_FIELD(boolop);
420 	COMPARE_NODE_FIELD(args);
421 	COMPARE_LOCATION_FIELD(location);
422 
423 	return true;
424 }
425 
426 static bool
427 _equalSubLink(const SubLink *a, const SubLink *b)
428 {
429 	COMPARE_SCALAR_FIELD(subLinkType);
430 	COMPARE_SCALAR_FIELD(subLinkId);
431 	COMPARE_NODE_FIELD(testexpr);
432 	COMPARE_NODE_FIELD(operName);
433 	COMPARE_NODE_FIELD(subselect);
434 	COMPARE_LOCATION_FIELD(location);
435 
436 	return true;
437 }
438 
439 static bool
440 _equalSubPlan(const SubPlan *a, const SubPlan *b)
441 {
442 	COMPARE_SCALAR_FIELD(subLinkType);
443 	COMPARE_NODE_FIELD(testexpr);
444 	COMPARE_NODE_FIELD(paramIds);
445 	COMPARE_SCALAR_FIELD(plan_id);
446 	COMPARE_STRING_FIELD(plan_name);
447 	COMPARE_SCALAR_FIELD(firstColType);
448 	COMPARE_SCALAR_FIELD(firstColTypmod);
449 	COMPARE_SCALAR_FIELD(firstColCollation);
450 	COMPARE_SCALAR_FIELD(useHashTable);
451 	COMPARE_SCALAR_FIELD(unknownEqFalse);
452 	COMPARE_SCALAR_FIELD(parallel_safe);
453 	COMPARE_NODE_FIELD(setParam);
454 	COMPARE_NODE_FIELD(parParam);
455 	COMPARE_NODE_FIELD(args);
456 	COMPARE_SCALAR_FIELD(startup_cost);
457 	COMPARE_SCALAR_FIELD(per_call_cost);
458 
459 	return true;
460 }
461 
462 static bool
463 _equalAlternativeSubPlan(const AlternativeSubPlan *a, const AlternativeSubPlan *b)
464 {
465 	COMPARE_NODE_FIELD(subplans);
466 
467 	return true;
468 }
469 
470 static bool
471 _equalFieldSelect(const FieldSelect *a, const FieldSelect *b)
472 {
473 	COMPARE_NODE_FIELD(arg);
474 	COMPARE_SCALAR_FIELD(fieldnum);
475 	COMPARE_SCALAR_FIELD(resulttype);
476 	COMPARE_SCALAR_FIELD(resulttypmod);
477 	COMPARE_SCALAR_FIELD(resultcollid);
478 
479 	return true;
480 }
481 
482 static bool
483 _equalFieldStore(const FieldStore *a, const FieldStore *b)
484 {
485 	COMPARE_NODE_FIELD(arg);
486 	COMPARE_NODE_FIELD(newvals);
487 	COMPARE_NODE_FIELD(fieldnums);
488 	COMPARE_SCALAR_FIELD(resulttype);
489 
490 	return true;
491 }
492 
493 static bool
494 _equalRelabelType(const RelabelType *a, const RelabelType *b)
495 {
496 	COMPARE_NODE_FIELD(arg);
497 	COMPARE_SCALAR_FIELD(resulttype);
498 	COMPARE_SCALAR_FIELD(resulttypmod);
499 	COMPARE_SCALAR_FIELD(resultcollid);
500 	COMPARE_COERCIONFORM_FIELD(relabelformat);
501 	COMPARE_LOCATION_FIELD(location);
502 
503 	return true;
504 }
505 
506 static bool
507 _equalCoerceViaIO(const CoerceViaIO *a, const CoerceViaIO *b)
508 {
509 	COMPARE_NODE_FIELD(arg);
510 	COMPARE_SCALAR_FIELD(resulttype);
511 	COMPARE_SCALAR_FIELD(resultcollid);
512 	COMPARE_COERCIONFORM_FIELD(coerceformat);
513 	COMPARE_LOCATION_FIELD(location);
514 
515 	return true;
516 }
517 
518 static bool
519 _equalArrayCoerceExpr(const ArrayCoerceExpr *a, const ArrayCoerceExpr *b)
520 {
521 	COMPARE_NODE_FIELD(arg);
522 	COMPARE_NODE_FIELD(elemexpr);
523 	COMPARE_SCALAR_FIELD(resulttype);
524 	COMPARE_SCALAR_FIELD(resulttypmod);
525 	COMPARE_SCALAR_FIELD(resultcollid);
526 	COMPARE_COERCIONFORM_FIELD(coerceformat);
527 	COMPARE_LOCATION_FIELD(location);
528 
529 	return true;
530 }
531 
532 static bool
533 _equalConvertRowtypeExpr(const ConvertRowtypeExpr *a, const ConvertRowtypeExpr *b)
534 {
535 	COMPARE_NODE_FIELD(arg);
536 	COMPARE_SCALAR_FIELD(resulttype);
537 	COMPARE_COERCIONFORM_FIELD(convertformat);
538 	COMPARE_LOCATION_FIELD(location);
539 
540 	return true;
541 }
542 
543 static bool
544 _equalCollateExpr(const CollateExpr *a, const CollateExpr *b)
545 {
546 	COMPARE_NODE_FIELD(arg);
547 	COMPARE_SCALAR_FIELD(collOid);
548 	COMPARE_LOCATION_FIELD(location);
549 
550 	return true;
551 }
552 
553 static bool
554 _equalCaseExpr(const CaseExpr *a, const CaseExpr *b)
555 {
556 	COMPARE_SCALAR_FIELD(casetype);
557 	COMPARE_SCALAR_FIELD(casecollid);
558 	COMPARE_NODE_FIELD(arg);
559 	COMPARE_NODE_FIELD(args);
560 	COMPARE_NODE_FIELD(defresult);
561 	COMPARE_LOCATION_FIELD(location);
562 
563 	return true;
564 }
565 
566 static bool
567 _equalCaseWhen(const CaseWhen *a, const CaseWhen *b)
568 {
569 	COMPARE_NODE_FIELD(expr);
570 	COMPARE_NODE_FIELD(result);
571 	COMPARE_LOCATION_FIELD(location);
572 
573 	return true;
574 }
575 
576 static bool
577 _equalCaseTestExpr(const CaseTestExpr *a, const CaseTestExpr *b)
578 {
579 	COMPARE_SCALAR_FIELD(typeId);
580 	COMPARE_SCALAR_FIELD(typeMod);
581 	COMPARE_SCALAR_FIELD(collation);
582 
583 	return true;
584 }
585 
586 static bool
587 _equalArrayExpr(const ArrayExpr *a, const ArrayExpr *b)
588 {
589 	COMPARE_SCALAR_FIELD(array_typeid);
590 	COMPARE_SCALAR_FIELD(array_collid);
591 	COMPARE_SCALAR_FIELD(element_typeid);
592 	COMPARE_NODE_FIELD(elements);
593 	COMPARE_SCALAR_FIELD(multidims);
594 	COMPARE_LOCATION_FIELD(location);
595 
596 	return true;
597 }
598 
599 static bool
600 _equalRowExpr(const RowExpr *a, const RowExpr *b)
601 {
602 	COMPARE_NODE_FIELD(args);
603 	COMPARE_SCALAR_FIELD(row_typeid);
604 	COMPARE_COERCIONFORM_FIELD(row_format);
605 	COMPARE_NODE_FIELD(colnames);
606 	COMPARE_LOCATION_FIELD(location);
607 
608 	return true;
609 }
610 
611 static bool
612 _equalRowCompareExpr(const RowCompareExpr *a, const RowCompareExpr *b)
613 {
614 	COMPARE_SCALAR_FIELD(rctype);
615 	COMPARE_NODE_FIELD(opnos);
616 	COMPARE_NODE_FIELD(opfamilies);
617 	COMPARE_NODE_FIELD(inputcollids);
618 	COMPARE_NODE_FIELD(largs);
619 	COMPARE_NODE_FIELD(rargs);
620 
621 	return true;
622 }
623 
624 static bool
625 _equalCoalesceExpr(const CoalesceExpr *a, const CoalesceExpr *b)
626 {
627 	COMPARE_SCALAR_FIELD(coalescetype);
628 	COMPARE_SCALAR_FIELD(coalescecollid);
629 	COMPARE_NODE_FIELD(args);
630 	COMPARE_LOCATION_FIELD(location);
631 
632 	return true;
633 }
634 
635 static bool
636 _equalMinMaxExpr(const MinMaxExpr *a, const MinMaxExpr *b)
637 {
638 	COMPARE_SCALAR_FIELD(minmaxtype);
639 	COMPARE_SCALAR_FIELD(minmaxcollid);
640 	COMPARE_SCALAR_FIELD(inputcollid);
641 	COMPARE_SCALAR_FIELD(op);
642 	COMPARE_NODE_FIELD(args);
643 	COMPARE_LOCATION_FIELD(location);
644 
645 	return true;
646 }
647 
648 static bool
649 _equalSQLValueFunction(const SQLValueFunction *a, const SQLValueFunction *b)
650 {
651 	COMPARE_SCALAR_FIELD(op);
652 	COMPARE_SCALAR_FIELD(type);
653 	COMPARE_SCALAR_FIELD(typmod);
654 	COMPARE_LOCATION_FIELD(location);
655 
656 	return true;
657 }
658 
659 static bool
660 _equalXmlExpr(const XmlExpr *a, const XmlExpr *b)
661 {
662 	COMPARE_SCALAR_FIELD(op);
663 	COMPARE_STRING_FIELD(name);
664 	COMPARE_NODE_FIELD(named_args);
665 	COMPARE_NODE_FIELD(arg_names);
666 	COMPARE_NODE_FIELD(args);
667 	COMPARE_SCALAR_FIELD(xmloption);
668 	COMPARE_SCALAR_FIELD(type);
669 	COMPARE_SCALAR_FIELD(typmod);
670 	COMPARE_LOCATION_FIELD(location);
671 
672 	return true;
673 }
674 
675 static bool
676 _equalNullTest(const NullTest *a, const NullTest *b)
677 {
678 	COMPARE_NODE_FIELD(arg);
679 	COMPARE_SCALAR_FIELD(nulltesttype);
680 	COMPARE_SCALAR_FIELD(argisrow);
681 	COMPARE_LOCATION_FIELD(location);
682 
683 	return true;
684 }
685 
686 static bool
687 _equalBooleanTest(const BooleanTest *a, const BooleanTest *b)
688 {
689 	COMPARE_NODE_FIELD(arg);
690 	COMPARE_SCALAR_FIELD(booltesttype);
691 	COMPARE_LOCATION_FIELD(location);
692 
693 	return true;
694 }
695 
696 static bool
697 _equalCoerceToDomain(const CoerceToDomain *a, const CoerceToDomain *b)
698 {
699 	COMPARE_NODE_FIELD(arg);
700 	COMPARE_SCALAR_FIELD(resulttype);
701 	COMPARE_SCALAR_FIELD(resulttypmod);
702 	COMPARE_SCALAR_FIELD(resultcollid);
703 	COMPARE_COERCIONFORM_FIELD(coercionformat);
704 	COMPARE_LOCATION_FIELD(location);
705 
706 	return true;
707 }
708 
709 static bool
710 _equalCoerceToDomainValue(const CoerceToDomainValue *a, const CoerceToDomainValue *b)
711 {
712 	COMPARE_SCALAR_FIELD(typeId);
713 	COMPARE_SCALAR_FIELD(typeMod);
714 	COMPARE_SCALAR_FIELD(collation);
715 	COMPARE_LOCATION_FIELD(location);
716 
717 	return true;
718 }
719 
720 static bool
721 _equalSetToDefault(const SetToDefault *a, const SetToDefault *b)
722 {
723 	COMPARE_SCALAR_FIELD(typeId);
724 	COMPARE_SCALAR_FIELD(typeMod);
725 	COMPARE_SCALAR_FIELD(collation);
726 	COMPARE_LOCATION_FIELD(location);
727 
728 	return true;
729 }
730 
731 static bool
732 _equalCurrentOfExpr(const CurrentOfExpr *a, const CurrentOfExpr *b)
733 {
734 	COMPARE_SCALAR_FIELD(cvarno);
735 	COMPARE_STRING_FIELD(cursor_name);
736 	COMPARE_SCALAR_FIELD(cursor_param);
737 
738 	return true;
739 }
740 
741 static bool
742 _equalNextValueExpr(const NextValueExpr *a, const NextValueExpr *b)
743 {
744 	COMPARE_SCALAR_FIELD(seqid);
745 	COMPARE_SCALAR_FIELD(typeId);
746 
747 	return true;
748 }
749 
750 static bool
751 _equalInferenceElem(const InferenceElem *a, const InferenceElem *b)
752 {
753 	COMPARE_NODE_FIELD(expr);
754 	COMPARE_SCALAR_FIELD(infercollid);
755 	COMPARE_SCALAR_FIELD(inferopclass);
756 
757 	return true;
758 }
759 
760 static bool
761 _equalTargetEntry(const TargetEntry *a, const TargetEntry *b)
762 {
763 	COMPARE_NODE_FIELD(expr);
764 	COMPARE_SCALAR_FIELD(resno);
765 	COMPARE_STRING_FIELD(resname);
766 	COMPARE_SCALAR_FIELD(ressortgroupref);
767 	COMPARE_SCALAR_FIELD(resorigtbl);
768 	COMPARE_SCALAR_FIELD(resorigcol);
769 	COMPARE_SCALAR_FIELD(resjunk);
770 
771 	return true;
772 }
773 
774 static bool
775 _equalRangeTblRef(const RangeTblRef *a, const RangeTblRef *b)
776 {
777 	COMPARE_SCALAR_FIELD(rtindex);
778 
779 	return true;
780 }
781 
782 static bool
783 _equalJoinExpr(const JoinExpr *a, const JoinExpr *b)
784 {
785 	COMPARE_SCALAR_FIELD(jointype);
786 	COMPARE_SCALAR_FIELD(isNatural);
787 	COMPARE_NODE_FIELD(larg);
788 	COMPARE_NODE_FIELD(rarg);
789 	COMPARE_NODE_FIELD(usingClause);
790 	COMPARE_NODE_FIELD(quals);
791 	COMPARE_NODE_FIELD(alias);
792 	COMPARE_SCALAR_FIELD(rtindex);
793 
794 	return true;
795 }
796 
797 static bool
798 _equalFromExpr(const FromExpr *a, const FromExpr *b)
799 {
800 	COMPARE_NODE_FIELD(fromlist);
801 	COMPARE_NODE_FIELD(quals);
802 
803 	return true;
804 }
805 
806 static bool
807 _equalOnConflictExpr(const OnConflictExpr *a, const OnConflictExpr *b)
808 {
809 	COMPARE_SCALAR_FIELD(action);
810 	COMPARE_NODE_FIELD(arbiterElems);
811 	COMPARE_NODE_FIELD(arbiterWhere);
812 	COMPARE_SCALAR_FIELD(constraint);
813 	COMPARE_NODE_FIELD(onConflictSet);
814 	COMPARE_NODE_FIELD(onConflictWhere);
815 	COMPARE_SCALAR_FIELD(exclRelIndex);
816 	COMPARE_NODE_FIELD(exclRelTlist);
817 
818 	return true;
819 }
820 
821 /*
822  * Stuff from pathnodes.h
823  */
824 
825 static bool
826 _equalPathKey(const PathKey *a, const PathKey *b)
827 {
828 	/* We assume pointer equality is sufficient to compare the eclasses */
829 	COMPARE_SCALAR_FIELD(pk_eclass);
830 	COMPARE_SCALAR_FIELD(pk_opfamily);
831 	COMPARE_SCALAR_FIELD(pk_strategy);
832 	COMPARE_SCALAR_FIELD(pk_nulls_first);
833 
834 	return true;
835 }
836 
837 static bool
838 _equalRestrictInfo(const RestrictInfo *a, const RestrictInfo *b)
839 {
840 	COMPARE_NODE_FIELD(clause);
841 	COMPARE_SCALAR_FIELD(is_pushed_down);
842 	COMPARE_SCALAR_FIELD(outerjoin_delayed);
843 	COMPARE_SCALAR_FIELD(security_level);
844 	COMPARE_BITMAPSET_FIELD(required_relids);
845 	COMPARE_BITMAPSET_FIELD(outer_relids);
846 	COMPARE_BITMAPSET_FIELD(nullable_relids);
847 
848 	/*
849 	 * We ignore all the remaining fields, since they may not be set yet, and
850 	 * should be derivable from the clause anyway.
851 	 */
852 
853 	return true;
854 }
855 
856 static bool
857 _equalPlaceHolderVar(const PlaceHolderVar *a, const PlaceHolderVar *b)
858 {
859 	/*
860 	 * We intentionally do not compare phexpr.  Two PlaceHolderVars with the
861 	 * same ID and levelsup should be considered equal even if the contained
862 	 * expressions have managed to mutate to different states.  This will
863 	 * happen during final plan construction when there are nested PHVs, since
864 	 * the inner PHV will get replaced by a Param in some copies of the outer
865 	 * PHV.  Another way in which it can happen is that initplan sublinks
866 	 * could get replaced by differently-numbered Params when sublink folding
867 	 * is done.  (The end result of such a situation would be some
868 	 * unreferenced initplans, which is annoying but not really a problem.) On
869 	 * the same reasoning, there is no need to examine phrels.
870 	 *
871 	 * COMPARE_NODE_FIELD(phexpr);
872 	 *
873 	 * COMPARE_BITMAPSET_FIELD(phrels);
874 	 */
875 	COMPARE_SCALAR_FIELD(phid);
876 	COMPARE_SCALAR_FIELD(phlevelsup);
877 
878 	return true;
879 }
880 
881 static bool
882 _equalSpecialJoinInfo(const SpecialJoinInfo *a, const SpecialJoinInfo *b)
883 {
884 	COMPARE_BITMAPSET_FIELD(min_lefthand);
885 	COMPARE_BITMAPSET_FIELD(min_righthand);
886 	COMPARE_BITMAPSET_FIELD(syn_lefthand);
887 	COMPARE_BITMAPSET_FIELD(syn_righthand);
888 	COMPARE_SCALAR_FIELD(jointype);
889 	COMPARE_SCALAR_FIELD(lhs_strict);
890 	COMPARE_SCALAR_FIELD(delay_upper_joins);
891 	COMPARE_SCALAR_FIELD(semi_can_btree);
892 	COMPARE_SCALAR_FIELD(semi_can_hash);
893 	COMPARE_NODE_FIELD(semi_operators);
894 	COMPARE_NODE_FIELD(semi_rhs_exprs);
895 
896 	return true;
897 }
898 
899 static bool
900 _equalAppendRelInfo(const AppendRelInfo *a, const AppendRelInfo *b)
901 {
902 	COMPARE_SCALAR_FIELD(parent_relid);
903 	COMPARE_SCALAR_FIELD(child_relid);
904 	COMPARE_SCALAR_FIELD(parent_reltype);
905 	COMPARE_SCALAR_FIELD(child_reltype);
906 	COMPARE_NODE_FIELD(translated_vars);
907 	COMPARE_SCALAR_FIELD(num_child_cols);
908 	COMPARE_POINTER_FIELD(parent_colnos, a->num_child_cols * sizeof(AttrNumber));
909 	COMPARE_SCALAR_FIELD(parent_reloid);
910 
911 	return true;
912 }
913 
914 static bool
915 _equalPlaceHolderInfo(const PlaceHolderInfo *a, const PlaceHolderInfo *b)
916 {
917 	COMPARE_SCALAR_FIELD(phid);
918 	COMPARE_NODE_FIELD(ph_var); /* should be redundant */
919 	COMPARE_BITMAPSET_FIELD(ph_eval_at);
920 	COMPARE_BITMAPSET_FIELD(ph_lateral);
921 	COMPARE_BITMAPSET_FIELD(ph_needed);
922 	COMPARE_SCALAR_FIELD(ph_width);
923 
924 	return true;
925 }
926 
927 /*
928  * Stuff from extensible.h
929  */
930 static bool
931 _equalExtensibleNode(const ExtensibleNode *a, const ExtensibleNode *b)
932 {
933 	const ExtensibleNodeMethods *methods;
934 
935 	COMPARE_STRING_FIELD(extnodename);
936 
937 	/* At this point, we know extnodename is the same for both nodes. */
938 	methods = GetExtensibleNodeMethods(a->extnodename, false);
939 
940 	/* compare the private fields */
941 	if (!methods->nodeEqual(a, b))
942 		return false;
943 
944 	return true;
945 }
946 
947 /*
948  * Stuff from parsenodes.h
949  */
950 
951 static bool
952 _equalQuery(const Query *a, const Query *b)
953 {
954 	COMPARE_SCALAR_FIELD(commandType);
955 	COMPARE_SCALAR_FIELD(querySource);
956 	/* we intentionally ignore queryId, since it might not be set */
957 	COMPARE_SCALAR_FIELD(canSetTag);
958 	COMPARE_NODE_FIELD(utilityStmt);
959 	COMPARE_SCALAR_FIELD(resultRelation);
960 	COMPARE_SCALAR_FIELD(hasAggs);
961 	COMPARE_SCALAR_FIELD(hasWindowFuncs);
962 	COMPARE_SCALAR_FIELD(hasTargetSRFs);
963 	COMPARE_SCALAR_FIELD(hasSubLinks);
964 	COMPARE_SCALAR_FIELD(hasDistinctOn);
965 	COMPARE_SCALAR_FIELD(hasRecursive);
966 	COMPARE_SCALAR_FIELD(hasModifyingCTE);
967 	COMPARE_SCALAR_FIELD(hasForUpdate);
968 	COMPARE_SCALAR_FIELD(hasRowSecurity);
969 	COMPARE_NODE_FIELD(cteList);
970 	COMPARE_NODE_FIELD(rtable);
971 	COMPARE_NODE_FIELD(jointree);
972 	COMPARE_NODE_FIELD(targetList);
973 	COMPARE_SCALAR_FIELD(override);
974 	COMPARE_NODE_FIELD(onConflict);
975 	COMPARE_NODE_FIELD(returningList);
976 	COMPARE_NODE_FIELD(groupClause);
977 	COMPARE_NODE_FIELD(groupingSets);
978 	COMPARE_NODE_FIELD(havingQual);
979 	COMPARE_NODE_FIELD(windowClause);
980 	COMPARE_NODE_FIELD(distinctClause);
981 	COMPARE_NODE_FIELD(sortClause);
982 	COMPARE_NODE_FIELD(limitOffset);
983 	COMPARE_NODE_FIELD(limitCount);
984 	COMPARE_SCALAR_FIELD(limitOption);
985 	COMPARE_NODE_FIELD(rowMarks);
986 	COMPARE_NODE_FIELD(setOperations);
987 	COMPARE_NODE_FIELD(constraintDeps);
988 	COMPARE_NODE_FIELD(withCheckOptions);
989 	COMPARE_LOCATION_FIELD(stmt_location);
990 	COMPARE_SCALAR_FIELD(stmt_len);
991 
992 	return true;
993 }
994 
995 static bool
996 _equalRawStmt(const RawStmt *a, const RawStmt *b)
997 {
998 	COMPARE_NODE_FIELD(stmt);
999 	COMPARE_LOCATION_FIELD(stmt_location);
1000 	COMPARE_SCALAR_FIELD(stmt_len);
1001 
1002 	return true;
1003 }
1004 
1005 static bool
1006 _equalInsertStmt(const InsertStmt *a, const InsertStmt *b)
1007 {
1008 	COMPARE_NODE_FIELD(relation);
1009 	COMPARE_NODE_FIELD(cols);
1010 	COMPARE_NODE_FIELD(selectStmt);
1011 	COMPARE_NODE_FIELD(onConflictClause);
1012 	COMPARE_NODE_FIELD(returningList);
1013 	COMPARE_NODE_FIELD(withClause);
1014 	COMPARE_SCALAR_FIELD(override);
1015 
1016 	return true;
1017 }
1018 
1019 static bool
1020 _equalDeleteStmt(const DeleteStmt *a, const DeleteStmt *b)
1021 {
1022 	COMPARE_NODE_FIELD(relation);
1023 	COMPARE_NODE_FIELD(usingClause);
1024 	COMPARE_NODE_FIELD(whereClause);
1025 	COMPARE_NODE_FIELD(returningList);
1026 	COMPARE_NODE_FIELD(withClause);
1027 
1028 	return true;
1029 }
1030 
1031 static bool
1032 _equalUpdateStmt(const UpdateStmt *a, const UpdateStmt *b)
1033 {
1034 	COMPARE_NODE_FIELD(relation);
1035 	COMPARE_NODE_FIELD(targetList);
1036 	COMPARE_NODE_FIELD(whereClause);
1037 	COMPARE_NODE_FIELD(fromClause);
1038 	COMPARE_NODE_FIELD(returningList);
1039 	COMPARE_NODE_FIELD(withClause);
1040 
1041 	return true;
1042 }
1043 
1044 static bool
1045 _equalSelectStmt(const SelectStmt *a, const SelectStmt *b)
1046 {
1047 	COMPARE_NODE_FIELD(distinctClause);
1048 	COMPARE_NODE_FIELD(intoClause);
1049 	COMPARE_NODE_FIELD(targetList);
1050 	COMPARE_NODE_FIELD(fromClause);
1051 	COMPARE_NODE_FIELD(whereClause);
1052 	COMPARE_NODE_FIELD(groupClause);
1053 	COMPARE_NODE_FIELD(havingClause);
1054 	COMPARE_NODE_FIELD(windowClause);
1055 	COMPARE_NODE_FIELD(valuesLists);
1056 	COMPARE_NODE_FIELD(sortClause);
1057 	COMPARE_NODE_FIELD(limitOffset);
1058 	COMPARE_NODE_FIELD(limitCount);
1059 	COMPARE_SCALAR_FIELD(limitOption);
1060 	COMPARE_NODE_FIELD(lockingClause);
1061 	COMPARE_NODE_FIELD(withClause);
1062 	COMPARE_SCALAR_FIELD(op);
1063 	COMPARE_SCALAR_FIELD(all);
1064 	COMPARE_NODE_FIELD(larg);
1065 	COMPARE_NODE_FIELD(rarg);
1066 
1067 	return true;
1068 }
1069 
1070 static bool
1071 _equalSetOperationStmt(const SetOperationStmt *a, const SetOperationStmt *b)
1072 {
1073 	COMPARE_SCALAR_FIELD(op);
1074 	COMPARE_SCALAR_FIELD(all);
1075 	COMPARE_NODE_FIELD(larg);
1076 	COMPARE_NODE_FIELD(rarg);
1077 	COMPARE_NODE_FIELD(colTypes);
1078 	COMPARE_NODE_FIELD(colTypmods);
1079 	COMPARE_NODE_FIELD(colCollations);
1080 	COMPARE_NODE_FIELD(groupClauses);
1081 
1082 	return true;
1083 }
1084 
1085 static bool
1086 _equalAlterTableStmt(const AlterTableStmt *a, const AlterTableStmt *b)
1087 {
1088 	COMPARE_NODE_FIELD(relation);
1089 	COMPARE_NODE_FIELD(cmds);
1090 	COMPARE_SCALAR_FIELD(relkind);
1091 	COMPARE_SCALAR_FIELD(missing_ok);
1092 
1093 	return true;
1094 }
1095 
1096 static bool
1097 _equalAlterTableCmd(const AlterTableCmd *a, const AlterTableCmd *b)
1098 {
1099 	COMPARE_SCALAR_FIELD(subtype);
1100 	COMPARE_STRING_FIELD(name);
1101 	COMPARE_SCALAR_FIELD(num);
1102 	COMPARE_NODE_FIELD(newowner);
1103 	COMPARE_NODE_FIELD(def);
1104 	COMPARE_SCALAR_FIELD(behavior);
1105 	COMPARE_SCALAR_FIELD(missing_ok);
1106 
1107 	return true;
1108 }
1109 
1110 static bool
1111 _equalAlterCollationStmt(const AlterCollationStmt *a, const AlterCollationStmt *b)
1112 {
1113 	COMPARE_NODE_FIELD(collname);
1114 
1115 	return true;
1116 }
1117 
1118 static bool
1119 _equalAlterDomainStmt(const AlterDomainStmt *a, const AlterDomainStmt *b)
1120 {
1121 	COMPARE_SCALAR_FIELD(subtype);
1122 	COMPARE_NODE_FIELD(typeName);
1123 	COMPARE_STRING_FIELD(name);
1124 	COMPARE_NODE_FIELD(def);
1125 	COMPARE_SCALAR_FIELD(behavior);
1126 	COMPARE_SCALAR_FIELD(missing_ok);
1127 
1128 	return true;
1129 }
1130 
1131 static bool
1132 _equalGrantStmt(const GrantStmt *a, const GrantStmt *b)
1133 {
1134 	COMPARE_SCALAR_FIELD(is_grant);
1135 	COMPARE_SCALAR_FIELD(targtype);
1136 	COMPARE_SCALAR_FIELD(objtype);
1137 	COMPARE_NODE_FIELD(objects);
1138 	COMPARE_NODE_FIELD(privileges);
1139 	COMPARE_NODE_FIELD(grantees);
1140 	COMPARE_SCALAR_FIELD(grant_option);
1141 	COMPARE_SCALAR_FIELD(behavior);
1142 
1143 	return true;
1144 }
1145 
1146 static bool
1147 _equalObjectWithArgs(const ObjectWithArgs *a, const ObjectWithArgs *b)
1148 {
1149 	COMPARE_NODE_FIELD(objname);
1150 	COMPARE_NODE_FIELD(objargs);
1151 	COMPARE_SCALAR_FIELD(args_unspecified);
1152 
1153 	return true;
1154 }
1155 
1156 static bool
1157 _equalAccessPriv(const AccessPriv *a, const AccessPriv *b)
1158 {
1159 	COMPARE_STRING_FIELD(priv_name);
1160 	COMPARE_NODE_FIELD(cols);
1161 
1162 	return true;
1163 }
1164 
1165 static bool
1166 _equalGrantRoleStmt(const GrantRoleStmt *a, const GrantRoleStmt *b)
1167 {
1168 	COMPARE_NODE_FIELD(granted_roles);
1169 	COMPARE_NODE_FIELD(grantee_roles);
1170 	COMPARE_SCALAR_FIELD(is_grant);
1171 	COMPARE_SCALAR_FIELD(admin_opt);
1172 	COMPARE_NODE_FIELD(grantor);
1173 	COMPARE_SCALAR_FIELD(behavior);
1174 
1175 	return true;
1176 }
1177 
1178 static bool
1179 _equalAlterDefaultPrivilegesStmt(const AlterDefaultPrivilegesStmt *a, const AlterDefaultPrivilegesStmt *b)
1180 {
1181 	COMPARE_NODE_FIELD(options);
1182 	COMPARE_NODE_FIELD(action);
1183 
1184 	return true;
1185 }
1186 
1187 static bool
1188 _equalDeclareCursorStmt(const DeclareCursorStmt *a, const DeclareCursorStmt *b)
1189 {
1190 	COMPARE_STRING_FIELD(portalname);
1191 	COMPARE_SCALAR_FIELD(options);
1192 	COMPARE_NODE_FIELD(query);
1193 
1194 	return true;
1195 }
1196 
1197 static bool
1198 _equalClosePortalStmt(const ClosePortalStmt *a, const ClosePortalStmt *b)
1199 {
1200 	COMPARE_STRING_FIELD(portalname);
1201 
1202 	return true;
1203 }
1204 
1205 static bool
1206 _equalCallStmt(const CallStmt *a, const CallStmt *b)
1207 {
1208 	COMPARE_NODE_FIELD(funccall);
1209 	COMPARE_NODE_FIELD(funcexpr);
1210 
1211 	return true;
1212 }
1213 
1214 static bool
1215 _equalClusterStmt(const ClusterStmt *a, const ClusterStmt *b)
1216 {
1217 	COMPARE_NODE_FIELD(relation);
1218 	COMPARE_STRING_FIELD(indexname);
1219 	COMPARE_SCALAR_FIELD(options);
1220 
1221 	return true;
1222 }
1223 
1224 static bool
1225 _equalCopyStmt(const CopyStmt *a, const CopyStmt *b)
1226 {
1227 	COMPARE_NODE_FIELD(relation);
1228 	COMPARE_NODE_FIELD(query);
1229 	COMPARE_NODE_FIELD(attlist);
1230 	COMPARE_SCALAR_FIELD(is_from);
1231 	COMPARE_SCALAR_FIELD(is_program);
1232 	COMPARE_STRING_FIELD(filename);
1233 	COMPARE_NODE_FIELD(options);
1234 	COMPARE_NODE_FIELD(whereClause);
1235 
1236 	return true;
1237 }
1238 
1239 static bool
1240 _equalCreateStmt(const CreateStmt *a, const CreateStmt *b)
1241 {
1242 	COMPARE_NODE_FIELD(relation);
1243 	COMPARE_NODE_FIELD(tableElts);
1244 	COMPARE_NODE_FIELD(inhRelations);
1245 	COMPARE_NODE_FIELD(partbound);
1246 	COMPARE_NODE_FIELD(partspec);
1247 	COMPARE_NODE_FIELD(ofTypename);
1248 	COMPARE_NODE_FIELD(constraints);
1249 	COMPARE_NODE_FIELD(options);
1250 	COMPARE_SCALAR_FIELD(oncommit);
1251 	COMPARE_STRING_FIELD(tablespacename);
1252 	COMPARE_STRING_FIELD(accessMethod);
1253 	COMPARE_SCALAR_FIELD(if_not_exists);
1254 
1255 	return true;
1256 }
1257 
1258 static bool
1259 _equalTableLikeClause(const TableLikeClause *a, const TableLikeClause *b)
1260 {
1261 	COMPARE_NODE_FIELD(relation);
1262 	COMPARE_SCALAR_FIELD(options);
1263 	COMPARE_SCALAR_FIELD(relationOid);
1264 
1265 	return true;
1266 }
1267 
1268 static bool
1269 _equalDefineStmt(const DefineStmt *a, const DefineStmt *b)
1270 {
1271 	COMPARE_SCALAR_FIELD(kind);
1272 	COMPARE_SCALAR_FIELD(oldstyle);
1273 	COMPARE_NODE_FIELD(defnames);
1274 	COMPARE_NODE_FIELD(args);
1275 	COMPARE_NODE_FIELD(definition);
1276 	COMPARE_SCALAR_FIELD(if_not_exists);
1277 	COMPARE_SCALAR_FIELD(replace);
1278 
1279 	return true;
1280 }
1281 
1282 static bool
1283 _equalDropStmt(const DropStmt *a, const DropStmt *b)
1284 {
1285 	COMPARE_NODE_FIELD(objects);
1286 	COMPARE_SCALAR_FIELD(removeType);
1287 	COMPARE_SCALAR_FIELD(behavior);
1288 	COMPARE_SCALAR_FIELD(missing_ok);
1289 	COMPARE_SCALAR_FIELD(concurrent);
1290 
1291 	return true;
1292 }
1293 
1294 static bool
1295 _equalTruncateStmt(const TruncateStmt *a, const TruncateStmt *b)
1296 {
1297 	COMPARE_NODE_FIELD(relations);
1298 	COMPARE_SCALAR_FIELD(restart_seqs);
1299 	COMPARE_SCALAR_FIELD(behavior);
1300 
1301 	return true;
1302 }
1303 
1304 static bool
1305 _equalCommentStmt(const CommentStmt *a, const CommentStmt *b)
1306 {
1307 	COMPARE_SCALAR_FIELD(objtype);
1308 	COMPARE_NODE_FIELD(object);
1309 	COMPARE_STRING_FIELD(comment);
1310 
1311 	return true;
1312 }
1313 
1314 static bool
1315 _equalSecLabelStmt(const SecLabelStmt *a, const SecLabelStmt *b)
1316 {
1317 	COMPARE_SCALAR_FIELD(objtype);
1318 	COMPARE_NODE_FIELD(object);
1319 	COMPARE_STRING_FIELD(provider);
1320 	COMPARE_STRING_FIELD(label);
1321 
1322 	return true;
1323 }
1324 
1325 static bool
1326 _equalFetchStmt(const FetchStmt *a, const FetchStmt *b)
1327 {
1328 	COMPARE_SCALAR_FIELD(direction);
1329 	COMPARE_SCALAR_FIELD(howMany);
1330 	COMPARE_STRING_FIELD(portalname);
1331 	COMPARE_SCALAR_FIELD(ismove);
1332 
1333 	return true;
1334 }
1335 
1336 static bool
1337 _equalIndexStmt(const IndexStmt *a, const IndexStmt *b)
1338 {
1339 	COMPARE_STRING_FIELD(idxname);
1340 	COMPARE_NODE_FIELD(relation);
1341 	COMPARE_STRING_FIELD(accessMethod);
1342 	COMPARE_STRING_FIELD(tableSpace);
1343 	COMPARE_NODE_FIELD(indexParams);
1344 	COMPARE_NODE_FIELD(indexIncludingParams);
1345 	COMPARE_NODE_FIELD(options);
1346 	COMPARE_NODE_FIELD(whereClause);
1347 	COMPARE_NODE_FIELD(excludeOpNames);
1348 	COMPARE_STRING_FIELD(idxcomment);
1349 	COMPARE_SCALAR_FIELD(indexOid);
1350 	COMPARE_SCALAR_FIELD(oldNode);
1351 	COMPARE_SCALAR_FIELD(oldCreateSubid);
1352 	COMPARE_SCALAR_FIELD(oldFirstRelfilenodeSubid);
1353 	COMPARE_SCALAR_FIELD(unique);
1354 	COMPARE_SCALAR_FIELD(primary);
1355 	COMPARE_SCALAR_FIELD(isconstraint);
1356 	COMPARE_SCALAR_FIELD(deferrable);
1357 	COMPARE_SCALAR_FIELD(initdeferred);
1358 	COMPARE_SCALAR_FIELD(transformed);
1359 	COMPARE_SCALAR_FIELD(concurrent);
1360 	COMPARE_SCALAR_FIELD(if_not_exists);
1361 	COMPARE_SCALAR_FIELD(reset_default_tblspc);
1362 
1363 	return true;
1364 }
1365 
1366 static bool
1367 _equalCreateStatsStmt(const CreateStatsStmt *a, const CreateStatsStmt *b)
1368 {
1369 	COMPARE_NODE_FIELD(defnames);
1370 	COMPARE_NODE_FIELD(stat_types);
1371 	COMPARE_NODE_FIELD(exprs);
1372 	COMPARE_NODE_FIELD(relations);
1373 	COMPARE_STRING_FIELD(stxcomment);
1374 	COMPARE_SCALAR_FIELD(if_not_exists);
1375 
1376 	return true;
1377 }
1378 
1379 static bool
1380 _equalAlterStatsStmt(const AlterStatsStmt *a, const AlterStatsStmt *b)
1381 {
1382 	COMPARE_NODE_FIELD(defnames);
1383 	COMPARE_SCALAR_FIELD(stxstattarget);
1384 	COMPARE_SCALAR_FIELD(missing_ok);
1385 
1386 	return true;
1387 }
1388 
1389 static bool
1390 _equalCreateFunctionStmt(const CreateFunctionStmt *a, const CreateFunctionStmt *b)
1391 {
1392 	COMPARE_SCALAR_FIELD(is_procedure);
1393 	COMPARE_SCALAR_FIELD(replace);
1394 	COMPARE_NODE_FIELD(funcname);
1395 	COMPARE_NODE_FIELD(parameters);
1396 	COMPARE_NODE_FIELD(returnType);
1397 	COMPARE_NODE_FIELD(options);
1398 
1399 	return true;
1400 }
1401 
1402 static bool
1403 _equalFunctionParameter(const FunctionParameter *a, const FunctionParameter *b)
1404 {
1405 	COMPARE_STRING_FIELD(name);
1406 	COMPARE_NODE_FIELD(argType);
1407 	COMPARE_SCALAR_FIELD(mode);
1408 	COMPARE_NODE_FIELD(defexpr);
1409 
1410 	return true;
1411 }
1412 
1413 static bool
1414 _equalAlterFunctionStmt(const AlterFunctionStmt *a, const AlterFunctionStmt *b)
1415 {
1416 	COMPARE_SCALAR_FIELD(objtype);
1417 	COMPARE_NODE_FIELD(func);
1418 	COMPARE_NODE_FIELD(actions);
1419 
1420 	return true;
1421 }
1422 
1423 static bool
1424 _equalDoStmt(const DoStmt *a, const DoStmt *b)
1425 {
1426 	COMPARE_NODE_FIELD(args);
1427 
1428 	return true;
1429 }
1430 
1431 static bool
1432 _equalRenameStmt(const RenameStmt *a, const RenameStmt *b)
1433 {
1434 	COMPARE_SCALAR_FIELD(renameType);
1435 	COMPARE_SCALAR_FIELD(relationType);
1436 	COMPARE_NODE_FIELD(relation);
1437 	COMPARE_NODE_FIELD(object);
1438 	COMPARE_STRING_FIELD(subname);
1439 	COMPARE_STRING_FIELD(newname);
1440 	COMPARE_SCALAR_FIELD(behavior);
1441 	COMPARE_SCALAR_FIELD(missing_ok);
1442 
1443 	return true;
1444 }
1445 
1446 static bool
1447 _equalAlterObjectDependsStmt(const AlterObjectDependsStmt *a, const AlterObjectDependsStmt *b)
1448 {
1449 	COMPARE_SCALAR_FIELD(objectType);
1450 	COMPARE_NODE_FIELD(relation);
1451 	COMPARE_NODE_FIELD(object);
1452 	COMPARE_NODE_FIELD(extname);
1453 	COMPARE_SCALAR_FIELD(remove);
1454 
1455 	return true;
1456 }
1457 
1458 static bool
1459 _equalAlterObjectSchemaStmt(const AlterObjectSchemaStmt *a, const AlterObjectSchemaStmt *b)
1460 {
1461 	COMPARE_SCALAR_FIELD(objectType);
1462 	COMPARE_NODE_FIELD(relation);
1463 	COMPARE_NODE_FIELD(object);
1464 	COMPARE_STRING_FIELD(newschema);
1465 	COMPARE_SCALAR_FIELD(missing_ok);
1466 
1467 	return true;
1468 }
1469 
1470 static bool
1471 _equalAlterOwnerStmt(const AlterOwnerStmt *a, const AlterOwnerStmt *b)
1472 {
1473 	COMPARE_SCALAR_FIELD(objectType);
1474 	COMPARE_NODE_FIELD(relation);
1475 	COMPARE_NODE_FIELD(object);
1476 	COMPARE_NODE_FIELD(newowner);
1477 
1478 	return true;
1479 }
1480 
1481 static bool
1482 _equalAlterOperatorStmt(const AlterOperatorStmt *a, const AlterOperatorStmt *b)
1483 {
1484 	COMPARE_NODE_FIELD(opername);
1485 	COMPARE_NODE_FIELD(options);
1486 
1487 	return true;
1488 }
1489 
1490 static bool
1491 _equalAlterTypeStmt(const AlterTypeStmt *a, const AlterTypeStmt *b)
1492 {
1493 	COMPARE_NODE_FIELD(typeName);
1494 	COMPARE_NODE_FIELD(options);
1495 
1496 	return true;
1497 }
1498 
1499 static bool
1500 _equalRuleStmt(const RuleStmt *a, const RuleStmt *b)
1501 {
1502 	COMPARE_NODE_FIELD(relation);
1503 	COMPARE_STRING_FIELD(rulename);
1504 	COMPARE_NODE_FIELD(whereClause);
1505 	COMPARE_SCALAR_FIELD(event);
1506 	COMPARE_SCALAR_FIELD(instead);
1507 	COMPARE_NODE_FIELD(actions);
1508 	COMPARE_SCALAR_FIELD(replace);
1509 
1510 	return true;
1511 }
1512 
1513 static bool
1514 _equalNotifyStmt(const NotifyStmt *a, const NotifyStmt *b)
1515 {
1516 	COMPARE_STRING_FIELD(conditionname);
1517 	COMPARE_STRING_FIELD(payload);
1518 
1519 	return true;
1520 }
1521 
1522 static bool
1523 _equalListenStmt(const ListenStmt *a, const ListenStmt *b)
1524 {
1525 	COMPARE_STRING_FIELD(conditionname);
1526 
1527 	return true;
1528 }
1529 
1530 static bool
1531 _equalUnlistenStmt(const UnlistenStmt *a, const UnlistenStmt *b)
1532 {
1533 	COMPARE_STRING_FIELD(conditionname);
1534 
1535 	return true;
1536 }
1537 
1538 static bool
1539 _equalTransactionStmt(const TransactionStmt *a, const TransactionStmt *b)
1540 {
1541 	COMPARE_SCALAR_FIELD(kind);
1542 	COMPARE_NODE_FIELD(options);
1543 	COMPARE_STRING_FIELD(savepoint_name);
1544 	COMPARE_STRING_FIELD(gid);
1545 	COMPARE_SCALAR_FIELD(chain);
1546 
1547 	return true;
1548 }
1549 
1550 static bool
1551 _equalCompositeTypeStmt(const CompositeTypeStmt *a, const CompositeTypeStmt *b)
1552 {
1553 	COMPARE_NODE_FIELD(typevar);
1554 	COMPARE_NODE_FIELD(coldeflist);
1555 
1556 	return true;
1557 }
1558 
1559 static bool
1560 _equalCreateEnumStmt(const CreateEnumStmt *a, const CreateEnumStmt *b)
1561 {
1562 	COMPARE_NODE_FIELD(typeName);
1563 	COMPARE_NODE_FIELD(vals);
1564 
1565 	return true;
1566 }
1567 
1568 static bool
1569 _equalCreateRangeStmt(const CreateRangeStmt *a, const CreateRangeStmt *b)
1570 {
1571 	COMPARE_NODE_FIELD(typeName);
1572 	COMPARE_NODE_FIELD(params);
1573 
1574 	return true;
1575 }
1576 
1577 static bool
1578 _equalAlterEnumStmt(const AlterEnumStmt *a, const AlterEnumStmt *b)
1579 {
1580 	COMPARE_NODE_FIELD(typeName);
1581 	COMPARE_STRING_FIELD(oldVal);
1582 	COMPARE_STRING_FIELD(newVal);
1583 	COMPARE_STRING_FIELD(newValNeighbor);
1584 	COMPARE_SCALAR_FIELD(newValIsAfter);
1585 	COMPARE_SCALAR_FIELD(skipIfNewValExists);
1586 
1587 	return true;
1588 }
1589 
1590 static bool
1591 _equalViewStmt(const ViewStmt *a, const ViewStmt *b)
1592 {
1593 	COMPARE_NODE_FIELD(view);
1594 	COMPARE_NODE_FIELD(aliases);
1595 	COMPARE_NODE_FIELD(query);
1596 	COMPARE_SCALAR_FIELD(replace);
1597 	COMPARE_NODE_FIELD(options);
1598 	COMPARE_SCALAR_FIELD(withCheckOption);
1599 
1600 	return true;
1601 }
1602 
1603 static bool
1604 _equalLoadStmt(const LoadStmt *a, const LoadStmt *b)
1605 {
1606 	COMPARE_STRING_FIELD(filename);
1607 
1608 	return true;
1609 }
1610 
1611 static bool
1612 _equalCreateDomainStmt(const CreateDomainStmt *a, const CreateDomainStmt *b)
1613 {
1614 	COMPARE_NODE_FIELD(domainname);
1615 	COMPARE_NODE_FIELD(typeName);
1616 	COMPARE_NODE_FIELD(collClause);
1617 	COMPARE_NODE_FIELD(constraints);
1618 
1619 	return true;
1620 }
1621 
1622 static bool
1623 _equalCreateOpClassStmt(const CreateOpClassStmt *a, const CreateOpClassStmt *b)
1624 {
1625 	COMPARE_NODE_FIELD(opclassname);
1626 	COMPARE_NODE_FIELD(opfamilyname);
1627 	COMPARE_STRING_FIELD(amname);
1628 	COMPARE_NODE_FIELD(datatype);
1629 	COMPARE_NODE_FIELD(items);
1630 	COMPARE_SCALAR_FIELD(isDefault);
1631 
1632 	return true;
1633 }
1634 
1635 static bool
1636 _equalCreateOpClassItem(const CreateOpClassItem *a, const CreateOpClassItem *b)
1637 {
1638 	COMPARE_SCALAR_FIELD(itemtype);
1639 	COMPARE_NODE_FIELD(name);
1640 	COMPARE_SCALAR_FIELD(number);
1641 	COMPARE_NODE_FIELD(order_family);
1642 	COMPARE_NODE_FIELD(class_args);
1643 	COMPARE_NODE_FIELD(storedtype);
1644 
1645 	return true;
1646 }
1647 
1648 static bool
1649 _equalCreateOpFamilyStmt(const CreateOpFamilyStmt *a, const CreateOpFamilyStmt *b)
1650 {
1651 	COMPARE_NODE_FIELD(opfamilyname);
1652 	COMPARE_STRING_FIELD(amname);
1653 
1654 	return true;
1655 }
1656 
1657 static bool
1658 _equalAlterOpFamilyStmt(const AlterOpFamilyStmt *a, const AlterOpFamilyStmt *b)
1659 {
1660 	COMPARE_NODE_FIELD(opfamilyname);
1661 	COMPARE_STRING_FIELD(amname);
1662 	COMPARE_SCALAR_FIELD(isDrop);
1663 	COMPARE_NODE_FIELD(items);
1664 
1665 	return true;
1666 }
1667 
1668 static bool
1669 _equalCreatedbStmt(const CreatedbStmt *a, const CreatedbStmt *b)
1670 {
1671 	COMPARE_STRING_FIELD(dbname);
1672 	COMPARE_NODE_FIELD(options);
1673 
1674 	return true;
1675 }
1676 
1677 static bool
1678 _equalAlterDatabaseStmt(const AlterDatabaseStmt *a, const AlterDatabaseStmt *b)
1679 {
1680 	COMPARE_STRING_FIELD(dbname);
1681 	COMPARE_NODE_FIELD(options);
1682 
1683 	return true;
1684 }
1685 
1686 static bool
1687 _equalAlterDatabaseSetStmt(const AlterDatabaseSetStmt *a, const AlterDatabaseSetStmt *b)
1688 {
1689 	COMPARE_STRING_FIELD(dbname);
1690 	COMPARE_NODE_FIELD(setstmt);
1691 
1692 	return true;
1693 }
1694 
1695 static bool
1696 _equalDropdbStmt(const DropdbStmt *a, const DropdbStmt *b)
1697 {
1698 	COMPARE_STRING_FIELD(dbname);
1699 	COMPARE_SCALAR_FIELD(missing_ok);
1700 	COMPARE_NODE_FIELD(options);
1701 
1702 	return true;
1703 }
1704 
1705 static bool
1706 _equalVacuumStmt(const VacuumStmt *a, const VacuumStmt *b)
1707 {
1708 	COMPARE_NODE_FIELD(options);
1709 	COMPARE_NODE_FIELD(rels);
1710 	COMPARE_SCALAR_FIELD(is_vacuumcmd);
1711 
1712 	return true;
1713 }
1714 
1715 static bool
1716 _equalVacuumRelation(const VacuumRelation *a, const VacuumRelation *b)
1717 {
1718 	COMPARE_NODE_FIELD(relation);
1719 	COMPARE_SCALAR_FIELD(oid);
1720 	COMPARE_NODE_FIELD(va_cols);
1721 
1722 	return true;
1723 }
1724 
1725 static bool
1726 _equalExplainStmt(const ExplainStmt *a, const ExplainStmt *b)
1727 {
1728 	COMPARE_NODE_FIELD(query);
1729 	COMPARE_NODE_FIELD(options);
1730 
1731 	return true;
1732 }
1733 
1734 static bool
1735 _equalCreateTableAsStmt(const CreateTableAsStmt *a, const CreateTableAsStmt *b)
1736 {
1737 	COMPARE_NODE_FIELD(query);
1738 	COMPARE_NODE_FIELD(into);
1739 	COMPARE_SCALAR_FIELD(relkind);
1740 	COMPARE_SCALAR_FIELD(is_select_into);
1741 	COMPARE_SCALAR_FIELD(if_not_exists);
1742 
1743 	return true;
1744 }
1745 
1746 static bool
1747 _equalRefreshMatViewStmt(const RefreshMatViewStmt *a, const RefreshMatViewStmt *b)
1748 {
1749 	COMPARE_SCALAR_FIELD(concurrent);
1750 	COMPARE_SCALAR_FIELD(skipData);
1751 	COMPARE_NODE_FIELD(relation);
1752 
1753 	return true;
1754 }
1755 
1756 static bool
1757 _equalReplicaIdentityStmt(const ReplicaIdentityStmt *a, const ReplicaIdentityStmt *b)
1758 {
1759 	COMPARE_SCALAR_FIELD(identity_type);
1760 	COMPARE_STRING_FIELD(name);
1761 
1762 	return true;
1763 }
1764 
1765 static bool
1766 _equalAlterSystemStmt(const AlterSystemStmt *a, const AlterSystemStmt *b)
1767 {
1768 	COMPARE_NODE_FIELD(setstmt);
1769 
1770 	return true;
1771 }
1772 
1773 
1774 static bool
1775 _equalCreateSeqStmt(const CreateSeqStmt *a, const CreateSeqStmt *b)
1776 {
1777 	COMPARE_NODE_FIELD(sequence);
1778 	COMPARE_NODE_FIELD(options);
1779 	COMPARE_SCALAR_FIELD(ownerId);
1780 	COMPARE_SCALAR_FIELD(for_identity);
1781 	COMPARE_SCALAR_FIELD(if_not_exists);
1782 
1783 	return true;
1784 }
1785 
1786 static bool
1787 _equalAlterSeqStmt(const AlterSeqStmt *a, const AlterSeqStmt *b)
1788 {
1789 	COMPARE_NODE_FIELD(sequence);
1790 	COMPARE_NODE_FIELD(options);
1791 	COMPARE_SCALAR_FIELD(for_identity);
1792 	COMPARE_SCALAR_FIELD(missing_ok);
1793 
1794 	return true;
1795 }
1796 
1797 static bool
1798 _equalVariableSetStmt(const VariableSetStmt *a, const VariableSetStmt *b)
1799 {
1800 	COMPARE_SCALAR_FIELD(kind);
1801 	COMPARE_STRING_FIELD(name);
1802 	COMPARE_NODE_FIELD(args);
1803 	COMPARE_SCALAR_FIELD(is_local);
1804 
1805 	return true;
1806 }
1807 
1808 static bool
1809 _equalVariableShowStmt(const VariableShowStmt *a, const VariableShowStmt *b)
1810 {
1811 	COMPARE_STRING_FIELD(name);
1812 
1813 	return true;
1814 }
1815 
1816 static bool
1817 _equalDiscardStmt(const DiscardStmt *a, const DiscardStmt *b)
1818 {
1819 	COMPARE_SCALAR_FIELD(target);
1820 
1821 	return true;
1822 }
1823 
1824 static bool
1825 _equalCreateTableSpaceStmt(const CreateTableSpaceStmt *a, const CreateTableSpaceStmt *b)
1826 {
1827 	COMPARE_STRING_FIELD(tablespacename);
1828 	COMPARE_NODE_FIELD(owner);
1829 	COMPARE_STRING_FIELD(location);
1830 	COMPARE_NODE_FIELD(options);
1831 
1832 	return true;
1833 }
1834 
1835 static bool
1836 _equalDropTableSpaceStmt(const DropTableSpaceStmt *a, const DropTableSpaceStmt *b)
1837 {
1838 	COMPARE_STRING_FIELD(tablespacename);
1839 	COMPARE_SCALAR_FIELD(missing_ok);
1840 
1841 	return true;
1842 }
1843 
1844 static bool
1845 _equalAlterTableSpaceOptionsStmt(const AlterTableSpaceOptionsStmt *a,
1846 								 const AlterTableSpaceOptionsStmt *b)
1847 {
1848 	COMPARE_STRING_FIELD(tablespacename);
1849 	COMPARE_NODE_FIELD(options);
1850 	COMPARE_SCALAR_FIELD(isReset);
1851 
1852 	return true;
1853 }
1854 
1855 static bool
1856 _equalAlterTableMoveAllStmt(const AlterTableMoveAllStmt *a,
1857 							const AlterTableMoveAllStmt *b)
1858 {
1859 	COMPARE_STRING_FIELD(orig_tablespacename);
1860 	COMPARE_SCALAR_FIELD(objtype);
1861 	COMPARE_NODE_FIELD(roles);
1862 	COMPARE_STRING_FIELD(new_tablespacename);
1863 	COMPARE_SCALAR_FIELD(nowait);
1864 
1865 	return true;
1866 }
1867 
1868 static bool
1869 _equalCreateExtensionStmt(const CreateExtensionStmt *a, const CreateExtensionStmt *b)
1870 {
1871 	COMPARE_STRING_FIELD(extname);
1872 	COMPARE_SCALAR_FIELD(if_not_exists);
1873 	COMPARE_NODE_FIELD(options);
1874 
1875 	return true;
1876 }
1877 
1878 static bool
1879 _equalAlterExtensionStmt(const AlterExtensionStmt *a, const AlterExtensionStmt *b)
1880 {
1881 	COMPARE_STRING_FIELD(extname);
1882 	COMPARE_NODE_FIELD(options);
1883 
1884 	return true;
1885 }
1886 
1887 static bool
1888 _equalAlterExtensionContentsStmt(const AlterExtensionContentsStmt *a, const AlterExtensionContentsStmt *b)
1889 {
1890 	COMPARE_STRING_FIELD(extname);
1891 	COMPARE_SCALAR_FIELD(action);
1892 	COMPARE_SCALAR_FIELD(objtype);
1893 	COMPARE_NODE_FIELD(object);
1894 
1895 	return true;
1896 }
1897 
1898 static bool
1899 _equalCreateFdwStmt(const CreateFdwStmt *a, const CreateFdwStmt *b)
1900 {
1901 	COMPARE_STRING_FIELD(fdwname);
1902 	COMPARE_NODE_FIELD(func_options);
1903 	COMPARE_NODE_FIELD(options);
1904 
1905 	return true;
1906 }
1907 
1908 static bool
1909 _equalAlterFdwStmt(const AlterFdwStmt *a, const AlterFdwStmt *b)
1910 {
1911 	COMPARE_STRING_FIELD(fdwname);
1912 	COMPARE_NODE_FIELD(func_options);
1913 	COMPARE_NODE_FIELD(options);
1914 
1915 	return true;
1916 }
1917 
1918 static bool
1919 _equalCreateForeignServerStmt(const CreateForeignServerStmt *a, const CreateForeignServerStmt *b)
1920 {
1921 	COMPARE_STRING_FIELD(servername);
1922 	COMPARE_STRING_FIELD(servertype);
1923 	COMPARE_STRING_FIELD(version);
1924 	COMPARE_STRING_FIELD(fdwname);
1925 	COMPARE_SCALAR_FIELD(if_not_exists);
1926 	COMPARE_NODE_FIELD(options);
1927 
1928 	return true;
1929 }
1930 
1931 static bool
1932 _equalAlterForeignServerStmt(const AlterForeignServerStmt *a, const AlterForeignServerStmt *b)
1933 {
1934 	COMPARE_STRING_FIELD(servername);
1935 	COMPARE_STRING_FIELD(version);
1936 	COMPARE_NODE_FIELD(options);
1937 	COMPARE_SCALAR_FIELD(has_version);
1938 
1939 	return true;
1940 }
1941 
1942 static bool
1943 _equalCreateUserMappingStmt(const CreateUserMappingStmt *a, const CreateUserMappingStmt *b)
1944 {
1945 	COMPARE_NODE_FIELD(user);
1946 	COMPARE_STRING_FIELD(servername);
1947 	COMPARE_SCALAR_FIELD(if_not_exists);
1948 	COMPARE_NODE_FIELD(options);
1949 
1950 	return true;
1951 }
1952 
1953 static bool
1954 _equalAlterUserMappingStmt(const AlterUserMappingStmt *a, const AlterUserMappingStmt *b)
1955 {
1956 	COMPARE_NODE_FIELD(user);
1957 	COMPARE_STRING_FIELD(servername);
1958 	COMPARE_NODE_FIELD(options);
1959 
1960 	return true;
1961 }
1962 
1963 static bool
1964 _equalDropUserMappingStmt(const DropUserMappingStmt *a, const DropUserMappingStmt *b)
1965 {
1966 	COMPARE_NODE_FIELD(user);
1967 	COMPARE_STRING_FIELD(servername);
1968 	COMPARE_SCALAR_FIELD(missing_ok);
1969 
1970 	return true;
1971 }
1972 
1973 static bool
1974 _equalCreateForeignTableStmt(const CreateForeignTableStmt *a, const CreateForeignTableStmt *b)
1975 {
1976 	if (!_equalCreateStmt(&a->base, &b->base))
1977 		return false;
1978 
1979 	COMPARE_STRING_FIELD(servername);
1980 	COMPARE_NODE_FIELD(options);
1981 
1982 	return true;
1983 }
1984 
1985 static bool
1986 _equalImportForeignSchemaStmt(const ImportForeignSchemaStmt *a, const ImportForeignSchemaStmt *b)
1987 {
1988 	COMPARE_STRING_FIELD(server_name);
1989 	COMPARE_STRING_FIELD(remote_schema);
1990 	COMPARE_STRING_FIELD(local_schema);
1991 	COMPARE_SCALAR_FIELD(list_type);
1992 	COMPARE_NODE_FIELD(table_list);
1993 	COMPARE_NODE_FIELD(options);
1994 
1995 	return true;
1996 }
1997 
1998 static bool
1999 _equalCreateTransformStmt(const CreateTransformStmt *a, const CreateTransformStmt *b)
2000 {
2001 	COMPARE_SCALAR_FIELD(replace);
2002 	COMPARE_NODE_FIELD(type_name);
2003 	COMPARE_STRING_FIELD(lang);
2004 	COMPARE_NODE_FIELD(fromsql);
2005 	COMPARE_NODE_FIELD(tosql);
2006 
2007 	return true;
2008 }
2009 
2010 static bool
2011 _equalCreateAmStmt(const CreateAmStmt *a, const CreateAmStmt *b)
2012 {
2013 	COMPARE_STRING_FIELD(amname);
2014 	COMPARE_NODE_FIELD(handler_name);
2015 	COMPARE_SCALAR_FIELD(amtype);
2016 
2017 	return true;
2018 }
2019 
2020 static bool
2021 _equalCreateTrigStmt(const CreateTrigStmt *a, const CreateTrigStmt *b)
2022 {
2023 	COMPARE_STRING_FIELD(trigname);
2024 	COMPARE_NODE_FIELD(relation);
2025 	COMPARE_NODE_FIELD(funcname);
2026 	COMPARE_NODE_FIELD(args);
2027 	COMPARE_SCALAR_FIELD(row);
2028 	COMPARE_SCALAR_FIELD(timing);
2029 	COMPARE_SCALAR_FIELD(events);
2030 	COMPARE_NODE_FIELD(columns);
2031 	COMPARE_NODE_FIELD(whenClause);
2032 	COMPARE_SCALAR_FIELD(isconstraint);
2033 	COMPARE_NODE_FIELD(transitionRels);
2034 	COMPARE_SCALAR_FIELD(deferrable);
2035 	COMPARE_SCALAR_FIELD(initdeferred);
2036 	COMPARE_NODE_FIELD(constrrel);
2037 
2038 	return true;
2039 }
2040 
2041 static bool
2042 _equalCreateEventTrigStmt(const CreateEventTrigStmt *a, const CreateEventTrigStmt *b)
2043 {
2044 	COMPARE_STRING_FIELD(trigname);
2045 	COMPARE_STRING_FIELD(eventname);
2046 	COMPARE_NODE_FIELD(whenclause);
2047 	COMPARE_NODE_FIELD(funcname);
2048 
2049 	return true;
2050 }
2051 
2052 static bool
2053 _equalAlterEventTrigStmt(const AlterEventTrigStmt *a, const AlterEventTrigStmt *b)
2054 {
2055 	COMPARE_STRING_FIELD(trigname);
2056 	COMPARE_SCALAR_FIELD(tgenabled);
2057 
2058 	return true;
2059 }
2060 
2061 static bool
2062 _equalCreatePLangStmt(const CreatePLangStmt *a, const CreatePLangStmt *b)
2063 {
2064 	COMPARE_SCALAR_FIELD(replace);
2065 	COMPARE_STRING_FIELD(plname);
2066 	COMPARE_NODE_FIELD(plhandler);
2067 	COMPARE_NODE_FIELD(plinline);
2068 	COMPARE_NODE_FIELD(plvalidator);
2069 	COMPARE_SCALAR_FIELD(pltrusted);
2070 
2071 	return true;
2072 }
2073 
2074 static bool
2075 _equalCreateRoleStmt(const CreateRoleStmt *a, const CreateRoleStmt *b)
2076 {
2077 	COMPARE_SCALAR_FIELD(stmt_type);
2078 	COMPARE_STRING_FIELD(role);
2079 	COMPARE_NODE_FIELD(options);
2080 
2081 	return true;
2082 }
2083 
2084 static bool
2085 _equalAlterRoleStmt(const AlterRoleStmt *a, const AlterRoleStmt *b)
2086 {
2087 	COMPARE_NODE_FIELD(role);
2088 	COMPARE_NODE_FIELD(options);
2089 	COMPARE_SCALAR_FIELD(action);
2090 
2091 	return true;
2092 }
2093 
2094 static bool
2095 _equalAlterRoleSetStmt(const AlterRoleSetStmt *a, const AlterRoleSetStmt *b)
2096 {
2097 	COMPARE_NODE_FIELD(role);
2098 	COMPARE_STRING_FIELD(database);
2099 	COMPARE_NODE_FIELD(setstmt);
2100 
2101 	return true;
2102 }
2103 
2104 static bool
2105 _equalDropRoleStmt(const DropRoleStmt *a, const DropRoleStmt *b)
2106 {
2107 	COMPARE_NODE_FIELD(roles);
2108 	COMPARE_SCALAR_FIELD(missing_ok);
2109 
2110 	return true;
2111 }
2112 
2113 static bool
2114 _equalLockStmt(const LockStmt *a, const LockStmt *b)
2115 {
2116 	COMPARE_NODE_FIELD(relations);
2117 	COMPARE_SCALAR_FIELD(mode);
2118 	COMPARE_SCALAR_FIELD(nowait);
2119 
2120 	return true;
2121 }
2122 
2123 static bool
2124 _equalConstraintsSetStmt(const ConstraintsSetStmt *a, const ConstraintsSetStmt *b)
2125 {
2126 	COMPARE_NODE_FIELD(constraints);
2127 	COMPARE_SCALAR_FIELD(deferred);
2128 
2129 	return true;
2130 }
2131 
2132 static bool
2133 _equalReindexStmt(const ReindexStmt *a, const ReindexStmt *b)
2134 {
2135 	COMPARE_SCALAR_FIELD(kind);
2136 	COMPARE_NODE_FIELD(relation);
2137 	COMPARE_STRING_FIELD(name);
2138 	COMPARE_SCALAR_FIELD(options);
2139 	COMPARE_SCALAR_FIELD(concurrent);
2140 
2141 	return true;
2142 }
2143 
2144 static bool
2145 _equalCreateSchemaStmt(const CreateSchemaStmt *a, const CreateSchemaStmt *b)
2146 {
2147 	COMPARE_STRING_FIELD(schemaname);
2148 	COMPARE_NODE_FIELD(authrole);
2149 	COMPARE_NODE_FIELD(schemaElts);
2150 	COMPARE_SCALAR_FIELD(if_not_exists);
2151 
2152 	return true;
2153 }
2154 
2155 static bool
2156 _equalCreateConversionStmt(const CreateConversionStmt *a, const CreateConversionStmt *b)
2157 {
2158 	COMPARE_NODE_FIELD(conversion_name);
2159 	COMPARE_STRING_FIELD(for_encoding_name);
2160 	COMPARE_STRING_FIELD(to_encoding_name);
2161 	COMPARE_NODE_FIELD(func_name);
2162 	COMPARE_SCALAR_FIELD(def);
2163 
2164 	return true;
2165 }
2166 
2167 static bool
2168 _equalCreateCastStmt(const CreateCastStmt *a, const CreateCastStmt *b)
2169 {
2170 	COMPARE_NODE_FIELD(sourcetype);
2171 	COMPARE_NODE_FIELD(targettype);
2172 	COMPARE_NODE_FIELD(func);
2173 	COMPARE_SCALAR_FIELD(context);
2174 	COMPARE_SCALAR_FIELD(inout);
2175 
2176 	return true;
2177 }
2178 
2179 static bool
2180 _equalPrepareStmt(const PrepareStmt *a, const PrepareStmt *b)
2181 {
2182 	COMPARE_STRING_FIELD(name);
2183 	COMPARE_NODE_FIELD(argtypes);
2184 	COMPARE_NODE_FIELD(query);
2185 
2186 	return true;
2187 }
2188 
2189 static bool
2190 _equalExecuteStmt(const ExecuteStmt *a, const ExecuteStmt *b)
2191 {
2192 	COMPARE_STRING_FIELD(name);
2193 	COMPARE_NODE_FIELD(params);
2194 
2195 	return true;
2196 }
2197 
2198 static bool
2199 _equalDeallocateStmt(const DeallocateStmt *a, const DeallocateStmt *b)
2200 {
2201 	COMPARE_STRING_FIELD(name);
2202 
2203 	return true;
2204 }
2205 
2206 static bool
2207 _equalDropOwnedStmt(const DropOwnedStmt *a, const DropOwnedStmt *b)
2208 {
2209 	COMPARE_NODE_FIELD(roles);
2210 	COMPARE_SCALAR_FIELD(behavior);
2211 
2212 	return true;
2213 }
2214 
2215 static bool
2216 _equalReassignOwnedStmt(const ReassignOwnedStmt *a, const ReassignOwnedStmt *b)
2217 {
2218 	COMPARE_NODE_FIELD(roles);
2219 	COMPARE_NODE_FIELD(newrole);
2220 
2221 	return true;
2222 }
2223 
2224 static bool
2225 _equalAlterTSDictionaryStmt(const AlterTSDictionaryStmt *a, const AlterTSDictionaryStmt *b)
2226 {
2227 	COMPARE_NODE_FIELD(dictname);
2228 	COMPARE_NODE_FIELD(options);
2229 
2230 	return true;
2231 }
2232 
2233 static bool
2234 _equalAlterTSConfigurationStmt(const AlterTSConfigurationStmt *a,
2235 							   const AlterTSConfigurationStmt *b)
2236 {
2237 	COMPARE_SCALAR_FIELD(kind);
2238 	COMPARE_NODE_FIELD(cfgname);
2239 	COMPARE_NODE_FIELD(tokentype);
2240 	COMPARE_NODE_FIELD(dicts);
2241 	COMPARE_SCALAR_FIELD(override);
2242 	COMPARE_SCALAR_FIELD(replace);
2243 	COMPARE_SCALAR_FIELD(missing_ok);
2244 
2245 	return true;
2246 }
2247 
2248 static bool
2249 _equalCreatePublicationStmt(const CreatePublicationStmt *a,
2250 							const CreatePublicationStmt *b)
2251 {
2252 	COMPARE_STRING_FIELD(pubname);
2253 	COMPARE_NODE_FIELD(options);
2254 	COMPARE_NODE_FIELD(tables);
2255 	COMPARE_SCALAR_FIELD(for_all_tables);
2256 
2257 	return true;
2258 }
2259 
2260 static bool
2261 _equalAlterPublicationStmt(const AlterPublicationStmt *a,
2262 						   const AlterPublicationStmt *b)
2263 {
2264 	COMPARE_STRING_FIELD(pubname);
2265 	COMPARE_NODE_FIELD(options);
2266 	COMPARE_NODE_FIELD(tables);
2267 	COMPARE_SCALAR_FIELD(for_all_tables);
2268 	COMPARE_SCALAR_FIELD(tableAction);
2269 
2270 	return true;
2271 }
2272 
2273 static bool
2274 _equalCreateSubscriptionStmt(const CreateSubscriptionStmt *a,
2275 							 const CreateSubscriptionStmt *b)
2276 {
2277 	COMPARE_STRING_FIELD(subname);
2278 	COMPARE_STRING_FIELD(conninfo);
2279 	COMPARE_NODE_FIELD(publication);
2280 	COMPARE_NODE_FIELD(options);
2281 
2282 	return true;
2283 }
2284 
2285 static bool
2286 _equalAlterSubscriptionStmt(const AlterSubscriptionStmt *a,
2287 							const AlterSubscriptionStmt *b)
2288 {
2289 	COMPARE_SCALAR_FIELD(kind);
2290 	COMPARE_STRING_FIELD(subname);
2291 	COMPARE_STRING_FIELD(conninfo);
2292 	COMPARE_NODE_FIELD(publication);
2293 	COMPARE_NODE_FIELD(options);
2294 
2295 	return true;
2296 }
2297 
2298 static bool
2299 _equalDropSubscriptionStmt(const DropSubscriptionStmt *a,
2300 						   const DropSubscriptionStmt *b)
2301 {
2302 	COMPARE_STRING_FIELD(subname);
2303 	COMPARE_SCALAR_FIELD(missing_ok);
2304 	COMPARE_SCALAR_FIELD(behavior);
2305 
2306 	return true;
2307 }
2308 
2309 static bool
2310 _equalCreatePolicyStmt(const CreatePolicyStmt *a, const CreatePolicyStmt *b)
2311 {
2312 	COMPARE_STRING_FIELD(policy_name);
2313 	COMPARE_NODE_FIELD(table);
2314 	COMPARE_STRING_FIELD(cmd_name);
2315 	COMPARE_SCALAR_FIELD(permissive);
2316 	COMPARE_NODE_FIELD(roles);
2317 	COMPARE_NODE_FIELD(qual);
2318 	COMPARE_NODE_FIELD(with_check);
2319 
2320 	return true;
2321 }
2322 
2323 static bool
2324 _equalAlterPolicyStmt(const AlterPolicyStmt *a, const AlterPolicyStmt *b)
2325 {
2326 	COMPARE_STRING_FIELD(policy_name);
2327 	COMPARE_NODE_FIELD(table);
2328 	COMPARE_NODE_FIELD(roles);
2329 	COMPARE_NODE_FIELD(qual);
2330 	COMPARE_NODE_FIELD(with_check);
2331 
2332 	return true;
2333 }
2334 
2335 static bool
2336 _equalAExpr(const A_Expr *a, const A_Expr *b)
2337 {
2338 	COMPARE_SCALAR_FIELD(kind);
2339 	COMPARE_NODE_FIELD(name);
2340 	COMPARE_NODE_FIELD(lexpr);
2341 	COMPARE_NODE_FIELD(rexpr);
2342 	COMPARE_LOCATION_FIELD(location);
2343 
2344 	return true;
2345 }
2346 
2347 static bool
2348 _equalColumnRef(const ColumnRef *a, const ColumnRef *b)
2349 {
2350 	COMPARE_NODE_FIELD(fields);
2351 	COMPARE_LOCATION_FIELD(location);
2352 
2353 	return true;
2354 }
2355 
2356 static bool
2357 _equalParamRef(const ParamRef *a, const ParamRef *b)
2358 {
2359 	COMPARE_SCALAR_FIELD(number);
2360 	COMPARE_LOCATION_FIELD(location);
2361 
2362 	return true;
2363 }
2364 
2365 static bool
2366 _equalAConst(const A_Const *a, const A_Const *b)
2367 {
2368 	if (!equal(&a->val, &b->val))	/* hack for in-line Value field */
2369 		return false;
2370 	COMPARE_LOCATION_FIELD(location);
2371 
2372 	return true;
2373 }
2374 
2375 static bool
2376 _equalFuncCall(const FuncCall *a, const FuncCall *b)
2377 {
2378 	COMPARE_NODE_FIELD(funcname);
2379 	COMPARE_NODE_FIELD(args);
2380 	COMPARE_NODE_FIELD(agg_order);
2381 	COMPARE_NODE_FIELD(agg_filter);
2382 	COMPARE_SCALAR_FIELD(agg_within_group);
2383 	COMPARE_SCALAR_FIELD(agg_star);
2384 	COMPARE_SCALAR_FIELD(agg_distinct);
2385 	COMPARE_SCALAR_FIELD(func_variadic);
2386 	COMPARE_NODE_FIELD(over);
2387 	COMPARE_LOCATION_FIELD(location);
2388 
2389 	return true;
2390 }
2391 
2392 static bool
2393 _equalAStar(const A_Star *a, const A_Star *b)
2394 {
2395 	return true;
2396 }
2397 
2398 static bool
2399 _equalAIndices(const A_Indices *a, const A_Indices *b)
2400 {
2401 	COMPARE_SCALAR_FIELD(is_slice);
2402 	COMPARE_NODE_FIELD(lidx);
2403 	COMPARE_NODE_FIELD(uidx);
2404 
2405 	return true;
2406 }
2407 
2408 static bool
2409 _equalA_Indirection(const A_Indirection *a, const A_Indirection *b)
2410 {
2411 	COMPARE_NODE_FIELD(arg);
2412 	COMPARE_NODE_FIELD(indirection);
2413 
2414 	return true;
2415 }
2416 
2417 static bool
2418 _equalA_ArrayExpr(const A_ArrayExpr *a, const A_ArrayExpr *b)
2419 {
2420 	COMPARE_NODE_FIELD(elements);
2421 	COMPARE_LOCATION_FIELD(location);
2422 
2423 	return true;
2424 }
2425 
2426 static bool
2427 _equalResTarget(const ResTarget *a, const ResTarget *b)
2428 {
2429 	COMPARE_STRING_FIELD(name);
2430 	COMPARE_NODE_FIELD(indirection);
2431 	COMPARE_NODE_FIELD(val);
2432 	COMPARE_LOCATION_FIELD(location);
2433 
2434 	return true;
2435 }
2436 
2437 static bool
2438 _equalMultiAssignRef(const MultiAssignRef *a, const MultiAssignRef *b)
2439 {
2440 	COMPARE_NODE_FIELD(source);
2441 	COMPARE_SCALAR_FIELD(colno);
2442 	COMPARE_SCALAR_FIELD(ncolumns);
2443 
2444 	return true;
2445 }
2446 
2447 static bool
2448 _equalTypeName(const TypeName *a, const TypeName *b)
2449 {
2450 	COMPARE_NODE_FIELD(names);
2451 	COMPARE_SCALAR_FIELD(typeOid);
2452 	COMPARE_SCALAR_FIELD(setof);
2453 	COMPARE_SCALAR_FIELD(pct_type);
2454 	COMPARE_NODE_FIELD(typmods);
2455 	COMPARE_SCALAR_FIELD(typemod);
2456 	COMPARE_NODE_FIELD(arrayBounds);
2457 	COMPARE_LOCATION_FIELD(location);
2458 
2459 	return true;
2460 }
2461 
2462 static bool
2463 _equalTypeCast(const TypeCast *a, const TypeCast *b)
2464 {
2465 	COMPARE_NODE_FIELD(arg);
2466 	COMPARE_NODE_FIELD(typeName);
2467 	COMPARE_LOCATION_FIELD(location);
2468 
2469 	return true;
2470 }
2471 
2472 static bool
2473 _equalCollateClause(const CollateClause *a, const CollateClause *b)
2474 {
2475 	COMPARE_NODE_FIELD(arg);
2476 	COMPARE_NODE_FIELD(collname);
2477 	COMPARE_LOCATION_FIELD(location);
2478 
2479 	return true;
2480 }
2481 
2482 static bool
2483 _equalSortBy(const SortBy *a, const SortBy *b)
2484 {
2485 	COMPARE_NODE_FIELD(node);
2486 	COMPARE_SCALAR_FIELD(sortby_dir);
2487 	COMPARE_SCALAR_FIELD(sortby_nulls);
2488 	COMPARE_NODE_FIELD(useOp);
2489 	COMPARE_LOCATION_FIELD(location);
2490 
2491 	return true;
2492 }
2493 
2494 static bool
2495 _equalWindowDef(const WindowDef *a, const WindowDef *b)
2496 {
2497 	COMPARE_STRING_FIELD(name);
2498 	COMPARE_STRING_FIELD(refname);
2499 	COMPARE_NODE_FIELD(partitionClause);
2500 	COMPARE_NODE_FIELD(orderClause);
2501 	COMPARE_SCALAR_FIELD(frameOptions);
2502 	COMPARE_NODE_FIELD(startOffset);
2503 	COMPARE_NODE_FIELD(endOffset);
2504 	COMPARE_LOCATION_FIELD(location);
2505 
2506 	return true;
2507 }
2508 
2509 static bool
2510 _equalRangeSubselect(const RangeSubselect *a, const RangeSubselect *b)
2511 {
2512 	COMPARE_SCALAR_FIELD(lateral);
2513 	COMPARE_NODE_FIELD(subquery);
2514 	COMPARE_NODE_FIELD(alias);
2515 
2516 	return true;
2517 }
2518 
2519 static bool
2520 _equalRangeFunction(const RangeFunction *a, const RangeFunction *b)
2521 {
2522 	COMPARE_SCALAR_FIELD(lateral);
2523 	COMPARE_SCALAR_FIELD(ordinality);
2524 	COMPARE_SCALAR_FIELD(is_rowsfrom);
2525 	COMPARE_NODE_FIELD(functions);
2526 	COMPARE_NODE_FIELD(alias);
2527 	COMPARE_NODE_FIELD(coldeflist);
2528 
2529 	return true;
2530 }
2531 
2532 static bool
2533 _equalRangeTableSample(const RangeTableSample *a, const RangeTableSample *b)
2534 {
2535 	COMPARE_NODE_FIELD(relation);
2536 	COMPARE_NODE_FIELD(method);
2537 	COMPARE_NODE_FIELD(args);
2538 	COMPARE_NODE_FIELD(repeatable);
2539 	COMPARE_LOCATION_FIELD(location);
2540 
2541 	return true;
2542 }
2543 
2544 static bool
2545 _equalRangeTableFunc(const RangeTableFunc *a, const RangeTableFunc *b)
2546 {
2547 	COMPARE_SCALAR_FIELD(lateral);
2548 	COMPARE_NODE_FIELD(docexpr);
2549 	COMPARE_NODE_FIELD(rowexpr);
2550 	COMPARE_NODE_FIELD(namespaces);
2551 	COMPARE_NODE_FIELD(columns);
2552 	COMPARE_NODE_FIELD(alias);
2553 	COMPARE_LOCATION_FIELD(location);
2554 
2555 	return true;
2556 }
2557 
2558 static bool
2559 _equalRangeTableFuncCol(const RangeTableFuncCol *a, const RangeTableFuncCol *b)
2560 {
2561 	COMPARE_STRING_FIELD(colname);
2562 	COMPARE_NODE_FIELD(typeName);
2563 	COMPARE_SCALAR_FIELD(for_ordinality);
2564 	COMPARE_SCALAR_FIELD(is_not_null);
2565 	COMPARE_NODE_FIELD(colexpr);
2566 	COMPARE_NODE_FIELD(coldefexpr);
2567 	COMPARE_LOCATION_FIELD(location);
2568 
2569 	return true;
2570 }
2571 
2572 
2573 static bool
2574 _equalIndexElem(const IndexElem *a, const IndexElem *b)
2575 {
2576 	COMPARE_STRING_FIELD(name);
2577 	COMPARE_NODE_FIELD(expr);
2578 	COMPARE_STRING_FIELD(indexcolname);
2579 	COMPARE_NODE_FIELD(collation);
2580 	COMPARE_NODE_FIELD(opclass);
2581 	COMPARE_NODE_FIELD(opclassopts);
2582 	COMPARE_SCALAR_FIELD(ordering);
2583 	COMPARE_SCALAR_FIELD(nulls_ordering);
2584 
2585 	return true;
2586 }
2587 
2588 static bool
2589 _equalColumnDef(const ColumnDef *a, const ColumnDef *b)
2590 {
2591 	COMPARE_STRING_FIELD(colname);
2592 	COMPARE_NODE_FIELD(typeName);
2593 	COMPARE_SCALAR_FIELD(inhcount);
2594 	COMPARE_SCALAR_FIELD(is_local);
2595 	COMPARE_SCALAR_FIELD(is_not_null);
2596 	COMPARE_SCALAR_FIELD(is_from_type);
2597 	COMPARE_SCALAR_FIELD(storage);
2598 	COMPARE_NODE_FIELD(raw_default);
2599 	COMPARE_NODE_FIELD(cooked_default);
2600 	COMPARE_SCALAR_FIELD(identity);
2601 	COMPARE_NODE_FIELD(identitySequence);
2602 	COMPARE_SCALAR_FIELD(generated);
2603 	COMPARE_NODE_FIELD(collClause);
2604 	COMPARE_SCALAR_FIELD(collOid);
2605 	COMPARE_NODE_FIELD(constraints);
2606 	COMPARE_NODE_FIELD(fdwoptions);
2607 	COMPARE_LOCATION_FIELD(location);
2608 
2609 	return true;
2610 }
2611 
2612 static bool
2613 _equalConstraint(const Constraint *a, const Constraint *b)
2614 {
2615 	COMPARE_SCALAR_FIELD(contype);
2616 	COMPARE_STRING_FIELD(conname);
2617 	COMPARE_SCALAR_FIELD(deferrable);
2618 	COMPARE_SCALAR_FIELD(initdeferred);
2619 	COMPARE_LOCATION_FIELD(location);
2620 	COMPARE_SCALAR_FIELD(is_no_inherit);
2621 	COMPARE_NODE_FIELD(raw_expr);
2622 	COMPARE_STRING_FIELD(cooked_expr);
2623 	COMPARE_SCALAR_FIELD(generated_when);
2624 	COMPARE_NODE_FIELD(keys);
2625 	COMPARE_NODE_FIELD(including);
2626 	COMPARE_NODE_FIELD(exclusions);
2627 	COMPARE_NODE_FIELD(options);
2628 	COMPARE_STRING_FIELD(indexname);
2629 	COMPARE_STRING_FIELD(indexspace);
2630 	COMPARE_SCALAR_FIELD(reset_default_tblspc);
2631 	COMPARE_STRING_FIELD(access_method);
2632 	COMPARE_NODE_FIELD(where_clause);
2633 	COMPARE_NODE_FIELD(pktable);
2634 	COMPARE_NODE_FIELD(fk_attrs);
2635 	COMPARE_NODE_FIELD(pk_attrs);
2636 	COMPARE_SCALAR_FIELD(fk_matchtype);
2637 	COMPARE_SCALAR_FIELD(fk_upd_action);
2638 	COMPARE_SCALAR_FIELD(fk_del_action);
2639 	COMPARE_NODE_FIELD(old_conpfeqop);
2640 	COMPARE_SCALAR_FIELD(old_pktable_oid);
2641 	COMPARE_SCALAR_FIELD(skip_validation);
2642 	COMPARE_SCALAR_FIELD(initially_valid);
2643 
2644 	return true;
2645 }
2646 
2647 static bool
2648 _equalDefElem(const DefElem *a, const DefElem *b)
2649 {
2650 	COMPARE_STRING_FIELD(defnamespace);
2651 	COMPARE_STRING_FIELD(defname);
2652 	COMPARE_NODE_FIELD(arg);
2653 	COMPARE_SCALAR_FIELD(defaction);
2654 	COMPARE_LOCATION_FIELD(location);
2655 
2656 	return true;
2657 }
2658 
2659 static bool
2660 _equalLockingClause(const LockingClause *a, const LockingClause *b)
2661 {
2662 	COMPARE_NODE_FIELD(lockedRels);
2663 	COMPARE_SCALAR_FIELD(strength);
2664 	COMPARE_SCALAR_FIELD(waitPolicy);
2665 
2666 	return true;
2667 }
2668 
2669 static bool
2670 _equalRangeTblEntry(const RangeTblEntry *a, const RangeTblEntry *b)
2671 {
2672 	COMPARE_SCALAR_FIELD(rtekind);
2673 	COMPARE_SCALAR_FIELD(relid);
2674 	COMPARE_SCALAR_FIELD(relkind);
2675 	COMPARE_SCALAR_FIELD(rellockmode);
2676 	COMPARE_NODE_FIELD(tablesample);
2677 	COMPARE_NODE_FIELD(subquery);
2678 	COMPARE_SCALAR_FIELD(security_barrier);
2679 	COMPARE_SCALAR_FIELD(jointype);
2680 	COMPARE_SCALAR_FIELD(joinmergedcols);
2681 	COMPARE_NODE_FIELD(joinaliasvars);
2682 	COMPARE_NODE_FIELD(joinleftcols);
2683 	COMPARE_NODE_FIELD(joinrightcols);
2684 	COMPARE_NODE_FIELD(functions);
2685 	COMPARE_SCALAR_FIELD(funcordinality);
2686 	COMPARE_NODE_FIELD(tablefunc);
2687 	COMPARE_NODE_FIELD(values_lists);
2688 	COMPARE_STRING_FIELD(ctename);
2689 	COMPARE_SCALAR_FIELD(ctelevelsup);
2690 	COMPARE_SCALAR_FIELD(self_reference);
2691 	COMPARE_NODE_FIELD(coltypes);
2692 	COMPARE_NODE_FIELD(coltypmods);
2693 	COMPARE_NODE_FIELD(colcollations);
2694 	COMPARE_STRING_FIELD(enrname);
2695 	COMPARE_SCALAR_FIELD(enrtuples);
2696 	COMPARE_NODE_FIELD(alias);
2697 	COMPARE_NODE_FIELD(eref);
2698 	COMPARE_SCALAR_FIELD(lateral);
2699 	COMPARE_SCALAR_FIELD(inh);
2700 	COMPARE_SCALAR_FIELD(inFromCl);
2701 	COMPARE_SCALAR_FIELD(requiredPerms);
2702 	COMPARE_SCALAR_FIELD(checkAsUser);
2703 	COMPARE_BITMAPSET_FIELD(selectedCols);
2704 	COMPARE_BITMAPSET_FIELD(insertedCols);
2705 	COMPARE_BITMAPSET_FIELD(updatedCols);
2706 	COMPARE_BITMAPSET_FIELD(extraUpdatedCols);
2707 	COMPARE_NODE_FIELD(securityQuals);
2708 
2709 	return true;
2710 }
2711 
2712 static bool
2713 _equalRangeTblFunction(const RangeTblFunction *a, const RangeTblFunction *b)
2714 {
2715 	COMPARE_NODE_FIELD(funcexpr);
2716 	COMPARE_SCALAR_FIELD(funccolcount);
2717 	COMPARE_NODE_FIELD(funccolnames);
2718 	COMPARE_NODE_FIELD(funccoltypes);
2719 	COMPARE_NODE_FIELD(funccoltypmods);
2720 	COMPARE_NODE_FIELD(funccolcollations);
2721 	COMPARE_BITMAPSET_FIELD(funcparams);
2722 
2723 	return true;
2724 }
2725 
2726 static bool
2727 _equalTableSampleClause(const TableSampleClause *a, const TableSampleClause *b)
2728 {
2729 	COMPARE_SCALAR_FIELD(tsmhandler);
2730 	COMPARE_NODE_FIELD(args);
2731 	COMPARE_NODE_FIELD(repeatable);
2732 
2733 	return true;
2734 }
2735 
2736 static bool
2737 _equalWithCheckOption(const WithCheckOption *a, const WithCheckOption *b)
2738 {
2739 	COMPARE_SCALAR_FIELD(kind);
2740 	COMPARE_STRING_FIELD(relname);
2741 	COMPARE_STRING_FIELD(polname);
2742 	COMPARE_NODE_FIELD(qual);
2743 	COMPARE_SCALAR_FIELD(cascaded);
2744 
2745 	return true;
2746 }
2747 
2748 static bool
2749 _equalSortGroupClause(const SortGroupClause *a, const SortGroupClause *b)
2750 {
2751 	COMPARE_SCALAR_FIELD(tleSortGroupRef);
2752 	COMPARE_SCALAR_FIELD(eqop);
2753 	COMPARE_SCALAR_FIELD(sortop);
2754 	COMPARE_SCALAR_FIELD(nulls_first);
2755 	COMPARE_SCALAR_FIELD(hashable);
2756 
2757 	return true;
2758 }
2759 
2760 static bool
2761 _equalGroupingSet(const GroupingSet *a, const GroupingSet *b)
2762 {
2763 	COMPARE_SCALAR_FIELD(kind);
2764 	COMPARE_NODE_FIELD(content);
2765 	COMPARE_LOCATION_FIELD(location);
2766 
2767 	return true;
2768 }
2769 
2770 static bool
2771 _equalWindowClause(const WindowClause *a, const WindowClause *b)
2772 {
2773 	COMPARE_STRING_FIELD(name);
2774 	COMPARE_STRING_FIELD(refname);
2775 	COMPARE_NODE_FIELD(partitionClause);
2776 	COMPARE_NODE_FIELD(orderClause);
2777 	COMPARE_SCALAR_FIELD(frameOptions);
2778 	COMPARE_NODE_FIELD(startOffset);
2779 	COMPARE_NODE_FIELD(endOffset);
2780 	COMPARE_SCALAR_FIELD(startInRangeFunc);
2781 	COMPARE_SCALAR_FIELD(endInRangeFunc);
2782 	COMPARE_SCALAR_FIELD(inRangeColl);
2783 	COMPARE_SCALAR_FIELD(inRangeAsc);
2784 	COMPARE_SCALAR_FIELD(inRangeNullsFirst);
2785 	COMPARE_SCALAR_FIELD(winref);
2786 	COMPARE_SCALAR_FIELD(copiedOrder);
2787 
2788 	return true;
2789 }
2790 
2791 static bool
2792 _equalRowMarkClause(const RowMarkClause *a, const RowMarkClause *b)
2793 {
2794 	COMPARE_SCALAR_FIELD(rti);
2795 	COMPARE_SCALAR_FIELD(strength);
2796 	COMPARE_SCALAR_FIELD(waitPolicy);
2797 	COMPARE_SCALAR_FIELD(pushedDown);
2798 
2799 	return true;
2800 }
2801 
2802 static bool
2803 _equalWithClause(const WithClause *a, const WithClause *b)
2804 {
2805 	COMPARE_NODE_FIELD(ctes);
2806 	COMPARE_SCALAR_FIELD(recursive);
2807 	COMPARE_LOCATION_FIELD(location);
2808 
2809 	return true;
2810 }
2811 
2812 static bool
2813 _equalInferClause(const InferClause *a, const InferClause *b)
2814 {
2815 	COMPARE_NODE_FIELD(indexElems);
2816 	COMPARE_NODE_FIELD(whereClause);
2817 	COMPARE_STRING_FIELD(conname);
2818 	COMPARE_LOCATION_FIELD(location);
2819 
2820 	return true;
2821 }
2822 
2823 static bool
2824 _equalOnConflictClause(const OnConflictClause *a, const OnConflictClause *b)
2825 {
2826 	COMPARE_SCALAR_FIELD(action);
2827 	COMPARE_NODE_FIELD(infer);
2828 	COMPARE_NODE_FIELD(targetList);
2829 	COMPARE_NODE_FIELD(whereClause);
2830 	COMPARE_LOCATION_FIELD(location);
2831 
2832 	return true;
2833 }
2834 
2835 static bool
2836 _equalCommonTableExpr(const CommonTableExpr *a, const CommonTableExpr *b)
2837 {
2838 	COMPARE_STRING_FIELD(ctename);
2839 	COMPARE_NODE_FIELD(aliascolnames);
2840 	COMPARE_SCALAR_FIELD(ctematerialized);
2841 	COMPARE_NODE_FIELD(ctequery);
2842 	COMPARE_LOCATION_FIELD(location);
2843 	COMPARE_SCALAR_FIELD(cterecursive);
2844 	COMPARE_SCALAR_FIELD(cterefcount);
2845 	COMPARE_NODE_FIELD(ctecolnames);
2846 	COMPARE_NODE_FIELD(ctecoltypes);
2847 	COMPARE_NODE_FIELD(ctecoltypmods);
2848 	COMPARE_NODE_FIELD(ctecolcollations);
2849 
2850 	return true;
2851 }
2852 
2853 static bool
2854 _equalXmlSerialize(const XmlSerialize *a, const XmlSerialize *b)
2855 {
2856 	COMPARE_SCALAR_FIELD(xmloption);
2857 	COMPARE_NODE_FIELD(expr);
2858 	COMPARE_NODE_FIELD(typeName);
2859 	COMPARE_LOCATION_FIELD(location);
2860 
2861 	return true;
2862 }
2863 
2864 static bool
2865 _equalRoleSpec(const RoleSpec *a, const RoleSpec *b)
2866 {
2867 	COMPARE_SCALAR_FIELD(roletype);
2868 	COMPARE_STRING_FIELD(rolename);
2869 	COMPARE_LOCATION_FIELD(location);
2870 
2871 	return true;
2872 }
2873 
2874 static bool
2875 _equalTriggerTransition(const TriggerTransition *a, const TriggerTransition *b)
2876 {
2877 	COMPARE_STRING_FIELD(name);
2878 	COMPARE_SCALAR_FIELD(isNew);
2879 	COMPARE_SCALAR_FIELD(isTable);
2880 
2881 	return true;
2882 }
2883 
2884 static bool
2885 _equalPartitionElem(const PartitionElem *a, const PartitionElem *b)
2886 {
2887 	COMPARE_STRING_FIELD(name);
2888 	COMPARE_NODE_FIELD(expr);
2889 	COMPARE_NODE_FIELD(collation);
2890 	COMPARE_NODE_FIELD(opclass);
2891 	COMPARE_LOCATION_FIELD(location);
2892 
2893 	return true;
2894 }
2895 
2896 static bool
2897 _equalPartitionSpec(const PartitionSpec *a, const PartitionSpec *b)
2898 {
2899 	COMPARE_STRING_FIELD(strategy);
2900 	COMPARE_NODE_FIELD(partParams);
2901 	COMPARE_LOCATION_FIELD(location);
2902 
2903 	return true;
2904 }
2905 
2906 static bool
2907 _equalPartitionBoundSpec(const PartitionBoundSpec *a, const PartitionBoundSpec *b)
2908 {
2909 	COMPARE_SCALAR_FIELD(strategy);
2910 	COMPARE_SCALAR_FIELD(is_default);
2911 	COMPARE_SCALAR_FIELD(modulus);
2912 	COMPARE_SCALAR_FIELD(remainder);
2913 	COMPARE_NODE_FIELD(listdatums);
2914 	COMPARE_NODE_FIELD(lowerdatums);
2915 	COMPARE_NODE_FIELD(upperdatums);
2916 	COMPARE_LOCATION_FIELD(location);
2917 
2918 	return true;
2919 }
2920 
2921 static bool
2922 _equalPartitionRangeDatum(const PartitionRangeDatum *a, const PartitionRangeDatum *b)
2923 {
2924 	COMPARE_SCALAR_FIELD(kind);
2925 	COMPARE_NODE_FIELD(value);
2926 	COMPARE_LOCATION_FIELD(location);
2927 
2928 	return true;
2929 }
2930 
2931 static bool
2932 _equalPartitionCmd(const PartitionCmd *a, const PartitionCmd *b)
2933 {
2934 	COMPARE_NODE_FIELD(name);
2935 	COMPARE_NODE_FIELD(bound);
2936 
2937 	return true;
2938 }
2939 
2940 /*
2941  * Stuff from pg_list.h
2942  */
2943 
2944 static bool
2945 _equalList(const List *a, const List *b)
2946 {
2947 	const ListCell *item_a;
2948 	const ListCell *item_b;
2949 
2950 	/*
2951 	 * Try to reject by simple scalar checks before grovelling through all the
2952 	 * list elements...
2953 	 */
2954 	COMPARE_SCALAR_FIELD(type);
2955 	COMPARE_SCALAR_FIELD(length);
2956 
2957 	/*
2958 	 * We place the switch outside the loop for the sake of efficiency; this
2959 	 * may not be worth doing...
2960 	 */
2961 	switch (a->type)
2962 	{
2963 		case T_List:
2964 			forboth(item_a, a, item_b, b)
2965 			{
2966 				if (!equal(lfirst(item_a), lfirst(item_b)))
2967 					return false;
2968 			}
2969 			break;
2970 		case T_IntList:
2971 			forboth(item_a, a, item_b, b)
2972 			{
2973 				if (lfirst_int(item_a) != lfirst_int(item_b))
2974 					return false;
2975 			}
2976 			break;
2977 		case T_OidList:
2978 			forboth(item_a, a, item_b, b)
2979 			{
2980 				if (lfirst_oid(item_a) != lfirst_oid(item_b))
2981 					return false;
2982 			}
2983 			break;
2984 		default:
2985 			elog(ERROR, "unrecognized list node type: %d",
2986 				 (int) a->type);
2987 			return false;		/* keep compiler quiet */
2988 	}
2989 
2990 	/*
2991 	 * If we got here, we should have run out of elements of both lists
2992 	 */
2993 	Assert(item_a == NULL);
2994 	Assert(item_b == NULL);
2995 
2996 	return true;
2997 }
2998 
2999 /*
3000  * Stuff from value.h
3001  */
3002 
3003 static bool
3004 _equalValue(const Value *a, const Value *b)
3005 {
3006 	COMPARE_SCALAR_FIELD(type);
3007 
3008 	switch (a->type)
3009 	{
3010 		case T_Integer:
3011 			COMPARE_SCALAR_FIELD(val.ival);
3012 			break;
3013 		case T_Float:
3014 		case T_String:
3015 		case T_BitString:
3016 			COMPARE_STRING_FIELD(val.str);
3017 			break;
3018 		case T_Null:
3019 			/* nothing to do */
3020 			break;
3021 		default:
3022 			elog(ERROR, "unrecognized node type: %d", (int) a->type);
3023 			break;
3024 	}
3025 
3026 	return true;
3027 }
3028 
3029 /*
3030  * equal
3031  *	  returns whether two nodes are equal
3032  */
3033 bool
3034 equal(const void *a, const void *b)
3035 {
3036 	bool		retval;
3037 
3038 	if (a == b)
3039 		return true;
3040 
3041 	/*
3042 	 * note that a!=b, so only one of them can be NULL
3043 	 */
3044 	if (a == NULL || b == NULL)
3045 		return false;
3046 
3047 	/*
3048 	 * are they the same type of nodes?
3049 	 */
3050 	if (nodeTag(a) != nodeTag(b))
3051 		return false;
3052 
3053 	/* Guard against stack overflow due to overly complex expressions */
3054 	check_stack_depth();
3055 
3056 	switch (nodeTag(a))
3057 	{
3058 			/*
3059 			 * PRIMITIVE NODES
3060 			 */
3061 		case T_Alias:
3062 			retval = _equalAlias(a, b);
3063 			break;
3064 		case T_RangeVar:
3065 			retval = _equalRangeVar(a, b);
3066 			break;
3067 		case T_TableFunc:
3068 			retval = _equalTableFunc(a, b);
3069 			break;
3070 		case T_IntoClause:
3071 			retval = _equalIntoClause(a, b);
3072 			break;
3073 		case T_Var:
3074 			retval = _equalVar(a, b);
3075 			break;
3076 		case T_Const:
3077 			retval = _equalConst(a, b);
3078 			break;
3079 		case T_Param:
3080 			retval = _equalParam(a, b);
3081 			break;
3082 		case T_Aggref:
3083 			retval = _equalAggref(a, b);
3084 			break;
3085 		case T_GroupingFunc:
3086 			retval = _equalGroupingFunc(a, b);
3087 			break;
3088 		case T_WindowFunc:
3089 			retval = _equalWindowFunc(a, b);
3090 			break;
3091 		case T_SubscriptingRef:
3092 			retval = _equalSubscriptingRef(a, b);
3093 			break;
3094 		case T_FuncExpr:
3095 			retval = _equalFuncExpr(a, b);
3096 			break;
3097 		case T_NamedArgExpr:
3098 			retval = _equalNamedArgExpr(a, b);
3099 			break;
3100 		case T_OpExpr:
3101 			retval = _equalOpExpr(a, b);
3102 			break;
3103 		case T_DistinctExpr:
3104 			retval = _equalDistinctExpr(a, b);
3105 			break;
3106 		case T_NullIfExpr:
3107 			retval = _equalNullIfExpr(a, b);
3108 			break;
3109 		case T_ScalarArrayOpExpr:
3110 			retval = _equalScalarArrayOpExpr(a, b);
3111 			break;
3112 		case T_BoolExpr:
3113 			retval = _equalBoolExpr(a, b);
3114 			break;
3115 		case T_SubLink:
3116 			retval = _equalSubLink(a, b);
3117 			break;
3118 		case T_SubPlan:
3119 			retval = _equalSubPlan(a, b);
3120 			break;
3121 		case T_AlternativeSubPlan:
3122 			retval = _equalAlternativeSubPlan(a, b);
3123 			break;
3124 		case T_FieldSelect:
3125 			retval = _equalFieldSelect(a, b);
3126 			break;
3127 		case T_FieldStore:
3128 			retval = _equalFieldStore(a, b);
3129 			break;
3130 		case T_RelabelType:
3131 			retval = _equalRelabelType(a, b);
3132 			break;
3133 		case T_CoerceViaIO:
3134 			retval = _equalCoerceViaIO(a, b);
3135 			break;
3136 		case T_ArrayCoerceExpr:
3137 			retval = _equalArrayCoerceExpr(a, b);
3138 			break;
3139 		case T_ConvertRowtypeExpr:
3140 			retval = _equalConvertRowtypeExpr(a, b);
3141 			break;
3142 		case T_CollateExpr:
3143 			retval = _equalCollateExpr(a, b);
3144 			break;
3145 		case T_CaseExpr:
3146 			retval = _equalCaseExpr(a, b);
3147 			break;
3148 		case T_CaseWhen:
3149 			retval = _equalCaseWhen(a, b);
3150 			break;
3151 		case T_CaseTestExpr:
3152 			retval = _equalCaseTestExpr(a, b);
3153 			break;
3154 		case T_ArrayExpr:
3155 			retval = _equalArrayExpr(a, b);
3156 			break;
3157 		case T_RowExpr:
3158 			retval = _equalRowExpr(a, b);
3159 			break;
3160 		case T_RowCompareExpr:
3161 			retval = _equalRowCompareExpr(a, b);
3162 			break;
3163 		case T_CoalesceExpr:
3164 			retval = _equalCoalesceExpr(a, b);
3165 			break;
3166 		case T_MinMaxExpr:
3167 			retval = _equalMinMaxExpr(a, b);
3168 			break;
3169 		case T_SQLValueFunction:
3170 			retval = _equalSQLValueFunction(a, b);
3171 			break;
3172 		case T_XmlExpr:
3173 			retval = _equalXmlExpr(a, b);
3174 			break;
3175 		case T_NullTest:
3176 			retval = _equalNullTest(a, b);
3177 			break;
3178 		case T_BooleanTest:
3179 			retval = _equalBooleanTest(a, b);
3180 			break;
3181 		case T_CoerceToDomain:
3182 			retval = _equalCoerceToDomain(a, b);
3183 			break;
3184 		case T_CoerceToDomainValue:
3185 			retval = _equalCoerceToDomainValue(a, b);
3186 			break;
3187 		case T_SetToDefault:
3188 			retval = _equalSetToDefault(a, b);
3189 			break;
3190 		case T_CurrentOfExpr:
3191 			retval = _equalCurrentOfExpr(a, b);
3192 			break;
3193 		case T_NextValueExpr:
3194 			retval = _equalNextValueExpr(a, b);
3195 			break;
3196 		case T_InferenceElem:
3197 			retval = _equalInferenceElem(a, b);
3198 			break;
3199 		case T_TargetEntry:
3200 			retval = _equalTargetEntry(a, b);
3201 			break;
3202 		case T_RangeTblRef:
3203 			retval = _equalRangeTblRef(a, b);
3204 			break;
3205 		case T_FromExpr:
3206 			retval = _equalFromExpr(a, b);
3207 			break;
3208 		case T_OnConflictExpr:
3209 			retval = _equalOnConflictExpr(a, b);
3210 			break;
3211 		case T_JoinExpr:
3212 			retval = _equalJoinExpr(a, b);
3213 			break;
3214 
3215 			/*
3216 			 * RELATION NODES
3217 			 */
3218 		case T_PathKey:
3219 			retval = _equalPathKey(a, b);
3220 			break;
3221 		case T_RestrictInfo:
3222 			retval = _equalRestrictInfo(a, b);
3223 			break;
3224 		case T_PlaceHolderVar:
3225 			retval = _equalPlaceHolderVar(a, b);
3226 			break;
3227 		case T_SpecialJoinInfo:
3228 			retval = _equalSpecialJoinInfo(a, b);
3229 			break;
3230 		case T_AppendRelInfo:
3231 			retval = _equalAppendRelInfo(a, b);
3232 			break;
3233 		case T_PlaceHolderInfo:
3234 			retval = _equalPlaceHolderInfo(a, b);
3235 			break;
3236 
3237 		case T_List:
3238 		case T_IntList:
3239 		case T_OidList:
3240 			retval = _equalList(a, b);
3241 			break;
3242 
3243 		case T_Integer:
3244 		case T_Float:
3245 		case T_String:
3246 		case T_BitString:
3247 		case T_Null:
3248 			retval = _equalValue(a, b);
3249 			break;
3250 
3251 			/*
3252 			 * EXTENSIBLE NODES
3253 			 */
3254 		case T_ExtensibleNode:
3255 			retval = _equalExtensibleNode(a, b);
3256 			break;
3257 
3258 			/*
3259 			 * PARSE NODES
3260 			 */
3261 		case T_Query:
3262 			retval = _equalQuery(a, b);
3263 			break;
3264 		case T_RawStmt:
3265 			retval = _equalRawStmt(a, b);
3266 			break;
3267 		case T_InsertStmt:
3268 			retval = _equalInsertStmt(a, b);
3269 			break;
3270 		case T_DeleteStmt:
3271 			retval = _equalDeleteStmt(a, b);
3272 			break;
3273 		case T_UpdateStmt:
3274 			retval = _equalUpdateStmt(a, b);
3275 			break;
3276 		case T_SelectStmt:
3277 			retval = _equalSelectStmt(a, b);
3278 			break;
3279 		case T_SetOperationStmt:
3280 			retval = _equalSetOperationStmt(a, b);
3281 			break;
3282 		case T_AlterTableStmt:
3283 			retval = _equalAlterTableStmt(a, b);
3284 			break;
3285 		case T_AlterTableCmd:
3286 			retval = _equalAlterTableCmd(a, b);
3287 			break;
3288 		case T_AlterCollationStmt:
3289 			retval = _equalAlterCollationStmt(a, b);
3290 			break;
3291 		case T_AlterDomainStmt:
3292 			retval = _equalAlterDomainStmt(a, b);
3293 			break;
3294 		case T_GrantStmt:
3295 			retval = _equalGrantStmt(a, b);
3296 			break;
3297 		case T_GrantRoleStmt:
3298 			retval = _equalGrantRoleStmt(a, b);
3299 			break;
3300 		case T_AlterDefaultPrivilegesStmt:
3301 			retval = _equalAlterDefaultPrivilegesStmt(a, b);
3302 			break;
3303 		case T_DeclareCursorStmt:
3304 			retval = _equalDeclareCursorStmt(a, b);
3305 			break;
3306 		case T_ClosePortalStmt:
3307 			retval = _equalClosePortalStmt(a, b);
3308 			break;
3309 		case T_CallStmt:
3310 			retval = _equalCallStmt(a, b);
3311 			break;
3312 		case T_ClusterStmt:
3313 			retval = _equalClusterStmt(a, b);
3314 			break;
3315 		case T_CopyStmt:
3316 			retval = _equalCopyStmt(a, b);
3317 			break;
3318 		case T_CreateStmt:
3319 			retval = _equalCreateStmt(a, b);
3320 			break;
3321 		case T_TableLikeClause:
3322 			retval = _equalTableLikeClause(a, b);
3323 			break;
3324 		case T_DefineStmt:
3325 			retval = _equalDefineStmt(a, b);
3326 			break;
3327 		case T_DropStmt:
3328 			retval = _equalDropStmt(a, b);
3329 			break;
3330 		case T_TruncateStmt:
3331 			retval = _equalTruncateStmt(a, b);
3332 			break;
3333 		case T_CommentStmt:
3334 			retval = _equalCommentStmt(a, b);
3335 			break;
3336 		case T_SecLabelStmt:
3337 			retval = _equalSecLabelStmt(a, b);
3338 			break;
3339 		case T_FetchStmt:
3340 			retval = _equalFetchStmt(a, b);
3341 			break;
3342 		case T_IndexStmt:
3343 			retval = _equalIndexStmt(a, b);
3344 			break;
3345 		case T_CreateStatsStmt:
3346 			retval = _equalCreateStatsStmt(a, b);
3347 			break;
3348 		case T_AlterStatsStmt:
3349 			retval = _equalAlterStatsStmt(a, b);
3350 			break;
3351 		case T_CreateFunctionStmt:
3352 			retval = _equalCreateFunctionStmt(a, b);
3353 			break;
3354 		case T_FunctionParameter:
3355 			retval = _equalFunctionParameter(a, b);
3356 			break;
3357 		case T_AlterFunctionStmt:
3358 			retval = _equalAlterFunctionStmt(a, b);
3359 			break;
3360 		case T_DoStmt:
3361 			retval = _equalDoStmt(a, b);
3362 			break;
3363 		case T_RenameStmt:
3364 			retval = _equalRenameStmt(a, b);
3365 			break;
3366 		case T_AlterObjectDependsStmt:
3367 			retval = _equalAlterObjectDependsStmt(a, b);
3368 			break;
3369 		case T_AlterObjectSchemaStmt:
3370 			retval = _equalAlterObjectSchemaStmt(a, b);
3371 			break;
3372 		case T_AlterOwnerStmt:
3373 			retval = _equalAlterOwnerStmt(a, b);
3374 			break;
3375 		case T_AlterOperatorStmt:
3376 			retval = _equalAlterOperatorStmt(a, b);
3377 			break;
3378 		case T_AlterTypeStmt:
3379 			retval = _equalAlterTypeStmt(a, b);
3380 			break;
3381 		case T_RuleStmt:
3382 			retval = _equalRuleStmt(a, b);
3383 			break;
3384 		case T_NotifyStmt:
3385 			retval = _equalNotifyStmt(a, b);
3386 			break;
3387 		case T_ListenStmt:
3388 			retval = _equalListenStmt(a, b);
3389 			break;
3390 		case T_UnlistenStmt:
3391 			retval = _equalUnlistenStmt(a, b);
3392 			break;
3393 		case T_TransactionStmt:
3394 			retval = _equalTransactionStmt(a, b);
3395 			break;
3396 		case T_CompositeTypeStmt:
3397 			retval = _equalCompositeTypeStmt(a, b);
3398 			break;
3399 		case T_CreateEnumStmt:
3400 			retval = _equalCreateEnumStmt(a, b);
3401 			break;
3402 		case T_CreateRangeStmt:
3403 			retval = _equalCreateRangeStmt(a, b);
3404 			break;
3405 		case T_AlterEnumStmt:
3406 			retval = _equalAlterEnumStmt(a, b);
3407 			break;
3408 		case T_ViewStmt:
3409 			retval = _equalViewStmt(a, b);
3410 			break;
3411 		case T_LoadStmt:
3412 			retval = _equalLoadStmt(a, b);
3413 			break;
3414 		case T_CreateDomainStmt:
3415 			retval = _equalCreateDomainStmt(a, b);
3416 			break;
3417 		case T_CreateOpClassStmt:
3418 			retval = _equalCreateOpClassStmt(a, b);
3419 			break;
3420 		case T_CreateOpClassItem:
3421 			retval = _equalCreateOpClassItem(a, b);
3422 			break;
3423 		case T_CreateOpFamilyStmt:
3424 			retval = _equalCreateOpFamilyStmt(a, b);
3425 			break;
3426 		case T_AlterOpFamilyStmt:
3427 			retval = _equalAlterOpFamilyStmt(a, b);
3428 			break;
3429 		case T_CreatedbStmt:
3430 			retval = _equalCreatedbStmt(a, b);
3431 			break;
3432 		case T_AlterDatabaseStmt:
3433 			retval = _equalAlterDatabaseStmt(a, b);
3434 			break;
3435 		case T_AlterDatabaseSetStmt:
3436 			retval = _equalAlterDatabaseSetStmt(a, b);
3437 			break;
3438 		case T_DropdbStmt:
3439 			retval = _equalDropdbStmt(a, b);
3440 			break;
3441 		case T_VacuumStmt:
3442 			retval = _equalVacuumStmt(a, b);
3443 			break;
3444 		case T_VacuumRelation:
3445 			retval = _equalVacuumRelation(a, b);
3446 			break;
3447 		case T_ExplainStmt:
3448 			retval = _equalExplainStmt(a, b);
3449 			break;
3450 		case T_CreateTableAsStmt:
3451 			retval = _equalCreateTableAsStmt(a, b);
3452 			break;
3453 		case T_RefreshMatViewStmt:
3454 			retval = _equalRefreshMatViewStmt(a, b);
3455 			break;
3456 		case T_ReplicaIdentityStmt:
3457 			retval = _equalReplicaIdentityStmt(a, b);
3458 			break;
3459 		case T_AlterSystemStmt:
3460 			retval = _equalAlterSystemStmt(a, b);
3461 			break;
3462 		case T_CreateSeqStmt:
3463 			retval = _equalCreateSeqStmt(a, b);
3464 			break;
3465 		case T_AlterSeqStmt:
3466 			retval = _equalAlterSeqStmt(a, b);
3467 			break;
3468 		case T_VariableSetStmt:
3469 			retval = _equalVariableSetStmt(a, b);
3470 			break;
3471 		case T_VariableShowStmt:
3472 			retval = _equalVariableShowStmt(a, b);
3473 			break;
3474 		case T_DiscardStmt:
3475 			retval = _equalDiscardStmt(a, b);
3476 			break;
3477 		case T_CreateTableSpaceStmt:
3478 			retval = _equalCreateTableSpaceStmt(a, b);
3479 			break;
3480 		case T_DropTableSpaceStmt:
3481 			retval = _equalDropTableSpaceStmt(a, b);
3482 			break;
3483 		case T_AlterTableSpaceOptionsStmt:
3484 			retval = _equalAlterTableSpaceOptionsStmt(a, b);
3485 			break;
3486 		case T_AlterTableMoveAllStmt:
3487 			retval = _equalAlterTableMoveAllStmt(a, b);
3488 			break;
3489 		case T_CreateExtensionStmt:
3490 			retval = _equalCreateExtensionStmt(a, b);
3491 			break;
3492 		case T_AlterExtensionStmt:
3493 			retval = _equalAlterExtensionStmt(a, b);
3494 			break;
3495 		case T_AlterExtensionContentsStmt:
3496 			retval = _equalAlterExtensionContentsStmt(a, b);
3497 			break;
3498 		case T_CreateFdwStmt:
3499 			retval = _equalCreateFdwStmt(a, b);
3500 			break;
3501 		case T_AlterFdwStmt:
3502 			retval = _equalAlterFdwStmt(a, b);
3503 			break;
3504 		case T_CreateForeignServerStmt:
3505 			retval = _equalCreateForeignServerStmt(a, b);
3506 			break;
3507 		case T_AlterForeignServerStmt:
3508 			retval = _equalAlterForeignServerStmt(a, b);
3509 			break;
3510 		case T_CreateUserMappingStmt:
3511 			retval = _equalCreateUserMappingStmt(a, b);
3512 			break;
3513 		case T_AlterUserMappingStmt:
3514 			retval = _equalAlterUserMappingStmt(a, b);
3515 			break;
3516 		case T_DropUserMappingStmt:
3517 			retval = _equalDropUserMappingStmt(a, b);
3518 			break;
3519 		case T_CreateForeignTableStmt:
3520 			retval = _equalCreateForeignTableStmt(a, b);
3521 			break;
3522 		case T_ImportForeignSchemaStmt:
3523 			retval = _equalImportForeignSchemaStmt(a, b);
3524 			break;
3525 		case T_CreateTransformStmt:
3526 			retval = _equalCreateTransformStmt(a, b);
3527 			break;
3528 		case T_CreateAmStmt:
3529 			retval = _equalCreateAmStmt(a, b);
3530 			break;
3531 		case T_CreateTrigStmt:
3532 			retval = _equalCreateTrigStmt(a, b);
3533 			break;
3534 		case T_CreateEventTrigStmt:
3535 			retval = _equalCreateEventTrigStmt(a, b);
3536 			break;
3537 		case T_AlterEventTrigStmt:
3538 			retval = _equalAlterEventTrigStmt(a, b);
3539 			break;
3540 		case T_CreatePLangStmt:
3541 			retval = _equalCreatePLangStmt(a, b);
3542 			break;
3543 		case T_CreateRoleStmt:
3544 			retval = _equalCreateRoleStmt(a, b);
3545 			break;
3546 		case T_AlterRoleStmt:
3547 			retval = _equalAlterRoleStmt(a, b);
3548 			break;
3549 		case T_AlterRoleSetStmt:
3550 			retval = _equalAlterRoleSetStmt(a, b);
3551 			break;
3552 		case T_DropRoleStmt:
3553 			retval = _equalDropRoleStmt(a, b);
3554 			break;
3555 		case T_LockStmt:
3556 			retval = _equalLockStmt(a, b);
3557 			break;
3558 		case T_ConstraintsSetStmt:
3559 			retval = _equalConstraintsSetStmt(a, b);
3560 			break;
3561 		case T_ReindexStmt:
3562 			retval = _equalReindexStmt(a, b);
3563 			break;
3564 		case T_CheckPointStmt:
3565 			retval = true;
3566 			break;
3567 		case T_CreateSchemaStmt:
3568 			retval = _equalCreateSchemaStmt(a, b);
3569 			break;
3570 		case T_CreateConversionStmt:
3571 			retval = _equalCreateConversionStmt(a, b);
3572 			break;
3573 		case T_CreateCastStmt:
3574 			retval = _equalCreateCastStmt(a, b);
3575 			break;
3576 		case T_PrepareStmt:
3577 			retval = _equalPrepareStmt(a, b);
3578 			break;
3579 		case T_ExecuteStmt:
3580 			retval = _equalExecuteStmt(a, b);
3581 			break;
3582 		case T_DeallocateStmt:
3583 			retval = _equalDeallocateStmt(a, b);
3584 			break;
3585 		case T_DropOwnedStmt:
3586 			retval = _equalDropOwnedStmt(a, b);
3587 			break;
3588 		case T_ReassignOwnedStmt:
3589 			retval = _equalReassignOwnedStmt(a, b);
3590 			break;
3591 		case T_AlterTSDictionaryStmt:
3592 			retval = _equalAlterTSDictionaryStmt(a, b);
3593 			break;
3594 		case T_AlterTSConfigurationStmt:
3595 			retval = _equalAlterTSConfigurationStmt(a, b);
3596 			break;
3597 		case T_CreatePolicyStmt:
3598 			retval = _equalCreatePolicyStmt(a, b);
3599 			break;
3600 		case T_AlterPolicyStmt:
3601 			retval = _equalAlterPolicyStmt(a, b);
3602 			break;
3603 		case T_CreatePublicationStmt:
3604 			retval = _equalCreatePublicationStmt(a, b);
3605 			break;
3606 		case T_AlterPublicationStmt:
3607 			retval = _equalAlterPublicationStmt(a, b);
3608 			break;
3609 		case T_CreateSubscriptionStmt:
3610 			retval = _equalCreateSubscriptionStmt(a, b);
3611 			break;
3612 		case T_AlterSubscriptionStmt:
3613 			retval = _equalAlterSubscriptionStmt(a, b);
3614 			break;
3615 		case T_DropSubscriptionStmt:
3616 			retval = _equalDropSubscriptionStmt(a, b);
3617 			break;
3618 		case T_A_Expr:
3619 			retval = _equalAExpr(a, b);
3620 			break;
3621 		case T_ColumnRef:
3622 			retval = _equalColumnRef(a, b);
3623 			break;
3624 		case T_ParamRef:
3625 			retval = _equalParamRef(a, b);
3626 			break;
3627 		case T_A_Const:
3628 			retval = _equalAConst(a, b);
3629 			break;
3630 		case T_FuncCall:
3631 			retval = _equalFuncCall(a, b);
3632 			break;
3633 		case T_A_Star:
3634 			retval = _equalAStar(a, b);
3635 			break;
3636 		case T_A_Indices:
3637 			retval = _equalAIndices(a, b);
3638 			break;
3639 		case T_A_Indirection:
3640 			retval = _equalA_Indirection(a, b);
3641 			break;
3642 		case T_A_ArrayExpr:
3643 			retval = _equalA_ArrayExpr(a, b);
3644 			break;
3645 		case T_ResTarget:
3646 			retval = _equalResTarget(a, b);
3647 			break;
3648 		case T_MultiAssignRef:
3649 			retval = _equalMultiAssignRef(a, b);
3650 			break;
3651 		case T_TypeCast:
3652 			retval = _equalTypeCast(a, b);
3653 			break;
3654 		case T_CollateClause:
3655 			retval = _equalCollateClause(a, b);
3656 			break;
3657 		case T_SortBy:
3658 			retval = _equalSortBy(a, b);
3659 			break;
3660 		case T_WindowDef:
3661 			retval = _equalWindowDef(a, b);
3662 			break;
3663 		case T_RangeSubselect:
3664 			retval = _equalRangeSubselect(a, b);
3665 			break;
3666 		case T_RangeFunction:
3667 			retval = _equalRangeFunction(a, b);
3668 			break;
3669 		case T_RangeTableSample:
3670 			retval = _equalRangeTableSample(a, b);
3671 			break;
3672 		case T_RangeTableFunc:
3673 			retval = _equalRangeTableFunc(a, b);
3674 			break;
3675 		case T_RangeTableFuncCol:
3676 			retval = _equalRangeTableFuncCol(a, b);
3677 			break;
3678 		case T_TypeName:
3679 			retval = _equalTypeName(a, b);
3680 			break;
3681 		case T_IndexElem:
3682 			retval = _equalIndexElem(a, b);
3683 			break;
3684 		case T_ColumnDef:
3685 			retval = _equalColumnDef(a, b);
3686 			break;
3687 		case T_Constraint:
3688 			retval = _equalConstraint(a, b);
3689 			break;
3690 		case T_DefElem:
3691 			retval = _equalDefElem(a, b);
3692 			break;
3693 		case T_LockingClause:
3694 			retval = _equalLockingClause(a, b);
3695 			break;
3696 		case T_RangeTblEntry:
3697 			retval = _equalRangeTblEntry(a, b);
3698 			break;
3699 		case T_RangeTblFunction:
3700 			retval = _equalRangeTblFunction(a, b);
3701 			break;
3702 		case T_TableSampleClause:
3703 			retval = _equalTableSampleClause(a, b);
3704 			break;
3705 		case T_WithCheckOption:
3706 			retval = _equalWithCheckOption(a, b);
3707 			break;
3708 		case T_SortGroupClause:
3709 			retval = _equalSortGroupClause(a, b);
3710 			break;
3711 		case T_GroupingSet:
3712 			retval = _equalGroupingSet(a, b);
3713 			break;
3714 		case T_WindowClause:
3715 			retval = _equalWindowClause(a, b);
3716 			break;
3717 		case T_RowMarkClause:
3718 			retval = _equalRowMarkClause(a, b);
3719 			break;
3720 		case T_WithClause:
3721 			retval = _equalWithClause(a, b);
3722 			break;
3723 		case T_InferClause:
3724 			retval = _equalInferClause(a, b);
3725 			break;
3726 		case T_OnConflictClause:
3727 			retval = _equalOnConflictClause(a, b);
3728 			break;
3729 		case T_CommonTableExpr:
3730 			retval = _equalCommonTableExpr(a, b);
3731 			break;
3732 		case T_ObjectWithArgs:
3733 			retval = _equalObjectWithArgs(a, b);
3734 			break;
3735 		case T_AccessPriv:
3736 			retval = _equalAccessPriv(a, b);
3737 			break;
3738 		case T_XmlSerialize:
3739 			retval = _equalXmlSerialize(a, b);
3740 			break;
3741 		case T_RoleSpec:
3742 			retval = _equalRoleSpec(a, b);
3743 			break;
3744 		case T_TriggerTransition:
3745 			retval = _equalTriggerTransition(a, b);
3746 			break;
3747 		case T_PartitionElem:
3748 			retval = _equalPartitionElem(a, b);
3749 			break;
3750 		case T_PartitionSpec:
3751 			retval = _equalPartitionSpec(a, b);
3752 			break;
3753 		case T_PartitionBoundSpec:
3754 			retval = _equalPartitionBoundSpec(a, b);
3755 			break;
3756 		case T_PartitionRangeDatum:
3757 			retval = _equalPartitionRangeDatum(a, b);
3758 			break;
3759 		case T_PartitionCmd:
3760 			retval = _equalPartitionCmd(a, b);
3761 			break;
3762 
3763 		default:
3764 			elog(ERROR, "unrecognized node type: %d",
3765 				 (int) nodeTag(a));
3766 			retval = false;		/* keep compiler quiet */
3767 			break;
3768 	}
3769 
3770 	return retval;
3771 }
3772