~ubuntu-branches/ubuntu/precise/postgresql-9.1/precise-security

« back to all changes in this revision

Viewing changes to src/backend/nodes/equalfuncs.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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-2011, 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 "nodes/relation.h"
 
33
#include "utils/datum.h"
 
34
 
 
35
 
 
36
/*
 
37
 * Macros to simplify comparison of different kinds of fields.  Use these
 
38
 * wherever possible to reduce the chance for silly typos.      Note that these
 
39
 * hard-wire the convention that the local variables in an Equal routine are
 
40
 * named 'a' and 'b'.
 
41
 */
 
42
 
 
43
/* Compare a simple scalar field (int, float, bool, enum, etc) */
 
44
#define COMPARE_SCALAR_FIELD(fldname) \
 
45
        do { \
 
46
                if (a->fldname != b->fldname) \
 
47
                        return false; \
 
48
        } while (0)
 
49
 
 
50
/* Compare a field that is a pointer to some kind of Node or Node tree */
 
51
#define COMPARE_NODE_FIELD(fldname) \
 
52
        do { \
 
53
                if (!equal(a->fldname, b->fldname)) \
 
54
                        return false; \
 
55
        } while (0)
 
56
 
 
57
/* Compare a field that is a pointer to a Bitmapset */
 
58
#define COMPARE_BITMAPSET_FIELD(fldname) \
 
59
        do { \
 
60
                if (!bms_equal(a->fldname, b->fldname)) \
 
61
                        return false; \
 
62
        } while (0)
 
63
 
 
64
/* Compare a field that is a pointer to a C string, or perhaps NULL */
 
65
#define COMPARE_STRING_FIELD(fldname) \
 
66
        do { \
 
67
                if (!equalstr(a->fldname, b->fldname)) \
 
68
                        return false; \
 
69
        } while (0)
 
70
 
 
71
/* Macro for comparing string fields that might be NULL */
 
72
#define equalstr(a, b)  \
 
73
        (((a) != NULL && (b) != NULL) ? (strcmp(a, b) == 0) : (a) == (b))
 
74
 
 
75
/* Compare a field that is a pointer to a simple palloc'd object of size sz */
 
76
#define COMPARE_POINTER_FIELD(fldname, sz) \
 
77
        do { \
 
78
                if (memcmp(a->fldname, b->fldname, (sz)) != 0) \
 
79
                        return false; \
 
80
        } while (0)
 
81
 
 
82
/* Compare a parse location field (this is a no-op, per note above) */
 
83
#define COMPARE_LOCATION_FIELD(fldname) \
 
84
        ((void) 0)
 
85
 
 
86
 
 
87
/*
 
88
 *      Stuff from primnodes.h
 
89
 */
 
90
 
 
91
static bool
 
92
_equalAlias(Alias *a, Alias *b)
 
93
{
 
94
        COMPARE_STRING_FIELD(aliasname);
 
95
        COMPARE_NODE_FIELD(colnames);
 
96
 
 
97
        return true;
 
98
}
 
99
 
 
100
static bool
 
101
_equalRangeVar(RangeVar *a, RangeVar *b)
 
102
{
 
103
        COMPARE_STRING_FIELD(catalogname);
 
104
        COMPARE_STRING_FIELD(schemaname);
 
105
        COMPARE_STRING_FIELD(relname);
 
106
        COMPARE_SCALAR_FIELD(inhOpt);
 
107
        COMPARE_SCALAR_FIELD(relpersistence);
 
108
        COMPARE_NODE_FIELD(alias);
 
109
        COMPARE_LOCATION_FIELD(location);
 
110
 
 
111
        return true;
 
112
}
 
113
 
 
114
static bool
 
115
_equalIntoClause(IntoClause *a, IntoClause *b)
 
116
{
 
117
        COMPARE_NODE_FIELD(rel);
 
118
        COMPARE_NODE_FIELD(colNames);
 
119
        COMPARE_NODE_FIELD(options);
 
120
        COMPARE_SCALAR_FIELD(onCommit);
 
121
        COMPARE_STRING_FIELD(tableSpaceName);
 
122
 
 
123
        return true;
 
124
}
 
125
 
 
126
/*
 
127
 * We don't need an _equalExpr because Expr is an abstract supertype which
 
128
 * should never actually get instantiated.      Also, since it has no common
 
129
 * fields except NodeTag, there's no need for a helper routine to factor
 
130
 * out comparing the common fields...
 
131
 */
 
132
 
 
133
static bool
 
134
_equalVar(Var *a, Var *b)
 
135
{
 
136
        COMPARE_SCALAR_FIELD(varno);
 
137
        COMPARE_SCALAR_FIELD(varattno);
 
138
        COMPARE_SCALAR_FIELD(vartype);
 
139
        COMPARE_SCALAR_FIELD(vartypmod);
 
140
        COMPARE_SCALAR_FIELD(varcollid);
 
141
        COMPARE_SCALAR_FIELD(varlevelsup);
 
142
        COMPARE_SCALAR_FIELD(varnoold);
 
143
        COMPARE_SCALAR_FIELD(varoattno);
 
144
        COMPARE_LOCATION_FIELD(location);
 
145
 
 
146
        return true;
 
147
}
 
148
 
 
149
static bool
 
150
_equalConst(Const *a, Const *b)
 
151
{
 
152
        COMPARE_SCALAR_FIELD(consttype);
 
153
        COMPARE_SCALAR_FIELD(consttypmod);
 
154
        COMPARE_SCALAR_FIELD(constcollid);
 
155
        COMPARE_SCALAR_FIELD(constlen);
 
156
        COMPARE_SCALAR_FIELD(constisnull);
 
157
        COMPARE_SCALAR_FIELD(constbyval);
 
158
        COMPARE_LOCATION_FIELD(location);
 
159
 
 
160
        /*
 
161
         * We treat all NULL constants of the same type as equal. Someday this
 
162
         * might need to change?  But datumIsEqual doesn't work on nulls, so...
 
163
         */
 
164
        if (a->constisnull)
 
165
                return true;
 
166
        return datumIsEqual(a->constvalue, b->constvalue,
 
167
                                                a->constbyval, a->constlen);
 
168
}
 
169
 
 
170
static bool
 
171
_equalParam(Param *a, Param *b)
 
172
{
 
173
        COMPARE_SCALAR_FIELD(paramkind);
 
174
        COMPARE_SCALAR_FIELD(paramid);
 
175
        COMPARE_SCALAR_FIELD(paramtype);
 
176
        COMPARE_SCALAR_FIELD(paramtypmod);
 
177
        COMPARE_SCALAR_FIELD(paramcollid);
 
178
        COMPARE_LOCATION_FIELD(location);
 
179
 
 
180
        return true;
 
181
}
 
182
 
 
183
static bool
 
184
_equalAggref(Aggref *a, Aggref *b)
 
185
{
 
186
        COMPARE_SCALAR_FIELD(aggfnoid);
 
187
        COMPARE_SCALAR_FIELD(aggtype);
 
188
        COMPARE_SCALAR_FIELD(aggcollid);
 
189
        COMPARE_SCALAR_FIELD(inputcollid);
 
190
        COMPARE_NODE_FIELD(args);
 
191
        COMPARE_NODE_FIELD(aggorder);
 
192
        COMPARE_NODE_FIELD(aggdistinct);
 
193
        COMPARE_SCALAR_FIELD(aggstar);
 
194
        COMPARE_SCALAR_FIELD(agglevelsup);
 
195
        COMPARE_LOCATION_FIELD(location);
 
196
 
 
197
        return true;
 
198
}
 
199
 
 
200
static bool
 
201
_equalWindowFunc(WindowFunc *a, WindowFunc *b)
 
202
{
 
203
        COMPARE_SCALAR_FIELD(winfnoid);
 
204
        COMPARE_SCALAR_FIELD(wintype);
 
205
        COMPARE_SCALAR_FIELD(wincollid);
 
206
        COMPARE_SCALAR_FIELD(inputcollid);
 
207
        COMPARE_NODE_FIELD(args);
 
208
        COMPARE_SCALAR_FIELD(winref);
 
209
        COMPARE_SCALAR_FIELD(winstar);
 
210
        COMPARE_SCALAR_FIELD(winagg);
 
211
        COMPARE_LOCATION_FIELD(location);
 
212
 
 
213
        return true;
 
214
}
 
215
 
 
216
static bool
 
217
_equalArrayRef(ArrayRef *a, ArrayRef *b)
 
218
{
 
219
        COMPARE_SCALAR_FIELD(refarraytype);
 
220
        COMPARE_SCALAR_FIELD(refelemtype);
 
221
        COMPARE_SCALAR_FIELD(reftypmod);
 
222
        COMPARE_SCALAR_FIELD(refcollid);
 
223
        COMPARE_NODE_FIELD(refupperindexpr);
 
224
        COMPARE_NODE_FIELD(reflowerindexpr);
 
225
        COMPARE_NODE_FIELD(refexpr);
 
226
        COMPARE_NODE_FIELD(refassgnexpr);
 
227
 
 
228
        return true;
 
229
}
 
230
 
 
231
static bool
 
232
_equalFuncExpr(FuncExpr *a, FuncExpr *b)
 
233
{
 
234
        COMPARE_SCALAR_FIELD(funcid);
 
235
        COMPARE_SCALAR_FIELD(funcresulttype);
 
236
        COMPARE_SCALAR_FIELD(funcretset);
 
237
 
 
238
        /*
 
239
         * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
 
240
         * that are equal() to both explicit and implicit coercions.
 
241
         */
 
242
        if (a->funcformat != b->funcformat &&
 
243
                a->funcformat != COERCE_DONTCARE &&
 
244
                b->funcformat != COERCE_DONTCARE)
 
245
                return false;
 
246
 
 
247
        COMPARE_SCALAR_FIELD(funccollid);
 
248
        COMPARE_SCALAR_FIELD(inputcollid);
 
249
        COMPARE_NODE_FIELD(args);
 
250
        COMPARE_LOCATION_FIELD(location);
 
251
 
 
252
        return true;
 
253
}
 
254
 
 
255
static bool
 
256
_equalNamedArgExpr(NamedArgExpr *a, NamedArgExpr *b)
 
257
{
 
258
        COMPARE_NODE_FIELD(arg);
 
259
        COMPARE_STRING_FIELD(name);
 
260
        COMPARE_SCALAR_FIELD(argnumber);
 
261
        COMPARE_LOCATION_FIELD(location);
 
262
 
 
263
        return true;
 
264
}
 
265
 
 
266
static bool
 
267
_equalOpExpr(OpExpr *a, OpExpr *b)
 
268
{
 
269
        COMPARE_SCALAR_FIELD(opno);
 
270
 
 
271
        /*
 
272
         * Special-case opfuncid: it is allowable for it to differ if one node
 
273
         * contains zero and the other doesn't.  This just means that the one node
 
274
         * isn't as far along in the parse/plan pipeline and hasn't had the
 
275
         * opfuncid cache filled yet.
 
276
         */
 
277
        if (a->opfuncid != b->opfuncid &&
 
278
                a->opfuncid != 0 &&
 
279
                b->opfuncid != 0)
 
280
                return false;
 
281
 
 
282
        COMPARE_SCALAR_FIELD(opresulttype);
 
283
        COMPARE_SCALAR_FIELD(opretset);
 
284
        COMPARE_SCALAR_FIELD(opcollid);
 
285
        COMPARE_SCALAR_FIELD(inputcollid);
 
286
        COMPARE_NODE_FIELD(args);
 
287
        COMPARE_LOCATION_FIELD(location);
 
288
 
 
289
        return true;
 
290
}
 
291
 
 
292
static bool
 
293
_equalDistinctExpr(DistinctExpr *a, DistinctExpr *b)
 
294
{
 
295
        COMPARE_SCALAR_FIELD(opno);
 
296
 
 
297
        /*
 
298
         * Special-case opfuncid: it is allowable for it to differ if one node
 
299
         * contains zero and the other doesn't.  This just means that the one node
 
300
         * isn't as far along in the parse/plan pipeline and hasn't had the
 
301
         * opfuncid cache filled yet.
 
302
         */
 
303
        if (a->opfuncid != b->opfuncid &&
 
304
                a->opfuncid != 0 &&
 
305
                b->opfuncid != 0)
 
306
                return false;
 
307
 
 
308
        COMPARE_SCALAR_FIELD(opresulttype);
 
309
        COMPARE_SCALAR_FIELD(opretset);
 
310
        COMPARE_SCALAR_FIELD(opcollid);
 
311
        COMPARE_SCALAR_FIELD(inputcollid);
 
312
        COMPARE_NODE_FIELD(args);
 
313
        COMPARE_LOCATION_FIELD(location);
 
314
 
 
315
        return true;
 
316
}
 
317
 
 
318
static bool
 
319
_equalNullIfExpr(NullIfExpr *a, NullIfExpr *b)
 
320
{
 
321
        COMPARE_SCALAR_FIELD(opno);
 
322
 
 
323
        /*
 
324
         * Special-case opfuncid: it is allowable for it to differ if one node
 
325
         * contains zero and the other doesn't.  This just means that the one node
 
326
         * isn't as far along in the parse/plan pipeline and hasn't had the
 
327
         * opfuncid cache filled yet.
 
328
         */
 
329
        if (a->opfuncid != b->opfuncid &&
 
330
                a->opfuncid != 0 &&
 
331
                b->opfuncid != 0)
 
332
                return false;
 
333
 
 
334
        COMPARE_SCALAR_FIELD(opresulttype);
 
335
        COMPARE_SCALAR_FIELD(opretset);
 
336
        COMPARE_SCALAR_FIELD(opcollid);
 
337
        COMPARE_SCALAR_FIELD(inputcollid);
 
338
        COMPARE_NODE_FIELD(args);
 
339
        COMPARE_LOCATION_FIELD(location);
 
340
 
 
341
        return true;
 
342
}
 
343
 
 
344
static bool
 
345
_equalScalarArrayOpExpr(ScalarArrayOpExpr *a, ScalarArrayOpExpr *b)
 
346
{
 
347
        COMPARE_SCALAR_FIELD(opno);
 
348
 
 
349
        /*
 
350
         * Special-case opfuncid: it is allowable for it to differ if one node
 
351
         * contains zero and the other doesn't.  This just means that the one node
 
352
         * isn't as far along in the parse/plan pipeline and hasn't had the
 
353
         * opfuncid cache filled yet.
 
354
         */
 
355
        if (a->opfuncid != b->opfuncid &&
 
356
                a->opfuncid != 0 &&
 
357
                b->opfuncid != 0)
 
358
                return false;
 
359
 
 
360
        COMPARE_SCALAR_FIELD(useOr);
 
361
        COMPARE_SCALAR_FIELD(inputcollid);
 
362
        COMPARE_NODE_FIELD(args);
 
363
        COMPARE_LOCATION_FIELD(location);
 
364
 
 
365
        return true;
 
366
}
 
367
 
 
368
static bool
 
369
_equalBoolExpr(BoolExpr *a, BoolExpr *b)
 
370
{
 
371
        COMPARE_SCALAR_FIELD(boolop);
 
372
        COMPARE_NODE_FIELD(args);
 
373
        COMPARE_LOCATION_FIELD(location);
 
374
 
 
375
        return true;
 
376
}
 
377
 
 
378
static bool
 
379
_equalSubLink(SubLink *a, SubLink *b)
 
380
{
 
381
        COMPARE_SCALAR_FIELD(subLinkType);
 
382
        COMPARE_NODE_FIELD(testexpr);
 
383
        COMPARE_NODE_FIELD(operName);
 
384
        COMPARE_NODE_FIELD(subselect);
 
385
        COMPARE_LOCATION_FIELD(location);
 
386
 
 
387
        return true;
 
388
}
 
389
 
 
390
static bool
 
391
_equalSubPlan(SubPlan *a, SubPlan *b)
 
392
{
 
393
        COMPARE_SCALAR_FIELD(subLinkType);
 
394
        COMPARE_NODE_FIELD(testexpr);
 
395
        COMPARE_NODE_FIELD(paramIds);
 
396
        COMPARE_SCALAR_FIELD(plan_id);
 
397
        COMPARE_STRING_FIELD(plan_name);
 
398
        COMPARE_SCALAR_FIELD(firstColType);
 
399
        COMPARE_SCALAR_FIELD(firstColTypmod);
 
400
        COMPARE_SCALAR_FIELD(firstColCollation);
 
401
        COMPARE_SCALAR_FIELD(useHashTable);
 
402
        COMPARE_SCALAR_FIELD(unknownEqFalse);
 
403
        COMPARE_NODE_FIELD(setParam);
 
404
        COMPARE_NODE_FIELD(parParam);
 
405
        COMPARE_NODE_FIELD(args);
 
406
        COMPARE_SCALAR_FIELD(startup_cost);
 
407
        COMPARE_SCALAR_FIELD(per_call_cost);
 
408
 
 
409
        return true;
 
410
}
 
