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