30 #define COPY_SCALAR_FIELD(fldname) \
31 (newnode->fldname = from->fldname)
34 #define COPY_NODE_FIELD(fldname) \
35 (newnode->fldname = copyObjectImpl(from->fldname))
38 #define COPY_BITMAPSET_FIELD(fldname) \
39 (newnode->fldname = bms_copy(from->fldname))
42 #define COPY_STRING_FIELD(fldname) \
43 (newnode->fldname = from->fldname ? pstrdup(from->fldname) : (char *) NULL)
46 #define COPY_ARRAY_FIELD(fldname) \
47 memcpy(newnode->fldname, from->fldname, sizeof(newnode->fldname))
50 #define COPY_POINTER_FIELD(fldname, sz) \
55 newnode->fldname = palloc(_size); \
56 memcpy(newnode->fldname, from->fldname, _size); \
61 #define COPY_LOCATION_FIELD(fldname) \
62 (newnode->fldname = from->fldname)
65 #include "copyfuncs.funcs.c"
82 if (from->constbyval || from->constisnull)
88 newnode->constvalue = from->constvalue;
95 newnode->constvalue =
datumCopy(from->constvalue,
135 elog(
ERROR,
"unrecognized node type: %d",
189 #include "copyfuncs.switch.c"
Bitmapset * bms_copy(const Bitmapset *a)
static Const * _copyConst(const Const *from)
#define COPY_LOCATION_FIELD(fldname)
#define COPY_STRING_FIELD(fldname)
void * copyObjectImpl(const void *from)
static A_Const * _copyA_Const(const A_Const *from)
static ExtensibleNode * _copyExtensibleNode(const ExtensibleNode *from)
static Bitmapset * _copyBitmapset(const Bitmapset *from)
#define COPY_SCALAR_FIELD(fldname)
Datum datumCopy(Datum value, bool typByVal, int typLen)
elog(ERROR, "%s: %s", p2, msg)
const ExtensibleNodeMethods * GetExtensibleNodeMethods(const char *extnodename, bool missing_ok)
List * list_copy_deep(const List *oldlist)
List * list_copy(const List *oldlist)
#define newNode(size, tag)
void check_stack_depth(void)
void(* nodeCopy)(struct ExtensibleNode *newnode, const struct ExtensibleNode *oldnode)