411
 
 
412
static bool
 
413
_equalAlternativeSubPlan(AlternativeSubPlan *a, AlternativeSubPlan *b)
 
414
{
 
415
        COMPARE_NODE_FIELD(subplans);
 
416
 
 
417
        return true;
 
418
}
 
419
 
 
420
static bool
 
421
_equalFieldSelect(FieldSelect *a, FieldSelect *b)
 
422
{
 
423
        COMPARE_NODE_FIELD(arg);
 
424
        COMPARE_SCALAR_FIELD(fieldnum);
 
425
        COMPARE_SCALAR_FIELD(resulttype);
 
426
        COMPARE_SCALAR_FIELD(resulttypmod);
 
427
        COMPARE_SCALAR_FIELD(resultcollid);
 
428
 
 
429
        return true;
 
430
}
 
431
 
 
432
static bool
 
433
_equalFieldStore(FieldStore *a, FieldStore *b)
 
434
{
 
435
        COMPARE_NODE_FIELD(arg);
 
436
        COMPARE_NODE_FIELD(newvals);
 
437
        COMPARE_NODE_FIELD(fieldnums);
 
438
        COMPARE_SCALAR_FIELD(resulttype);
 
439
 
 
440
        return true;
 
441
}
 
442
 
 
443
static bool
 
444
_equalRelabelType(RelabelType *a, RelabelType *b)
 
445
{
 
446
        COMPARE_NODE_FIELD(arg);
 
447
        COMPARE_SCALAR_FIELD(resulttype);
 
448
        COMPARE_SCALAR_FIELD(resulttypmod);
 
449
        COMPARE_SCALAR_FIELD(resultcollid);
 
450
 
 
451
        /*
 
452
         * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
 
453
         * that are equal() to both explicit and implicit coercions.
 
454
         */
 
455
        if (a->relabelformat != b->relabelformat &&
 
456
                a->relabelformat != COERCE_DONTCARE &&
 
457
                b->relabelformat != COERCE_DONTCARE)
 
458
                return false;
 
459
 
 
460
        COMPARE_LOCATION_FIELD(location);
 
461
 
 
462
        return true;
 
463
}
 
464
 
 
465
static bool
 
466
_equalCoerceViaIO(CoerceViaIO *a, CoerceViaIO *b)
 
467
{
 
468
        COMPARE_NODE_FIELD(arg);
 
469
        COMPARE_SCALAR_FIELD(resulttype);
 
470
        COMPARE_SCALAR_FIELD(resultcollid);
 
471
 
 
472
        /*
 
473
         * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
 
474
         * that are equal() to both explicit and implicit coercions.
 
475
         */
 
476
        if (a->coerceformat != b->coerceformat &&
 
477
                a->coerceformat != COERCE_DONTCARE &&
 
478
                b->coerceformat != COERCE_DONTCARE)
 
479
                return false;
 
480
 
 
481
        COMPARE_LOCATION_FIELD(location);
 
482
 
 
483
        return true;
 
484
}
 
485
 
 
486
static bool
 
487
_equalArrayCoerceExpr(ArrayCoerceExpr *a, ArrayCoerceExpr *b)
 
488
{
 
489
        COMPARE_NODE_FIELD(arg);
 
490
        COMPARE_SCALAR_FIELD(elemfuncid);
 
491
        COMPARE_SCALAR_FIELD(resulttype);
 
492
        COMPARE_SCALAR_FIELD(resulttypmod);
 
493
        COMPARE_SCALAR_FIELD(resultcollid);
 
494
        COMPARE_SCALAR_FIELD(isExplicit);
 
495
 
 
496
        /*
 
497
         * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
 
498
         * that are equal() to both explicit and implicit coercions.
 
499
         */
 
500
        if (a->coerceformat != b->coerceformat &&
 
501
                a->coerceformat != COERCE_DONTCARE &&
 
502
                b->coerceformat != COERCE_DONTCARE)
 
503
                return false;
 
504
 
 
505
        COMPARE_LOCATION_FIELD(location);
 
506
 
 
507
        return true;
 
508
}
 
509
 
 
510
static bool
 
511
_equalConvertRowtypeExpr(ConvertRowtypeExpr *a, ConvertRowtypeExpr *b)
 
512
{
 
513
        COMPARE_NODE_FIELD(arg);
 
514
        COMPARE_SCALAR_FIELD(resulttype);
 
515
 
 
516
        /*
 
517
         * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
 
518
         * that are equal() to both explicit and implicit coercions.
 
519
         */
 
520
        if (a->convertformat != b->convertformat &&
 
521
                a->convertformat != COERCE_DONTCARE &&
 
522
                b->convertformat != COERCE_DONTCARE)
 
523
                return false;
 
524
 
 
525
        COMPARE_LOCATION_FIELD(location);
 
526
 
 
527
        return true;
 
528
}
 
529
 
 
530
static bool
 
531
_equalCollateExpr(CollateExpr *a, CollateExpr *b)
 
532
{
 
533
        COMPARE_NODE_FIELD(arg);
 
534
        COMPARE_SCALAR_FIELD(collOid);
 
535
        COMPARE_LOCATION_FIELD(location);
 
536
 
 
537
        return true;
 
538
}
 
539
 
 
540
static bool
 
541
_equalCaseExpr(CaseExpr *a, CaseExpr *b)
 
542
{
 
543
        COMPARE_SCALAR_FIELD(casetype);
 
544
        COMPARE_SCALAR_FIELD(casecollid);
 
545
        COMPARE_NODE_FIELD(arg);
 
546
        COMPARE_NODE_FIELD(args);
 
547
        COMPARE_NODE_FIELD(defresult);
 
548
        COMPARE_LOCATION_FIELD(location);
 
549
 
 
550
        return true;
 
551
}
 
552
 
 
553
static bool
 
554
_equalCaseWhen(CaseWhen *a, CaseWhen *b)
 
555
{
 
556
        COMPARE_NODE_FIELD(expr);
 
557
        COMPARE_NODE_FIELD(result);
 
558
        COMPARE_LOCATION_FIELD(location);
 
559
 
 
560
        return true;
 
561
}
 
562
 
 
563
static bool
 
564
_equalCaseTestExpr(CaseTestExpr *a, CaseTestExpr *b)
 
565
{
 
566
        COMPARE_SCALAR_FIELD(typeId);
 
567
        COMPARE_SCALAR_FIELD(typeMod);
 
568
        COMPARE_SCALAR_FIELD(collation);
 
569
 
 
570
        return true;
 
571
}
 
572
 
 
573
static bool
 
574
_equalArrayExpr(ArrayExpr *a, ArrayExpr *b)
 
575
{
 
576
        COMPARE_SCALAR_FIELD(array_typeid);
 
577
        COMPARE_SCALAR_FIELD(array_collid);
 
578
        COMPARE_SCALAR_FIELD(element_typeid);
 
579
        COMPARE_NODE_FIELD(elements);
 
580
        COMPARE_SCALAR_FIELD(multidims);
 
581
        COMPARE_LOCATION_FIELD(location);
 
582
 
 
583
        return true;
 
584
}
 
585
 
 
586
static bool
 
587
_equalRowExpr(RowExpr *a, RowExpr *b)
 
588
{
 
589
        COMPARE_NODE_FIELD(args);
 
590
        COMPARE_SCALAR_FIELD(row_typeid);
 
591
 
 
592
        /*
 
593
         * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
 
594
         * that are equal() to both explicit and implicit coercions.
 
595
         */
 
596
        if (a->row_format != b->row_format &&
 
597
                a->row_format != COERCE_DONTCARE &&
 
598
                b->row_format != COERCE_DONTCARE)
 
599
                return false;
 
600
 
 
601
        COMPARE_NODE_FIELD(colnames);
 
602
        COMPARE_LOCATION_FIELD(location);
 
603
 
 
604
        return true;
 
605
}
 
606
 
 
607
static bool
 
