X-Git-Url: https://granicus.if.org/sourcecode?a=blobdiff_plain;f=src%2Fbackend%2Fnodes%2Fequalfuncs.c;h=04072c7a65422560271d422496ac86230e40f817;hb=6808f1b1de0ebcd4af558ba84c3226b2027f55ea;hp=6d727a6327831a4ca4599ee2f53c3fbd7b716555;hpb=d42cf5a42a42689f68bc1ee1200aca75f954b1fd;p=postgresql diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c index 6d727a6327..04072c7a65 100644 --- a/src/backend/nodes/equalfuncs.c +++ b/src/backend/nodes/equalfuncs.c @@ -14,19 +14,17 @@ * either. This might need to be fixed someday. * * - * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.250 2005/07/31 17:19:18 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.309 2007/06/11 01:16:22 tgl Exp $ * *------------------------------------------------------------------------- */ #include "postgres.h" -#include "nodes/params.h" -#include "nodes/parsenodes.h" #include "nodes/relation.h" #include "utils/datum.h" @@ -104,6 +102,18 @@ _equalRangeVar(RangeVar *a, RangeVar *b) return true; } +static bool +_equalIntoClause(IntoClause *a, IntoClause *b) +{ + COMPARE_NODE_FIELD(rel); + COMPARE_NODE_FIELD(colNames); + COMPARE_NODE_FIELD(options); + COMPARE_SCALAR_FIELD(onCommit); + COMPARE_STRING_FIELD(tableSpaceName); + + return true; +} + /* * We don't need an _equalExpr because Expr is an abstract supertype which * should never actually get instantiated. Also, since it has no common @@ -129,14 +139,14 @@ static bool _equalConst(Const *a, Const *b) { COMPARE_SCALAR_FIELD(consttype); + COMPARE_SCALAR_FIELD(consttypmod); COMPARE_SCALAR_FIELD(constlen); COMPARE_SCALAR_FIELD(constisnull); COMPARE_SCALAR_FIELD(constbyval); /* * 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... + * might need to change? But datumIsEqual doesn't work on nulls, so... */ if (a->constisnull) return true; @@ -148,21 +158,9 @@ static bool _equalParam(Param *a, Param *b) { COMPARE_SCALAR_FIELD(paramkind); + COMPARE_SCALAR_FIELD(paramid); COMPARE_SCALAR_FIELD(paramtype); - - switch (a->paramkind) - { - case PARAM_NAMED: - COMPARE_STRING_FIELD(paramname); - break; - case PARAM_NUM: - case PARAM_EXEC: - COMPARE_SCALAR_FIELD(paramid); - break; - default: - elog(ERROR, "unrecognized paramkind: %d", - a->paramkind); - } + COMPARE_SCALAR_FIELD(paramtypmod); return true; } @@ -172,7 +170,7 @@ _equalAggref(Aggref *a, Aggref *b) { COMPARE_SCALAR_FIELD(aggfnoid); COMPARE_SCALAR_FIELD(aggtype); - COMPARE_NODE_FIELD(target); + COMPARE_NODE_FIELD(args); COMPARE_SCALAR_FIELD(agglevelsup); COMPARE_SCALAR_FIELD(aggstar); COMPARE_SCALAR_FIELD(aggdistinct); @@ -183,9 +181,9 @@ _equalAggref(Aggref *a, Aggref *b) static bool _equalArrayRef(ArrayRef *a, ArrayRef *b) { - COMPARE_SCALAR_FIELD(refrestype); COMPARE_SCALAR_FIELD(refarraytype); COMPARE_SCALAR_FIELD(refelemtype); + COMPARE_SCALAR_FIELD(reftypmod); COMPARE_NODE_FIELD(refupperindexpr); COMPARE_NODE_FIELD(reflowerindexpr); COMPARE_NODE_FIELD(refexpr); @@ -202,8 +200,8 @@ _equalFuncExpr(FuncExpr *a, FuncExpr *b) COMPARE_SCALAR_FIELD(funcretset); /* - * Special-case COERCE_DONTCARE, so that planner can build coercion - * nodes that are equal() to both explicit and implicit coercions. + * Special-case COERCE_DONTCARE, so that planner can build coercion nodes + * that are equal() to both explicit and implicit coercions. */ if (a->funcformat != b->funcformat && a->funcformat != COERCE_DONTCARE && @@ -222,9 +220,9 @@ _equalOpExpr(OpExpr *a, OpExpr *b) /* * Special-case opfuncid: it is allowable for it to differ if one node - * contains zero and the other doesn't. This just means that the one - * node isn't as far along in the parse/plan pipeline and hasn't had - * the opfuncid cache filled yet. + * contains zero and the other doesn't. This just means that the one node + * isn't as far along in the parse/plan pipeline and hasn't had the + * opfuncid cache filled yet. */ if (a->opfuncid != b->opfuncid && a->opfuncid != 0 && @@ -245,9 +243,9 @@ _equalDistinctExpr(DistinctExpr *a, DistinctExpr *b) /* * Special-case opfuncid: it is allowable for it to differ if one node - * contains zero and the other doesn't. This just means that the one - * node isn't as far along in the parse/plan pipeline and hasn't had - * the opfuncid cache filled yet. + * contains zero and the other doesn't. This just means that the one node + * isn't as far along in the parse/plan pipeline and hasn't had the + * opfuncid cache filled yet. */ if (a->opfuncid != b->opfuncid && a->opfuncid != 0 && @@ -268,9 +266,9 @@ _equalScalarArrayOpExpr(ScalarArrayOpExpr *a, ScalarArrayOpExpr *b) /* * Special-case opfuncid: it is allowable for it to differ if one node - * contains zero and the other doesn't. This just means that the one - * node isn't as far along in the parse/plan pipeline and hasn't had - * the opfuncid cache filled yet. + * contains zero and the other doesn't. This just means that the one node + * isn't as far along in the parse/plan pipeline and hasn't had the + * opfuncid cache filled yet. */ if (a->opfuncid != b->opfuncid && a->opfuncid != 0 && @@ -296,10 +294,8 @@ static bool _equalSubLink(SubLink *a, SubLink *b) { COMPARE_SCALAR_FIELD(subLinkType); - COMPARE_SCALAR_FIELD(useOr); - COMPARE_NODE_FIELD(lefthand); + COMPARE_NODE_FIELD(testexpr); COMPARE_NODE_FIELD(operName); - COMPARE_NODE_FIELD(operOids); COMPARE_NODE_FIELD(subselect); return true; @@ -309,12 +305,10 @@ static bool _equalSubPlan(SubPlan *a, SubPlan *b) { COMPARE_SCALAR_FIELD(subLinkType); - COMPARE_SCALAR_FIELD(useOr); - COMPARE_NODE_FIELD(exprs); + COMPARE_NODE_FIELD(testexpr); COMPARE_NODE_FIELD(paramIds); - /* should compare plans, but have to settle for comparing plan IDs */ COMPARE_SCALAR_FIELD(plan_id); - COMPARE_NODE_FIELD(rtable); + COMPARE_SCALAR_FIELD(firstColType); COMPARE_SCALAR_FIELD(useHashTable); COMPARE_SCALAR_FIELD(unknownEqFalse); COMPARE_NODE_FIELD(setParam); @@ -354,8 +348,8 @@ _equalRelabelType(RelabelType *a, RelabelType *b) COMPARE_SCALAR_FIELD(resulttypmod); /* - * Special-case COERCE_DONTCARE, so that planner can build coercion - * nodes that are equal() to both explicit and implicit coercions. + * Special-case COERCE_DONTCARE, so that planner can build coercion nodes + * that are equal() to both explicit and implicit coercions. */ if (a->relabelformat != b->relabelformat && a->relabelformat != COERCE_DONTCARE && @@ -365,6 +359,45 @@ _equalRelabelType(RelabelType *a, RelabelType *b) return true; } +static bool +_equalCoerceViaIO(CoerceViaIO *a, CoerceViaIO *b) +{ + COMPARE_NODE_FIELD(arg); + COMPARE_SCALAR_FIELD(resulttype); + + /* + * Special-case COERCE_DONTCARE, so that planner can build coercion nodes + * that are equal() to both explicit and implicit coercions. + */ + if (a->coerceformat != b->coerceformat && + a->coerceformat != COERCE_DONTCARE && + b->coerceformat != COERCE_DONTCARE) + return false; + + return true; +} + +static bool +_equalArrayCoerceExpr(ArrayCoerceExpr *a, ArrayCoerceExpr *b) +{ + COMPARE_NODE_FIELD(arg); + COMPARE_SCALAR_FIELD(elemfuncid); + COMPARE_SCALAR_FIELD(resulttype); + COMPARE_SCALAR_FIELD(resulttypmod); + COMPARE_SCALAR_FIELD(isExplicit); + + /* + * Special-case COERCE_DONTCARE, so that planner can build coercion nodes + * that are equal() to both explicit and implicit coercions. + */ + if (a->coerceformat != b->coerceformat && + a->coerceformat != COERCE_DONTCARE && + b->coerceformat != COERCE_DONTCARE) + return false; + + return true; +} + static bool _equalConvertRowtypeExpr(ConvertRowtypeExpr *a, ConvertRowtypeExpr *b) { @@ -372,8 +405,8 @@ _equalConvertRowtypeExpr(ConvertRowtypeExpr *a, ConvertRowtypeExpr *b) COMPARE_SCALAR_FIELD(resulttype); /* - * Special-case COERCE_DONTCARE, so that planner can build coercion - * nodes that are equal() to both explicit and implicit coercions. + * Special-case COERCE_DONTCARE, so that planner can build coercion nodes + * that are equal() to both explicit and implicit coercions. */ if (a->convertformat != b->convertformat && a->convertformat != COERCE_DONTCARE && @@ -430,8 +463,8 @@ _equalRowExpr(RowExpr *a, RowExpr *b) COMPARE_SCALAR_FIELD(row_typeid); /* - * Special-case COERCE_DONTCARE, so that planner can build coercion - * nodes that are equal() to both explicit and implicit coercions. + * Special-case COERCE_DONTCARE, so that planner can build coercion nodes + * that are equal() to both explicit and implicit coercions. */ if (a->row_format != b->row_format && a->row_format != COERCE_DONTCARE && @@ -441,6 +474,18 @@ _equalRowExpr(RowExpr *a, RowExpr *b) return true; } +static bool +_equalRowCompareExpr(RowCompareExpr *a, RowCompareExpr *b) +{ + COMPARE_SCALAR_FIELD(rctype); + COMPARE_NODE_FIELD(opnos); + COMPARE_NODE_FIELD(opfamilies); + COMPARE_NODE_FIELD(largs); + COMPARE_NODE_FIELD(rargs); + + return true; +} + static bool _equalCoalesceExpr(CoalesceExpr *a, CoalesceExpr *b) { @@ -460,6 +505,21 @@ _equalMinMaxExpr(MinMaxExpr *a, MinMaxExpr *b) return true; } +static bool +_equalXmlExpr(XmlExpr *a, XmlExpr *b) +{ + COMPARE_SCALAR_FIELD(op); + COMPARE_STRING_FIELD(name); + COMPARE_NODE_FIELD(named_args); + COMPARE_NODE_FIELD(arg_names); + COMPARE_NODE_FIELD(args); + COMPARE_SCALAR_FIELD(xmloption); + COMPARE_SCALAR_FIELD(type); + COMPARE_SCALAR_FIELD(typmod); + + return true; +} + static bool _equalNullIfExpr(NullIfExpr *a, NullIfExpr *b) { @@ -467,9 +527,9 @@ _equalNullIfExpr(NullIfExpr *a, NullIfExpr *b) /* * Special-case opfuncid: it is allowable for it to differ if one node - * contains zero and the other doesn't. This just means that the one - * node isn't as far along in the parse/plan pipeline and hasn't had - * the opfuncid cache filled yet. + * contains zero and the other doesn't. This just means that the one node + * isn't as far along in the parse/plan pipeline and hasn't had the + * opfuncid cache filled yet. */ if (a->opfuncid != b->opfuncid && a->opfuncid != 0 && @@ -509,8 +569,8 @@ _equalCoerceToDomain(CoerceToDomain *a, CoerceToDomain *b) COMPARE_SCALAR_FIELD(resulttypmod); /* - * Special-case COERCE_DONTCARE, so that planner can build coercion - * nodes that are equal() to both explicit and implicit coercions. + * Special-case COERCE_DONTCARE, so that planner can build coercion nodes + * that are equal() to both explicit and implicit coercions. */ if (a->coercionformat != b->coercionformat && a->coercionformat != COERCE_DONTCARE && @@ -538,6 +598,15 @@ _equalSetToDefault(SetToDefault *a, SetToDefault *b) return true; } +static bool +_equalCurrentOfExpr(CurrentOfExpr *a, CurrentOfExpr *b) +{ + COMPARE_SCALAR_FIELD(cvarno); + COMPARE_STRING_FIELD(cursor_name); + + return true; +} + static bool _equalTargetEntry(TargetEntry *a, TargetEntry *b) { @@ -590,10 +659,27 @@ _equalFromExpr(FromExpr *a, FromExpr *b) */ static bool -_equalPathKeyItem(PathKeyItem *a, PathKeyItem *b) +_equalPathKey(PathKey *a, PathKey *b) { - COMPARE_NODE_FIELD(key); - COMPARE_SCALAR_FIELD(sortop); + /* + * This is normally used on non-canonicalized PathKeys, so must chase + * up to the topmost merged EquivalenceClass and see if those are the + * same (by pointer equality). + */ + EquivalenceClass *a_eclass; + EquivalenceClass *b_eclass; + + a_eclass = a->pk_eclass; + while (a_eclass->ec_merged) + a_eclass = a_eclass->ec_merged; + b_eclass = b->pk_eclass; + while (b_eclass->ec_merged) + b_eclass = b_eclass->ec_merged; + if (a_eclass != b_eclass) + return false; + COMPARE_SCALAR_FIELD(pk_opfamily); + COMPARE_SCALAR_FIELD(pk_strategy); + COMPARE_SCALAR_FIELD(pk_nulls_first); return true; } @@ -603,22 +689,50 @@ _equalRestrictInfo(RestrictInfo *a, RestrictInfo *b) { COMPARE_NODE_FIELD(clause); COMPARE_SCALAR_FIELD(is_pushed_down); + COMPARE_SCALAR_FIELD(outerjoin_delayed); COMPARE_BITMAPSET_FIELD(required_relids); /* - * We ignore all the remaining fields, since they may not be set yet, - * and should be derivable from the clause anyway. + * We ignore all the remaining fields, since they may not be set yet, and + * should be derivable from the clause anyway. */ return true; } +static bool +_equalOuterJoinInfo(OuterJoinInfo *a, OuterJoinInfo *b) +{ + COMPARE_BITMAPSET_FIELD(min_lefthand); + COMPARE_BITMAPSET_FIELD(min_righthand); + COMPARE_SCALAR_FIELD(is_full_join); + COMPARE_SCALAR_FIELD(lhs_strict); + COMPARE_SCALAR_FIELD(delay_upper_joins); + + return true; +} + static bool _equalInClauseInfo(InClauseInfo *a, InClauseInfo *b) { COMPARE_BITMAPSET_FIELD(lefthand); COMPARE_BITMAPSET_FIELD(righthand); COMPARE_NODE_FIELD(sub_targetlist); + COMPARE_NODE_FIELD(in_operators); + + return true; +} + +static bool +_equalAppendRelInfo(AppendRelInfo *a, AppendRelInfo *b) +{ + COMPARE_SCALAR_FIELD(parent_relid); + COMPARE_SCALAR_FIELD(child_relid); + COMPARE_SCALAR_FIELD(parent_reltype); + COMPARE_SCALAR_FIELD(child_reltype); + COMPARE_NODE_FIELD(col_mappings); + COMPARE_NODE_FIELD(translated_vars); + COMPARE_SCALAR_FIELD(parent_reloid); return true; } @@ -636,23 +750,21 @@ _equalQuery(Query *a, Query *b) COMPARE_SCALAR_FIELD(canSetTag); COMPARE_NODE_FIELD(utilityStmt); COMPARE_SCALAR_FIELD(resultRelation); - COMPARE_NODE_FIELD(into); - COMPARE_SCALAR_FIELD(intoHasOids); + COMPARE_NODE_FIELD(intoClause); COMPARE_SCALAR_FIELD(hasAggs); COMPARE_SCALAR_FIELD(hasSubLinks); COMPARE_NODE_FIELD(rtable); COMPARE_NODE_FIELD(jointree); - COMPARE_NODE_FIELD(rowMarks); - COMPARE_SCALAR_FIELD(forUpdate); COMPARE_NODE_FIELD(targetList); + COMPARE_NODE_FIELD(returningList); COMPARE_NODE_FIELD(groupClause); COMPARE_NODE_FIELD(havingQual); COMPARE_NODE_FIELD(distinctClause); COMPARE_NODE_FIELD(sortClause); COMPARE_NODE_FIELD(limitOffset); COMPARE_NODE_FIELD(limitCount); + COMPARE_NODE_FIELD(rowMarks); COMPARE_NODE_FIELD(setOperations); - COMPARE_NODE_FIELD(resultRelations); return true; } @@ -662,8 +774,8 @@ _equalInsertStmt(InsertStmt *a, InsertStmt *b) { COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(cols); - COMPARE_NODE_FIELD(targetList); COMPARE_NODE_FIELD(selectStmt); + COMPARE_NODE_FIELD(returningList); return true; } @@ -672,8 +784,9 @@ static bool _equalDeleteStmt(DeleteStmt *a, DeleteStmt *b) { COMPARE_NODE_FIELD(relation); - COMPARE_NODE_FIELD(whereClause); COMPARE_NODE_FIELD(usingClause); + COMPARE_NODE_FIELD(whereClause); + COMPARE_NODE_FIELD(returningList); return true; } @@ -685,6 +798,7 @@ _equalUpdateStmt(UpdateStmt *a, UpdateStmt *b) COMPARE_NODE_FIELD(targetList); COMPARE_NODE_FIELD(whereClause); COMPARE_NODE_FIELD(fromClause); + COMPARE_NODE_FIELD(returningList); return true; } @@ -693,19 +807,17 @@ static bool _equalSelectStmt(SelectStmt *a, SelectStmt *b) { COMPARE_NODE_FIELD(distinctClause); - COMPARE_NODE_FIELD(into); - COMPARE_NODE_FIELD(intoColNames); - COMPARE_SCALAR_FIELD(intoHasOids); + COMPARE_NODE_FIELD(intoClause); COMPARE_NODE_FIELD(targetList); COMPARE_NODE_FIELD(fromClause); COMPARE_NODE_FIELD(whereClause); COMPARE_NODE_FIELD(groupClause); COMPARE_NODE_FIELD(havingClause); + COMPARE_NODE_FIELD(valuesLists); COMPARE_NODE_FIELD(sortClause); COMPARE_NODE_FIELD(limitOffset); COMPARE_NODE_FIELD(limitCount); - COMPARE_NODE_FIELD(lockedRels); - COMPARE_SCALAR_FIELD(forUpdate); + COMPARE_NODE_FIELD(lockingClause); COMPARE_SCALAR_FIELD(op); COMPARE_SCALAR_FIELD(all); COMPARE_NODE_FIELD(larg); @@ -722,6 +834,7 @@ _equalSetOperationStmt(SetOperationStmt *a, SetOperationStmt *b) COMPARE_NODE_FIELD(larg); COMPARE_NODE_FIELD(rarg); COMPARE_NODE_FIELD(colTypes); + COMPARE_NODE_FIELD(colTypmods); return true; } @@ -835,6 +948,7 @@ static bool _equalCopyStmt(CopyStmt *a, CopyStmt *b) { COMPARE_NODE_FIELD(relation); + COMPARE_NODE_FIELD(query); COMPARE_NODE_FIELD(attlist); COMPARE_SCALAR_FIELD(is_from); COMPARE_STRING_FIELD(filename); @@ -850,7 +964,7 @@ _equalCreateStmt(CreateStmt *a, CreateStmt *b) COMPARE_NODE_FIELD(tableElts); COMPARE_NODE_FIELD(inhRelations); COMPARE_NODE_FIELD(constraints); - COMPARE_SCALAR_FIELD(hasoids); + COMPARE_NODE_FIELD(options); COMPARE_SCALAR_FIELD(oncommit); COMPARE_STRING_FIELD(tablespacename); @@ -861,7 +975,7 @@ static bool _equalInhRelation(InhRelation *a, InhRelation *b) { COMPARE_NODE_FIELD(relation); - COMPARE_SCALAR_FIELD(including_defaults); + COMPARE_NODE_FIELD(options); return true; } @@ -870,7 +984,9 @@ static bool _equalDefineStmt(DefineStmt *a, DefineStmt *b) { COMPARE_SCALAR_FIELD(kind); + COMPARE_SCALAR_FIELD(oldstyle); COMPARE_NODE_FIELD(defnames); + COMPARE_NODE_FIELD(args); COMPARE_NODE_FIELD(definition); return true; @@ -882,6 +998,7 @@ _equalDropStmt(DropStmt *a, DropStmt *b) COMPARE_NODE_FIELD(objects); COMPARE_SCALAR_FIELD(removeType); COMPARE_SCALAR_FIELD(behavior); + COMPARE_SCALAR_FIELD(missing_ok); return true; } @@ -890,6 +1007,7 @@ static bool _equalTruncateStmt(TruncateStmt *a, TruncateStmt *b) { COMPARE_NODE_FIELD(relations); + COMPARE_SCALAR_FIELD(behavior); return true; } @@ -924,11 +1042,12 @@ _equalIndexStmt(IndexStmt *a, IndexStmt *b) COMPARE_STRING_FIELD(accessMethod); COMPARE_STRING_FIELD(tableSpace); COMPARE_NODE_FIELD(indexParams); + COMPARE_NODE_FIELD(options); COMPARE_NODE_FIELD(whereClause); - COMPARE_NODE_FIELD(rangetable); COMPARE_SCALAR_FIELD(unique); COMPARE_SCALAR_FIELD(primary); COMPARE_SCALAR_FIELD(isconstraint); + COMPARE_SCALAR_FIELD(concurrent); return true; } @@ -965,42 +1084,36 @@ _equalAlterFunctionStmt(AlterFunctionStmt *a, AlterFunctionStmt *b) return true; } -static bool -_equalRemoveAggrStmt(RemoveAggrStmt *a, RemoveAggrStmt *b) -{ - COMPARE_NODE_FIELD(aggname); - COMPARE_NODE_FIELD(aggtype); - COMPARE_SCALAR_FIELD(behavior); - - return true; -} - static bool _equalRemoveFuncStmt(RemoveFuncStmt *a, RemoveFuncStmt *b) { - COMPARE_NODE_FIELD(funcname); + COMPARE_SCALAR_FIELD(kind); + COMPARE_NODE_FIELD(name); COMPARE_NODE_FIELD(args); COMPARE_SCALAR_FIELD(behavior); + COMPARE_SCALAR_FIELD(missing_ok); return true; } static bool -_equalRemoveOperStmt(RemoveOperStmt *a, RemoveOperStmt *b) +_equalRemoveOpClassStmt(RemoveOpClassStmt *a, RemoveOpClassStmt *b) { - COMPARE_NODE_FIELD(opname); - COMPARE_NODE_FIELD(args); + COMPARE_NODE_FIELD(opclassname); + COMPARE_STRING_FIELD(amname); COMPARE_SCALAR_FIELD(behavior); + COMPARE_SCALAR_FIELD(missing_ok); return true; } static bool -_equalRemoveOpClassStmt(RemoveOpClassStmt *a, RemoveOpClassStmt *b) +_equalRemoveOpFamilyStmt(RemoveOpFamilyStmt *a, RemoveOpFamilyStmt *b) { - COMPARE_NODE_FIELD(opclassname); + COMPARE_NODE_FIELD(opfamilyname); COMPARE_STRING_FIELD(amname); COMPARE_SCALAR_FIELD(behavior); + COMPARE_SCALAR_FIELD(missing_ok); return true; } @@ -1008,12 +1121,25 @@ _equalRemoveOpClassStmt(RemoveOpClassStmt *a, RemoveOpClassStmt *b) static bool _equalRenameStmt(RenameStmt *a, RenameStmt *b) { + COMPARE_SCALAR_FIELD(renameType); COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(object); COMPARE_NODE_FIELD(objarg); COMPARE_STRING_FIELD(subname); COMPARE_STRING_FIELD(newname); - COMPARE_SCALAR_FIELD(renameType); + + return true; +} + +static bool +_equalAlterObjectSchemaStmt(AlterObjectSchemaStmt *a, AlterObjectSchemaStmt *b) +{ + COMPARE_SCALAR_FIELD(objectType); + COMPARE_NODE_FIELD(relation); + COMPARE_NODE_FIELD(object); + COMPARE_NODE_FIELD(objarg); + COMPARE_STRING_FIELD(addname); + COMPARE_STRING_FIELD(newschema); return true; } @@ -1021,12 +1147,12 @@ _equalRenameStmt(RenameStmt *a, RenameStmt *b) static bool _equalAlterOwnerStmt(AlterOwnerStmt *a, AlterOwnerStmt *b) { + COMPARE_SCALAR_FIELD(objectType); COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(object); COMPARE_NODE_FIELD(objarg); COMPARE_STRING_FIELD(addname); COMPARE_STRING_FIELD(newowner); - COMPARE_SCALAR_FIELD(objectType); return true; } @@ -1088,6 +1214,15 @@ _equalCompositeTypeStmt(CompositeTypeStmt *a, CompositeTypeStmt *b) return true; } +static bool +_equalCreateEnumStmt(CreateEnumStmt *a, CreateEnumStmt *b) +{ + COMPARE_NODE_FIELD(typename); + COMPARE_NODE_FIELD(vals); + + return true; +} + static bool _equalViewStmt(ViewStmt *a, ViewStmt *b) { @@ -1121,6 +1256,7 @@ static bool _equalCreateOpClassStmt(CreateOpClassStmt *a, CreateOpClassStmt *b) { COMPARE_NODE_FIELD(opclassname); + COMPARE_NODE_FIELD(opfamilyname); COMPARE_STRING_FIELD(amname); COMPARE_NODE_FIELD(datatype); COMPARE_NODE_FIELD(items); @@ -1137,11 +1273,32 @@ _equalCreateOpClassItem(CreateOpClassItem *a, CreateOpClassItem *b) COMPARE_NODE_FIELD(args); COMPARE_SCALAR_FIELD(number); COMPARE_SCALAR_FIELD(recheck); + COMPARE_NODE_FIELD(class_args); COMPARE_NODE_FIELD(storedtype); return true; } +static bool +_equalCreateOpFamilyStmt(CreateOpFamilyStmt *a, CreateOpFamilyStmt *b) +{ + COMPARE_NODE_FIELD(opfamilyname); + COMPARE_STRING_FIELD(amname); + + return true; +} + +static bool +_equalAlterOpFamilyStmt(AlterOpFamilyStmt *a, AlterOpFamilyStmt *b) +{ + COMPARE_NODE_FIELD(opfamilyname); + COMPARE_STRING_FIELD(amname); + COMPARE_SCALAR_FIELD(isDrop); + COMPARE_NODE_FIELD(items); + + return true; +} + static bool _equalCreatedbStmt(CreatedbStmt *a, CreatedbStmt *b) { @@ -1174,6 +1331,7 @@ static bool _equalDropdbStmt(DropdbStmt *a, DropdbStmt *b) { COMPARE_STRING_FIELD(dbname); + COMPARE_SCALAR_FIELD(missing_ok); return true; } @@ -1184,8 +1342,8 @@ _equalVacuumStmt(VacuumStmt *a, VacuumStmt *b) COMPARE_SCALAR_FIELD(vacuum); COMPARE_SCALAR_FIELD(full); COMPARE_SCALAR_FIELD(analyze); - COMPARE_SCALAR_FIELD(freeze); COMPARE_SCALAR_FIELD(verbose); + COMPARE_SCALAR_FIELD(freeze_min_age); COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(va_cols); @@ -1246,6 +1404,14 @@ _equalVariableResetStmt(VariableResetStmt *a, VariableResetStmt *b) return true; } +static bool +_equalDiscardStmt(DiscardStmt *a, DiscardStmt *b) +{ + COMPARE_SCALAR_FIELD(target); + + return true; +} + static bool _equalCreateTableSpaceStmt(CreateTableSpaceStmt *a, CreateTableSpaceStmt *b) { @@ -1260,6 +1426,7 @@ static bool _equalDropTableSpaceStmt(DropTableSpaceStmt *a, DropTableSpaceStmt *b) { COMPARE_STRING_FIELD(tablespacename); + COMPARE_SCALAR_FIELD(missing_ok); return true; } @@ -1290,6 +1457,7 @@ _equalDropPropertyStmt(DropPropertyStmt *a, DropPropertyStmt *b) COMPARE_STRING_FIELD(property); COMPARE_SCALAR_FIELD(removeType); COMPARE_SCALAR_FIELD(behavior); + COMPARE_SCALAR_FIELD(missing_ok); return true; } @@ -1310,6 +1478,7 @@ _equalDropPLangStmt(DropPLangStmt *a, DropPLangStmt *b) { COMPARE_STRING_FIELD(plname); COMPARE_SCALAR_FIELD(behavior); + COMPARE_SCALAR_FIELD(missing_ok); return true; } @@ -1348,6 +1517,7 @@ static bool _equalDropRoleStmt(DropRoleStmt *a, DropRoleStmt *b) { COMPARE_NODE_FIELD(roles); + COMPARE_SCALAR_FIELD(missing_ok); return true; } @@ -1422,6 +1592,7 @@ _equalDropCastStmt(DropCastStmt *a, DropCastStmt *b) COMPARE_NODE_FIELD(sourcetype); COMPARE_NODE_FIELD(targettype); COMPARE_SCALAR_FIELD(behavior); + COMPARE_SCALAR_FIELD(missing_ok); return true; } @@ -1431,7 +1602,6 @@ _equalPrepareStmt(PrepareStmt *a, PrepareStmt *b) { COMPARE_STRING_FIELD(name); COMPARE_NODE_FIELD(argtypes); - COMPARE_NODE_FIELD(argtype_oids); COMPARE_NODE_FIELD(query); return true; @@ -1455,10 +1625,23 @@ _equalDeallocateStmt(DeallocateStmt *a, DeallocateStmt *b) return true; } +static bool +_equalDropOwnedStmt(DropOwnedStmt *a, DropOwnedStmt *b) +{ + COMPARE_NODE_FIELD(roles); + COMPARE_SCALAR_FIELD(behavior); -/* - * stuff from parsenodes.h - */ + return true; +} + +static bool +_equalReassignOwnedStmt(ReassignOwnedStmt *a, ReassignOwnedStmt *b) +{ + COMPARE_NODE_FIELD(roles); + COMPARE_NODE_FIELD(newrole); + + return true; +} static bool _equalAExpr(A_Expr *a, A_Expr *b) @@ -1467,6 +1650,7 @@ _equalAExpr(A_Expr *a, A_Expr *b) COMPARE_NODE_FIELD(name); COMPARE_NODE_FIELD(lexpr); COMPARE_NODE_FIELD(rexpr); + COMPARE_SCALAR_FIELD(location); return true; } @@ -1475,6 +1659,7 @@ static bool _equalColumnRef(ColumnRef *a, ColumnRef *b) { COMPARE_NODE_FIELD(fields); + COMPARE_SCALAR_FIELD(location); return true; } @@ -1504,6 +1689,7 @@ _equalFuncCall(FuncCall *a, FuncCall *b) COMPARE_NODE_FIELD(args); COMPARE_SCALAR_FIELD(agg_star); COMPARE_SCALAR_FIELD(agg_distinct); + COMPARE_SCALAR_FIELD(location); return true; } @@ -1532,6 +1718,7 @@ _equalResTarget(ResTarget *a, ResTarget *b) COMPARE_STRING_FIELD(name); COMPARE_NODE_FIELD(indirection); COMPARE_NODE_FIELD(val); + COMPARE_SCALAR_FIELD(location); return true; } @@ -1544,8 +1731,10 @@ _equalTypeName(TypeName *a, TypeName *b) COMPARE_SCALAR_FIELD(timezone); COMPARE_SCALAR_FIELD(setof); COMPARE_SCALAR_FIELD(pct_type); - COMPARE_SCALAR_FIELD(typmod); + COMPARE_NODE_FIELD(typmods); + COMPARE_SCALAR_FIELD(typemod); COMPARE_NODE_FIELD(arrayBounds); + COMPARE_SCALAR_FIELD(location); return true; } @@ -1562,7 +1751,8 @@ _equalTypeCast(TypeCast *a, TypeCast *b) static bool _equalSortBy(SortBy *a, SortBy *b) { - COMPARE_SCALAR_FIELD(sortby_kind); + COMPARE_SCALAR_FIELD(sortby_dir); + COMPARE_SCALAR_FIELD(sortby_nulls); COMPARE_NODE_FIELD(useOp); COMPARE_NODE_FIELD(node); @@ -1594,6 +1784,8 @@ _equalIndexElem(IndexElem *a, IndexElem *b) COMPARE_STRING_FIELD(name); COMPARE_NODE_FIELD(expr); COMPARE_NODE_FIELD(opclass); + COMPARE_SCALAR_FIELD(ordering); + COMPARE_SCALAR_FIELD(nulls_ordering); return true; } @@ -1609,7 +1801,6 @@ _equalColumnDef(ColumnDef *a, ColumnDef *b) COMPARE_NODE_FIELD(raw_default); COMPARE_STRING_FIELD(cooked_default); COMPARE_NODE_FIELD(constraints); - COMPARE_NODE_FIELD(support); return true; } @@ -1622,6 +1813,7 @@ _equalConstraint(Constraint *a, Constraint *b) COMPARE_NODE_FIELD(raw_expr); COMPARE_STRING_FIELD(cooked_expr); COMPARE_NODE_FIELD(keys); + COMPARE_NODE_FIELD(options); COMPARE_STRING_FIELD(indexspace); return true; @@ -1636,6 +1828,16 @@ _equalDefElem(DefElem *a, DefElem *b) return true; } +static bool +_equalLockingClause(LockingClause *a, LockingClause *b) +{ + COMPARE_NODE_FIELD(lockedRels); + COMPARE_SCALAR_FIELD(forUpdate); + COMPARE_SCALAR_FIELD(noWait); + + return true; +} + static bool _equalRangeTblEntry(RangeTblEntry *a, RangeTblEntry *b) { @@ -1643,7 +1845,9 @@ _equalRangeTblEntry(RangeTblEntry *a, RangeTblEntry *b) COMPARE_SCALAR_FIELD(relid); COMPARE_NODE_FIELD(subquery); COMPARE_NODE_FIELD(funcexpr); - COMPARE_NODE_FIELD(coldeflist); + COMPARE_NODE_FIELD(funccoltypes); + COMPARE_NODE_FIELD(funccoltypmods); + COMPARE_NODE_FIELD(values_lists); COMPARE_SCALAR_FIELD(jointype); COMPARE_NODE_FIELD(joinaliasvars); COMPARE_NODE_FIELD(alias); @@ -1661,6 +1865,17 @@ _equalSortClause(SortClause *a, SortClause *b) { COMPARE_SCALAR_FIELD(tleSortGroupRef); COMPARE_SCALAR_FIELD(sortop); + COMPARE_SCALAR_FIELD(nulls_first); + + return true; +} + +static bool +_equalRowMarkClause(RowMarkClause *a, RowMarkClause *b) +{ + COMPARE_SCALAR_FIELD(rti); + COMPARE_SCALAR_FIELD(forUpdate); + COMPARE_SCALAR_FIELD(noWait); return true; } @@ -1682,6 +1897,15 @@ _equalFkConstraint(FkConstraint *a, FkConstraint *b) return true; } +static bool +_equalXmlSerialize(XmlSerialize *a, XmlSerialize *b) +{ + COMPARE_SCALAR_FIELD(xmloption); + COMPARE_NODE_FIELD(expr); + COMPARE_NODE_FIELD(typename); + + return true; +} /* * Stuff from pg_list.h @@ -1694,15 +1918,15 @@ _equalList(List *a, List *b) ListCell *item_b; /* - * Try to reject by simple scalar checks before grovelling through all - * the list elements... + * Try to reject by simple scalar checks before grovelling through all the + * list elements... */ COMPARE_SCALAR_FIELD(type); COMPARE_SCALAR_FIELD(length); /* - * We place the switch outside the loop for the sake of efficiency; - * this may not be worth doing... + * We place the switch outside the loop for the sake of efficiency; this + * may not be worth doing... */ switch (a->type) { @@ -1807,6 +2031,9 @@ equal(void *a, void *b) case T_RangeVar: retval = _equalRangeVar(a, b); break; + case T_IntoClause: + retval = _equalIntoClause(a, b); + break; case T_Var: retval = _equalVar(a, b); break; @@ -1852,6 +2079,12 @@ equal(void *a, void *b) case T_RelabelType: retval = _equalRelabelType(a, b); break; + case T_CoerceViaIO: + retval = _equalCoerceViaIO(a, b); + break; + case T_ArrayCoerceExpr: + retval = _equalArrayCoerceExpr(a, b); + break; case T_ConvertRowtypeExpr: retval = _equalConvertRowtypeExpr(a, b); break; @@ -1870,12 +2103,18 @@ equal(void *a, void *b) case T_RowExpr: retval = _equalRowExpr(a, b); break; + case T_RowCompareExpr: + retval = _equalRowCompareExpr(a, b); + break; case T_CoalesceExpr: retval = _equalCoalesceExpr(a, b); break; case T_MinMaxExpr: retval = _equalMinMaxExpr(a, b); break; + case T_XmlExpr: + retval = _equalXmlExpr(a, b); + break; case T_NullIfExpr: retval = _equalNullIfExpr(a, b); break; @@ -1894,6 +2133,9 @@ equal(void *a, void *b) case T_SetToDefault: retval = _equalSetToDefault(a, b); break; + case T_CurrentOfExpr: + retval = _equalCurrentOfExpr(a, b); + break; case T_TargetEntry: retval = _equalTargetEntry(a, b); break; @@ -1910,15 +2152,21 @@ equal(void *a, void *b) /* * RELATION NODES */ - case T_PathKeyItem: - retval = _equalPathKeyItem(a, b); + case T_PathKey: + retval = _equalPathKey(a, b); break; case T_RestrictInfo: retval = _equalRestrictInfo(a, b); break; + case T_OuterJoinInfo: + retval = _equalOuterJoinInfo(a, b); + break; case T_InClauseInfo: retval = _equalInClauseInfo(a, b); break; + case T_AppendRelInfo: + retval = _equalAppendRelInfo(a, b); + break; case T_List: case T_IntList: case T_OidList: @@ -2014,21 +2262,21 @@ equal(void *a, void *b) case T_AlterFunctionStmt: retval = _equalAlterFunctionStmt(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_RemoveOpClassStmt: retval = _equalRemoveOpClassStmt(a, b); break; + case T_RemoveOpFamilyStmt: + retval = _equalRemoveOpFamilyStmt(a, b); + break; case T_RenameStmt: retval = _equalRenameStmt(a, b); break; + case T_AlterObjectSchemaStmt: + retval = _equalAlterObjectSchemaStmt(a, b); + break; case T_AlterOwnerStmt: retval = _equalAlterOwnerStmt(a, b); break; @@ -2050,6 +2298,9 @@ equal(void *a, void *b) case T_CompositeTypeStmt: retval = _equalCompositeTypeStmt(a, b); break; + case T_CreateEnumStmt: + retval = _equalCreateEnumStmt(a, b); + break; case T_ViewStmt: retval = _equalViewStmt(a, b); break; @@ -2065,6 +2316,12 @@ equal(void *a, void *b) case T_CreateOpClassItem: retval = _equalCreateOpClassItem(a, b); break; + case T_CreateOpFamilyStmt: + retval = _equalCreateOpFamilyStmt(a, b); + break; + case T_AlterOpFamilyStmt: + retval = _equalAlterOpFamilyStmt(a, b); + break; case T_CreatedbStmt: retval = _equalCreatedbStmt(a, b); break; @@ -2098,6 +2355,9 @@ equal(void *a, void *b) case T_VariableResetStmt: retval = _equalVariableResetStmt(a, b); break; + case T_DiscardStmt: + retval = _equalDiscardStmt(a, b); + break; case T_CreateTableSpaceStmt: retval = _equalCreateTableSpaceStmt(a, b); break; @@ -2161,6 +2421,13 @@ equal(void *a, void *b) case T_DeallocateStmt: retval = _equalDeallocateStmt(a, b); break; + case T_DropOwnedStmt: + retval = _equalDropOwnedStmt(a, b); + break; + + case T_ReassignOwnedStmt: + retval = _equalReassignOwnedStmt(a, b); + break; case T_A_Expr: retval = _equalAExpr(a, b); @@ -2213,6 +2480,9 @@ equal(void *a, void *b) case T_DefElem: retval = _equalDefElem(a, b); break; + case T_LockingClause: + retval = _equalLockingClause(a, b); + break; case T_RangeTblEntry: retval = _equalRangeTblEntry(a, b); break; @@ -2223,6 +2493,9 @@ equal(void *a, void *b) /* GroupClause is equivalent to SortClause */ retval = _equalSortClause(a, b); break; + case T_RowMarkClause: + retval = _equalRowMarkClause(a, b); + break; case T_FkConstraint: retval = _equalFkConstraint(a, b); break; @@ -2232,6 +2505,9 @@ equal(void *a, void *b) case T_FuncWithArgs: retval = _equalFuncWithArgs(a, b); break; + case T_XmlSerialize: + retval = _equalXmlSerialize(a, b); + break; default: elog(ERROR, "unrecognized node type: %d",