X-Git-Url: https://granicus.if.org/sourcecode?a=blobdiff_plain;f=src%2Fbackend%2Fnodes%2Fcopyfuncs.c;h=1e79857d80739d26ae18721521c4b8ed4866273b;hb=984a6ced3ece409e97b74ce163297b8193eeeb6c;hp=e260bc6595077d21a6e21841aeae90412ec94a5a;hpb=e69785debfcca308a5999946bbf4cfefd0ab5e3c;p=postgresql diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index e260bc6595..1e79857d80 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -4,18 +4,18 @@ * Copy functions for Postgres tree nodes. * * NOTE: we currently support copying all node types found in parse and - * plan trees. We do not support copying executor state trees; there + * plan trees. We do not support copying executor state trees; there * is no need for that, and no point in maintaining all the code that * would be needed. We also do not support copying Path trees, mainly * because the circular linkages between RelOptInfo and Path nodes can't * be handled easily in a simple depth-first traversal. * * - * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.235 2003/01/10 21:08:10 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.328 2006/03/03 03:30:52 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -30,7 +30,7 @@ /* * Macros to simplify copying of different kinds of fields. Use these - * wherever possible to reduce the chance for silly typos. Note that these + * wherever possible to reduce the chance for silly typos. Note that these * hard-wire the convention that the local variables in a Copy routine are * named 'newnode' and 'from'. */ @@ -43,9 +43,9 @@ #define COPY_NODE_FIELD(fldname) \ (newnode->fldname = copyObject(from->fldname)) -/* Copy a field that is a pointer to a list of integers */ -#define COPY_INTLIST_FIELD(fldname) \ - (newnode->fldname = listCopy(from->fldname)) +/* Copy a field that is a pointer to a Bitmapset */ +#define COPY_BITMAPSET_FIELD(fldname) \ + (newnode->fldname = bms_copy(from->fldname)) /* Copy a field that is a pointer to a C string, or perhaps NULL */ #define COPY_STRING_FIELD(fldname) \ @@ -60,39 +60,6 @@ } while (0) -/* - * listCopy - * This copy function only copies the "cons-cells" of the list, not the - * pointed-to objects. (Use copyObject if you want a "deep" copy.) - * - * We also use this function for copying lists of integers, which is - * grotty but unlikely to break --- it could fail if sizeof(pointer) - * is less than sizeof(int), but I don't know any such machines... - * - * Note that copyObject will surely coredump if applied to a list - * of integers! - */ -List * -listCopy(List *list) -{ - List *newlist, - *l, - *nl; - - /* rather ugly coding for speed... */ - if (list == NIL) - return NIL; - - newlist = nl = makeList1(lfirst(list)); - - foreach(l, lnext(list)) - { - lnext(nl) = makeList1(lfirst(l)); - nl = lnext(nl); - } - return newlist; -} - /* **************************************************************** * plannodes.h copy functions * **************************************************************** @@ -116,8 +83,8 @@ CopyPlanFields(Plan *from, Plan *newnode) COPY_NODE_FIELD(lefttree); COPY_NODE_FIELD(righttree); COPY_NODE_FIELD(initPlan); - COPY_INTLIST_FIELD(extParam); - COPY_INTLIST_FIELD(locParam); + COPY_BITMAPSET_FIELD(extParam); + COPY_BITMAPSET_FIELD(allParam); COPY_SCALAR_FIELD(nParamExec); } @@ -181,6 +148,48 @@ _copyAppend(Append *from) return newnode; } +/* + * _copyBitmapAnd + */ +static BitmapAnd * +_copyBitmapAnd(BitmapAnd *from) +{ + BitmapAnd *newnode = makeNode(BitmapAnd); + + /* + * copy node superclass fields + */ + CopyPlanFields((Plan *) from, (Plan *) newnode); + + /* + * copy remainder of node + */ + COPY_NODE_FIELD(bitmapplans); + + return newnode; +} + +/* + * _copyBitmapOr + */ +static BitmapOr * +_copyBitmapOr(BitmapOr *from) +{ + BitmapOr *newnode = makeNode(BitmapOr); + + /* + * copy node superclass fields + */ + CopyPlanFields((Plan *) from, (Plan *) newnode); + + /* + * copy remainder of node + */ + COPY_NODE_FIELD(bitmapplans); + + return newnode; +} + /* * CopyScanFields @@ -244,10 +253,58 @@ _copyIndexScan(IndexScan *from) /* * copy remainder of node */ - COPY_INTLIST_FIELD(indxid); - COPY_NODE_FIELD(indxqual); - COPY_NODE_FIELD(indxqualorig); - COPY_SCALAR_FIELD(indxorderdir); + COPY_SCALAR_FIELD(indexid); + COPY_NODE_FIELD(indexqual); + COPY_NODE_FIELD(indexqualorig); + COPY_NODE_FIELD(indexstrategy); + COPY_NODE_FIELD(indexsubtype); + COPY_SCALAR_FIELD(indexorderdir); + + return newnode; +} + +/* + * _copyBitmapIndexScan + */ +static BitmapIndexScan * +_copyBitmapIndexScan(BitmapIndexScan *from) +{ + BitmapIndexScan *newnode = makeNode(BitmapIndexScan); + + /* + * copy node superclass fields + */ + CopyScanFields((Scan *) from, (Scan *) newnode); + + /* + * copy remainder of node + */ + COPY_SCALAR_FIELD(indexid); + COPY_NODE_FIELD(indexqual); + COPY_NODE_FIELD(indexqualorig); + COPY_NODE_FIELD(indexstrategy); + COPY_NODE_FIELD(indexsubtype); + + return newnode; +} + +/* + * _copyBitmapHeapScan + */ +static BitmapHeapScan * +_copyBitmapHeapScan(BitmapHeapScan *from) +{ + BitmapHeapScan *newnode = makeNode(BitmapHeapScan); + + /* + * copy node superclass fields + */ + CopyScanFields((Scan *) from, (Scan *) newnode); + + /* + * copy remainder of node + */ + COPY_NODE_FIELD(bitmapqualorig); return newnode; } @@ -268,7 +325,7 @@ _copyTidScan(TidScan *from) /* * copy remainder of node */ - COPY_NODE_FIELD(tideval); + COPY_NODE_FIELD(tidquals); return newnode; } @@ -433,7 +490,9 @@ _copySort(Sort *from) */ CopyPlanFields((Plan *) from, (Plan *) newnode); - COPY_SCALAR_FIELD(keycount); + COPY_SCALAR_FIELD(numCols); + COPY_POINTER_FIELD(sortColIdx, from->numCols * sizeof(AttrNumber)); + COPY_POINTER_FIELD(sortOperators, from->numCols * sizeof(Oid)); return newnode; } @@ -512,7 +571,6 @@ _copyHash(Hash *from) /* * copy remainder of node */ - COPY_NODE_FIELD(hashkeys); return newnode; } @@ -568,26 +626,6 @@ _copyLimit(Limit *from) * **************************************************************** */ -/* - * _copyResdom - */ -static Resdom * -_copyResdom(Resdom *from) -{ - Resdom *newnode = makeNode(Resdom); - - COPY_SCALAR_FIELD(resno); - COPY_SCALAR_FIELD(restype); - COPY_SCALAR_FIELD(restypmod); - COPY_STRING_FIELD(resname); - COPY_SCALAR_FIELD(ressortgroupref); - COPY_SCALAR_FIELD(reskey); - COPY_SCALAR_FIELD(reskeyop); - COPY_SCALAR_FIELD(resjunk); - - return newnode; -} - /* * _copyAlias */ @@ -622,7 +660,7 @@ _copyRangeVar(RangeVar *from) /* * We don't need a _copyExpr because Expr is an abstract supertype which - * should never actually get instantiated. Also, since it has no common + * should never actually get instantiated. Also, since it has no common * fields except NodeTag, there's no need for a helper routine to factor * out copying the common fields... */ @@ -708,6 +746,7 @@ _copyAggref(Aggref *from) COPY_SCALAR_FIELD(aggfnoid); COPY_SCALAR_FIELD(aggtype); COPY_NODE_FIELD(target); + COPY_SCALAR_FIELD(agglevelsup); COPY_SCALAR_FIELD(aggstar); COPY_SCALAR_FIELD(aggdistinct); @@ -723,10 +762,8 @@ _copyArrayRef(ArrayRef *from) ArrayRef *newnode = makeNode(ArrayRef); COPY_SCALAR_FIELD(refrestype); - COPY_SCALAR_FIELD(refattrlength); - COPY_SCALAR_FIELD(refelemlength); - COPY_SCALAR_FIELD(refelembyval); - COPY_SCALAR_FIELD(refelemalign); + COPY_SCALAR_FIELD(refarraytype); + COPY_SCALAR_FIELD(refelemtype); COPY_NODE_FIELD(refupperindexpr); COPY_NODE_FIELD(reflowerindexpr); COPY_NODE_FIELD(refexpr); @@ -741,7 +778,7 @@ _copyArrayRef(ArrayRef *from) static FuncExpr * _copyFuncExpr(FuncExpr *from) { - FuncExpr *newnode = makeNode(FuncExpr); + FuncExpr *newnode = makeNode(FuncExpr); COPY_SCALAR_FIELD(funcid); COPY_SCALAR_FIELD(funcresulttype); @@ -770,12 +807,12 @@ _copyOpExpr(OpExpr *from) } /* - * _copyDistinctExpr + * _copyDistinctExpr (same as OpExpr) */ static DistinctExpr * _copyDistinctExpr(DistinctExpr *from) { - DistinctExpr *newnode = makeNode(DistinctExpr); + DistinctExpr *newnode = makeNode(DistinctExpr); COPY_SCALAR_FIELD(opno); COPY_SCALAR_FIELD(opfuncid); @@ -786,13 +823,29 @@ _copyDistinctExpr(DistinctExpr *from) return newnode; } +/* + * _copyScalarArrayOpExpr + */ +static ScalarArrayOpExpr * +_copyScalarArrayOpExpr(ScalarArrayOpExpr *from) +{ + ScalarArrayOpExpr *newnode = makeNode(ScalarArrayOpExpr); + + COPY_SCALAR_FIELD(opno); + COPY_SCALAR_FIELD(opfuncid); + COPY_SCALAR_FIELD(useOr); + COPY_NODE_FIELD(args); + + return newnode; +} + /* * _copyBoolExpr */ static BoolExpr * _copyBoolExpr(BoolExpr *from) { - BoolExpr *newnode = makeNode(BoolExpr); + BoolExpr *newnode = makeNode(BoolExpr); COPY_SCALAR_FIELD(boolop); COPY_NODE_FIELD(args); @@ -809,10 +862,8 @@ _copySubLink(SubLink *from) SubLink *newnode = makeNode(SubLink); COPY_SCALAR_FIELD(subLinkType); - COPY_SCALAR_FIELD(useOr); - COPY_NODE_FIELD(lefthand); + COPY_NODE_FIELD(testexpr); COPY_NODE_FIELD(operName); - COPY_INTLIST_FIELD(operOids); COPY_NODE_FIELD(subselect); return newnode; @@ -827,16 +878,15 @@ _copySubPlan(SubPlan *from) SubPlan *newnode = makeNode(SubPlan); COPY_SCALAR_FIELD(subLinkType); - COPY_SCALAR_FIELD(useOr); - COPY_NODE_FIELD(exprs); - COPY_INTLIST_FIELD(paramIds); + COPY_NODE_FIELD(testexpr); + COPY_NODE_FIELD(paramIds); COPY_NODE_FIELD(plan); COPY_SCALAR_FIELD(plan_id); COPY_NODE_FIELD(rtable); COPY_SCALAR_FIELD(useHashTable); COPY_SCALAR_FIELD(unknownEqFalse); - COPY_INTLIST_FIELD(setParam); - COPY_INTLIST_FIELD(parParam); + COPY_NODE_FIELD(setParam); + COPY_NODE_FIELD(parParam); COPY_NODE_FIELD(args); return newnode; @@ -858,6 +908,22 @@ _copyFieldSelect(FieldSelect *from) return newnode; } +/* + * _copyFieldStore + */ +static FieldStore * +_copyFieldStore(FieldStore *from) +{ + FieldStore *newnode = makeNode(FieldStore); + + COPY_NODE_FIELD(arg); + COPY_NODE_FIELD(newvals); + COPY_NODE_FIELD(fieldnums); + COPY_SCALAR_FIELD(resulttype); + + return newnode; +} + /* * _copyRelabelType */ @@ -874,6 +940,21 @@ _copyRelabelType(RelabelType *from) return newnode; } +/* + * _copyConvertRowtypeExpr + */ +static ConvertRowtypeExpr * +_copyConvertRowtypeExpr(ConvertRowtypeExpr *from) +{ + ConvertRowtypeExpr *newnode = makeNode(ConvertRowtypeExpr); + + COPY_NODE_FIELD(arg); + COPY_SCALAR_FIELD(resulttype); + COPY_SCALAR_FIELD(convertformat); + + return newnode; +} + /* * _copyCaseExpr */ @@ -904,6 +985,114 @@ _copyCaseWhen(CaseWhen *from) return newnode; } +/* + * _copyCaseTestExpr + */ +static CaseTestExpr * +_copyCaseTestExpr(CaseTestExpr *from) +{ + CaseTestExpr *newnode = makeNode(CaseTestExpr); + + COPY_SCALAR_FIELD(typeId); + COPY_SCALAR_FIELD(typeMod); + + return newnode; +} + +/* + * _copyArrayExpr + */ +static ArrayExpr * +_copyArrayExpr(ArrayExpr *from) +{ + ArrayExpr *newnode = makeNode(ArrayExpr); + + COPY_SCALAR_FIELD(array_typeid); + COPY_SCALAR_FIELD(element_typeid); + COPY_NODE_FIELD(elements); + COPY_SCALAR_FIELD(multidims); + + return newnode; +} + +/* + * _copyRowExpr + */ +static RowExpr * +_copyRowExpr(RowExpr *from) +{ + RowExpr *newnode = makeNode(RowExpr); + + COPY_NODE_FIELD(args); + COPY_SCALAR_FIELD(row_typeid); + COPY_SCALAR_FIELD(row_format); + + return newnode; +} + +/* + * _copyRowCompareExpr + */ +static RowCompareExpr * +_copyRowCompareExpr(RowCompareExpr *from) +{ + RowCompareExpr *newnode = makeNode(RowCompareExpr); + + COPY_SCALAR_FIELD(rctype); + COPY_NODE_FIELD(opnos); + COPY_NODE_FIELD(opclasses); + COPY_NODE_FIELD(largs); + COPY_NODE_FIELD(rargs); + + return newnode; +} + +/* + * _copyCoalesceExpr + */ +static CoalesceExpr * +_copyCoalesceExpr(CoalesceExpr *from) +{ + CoalesceExpr *newnode = makeNode(CoalesceExpr); + + COPY_SCALAR_FIELD(coalescetype); + COPY_NODE_FIELD(args); + + return newnode; +} + +/* + * _copyMinMaxExpr + */ +static MinMaxExpr * +_copyMinMaxExpr(MinMaxExpr *from) +{ + MinMaxExpr *newnode = makeNode(MinMaxExpr); + + COPY_SCALAR_FIELD(minmaxtype); + COPY_SCALAR_FIELD(op); + COPY_NODE_FIELD(args); + + return newnode; +} + +/* + * _copyNullIfExpr (same as OpExpr) + */ +static NullIfExpr * +_copyNullIfExpr(NullIfExpr *from) +{ + NullIfExpr *newnode = makeNode(NullIfExpr); + + COPY_SCALAR_FIELD(opno); + COPY_SCALAR_FIELD(opfuncid); + COPY_SCALAR_FIELD(opresulttype); + COPY_SCALAR_FIELD(opretset); + COPY_NODE_FIELD(args); + + return newnode; +} + /* * _copyNullTest */ @@ -933,29 +1122,42 @@ _copyBooleanTest(BooleanTest *from) } /* - * _copyConstraintTest + * _copyCoerceToDomain */ -static ConstraintTest * -_copyConstraintTest(ConstraintTest *from) +static CoerceToDomain * +_copyCoerceToDomain(CoerceToDomain *from) { - ConstraintTest *newnode = makeNode(ConstraintTest); + CoerceToDomain *newnode = makeNode(CoerceToDomain); COPY_NODE_FIELD(arg); - COPY_SCALAR_FIELD(testtype); - COPY_STRING_FIELD(name); - COPY_STRING_FIELD(domname); - COPY_NODE_FIELD(check_expr); + COPY_SCALAR_FIELD(resulttype); + COPY_SCALAR_FIELD(resulttypmod); + COPY_SCALAR_FIELD(coercionformat); + + return newnode; +} + +/* + * _copyCoerceToDomainValue + */ +static CoerceToDomainValue * +_copyCoerceToDomainValue(CoerceToDomainValue *from) +{ + CoerceToDomainValue *newnode = makeNode(CoerceToDomainValue); + + COPY_SCALAR_FIELD(typeId); + COPY_SCALAR_FIELD(typeMod); return newnode; } /* - * _copyConstraintTestValue + * _copySetToDefault */ -static ConstraintTestValue * -_copyConstraintTestValue(ConstraintTestValue *from) +static SetToDefault * +_copySetToDefault(SetToDefault *from) { - ConstraintTestValue *newnode = makeNode(ConstraintTestValue); + SetToDefault *newnode = makeNode(SetToDefault); COPY_SCALAR_FIELD(typeId); COPY_SCALAR_FIELD(typeMod); @@ -971,8 +1173,13 @@ _copyTargetEntry(TargetEntry *from) { TargetEntry *newnode = makeNode(TargetEntry); - COPY_NODE_FIELD(resdom); COPY_NODE_FIELD(expr); + COPY_SCALAR_FIELD(resno); + COPY_STRING_FIELD(resname); + COPY_SCALAR_FIELD(ressortgroupref); + COPY_SCALAR_FIELD(resorigtbl); + COPY_SCALAR_FIELD(resorigcol); + COPY_SCALAR_FIELD(resjunk); return newnode; } @@ -1055,8 +1262,14 @@ _copyRestrictInfo(RestrictInfo *from) RestrictInfo *newnode = makeNode(RestrictInfo); COPY_NODE_FIELD(clause); - COPY_SCALAR_FIELD(ispusheddown); - COPY_NODE_FIELD(subclauseindices); /* XXX probably bad */ + COPY_SCALAR_FIELD(is_pushed_down); + COPY_SCALAR_FIELD(outerjoin_delayed); + COPY_SCALAR_FIELD(can_join); + COPY_BITMAPSET_FIELD(clause_relids); + COPY_BITMAPSET_FIELD(required_relids); + COPY_BITMAPSET_FIELD(left_relids); + COPY_BITMAPSET_FIELD(right_relids); + COPY_NODE_FIELD(orclause); COPY_SCALAR_FIELD(eval_cost); COPY_SCALAR_FIELD(this_selec); COPY_SCALAR_FIELD(mergejoinoperator); @@ -1064,8 +1277,7 @@ _copyRestrictInfo(RestrictInfo *from) COPY_SCALAR_FIELD(right_sortop); /* - * Do not copy pathkeys, since they'd not be canonical in a copied - * query + * Do not copy pathkeys, since they'd not be canonical in a copied query */ newnode->left_pathkey = NIL; newnode->right_pathkey = NIL; @@ -1080,15 +1292,51 @@ _copyRestrictInfo(RestrictInfo *from) } /* - * _copyJoinInfo + * _copyOuterJoinInfo */ -static JoinInfo * -_copyJoinInfo(JoinInfo *from) +static OuterJoinInfo * +_copyOuterJoinInfo(OuterJoinInfo *from) { - JoinInfo *newnode = makeNode(JoinInfo); + OuterJoinInfo *newnode = makeNode(OuterJoinInfo); - COPY_INTLIST_FIELD(unjoined_relids); - COPY_NODE_FIELD(jinfo_restrictinfo); + COPY_BITMAPSET_FIELD(min_lefthand); + COPY_BITMAPSET_FIELD(min_righthand); + COPY_SCALAR_FIELD(is_full_join); + COPY_SCALAR_FIELD(lhs_strict); + + return newnode; +} + +/* + * _copyInClauseInfo + */ +static InClauseInfo * +_copyInClauseInfo(InClauseInfo *from) +{ + InClauseInfo *newnode = makeNode(InClauseInfo); + + COPY_BITMAPSET_FIELD(lefthand); + COPY_BITMAPSET_FIELD(righthand); + COPY_NODE_FIELD(sub_targetlist); + + return newnode; +} + +/* + * _copyAppendRelInfo + */ +static AppendRelInfo * +_copyAppendRelInfo(AppendRelInfo *from) +{ + AppendRelInfo *newnode = makeNode(AppendRelInfo); + + COPY_SCALAR_FIELD(parent_relid); + COPY_SCALAR_FIELD(child_relid); + COPY_SCALAR_FIELD(parent_reltype); + COPY_SCALAR_FIELD(child_reltype); + COPY_NODE_FIELD(col_mappings); + COPY_NODE_FIELD(translated_vars); + COPY_SCALAR_FIELD(parent_reloid); return newnode; } @@ -1114,8 +1362,7 @@ _copyRangeTblEntry(RangeTblEntry *from) COPY_NODE_FIELD(eref); COPY_SCALAR_FIELD(inh); COPY_SCALAR_FIELD(inFromCl); - COPY_SCALAR_FIELD(checkForRead); - COPY_SCALAR_FIELD(checkForWrite); + COPY_SCALAR_FIELD(requiredPerms); COPY_SCALAR_FIELD(checkAsUser); return newnode; @@ -1167,7 +1414,7 @@ _copyAExpr(A_Expr *from) { A_Expr *newnode = makeNode(A_Expr); - COPY_SCALAR_FIELD(oper); + COPY_SCALAR_FIELD(kind); COPY_NODE_FIELD(name); COPY_NODE_FIELD(lexpr); COPY_NODE_FIELD(rexpr); @@ -1181,7 +1428,6 @@ _copyColumnRef(ColumnRef *from) ColumnRef *newnode = makeNode(ColumnRef); COPY_NODE_FIELD(fields); - COPY_NODE_FIELD(indirection); return newnode; } @@ -1192,8 +1438,6 @@ _copyParamRef(ParamRef *from) ParamRef *newnode = makeNode(ParamRef); COPY_SCALAR_FIELD(number); - COPY_NODE_FIELD(fields); - COPY_NODE_FIELD(indirection); return newnode; } @@ -1219,7 +1463,8 @@ _copyAConst(A_Const *from) /* nothing to do */ break; default: - elog(ERROR, "_copyAConst: unknown node type %d", from->val.type); + elog(ERROR, "unrecognized node type: %d", + (int) from->val.type); break; } @@ -1252,13 +1497,12 @@ _copyAIndices(A_Indices *from) return newnode; } -static ExprFieldSelect * -_copyExprFieldSelect(ExprFieldSelect *from) +static A_Indirection * +_copyA_Indirection(A_Indirection *from) { - ExprFieldSelect *newnode = makeNode(ExprFieldSelect); + A_Indirection *newnode = makeNode(A_Indirection); COPY_NODE_FIELD(arg); - COPY_NODE_FIELD(fields); COPY_NODE_FIELD(indirection); return newnode; @@ -1292,11 +1536,12 @@ _copyTypeName(TypeName *from) return newnode; } -static SortGroupBy * -_copySortGroupBy(SortGroupBy *from) +static SortBy * +_copySortBy(SortBy *from) { - SortGroupBy *newnode = makeNode(SortGroupBy); + SortBy *newnode = makeNode(SortBy); + COPY_SCALAR_FIELD(sortby_kind); COPY_NODE_FIELD(useOp); COPY_NODE_FIELD(node); @@ -1343,8 +1588,7 @@ _copyIndexElem(IndexElem *from) IndexElem *newnode = makeNode(IndexElem); COPY_STRING_FIELD(name); - COPY_NODE_FIELD(funcname); - COPY_NODE_FIELD(args); + COPY_NODE_FIELD(expr); COPY_NODE_FIELD(opclass); return newnode; @@ -1378,6 +1622,7 @@ _copyConstraint(Constraint *from) COPY_NODE_FIELD(raw_expr); COPY_STRING_FIELD(cooked_expr); COPY_NODE_FIELD(keys); + COPY_STRING_FIELD(indexspace); return newnode; } @@ -1393,6 +1638,18 @@ _copyDefElem(DefElem *from) return newnode; } +static LockingClause * +_copyLockingClause(LockingClause *from) +{ + LockingClause *newnode = makeNode(LockingClause); + + COPY_NODE_FIELD(lockedRels); + COPY_SCALAR_FIELD(forUpdate); + COPY_SCALAR_FIELD(nowait); + + return newnode; +} + static Query * _copyQuery(Query *from) { @@ -1400,16 +1657,20 @@ _copyQuery(Query *from) COPY_SCALAR_FIELD(commandType); COPY_SCALAR_FIELD(querySource); + COPY_SCALAR_FIELD(canSetTag); COPY_NODE_FIELD(utilityStmt); COPY_SCALAR_FIELD(resultRelation); COPY_NODE_FIELD(into); - COPY_SCALAR_FIELD(isPortal); - COPY_SCALAR_FIELD(isBinary); + COPY_SCALAR_FIELD(intoHasOids); + COPY_SCALAR_FIELD(intoOnCommit); + COPY_STRING_FIELD(intoTableSpaceName); COPY_SCALAR_FIELD(hasAggs); COPY_SCALAR_FIELD(hasSubLinks); COPY_NODE_FIELD(rtable); COPY_NODE_FIELD(jointree); - COPY_INTLIST_FIELD(rowMarks); + COPY_NODE_FIELD(rowMarks); + COPY_SCALAR_FIELD(forUpdate); + COPY_SCALAR_FIELD(rowNoWait); COPY_NODE_FIELD(targetList); COPY_NODE_FIELD(groupClause); COPY_NODE_FIELD(havingQual); @@ -1418,14 +1679,7 @@ _copyQuery(Query *from) COPY_NODE_FIELD(limitOffset); COPY_NODE_FIELD(limitCount); COPY_NODE_FIELD(setOperations); - COPY_INTLIST_FIELD(resultRelations); - - /* - * We do not copy the planner internal fields: base_rel_list, - * other_rel_list, join_rel_list, equi_key_list, query_pathkeys, - * hasJoinRTEs. That would get us into copying RelOptInfo/Path - * trees, which we don't want to do. - */ + COPY_NODE_FIELD(resultRelations); return newnode; } @@ -1450,6 +1704,7 @@ _copyDeleteStmt(DeleteStmt *from) COPY_NODE_FIELD(relation); COPY_NODE_FIELD(whereClause); + COPY_NODE_FIELD(usingClause); return newnode; } @@ -1475,17 +1730,18 @@ _copySelectStmt(SelectStmt *from) COPY_NODE_FIELD(distinctClause); COPY_NODE_FIELD(into); COPY_NODE_FIELD(intoColNames); + COPY_SCALAR_FIELD(intoHasOids); + COPY_SCALAR_FIELD(intoOnCommit); + COPY_STRING_FIELD(intoTableSpaceName); COPY_NODE_FIELD(targetList); COPY_NODE_FIELD(fromClause); COPY_NODE_FIELD(whereClause); COPY_NODE_FIELD(groupClause); COPY_NODE_FIELD(havingClause); COPY_NODE_FIELD(sortClause); - COPY_STRING_FIELD(portalname); - COPY_SCALAR_FIELD(binary); COPY_NODE_FIELD(limitOffset); COPY_NODE_FIELD(limitCount); - COPY_NODE_FIELD(forUpdate); + COPY_NODE_FIELD(lockingClause); COPY_SCALAR_FIELD(op); COPY_SCALAR_FIELD(all); COPY_NODE_FIELD(larg); @@ -1503,7 +1759,7 @@ _copySetOperationStmt(SetOperationStmt *from) COPY_SCALAR_FIELD(all); COPY_NODE_FIELD(larg); COPY_NODE_FIELD(rarg); - COPY_INTLIST_FIELD(colTypes); + COPY_NODE_FIELD(colTypes); return newnode; } @@ -1513,10 +1769,22 @@ _copyAlterTableStmt(AlterTableStmt *from) { AlterTableStmt *newnode = makeNode(AlterTableStmt); - COPY_SCALAR_FIELD(subtype); COPY_NODE_FIELD(relation); + COPY_NODE_FIELD(cmds); + COPY_SCALAR_FIELD(relkind); + + return newnode; +} + +static AlterTableCmd * +_copyAlterTableCmd(AlterTableCmd *from) +{ + AlterTableCmd *newnode = makeNode(AlterTableCmd); + + COPY_SCALAR_FIELD(subtype); COPY_STRING_FIELD(name); COPY_NODE_FIELD(def); + COPY_NODE_FIELD(transform); COPY_SCALAR_FIELD(behavior); return newnode; @@ -1534,7 +1802,7 @@ _copyAlterDomainStmt(AlterDomainStmt *from) COPY_SCALAR_FIELD(behavior); return newnode; -} +} static GrantStmt * _copyGrantStmt(GrantStmt *from) @@ -1544,8 +1812,10 @@ _copyGrantStmt(GrantStmt *from) COPY_SCALAR_FIELD(is_grant); COPY_SCALAR_FIELD(objtype); COPY_NODE_FIELD(objects); - COPY_INTLIST_FIELD(privileges); + COPY_NODE_FIELD(privileges); COPY_NODE_FIELD(grantees); + COPY_SCALAR_FIELD(grant_option); + COPY_SCALAR_FIELD(behavior); return newnode; } @@ -1555,8 +1825,7 @@ _copyPrivGrantee(PrivGrantee *from) { PrivGrantee *newnode = makeNode(PrivGrantee); - COPY_STRING_FIELD(username); - COPY_STRING_FIELD(groupname); + COPY_STRING_FIELD(rolname); return newnode; } @@ -1572,14 +1841,32 @@ _copyFuncWithArgs(FuncWithArgs *from) return newnode; } -static InsertDefault * -_copyInsertDefault(InsertDefault *from) +static GrantRoleStmt * +_copyGrantRoleStmt(GrantRoleStmt *from) { - InsertDefault *newnode = makeNode(InsertDefault); + GrantRoleStmt *newnode = makeNode(GrantRoleStmt); + + COPY_NODE_FIELD(granted_roles); + COPY_NODE_FIELD(grantee_roles); + COPY_SCALAR_FIELD(is_grant); + COPY_SCALAR_FIELD(admin_opt); + COPY_STRING_FIELD(grantor); + COPY_SCALAR_FIELD(behavior); return newnode; } +static DeclareCursorStmt * +_copyDeclareCursorStmt(DeclareCursorStmt *from) +{ + DeclareCursorStmt *newnode = makeNode(DeclareCursorStmt); + + COPY_STRING_FIELD(portalname); + COPY_SCALAR_FIELD(options); + COPY_NODE_FIELD(query); + + return newnode; +} static ClosePortalStmt * _copyClosePortalStmt(ClosePortalStmt *from) @@ -1627,6 +1914,18 @@ _copyCreateStmt(CreateStmt *from) COPY_NODE_FIELD(constraints); COPY_SCALAR_FIELD(hasoids); COPY_SCALAR_FIELD(oncommit); + COPY_STRING_FIELD(tablespacename); + + return newnode; +} + +static InhRelation * +_copyInhRelation(InhRelation *from) +{ + InhRelation *newnode = makeNode(InhRelation); + + COPY_NODE_FIELD(relation); + COPY_SCALAR_FIELD(including_defaults); return newnode; } @@ -1636,7 +1935,7 @@ _copyDefineStmt(DefineStmt *from) { DefineStmt *newnode = makeNode(DefineStmt); - COPY_SCALAR_FIELD(defType); + COPY_SCALAR_FIELD(kind); COPY_NODE_FIELD(defnames); COPY_NODE_FIELD(definition); @@ -1651,6 +1950,7 @@ _copyDropStmt(DropStmt *from) COPY_NODE_FIELD(objects); COPY_SCALAR_FIELD(removeType); COPY_SCALAR_FIELD(behavior); + COPY_SCALAR_FIELD(missing_ok); return newnode; } @@ -1660,7 +1960,8 @@ _copyTruncateStmt(TruncateStmt *from) { TruncateStmt *newnode = makeNode(TruncateStmt); - COPY_NODE_FIELD(relation); + COPY_NODE_FIELD(relations); + COPY_SCALAR_FIELD(behavior); return newnode; } @@ -1699,6 +2000,7 @@ _copyIndexStmt(IndexStmt *from) COPY_STRING_FIELD(idxname); COPY_NODE_FIELD(relation); COPY_STRING_FIELD(accessMethod); + COPY_STRING_FIELD(tableSpace); COPY_NODE_FIELD(indexParams); COPY_NODE_FIELD(whereClause); COPY_NODE_FIELD(rangetable); @@ -1716,7 +2018,7 @@ _copyCreateFunctionStmt(CreateFunctionStmt *from) COPY_SCALAR_FIELD(replace); COPY_NODE_FIELD(funcname); - COPY_NODE_FIELD(argTypes); + COPY_NODE_FIELD(parameters); COPY_NODE_FIELD(returnType); COPY_NODE_FIELD(options); COPY_NODE_FIELD(withClause); @@ -1724,6 +2026,29 @@ _copyCreateFunctionStmt(CreateFunctionStmt *from) return newnode; } +static FunctionParameter * +_copyFunctionParameter(FunctionParameter *from) +{ + FunctionParameter *newnode = makeNode(FunctionParameter); + + COPY_STRING_FIELD(name); + COPY_NODE_FIELD(argType); + COPY_SCALAR_FIELD(mode); + + return newnode; +} + +static AlterFunctionStmt * +_copyAlterFunctionStmt(AlterFunctionStmt *from) +{ + AlterFunctionStmt *newnode = makeNode(AlterFunctionStmt); + + COPY_NODE_FIELD(func); + COPY_NODE_FIELD(actions); + + return newnode; +} + static RemoveAggrStmt * _copyRemoveAggrStmt(RemoveAggrStmt *from) { @@ -1777,10 +2102,42 @@ _copyRenameStmt(RenameStmt *from) { RenameStmt *newnode = makeNode(RenameStmt); + COPY_SCALAR_FIELD(renameType); COPY_NODE_FIELD(relation); - COPY_STRING_FIELD(oldname); + COPY_NODE_FIELD(object); + COPY_NODE_FIELD(objarg); + COPY_STRING_FIELD(subname); COPY_STRING_FIELD(newname); - COPY_SCALAR_FIELD(renameType); + + return newnode; +} + +static AlterObjectSchemaStmt * +_copyAlterObjectSchemaStmt(AlterObjectSchemaStmt *from) +{ + AlterObjectSchemaStmt *newnode = makeNode(AlterObjectSchemaStmt); + + COPY_SCALAR_FIELD(objectType); + COPY_NODE_FIELD(relation); + COPY_NODE_FIELD(object); + COPY_NODE_FIELD(objarg); + COPY_STRING_FIELD(addname); + COPY_STRING_FIELD(newschema); + + return newnode; +} + +static AlterOwnerStmt * +_copyAlterOwnerStmt(AlterOwnerStmt *from) +{ + AlterOwnerStmt *newnode = makeNode(AlterOwnerStmt); + + COPY_SCALAR_FIELD(objectType); + COPY_NODE_FIELD(relation); + COPY_NODE_FIELD(object); + COPY_NODE_FIELD(objarg); + COPY_STRING_FIELD(addname); + COPY_STRING_FIELD(newowner); return newnode; } @@ -1836,8 +2193,9 @@ _copyTransactionStmt(TransactionStmt *from) { TransactionStmt *newnode = makeNode(TransactionStmt); - COPY_SCALAR_FIELD(command); + COPY_SCALAR_FIELD(kind); COPY_NODE_FIELD(options); + COPY_STRING_FIELD(gid); return newnode; } @@ -1928,6 +2286,17 @@ _copyCreatedbStmt(CreatedbStmt *from) return newnode; } +static AlterDatabaseStmt * +_copyAlterDatabaseStmt(AlterDatabaseStmt *from) +{ + AlterDatabaseStmt *newnode = makeNode(AlterDatabaseStmt); + + COPY_STRING_FIELD(dbname); + COPY_NODE_FIELD(options); + + return newnode; +} + static AlterDatabaseSetStmt * _copyAlterDatabaseSetStmt(AlterDatabaseSetStmt *from) { @@ -1946,6 +2315,7 @@ _copyDropdbStmt(DropdbStmt *from) DropdbStmt *newnode = makeNode(DropdbStmt); COPY_STRING_FIELD(dbname); + COPY_SCALAR_FIELD(missing_ok); return newnode; } @@ -1989,6 +2359,17 @@ _copyCreateSeqStmt(CreateSeqStmt *from) return newnode; } +static AlterSeqStmt * +_copyAlterSeqStmt(AlterSeqStmt *from) +{ + AlterSeqStmt *newnode = makeNode(AlterSeqStmt); + + COPY_NODE_FIELD(sequence); + COPY_NODE_FIELD(options); + + return newnode; +} + static VariableSetStmt * _copyVariableSetStmt(VariableSetStmt *from) { @@ -2021,6 +2402,28 @@ _copyVariableResetStmt(VariableResetStmt *from) return newnode; } +static CreateTableSpaceStmt * +_copyCreateTableSpaceStmt(CreateTableSpaceStmt *from) +{ + CreateTableSpaceStmt *newnode = makeNode(CreateTableSpaceStmt); + + COPY_STRING_FIELD(tablespacename); + COPY_STRING_FIELD(owner); + COPY_STRING_FIELD(location); + + return newnode; +} + +static DropTableSpaceStmt * +_copyDropTableSpaceStmt(DropTableSpaceStmt *from) +{ + DropTableSpaceStmt *newnode = makeNode(DropTableSpaceStmt); + + COPY_STRING_FIELD(tablespacename); + + return newnode; +} + static CreateTrigStmt * _copyCreateTrigStmt(CreateTrigStmt *from) { @@ -2032,7 +2435,7 @@ _copyCreateTrigStmt(CreateTrigStmt *from) COPY_NODE_FIELD(args); COPY_SCALAR_FIELD(before); COPY_SCALAR_FIELD(row); - strcpy(newnode->actions, from->actions); /* in-line string field */ + strcpy(newnode->actions, from->actions); /* in-line string field */ COPY_SCALAR_FIELD(isconstraint); COPY_SCALAR_FIELD(deferrable); COPY_SCALAR_FIELD(initdeferred); @@ -2078,46 +2481,49 @@ _copyDropPLangStmt(DropPLangStmt *from) return newnode; } -static CreateUserStmt * -_copyCreateUserStmt(CreateUserStmt *from) +static CreateRoleStmt * +_copyCreateRoleStmt(CreateRoleStmt *from) { - CreateUserStmt *newnode = makeNode(CreateUserStmt); + CreateRoleStmt *newnode = makeNode(CreateRoleStmt); - COPY_STRING_FIELD(user); + COPY_SCALAR_FIELD(stmt_type); + COPY_STRING_FIELD(role); COPY_NODE_FIELD(options); return newnode; } -static AlterUserStmt * -_copyAlterUserStmt(AlterUserStmt *from) +static AlterRoleStmt * +_copyAlterRoleStmt(AlterRoleStmt *from) { - AlterUserStmt *newnode = makeNode(AlterUserStmt); + AlterRoleStmt *newnode = makeNode(AlterRoleStmt); - COPY_STRING_FIELD(user); + COPY_STRING_FIELD(role); COPY_NODE_FIELD(options); + COPY_SCALAR_FIELD(action); return newnode; } -static AlterUserSetStmt * -_copyAlterUserSetStmt(AlterUserSetStmt *from) +static AlterRoleSetStmt * +_copyAlterRoleSetStmt(AlterRoleSetStmt *from) { - AlterUserSetStmt *newnode = makeNode(AlterUserSetStmt); + AlterRoleSetStmt *newnode = makeNode(AlterRoleSetStmt); - COPY_STRING_FIELD(user); + COPY_STRING_FIELD(role); COPY_STRING_FIELD(variable); COPY_NODE_FIELD(value); return newnode; } -static DropUserStmt * -_copyDropUserStmt(DropUserStmt *from) +static DropRoleStmt * +_copyDropRoleStmt(DropRoleStmt *from) { - DropUserStmt *newnode = makeNode(DropUserStmt); + DropRoleStmt *newnode = makeNode(DropRoleStmt); - COPY_NODE_FIELD(users); + COPY_NODE_FIELD(roles); + COPY_SCALAR_FIELD(missing_ok); return newnode; } @@ -2129,6 +2535,7 @@ _copyLockStmt(LockStmt *from) COPY_NODE_FIELD(relations); COPY_SCALAR_FIELD(mode); + COPY_SCALAR_FIELD(nowait); return newnode; } @@ -2144,49 +2551,16 @@ _copyConstraintsSetStmt(ConstraintsSetStmt *from) return newnode; } -static CreateGroupStmt * -_copyCreateGroupStmt(CreateGroupStmt *from) -{ - CreateGroupStmt *newnode = makeNode(CreateGroupStmt); - - COPY_STRING_FIELD(name); - COPY_NODE_FIELD(options); - - return newnode; -} - -static AlterGroupStmt * -_copyAlterGroupStmt(AlterGroupStmt *from) -{ - AlterGroupStmt *newnode = makeNode(AlterGroupStmt); - - COPY_STRING_FIELD(name); - COPY_SCALAR_FIELD(action); - COPY_NODE_FIELD(listUsers); - - return newnode; -} - -static DropGroupStmt * -_copyDropGroupStmt(DropGroupStmt *from) -{ - DropGroupStmt *newnode = makeNode(DropGroupStmt); - - COPY_STRING_FIELD(name); - - return newnode; -} - static ReindexStmt * _copyReindexStmt(ReindexStmt *from) { ReindexStmt *newnode = makeNode(ReindexStmt); - COPY_SCALAR_FIELD(reindexType); + COPY_SCALAR_FIELD(kind); COPY_NODE_FIELD(relation); COPY_STRING_FIELD(name); - COPY_SCALAR_FIELD(force); - COPY_SCALAR_FIELD(all); + COPY_SCALAR_FIELD(do_system); + COPY_SCALAR_FIELD(do_user); return newnode; } @@ -2249,7 +2623,7 @@ _copyPrepareStmt(PrepareStmt *from) COPY_STRING_FIELD(name); COPY_NODE_FIELD(argtypes); - COPY_INTLIST_FIELD(argtype_oids); + COPY_NODE_FIELD(argtype_oids); COPY_NODE_FIELD(query); return newnode; @@ -2262,6 +2636,10 @@ _copyExecuteStmt(ExecuteStmt *from) COPY_STRING_FIELD(name); COPY_NODE_FIELD(into); + COPY_SCALAR_FIELD(into_contains_oids); + COPY_SCALAR_FIELD(into_has_oids); + COPY_SCALAR_FIELD(into_on_commit); + COPY_STRING_FIELD(into_tbl_space); COPY_NODE_FIELD(params); return newnode; @@ -2277,12 +2655,74 @@ _copyDeallocateStmt(DeallocateStmt *from) return newnode; } +static DropOwnedStmt * +_copyDropOwnedStmt(DropOwnedStmt * from) +{ + DropOwnedStmt *newnode = makeNode(DropOwnedStmt); + + COPY_NODE_FIELD(roles); + COPY_SCALAR_FIELD(behavior); + + return newnode; +} + +static ReassignOwnedStmt * +_copyReassignOwnedStmt(ReassignOwnedStmt * from) +{ + ReassignOwnedStmt *newnode = makeNode(ReassignOwnedStmt); + + COPY_NODE_FIELD(roles); + COPY_SCALAR_FIELD(newrole); + + return newnode; +} /* **************************************************************** * pg_list.h copy functions * **************************************************************** */ +/* + * Perform a deep copy of the specified list, using copyObject(). The + * list MUST be of type T_List; T_IntList and T_OidList nodes don't + * need deep copies, so they should be copied via list_copy() + */ +#define COPY_NODE_CELL(new, old) \ + (new) = (ListCell *) palloc(sizeof(ListCell)); \ + lfirst(new) = copyObject(lfirst(old)); + +static List * +_copyList(List *from) +{ + List *new; + ListCell *curr_old; + ListCell *prev_new; + + Assert(list_length(from) >= 1); + + new = makeNode(List); + new->length = from->length; + + COPY_NODE_CELL(new->head, from->head); + prev_new = new->head; + curr_old = lnext(from->head); + + while (curr_old) + { + COPY_NODE_CELL(prev_new->next, curr_old); + prev_new = prev_new->next; + curr_old = curr_old->next; + } + prev_new->next = NULL; + new->tail = prev_new; + + return new; +} + +/* **************************************************************** + * value.h copy functions + * **************************************************************** + */ static Value * _copyValue(Value *from) { @@ -2305,7 +2745,8 @@ _copyValue(Value *from) /* nothing to do */ break; default: - elog(ERROR, "_copyValue: unknown node type %d", from->type); + elog(ERROR, "unrecognized node type: %d", + (int) from->type); break; } return newnode; @@ -2339,6 +2780,12 @@ copyObject(void *from) case T_Append: retval = _copyAppend(from); break; + case T_BitmapAnd: + retval = _copyBitmapAnd(from); + break; + case T_BitmapOr: + retval = _copyBitmapOr(from); + break; case T_Scan: retval = _copyScan(from); break; @@ -2348,6 +2795,12 @@ copyObject(void *from) case T_IndexScan: retval = _copyIndexScan(from); break; + case T_BitmapIndexScan: + retval = _copyBitmapIndexScan(from); + break; + case T_BitmapHeapScan: + retval = _copyBitmapHeapScan(from); + break; case T_TidScan: retval = _copyTidScan(from); break; @@ -2397,9 +2850,6 @@ copyObject(void *from) /* * PRIMITIVE NODES */ - case T_Resdom: - retval = _copyResdom(from); - break; case T_Alias: retval = _copyAlias(from); break; @@ -2430,6 +2880,9 @@ copyObject(void *from) case T_DistinctExpr: retval = _copyDistinctExpr(from); break; + case T_ScalarArrayOpExpr: + retval = _copyScalarArrayOpExpr(from); + break; case T_BoolExpr: retval = _copyBoolExpr(from); break; @@ -2442,26 +2895,56 @@ copyObject(void *from) case T_FieldSelect: retval = _copyFieldSelect(from); break; + case T_FieldStore: + retval = _copyFieldStore(from); + break; case T_RelabelType: retval = _copyRelabelType(from); break; + case T_ConvertRowtypeExpr: + retval = _copyConvertRowtypeExpr(from); + break; case T_CaseExpr: retval = _copyCaseExpr(from); break; case T_CaseWhen: retval = _copyCaseWhen(from); break; + case T_CaseTestExpr: + retval = _copyCaseTestExpr(from); + break; + case T_ArrayExpr: + retval = _copyArrayExpr(from); + break; + case T_RowExpr: + retval = _copyRowExpr(from); + break; + case T_RowCompareExpr: + retval = _copyRowCompareExpr(from); + break; + case T_CoalesceExpr: + retval = _copyCoalesceExpr(from); + break; + case T_MinMaxExpr: + retval = _copyMinMaxExpr(from); + break; + case T_NullIfExpr: + retval = _copyNullIfExpr(from); + break; case T_NullTest: retval = _copyNullTest(from); break; case T_BooleanTest: retval = _copyBooleanTest(from); break; - case T_ConstraintTest: - retval = _copyConstraintTest(from); + case T_CoerceToDomain: + retval = _copyCoerceToDomain(from); break; - case T_ConstraintTestValue: - retval = _copyConstraintTestValue(from); + case T_CoerceToDomainValue: + retval = _copyCoerceToDomainValue(from); + break; + case T_SetToDefault: + retval = _copySetToDefault(from); break; case T_TargetEntry: retval = _copyTargetEntry(from); @@ -2485,8 +2968,14 @@ copyObject(void *from) case T_RestrictInfo: retval = _copyRestrictInfo(from); break; - case T_JoinInfo: - retval = _copyJoinInfo(from); + case T_OuterJoinInfo: + retval = _copyOuterJoinInfo(from); + break; + case T_InClauseInfo: + retval = _copyInClauseInfo(from); + break; + case T_AppendRelInfo: + retval = _copyAppendRelInfo(from); break; /* @@ -2499,23 +2988,21 @@ copyObject(void *from) case T_Null: retval = _copyValue(from); break; - case T_List: - { - List *list = from, - *l, - *nl; - /* rather ugly coding for speed... */ - /* Note the input list cannot be NIL if we got here. */ - nl = makeList1(copyObject(lfirst(list))); - retval = nl; + /* + * LIST NODES + */ + case T_List: + retval = _copyList(from); + break; - foreach(l, lnext(list)) - { - lnext(nl) = makeList1(copyObject(lfirst(l))); - nl = lnext(nl); - } - } + /* + * Lists of integers and OIDs don't need to be deep-copied, so we + * perform a shallow copy via list_copy() + */ + case T_IntList: + case T_OidList: + retval = list_copy(from); break; /* @@ -2542,12 +3029,21 @@ copyObject(void *from) case T_AlterTableStmt: retval = _copyAlterTableStmt(from); break; + case T_AlterTableCmd: + retval = _copyAlterTableCmd(from); + break; case T_AlterDomainStmt: retval = _copyAlterDomainStmt(from); break; case T_GrantStmt: retval = _copyGrantStmt(from); break; + case T_GrantRoleStmt: + retval = _copyGrantRoleStmt(from); + break; + case T_DeclareCursorStmt: + retval = _copyDeclareCursorStmt(from); + break; case T_ClosePortalStmt: retval = _copyClosePortalStmt(from); break; @@ -2560,6 +3056,9 @@ copyObject(void *from) case T_CreateStmt: retval = _copyCreateStmt(from); break; + case T_InhRelation: + retval = _copyInhRelation(from); + break; case T_DefineStmt: retval = _copyDefineStmt(from); break; @@ -2581,6 +3080,12 @@ copyObject(void *from) case T_CreateFunctionStmt: retval = _copyCreateFunctionStmt(from); break; + case T_FunctionParameter: + retval = _copyFunctionParameter(from); + break; + case T_AlterFunctionStmt: + retval = _copyAlterFunctionStmt(from); + break; case T_RemoveAggrStmt: retval = _copyRemoveAggrStmt(from); break; @@ -2596,6 +3101,12 @@ copyObject(void *from) case T_RenameStmt: retval = _copyRenameStmt(from); break; + case T_AlterObjectSchemaStmt: + retval = _copyAlterObjectSchemaStmt(from); + break; + case T_AlterOwnerStmt: + retval = _copyAlterOwnerStmt(from); + break; case T_RuleStmt: retval = _copyRuleStmt(from); break; @@ -2632,6 +3143,9 @@ copyObject(void *from) case T_CreatedbStmt: retval = _copyCreatedbStmt(from); break; + case T_AlterDatabaseStmt: + retval = _copyAlterDatabaseStmt(from); + break; case T_AlterDatabaseSetStmt: retval = _copyAlterDatabaseSetStmt(from); break; @@ -2647,6 +3161,9 @@ copyObject(void *from) case T_CreateSeqStmt: retval = _copyCreateSeqStmt(from); break; + case T_AlterSeqStmt: + retval = _copyAlterSeqStmt(from); + break; case T_VariableSetStmt: retval = _copyVariableSetStmt(from); break; @@ -2656,6 +3173,12 @@ copyObject(void *from) case T_VariableResetStmt: retval = _copyVariableResetStmt(from); break; + case T_CreateTableSpaceStmt: + retval = _copyCreateTableSpaceStmt(from); + break; + case T_DropTableSpaceStmt: + retval = _copyDropTableSpaceStmt(from); + break; case T_CreateTrigStmt: retval = _copyCreateTrigStmt(from); break; @@ -2668,17 +3191,17 @@ copyObject(void *from) case T_DropPLangStmt: retval = _copyDropPLangStmt(from); break; - case T_CreateUserStmt: - retval = _copyCreateUserStmt(from); + case T_CreateRoleStmt: + retval = _copyCreateRoleStmt(from); break; - case T_AlterUserStmt: - retval = _copyAlterUserStmt(from); + case T_AlterRoleStmt: + retval = _copyAlterRoleStmt(from); break; - case T_AlterUserSetStmt: - retval = _copyAlterUserSetStmt(from); + case T_AlterRoleSetStmt: + retval = _copyAlterRoleSetStmt(from); break; - case T_DropUserStmt: - retval = _copyDropUserStmt(from); + case T_DropRoleStmt: + retval = _copyDropRoleStmt(from); break; case T_LockStmt: retval = _copyLockStmt(from); @@ -2686,15 +3209,6 @@ copyObject(void *from) case T_ConstraintsSetStmt: retval = _copyConstraintsSetStmt(from); break; - case T_CreateGroupStmt: - retval = _copyCreateGroupStmt(from); - break; - case T_AlterGroupStmt: - retval = _copyAlterGroupStmt(from); - break; - case T_DropGroupStmt: - retval = _copyDropGroupStmt(from); - break; case T_ReindexStmt: retval = _copyReindexStmt(from); break; @@ -2722,6 +3236,12 @@ copyObject(void *from) case T_DeallocateStmt: retval = _copyDeallocateStmt(from); break; + case T_DropOwnedStmt: + retval = _copyDropOwnedStmt(from); + break; + case T_ReassignOwnedStmt: + retval = _copyReassignOwnedStmt(from); + break; case T_A_Expr: retval = _copyAExpr(from); @@ -2741,8 +3261,8 @@ copyObject(void *from) case T_A_Indices: retval = _copyAIndices(from); break; - case T_ExprFieldSelect: - retval = _copyExprFieldSelect(from); + case T_A_Indirection: + retval = _copyA_Indirection(from); break; case T_ResTarget: retval = _copyResTarget(from); @@ -2750,8 +3270,8 @@ copyObject(void *from) case T_TypeCast: retval = _copyTypeCast(from); break; - case T_SortGroupBy: - retval = _copySortGroupBy(from); + case T_SortBy: + retval = _copySortBy(from); break; case T_RangeSubselect: retval = _copyRangeSubselect(from); @@ -2774,6 +3294,9 @@ copyObject(void *from) case T_DefElem: retval = _copyDefElem(from); break; + case T_LockingClause: + retval = _copyLockingClause(from); + break; case T_RangeTblEntry: retval = _copyRangeTblEntry(from); break; @@ -2792,13 +3315,9 @@ copyObject(void *from) case T_FuncWithArgs: retval = _copyFuncWithArgs(from); break; - case T_InsertDefault: - retval = _copyInsertDefault(from); - break; default: - elog(ERROR, "copyObject: don't know how to copy node type %d", - nodeTag(from)); + elog(ERROR, "unrecognized node type: %d", (int) nodeTag(from)); retval = from; /* keep compiler quiet */ break; }