608
_equalRowCompareExpr(RowCompareExpr *a, 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
 
 
620
static bool
 
621
_equalCoalesceExpr(CoalesceExpr *a, 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
 
 
631
static bool
 
632
_equalMinMaxExpr(MinMaxExpr *a, 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
 
 
644
static bool
 
645
_equalXmlExpr(XmlExpr *a, XmlExpr *b)
 
646
{
 
647
        COMPARE_SCALAR_FIELD(op);
 
648
        COMPARE_STRING_FIELD(name);
 
649
        COMPARE_NODE_FIELD(named_args);
 
650
        COMPARE_NODE_FIELD(arg_names);
 
651
        COMPARE_NODE_FIELD(args);
 
652
        COMPARE_SCALAR_FIELD(xmloption);
 
653
        COMPARE_SCALAR_FIELD(type);
 
654
        COMPARE_SCALAR_FIELD(typmod);
 
655
        COMPARE_LOCATION_FIELD(location);
 
656
 
 
657
        return true;
 
658
}
 
659
 
 
660
static bool
 
661
_equalNullTest(NullTest *a, NullTest *b)
 
662
{
 
663
        COMPARE_NODE_FIELD(arg);
 
664
        COMPARE_SCALAR_FIELD(nulltesttype);
 
665
        COMPARE_SCALAR_FIELD(argisrow);
 
666
 
 
667
        return true;
 
668
}
 
669
 
 
670
static bool
 
671
_equalBooleanTest(BooleanTest *a, BooleanTest *b)
 
672
{
 
673
        COMPARE_NODE_FIELD(arg);
 
674
        COMPARE_SCALAR_FIELD(booltesttype);
 
675
 
 
676
        return true;
 
677
}
 
678
 
 
679
static bool
 
680
_equalCoerceToDomain(CoerceToDomain *a, CoerceToDomain *b)
 
681
{
 
682
        COMPARE_NODE_FIELD(arg);
 
683
        COMPARE_SCALAR_FIELD(resulttype);
 
684
        COMPARE_SCALAR_FIELD(resulttypmod);
 
685
        COMPARE_SCALAR_FIELD(resultcollid);
 
686
 
 
687
        /*
 
688
         * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
 
689
         * that are equal() to both explicit and implicit coercions.
 
690
         */
 
691
        if (a->coercionformat != b->coercionformat &&
 
692
                a->coercionformat != COERCE_DONTCARE &&
 
693
                b->coercionformat != COERCE_DONTCARE)
 
694
                return false;
 
695
 
 
696
        COMPARE_LOCATION_FIELD(location);
 
697
 
 
698
        return true;
 
699
}
 
700
 
 
701
static bool
 
702
_equalCoerceToDomainValue(CoerceToDomainValue *a, CoerceToDomainValue *b)
 
703
{
 
704
        COMPARE_SCALAR_FIELD(typeId);
 
705
        COMPARE_SCALAR_FIELD(typeMod);
 
706
        COMPARE_SCALAR_FIELD(collation);
 
707
        COMPARE_LOCATION_FIELD(location);
 
708
 
 
709
        return true;
 
710
}
 
711
 
 
712
static bool
 
713
_equalSetToDefault(SetToDefault *a, SetToDefault *b)
 
714
{
 
715
        COMPARE_SCALAR_FIELD(typeId);
 
716
        COMPARE_SCALAR_FIELD(typeMod);
 
717
        COMPARE_SCALAR_FIELD(collation);
 
718
        COMPARE_LOCATION_FIELD(location);
 
719
 
 
720
        return true;
 
721
}
 
722
 
 
723
static bool
 
724
_equalCurrentOfExpr(CurrentOfExpr *a, CurrentOfExpr *b)
 
725
{
 
726
        COMPARE_SCALAR_FIELD(cvarno);
 
727
        COMPARE_STRING_FIELD(cursor_name);
 
728
        COMPARE_SCALAR_FIELD(cursor_param);
 
729
 
 
730
        return true;
 
731
}
 
732
 
 
733
static bool
 
734
_equalTargetEntry(TargetEntry *a, TargetEntry *b)
 
735
{
 
736
        COMPARE_NODE_FIELD(expr);
 
737
        COMPARE_SCALAR_FIELD(resno);
 
738
        COMPARE_STRING_FIELD(resname);
 
739
        COMPARE_SCALAR_FIELD(ressortgroupref);
 
740
        COMPARE_SCALAR_FIELD(resorigtbl);
 
741
        COMPARE_SCALAR_FIELD(resorigcol);
 
742
        COMPARE_SCALAR_FIELD(resjunk);
 
743
 
 
744
        return true;
 
745
}
 
746
 
 
747
static bool
 
748
_equalRangeTblRef(RangeTblRef *a, RangeTblRef *b)
 
749
{
 
750
        COMPARE_SCALAR_FIELD(rtindex);
 
751
 
 
752
        return true;
 
753
}
 
754
 
 
755
static bool
 
756
_equalJoinExpr(JoinExpr *a, JoinExpr *b)
 
757
{
 
758
        COMPARE_SCALAR_FIELD(jointype);
 
759
        COMPARE_SCALAR_FIELD(isNatural);
 
760
        COMPARE_NODE_FIELD(larg);
 
761
        COMPARE_NODE_FIELD(rarg);
 
762
        COMPARE_NODE_FIELD(usingClause);
 
763
        COMPARE_NODE_FIELD(quals);
 
764
        COMPARE_NODE_FIELD(alias);
 
765
        COMPARE_SCALAR_FIELD(rtindex);
 
766
 
 
767
        return true;
 
768
}
 
769
 
 
770
static bool
 
771
_equalFromExpr(FromExpr *a, FromExpr *b)
 
772
{
 
773
        COMPARE_NODE_FIELD(fromlist);
 
774
        COMPARE_NODE_FIELD(quals);
 
775
 
 
776
        return true;
 
777
}
 
778
 
 
779
 
 
780
/*
 
781
 * Stuff from relation.h
 
782
 */
 
783
 
 
784
static bool
 
785
_equalPathKey(PathKey *a, PathKey *b)
 
786
{
 
787
        /*
 
788
         * This is normally used on non-canonicalized PathKeys, so must chase up
 
789
         * to the topmost merged EquivalenceClass and see if those are the same
 
790
         * (by pointer equality).
 
791
         */
 
792
        EquivalenceClass *a_eclass;
 
793
        EquivalenceClass *b_eclass;
 
794
 
 
795
        a_eclass = a->pk_eclass;
 
796
        while (a_eclass->ec_merged)
 
797
                a_eclass = a_eclass->ec_merged;
 
798
        b_eclass = b->pk_eclass;
 
799
        while (b_eclass->ec_merged)
 
800
                b_eclass = b_eclass->ec_merged;
 
801
        if (a_eclass != b_eclass)
 
802
                return false;
 
803
        COMPARE_SCALAR_FIELD(pk_opfamily);
 
804
        COMPARE_SCALAR_FIELD(pk_strategy);
 
805
        COMPARE_SCALAR_FIELD(pk_nulls_first);
 
806
 
 
807
        return true;
 
808
}
 
809
 
 
810
static bool
 
811
_equalRestrictInfo(RestrictInfo *a, RestrictInfo *b)
 
812
{
 
813
        COMPARE_NODE_FIELD(clause);
 
814
        COMPARE_SCALAR_FIELD(is_pushed_down);
 
815
        COMPARE_SCALAR_FIELD(outerjoin_delayed);
 
816
        COMPARE_BITMAPSET_FIELD(required_relids);
 
817
        COMPARE_BITMAPSET_FIELD(nullable_relids);
 
818
 
 
819
        /*
 
820
         * We ignore all the remaining fields, since they may not be set yet, and
 
821
         * should be derivable from the clause anyway.
 
822
         */
 
823
 
 
824
        return true;
 
825
}
 
826
 
 
827
static bool
 
828
_equalPlaceHolderVar(PlaceHolderVar *a, PlaceHolderVar *b)
 
829
{
 
830
        /*
 
831
         * We intentionally do not compare phexpr.      Two PlaceHolderVars with the
 
832
         * same ID and levelsup should be considered equal even if the contained
 
833
         * expressions have managed to mutate to different states.      One way in
 
834
         * which that can happen is that initplan sublinks would get replaced by
 
835
         * differently-numbered Params when sublink folding is done.  (The end
 
836
         * result of such a situation would be some unreferenced initplans, which
 
837
         * is annoying but not really a problem.)
 
838
         *
 
839
         * COMPARE_NODE_FIELD(phexpr);
 
840
         */
 
841
        COMPARE_BITMAPSET_FIELD(phrels);
 
842
        COMPARE_SCALAR_FIELD(phid);
 
843
        COMPARE_SCALAR_FIELD(phlevelsup);
 
844
 
 
845
        return true;
 
846
}
 
847
 
 
848
static bool
 
849
_equalSpecialJoinInfo(SpecialJoinInfo *a, SpecialJoinInfo *b)
 
850
{
 
851
        COMPARE_BITMAPSET_FIELD(min_lefthand);
 
852
        COMPARE_BITMAPSET_FIELD(min_righthand);
 
853
        COMPARE_BITMAPSET_FIELD(syn_lefthand);
 
854
        COMPARE_BITMAPSET_FIELD(syn_righthand);
 
855
        COMPARE_SCALAR_FIELD(jointype);
 
856
        COMPARE_SCALAR_FIELD(lhs_strict);
 
857
        COMPARE_SCALAR_FIELD(delay_upper_joins);
 
858
        COMPARE_NODE_FIELD(join_quals);
 
859
 
 
860
        return true;
 
861
}
 
862
 
 
863
static bool
 
864
_equalAppendRelInfo(AppendRelInfo *a, AppendRelInfo *b)
 
865
{
 
866
        COMPARE_SCALAR_FIELD(parent_relid);
 
867
        COMPARE_SCALAR_FIELD(child_relid);
 
868
        COMPARE_SCALAR_FIELD(parent_reltype);
 
869
        COMPARE_SCALAR_FIELD(child_reltype);
 
870
        COMPARE_NODE_FIELD(translated_vars);
 
871
        COMPARE_SCALAR_FIELD(parent_reloid);
 
872
 
 
873
        return true;
 
874
}
 
875
 
 
876
static bool
 
877
_equalPlaceHolderInfo(PlaceHolderInfo *a, PlaceHolderInfo *b)
 
878
{
 
879
        COMPARE_SCALAR_FIELD(phid);
 
880
        COMPARE_NODE_FIELD(ph_var);
 
881
        COMPARE_BITMAPSET_FIELD(ph_eval_at);
 
882
        COMPARE_BITMAPSET_FIELD(ph_needed);
 
883
        COMPARE_BITMAPSET_FIELD(ph_may_need);
 
884
        COMPARE_SCALAR_FIELD(ph_width);
 
885
 
 
886
        return true;
 
887
}
 
888
 
 
889
 
 
890
/*
 
891
 * Stuff from parsenodes.h
 
892
 */
 
893
 
 
894
static bool
 
895
_equalQuery(Query *a, Query *b)
 
896
{
 
897
        COMPARE_SCALAR_FIELD(commandType);
 
898
        COMPARE_SCALAR_FIELD(querySource);
 
899
        COMPARE_SCALAR_FIELD(canSetTag);
 
900
        COMPARE_NODE_FIELD(utilityStmt);
 
901
        COMPARE_SCALAR_FIELD(resultRelation);
 
902
        COMPARE_NODE_FIELD(intoClause);
 
903
        COMPARE_SCALAR_FIELD(hasAggs);
 
904
        COMPARE_SCALAR_FIELD(hasWindowFuncs);
 
905
        COMPARE_SCALAR_FIELD(hasSubLinks);
 
906
        COMPARE_SCALAR_FIELD(hasDistinctOn);
 
907
        COMPARE_SCALAR_FIELD(hasRecursive);
 
908
        COMPARE_SCALAR_FIELD(hasModifyingCTE);
 
909
        COMPARE_SCALAR_FIELD(hasForUpdate);
 
910
        COMPARE_NODE_FIELD(cteList);
 
911
        COMPARE_NODE_FIELD(rtable);
 
912
        COMPARE_NODE_FIELD(jointree);
 
913
        COMPARE_NODE_FIELD(targetList);
 
914
        COMPARE_NODE_FIELD(returningList);
 
915
        COMPARE_NODE_FIELD(groupClause);
 
916
        COMPARE_NODE_FIELD(havingQual);
 
917
        COMPARE_NODE_FIELD(windowClause);
 
918
        COMPARE_NODE_FIELD(distinctClause);
 
919
        COMPARE_NODE_FIELD(sortClause);
 
920
        COMPARE_NODE_FIELD(limitOffset);
 
921
        COMPARE_NODE_FIELD(limitCount);
 
922
        COMPARE_NODE_FIELD(rowMarks);
 
923
        COMPARE_NODE_FIELD(setOperations);
 
924
        COMPARE_NODE_FIELD(constraintDeps);
 
925
 
 
926
        return true;
 
927
}
 
928
 
 
929
static bool
 
930
_equalInsertStmt(InsertStmt *a, InsertStmt *b)
 
931
{
 
932
        COMPARE_NODE_FIELD(relation);
 
933
        COMPARE_NODE_FIELD(cols);
 
934
        COMPARE_NODE_FIELD(selectStmt);
 
935
        COMPARE_NODE_FIELD(returningList);
 
936
        COMPARE_NODE_FIELD(withClause);
 
937
 
 
938
        return true;
 
939
}
 
940
 
 
941
static bool
 
942
_equalDeleteStmt(DeleteStmt *a, DeleteStmt *b)
 
943
{
 
944
        COMPARE_NODE_FIELD(relation);
 
945
        COMPARE_NODE_FIELD(usingClause);
 
946
        COMPARE_NODE_FIELD(whereClause);
 
947
        COMPARE_NODE_FIELD(returningList);
 
948
        COMPARE_NODE_FIELD(withClause);
 
949
 
 
950
        return true;
 
951
}
 
952
 
 
953
static bool
 
954
_equalUpdateStmt(UpdateStmt *a, UpdateStmt *b)
 
955
{
 
956
        COMPARE_NODE_FIELD(relation);
 
957
        COMPARE_NODE_FIELD(targetList);
 
958
        COMPARE_NODE_FIELD(whereClause);
 
959
        COMPARE_NODE_FIELD(fromClause);
 
960
        COMPARE_NODE_FIELD(returningList);
 
961
        COMPARE_NODE_FIELD(withClause);
 
962
 
 
963
        return true;
 
964
}
 
965
 
 
966
static bool
 
967
_equalSelectStmt(SelectStmt *a, SelectStmt *b)
 
968
{
 
969
        COMPARE_NODE_FIELD(distinctClause);
 
970
        COMPARE_NODE_FIELD(intoClause);
 
971
        COMPARE_NODE_FIELD(targetList);
 
972
        COMPARE_NODE_FIELD(fromClause);
 
973
        COMPARE_NODE_FIELD(whereClause);
 
974
        COMPARE_NODE_FIELD(groupClause);
 
975
        COMPARE_NODE_FIELD(havingClause);
 
976
        COMPARE_NODE_FIELD(windowClause);
 
977
        COMPARE_NODE_FIELD(withClause);
 
978
        COMPARE_NODE_FIELD(valuesLists);
 
979
        COMPARE_NODE_FIELD(sortClause);
 
980
        COMPARE_NODE_FIELD(limitOffset);
 
981
        COMPARE_NODE_FIELD(limitCount);
 
982
        COMPARE_NODE_FIELD(lockingClause);
 
983
        COMPARE_SCALAR_FIELD(op);
 
984
        COMPARE_SCALAR_FIELD(all);
 
985
        COMPARE_NODE_FIELD(larg);
 
986
        COMPARE_NODE_FIELD(rarg);
 
987
 
 
988
        return true;
 
989
}
 
990
 
 
991
static bool
 
992
_equalSetOperationStmt(SetOperationStmt *a, SetOperationStmt *b)
 
993
{
 
994
        COMPARE_SCALAR_FIELD(op);
 
995
        COMPARE_SCALAR_FIELD(all);
 
996
        COMPARE_NODE_FIELD(larg);
 
997
        COMPARE_NODE_FIELD(rarg);
 
998
        COMPARE_NODE_FIELD(colTypes);
 
999
        COMPARE_NODE_FIELD(colTypmods);
 
1000
        COMPARE_NODE_FIELD(colCollations);
 
1001
        COMPARE_NODE_FIELD(groupClauses);
 
1002
 
 
1003
        return true;
 
1004
}
 
1005
 
 
1006
static bool
 
1007
_equalAlterTableStmt(AlterTableStmt *a, AlterTableStmt *b)
 
1008
{
 
1009
        COMPARE_NODE_FIELD(relation);
 
1010
        COMPARE_NODE_FIELD(cmds);
 
1011
        COMPARE_SCALAR_FIELD(relkind);
 
1012
 
 
1013
        return true;
 
1014
}
 
1015
 
 
1016
static bool
 
1017
_equalAlterTableCmd(AlterTableCmd *a, AlterTableCmd *b)
 
1018
{
 
1019
        COMPARE_SCALAR_FIELD(subtype);
 
1020
        COMPARE_STRING_FIELD(name);
 
1021
        COMPARE_NODE_FIELD(def);
 
1022
        COMPARE_SCALAR_FIELD(behavior);
 
1023
        COMPARE_SCALAR_FIELD(missing_ok);
 
1024
 
 
1025
        return true;
 
1026
}
 
1027
 
 
1028
static bool
 
1029
_equalAlterDomainStmt(AlterDomainStmt *a, AlterDomainStmt *b)
 
1030
{
 
1031
        COMPARE_SCALAR_FIELD(subtype);
 
1032
        COMPARE_NODE_FIELD(typeName);
 
1033
        COMPARE_STRING_FIELD(name);
 
1034
        COMPARE_NODE_FIELD(def);
 
1035
        COMPARE_SCALAR_FIELD(behavior);
 
1036
 
 
1037
        return true;
 
1038
}
 
1039
 
 
1040
static bool
 
1041
_equalGrantStmt(GrantStmt *a, GrantStmt *b)
 
1042
{
 
1043
        COMPARE_SCALAR_FIELD(is_grant);
 
1044
        COMPARE_SCALAR_FIELD(targtype);
 
1045
        COMPARE_SCALAR_FIELD(objtype);
 
1046
        COMPARE_NODE_FIELD(objects);
 
1047
        COMPARE_NODE_FIELD(privileges);
 
1048
        COMPARE_NODE_FIELD(grantees);
 
1049
        COMPARE_SCALAR_FIELD(grant_option);
 
1050
        COMPARE_SCALAR_FIELD(behavior);
 
1051
 
 
1052
        return true;
 
1053
}
 
1054
 
 
1055
static bool
 
1056
_equalPrivGrantee(PrivGrantee *a, PrivGrantee *b)
 
1057
{
 
1058
        COMPARE_STRING_FIELD(rolname);
 
1059
 
 
1060
        return true;
 
1061
}
 
1062
 
 
1063
static bool
 
1064
_equalFuncWithArgs(FuncWithArgs *a, FuncWithArgs *b)
 
1065
{
 
1066
        COMPARE_NODE_FIELD(funcname);
 
1067
        COMPARE_NODE_FIELD(funcargs);
 
1068
 
 
1069
        return true;
 
1070
}
 
1071
 
 
1072
static bool
 
1073
_equalAccessPriv(AccessPriv *a, AccessPriv *b)
 
1074
{
 
1075
        COMPARE_STRING_FIELD(priv_name);
 
1076
        COMPARE_NODE_FIELD(cols);
 
1077
 
 
1078
        return true;
 
1079
}
 
1080
 
 
1081
static bool
 
1082
_equalGrantRoleStmt(GrantRoleStmt *a, GrantRoleStmt *b)
 
1083
{
 
1084
        COMPARE_NODE_FIELD(granted_roles);
 
1085
        COMPARE_NODE_FIELD(grantee_roles);
 
1086
        COMPARE_SCALAR_FIELD(is_grant);
 
1087
        COMPARE_SCALAR_FIELD(admin_opt);
 
1088
        COMPARE_STRING_FIELD(grantor);
 
1089
        COMPARE_SCALAR_FIELD(behavior);
 
1090
 
 
1091
        return true;
 
1092
}
 
1093
 
 
1094
static bool
 
1095
_equalAlterDefaultPrivilegesStmt(AlterDefaultPrivilegesStmt *a, AlterDefaultPrivilegesStmt *b)
 
1096
{
 
1097
        COMPARE_NODE_FIELD(options);
 
1098
        COMPARE_NODE_FIELD(action);
 
1099
 
 
1100
        return true;
 
1101
}
 
1102
 
 
1103
static bool
 
1104
_equalDeclareCursorStmt(DeclareCursorStmt *a, DeclareCursorStmt *b)
 
1105
{
 
1106
        COMPARE_STRING_FIELD(portalname);
 
1107
        COMPARE_SCALAR_FIELD(options);
 
1108
        COMPARE_NODE_FIELD(query);
 
1109
 
 
1110
        return true;
 
1111
}
 
1112
 
 
1113
static bool
 
1114
_equalClosePortalStmt(ClosePortalStmt *a, ClosePortalStmt *b)
 
1115
{
 
1116
        COMPARE_STRING_FIELD(portalname);
 
1117
 
 
1118
        return true;
 
1119
}
 
1120
 
 
1121
static bool
 
1122
_equalClusterStmt(ClusterStmt *a, ClusterStmt *b)
 
1123
{
 
1124
        COMPARE_NODE_FIELD(relation);
 
1125
        COMPARE_STRING_FIELD(indexname);
 
1126
        COMPARE_SCALAR_FIELD(verbose);
 
1127
 
 
1128
        return true;
 
1129
}
 
1130
 
 
1131
static bool
 
1132
_equalCopyStmt(CopyStmt *a, CopyStmt *b)
 
1133
{
 
1134
        COMPARE_NODE_FIELD(relation);
 
1135
        COMPARE_NODE_FIELD(query);
 
1136
        COMPARE_NODE_FIELD(attlist);
 
1137
        COMPARE_SCALAR_FIELD(is_from);
 
1138
        COMPARE_STRING_FIELD(filename);
 
1139
        COMPARE_NODE_FIELD(options);
 
1140
 
 
1141
        return true;
 
1142
}
 
1143
 
 
1144
static bool
 
1145
_equalCreateStmt(CreateStmt *a, CreateStmt *b)
 
1146
{
 
1147
        COMPARE_NODE_FIELD(relation);
 
1148
        COMPARE_NODE_FIELD(tableElts);
 
1149
        COMPARE_NODE_FIELD(inhRelations);
 
1150
        COMPARE_NODE_FIELD(ofTypename);
 
1151
        COMPARE_NODE_FIELD(constraints);
 
1152
        COMPARE_NODE_FIELD(options);
 
1153
        COMPARE_SCALAR_FIELD(oncommit);
 
1154
        COMPARE_STRING_FIELD(tablespacename);
 
1155
        COMPARE_SCALAR_FIELD(if_not_exists);
 
1156
 
 
1157
        return true;
 
1158
}
 
1159
 
 
1160
static bool
 
1161
_equalInhRelation(InhRelation *a, InhRelation *b)
 
1162
{
 
1163
        COMPARE_NODE_FIELD(relation);
 
1164
        COMPARE_SCALAR_FIELD(options);
 
1165
 
 
1166
        return true;
 
1167
}
 
1168
 
 
1169
static bool
 
1170
_equalDefineStmt(DefineStmt *a, DefineStmt *b)
 
1171
{
 
1172
        COMPARE_SCALAR_FIELD(kind);
 
1173
        COMPARE_SCALAR_FIELD(oldstyle);
 
1174
        COMPARE_NODE_FIELD(defnames);
 
1175
        COMPARE_NODE_FIELD(args);
 
1176
        COMPARE_NODE_FIELD(definition);
 
1177
 
 
1178
        return true;
 
1179
}
 
1180
 
 
1181
static bool
 
1182
_equalDropStmt(DropStmt *a, DropStmt *b)
 
1183
{
 
1184
        COMPARE_NODE_FIELD(objects);
 
1185
        COMPARE_SCALAR_FIELD(removeType);
 
1186
        COMPARE_SCALAR_FIELD(behavior);
 
1187
        COMPARE_SCALAR_FIELD(missing_ok);
 
1188
 
 
1189
        return true;
 
1190
}
 
1191
 
 
1192
static bool
 
1193
_equalTruncateStmt(TruncateStmt *a, TruncateStmt *b)
 
1194
{
 
1195
        COMPARE_NODE_FIELD(relations);
 
1196
        COMPARE_SCALAR_FIELD(restart_seqs);
 
1197
        COMPARE_SCALAR_FIELD(behavior);
 
1198
 
 
1199
        return true;
 
1200
}
 
1201
 
 
1202
static bool
 
1203
_equalCommentStmt(CommentStmt *a, CommentStmt *b)
 
1204
{
 
1205
        COMPARE_SCALAR_FIELD(objtype);
 
1206
        COMPARE_NODE_FIELD(objname);
 
1207
        COMPARE_NODE_FIELD(objargs);
 
1208
        COMPARE_STRING_FIELD(comment);
 
1209
 
 
1210
        return true;
 
1211
}
 
1212
 
 
1213
static bool
 
1214
_equalSecLabelStmt(SecLabelStmt *a, SecLabelStmt *b)
 
1215
{
 
1216
        COMPARE_SCALAR_FIELD(objtype);
 
1217
        COMPARE_NODE_FIELD(objname);
 
1218
        COMPARE_NODE_FIELD(objargs);
 
1219
        COMPARE_STRING_FIELD(provider);
 
1220
        COMPARE_STRING_FIELD(label);
 
1221
 
 
1222
        return true;
 
1223
}
 
1224
 
 
1225
static bool
 
1226
_equalFetchStmt(FetchStmt *a, FetchStmt *b)
 
1227
{
 
1228
        COMPARE_SCALAR_FIELD(direction);
 
1229
        COMPARE_SCALAR_FIELD(howMany);
 
1230
        COMPARE_STRING_FIELD(portalname);
 
1231
        COMPARE_SCALAR_FIELD(ismove);
 
1232
 
 
1233
        return true;
 
1234
}
 
1235
 
 
1236
static bool
 
1237
_equalIndexStmt(IndexStmt *a, IndexStmt *b)
 
1238
{
 
1239
        COMPARE_STRING_FIELD(idxname);
 
1240
        COMPARE_NODE_FIELD(relation);
 
1241
        COMPARE_STRING_FIELD(accessMethod);
 
1242
        COMPARE_STRING_FIELD(tableSpace);
 
1243
        COMPARE_NODE_FIELD(indexParams);
 
1244
        COMPARE_NODE_FIELD(options);
 
1245
        COMPARE_NODE_FIELD(whereClause);
 
1246
        COMPARE_NODE_FIELD(excludeOpNames);
 
1247
        COMPARE_SCALAR_FIELD(indexOid);
 
1248
        COMPARE_SCALAR_FIELD(unique);
 
1249
        COMPARE_SCALAR_FIELD(primary);
 
1250
        COMPARE_SCALAR_FIELD(isconstraint);
 
1251
        COMPARE_SCALAR_FIELD(deferrable);
 
1252
        COMPARE_SCALAR_FIELD(initdeferred);
 
1253
        COMPARE_SCALAR_FIELD(concurrent);
 
1254
 
 
1255
        return true;
 
1256
}
 
1257
 
 
1258
static bool
 
1259
_equalCreateFunctionStmt(CreateFunctionStmt *a, CreateFunctionStmt *b)
 
1260
{
 
1261
        COMPARE_SCALAR_FIELD(replace);
 
1262
        COMPARE_NODE_FIELD(funcname);
 
1263
        COMPARE_NODE_FIELD(parameters);
 
1264
        COMPARE_NODE_FIELD(returnType);
 
1265
        COMPARE_NODE_FIELD(options);
 
1266
        COMPARE_NODE_FIELD(withClause);
 
1267
 
 
1268
        return true;
 
1269
}
 
1270
 
 
1271
static bool
 
1272
_equalFunctionParameter(FunctionParameter *a, FunctionParameter *b)
 
1273
{
 
1274
        COMPARE_STRING_FIELD(name);
 
1275
        COMPARE_NODE_FIELD(argType);
 
1276
        COMPARE_SCALAR_FIELD(mode);
 
1277
        COMPARE_NODE_FIELD(defexpr);
 
1278
 
 
1279
        return true;
 
1280
}
 
1281
 
 
1282
static bool
 
1283
_equalAlterFunctionStmt(AlterFunctionStmt *a, AlterFunctionStmt *b)
 
1284
{
 
1285
        COMPARE_NODE_FIELD(func);
 
1286
        COMPARE_NODE_FIELD(actions);
 
1287
 
 
1288
        return true;
 
1289
}
 
1290
 
 
1291
static bool
 
1292
_equalRemoveFuncStmt(RemoveFuncStmt *a, RemoveFuncStmt *b)
 
1293
{
 
1294
        COMPARE_SCALAR_FIELD(kind);
 
1295
        COMPARE_NODE_FIELD(name);
 
1296
        COMPARE_NODE_FIELD(args);
 
1297
        COMPARE_SCALAR_FIELD(behavior);
 
1298
        COMPARE_SCALAR_FIELD(missing_ok);
 
1299
 
 
1300
        return true;
 
1301
}
 
1302
 
 
1303
static bool
 
1304
_equalDoStmt(DoStmt *a, DoStmt *b)
 
1305
{
 
1306
        COMPARE_NODE_FIELD(args);
 
1307
 
 
1308
        return true;
 
1309
}
 
1310
 
 
1311
static bool
 
1312
_equalRemoveOpClassStmt(RemoveOpClassStmt *a, RemoveOpClassStmt *b)
 
1313
{
 
1314
        COMPARE_NODE_FIELD(opclassname);
 
1315
        COMPARE_STRING_FIELD(amname);
 
1316
        COMPARE_SCALAR_FIELD(behavior);
 
1317
        COMPARE_SCALAR_FIELD(missing_ok);
 
1318
 
 
1319
        return true;
 
1320
}
 
1321
 
 
1322
static bool
 
1323
_equalRemoveOpFamilyStmt(RemoveOpFamilyStmt *a, RemoveOpFamilyStmt *b)
 
1324
{
 
1325
        COMPARE_NODE_FIELD(opfamilyname);
 
1326
        COMPARE_STRING_FIELD(amname);
 
1327
        COMPARE_SCALAR_FIELD(behavior);
 
1328
        COMPARE_SCALAR_FIELD(missing_ok);
 
1329
 
 
1330
        return true;
 
1331
}
 
1332
 
 
1333
static bool
 
1334
_equalRenameStmt(RenameStmt *a, RenameStmt *b)
 
1335
{
 
1336
        COMPARE_SCALAR_FIELD(renameType);
 
1337
        COMPARE_NODE_FIELD(relation);
 
1338
        COMPARE_NODE_FIELD(object);
 
1339
        COMPARE_NODE_FIELD(objarg);
 
1340
        COMPARE_STRING_FIELD(subname);
 
1341
        COMPARE_STRING_FIELD(newname);
 
1342
        COMPARE_SCALAR_FIELD(behavior);
 
1343
 
 
1344
        return true;
 
1345
}
 
1346
 
 
1347
static bool
 
1348
_equalAlterObjectSchemaStmt(AlterObjectSchemaStmt *a, AlterObjectSchemaStmt *b)
 
1349
{
 
1350
        COMPARE_SCALAR_FIELD(objectType);
 
1351
        COMPARE_NODE_FIELD(relation);
 
1352
        COMPARE_NODE_FIELD(object);
 
1353
        COMPARE_NODE_FIELD(objarg);
 
1354
        COMPARE_STRING_FIELD(addname);
 
1355
        COMPARE_STRING_FIELD(newschema);
 
1356
 
 
1357
        return true;
 
1358
}
 
1359
 
 
1360
static bool
 
1361
_equalAlterOwnerStmt(AlterOwnerStmt *a, AlterOwnerStmt *b)
 
1362
{
 
1363
        COMPARE_SCALAR_FIELD(objectType);
 
1364
        COMPARE_NODE_FIELD(relation);
 
1365
        COMPARE_NODE_FIELD(object);
 
1366
        COMPARE_NODE_FIELD(objarg);
 
1367
        COMPARE_STRING_FIELD(addname);
 
1368
        COMPARE_STRING_FIELD(newowner);
 
1369
 
 
1370
        return true;
 
1371
}
 
1372
 
 
1373
static bool
 
1374
_equalRuleStmt(RuleStmt *a, RuleStmt *b)
 
1375
{
 
1376
        COMPARE_NODE_FIELD(relation);
 
1377
        COMPARE_STRING_FIELD(rulename);
 
1378
        COMPARE_NODE_FIELD(whereClause);
 
1379
        COMPARE_SCALAR_FIELD(event);
 
1380
        COMPARE_SCALAR_FIELD(instead);
 
1381
        COMPARE_NODE_FIELD(actions);
 
1382
        COMPARE_SCALAR_FIELD(replace);
 
1383
 
 
1384
        return true;
 
1385
}
 
1386
 
 
1387
static bool
 
1388
_equalNotifyStmt(NotifyStmt *a, NotifyStmt *b)
 
1389
{
 
1390
        COMPARE_STRING_FIELD(conditionname);
 
1391
        COMPARE_STRING_FIELD(payload);
 
1392
 
 
1393
        return true;
 
1394
}
 
1395
 
 
1396
static bool
 
1397
_equalListenStmt(ListenStmt *a, ListenStmt *b)
 
1398
{
 
1399
        COMPARE_STRING_FIELD(conditionname);
 
1400
 
 
1401
        return true;
 
1402
}
 
1403
 
 
1404
static bool
 
1405
_equalUnlistenStmt(UnlistenStmt *a, UnlistenStmt *b)
 
1406
{
 
1407
        COMPARE_STRING_FIELD(conditionname);
 
1408
 
 
1409
        return true;
 
1410
}
 
1411
 
 
1412
static bool
 
1413
_equalTransactionStmt(TransactionStmt *a, TransactionStmt *b)
 
1414
{
 
1415
        COMPARE_SCALAR_FIELD(kind);
 
1416
        COMPARE_NODE_FIELD(options);
 
1417
        COMPARE_STRING_FIELD(gid);
 
1418
 
 
1419
        return true;
 
1420
}
 
1421
 
 
1422
static bool
 
1423
_equalCompositeTypeStmt(CompositeTypeStmt *a, CompositeTypeStmt *b)
 
1424
{
 
1425
        COMPARE_NODE_FIELD(typevar);
 
1426
        COMPARE_NODE_FIELD(coldeflist);
 
1427
 
 
1428
        return true;
 
1429
}
 
1430
 
 
1431
static bool
 
1432
_equalCreateEnumStmt(CreateEnumStmt *a, CreateEnumStmt *b)
 
1433
{
 
1434
        COMPARE_NODE_FIELD(typeName);
 
1435
        COMPARE_NODE_FIELD(vals);
 
1436
 
 
1437
        return true;
 
1438
}
 
1439
 
 
1440
static bool
 
1441
_equalAlterEnumStmt(AlterEnumStmt *a, AlterEnumStmt *b)
 
1442
{
 
1443
        COMPARE_NODE_FIELD(typeName);
 
1444
        COMPARE_STRING_FIELD(newVal);
 
1445
        COMPARE_STRING_FIELD(newValNeighbor);
 
1446
        COMPARE_SCALAR_FIELD(newValIsAfter);
 
1447
 
 
1448
        return true;
 
1449
}
 
1450
 
 
1451
static bool
 
1452
_equalViewStmt(ViewStmt *a, ViewStmt *b)
 
1453
{
 
1454
        COMPARE_NODE_FIELD(view);
 
1455
        COMPARE_NODE_FIELD(aliases);
 
1456
        COMPARE_NODE_FIELD(query);
 
1457
        COMPARE_SCALAR_FIELD(replace);
 
1458
 
 
1459
        return true;
 
1460
}
 
1461
 
 
1462
static bool
 
1463
_equalLoadStmt(LoadStmt *a, LoadStmt *b)
 
1464
{
 
1465
        COMPARE_STRING_FIELD(filename);
 
1466
 
 
1467
        return true;
 
1468
}
 
1469
 
 
1470
static bool
 
1471
_equalCreateDomainStmt(CreateDomainStmt *a, CreateDomainStmt *b)
 
1472
{
 
1473
        COMPARE_NODE_FIELD(domainname);
 
1474
        COMPARE_NODE_FIELD(typeName);
 
1475
        COMPARE_NODE_FIELD(collClause);
 
1476
        COMPARE_NODE_FIELD(constraints);
 
1477
 
 
1478
        return true;
 
1479
}
 
1480
 
 
1481
static bool
 
1482
_equalCreateOpClassStmt(CreateOpClassStmt *a, CreateOpClassStmt *b)
 
1483
{
 
1484
        COMPARE_NODE_FIELD(opclassname);
 
1485
        COMPARE_NODE_FIELD(opfamilyname);
 
1486
        COMPARE_STRING_FIELD(amname);
 
1487
        COMPARE_NODE_FIELD(datatype);
 
1488
        COMPARE_NODE_FIELD(items);
 
1489
        COMPARE_SCALAR_FIELD(isDefault);
 
1490
 
 
1491
        return true;
 
1492
}
 
1493
 
 
1494
static bool
 
1495
_equalCreateOpClassItem(CreateOpClassItem *a, CreateOpClassItem *b)
 
1496
{
 
1497
        COMPARE_SCALAR_FIELD(itemtype);
 
1498
        COMPARE_NODE_FIELD(name);
 
1499
        COMPARE_NODE_FIELD(args);
 
1500
        COMPARE_SCALAR_FIELD(number);
 
1501
        COMPARE_NODE_FIELD(order_family);
 
1502
        COMPARE_NODE_FIELD(class_args);
 
1503
        COMPARE_NODE_FIELD(storedtype);
 
1504
 
 
1505
        return true;
 
1506
}
 
1507
 
 
1508
static bool
 
1509
_equalCreateOpFamilyStmt(CreateOpFamilyStmt *a, CreateOpFamilyStmt *b)
 
1510
{
 
1511
        COMPARE_NODE_FIELD(opfamilyname);
 
1512
        COMPARE_STRING_FIELD(amname);
 
1513
 
 
1514
        return true;
 
1515
}
 
1516
 
 
1517
static bool
 
1518
_equalAlterOpFamilyStmt(AlterOpFamilyStmt *a, AlterOpFamilyStmt *b)
 
1519
{
 
1520
        COMPARE_NODE_FIELD(opfamilyname);
 
1521
        COMPARE_STRING_FIELD(amname);
 
1522
        COMPARE_SCALAR_FIELD(isDrop);
 
1523
        COMPARE_NODE_FIELD(items);
 
1524
 
 
1525
        return true;
 
1526
}
 
1527
 
 
1528
static bool
 
1529
_equalCreatedbStmt(CreatedbStmt *a, CreatedbStmt *b)
 
1530
{
 
1531
        COMPARE_STRING_FIELD(dbname);
 
1532
        COMPARE_NODE_FIELD(options);
 
1533
 
 
1534
        return true;
 
1535
}
 
1536
 
 
1537
static bool
 
1538
_equalAlterDatabaseStmt(AlterDatabaseStmt *a, AlterDatabaseStmt *b)
 
1539
{
 
1540
        COMPARE_STRING_FIELD(dbname);
 
1541
        COMPARE_NODE_FIELD(options);
 
1542
 
 
1543
        return true;
 
1544
}
 
1545
 
 
1546
static bool
 
1547
_equalAlterDatabaseSetStmt(AlterDatabaseSetStmt *a, AlterDatabaseSetStmt *b)
 
1548
{
 
1549
        COMPARE_STRING_FIELD(dbname);
 
1550
        COMPARE_NODE_FIELD(setstmt);
 
1551
 
 
1552
        return true;
 
1553
}
 
1554
 
 
1555
static bool
 
1556
_equalDropdbStmt(DropdbStmt *a, DropdbStmt *b)
 
1557
{
 
1558
        COMPARE_STRING_FIELD(dbname);
 
1559
        COMPARE_SCALAR_FIELD(missing_ok);
 
1560
 
 
1561
        return true;
 
1562
}
 
1563
 
 
1564
static bool
 
1565
_equalVacuumStmt(VacuumStmt *a, VacuumStmt *b)
 
1566
{
 
1567
        COMPARE_SCALAR_FIELD(options);
 
1568
        COMPARE_SCALAR_FIELD(freeze_min_age);
 
1569
        COMPARE_SCALAR_FIELD(freeze_table_age);
 
1570
        COMPARE_NODE_FIELD(relation);
 
1571
        COMPARE_NODE_FIELD(va_cols);
 
1572
 
 
1573
        return true;
 
1574
}
 
1575
 
 
1576
static bool
 
1577
_equalExplainStmt(ExplainStmt *a, ExplainStmt *b)
 
1578
{
 
1579
        COMPARE_NODE_FIELD(query);
 
1580
        COMPARE_NODE_FIELD(options);
 
1581
 
 
1582
        return true;
 
1583
}
 
1584
 
 
1585
static bool
 
1586
_equalCreateSeqStmt(CreateSeqStmt *a, CreateSeqStmt *b)
 
1587
{
 
1588
        COMPARE_NODE_FIELD(sequence);
 
1589
        COMPARE_NODE_FIELD(options);
 
1590
        COMPARE_SCALAR_FIELD(ownerId);
 
1591
 
 
1592
        return true;
 
1593
}
 
1594
 
 
1595
static bool
 
1596
_equalAlterSeqStmt(AlterSeqStmt *a, AlterSeqStmt *b)
 
1597
{
 
1598
        COMPARE_NODE_FIELD(sequence);
 
1599
        COMPARE_NODE_FIELD(options);
 
1600
 
 
1601
        return true;
 
1602
}
 
1603
 
 
1604
static bool
 
1605
_equalVariableSetStmt(VariableSetStmt *a, VariableSetStmt *b)
 
1606
{
 
1607
        COMPARE_SCALAR_FIELD(kind);
 
1608
        COMPARE_STRING_FIELD(name);
 
1609
        COMPARE_NODE_FIELD(args);
 
1610
        COMPARE_SCALAR_FIELD(is_local);
 
1611
 
 
1612
        return true;
 
1613
}
 
1614
 
 
1615
static bool
 
1616
_equalVariableShowStmt(VariableShowStmt *a, VariableShowStmt *b)
 
1617
{
 
1618
        COMPARE_STRING_FIELD(name);
 
1619
 
 
1620
        return true;
 
1621
}
 
1622
 
 
1623
static bool
 
1624
_equalDiscardStmt(DiscardStmt *a, DiscardStmt *b)
 
1625
{
 
1626
        COMPARE_SCALAR_FIELD(target);
 
1627
 
 
1628
        return true;
 
1629
}
 
1630
 
 
1631
static bool
 
1632
_equalCreateTableSpaceStmt(CreateTableSpaceStmt *a, CreateTableSpaceStmt *b)
 
1633
{
 
1634
        COMPARE_STRING_FIELD(tablespacename);
 
1635
        COMPARE_STRING_FIELD(owner);
 
1636
        COMPARE_STRING_FIELD(location);
 
1637
 
 
1638
        return true;
 
1639
}
 
1640
 
 
1641
static bool
 
1642
_equalDropTableSpaceStmt(DropTableSpaceStmt *a, DropTableSpaceStmt *b)
 
1643
{
 
1644
        COMPARE_STRING_FIELD(tablespacename);
 
1645
        COMPARE_SCALAR_FIELD(missing_ok);
 
1646
 
 
1647
        return true;
 
1648
}
 
1649
 
 
1650
static bool
 
1651
_equalAlterTableSpaceOptionsStmt(AlterTableSpaceOptionsStmt *a,
 
1652
                                                                 AlterTableSpaceOptionsStmt *b)
 
1653
{
 
1654
        COMPARE_STRING_FIELD(tablespacename);
 
1655
        COMPARE_NODE_FIELD(options);
 
1656
        COMPARE_SCALAR_FIELD(isReset);
 
1657
 
 
1658
        return true;
 
1659
}
 
1660
 
 
1661
static bool
 
1662
_equalCreateExtensionStmt(CreateExtensionStmt *a, CreateExtensionStmt *b)
 
1663
{
 
1664
        COMPARE_STRING_FIELD(extname);
 
1665
        COMPARE_SCALAR_FIELD(if_not_exists);
 
1666
        COMPARE_NODE_FIELD(options);
 
1667
 
 
1668
        return true;
 
1669
}
 
1670
 
 
1671
static bool
 
1672
_equalAlterExtensionStmt(AlterExtensionStmt *a, AlterExtensionStmt *b)
 
1673
{
 
1674
        COMPARE_STRING_FIELD(extname);
 
1675
        COMPARE_NODE_FIELD(options);
 
1676
 
 
1677
        return true;
 
1678
}
 
1679
 
 
1680
static bool
 
1681
_equalAlterExtensionContentsStmt(AlterExtensionContentsStmt *a, AlterExtensionContentsStmt *b)
 
1682
{
 
1683
        COMPARE_STRING_FIELD(extname);
 
1684
        COMPARE_SCALAR_FIELD(action);
 
1685
        COMPARE_SCALAR_FIELD(objtype);
 
1686
        COMPARE_NODE_FIELD(objname);
 
1687
        COMPARE_NODE_FIELD(objargs);
 
1688
 
 
1689
        return true;
 
1690
}
 
1691
 
 
1692
static bool
 
1693
_equalCreateFdwStmt(CreateFdwStmt *a, CreateFdwStmt *b)
 
1694
{
 
1695
        COMPARE_STRING_FIELD(fdwname);
 
1696
        COMPARE_NODE_FIELD(func_options);
 
1697
        COMPARE_NODE_FIELD(options);
 
1698
 
 
1699
        return true;
 
1700
}
 
1701
 
 
1702
static bool
 
1703
_equalAlterFdwStmt(AlterFdwStmt *a, AlterFdwStmt *b)
 
1704
{
 
1705
        COMPARE_STRING_FIELD(fdwname);
 
1706
        COMPARE_NODE_FIELD(func_options);
 
1707
        COMPARE_NODE_FIELD(options);
 
1708
 
 
1709
        return true;
 
1710
}
 
1711
 
 
1712
static bool
 
1713
_equalDropFdwStmt(DropFdwStmt *a, DropFdwStmt *b)
 
1714
{
 
1715
        COMPARE_STRING_FIELD(fdwname);
 
1716
        COMPARE_SCALAR_FIELD(missing_ok);
 
1717
        COMPARE_SCALAR_FIELD(behavior);
 
1718
 
 
1719
        return true;
 
1720
}
 
1721
 
 
1722
static bool
 
1723
_equalCreateForeignServerStmt(CreateForeignServerStmt *a, CreateForeignServerStmt *b)
 
1724
{
 
1725
        COMPARE_STRING_FIELD(servername);
 
1726
        COMPARE_STRING_FIELD(servertype);
 
1727
        COMPARE_STRING_FIELD(version);
 
1728
        COMPARE_STRING_FIELD(fdwname);
 
1729
        COMPARE_NODE_FIELD(options);
 
1730
 
 
1731
        return true;
 
1732
}
 
1733
 
 
1734
static bool
 
1735
_equalAlterForeignServerStmt(AlterForeignServerStmt *a, AlterForeignServerStmt *b)
 
1736
{
 
1737
        COMPARE_STRING_FIELD(servername);
 
1738
        COMPARE_STRING_FIELD(version);
 
1739
        COMPARE_NODE_FIELD(options);
 
1740
        COMPARE_SCALAR_FIELD(has_version);
 
1741
 
 
1742
        return true;
 
1743
}
 
1744
 
 
1745
static bool
 
1746
_equalDropForeignServerStmt(DropForeignServerStmt *a, DropForeignServerStmt *b)
 
1747
{
 
1748
        COMPARE_STRING_FIELD(servername);
 
1749
        COMPARE_SCALAR_FIELD(missing_ok);
 
1750
        COMPARE_SCALAR_FIELD(behavior);
 
1751
 
 
1752
        return true;
 
1753
}
 
1754
 
 
1755
static bool
 
1756
_equalCreateUserMappingStmt(CreateUserMappingStmt *a, CreateUserMappingStmt *b)
 
1757
{
 
1758
        COMPARE_STRING_FIELD(username);
 
1759
        COMPARE_STRING_FIELD(servername);
 
1760
        COMPARE_NODE_FIELD(options);
 
1761
 
 
1762
        return true;
 
1763
}
 
1764
 
 
1765
static bool
 
1766
_equalAlterUserMappingStmt(AlterUserMappingStmt *a, AlterUserMappingStmt *b)
 
1767
{
 
1768
        COMPARE_STRING_FIELD(username);
 
1769
        COMPARE_STRING_FIELD(servername);
 
1770
        COMPARE_NODE_FIELD(options);
 
1771
 
 
1772
        return true;
 
1773
}
 
1774
 
 
1775
static bool
 
1776
_equalDropUserMappingStmt(DropUserMappingStmt *a, DropUserMappingStmt *b)
 
1777
{
 
1778
        COMPARE_STRING_FIELD(username);
 
1779
        COMPARE_STRING_FIELD(servername);
 
1780
        COMPARE_SCALAR_FIELD(missing_ok);
 
1781
 
 
1782
        return true;
 
1783
}
 
1784
 
 
1785
static bool
 
1786
_equalCreateForeignTableStmt(CreateForeignTableStmt *a, CreateForeignTableStmt *b)
 
1787
{
 
1788
        if (!_equalCreateStmt(&a->base, &b->base))
 
1789
                return false;
 
1790
 
 
1791
        COMPARE_STRING_FIELD(servername);
 
1792
        COMPARE_NODE_FIELD(options);
 
1793
 
 
1794
        return true;
 
1795
}
 
1796
 
 
1797
static bool
 
1798
_equalCreateTrigStmt(CreateTrigStmt *a, CreateTrigStmt *b)
 
1799
{
 
1800
        COMPARE_STRING_FIELD(trigname);
 
1801
        COMPARE_NODE_FIELD(relation);
 
1802
        COMPARE_NODE_FIELD(funcname);
 
1803
        COMPARE_NODE_FIELD(args);
 
1804
        COMPARE_SCALAR_FIELD(row);
 
1805
        COMPARE_SCALAR_FIELD(timing);
 
1806
        COMPARE_SCALAR_FIELD(events);
 
1807
        COMPARE_NODE_FIELD(columns);
 
1808
        COMPARE_NODE_FIELD(whenClause);
 
1809
        COMPARE_SCALAR_FIELD(isconstraint);
 
1810
        COMPARE_SCALAR_FIELD(deferrable);
 
1811
        COMPARE_SCALAR_FIELD(initdeferred);
 
1812
        COMPARE_NODE_FIELD(constrrel);
 
1813
 
 
1814
        return true;
 
1815
}
 
1816
 
 
1817
static bool
 
1818
_equalDropPropertyStmt(DropPropertyStmt *a, DropPropertyStmt *b)
 
1819
{
 
1820
        COMPARE_NODE_FIELD(relation);
 
1821
        COMPARE_STRING_FIELD(property);
 
1822
        COMPARE_SCALAR_FIELD(removeType);
 
1823
        COMPARE_SCALAR_FIELD(behavior);
 
1824
        COMPARE_SCALAR_FIELD(missing_ok);
 
1825
 
 
1826
        return true;
 
1827
}
 
1828
 
 
1829
static bool
 
1830
_equalCreatePLangStmt(CreatePLangStmt *a, CreatePLangStmt *b)
 
1831
{
 
1832
        COMPARE_SCALAR_FIELD(replace);
 
1833
        COMPARE_STRING_FIELD(plname);
 
1834
        COMPARE_NODE_FIELD(plhandler);
 
1835
        COMPARE_NODE_FIELD(plinline);
 
1836
        COMPARE_NODE_FIELD(plvalidator);
 
1837
        COMPARE_SCALAR_FIELD(pltrusted);
 
1838
 
 
1839
        return true;
 
1840
}
 
1841
 
 
1842
static bool
 
1843
_equalDropPLangStmt(DropPLangStmt *a, DropPLangStmt *b)
 
1844
{
 
1845
        COMPARE_STRING_FIELD(plname);
 
1846
        COMPARE_SCALAR_FIELD(behavior);
 
1847
        COMPARE_SCALAR_FIELD(missing_ok);
 
1848
 
 
1849
        return true;
 
1850
}
 
1851
 
 
1852
static bool
 
1853
_equalCreateRoleStmt(CreateRoleStmt *a, CreateRoleStmt *b)
 
1854
{
 
1855
        COMPARE_SCALAR_FIELD(stmt_type);
 
1856
        COMPARE_STRING_FIELD(role);
 
1857
        COMPARE_NODE_FIELD(options);
 
1858
 
 
1859
        return true;
 
1860
}
 
1861
 
 
1862
static bool
 
1863
_equalAlterRoleStmt(AlterRoleStmt *a, AlterRoleStmt *b)
 
1864
{
 
1865
        COMPARE_STRING_FIELD(role);
 
1866
        COMPARE_NODE_FIELD(options);
 
1867
        COMPARE_SCALAR_FIELD(action);
 
1868
 
 
1869
        return true;
 
1870
}
 
1871
 
 
1872
static bool
 
1873
_equalAlterRoleSetStmt(AlterRoleSetStmt *a, AlterRoleSetStmt *b)
 
1874
{
 
1875
        COMPARE_STRING_FIELD(role);
 
1876
        COMPARE_STRING_FIELD(database);
 
1877
        COMPARE_NODE_FIELD(setstmt);
 
1878
 
 
1879
        return true;
 
1880
}
 
1881
 
 
1882
static bool
 
1883
_equalDropRoleStmt(DropRoleStmt *a, DropRoleStmt *b)
 
1884
{
 
1885
        COMPARE_NODE_FIELD(roles);
 
1886
        COMPARE_SCALAR_FIELD(missing_ok);
 
1887
 
 
1888
        return true;
 
1889
}
 
1890
 
 
1891
static bool
 
1892
_equalLockStmt(LockStmt *a, LockStmt *b)
 
1893
{
 
1894
        COMPARE_NODE_FIELD(relations);
 
1895
        COMPARE_SCALAR_FIELD(mode);
 
1896
        COMPARE_SCALAR_FIELD(nowait);
 
1897
 
 
1898
        return true;
 
1899
}
 
1900
 
 
1901
static bool
 
1902
_equalConstraintsSetStmt(ConstraintsSetStmt *a, ConstraintsSetStmt *b)
 
1903
{
 
1904
        COMPARE_NODE_FIELD(constraints);
 
1905
        COMPARE_SCALAR_FIELD(deferred);
 
1906
 
 
1907
        return true;
 
1908
}
 
1909
 
 
1910
static bool
 
1911
_equalReindexStmt(ReindexStmt *a, ReindexStmt *b)
 
1912
{
 
1913
        COMPARE_SCALAR_FIELD(kind);
 
1914
        COMPARE_NODE_FIELD(relation);
 
1915
        COMPARE_STRING_FIELD(name);
 
1916
        COMPARE_SCALAR_FIELD(do_system);
 
1917
        COMPARE_SCALAR_FIELD(do_user);
 
1918
 
 
1919
        return true;
 
1920
}
 
1921
 
 
1922
static bool
 
1923
_equalCreateSchemaStmt(CreateSchemaStmt *a, CreateSchemaStmt *b)
 
1924
{
 
1925
        COMPARE_STRING_FIELD(schemaname);
 
1926
        COMPARE_STRING_FIELD(authid);
 
1927
        COMPARE_NODE_FIELD(schemaElts);
 
1928
 
 
1929
        return true;
 
1930
}
 
1931
 
 
1932
static bool
 
1933
_equalCreateConversionStmt(CreateConversionStmt *a, CreateConversionStmt *b)
 
1934
{
 
1935
        COMPARE_NODE_FIELD(conversion_name);
 
1936
        COMPARE_STRING_FIELD(for_encoding_name);
 
1937
        COMPARE_STRING_FIELD(to_encoding_name);
 
1938
        COMPARE_NODE_FIELD(func_name);
 
1939
        COMPARE_SCALAR_FIELD(def);
 
1940
 
 
1941
        return true;
 
1942
}
 
1943
 
 
1944
static bool
 
1945
_equalCreateCastStmt(CreateCastStmt *a, CreateCastStmt *b)
 
1946
{
 
1947
        COMPARE_NODE_FIELD(sourcetype);
 
1948
        COMPARE_NODE_FIELD(targettype);
 
1949
        COMPARE_NODE_FIELD(func);
 
1950
        COMPARE_SCALAR_FIELD(context);
 
1951
        COMPARE_SCALAR_FIELD(inout);
 
1952
 
 
1953
        return true;
 
1954
}
 
1955
 
 
1956
static bool
 
1957
_equalDropCastStmt(DropCastStmt *a, DropCastStmt *b)
 
1958
{
 
1959
        COMPARE_NODE_FIELD(sourcetype);
 
1960
        COMPARE_NODE_FIELD(targettype);
 
1961
        COMPARE_SCALAR_FIELD(behavior);
 
1962
        COMPARE_SCALAR_FIELD(missing_ok);
 
1963
 
 
1964
        return true;
 
1965
}
 
1966
 
 
1967
static bool
 
1968
_equalPrepareStmt(PrepareStmt *a, PrepareStmt *b)
 
1969
{
 
1970
        COMPARE_STRING_FIELD(name);
 
1971
        COMPARE_NODE_FIELD(argtypes);
 
1972
        COMPARE_NODE_FIELD(query);
 
1973
 
 
1974
        return true;
 
1975
}
 
1976
 
 
1977
static bool
 
1978
_equalExecuteStmt(ExecuteStmt *a, ExecuteStmt *b)
 
1979
{
 
1980
        COMPARE_STRING_FIELD(name);
 
1981
        COMPARE_NODE_FIELD(into);
 
1982
        COMPARE_NODE_FIELD(params);
 
1983
 
 
1984
        return true;
 
1985
}
 
1986
 
 
1987
static bool
 
1988
_equalDeallocateStmt(DeallocateStmt *a, DeallocateStmt *b)
 
1989
{
 
1990
        COMPARE_STRING_FIELD(name);
 
1991
 
 
1992
        return true;
 
1993
}
 
1994
 
 
1995
static bool
 
1996
_equalDropOwnedStmt(DropOwnedStmt *a, DropOwnedStmt *b)
 
1997
{
 
1998
        COMPARE_NODE_FIELD(roles);
 
1999
        COMPARE_SCALAR_FIELD(behavior);
 
2000
 
 
2001
        return true;
 
2002
}
 
2003
 
 
2004
static bool
 
2005
_equalReassignOwnedStmt(ReassignOwnedStmt *a, ReassignOwnedStmt *b)
 
2006
{
 
2007
        COMPARE_NODE_FIELD(roles);
 
2008
        COMPARE_NODE_FIELD(newrole);
 
2009
 
 
2010
        return true;
 
2011
}
 
2012
 
 
2013
static bool
 
2014
_equalAlterTSDictionaryStmt(AlterTSDictionaryStmt *a, AlterTSDictionaryStmt *b)
 
2015
{
 
2016
        COMPARE_NODE_FIELD(dictname);
 
2017
        COMPARE_NODE_FIELD(options);
 
2018
 
 
2019
        return true;
 
2020
}
 
2021
 
 
2022
static bool
 
2023
_equalAlterTSConfigurationStmt(AlterTSConfigurationStmt *a,
 
2024
                                                           AlterTSConfigurationStmt *b)
 
2025
{
 
2026
        COMPARE_NODE_FIELD(cfgname);
 
2027
        COMPARE_NODE_FIELD(tokentype);
 
2028
        COMPARE_NODE_FIELD(dicts);
 
2029
        COMPARE_SCALAR_FIELD(override);
 
2030
        COMPARE_SCALAR_FIELD(replace);
 
2031
        COMPARE_SCALAR_FIELD(missing_ok);
 
2032
 
 
2033
        return true;
 
2034
}
 
2035
 
 
2036
static bool
 
2037
_equalAExpr(A_Expr *a, A_Expr *b)
 
2038
{
 
2039
        COMPARE_SCALAR_FIELD(kind);
 
2040
        COMPARE_NODE_FIELD(name);
 
2041
        COMPARE_NODE_FIELD(lexpr);
 
2042
        COMPARE_NODE_FIELD(rexpr);
 
2043
        COMPARE_LOCATION_FIELD(location);
 
2044
 
 
2045
        return true;
 
2046
}
 
2047
 
 
2048
static bool
 
2049
_equalColumnRef(ColumnRef *a, ColumnRef *b)
 
2050
{
 
2051
        COMPARE_NODE_FIELD(fields);
 
2052
        COMPARE_LOCATION_FIELD(location);
 
2053
 
 
2054
        return true;
 
2055
}
 
2056
 
 
2057
static bool
 
2058
_equalParamRef(ParamRef *a, ParamRef *b)
 
2059
{
 
2060
        COMPARE_SCALAR_FIELD(number);
 
2061
        COMPARE_LOCATION_FIELD(location);
 
2062
 
 
2063
        return true;
 
2064
}
 
2065
 
 
2066
static bool
 
2067
_equalAConst(A_Const *a, A_Const *b)
 
2068
{
 
2069
        if (!equal(&a->val, &b->val))           /* hack for in-line Value field */
 
2070
                return false;
 
2071
        COMPARE_LOCATION_FIELD(location);
 
2072
 
 
2073
        return true;
 
2074
}
 
2075
 
 
2076
static bool
 
2077
_equalFuncCall(FuncCall *a, FuncCall *b)
 
2078
{
 
2079
        COMPARE_NODE_FIELD(funcname);
 
2080
        COMPARE_NODE_FIELD(args);
 
2081
        COMPARE_NODE_FIELD(agg_order);
 
2082
        COMPARE_SCALAR_FIELD(agg_star);
 
2083
        COMPARE_SCALAR_FIELD(agg_distinct);
 
2084
        COMPARE_SCALAR_FIELD(func_variadic);
 
2085
        COMPARE_NODE_FIELD(over);
 
2086
        COMPARE_LOCATION_FIELD(location);
 
2087
 
 
2088
        return true;
 
2089
}
 
2090
 
 
2091
static bool
 
2092
_equalAStar(A_Star *a, A_Star *b)
 
2093
{
 
2094
        return true;
 
2095
}
 
2096
 
 
2097
static bool
 
2098
_equalAIndices(A_Indices *a, A_Indices *b)
 
2099
{
 
2100
        COMPARE_NODE_FIELD(lidx);
 
2101
        COMPARE_NODE_FIELD(uidx);
 
2102
 
 
2103
        return true;
 
2104
}
 
2105
 
 
2106
static bool
 
2107
_equalA_Indirection(A_Indirection *a, A_Indirection *b)
 
2108
{
 
2109
        COMPARE_NODE_FIELD(arg);
 
2110
        COMPARE_NODE_FIELD(indirection);
 
2111
 
 
2112
        return true;
 
2113
}
 
2114
 
 
2115
static bool
 
2116
_equalA_ArrayExpr(A_ArrayExpr *a, A_ArrayExpr *b)
 
2117
{
 
2118
        COMPARE_NODE_FIELD(elements);
 
2119
        COMPARE_LOCATION_FIELD(location);
 
2120
 
 
2121
        return true;
 
2122
}
 
2123
 
 
2124
static bool
 
2125
_equalResTarget(ResTarget *a, ResTarget *b)
 
2126
{
 
2127
        COMPARE_STRING_FIELD(name);
 
2128
        COMPARE_NODE_FIELD(indirection);
 
2129
        COMPARE_NODE_FIELD(val);
 
2130
        COMPARE_LOCATION_FIELD(location);
 
2131
 
 
2132
        return true;
 
2133
}
 
2134
 
 
2135
static bool
 
2136
_equalTypeName(TypeName *a, TypeName *b)
 
2137
{
 
2138
        COMPARE_NODE_FIELD(names);
 
2139
        COMPARE_SCALAR_FIELD(typeOid);
 
2140
        COMPARE_SCALAR_FIELD(setof);
 
2141
        COMPARE_SCALAR_FIELD(pct_type);
 
2142
        COMPARE_NODE_FIELD(typmods);
 
2143
        COMPARE_SCALAR_FIELD(typemod);
 
2144
        COMPARE_NODE_FIELD(arrayBounds);
 
2145
        COMPARE_LOCATION_FIELD(location);
 
2146
 
 
2147
        return true;
 
2148
}
 
2149
 
 
2150
static bool
 
2151
_equalTypeCast(TypeCast *a, TypeCast *b)
 
2152
{
 
2153
        COMPARE_NODE_FIELD(arg);
 
2154
        COMPARE_NODE_FIELD(typeName);
 
2155
        COMPARE_LOCATION_FIELD(location);
 
2156
 
 
2157
        return true;
 
2158
}
 
2159
 
 
2160
static bool
 
2161
_equalCollateClause(CollateClause *a, CollateClause *b)
 
2162
{
 
2163
        COMPARE_NODE_FIELD(arg);
 
2164
        COMPARE_NODE_FIELD(collname);
 
2165
        COMPARE_LOCATION_FIELD(location);
 
2166
 
 
2167
        return true;
 
2168
}
 
2169
 
 
2170
static bool
 
2171
_equalSortBy(SortBy *a, SortBy *b)
 
2172
{
 
2173
        COMPARE_NODE_FIELD(node);
 
2174
        COMPARE_SCALAR_FIELD(sortby_dir);
 
2175
        COMPARE_SCALAR_FIELD(sortby_nulls);
 
2176
        COMPARE_NODE_FIELD(useOp);
 
2177
        COMPARE_LOCATION_FIELD(location);
 
2178
 
 
2179
        return true;
 
2180
}
 
2181
 
 
2182
static bool
 
2183
_equalWindowDef(WindowDef *a, WindowDef *b)
 
2184
{
 
2185
        COMPARE_STRING_FIELD(name);
 
2186
        COMPARE_STRING_FIELD(refname);
 
2187
        COMPARE_NODE_FIELD(partitionClause);
 
2188
        COMPARE_NODE_FIELD(orderClause);
 
2189
        COMPARE_SCALAR_FIELD(frameOptions);
 
2190
        COMPARE_NODE_FIELD(startOffset);
 
2191
        COMPARE_NODE_FIELD(endOffset);
 
2192
        COMPARE_LOCATION_FIELD(location);
 
2193
 
 
2194
        return true;
 
2195
}
 
2196
 
 
2197
static bool
 
2198
_equalRangeSubselect(RangeSubselect *a, RangeSubselect *b)
 
2199
{
 
2200
        COMPARE_NODE_FIELD(subquery);
 
2201
        COMPARE_NODE_FIELD(alias);
 
2202
 
 
2203
        return true;
 
2204
}
 
2205
 
 
2206
static bool
 
2207
_equalRangeFunction(RangeFunction *a, RangeFunction *b)
 
2208
{
 
2209
        COMPARE_NODE_FIELD(funccallnode);
 
2210
        COMPARE_NODE_FIELD(alias);
 
2211
        COMPARE_NODE_FIELD(coldeflist);
 
2212
 
 
2213
        return true;
 
2214
}
 
2215
 
 
2216
static bool
 
2217
_equalIndexElem(IndexElem *a, IndexElem *b)
 
2218
{
 
2219
        COMPARE_STRING_FIELD(name);
 
2220
        COMPARE_NODE_FIELD(expr);
 
2221
        COMPARE_STRING_FIELD(indexcolname);
 
2222
        COMPARE_NODE_FIELD(collation);
 
2223
        COMPARE_NODE_FIELD(opclass);
 
2224
        COMPARE_SCALAR_FIELD(ordering);
 
2225
        COMPARE_SCALAR_FIELD(nulls_ordering);
 
2226
 
 
2227
        return true;
 
2228
}
 
2229
 
 
2230
static bool
 
2231
_equalColumnDef(ColumnDef *a, ColumnDef *b)
 
2232
{
 
2233
        COMPARE_STRING_FIELD(colname);
 
2234
        COMPARE_NODE_FIELD(typeName);
 
2235
        COMPARE_SCALAR_FIELD(inhcount);
 
2236
        COMPARE_SCALAR_FIELD(is_local);
 
2237
        COMPARE_SCALAR_FIELD(is_not_null);
 
2238
        COMPARE_SCALAR_FIELD(is_from_type);
 
2239
        COMPARE_SCALAR_FIELD(storage);
 
2240
        COMPARE_NODE_FIELD(raw_default);
 
2241
        COMPARE_NODE_FIELD(cooked_default);
 
2242
        COMPARE_NODE_FIELD(collClause);
 
2243
        COMPARE_SCALAR_FIELD(collOid);
 
2244
        COMPARE_NODE_FIELD(constraints);
 
2245
 
 
2246
        return true;
 
2247
}
 
2248
 
 
2249
static bool
 
2250
_equalConstraint(Constraint *a, Constraint *b)
 
2251
{
 
2252
        COMPARE_SCALAR_FIELD(contype);
 
2253
        COMPARE_STRING_FIELD(conname);
 
2254
        COMPARE_SCALAR_FIELD(deferrable);
 
2255
        COMPARE_SCALAR_FIELD(initdeferred);
 
2256
        COMPARE_LOCATION_FIELD(location);
 
2257
        COMPARE_NODE_FIELD(raw_expr);
 
2258
        COMPARE_STRING_FIELD(cooked_expr);
 
2259
        COMPARE_NODE_FIELD(keys);
 
2260
        COMPARE_NODE_FIELD(exclusions);
 
2261
        COMPARE_NODE_FIELD(options);
 
2262
        COMPARE_STRING_FIELD(indexname);
 
2263
        COMPARE_STRING_FIELD(indexspace);
 
2264
        COMPARE_STRING_FIELD(access_method);
 
2265
        COMPARE_NODE_FIELD(where_clause);
 
2266
        COMPARE_NODE_FIELD(pktable);
 
2267
        COMPARE_NODE_FIELD(fk_attrs);
 
2268
        COMPARE_NODE_FIELD(pk_attrs);
 
2269
        COMPARE_SCALAR_FIELD(fk_matchtype);
 
2270
        COMPARE_SCALAR_FIELD(fk_upd_action);
 
2271
        COMPARE_SCALAR_FIELD(fk_del_action);
 
2272
        COMPARE_SCALAR_FIELD(skip_validation);
 
2273
        COMPARE_SCALAR_FIELD(initially_valid);
 
2274
 
 
2275
        return true;
 
2276
}
 
2277
 
 
2278
static bool
 
2279
_equalDefElem(DefElem *a, DefElem *b)
 
2280
{
 
2281
        COMPARE_STRING_FIELD(defnamespace);
 
2282
        COMPARE_STRING_FIELD(defname);
 
2283
        COMPARE_NODE_FIELD(arg);
 
2284
        COMPARE_SCALAR_FIELD(defaction);
 
2285
 
 
2286
        return true;
 
2287
}
 
2288
 
 
2289
static bool
 
2290
_equalLockingClause(LockingClause *a, LockingClause *b)
 
2291
{
 
2292
        COMPARE_NODE_FIELD(lockedRels);
 
2293
        COMPARE_SCALAR_FIELD(forUpdate);
 
2294
        COMPARE_SCALAR_FIELD(noWait);
 
2295
 
 
2296
        return true;
 
2297
}
 
2298
 
 
2299
static bool
 
2300
_equalRangeTblEntry(RangeTblEntry *a, RangeTblEntry *b)
 
2301
{
 
2302
        COMPARE_SCALAR_FIELD(rtekind);
 
2303
        COMPARE_SCALAR_FIELD(relid);
 
2304
        COMPARE_SCALAR_FIELD(relkind);
 
2305
        COMPARE_NODE_FIELD(subquery);
 
2306
        COMPARE_SCALAR_FIELD(jointype);
 
2307
        COMPARE_NODE_FIELD(joinaliasvars);
 
2308
        COMPARE_NODE_FIELD(funcexpr);
 
2309
        COMPARE_NODE_FIELD(funccoltypes);
 
2310
        COMPARE_NODE_FIELD(funccoltypmods);
 
2311
        COMPARE_NODE_FIELD(funccolcollations);
 
2312
        COMPARE_NODE_FIELD(values_lists);
 
2313
        COMPARE_NODE_FIELD(values_collations);
 
2314
        COMPARE_STRING_FIELD(ctename);
 
2315
        COMPARE_SCALAR_FIELD(ctelevelsup);
 
2316
        COMPARE_SCALAR_FIELD(self_reference);
 
2317
        COMPARE_NODE_FIELD(ctecoltypes);
 
2318
        COMPARE_NODE_FIELD(ctecoltypmods);
 
2319
        COMPARE_NODE_FIELD(ctecolcollations);
 
2320
        COMPARE_NODE_FIELD(alias);
 
2321
        COMPARE_NODE_FIELD(eref);
 
2322
        COMPARE_SCALAR_FIELD(inh);
 
2323
        COMPARE_SCALAR_FIELD(inFromCl);
 
2324
        COMPARE_SCALAR_FIELD(requiredPerms);
 
2325
        COMPARE_SCALAR_FIELD(checkAsUser);
 
2326
        COMPARE_BITMAPSET_FIELD(selectedCols);
 
2327
        COMPARE_BITMAPSET_FIELD(modifiedCols);
 
2328
 
 
2329
        return true;
 
2330
}
 
2331
 
 
2332
static bool
 
2333
_equalSortGroupClause(SortGroupClause *a, SortGroupClause *b)
 
2334
{
 
2335
        COMPARE_SCALAR_FIELD(tleSortGroupRef);
 
2336
        COMPARE_SCALAR_FIELD(eqop);
 
2337
        COMPARE_SCALAR_FIELD(sortop);
 
2338
        COMPARE_SCALAR_FIELD(nulls_first);
 
2339
        COMPARE_SCALAR_FIELD(hashable);
 
2340
 
 
2341
        return true;
 
2342
}
 
2343
 
 
2344
static bool
 
2345
_equalWindowClause(WindowClause *a, WindowClause *b)
 
2346
{
 
2347
        COMPARE_STRING_FIELD(name);
 
2348
        COMPARE_STRING_FIELD(refname);
 
2349
        COMPARE_NODE_FIELD(partitionClause);
 
2350
        COMPARE_NODE_FIELD(orderClause);
 
2351
        COMPARE_SCALAR_FIELD(frameOptions);
 
2352
        COMPARE_NODE_FIELD(startOffset);
 
2353
        COMPARE_NODE_FIELD(endOffset);
 
2354
        COMPARE_SCALAR_FIELD(winref);
 
2355
        COMPARE_SCALAR_FIELD(copiedOrder);
 
2356
 
 
2357
        return true;
 
2358
}
 
2359
 
 
2360
static bool
 
2361
_equalRowMarkClause(RowMarkClause *a, RowMarkClause *b)
 
2362
{
 
2363
        COMPARE_SCALAR_FIELD(rti);
 
2364
        COMPARE_SCALAR_FIELD(forUpdate);
 
2365
        COMPARE_SCALAR_FIELD(noWait);
 
2366
        COMPARE_SCALAR_FIELD(pushedDown);
 
2367
 
 
2368
        return true;
 
2369
}
 
2370
 
 
2371
static bool
 
2372
_equalWithClause(WithClause *a, WithClause *b)
 
2373
{
 
2374
        COMPARE_NODE_FIELD(ctes);
 
2375
        COMPARE_SCALAR_FIELD(recursive);
 
2376
        COMPARE_LOCATION_FIELD(location);
 
2377
 
 
2378
        return true;
 
2379
}
 
2380
 
 
2381
static bool
 
2382
_equalCommonTableExpr(CommonTableExpr *a, CommonTableExpr *b)
 
2383
{
 
2384
        COMPARE_STRING_FIELD(ctename);
 
2385
        COMPARE_NODE_FIELD(aliascolnames);
 
2386
        COMPARE_NODE_FIELD(ctequery);
 
2387
        COMPARE_LOCATION_FIELD(location);
 
2388
        COMPARE_SCALAR_FIELD(cterecursive);
 
2389
        COMPARE_SCALAR_FIELD(cterefcount);
 
2390
        COMPARE_NODE_FIELD(ctecolnames);
 
2391
        COMPARE_NODE_FIELD(ctecoltypes);
 
2392
        COMPARE_NODE_FIELD(ctecoltypmods);
 
2393
        COMPARE_NODE_FIELD(ctecolcollations);
 
2394
 
 
2395
        return true;
 
2396
}
 
2397
 
 
2398
static bool
 
2399
_equalXmlSerialize(XmlSerialize *a, XmlSerialize *b)
 
2400
{
 
2401
        COMPARE_SCALAR_FIELD(xmloption);
 
2402
        COMPARE_NODE_FIELD(expr);
 
2403
        COMPARE_NODE_FIELD(typeName);
 
2404
        COMPARE_LOCATION_FIELD(location);
 
2405
 
 
2406
        return true;
 
2407
}
 
2408
 
 
2409
/*
 
2410
 * Stuff from pg_list.h
 
2411
 */
 
2412
 
 
2413
static bool
 
2414
_equalList(List *a, List *b)
 
2415
{
 
2416
        ListCell   *item_a;
 
2417
        ListCell   *item_b;
 
2418
 
 
2419
        /*
 
2420
         * Try to reject by simple scalar checks before grovelling through all the
 
2421
         * list elements...
 
2422
         */
 
2423
        COMPARE_SCALAR_FIELD(type);
 
2424
        COMPARE_SCALAR_FIELD(length);
 
2425
 
 
2426
        /*
 
2427
         * We place the switch outside the loop for the sake of efficiency; this
 
2428
         * may not be worth doing...
 
2429
         */
 
2430
        switch (a->type)
 
2431
        {
 
2432
                case T_List:
 
2433
                        forboth(item_a, a, item_b, b)
 
2434
                        {
 
2435
                                if (!equal(lfirst(item_a), lfirst(item_b)))
 
2436
                                        return false;
 
2437
                        }
 
2438
                        break;
 
2439
                case T_IntList:
 
2440
                        forboth(item_a, a, item_b, b)
 
2441
                        {
 
2442
                                if (lfirst_int(item_a) != lfirst_int(item_b))
 
2443
                                        return false;
 
2444
                        }
 
2445
                        break;
 
2446
                case T_OidList:
 
2447
                        forboth(item_a, a, item_b, b)
 
2448
                        {
 
2449
                                if (lfirst_oid(item_a) != lfirst_oid(item_b))
 
2450
                                        return false;
 
2451
                        }
 
2452
                        break;
 
2453
                default:
 
2454
                        elog(ERROR, "unrecognized list node type: %d",
 
2455
                                 (int) a->type);
 
2456
                        return false;           /* keep compiler quiet */
 
2457
        }
 
2458
 
 
2459
        /*
 
2460
         * If we got here, we should have run out of elements of both lists
 
2461
         */
 
2462
        Assert(item_a == NULL);
 
2463
        Assert(item_b == NULL);
 
2464
 
 
2465
        return true;
 
2466
}
 
2467
 
 
2468
/*
 
2469
 * Stuff from value.h
 
2470
 */
 
2471
 
 
2472
static bool
 
2473
_equalValue(Value *a, Value *b)
 
2474
{
 
2475
        COMPARE_SCALAR_FIELD(type);
 
2476
 
 
2477
        switch (a->type)
 
2478
        {
 
2479
                case T_Integer:
 
2480
                        COMPARE_SCALAR_FIELD(val.ival);
 
2481
                        break;
 
2482
                case T_Float:
 
2483
                case T_String:
 
2484
                case T_BitString:
 
2485
                        COMPARE_STRING_FIELD(val.str);
 
2486
                        break;
 
2487
                case T_Null:
 
2488
                        /* nothing to do */
 
2489
                        break;
 
2490
                default:
 
2491
                        elog(ERROR, "unrecognized node type: %d", (int) a->type);
 
2492
                        break;
 
2493
        }
 
2494
 
 
2495
        return true;
 
2496
}
 
2497
 
 
2498
/*
 
2499
 * equal
 
2500
 *        returns whether two nodes are equal
 
2501
 */
 
2502
bool
 
2503
equal(void *a, void *b)
 
2504
{
 
2505
        bool            retval;
 
2506
 
 
2507
        if (a == b)
 
2508
                return true;
 
2509
 
 
2510
        /*
 
2511
         * note that a!=b, so only one of them can be NULL
 
2512
         */
 
2513
        if (a == NULL || b == NULL)
 
2514
                return false;
 
2515
 
 
2516
        /*
 
2517
         * are they the same type of nodes?
 
2518
         */
 
2519
        if (nodeTag(a) != nodeTag(b))
 
2520
                return false;
 
2521
 
 
2522
        switch (nodeTag(a))
 
2523
        {
 
2524
                        /*
 
2525
                         * PRIMITIVE NODES
 
2526
                         */
 
2527
                case T_Alias:
 
2528
                        retval = _equalAlias(a, b);
 
2529
                        break;
 
2530
                case T_RangeVar:
 
2531
                        retval = _equalRangeVar(a, b);
 
2532
                        break;
 
2533
                case T_IntoClause:
 
2534
                        retval = _equalIntoClause(a, b);
 
2535
                        break;
 
2536
                case T_Var:
 
2537
                        retval = _equalVar(a, b);
 
2538
                        break;
 
2539
                case T_Const:
 
2540
                        retval = _equalConst(a, b);
 
2541
                        break;
 
2542
                case T_Param:
 
2543
                        retval = _equalParam(a, b);
 
2544
                        break;
 
2545
                case T_Aggref:
 
2546
                        retval = _equalAggref(a, b);
 
2547
                        break;
 
2548
                case T_WindowFunc:
 
2549
                        retval = _equalWindowFunc(a, b);
 
2550
                        break;
 
2551
                case T_ArrayRef:
 
2552
                        retval = _equalArrayRef(a, b);
 
2553
                        break;
 
2554
                case T_FuncExpr:
 
2555
                        retval = _equalFuncExpr(a, b);
 
2556
                        break;
 
2557
                case T_NamedArgExpr:
 
2558
                        retval = _equalNamedArgExpr(a, b);
 
2559
                        break;
 
2560
                case T_OpExpr:
 
2561
                        retval = _equalOpExpr(a, b);
 
2562
                        break;
 
2563
                case T_DistinctExpr:
 
2564
                        retval = _equalDistinctExpr(a, b);
 
2565
                        break;
 
2566
                case T_NullIfExpr:
 
2567
                        retval = _equalNullIfExpr(a, b);
 
2568
                        break;
 
2569
                case T_ScalarArrayOpExpr:
 
2570
                        retval = _equalScalarArrayOpExpr(a, b);
 
2571
                        break;
 
2572
                case T_BoolExpr:
 
2573
                        retval = _equalBoolExpr(a, b);
 
2574
                        break;
 
2575
                case T_SubLink:
 
2576
                        retval = _equalSubLink(a, b);
 
2577
                        break;
 
2578
                case T_SubPlan:
 
2579
                        retval = _equalSubPlan(a, b);
 
2580
                        break;
 
2581
                case T_AlternativeSubPlan:
 
2582
                        retval = _equalAlternativeSubPlan(a, b);
 
2583
                        break;
 
2584
                case T_FieldSelect:
 
2585
                        retval = _equalFieldSelect(a, b);
 
2586
                        break;
 
2587
                case T_FieldStore:
 
2588
                        retval = _equalFieldStore(a, b);
 
2589
                        break;
 
2590
                case T_RelabelType:
 
2591
                        retval = _equalRelabelType(a, b);
 
2592
                        break;
 
2593
                case T_CoerceViaIO:
 
2594
                        retval = _equalCoerceViaIO(a, b);
 
2595
                        break;
 
2596
                case T_ArrayCoerceExpr:
 
2597
                        retval = _equalArrayCoerceExpr(a, b);
 
2598
                        break;
 
2599
                case T_ConvertRowtypeExpr:
 
2600
                        retval = _equalConvertRowtypeExpr(a, b);
 
2601
                        break;
 
2602
                case T_CollateExpr:
 
2603
                        retval = _equalCollateExpr(a, b);
 
2604
                        break;
 
2605
                case T_CaseExpr:
 
2606
                        retval = _equalCaseExpr(a, b);
 
2607
                        break;
 
2608
                case T_CaseWhen:
 
2609
                        retval = _equalCaseWhen(a, b);
 
2610
                        break;
 
2611
                case T_CaseTestExpr:
 
2612
                        retval = _equalCaseTestExpr(a, b);
 
2613
                        break;
 
2614
                case T_ArrayExpr:
 
2615
                        retval = _equalArrayExpr(a, b);
 
2616
                        break;
 
2617
                case T_RowExpr:
 
2618
                        retval = _equalRowExpr(a, b);
 
2619
                        break;
 
2620
                case T_RowCompareExpr:
 
2621
                        retval = _equalRowCompareExpr(a, b);
 
2622
                        break;
 
2623
                case T_CoalesceExpr:
 
2624
                        retval = _equalCoalesceExpr(a, b);
 
2625
                        break;
 
2626
                case T_MinMaxExpr:
 
2627
                        retval = _equalMinMaxExpr(a, b);
 
2628
                        break;
 
2629
                case T_XmlExpr:
 
2630
                        retval = _equalXmlExpr(a, b);
 
2631
                        break;
 
2632
                case T_NullTest:
 
2633
                        retval = _equalNullTest(a, b);
 
2634
                        break;
 
2635
                case T_BooleanTest:
 
2636
                        retval = _equalBooleanTest(a, b);
 
2637
                        break;
 
2638
                case T_CoerceToDomain:
 
2639
                        retval = _equalCoerceToDomain(a, b);
 
2640
                        break;
 
2641
                case T_CoerceToDomainValue:
 
2642
                        retval = _equalCoerceToDomainValue(a, b);
 
2643
                        break;
 
2644
                case T_SetToDefault:
 
2645
                        retval = _equalSetToDefault(a, b);
 
2646
                        break;
 
2647
                case T_CurrentOfExpr:
 
2648
                        retval = _equalCurrentOfExpr(a, b);
 
2649
                        break;
 
2650
                case T_TargetEntry:
 
2651
                        retval = _equalTargetEntry(a, b);
 
2652
                        break;
 
2653
                case T_RangeTblRef:
 
2654
                        retval = _equalRangeTblRef(a, b);
 
2655
                        break;
 
2656
                case T_FromExpr:
 
2657
                        retval = _equalFromExpr(a, b);
 
2658
                        break;
 
2659
                case T_JoinExpr:
 
2660
                        retval = _equalJoinExpr(a, b);
 
2661
                        break;
 
2662
 
 
2663
                        /*
 
2664
                         * RELATION NODES
 
2665
                         */
 
2666
                case T_PathKey:
 
2667
                        retval = _equalPathKey(a, b);
 
2668
                        break;
 
2669
                case T_RestrictInfo:
 
2670
                        retval = _equalRestrictInfo(a, b);
 
2671
                        break;
 
2672
                case T_PlaceHolderVar:
 
2673
                        retval = _equalPlaceHolderVar(a, b);
 
2674
                        break;
 
2675
                case T_SpecialJoinInfo:
 
2676
                        retval = _equalSpecialJoinInfo(a, b);
 
2677
                        break;
 
2678
                case T_AppendRelInfo:
 
2679
                        retval = _equalAppendRelInfo(a, b);
 
2680
                        break;
 
2681
                case T_PlaceHolderInfo:
 
2682
                        retval = _equalPlaceHolderInfo(a, b);
 
2683
                        break;
 
2684
 
 
2685
                case T_List:
 
2686
                case T_IntList:
 
2687
                case T_OidList:
 
2688
                        retval = _equalList(a, b);
 
2689
                        break;
 
2690
 
 
2691
                case T_Integer:
 
2692
                case T_Float:
 
2693
                case T_String:
 
2694
                case T_BitString:
 
2695
                case T_Null:
 
2696
                        retval = _equalValue(a, b);
 
2697
                        break;
 
2698
 
 
2699
                        /*
 
2700
                         * PARSE NODES
 
2701
                         */
 
2702
                case T_Query:
 
2703
                        retval = _equalQuery(a, b);
 
2704
                        break;
 
2705
                case T_InsertStmt:
 
2706
                        retval = _equalInsertStmt(a, b);
 
2707
                        break;
 
2708
                case T_DeleteStmt:
 
2709
                        retval = _equalDeleteStmt(a, b);
 
2710
                        break;
 
2711
                case T_UpdateStmt:
 
2712
                        retval = _equalUpdateStmt(a, b);
 
2713
                        break;
 
2714
                case T_SelectStmt:
 
2715
                        retval = _equalSelectStmt(a, b);
 
2716
                        break;
 
2717
                case T_SetOperationStmt:
 
2718
                        retval = _equalSetOperationStmt(a, b);
 
2719
                        break;
 
2720
                case T_AlterTableStmt:
 
2721
                        retval = _equalAlterTableStmt(a, b);
 
2722
                        break;
 
2723
                case T_AlterTableCmd:
 
2724
                        retval = _equalAlterTableCmd(a, b);
 
2725
                        break;
 
2726
                case T_AlterDomainStmt:
 
2727
                        retval = _equalAlterDomainStmt(a, b);
 
2728
                        break;
 
2729
                case T_GrantStmt:
 
2730
                        retval = _equalGrantStmt(a, b);
 
2731
                        break;
 
2732
                case T_GrantRoleStmt:
 
2733
                        retval = _equalGrantRoleStmt(a, b);
 
2734
                        break;
 
2735
                case T_AlterDefaultPrivilegesStmt:
 
2736
                        retval = _equalAlterDefaultPrivilegesStmt(a, b);
 
2737
                        break;
 
2738
                case T_DeclareCursorStmt:
 
2739
                        retval = _equalDeclareCursorStmt(a, b);
 
2740
                        break;
 
2741
                case T_ClosePortalStmt:
 
2742
                        retval = _equalClosePortalStmt(a, b);
 
2743
                        break;
 
2744
                case T_ClusterStmt:
 
2745
                        retval = _equalClusterStmt(a, b);
 
2746
                        break;
 
2747
                case T_CopyStmt:
 
2748
                        retval = _equalCopyStmt(a, b);
 
2749
                        break;
 
2750
                case T_CreateStmt:
 
2751
                        retval = _equalCreateStmt(a, b);
 
2752
                        break;
 
2753
                case T_InhRelation:
 
2754
                        retval = _equalInhRelation(a, b);
 
2755
                        break;
 
2756
                case T_DefineStmt:
 
2757
                        retval = _equalDefineStmt(a, b);
 
2758
                        break;
 
2759
                case T_DropStmt:
 
2760
                        retval = _equalDropStmt(a, b);
 
2761
                        break;
 
2762
                case T_TruncateStmt:
 
2763
                        retval = _equalTruncateStmt(a, b);
 
2764
                        break;
 
2765
                case T_CommentStmt:
 
2766
                        retval = _equalCommentStmt(a, b);
 
2767
                        break;
 
2768
                case T_SecLabelStmt:
 
2769
                        retval = _equalSecLabelStmt(a, b);
 
2770
                        break;
 
2771
                case T_FetchStmt:
 
2772
                        retval = _equalFetchStmt(a, b);
 
2773
                        break;
 
2774
                case T_IndexStmt:
 
2775
                        retval = _equalIndexStmt(a, b);
 
2776
                        break;
 
2777
                case T_CreateFunctionStmt:
 
2778
                        retval = _equalCreateFunctionStmt(a, b);
 
2779
                        break;
 
2780
                case T_FunctionParameter:
 
2781
                        retval = _equalFunctionParameter(a, b);
 
2782
                        break;
 
2783
                case T_AlterFunctionStmt:
 
2784
                        retval = _equalAlterFunctionStmt(a, b);
 
2785
                        break;
 
2786
                case T_RemoveFuncStmt:
 
2787
                        retval = _equalRemoveFuncStmt(a, b);
 
2788
                        break;
 
2789
                case T_DoStmt:
 
2790
                        retval = _equalDoStmt(a, b);
 
2791
                        break;
 
2792
                case T_RemoveOpClassStmt:
 
2793
                        retval = _equalRemoveOpClassStmt(a, b);
 
2794
                        break;
 
2795
                case T_RemoveOpFamilyStmt:
 
2796
                        retval = _equalRemoveOpFamilyStmt(a, b);
 
2797
                        break;
 
2798
                case T_RenameStmt:
 
2799
                        retval = _equalRenameStmt(a, b);
 
2800
                        break;
 
2801
                case T_AlterObjectSchemaStmt:
 
2802
                        retval = _equalAlterObjectSchemaStmt(a, b);
 
2803
                        break;
 
2804
                case T_AlterOwnerStmt:
 
2805
                        retval = _equalAlterOwnerStmt(a, b);
 
2806
                        break;
 
2807
                case T_RuleStmt:
 
2808
                        retval = _equalRuleStmt(a, b);
 
2809
                        break;
 
2810
                case T_NotifyStmt:
 
2811
                        retval = _equalNotifyStmt(a, b);
 
2812
                        break;
 
2813
                case T_ListenStmt:
 
2814
                        retval = _equalListenStmt(a, b);
 
2815
                        break;
 
2816
                case T_UnlistenStmt:
 
2817
                        retval = _equalUnlistenStmt(a, b);
 
2818
                        break;
 
2819
                case T_TransactionStmt:
 
2820
                        retval = _equalTransactionStmt(a, b);
 
2821
                        break;
 
2822
                case T_CompositeTypeStmt:
 
2823
                        retval = _equalCompositeTypeStmt(a, b);
 
2824
                        break;
 
2825
                case T_CreateEnumStmt:
 
2826
                        retval = _equalCreateEnumStmt(a, b);
 
2827
                        break;
 
2828
                case T_AlterEnumStmt:
 
2829
                        retval = _equalAlterEnumStmt(a, b);
 
2830
                        break;
 
2831
                case T_ViewStmt:
 
2832
                        retval = _equalViewStmt(a, b);
 
2833
                        break;
 
2834
                case T_LoadStmt:
 
2835
                        retval = _equalLoadStmt(a, b);
 
2836
                        break;
 
2837
                case T_CreateDomainStmt:
 
2838
                        retval = _equalCreateDomainStmt(a, b);
 
2839
                        break;
 
2840
                case T_CreateOpClassStmt:
 
2841
                        retval = _equalCreateOpClassStmt(a, b);
 
2842
                        break;
 
2843
                case T_CreateOpClassItem:
 
2844
                        retval = _equalCreateOpClassItem(a, b);
 
2845
                        break;
 
2846
                case T_CreateOpFamilyStmt:
 
2847
                        retval = _equalCreateOpFamilyStmt(a, b);
 
2848
                        break;
 
2849
                case T_AlterOpFamilyStmt:
 
2850
                        retval = _equalAlterOpFamilyStmt(a, b);
 
2851
                        break;
 
2852
                case T_CreatedbStmt:
 
2853
                        retval = _equalCreatedbStmt(a, b);
 
2854
                        break;
 
2855
                case T_AlterDatabaseStmt:
 
2856
                        retval = _equalAlterDatabaseStmt(a, b);
 
2857
                        break;
 
2858
                case T_AlterDatabaseSetStmt:
 
2859
                        retval = _equalAlterDatabaseSetStmt(a, b);
 
2860
                        break;
 
2861
                case T_DropdbStmt:
 
2862
                        retval = _equalDropdbStmt(a, b);
 
2863
                        break;
 
2864
                case T_VacuumStmt:
 
2865
                        retval = _equalVacuumStmt(a, b);
 
2866
                        break;
 
2867
                case T_ExplainStmt:
 
2868
                        retval = _equalExplainStmt(a, b);
 
2869
                        break;
 
2870
                case T_CreateSeqStmt:
 
2871
                        retval = _equalCreateSeqStmt(a, b);
 
2872
                        break;
 
2873
                case T_AlterSeqStmt:
 
2874
                        retval = _equalAlterSeqStmt(a, b);
 
2875
                        break;
 
2876
                case T_VariableSetStmt:
 
2877
                        retval = _equalVariableSetStmt(a, b);
 
2878
                        break;
 
2879
                case T_VariableShowStmt:
 
2880
                        retval = _equalVariableShowStmt(a, b);
 
2881
                        break;
 
2882
                case T_DiscardStmt:
 
2883
                        retval = _equalDiscardStmt(a, b);
 
2884
                        break;
 
2885
                case T_CreateTableSpaceStmt:
 
2886
                        retval = _equalCreateTableSpaceStmt(a, b);
 
2887
                        break;
 
2888
                case T_DropTableSpaceStmt:
 
2889
                        retval = _equalDropTableSpaceStmt(a, b);
 
2890
                        break;
 
2891
                case T_AlterTableSpaceOptionsStmt:
 
2892
                        retval = _equalAlterTableSpaceOptionsStmt(a, b);
 
2893
                        break;
 
2894
                case T_CreateExtensionStmt:
 
2895
                        retval = _equalCreateExtensionStmt(a, b);
 
2896
                        break;
 
2897
                case T_AlterExtensionStmt:
 
2898
                        retval = _equalAlterExtensionStmt(a, b);
 
2899
                        break;
 
2900
                case T_AlterExtensionContentsStmt:
 
2901
                        retval = _equalAlterExtensionContentsStmt(a, b);
 
2902
                        break;
 
2903
                case T_CreateFdwStmt:
 
2904
                        retval = _equalCreateFdwStmt(a, b);
 
2905
                        break;
 
2906
                case T_AlterFdwStmt:
 
2907
                        retval = _equalAlterFdwStmt(a, b);
 
2908
                        break;
 
2909
                case T_DropFdwStmt:
 
2910
                        retval = _equalDropFdwStmt(a, b);
 
2911
                        break;
 
2912
                case T_CreateForeignServerStmt:
 
2913
                        retval = _equalCreateForeignServerStmt(a, b);
 
2914
                        break;
 
2915
                case T_AlterForeignServerStmt:
 
2916
                        retval = _equalAlterForeignServerStmt(a, b);
 
2917
                        break;
 
2918
                case T_DropForeignServerStmt:
 
2919
                        retval = _equalDropForeignServerStmt(a, b);
 
2920
                        break;
 
2921
                case T_CreateUserMappingStmt:
 
2922
                        retval = _equalCreateUserMappingStmt(a, b);
 
2923
                        break;
 
2924
                case T_AlterUserMappingStmt:
 
2925
                        retval = _equalAlterUserMappingStmt(a, b);
 
2926
                        break;
 
2927
                case T_DropUserMappingStmt:
 
2928
                        retval = _equalDropUserMappingStmt(a, b);
 
2929
                        break;
 
2930
                case T_CreateForeignTableStmt:
 
2931
                        retval = _equalCreateForeignTableStmt(a, b);
 
2932
                        break;
 
2933
                case T_CreateTrigStmt:
 
2934
                        retval = _equalCreateTrigStmt(a, b);
 
2935
                        break;
 
2936
                case T_DropPropertyStmt:
 
2937
                        retval = _equalDropPropertyStmt(a, b);
 
2938
                        break;
 
2939
                case T_CreatePLangStmt:
 
2940
                        retval = _equalCreatePLangStmt(a, b);
 
2941
                        break;
 
2942
                case T_DropPLangStmt:
 
2943
                        retval = _equalDropPLangStmt(a, b);
 
2944
                        break;
 
2945
                case T_CreateRoleStmt:
 
2946
                        retval = _equalCreateRoleStmt(a, b);
 
2947
                        break;
 
2948
                case T_AlterRoleStmt:
 
2949
                        retval = _equalAlterRoleStmt(a, b);
 
2950
                        break;
 
2951
                case T_AlterRoleSetStmt:
 
2952
                        retval = _equalAlterRoleSetStmt(a, b);
 
2953
                        break;
 
2954
                case T_DropRoleStmt:
 
2955
                        retval = _equalDropRoleStmt(a, b);
 
2956
                        break;
 
2957
                case T_LockStmt:
 
2958
                        retval = _equalLockStmt(a, b);
 
2959
                        break;
 
2960
                case T_ConstraintsSetStmt:
 
2961
                        retval = _equalConstraintsSetStmt(a, b);
 
2962
                        break;
 
2963
                case T_ReindexStmt:
 
2964
                        retval = _equalReindexStmt(a, b);
 
2965
                        break;
 
2966
                case T_CheckPointStmt:
 
2967
                        retval = true;
 
2968
                        break;
 
2969
                case T_CreateSchemaStmt:
 
2970
                        retval = _equalCreateSchemaStmt(a, b);
 
2971
                        break;
 
2972
                case T_CreateConversionStmt:
 
2973
                        retval = _equalCreateConversionStmt(a, b);
 
2974
                        break;
 
2975
                case T_CreateCastStmt:
 
2976
                        retval = _equalCreateCastStmt(a, b);
 
2977
                        break;
 
2978
                case T_DropCastStmt:
 
2979
                        retval = _equalDropCastStmt(a, b);
 
2980
                        break;
 
2981
                case T_PrepareStmt:
 
2982
                        retval = _equalPrepareStmt(a, b);
 
2983
                        break;
 
2984
                case T_ExecuteStmt:
 
2985
                        retval = _equalExecuteStmt(a, b);
 
2986
                        break;
 
2987
                case T_DeallocateStmt:
 
2988
                        retval = _equalDeallocateStmt(a, b);
 
2989
                        break;
 
2990
                case T_DropOwnedStmt:
 
2991
                        retval = _equalDropOwnedStmt(a, b);
 
2992
                        break;
 
2993
                case T_ReassignOwnedStmt:
 
2994
                        retval = _equalReassignOwnedStmt(a, b);
 
2995
                        break;
 
2996
                case T_AlterTSDictionaryStmt:
 
2997
                        retval = _equalAlterTSDictionaryStmt(a, b);
 
2998
                        break;
 
2999
                case T_AlterTSConfigurationStmt:
 
3000
                        retval = _equalAlterTSConfigurationStmt(a, b);
 
3001
                        break;
 
3002
 
 
3003
                case T_A_Expr:
 
3004
                        retval = _equalAExpr(a, b);
 
3005
                        break;
 
3006
                case T_ColumnRef:
 
3007
                        retval = _equalColumnRef(a, b);
 
3008
                        break;
 
3009
                case T_ParamRef:
 
3010
                        retval = _equalParamRef(a, b);
 
3011
                        break;
 
3012
                case T_A_Const:
 
3013
                        retval = _equalAConst(a, b);
 
3014
                        break;
 
3015
                case T_FuncCall:
 
3016
                        retval = _equalFuncCall(a, b);
 
3017
                        break;
 
3018
                case T_A_Star:
 
3019
                        retval = _equalAStar(a, b);
 
3020
                        break;
 
3021
                case T_A_Indices:
 
3022
                        retval = _equalAIndices(a, b);
 
3023
                        break;
 
3024
                case T_A_Indirection:
 
3025
                        retval = _equalA_Indirection(a, b);
 
3026
                        break;
 
3027
                case T_A_ArrayExpr:
 
3028
                        retval = _equalA_ArrayExpr(a, b);
 
3029
                        break;
 
3030
                case T_ResTarget:
 
3031
                        retval = _equalResTarget(a, b);
 
3032
                        break;
 
3033
                case T_TypeCast:
 
3034
                        retval = _equalTypeCast(a, b);
 
3035
                        break;
 
3036
                case T_CollateClause:
 
3037
                        retval = _equalCollateClause(a, b);
 
3038
                        break;
 
3039
                case T_SortBy:
 
3040
                        retval = _equalSortBy(a, b);
 
3041
                        break;
 
3042
                case T_WindowDef:
 
3043
                        retval = _equalWindowDef(a, b);
 
3044
                        break;
 
3045
                case T_RangeSubselect:
 
3046
                        retval = _equalRangeSubselect(a, b);
 
3047
                        break;
 
3048
                case T_RangeFunction:
 
3049
                        retval = _equalRangeFunction(a, b);
 
3050
                        break;
 
3051
                case T_TypeName:
 
3052
                        retval = _equalTypeName(a, b);
 
3053
                        break;
 
3054
                case T_IndexElem:
 
3055
                        retval = _equalIndexElem(a, b);
 
3056
                        break;
 
3057
                case T_ColumnDef:
 
3058
                        retval = _equalColumnDef(a, b);
 
3059
                        break;
 
3060
                case T_Constraint:
 
3061
                        retval = _equalConstraint(a, b);
 
3062
                        break;
 
3063
                case T_DefElem:
 
3064
                        retval = _equalDefElem(a, b);
 
3065
                        break;
 
3066
                case T_LockingClause:
 
3067
                        retval = _equalLockingClause(a, b);
 
3068
                        break;
 
3069
                case T_RangeTblEntry:
 
3070
                        retval = _equalRangeTblEntry(a, b);
 
3071
                        break;
 
3072
                case T_SortGroupClause:
 
3073
                        retval = _equalSortGroupClause(a, b);
 
3074
                        break;
 
3075
                case T_WindowClause:
 
3076
                        retval = _equalWindowClause(a, b);
 
3077
                        break;
 
3078
                case T_RowMarkClause:
 
3079
                        retval = _equalRowMarkClause(a, b);
 
3080
                        break;
 
3081
                case T_WithClause:
 
3082
                        retval = _equalWithClause(a, b);
 
3083
                        break;
 
3084
                case T_CommonTableExpr:
 
3085
                        retval = _equalCommonTableExpr(a, b);
 
3086
                        break;
 
3087
                case T_PrivGrantee:
 
3088
                        retval = _equalPrivGrantee(a, b);
 
3089
                        break;
 
3090
                case T_FuncWithArgs:
 
3091
                        retval = _equalFuncWithArgs(a, b);
 
3092
                        break;
 
3093
                case T_AccessPriv:
 
3094
                        retval = _equalAccessPriv(a, b);
 
3095
                        break;
 
3096
                case T_XmlSerialize:
 
3097
                        retval = _equalXmlSerialize(a, b);
 
3098
                        break;
 
3099
 
 
3100
                default:
 
3101
                        elog(ERROR, "unrecognized node type: %d",
 
3102
                                 (int) nodeTag(a));
 
3103
                        retval = false;         /* keep compiler quiet */
 
3104
                        break;
 
3105
        }
 
3106
 
 
3107
        return retval;
 
3108
}