1 /*-------------------------------------------------------------------------
4 * Copy functions for Postgres tree nodes.
6 * NOTE: we currently support copying all node types found in parse and
7 * plan trees. We do not support copying executor state trees; there
8 * is no need for that, and no point in maintaining all the code that
9 * would be needed. We also do not support copying Path trees, mainly
10 * because the circular linkages between RelOptInfo and Path nodes can't
11 * be handled easily in a simple depth-first traversal.
14 * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
15 * Portions Copyright (c) 1994, Regents of the University of California
20 *-------------------------------------------------------------------------
25 #include "nodes/plannodes.h"
26 #include "nodes/relation.h"
27 #include "utils/datum.h"
31 * Macros to simplify copying of different kinds of fields. Use these
32 * wherever possible to reduce the chance for silly typos. Note that these
33 * hard-wire the convention that the local variables in a Copy routine are
34 * named 'newnode' and 'from'.
37 /* Copy a simple scalar field (int, float, bool, enum, etc) */
38 #define COPY_SCALAR_FIELD(fldname) \
39 (newnode->fldname = from->fldname)
41 /* Copy a field that is a pointer to some kind of Node or Node tree */
42 #define COPY_NODE_FIELD(fldname) \
43 (newnode->fldname = copyObject(from->fldname))
45 /* Copy a field that is a pointer to a Bitmapset */
46 #define COPY_BITMAPSET_FIELD(fldname) \
47 (newnode->fldname = bms_copy(from->fldname))
49 /* Copy a field that is a pointer to a C string, or perhaps NULL */
50 #define COPY_STRING_FIELD(fldname) \
51 (newnode->fldname = from->fldname ? pstrdup(from->fldname) : (char *) NULL)
53 /* Copy a field that is a pointer to a simple palloc'd object of size sz */
54 #define COPY_POINTER_FIELD(fldname, sz) \
57 newnode->fldname = palloc(_size); \
58 memcpy(newnode->fldname, from->fldname, _size); \
61 /* Copy a parse location field (for Copy, this is same as scalar case) */
62 #define COPY_LOCATION_FIELD(fldname) \
63 (newnode->fldname = from->fldname)
66 /* ****************************************************************
67 * plannodes.h copy functions
68 * ****************************************************************
75 _copyPlannedStmt(PlannedStmt
*from
)
77 PlannedStmt
*newnode
= makeNode(PlannedStmt
);
79 COPY_SCALAR_FIELD(commandType
);
80 COPY_SCALAR_FIELD(canSetTag
);
81 COPY_NODE_FIELD(planTree
);
82 COPY_NODE_FIELD(rtable
);
83 COPY_NODE_FIELD(resultRelations
);
84 COPY_NODE_FIELD(utilityStmt
);
85 COPY_NODE_FIELD(intoClause
);
86 COPY_NODE_FIELD(subplans
);
87 COPY_BITMAPSET_FIELD(rewindPlanIDs
);
88 COPY_NODE_FIELD(returningLists
);
89 COPY_NODE_FIELD(rowMarks
);
90 COPY_NODE_FIELD(relationOids
);
91 COPY_NODE_FIELD(invalItems
);
92 COPY_SCALAR_FIELD(nParamExec
);
100 * This function copies the fields of the Plan node. It is used by
101 * all the copy functions for classes which inherit from Plan.
104 CopyPlanFields(Plan
*from
, Plan
*newnode
)
106 COPY_SCALAR_FIELD(startup_cost
);
107 COPY_SCALAR_FIELD(total_cost
);
108 COPY_SCALAR_FIELD(plan_rows
);
109 COPY_SCALAR_FIELD(plan_width
);
110 COPY_NODE_FIELD(targetlist
);
111 COPY_NODE_FIELD(qual
);
112 COPY_NODE_FIELD(lefttree
);
113 COPY_NODE_FIELD(righttree
);
114 COPY_NODE_FIELD(initPlan
);
115 COPY_BITMAPSET_FIELD(extParam
);
116 COPY_BITMAPSET_FIELD(allParam
);
123 _copyPlan(Plan
*from
)
125 Plan
*newnode
= makeNode(Plan
);
128 * copy node superclass fields
130 CopyPlanFields(from
, newnode
);
140 _copyResult(Result
*from
)
142 Result
*newnode
= makeNode(Result
);
145 * copy node superclass fields
147 CopyPlanFields((Plan
*) from
, (Plan
*) newnode
);
150 * copy remainder of node
152 COPY_NODE_FIELD(resconstantqual
);
161 _copyAppend(Append
*from
)
163 Append
*newnode
= makeNode(Append
);
166 * copy node superclass fields
168 CopyPlanFields((Plan
*) from
, (Plan
*) newnode
);
171 * copy remainder of node
173 COPY_NODE_FIELD(appendplans
);
174 COPY_SCALAR_FIELD(isTarget
);
180 * _copyRecursiveUnion
182 static RecursiveUnion
*
183 _copyRecursiveUnion(RecursiveUnion
*from
)
185 RecursiveUnion
*newnode
= makeNode(RecursiveUnion
);
188 * copy node superclass fields
190 CopyPlanFields((Plan
*) from
, (Plan
*) newnode
);
193 * copy remainder of node
195 COPY_SCALAR_FIELD(wtParam
);
196 COPY_SCALAR_FIELD(numCols
);
197 if (from
->numCols
> 0)
199 COPY_POINTER_FIELD(dupColIdx
, from
->numCols
* sizeof(AttrNumber
));
200 COPY_POINTER_FIELD(dupOperators
, from
->numCols
* sizeof(Oid
));
202 COPY_SCALAR_FIELD(numGroups
);
211 _copyBitmapAnd(BitmapAnd
*from
)
213 BitmapAnd
*newnode
= makeNode(BitmapAnd
);
216 * copy node superclass fields
218 CopyPlanFields((Plan
*) from
, (Plan
*) newnode
);
221 * copy remainder of node
223 COPY_NODE_FIELD(bitmapplans
);
232 _copyBitmapOr(BitmapOr
*from
)
234 BitmapOr
*newnode
= makeNode(BitmapOr
);
237 * copy node superclass fields
239 CopyPlanFields((Plan
*) from
, (Plan
*) newnode
);
242 * copy remainder of node
244 COPY_NODE_FIELD(bitmapplans
);
253 * This function copies the fields of the Scan node. It is used by
254 * all the copy functions for classes which inherit from Scan.
257 CopyScanFields(Scan
*from
, Scan
*newnode
)
259 CopyPlanFields((Plan
*) from
, (Plan
*) newnode
);
261 COPY_SCALAR_FIELD(scanrelid
);
268 _copyScan(Scan
*from
)
270 Scan
*newnode
= makeNode(Scan
);
273 * copy node superclass fields
275 CopyScanFields((Scan
*) from
, (Scan
*) newnode
);
284 _copySeqScan(SeqScan
*from
)
286 SeqScan
*newnode
= makeNode(SeqScan
);
289 * copy node superclass fields
291 CopyScanFields((Scan
*) from
, (Scan
*) newnode
);
300 _copyIndexScan(IndexScan
*from
)
302 IndexScan
*newnode
= makeNode(IndexScan
);
305 * copy node superclass fields
307 CopyScanFields((Scan
*) from
, (Scan
*) newnode
);
310 * copy remainder of node
312 COPY_SCALAR_FIELD(indexid
);
313 COPY_NODE_FIELD(indexqual
);
314 COPY_NODE_FIELD(indexqualorig
);
315 COPY_SCALAR_FIELD(indexorderdir
);
321 * _copyBitmapIndexScan
323 static BitmapIndexScan
*
324 _copyBitmapIndexScan(BitmapIndexScan
*from
)
326 BitmapIndexScan
*newnode
= makeNode(BitmapIndexScan
);
329 * copy node superclass fields
331 CopyScanFields((Scan
*) from
, (Scan
*) newnode
);
334 * copy remainder of node
336 COPY_SCALAR_FIELD(indexid
);
337 COPY_NODE_FIELD(indexqual
);
338 COPY_NODE_FIELD(indexqualorig
);
344 * _copyBitmapHeapScan
346 static BitmapHeapScan
*
347 _copyBitmapHeapScan(BitmapHeapScan
*from
)
349 BitmapHeapScan
*newnode
= makeNode(BitmapHeapScan
);
352 * copy node superclass fields
354 CopyScanFields((Scan
*) from
, (Scan
*) newnode
);
357 * copy remainder of node
359 COPY_NODE_FIELD(bitmapqualorig
);
368 _copyTidScan(TidScan
*from
)
370 TidScan
*newnode
= makeNode(TidScan
);
373 * copy node superclass fields
375 CopyScanFields((Scan
*) from
, (Scan
*) newnode
);
378 * copy remainder of node
380 COPY_NODE_FIELD(tidquals
);
388 static SubqueryScan
*
389 _copySubqueryScan(SubqueryScan
*from
)
391 SubqueryScan
*newnode
= makeNode(SubqueryScan
);
394 * copy node superclass fields
396 CopyScanFields((Scan
*) from
, (Scan
*) newnode
);
399 * copy remainder of node
401 COPY_NODE_FIELD(subplan
);
402 COPY_NODE_FIELD(subrtable
);
410 static FunctionScan
*
411 _copyFunctionScan(FunctionScan
*from
)
413 FunctionScan
*newnode
= makeNode(FunctionScan
);
416 * copy node superclass fields
418 CopyScanFields((Scan
*) from
, (Scan
*) newnode
);
421 * copy remainder of node
423 COPY_NODE_FIELD(funcexpr
);
424 COPY_NODE_FIELD(funccolnames
);
425 COPY_NODE_FIELD(funccoltypes
);
426 COPY_NODE_FIELD(funccoltypmods
);
435 _copyValuesScan(ValuesScan
*from
)
437 ValuesScan
*newnode
= makeNode(ValuesScan
);
440 * copy node superclass fields
442 CopyScanFields((Scan
*) from
, (Scan
*) newnode
);
445 * copy remainder of node
447 COPY_NODE_FIELD(values_lists
);
456 _copyCteScan(CteScan
*from
)
458 CteScan
*newnode
= makeNode(CteScan
);
461 * copy node superclass fields
463 CopyScanFields((Scan
*) from
, (Scan
*) newnode
);
466 * copy remainder of node
468 COPY_SCALAR_FIELD(ctePlanId
);
469 COPY_SCALAR_FIELD(cteParam
);
477 static WorkTableScan
*
478 _copyWorkTableScan(WorkTableScan
*from
)
480 WorkTableScan
*newnode
= makeNode(WorkTableScan
);
483 * copy node superclass fields
485 CopyScanFields((Scan
*) from
, (Scan
*) newnode
);
488 * copy remainder of node
490 COPY_SCALAR_FIELD(wtParam
);
498 * This function copies the fields of the Join node. It is used by
499 * all the copy functions for classes which inherit from Join.
502 CopyJoinFields(Join
*from
, Join
*newnode
)
504 CopyPlanFields((Plan
*) from
, (Plan
*) newnode
);
506 COPY_SCALAR_FIELD(jointype
);
507 COPY_NODE_FIELD(joinqual
);
515 _copyJoin(Join
*from
)
517 Join
*newnode
= makeNode(Join
);
520 * copy node superclass fields
522 CopyJoinFields(from
, newnode
);
532 _copyNestLoop(NestLoop
*from
)
534 NestLoop
*newnode
= makeNode(NestLoop
);
537 * copy node superclass fields
539 CopyJoinFields((Join
*) from
, (Join
*) newnode
);
549 _copyMergeJoin(MergeJoin
*from
)
551 MergeJoin
*newnode
= makeNode(MergeJoin
);
555 * copy node superclass fields
557 CopyJoinFields((Join
*) from
, (Join
*) newnode
);
560 * copy remainder of node
562 COPY_NODE_FIELD(mergeclauses
);
563 numCols
= list_length(from
->mergeclauses
);
564 COPY_POINTER_FIELD(mergeFamilies
, numCols
* sizeof(Oid
));
565 COPY_POINTER_FIELD(mergeStrategies
, numCols
* sizeof(int));
566 COPY_POINTER_FIELD(mergeNullsFirst
, numCols
* sizeof(bool));
575 _copyHashJoin(HashJoin
*from
)
577 HashJoin
*newnode
= makeNode(HashJoin
);
580 * copy node superclass fields
582 CopyJoinFields((Join
*) from
, (Join
*) newnode
);
585 * copy remainder of node
587 COPY_NODE_FIELD(hashclauses
);
597 _copyMaterial(Material
*from
)
599 Material
*newnode
= makeNode(Material
);
602 * copy node superclass fields
604 CopyPlanFields((Plan
*) from
, (Plan
*) newnode
);
614 _copySort(Sort
*from
)
616 Sort
*newnode
= makeNode(Sort
);
619 * copy node superclass fields
621 CopyPlanFields((Plan
*) from
, (Plan
*) newnode
);
623 COPY_SCALAR_FIELD(numCols
);
624 COPY_POINTER_FIELD(sortColIdx
, from
->numCols
* sizeof(AttrNumber
));
625 COPY_POINTER_FIELD(sortOperators
, from
->numCols
* sizeof(Oid
));
626 COPY_POINTER_FIELD(nullsFirst
, from
->numCols
* sizeof(bool));
636 _copyGroup(Group
*from
)
638 Group
*newnode
= makeNode(Group
);
640 CopyPlanFields((Plan
*) from
, (Plan
*) newnode
);
642 COPY_SCALAR_FIELD(numCols
);
643 COPY_POINTER_FIELD(grpColIdx
, from
->numCols
* sizeof(AttrNumber
));
644 COPY_POINTER_FIELD(grpOperators
, from
->numCols
* sizeof(Oid
));
655 Agg
*newnode
= makeNode(Agg
);
657 CopyPlanFields((Plan
*) from
, (Plan
*) newnode
);
659 COPY_SCALAR_FIELD(aggstrategy
);
660 COPY_SCALAR_FIELD(numCols
);
661 if (from
->numCols
> 0)
663 COPY_POINTER_FIELD(grpColIdx
, from
->numCols
* sizeof(AttrNumber
));
664 COPY_POINTER_FIELD(grpOperators
, from
->numCols
* sizeof(Oid
));
666 COPY_SCALAR_FIELD(numGroups
);
675 _copyUnique(Unique
*from
)
677 Unique
*newnode
= makeNode(Unique
);
680 * copy node superclass fields
682 CopyPlanFields((Plan
*) from
, (Plan
*) newnode
);
685 * copy remainder of node
687 COPY_SCALAR_FIELD(numCols
);
688 COPY_POINTER_FIELD(uniqColIdx
, from
->numCols
* sizeof(AttrNumber
));
689 COPY_POINTER_FIELD(uniqOperators
, from
->numCols
* sizeof(Oid
));
698 _copyHash(Hash
*from
)
700 Hash
*newnode
= makeNode(Hash
);
703 * copy node superclass fields
705 CopyPlanFields((Plan
*) from
, (Plan
*) newnode
);
708 * copy remainder of node
718 _copySetOp(SetOp
*from
)
720 SetOp
*newnode
= makeNode(SetOp
);
723 * copy node superclass fields
725 CopyPlanFields((Plan
*) from
, (Plan
*) newnode
);
728 * copy remainder of node
730 COPY_SCALAR_FIELD(cmd
);
731 COPY_SCALAR_FIELD(strategy
);
732 COPY_SCALAR_FIELD(numCols
);
733 COPY_POINTER_FIELD(dupColIdx
, from
->numCols
* sizeof(AttrNumber
));
734 COPY_POINTER_FIELD(dupOperators
, from
->numCols
* sizeof(Oid
));
735 COPY_SCALAR_FIELD(flagColIdx
);
736 COPY_SCALAR_FIELD(firstFlag
);
737 COPY_SCALAR_FIELD(numGroups
);
746 _copyLimit(Limit
*from
)
748 Limit
*newnode
= makeNode(Limit
);
751 * copy node superclass fields
753 CopyPlanFields((Plan
*) from
, (Plan
*) newnode
);
756 * copy remainder of node
758 COPY_NODE_FIELD(limitOffset
);
759 COPY_NODE_FIELD(limitCount
);
767 static PlanInvalItem
*
768 _copyPlanInvalItem(PlanInvalItem
*from
)
770 PlanInvalItem
*newnode
= makeNode(PlanInvalItem
);
772 COPY_SCALAR_FIELD(cacheId
);
773 /* tupleId isn't really a "scalar", but this works anyway */
774 COPY_SCALAR_FIELD(tupleId
);
779 /* ****************************************************************
780 * primnodes.h copy functions
781 * ****************************************************************
788 _copyAlias(Alias
*from
)
790 Alias
*newnode
= makeNode(Alias
);
792 COPY_STRING_FIELD(aliasname
);
793 COPY_NODE_FIELD(colnames
);
802 _copyRangeVar(RangeVar
*from
)
804 RangeVar
*newnode
= makeNode(RangeVar
);
806 COPY_STRING_FIELD(catalogname
);
807 COPY_STRING_FIELD(schemaname
);
808 COPY_STRING_FIELD(relname
);
809 COPY_SCALAR_FIELD(inhOpt
);
810 COPY_SCALAR_FIELD(istemp
);
811 COPY_NODE_FIELD(alias
);
812 COPY_LOCATION_FIELD(location
);
821 _copyIntoClause(IntoClause
*from
)
823 IntoClause
*newnode
= makeNode(IntoClause
);
825 COPY_NODE_FIELD(rel
);
826 COPY_NODE_FIELD(colNames
);
827 COPY_NODE_FIELD(options
);
828 COPY_SCALAR_FIELD(onCommit
);
829 COPY_STRING_FIELD(tableSpaceName
);
835 * We don't need a _copyExpr because Expr is an abstract supertype which
836 * should never actually get instantiated. Also, since it has no common
837 * fields except NodeTag, there's no need for a helper routine to factor
838 * out copying the common fields...
847 Var
*newnode
= makeNode(Var
);
849 COPY_SCALAR_FIELD(varno
);
850 COPY_SCALAR_FIELD(varattno
);
851 COPY_SCALAR_FIELD(vartype
);
852 COPY_SCALAR_FIELD(vartypmod
);
853 COPY_SCALAR_FIELD(varlevelsup
);
854 COPY_SCALAR_FIELD(varnoold
);
855 COPY_SCALAR_FIELD(varoattno
);
856 COPY_LOCATION_FIELD(location
);
865 _copyConst(Const
*from
)
867 Const
*newnode
= makeNode(Const
);
869 COPY_SCALAR_FIELD(consttype
);
870 COPY_SCALAR_FIELD(consttypmod
);
871 COPY_SCALAR_FIELD(constlen
);
873 if (from
->constbyval
|| from
->constisnull
)
876 * passed by value so just copy the datum. Also, don't try to copy
877 * struct when value is null!
879 newnode
->constvalue
= from
->constvalue
;
884 * passed by reference. We need a palloc'd copy.
886 newnode
->constvalue
= datumCopy(from
->constvalue
,
891 COPY_SCALAR_FIELD(constisnull
);
892 COPY_SCALAR_FIELD(constbyval
);
893 COPY_LOCATION_FIELD(location
);
902 _copyParam(Param
*from
)
904 Param
*newnode
= makeNode(Param
);
906 COPY_SCALAR_FIELD(paramkind
);
907 COPY_SCALAR_FIELD(paramid
);
908 COPY_SCALAR_FIELD(paramtype
);
909 COPY_SCALAR_FIELD(paramtypmod
);
910 COPY_LOCATION_FIELD(location
);
919 _copyAggref(Aggref
*from
)
921 Aggref
*newnode
= makeNode(Aggref
);
923 COPY_SCALAR_FIELD(aggfnoid
);
924 COPY_SCALAR_FIELD(aggtype
);
925 COPY_NODE_FIELD(args
);
926 COPY_SCALAR_FIELD(agglevelsup
);
927 COPY_SCALAR_FIELD(aggstar
);
928 COPY_SCALAR_FIELD(aggdistinct
);
929 COPY_LOCATION_FIELD(location
);
938 _copyArrayRef(ArrayRef
*from
)
940 ArrayRef
*newnode
= makeNode(ArrayRef
);
942 COPY_SCALAR_FIELD(refarraytype
);
943 COPY_SCALAR_FIELD(refelemtype
);
944 COPY_SCALAR_FIELD(reftypmod
);
945 COPY_NODE_FIELD(refupperindexpr
);
946 COPY_NODE_FIELD(reflowerindexpr
);
947 COPY_NODE_FIELD(refexpr
);
948 COPY_NODE_FIELD(refassgnexpr
);
957 _copyFuncExpr(FuncExpr
*from
)
959 FuncExpr
*newnode
= makeNode(FuncExpr
);
961 COPY_SCALAR_FIELD(funcid
);
962 COPY_SCALAR_FIELD(funcresulttype
);
963 COPY_SCALAR_FIELD(funcretset
);
964 COPY_SCALAR_FIELD(funcformat
);
965 COPY_NODE_FIELD(args
);
966 COPY_LOCATION_FIELD(location
);
975 _copyOpExpr(OpExpr
*from
)
977 OpExpr
*newnode
= makeNode(OpExpr
);
979 COPY_SCALAR_FIELD(opno
);
980 COPY_SCALAR_FIELD(opfuncid
);
981 COPY_SCALAR_FIELD(opresulttype
);
982 COPY_SCALAR_FIELD(opretset
);
983 COPY_NODE_FIELD(args
);
984 COPY_LOCATION_FIELD(location
);
990 * _copyDistinctExpr (same as OpExpr)
992 static DistinctExpr
*
993 _copyDistinctExpr(DistinctExpr
*from
)
995 DistinctExpr
*newnode
= makeNode(DistinctExpr
);
997 COPY_SCALAR_FIELD(opno
);
998 COPY_SCALAR_FIELD(opfuncid
);
999 COPY_SCALAR_FIELD(opresulttype
);
1000 COPY_SCALAR_FIELD(opretset
);
1001 COPY_NODE_FIELD(args
);
1002 COPY_LOCATION_FIELD(location
);
1008 * _copyScalarArrayOpExpr
1010 static ScalarArrayOpExpr
*
1011 _copyScalarArrayOpExpr(ScalarArrayOpExpr
*from
)
1013 ScalarArrayOpExpr
*newnode
= makeNode(ScalarArrayOpExpr
);
1015 COPY_SCALAR_FIELD(opno
);
1016 COPY_SCALAR_FIELD(opfuncid
);
1017 COPY_SCALAR_FIELD(useOr
);
1018 COPY_NODE_FIELD(args
);
1019 COPY_LOCATION_FIELD(location
);
1028 _copyBoolExpr(BoolExpr
*from
)
1030 BoolExpr
*newnode
= makeNode(BoolExpr
);
1032 COPY_SCALAR_FIELD(boolop
);
1033 COPY_NODE_FIELD(args
);
1034 COPY_LOCATION_FIELD(location
);
1043 _copySubLink(SubLink
*from
)
1045 SubLink
*newnode
= makeNode(SubLink
);
1047 COPY_SCALAR_FIELD(subLinkType
);
1048 COPY_NODE_FIELD(testexpr
);
1049 COPY_NODE_FIELD(operName
);
1050 COPY_NODE_FIELD(subselect
);
1051 COPY_LOCATION_FIELD(location
);
1060 _copySubPlan(SubPlan
*from
)
1062 SubPlan
*newnode
= makeNode(SubPlan
);
1064 COPY_SCALAR_FIELD(subLinkType
);
1065 COPY_NODE_FIELD(testexpr
);
1066 COPY_NODE_FIELD(paramIds
);
1067 COPY_SCALAR_FIELD(plan_id
);
1068 COPY_SCALAR_FIELD(firstColType
);
1069 COPY_SCALAR_FIELD(useHashTable
);
1070 COPY_SCALAR_FIELD(unknownEqFalse
);
1071 COPY_NODE_FIELD(setParam
);
1072 COPY_NODE_FIELD(parParam
);
1073 COPY_NODE_FIELD(args
);
1074 COPY_SCALAR_FIELD(startup_cost
);
1075 COPY_SCALAR_FIELD(per_call_cost
);
1081 * _copyAlternativeSubPlan
1083 static AlternativeSubPlan
*
1084 _copyAlternativeSubPlan(AlternativeSubPlan
*from
)
1086 AlternativeSubPlan
*newnode
= makeNode(AlternativeSubPlan
);
1088 COPY_NODE_FIELD(subplans
);
1096 static FieldSelect
*
1097 _copyFieldSelect(FieldSelect
*from
)
1099 FieldSelect
*newnode
= makeNode(FieldSelect
);
1101 COPY_NODE_FIELD(arg
);
1102 COPY_SCALAR_FIELD(fieldnum
);
1103 COPY_SCALAR_FIELD(resulttype
);
1104 COPY_SCALAR_FIELD(resulttypmod
);
1113 _copyFieldStore(FieldStore
*from
)
1115 FieldStore
*newnode
= makeNode(FieldStore
);
1117 COPY_NODE_FIELD(arg
);
1118 COPY_NODE_FIELD(newvals
);
1119 COPY_NODE_FIELD(fieldnums
);
1120 COPY_SCALAR_FIELD(resulttype
);
1128 static RelabelType
*
1129 _copyRelabelType(RelabelType
*from
)
1131 RelabelType
*newnode
= makeNode(RelabelType
);
1133 COPY_NODE_FIELD(arg
);
1134 COPY_SCALAR_FIELD(resulttype
);
1135 COPY_SCALAR_FIELD(resulttypmod
);
1136 COPY_SCALAR_FIELD(relabelformat
);
1137 COPY_LOCATION_FIELD(location
);
1145 static CoerceViaIO
*
1146 _copyCoerceViaIO(CoerceViaIO
*from
)
1148 CoerceViaIO
*newnode
= makeNode(CoerceViaIO
);
1150 COPY_NODE_FIELD(arg
);
1151 COPY_SCALAR_FIELD(resulttype
);
1152 COPY_SCALAR_FIELD(coerceformat
);
1153 COPY_LOCATION_FIELD(location
);
1159 * _copyArrayCoerceExpr
1161 static ArrayCoerceExpr
*
1162 _copyArrayCoerceExpr(ArrayCoerceExpr
*from
)
1164 ArrayCoerceExpr
*newnode
= makeNode(ArrayCoerceExpr
);
1166 COPY_NODE_FIELD(arg
);
1167 COPY_SCALAR_FIELD(elemfuncid
);
1168 COPY_SCALAR_FIELD(resulttype
);
1169 COPY_SCALAR_FIELD(resulttypmod
);
1170 COPY_SCALAR_FIELD(isExplicit
);
1171 COPY_SCALAR_FIELD(coerceformat
);
1172 COPY_LOCATION_FIELD(location
);
1178 * _copyConvertRowtypeExpr
1180 static ConvertRowtypeExpr
*
1181 _copyConvertRowtypeExpr(ConvertRowtypeExpr
*from
)
1183 ConvertRowtypeExpr
*newnode
= makeNode(ConvertRowtypeExpr
);
1185 COPY_NODE_FIELD(arg
);
1186 COPY_SCALAR_FIELD(resulttype
);
1187 COPY_SCALAR_FIELD(convertformat
);
1188 COPY_LOCATION_FIELD(location
);
1197 _copyCaseExpr(CaseExpr
*from
)
1199 CaseExpr
*newnode
= makeNode(CaseExpr
);
1201 COPY_SCALAR_FIELD(casetype
);
1202 COPY_NODE_FIELD(arg
);
1203 COPY_NODE_FIELD(args
);
1204 COPY_NODE_FIELD(defresult
);
1205 COPY_LOCATION_FIELD(location
);
1214 _copyCaseWhen(CaseWhen
*from
)
1216 CaseWhen
*newnode
= makeNode(CaseWhen
);
1218 COPY_NODE_FIELD(expr
);
1219 COPY_NODE_FIELD(result
);
1220 COPY_LOCATION_FIELD(location
);
1228 static CaseTestExpr
*
1229 _copyCaseTestExpr(CaseTestExpr
*from
)
1231 CaseTestExpr
*newnode
= makeNode(CaseTestExpr
);
1233 COPY_SCALAR_FIELD(typeId
);
1234 COPY_SCALAR_FIELD(typeMod
);
1243 _copyArrayExpr(ArrayExpr
*from
)
1245 ArrayExpr
*newnode
= makeNode(ArrayExpr
);
1247 COPY_SCALAR_FIELD(array_typeid
);
1248 COPY_SCALAR_FIELD(element_typeid
);
1249 COPY_NODE_FIELD(elements
);
1250 COPY_SCALAR_FIELD(multidims
);
1251 COPY_LOCATION_FIELD(location
);
1260 _copyRowExpr(RowExpr
*from
)
1262 RowExpr
*newnode
= makeNode(RowExpr
);
1264 COPY_NODE_FIELD(args
);
1265 COPY_SCALAR_FIELD(row_typeid
);
1266 COPY_SCALAR_FIELD(row_format
);
1267 COPY_NODE_FIELD(colnames
);
1268 COPY_LOCATION_FIELD(location
);
1274 * _copyRowCompareExpr
1276 static RowCompareExpr
*
1277 _copyRowCompareExpr(RowCompareExpr
*from
)
1279 RowCompareExpr
*newnode
= makeNode(RowCompareExpr
);
1281 COPY_SCALAR_FIELD(rctype
);
1282 COPY_NODE_FIELD(opnos
);
1283 COPY_NODE_FIELD(opfamilies
);
1284 COPY_NODE_FIELD(largs
);
1285 COPY_NODE_FIELD(rargs
);
1293 static CoalesceExpr
*
1294 _copyCoalesceExpr(CoalesceExpr
*from
)
1296 CoalesceExpr
*newnode
= makeNode(CoalesceExpr
);
1298 COPY_SCALAR_FIELD(coalescetype
);
1299 COPY_NODE_FIELD(args
);
1300 COPY_LOCATION_FIELD(location
);
1309 _copyMinMaxExpr(MinMaxExpr
*from
)
1311 MinMaxExpr
*newnode
= makeNode(MinMaxExpr
);
1313 COPY_SCALAR_FIELD(minmaxtype
);
1314 COPY_SCALAR_FIELD(op
);
1315 COPY_NODE_FIELD(args
);
1316 COPY_LOCATION_FIELD(location
);
1325 _copyXmlExpr(XmlExpr
*from
)
1327 XmlExpr
*newnode
= makeNode(XmlExpr
);
1329 COPY_SCALAR_FIELD(op
);
1330 COPY_STRING_FIELD(name
);
1331 COPY_NODE_FIELD(named_args
);
1332 COPY_NODE_FIELD(arg_names
);
1333 COPY_NODE_FIELD(args
);
1334 COPY_SCALAR_FIELD(xmloption
);
1335 COPY_SCALAR_FIELD(type
);
1336 COPY_SCALAR_FIELD(typmod
);
1337 COPY_LOCATION_FIELD(location
);
1343 * _copyNullIfExpr (same as OpExpr)
1346 _copyNullIfExpr(NullIfExpr
*from
)
1348 NullIfExpr
*newnode
= makeNode(NullIfExpr
);
1350 COPY_SCALAR_FIELD(opno
);
1351 COPY_SCALAR_FIELD(opfuncid
);
1352 COPY_SCALAR_FIELD(opresulttype
);
1353 COPY_SCALAR_FIELD(opretset
);
1354 COPY_NODE_FIELD(args
);
1355 COPY_LOCATION_FIELD(location
);
1364 _copyNullTest(NullTest
*from
)
1366 NullTest
*newnode
= makeNode(NullTest
);
1368 COPY_NODE_FIELD(arg
);
1369 COPY_SCALAR_FIELD(nulltesttype
);
1377 static BooleanTest
*
1378 _copyBooleanTest(BooleanTest
*from
)
1380 BooleanTest
*newnode
= makeNode(BooleanTest
);
1382 COPY_NODE_FIELD(arg
);
1383 COPY_SCALAR_FIELD(booltesttype
);
1389 * _copyCoerceToDomain
1391 static CoerceToDomain
*
1392 _copyCoerceToDomain(CoerceToDomain
*from
)
1394 CoerceToDomain
*newnode
= makeNode(CoerceToDomain
);
1396 COPY_NODE_FIELD(arg
);
1397 COPY_SCALAR_FIELD(resulttype
);
1398 COPY_SCALAR_FIELD(resulttypmod
);
1399 COPY_SCALAR_FIELD(coercionformat
);
1400 COPY_LOCATION_FIELD(location
);
1406 * _copyCoerceToDomainValue
1408 static CoerceToDomainValue
*
1409 _copyCoerceToDomainValue(CoerceToDomainValue
*from
)
1411 CoerceToDomainValue
*newnode
= makeNode(CoerceToDomainValue
);
1413 COPY_SCALAR_FIELD(typeId
);
1414 COPY_SCALAR_FIELD(typeMod
);
1415 COPY_LOCATION_FIELD(location
);
1423 static SetToDefault
*
1424 _copySetToDefault(SetToDefault
*from
)
1426 SetToDefault
*newnode
= makeNode(SetToDefault
);
1428 COPY_SCALAR_FIELD(typeId
);
1429 COPY_SCALAR_FIELD(typeMod
);
1430 COPY_LOCATION_FIELD(location
);
1436 * _copyCurrentOfExpr
1438 static CurrentOfExpr
*
1439 _copyCurrentOfExpr(CurrentOfExpr
*from
)
1441 CurrentOfExpr
*newnode
= makeNode(CurrentOfExpr
);
1443 COPY_SCALAR_FIELD(cvarno
);
1444 COPY_STRING_FIELD(cursor_name
);
1445 COPY_SCALAR_FIELD(cursor_param
);
1453 static TargetEntry
*
1454 _copyTargetEntry(TargetEntry
*from
)
1456 TargetEntry
*newnode
= makeNode(TargetEntry
);
1458 COPY_NODE_FIELD(expr
);
1459 COPY_SCALAR_FIELD(resno
);
1460 COPY_STRING_FIELD(resname
);
1461 COPY_SCALAR_FIELD(ressortgroupref
);
1462 COPY_SCALAR_FIELD(resorigtbl
);
1463 COPY_SCALAR_FIELD(resorigcol
);
1464 COPY_SCALAR_FIELD(resjunk
);
1472 static RangeTblRef
*
1473 _copyRangeTblRef(RangeTblRef
*from
)
1475 RangeTblRef
*newnode
= makeNode(RangeTblRef
);
1477 COPY_SCALAR_FIELD(rtindex
);
1486 _copyJoinExpr(JoinExpr
*from
)
1488 JoinExpr
*newnode
= makeNode(JoinExpr
);
1490 COPY_SCALAR_FIELD(jointype
);
1491 COPY_SCALAR_FIELD(isNatural
);
1492 COPY_NODE_FIELD(larg
);
1493 COPY_NODE_FIELD(rarg
);
1494 COPY_NODE_FIELD(using);
1495 COPY_NODE_FIELD(quals
);
1496 COPY_NODE_FIELD(alias
);
1497 COPY_SCALAR_FIELD(rtindex
);
1506 _copyFromExpr(FromExpr
*from
)
1508 FromExpr
*newnode
= makeNode(FromExpr
);
1510 COPY_NODE_FIELD(fromlist
);
1511 COPY_NODE_FIELD(quals
);
1516 /* ****************************************************************
1517 * relation.h copy functions
1519 * We don't support copying RelOptInfo, IndexOptInfo, or Path nodes.
1520 * There are some subsidiary structs that are useful to copy, though.
1521 * ****************************************************************
1528 _copyPathKey(PathKey
*from
)
1530 PathKey
*newnode
= makeNode(PathKey
);
1532 /* EquivalenceClasses are never moved, so just shallow-copy the pointer */
1533 COPY_SCALAR_FIELD(pk_eclass
);
1534 COPY_SCALAR_FIELD(pk_opfamily
);
1535 COPY_SCALAR_FIELD(pk_strategy
);
1536 COPY_SCALAR_FIELD(pk_nulls_first
);
1544 static RestrictInfo
*
1545 _copyRestrictInfo(RestrictInfo
*from
)
1547 RestrictInfo
*newnode
= makeNode(RestrictInfo
);
1549 COPY_NODE_FIELD(clause
);
1550 COPY_SCALAR_FIELD(is_pushed_down
);
1551 COPY_SCALAR_FIELD(outerjoin_delayed
);
1552 COPY_SCALAR_FIELD(can_join
);
1553 COPY_SCALAR_FIELD(pseudoconstant
);
1554 COPY_BITMAPSET_FIELD(clause_relids
);
1555 COPY_BITMAPSET_FIELD(required_relids
);
1556 COPY_BITMAPSET_FIELD(left_relids
);
1557 COPY_BITMAPSET_FIELD(right_relids
);
1558 COPY_NODE_FIELD(orclause
);
1559 /* EquivalenceClasses are never copied, so shallow-copy the pointers */
1560 COPY_SCALAR_FIELD(parent_ec
);
1561 COPY_SCALAR_FIELD(eval_cost
);
1562 COPY_SCALAR_FIELD(this_selec
);
1563 COPY_NODE_FIELD(mergeopfamilies
);
1564 /* EquivalenceClasses are never copied, so shallow-copy the pointers */
1565 COPY_SCALAR_FIELD(left_ec
);
1566 COPY_SCALAR_FIELD(right_ec
);
1567 COPY_SCALAR_FIELD(left_em
);
1568 COPY_SCALAR_FIELD(right_em
);
1569 /* MergeScanSelCache isn't a Node, so hard to copy; just reset cache */
1570 newnode
->scansel_cache
= NIL
;
1571 COPY_SCALAR_FIELD(outer_is_left
);
1572 COPY_SCALAR_FIELD(hashjoinoperator
);
1573 COPY_SCALAR_FIELD(left_bucketsize
);
1574 COPY_SCALAR_FIELD(right_bucketsize
);
1580 * _copyFlattenedSubLink
1582 static FlattenedSubLink
*
1583 _copyFlattenedSubLink(FlattenedSubLink
*from
)
1585 FlattenedSubLink
*newnode
= makeNode(FlattenedSubLink
);
1587 COPY_SCALAR_FIELD(jointype
);
1588 COPY_BITMAPSET_FIELD(lefthand
);
1589 COPY_BITMAPSET_FIELD(righthand
);
1590 COPY_NODE_FIELD(quals
);
1596 * _copyPlaceHolderVar
1598 static PlaceHolderVar
*
1599 _copyPlaceHolderVar(PlaceHolderVar
*from
)
1601 PlaceHolderVar
*newnode
= makeNode(PlaceHolderVar
);
1603 COPY_NODE_FIELD(phexpr
);
1604 COPY_BITMAPSET_FIELD(phrels
);
1605 COPY_SCALAR_FIELD(phid
);
1606 COPY_SCALAR_FIELD(phlevelsup
);
1612 * _copySpecialJoinInfo
1614 static SpecialJoinInfo
*
1615 _copySpecialJoinInfo(SpecialJoinInfo
*from
)
1617 SpecialJoinInfo
*newnode
= makeNode(SpecialJoinInfo
);
1619 COPY_BITMAPSET_FIELD(min_lefthand
);
1620 COPY_BITMAPSET_FIELD(min_righthand
);
1621 COPY_BITMAPSET_FIELD(syn_lefthand
);
1622 COPY_BITMAPSET_FIELD(syn_righthand
);
1623 COPY_SCALAR_FIELD(jointype
);
1624 COPY_SCALAR_FIELD(lhs_strict
);
1625 COPY_SCALAR_FIELD(delay_upper_joins
);
1626 COPY_NODE_FIELD(join_quals
);
1632 * _copyAppendRelInfo
1634 static AppendRelInfo
*
1635 _copyAppendRelInfo(AppendRelInfo
*from
)
1637 AppendRelInfo
*newnode
= makeNode(AppendRelInfo
);
1639 COPY_SCALAR_FIELD(parent_relid
);
1640 COPY_SCALAR_FIELD(child_relid
);
1641 COPY_SCALAR_FIELD(parent_reltype
);
1642 COPY_SCALAR_FIELD(child_reltype
);
1643 COPY_NODE_FIELD(col_mappings
);
1644 COPY_NODE_FIELD(translated_vars
);
1645 COPY_SCALAR_FIELD(parent_reloid
);
1651 * _copyPlaceHolderInfo
1653 static PlaceHolderInfo
*
1654 _copyPlaceHolderInfo(PlaceHolderInfo
*from
)
1656 PlaceHolderInfo
*newnode
= makeNode(PlaceHolderInfo
);
1658 COPY_SCALAR_FIELD(phid
);
1659 COPY_NODE_FIELD(ph_var
);
1660 COPY_BITMAPSET_FIELD(ph_eval_at
);
1661 COPY_BITMAPSET_FIELD(ph_needed
);
1662 COPY_SCALAR_FIELD(ph_width
);
1667 /* ****************************************************************
1668 * parsenodes.h copy functions
1669 * ****************************************************************
1672 static RangeTblEntry
*
1673 _copyRangeTblEntry(RangeTblEntry
*from
)
1675 RangeTblEntry
*newnode
= makeNode(RangeTblEntry
);
1677 COPY_SCALAR_FIELD(rtekind
);
1678 COPY_SCALAR_FIELD(relid
);
1679 COPY_NODE_FIELD(subquery
);
1680 COPY_SCALAR_FIELD(jointype
);
1681 COPY_NODE_FIELD(joinaliasvars
);
1682 COPY_NODE_FIELD(funcexpr
);
1683 COPY_NODE_FIELD(funccoltypes
);
1684 COPY_NODE_FIELD(funccoltypmods
);
1685 COPY_NODE_FIELD(values_lists
);
1686 COPY_STRING_FIELD(ctename
);
1687 COPY_SCALAR_FIELD(ctelevelsup
);
1688 COPY_SCALAR_FIELD(self_reference
);
1689 COPY_NODE_FIELD(ctecoltypes
);
1690 COPY_NODE_FIELD(ctecoltypmods
);
1691 COPY_NODE_FIELD(alias
);
1692 COPY_NODE_FIELD(eref
);
1693 COPY_SCALAR_FIELD(inh
);
1694 COPY_SCALAR_FIELD(inFromCl
);
1695 COPY_SCALAR_FIELD(requiredPerms
);
1696 COPY_SCALAR_FIELD(checkAsUser
);
1701 static FkConstraint
*
1702 _copyFkConstraint(FkConstraint
*from
)
1704 FkConstraint
*newnode
= makeNode(FkConstraint
);
1706 COPY_STRING_FIELD(constr_name
);
1707 COPY_NODE_FIELD(pktable
);
1708 COPY_NODE_FIELD(fk_attrs
);
1709 COPY_NODE_FIELD(pk_attrs
);
1710 COPY_SCALAR_FIELD(fk_matchtype
);
1711 COPY_SCALAR_FIELD(fk_upd_action
);
1712 COPY_SCALAR_FIELD(fk_del_action
);
1713 COPY_SCALAR_FIELD(deferrable
);
1714 COPY_SCALAR_FIELD(initdeferred
);
1715 COPY_SCALAR_FIELD(skip_validation
);
1720 static SortGroupClause
*
1721 _copySortGroupClause(SortGroupClause
*from
)
1723 SortGroupClause
*newnode
= makeNode(SortGroupClause
);
1725 COPY_SCALAR_FIELD(tleSortGroupRef
);
1726 COPY_SCALAR_FIELD(eqop
);
1727 COPY_SCALAR_FIELD(sortop
);
1728 COPY_SCALAR_FIELD(nulls_first
);
1733 static RowMarkClause
*
1734 _copyRowMarkClause(RowMarkClause
*from
)
1736 RowMarkClause
*newnode
= makeNode(RowMarkClause
);
1738 COPY_SCALAR_FIELD(rti
);
1739 COPY_SCALAR_FIELD(forUpdate
);
1740 COPY_SCALAR_FIELD(noWait
);
1746 _copyWithClause(WithClause
*from
)
1748 WithClause
*newnode
= makeNode(WithClause
);
1750 COPY_NODE_FIELD(ctes
);
1751 COPY_SCALAR_FIELD(recursive
);
1752 COPY_LOCATION_FIELD(location
);
1757 static CommonTableExpr
*
1758 _copyCommonTableExpr(CommonTableExpr
*from
)
1760 CommonTableExpr
*newnode
= makeNode(CommonTableExpr
);
1762 COPY_STRING_FIELD(ctename
);
1763 COPY_NODE_FIELD(aliascolnames
);
1764 COPY_NODE_FIELD(ctequery
);
1765 COPY_LOCATION_FIELD(location
);
1766 COPY_SCALAR_FIELD(cterecursive
);
1767 COPY_SCALAR_FIELD(cterefcount
);
1768 COPY_NODE_FIELD(ctecolnames
);
1769 COPY_NODE_FIELD(ctecoltypes
);
1770 COPY_NODE_FIELD(ctecoltypmods
);
1776 _copyAExpr(A_Expr
*from
)
1778 A_Expr
*newnode
= makeNode(A_Expr
);
1780 COPY_SCALAR_FIELD(kind
);
1781 COPY_NODE_FIELD(name
);
1782 COPY_NODE_FIELD(lexpr
);
1783 COPY_NODE_FIELD(rexpr
);
1784 COPY_LOCATION_FIELD(location
);
1790 _copyColumnRef(ColumnRef
*from
)
1792 ColumnRef
*newnode
= makeNode(ColumnRef
);
1794 COPY_NODE_FIELD(fields
);
1795 COPY_LOCATION_FIELD(location
);
1801 _copyParamRef(ParamRef
*from
)
1803 ParamRef
*newnode
= makeNode(ParamRef
);
1805 COPY_SCALAR_FIELD(number
);
1806 COPY_LOCATION_FIELD(location
);
1812 _copyAConst(A_Const
*from
)
1814 A_Const
*newnode
= makeNode(A_Const
);
1816 /* This part must duplicate _copyValue */
1817 COPY_SCALAR_FIELD(val
.type
);
1818 switch (from
->val
.type
)
1821 COPY_SCALAR_FIELD(val
.val
.ival
);
1826 COPY_STRING_FIELD(val
.val
.str
);
1832 elog(ERROR
, "unrecognized node type: %d",
1833 (int) from
->val
.type
);
1837 COPY_LOCATION_FIELD(location
);
1843 _copyFuncCall(FuncCall
*from
)
1845 FuncCall
*newnode
= makeNode(FuncCall
);
1847 COPY_NODE_FIELD(funcname
);
1848 COPY_NODE_FIELD(args
);
1849 COPY_SCALAR_FIELD(agg_star
);
1850 COPY_SCALAR_FIELD(agg_distinct
);
1851 COPY_SCALAR_FIELD(func_variadic
);
1852 COPY_LOCATION_FIELD(location
);
1858 _copyAStar(A_Star
*from
)
1860 A_Star
*newnode
= makeNode(A_Star
);
1866 _copyAIndices(A_Indices
*from
)
1868 A_Indices
*newnode
= makeNode(A_Indices
);
1870 COPY_NODE_FIELD(lidx
);
1871 COPY_NODE_FIELD(uidx
);
1876 static A_Indirection
*
1877 _copyA_Indirection(A_Indirection
*from
)
1879 A_Indirection
*newnode
= makeNode(A_Indirection
);
1881 COPY_NODE_FIELD(arg
);
1882 COPY_NODE_FIELD(indirection
);
1887 static A_ArrayExpr
*
1888 _copyA_ArrayExpr(A_ArrayExpr
*from
)
1890 A_ArrayExpr
*newnode
= makeNode(A_ArrayExpr
);
1892 COPY_NODE_FIELD(elements
);
1893 COPY_LOCATION_FIELD(location
);
1899 _copyResTarget(ResTarget
*from
)
1901 ResTarget
*newnode
= makeNode(ResTarget
);
1903 COPY_STRING_FIELD(name
);
1904 COPY_NODE_FIELD(indirection
);
1905 COPY_NODE_FIELD(val
);
1906 COPY_LOCATION_FIELD(location
);
1912 _copyTypeName(TypeName
*from
)
1914 TypeName
*newnode
= makeNode(TypeName
);
1916 COPY_NODE_FIELD(names
);
1917 COPY_SCALAR_FIELD(typeid);
1918 COPY_SCALAR_FIELD(setof
);
1919 COPY_SCALAR_FIELD(pct_type
);
1920 COPY_NODE_FIELD(typmods
);
1921 COPY_SCALAR_FIELD(typemod
);
1922 COPY_NODE_FIELD(arrayBounds
);
1923 COPY_LOCATION_FIELD(location
);
1929 _copySortBy(SortBy
*from
)
1931 SortBy
*newnode
= makeNode(SortBy
);
1933 COPY_NODE_FIELD(node
);
1934 COPY_SCALAR_FIELD(sortby_dir
);
1935 COPY_SCALAR_FIELD(sortby_nulls
);
1936 COPY_NODE_FIELD(useOp
);
1937 COPY_LOCATION_FIELD(location
);
1942 static RangeSubselect
*
1943 _copyRangeSubselect(RangeSubselect
*from
)
1945 RangeSubselect
*newnode
= makeNode(RangeSubselect
);
1947 COPY_NODE_FIELD(subquery
);
1948 COPY_NODE_FIELD(alias
);
1953 static RangeFunction
*
1954 _copyRangeFunction(RangeFunction
*from
)
1956 RangeFunction
*newnode
= makeNode(RangeFunction
);
1958 COPY_NODE_FIELD(funccallnode
);
1959 COPY_NODE_FIELD(alias
);
1960 COPY_NODE_FIELD(coldeflist
);
1966 _copyTypeCast(TypeCast
*from
)
1968 TypeCast
*newnode
= makeNode(TypeCast
);
1970 COPY_NODE_FIELD(arg
);
1971 COPY_NODE_FIELD(typename
);
1972 COPY_LOCATION_FIELD(location
);
1978 _copyIndexElem(IndexElem
*from
)
1980 IndexElem
*newnode
= makeNode(IndexElem
);
1982 COPY_STRING_FIELD(name
);
1983 COPY_NODE_FIELD(expr
);
1984 COPY_NODE_FIELD(opclass
);
1985 COPY_SCALAR_FIELD(ordering
);
1986 COPY_SCALAR_FIELD(nulls_ordering
);
1992 _copyColumnDef(ColumnDef
*from
)
1994 ColumnDef
*newnode
= makeNode(ColumnDef
);
1996 COPY_STRING_FIELD(colname
);
1997 COPY_NODE_FIELD(typename
);
1998 COPY_SCALAR_FIELD(inhcount
);
1999 COPY_SCALAR_FIELD(is_local
);
2000 COPY_SCALAR_FIELD(is_not_null
);
2001 COPY_NODE_FIELD(raw_default
);
2002 COPY_STRING_FIELD(cooked_default
);
2003 COPY_NODE_FIELD(constraints
);
2009 _copyConstraint(Constraint
*from
)
2011 Constraint
*newnode
= makeNode(Constraint
);
2013 COPY_SCALAR_FIELD(contype
);
2014 COPY_STRING_FIELD(name
);
2015 COPY_NODE_FIELD(raw_expr
);
2016 COPY_STRING_FIELD(cooked_expr
);
2017 COPY_NODE_FIELD(keys
);
2018 COPY_NODE_FIELD(options
);
2019 COPY_STRING_FIELD(indexspace
);
2025 _copyDefElem(DefElem
*from
)
2027 DefElem
*newnode
= makeNode(DefElem
);
2029 COPY_STRING_FIELD(defname
);
2030 COPY_NODE_FIELD(arg
);
2035 static LockingClause
*
2036 _copyLockingClause(LockingClause
*from
)
2038 LockingClause
*newnode
= makeNode(LockingClause
);
2040 COPY_NODE_FIELD(lockedRels
);
2041 COPY_SCALAR_FIELD(forUpdate
);
2042 COPY_SCALAR_FIELD(noWait
);
2047 static XmlSerialize
*
2048 _copyXmlSerialize(XmlSerialize
*from
)
2050 XmlSerialize
*newnode
= makeNode(XmlSerialize
);
2052 COPY_SCALAR_FIELD(xmloption
);
2053 COPY_NODE_FIELD(expr
);
2054 COPY_NODE_FIELD(typename
);
2055 COPY_LOCATION_FIELD(location
);
2061 _copyQuery(Query
*from
)
2063 Query
*newnode
= makeNode(Query
);
2065 COPY_SCALAR_FIELD(commandType
);
2066 COPY_SCALAR_FIELD(querySource
);
2067 COPY_SCALAR_FIELD(canSetTag
);
2068 COPY_NODE_FIELD(utilityStmt
);
2069 COPY_SCALAR_FIELD(resultRelation
);
2070 COPY_NODE_FIELD(intoClause
);
2071 COPY_SCALAR_FIELD(hasAggs
);
2072 COPY_SCALAR_FIELD(hasSubLinks
);
2073 COPY_SCALAR_FIELD(hasDistinctOn
);
2074 COPY_SCALAR_FIELD(hasRecursive
);
2075 COPY_NODE_FIELD(cteList
);
2076 COPY_NODE_FIELD(rtable
);
2077 COPY_NODE_FIELD(jointree
);
2078 COPY_NODE_FIELD(targetList
);
2079 COPY_NODE_FIELD(returningList
);
2080 COPY_NODE_FIELD(groupClause
);
2081 COPY_NODE_FIELD(havingQual
);
2082 COPY_NODE_FIELD(distinctClause
);
2083 COPY_NODE_FIELD(sortClause
);
2084 COPY_NODE_FIELD(limitOffset
);
2085 COPY_NODE_FIELD(limitCount
);
2086 COPY_NODE_FIELD(rowMarks
);
2087 COPY_NODE_FIELD(setOperations
);
2093 _copyInsertStmt(InsertStmt
*from
)
2095 InsertStmt
*newnode
= makeNode(InsertStmt
);
2097 COPY_NODE_FIELD(relation
);
2098 COPY_NODE_FIELD(cols
);
2099 COPY_NODE_FIELD(selectStmt
);
2100 COPY_NODE_FIELD(returningList
);
2106 _copyDeleteStmt(DeleteStmt
*from
)
2108 DeleteStmt
*newnode
= makeNode(DeleteStmt
);
2110 COPY_NODE_FIELD(relation
);
2111 COPY_NODE_FIELD(usingClause
);
2112 COPY_NODE_FIELD(whereClause
);
2113 COPY_NODE_FIELD(returningList
);
2119 _copyUpdateStmt(UpdateStmt
*from
)
2121 UpdateStmt
*newnode
= makeNode(UpdateStmt
);
2123 COPY_NODE_FIELD(relation
);
2124 COPY_NODE_FIELD(targetList
);
2125 COPY_NODE_FIELD(whereClause
);
2126 COPY_NODE_FIELD(fromClause
);
2127 COPY_NODE_FIELD(returningList
);
2133 _copySelectStmt(SelectStmt
*from
)
2135 SelectStmt
*newnode
= makeNode(SelectStmt
);
2137 COPY_NODE_FIELD(distinctClause
);
2138 COPY_NODE_FIELD(intoClause
);
2139 COPY_NODE_FIELD(targetList
);
2140 COPY_NODE_FIELD(fromClause
);
2141 COPY_NODE_FIELD(whereClause
);
2142 COPY_NODE_FIELD(groupClause
);
2143 COPY_NODE_FIELD(havingClause
);
2144 COPY_NODE_FIELD(withClause
);
2145 COPY_NODE_FIELD(valuesLists
);
2146 COPY_NODE_FIELD(sortClause
);
2147 COPY_NODE_FIELD(limitOffset
);
2148 COPY_NODE_FIELD(limitCount
);
2149 COPY_NODE_FIELD(lockingClause
);
2150 COPY_SCALAR_FIELD(op
);
2151 COPY_SCALAR_FIELD(all
);
2152 COPY_NODE_FIELD(larg
);
2153 COPY_NODE_FIELD(rarg
);
2158 static SetOperationStmt
*
2159 _copySetOperationStmt(SetOperationStmt
*from
)
2161 SetOperationStmt
*newnode
= makeNode(SetOperationStmt
);
2163 COPY_SCALAR_FIELD(op
);
2164 COPY_SCALAR_FIELD(all
);
2165 COPY_NODE_FIELD(larg
);
2166 COPY_NODE_FIELD(rarg
);
2167 COPY_NODE_FIELD(colTypes
);
2168 COPY_NODE_FIELD(colTypmods
);
2169 COPY_NODE_FIELD(groupClauses
);
2174 static AlterTableStmt
*
2175 _copyAlterTableStmt(AlterTableStmt
*from
)
2177 AlterTableStmt
*newnode
= makeNode(AlterTableStmt
);
2179 COPY_NODE_FIELD(relation
);
2180 COPY_NODE_FIELD(cmds
);
2181 COPY_SCALAR_FIELD(relkind
);
2186 static AlterTableCmd
*
2187 _copyAlterTableCmd(AlterTableCmd
*from
)
2189 AlterTableCmd
*newnode
= makeNode(AlterTableCmd
);
2191 COPY_SCALAR_FIELD(subtype
);
2192 COPY_STRING_FIELD(name
);
2193 COPY_NODE_FIELD(def
);
2194 COPY_NODE_FIELD(transform
);
2195 COPY_SCALAR_FIELD(behavior
);
2200 static AlterDomainStmt
*
2201 _copyAlterDomainStmt(AlterDomainStmt
*from
)
2203 AlterDomainStmt
*newnode
= makeNode(AlterDomainStmt
);
2205 COPY_SCALAR_FIELD(subtype
);
2206 COPY_NODE_FIELD(typename
);
2207 COPY_STRING_FIELD(name
);
2208 COPY_NODE_FIELD(def
);
2209 COPY_SCALAR_FIELD(behavior
);
2215 _copyGrantStmt(GrantStmt
*from
)
2217 GrantStmt
*newnode
= makeNode(GrantStmt
);
2219 COPY_SCALAR_FIELD(is_grant
);
2220 COPY_SCALAR_FIELD(objtype
);
2221 COPY_NODE_FIELD(objects
);
2222 COPY_NODE_FIELD(privileges
);
2223 COPY_NODE_FIELD(grantees
);
2224 COPY_SCALAR_FIELD(grant_option
);
2225 COPY_SCALAR_FIELD(behavior
);
2230 static PrivGrantee
*
2231 _copyPrivGrantee(PrivGrantee
*from
)
2233 PrivGrantee
*newnode
= makeNode(PrivGrantee
);
2235 COPY_STRING_FIELD(rolname
);
2240 static FuncWithArgs
*
2241 _copyFuncWithArgs(FuncWithArgs
*from
)
2243 FuncWithArgs
*newnode
= makeNode(FuncWithArgs
);
2245 COPY_NODE_FIELD(funcname
);
2246 COPY_NODE_FIELD(funcargs
);
2251 static GrantRoleStmt
*
2252 _copyGrantRoleStmt(GrantRoleStmt
*from
)
2254 GrantRoleStmt
*newnode
= makeNode(GrantRoleStmt
);
2256 COPY_NODE_FIELD(granted_roles
);
2257 COPY_NODE_FIELD(grantee_roles
);
2258 COPY_SCALAR_FIELD(is_grant
);
2259 COPY_SCALAR_FIELD(admin_opt
);
2260 COPY_STRING_FIELD(grantor
);
2261 COPY_SCALAR_FIELD(behavior
);
2266 static DeclareCursorStmt
*
2267 _copyDeclareCursorStmt(DeclareCursorStmt
*from
)
2269 DeclareCursorStmt
*newnode
= makeNode(DeclareCursorStmt
);
2271 COPY_STRING_FIELD(portalname
);
2272 COPY_SCALAR_FIELD(options
);
2273 COPY_NODE_FIELD(query
);
2278 static ClosePortalStmt
*
2279 _copyClosePortalStmt(ClosePortalStmt
*from
)
2281 ClosePortalStmt
*newnode
= makeNode(ClosePortalStmt
);
2283 COPY_STRING_FIELD(portalname
);
2288 static ClusterStmt
*
2289 _copyClusterStmt(ClusterStmt
*from
)
2291 ClusterStmt
*newnode
= makeNode(ClusterStmt
);
2293 COPY_NODE_FIELD(relation
);
2294 COPY_STRING_FIELD(indexname
);
2300 _copyCopyStmt(CopyStmt
*from
)
2302 CopyStmt
*newnode
= makeNode(CopyStmt
);
2304 COPY_NODE_FIELD(relation
);
2305 COPY_NODE_FIELD(query
);
2306 COPY_NODE_FIELD(attlist
);
2307 COPY_SCALAR_FIELD(is_from
);
2308 COPY_STRING_FIELD(filename
);
2309 COPY_NODE_FIELD(options
);
2315 _copyCreateStmt(CreateStmt
*from
)
2317 CreateStmt
*newnode
= makeNode(CreateStmt
);
2319 COPY_NODE_FIELD(relation
);
2320 COPY_NODE_FIELD(tableElts
);
2321 COPY_NODE_FIELD(inhRelations
);
2322 COPY_NODE_FIELD(constraints
);
2323 COPY_NODE_FIELD(options
);
2324 COPY_SCALAR_FIELD(oncommit
);
2325 COPY_STRING_FIELD(tablespacename
);
2330 static InhRelation
*
2331 _copyInhRelation(InhRelation
*from
)
2333 InhRelation
*newnode
= makeNode(InhRelation
);
2335 COPY_NODE_FIELD(relation
);
2336 COPY_NODE_FIELD(options
);
2342 _copyDefineStmt(DefineStmt
*from
)
2344 DefineStmt
*newnode
= makeNode(DefineStmt
);
2346 COPY_SCALAR_FIELD(kind
);
2347 COPY_SCALAR_FIELD(oldstyle
);
2348 COPY_NODE_FIELD(defnames
);
2349 COPY_NODE_FIELD(args
);
2350 COPY_NODE_FIELD(definition
);
2356 _copyDropStmt(DropStmt
*from
)
2358 DropStmt
*newnode
= makeNode(DropStmt
);
2360 COPY_NODE_FIELD(objects
);
2361 COPY_SCALAR_FIELD(removeType
);
2362 COPY_SCALAR_FIELD(behavior
);
2363 COPY_SCALAR_FIELD(missing_ok
);
2368 static TruncateStmt
*
2369 _copyTruncateStmt(TruncateStmt
*from
)
2371 TruncateStmt
*newnode
= makeNode(TruncateStmt
);
2373 COPY_NODE_FIELD(relations
);
2374 COPY_SCALAR_FIELD(restart_seqs
);
2375 COPY_SCALAR_FIELD(behavior
);
2380 static CommentStmt
*
2381 _copyCommentStmt(CommentStmt
*from
)
2383 CommentStmt
*newnode
= makeNode(CommentStmt
);
2385 COPY_SCALAR_FIELD(objtype
);
2386 COPY_NODE_FIELD(objname
);
2387 COPY_NODE_FIELD(objargs
);
2388 COPY_STRING_FIELD(comment
);
2394 _copyFetchStmt(FetchStmt
*from
)
2396 FetchStmt
*newnode
= makeNode(FetchStmt
);
2398 COPY_SCALAR_FIELD(direction
);
2399 COPY_SCALAR_FIELD(howMany
);
2400 COPY_STRING_FIELD(portalname
);
2401 COPY_SCALAR_FIELD(ismove
);
2407 _copyIndexStmt(IndexStmt
*from
)
2409 IndexStmt
*newnode
= makeNode(IndexStmt
);
2411 COPY_STRING_FIELD(idxname
);
2412 COPY_NODE_FIELD(relation
);
2413 COPY_STRING_FIELD(accessMethod
);
2414 COPY_STRING_FIELD(tableSpace
);
2415 COPY_NODE_FIELD(indexParams
);
2416 COPY_NODE_FIELD(options
);
2417 COPY_NODE_FIELD(whereClause
);
2418 COPY_SCALAR_FIELD(unique
);
2419 COPY_SCALAR_FIELD(primary
);
2420 COPY_SCALAR_FIELD(isconstraint
);
2421 COPY_SCALAR_FIELD(concurrent
);
2426 static CreateFunctionStmt
*
2427 _copyCreateFunctionStmt(CreateFunctionStmt
*from
)
2429 CreateFunctionStmt
*newnode
= makeNode(CreateFunctionStmt
);
2431 COPY_SCALAR_FIELD(replace
);
2432 COPY_NODE_FIELD(funcname
);
2433 COPY_NODE_FIELD(parameters
);
2434 COPY_NODE_FIELD(returnType
);
2435 COPY_NODE_FIELD(options
);
2436 COPY_NODE_FIELD(withClause
);
2441 static FunctionParameter
*
2442 _copyFunctionParameter(FunctionParameter
*from
)
2444 FunctionParameter
*newnode
= makeNode(FunctionParameter
);
2446 COPY_STRING_FIELD(name
);
2447 COPY_NODE_FIELD(argType
);
2448 COPY_SCALAR_FIELD(mode
);
2453 static AlterFunctionStmt
*
2454 _copyAlterFunctionStmt(AlterFunctionStmt
*from
)
2456 AlterFunctionStmt
*newnode
= makeNode(AlterFunctionStmt
);
2458 COPY_NODE_FIELD(func
);
2459 COPY_NODE_FIELD(actions
);
2464 static RemoveFuncStmt
*
2465 _copyRemoveFuncStmt(RemoveFuncStmt
*from
)
2467 RemoveFuncStmt
*newnode
= makeNode(RemoveFuncStmt
);
2469 COPY_SCALAR_FIELD(kind
);
2470 COPY_NODE_FIELD(name
);
2471 COPY_NODE_FIELD(args
);
2472 COPY_SCALAR_FIELD(behavior
);
2473 COPY_SCALAR_FIELD(missing_ok
);
2478 static RemoveOpClassStmt
*
2479 _copyRemoveOpClassStmt(RemoveOpClassStmt
*from
)
2481 RemoveOpClassStmt
*newnode
= makeNode(RemoveOpClassStmt
);
2483 COPY_NODE_FIELD(opclassname
);
2484 COPY_STRING_FIELD(amname
);
2485 COPY_SCALAR_FIELD(behavior
);
2486 COPY_SCALAR_FIELD(missing_ok
);
2491 static RemoveOpFamilyStmt
*
2492 _copyRemoveOpFamilyStmt(RemoveOpFamilyStmt
*from
)
2494 RemoveOpFamilyStmt
*newnode
= makeNode(RemoveOpFamilyStmt
);
2496 COPY_NODE_FIELD(opfamilyname
);
2497 COPY_STRING_FIELD(amname
);
2498 COPY_SCALAR_FIELD(behavior
);
2499 COPY_SCALAR_FIELD(missing_ok
);
2505 _copyRenameStmt(RenameStmt
*from
)
2507 RenameStmt
*newnode
= makeNode(RenameStmt
);
2509 COPY_SCALAR_FIELD(renameType
);
2510 COPY_NODE_FIELD(relation
);
2511 COPY_NODE_FIELD(object
);
2512 COPY_NODE_FIELD(objarg
);
2513 COPY_STRING_FIELD(subname
);
2514 COPY_STRING_FIELD(newname
);
2519 static AlterObjectSchemaStmt
*
2520 _copyAlterObjectSchemaStmt(AlterObjectSchemaStmt
*from
)
2522 AlterObjectSchemaStmt
*newnode
= makeNode(AlterObjectSchemaStmt
);
2524 COPY_SCALAR_FIELD(objectType
);
2525 COPY_NODE_FIELD(relation
);
2526 COPY_NODE_FIELD(object
);
2527 COPY_NODE_FIELD(objarg
);
2528 COPY_STRING_FIELD(addname
);
2529 COPY_STRING_FIELD(newschema
);
2534 static AlterOwnerStmt
*
2535 _copyAlterOwnerStmt(AlterOwnerStmt
*from
)
2537 AlterOwnerStmt
*newnode
= makeNode(AlterOwnerStmt
);
2539 COPY_SCALAR_FIELD(objectType
);
2540 COPY_NODE_FIELD(relation
);
2541 COPY_NODE_FIELD(object
);
2542 COPY_NODE_FIELD(objarg
);
2543 COPY_STRING_FIELD(addname
);
2544 COPY_STRING_FIELD(newowner
);
2550 _copyRuleStmt(RuleStmt
*from
)
2552 RuleStmt
*newnode
= makeNode(RuleStmt
);
2554 COPY_NODE_FIELD(relation
);
2555 COPY_STRING_FIELD(rulename
);
2556 COPY_NODE_FIELD(whereClause
);
2557 COPY_SCALAR_FIELD(event
);
2558 COPY_SCALAR_FIELD(instead
);
2559 COPY_NODE_FIELD(actions
);
2560 COPY_SCALAR_FIELD(replace
);
2566 _copyNotifyStmt(NotifyStmt
*from
)
2568 NotifyStmt
*newnode
= makeNode(NotifyStmt
);
2570 COPY_STRING_FIELD(conditionname
);
2576 _copyListenStmt(ListenStmt
*from
)
2578 ListenStmt
*newnode
= makeNode(ListenStmt
);
2580 COPY_STRING_FIELD(conditionname
);
2585 static UnlistenStmt
*
2586 _copyUnlistenStmt(UnlistenStmt
*from
)
2588 UnlistenStmt
*newnode
= makeNode(UnlistenStmt
);
2590 COPY_STRING_FIELD(conditionname
);
2595 static TransactionStmt
*
2596 _copyTransactionStmt(TransactionStmt
*from
)
2598 TransactionStmt
*newnode
= makeNode(TransactionStmt
);
2600 COPY_SCALAR_FIELD(kind
);
2601 COPY_NODE_FIELD(options
);
2602 COPY_STRING_FIELD(gid
);
2607 static CompositeTypeStmt
*
2608 _copyCompositeTypeStmt(CompositeTypeStmt
*from
)
2610 CompositeTypeStmt
*newnode
= makeNode(CompositeTypeStmt
);
2612 COPY_NODE_FIELD(typevar
);
2613 COPY_NODE_FIELD(coldeflist
);
2618 static CreateEnumStmt
*
2619 _copyCreateEnumStmt(CreateEnumStmt
*from
)
2621 CreateEnumStmt
*newnode
= makeNode(CreateEnumStmt
);
2623 COPY_NODE_FIELD(typename
);
2624 COPY_NODE_FIELD(vals
);
2630 _copyViewStmt(ViewStmt
*from
)
2632 ViewStmt
*newnode
= makeNode(ViewStmt
);
2634 COPY_NODE_FIELD(view
);
2635 COPY_NODE_FIELD(aliases
);
2636 COPY_NODE_FIELD(query
);
2637 COPY_SCALAR_FIELD(replace
);
2643 _copyLoadStmt(LoadStmt
*from
)
2645 LoadStmt
*newnode
= makeNode(LoadStmt
);
2647 COPY_STRING_FIELD(filename
);
2652 static CreateDomainStmt
*
2653 _copyCreateDomainStmt(CreateDomainStmt
*from
)
2655 CreateDomainStmt
*newnode
= makeNode(CreateDomainStmt
);
2657 COPY_NODE_FIELD(domainname
);
2658 COPY_NODE_FIELD(typename
);
2659 COPY_NODE_FIELD(constraints
);
2664 static CreateOpClassStmt
*
2665 _copyCreateOpClassStmt(CreateOpClassStmt
*from
)
2667 CreateOpClassStmt
*newnode
= makeNode(CreateOpClassStmt
);
2669 COPY_NODE_FIELD(opclassname
);
2670 COPY_NODE_FIELD(opfamilyname
);
2671 COPY_STRING_FIELD(amname
);
2672 COPY_NODE_FIELD(datatype
);
2673 COPY_NODE_FIELD(items
);
2674 COPY_SCALAR_FIELD(isDefault
);
2679 static CreateOpClassItem
*
2680 _copyCreateOpClassItem(CreateOpClassItem
*from
)
2682 CreateOpClassItem
*newnode
= makeNode(CreateOpClassItem
);
2684 COPY_SCALAR_FIELD(itemtype
);
2685 COPY_NODE_FIELD(name
);
2686 COPY_NODE_FIELD(args
);
2687 COPY_SCALAR_FIELD(number
);
2688 COPY_NODE_FIELD(class_args
);
2689 COPY_NODE_FIELD(storedtype
);
2694 static CreateOpFamilyStmt
*
2695 _copyCreateOpFamilyStmt(CreateOpFamilyStmt
*from
)
2697 CreateOpFamilyStmt
*newnode
= makeNode(CreateOpFamilyStmt
);
2699 COPY_NODE_FIELD(opfamilyname
);
2700 COPY_STRING_FIELD(amname
);
2705 static AlterOpFamilyStmt
*
2706 _copyAlterOpFamilyStmt(AlterOpFamilyStmt
*from
)
2708 AlterOpFamilyStmt
*newnode
= makeNode(AlterOpFamilyStmt
);
2710 COPY_NODE_FIELD(opfamilyname
);
2711 COPY_STRING_FIELD(amname
);
2712 COPY_SCALAR_FIELD(isDrop
);
2713 COPY_NODE_FIELD(items
);
2718 static CreatedbStmt
*
2719 _copyCreatedbStmt(CreatedbStmt
*from
)
2721 CreatedbStmt
*newnode
= makeNode(CreatedbStmt
);
2723 COPY_STRING_FIELD(dbname
);
2724 COPY_NODE_FIELD(options
);
2729 static AlterDatabaseStmt
*
2730 _copyAlterDatabaseStmt(AlterDatabaseStmt
*from
)
2732 AlterDatabaseStmt
*newnode
= makeNode(AlterDatabaseStmt
);
2734 COPY_STRING_FIELD(dbname
);
2735 COPY_NODE_FIELD(options
);
2740 static AlterDatabaseSetStmt
*
2741 _copyAlterDatabaseSetStmt(AlterDatabaseSetStmt
*from
)
2743 AlterDatabaseSetStmt
*newnode
= makeNode(AlterDatabaseSetStmt
);
2745 COPY_STRING_FIELD(dbname
);
2746 COPY_NODE_FIELD(setstmt
);
2752 _copyDropdbStmt(DropdbStmt
*from
)
2754 DropdbStmt
*newnode
= makeNode(DropdbStmt
);
2756 COPY_STRING_FIELD(dbname
);
2757 COPY_SCALAR_FIELD(missing_ok
);
2763 _copyVacuumStmt(VacuumStmt
*from
)
2765 VacuumStmt
*newnode
= makeNode(VacuumStmt
);
2767 COPY_SCALAR_FIELD(vacuum
);
2768 COPY_SCALAR_FIELD(full
);
2769 COPY_SCALAR_FIELD(analyze
);
2770 COPY_SCALAR_FIELD(verbose
);
2771 COPY_SCALAR_FIELD(freeze_min_age
);
2772 COPY_NODE_FIELD(relation
);
2773 COPY_NODE_FIELD(va_cols
);
2778 static ExplainStmt
*
2779 _copyExplainStmt(ExplainStmt
*from
)
2781 ExplainStmt
*newnode
= makeNode(ExplainStmt
);
2783 COPY_NODE_FIELD(query
);
2784 COPY_SCALAR_FIELD(verbose
);
2785 COPY_SCALAR_FIELD(analyze
);
2790 static CreateSeqStmt
*
2791 _copyCreateSeqStmt(CreateSeqStmt
*from
)
2793 CreateSeqStmt
*newnode
= makeNode(CreateSeqStmt
);
2795 COPY_NODE_FIELD(sequence
);
2796 COPY_NODE_FIELD(options
);
2801 static AlterSeqStmt
*
2802 _copyAlterSeqStmt(AlterSeqStmt
*from
)
2804 AlterSeqStmt
*newnode
= makeNode(AlterSeqStmt
);
2806 COPY_NODE_FIELD(sequence
);
2807 COPY_NODE_FIELD(options
);
2812 static VariableSetStmt
*
2813 _copyVariableSetStmt(VariableSetStmt
*from
)
2815 VariableSetStmt
*newnode
= makeNode(VariableSetStmt
);
2817 COPY_SCALAR_FIELD(kind
);
2818 COPY_STRING_FIELD(name
);
2819 COPY_NODE_FIELD(args
);
2820 COPY_SCALAR_FIELD(is_local
);
2825 static VariableShowStmt
*
2826 _copyVariableShowStmt(VariableShowStmt
*from
)
2828 VariableShowStmt
*newnode
= makeNode(VariableShowStmt
);
2830 COPY_STRING_FIELD(name
);
2835 static DiscardStmt
*
2836 _copyDiscardStmt(DiscardStmt
*from
)
2838 DiscardStmt
*newnode
= makeNode(DiscardStmt
);
2840 COPY_SCALAR_FIELD(target
);
2845 static CreateTableSpaceStmt
*
2846 _copyCreateTableSpaceStmt(CreateTableSpaceStmt
*from
)
2848 CreateTableSpaceStmt
*newnode
= makeNode(CreateTableSpaceStmt
);
2850 COPY_STRING_FIELD(tablespacename
);
2851 COPY_STRING_FIELD(owner
);
2852 COPY_STRING_FIELD(location
);
2857 static DropTableSpaceStmt
*
2858 _copyDropTableSpaceStmt(DropTableSpaceStmt
*from
)
2860 DropTableSpaceStmt
*newnode
= makeNode(DropTableSpaceStmt
);
2862 COPY_STRING_FIELD(tablespacename
);
2863 COPY_SCALAR_FIELD(missing_ok
);
2868 static CreateTrigStmt
*
2869 _copyCreateTrigStmt(CreateTrigStmt
*from
)
2871 CreateTrigStmt
*newnode
= makeNode(CreateTrigStmt
);
2873 COPY_STRING_FIELD(trigname
);
2874 COPY_NODE_FIELD(relation
);
2875 COPY_NODE_FIELD(funcname
);
2876 COPY_NODE_FIELD(args
);
2877 COPY_SCALAR_FIELD(before
);
2878 COPY_SCALAR_FIELD(row
);
2879 strcpy(newnode
->actions
, from
->actions
); /* in-line string field */
2880 COPY_SCALAR_FIELD(isconstraint
);
2881 COPY_SCALAR_FIELD(deferrable
);
2882 COPY_SCALAR_FIELD(initdeferred
);
2883 COPY_NODE_FIELD(constrrel
);
2888 static DropPropertyStmt
*
2889 _copyDropPropertyStmt(DropPropertyStmt
*from
)
2891 DropPropertyStmt
*newnode
= makeNode(DropPropertyStmt
);
2893 COPY_NODE_FIELD(relation
);
2894 COPY_STRING_FIELD(property
);
2895 COPY_SCALAR_FIELD(removeType
);
2896 COPY_SCALAR_FIELD(behavior
);
2897 COPY_SCALAR_FIELD(missing_ok
);
2902 static CreatePLangStmt
*
2903 _copyCreatePLangStmt(CreatePLangStmt
*from
)
2905 CreatePLangStmt
*newnode
= makeNode(CreatePLangStmt
);
2907 COPY_STRING_FIELD(plname
);
2908 COPY_NODE_FIELD(plhandler
);
2909 COPY_NODE_FIELD(plvalidator
);
2910 COPY_SCALAR_FIELD(pltrusted
);
2915 static DropPLangStmt
*
2916 _copyDropPLangStmt(DropPLangStmt
*from
)
2918 DropPLangStmt
*newnode
= makeNode(DropPLangStmt
);
2920 COPY_STRING_FIELD(plname
);
2921 COPY_SCALAR_FIELD(behavior
);
2922 COPY_SCALAR_FIELD(missing_ok
);
2927 static CreateRoleStmt
*
2928 _copyCreateRoleStmt(CreateRoleStmt
*from
)
2930 CreateRoleStmt
*newnode
= makeNode(CreateRoleStmt
);
2932 COPY_SCALAR_FIELD(stmt_type
);
2933 COPY_STRING_FIELD(role
);
2934 COPY_NODE_FIELD(options
);
2939 static AlterRoleStmt
*
2940 _copyAlterRoleStmt(AlterRoleStmt
*from
)
2942 AlterRoleStmt
*newnode
= makeNode(AlterRoleStmt
);
2944 COPY_STRING_FIELD(role
);
2945 COPY_NODE_FIELD(options
);
2946 COPY_SCALAR_FIELD(action
);
2951 static AlterRoleSetStmt
*
2952 _copyAlterRoleSetStmt(AlterRoleSetStmt
*from
)
2954 AlterRoleSetStmt
*newnode
= makeNode(AlterRoleSetStmt
);
2956 COPY_STRING_FIELD(role
);
2957 COPY_NODE_FIELD(setstmt
);
2962 static DropRoleStmt
*
2963 _copyDropRoleStmt(DropRoleStmt
*from
)
2965 DropRoleStmt
*newnode
= makeNode(DropRoleStmt
);
2967 COPY_NODE_FIELD(roles
);
2968 COPY_SCALAR_FIELD(missing_ok
);
2974 _copyLockStmt(LockStmt
*from
)
2976 LockStmt
*newnode
= makeNode(LockStmt
);
2978 COPY_NODE_FIELD(relations
);
2979 COPY_SCALAR_FIELD(mode
);
2980 COPY_SCALAR_FIELD(nowait
);
2985 static ConstraintsSetStmt
*
2986 _copyConstraintsSetStmt(ConstraintsSetStmt
*from
)
2988 ConstraintsSetStmt
*newnode
= makeNode(ConstraintsSetStmt
);
2990 COPY_NODE_FIELD(constraints
);
2991 COPY_SCALAR_FIELD(deferred
);
2996 static ReindexStmt
*
2997 _copyReindexStmt(ReindexStmt
*from
)
2999 ReindexStmt
*newnode
= makeNode(ReindexStmt
);
3001 COPY_SCALAR_FIELD(kind
);
3002 COPY_NODE_FIELD(relation
);
3003 COPY_STRING_FIELD(name
);
3004 COPY_SCALAR_FIELD(do_system
);
3005 COPY_SCALAR_FIELD(do_user
);
3010 static CreateSchemaStmt
*
3011 _copyCreateSchemaStmt(CreateSchemaStmt
*from
)
3013 CreateSchemaStmt
*newnode
= makeNode(CreateSchemaStmt
);
3015 COPY_STRING_FIELD(schemaname
);
3016 COPY_STRING_FIELD(authid
);
3017 COPY_NODE_FIELD(schemaElts
);
3022 static CreateConversionStmt
*
3023 _copyCreateConversionStmt(CreateConversionStmt
*from
)
3025 CreateConversionStmt
*newnode
= makeNode(CreateConversionStmt
);
3027 COPY_NODE_FIELD(conversion_name
);
3028 COPY_STRING_FIELD(for_encoding_name
);
3029 COPY_STRING_FIELD(to_encoding_name
);
3030 COPY_NODE_FIELD(func_name
);
3031 COPY_SCALAR_FIELD(def
);
3036 static CreateCastStmt
*
3037 _copyCreateCastStmt(CreateCastStmt
*from
)
3039 CreateCastStmt
*newnode
= makeNode(CreateCastStmt
);
3041 COPY_NODE_FIELD(sourcetype
);
3042 COPY_NODE_FIELD(targettype
);
3043 COPY_NODE_FIELD(func
);
3044 COPY_SCALAR_FIELD(context
);
3045 COPY_SCALAR_FIELD(inout
);
3050 static DropCastStmt
*
3051 _copyDropCastStmt(DropCastStmt
*from
)
3053 DropCastStmt
*newnode
= makeNode(DropCastStmt
);
3055 COPY_NODE_FIELD(sourcetype
);
3056 COPY_NODE_FIELD(targettype
);
3057 COPY_SCALAR_FIELD(behavior
);
3058 COPY_SCALAR_FIELD(missing_ok
);
3063 static PrepareStmt
*
3064 _copyPrepareStmt(PrepareStmt
*from
)
3066 PrepareStmt
*newnode
= makeNode(PrepareStmt
);
3068 COPY_STRING_FIELD(name
);
3069 COPY_NODE_FIELD(argtypes
);
3070 COPY_NODE_FIELD(query
);
3075 static ExecuteStmt
*
3076 _copyExecuteStmt(ExecuteStmt
*from
)
3078 ExecuteStmt
*newnode
= makeNode(ExecuteStmt
);
3080 COPY_STRING_FIELD(name
);
3081 COPY_NODE_FIELD(into
);
3082 COPY_NODE_FIELD(params
);
3087 static DeallocateStmt
*
3088 _copyDeallocateStmt(DeallocateStmt
*from
)
3090 DeallocateStmt
*newnode
= makeNode(DeallocateStmt
);
3092 COPY_STRING_FIELD(name
);
3097 static DropOwnedStmt
*
3098 _copyDropOwnedStmt(DropOwnedStmt
*from
)
3100 DropOwnedStmt
*newnode
= makeNode(DropOwnedStmt
);
3102 COPY_NODE_FIELD(roles
);
3103 COPY_SCALAR_FIELD(behavior
);
3108 static ReassignOwnedStmt
*
3109 _copyReassignOwnedStmt(ReassignOwnedStmt
*from
)
3111 ReassignOwnedStmt
*newnode
= makeNode(ReassignOwnedStmt
);
3113 COPY_NODE_FIELD(roles
);
3114 COPY_SCALAR_FIELD(newrole
);
3119 static AlterTSDictionaryStmt
*
3120 _copyAlterTSDictionaryStmt(AlterTSDictionaryStmt
*from
)
3122 AlterTSDictionaryStmt
*newnode
= makeNode(AlterTSDictionaryStmt
);
3124 COPY_NODE_FIELD(dictname
);
3125 COPY_NODE_FIELD(options
);
3130 static AlterTSConfigurationStmt
*
3131 _copyAlterTSConfigurationStmt(AlterTSConfigurationStmt
*from
)
3133 AlterTSConfigurationStmt
*newnode
= makeNode(AlterTSConfigurationStmt
);
3135 COPY_NODE_FIELD(cfgname
);
3136 COPY_NODE_FIELD(tokentype
);
3137 COPY_NODE_FIELD(dicts
);
3138 COPY_SCALAR_FIELD(override
);
3139 COPY_SCALAR_FIELD(replace
);
3140 COPY_SCALAR_FIELD(missing_ok
);
3145 /* ****************************************************************
3146 * pg_list.h copy functions
3147 * ****************************************************************
3151 * Perform a deep copy of the specified list, using copyObject(). The
3152 * list MUST be of type T_List; T_IntList and T_OidList nodes don't
3153 * need deep copies, so they should be copied via list_copy()
3155 #define COPY_NODE_CELL(new, old) \
3156 (new) = (ListCell *) palloc(sizeof(ListCell)); \
3157 lfirst(new) = copyObject(lfirst(old));
3160 _copyList(List
*from
)
3166 Assert(list_length(from
) >= 1);
3168 new = makeNode(List
);
3169 new->length
= from
->length
;
3171 COPY_NODE_CELL(new->head
, from
->head
);
3172 prev_new
= new->head
;
3173 curr_old
= lnext(from
->head
);
3177 COPY_NODE_CELL(prev_new
->next
, curr_old
);
3178 prev_new
= prev_new
->next
;
3179 curr_old
= curr_old
->next
;
3181 prev_new
->next
= NULL
;
3182 new->tail
= prev_new
;
3187 /* ****************************************************************
3188 * value.h copy functions
3189 * ****************************************************************
3192 _copyValue(Value
*from
)
3194 Value
*newnode
= makeNode(Value
);
3196 /* See also _copyAConst when changing this code! */
3198 COPY_SCALAR_FIELD(type
);
3202 COPY_SCALAR_FIELD(val
.ival
);
3207 COPY_STRING_FIELD(val
.str
);
3213 elog(ERROR
, "unrecognized node type: %d",
3223 * Create a copy of a Node tree or list. This is a "deep" copy: all
3224 * substructure is copied too, recursively.
3227 copyObject(void *from
)
3234 switch (nodeTag(from
))
3240 retval
= _copyPlannedStmt(from
);
3243 retval
= _copyPlan(from
);
3246 retval
= _copyResult(from
);
3249 retval
= _copyAppend(from
);
3251 case T_RecursiveUnion
:
3252 retval
= _copyRecursiveUnion(from
);
3255 retval
= _copyBitmapAnd(from
);
3258 retval
= _copyBitmapOr(from
);
3261 retval
= _copyScan(from
);
3264 retval
= _copySeqScan(from
);
3267 retval
= _copyIndexScan(from
);
3269 case T_BitmapIndexScan
:
3270 retval
= _copyBitmapIndexScan(from
);
3272 case T_BitmapHeapScan
:
3273 retval
= _copyBitmapHeapScan(from
);
3276 retval
= _copyTidScan(from
);
3278 case T_SubqueryScan
:
3279 retval
= _copySubqueryScan(from
);
3281 case T_FunctionScan
:
3282 retval
= _copyFunctionScan(from
);
3285 retval
= _copyValuesScan(from
);
3288 retval
= _copyCteScan(from
);
3290 case T_WorkTableScan
:
3291 retval
= _copyWorkTableScan(from
);
3294 retval
= _copyJoin(from
);
3297 retval
= _copyNestLoop(from
);
3300 retval
= _copyMergeJoin(from
);
3303 retval
= _copyHashJoin(from
);
3306 retval
= _copyMaterial(from
);
3309 retval
= _copySort(from
);
3312 retval
= _copyGroup(from
);
3315 retval
= _copyAgg(from
);
3318 retval
= _copyUnique(from
);
3321 retval
= _copyHash(from
);
3324 retval
= _copySetOp(from
);
3327 retval
= _copyLimit(from
);
3329 case T_PlanInvalItem
:
3330 retval
= _copyPlanInvalItem(from
);
3337 retval
= _copyAlias(from
);
3340 retval
= _copyRangeVar(from
);
3343 retval
= _copyIntoClause(from
);
3346 retval
= _copyVar(from
);
3349 retval
= _copyConst(from
);
3352 retval
= _copyParam(from
);
3355 retval
= _copyAggref(from
);
3358 retval
= _copyArrayRef(from
);
3361 retval
= _copyFuncExpr(from
);
3364 retval
= _copyOpExpr(from
);
3366 case T_DistinctExpr
:
3367 retval
= _copyDistinctExpr(from
);
3369 case T_ScalarArrayOpExpr
:
3370 retval
= _copyScalarArrayOpExpr(from
);
3373 retval
= _copyBoolExpr(from
);
3376 retval
= _copySubLink(from
);
3379 retval
= _copySubPlan(from
);
3381 case T_AlternativeSubPlan
:
3382 retval
= _copyAlternativeSubPlan(from
);
3385 retval
= _copyFieldSelect(from
);
3388 retval
= _copyFieldStore(from
);
3391 retval
= _copyRelabelType(from
);
3394 retval
= _copyCoerceViaIO(from
);
3396 case T_ArrayCoerceExpr
:
3397 retval
= _copyArrayCoerceExpr(from
);
3399 case T_ConvertRowtypeExpr
:
3400 retval
= _copyConvertRowtypeExpr(from
);
3403 retval
= _copyCaseExpr(from
);
3406 retval
= _copyCaseWhen(from
);
3408 case T_CaseTestExpr
:
3409 retval
= _copyCaseTestExpr(from
);
3412 retval
= _copyArrayExpr(from
);
3415 retval
= _copyRowExpr(from
);
3417 case T_RowCompareExpr
:
3418 retval
= _copyRowCompareExpr(from
);
3420 case T_CoalesceExpr
:
3421 retval
= _copyCoalesceExpr(from
);
3424 retval
= _copyMinMaxExpr(from
);
3427 retval
= _copyXmlExpr(from
);
3430 retval
= _copyNullIfExpr(from
);
3433 retval
= _copyNullTest(from
);
3436 retval
= _copyBooleanTest(from
);
3438 case T_CoerceToDomain
:
3439 retval
= _copyCoerceToDomain(from
);
3441 case T_CoerceToDomainValue
:
3442 retval
= _copyCoerceToDomainValue(from
);
3444 case T_SetToDefault
:
3445 retval
= _copySetToDefault(from
);
3447 case T_CurrentOfExpr
:
3448 retval
= _copyCurrentOfExpr(from
);
3451 retval
= _copyTargetEntry(from
);
3454 retval
= _copyRangeTblRef(from
);
3457 retval
= _copyJoinExpr(from
);
3460 retval
= _copyFromExpr(from
);
3467 retval
= _copyPathKey(from
);
3469 case T_RestrictInfo
:
3470 retval
= _copyRestrictInfo(from
);
3472 case T_FlattenedSubLink
:
3473 retval
= _copyFlattenedSubLink(from
);
3475 case T_PlaceHolderVar
:
3476 retval
= _copyPlaceHolderVar(from
);
3478 case T_SpecialJoinInfo
:
3479 retval
= _copySpecialJoinInfo(from
);
3481 case T_AppendRelInfo
:
3482 retval
= _copyAppendRelInfo(from
);
3484 case T_PlaceHolderInfo
:
3485 retval
= _copyPlaceHolderInfo(from
);
3496 retval
= _copyValue(from
);
3503 retval
= _copyList(from
);
3507 * Lists of integers and OIDs don't need to be deep-copied, so we
3508 * perform a shallow copy via list_copy()
3512 retval
= list_copy(from
);
3519 retval
= _copyQuery(from
);
3522 retval
= _copyInsertStmt(from
);
3525 retval
= _copyDeleteStmt(from
);
3528 retval
= _copyUpdateStmt(from
);
3531 retval
= _copySelectStmt(from
);
3533 case T_SetOperationStmt
:
3534 retval
= _copySetOperationStmt(from
);
3536 case T_AlterTableStmt
:
3537 retval
= _copyAlterTableStmt(from
);
3539 case T_AlterTableCmd
:
3540 retval
= _copyAlterTableCmd(from
);
3542 case T_AlterDomainStmt
:
3543 retval
= _copyAlterDomainStmt(from
);
3546 retval
= _copyGrantStmt(from
);
3548 case T_GrantRoleStmt
:
3549 retval
= _copyGrantRoleStmt(from
);
3551 case T_DeclareCursorStmt
:
3552 retval
= _copyDeclareCursorStmt(from
);
3554 case T_ClosePortalStmt
:
3555 retval
= _copyClosePortalStmt(from
);
3558 retval
= _copyClusterStmt(from
);
3561 retval
= _copyCopyStmt(from
);
3564 retval
= _copyCreateStmt(from
);
3567 retval
= _copyInhRelation(from
);
3570 retval
= _copyDefineStmt(from
);
3573 retval
= _copyDropStmt(from
);
3575 case T_TruncateStmt
:
3576 retval
= _copyTruncateStmt(from
);
3579 retval
= _copyCommentStmt(from
);
3582 retval
= _copyFetchStmt(from
);
3585 retval
= _copyIndexStmt(from
);
3587 case T_CreateFunctionStmt
:
3588 retval
= _copyCreateFunctionStmt(from
);
3590 case T_FunctionParameter
:
3591 retval
= _copyFunctionParameter(from
);
3593 case T_AlterFunctionStmt
:
3594 retval
= _copyAlterFunctionStmt(from
);
3596 case T_RemoveFuncStmt
:
3597 retval
= _copyRemoveFuncStmt(from
);
3599 case T_RemoveOpClassStmt
:
3600 retval
= _copyRemoveOpClassStmt(from
);
3602 case T_RemoveOpFamilyStmt
:
3603 retval
= _copyRemoveOpFamilyStmt(from
);
3606 retval
= _copyRenameStmt(from
);
3608 case T_AlterObjectSchemaStmt
:
3609 retval
= _copyAlterObjectSchemaStmt(from
);
3611 case T_AlterOwnerStmt
:
3612 retval
= _copyAlterOwnerStmt(from
);
3615 retval
= _copyRuleStmt(from
);
3618 retval
= _copyNotifyStmt(from
);
3621 retval
= _copyListenStmt(from
);
3623 case T_UnlistenStmt
:
3624 retval
= _copyUnlistenStmt(from
);
3626 case T_TransactionStmt
:
3627 retval
= _copyTransactionStmt(from
);
3629 case T_CompositeTypeStmt
:
3630 retval
= _copyCompositeTypeStmt(from
);
3632 case T_CreateEnumStmt
:
3633 retval
= _copyCreateEnumStmt(from
);
3636 retval
= _copyViewStmt(from
);
3639 retval
= _copyLoadStmt(from
);
3641 case T_CreateDomainStmt
:
3642 retval
= _copyCreateDomainStmt(from
);
3644 case T_CreateOpClassStmt
:
3645 retval
= _copyCreateOpClassStmt(from
);
3647 case T_CreateOpClassItem
:
3648 retval
= _copyCreateOpClassItem(from
);
3650 case T_CreateOpFamilyStmt
:
3651 retval
= _copyCreateOpFamilyStmt(from
);
3653 case T_AlterOpFamilyStmt
:
3654 retval
= _copyAlterOpFamilyStmt(from
);
3656 case T_CreatedbStmt
:
3657 retval
= _copyCreatedbStmt(from
);
3659 case T_AlterDatabaseStmt
:
3660 retval
= _copyAlterDatabaseStmt(from
);
3662 case T_AlterDatabaseSetStmt
:
3663 retval
= _copyAlterDatabaseSetStmt(from
);
3666 retval
= _copyDropdbStmt(from
);
3669 retval
= _copyVacuumStmt(from
);
3672 retval
= _copyExplainStmt(from
);
3674 case T_CreateSeqStmt
:
3675 retval
= _copyCreateSeqStmt(from
);
3677 case T_AlterSeqStmt
:
3678 retval
= _copyAlterSeqStmt(from
);
3680 case T_VariableSetStmt
:
3681 retval
= _copyVariableSetStmt(from
);
3683 case T_VariableShowStmt
:
3684 retval
= _copyVariableShowStmt(from
);
3687 retval
= _copyDiscardStmt(from
);
3689 case T_CreateTableSpaceStmt
:
3690 retval
= _copyCreateTableSpaceStmt(from
);
3692 case T_DropTableSpaceStmt
:
3693 retval
= _copyDropTableSpaceStmt(from
);
3695 case T_CreateTrigStmt
:
3696 retval
= _copyCreateTrigStmt(from
);
3698 case T_DropPropertyStmt
:
3699 retval
= _copyDropPropertyStmt(from
);
3701 case T_CreatePLangStmt
:
3702 retval
= _copyCreatePLangStmt(from
);
3704 case T_DropPLangStmt
:
3705 retval
= _copyDropPLangStmt(from
);
3707 case T_CreateRoleStmt
:
3708 retval
= _copyCreateRoleStmt(from
);
3710 case T_AlterRoleStmt
:
3711 retval
= _copyAlterRoleStmt(from
);
3713 case T_AlterRoleSetStmt
:
3714 retval
= _copyAlterRoleSetStmt(from
);
3716 case T_DropRoleStmt
:
3717 retval
= _copyDropRoleStmt(from
);
3720 retval
= _copyLockStmt(from
);
3722 case T_ConstraintsSetStmt
:
3723 retval
= _copyConstraintsSetStmt(from
);
3726 retval
= _copyReindexStmt(from
);
3728 case T_CheckPointStmt
:
3729 retval
= (void *) makeNode(CheckPointStmt
);
3731 case T_CreateSchemaStmt
:
3732 retval
= _copyCreateSchemaStmt(from
);
3734 case T_CreateConversionStmt
:
3735 retval
= _copyCreateConversionStmt(from
);
3737 case T_CreateCastStmt
:
3738 retval
= _copyCreateCastStmt(from
);
3740 case T_DropCastStmt
:
3741 retval
= _copyDropCastStmt(from
);
3744 retval
= _copyPrepareStmt(from
);
3747 retval
= _copyExecuteStmt(from
);
3749 case T_DeallocateStmt
:
3750 retval
= _copyDeallocateStmt(from
);
3752 case T_DropOwnedStmt
:
3753 retval
= _copyDropOwnedStmt(from
);
3755 case T_ReassignOwnedStmt
:
3756 retval
= _copyReassignOwnedStmt(from
);
3758 case T_AlterTSDictionaryStmt
:
3759 retval
= _copyAlterTSDictionaryStmt(from
);
3761 case T_AlterTSConfigurationStmt
:
3762 retval
= _copyAlterTSConfigurationStmt(from
);
3766 retval
= _copyAExpr(from
);
3769 retval
= _copyColumnRef(from
);
3772 retval
= _copyParamRef(from
);
3775 retval
= _copyAConst(from
);
3778 retval
= _copyFuncCall(from
);
3781 retval
= _copyAStar(from
);
3784 retval
= _copyAIndices(from
);
3786 case T_A_Indirection
:
3787 retval
= _copyA_Indirection(from
);
3790 retval
= _copyA_ArrayExpr(from
);
3793 retval
= _copyResTarget(from
);
3796 retval
= _copyTypeCast(from
);
3799 retval
= _copySortBy(from
);
3801 case T_RangeSubselect
:
3802 retval
= _copyRangeSubselect(from
);
3804 case T_RangeFunction
:
3805 retval
= _copyRangeFunction(from
);
3808 retval
= _copyTypeName(from
);
3811 retval
= _copyIndexElem(from
);
3814 retval
= _copyColumnDef(from
);
3817 retval
= _copyConstraint(from
);
3820 retval
= _copyDefElem(from
);
3822 case T_LockingClause
:
3823 retval
= _copyLockingClause(from
);
3825 case T_RangeTblEntry
:
3826 retval
= _copyRangeTblEntry(from
);
3828 case T_SortGroupClause
:
3829 retval
= _copySortGroupClause(from
);
3831 case T_RowMarkClause
:
3832 retval
= _copyRowMarkClause(from
);
3835 retval
= _copyWithClause(from
);
3837 case T_CommonTableExpr
:
3838 retval
= _copyCommonTableExpr(from
);
3840 case T_FkConstraint
:
3841 retval
= _copyFkConstraint(from
);
3844 retval
= _copyPrivGrantee(from
);
3846 case T_FuncWithArgs
:
3847 retval
= _copyFuncWithArgs(from
);
3849 case T_XmlSerialize
:
3850 retval
= _copyXmlSerialize(from
);
3854 elog(ERROR
, "unrecognized node type: %d", (int) nodeTag(from
));
3855 retval
= from
; /* keep compiler quiet */