1996-07-09 08:22:35 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* equalfuncs.c
|
2000-06-29 09:35:57 +02:00
|
|
|
* Equality functions to compare node trees.
|
|
|
|
*
|
|
|
|
* NOTE: a general convention when copying or comparing plan nodes is
|
|
|
|
* that we ignore the executor state subnode. We do not need to look
|
|
|
|
* at it because no current uses of copyObject() or equal() need to
|
2001-03-22 05:01:46 +01:00
|
|
|
* deal with already-executing plan trees. By leaving the state subnodes
|
2000-06-29 09:35:57 +02:00
|
|
|
* out, we avoid needing to write copy/compare routines for all the
|
|
|
|
* different executor state node types.
|
|
|
|
*
|
|
|
|
* Currently, in fact, equal() doesn't know how to compare Plan nodes
|
|
|
|
* at all, let alone their executor-state subnodes. This will probably
|
|
|
|
* need to be fixed someday, but presently there is no need to compare
|
|
|
|
* plan trees.
|
|
|
|
*
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
2001-01-24 20:43:33 +01:00
|
|
|
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
|
|
|
* IDENTIFICATION
|
2001-08-10 20:57:42 +02:00
|
|
|
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.100 2001/08/10 18:57:36 tgl Exp $
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
1997-01-10 21:19:49 +01:00
|
|
|
|
1996-07-09 08:22:35 +02:00
|
|
|
#include "postgres.h"
|
|
|
|
|
|
|
|
#include "nodes/plannodes.h"
|
1999-07-16 07:00:38 +02:00
|
|
|
#include "nodes/relation.h"
|
1996-07-09 08:22:35 +02:00
|
|
|
#include "utils/datum.h"
|
|
|
|
|
2000-08-12 01:45:35 +02:00
|
|
|
|
|
|
|
/* Macro for comparing string fields that might be NULL */
|
2001-03-22 05:01:46 +01:00
|
|
|
#define equalstr(a, b) \
|
2000-08-12 01:45:35 +02:00
|
|
|
(((a) != NULL && (b) != NULL) ? (strcmp(a, b) == 0) : (a) == (b))
|
|
|
|
|
1999-07-29 04:45:36 +02:00
|
|
|
|
1996-07-09 08:22:35 +02:00
|
|
|
/*
|
1997-09-07 07:04:48 +02:00
|
|
|
* Stuff from primnodes.h
|
1996-07-09 08:22:35 +02:00
|
|
|
*/
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
static bool
|
1997-09-08 23:56:23 +02:00
|
|
|
_equalResdom(Resdom *a, Resdom *b)
|
1996-07-09 08:22:35 +02:00
|
|
|
{
|
1997-09-07 07:04:48 +02:00
|
|
|
if (a->resno != b->resno)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
if (a->restype != b->restype)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1998-02-10 05:02:59 +01:00
|
|
|
if (a->restypmod != b->restypmod)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
2000-08-12 01:45:35 +02:00
|
|
|
if (!equalstr(a->resname, b->resname))
|
|
|
|
return false;
|
1999-08-21 05:49:17 +02:00
|
|
|
if (a->ressortgroupref != b->ressortgroupref)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
if (a->reskey != b->reskey)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
if (a->reskeyop != b->reskeyop)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1999-07-29 04:45:36 +02:00
|
|
|
/* we ignore resjunk flag ... is this correct? */
|
1997-09-07 07:04:48 +02:00
|
|
|
|
1998-09-01 05:29:17 +02:00
|
|
|
return true;
|
1996-07-09 08:22:35 +02:00
|
|
|
}
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
static bool
|
1997-09-08 23:56:23 +02:00
|
|
|
_equalFjoin(Fjoin *a, Fjoin *b)
|
1996-07-09 08:22:35 +02:00
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
int nNodes;
|
1997-09-07 07:04:48 +02:00
|
|
|
|
|
|
|
if (a->fj_initialized != b->fj_initialized)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
if (a->fj_nNodes != b->fj_nNodes)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
if (!equal(a->fj_innerNode, b->fj_innerNode))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
|
|
|
|
nNodes = a->fj_nNodes;
|
|
|
|
if (memcmp(a->fj_results, b->fj_results, nNodes * sizeof(Datum)) != 0)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
if (memcmp(a->fj_alwaysDone, b->fj_alwaysDone, nNodes * sizeof(bool)) != 0)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
|
1998-09-01 05:29:17 +02:00
|
|
|
return true;
|
1996-07-09 08:22:35 +02:00
|
|
|
}
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
static bool
|
1997-09-08 23:56:23 +02:00
|
|
|
_equalExpr(Expr *a, Expr *b)
|
1996-07-09 08:22:35 +02:00
|
|
|
{
|
2000-04-12 19:17:23 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* We do not examine typeOid, since the optimizer often doesn't bother
|
|
|
|
* to set it in created nodes, and it is logically a derivative of the
|
|
|
|
* oper field anyway.
|
1999-07-29 04:45:36 +02:00
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
if (a->opType != b->opType)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
if (!equal(a->oper, b->oper))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
if (!equal(a->args, b->args))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
|
1998-09-01 05:29:17 +02:00
|
|
|
return true;
|
1996-07-09 08:22:35 +02:00
|
|
|
}
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
static bool
|
1997-09-08 23:56:23 +02:00
|
|
|
_equalVar(Var *a, Var *b)
|
1996-07-09 08:22:35 +02:00
|
|
|
{
|
1997-09-07 07:04:48 +02:00
|
|
|
if (a->varno != b->varno)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
if (a->varattno != b->varattno)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
if (a->vartype != b->vartype)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1998-02-10 05:02:59 +01:00
|
|
|
if (a->vartypmod != b->vartypmod)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1998-01-20 23:12:17 +01:00
|
|
|
if (a->varlevelsup != b->varlevelsup)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
if (a->varnoold != b->varnoold)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
if (a->varoattno != b->varoattno)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
|
1998-09-01 05:29:17 +02:00
|
|
|
return true;
|
1996-07-09 08:22:35 +02:00
|
|
|
}
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
static bool
|
1997-09-08 23:56:23 +02:00
|
|
|
_equalOper(Oper *a, Oper *b)
|
1996-07-09 08:22:35 +02:00
|
|
|
{
|
1997-09-07 07:04:48 +02:00
|
|
|
if (a->opno != b->opno)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
if (a->opresulttype != b->opresulttype)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
2000-04-12 19:17:23 +02:00
|
|
|
|
|
|
|
/*
|
2001-03-22 05:01:46 +01:00
|
|
|
* We do not examine opid or op_fcache, since these are logically
|
|
|
|
* derived from opno, and they may not be set yet depending on how far
|
|
|
|
* along the node is in the parse/plan pipeline.
|
1999-07-29 04:45:36 +02:00
|
|
|
*
|
2000-08-12 01:45:35 +02:00
|
|
|
* (Besides, op_fcache is executor state, which we don't check --- see
|
|
|
|
* notes at head of file.)
|
|
|
|
*
|
1999-07-29 04:45:36 +02:00
|
|
|
* It's probably not really necessary to check opresulttype either...
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
|
1998-09-01 05:29:17 +02:00
|
|
|
return true;
|
1996-07-09 08:22:35 +02:00
|
|
|
}
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
static bool
|
1997-09-08 23:56:23 +02:00
|
|
|
_equalConst(Const *a, Const *b)
|
1996-07-09 08:22:35 +02:00
|
|
|
{
|
1997-09-07 07:04:48 +02:00
|
|
|
if (a->consttype != b->consttype)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
if (a->constlen != b->constlen)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
if (a->constisnull != b->constisnull)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
if (a->constbyval != b->constbyval)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1999-07-29 04:45:36 +02:00
|
|
|
/* XXX What about constisset and constiscast? */
|
2000-04-12 19:17:23 +02:00
|
|
|
|
1999-12-24 07:43:34 +01:00
|
|
|
/*
|
2000-04-12 19:17:23 +02:00
|
|
|
* We treat all NULL constants of the same type as equal. Someday this
|
|
|
|
* might need to change? But datumIsEqual doesn't work on nulls,
|
|
|
|
* so...
|
1999-12-24 07:43:34 +01:00
|
|
|
*/
|
|
|
|
if (a->constisnull)
|
|
|
|
return true;
|
2000-07-12 04:37:39 +02:00
|
|
|
return datumIsEqual(a->constvalue, b->constvalue,
|
|
|
|
a->constbyval, a->constlen);
|
1996-07-09 08:22:35 +02:00
|
|
|
}
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
static bool
|
1997-09-08 23:56:23 +02:00
|
|
|
_equalParam(Param *a, Param *b)
|
1996-07-09 08:22:35 +02:00
|
|
|
{
|
1997-09-07 07:04:48 +02:00
|
|
|
if (a->paramkind != b->paramkind)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
if (a->paramtype != b->paramtype)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
|
|
|
|
switch (a->paramkind)
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
case PARAM_NAMED:
|
|
|
|
case PARAM_NEW:
|
|
|
|
case PARAM_OLD:
|
|
|
|
if (strcmp(a->paramname, b->paramname) != 0)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-08 04:41:22 +02:00
|
|
|
break;
|
|
|
|
case PARAM_NUM:
|
1998-02-13 04:27:47 +01:00
|
|
|
case PARAM_EXEC:
|
1997-09-08 04:41:22 +02:00
|
|
|
if (a->paramid != b->paramid)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-08 04:41:22 +02:00
|
|
|
break;
|
|
|
|
case PARAM_INVALID:
|
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX: Hmmm... What are we supposed to return in this case ??
|
|
|
|
*/
|
1998-09-01 05:29:17 +02:00
|
|
|
return true;
|
1997-09-08 04:41:22 +02:00
|
|
|
break;
|
|
|
|
default:
|
1998-01-07 22:07:04 +01:00
|
|
|
elog(ERROR, "_equalParam: Invalid paramkind value: %d",
|
1997-09-08 04:41:22 +02:00
|
|
|
a->paramkind);
|
1997-09-07 07:04:48 +02:00
|
|
|
}
|
|
|
|
|
1998-09-01 05:29:17 +02:00
|
|
|
return true;
|
1996-07-09 08:22:35 +02:00
|
|
|
}
|
|
|
|
|
1999-07-29 04:45:36 +02:00
|
|
|
static bool
|
|
|
|
_equalFunc(Func *a, Func *b)
|
|
|
|
{
|
|
|
|
if (a->funcid != b->funcid)
|
|
|
|
return false;
|
|
|
|
if (a->functype != b->functype)
|
|
|
|
return false;
|
2000-08-08 17:43:12 +02:00
|
|
|
/* Note we do not look at func_fcache; see notes for _equalOper */
|
1999-07-29 04:45:36 +02:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
1999-06-06 19:46:40 +02:00
|
|
|
static bool
|
|
|
|
_equalAggref(Aggref *a, Aggref *b)
|
|
|
|
{
|
|
|
|
if (strcmp(a->aggname, b->aggname) != 0)
|
|
|
|
return false;
|
|
|
|
if (a->basetype != b->basetype)
|
|
|
|
return false;
|
|
|
|
if (a->aggtype != b->aggtype)
|
|
|
|
return false;
|
|
|
|
if (!equal(a->target, b->target))
|
|
|
|
return false;
|
1999-12-13 02:27:21 +01:00
|
|
|
if (a->aggstar != b->aggstar)
|
|
|
|
return false;
|
|
|
|
if (a->aggdistinct != b->aggdistinct)
|
|
|
|
return false;
|
1999-08-21 05:49:17 +02:00
|
|
|
/* ignore aggno, which is only a private field for the executor */
|
1999-06-06 19:46:40 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
1999-09-26 04:28:44 +02:00
|
|
|
static bool
|
|
|
|
_equalSubLink(SubLink *a, SubLink *b)
|
|
|
|
{
|
|
|
|
if (a->subLinkType != b->subLinkType)
|
|
|
|
return false;
|
|
|
|
if (a->useor != b->useor)
|
|
|
|
return false;
|
|
|
|
if (!equal(a->lefthand, b->lefthand))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->oper, b->oper))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->subselect, b->subselect))
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2000-09-12 23:07:18 +02:00
|
|
|
static bool
|
|
|
|
_equalArrayRef(ArrayRef *a, ArrayRef *b)
|
|
|
|
{
|
|
|
|
if (a->refelemtype != b->refelemtype)
|
|
|
|
return false;
|
|
|
|
if (a->refattrlength != b->refattrlength)
|
|
|
|
return false;
|
|
|
|
if (a->refelemlength != b->refelemlength)
|
|
|
|
return false;
|
|
|
|
if (a->refelembyval != b->refelembyval)
|
|
|
|
return false;
|
|
|
|
if (!equal(a->refupperindexpr, b->refupperindexpr))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->reflowerindexpr, b->reflowerindexpr))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->refexpr, b->refexpr))
|
|
|
|
return false;
|
|
|
|
return equal(a->refassgnexpr, b->refassgnexpr);
|
|
|
|
}
|
|
|
|
|
2000-08-08 17:43:12 +02:00
|
|
|
static bool
|
|
|
|
_equalFieldSelect(FieldSelect *a, FieldSelect *b)
|
|
|
|
{
|
|
|
|
if (!equal(a->arg, b->arg))
|
|
|
|
return false;
|
|
|
|
if (a->fieldnum != b->fieldnum)
|
|
|
|
return false;
|
|
|
|
if (a->resulttype != b->resulttype)
|
|
|
|
return false;
|
|
|
|
if (a->resulttypmod != b->resulttypmod)
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2000-02-20 22:32:16 +01:00
|
|
|
static bool
|
|
|
|
_equalRelabelType(RelabelType *a, RelabelType *b)
|
|
|
|
{
|
|
|
|
if (!equal(a->arg, b->arg))
|
|
|
|
return false;
|
|
|
|
if (a->resulttype != b->resulttype)
|
|
|
|
return false;
|
|
|
|
if (a->resulttypmod != b->resulttypmod)
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
static bool
|
2000-09-12 23:07:18 +02:00
|
|
|
_equalRangeTblRef(RangeTblRef *a, RangeTblRef *b)
|
1996-07-09 08:22:35 +02:00
|
|
|
{
|
2000-09-12 23:07:18 +02:00
|
|
|
if (a->rtindex != b->rtindex)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
2000-09-12 23:07:18 +02:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2000-09-29 20:21:41 +02:00
|
|
|
static bool
|
|
|
|
_equalFromExpr(FromExpr *a, FromExpr *b)
|
|
|
|
{
|
|
|
|
if (!equal(a->fromlist, b->fromlist))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->quals, b->quals))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2000-09-12 23:07:18 +02:00
|
|
|
static bool
|
|
|
|
_equalJoinExpr(JoinExpr *a, JoinExpr *b)
|
|
|
|
{
|
|
|
|
if (a->jointype != b->jointype)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
2000-09-12 23:07:18 +02:00
|
|
|
if (a->isNatural != b->isNatural)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
2000-09-12 23:07:18 +02:00
|
|
|
if (!equal(a->larg, b->larg))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
2000-09-12 23:07:18 +02:00
|
|
|
if (!equal(a->rarg, b->rarg))
|
1999-07-29 04:45:36 +02:00
|
|
|
return false;
|
2000-09-12 23:07:18 +02:00
|
|
|
if (!equal(a->using, b->using))
|
1999-07-29 04:45:36 +02:00
|
|
|
return false;
|
2000-09-12 23:07:18 +02:00
|
|
|
if (!equal(a->quals, b->quals))
|
1999-07-29 04:45:36 +02:00
|
|
|
return false;
|
2000-09-12 23:07:18 +02:00
|
|
|
if (!equal(a->alias, b->alias))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->colnames, b->colnames))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->colvars, b->colvars))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
1996-07-09 08:22:35 +02:00
|
|
|
}
|
|
|
|
|
1998-08-02 00:12:13 +02:00
|
|
|
/*
|
1999-07-29 04:45:36 +02:00
|
|
|
* Stuff from relation.h
|
1998-08-02 00:12:13 +02:00
|
|
|
*/
|
1999-07-29 04:45:36 +02:00
|
|
|
|
1998-08-02 00:12:13 +02:00
|
|
|
static bool
|
1999-05-26 00:43:53 +02:00
|
|
|
_equalRelOptInfo(RelOptInfo *a, RelOptInfo *b)
|
1998-08-02 00:12:13 +02:00
|
|
|
{
|
2000-04-12 19:17:23 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* We treat RelOptInfos as equal if they refer to the same base rels
|
2000-09-29 20:21:41 +02:00
|
|
|
* joined in the same order. Is this appropriate/sufficient?
|
1999-07-29 04:45:36 +02:00
|
|
|
*/
|
1999-08-16 04:17:58 +02:00
|
|
|
return equali(a->relids, b->relids);
|
1998-08-02 00:12:13 +02:00
|
|
|
}
|
|
|
|
|
2000-01-09 01:26:47 +01:00
|
|
|
static bool
|
|
|
|
_equalIndexOptInfo(IndexOptInfo *a, IndexOptInfo *b)
|
|
|
|
{
|
2000-04-12 19:17:23 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* We treat IndexOptInfos as equal if they refer to the same index. Is
|
|
|
|
* this sufficient?
|
2000-01-09 01:26:47 +01:00
|
|
|
*/
|
|
|
|
if (a->indexoid != b->indexoid)
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
static bool
|
1999-08-16 04:17:58 +02:00
|
|
|
_equalPathKeyItem(PathKeyItem *a, PathKeyItem *b)
|
1996-07-09 08:22:35 +02:00
|
|
|
{
|
1999-08-16 04:17:58 +02:00
|
|
|
if (a->sortop != b->sortop)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1999-08-16 04:17:58 +02:00
|
|
|
if (!equal(a->key, b->key))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
|
|
|
return true;
|
1996-07-09 08:22:35 +02:00
|
|
|
}
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
static bool
|
1997-09-08 23:56:23 +02:00
|
|
|
_equalPath(Path *a, Path *b)
|
1996-07-09 08:22:35 +02:00
|
|
|
{
|
1997-09-07 07:04:48 +02:00
|
|
|
if (a->pathtype != b->pathtype)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1999-08-16 04:17:58 +02:00
|
|
|
if (!equal(a->parent, b->parent))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
2000-04-12 19:17:23 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* do not check path costs, since they may not be set yet, and being
|
2000-02-15 21:49:31 +01:00
|
|
|
* float values there are roundoff error issues anyway...
|
1997-09-07 07:04:48 +02:00
|
|
|
*/
|
1999-02-10 04:52:54 +01:00
|
|
|
if (!equal(a->pathkeys, b->pathkeys))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
|
|
|
return true;
|
1996-07-09 08:22:35 +02:00
|
|
|
}
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
static bool
|
1997-09-08 23:56:23 +02:00
|
|
|
_equalIndexPath(IndexPath *a, IndexPath *b)
|
1996-07-09 08:22:35 +02:00
|
|
|
{
|
1997-09-07 07:04:48 +02:00
|
|
|
if (!_equalPath((Path *) a, (Path *) b))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
2001-05-20 22:28:20 +02:00
|
|
|
if (!equal(a->indexinfo, b->indexinfo))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1999-02-03 21:15:53 +01:00
|
|
|
if (!equal(a->indexqual, b->indexqual))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
2000-02-15 21:49:31 +01:00
|
|
|
if (a->indexscandir != b->indexscandir)
|
|
|
|
return false;
|
1999-08-16 04:17:58 +02:00
|
|
|
if (!equali(a->joinrelids, b->joinrelids))
|
|
|
|
return false;
|
2000-09-12 23:07:18 +02:00
|
|
|
if (a->alljoinquals != b->alljoinquals)
|
|
|
|
return false;
|
2000-04-12 19:17:23 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Skip 'rows' because of possibility of floating-point roundoff
|
|
|
|
* error. It should be derivable from the other fields anyway.
|
2000-03-22 23:08:35 +01:00
|
|
|
*/
|
1998-09-01 05:29:17 +02:00
|
|
|
return true;
|
1996-07-09 08:22:35 +02:00
|
|
|
}
|
|
|
|
|
1999-11-23 21:07:06 +01:00
|
|
|
static bool
|
|
|
|
_equalTidPath(TidPath *a, TidPath *b)
|
|
|
|
{
|
|
|
|
if (!_equalPath((Path *) a, (Path *) b))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->tideval, b->tideval))
|
|
|
|
return false;
|
|
|
|
if (!equali(a->unjoined_relids, b->unjoined_relids))
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2000-11-12 01:37:02 +01:00
|
|
|
static bool
|
|
|
|
_equalAppendPath(AppendPath *a, AppendPath *b)
|
|
|
|
{
|
|
|
|
if (!_equalPath((Path *) a, (Path *) b))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->subpaths, b->subpaths))
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
static bool
|
1999-08-16 04:17:58 +02:00
|
|
|
_equalJoinPath(JoinPath *a, JoinPath *b)
|
1996-07-09 08:22:35 +02:00
|
|
|
{
|
1997-09-07 07:04:48 +02:00
|
|
|
if (!_equalPath((Path *) a, (Path *) b))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
2000-09-12 23:07:18 +02:00
|
|
|
if (a->jointype != b->jointype)
|
|
|
|
return false;
|
1999-02-03 21:15:53 +01:00
|
|
|
if (!equal(a->outerjoinpath, b->outerjoinpath))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1999-02-03 21:15:53 +01:00
|
|
|
if (!equal(a->innerjoinpath, b->innerjoinpath))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
2000-02-07 05:41:04 +01:00
|
|
|
if (!equal(a->joinrestrictinfo, b->joinrestrictinfo))
|
|
|
|
return false;
|
1998-09-01 05:29:17 +02:00
|
|
|
return true;
|
1996-07-09 08:22:35 +02:00
|
|
|
}
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
static bool
|
1999-08-16 04:17:58 +02:00
|
|
|
_equalNestPath(NestPath *a, NestPath *b)
|
1996-07-09 08:22:35 +02:00
|
|
|
{
|
1999-08-16 04:17:58 +02:00
|
|
|
if (!_equalJoinPath((JoinPath *) a, (JoinPath *) b))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
|
|
|
return true;
|
1996-07-09 08:22:35 +02:00
|
|
|
}
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
static bool
|
1999-08-16 04:17:58 +02:00
|
|
|
_equalMergePath(MergePath *a, MergePath *b)
|
1996-07-09 08:22:35 +02:00
|
|
|
{
|
1999-08-16 04:17:58 +02:00
|
|
|
if (!_equalJoinPath((JoinPath *) a, (JoinPath *) b))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1999-08-16 04:17:58 +02:00
|
|
|
if (!equal(a->path_mergeclauses, b->path_mergeclauses))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1999-08-16 04:17:58 +02:00
|
|
|
if (!equal(a->outersortkeys, b->outersortkeys))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1999-08-16 04:17:58 +02:00
|
|
|
if (!equal(a->innersortkeys, b->innersortkeys))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
|
|
|
return true;
|
1996-07-09 08:22:35 +02:00
|
|
|
}
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
static bool
|
1999-08-16 04:17:58 +02:00
|
|
|
_equalHashPath(HashPath *a, HashPath *b)
|
1996-07-09 08:22:35 +02:00
|
|
|
{
|
1999-08-16 04:17:58 +02:00
|
|
|
if (!_equalJoinPath((JoinPath *) a, (JoinPath *) b))
|
1999-07-29 04:45:36 +02:00
|
|
|
return false;
|
1999-08-16 04:17:58 +02:00
|
|
|
if (!equal(a->path_hashclauses, b->path_hashclauses))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
|
|
|
return true;
|
1996-07-09 08:22:35 +02:00
|
|
|
}
|
|
|
|
|
1998-02-13 04:27:47 +01:00
|
|
|
static bool
|
|
|
|
_equalSubPlan(SubPlan *a, SubPlan *b)
|
|
|
|
{
|
1999-11-15 04:28:07 +01:00
|
|
|
/* should compare plans, but have to settle for comparing plan IDs */
|
1998-02-13 04:27:47 +01:00
|
|
|
if (a->plan_id != b->plan_id)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1998-02-13 04:27:47 +01:00
|
|
|
|
1999-11-15 04:28:07 +01:00
|
|
|
if (!equal(a->rtable, b->rtable))
|
|
|
|
return false;
|
|
|
|
|
1999-09-26 04:28:44 +02:00
|
|
|
if (!equal(a->sublink, b->sublink))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1998-02-26 05:46:47 +01:00
|
|
|
|
1998-09-01 05:29:17 +02:00
|
|
|
return true;
|
1998-02-13 04:27:47 +01:00
|
|
|
}
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
static bool
|
1999-08-16 04:17:58 +02:00
|
|
|
_equalRestrictInfo(RestrictInfo *a, RestrictInfo *b)
|
1996-07-09 08:22:35 +02:00
|
|
|
{
|
1999-08-16 04:17:58 +02:00
|
|
|
if (!equal(a->clause, b->clause))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
2000-09-29 20:21:41 +02:00
|
|
|
if (a->ispusheddown != b->ispusheddown)
|
2000-09-12 23:07:18 +02:00
|
|
|
return false;
|
2001-06-05 07:26:05 +02:00
|
|
|
/*
|
|
|
|
* We ignore eval_cost, this_selec, left/right_pathkey, and
|
|
|
|
* left/right_bucketsize, since they may not be set yet, and should be
|
|
|
|
* derivable from the clause anyway. Probably it's not really necessary
|
|
|
|
* to compare any of these remaining fields ...
|
|
|
|
*/
|
1999-08-16 04:17:58 +02:00
|
|
|
if (!equal(a->subclauseindices, b->subclauseindices))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1999-08-16 04:17:58 +02:00
|
|
|
if (a->mergejoinoperator != b->mergejoinoperator)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1999-08-16 04:17:58 +02:00
|
|
|
if (a->left_sortop != b->left_sortop)
|
|
|
|
return false;
|
|
|
|
if (a->right_sortop != b->right_sortop)
|
|
|
|
return false;
|
|
|
|
if (a->hashjoinoperator != b->hashjoinoperator)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
|
|
|
return true;
|
1996-07-09 08:22:35 +02:00
|
|
|
}
|
|
|
|
|
1999-07-29 04:45:36 +02:00
|
|
|
static bool
|
1999-08-16 04:17:58 +02:00
|
|
|
_equalJoinInfo(JoinInfo *a, JoinInfo *b)
|
1999-07-29 04:45:36 +02:00
|
|
|
{
|
1999-08-16 04:17:58 +02:00
|
|
|
if (!equali(a->unjoined_relids, b->unjoined_relids))
|
1999-07-29 04:45:36 +02:00
|
|
|
return false;
|
1999-08-16 04:17:58 +02:00
|
|
|
if (!equal(a->jinfo_restrictinfo, b->jinfo_restrictinfo))
|
1999-07-29 04:45:36 +02:00
|
|
|
return false;
|
1999-08-16 04:17:58 +02:00
|
|
|
return true;
|
1999-07-29 04:45:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalIter(Iter *a, Iter *b)
|
|
|
|
{
|
|
|
|
return equal(a->iterexpr, b->iterexpr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalStream(Stream *a, Stream *b)
|
|
|
|
{
|
|
|
|
if (a->clausetype != b->clausetype)
|
|
|
|
return false;
|
|
|
|
if (a->groupup != b->groupup)
|
|
|
|
return false;
|
|
|
|
if (a->groupcost != b->groupcost)
|
|
|
|
return false;
|
|
|
|
if (a->groupsel != b->groupsel)
|
|
|
|
return false;
|
|
|
|
if (!equal(a->pathptr, b->pathptr))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->cinfo, b->cinfo))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->upstream, b->upstream))
|
|
|
|
return false;
|
|
|
|
return equal(a->downstream, b->downstream);
|
|
|
|
}
|
|
|
|
|
1999-02-07 01:52:12 +01:00
|
|
|
/*
|
|
|
|
* Stuff from parsenodes.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalQuery(Query *a, Query *b)
|
|
|
|
{
|
|
|
|
if (a->commandType != b->commandType)
|
|
|
|
return false;
|
|
|
|
if (!equal(a->utilityStmt, b->utilityStmt))
|
|
|
|
return false;
|
|
|
|
if (a->resultRelation != b->resultRelation)
|
|
|
|
return false;
|
2000-08-12 01:45:35 +02:00
|
|
|
if (!equalstr(a->into, b->into))
|
|
|
|
return false;
|
1999-02-07 01:52:12 +01:00
|
|
|
if (a->isPortal != b->isPortal)
|
|
|
|
return false;
|
|
|
|
if (a->isBinary != b->isBinary)
|
|
|
|
return false;
|
|
|
|
if (a->isTemp != b->isTemp)
|
|
|
|
return false;
|
|
|
|
if (a->hasAggs != b->hasAggs)
|
|
|
|
return false;
|
|
|
|
if (a->hasSubLinks != b->hasSubLinks)
|
|
|
|
return false;
|
1999-08-21 05:49:17 +02:00
|
|
|
if (!equal(a->rtable, b->rtable))
|
|
|
|
return false;
|
2000-09-12 23:07:18 +02:00
|
|
|
if (!equal(a->jointree, b->jointree))
|
|
|
|
return false;
|
2000-09-29 20:21:41 +02:00
|
|
|
if (!equali(a->rowMarks, b->rowMarks))
|
1999-08-21 05:49:17 +02:00
|
|
|
return false;
|
2000-10-05 21:11:39 +02:00
|
|
|
if (!equal(a->targetList, b->targetList))
|
1999-02-07 01:52:12 +01:00
|
|
|
return false;
|
|
|
|
if (!equal(a->groupClause, b->groupClause))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->havingQual, b->havingQual))
|
|
|
|
return false;
|
2000-10-05 21:11:39 +02:00
|
|
|
if (!equal(a->distinctClause, b->distinctClause))
|
1999-02-07 01:52:12 +01:00
|
|
|
return false;
|
2000-10-05 21:11:39 +02:00
|
|
|
if (!equal(a->sortClause, b->sortClause))
|
1999-02-07 01:52:12 +01:00
|
|
|
return false;
|
|
|
|
if (!equal(a->limitOffset, b->limitOffset))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->limitCount, b->limitCount))
|
|
|
|
return false;
|
2000-10-05 21:11:39 +02:00
|
|
|
if (!equal(a->setOperations, b->setOperations))
|
|
|
|
return false;
|
2000-11-12 01:37:02 +01:00
|
|
|
if (!equali(a->resultRelations, b->resultRelations))
|
|
|
|
return false;
|
1999-02-07 01:52:12 +01:00
|
|
|
|
1999-05-25 18:15:34 +02:00
|
|
|
/*
|
1999-08-21 05:49:17 +02:00
|
|
|
* We do not check the internal-to-the-planner fields: base_rel_list,
|
2001-05-20 22:28:20 +02:00
|
|
|
* other_rel_list, join_rel_list, equi_key_list, query_pathkeys.
|
|
|
|
* They might not be set yet, and in any case they should be derivable
|
|
|
|
* from the other fields.
|
1999-02-07 01:52:12 +01:00
|
|
|
*/
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
2000-08-12 01:45:35 +02:00
|
|
|
_equalInsertStmt(InsertStmt *a, InsertStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->relname, b->relname))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->cols, b->cols))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->targetList, b->targetList))
|
|
|
|
return false;
|
2000-10-05 21:11:39 +02:00
|
|
|
if (!equal(a->selectStmt, b->selectStmt))
|
2000-08-12 01:45:35 +02:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalDeleteStmt(DeleteStmt *a, DeleteStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->relname, b->relname))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->whereClause, b->whereClause))
|
|
|
|
return false;
|
2001-01-05 07:34:23 +01:00
|
|
|
if (a->inhOpt != b->inhOpt)
|
2000-08-12 01:45:35 +02:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalUpdateStmt(UpdateStmt *a, UpdateStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->relname, b->relname))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->targetList, b->targetList))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->whereClause, b->whereClause))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->fromClause, b->fromClause))
|
|
|
|
return false;
|
2001-01-05 07:34:23 +01:00
|
|
|
if (a->inhOpt != b->inhOpt)
|
2000-08-12 01:45:35 +02:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalSelectStmt(SelectStmt *a, SelectStmt *b)
|
|
|
|
{
|
|
|
|
if (!equal(a->distinctClause, b->distinctClause))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->into, b->into))
|
|
|
|
return false;
|
2000-11-05 01:15:54 +01:00
|
|
|
if (a->istemp != b->istemp)
|
|
|
|
return false;
|
2000-08-12 01:45:35 +02:00
|
|
|
if (!equal(a->targetList, b->targetList))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->fromClause, b->fromClause))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->whereClause, b->whereClause))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->groupClause, b->groupClause))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->havingClause, b->havingClause))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->sortClause, b->sortClause))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->portalname, b->portalname))
|
|
|
|
return false;
|
|
|
|
if (a->binary != b->binary)
|
|
|
|
return false;
|
|
|
|
if (!equal(a->limitOffset, b->limitOffset))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->limitCount, b->limitCount))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->forUpdate, b->forUpdate))
|
|
|
|
return false;
|
2000-11-05 01:15:54 +01:00
|
|
|
if (a->op != b->op)
|
|
|
|
return false;
|
|
|
|
if (a->all != b->all)
|
|
|
|
return false;
|
|
|
|
if (!equal(a->larg, b->larg))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->rarg, b->rarg))
|
|
|
|
return false;
|
2000-08-12 01:45:35 +02:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2000-10-05 21:11:39 +02:00
|
|
|
static bool
|
|
|
|
_equalSetOperationStmt(SetOperationStmt *a, SetOperationStmt *b)
|
|
|
|
{
|
|
|
|
if (a->op != b->op)
|
|
|
|
return false;
|
|
|
|
if (a->all != b->all)
|
|
|
|
return false;
|
|
|
|
if (!equal(a->larg, b->larg))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->rarg, b->rarg))
|
|
|
|
return false;
|
|
|
|
if (!equali(a->colTypes, b->colTypes))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2000-08-12 01:45:35 +02:00
|
|
|
static bool
|
|
|
|
_equalAlterTableStmt(AlterTableStmt *a, AlterTableStmt *b)
|
1999-02-07 01:52:12 +01:00
|
|
|
{
|
2000-08-12 01:45:35 +02:00
|
|
|
if (a->subtype != b->subtype)
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->relname, b->relname))
|
|
|
|
return false;
|
2001-01-05 07:34:23 +01:00
|
|
|
if (a->inhOpt != b->inhOpt)
|
2000-08-12 01:45:35 +02:00
|
|
|
return false;
|
|
|
|
if (!equalstr(a->name, b->name))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->def, b->def))
|
|
|
|
return false;
|
|
|
|
if (a->behavior != b->behavior)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
2001-06-10 01:21:55 +02:00
|
|
|
_equalGrantStmt(GrantStmt *a, GrantStmt *b)
|
2000-08-12 01:45:35 +02:00
|
|
|
{
|
2001-06-10 01:21:55 +02:00
|
|
|
if (a->is_grant != b->is_grant)
|
1999-02-07 01:52:12 +01:00
|
|
|
return false;
|
2001-06-10 01:21:55 +02:00
|
|
|
if (!equal(a->relnames, b->relnames))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->privileges, b->privileges))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->grantees, b->grantees))
|
2000-10-07 02:58:23 +02:00
|
|
|
return false;
|
2000-08-12 01:45:35 +02:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2001-06-10 01:21:55 +02:00
|
|
|
static bool
|
|
|
|
_equalPrivGrantee(PrivGrantee *a, PrivGrantee *b)
|
|
|
|
{
|
|
|
|
return equalstr(a->username, b->username)
|
|
|
|
&& equalstr(a->groupname, b->groupname);
|
|
|
|
}
|
|
|
|
|
2000-08-12 01:45:35 +02:00
|
|
|
static bool
|
|
|
|
_equalClosePortalStmt(ClosePortalStmt *a, ClosePortalStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->portalname, b->portalname))
|
1999-02-07 01:52:12 +01:00
|
|
|
return false;
|
2000-08-12 01:45:35 +02:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalClusterStmt(ClusterStmt *a, ClusterStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->relname, b->relname))
|
1999-10-07 06:23:24 +02:00
|
|
|
return false;
|
2000-08-12 01:45:35 +02:00
|
|
|
if (!equalstr(a->indexname, b->indexname))
|
1999-02-07 01:52:12 +01:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2000-01-31 02:21:39 +01:00
|
|
|
static bool
|
2000-08-12 01:45:35 +02:00
|
|
|
_equalCopyStmt(CopyStmt *a, CopyStmt *b)
|
2000-01-31 02:21:39 +01:00
|
|
|
{
|
2000-08-12 01:45:35 +02:00
|
|
|
if (a->binary != b->binary)
|
2000-01-31 02:21:39 +01:00
|
|
|
return false;
|
2000-08-12 01:45:35 +02:00
|
|
|
if (!equalstr(a->relname, b->relname))
|
|
|
|
return false;
|
|
|
|
if (a->oids != b->oids)
|
|
|
|
return false;
|
|
|
|
if (a->direction != b->direction)
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->filename, b->filename))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->delimiter, b->delimiter))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->null_print, b->null_print))
|
2000-01-31 02:21:39 +01:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2000-06-29 09:35:57 +02:00
|
|
|
static bool
|
2000-08-12 01:45:35 +02:00
|
|
|
_equalCreateStmt(CreateStmt *a, CreateStmt *b)
|
2000-06-29 09:35:57 +02:00
|
|
|
{
|
2000-08-12 01:45:35 +02:00
|
|
|
if (!equalstr(a->relname, b->relname))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->tableElts, b->tableElts))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->inhRelnames, b->inhRelnames))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->constraints, b->constraints))
|
2000-06-29 09:35:57 +02:00
|
|
|
return false;
|
2001-08-10 20:57:42 +02:00
|
|
|
if (a->istemp != b->istemp)
|
|
|
|
return false;
|
|
|
|
if (a->hasoids != b->hasoids)
|
|
|
|
return false;
|
2000-06-29 09:35:57 +02:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
static bool
|
2000-08-12 01:45:35 +02:00
|
|
|
_equalVersionStmt(VersionStmt *a, VersionStmt *b)
|
1996-08-26 08:32:06 +02:00
|
|
|
{
|
2000-08-12 01:45:35 +02:00
|
|
|
if (!equalstr(a->relname, b->relname))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
2000-08-12 01:45:35 +02:00
|
|
|
if (a->direction != b->direction)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
2000-08-12 01:45:35 +02:00
|
|
|
if (!equalstr(a->fromRelname, b->fromRelname))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->date, b->date))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
|
1998-09-01 05:29:17 +02:00
|
|
|
return true;
|
1996-08-26 08:32:06 +02:00
|
|
|
}
|
|
|
|
|
1999-07-29 04:45:36 +02:00
|
|
|
static bool
|
2000-08-12 01:45:35 +02:00
|
|
|
_equalDefineStmt(DefineStmt *a, DefineStmt *b)
|
1999-07-29 04:45:36 +02:00
|
|
|
{
|
2000-08-12 01:45:35 +02:00
|
|
|
if (a->defType != b->defType)
|
1999-07-29 04:45:36 +02:00
|
|
|
return false;
|
2000-08-12 01:45:35 +02:00
|
|
|
if (!equalstr(a->defname, b->defname))
|
1999-07-29 04:45:36 +02:00
|
|
|
return false;
|
2000-08-12 01:45:35 +02:00
|
|
|
if (!equal(a->definition, b->definition))
|
1999-07-29 04:45:36 +02:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
2000-08-12 01:45:35 +02:00
|
|
|
_equalDropStmt(DropStmt *a, DropStmt *b)
|
1999-07-29 04:45:36 +02:00
|
|
|
{
|
2000-10-18 18:16:18 +02:00
|
|
|
if (!equal(a->names, b->names))
|
1999-07-29 04:45:36 +02:00
|
|
|
return false;
|
2000-10-18 18:16:18 +02:00
|
|
|
if (a->removeType != b->removeType)
|
1999-07-29 04:45:36 +02:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2000-08-12 01:45:35 +02:00
|
|
|
static bool
|
|
|
|
_equalTruncateStmt(TruncateStmt *a, TruncateStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->relName, b->relName))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
1999-02-07 01:52:12 +01:00
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
static bool
|
2000-08-12 01:45:35 +02:00
|
|
|
_equalCommentStmt(CommentStmt *a, CommentStmt *b)
|
1996-07-09 08:22:35 +02:00
|
|
|
{
|
2000-08-12 01:45:35 +02:00
|
|
|
if (a->objtype != b->objtype)
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->objname, b->objname))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->objproperty, b->objproperty))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->objlist, b->objlist))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->comment, b->comment))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
|
2000-08-12 01:45:35 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalFetchStmt(FetchStmt *a, FetchStmt *b)
|
1996-07-09 08:22:35 +02:00
|
|
|
{
|
2000-08-12 01:45:35 +02:00
|
|
|
if (a->direction != b->direction)
|
|
|
|
return false;
|
|
|
|
if (a->howMany != b->howMany)
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->portalname, b->portalname))
|
|
|
|
return false;
|
|
|
|
if (a->ismove != b->ismove)
|
|
|
|
return false;
|
1996-07-09 08:22:35 +02:00
|
|
|
|
2000-08-12 01:45:35 +02:00
|
|
|
return true;
|
|
|
|
}
|
1997-09-07 07:04:48 +02:00
|
|
|
|
2000-08-12 01:45:35 +02:00
|
|
|
static bool
|
|
|
|
_equalIndexStmt(IndexStmt *a, IndexStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->idxname, b->idxname))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->relname, b->relname))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->accessMethod, b->accessMethod))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->indexParams, b->indexParams))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->withClause, b->withClause))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->whereClause, b->whereClause))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->rangetable, b->rangetable))
|
|
|
|
return false;
|
|
|
|
if (a->unique != b->unique)
|
|
|
|
return false;
|
|
|
|
if (a->primary != b->primary)
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
|
2000-08-12 01:45:35 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalProcedureStmt(ProcedureStmt *a, ProcedureStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->funcname, b->funcname))
|
|
|
|
return false;
|
2000-10-07 02:58:23 +02:00
|
|
|
if (!equal(a->argTypes, b->argTypes))
|
2000-08-12 01:45:35 +02:00
|
|
|
return false;
|
|
|
|
if (!equal(a->returnType, b->returnType))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->withClause, b->withClause))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->as, b->as))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->language, b->language))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-07 07:04:48 +02:00
|
|
|
|
2000-08-12 01:45:35 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalRemoveAggrStmt(RemoveAggrStmt *a, RemoveAggrStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->aggname, b->aggname))
|
|
|
|
return false;
|
2000-10-07 02:58:23 +02:00
|
|
|
if (!equal(a->aggtype, b->aggtype))
|
2000-08-12 01:45:35 +02:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalRemoveFuncStmt(RemoveFuncStmt *a, RemoveFuncStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->funcname, b->funcname))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->args, b->args))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalRemoveOperStmt(RemoveOperStmt *a, RemoveOperStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->opname, b->opname))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->args, b->args))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalRenameStmt(RenameStmt *a, RenameStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->relname, b->relname))
|
|
|
|
return false;
|
2001-01-05 07:34:23 +01:00
|
|
|
if (a->inhOpt != b->inhOpt)
|
2000-08-12 01:45:35 +02:00
|
|
|
return false;
|
|
|
|
if (!equalstr(a->column, b->column))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->newname, b->newname))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalRuleStmt(RuleStmt *a, RuleStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->rulename, b->rulename))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->whereClause, b->whereClause))
|
|
|
|
return false;
|
|
|
|
if (a->event != b->event)
|
|
|
|
return false;
|
|
|
|
if (!equal(a->object, b->object))
|
|
|
|
return false;
|
|
|
|
if (a->instead != b->instead)
|
|
|
|
return false;
|
|
|
|
if (!equal(a->actions, b->actions))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalNotifyStmt(NotifyStmt *a, NotifyStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->relname, b->relname))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalListenStmt(ListenStmt *a, ListenStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->relname, b->relname))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalUnlistenStmt(UnlistenStmt *a, UnlistenStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->relname, b->relname))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalTransactionStmt(TransactionStmt *a, TransactionStmt *b)
|
|
|
|
{
|
|
|
|
if (a->command != b->command)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalViewStmt(ViewStmt *a, ViewStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->viewname, b->viewname))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->aliases, b->aliases))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->query, b->query))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalLoadStmt(LoadStmt *a, LoadStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->filename, b->filename))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalCreatedbStmt(CreatedbStmt *a, CreatedbStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->dbname, b->dbname))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->dbpath, b->dbpath))
|
|
|
|
return false;
|
2000-11-14 19:37:49 +01:00
|
|
|
if (!equalstr(a->dbtemplate, b->dbtemplate))
|
|
|
|
return false;
|
2000-08-12 01:45:35 +02:00
|
|
|
if (a->encoding != b->encoding)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalDropdbStmt(DropdbStmt *a, DropdbStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->dbname, b->dbname))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalVacuumStmt(VacuumStmt *a, VacuumStmt *b)
|
|
|
|
{
|
2001-05-07 02:43:27 +02:00
|
|
|
if (a->vacuum != b->vacuum)
|
2000-08-12 01:45:35 +02:00
|
|
|
return false;
|
2001-07-11 00:09:29 +02:00
|
|
|
if (a->full != b->full)
|
|
|
|
return false;
|
2000-08-12 01:45:35 +02:00
|
|
|
if (a->analyze != b->analyze)
|
|
|
|
return false;
|
2001-05-07 02:43:27 +02:00
|
|
|
if (a->verbose != b->verbose)
|
|
|
|
return false;
|
2000-08-12 01:45:35 +02:00
|
|
|
if (!equalstr(a->vacrel, b->vacrel))
|
|
|
|
return false;
|
2001-05-07 02:43:27 +02:00
|
|
|
if (!equal(a->va_cols, b->va_cols))
|
2000-08-12 01:45:35 +02:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalExplainStmt(ExplainStmt *a, ExplainStmt *b)
|
|
|
|
{
|
|
|
|
if (!equal(a->query, b->query))
|
|
|
|
return false;
|
|
|
|
if (a->verbose != b->verbose)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalCreateSeqStmt(CreateSeqStmt *a, CreateSeqStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->seqname, b->seqname))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->options, b->options))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalVariableSetStmt(VariableSetStmt *a, VariableSetStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->name, b->name))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->value, b->value))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalVariableShowStmt(VariableShowStmt *a, VariableShowStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->name, b->name))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalVariableResetStmt(VariableResetStmt *a, VariableResetStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->name, b->name))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalCreateTrigStmt(CreateTrigStmt *a, CreateTrigStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->trigname, b->trigname))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->relname, b->relname))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->funcname, b->funcname))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->args, b->args))
|
|
|
|
return false;
|
|
|
|
if (a->before != b->before)
|
|
|
|
return false;
|
|
|
|
if (a->row != b->row)
|
|
|
|
return false;
|
|
|
|
if (strcmp(a->actions, b->actions) != 0)
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->lang, b->lang))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->text, b->text))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->attr, b->attr))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->when, b->when))
|
|
|
|
return false;
|
|
|
|
if (a->isconstraint != b->isconstraint)
|
|
|
|
return false;
|
|
|
|
if (a->deferrable != b->deferrable)
|
|
|
|
return false;
|
|
|
|
if (a->initdeferred != b->initdeferred)
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->constrrelname, b->constrrelname))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalDropTrigStmt(DropTrigStmt *a, DropTrigStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->trigname, b->trigname))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->relname, b->relname))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalCreatePLangStmt(CreatePLangStmt *a, CreatePLangStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->plname, b->plname))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->plhandler, b->plhandler))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->plcompiler, b->plcompiler))
|
|
|
|
return false;
|
|
|
|
if (a->pltrusted != b->pltrusted)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalDropPLangStmt(DropPLangStmt *a, DropPLangStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->plname, b->plname))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalCreateUserStmt(CreateUserStmt *a, CreateUserStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->user, b->user))
|
|
|
|
return false;
|
2001-07-11 00:09:29 +02:00
|
|
|
if (!equal(a->options, b->options))
|
2000-08-12 01:45:35 +02:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalAlterUserStmt(AlterUserStmt *a, AlterUserStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->user, b->user))
|
|
|
|
return false;
|
2001-07-11 00:09:29 +02:00
|
|
|
if (!equal(a->options, b->options))
|
2000-08-12 01:45:35 +02:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalDropUserStmt(DropUserStmt *a, DropUserStmt *b)
|
|
|
|
{
|
|
|
|
if (!equal(a->users, b->users))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalLockStmt(LockStmt *a, LockStmt *b)
|
|
|
|
{
|
2001-08-10 16:30:15 +02:00
|
|
|
if (!equal(a->rellist, b->rellist))
|
2000-08-12 01:45:35 +02:00
|
|
|
return false;
|
|
|
|
if (a->mode != b->mode)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalConstraintsSetStmt(ConstraintsSetStmt *a, ConstraintsSetStmt *b)
|
|
|
|
{
|
|
|
|
if (!equal(a->constraints, b->constraints))
|
|
|
|
return false;
|
|
|
|
if (a->deferred != b->deferred)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalCreateGroupStmt(CreateGroupStmt *a, CreateGroupStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->name, b->name))
|
|
|
|
return false;
|
2001-07-12 20:03:00 +02:00
|
|
|
if (!equal(a->options, b->options))
|
2000-08-12 01:45:35 +02:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalAlterGroupStmt(AlterGroupStmt *a, AlterGroupStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->name, b->name))
|
|
|
|
return false;
|
|
|
|
if (a->action != b->action)
|
|
|
|
return false;
|
|
|
|
if (!equal(a->listUsers, b->listUsers))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalDropGroupStmt(DropGroupStmt *a, DropGroupStmt *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->name, b->name))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalReindexStmt(ReindexStmt *a, ReindexStmt *b)
|
|
|
|
{
|
|
|
|
if (a->reindexType != b->reindexType)
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->name, b->name))
|
|
|
|
return false;
|
|
|
|
if (a->force != b->force)
|
|
|
|
return false;
|
|
|
|
if (a->all != b->all)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalAExpr(A_Expr *a, A_Expr *b)
|
|
|
|
{
|
|
|
|
if (a->oper != b->oper)
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->opname, b->opname))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->lexpr, b->lexpr))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->rexpr, b->rexpr))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalAttr(Attr *a, Attr *b)
|
|
|
|
{
|
|
|
|
if (strcmp(a->relname, b->relname) != 0)
|
|
|
|
return false;
|
|
|
|
if (!equal(a->paramNo, b->paramNo))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->attrs, b->attrs))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->indirection, b->indirection))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalAConst(A_Const *a, A_Const *b)
|
|
|
|
{
|
|
|
|
if (!equal(&a->val, &b->val))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->typename, b->typename))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalParamNo(ParamNo *a, ParamNo *b)
|
|
|
|
{
|
|
|
|
if (a->number != b->number)
|
|
|
|
return false;
|
|
|
|
if (!equal(a->typename, b->typename))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->indirection, b->indirection))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalIdent(Ident *a, Ident *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->name, b->name))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->indirection, b->indirection))
|
|
|
|
return false;
|
|
|
|
if (a->isRel != b->isRel)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalFuncCall(FuncCall *a, FuncCall *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->funcname, b->funcname))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->args, b->args))
|
|
|
|
return false;
|
|
|
|
if (a->agg_star != b->agg_star)
|
|
|
|
return false;
|
|
|
|
if (a->agg_distinct != b->agg_distinct)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalAIndices(A_Indices *a, A_Indices *b)
|
|
|
|
{
|
|
|
|
if (!equal(a->lidx, b->lidx))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->uidx, b->uidx))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalResTarget(ResTarget *a, ResTarget *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->name, b->name))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->indirection, b->indirection))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->val, b->val))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalTypeCast(TypeCast *a, TypeCast *b)
|
|
|
|
{
|
|
|
|
if (!equal(a->arg, b->arg))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->typename, b->typename))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
2000-09-12 23:07:18 +02:00
|
|
|
_equalSortGroupBy(SortGroupBy *a, SortGroupBy *b)
|
2000-08-12 01:45:35 +02:00
|
|
|
{
|
2000-09-12 23:07:18 +02:00
|
|
|
if (!equalstr(a->useOp, b->useOp))
|
2000-08-12 01:45:35 +02:00
|
|
|
return false;
|
2000-09-12 23:07:18 +02:00
|
|
|
if (!equal(a->node, b->node))
|
2000-08-12 01:45:35 +02:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
2000-09-12 23:07:18 +02:00
|
|
|
_equalRangeVar(RangeVar *a, RangeVar *b)
|
2000-08-12 01:45:35 +02:00
|
|
|
{
|
2000-09-12 23:07:18 +02:00
|
|
|
if (!equalstr(a->relname, b->relname))
|
2000-08-12 01:45:35 +02:00
|
|
|
return false;
|
2001-01-05 07:34:23 +01:00
|
|
|
if (a->inhOpt != b->inhOpt)
|
2000-09-12 23:07:18 +02:00
|
|
|
return false;
|
|
|
|
if (!equal(a->name, b->name))
|
2000-08-12 01:45:35 +02:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
2000-09-12 23:07:18 +02:00
|
|
|
_equalRangeSubselect(RangeSubselect *a, RangeSubselect *b)
|
2000-08-12 01:45:35 +02:00
|
|
|
{
|
2000-09-12 23:07:18 +02:00
|
|
|
if (!equal(a->subquery, b->subquery))
|
2000-08-12 01:45:35 +02:00
|
|
|
return false;
|
|
|
|
if (!equal(a->name, b->name))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalTypeName(TypeName *a, TypeName *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->name, b->name))
|
|
|
|
return false;
|
|
|
|
if (a->timezone != b->timezone)
|
|
|
|
return false;
|
|
|
|
if (a->setof != b->setof)
|
|
|
|
return false;
|
|
|
|
if (a->typmod != b->typmod)
|
|
|
|
return false;
|
|
|
|
if (!equal(a->arrayBounds, b->arrayBounds))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalIndexElem(IndexElem *a, IndexElem *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->name, b->name))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->args, b->args))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->class, b->class))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalColumnDef(ColumnDef *a, ColumnDef *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->colname, b->colname))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->typename, b->typename))
|
|
|
|
return false;
|
|
|
|
if (a->is_not_null != b->is_not_null)
|
|
|
|
return false;
|
|
|
|
if (a->is_sequence != b->is_sequence)
|
|
|
|
return false;
|
|
|
|
if (!equal(a->raw_default, b->raw_default))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->cooked_default, b->cooked_default))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->constraints, b->constraints))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalConstraint(Constraint *a, Constraint *b)
|
|
|
|
{
|
|
|
|
if (a->contype != b->contype)
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->name, b->name))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->raw_expr, b->raw_expr))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->cooked_expr, b->cooked_expr))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->keys, b->keys))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalDefElem(DefElem *a, DefElem *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->defname, b->defname))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->arg, b->arg))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalTargetEntry(TargetEntry *a, TargetEntry *b)
|
|
|
|
{
|
|
|
|
if (!equal(a->resdom, b->resdom))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->fjoin, b->fjoin))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->expr, b->expr))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalRangeTblEntry(RangeTblEntry *a, RangeTblEntry *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->relname, b->relname))
|
|
|
|
return false;
|
|
|
|
if (a->relid != b->relid)
|
|
|
|
return false;
|
2000-09-29 20:21:41 +02:00
|
|
|
if (!equal(a->subquery, b->subquery))
|
|
|
|
return false;
|
2000-09-12 23:07:18 +02:00
|
|
|
if (!equal(a->alias, b->alias))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->eref, b->eref))
|
|
|
|
return false;
|
2000-08-12 01:45:35 +02:00
|
|
|
if (a->inh != b->inh)
|
|
|
|
return false;
|
|
|
|
if (a->inFromCl != b->inFromCl)
|
|
|
|
return false;
|
2000-09-29 20:21:41 +02:00
|
|
|
if (a->checkForRead != b->checkForRead)
|
|
|
|
return false;
|
|
|
|
if (a->checkForWrite != b->checkForWrite)
|
|
|
|
return false;
|
|
|
|
if (a->checkAsUser != b->checkAsUser)
|
2000-08-12 01:45:35 +02:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalSortClause(SortClause *a, SortClause *b)
|
|
|
|
{
|
|
|
|
if (a->tleSortGroupRef != b->tleSortGroupRef)
|
|
|
|
return false;
|
|
|
|
if (a->sortop != b->sortop)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalFkConstraint(FkConstraint *a, FkConstraint *b)
|
|
|
|
{
|
|
|
|
if (!equalstr(a->constr_name, b->constr_name))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->pktable_name, b->pktable_name))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->fk_attrs, b->fk_attrs))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->pk_attrs, b->pk_attrs))
|
|
|
|
return false;
|
|
|
|
if (!equalstr(a->match_type, b->match_type))
|
|
|
|
return false;
|
|
|
|
if (a->actions != b->actions)
|
|
|
|
return false;
|
|
|
|
if (a->deferrable != b->deferrable)
|
|
|
|
return false;
|
|
|
|
if (a->initdeferred != b->initdeferred)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalCaseExpr(CaseExpr *a, CaseExpr *b)
|
|
|
|
{
|
|
|
|
if (a->casetype != b->casetype)
|
|
|
|
return false;
|
|
|
|
if (!equal(a->arg, b->arg))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->args, b->args))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->defresult, b->defresult))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalCaseWhen(CaseWhen *a, CaseWhen *b)
|
|
|
|
{
|
|
|
|
if (!equal(a->expr, b->expr))
|
|
|
|
return false;
|
|
|
|
if (!equal(a->result, b->result))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2001-06-20 00:39:12 +02:00
|
|
|
static bool
|
|
|
|
_equalNullTest(NullTest *a, NullTest *b)
|
|
|
|
{
|
|
|
|
if (!equal(a->arg, b->arg))
|
|
|
|
return false;
|
|
|
|
if (a->nulltesttype != b->nulltesttype)
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalBooleanTest(BooleanTest *a, BooleanTest *b)
|
|
|
|
{
|
|
|
|
if (!equal(a->arg, b->arg))
|
|
|
|
return false;
|
|
|
|
if (a->booltesttype != b->booltesttype)
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2000-08-12 01:45:35 +02:00
|
|
|
/*
|
|
|
|
* Stuff from pg_list.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_equalValue(Value *a, Value *b)
|
|
|
|
{
|
|
|
|
if (a->type != b->type)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
switch (a->type)
|
|
|
|
{
|
|
|
|
case T_Integer:
|
|
|
|
return a->val.ival == b->val.ival;
|
|
|
|
case T_Float:
|
|
|
|
case T_String:
|
2000-10-31 11:22:13 +01:00
|
|
|
case T_BitString:
|
2000-08-12 01:45:35 +02:00
|
|
|
return strcmp(a->val.str, b->val.str) == 0;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* equal
|
|
|
|
* returns whether two nodes are equal
|
|
|
|
*/
|
|
|
|
bool
|
|
|
|
equal(void *a, void *b)
|
|
|
|
{
|
|
|
|
bool retval = false;
|
|
|
|
|
|
|
|
if (a == b)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* note that a!=b, so only one of them can be NULL
|
|
|
|
*/
|
|
|
|
if (a == NULL || b == NULL)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* are they the same type of nodes?
|
|
|
|
*/
|
|
|
|
if (nodeTag(a) != nodeTag(b))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
switch (nodeTag(a))
|
|
|
|
{
|
|
|
|
case T_SubPlan:
|
|
|
|
retval = _equalSubPlan(a, b);
|
2000-06-29 09:35:57 +02:00
|
|
|
break;
|
2000-08-12 01:45:35 +02:00
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
case T_Resdom:
|
|
|
|
retval = _equalResdom(a, b);
|
|
|
|
break;
|
|
|
|
case T_Fjoin:
|
|
|
|
retval = _equalFjoin(a, b);
|
|
|
|
break;
|
|
|
|
case T_Expr:
|
|
|
|
retval = _equalExpr(a, b);
|
|
|
|
break;
|
|
|
|
case T_Var:
|
|
|
|
retval = _equalVar(a, b);
|
|
|
|
break;
|
|
|
|
case T_Oper:
|
|
|
|
retval = _equalOper(a, b);
|
|
|
|
break;
|
|
|
|
case T_Const:
|
|
|
|
retval = _equalConst(a, b);
|
|
|
|
break;
|
|
|
|
case T_Param:
|
|
|
|
retval = _equalParam(a, b);
|
|
|
|
break;
|
1999-06-06 19:46:40 +02:00
|
|
|
case T_Aggref:
|
|
|
|
retval = _equalAggref(a, b);
|
1999-09-26 04:28:44 +02:00
|
|
|
break;
|
|
|
|
case T_SubLink:
|
|
|
|
retval = _equalSubLink(a, b);
|
1999-06-06 19:46:40 +02:00
|
|
|
break;
|
1997-09-08 04:41:22 +02:00
|
|
|
case T_Func:
|
|
|
|
retval = _equalFunc(a, b);
|
|
|
|
break;
|
2000-08-12 01:45:35 +02:00
|
|
|
case T_FieldSelect:
|
|
|
|
retval = _equalFieldSelect(a, b);
|
|
|
|
break;
|
2000-06-29 09:35:57 +02:00
|
|
|
case T_ArrayRef:
|
|
|
|
retval = _equalArrayRef(a, b);
|
1998-08-02 00:12:13 +02:00
|
|
|
break;
|
2000-06-29 09:35:57 +02:00
|
|
|
case T_Iter:
|
|
|
|
retval = _equalIter(a, b);
|
2000-01-09 01:26:47 +01:00
|
|
|
break;
|
2000-06-29 09:35:57 +02:00
|
|
|
case T_RelabelType:
|
|
|
|
retval = _equalRelabelType(a, b);
|
|
|
|
break;
|
2000-09-12 23:07:18 +02:00
|
|
|
case T_RangeTblRef:
|
|
|
|
retval = _equalRangeTblRef(a, b);
|
|
|
|
break;
|
2000-09-29 20:21:41 +02:00
|
|
|
case T_FromExpr:
|
|
|
|
retval = _equalFromExpr(a, b);
|
|
|
|
break;
|
2000-09-12 23:07:18 +02:00
|
|
|
case T_JoinExpr:
|
|
|
|
retval = _equalJoinExpr(a, b);
|
|
|
|
break;
|
2000-08-12 01:45:35 +02:00
|
|
|
|
2000-06-29 09:35:57 +02:00
|
|
|
case T_RelOptInfo:
|
|
|
|
retval = _equalRelOptInfo(a, b);
|
1997-09-08 04:41:22 +02:00
|
|
|
break;
|
|
|
|
case T_Path:
|
|
|
|
retval = _equalPath(a, b);
|
|
|
|
break;
|
|
|
|
case T_IndexPath:
|
|
|
|
retval = _equalIndexPath(a, b);
|
|
|
|
break;
|
1999-02-12 07:43:53 +01:00
|
|
|
case T_NestPath:
|
|
|
|
retval = _equalNestPath(a, b);
|
1997-09-08 04:41:22 +02:00
|
|
|
break;
|
|
|
|
case T_MergePath:
|
|
|
|
retval = _equalMergePath(a, b);
|
|
|
|
break;
|
|
|
|
case T_HashPath:
|
|
|
|
retval = _equalHashPath(a, b);
|
|
|
|
break;
|
2000-06-29 09:35:57 +02:00
|
|
|
case T_PathKeyItem:
|
|
|
|
retval = _equalPathKeyItem(a, b);
|
1999-11-23 21:07:06 +01:00
|
|
|
break;
|
2000-06-29 09:35:57 +02:00
|
|
|
case T_RestrictInfo:
|
|
|
|
retval = _equalRestrictInfo(a, b);
|
1998-02-13 04:27:47 +01:00
|
|
|
break;
|
1998-09-01 05:29:17 +02:00
|
|
|
case T_JoinInfo:
|
|
|
|
retval = _equalJoinInfo(a, b);
|
1997-09-08 04:41:22 +02:00
|
|
|
break;
|
2000-06-29 09:35:57 +02:00
|
|
|
case T_Stream:
|
|
|
|
retval = _equalStream(a, b);
|
|
|
|
break;
|
|
|
|
case T_TidPath:
|
|
|
|
retval = _equalTidPath(a, b);
|
|
|
|
break;
|
2000-11-12 01:37:02 +01:00
|
|
|
case T_AppendPath:
|
|
|
|
retval = _equalAppendPath(a, b);
|
|
|
|
break;
|
2000-06-29 09:35:57 +02:00
|
|
|
case T_IndexOptInfo:
|
|
|
|
retval = _equalIndexOptInfo(a, b);
|
|
|
|
break;
|
2000-08-12 01:45:35 +02:00
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
case T_List:
|
1997-09-07 07:04:48 +02:00
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
List *la = (List *) a;
|
|
|
|
List *lb = (List *) b;
|
|
|
|
List *l;
|
|
|
|
|
2000-04-12 19:17:23 +02:00
|
|
|
/*
|
|
|
|
* Try to reject by length check before we grovel through
|
1999-07-29 04:45:36 +02:00
|
|
|
* all the elements...
|
|
|
|
*/
|
|
|
|
if (length(la) != length(lb))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-08 04:41:22 +02:00
|
|
|
foreach(l, la)
|
|
|
|
{
|
|
|
|
if (!equal(lfirst(l), lfirst(lb)))
|
1998-09-01 05:29:17 +02:00
|
|
|
return false;
|
1997-09-08 04:41:22 +02:00
|
|
|
lb = lnext(lb);
|
|
|
|
}
|
|
|
|
retval = true;
|
1997-09-07 07:04:48 +02:00
|
|
|
}
|
1997-09-08 04:41:22 +02:00
|
|
|
break;
|
2000-06-29 09:35:57 +02:00
|
|
|
case T_Integer:
|
|
|
|
case T_Float:
|
|
|
|
case T_String:
|
2000-10-31 11:22:13 +01:00
|
|
|
case T_BitString:
|
2000-06-29 09:35:57 +02:00
|
|
|
retval = _equalValue(a, b);
|
|
|
|
break;
|
2000-08-12 01:45:35 +02:00
|
|
|
|
1999-02-07 01:52:12 +01:00
|
|
|
case T_Query:
|
|
|
|
retval = _equalQuery(a, b);
|
|
|
|
break;
|
2000-08-12 01:45:35 +02:00
|
|
|
case T_InsertStmt:
|
|
|
|
retval = _equalInsertStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_DeleteStmt:
|
|
|
|
retval = _equalDeleteStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_UpdateStmt:
|
|
|
|
retval = _equalUpdateStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_SelectStmt:
|
|
|
|
retval = _equalSelectStmt(a, b);
|
|
|
|
break;
|
2000-10-05 21:11:39 +02:00
|
|
|
case T_SetOperationStmt:
|
|
|
|
retval = _equalSetOperationStmt(a, b);
|
|
|
|
break;
|
2000-08-12 01:45:35 +02:00
|
|
|
case T_AlterTableStmt:
|
|
|
|
retval = _equalAlterTableStmt(a, b);
|
|
|
|
break;
|
2001-06-10 01:21:55 +02:00
|
|
|
case T_GrantStmt:
|
|
|
|
retval = _equalGrantStmt(a, b);
|
2000-08-12 01:45:35 +02:00
|
|
|
break;
|
|
|
|
case T_ClosePortalStmt:
|
|
|
|
retval = _equalClosePortalStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_ClusterStmt:
|
|
|
|
retval = _equalClusterStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_CopyStmt:
|
|
|
|
retval = _equalCopyStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_CreateStmt:
|
|
|
|
retval = _equalCreateStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_VersionStmt:
|
|
|
|
retval = _equalVersionStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_DefineStmt:
|
|
|
|
retval = _equalDefineStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_DropStmt:
|
|
|
|
retval = _equalDropStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_TruncateStmt:
|
|
|
|
retval = _equalTruncateStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_CommentStmt:
|
|
|
|
retval = _equalCommentStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_FetchStmt:
|
|
|
|
retval = _equalFetchStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_IndexStmt:
|
|
|
|
retval = _equalIndexStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_ProcedureStmt:
|
|
|
|
retval = _equalProcedureStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_RemoveAggrStmt:
|
|
|
|
retval = _equalRemoveAggrStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_RemoveFuncStmt:
|
|
|
|
retval = _equalRemoveFuncStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_RemoveOperStmt:
|
|
|
|
retval = _equalRemoveOperStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_RenameStmt:
|
|
|
|
retval = _equalRenameStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_RuleStmt:
|
|
|
|
retval = _equalRuleStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_NotifyStmt:
|
|
|
|
retval = _equalNotifyStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_ListenStmt:
|
|
|
|
retval = _equalListenStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_UnlistenStmt:
|
|
|
|
retval = _equalUnlistenStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_TransactionStmt:
|
|
|
|
retval = _equalTransactionStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_ViewStmt:
|
|
|
|
retval = _equalViewStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_LoadStmt:
|
|
|
|
retval = _equalLoadStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_CreatedbStmt:
|
|
|
|
retval = _equalCreatedbStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_DropdbStmt:
|
|
|
|
retval = _equalDropdbStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_VacuumStmt:
|
|
|
|
retval = _equalVacuumStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_ExplainStmt:
|
|
|
|
retval = _equalExplainStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_CreateSeqStmt:
|
|
|
|
retval = _equalCreateSeqStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_VariableSetStmt:
|
|
|
|
retval = _equalVariableSetStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_VariableShowStmt:
|
|
|
|
retval = _equalVariableShowStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_VariableResetStmt:
|
|
|
|
retval = _equalVariableResetStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_CreateTrigStmt:
|
|
|
|
retval = _equalCreateTrigStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_DropTrigStmt:
|
|
|
|
retval = _equalDropTrigStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_CreatePLangStmt:
|
|
|
|
retval = _equalCreatePLangStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_DropPLangStmt:
|
|
|
|
retval = _equalDropPLangStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_CreateUserStmt:
|
|
|
|
retval = _equalCreateUserStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_AlterUserStmt:
|
|
|
|
retval = _equalAlterUserStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_DropUserStmt:
|
|
|
|
retval = _equalDropUserStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_LockStmt:
|
|
|
|
retval = _equalLockStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_ConstraintsSetStmt:
|
|
|
|
retval = _equalConstraintsSetStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_CreateGroupStmt:
|
|
|
|
retval = _equalCreateGroupStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_AlterGroupStmt:
|
|
|
|
retval = _equalAlterGroupStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_DropGroupStmt:
|
|
|
|
retval = _equalDropGroupStmt(a, b);
|
|
|
|
break;
|
|
|
|
case T_ReindexStmt:
|
|
|
|
retval = _equalReindexStmt(a, b);
|
|
|
|
break;
|
2000-11-05 23:50:21 +01:00
|
|
|
case T_CheckPointStmt:
|
|
|
|
retval = true;
|
|
|
|
break;
|
2000-08-12 01:45:35 +02:00
|
|
|
|
|
|
|
case T_A_Expr:
|
|
|
|
retval = _equalAExpr(a, b);
|
|
|
|
break;
|
|
|
|
case T_Attr:
|
|
|
|
retval = _equalAttr(a, b);
|
|
|
|
break;
|
|
|
|
case T_A_Const:
|
|
|
|
retval = _equalAConst(a, b);
|
|
|
|
break;
|
|
|
|
case T_ParamNo:
|
|
|
|
retval = _equalParamNo(a, b);
|
|
|
|
break;
|
|
|
|
case T_Ident:
|
|
|
|
retval = _equalIdent(a, b);
|
|
|
|
break;
|
|
|
|
case T_FuncCall:
|
|
|
|
retval = _equalFuncCall(a, b);
|
|
|
|
break;
|
|
|
|
case T_A_Indices:
|
|
|
|
retval = _equalAIndices(a, b);
|
|
|
|
break;
|
|
|
|
case T_ResTarget:
|
|
|
|
retval = _equalResTarget(a, b);
|
|
|
|
break;
|
|
|
|
case T_TypeCast:
|
|
|
|
retval = _equalTypeCast(a, b);
|
|
|
|
break;
|
|
|
|
case T_SortGroupBy:
|
|
|
|
retval = _equalSortGroupBy(a, b);
|
|
|
|
break;
|
|
|
|
case T_RangeVar:
|
|
|
|
retval = _equalRangeVar(a, b);
|
|
|
|
break;
|
2000-09-12 23:07:18 +02:00
|
|
|
case T_RangeSubselect:
|
|
|
|
retval = _equalRangeSubselect(a, b);
|
|
|
|
break;
|
2000-08-12 01:45:35 +02:00
|
|
|
case T_TypeName:
|
|
|
|
retval = _equalTypeName(a, b);
|
|
|
|
break;
|
|
|
|
case T_IndexElem:
|
|
|
|
retval = _equalIndexElem(a, b);
|
|
|
|
break;
|
|
|
|
case T_ColumnDef:
|
|
|
|
retval = _equalColumnDef(a, b);
|
|
|
|
break;
|
|
|
|
case T_Constraint:
|
|
|
|
retval = _equalConstraint(a, b);
|
|
|
|
break;
|
|
|
|
case T_DefElem:
|
|
|
|
retval = _equalDefElem(a, b);
|
|
|
|
break;
|
2000-06-29 09:35:57 +02:00
|
|
|
case T_TargetEntry:
|
|
|
|
retval = _equalTargetEntry(a, b);
|
|
|
|
break;
|
1999-02-07 01:52:12 +01:00
|
|
|
case T_RangeTblEntry:
|
|
|
|
retval = _equalRangeTblEntry(a, b);
|
|
|
|
break;
|
2000-01-31 02:21:39 +01:00
|
|
|
case T_SortClause:
|
|
|
|
retval = _equalSortClause(a, b);
|
|
|
|
break;
|
|
|
|
case T_GroupClause:
|
|
|
|
/* GroupClause is equivalent to SortClause */
|
|
|
|
retval = _equalSortClause(a, b);
|
|
|
|
break;
|
1999-07-29 04:45:36 +02:00
|
|
|
case T_CaseExpr:
|
|
|
|
retval = _equalCaseExpr(a, b);
|
|
|
|
break;
|
|
|
|
case T_CaseWhen:
|
|
|
|
retval = _equalCaseWhen(a, b);
|
|
|
|
break;
|
2001-06-20 00:39:12 +02:00
|
|
|
case T_NullTest:
|
|
|
|
retval = _equalNullTest(a, b);
|
|
|
|
break;
|
|
|
|
case T_BooleanTest:
|
|
|
|
retval = _equalBooleanTest(a, b);
|
|
|
|
break;
|
2000-08-12 01:45:35 +02:00
|
|
|
case T_FkConstraint:
|
|
|
|
retval = _equalFkConstraint(a, b);
|
|
|
|
break;
|
2001-06-10 01:21:55 +02:00
|
|
|
case T_PrivGrantee:
|
|
|
|
retval = _equalPrivGrantee(a, b);
|
|
|
|
break;
|
2000-06-29 09:35:57 +02:00
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
default:
|
|
|
|
elog(NOTICE, "equal: don't know whether nodes of type %d are equal",
|
|
|
|
nodeTag(a));
|
|
|
|
break;
|
1996-07-09 08:22:35 +02:00
|
|
|
}
|
1997-09-07 07:04:48 +02:00
|
|
|
|
|
|
|
return retval;
|
1996-07-09 08:22:35 +02:00
|
|
|
}
|