head 1.46; access; symbols release_4_2:1.46 aix_ok:1.44 Version_2_1:1.16; locks; strict; comment @ * @; 1.46 date 94.02.07.11.54.24; author aoki; state Exp; branches; next 1.45; 1.45 date 94.02.02.00.22.27; author marc; state Exp; branches; next 1.44; 1.44 date 93.08.04.00.02.02; author joey; state Exp; branches; next 1.43; 1.43 date 93.04.14.01.04.39; author sunita; state Exp; branches; next 1.42; 1.42 date 93.01.16.03.14.59; author aoki; state Exp; branches; next 1.41; 1.41 date 92.11.23.22.44.13; author joey; state Exp; branches; next 1.40; 1.40 date 92.07.26.17.10.05; author mer; state Exp; branches; next 1.39; 1.39 date 92.07.23.21.38.24; author mer; state Exp; branches; next 1.38; 1.38 date 92.07.14.18.35.54; author joey; state Exp; branches; next 1.37; 1.37 date 92.07.08.20.36.14; author joey; state Exp; branches; next 1.36; 1.36 date 92.07.08.04.54.19; author joey; state Exp; branches; next 1.35; 1.35 date 92.07.06.22.21.58; author mao; state Exp; branches; next 1.34; 1.34 date 92.07.04.04.03.36; author mao; state Exp; branches; next 1.33; 1.33 date 92.07.01.02.34.33; author joey; state Exp; branches; next 1.32; 1.32 date 92.06.28.15.31.06; author mer; state Exp; branches; next 1.31; 1.31 date 92.06.23.15.49.51; author mer; state Exp; branches; next 1.30; 1.30 date 91.11.15.16.18.16; author hong; state Exp; branches; next 1.29; 1.29 date 91.11.14.15.03.35; author jolly; state Exp; branches; next 1.28; 1.28 date 91.11.10.20.47.53; author clarsen; state Exp; branches; next 1.27; 1.27 date 91.08.15.17.56.42; author caetta; state Exp; branches; next 1.26; 1.26 date 91.08.14.11.17.49; author glass; state Exp; branches; next 1.25; 1.25 date 91.08.14.10.50.02; author caetta; state Exp; branches; next 1.24; 1.24 date 91.08.09.00.44.44; author glass; state Exp; branches; next 1.23; 1.23 date 91.08.01.11.05.23; author mer; state Exp; branches; next 1.22; 1.22 date 91.07.24.16.09.51; author hong; state Exp; branches; next 1.21; 1.21 date 91.07.17.23.51.10; author hong; state Exp; branches; next 1.20; 1.20 date 91.06.18.23.27.49; author cimarron; state Exp; branches; next 1.19; 1.19 date 91.04.24.23.23.55; author hong; state Exp; branches; next 1.18; 1.18 date 91.03.28.22.23.55; author kemnitz; state Exp; branches; next 1.17; 1.17 date 91.03.27.12.33.53; author choi; state Exp; branches; next 1.16; 1.16 date 91.02.24.00.47.19; author cimarron; state Exp; branches; next 1.15; 1.15 date 91.02.05.15.32.05; author sp; state Exp; branches; next 1.14; 1.14 date 90.12.27.19.15.56; author sp; state Exp; branches; next 1.13; 1.13 date 90.11.10.12.24.54; author hong; state Exp; branches; next 1.12; 1.12 date 90.11.07.11.59.41; author hong; state Exp; branches; next 1.11; 1.11 date 90.10.10.18.48.50; author hong; state Exp; branches; next 1.10; 1.10 date 90.10.02.17.34.02; author mao; state Exp; branches; next 1.9; 1.9 date 90.09.25.16.21.56; author kemnitz; state Exp; branches; next 1.8; 1.8 date 90.06.07.18.20.02; author cimarron; state Exp; branches; next 1.7; 1.7 date 90.06.02.13.10.50; author cimarron; state Exp; branches; next 1.6; 1.6 date 90.06.01.14.58.21; author cimarron; state Exp; branches; next 1.5; 1.5 date 90.05.31.22.30.54; author cimarron; state Exp; branches; next 1.4; 1.4 date 90.05.31.10.23.12; author cimarron; state Exp; branches; next 1.3; 1.3 date 90.05.25.13.10.16; author cimarron; state Exp; branches; next 1.2; 1.2 date 90.05.25.13.01.27; author cimarron; state Exp; branches; next 1.1; 1.1 date 90.05.25.11.02.44; author cimarron; state Exp; branches; next ; desc @copy functions for nodes @ 1.46 log @casting to shut up gcc name-safing @ text @/* ---------------------------------------------------------------- * FILE * copyfuncs.c * * DESCRIPTION * Copy functions for Postgres tree nodes. * * INTERFACE ROUTINES * lispCopy - partial copy function for lisp structures * NodeCopy - function to recursively copy a node * CopyObject - \ simpler interfaces to * CopyObjectUsing - / NodeCopy() * _copyXXX - copy function for class XXX * * NOTES * These routines are intended for use during development, and should * be improved before we do a production version. Right now, every node * we create ships around a pointer to the function that knows how to * copy it. * * IDENTIFICATION * $Header: /import/faerie/faerie/aoki/postgres/src/backend/lib/RCS/copyfuncs.c,v 1.45 1994/02/02 00:22:27 marc Exp aoki $ * ---------------------------------------------------------------- */ /* ---------------- * this list of header files taken from other node file headers. * ---------------- */ #include #include #include "tmp/postgres.h" #include "access/heapam.h" #include "access/htup.h" #include "fmgr.h" #include "utils/log.h" #include "storage/lmgr.h" #include "utils/palloc.h" #include "nodes/execnodes.h" #include "nodes/nodes.h" #include "nodes/pg_lisp.h" #include "nodes/plannodes.h" #include "nodes/primnodes.h" #include "nodes/relation.h" #include "catalog/syscache.h" #include "catalog/pg_type.h" extern bool _copyLispValue(); /* ---------------------------------------------------------------- * lispCopy * * This copy function is used to make copies of just the * "internal nodes" (lisp structures) but not copy "leaf" * nodes. In simpler terms, the recursion stops at the * first non-lisp node type. This function allocates * memory with palloc(). * ---------------------------------------------------------------- */ LispValue lispCopy(lispObject) LispValue lispObject; { LispValue newnode; if (lispObject == LispNil) return(LispNil); newnode = (LispValue) lispAlloc(); newnode->type = lispObject->type; newnode->outFunc = lispObject->outFunc; newnode->equalFunc = lispObject->equalFunc; newnode->copyFunc = lispObject->copyFunc; switch (lispObject->type) { case T_LispSymbol: newnode->val.name = lispObject->val.name; newnode->cdr = LispNil; break; case T_LispStr: newnode->val.str = lispObject->val.str; newnode->cdr = LispNil; break; case T_LispInt: newnode->val.fixnum = lispObject->val.fixnum; newnode->cdr = LispNil; break; case T_LispFloat: newnode->val.flonum = lispObject->val.flonum; newnode->cdr = LispNil; break; case T_LispVector: newnode->val.veci = lispObject->val.veci; newnode->cdr = LispNil; break; case T_LispList: newnode->val.car = lispCopy(lispObject->val.car); newnode->cdr = lispCopy(lispObject->cdr); break; default: newnode = lispObject; } return (newnode); } /* ---------------------------------------------------------------- * NodeCopy * CopyObject * CopyObjectUsing * * These functions provide support for copying complex * trees of all node types which supply simple copy functions * defined below. * ---------------------------------------------------------------- */ /* ---------------- * NodeCopy is a function which calls the node's own * copy function to copy the node using the specified allocation * function and update the value of the "to" pointer. * ---------------- */ bool NodeCopy(from, toP, alloc) Node from; Node *toP; char * (*alloc)(); { bool (*copyfunc)(); /* ---------------- * if the "from" node is NULL, then just assign NULL to the * "to" node. * ---------------- */ if (from == NULL) { (*toP) = NULL; return true; } /* ---------------- * if the copy function doesn't exist then we print * a warning and do a pointer assignment. * ---------------- */ copyfunc = from->copyFunc; if (copyfunc == NULL) { elog(NOTICE, "NodeCopy: NULL copy function (type: %d) -- doing ptr assign", from->type); (*toP) = from; return true; } else return (*copyfunc)(from, toP, alloc); } /* ---------------- * CopyObject is a simpler top level interface * to the NodeCopy. Given a pointer to * the root of a node tree, it returns a pointer to a copy * of the tree which was allocated with palloc. * ---------------- */ Node CopyObject(from) Node from; { Node copy; #ifndef PALLOC_DEBUG Pointer (*f)() = palloc; #else Pointer (*f)() = palloc_debug; #endif PALLOC_DEBUG if (NodeCopy(from, ©, f) == true) return copy; else return NULL; } /* ---------------- * CopyObjectUsing() is identical to CopyObject() but takes * a second parameter which is a pointer to the allocation * function to use in making the copy. * * In particular, this function is needed in the parallel * executor code to place copies of query plans into shared * memory. * ---------------- */ Node CopyObjectUsing(from, alloc) Node from; char * (*alloc)(); { Node copy; if (alloc == NULL) { elog(NOTICE, "CopyObjectUsing: alloc function is NULL!"); return NULL; } if (NodeCopy(from, ©, alloc) == true) return copy; else return NULL; } /* ---------------------------------------------------------------- * NodeCopy/CopyObject/CopyObjectUsing support functions * ---------------------------------------------------------------- */ /* ---------------- * Node_Copy * * a macro to simplify calling of NodeCopy from within * the copy support routines: * * if (NodeCopy(from->state, &(newnode->state), alloc) != true) * return false; * * becomes * * Node_Copy(from, newnode, alloc, state); * * ---------------- */ #define Node_Copy(a, b, c, d) \ if (NodeCopy(((a)->d), &((b)->d), c) != true) { \ return false; \ } /* ---------------- * COPY_CHECKARGS, COPY_CHECKNULL and COPY_NEW are macros used * to simplify all the _copy functions. COPY_NEW_TYPE is exactly * like COPY_NEW, except that instead of returning 'false' on * failure, it returns the appropriate type of NULL. * ---------------- */ #ifndef PALLOC_DEBUG #define COPYALLOC(x) (*alloc)(x) #else #define COPYALLOC(x) (alloc == palloc_debug ? palloc(x) : (*alloc)(x)) #endif PALLOC_DEBUG #define COPY_CHECKARGS() \ if (to == NULL || alloc == NULL) { \ return false; \ } #define COPY_CHECKNULL() \ if (from == NULL) { \ (*to) = NULL; \ return true; \ } #define COPY_NEW(c) \ newnode = (c) COPYALLOC(classSize(c)); \ if (newnode == NULL) { \ return false; \ } #define COPY_NEW_TYPE(c) \ newnode = (c) COPYALLOC(classSize(c)); \ if (newnode == NULL) { \ return (c) NULL; \ } /* **************************************************************** * nodes.h copy functions * **************************************************************** */ /* ---------------- * CopyNodeFields * * This function copies the fields of the Node node. It is used by * all the copy functions for classes which inherit from Node. * ---------------- */ bool CopyNodeFields(from, newnode, alloc) Node from; Node newnode; char * (*alloc)(); { newnode->type = from->type; newnode->outFunc = from->outFunc; newnode->equalFunc = from->equalFunc; newnode->copyFunc = from->copyFunc; return true; } /* ---------------- * _copyNode * ---------------- */ bool _copyNode(from, to, alloc) Node from; Node *to; char * (*alloc)(); { Node newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Node); /* ---------------- * copy the node * ---------------- */ CopyNodeFields(from, newnode, alloc); (*to) = newnode; return true; } /* **************************************************************** * plannodes.h copy functions * **************************************************************** */ /* ---------------- * CopyPlanFields * * This function copies the fields of the Plan node. It is used by * all the copy functions for classes which inherit from Plan. * ---------------- */ bool CopyPlanFields(from, newnode, alloc) Plan from; Plan newnode; char * (*alloc)(); { newnode->cost = from->cost; newnode->plan_size = from->plan_size; newnode->plan_width = from->plan_width; newnode->fragment = from->fragment; newnode->parallel = from->parallel; Node_Copy(from, newnode, alloc, state); Node_Copy(from, newnode, alloc, qptargetlist); Node_Copy(from, newnode, alloc, qpqual); Node_Copy(from, newnode, alloc, lefttree); Node_Copy(from, newnode, alloc, righttree); return true; } /* ---------------- * _copyPlan * ---------------- */ bool _copyPlan(from, to, alloc) Plan from; Plan *to; char * (*alloc)(); { Plan newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Plan); /* ---------------- * copy the node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPlanFields(from, newnode, alloc); (*to) = newnode; return true; } /* ---------------- * _copyExistential * ---------------- */ bool _copyExistential(from, to, alloc) Existential from; Existential *to; char * (*alloc)(); { Existential newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Existential); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPlanFields(from, newnode, alloc); (*to) = newnode; return true; } /* ---------------- * _copyResult * ---------------- */ bool _copyResult(from, to, alloc) Result from; Result *to; char * (*alloc)(); { Result newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Result); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPlanFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ Node_Copy(from, newnode, alloc, resrellevelqual); Node_Copy(from, newnode, alloc, resconstantqual); Node_Copy(from, newnode, alloc, resstate); (*to) = newnode; return true; } /* ---------------- * _copyAppend * ---------------- */ bool _copyAppend(from, to, alloc) Append from; Append *to; char * (*alloc)(); { Append newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Append); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPlanFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ Node_Copy(from, newnode, alloc, unionplans); Node_Copy(from, newnode, alloc, unionrelid); Node_Copy(from, newnode, alloc, unionrtentries); Node_Copy(from, newnode, alloc, unionstate); (*to) = newnode; return true; } /* ---------------- * CopyScanFields * * This function copies the fields of the Scan node. It is used by * all the copy functions for classes which inherit from Scan. * ---------------- */ bool CopyScanFields(from, newnode, alloc) Scan from; Scan newnode; char * (*alloc)(); { newnode->scanrelid = from->scanrelid; Node_Copy(from, newnode, alloc, scanstate); return true; } /* ---------------- * CopyRelDescUsing is a function used by CopyScanTempFields. * * Note: when this function changes, make sure to change the function * sizeofTmpRelDesc() in tcop/pfrag.c accordingly. * ---------------- */ Relation CopyRelDescUsing(reldesc, alloc) Relation reldesc; char * (*alloc)(); { int len; int natts; int i; Relation newreldesc; natts = reldesc->rd_rel->relnatts; len = sizeof *reldesc + (int)(natts - 1) * sizeof reldesc->rd_att; newreldesc = (Relation) COPYALLOC(len); newreldesc->rd_fd = reldesc->rd_fd; newreldesc->rd_refcnt = reldesc->rd_refcnt; newreldesc->rd_ismem = reldesc->rd_ismem; newreldesc->rd_am = reldesc->rd_am; /* YYY */ newreldesc->rd_rel = (RelationTupleForm) COPYALLOC(sizeof (RuleLock) + sizeof *reldesc->rd_rel); *newreldesc->rd_rel = *reldesc->rd_rel; newreldesc->rd_id = reldesc->rd_id; if (reldesc->lockInfo != NULL) { newreldesc->lockInfo = (Pointer) COPYALLOC(sizeof(LockInfoData)); *(LockInfo)(newreldesc->lockInfo) = *(LockInfo)(reldesc->lockInfo); } len = sizeof *reldesc->rd_att.data[0]; for (i = 0; i < natts; i++) { newreldesc->rd_att.data[i] = (AttributeTupleForm) COPYALLOC(len + sizeof (RuleLock)); bcopy((char *)reldesc->rd_att.data[i], (char *)newreldesc->rd_att.data[i], len); bzero((char *)(newreldesc->rd_att.data[i] + 1), sizeof (RuleLock)); newreldesc->rd_att.data[i]->attrelid = reldesc->rd_att.data[i]->attrelid; } return newreldesc; } /* ---------------- * copy a list of reldescs * ---------------- */ List copyRelDescsUsing(relDescs, alloc) List relDescs; char * (*alloc)(); { List newlist; if (lispNullp(relDescs)) return LispNil; newlist = (List) COPYALLOC(classSize(LispValue)); CopyNodeFields(relDescs, newlist, alloc); newlist->val.car = (LispValue) CopyRelDescUsing(CAR(relDescs), alloc); newlist->cdr = copyRelDescsUsing(CDR(relDescs), alloc); return newlist; } /* ---------------- * CopyScanTempFields * * This function copies the fields of the ScanTemps node. It is used by * all the copy functions for classes which inherit from Scan. * ---------------- */ bool CopyScanTempFields(from, newnode, alloc) ScanTemps from; ScanTemps newnode; char * (*alloc)(); { newnode->temprelDescs = copyRelDescsUsing(from->temprelDescs, alloc); Node_Copy(from, newnode, alloc, scantempState); return true; } /* ---------------- * _copyScan * ---------------- */ bool _copyScan(from, to, alloc) Scan from; Scan *to; char * (*alloc)(); { Scan newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Scan); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPlanFields(from, newnode, alloc); CopyScanFields(from, newnode, alloc); (*to) = newnode; return true; } /* ---------------- * _copyScanTemp * ---------------- */ bool _copyScanTemps(from, to, alloc) ScanTemps from; ScanTemps *to; char * (*alloc)(); { ScanTemps newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(ScanTemps); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPlanFields(from, newnode, alloc); CopyScanTempFields(from, newnode, alloc); (*to) = newnode; return true; } /* ---------------- * _copySeqScan * ---------------- */ bool _copySeqScan(from, to, alloc) SeqScan from; SeqScan *to; char * (*alloc)(); { SeqScan newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(SeqScan); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPlanFields(from, newnode, alloc); CopyScanFields(from, newnode, alloc); (*to) = newnode; return true; } /* ---------------- * _copyIndexScan * ---------------- */ bool _copyIndexScan(from, to, alloc) IndexScan from; IndexScan *to; char * (*alloc)(); { IndexScan newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(IndexScan); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPlanFields(from, newnode, alloc); CopyScanFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ Node_Copy(from, newnode, alloc, indxid); Node_Copy(from, newnode, alloc, indxqual); Node_Copy(from, newnode, alloc, indxstate); (*to) = newnode; return true; } /* ---------------- * -copyJoinRuleInfo * ---------------- */ bool _copyJoinRuleInfo(from, to, alloc) JoinRuleInfo from; JoinRuleInfo *to; char * (*alloc)(); { JoinRuleInfo newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(JoinRuleInfo); newnode->jri_operator = from->jri_operator; newnode->jri_inattrno = from->jri_inattrno; newnode->jri_outattrno = from->jri_outattrno; newnode->jri_lock = from->jri_lock; newnode->jri_ruleid = from->jri_ruleid; newnode->jri_stubid = from->jri_stubid; newnode->jri_stub = from->jri_stub; (*to) = newnode; return(true); } /* ---------------- * CopyJoinFields * * This function copies the fields of the Join node. It is used by * all the copy functions for classes which inherit from Join. * ---------------- */ bool CopyJoinFields(from, newnode, alloc) Join from; Join newnode; char * (*alloc)(); { Node_Copy(from, newnode, alloc, ruleinfo); return true; } /* ---------------- * _copyJoin * ---------------- */ bool _copyJoin(from, to, alloc) Join from; Join *to; char * (*alloc)(); { Join newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Join); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPlanFields(from, newnode, alloc); CopyJoinFields(from, newnode, alloc); (*to) = newnode; return true; } /* ---------------- * _copyNestLoop * ---------------- */ bool _copyNestLoop(from, to, alloc) NestLoop from; NestLoop *to; char * (*alloc)(); { NestLoop newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(NestLoop); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPlanFields(from, newnode, alloc); CopyJoinFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ Node_Copy(from, newnode, alloc, nlstate); (*to) = newnode; return true; } /* ---------------- * _copyMergeJoin * ---------------- */ bool _copyMergeJoin(from, to, alloc) MergeJoin from; MergeJoin *to; char * (*alloc)(); { MergeJoin newnode; LispValue x, y; List newlist; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(MergeJoin); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPlanFields(from, newnode, alloc); CopyJoinFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ Node_Copy(from, newnode, alloc, mergeclauses); newnode->mergesortop = from->mergesortop; newlist = LispNil; foreach (x, from->mergerightorder) { newlist = nappend1(newlist, CAR(x)); } newnode->mergerightorder = newlist; newlist = LispNil; foreach (x, from->mergeleftorder) { newlist = nappend1(newlist, CAR(x)); } newnode->mergeleftorder = newlist; Node_Copy(from, newnode, alloc, mergestate); (*to) = newnode; return true; } /* ---------------- * _copyHashJoin * ---------------- */ bool _copyHashJoin(from, to, alloc) HashJoin from; HashJoin *to; char * (*alloc)(); { HashJoin newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(HashJoin); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPlanFields(from, newnode, alloc); CopyJoinFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ Node_Copy(from, newnode, alloc, hashclauses); newnode->hashjoinop = from->hashjoinop; Node_Copy(from, newnode, alloc, hashjoinstate); newnode->hashjointable = from->hashjointable; newnode->hashjointablekey = from->hashjointablekey; newnode->hashjointablesize = from->hashjointablesize; newnode->hashdone = from->hashdone; (*to) = newnode; return true; } /* ---------------- * CopyTempFields * * This function copies the fields of the Temp node. It is used by * all the copy functions for classes which inherit from Temp. * ---------------- */ bool CopyTempFields(from, newnode, alloc) Temp from; Temp newnode; char * (*alloc)(); { newnode->tempid = from->tempid; newnode->keycount = from->keycount; return true; } /* ---------------- * _copyTemp * ---------------- */ bool _copyTemp(from, to, alloc) Temp from; Temp *to; char * (*alloc)(); { Temp newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Temp); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPlanFields(from, newnode, alloc); CopyTempFields(from, newnode, alloc); (*to) = newnode; return true; } /* ---------------- * _copyMaterial * ---------------- */ bool _copyMaterial(from, to, alloc) Material from; Material *to; char * (*alloc)(); { Material newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Material); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPlanFields(from, newnode, alloc); CopyTempFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ Node_Copy(from, newnode, alloc, matstate); (*to) = newnode; return true; } /* ---------------- * _copySort * ---------------- */ bool _copySort(from, to, alloc) Sort from; Sort *to; char * (*alloc)(); { Sort newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Sort); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPlanFields(from, newnode, alloc); CopyTempFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ Node_Copy(from, newnode, alloc, sortstate); (*to) = newnode; return true; } /* --------------- * _copyAgg * -------------- */ bool _copyAgg(from, to, alloc) Agg from; Agg *to; char * (*alloc)(); { Agg newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Agg); CopyNodeFields(from, newnode, alloc); CopyPlanFields(from, newnode, alloc); CopyTempFields(from, newnode, alloc); Node_Copy(from, newnode, alloc, aggstate); (*to) = newnode; return true; } /* ---------------- * _copyUnique * ---------------- */ bool _copyUnique(from, to, alloc) Unique from; Unique *to; char * (*alloc)(); { Unique newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Unique); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPlanFields(from, newnode, alloc); CopyTempFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ Node_Copy(from, newnode, alloc, uniquestate); (*to) = newnode; return true; } /* ---------------- * _copyHash * ---------------- */ bool _copyHash(from, to, alloc) Hash from; Hash *to; char * (*alloc)(); { Hash newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Hash); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPlanFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ Node_Copy(from, newnode, alloc, hashkey); Node_Copy(from, newnode, alloc, hashstate); newnode->hashtable = from->hashtable; newnode->hashtablekey = from->hashtablekey; newnode->hashtablesize = from->hashtablesize; (*to) = newnode; return true; } /* **************************************************************** * primnodes.h copy functions * **************************************************************** */ /* ---------------- * _copyResdom * ---------------- */ bool _copyResdom(from, to, alloc) Resdom from; Resdom *to; char * (*alloc)(); { Resdom newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Resdom); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); /* ---------------- * copy remainder of node * * XXX reskeyop is USED as an int within the print functions * so that's what the copy function uses, but its * declared as an OperatorTupleForm in primnodes.h * One or the other is wrong, and I'm assuming * it should be an int. -cim 5/1/90 * ---------------- */ newnode->resno = from->resno; newnode->restype = from->restype; newnode->rescomplex = from->rescomplex; newnode->reslen = from->reslen; if (from->resname != NULL) { newnode->resname = (Name) COPYALLOC(NAMEDATALEN); (void) namecpy(newnode->resname, from->resname); } else newnode->resname = (Name) NULL; newnode->reskey = from->reskey; newnode->reskeyop = from->reskeyop; /* USED AS AN INT (see above) */ newnode->resjunk = from->resjunk; (*to) = newnode; return true; } bool _copyFjoin(from, to, alloc) Fjoin from; Fjoin *to; char * (*alloc)(); { Fjoin newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Fjoin); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); newnode->fj_initialized = from->fj_initialized; newnode->fj_nNodes = from->fj_nNodes; Node_Copy(from, newnode, alloc, fj_innerNode); newnode->fj_results = (DatumPtr) COPYALLOC((from->fj_nNodes)*sizeof(Datum)); newnode->fj_alwaysDone = (BoolPtr) COPYALLOC((from->fj_nNodes)*sizeof(bool)); bcopy(newnode->fj_results, from->fj_results, (from->fj_nNodes)*sizeof(Datum)); bcopy(newnode->fj_alwaysDone, from->fj_alwaysDone, (from->fj_nNodes)*sizeof(bool)); (*to) = newnode; return true; } /* ---------------- * CopyExprFields * * This function copies the fields of the Expr node. It is used by * all the copy functions for classes which inherit from Expr. * ---------------- */ bool CopyExprFields(from, newnode, alloc) Expr from; Expr newnode; char * (*alloc)(); { return true; } /* ---------------- * _copyExpr * ---------------- */ bool _copyExpr(from, to, alloc) Expr from; Expr *to; char * (*alloc)(); { Expr newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Expr); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyExprFields(from, newnode, alloc); (*to) = newnode; return true; } bool _copyIter(from, to, alloc) Iter from; Iter *to; char * (*alloc)(); { Iter newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Iter); CopyNodeFields(from, newnode, alloc); Node_Copy(from, newnode, alloc, iterexpr); (*to) = newnode; return true; } bool _copyStream(from, to, alloc) Stream from; Stream *to; char * (*alloc)(); { Stream newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Stream); CopyNodeFields(from, newnode, alloc); newnode->pathptr = from->pathptr; newnode->cinfo = from->cinfo; newnode->clausetype = from->clausetype; newnode->groupup = from->groupup; newnode->groupcost = from->groupcost; newnode->groupsel = from->groupsel; newnode->upstream = (StreamPtr)LispNil; /* only copy nodes downwards! */ Node_Copy(from, newnode, alloc, downstream); if (newnode->downstream) ((Stream)newnode->downstream)->upstream = (StreamPtr)newnode; (*to) = newnode; return true; } /* ---------------- * _copyVar * ---------------- */ bool _copyVar(from, to, alloc) Var from; Var *to; char * (*alloc)(); { Var newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Var); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyExprFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ newnode->varno = from->varno; newnode->varattno = from->varattno; newnode->vartype = from->vartype; Node_Copy(from, newnode, alloc, varid); /* ---------------- * don't copy var's cached slot pointer! * ---------------- */ newnode->varslot = NULL; (*to) = newnode; return true; } bool _copyArray(from, to, alloc) Array from; Array *to; char * (*alloc)(); { Array newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Array); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyExprFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ newnode->arrayelemtype = from->arrayelemtype; newnode->arrayelemlength = from->arrayelemlength; newnode->arrayelembyval = from->arrayelembyval; newnode->arrayndim = from->arrayndim; newnode->arraylow = from->arraylow; newnode->arrayhigh = from->arrayhigh; newnode->arraylen = from->arraylen; (*to) = newnode; return true; } bool _copyArrayRef(from, to, alloc) ArrayRef from; ArrayRef *to; char * (*alloc)(); { ArrayRef newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(ArrayRef); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyExprFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ newnode->refelemtype = from->refelemtype; newnode->refattrlength = from->refattrlength; newnode->refelemlength = from->refelemlength; newnode->refelembyval = from->refelembyval; (void) NodeCopy(from->refupperindexpr, &(newnode->refupperindexpr), alloc); (void) NodeCopy(from->reflowerindexpr, &(newnode->reflowerindexpr), alloc); (void) NodeCopy(from->refexpr, &(newnode->refexpr), alloc); (void) NodeCopy(from->refassgnexpr, &(newnode->refassgnexpr), alloc); (*to) = newnode; return true; } /* ---------------- * _copyOper * ---------------- */ bool _copyOper(from, to, alloc) Oper from; Oper *to; char * (*alloc)(); { Oper newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Oper); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyExprFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ newnode->opno = from->opno; newnode->opid = from->opid; newnode->oprelationlevel = from->oprelationlevel; newnode->opresulttype = from->opresulttype; newnode->opsize = from->opsize; /* * NOTE: shall we copy the cache structure or just the pointer ? * Alternatively we can set 'op_fcache' to NULL, in which * case the executor will initialize it when it needs it... */ newnode->op_fcache = from->op_fcache; (*to) = newnode; return true; } /* ---------------- * _copyConst * ---------------- */ bool _copyConst(from, to, alloc) Const from; Const *to; char * (*alloc)(); { static ObjectId cached_type; static bool cached_typbyval; Const newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Const); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyExprFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ newnode->consttype = from->consttype; newnode->constlen = from->constlen; /* ---------------- * XXX super cheesy hack until parser/planner * puts in the right values here. * ---------------- */ if (cached_type != from->consttype) { HeapTuple typeTuple; TypeTupleForm typeStruct; /* ---------------- * get the type tuple corresponding to the paramList->type, * If this fails, returnValue has been pre-initialized * to "null" so we just return it. * ---------------- */ typeTuple = SearchSysCacheTuple(TYPOID, (char *) ObjectIdGetDatum(from->consttype), (char *) NULL, (char *) NULL, (char *) NULL); /* ---------------- * get the type length and by-value from the type tuple and * save the information in our one element cache. * ---------------- */ Assert(PointerIsValid(typeTuple)); typeStruct = (TypeTupleForm) GETSTRUCT(typeTuple); cached_typbyval = (typeStruct)->typbyval ? true : false ; cached_type = from->consttype; } from->constbyval = cached_typbyval; if (!from->constisnull) { /* ---------------- * copying the Datum in a const node is a bit trickier * because it might be a pointer and it might also be of * variable length... * ---------------- */ if (from->constbyval == true) { /* ---------------- * passed by value so just copy the datum. * ---------------- */ newnode->constvalue = from->constvalue; } else { /* ---------------- * not passed by value. datum contains a pointer. * ---------------- */ if (from->constlen != -1) { /* ---------------- * fixed length structure * ---------------- */ newnode->constvalue = PointerGetDatum(COPYALLOC(from->constlen)); bcopy(from->constvalue, newnode->constvalue, from->constlen); } else { /* ---------------- * variable length structure. here the length is stored * in the first int pointed to by the constval. * ---------------- */ int length; length = *((int *) from->constvalue); newnode->constvalue = PointerGetDatum(COPYALLOC(length)); bcopy(from->constvalue, newnode->constvalue, length); } } } else { newnode->constvalue = from->constvalue; } newnode->constisnull = from->constisnull; newnode->constbyval = from->constbyval; (*to) = newnode; return true; } /* ---------------- * _copyParam * ---------------- */ bool _copyParam(from, to, alloc) Param from; Param *to; char * (*alloc)(); { Param newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Param); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyExprFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ newnode->paramkind = from->paramkind; newnode->paramid = from->paramid; if (from->paramname != NULL) { newnode->paramname = (Name) COPYALLOC(NAMEDATALEN); (void) namecpy(newnode->paramname, from->paramname); } else newnode->paramname = (Name) NULL; newnode->paramtype = from->paramtype; Node_Copy(from, newnode, alloc, param_tlist); (*to) = newnode; return true; } /* ---------------- * _copyFunc * ---------------- */ bool _copyFunc(from, to, alloc) Func from; Func *to; char * (*alloc)(); { Func newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Func); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyExprFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ newnode->funcid = from->funcid; newnode->functype = from->functype; newnode->funcisindex = from->funcisindex; newnode->funcsize = from->funcsize; newnode->func_fcache = from->func_fcache; Node_Copy(from, newnode, alloc, func_tlist); Node_Copy(from, newnode, alloc, func_planlist); (*to) = newnode; return true; } /* **************************************************************** * relation.h copy functions * **************************************************************** */ /* ---------------- * _copyRel * ---------------- */ /* ** when you change this, also make sure to fix up xfunc_copyRel in ** planner/path/xfunc.c accordingly!!! ** -- JMH, 8/2/93 */ bool _copyRel(from, to, alloc) Rel from; Rel *to; char * (*alloc)(); { Rel newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Rel); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ Node_Copy(from, newnode, alloc, relids); newnode->indexed = from->indexed; newnode->pages = from->pages; newnode->tuples = from->tuples; newnode->size = from->size; newnode->width = from->width; newnode->indproc = from->indproc; Node_Copy(from, newnode, alloc, targetlist); Node_Copy(from, newnode, alloc, pathlist); Node_Copy(from, newnode, alloc, unorderedpath); Node_Copy(from, newnode, alloc, cheapestpath); newnode->pruneable = from->pruneable; Node_Copy(from, newnode, alloc, classlist); Node_Copy(from, newnode, alloc, indexkeys); Node_Copy(from, newnode, alloc, ordering); Node_Copy(from, newnode, alloc, clauseinfo); Node_Copy(from, newnode, alloc, joininfo); Node_Copy(from, newnode, alloc, innerjoin); Node_Copy(from, newnode, alloc, superrels); (*to) = newnode; return true; } /* ---------------- * _copySortKey * ---------------- */ bool _copySortKey(from, to, alloc) SortKey from; SortKey *to; char * (*alloc)(); { SortKey newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(SortKey); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ Node_Copy(from, newnode, alloc, varkeys); Node_Copy(from, newnode, alloc, sortkeys); Node_Copy(from, newnode, alloc, relid); Node_Copy(from, newnode, alloc, sortorder); (*to) = newnode; return true; } /* ---------------- * CopyPathFields * * This function copies the fields of the Path node. It is used by * all the copy functions for classes which inherit from Path. * ---------------- */ bool CopyPathFields(from, newnode, alloc) Path from; Path newnode; char * (*alloc)(); { newnode->pathtype = from->pathtype; /* Modify the next line, since it causes the copying to cycle (i.e. the parent points right back here! -- JMH, 7/7/92. Old version: Node_Copy(from, newnode, alloc, parent); */ newnode->parent = from->parent; newnode->path_cost = from->path_cost; Node_Copy(from, newnode, alloc, p_ordering); Node_Copy(from, newnode, alloc, keys); Node_Copy(from, newnode, alloc, pathsortkey); newnode->outerjoincost = from->outerjoincost; Node_Copy(from, newnode, alloc, joinid); Node_Copy(from, newnode, alloc, locclauseinfo); return true; } /* ---------------- * _copyPath * ---------------- */ bool _copyPath(from, to, alloc) Path from; Path *to; char * (*alloc)(); { Path newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Path); /* ---------------- * copy the node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPathFields(from, newnode, alloc); (*to) = newnode; return true; } /* ---------------- * _copyIndexPath * ---------------- */ bool _copyIndexPath(from, to, alloc) IndexPath from; IndexPath *to; char * (*alloc)(); { IndexPath newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(IndexPath); /* ---------------- * copy the node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPathFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ Node_Copy(from, newnode, alloc, indexid); Node_Copy(from, newnode, alloc, indexqual); (*to) = newnode; return true; } /* ---------------- * CopyJoinPathFields * * This function copies the fields of the JoinPath node. It is used by * all the copy functions for classes which inherit from JoinPath. * ---------------- */ bool CopyJoinPathFields(from, newnode, alloc) JoinPath from; JoinPath newnode; char * (*alloc)(); { Node_Copy(from, newnode, alloc, pathclauseinfo); Node_Copy(from, newnode, alloc, outerjoinpath); Node_Copy(from, newnode, alloc, innerjoinpath); return true; } /* ---------------- * _copyJoinPath * ---------------- */ bool _copyJoinPath(from, to, alloc) JoinPath from; JoinPath *to; char * (*alloc)(); { JoinPath newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(JoinPath); /* ---------------- * copy the node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPathFields(from, newnode, alloc); CopyJoinPathFields(from, newnode, alloc); (*to) = newnode; return true; } /* ---------------- * _copyMergePath * ---------------- */ bool _copyMergePath(from, to, alloc) MergePath from; MergePath *to; char * (*alloc)(); { MergePath newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(MergePath); /* ---------------- * copy the node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPathFields(from, newnode, alloc); CopyJoinPathFields(from, newnode, alloc); /* ---------------- * copy the remainder of the node * ---------------- */ Node_Copy(from, newnode, alloc, path_mergeclauses); Node_Copy(from, newnode, alloc, outersortkeys); Node_Copy(from, newnode, alloc, innersortkeys); (*to) = newnode; return true; } /* ---------------- * _copyHashPath * ---------------- */ bool _copyHashPath(from, to, alloc) HashPath from; HashPath *to; char * (*alloc)(); { HashPath newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(HashPath); /* ---------------- * copy the node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPathFields(from, newnode, alloc); CopyJoinPathFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ Node_Copy(from, newnode, alloc, path_hashclauses); Node_Copy(from, newnode, alloc, outerhashkeys); Node_Copy(from, newnode, alloc, innerhashkeys); (*to) = newnode; return true; } /* ---------------- * _copyOrderKey * ---------------- */ bool _copyOrderKey(from, to, alloc) OrderKey from; OrderKey *to; char * (*alloc)(); { OrderKey newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(OrderKey); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ newnode->attribute_number = from->attribute_number; newnode->array_index = from->array_index; (*to) = newnode; return true; } /* ---------------- * _copyJoinKey * ---------------- */ bool _copyJoinKey(from, to, alloc) JoinKey from; JoinKey *to; char * (*alloc)(); { JoinKey newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(JoinKey); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ Node_Copy(from, newnode, alloc, outer); Node_Copy(from, newnode, alloc, inner); (*to) = newnode; return true; } /* ---------------- * _copyMergeOrder * ---------------- */ bool _copyMergeOrder(from, to, alloc) MergeOrder from; MergeOrder *to; char * (*alloc)(); { MergeOrder newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(MergeOrder); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ newnode->join_operator = from->join_operator; newnode->left_operator = from->left_operator; newnode->right_operator = from->right_operator; newnode->left_type = from->left_type; newnode->right_type = from->right_type; (*to) = newnode; return true; } /* ---------------- * _copyCInfo * ---------------- */ bool _copyCInfo(from, to, alloc) CInfo from; CInfo *to; char * (*alloc)(); { CInfo newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(CInfo); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ Node_Copy(from, newnode, alloc, clause); newnode->selectivity = from->selectivity; newnode->notclause = from->notclause; Node_Copy(from, newnode, alloc, indexids); Node_Copy(from, newnode, alloc, mergesortorder); newnode->hashjoinoperator = from->hashjoinoperator; Node_Copy(from, newnode, alloc, cinfojoinid); (*to) = newnode; return true; } /* ---------------- * CopyJoinMethodFields * * This function copies the fields of the JoinMethod node. It is used by * all the copy functions for classes which inherit from JoinMethod. * ---------------- */ bool CopyJoinMethodFields(from, newnode, alloc) JoinMethod from; JoinMethod newnode; char * (*alloc)(); { Node_Copy(from, newnode, alloc, jmkeys); Node_Copy(from, newnode, alloc, clauses); return true; } /* ---------------- * _copyJoinMethod * ---------------- */ bool _copyJoinMethod(from, to, alloc) JoinMethod from; JoinMethod *to; char * (*alloc)(); { JoinMethod newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(JoinMethod); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyJoinMethodFields(from, newnode, alloc); (*to) = newnode; return true; } /* ---------------- * _copyHInfo * ---------------- */ bool _copyHInfo(from, to, alloc) HInfo from; HInfo *to; char * (*alloc)(); { HInfo newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(HInfo); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyJoinMethodFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ newnode->hashop = from->hashop; (*to) = newnode; return true; } /* ---------------- * _copyMInfo * ---------------- */ bool _copyMInfo(from, to, alloc) MInfo from; MInfo *to; char * (*alloc)(); { MInfo newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(MInfo); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyJoinMethodFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ Node_Copy(from, newnode, alloc, m_ordering); (*to) = newnode; return true; } /* ---------------- * _copyJInfo * ---------------- */ bool _copyJInfo(from, to, alloc) JInfo from; JInfo *to; char * (*alloc)(); { JInfo newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(JInfo); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ Node_Copy(from, newnode, alloc, otherrels); Node_Copy(from, newnode, alloc, jinfoclauseinfo); newnode->mergesortable = from->mergesortable; newnode->hashjoinable = from->hashjoinable; newnode->inactive = from->inactive; (*to) = newnode; return true; } /* **************** * mnodes.h routines have no copy functions * **************** */ /* **************************************************************** * pg_lisp.h copy functions * **************************************************************** */ /* ---------------- * _copyLispValue * ---------------- */ bool _copyLispValue(from, to, alloc) LispValue from; LispValue *to; char * (*alloc)(); { LispValue newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(LispValue); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ elog(NOTICE, "_copyLispValue: LispValue - assuming LispList"); Node_Copy(from, newnode, alloc, val.car); Node_Copy(from, newnode, alloc, cdr); (*to) = newnode; return true; } /* ---------------- * _copyLispSymbol * ---------------- */ bool _copyLispSymbol(from, to, alloc) LispValue from; LispValue *to; char * (*alloc)(); { LispValue newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(LispValue); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ newnode->val.name = from->val.name; newnode->cdr = LispNil; (*to) = newnode; return true; } /* ---------------- * _copyLispStr * ---------------- */ bool _copyLispStr(from, to, alloc) LispValue from; LispValue *to; char * (*alloc)(); { LispValue newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(LispValue); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ if (from->val.name != NULL) newnode->val.name = (char *) strncpy((char *)COPYALLOC(NAMEDATALEN), from->val.name, NAMEDATALEN); else newnode->val.name = NULL; newnode->cdr = LispNil; (*to) = newnode; return true; } /* ---------------- * _copyLispInt * ---------------- */ bool _copyLispInt(from, to, alloc) LispValue from; LispValue *to; char * (*alloc)(); { LispValue newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(LispValue); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ newnode->val.fixnum = from->val.fixnum; newnode->cdr = LispNil; (*to) = newnode; return true; } /* ---------------- * _copyLispFloat * ---------------- */ bool _copyLispFloat(from, to, alloc) LispValue from; LispValue *to; char * (*alloc)(); { LispValue newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(LispValue); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ newnode->val.flonum = from->val.flonum; newnode->cdr = LispNil; (*to) = newnode; return true; } /* ---------------- * _copyLispVector * ---------------- */ bool _copyLispVector(from, to, alloc) LispValue from; LispValue *to; char * (*alloc)(); { LispValue newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(LispValue); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ if (from->val.veci == NULL) newnode->val.veci = NULL; else { /* ---------------- * XXX am unsure about meaning of "size" field of vectori * structure: is it the size of the data array or the size * of the whole structure. The code below will work in * either case -- the worst that will happen is we'll waste * a few bytes. -cim 4/30/90 * ---------------- */ newnode->val.veci = (struct vectori *) COPYALLOC(sizeof(struct vectori) + from->val.veci->size); newnode->val.veci->size = from->val.veci->size; bcopy(from->val.veci->data, newnode->val.veci->data, from->val.veci->size); } newnode->cdr = LispNil; (*to) = newnode; return true; } /* ---------------- * _copyLispList * ---------------- */ bool _copyLispList(from, to, alloc) LispValue from; LispValue *to; char * (*alloc)(); { LispValue newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(LispValue); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ Node_Copy(from, newnode, alloc, val.car); Node_Copy(from, newnode, alloc, cdr); (*to) = newnode; return true; } @ 1.45 log @Fixes to make sure we don't expect NameData variables to be NULL terminated and that we don't write mroe than NAMEDATALEN chars into them @ text @d22 1 a22 1 * $Header: /usr/local/devel/postgres.test/src/backend/lib/RCS/copyfuncs.c,v 1.44 1993/08/04 00:02:02 joey Exp marc $ d31 1 d1177 4 a1180 4 if (from->resname != NULL) newnode->resname = (Name) strncpy((char *) COPYALLOC(NAMEDATALEN), from->resname, NAMEDATALEN); else d1533 4 a1536 4 from->consttype, NULL, NULL, NULL); d1630 4 a1633 5 if (from->paramname != NULL) newnode->paramname = (Name) strncpy((char *)COPYALLOC(NAMEDATALEN), from->paramname, NAMEDATALEN); else @ 1.44 log @added a comment @ text @d22 1 a22 1 * $Header: /private/joey/src/backend/lib/RCS/copyfuncs.c,v 1.43 1993/04/14 01:04:39 sunita Exp $ d1178 1 a1178 1 strcpy((char *) COPYALLOC(strlen(from->resname)+1), from->resname); d1631 2 a1632 2 strcpy((char *) COPYALLOC(strlen(from->paramname)+1), from->paramname); d2388 2 a2389 2 strcpy((char *) COPYALLOC(strlen(from->val.name)+1), from->val.name); @ 1.43 log @included copy functions for array nodes @ text @d22 1 a22 1 * $Header: /private/src/postgres/src/backend/lib/RCS/copyfuncs.c,v 1.43 1993/04/14 01:01:04 sunita Exp $ d1691 5 @ 1.42 log @removed references to utils/fmgr.h and parser/parse.h @ text @d22 1 a22 1 * $Header: /home2/aoki/postgres/src/backend/lib/RCS/copyfuncs.c,v 1.41 1992/11/23 22:44:13 joey Exp aoki $ d1392 1 d1430 2 a1431 1 (void) NodeCopy(from->refindexpr, &(newnode->refindexpr), alloc); d1433 1 @ 1.41 log @added _copyStream, and fixed _copyRel to copy the new pruneable flag @ text @d22 1 a22 1 * $Header: /home1/joey/pg/src/lib/C/RCS/copyfuncs.c,v 1.40 1992/07/26 17:10:05 mer Exp $ d36 1 a36 1 #include "utils/fmgr.h" @ 1.40 log @process new field (refattrlength) of ArrayRef nodes. @ text @d22 1 a22 1 * $Header: /private/mer/pg/src/lib/C/RCS/copyfuncs.c,v 1.39 1992/07/23 21:38:24 mer Exp mer $ d1292 30 d1723 1 @ 1.39 log @bad assignment (used == instead of =) @ text @d22 1 a22 1 * $Header: /private/mer/pg/src/lib/C/RCS/copyfuncs.c,v 1.38 1992/07/14 18:35:54 joey Exp mer $ d1395 1 @ 1.38 log @copy indproc field in Rels @ text @d22 1 a22 1 * $Header: /users/joey/pg/src/lib/C/RCS/copyfuncs.c,v 1.37 1992/07/08 20:36:14 joey Exp joey $ d2452 1 a2452 1 newnode->val.veci == NULL; @ 1.37 log @Fix for resdom->rescomplex, func->func_planlist @ text @d22 1 a22 1 * $Header: /private/joey/pg/src/lib/C/RCS/copyfuncs.c,v 1.36 1992/07/08 04:54:19 joey Exp joey $ d1686 1 @ 1.36 log @_copyPath no longer copies the parent node. Also fixed _copyCInfo to treat the hashjoinoperator as copied by value. @ text @d22 1 a22 1 * $Header: /private/joey/pg/src/lib/C/RCS/copyfuncs.c,v 1.35 1992/07/06 22:21:58 mao Exp joey $ d1173 1 d1642 1 @ 1.35 log @ArrayRef nodes now allow arbitrary int4 expressions as array indices, not just integer constants @ text @d22 1 a22 1 * $Header: /private/mao/postgres/src/lib/C/RCS/copyfuncs.c,v 1.34 1992/07/04 04:03:36 mao Exp mao $ d1749 7 a1756 2 Node_Copy(from, newnode, alloc, parent); d1766 1 a1766 1 d2086 1 a2086 1 Node_Copy(from, newnode, alloc, hashjoinoperator); @ 1.34 log @fixes for arrays, array refs, and nested dots @ text @d22 1 a22 1 * $Header: /private/mao/postgres/src/lib/C/RCS/copyfuncs.c,v 1.33 1992/07/01 02:34:33 joey Exp mao $ a1395 1 newnode->refindex = from->refindex; d1397 1 @ 1.33 log @bring up to date for new fields in Param @ text @d22 1 a22 1 * $Header: /private/joey/pg/src/lib/C/RCS/copyfuncs.c,v 1.32 1992/06/28 15:31:06 mer Exp joey $ d51 2 a1321 2 Node_Copy(from, newnode, alloc, vardotfields); Node_Copy(from, newnode, alloc, vararraylist); d1364 35 @ 1.32 log @add functions for Iter and Fjoin nodes, also copy the Func tlists @ text @d22 1 a22 1 * $Header: /private/mer/pg/src/lib/C/RCS/copyfuncs.c,v 1.31 1992/06/23 15:49:51 mer Exp mer $ d1567 1 @ 1.31 log @_copyFunc() didn't copy *all* of the func node fields (bad) @ text @d22 1 a22 1 * $Header: /usr/local/dev/postgres/mastertree/newconf/RCS/copyfuncs.c,v 1.30 1991/11/15 16:18:16 hong Exp $ d1187 40 d1270 19 d1604 1 @ 1.30 log @for prototyping @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.29 91/11/14 15:03:35 jolly Exp Locker: hong $ d1544 1 @ 1.29 log @cleaned up for function prototyping @ text @d22 1 a22 1 * $Header: lib/C/RCS/copyfuncs.c,v 1.28 91/11/10 20:47:53 clarsen Exp Locker: jolly $ d1659 1 a1659 1 Node_Copy(from, newnode, alloc, sortpath); @ 1.28 log @prototypes @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.27 91/08/15 17:56:42 caetta Exp Locker: clarsen $ d171 1 a171 2 #ifndef PALLOC_DEBUG extern Pointer palloc(); d173 1 a173 2 #else extern Pointer palloc_debug(); d175 2 a176 2 #endif PALLOC_DEBUG @ 1.27 log @normal stuff for aggs... @ text @d22 1 a22 1 * $Header: lib/C/RCS/copyfuncs.c,v 1.26 91/08/14 11:17:49 glass Exp Locker: caetta $ d39 1 @ 1.26 log @fixed bug I created in _copyConst @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.25 91/08/14 10:50:02 caetta Exp Locker: glass $ d1038 1 a1038 1 /*bool a1057 2 -commented out for adam... */ @ 1.25 log @CopyAgg commented out so Adam could lock this... @ text @d22 1 a22 1 * $Header: lib/C/RCS/copyfuncs.c,v 1.24 91/08/09 00:44:44 glass Exp Locker: caetta $ d1457 1 a1457 1 length = *((int *) newnode->constvalue); @ 1.24 log @fixed horrendous bug in _copyConst @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.23 91/08/01 11:05:23 mer Exp Locker: glass $ d1034 27 @ 1.23 log @cleanup lmgr.h include @ text @d22 1 a22 1 * $Header: lib/C/RCS/copyfuncs.c,v 1.22 91/07/24 16:09:51 hong Exp Locker: mer $ d1398 1 a1398 7 /* ---------------- * copying the Datum in a const node is a bit trickier * because it might be a pointer and it might also be of * variable length... * ---------------- */ if (from->constbyval == true) { d1400 3 a1402 1 * passed by value so just copy the datum. d1405 1 a1405 7 newnode->constvalue = from->constvalue; } else { /* ---------------- * not passed by value. datum contains a pointer. * ---------------- */ if (from->constlen != -1) { d1407 1 a1407 1 * fixed length structure d1410 1 a1410 2 newnode->constvalue = PointerGetDatum(COPYALLOC(from->constlen)); bcopy(from->constvalue, newnode->constvalue, from->constlen); d1413 1 a1413 2 * variable length structure. here the length is stored * in the first int pointed to by the constval. d1416 18 a1433 4 int length; length = *((int *) newnode->constvalue); newnode->constvalue = PointerGetDatum(COPYALLOC(length)); bcopy(from->constvalue, newnode->constvalue, length); d1435 3 @ 1.22 log @added some comments indicating some cross file dependency @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.21 91/07/17 23:51:10 hong Exp Locker: hong $ d38 1 a38 1 #include "utils/lmgr.h" @ 1.21 log @got rid of obsolete function CopyReturnStateUsing() @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.20 91/06/18 23:27:49 cimarron Exp Locker: hong $ d503 3 @ 1.20 log @reorganized executor to use tuple table properly for nested dot stuff @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.19 91/04/24 23:23:55 hong Exp Locker: cimarron $ a2103 22 } /* **************** * execnodes.h routines have no copy functions * **************** */ ReturnState CopyReturnStateUsing(retstate, alloc) ReturnState retstate; char * (*alloc)(); { ReturnState newnode; COPY_NEW_TYPE(ReturnState); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(retstate, newnode, alloc); return newnode; @ 1.19 log @fixed a bug in the copy function of the MergeJoin @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.18 91/03/28 22:23:55 kemnitz Exp Locker: hong $ a35 2 #include "executor/recursion.h" #include "planner/recurplanner.h" d341 5 a345 5 newnode->cost = from->cost; newnode->plan_size = from->plan_size; newnode->plan_width = from->plan_width; newnode->fragment = from->fragment; newnode->parallel = from->parallel; a405 6 /* ---------------- * copy remainder of node * ---------------- */ Node_Copy(from, newnode, alloc, exstate); a483 74 * _copyParallel * ---------------- */ bool _copyParallel(from, to, alloc) Parallel from; Parallel *to; char * (*alloc)(); { Parallel newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Parallel); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPlanFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ Node_Copy(from, newnode, alloc, parstate); (*to) = newnode; return true; } /* ---------------- * _copyRecursive * ---------------- */ bool _copyRecursive(from, to, alloc) Recursive from; Recursive *to; char * (*alloc)(); { Recursive newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(Recursive); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyPlanFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ newnode->recurMethod = from->recurMethod; Node_Copy(from, newnode, alloc, recurCommand); Node_Copy(from, newnode, alloc, recurInitPlans); Node_Copy(from, newnode, alloc, recurLoopPlans); Node_Copy(from, newnode, alloc, recurCleanupPlans); Node_Copy(from, newnode, alloc, recurCheckpoints); Node_Copy(from, newnode, alloc, recurResultRelationName); Node_Copy(from, newnode, alloc, recurState); (*to) = newnode; return true; } /* ---------------- d490 2 a491 1 bool CopyScanFields(from, newnode, alloc) a504 1 d507 2 a508 2 Relation reldesc; char * (*alloc)(); d510 4 a513 4 int len; int natts; int i; Relation newreldesc; d515 3 a517 2 natts = reldesc->rd_rel->relnatts; len = sizeof *reldesc + (int)(natts - 1) * sizeof reldesc->rd_att; d519 6 a524 4 newreldesc->rd_fd = reldesc->rd_fd; newreldesc->rd_refcnt = reldesc->rd_refcnt; newreldesc->rd_ismem = reldesc->rd_ismem; newreldesc->rd_am = reldesc->rd_am; /* YYY */ d528 3 a530 1 newreldesc->rd_id = reldesc->rd_id; d532 2 a533 1 newreldesc->lockInfo = (Pointer) COPYALLOC(sizeof(LockInfoData)); d535 1 a535 1 } d546 2 a547 1 newreldesc->rd_att.data[i]->attrelid=reldesc->rd_att.data[i]->attrelid; d549 1 d553 4 d559 2 a560 2 List relDescs; char * (*alloc)(); d566 1 d569 2 a570 2 newlist->val.car = (LispValue)CopyRelDescUsing(CAR(relDescs), alloc); newlist->cdr = copyRelDescsUsing(CDR(relDescs), alloc); d728 7 a734 7 newnode->jri_operator = from->jri_operator; newnode->jri_inattrno = from->jri_inattrno; newnode->jri_outattrno = from->jri_outattrno; newnode->jri_lock = from->jri_lock; newnode->jri_ruleid = from->jri_ruleid; newnode->jri_stubid = from->jri_stubid; newnode->jri_stub = from->jri_stub; d852 1 d857 2 a858 1 } d863 2 a864 1 } d902 3 a904 1 newnode->hashjoinop = from->hashjoinop; a905 4 newnode->hashjointable = from->hashjointable; newnode->hashjointablekey = from->hashjointablekey; newnode->hashjointablesize = from->hashjointablesize; newnode->hashdone = from->hashdone; d907 5 d929 1 a929 1 newnode->tempid = from->tempid; a1095 3 newnode->hashtable = from->hashtable; newnode->hashtablekey = from->hashtablekey; newnode->hashtablesize = from->hashtablesize; d1097 4 d1142 3 a1144 3 newnode->resno = from->resno; newnode->restype = from->restype; newnode->reslen = from->reslen; d1152 1 a1152 1 newnode->reskey = from->reskey; d1154 1 a1154 1 newnode->resjunk = from->resjunk; d1167 2 a1168 1 bool CopyExprFields(from, newnode, alloc) d1235 1 a1235 3 Node_Copy(from, newnode, alloc, vararraylist); d1238 5 a1242 1 /* newnode->varelemtype = from->varelemtype; */ d1261 4 d1268 10 a1277 6 newnode->arrayelemtype = from->arrayelemtype; newnode->arrayelemlength = from->arrayelemlength; newnode->arrayelembyval = from->arrayelembyval; newnode->arraylow = from->arraylow; newnode->arrayhigh = from->arrayhigh; newnode->arraylen = from->arraylen; d1310 5 a1314 5 newnode->opno = from->opno; newnode->opid = from->opid; newnode->oprelationlevel = from->oprelationlevel; newnode->opresulttype = from->opresulttype; newnode->opsize = from->opsize; d1321 1 a1321 1 newnode->op_fcache = from->op_fcache; d1508 1 a1508 1 newnode->funcid = from->funcid; d1619 2 a1620 1 newnode->pathtype = from->pathtype; d1622 3 a1624 1 newnode->path_cost = from->path_cost; d1628 3 a1630 1 newnode->outerjoincost = from->outerjoincost; d1912 2 a1913 2 newnode->left_type = from->left_type; newnode->right_type = from->right_type; d1946 1 d1949 1 d2097 1 d2112 2 a2113 2 ReturnState retstate; char * (*alloc)(); d2118 1 d2124 1 @ 1.18 log @Copy functions added for array nodes. @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.17 91/03/27 12:33:53 choi Exp Locker: kemnitz $ d901 2 d922 10 a931 2 Node_Copy(from, newnode, alloc, mergerightorder); Node_Copy(from, newnode, alloc, mergeleftorder); @ 1.17 log @varnodes no longer has vararrayindex or varelemtype @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.16 91/02/24 00:47:19 cimarron Exp Locker: choi $ d1287 1 a1287 1 newnode->vararraylist = from->vararraylist; d1297 26 @ 1.16 log @added palloc_debug tracing facility @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.15 91/02/05 15:32:05 sp Exp Locker: cimarron $ d1287 1 a1287 1 newnode->vararrayindex = from->vararrayindex; d1291 1 a1291 1 newnode->varelemtype = from->varelemtype; @ 1.15 log @The 'printFunc' have been replaced by the 'outFunc's. @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.14 90/12/27 19:15:56 sp Exp Locker: sp $ a31 6 /* ---------------- * this list of header files taken from other node file headers. * ---------------- */ #include d171 2 d174 5 d180 1 a180 1 if (NodeCopy(from, ©, palloc) == true) d246 6 d264 1 a264 1 newnode = (c) (*alloc)(classSize(c)); \ d270 1 a270 1 newnode = (c) (*alloc)(classSize(c)); \ d599 1 a599 1 newreldesc = (Relation)(*alloc)(len); d605 1 a605 1 (*alloc)(sizeof (RuleLock) + sizeof *reldesc->rd_rel); d609 1 a609 1 newreldesc->lockInfo = (Pointer)(*alloc)(sizeof(LockInfoData)); d616 1 a616 1 (*alloc)(len + sizeof (RuleLock)); d636 1 a636 1 newlist = (List)(*alloc)(classSize(LispValue)); d1200 1 a1200 1 strcpy((char *) (*alloc)(strlen(from->resname)+1), from->resname); d1432 1 a1432 1 newnode->constvalue = PointerGetDatum((*alloc)(from->constlen)); d1442 1 a1442 1 newnode->constvalue = PointerGetDatum((*alloc)(length)); d1485 1 a1485 1 strcpy((char *) (*alloc)(strlen(from->paramname)+1), d2238 1 a2238 1 strcpy((char *) (*alloc)(strlen(from->val.name)+1), d2353 1 a2353 1 (*alloc)(sizeof(struct vectori) + from->val.veci->size); @ 1.14 log @Oper nodes now have a new field (opid) where the oid of the regproc is stored (that used to be stored in 'opno' overriding the pg_operator oid). @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.13 90/11/10 12:24:54 hong Exp Locker: sp $ d79 1 a79 1 newnode->printFunc = lispObject->printFunc; d286 1 a286 1 newnode->printFunc = from->printFunc; @ 1.13 log @added fields to HasJoin and Hash nodes @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.12 90/11/07 11:59:41 hong Exp Locker: hong $ d1319 1 d1323 7 @ 1.12 log @in sync with modifications to HashJoin nodes @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.11 90/10/10 18:48:50 hong Exp Locker: hong $ d954 2 d1143 2 @ 1.11 log @added a new field to Resdom node @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.10 90/10/02 17:34:02 mao Exp Locker: hong $ d953 2 a1132 1 CopyTempFields(from, newnode, alloc); d1138 1 d1140 1 @ 1.10 log @fix type clash in return statement @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.9 90/09/25 16:21:56 kemnitz Exp Locker: mao $ d1192 1 @ 1.9 log @Updating from revision 1.8 to revision 1.17 @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.17 90/09/14 11:44:12 hong Exp $ d240 3 a242 1 * to simplify all the _copy functions. d262 6 d2101 1 a2101 1 COPY_NEW(ReturnState); @ 1.8 log @made changes to simplify header include files @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.7 90/06/02 13:10:50 cimarron Exp $ d32 5 a36 10 #include "c.h" #include "datum.h" #include "pg_lisp.h" #include "nodes.h" #include "primnodes.h" #include "plannodes.h" #include "execnodes.h" #include "relation.h" #include "recursion.h" #include "recurplanner.h" d38 1 a38 6 #include "fmgr.h" #include "heapam.h" #include "log.h" #include "oid.h" #include "syscache.h" #include "htup.h" d40 18 d328 5 a332 2 newnode->cost = from->cost; newnode->fragment = from->fragment; a565 1 d568 79 d674 11 d686 16 d765 28 d806 1 d2086 15 @ 1.7 log @fixed case of trying to use strlen on NULL strings in a few of the _copy functions. @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.6 90/06/01 14:58:21 cimarron Exp $ d48 1 a48 1 #include "tuple.h" @ 1.6 log @added temporary sys cache lookup to _copyConst until parser/planner puts the right thing in constbyval. @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.5 90/05/31 22:30:54 cimarron Exp $ d1030 6 a1035 2 newnode->resname = (Name) strcpy((char *) (*alloc)(strlen(from->resname)+1), from->resname); d1306 7 a1313 3 newnode->paramname = (Name) strcpy((char *) (*alloc)(strlen(from->paramname)+1), from->paramname); d2045 7 a2051 2 newnode->val.name = (char *) strcpy((char *) (*alloc)(strlen(from->val.name)+1), from->val.name); @ 1.5 log @made changes to support constbyval. @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.4 90/05/31 10:23:12 cimarron Exp $ d1172 3 d1195 35 @ 1.4 log @corrected bug in arguments to strcpy() in a few places. @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.3 90/05/25 13:10:16 cimarron Exp $ d1191 37 a1227 1 newnode->constvalue = from->constvalue; d1229 1 @ 1.3 log @added made changes to support node copy functions -- added varelemtype , @ text @d22 1 a22 1 * $Header: RCS/copyfuncs.c,v 1.2 90/05/25 13:01:27 cimarron Exp $ d283 2 a284 2 Plan from; Plan *to; d287 1 a287 1 Plan newnode; d291 1 a291 1 COPY_NEW(Plan); d1031 1 a1031 1 strcpy(from->resname, (char *) (*alloc)(strlen(from->resname))); d1229 1 a1229 1 strcpy(from->paramname, (char *) (*alloc)(strlen(from->paramname))); d1963 1 a1963 1 strcpy(from->val.name, (char *) (*alloc)(strlen(from->val.name))); @ 1.2 log @new node stuff to support node copy functions. @ text @d22 1 a22 1 * $Header$ d1119 2 @ 1.1 log @Initial revision @ text @a1196 34 * _copyArrayRef * ---------------- */ bool _copyArrayRef(from, to, alloc) ArrayRef from; ArrayRef *to; char * (*alloc)(); { ArrayRef newnode; COPY_CHECKARGS(); COPY_CHECKNULL(); COPY_NEW(ArrayRef); /* ---------------- * copy node superclass fields * ---------------- */ CopyNodeFields(from, newnode, alloc); CopyExprFields(from, newnode, alloc); /* ---------------- * copy remainder of node * ---------------- */ Node_Copy(from, newnode, alloc, arraydesc); Node_Copy(from, newnode, alloc, dimension_expression); (*to) = newnode; return true; } /* ---------------- @