LCOV - code coverage report
Current view: top level - src/backend/nodes - copyfuncs.c (source / functions) Hit Total Coverage
Test: PostgreSQL Lines: 1862 2790 66.7 %
Date: 2017-09-29 15:12:54 Functions: 174 275 63.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*-------------------------------------------------------------------------
       2             :  *
       3             :  * copyfuncs.c
       4             :  *    Copy functions for Postgres tree nodes.
       5             :  *
       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.
      12             :  *
      13             :  *
      14             :  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
      15             :  * Portions Copyright (c) 1994, Regents of the University of California
      16             :  *
      17             :  * IDENTIFICATION
      18             :  *    src/backend/nodes/copyfuncs.c
      19             :  *
      20             :  *-------------------------------------------------------------------------
      21             :  */
      22             : 
      23             : #include "postgres.h"
      24             : 
      25             : #include "miscadmin.h"
      26             : #include "nodes/extensible.h"
      27             : #include "nodes/plannodes.h"
      28             : #include "nodes/relation.h"
      29             : #include "utils/datum.h"
      30             : #include "utils/rel.h"
      31             : 
      32             : 
      33             : /*
      34             :  * Macros to simplify copying of different kinds of fields.  Use these
      35             :  * wherever possible to reduce the chance for silly typos.  Note that these
      36             :  * hard-wire the convention that the local variables in a Copy routine are
      37             :  * named 'newnode' and 'from'.
      38             :  */
      39             : 
      40             : /* Copy a simple scalar field (int, float, bool, enum, etc) */
      41             : #define COPY_SCALAR_FIELD(fldname) \
      42             :     (newnode->fldname = from->fldname)
      43             : 
      44             : /* Copy a field that is a pointer to some kind of Node or Node tree */
      45             : #define COPY_NODE_FIELD(fldname) \
      46             :     (newnode->fldname = copyObjectImpl(from->fldname))
      47             : 
      48             : /* Copy a field that is a pointer to a Bitmapset */
      49             : #define COPY_BITMAPSET_FIELD(fldname) \
      50             :     (newnode->fldname = bms_copy(from->fldname))
      51             : 
      52             : /* Copy a field that is a pointer to a C string, or perhaps NULL */
      53             : #define COPY_STRING_FIELD(fldname) \
      54             :     (newnode->fldname = from->fldname ? pstrdup(from->fldname) : (char *) NULL)
      55             : 
      56             : /* Copy a field that is a pointer to a simple palloc'd object of size sz */
      57             : #define COPY_POINTER_FIELD(fldname, sz) \
      58             :     do { \
      59             :         Size    _size = (sz); \
      60             :         newnode->fldname = palloc(_size); \
      61             :         memcpy(newnode->fldname, from->fldname, _size); \
      62             :     } while (0)
      63             : 
      64             : /* Copy a parse location field (for Copy, this is same as scalar case) */
      65             : #define COPY_LOCATION_FIELD(fldname) \
      66             :     (newnode->fldname = from->fldname)
      67             : 
      68             : 
      69             : /* ****************************************************************
      70             :  *                   plannodes.h copy functions
      71             :  * ****************************************************************
      72             :  */
      73             : 
      74             : /*
      75             :  * _copyPlannedStmt
      76             :  */
      77             : static PlannedStmt *
      78        4088 : _copyPlannedStmt(const PlannedStmt *from)
      79             : {
      80        4088 :     PlannedStmt *newnode = makeNode(PlannedStmt);
      81             : 
      82        4088 :     COPY_SCALAR_FIELD(commandType);
      83        4088 :     COPY_SCALAR_FIELD(queryId);
      84        4088 :     COPY_SCALAR_FIELD(hasReturning);
      85        4088 :     COPY_SCALAR_FIELD(hasModifyingCTE);
      86        4088 :     COPY_SCALAR_FIELD(canSetTag);
      87        4088 :     COPY_SCALAR_FIELD(transientPlan);
      88        4088 :     COPY_SCALAR_FIELD(dependsOnRole);
      89        4088 :     COPY_SCALAR_FIELD(parallelModeNeeded);
      90        4088 :     COPY_NODE_FIELD(planTree);
      91        4088 :     COPY_NODE_FIELD(rtable);
      92        4088 :     COPY_NODE_FIELD(resultRelations);
      93        4088 :     COPY_NODE_FIELD(nonleafResultRelations);
      94        4088 :     COPY_NODE_FIELD(rootResultRelations);
      95        4088 :     COPY_NODE_FIELD(subplans);
      96        4088 :     COPY_BITMAPSET_FIELD(rewindPlanIDs);
      97        4088 :     COPY_NODE_FIELD(rowMarks);
      98        4088 :     COPY_NODE_FIELD(relationOids);
      99        4088 :     COPY_NODE_FIELD(invalItems);
     100        4088 :     COPY_SCALAR_FIELD(nParamExec);
     101        4088 :     COPY_NODE_FIELD(utilityStmt);
     102        4088 :     COPY_LOCATION_FIELD(stmt_location);
     103        4088 :     COPY_LOCATION_FIELD(stmt_len);
     104             : 
     105        4088 :     return newnode;
     106             : }
     107             : 
     108             : /*
     109             :  * CopyPlanFields
     110             :  *
     111             :  *      This function copies the fields of the Plan node.  It is used by
     112             :  *      all the copy functions for classes which inherit from Plan.
     113             :  */
     114             : static void
     115        4059 : CopyPlanFields(const Plan *from, Plan *newnode)
     116             : {
     117        4059 :     COPY_SCALAR_FIELD(startup_cost);
     118        4059 :     COPY_SCALAR_FIELD(total_cost);
     119        4059 :     COPY_SCALAR_FIELD(plan_rows);
     120        4059 :     COPY_SCALAR_FIELD(plan_width);
     121        4059 :     COPY_SCALAR_FIELD(parallel_aware);
     122        4059 :     COPY_SCALAR_FIELD(parallel_safe);
     123        4059 :     COPY_SCALAR_FIELD(plan_node_id);
     124        4059 :     COPY_NODE_FIELD(targetlist);
     125        4059 :     COPY_NODE_FIELD(qual);
     126        4059 :     COPY_NODE_FIELD(lefttree);
     127        4059 :     COPY_NODE_FIELD(righttree);
     128        4059 :     COPY_NODE_FIELD(initPlan);
     129        4059 :     COPY_BITMAPSET_FIELD(extParam);
     130        4059 :     COPY_BITMAPSET_FIELD(allParam);
     131        4059 : }
     132             : 
     133             : /*
     134             :  * _copyPlan
     135             :  */
     136             : static Plan *
     137           0 : _copyPlan(const Plan *from)
     138             : {
     139           0 :     Plan       *newnode = makeNode(Plan);
     140             : 
     141             :     /*
     142             :      * copy node superclass fields
     143             :      */
     144           0 :     CopyPlanFields(from, newnode);
     145             : 
     146           0 :     return newnode;
     147             : }
     148             : 
     149             : 
     150             : /*
     151             :  * _copyResult
     152             :  */
     153             : static Result *
     154        2068 : _copyResult(const Result *from)
     155             : {
     156        2068 :     Result     *newnode = makeNode(Result);
     157             : 
     158             :     /*
     159             :      * copy node superclass fields
     160             :      */
     161        2068 :     CopyPlanFields((const Plan *) from, (Plan *) newnode);
     162             : 
     163             :     /*
     164             :      * copy remainder of node
     165             :      */
     166        2068 :     COPY_NODE_FIELD(resconstantqual);
     167             : 
     168        2068 :     return newnode;
     169             : }
     170             : 
     171             : /*
     172             :  * _copyProjectSet
     173             :  */
     174             : static ProjectSet *
     175           2 : _copyProjectSet(const ProjectSet *from)
     176             : {
     177           2 :     ProjectSet *newnode = makeNode(ProjectSet);
     178             : 
     179             :     /*
     180             :      * copy node superclass fields
     181             :      */
     182           2 :     CopyPlanFields((const Plan *) from, (Plan *) newnode);
     183             : 
     184           2 :     return newnode;
     185             : }
     186             : 
     187             : /*
     188             :  * _copyModifyTable
     189             :  */
     190             : static ModifyTable *
     191         209 : _copyModifyTable(const ModifyTable *from)
     192             : {
     193         209 :     ModifyTable *newnode = makeNode(ModifyTable);
     194             : 
     195             :     /*
     196             :      * copy node superclass fields
     197             :      */
     198         209 :     CopyPlanFields((const Plan *) from, (Plan *) newnode);
     199             : 
     200             :     /*
     201             :      * copy remainder of node
     202             :      */
     203         209 :     COPY_SCALAR_FIELD(operation);
     204         209 :     COPY_SCALAR_FIELD(canSetTag);
     205         209 :     COPY_SCALAR_FIELD(nominalRelation);
     206         209 :     COPY_NODE_FIELD(partitioned_rels);
     207         209 :     COPY_NODE_FIELD(resultRelations);
     208         209 :     COPY_SCALAR_FIELD(resultRelIndex);
     209         209 :     COPY_SCALAR_FIELD(rootResultRelIndex);
     210         209 :     COPY_NODE_FIELD(plans);
     211         209 :     COPY_NODE_FIELD(withCheckOptionLists);
     212         209 :     COPY_NODE_FIELD(returningLists);
     213         209 :     COPY_NODE_FIELD(fdwPrivLists);
     214         209 :     COPY_BITMAPSET_FIELD(fdwDirectModifyPlans);
     215         209 :     COPY_NODE_FIELD(rowMarks);
     216         209 :     COPY_SCALAR_FIELD(epqParam);
     217         209 :     COPY_SCALAR_FIELD(onConflictAction);
     218         209 :     COPY_NODE_FIELD(arbiterIndexes);
     219         209 :     COPY_NODE_FIELD(onConflictSet);
     220         209 :     COPY_NODE_FIELD(onConflictWhere);
     221         209 :     COPY_SCALAR_FIELD(exclRelRTI);
     222         209 :     COPY_NODE_FIELD(exclRelTlist);
     223             : 
     224         209 :     return newnode;
     225             : }
     226             : 
     227             : /*
     228             :  * _copyAppend
     229             :  */
     230             : static Append *
     231          23 : _copyAppend(const Append *from)
     232             : {
     233          23 :     Append     *newnode = makeNode(Append);
     234             : 
     235             :     /*
     236             :      * copy node superclass fields
     237             :      */
     238          23 :     CopyPlanFields((const Plan *) from, (Plan *) newnode);
     239             : 
     240             :     /*
     241             :      * copy remainder of node
     242             :      */
     243          23 :     COPY_NODE_FIELD(partitioned_rels);
     244          23 :     COPY_NODE_FIELD(appendplans);
     245             : 
     246          23 :     return newnode;
     247             : }
     248             : 
     249             : /*
     250             :  * _copyMergeAppend
     251             :  */
     252             : static MergeAppend *
     253           0 : _copyMergeAppend(const MergeAppend *from)
     254             : {
     255           0 :     MergeAppend *newnode = makeNode(MergeAppend);
     256             : 
     257             :     /*
     258             :      * copy node superclass fields
     259             :      */
     260           0 :     CopyPlanFields((const Plan *) from, (Plan *) newnode);
     261             : 
     262             :     /*
     263             :      * copy remainder of node
     264             :      */
     265           0 :     COPY_NODE_FIELD(partitioned_rels);
     266           0 :     COPY_NODE_FIELD(mergeplans);
     267           0 :     COPY_SCALAR_FIELD(numCols);
     268           0 :     COPY_POINTER_FIELD(sortColIdx, from->numCols * sizeof(AttrNumber));
     269           0 :     COPY_POINTER_FIELD(sortOperators, from->numCols * sizeof(Oid));
     270           0 :     COPY_POINTER_FIELD(collations, from->numCols * sizeof(Oid));
     271           0 :     COPY_POINTER_FIELD(nullsFirst, from->numCols * sizeof(bool));
     272             : 
     273           0 :     return newnode;
     274             : }
     275             : 
     276             : /*
     277             :  * _copyRecursiveUnion
     278             :  */
     279             : static RecursiveUnion *
     280           0 : _copyRecursiveUnion(const RecursiveUnion *from)
     281             : {
     282           0 :     RecursiveUnion *newnode = makeNode(RecursiveUnion);
     283             : 
     284             :     /*
     285             :      * copy node superclass fields
     286             :      */
     287           0 :     CopyPlanFields((const Plan *) from, (Plan *) newnode);
     288             : 
     289             :     /*
     290             :      * copy remainder of node
     291             :      */
     292           0 :     COPY_SCALAR_FIELD(wtParam);
     293           0 :     COPY_SCALAR_FIELD(numCols);
     294           0 :     if (from->numCols > 0)
     295             :     {
     296           0 :         COPY_POINTER_FIELD(dupColIdx, from->numCols * sizeof(AttrNumber));
     297           0 :         COPY_POINTER_FIELD(dupOperators, from->numCols * sizeof(Oid));
     298             :     }
     299           0 :     COPY_SCALAR_FIELD(numGroups);
     300             : 
     301           0 :     return newnode;
     302             : }
     303             : 
     304             : /*
     305             :  * _copyBitmapAnd
     306             :  */
     307             : static BitmapAnd *
     308           0 : _copyBitmapAnd(const BitmapAnd *from)
     309             : {
     310           0 :     BitmapAnd  *newnode = makeNode(BitmapAnd);
     311             : 
     312             :     /*
     313             :      * copy node superclass fields
     314             :      */
     315           0 :     CopyPlanFields((const Plan *) from, (Plan *) newnode);
     316             : 
     317             :     /*
     318             :      * copy remainder of node
     319             :      */
     320           0 :     COPY_NODE_FIELD(bitmapplans);
     321             : 
     322           0 :     return newnode;
     323             : }
     324             : 
     325             : /*
     326             :  * _copyBitmapOr
     327             :  */
     328             : static BitmapOr *
     329           0 : _copyBitmapOr(const BitmapOr *from)
     330             : {
     331           0 :     BitmapOr   *newnode = makeNode(BitmapOr);
     332             : 
     333             :     /*
     334             :      * copy node superclass fields
     335             :      */
     336           0 :     CopyPlanFields((const Plan *) from, (Plan *) newnode);
     337             : 
     338             :     /*
     339             :      * copy remainder of node
     340             :      */
     341           0 :     COPY_SCALAR_FIELD(isshared);
     342           0 :     COPY_NODE_FIELD(bitmapplans);
     343             : 
     344           0 :     return newnode;
     345             : }
     346             : 
     347             : /*
     348             :  * _copyGather
     349             :  */
     350             : static Gather *
     351           0 : _copyGather(const Gather *from)
     352             : {
     353           0 :     Gather     *newnode = makeNode(Gather);
     354             : 
     355             :     /*
     356             :      * copy node superclass fields
     357             :      */
     358           0 :     CopyPlanFields((const Plan *) from, (Plan *) newnode);
     359             : 
     360             :     /*
     361             :      * copy remainder of node
     362             :      */
     363           0 :     COPY_SCALAR_FIELD(num_workers);
     364           0 :     COPY_SCALAR_FIELD(rescan_param);
     365           0 :     COPY_SCALAR_FIELD(single_copy);
     366           0 :     COPY_SCALAR_FIELD(invisible);
     367             : 
     368           0 :     return newnode;
     369             : }
     370             : 
     371             : /*
     372             :  * _copyGatherMerge
     373             :  */
     374             : static GatherMerge *
     375           0 : _copyGatherMerge(const GatherMerge *from)
     376             : {
     377           0 :     GatherMerge *newnode = makeNode(GatherMerge);
     378             : 
     379             :     /*
     380             :      * copy node superclass fields
     381             :      */
     382           0 :     CopyPlanFields((const Plan *) from, (Plan *) newnode);
     383             : 
     384             :     /*
     385             :      * copy remainder of node
     386             :      */
     387           0 :     COPY_SCALAR_FIELD(num_workers);
     388           0 :     COPY_SCALAR_FIELD(rescan_param);
     389           0 :     COPY_SCALAR_FIELD(numCols);
     390           0 :     COPY_POINTER_FIELD(sortColIdx, from->numCols * sizeof(AttrNumber));
     391           0 :     COPY_POINTER_FIELD(sortOperators, from->numCols * sizeof(Oid));
     392           0 :     COPY_POINTER_FIELD(collations, from->numCols * sizeof(Oid));
     393           0 :     COPY_POINTER_FIELD(nullsFirst, from->numCols * sizeof(bool));
     394             : 
     395           0 :     return newnode;
     396             : }
     397             : 
     398             : /*
     399             :  * CopyScanFields
     400             :  *
     401             :  *      This function copies the fields of the Scan node.  It is used by
     402             :  *      all the copy functions for classes which inherit from Scan.
     403             :  */
     404             : static void
     405        1224 : CopyScanFields(const Scan *from, Scan *newnode)
     406             : {
     407        1224 :     CopyPlanFields((const Plan *) from, (Plan *) newnode);
     408             : 
     409        1224 :     COPY_SCALAR_FIELD(scanrelid);
     410        1224 : }
     411             : 
     412             : /*
     413             :  * _copyScan
     414             :  */
     415             : static Scan *
     416           0 : _copyScan(const Scan *from)
     417             : {
     418           0 :     Scan       *newnode = makeNode(Scan);
     419             : 
     420             :     /*
     421             :      * copy node superclass fields
     422             :      */
     423           0 :     CopyScanFields((const Scan *) from, (Scan *) newnode);
     424             : 
     425           0 :     return newnode;
     426             : }
     427             : 
     428             : /*
     429             :  * _copySeqScan
     430             :  */
     431             : static SeqScan *
     432         468 : _copySeqScan(const SeqScan *from)
     433             : {
     434         468 :     SeqScan    *newnode = makeNode(SeqScan);
     435             : 
     436             :     /*
     437             :      * copy node superclass fields
     438             :      */
     439         468 :     CopyScanFields((const Scan *) from, (Scan *) newnode);
     440             : 
     441         468 :     return newnode;
     442             : }
     443             : 
     444             : /*
     445             :  * _copySampleScan
     446             :  */
     447             : static SampleScan *
     448           1 : _copySampleScan(const SampleScan *from)
     449             : {
     450           1 :     SampleScan *newnode = makeNode(SampleScan);
     451             : 
     452             :     /*
     453             :      * copy node superclass fields
     454             :      */
     455           1 :     CopyScanFields((const Scan *) from, (Scan *) newnode);
     456             : 
     457             :     /*
     458             :      * copy remainder of node
     459             :      */
     460           1 :     COPY_NODE_FIELD(tablesample);
     461             : 
     462           1 :     return newnode;
     463             : }
     464             : 
     465             : /*
     466             :  * _copyIndexScan
     467             :  */
     468             : static IndexScan *
     469         558 : _copyIndexScan(const IndexScan *from)
     470             : {
     471         558 :     IndexScan  *newnode = makeNode(IndexScan);
     472             : 
     473             :     /*
     474             :      * copy node superclass fields
     475             :      */
     476         558 :     CopyScanFields((const Scan *) from, (Scan *) newnode);
     477             : 
     478             :     /*
     479             :      * copy remainder of node
     480             :      */
     481         558 :     COPY_SCALAR_FIELD(indexid);
     482         558 :     COPY_NODE_FIELD(indexqual);
     483         558 :     COPY_NODE_FIELD(indexqualorig);
     484         558 :     COPY_NODE_FIELD(indexorderby);
     485         558 :     COPY_NODE_FIELD(indexorderbyorig);
     486         558 :     COPY_NODE_FIELD(indexorderbyops);
     487         558 :     COPY_SCALAR_FIELD(indexorderdir);
     488             : 
     489         558 :     return newnode;
     490             : }
     491             : 
     492             : /*
     493             :  * _copyIndexOnlyScan
     494             :  */
     495             : static IndexOnlyScan *
     496          31 : _copyIndexOnlyScan(const IndexOnlyScan *from)
     497             : {
     498          31 :     IndexOnlyScan *newnode = makeNode(IndexOnlyScan);
     499             : 
     500             :     /*
     501             :      * copy node superclass fields
     502             :      */
     503          31 :     CopyScanFields((const Scan *) from, (Scan *) newnode);
     504             : 
     505             :     /*
     506             :      * copy remainder of node
     507             :      */
     508          31 :     COPY_SCALAR_FIELD(indexid);
     509          31 :     COPY_NODE_FIELD(indexqual);
     510          31 :     COPY_NODE_FIELD(indexorderby);
     511          31 :     COPY_NODE_FIELD(indextlist);
     512          31 :     COPY_SCALAR_FIELD(indexorderdir);
     513             : 
     514          31 :     return newnode;
     515             : }
     516             : 
     517             : /*
     518             :  * _copyBitmapIndexScan
     519             :  */
     520             : static BitmapIndexScan *
     521          20 : _copyBitmapIndexScan(const BitmapIndexScan *from)
     522             : {
     523          20 :     BitmapIndexScan *newnode = makeNode(BitmapIndexScan);
     524             : 
     525             :     /*
     526             :      * copy node superclass fields
     527             :      */
     528          20 :     CopyScanFields((const Scan *) from, (Scan *) newnode);
     529             : 
     530             :     /*
     531             :      * copy remainder of node
     532             :      */
     533          20 :     COPY_SCALAR_FIELD(indexid);
     534          20 :     COPY_SCALAR_FIELD(isshared);
     535          20 :     COPY_NODE_FIELD(indexqual);
     536          20 :     COPY_NODE_FIELD(indexqualorig);
     537             : 
     538          20 :     return newnode;
     539             : }
     540             : 
     541             : /*
     542             :  * _copyBitmapHeapScan
     543             :  */
     544             : static BitmapHeapScan *
     545          20 : _copyBitmapHeapScan(const BitmapHeapScan *from)
     546             : {
     547          20 :     BitmapHeapScan *newnode = makeNode(BitmapHeapScan);
     548             : 
     549             :     /*
     550             :      * copy node superclass fields
     551             :      */
     552          20 :     CopyScanFields((const Scan *) from, (Scan *) newnode);
     553             : 
     554             :     /*
     555             :      * copy remainder of node
     556             :      */
     557          20 :     COPY_NODE_FIELD(bitmapqualorig);
     558             : 
     559          20 :     return newnode;
     560             : }
     561             : 
     562             : /*
     563             :  * _copyTidScan
     564             :  */
     565             : static TidScan *
     566          13 : _copyTidScan(const TidScan *from)
     567             : {
     568          13 :     TidScan    *newnode = makeNode(TidScan);
     569             : 
     570             :     /*
     571             :      * copy node superclass fields
     572             :      */
     573          13 :     CopyScanFields((const Scan *) from, (Scan *) newnode);
     574             : 
     575             :     /*
     576             :      * copy remainder of node
     577             :      */
     578          13 :     COPY_NODE_FIELD(tidquals);
     579             : 
     580          13 :     return newnode;
     581             : }
     582             : 
     583             : /*
     584             :  * _copySubqueryScan
     585             :  */
     586             : static SubqueryScan *
     587           3 : _copySubqueryScan(const SubqueryScan *from)
     588             : {
     589           3 :     SubqueryScan *newnode = makeNode(SubqueryScan);
     590             : 
     591             :     /*
     592             :      * copy node superclass fields
     593             :      */
     594           3 :     CopyScanFields((const Scan *) from, (Scan *) newnode);
     595             : 
     596             :     /*
     597             :      * copy remainder of node
     598             :      */
     599           3 :     COPY_NODE_FIELD(subplan);
     600             : 
     601           3 :     return newnode;
     602             : }
     603             : 
     604             : /*
     605             :  * _copyFunctionScan
     606             :  */
     607             : static FunctionScan *
     608          47 : _copyFunctionScan(const FunctionScan *from)
     609             : {
     610          47 :     FunctionScan *newnode = makeNode(FunctionScan);
     611             : 
     612             :     /*
     613             :      * copy node superclass fields
     614             :      */
     615          47 :     CopyScanFields((const Scan *) from, (Scan *) newnode);
     616             : 
     617             :     /*
     618             :      * copy remainder of node
     619             :      */
     620          47 :     COPY_NODE_FIELD(functions);
     621          47 :     COPY_SCALAR_FIELD(funcordinality);
     622             : 
     623          47 :     return newnode;
     624             : }
     625             : 
     626             : /*
     627             :  * _copyTableFuncScan
     628             :  */
     629             : static TableFuncScan *
     630           1 : _copyTableFuncScan(const TableFuncScan *from)
     631             : {
     632           1 :     TableFuncScan *newnode = makeNode(TableFuncScan);
     633             : 
     634             :     /*
     635             :      * copy node superclass fields
     636             :      */
     637           1 :     CopyScanFields((const Scan *) from, (Scan *) newnode);
     638             : 
     639             :     /*
     640             :      * copy remainder of node
     641             :      */
     642           1 :     COPY_NODE_FIELD(tablefunc);
     643             : 
     644           1 :     return newnode;
     645             : }
     646             : 
     647             : /*
     648             :  * _copyValuesScan
     649             :  */
     650             : static ValuesScan *
     651          14 : _copyValuesScan(const ValuesScan *from)
     652             : {
     653          14 :     ValuesScan *newnode = makeNode(ValuesScan);
     654             : 
     655             :     /*
     656             :      * copy node superclass fields
     657             :      */
     658          14 :     CopyScanFields((const Scan *) from, (Scan *) newnode);
     659             : 
     660             :     /*
     661             :      * copy remainder of node
     662             :      */
     663          14 :     COPY_NODE_FIELD(values_lists);
     664             : 
     665          14 :     return newnode;
     666             : }
     667             : 
     668             : /*
     669             :  * _copyCteScan
     670             :  */
     671             : static CteScan *
     672           9 : _copyCteScan(const CteScan *from)
     673             : {
     674           9 :     CteScan    *newnode = makeNode(CteScan);
     675             : 
     676             :     /*
     677             :      * copy node superclass fields
     678             :      */
     679           9 :     CopyScanFields((const Scan *) from, (Scan *) newnode);
     680             : 
     681             :     /*
     682             :      * copy remainder of node
     683             :      */
     684           9 :     COPY_SCALAR_FIELD(ctePlanId);
     685           9 :     COPY_SCALAR_FIELD(cteParam);
     686             : 
     687           9 :     return newnode;
     688             : }
     689             : 
     690             : /*
     691             :  * _copyNamedTuplestoreScan
     692             :  */
     693             : static NamedTuplestoreScan *
     694          39 : _copyNamedTuplestoreScan(const NamedTuplestoreScan *from)
     695             : {
     696          39 :     NamedTuplestoreScan *newnode = makeNode(NamedTuplestoreScan);
     697             : 
     698             :     /*
     699             :      * copy node superclass fields
     700             :      */
     701          39 :     CopyScanFields((const Scan *) from, (Scan *) newnode);
     702             : 
     703             :     /*
     704             :      * copy remainder of node
     705             :      */
     706          39 :     COPY_STRING_FIELD(enrname);
     707             : 
     708          39 :     return newnode;
     709             : }
     710             : 
     711             : /*
     712             :  * _copyWorkTableScan
     713             :  */
     714             : static WorkTableScan *
     715           0 : _copyWorkTableScan(const WorkTableScan *from)
     716             : {
     717           0 :     WorkTableScan *newnode = makeNode(WorkTableScan);
     718             : 
     719             :     /*
     720             :      * copy node superclass fields
     721             :      */
     722           0 :     CopyScanFields((const Scan *) from, (Scan *) newnode);
     723             : 
     724             :     /*
     725             :      * copy remainder of node
     726             :      */
     727           0 :     COPY_SCALAR_FIELD(wtParam);
     728             : 
     729           0 :     return newnode;
     730             : }
     731             : 
     732             : /*
     733             :  * _copyForeignScan
     734             :  */
     735             : static ForeignScan *
     736           0 : _copyForeignScan(const ForeignScan *from)
     737             : {
     738           0 :     ForeignScan *newnode = makeNode(ForeignScan);
     739             : 
     740             :     /*
     741             :      * copy node superclass fields
     742             :      */
     743           0 :     CopyScanFields((const Scan *) from, (Scan *) newnode);
     744             : 
     745             :     /*
     746             :      * copy remainder of node
     747             :      */
     748           0 :     COPY_SCALAR_FIELD(operation);
     749           0 :     COPY_SCALAR_FIELD(fs_server);
     750           0 :     COPY_NODE_FIELD(fdw_exprs);
     751           0 :     COPY_NODE_FIELD(fdw_private);
     752           0 :     COPY_NODE_FIELD(fdw_scan_tlist);
     753           0 :     COPY_NODE_FIELD(fdw_recheck_quals);
     754           0 :     COPY_BITMAPSET_FIELD(fs_relids);
     755           0 :     COPY_SCALAR_FIELD(fsSystemCol);
     756             : 
     757           0 :     return newnode;
     758             : }
     759             : 
     760             : /*
     761             :  * _copyCustomScan
     762             :  */
     763             : static CustomScan *
     764           0 : _copyCustomScan(const CustomScan *from)
     765             : {
     766           0 :     CustomScan *newnode = makeNode(CustomScan);
     767             : 
     768             :     /*
     769             :      * copy node superclass fields
     770             :      */
     771           0 :     CopyScanFields((const Scan *) from, (Scan *) newnode);
     772             : 
     773             :     /*
     774             :      * copy remainder of node
     775             :      */
     776           0 :     COPY_SCALAR_FIELD(flags);
     777           0 :     COPY_NODE_FIELD(custom_plans);
     778           0 :     COPY_NODE_FIELD(custom_exprs);
     779           0 :     COPY_NODE_FIELD(custom_private);
     780           0 :     COPY_NODE_FIELD(custom_scan_tlist);
     781           0 :     COPY_BITMAPSET_FIELD(custom_relids);
     782             : 
     783             :     /*
     784             :      * NOTE: The method field of CustomScan is required to be a pointer to a
     785             :      * static table of callback functions.  So we don't copy the table itself,
     786             :      * just reference the original one.
     787             :      */
     788           0 :     COPY_SCALAR_FIELD(methods);
     789             : 
     790           0 :     return newnode;
     791             : }
     792             : 
     793             : /*
     794             :  * CopyJoinFields
     795             :  *
     796             :  *      This function copies the fields of the Join node.  It is used by
     797             :  *      all the copy functions for classes which inherit from Join.
     798             :  */
     799             : static void
     800          67 : CopyJoinFields(const Join *from, Join *newnode)
     801             : {
     802          67 :     CopyPlanFields((const Plan *) from, (Plan *) newnode);
     803             : 
     804          67 :     COPY_SCALAR_FIELD(jointype);
     805          67 :     COPY_SCALAR_FIELD(inner_unique);
     806          67 :     COPY_NODE_FIELD(joinqual);
     807          67 : }
     808             : 
     809             : 
     810             : /*
     811             :  * _copyJoin
     812             :  */
     813             : static Join *
     814           0 : _copyJoin(const Join *from)
     815             : {
     816           0 :     Join       *newnode = makeNode(Join);
     817             : 
     818             :     /*
     819             :      * copy node superclass fields
     820             :      */
     821           0 :     CopyJoinFields(from, newnode);
     822             : 
     823           0 :     return newnode;
     824             : }
     825             : 
     826             : 
     827             : /*
     828             :  * _copyNestLoop
     829             :  */
     830             : static NestLoop *
     831          25 : _copyNestLoop(const NestLoop *from)
     832             : {
     833          25 :     NestLoop   *newnode = makeNode(NestLoop);
     834             : 
     835             :     /*
     836             :      * copy node superclass fields
     837             :      */
     838          25 :     CopyJoinFields((const Join *) from, (Join *) newnode);
     839             : 
     840             :     /*
     841             :      * copy remainder of node
     842             :      */
     843          25 :     COPY_NODE_FIELD(nestParams);
     844             : 
     845          25 :     return newnode;
     846             : }
     847             : 
     848             : 
     849             : /*
     850             :  * _copyMergeJoin
     851             :  */
     852             : static MergeJoin *
     853           7 : _copyMergeJoin(const MergeJoin *from)
     854             : {
     855           7 :     MergeJoin  *newnode = makeNode(MergeJoin);
     856             :     int         numCols;
     857             : 
     858             :     /*
     859             :      * copy node superclass fields
     860             :      */
     861           7 :     CopyJoinFields((const Join *) from, (Join *) newnode);
     862             : 
     863             :     /*
     864             :      * copy remainder of node
     865             :      */
     866           7 :     COPY_SCALAR_FIELD(skip_mark_restore);
     867           7 :     COPY_NODE_FIELD(mergeclauses);
     868           7 :     numCols = list_length(from->mergeclauses);
     869           7 :     if (numCols > 0)
     870             :     {
     871           7 :         COPY_POINTER_FIELD(mergeFamilies, numCols * sizeof(Oid));
     872           7 :         COPY_POINTER_FIELD(mergeCollations, numCols * sizeof(Oid));
     873           7 :         COPY_POINTER_FIELD(mergeStrategies, numCols * sizeof(int));
     874           7 :         COPY_POINTER_FIELD(mergeNullsFirst, numCols * sizeof(bool));
     875             :     }
     876             : 
     877           7 :     return newnode;
     878             : }
     879             : 
     880             : /*
     881             :  * _copyHashJoin
     882             :  */
     883             : static HashJoin *
     884          35 : _copyHashJoin(const HashJoin *from)
     885             : {
     886          35 :     HashJoin   *newnode = makeNode(HashJoin);
     887             : 
     888             :     /*
     889             :      * copy node superclass fields
     890             :      */
     891          35 :     CopyJoinFields((const Join *) from, (Join *) newnode);
     892             : 
     893             :     /*
     894             :      * copy remainder of node
     895             :      */
     896          35 :     COPY_NODE_FIELD(hashclauses);
     897             : 
     898          35 :     return newnode;
     899             : }
     900             : 
     901             : 
     902             : /*
     903             :  * _copyMaterial
     904             :  */
     905             : static Material *
     906          12 : _copyMaterial(const Material *from)
     907             : {
     908          12 :     Material   *newnode = makeNode(Material);
     909             : 
     910             :     /*
     911             :      * copy node superclass fields
     912             :      */
     913          12 :     CopyPlanFields((const Plan *) from, (Plan *) newnode);
     914             : 
     915          12 :     return newnode;
     916             : }
     917             : 
     918             : 
     919             : /*
     920             :  * _copySort
     921             :  */
     922             : static Sort *
     923          24 : _copySort(const Sort *from)
     924             : {
     925          24 :     Sort       *newnode = makeNode(Sort);
     926             : 
     927             :     /*
     928             :      * copy node superclass fields
     929             :      */
     930          24 :     CopyPlanFields((const Plan *) from, (Plan *) newnode);
     931             : 
     932          24 :     COPY_SCALAR_FIELD(numCols);
     933          24 :     COPY_POINTER_FIELD(sortColIdx, from->numCols * sizeof(AttrNumber));
     934          24 :     COPY_POINTER_FIELD(sortOperators, from->numCols * sizeof(Oid));
     935          24 :     COPY_POINTER_FIELD(collations, from->numCols * sizeof(Oid));
     936          24 :     COPY_POINTER_FIELD(nullsFirst, from->numCols * sizeof(bool));
     937             : 
     938          24 :     return newnode;
     939             : }
     940             : 
     941             : 
     942             : /*
     943             :  * _copyGroup
     944             :  */
     945             : static Group *
     946           0 : _copyGroup(const Group *from)
     947             : {
     948           0 :     Group      *newnode = makeNode(Group);
     949             : 
     950           0 :     CopyPlanFields((const Plan *) from, (Plan *) newnode);
     951             : 
     952           0 :     COPY_SCALAR_FIELD(numCols);
     953           0 :     COPY_POINTER_FIELD(grpColIdx, from->numCols * sizeof(AttrNumber));
     954           0 :     COPY_POINTER_FIELD(grpOperators, from->numCols * sizeof(Oid));
     955             : 
     956           0 :     return newnode;
     957             : }
     958             : 
     959             : /*
     960             :  * _copyAgg
     961             :  */
     962             : static Agg *
     963          71 : _copyAgg(const Agg *from)
     964             : {
     965          71 :     Agg        *newnode = makeNode(Agg);
     966             : 
     967          71 :     CopyPlanFields((const Plan *) from, (Plan *) newnode);
     968             : 
     969          71 :     COPY_SCALAR_FIELD(aggstrategy);
     970          71 :     COPY_SCALAR_FIELD(aggsplit);
     971          71 :     COPY_SCALAR_FIELD(numCols);
     972          71 :     if (from->numCols > 0)
     973             :     {
     974          14 :         COPY_POINTER_FIELD(grpColIdx, from->numCols * sizeof(AttrNumber));
     975          14 :         COPY_POINTER_FIELD(grpOperators, from->numCols * sizeof(Oid));
     976             :     }
     977          71 :     COPY_SCALAR_FIELD(numGroups);
     978          71 :     COPY_BITMAPSET_FIELD(aggParams);
     979          71 :     COPY_NODE_FIELD(groupingSets);
     980          71 :     COPY_NODE_FIELD(chain);
     981             : 
     982          71 :     return newnode;
     983             : }
     984             : 
     985             : /*
     986             :  * _copyWindowAgg
     987             :  */
     988             : static WindowAgg *
     989           0 : _copyWindowAgg(const WindowAgg *from)
     990             : {
     991           0 :     WindowAgg  *newnode = makeNode(WindowAgg);
     992             : 
     993           0 :     CopyPlanFields((const Plan *) from, (Plan *) newnode);
     994             : 
     995           0 :     COPY_SCALAR_FIELD(winref);
     996           0 :     COPY_SCALAR_FIELD(partNumCols);
     997           0 :     if (from->partNumCols > 0)
     998             :     {
     999           0 :         COPY_POINTER_FIELD(partColIdx, from->partNumCols * sizeof(AttrNumber));
    1000           0 :         COPY_POINTER_FIELD(partOperators, from->partNumCols * sizeof(Oid));
    1001             :     }
    1002           0 :     COPY_SCALAR_FIELD(ordNumCols);
    1003           0 :     if (from->ordNumCols > 0)
    1004             :     {
    1005           0 :         COPY_POINTER_FIELD(ordColIdx, from->ordNumCols * sizeof(AttrNumber));
    1006           0 :         COPY_POINTER_FIELD(ordOperators, from->ordNumCols * sizeof(Oid));
    1007             :     }
    1008           0 :     COPY_SCALAR_FIELD(frameOptions);
    1009           0 :     COPY_NODE_FIELD(startOffset);
    1010           0 :     COPY_NODE_FIELD(endOffset);
    1011             : 
    1012           0 :     return newnode;
    1013             : }
    1014             : 
    1015             : /*
    1016             :  * _copyUnique
    1017             :  */
    1018             : static Unique *
    1019           0 : _copyUnique(const Unique *from)
    1020             : {
    1021           0 :     Unique     *newnode = makeNode(Unique);
    1022             : 
    1023             :     /*
    1024             :      * copy node superclass fields
    1025             :      */
    1026           0 :     CopyPlanFields((const Plan *) from, (Plan *) newnode);
    1027             : 
    1028             :     /*
    1029             :      * copy remainder of node
    1030             :      */
    1031           0 :     COPY_SCALAR_FIELD(numCols);
    1032           0 :     COPY_POINTER_FIELD(uniqColIdx, from->numCols * sizeof(AttrNumber));
    1033           0 :     COPY_POINTER_FIELD(uniqOperators, from->numCols * sizeof(Oid));
    1034             : 
    1035           0 :     return newnode;
    1036             : }
    1037             : 
    1038             : /*
    1039             :  * _copyHash
    1040             :  */
    1041             : static Hash *
    1042          35 : _copyHash(const Hash *from)
    1043             : {
    1044          35 :     Hash       *newnode = makeNode(Hash);
    1045             : 
    1046             :     /*
    1047             :      * copy node superclass fields
    1048             :      */
    1049          35 :     CopyPlanFields((const Plan *) from, (Plan *) newnode);
    1050             : 
    1051             :     /*
    1052             :      * copy remainder of node
    1053             :      */
    1054          35 :     COPY_SCALAR_FIELD(skewTable);
    1055          35 :     COPY_SCALAR_FIELD(skewColumn);
    1056          35 :     COPY_SCALAR_FIELD(skewInherit);
    1057             : 
    1058          35 :     return newnode;
    1059             : }
    1060             : 
    1061             : /*
    1062             :  * _copySetOp
    1063             :  */
    1064             : static SetOp *
    1065           0 : _copySetOp(const SetOp *from)
    1066             : {
    1067           0 :     SetOp      *newnode = makeNode(SetOp);
    1068             : 
    1069             :     /*
    1070             :      * copy node superclass fields
    1071             :      */
    1072           0 :     CopyPlanFields((const Plan *) from, (Plan *) newnode);
    1073             : 
    1074             :     /*
    1075             :      * copy remainder of node
    1076             :      */
    1077           0 :     COPY_SCALAR_FIELD(cmd);
    1078           0 :     COPY_SCALAR_FIELD(strategy);
    1079           0 :     COPY_SCALAR_FIELD(numCols);
    1080           0 :     COPY_POINTER_FIELD(dupColIdx, from->numCols * sizeof(AttrNumber));
    1081           0 :     COPY_POINTER_FIELD(dupOperators, from->numCols * sizeof(Oid));
    1082           0 :     COPY_SCALAR_FIELD(flagColIdx);
    1083           0 :     COPY_SCALAR_FIELD(firstFlag);
    1084           0 :     COPY_SCALAR_FIELD(numGroups);
    1085             : 
    1086           0 :     return newnode;
    1087             : }
    1088             : 
    1089             : /*
    1090             :  * _copyLockRows
    1091             :  */
    1092             : static LockRows *
    1093         313 : _copyLockRows(const LockRows *from)
    1094             : {
    1095         313 :     LockRows   *newnode = makeNode(LockRows);
    1096             : 
    1097             :     /*
    1098             :      * copy node superclass fields
    1099             :      */
    1100         313 :     CopyPlanFields((const Plan *) from, (Plan *) newnode);
    1101             : 
    1102             :     /*
    1103             :      * copy remainder of node
    1104             :      */
    1105         313 :     COPY_NODE_FIELD(rowMarks);
    1106         313 :     COPY_SCALAR_FIELD(epqParam);
    1107             : 
    1108         313 :     return newnode;
    1109             : }
    1110             : 
    1111             : /*
    1112             :  * _copyLimit
    1113             :  */
    1114             : static Limit *
    1115          11 : _copyLimit(const Limit *from)
    1116             : {
    1117          11 :     Limit      *newnode = makeNode(Limit);
    1118             : 
    1119             :     /*
    1120             :      * copy node superclass fields
    1121             :      */
    1122          11 :     CopyPlanFields((const Plan *) from, (Plan *) newnode);
    1123             : 
    1124             :     /*
    1125             :      * copy remainder of node
    1126             :      */
    1127          11 :     COPY_NODE_FIELD(limitOffset);
    1128          11 :     COPY_NODE_FIELD(limitCount);
    1129             : 
    1130          11 :     return newnode;
    1131             : }
    1132             : 
    1133             : /*
    1134             :  * _copyNestLoopParam
    1135             :  */
    1136             : static NestLoopParam *
    1137           8 : _copyNestLoopParam(const NestLoopParam *from)
    1138             : {
    1139           8 :     NestLoopParam *newnode = makeNode(NestLoopParam);
    1140             : 
    1141           8 :     COPY_SCALAR_FIELD(paramno);
    1142           8 :     COPY_NODE_FIELD(paramval);
    1143             : 
    1144           8 :     return newnode;
    1145             : }
    1146             : 
    1147             : /*
    1148             :  * _copyPlanRowMark
    1149             :  */
    1150             : static PlanRowMark *
    1151         726 : _copyPlanRowMark(const PlanRowMark *from)
    1152             : {
    1153         726 :     PlanRowMark *newnode = makeNode(PlanRowMark);
    1154             : 
    1155         726 :     COPY_SCALAR_FIELD(rti);
    1156         726 :     COPY_SCALAR_FIELD(prti);
    1157         726 :     COPY_SCALAR_FIELD(rowmarkId);
    1158         726 :     COPY_SCALAR_FIELD(markType);
    1159         726 :     COPY_SCALAR_FIELD(allMarkTypes);
    1160         726 :     COPY_SCALAR_FIELD(strength);
    1161         726 :     COPY_SCALAR_FIELD(waitPolicy);
    1162         726 :     COPY_SCALAR_FIELD(isParent);
    1163             : 
    1164         726 :     return newnode;
    1165             : }
    1166             : 
    1167             : /*
    1168             :  * _copyPlanInvalItem
    1169             :  */
    1170             : static PlanInvalItem *
    1171          73 : _copyPlanInvalItem(const PlanInvalItem *from)
    1172             : {
    1173          73 :     PlanInvalItem *newnode = makeNode(PlanInvalItem);
    1174             : 
    1175          73 :     COPY_SCALAR_FIELD(cacheId);
    1176          73 :     COPY_SCALAR_FIELD(hashValue);
    1177             : 
    1178          73 :     return newnode;
    1179             : }
    1180             : 
    1181             : /* ****************************************************************
    1182             :  *                     primnodes.h copy functions
    1183             :  * ****************************************************************
    1184             :  */
    1185             : 
    1186             : /*
    1187             :  * _copyAlias
    1188             :  */
    1189             : static Alias *
    1190       46230 : _copyAlias(const Alias *from)
    1191             : {
    1192       46230 :     Alias      *newnode = makeNode(Alias);
    1193             : 
    1194       46230 :     COPY_STRING_FIELD(aliasname);
    1195       46230 :     COPY_NODE_FIELD(colnames);
    1196             : 
    1197       46230 :     return newnode;
    1198             : }
    1199             : 
    1200             : /*
    1201             :  * _copyRangeVar
    1202             :  */
    1203             : static RangeVar *
    1204        6697 : _copyRangeVar(const RangeVar *from)
    1205             : {
    1206        6697 :     RangeVar   *newnode = makeNode(RangeVar);
    1207             : 
    1208        6697 :     COPY_STRING_FIELD(catalogname);
    1209        6697 :     COPY_STRING_FIELD(schemaname);
    1210        6697 :     COPY_STRING_FIELD(relname);
    1211        6697 :     COPY_SCALAR_FIELD(inh);
    1212        6697 :     COPY_SCALAR_FIELD(relpersistence);
    1213        6697 :     COPY_NODE_FIELD(alias);
    1214        6697 :     COPY_LOCATION_FIELD(location);
    1215             : 
    1216        6697 :     return newnode;
    1217             : }
    1218             : 
    1219             : /*
    1220             :  * _copyTableFunc
    1221             :  */
    1222             : static TableFunc *
    1223          13 : _copyTableFunc(const TableFunc *from)
    1224             : {
    1225          13 :     TableFunc  *newnode = makeNode(TableFunc);
    1226             : 
    1227          13 :     COPY_NODE_FIELD(ns_uris);
    1228          13 :     COPY_NODE_FIELD(ns_names);
    1229          13 :     COPY_NODE_FIELD(docexpr);
    1230          13 :     COPY_NODE_FIELD(rowexpr);
    1231          13 :     COPY_NODE_FIELD(colnames);
    1232          13 :     COPY_NODE_FIELD(coltypes);
    1233          13 :     COPY_NODE_FIELD(coltypmods);
    1234          13 :     COPY_NODE_FIELD(colcollations);
    1235          13 :     COPY_NODE_FIELD(colexprs);
    1236          13 :     COPY_NODE_FIELD(coldefexprs);
    1237          13 :     COPY_BITMAPSET_FIELD(notnulls);
    1238          13 :     COPY_SCALAR_FIELD(ordinalitycol);
    1239          13 :     COPY_LOCATION_FIELD(location);
    1240             : 
    1241          13 :     return newnode;
    1242             : }
    1243             : 
    1244             : /*
    1245             :  * _copyIntoClause
    1246             :  */
    1247             : static IntoClause *
    1248          19 : _copyIntoClause(const IntoClause *from)
    1249             : {
    1250          19 :     IntoClause *newnode = makeNode(IntoClause);
    1251             : 
    1252          19 :     COPY_NODE_FIELD(rel);
    1253          19 :     COPY_NODE_FIELD(colNames);
    1254          19 :     COPY_NODE_FIELD(options);
    1255          19 :     COPY_SCALAR_FIELD(onCommit);
    1256          19 :     COPY_STRING_FIELD(tableSpaceName);
    1257          19 :     COPY_NODE_FIELD(viewQuery);
    1258          19 :     COPY_SCALAR_FIELD(skipData);
    1259             : 
    1260          19 :     return newnode;
    1261             : }
    1262             : 
    1263             : /*
    1264             :  * We don't need a _copyExpr because Expr is an abstract supertype which
    1265             :  * should never actually get instantiated.  Also, since it has no common
    1266             :  * fields except NodeTag, there's no need for a helper routine to factor
    1267             :  * out copying the common fields...
    1268             :  */
    1269             : 
    1270             : /*
    1271             :  * _copyVar
    1272             :  */
    1273             : static Var *
    1274      237970 : _copyVar(const Var *from)
    1275             : {
    1276      237970 :     Var        *newnode = makeNode(Var);
    1277             : 
    1278      237970 :     COPY_SCALAR_FIELD(varno);
    1279      237970 :     COPY_SCALAR_FIELD(varattno);
    1280      237970 :     COPY_SCALAR_FIELD(vartype);
    1281      237970 :     COPY_SCALAR_FIELD(vartypmod);
    1282      237970 :     COPY_SCALAR_FIELD(varcollid);
    1283      237970 :     COPY_SCALAR_FIELD(varlevelsup);
    1284      237970 :     COPY_SCALAR_FIELD(varnoold);
    1285      237970 :     COPY_SCALAR_FIELD(varoattno);
    1286      237970 :     COPY_LOCATION_FIELD(location);
    1287             : 
    1288      237970 :     return newnode;
    1289             : }
    1290             : 
    1291             : /*
    1292             :  * _copyConst
    1293             :  */
    1294             : static Const *
    1295       43022 : _copyConst(const Const *from)
    1296             : {
    1297       43022 :     Const      *newnode = makeNode(Const);
    1298             : 
    1299       43022 :     COPY_SCALAR_FIELD(consttype);
    1300       43022 :     COPY_SCALAR_FIELD(consttypmod);
    1301       43022 :     COPY_SCALAR_FIELD(constcollid);
    1302       43022 :     COPY_SCALAR_FIELD(constlen);
    1303             : 
    1304       43022 :     if (from->constbyval || from->constisnull)
    1305             :     {
    1306             :         /*
    1307             :          * passed by value so just copy the datum. Also, don't try to copy
    1308             :          * struct when value is null!
    1309             :          */
    1310       29769 :         newnode->constvalue = from->constvalue;
    1311             :     }
    1312             :     else
    1313             :     {
    1314             :         /*
    1315             :          * passed by reference.  We need a palloc'd copy.
    1316             :          */
    1317       26506 :         newnode->constvalue = datumCopy(from->constvalue,
    1318       13253 :                                         from->constbyval,
    1319             :                                         from->constlen);
    1320             :     }
    1321             : 
    1322       43022 :     COPY_SCALAR_FIELD(constisnull);
    1323       43022 :     COPY_SCALAR_FIELD(constbyval);
    1324       43022 :     COPY_LOCATION_FIELD(location);
    1325             : 
    1326       43022 :     return newnode;
    1327             : }
    1328             : 
    1329             : /*
    1330             :  * _copyParam
    1331             :  */
    1332             : static Param *
    1333       18017 : _copyParam(const Param *from)
    1334             : {
    1335       18017 :     Param      *newnode = makeNode(Param);
    1336             : 
    1337       18017 :     COPY_SCALAR_FIELD(paramkind);
    1338       18017 :     COPY_SCALAR_FIELD(paramid);
    1339       18017 :     COPY_SCALAR_FIELD(paramtype);
    1340       18017 :     COPY_SCALAR_FIELD(paramtypmod);
    1341       18017 :     COPY_SCALAR_FIELD(paramcollid);
    1342       18017 :     COPY_LOCATION_FIELD(location);
    1343             : 
    1344       18017 :     return newnode;
    1345             : }
    1346             : 
    1347             : /*
    1348             :  * _copyAggref
    1349             :  */
    1350             : static Aggref *
    1351        3811 : _copyAggref(const Aggref *from)
    1352             : {
    1353        3811 :     Aggref     *newnode = makeNode(Aggref);
    1354             : 
    1355        3811 :     COPY_SCALAR_FIELD(aggfnoid);
    1356        3811 :     COPY_SCALAR_FIELD(aggtype);
    1357        3811 :     COPY_SCALAR_FIELD(aggcollid);
    1358        3811 :     COPY_SCALAR_FIELD(inputcollid);
    1359        3811 :     COPY_SCALAR_FIELD(aggtranstype);
    1360        3811 :     COPY_NODE_FIELD(aggargtypes);
    1361        3811 :     COPY_NODE_FIELD(aggdirectargs);
    1362        3811 :     COPY_NODE_FIELD(args);
    1363        3811 :     COPY_NODE_FIELD(aggorder);
    1364        3811 :     COPY_NODE_FIELD(aggdistinct);
    1365        3811 :     COPY_NODE_FIELD(aggfilter);
    1366        3811 :     COPY_SCALAR_FIELD(aggstar);
    1367        3811 :     COPY_SCALAR_FIELD(aggvariadic);
    1368        3811 :     COPY_SCALAR_FIELD(aggkind);
    1369        3811 :     COPY_SCALAR_FIELD(agglevelsup);
    1370        3811 :     COPY_SCALAR_FIELD(aggsplit);
    1371        3811 :     COPY_LOCATION_FIELD(location);
    1372             : 
    1373        3811 :     return newnode;
    1374             : }
    1375             : 
    1376             : /*
    1377             :  * _copyGroupingFunc
    1378             :  */
    1379             : static GroupingFunc *
    1380          39 : _copyGroupingFunc(const GroupingFunc *from)
    1381             : {
    1382          39 :     GroupingFunc *newnode = makeNode(GroupingFunc);
    1383             : 
    1384          39 :     COPY_NODE_FIELD(args);
    1385          39 :     COPY_NODE_FIELD(refs);
    1386          39 :     COPY_NODE_FIELD(cols);
    1387          39 :     COPY_SCALAR_FIELD(agglevelsup);
    1388          39 :     COPY_LOCATION_FIELD(location);
    1389             : 
    1390          39 :     return newnode;
    1391             : }
    1392             : 
    1393             : /*
    1394             :  * _copyWindowFunc
    1395             :  */
    1396             : static WindowFunc *
    1397          43 : _copyWindowFunc(const WindowFunc *from)
    1398             : {
    1399          43 :     WindowFunc *newnode = makeNode(WindowFunc);
    1400             : 
    1401          43 :     COPY_SCALAR_FIELD(winfnoid);
    1402          43 :     COPY_SCALAR_FIELD(wintype);
    1403          43 :     COPY_SCALAR_FIELD(wincollid);
    1404          43 :     COPY_SCALAR_FIELD(inputcollid);
    1405          43 :     COPY_NODE_FIELD(args);
    1406          43 :     COPY_NODE_FIELD(aggfilter);
    1407          43 :     COPY_SCALAR_FIELD(winref);
    1408          43 :     COPY_SCALAR_FIELD(winstar);
    1409          43 :     COPY_SCALAR_FIELD(winagg);
    1410          43 :     COPY_LOCATION_FIELD(location);
    1411             : 
    1412          43 :     return newnode;
    1413             : }
    1414             : 
    1415             : /*
    1416             :  * _copyArrayRef
    1417             :  */
    1418             : static ArrayRef *
    1419         335 : _copyArrayRef(const ArrayRef *from)
    1420             : {
    1421         335 :     ArrayRef   *newnode = makeNode(ArrayRef);
    1422             : 
    1423         335 :     COPY_SCALAR_FIELD(refarraytype);
    1424         335 :     COPY_SCALAR_FIELD(refelemtype);
    1425         335 :     COPY_SCALAR_FIELD(reftypmod);
    1426         335 :     COPY_SCALAR_FIELD(refcollid);
    1427         335 :     COPY_NODE_FIELD(refupperindexpr);
    1428         335 :     COPY_NODE_FIELD(reflowerindexpr);
    1429         335 :     COPY_NODE_FIELD(refexpr);
    1430         335 :     COPY_NODE_FIELD(refassgnexpr);
    1431             : 
    1432         335 :     return newnode;
    1433             : }
    1434             : 
    1435             : /*
    1436             :  * _copyFuncExpr
    1437             :  */
    1438             : static FuncExpr *
    1439       16686 : _copyFuncExpr(const FuncExpr *from)
    1440             : {
    1441       16686 :     FuncExpr   *newnode = makeNode(FuncExpr);
    1442             : 
    1443       16686 :     COPY_SCALAR_FIELD(funcid);
    1444       16686 :     COPY_SCALAR_FIELD(funcresulttype);
    1445       16686 :     COPY_SCALAR_FIELD(funcretset);
    1446       16686 :     COPY_SCALAR_FIELD(funcvariadic);
    1447       16686 :     COPY_SCALAR_FIELD(funcformat);
    1448       16686 :     COPY_SCALAR_FIELD(funccollid);
    1449       16686 :     COPY_SCALAR_FIELD(inputcollid);
    1450       16686 :     COPY_NODE_FIELD(args);
    1451       16686 :     COPY_LOCATION_FIELD(location);
    1452             : 
    1453       16686 :     return newnode;
    1454             : }
    1455             : 
    1456             : /*
    1457             :  * _copyNamedArgExpr *
    1458             :  */
    1459             : static NamedArgExpr *
    1460          27 : _copyNamedArgExpr(const NamedArgExpr *from)
    1461             : {
    1462          27 :     NamedArgExpr *newnode = makeNode(NamedArgExpr);
    1463             : 
    1464          27 :     COPY_NODE_FIELD(arg);
    1465          27 :     COPY_STRING_FIELD(name);
    1466          27 :     COPY_SCALAR_FIELD(argnumber);
    1467          27 :     COPY_LOCATION_FIELD(location);
    1468             : 
    1469          27 :     return newnode;
    1470             : }
    1471             : 
    1472             : /*
    1473             :  * _copyOpExpr
    1474             :  */
    1475             : static OpExpr *
    1476       25718 : _copyOpExpr(const OpExpr *from)
    1477             : {
    1478       25718 :     OpExpr     *newnode = makeNode(OpExpr);
    1479             : 
    1480       25718 :     COPY_SCALAR_FIELD(opno);
    1481       25718 :     COPY_SCALAR_FIELD(opfuncid);
    1482       25718 :     COPY_SCALAR_FIELD(opresulttype);
    1483       25718 :     COPY_SCALAR_FIELD(opretset);
    1484       25718 :     COPY_SCALAR_FIELD(opcollid);
    1485       25718 :     COPY_SCALAR_FIELD(inputcollid);
    1486       25718 :     COPY_NODE_FIELD(args);
    1487       25718 :     COPY_LOCATION_FIELD(location);
    1488             : 
    1489       25718 :     return newnode;
    1490             : }
    1491             : 
    1492             : /*
    1493             :  * _copyDistinctExpr (same as OpExpr)
    1494             :  */
    1495             : static DistinctExpr *
    1496          21 : _copyDistinctExpr(const DistinctExpr *from)
    1497             : {
    1498          21 :     DistinctExpr *newnode = makeNode(DistinctExpr);
    1499             : 
    1500          21 :     COPY_SCALAR_FIELD(opno);
    1501          21 :     COPY_SCALAR_FIELD(opfuncid);
    1502          21 :     COPY_SCALAR_FIELD(opresulttype);
    1503          21 :     COPY_SCALAR_FIELD(opretset);
    1504          21 :     COPY_SCALAR_FIELD(opcollid);
    1505          21 :     COPY_SCALAR_FIELD(inputcollid);
    1506          21 :     COPY_NODE_FIELD(args);
    1507          21 :     COPY_LOCATION_FIELD(location);
    1508             : 
    1509          21 :     return newnode;
    1510             : }
    1511             : 
    1512             : /*
    1513             :  * _copyNullIfExpr (same as OpExpr)
    1514             :  */
    1515             : static NullIfExpr *
    1516           8 : _copyNullIfExpr(const NullIfExpr *from)
    1517             : {
    1518           8 :     NullIfExpr *newnode = makeNode(NullIfExpr);
    1519             : 
    1520           8 :     COPY_SCALAR_FIELD(opno);
    1521           8 :     COPY_SCALAR_FIELD(opfuncid);
    1522           8 :     COPY_SCALAR_FIELD(opresulttype);
    1523           8 :     COPY_SCALAR_FIELD(opretset);
    1524           8 :     COPY_SCALAR_FIELD(opcollid);
    1525           8 :     COPY_SCALAR_FIELD(inputcollid);
    1526           8 :     COPY_NODE_FIELD(args);
    1527           8 :     COPY_LOCATION_FIELD(location);
    1528             : 
    1529           8 :     return newnode;
    1530             : }
    1531             : 
    1532             : /*
    1533             :  * _copyScalarArrayOpExpr
    1534             :  */
    1535             : static ScalarArrayOpExpr *
    1536        1363 : _copyScalarArrayOpExpr(const ScalarArrayOpExpr *from)
    1537             : {
    1538        1363 :     ScalarArrayOpExpr *newnode = makeNode(ScalarArrayOpExpr);
    1539             : 
    1540        1363 :     COPY_SCALAR_FIELD(opno);
    1541        1363 :     COPY_SCALAR_FIELD(opfuncid);
    1542        1363 :     COPY_SCALAR_FIELD(useOr);
    1543        1363 :     COPY_SCALAR_FIELD(inputcollid);
    1544        1363 :     COPY_NODE_FIELD(args);
    1545        1363 :     COPY_LOCATION_FIELD(location);
    1546             : 
    1547        1363 :     return newnode;
    1548             : }
    1549             : 
    1550             : /*
    1551             :  * _copyBoolExpr
    1552             :  */
    1553             : static BoolExpr *
    1554        6046 : _copyBoolExpr(const BoolExpr *from)
    1555             : {
    1556        6046 :     BoolExpr   *newnode = makeNode(BoolExpr);
    1557             : 
    1558        6046 :     COPY_SCALAR_FIELD(boolop);
    1559        6046 :     COPY_NODE_FIELD(args);
    1560        6046 :     COPY_LOCATION_FIELD(location);
    1561             : 
    1562        6046 :     return newnode;
    1563             : }
    1564             : 
    1565             : /*
    1566             :  * _copySubLink
    1567             :  */
    1568             : static SubLink *
    1569        1108 : _copySubLink(const SubLink *from)
    1570             : {
    1571        1108 :     SubLink    *newnode = makeNode(SubLink);
    1572             : 
    1573        1108 :     COPY_SCALAR_FIELD(subLinkType);
    1574        1108 :     COPY_SCALAR_FIELD(subLinkId);
    1575        1108 :     COPY_NODE_FIELD(testexpr);
    1576        1108 :     COPY_NODE_FIELD(operName);
    1577        1108 :     COPY_NODE_FIELD(subselect);
    1578        1108 :     COPY_LOCATION_FIELD(location);
    1579             : 
    1580        1108 :     return newnode;
    1581             : }
    1582             : 
    1583             : /*
    1584             :  * _copySubPlan
    1585             :  */
    1586             : static SubPlan *
    1587         113 : _copySubPlan(const SubPlan *from)
    1588             : {
    1589         113 :     SubPlan    *newnode = makeNode(SubPlan);
    1590             : 
    1591         113 :     COPY_SCALAR_FIELD(subLinkType);
    1592         113 :     COPY_NODE_FIELD(testexpr);
    1593         113 :     COPY_NODE_FIELD(paramIds);
    1594         113 :     COPY_SCALAR_FIELD(plan_id);
    1595         113 :     COPY_STRING_FIELD(plan_name);
    1596         113 :     COPY_SCALAR_FIELD(firstColType);
    1597         113 :     COPY_SCALAR_FIELD(firstColTypmod);
    1598         113 :     COPY_SCALAR_FIELD(firstColCollation);
    1599         113 :     COPY_SCALAR_FIELD(useHashTable);
    1600         113 :     COPY_SCALAR_FIELD(unknownEqFalse);
    1601         113 :     COPY_SCALAR_FIELD(parallel_safe);
    1602         113 :     COPY_NODE_FIELD(setParam);
    1603         113 :     COPY_NODE_FIELD(parParam);
    1604         113 :     COPY_NODE_FIELD(args);
    1605         113 :     COPY_SCALAR_FIELD(startup_cost);
    1606         113 :     COPY_SCALAR_FIELD(per_call_cost);
    1607             : 
    1608         113 :     return newnode;
    1609             : }
    1610             : 
    1611             : /*
    1612             :  * _copyAlternativeSubPlan
    1613             :  */
    1614             : static AlternativeSubPlan *
    1615           0 : _copyAlternativeSubPlan(const AlternativeSubPlan *from)
    1616             : {
    1617           0 :     AlternativeSubPlan *newnode = makeNode(AlternativeSubPlan);
    1618             : 
    1619           0 :     COPY_NODE_FIELD(subplans);
    1620             : 
    1621           0 :     return newnode;
    1622             : }
    1623             : 
    1624             : /*
    1625             :  * _copyFieldSelect
    1626             :  */
    1627             : static FieldSelect *
    1628         479 : _copyFieldSelect(const FieldSelect *from)
    1629             : {
    1630         479 :     FieldSelect *newnode = makeNode(FieldSelect);
    1631             : 
    1632         479 :     COPY_NODE_FIELD(arg);
    1633         479 :     COPY_SCALAR_FIELD(fieldnum);
    1634         479 :     COPY_SCALAR_FIELD(resulttype);
    1635         479 :     COPY_SCALAR_FIELD(resulttypmod);
    1636         479 :     COPY_SCALAR_FIELD(resultcollid);
    1637             : 
    1638         479 :     return newnode;
    1639             : }
    1640             : 
    1641             : /*
    1642             :  * _copyFieldStore
    1643             :  */
    1644             : static FieldStore *
    1645           2 : _copyFieldStore(const FieldStore *from)
    1646             : {
    1647           2 :     FieldStore *newnode = makeNode(FieldStore);
    1648             : 
    1649           2 :     COPY_NODE_FIELD(arg);
    1650           2 :     COPY_NODE_FIELD(newvals);
    1651           2 :     COPY_NODE_FIELD(fieldnums);
    1652           2 :     COPY_SCALAR_FIELD(resulttype);
    1653             : 
    1654           2 :     return newnode;
    1655             : }
    1656             : 
    1657             : /*
    1658             :  * _copyRelabelType
    1659             :  */
    1660             : static RelabelType *
    1661        2753 : _copyRelabelType(const RelabelType *from)
    1662             : {
    1663        2753 :     RelabelType *newnode = makeNode(RelabelType);
    1664             : 
    1665        2753 :     COPY_NODE_FIELD(arg);
    1666        2753 :     COPY_SCALAR_FIELD(resulttype);
    1667        2753 :     COPY_SCALAR_FIELD(resulttypmod);
    1668        2753 :     COPY_SCALAR_FIELD(resultcollid);
    1669        2753 :     COPY_SCALAR_FIELD(relabelformat);
    1670        2753 :     COPY_LOCATION_FIELD(location);
    1671             : 
    1672        2753 :     return newnode;
    1673             : }
    1674             : 
    1675             : /*
    1676             :  * _copyCoerceViaIO
    1677             :  */
    1678             : static CoerceViaIO *
    1679         810 : _copyCoerceViaIO(const CoerceViaIO *from)
    1680             : {
    1681         810 :     CoerceViaIO *newnode = makeNode(CoerceViaIO);
    1682             : 
    1683         810 :     COPY_NODE_FIELD(arg);
    1684         810 :     COPY_SCALAR_FIELD(resulttype);
    1685         810 :     COPY_SCALAR_FIELD(resultcollid);
    1686         810 :     COPY_SCALAR_FIELD(coerceformat);
    1687         810 :     COPY_LOCATION_FIELD(location);
    1688             : 
    1689         810 :     return newnode;
    1690             : }
    1691             : 
    1692             : /*
    1693             :  * _copyArrayCoerceExpr
    1694             :  */
    1695             : static ArrayCoerceExpr *
    1696          14 : _copyArrayCoerceExpr(const ArrayCoerceExpr *from)
    1697             : {
    1698          14 :     ArrayCoerceExpr *newnode = makeNode(ArrayCoerceExpr);
    1699             : 
    1700          14 :     COPY_NODE_FIELD(arg);
    1701          14 :     COPY_SCALAR_FIELD(elemfuncid);
    1702          14 :     COPY_SCALAR_FIELD(resulttype);
    1703          14 :     COPY_SCALAR_FIELD(resulttypmod);
    1704          14 :     COPY_SCALAR_FIELD(resultcollid);
    1705          14 :     COPY_SCALAR_FIELD(isExplicit);
    1706          14 :     COPY_SCALAR_FIELD(coerceformat);
    1707          14 :     COPY_LOCATION_FIELD(location);
    1708             : 
    1709          14 :     return newnode;
    1710             : }
    1711             : 
    1712             : /*
    1713             :  * _copyConvertRowtypeExpr
    1714             :  */
    1715             : static ConvertRowtypeExpr *
    1716           2 : _copyConvertRowtypeExpr(const ConvertRowtypeExpr *from)
    1717             : {
    1718           2 :     ConvertRowtypeExpr *newnode = makeNode(ConvertRowtypeExpr);
    1719             : 
    1720           2 :     COPY_NODE_FIELD(arg);
    1721           2 :     COPY_SCALAR_FIELD(resulttype);
    1722           2 :     COPY_SCALAR_FIELD(convertformat);
    1723           2 :     COPY_LOCATION_FIELD(location);
    1724             : 
    1725           2 :     return newnode;
    1726             : }
    1727             : 
    1728             : /*
    1729             :  * _copyCollateExpr
    1730             :  */
    1731             : static CollateExpr *
    1732          12 : _copyCollateExpr(const CollateExpr *from)
    1733             : {
    1734          12 :     CollateExpr *newnode = makeNode(CollateExpr);
    1735             : 
    1736          12 :     COPY_NODE_FIELD(arg);
    1737          12 :     COPY_SCALAR_FIELD(collOid);
    1738          12 :     COPY_LOCATION_FIELD(location);
    1739             : 
    1740          12 :     return newnode;
    1741             : }
    1742             : 
    1743             : /*
    1744             :  * _copyCaseExpr
    1745             :  */
    1746             : static CaseExpr *
    1747        1706 : _copyCaseExpr(const CaseExpr *from)
    1748             : {
    1749        1706 :     CaseExpr   *newnode = makeNode(CaseExpr);
    1750             : 
    1751        1706 :     COPY_SCALAR_FIELD(casetype);
    1752        1706 :     COPY_SCALAR_FIELD(casecollid);
    1753        1706 :     COPY_NODE_FIELD(arg);
    1754        1706 :     COPY_NODE_FIELD(args);
    1755        1706 :     COPY_NODE_FIELD(defresult);
    1756        1706 :     COPY_LOCATION_FIELD(location);
    1757             : 
    1758        1706 :     return newnode;
    1759             : }
    1760             : 
    1761             : /*
    1762             :  * _copyCaseWhen
    1763             :  */
    1764             : static CaseWhen *
    1765        2567 : _copyCaseWhen(const CaseWhen *from)
    1766             : {
    1767        2567 :     CaseWhen   *newnode = makeNode(CaseWhen);
    1768             : 
    1769        2567 :     COPY_NODE_FIELD(expr);
    1770        2567 :     COPY_NODE_FIELD(result);
    1771        2567 :     COPY_LOCATION_FIELD(location);
    1772             : 
    1773        2567 :     return newnode;
    1774             : }
    1775             : 
    1776             : /*
    1777             :  * _copyCaseTestExpr
    1778             :  */
    1779             : static CaseTestExpr *
    1780        2154 : _copyCaseTestExpr(const CaseTestExpr *from)
    1781             : {
    1782        2154 :     CaseTestExpr *newnode = makeNode(CaseTestExpr);
    1783             : 
    1784        2154 :     COPY_SCALAR_FIELD(typeId);
    1785        2154 :     COPY_SCALAR_FIELD(typeMod);
    1786        2154 :     COPY_SCALAR_FIELD(collation);
    1787             : 
    1788        2154 :     return newnode;
    1789             : }
    1790             : 
    1791             : /*
    1792             :  * _copyArrayExpr
    1793             :  */
    1794             : static ArrayExpr *
    1795        1200 : _copyArrayExpr(const ArrayExpr *from)
    1796             : {
    1797        1200 :     ArrayExpr  *newnode = makeNode(ArrayExpr);
    1798             : 
    1799        1200 :     COPY_SCALAR_FIELD(array_typeid);
    1800        1200 :     COPY_SCALAR_FIELD(array_collid);
    1801        1200 :     COPY_SCALAR_FIELD(element_typeid);
    1802        1200 :     COPY_NODE_FIELD(elements);
    1803        1200 :     COPY_SCALAR_FIELD(multidims);
    1804        1200 :     COPY_LOCATION_FIELD(location);
    1805             : 
    1806        1200 :     return newnode;
    1807             : }
    1808             : 
    1809             : /*
    1810             :  * _copyRowExpr
    1811             :  */
    1812             : static RowExpr *
    1813         187 : _copyRowExpr(const RowExpr *from)
    1814             : {
    1815         187 :     RowExpr    *newnode = makeNode(RowExpr);
    1816             : 
    1817         187 :     COPY_NODE_FIELD(args);
    1818         187 :     COPY_SCALAR_FIELD(row_typeid);
    1819         187 :     COPY_SCALAR_FIELD(row_format);
    1820         187 :     COPY_NODE_FIELD(colnames);
    1821         187 :     COPY_LOCATION_FIELD(location);
    1822             : 
    1823         187 :     return newnode;
    1824             : }
    1825             : 
    1826             : /*
    1827             :  * _copyRowCompareExpr
    1828             :  */
    1829             : static RowCompareExpr *
    1830           2 : _copyRowCompareExpr(const RowCompareExpr *from)
    1831             : {
    1832           2 :     RowCompareExpr *newnode = makeNode(RowCompareExpr);
    1833             : 
    1834           2 :     COPY_SCALAR_FIELD(rctype);
    1835           2 :     COPY_NODE_FIELD(opnos);
    1836           2 :     COPY_NODE_FIELD(opfamilies);
    1837           2 :     COPY_NODE_FIELD(inputcollids);
    1838           2 :     COPY_NODE_FIELD(largs);
    1839           2 :     COPY_NODE_FIELD(rargs);
    1840             : 
    1841           2 :     return newnode;
    1842             : }
    1843             : 
    1844             : /*
    1845             :  * _copyCoalesceExpr
    1846             :  */
    1847             : static CoalesceExpr *
    1848         930 : _copyCoalesceExpr(const CoalesceExpr *from)
    1849             : {
    1850         930 :     CoalesceExpr *newnode = makeNode(CoalesceExpr);
    1851             : 
    1852         930 :     COPY_SCALAR_FIELD(coalescetype);
    1853         930 :     COPY_SCALAR_FIELD(coalescecollid);
    1854         930 :     COPY_NODE_FIELD(args);
    1855         930 :     COPY_LOCATION_FIELD(location);
    1856             : 
    1857         930 :     return newnode;
    1858             : }
    1859             : 
    1860             : /*
    1861             :  * _copyMinMaxExpr
    1862             :  */
    1863             : static MinMaxExpr *
    1864          28 : _copyMinMaxExpr(const MinMaxExpr *from)
    1865             : {
    1866          28 :     MinMaxExpr *newnode = makeNode(MinMaxExpr);
    1867             : 
    1868          28 :     COPY_SCALAR_FIELD(minmaxtype);
    1869          28 :     COPY_SCALAR_FIELD(minmaxcollid);
    1870          28 :     COPY_SCALAR_FIELD(inputcollid);
    1871          28 :     COPY_SCALAR_FIELD(op);
    1872          28 :     COPY_NODE_FIELD(args);
    1873          28 :     COPY_LOCATION_FIELD(location);
    1874             : 
    1875          28 :     return newnode;
    1876             : }
    1877             : 
    1878             : /*
    1879             :  * _copySQLValueFunction
    1880             :  */
    1881             : static SQLValueFunction *
    1882        1434 : _copySQLValueFunction(const SQLValueFunction *from)
    1883             : {
    1884        1434 :     SQLValueFunction *newnode = makeNode(SQLValueFunction);
    1885             : 
    1886        1434 :     COPY_SCALAR_FIELD(op);
    1887        1434 :     COPY_SCALAR_FIELD(type);
    1888        1434 :     COPY_SCALAR_FIELD(typmod);
    1889        1434 :     COPY_LOCATION_FIELD(location);
    1890             : 
    1891        1434 :     return newnode;
    1892             : }
    1893             : 
    1894             : /*
    1895             :  * _copyXmlExpr
    1896             :  */
    1897             : static XmlExpr *
    1898          10 : _copyXmlExpr(const XmlExpr *from)
    1899             : {
    1900          10 :     XmlExpr    *newnode = makeNode(XmlExpr);
    1901             : 
    1902          10 :     COPY_SCALAR_FIELD(op);
    1903          10 :     COPY_STRING_FIELD(name);
    1904          10 :     COPY_NODE_FIELD(named_args);
    1905          10 :     COPY_NODE_FIELD(arg_names);
    1906          10 :     COPY_NODE_FIELD(args);
    1907          10 :     COPY_SCALAR_FIELD(xmloption);
    1908          10 :     COPY_SCALAR_FIELD(type);
    1909          10 :     COPY_SCALAR_FIELD(typmod);
    1910          10 :     COPY_LOCATION_FIELD(location);
    1911             : 
    1912          10 :     return newnode;
    1913             : }
    1914             : 
    1915             : /*
    1916             :  * _copyNullTest
    1917             :  */
    1918             : static NullTest *
    1919        1901 : _copyNullTest(const NullTest *from)
    1920             : {
    1921        1901 :     NullTest   *newnode = makeNode(NullTest);
    1922             : 
    1923        1901 :     COPY_NODE_FIELD(arg);
    1924        1901 :     COPY_SCALAR_FIELD(nulltesttype);
    1925        1901 :     COPY_SCALAR_FIELD(argisrow);
    1926        1901 :     COPY_LOCATION_FIELD(location);
    1927             : 
    1928        1901 :     return newnode;
    1929             : }
    1930             : 
    1931             : /*
    1932             :  * _copyBooleanTest
    1933             :  */
    1934             : static BooleanTest *
    1935          77 : _copyBooleanTest(const BooleanTest *from)
    1936             : {
    1937          77 :     BooleanTest *newnode = makeNode(BooleanTest);
    1938             : 
    1939          77 :     COPY_NODE_FIELD(arg);
    1940          77 :     COPY_SCALAR_FIELD(booltesttype);
    1941          77 :     COPY_LOCATION_FIELD(location);
    1942             : 
    1943          77 :     return newnode;
    1944             : }
    1945             : 
    1946             : /*
    1947             :  * _copyCoerceToDomain
    1948             :  */
    1949             : static CoerceToDomain *
    1950        4812 : _copyCoerceToDomain(const CoerceToDomain *from)
    1951             : {
    1952        4812 :     CoerceToDomain *newnode = makeNode(CoerceToDomain);
    1953             : 
    1954        4812 :     COPY_NODE_FIELD(arg);
    1955        4812 :     COPY_SCALAR_FIELD(resulttype);
    1956        4812 :     COPY_SCALAR_FIELD(resulttypmod);
    1957        4812 :     COPY_SCALAR_FIELD(resultcollid);
    1958        4812 :     COPY_SCALAR_FIELD(coercionformat);
    1959        4812 :     COPY_LOCATION_FIELD(location);
    1960             : 
    1961        4812 :     return newnode;
    1962             : }
    1963             : 
    1964             : /*
    1965             :  * _copyCoerceToDomainValue
    1966             :  */
    1967             : static CoerceToDomainValue *
    1968         250 : _copyCoerceToDomainValue(const CoerceToDomainValue *from)
    1969             : {
    1970         250 :     CoerceToDomainValue *newnode = makeNode(CoerceToDomainValue);
    1971             : 
    1972         250 :     COPY_SCALAR_FIELD(typeId);
    1973         250 :     COPY_SCALAR_FIELD(typeMod);
    1974         250 :     COPY_SCALAR_FIELD(collation);
    1975         250 :     COPY_LOCATION_FIELD(location);
    1976             : 
    1977         250 :     return newnode;
    1978             : }
    1979             : 
    1980             : /*
    1981             :  * _copySetToDefault
    1982             :  */
    1983             : static SetToDefault *
    1984          12 : _copySetToDefault(const SetToDefault *from)
    1985             : {
    1986          12 :     SetToDefault *newnode = makeNode(SetToDefault);
    1987             : 
    1988          12 :     COPY_SCALAR_FIELD(typeId);
    1989          12 :     COPY_SCALAR_FIELD(typeMod);
    1990          12 :     COPY_SCALAR_FIELD(collation);
    1991          12 :     COPY_LOCATION_FIELD(location);
    1992             : 
    1993          12 :     return newnode;
    1994             : }
    1995             : 
    1996             : /*
    1997             :  * _copyCurrentOfExpr
    1998             :  */
    1999             : static CurrentOfExpr *
    2000         102 : _copyCurrentOfExpr(const CurrentOfExpr *from)
    2001             : {
    2002         102 :     CurrentOfExpr *newnode = makeNode(CurrentOfExpr);
    2003             : 
    2004         102 :     COPY_SCALAR_FIELD(cvarno);
    2005         102 :     COPY_STRING_FIELD(cursor_name);
    2006         102 :     COPY_SCALAR_FIELD(cursor_param);
    2007             : 
    2008         102 :     return newnode;
    2009             : }
    2010             : 
    2011             :  /*
    2012             :   * _copyNextValueExpr
    2013             :   */
    2014             : static NextValueExpr *
    2015          30 : _copyNextValueExpr(const NextValueExpr *from)
    2016             : {
    2017          30 :     NextValueExpr *newnode = makeNode(NextValueExpr);
    2018             : 
    2019          30 :     COPY_SCALAR_FIELD(seqid);
    2020          30 :     COPY_SCALAR_FIELD(typeId);
    2021             : 
    2022          30 :     return newnode;
    2023             : }
    2024             : 
    2025             : /*
    2026             :  * _copyInferenceElem
    2027             :  */
    2028             : static InferenceElem *
    2029          55 : _copyInferenceElem(const InferenceElem *from)
    2030             : {
    2031          55 :     InferenceElem *newnode = makeNode(InferenceElem);
    2032             : 
    2033          55 :     COPY_NODE_FIELD(expr);
    2034          55 :     COPY_SCALAR_FIELD(infercollid);
    2035          55 :     COPY_SCALAR_FIELD(inferopclass);
    2036             : 
    2037          55 :     return newnode;
    2038             : }
    2039             : 
    2040             : /*
    2041             :  * _copyTargetEntry
    2042             :  */
    2043             : static TargetEntry *
    2044       58090 : _copyTargetEntry(const TargetEntry *from)
    2045             : {
    2046       58090 :     TargetEntry *newnode = makeNode(TargetEntry);
    2047             : 
    2048       58090 :     COPY_NODE_FIELD(expr);
    2049       58090 :     COPY_SCALAR_FIELD(resno);
    2050       58090 :     COPY_STRING_FIELD(resname);
    2051       58090 :     COPY_SCALAR_FIELD(ressortgroupref);
    2052       58090 :     COPY_SCALAR_FIELD(resorigtbl);
    2053       58090 :     COPY_SCALAR_FIELD(resorigcol);
    2054       58090 :     COPY_SCALAR_FIELD(resjunk);
    2055             : 
    2056       58090 :     return newnode;
    2057             : }
    2058             : 
    2059             : /*
    2060             :  * _copyRangeTblRef
    2061             :  */
    2062             : static RangeTblRef *
    2063       18583 : _copyRangeTblRef(const RangeTblRef *from)
    2064             : {
    2065       18583 :     RangeTblRef *newnode = makeNode(RangeTblRef);
    2066             : 
    2067       18583 :     COPY_SCALAR_FIELD(rtindex);
    2068             : 
    2069       18583 :     return newnode;
    2070             : }
    2071             : 
    2072             : /*
    2073             :  * _copyJoinExpr
    2074             :  */
    2075             : static JoinExpr *
    2076        2792 : _copyJoinExpr(const JoinExpr *from)
    2077             : {
    2078        2792 :     JoinExpr   *newnode = makeNode(JoinExpr);
    2079             : 
    2080        2792 :     COPY_SCALAR_FIELD(jointype);
    2081        2792 :     COPY_SCALAR_FIELD(isNatural);
    2082        2792 :     COPY_NODE_FIELD(larg);
    2083        2792 :     COPY_NODE_FIELD(rarg);
    2084        2792 :     COPY_NODE_FIELD(usingClause);
    2085        2792 :     COPY_NODE_FIELD(quals);
    2086        2792 :     COPY_NODE_FIELD(alias);
    2087        2792 :     COPY_SCALAR_FIELD(rtindex);
    2088             : 
    2089        2792 :     return newnode;
    2090             : }
    2091             : 
    2092             : /*
    2093             :  * _copyFromExpr
    2094             :  */
    2095             : static FromExpr *
    2096       17749 : _copyFromExpr(const FromExpr *from)
    2097             : {
    2098       17749 :     FromExpr   *newnode = makeNode(FromExpr);
    2099             : 
    2100       17749 :     COPY_NODE_FIELD(fromlist);
    2101       17749 :     COPY_NODE_FIELD(quals);
    2102             : 
    2103       17749 :     return newnode;
    2104             : }
    2105             : 
    2106             : /*
    2107             :  * _copyOnConflictExpr
    2108             :  */
    2109             : static OnConflictExpr *
    2110          32 : _copyOnConflictExpr(const OnConflictExpr *from)
    2111             : {
    2112          32 :     OnConflictExpr *newnode = makeNode(OnConflictExpr);
    2113             : 
    2114          32 :     COPY_SCALAR_FIELD(action);
    2115          32 :     COPY_NODE_FIELD(arbiterElems);
    2116          32 :     COPY_NODE_FIELD(arbiterWhere);
    2117          32 :     COPY_SCALAR_FIELD(constraint);
    2118          32 :     COPY_NODE_FIELD(onConflictSet);
    2119          32 :     COPY_NODE_FIELD(onConflictWhere);
    2120          32 :     COPY_SCALAR_FIELD(exclRelIndex);
    2121          32 :     COPY_NODE_FIELD(exclRelTlist);
    2122             : 
    2123          32 :     return newnode;
    2124             : }
    2125             : 
    2126             : /* ****************************************************************
    2127             :  *                      relation.h copy functions
    2128             :  *
    2129             :  * We don't support copying RelOptInfo, IndexOptInfo, or Path nodes.
    2130             :  * There are some subsidiary structs that are useful to copy, though.
    2131             :  * ****************************************************************
    2132             :  */
    2133             : 
    2134             : /*
    2135             :  * _copyPathKey
    2136             :  */
    2137             : static PathKey *
    2138           0 : _copyPathKey(const PathKey *from)
    2139             : {
    2140           0 :     PathKey    *newnode = makeNode(PathKey);
    2141             : 
    2142             :     /* EquivalenceClasses are never moved, so just shallow-copy the pointer */
    2143           0 :     COPY_SCALAR_FIELD(pk_eclass);
    2144           0 :     COPY_SCALAR_FIELD(pk_opfamily);
    2145           0 :     COPY_SCALAR_FIELD(pk_strategy);
    2146           0 :     COPY_SCALAR_FIELD(pk_nulls_first);
    2147             : 
    2148           0 :     return newnode;
    2149             : }
    2150             : 
    2151             : /*
    2152             :  * _copyRestrictInfo
    2153             :  */
    2154             : static RestrictInfo *
    2155           0 : _copyRestrictInfo(const RestrictInfo *from)
    2156             : {
    2157           0 :     RestrictInfo *newnode = makeNode(RestrictInfo);
    2158             : 
    2159           0 :     COPY_NODE_FIELD(clause);
    2160           0 :     COPY_SCALAR_FIELD(is_pushed_down);
    2161           0 :     COPY_SCALAR_FIELD(outerjoin_delayed);
    2162           0 :     COPY_SCALAR_FIELD(can_join);
    2163           0 :     COPY_SCALAR_FIELD(pseudoconstant);
    2164           0 :     COPY_SCALAR_FIELD(leakproof);
    2165           0 :     COPY_SCALAR_FIELD(security_level);
    2166           0 :     COPY_BITMAPSET_FIELD(clause_relids);
    2167           0 :     COPY_BITMAPSET_FIELD(required_relids);
    2168           0 :     COPY_BITMAPSET_FIELD(outer_relids);
    2169           0 :     COPY_BITMAPSET_FIELD(nullable_relids);
    2170           0 :     COPY_BITMAPSET_FIELD(left_relids);
    2171           0 :     COPY_BITMAPSET_FIELD(right_relids);
    2172           0 :     COPY_NODE_FIELD(orclause);
    2173             :     /* EquivalenceClasses are never copied, so shallow-copy the pointers */
    2174           0 :     COPY_SCALAR_FIELD(parent_ec);
    2175           0 :     COPY_SCALAR_FIELD(eval_cost);
    2176           0 :     COPY_SCALAR_FIELD(norm_selec);
    2177           0 :     COPY_SCALAR_FIELD(outer_selec);
    2178           0 :     COPY_NODE_FIELD(mergeopfamilies);
    2179             :     /* EquivalenceClasses are never copied, so shallow-copy the pointers */
    2180           0 :     COPY_SCALAR_FIELD(left_ec);
    2181           0 :     COPY_SCALAR_FIELD(right_ec);
    2182           0 :     COPY_SCALAR_FIELD(left_em);
    2183           0 :     COPY_SCALAR_FIELD(right_em);
    2184             :     /* MergeScanSelCache isn't a Node, so hard to copy; just reset cache */
    2185           0 :     newnode->scansel_cache = NIL;
    2186           0 :     COPY_SCALAR_FIELD(outer_is_left);
    2187           0 :     COPY_SCALAR_FIELD(hashjoinoperator);
    2188           0 :     COPY_SCALAR_FIELD(left_bucketsize);
    2189           0 :     COPY_SCALAR_FIELD(right_bucketsize);
    2190           0 :     COPY_SCALAR_FIELD(left_mcvfreq);
    2191           0 :     COPY_SCALAR_FIELD(right_mcvfreq);
    2192             : 
    2193           0 :     return newnode;
    2194             : }
    2195             : 
    2196             : /*
    2197             :  * _copyPlaceHolderVar
    2198             :  */
    2199             : static PlaceHolderVar *
    2200         388 : _copyPlaceHolderVar(const PlaceHolderVar *from)
    2201             : {
    2202         388 :     PlaceHolderVar *newnode = makeNode(PlaceHolderVar);
    2203             : 
    2204         388 :     COPY_NODE_FIELD(phexpr);
    2205         388 :     COPY_BITMAPSET_FIELD(phrels);
    2206         388 :     COPY_SCALAR_FIELD(phid);
    2207         388 :     COPY_SCALAR_FIELD(phlevelsup);
    2208             : 
    2209         388 :     return newnode;
    2210             : }
    2211             : 
    2212             : /*
    2213             :  * _copySpecialJoinInfo
    2214             :  */
    2215             : static SpecialJoinInfo *
    2216           0 : _copySpecialJoinInfo(const SpecialJoinInfo *from)
    2217             : {
    2218           0 :     SpecialJoinInfo *newnode = makeNode(SpecialJoinInfo);
    2219             : 
    2220           0 :     COPY_BITMAPSET_FIELD(min_lefthand);
    2221           0 :     COPY_BITMAPSET_FIELD(min_righthand);
    2222           0 :     COPY_BITMAPSET_FIELD(syn_lefthand);
    2223           0 :     COPY_BITMAPSET_FIELD(syn_righthand);
    2224           0 :     COPY_SCALAR_FIELD(jointype);
    2225           0 :     COPY_SCALAR_FIELD(lhs_strict);
    2226           0 :     COPY_SCALAR_FIELD(delay_upper_joins);
    2227           0 :     COPY_SCALAR_FIELD(semi_can_btree);
    2228           0 :     COPY_SCALAR_FIELD(semi_can_hash);
    2229           0 :     COPY_NODE_FIELD(semi_operators);
    2230           0 :     COPY_NODE_FIELD(semi_rhs_exprs);
    2231             : 
    2232           0 :     return newnode;
    2233             : }
    2234             : 
    2235             : /*
    2236             :  * _copyAppendRelInfo
    2237             :  */
    2238             : static AppendRelInfo *
    2239          82 : _copyAppendRelInfo(const AppendRelInfo *from)
    2240             : {
    2241          82 :     AppendRelInfo *newnode = makeNode(AppendRelInfo);
    2242             : 
    2243          82 :     COPY_SCALAR_FIELD(parent_relid);
    2244          82 :     COPY_SCALAR_FIELD(child_relid);
    2245          82 :     COPY_SCALAR_FIELD(parent_reltype);
    2246          82 :     COPY_SCALAR_FIELD(child_reltype);
    2247          82 :     COPY_NODE_FIELD(translated_vars);
    2248          82 :     COPY_SCALAR_FIELD(parent_reloid);
    2249             : 
    2250          82 :     return newnode;
    2251             : }
    2252             : 
    2253             : /*
    2254             :  * _copyPartitionedChildRelInfo
    2255             :  */
    2256             : static PartitionedChildRelInfo *
    2257           0 : _copyPartitionedChildRelInfo(const PartitionedChildRelInfo *from)
    2258             : {
    2259           0 :     PartitionedChildRelInfo *newnode = makeNode(PartitionedChildRelInfo);
    2260             : 
    2261           0 :     COPY_SCALAR_FIELD(parent_relid);
    2262           0 :     COPY_NODE_FIELD(child_rels);
    2263             : 
    2264           0 :     return newnode;
    2265             : }
    2266             : 
    2267             : /*
    2268             :  * _copyPlaceHolderInfo
    2269             :  */
    2270             : static PlaceHolderInfo *
    2271           0 : _copyPlaceHolderInfo(const PlaceHolderInfo *from)
    2272             : {
    2273           0 :     PlaceHolderInfo *newnode = makeNode(PlaceHolderInfo);
    2274             : 
    2275           0 :     COPY_SCALAR_FIELD(phid);
    2276           0 :     COPY_NODE_FIELD(ph_var);
    2277           0 :     COPY_BITMAPSET_FIELD(ph_eval_at);
    2278           0 :     COPY_BITMAPSET_FIELD(ph_lateral);
    2279           0 :     COPY_BITMAPSET_FIELD(ph_needed);
    2280           0 :     COPY_SCALAR_FIELD(ph_width);
    2281             : 
    2282           0 :     return newnode;
    2283             : }
    2284             : 
    2285             : /* ****************************************************************
    2286             :  *                  parsenodes.h copy functions
    2287             :  * ****************************************************************
    2288             :  */
    2289             : 
    2290             : static RangeTblEntry *
    2291       29048 : _copyRangeTblEntry(const RangeTblEntry *from)
    2292             : {
    2293       29048 :     RangeTblEntry *newnode = makeNode(RangeTblEntry);
    2294             : 
    2295       29048 :     COPY_SCALAR_FIELD(rtekind);
    2296       29048 :     COPY_SCALAR_FIELD(relid);
    2297       29048 :     COPY_SCALAR_FIELD(relkind);
    2298       29048 :     COPY_NODE_FIELD(tablesample);
    2299       29048 :     COPY_NODE_FIELD(subquery);
    2300       29048 :     COPY_SCALAR_FIELD(security_barrier);
    2301       29048 :     COPY_SCALAR_FIELD(jointype);
    2302       29048 :     COPY_NODE_FIELD(joinaliasvars);
    2303       29048 :     COPY_NODE_FIELD(functions);
    2304       29048 :     COPY_SCALAR_FIELD(funcordinality);
    2305       29048 :     COPY_NODE_FIELD(tablefunc);
    2306       29048 :     COPY_NODE_FIELD(values_lists);
    2307       29048 :     COPY_STRING_FIELD(ctename);
    2308       29048 :     COPY_SCALAR_FIELD(ctelevelsup);
    2309       29048 :     COPY_SCALAR_FIELD(self_reference);
    2310       29048 :     COPY_NODE_FIELD(coltypes);
    2311       29048 :     COPY_NODE_FIELD(coltypmods);
    2312       29048 :     COPY_NODE_FIELD(colcollations);
    2313       29048 :     COPY_STRING_FIELD(enrname);
    2314       29048 :     COPY_SCALAR_FIELD(enrtuples);
    2315       29048 :     COPY_NODE_FIELD(alias);
    2316       29048 :     COPY_NODE_FIELD(eref);
    2317       29048 :     COPY_SCALAR_FIELD(lateral);
    2318       29048 :     COPY_SCALAR_FIELD(inh);
    2319       29048 :     COPY_SCALAR_FIELD(inFromCl);
    2320       29048 :     COPY_SCALAR_FIELD(requiredPerms);
    2321       29048 :     COPY_SCALAR_FIELD(checkAsUser);
    2322       29048 :     COPY_BITMAPSET_FIELD(selectedCols);
    2323       29048 :     COPY_BITMAPSET_FIELD(insertedCols);
    2324       29048 :     COPY_BITMAPSET_FIELD(updatedCols);
    2325       29048 :     COPY_NODE_FIELD(securityQuals);
    2326             : 
    2327       29048 :     return newnode;
    2328             : }
    2329             : 
    2330             : static RangeTblFunction *
    2331        1136 : _copyRangeTblFunction(const RangeTblFunction *from)
    2332             : {
    2333        1136 :     RangeTblFunction *newnode = makeNode(RangeTblFunction);
    2334             : 
    2335        1136 :     COPY_NODE_FIELD(funcexpr);
    2336        1136 :     COPY_SCALAR_FIELD(funccolcount);
    2337        1136 :     COPY_NODE_FIELD(funccolnames);
    2338        1136 :     COPY_NODE_FIELD(funccoltypes);
    2339        1136 :     COPY_NODE_FIELD(funccoltypmods);
    2340        1136 :     COPY_NODE_FIELD(funccolcollations);
    2341        1136 :     COPY_BITMAPSET_FIELD(funcparams);
    2342             : 
    2343        1136 :     return newnode;
    2344             : }
    2345             : 
    2346             : static TableSampleClause *
    2347          27 : _copyTableSampleClause(const TableSampleClause *from)
    2348             : {
    2349          27 :     TableSampleClause *newnode = makeNode(TableSampleClause);
    2350             : 
    2351          27 :     COPY_SCALAR_FIELD(tsmhandler);
    2352          27 :     COPY_NODE_FIELD(args);
    2353          27 :     COPY_NODE_FIELD(repeatable);
    2354             : 
    2355          27 :     return newnode;
    2356             : }
    2357             : 
    2358             : static WithCheckOption *
    2359           9 : _copyWithCheckOption(const WithCheckOption *from)
    2360             : {
    2361           9 :     WithCheckOption *newnode = makeNode(WithCheckOption);
    2362             : 
    2363           9 :     COPY_SCALAR_FIELD(kind);
    2364           9 :     COPY_STRING_FIELD(relname);
    2365           9 :     COPY_STRING_FIELD(polname);
    2366           9 :     COPY_NODE_FIELD(qual);
    2367           9 :     COPY_SCALAR_FIELD(cascaded);
    2368             : 
    2369           9 :     return newnode;
    2370             : }
    2371             : 
    2372             : static SortGroupClause *
    2373        2214 : _copySortGroupClause(const SortGroupClause *from)
    2374             : {
    2375        2214 :     SortGroupClause *newnode = makeNode(SortGroupClause);
    2376             : 
    2377        2214 :     COPY_SCALAR_FIELD(tleSortGroupRef);
    2378        2214 :     COPY_SCALAR_FIELD(eqop);
    2379        2214 :     COPY_SCALAR_FIELD(sortop);
    2380        2214 :     COPY_SCALAR_FIELD(nulls_first);
    2381        2214 :     COPY_SCALAR_FIELD(hashable);
    2382             : 
    2383        2214 :     return newnode;
    2384             : }
    2385             : 
    2386             : static GroupingSet *
    2387         102 : _copyGroupingSet(const GroupingSet *from)
    2388             : {
    2389         102 :     GroupingSet *newnode = makeNode(GroupingSet);
    2390             : 
    2391         102 :     COPY_SCALAR_FIELD(kind);
    2392         102 :     COPY_NODE_FIELD(content);
    2393         102 :     COPY_LOCATION_FIELD(location);
    2394             : 
    2395         102 :     return newnode;
    2396             : }
    2397             : 
    2398             : static WindowClause *
    2399          27 : _copyWindowClause(const WindowClause *from)
    2400             : {
    2401          27 :     WindowClause *newnode = makeNode(WindowClause);
    2402             : 
    2403          27 :     COPY_STRING_FIELD(name);
    2404          27 :     COPY_STRING_FIELD(refname);
    2405          27 :     COPY_NODE_FIELD(partitionClause);
    2406          27 :     COPY_NODE_FIELD(orderClause);
    2407          27 :     COPY_SCALAR_FIELD(frameOptions);
    2408          27 :     COPY_NODE_FIELD(startOffset);
    2409          27 :     COPY_NODE_FIELD(endOffset);
    2410          27 :     COPY_SCALAR_FIELD(winref);
    2411          27 :     COPY_SCALAR_FIELD(copiedOrder);
    2412             : 
    2413          27 :     return newnode;
    2414             : }
    2415             : 
    2416             : static RowMarkClause *
    2417         430 : _copyRowMarkClause(const RowMarkClause *from)
    2418             : {
    2419         430 :     RowMarkClause *newnode = makeNode(RowMarkClause);
    2420             : 
    2421         430 :     COPY_SCALAR_FIELD(rti);
    2422         430 :     COPY_SCALAR_FIELD(strength);
    2423         430 :     COPY_SCALAR_FIELD(waitPolicy);
    2424         430 :     COPY_SCALAR_FIELD(pushedDown);
    2425             : 
    2426         430 :     return newnode;
    2427             : }
    2428             : 
    2429             : static WithClause *
    2430          17 : _copyWithClause(const WithClause *from)
    2431             : {
    2432          17 :     WithClause *newnode = makeNode(WithClause);
    2433             : 
    2434          17 :     COPY_NODE_FIELD(ctes);
    2435          17 :     COPY_SCALAR_FIELD(recursive);
    2436          17 :     COPY_LOCATION_FIELD(location);
    2437             : 
    2438          17 :     return newnode;
    2439             : }
    2440             : 
    2441             : static InferClause *
    2442           2 : _copyInferClause(const InferClause *from)
    2443             : {
    2444           2 :     InferClause *newnode = makeNode(InferClause);
    2445             : 
    2446           2 :     COPY_NODE_FIELD(indexElems);
    2447           2 :     COPY_NODE_FIELD(whereClause);
    2448           2 :     COPY_STRING_FIELD(conname);
    2449           2 :     COPY_LOCATION_FIELD(location);
    2450             : 
    2451           2 :     return newnode;
    2452             : }
    2453             : 
    2454             : static OnConflictClause *
    2455           3 : _copyOnConflictClause(const OnConflictClause *from)
    2456             : {
    2457           3 :     OnConflictClause *newnode = makeNode(OnConflictClause);
    2458             : 
    2459           3 :     COPY_SCALAR_FIELD(action);
    2460           3 :     COPY_NODE_FIELD(infer);
    2461           3 :     COPY_NODE_FIELD(targetList);
    2462           3 :     COPY_NODE_FIELD(whereClause);
    2463           3 :     COPY_LOCATION_FIELD(location);
    2464             : 
    2465           3 :     return newnode;
    2466             : }
    2467             : 
    2468             : static CommonTableExpr *
    2469          84 : _copyCommonTableExpr(const CommonTableExpr *from)
    2470             : {
    2471          84 :     CommonTableExpr *newnode = makeNode(CommonTableExpr);
    2472             : 
    2473          84 :     COPY_STRING_FIELD(ctename);
    2474          84 :     COPY_NODE_FIELD(aliascolnames);
    2475          84 :     COPY_NODE_FIELD(ctequery);
    2476          84 :     COPY_LOCATION_FIELD(location);
    2477          84 :     COPY_SCALAR_FIELD(cterecursive);
    2478          84 :     COPY_SCALAR_FIELD(cterefcount);
    2479          84 :     COPY_NODE_FIELD(ctecolnames);
    2480          84 :     COPY_NODE_FIELD(ctecoltypes);
    2481          84 :     COPY_NODE_FIELD(ctecoltypmods);
    2482          84 :     COPY_NODE_FIELD(ctecolcollations);
    2483             : 
    2484          84 :     return newnode;
    2485             : }
    2486             : 
    2487             : static A_Expr *
    2488        2985 : _copyAExpr(const A_Expr *from)
    2489             : {
    2490        2985 :     A_Expr     *newnode = makeNode(A_Expr);
    2491             : 
    2492        2985 :     COPY_SCALAR_FIELD(kind);
    2493        2985 :     COPY_NODE_FIELD(name);
    2494        2985 :     COPY_NODE_FIELD(lexpr);
    2495        2985 :     COPY_NODE_FIELD(rexpr);
    2496        2985 :     COPY_LOCATION_FIELD(location);
    2497             : 
    2498        2985 :     return newnode;
    2499             : }
    2500             : 
    2501             : static ColumnRef *
    2502        7801 : _copyColumnRef(const ColumnRef *from)
    2503             : {
    2504        7801 :     ColumnRef  *newnode = makeNode(ColumnRef);
    2505             : 
    2506        7801 :     COPY_NODE_FIELD(fields);
    2507        7801 :     COPY_LOCATION_FIELD(location);
    2508             : 
    2509        7801 :     return newnode;
    2510             : }
    2511             : 
    2512             : static ParamRef *
    2513         465 : _copyParamRef(const ParamRef *from)
    2514             : {
    2515         465 :     ParamRef   *newnode = makeNode(ParamRef);
    2516             : 
    2517         465 :     COPY_SCALAR_FIELD(number);
    2518         465 :     COPY_LOCATION_FIELD(location);
    2519             : 
    2520         465 :     return newnode;
    2521             : }
    2522             : 
    2523             : static A_Const *
    2524        5762 : _copyAConst(const A_Const *from)
    2525             : {
    2526        5762 :     A_Const    *newnode = makeNode(A_Const);
    2527             : 
    2528             :     /* This part must duplicate _copyValue */
    2529        5762 :     COPY_SCALAR_FIELD(val.type);
    2530        5762 :     switch (from->val.type)
    2531             :     {
    2532             :         case T_Integer:
    2533        2884 :             COPY_SCALAR_FIELD(val.val.ival);
    2534        2884 :             break;
    2535             :         case T_Float:
    2536             :         case T_String:
    2537             :         case T_BitString:
    2538        2545 :             COPY_STRING_FIELD(val.val.str);
    2539        2545 :             break;
    2540             :         case T_Null:
    2541             :             /* nothing to do */
    2542         333 :             break;
    2543             :         default:
    2544           0 :             elog(ERROR, "unrecognized node type: %d",
    2545             :                  (int) from->val.type);
    2546             :             break;
    2547             :     }
    2548             : 
    2549        5762 :     COPY_LOCATION_FIELD(location);
    2550             : 
    2551        5762 :     return newnode;
    2552             : }
    2553             : 
    2554             : static FuncCall *
    2555        1589 : _copyFuncCall(const FuncCall *from)
    2556             : {
    2557        1589 :     FuncCall   *newnode = makeNode(FuncCall);
    2558             : 
    2559        1589 :     COPY_NODE_FIELD(funcname);
    2560        1589 :     COPY_NODE_FIELD(args);
    2561        1589 :     COPY_NODE_FIELD(agg_order);
    2562        1589 :     COPY_NODE_FIELD(agg_filter);
    2563        1589 :     COPY_SCALAR_FIELD(agg_within_group);
    2564        1589 :     COPY_SCALAR_FIELD(agg_star);
    2565        1589 :     COPY_SCALAR_FIELD(agg_distinct);
    2566        1589 :     COPY_SCALAR_FIELD(func_variadic);
    2567        1589 :     COPY_NODE_FIELD(over);
    2568        1589 :     COPY_LOCATION_FIELD(location);
    2569             : 
    2570        1589 :     return newnode;
    2571             : }
    2572             : 
    2573             : static A_Star *
    2574         488 : _copyAStar(const A_Star *from)
    2575             : {
    2576         488 :     A_Star     *newnode = makeNode(A_Star);
    2577             : 
    2578         488 :     return newnode;
    2579             : }
    2580             : 
    2581             : static A_Indices *
    2582          88 : _copyAIndices(const A_Indices *from)
    2583             : {
    2584          88 :     A_Indices  *newnode = makeNode(A_Indices);
    2585             : 
    2586          88 :     COPY_SCALAR_FIELD(is_slice);
    2587          88 :     COPY_NODE_FIELD(lidx);
    2588          88 :     COPY_NODE_FIELD(uidx);
    2589             : 
    2590          88 :     return newnode;
    2591             : }
    2592             : 
    2593             : static A_Indirection *
    2594         136 : _copyA_Indirection(const A_Indirection *from)
    2595             : {
    2596         136 :     A_Indirection *newnode = makeNode(A_Indirection);
    2597             : 
    2598         136 :     COPY_NODE_FIELD(arg);
    2599         136 :     COPY_NODE_FIELD(indirection);
    2600             : 
    2601         136 :     return newnode;
    2602             : }
    2603             : 
    2604             : static A_ArrayExpr *
    2605          24 : _copyA_ArrayExpr(const A_ArrayExpr *from)
    2606             : {
    2607          24 :     A_ArrayExpr *newnode = makeNode(A_ArrayExpr);
    2608             : 
    2609          24 :     COPY_NODE_FIELD(elements);
    2610          24 :     COPY_LOCATION_FIELD(location);
    2611             : 
    2612          24 :     return newnode;
    2613             : }
    2614             : 
    2615             : static ResTarget *
    2616        5175 : _copyResTarget(const ResTarget *from)
    2617             : {
    2618        5175 :     ResTarget  *newnode = makeNode(ResTarget);
    2619             : 
    2620        5175 :     COPY_STRING_FIELD(name);
    2621        5175 :     COPY_NODE_FIELD(indirection);
    2622        5175 :     COPY_NODE_FIELD(val);
    2623        5175 :     COPY_LOCATION_FIELD(location);
    2624             : 
    2625        5175 :     return newnode;
    2626             : }
    2627             : 
    2628             : static MultiAssignRef *
    2629           0 : _copyMultiAssignRef(const MultiAssignRef *from)
    2630             : {
    2631           0 :     MultiAssignRef *newnode = makeNode(MultiAssignRef);
    2632             : 
    2633           0 :     COPY_NODE_FIELD(source);
    2634           0 :     COPY_SCALAR_FIELD(colno);
    2635           0 :     COPY_SCALAR_FIELD(ncolumns);
    2636             : 
    2637           0 :     return newnode;
    2638             : }
    2639             : 
    2640             : static TypeName *
    2641        4806 : _copyTypeName(const TypeName *from)
    2642             : {
    2643        4806 :     TypeName   *newnode = makeNode(TypeName);
    2644             : 
    2645        4806 :     COPY_NODE_FIELD(names);
    2646        4806 :     COPY_SCALAR_FIELD(typeOid);
    2647        4806 :     COPY_SCALAR_FIELD(setof);
    2648        4806 :     COPY_SCALAR_FIELD(pct_type);
    2649        4806 :     COPY_NODE_FIELD(typmods);
    2650        4806 :     COPY_SCALAR_FIELD(typemod);
    2651        4806 :     COPY_NODE_FIELD(arrayBounds);
    2652        4806 :     COPY_LOCATION_FIELD(location);
    2653             : 
    2654        4806 :     return newnode;
    2655             : }
    2656             : 
    2657             : static SortBy *
    2658          84 : _copySortBy(const SortBy *from)
    2659             : {
    2660          84 :     SortBy     *newnode = makeNode(SortBy);
    2661             : 
    2662          84 :     COPY_NODE_FIELD(node);
    2663          84 :     COPY_SCALAR_FIELD(sortby_dir);
    2664          84 :     COPY_SCALAR_FIELD(sortby_nulls);
    2665          84 :     COPY_NODE_FIELD(useOp);
    2666          84 :     COPY_LOCATION_FIELD(location);
    2667             : 
    2668          84 :     return newnode;
    2669             : }
    2670             : 
    2671             : static WindowDef *
    2672           4 : _copyWindowDef(const WindowDef *from)
    2673             : {
    2674           4 :     WindowDef  *newnode = makeNode(WindowDef);
    2675             : 
    2676           4 :     COPY_STRING_FIELD(name);
    2677           4 :     COPY_STRING_FIELD(refname);
    2678           4 :     COPY_NODE_FIELD(partitionClause);
    2679           4 :     COPY_NODE_FIELD(orderClause);
    2680           4 :     COPY_SCALAR_FIELD(frameOptions);
    2681           4 :     COPY_NODE_FIELD(startOffset);
    2682           4 :     COPY_NODE_FIELD(endOffset);
    2683           4 :     COPY_LOCATION_FIELD(location);
    2684             : 
    2685           4 :     return newnode;
    2686             : }
    2687             : 
    2688             : static RangeSubselect *
    2689          58 : _copyRangeSubselect(const RangeSubselect *from)
    2690             : {
    2691          58 :     RangeSubselect *newnode = makeNode(RangeSubselect);
    2692             : 
    2693          58 :     COPY_SCALAR_FIELD(lateral);
    2694          58 :     COPY_NODE_FIELD(subquery);
    2695          58 :     COPY_NODE_FIELD(alias);
    2696             : 
    2697          58 :     return newnode;
    2698             : }
    2699             : 
    2700             : static RangeFunction *
    2701         101 : _copyRangeFunction(const RangeFunction *from)
    2702             : {
    2703         101 :     RangeFunction *newnode = makeNode(RangeFunction);
    2704             : 
    2705         101 :     COPY_SCALAR_FIELD(lateral);
    2706         101 :     COPY_SCALAR_FIELD(ordinality);
    2707         101 :     COPY_SCALAR_FIELD(is_rowsfrom);
    2708         101 :     COPY_NODE_FIELD(functions);
    2709         101 :     COPY_NODE_FIELD(alias);
    2710         101 :     COPY_NODE_FIELD(coldeflist);
    2711             : 
    2712         101 :     return newnode;
    2713             : }
    2714             : 
    2715             : static RangeTableSample *
    2716           2 : _copyRangeTableSample(const RangeTableSample *from)
    2717             : {
    2718           2 :     RangeTableSample *newnode = makeNode(RangeTableSample);
    2719             : 
    2720           2 :     COPY_NODE_FIELD(relation);
    2721           2 :     COPY_NODE_FIELD(method);
    2722           2 :     COPY_NODE_FIELD(args);
    2723           2 :     COPY_NODE_FIELD(repeatable);
    2724           2 :     COPY_LOCATION_FIELD(location);
    2725             : 
    2726           2 :     return newnode;
    2727             : }
    2728             : 
    2729             : static RangeTableFunc *
    2730           4 : _copyRangeTableFunc(const RangeTableFunc *from)
    2731             : {
    2732           4 :     RangeTableFunc *newnode = makeNode(RangeTableFunc);
    2733             : 
    2734           4 :     COPY_SCALAR_FIELD(lateral);
    2735           4 :     COPY_NODE_FIELD(docexpr);
    2736           4 :     COPY_NODE_FIELD(rowexpr);
    2737           4 :     COPY_NODE_FIELD(namespaces);
    2738           4 :     COPY_NODE_FIELD(columns);
    2739           4 :     COPY_NODE_FIELD(alias);
    2740           4 :     COPY_LOCATION_FIELD(location);
    2741             : 
    2742           4 :     return newnode;
    2743             : }
    2744             : 
    2745             : static RangeTableFuncCol *
    2746          25 : _copyRangeTableFuncCol(const RangeTableFuncCol *from)
    2747             : {
    2748          25 :     RangeTableFuncCol *newnode = makeNode(RangeTableFuncCol);
    2749             : 
    2750          25 :     COPY_STRING_FIELD(colname);
    2751          25 :     COPY_NODE_FIELD(typeName);
    2752          25 :     COPY_SCALAR_FIELD(for_ordinality);
    2753          25 :     COPY_SCALAR_FIELD(is_not_null);
    2754          25 :     COPY_NODE_FIELD(colexpr);
    2755          25 :     COPY_NODE_FIELD(coldefexpr);
    2756          25 :     COPY_LOCATION_FIELD(location);
    2757             : 
    2758          25 :     return newnode;
    2759             : }
    2760             : 
    2761             : static TypeCast *
    2762        1619 : _copyTypeCast(const TypeCast *from)
    2763             : {
    2764        1619 :     TypeCast   *newnode = makeNode(TypeCast);
    2765             : 
    2766        1619 :     COPY_NODE_FIELD(arg);
    2767        1619 :     COPY_NODE_FIELD(typeName);
    2768        1619 :     COPY_LOCATION_FIELD(location);
    2769             : 
    2770        1619 :     return newnode;
    2771             : }
    2772             : 
    2773             : static CollateClause *
    2774          26 : _copyCollateClause(const CollateClause *from)
    2775             : {
    2776          26 :     CollateClause *newnode = makeNode(CollateClause);
    2777             : 
    2778          26 :     COPY_NODE_FIELD(arg);
    2779          26 :     COPY_NODE_FIELD(collname);
    2780          26 :     COPY_LOCATION_FIELD(location);
    2781             : 
    2782          26 :     return newnode;
    2783             : }
    2784             : 
    2785             : static IndexElem *
    2786         809 : _copyIndexElem(const IndexElem *from)
    2787             : {
    2788         809 :     IndexElem  *newnode = makeNode(IndexElem);
    2789             : 
    2790         809 :     COPY_STRING_FIELD(name);
    2791         809 :     COPY_NODE_FIELD(expr);
    2792         809 :     COPY_STRING_FIELD(indexcolname);
    2793         809 :     COPY_NODE_FIELD(collation);
    2794         809 :     COPY_NODE_FIELD(opclass);
    2795         809 :     COPY_SCALAR_FIELD(ordering);
    2796         809 :     COPY_SCALAR_FIELD(nulls_ordering);
    2797             : 
    2798         809 :     return newnode;
    2799             : }
    2800             : 
    2801             : static ColumnDef *
    2802        3097 : _copyColumnDef(const ColumnDef *from)
    2803             : {
    2804        3097 :     ColumnDef  *newnode = makeNode(ColumnDef);
    2805             : 
    2806        3097 :     COPY_STRING_FIELD(colname);
    2807        3097 :     COPY_NODE_FIELD(typeName);
    2808        3097 :     COPY_SCALAR_FIELD(inhcount);
    2809        3097 :     COPY_SCALAR_FIELD(is_local);
    2810        3097 :     COPY_SCALAR_FIELD(is_not_null);
    2811        3097 :     COPY_SCALAR_FIELD(is_from_type);
    2812        3097 :     COPY_SCALAR_FIELD(is_from_parent);
    2813        3097 :     COPY_SCALAR_FIELD(storage);
    2814        3097 :     COPY_NODE_FIELD(raw_default);
    2815        3097 :     COPY_NODE_FIELD(cooked_default);
    2816        3097 :     COPY_SCALAR_FIELD(identity);
    2817        3097 :     COPY_NODE_FIELD(collClause);
    2818        3097 :     COPY_SCALAR_FIELD(collOid);
    2819        3097 :     COPY_NODE_FIELD(constraints);
    2820        3097 :     COPY_NODE_FIELD(fdwoptions);
    2821        3097 :     COPY_LOCATION_FIELD(location);
    2822             : 
    2823        3097 :     return newnode;
    2824             : }
    2825             : 
    2826             : static Constraint *
    2827        1283 : _copyConstraint(const Constraint *from)
    2828             : {
    2829        1283 :     Constraint *newnode = makeNode(Constraint);
    2830             : 
    2831        1283 :     COPY_SCALAR_FIELD(contype);
    2832        1283 :     COPY_STRING_FIELD(conname);
    2833        1283 :     COPY_SCALAR_FIELD(deferrable);
    2834        1283 :     COPY_SCALAR_FIELD(initdeferred);
    2835        1283 :     COPY_LOCATION_FIELD(location);
    2836        1283 :     COPY_SCALAR_FIELD(is_no_inherit);
    2837        1283 :     COPY_NODE_FIELD(raw_expr);
    2838        1283 :     COPY_STRING_FIELD(cooked_expr);
    2839        1283 :     COPY_SCALAR_FIELD(generated_when);
    2840        1283 :     COPY_NODE_FIELD(keys);
    2841        1283 :     COPY_NODE_FIELD(exclusions);
    2842        1283 :     COPY_NODE_FIELD(options);
    2843        1283 :     COPY_STRING_FIELD(indexname);
    2844        1283 :     COPY_STRING_FIELD(indexspace);
    2845        1283 :     COPY_STRING_FIELD(access_method);
    2846        1283 :     COPY_NODE_FIELD(where_clause);
    2847        1283 :     COPY_NODE_FIELD(pktable);
    2848        1283 :     COPY_NODE_FIELD(fk_attrs);
    2849        1283 :     COPY_NODE_FIELD(pk_attrs);
    2850        1283 :     COPY_SCALAR_FIELD(fk_matchtype);
    2851        1283 :     COPY_SCALAR_FIELD(fk_upd_action);
    2852        1283 :     COPY_SCALAR_FIELD(fk_del_action);
    2853        1283 :     COPY_NODE_FIELD(old_conpfeqop);
    2854        1283 :     COPY_SCALAR_FIELD(old_pktable_oid);
    2855        1283 :     COPY_SCALAR_FIELD(skip_validation);
    2856        1283 :     COPY_SCALAR_FIELD(initially_valid);
    2857             : 
    2858        1283 :     return newnode;
    2859             : }
    2860             : 
    2861             : static DefElem *
    2862         369 : _copyDefElem(const DefElem *from)
    2863             : {
    2864         369 :     DefElem    *newnode = makeNode(DefElem);
    2865             : 
    2866         369 :     COPY_STRING_FIELD(defnamespace);
    2867         369 :     COPY_STRING_FIELD(defname);
    2868         369 :     COPY_NODE_FIELD(arg);
    2869         369 :     COPY_SCALAR_FIELD(defaction);
    2870         369 :     COPY_LOCATION_FIELD(location);
    2871             : 
    2872         369 :     return newnode;
    2873             : }
    2874             : 
    2875             : static LockingClause *
    2876         114 : _copyLockingClause(const LockingClause *from)
    2877             : {
    2878         114 :     LockingClause *newnode = makeNode(LockingClause);
    2879             : 
    2880         114 :     COPY_NODE_FIELD(lockedRels);
    2881         114 :     COPY_SCALAR_FIELD(strength);
    2882         114 :     COPY_SCALAR_FIELD(waitPolicy);
    2883             : 
    2884         114 :     return newnode;
    2885             : }
    2886             : 
    2887             : static XmlSerialize *
    2888           2 : _copyXmlSerialize(const XmlSerialize *from)
    2889             : {
    2890           2 :     XmlSerialize *newnode = makeNode(XmlSerialize);
    2891             : 
    2892           2 :     COPY_SCALAR_FIELD(xmloption);
    2893           2 :     COPY_NODE_FIELD(expr);
    2894           2 :     COPY_NODE_FIELD(typeName);
    2895           2 :     COPY_LOCATION_FIELD(location);
    2896             : 
    2897           2 :     return newnode;
    2898             : }
    2899             : 
    2900             : static RoleSpec *
    2901          38 : _copyRoleSpec(const RoleSpec *from)
    2902             : {
    2903          38 :     RoleSpec   *newnode = makeNode(RoleSpec);
    2904             : 
    2905          38 :     COPY_SCALAR_FIELD(roletype);
    2906          38 :     COPY_STRING_FIELD(rolename);
    2907          38 :     COPY_LOCATION_FIELD(location);
    2908             : 
    2909          38 :     return newnode;
    2910             : }
    2911             : 
    2912             : static TriggerTransition *
    2913           0 : _copyTriggerTransition(const TriggerTransition *from)
    2914             : {
    2915           0 :     TriggerTransition *newnode = makeNode(TriggerTransition);
    2916             : 
    2917           0 :     COPY_STRING_FIELD(name);
    2918           0 :     COPY_SCALAR_FIELD(isNew);
    2919           0 :     COPY_SCALAR_FIELD(isTable);
    2920             : 
    2921           0 :     return newnode;
    2922             : }
    2923             : 
    2924             : static Query *
    2925       18820 : _copyQuery(const Query *from)
    2926             : {
    2927       18820 :     Query      *newnode = makeNode(Query);
    2928             : 
    2929       18820 :     COPY_SCALAR_FIELD(commandType);
    2930       18820 :     COPY_SCALAR_FIELD(querySource);
    2931       18820 :     COPY_SCALAR_FIELD(queryId);
    2932       18820 :     COPY_SCALAR_FIELD(canSetTag);
    2933       18820 :     COPY_NODE_FIELD(utilityStmt);
    2934       18820 :     COPY_SCALAR_FIELD(resultRelation);
    2935       18820 :     COPY_SCALAR_FIELD(hasAggs);
    2936       18820 :     COPY_SCALAR_FIELD(hasWindowFuncs);
    2937       18820 :     COPY_SCALAR_FIELD(hasTargetSRFs);
    2938       18820 :     COPY_SCALAR_FIELD(hasSubLinks);
    2939       18820 :     COPY_SCALAR_FIELD(hasDistinctOn);
    2940       18820 :     COPY_SCALAR_FIELD(hasRecursive);
    2941       18820 :     COPY_SCALAR_FIELD(hasModifyingCTE);
    2942       18820 :     COPY_SCALAR_FIELD(hasForUpdate);
    2943       18820 :     COPY_SCALAR_FIELD(hasRowSecurity);
    2944       18820 :     COPY_NODE_FIELD(cteList);
    2945       18820 :     COPY_NODE_FIELD(rtable);
    2946       18820 :     COPY_NODE_FIELD(jointree);
    2947       18820 :     COPY_NODE_FIELD(targetList);
    2948       18820 :     COPY_SCALAR_FIELD(override);
    2949       18820 :     COPY_NODE_FIELD(onConflict);
    2950       18820 :     COPY_NODE_FIELD(returningList);
    2951       18820 :     COPY_NODE_FIELD(groupClause);
    2952       18820 :     COPY_NODE_FIELD(groupingSets);
    2953       18820 :     COPY_NODE_FIELD(havingQual);
    2954       18820 :     COPY_NODE_FIELD(windowClause);
    2955       18820 :     COPY_NODE_FIELD(distinctClause);
    2956       18820 :     COPY_NODE_FIELD(sortClause);
    2957       18820 :     COPY_NODE_FIELD(limitOffset);
    2958       18820 :     COPY_NODE_FIELD(limitCount);
    2959       18820 :     COPY_NODE_FIELD(rowMarks);
    2960       18820 :     COPY_NODE_FIELD(setOperations);
    2961       18820 :     COPY_NODE_FIELD(constraintDeps);
    2962       18820 :     COPY_NODE_FIELD(withCheckOptions);
    2963       18820 :     COPY_LOCATION_FIELD(stmt_location);
    2964       18820 :     COPY_LOCATION_FIELD(stmt_len);
    2965             : 
    2966       18820 :     return newnode;
    2967             : }
    2968             : 
    2969             : static RawStmt *
    2970        3012 : _copyRawStmt(const RawStmt *from)
    2971             : {
    2972        3012 :     RawStmt    *newnode = makeNode(RawStmt);
    2973             : 
    2974        3012 :     COPY_NODE_FIELD(stmt);
    2975        3012 :     COPY_LOCATION_FIELD(stmt_location);
    2976        3012 :     COPY_LOCATION_FIELD(stmt_len);
    2977             : 
    2978        3012 :     return newnode;
    2979             : }
    2980             : 
    2981             : static InsertStmt *
    2982         108 : _copyInsertStmt(const InsertStmt *from)
    2983             : {
    2984         108 :     InsertStmt *newnode = makeNode(InsertStmt);
    2985             : 
    2986         108 :     COPY_NODE_FIELD(relation);
    2987         108 :     COPY_NODE_FIELD(cols);
    2988         108 :     COPY_NODE_FIELD(selectStmt);
    2989         108 :     COPY_NODE_FIELD(onConflictClause);
    2990         108 :     COPY_NODE_FIELD(returningList);
    2991         108 :     COPY_NODE_FIELD(withClause);
    2992         108 :     COPY_SCALAR_FIELD(override);
    2993             : 
    2994         108 :     return newnode;
    2995             : }
    2996             : 
    2997             : static DeleteStmt *
    2998          43 : _copyDeleteStmt(const DeleteStmt *from)
    2999             : {
    3000          43 :     DeleteStmt *newnode = makeNode(DeleteStmt);
    3001             : 
    3002          43 :     COPY_NODE_FIELD(relation);
    3003          43 :     COPY_NODE_FIELD(usingClause);
    3004          43 :     COPY_NODE_FIELD(whereClause);
    3005          43 :     COPY_NODE_FIELD(returningList);
    3006          43 :     COPY_NODE_FIELD(withClause);
    3007             : 
    3008          43 :     return newnode;
    3009             : }
    3010             : 
    3011             : static UpdateStmt *
    3012          80 : _copyUpdateStmt(const UpdateStmt *from)
    3013             : {
    3014          80 :     UpdateStmt *newnode = makeNode(UpdateStmt);
    3015             : 
    3016          80 :     COPY_NODE_FIELD(relation);
    3017          80 :     COPY_NODE_FIELD(targetList);
    3018          80 :     COPY_NODE_FIELD(whereClause);
    3019          80 :     COPY_NODE_FIELD(fromClause);
    3020          80 :     COPY_NODE_FIELD(returningList);
    3021          80 :     COPY_NODE_FIELD(withClause);
    3022             : 
    3023          80 :     return newnode;
    3024             : }
    3025             : 
    3026             : static SelectStmt *
    3027        3740 : _copySelectStmt(const SelectStmt *from)
    3028             : {
    3029        3740 :     SelectStmt *newnode = makeNode(SelectStmt);
    3030             : 
    3031        3740 :     COPY_NODE_FIELD(distinctClause);
    3032        3740 :     COPY_NODE_FIELD(intoClause);
    3033        3740 :     COPY_NODE_FIELD(targetList);
    3034        3740 :     COPY_NODE_FIELD(fromClause);
    3035        3740 :     COPY_NODE_FIELD(whereClause);
    3036        3740 :     COPY_NODE_FIELD(groupClause);
    3037        3740 :     COPY_NODE_FIELD(havingClause);
    3038        3740 :     COPY_NODE_FIELD(windowClause);
    3039        3740 :     COPY_NODE_FIELD(valuesLists);
    3040        3740 :     COPY_NODE_FIELD(sortClause);
    3041        3740 :     COPY_NODE_FIELD(limitOffset);
    3042        3740 :     COPY_NODE_FIELD(limitCount);
    3043        3740 :     COPY_NODE_FIELD(lockingClause);
    3044        3740 :     COPY_NODE_FIELD(withClause);
    3045        3740 :     COPY_SCALAR_FIELD(op);
    3046        3740 :     COPY_SCALAR_FIELD(all);
    3047        3740 :     COPY_NODE_FIELD(larg);
    3048        3740 :     COPY_NODE_FIELD(rarg);
    3049             : 
    3050        3740 :     return newnode;
    3051             : }
    3052             : 
    3053             : static SetOperationStmt *
    3054         310 : _copySetOperationStmt(const SetOperationStmt *from)
    3055             : {
    3056         310 :     SetOperationStmt *newnode = makeNode(SetOperationStmt);
    3057             : 
    3058         310 :     COPY_SCALAR_FIELD(op);
    3059         310 :     COPY_SCALAR_FIELD(all);
    3060         310 :     COPY_NODE_FIELD(larg);
    3061         310 :     COPY_NODE_FIELD(rarg);
    3062         310 :     COPY_NODE_FIELD(colTypes);
    3063         310 :     COPY_NODE_FIELD(colTypmods);
    3064         310 :     COPY_NODE_FIELD(colCollations);
    3065         310 :     COPY_NODE_FIELD(groupClauses);
    3066             : 
    3067         310 :     return newnode;
    3068             : }
    3069             : 
    3070             : static AlterTableStmt *
    3071        1029 : _copyAlterTableStmt(const AlterTableStmt *from)
    3072             : {
    3073        1029 :     AlterTableStmt *newnode = makeNode(AlterTableStmt);
    3074             : 
    3075        1029 :     COPY_NODE_FIELD(relation);
    3076        1029 :     COPY_NODE_FIELD(cmds);
    3077        1029 :     COPY_SCALAR_FIELD(relkind);
    3078        1029 :     COPY_SCALAR_FIELD(missing_ok);
    3079             : 
    3080        1029 :     return newnode;
    3081             : }
    3082             : 
    3083             : static AlterTableCmd *
    3084        2203 : _copyAlterTableCmd(const AlterTableCmd *from)
    3085             : {
    3086        2203 :     AlterTableCmd *newnode = makeNode(AlterTableCmd);
    3087             : 
    3088        2203 :     COPY_SCALAR_FIELD(subtype);
    3089        2203 :     COPY_STRING_FIELD(name);
    3090        2203 :     COPY_NODE_FIELD(newowner);
    3091        2203 :     COPY_NODE_FIELD(def);
    3092        2203 :     COPY_SCALAR_FIELD(behavior);
    3093        2203 :     COPY_SCALAR_FIELD(missing_ok);
    3094             : 
    3095        2203 :     return newnode;
    3096             : }
    3097             : 
    3098             : static AlterCollationStmt *
    3099           0 : _copyAlterCollationStmt(const AlterCollationStmt *from)
    3100             : {
    3101           0 :     AlterCollationStmt *newnode = makeNode(AlterCollationStmt);
    3102             : 
    3103           0 :     COPY_NODE_FIELD(collname);
    3104             : 
    3105           0 :     return newnode;
    3106             : }
    3107             : 
    3108             : static AlterDomainStmt *
    3109           0 : _copyAlterDomainStmt(const AlterDomainStmt *from)
    3110             : {
    3111           0 :     AlterDomainStmt *newnode = makeNode(AlterDomainStmt);
    3112             : 
    3113           0 :     COPY_SCALAR_FIELD(subtype);
    3114           0 :     COPY_NODE_FIELD(typeName);
    3115           0 :     COPY_STRING_FIELD(name);
    3116           0 :     COPY_NODE_FIELD(def);
    3117           0 :     COPY_SCALAR_FIELD(behavior);
    3118           0 :     COPY_SCALAR_FIELD(missing_ok);
    3119             : 
    3120           0 :     return newnode;
    3121             : }
    3122             : 
    3123             : static GrantStmt *
    3124           1 : _copyGrantStmt(const GrantStmt *from)
    3125             : {
    3126           1 :     GrantStmt  *newnode = makeNode(GrantStmt);
    3127             : 
    3128           1 :     COPY_SCALAR_FIELD(is_grant);
    3129           1 :     COPY_SCALAR_FIELD(targtype);
    3130           1 :     COPY_SCALAR_FIELD(objtype);
    3131           1 :     COPY_NODE_FIELD(objects);
    3132           1 :     COPY_NODE_FIELD(privileges);
    3133           1 :     COPY_NODE_FIELD(grantees);
    3134           1 :     COPY_SCALAR_FIELD(grant_option);
    3135           1 :     COPY_SCALAR_FIELD(behavior);
    3136             : 
    3137           1 :     return newnode;
    3138             : }
    3139             : 
    3140             : static ObjectWithArgs *
    3141           0 : _copyObjectWithArgs(const ObjectWithArgs *from)
    3142             : {
    3143           0 :     ObjectWithArgs *newnode = makeNode(ObjectWithArgs);
    3144             : 
    3145           0 :     COPY_NODE_FIELD(objname);
    3146           0 :     COPY_NODE_FIELD(objargs);
    3147           0 :     COPY_SCALAR_FIELD(args_unspecified);
    3148             : 
    3149           0 :     return newnode;
    3150             : }
    3151             : 
    3152             : static AccessPriv *
    3153           1 : _copyAccessPriv(const AccessPriv *from)
    3154             : {
    3155           1 :     AccessPriv *newnode = makeNode(AccessPriv);
    3156             : 
    3157           1 :     COPY_STRING_FIELD(priv_name);
    3158           1 :     COPY_NODE_FIELD(cols);
    3159             : 
    3160           1 :     return newnode;
    3161             : }
    3162             : 
    3163             : static GrantRoleStmt *
    3164           0 : _copyGrantRoleStmt(const GrantRoleStmt *from)
    3165             : {
    3166           0 :     GrantRoleStmt *newnode = makeNode(GrantRoleStmt);
    3167             : 
    3168           0 :     COPY_NODE_FIELD(granted_roles);
    3169           0 :     COPY_NODE_FIELD(grantee_roles);
    3170           0 :     COPY_SCALAR_FIELD(is_grant);
    3171           0 :     COPY_SCALAR_FIELD(admin_opt);
    3172           0 :     COPY_NODE_FIELD(grantor);
    3173           0 :     COPY_SCALAR_FIELD(behavior);
    3174             : 
    3175           0 :     return newnode;
    3176             : }
    3177             : 
    3178             : static AlterDefaultPrivilegesStmt *
    3179           1 : _copyAlterDefaultPrivilegesStmt(const AlterDefaultPrivilegesStmt *from)
    3180             : {
    3181           1 :     AlterDefaultPrivilegesStmt *newnode = makeNode(AlterDefaultPrivilegesStmt);
    3182             : 
    3183           1 :     COPY_NODE_FIELD(options);
    3184           1 :     COPY_NODE_FIELD(action);
    3185             : 
    3186           1 :     return newnode;
    3187             : }
    3188             : 
    3189             : static DeclareCursorStmt *
    3190           4 : _copyDeclareCursorStmt(const DeclareCursorStmt *from)
    3191             : {
    3192           4 :     DeclareCursorStmt *newnode = makeNode(DeclareCursorStmt);
    3193             : 
    3194           4 :     COPY_STRING_FIELD(portalname);
    3195           4 :     COPY_SCALAR_FIELD(options);
    3196           4 :     COPY_NODE_FIELD(query);
    3197             : 
    3198           4 :     return newnode;
    3199             : }
    3200             : 
    3201             : static ClosePortalStmt *
    3202           0 : _copyClosePortalStmt(const ClosePortalStmt *from)
    3203             : {
    3204           0 :     ClosePortalStmt *newnode = makeNode(ClosePortalStmt);
    3205             : 
    3206           0 :     COPY_STRING_FIELD(portalname);
    3207             : 
    3208           0 :     return newnode;
    3209             : }
    3210             : 
    3211             : static ClusterStmt *
    3212           0 : _copyClusterStmt(const ClusterStmt *from)
    3213             : {
    3214           0 :     ClusterStmt *newnode = makeNode(ClusterStmt);
    3215             : 
    3216           0 :     COPY_NODE_FIELD(relation);
    3217           0 :     COPY_STRING_FIELD(indexname);
    3218           0 :     COPY_SCALAR_FIELD(verbose);
    3219             : 
    3220           0 :     return newnode;
    3221             : }
    3222             : 
    3223             : static CopyStmt *
    3224           0 : _copyCopyStmt(const CopyStmt *from)
    3225             : {
    3226           0 :     CopyStmt   *newnode = makeNode(CopyStmt);
    3227             : 
    3228           0 :     COPY_NODE_FIELD(relation);
    3229           0 :     COPY_NODE_FIELD(query);
    3230           0 :     COPY_NODE_FIELD(attlist);
    3231           0 :     COPY_SCALAR_FIELD(is_from);
    3232           0 :     COPY_SCALAR_FIELD(is_program);
    3233           0 :     COPY_STRING_FIELD(filename);
    3234           0 :     COPY_NODE_FIELD(options);
    3235             : 
    3236           0 :     return newnode;
    3237             : }
    3238             : 
    3239             : /*
    3240             :  * CopyCreateStmtFields
    3241             :  *
    3242             :  *      This function copies the fields of the CreateStmt node.  It is used by
    3243             :  *      copy functions for classes which inherit from CreateStmt.
    3244             :  */
    3245             : static void
    3246        1535 : CopyCreateStmtFields(const CreateStmt *from, CreateStmt *newnode)
    3247             : {
    3248        1535 :     COPY_NODE_FIELD(relation);
    3249        1535 :     COPY_NODE_FIELD(tableElts);
    3250        1535 :     COPY_NODE_FIELD(inhRelations);
    3251        1535 :     COPY_NODE_FIELD(partspec);
    3252        1535 :     COPY_NODE_FIELD(partbound);
    3253        1535 :     COPY_NODE_FIELD(ofTypename);
    3254        1535 :     COPY_NODE_FIELD(constraints);
    3255        1535 :     COPY_NODE_FIELD(options);
    3256        1535 :     COPY_SCALAR_FIELD(oncommit);
    3257        1535 :     COPY_STRING_FIELD(tablespacename);
    3258        1535 :     COPY_SCALAR_FIELD(if_not_exists);
    3259        1535 : }
    3260             : 
    3261             : static CreateStmt *
    3262        1521 : _copyCreateStmt(const CreateStmt *from)
    3263             : {
    3264        1521 :     CreateStmt *newnode = makeNode(CreateStmt);
    3265             : 
    3266        1521 :     CopyCreateStmtFields(from, newnode);
    3267             : 
    3268        1521 :     return newnode;
    3269             : }
    3270             : 
    3271             : static TableLikeClause *
    3272          50 : _copyTableLikeClause(const TableLikeClause *from)
    3273             : {
    3274          50 :     TableLikeClause *newnode = makeNode(TableLikeClause);
    3275             : 
    3276          50 :     COPY_NODE_FIELD(relation);
    3277          50 :     COPY_SCALAR_FIELD(options);
    3278             : 
    3279          50 :     return newnode;
    3280             : }
    3281             : 
    3282             : static DefineStmt *
    3283           0 : _copyDefineStmt(const DefineStmt *from)
    3284             : {
    3285           0 :     DefineStmt *newnode = makeNode(DefineStmt);
    3286             : 
    3287           0 :     COPY_SCALAR_FIELD(kind);
    3288           0 :     COPY_SCALAR_FIELD(oldstyle);
    3289           0 :     COPY_NODE_FIELD(defnames);
    3290           0 :     COPY_NODE_FIELD(args);
    3291           0 :     COPY_NODE_FIELD(definition);
    3292           0 :     COPY_SCALAR_FIELD(if_not_exists);
    3293             : 
    3294           0 :     return newnode;
    3295             : }
    3296             : 
    3297             : static DropStmt *
    3298           8 : _copyDropStmt(const DropStmt *from)
    3299             : {
    3300           8 :     DropStmt   *newnode = makeNode(DropStmt);
    3301             : 
    3302           8 :     COPY_NODE_FIELD(objects);
    3303           8 :     COPY_SCALAR_FIELD(removeType);
    3304           8 :     COPY_SCALAR_FIELD(behavior);
    3305           8 :     COPY_SCALAR_FIELD(missing_ok);
    3306           8 :     COPY_SCALAR_FIELD(concurrent);
    3307             : 
    3308           8 :     return newnode;
    3309             : }
    3310             : 
    3311             : static TruncateStmt *
    3312           4 : _copyTruncateStmt(const TruncateStmt *from)
    3313             : {
    3314           4 :     TruncateStmt *newnode = makeNode(TruncateStmt);
    3315             : 
    3316           4 :     COPY_NODE_FIELD(relations);
    3317           4 :     COPY_SCALAR_FIELD(restart_seqs);
    3318           4 :     COPY_SCALAR_FIELD(behavior);
    3319             : 
    3320           4 :     return newnode;
    3321             : }
    3322             : 
    3323             : static CommentStmt *
    3324           1 : _copyCommentStmt(const CommentStmt *from)
    3325             : {
    3326           1 :     CommentStmt *newnode = makeNode(CommentStmt);
    3327             : 
    3328           1 :     COPY_SCALAR_FIELD(objtype);
    3329           1 :     COPY_NODE_FIELD(object);
    3330           1 :     COPY_STRING_FIELD(comment);
    3331             : 
    3332           1 :     return newnode;
    3333             : }
    3334             : 
    3335             : static SecLabelStmt *
    3336           0 : _copySecLabelStmt(const SecLabelStmt *from)
    3337             : {
    3338           0 :     SecLabelStmt *newnode = makeNode(SecLabelStmt);
    3339             : 
    3340           0 :     COPY_SCALAR_FIELD(objtype);
    3341           0 :     COPY_NODE_FIELD(object);
    3342           0 :     COPY_STRING_FIELD(provider);
    3343           0 :     COPY_STRING_FIELD(label);
    3344             : 
    3345           0 :     return newnode;
    3346             : }
    3347             : 
    3348             : static FetchStmt *
    3349           0 : _copyFetchStmt(const FetchStmt *from)
    3350             : {
    3351           0 :     FetchStmt  *newnode = makeNode(FetchStmt);
    3352             : 
    3353           0 :     COPY_SCALAR_FIELD(direction);
    3354           0 :     COPY_SCALAR_FIELD(howMany);
    3355           0 :     COPY_STRING_FIELD(portalname);
    3356           0 :     COPY_SCALAR_FIELD(ismove);
    3357             : 
    3358           0 :     return newnode;
    3359             : }
    3360             : 
    3361             : static IndexStmt *
    3362         639 : _copyIndexStmt(const IndexStmt *from)
    3363             : {
    3364         639 :     IndexStmt  *newnode = makeNode(IndexStmt);
    3365             : 
    3366         639 :     COPY_STRING_FIELD(idxname);
    3367         639 :     COPY_NODE_FIELD(relation);
    3368         639 :     COPY_STRING_FIELD(accessMethod);
    3369         639 :     COPY_STRING_FIELD(tableSpace);
    3370         639 :     COPY_NODE_FIELD(indexParams);
    3371         639 :     COPY_NODE_FIELD(options);
    3372         639 :     COPY_NODE_FIELD(whereClause);
    3373         639 :     COPY_NODE_FIELD(excludeOpNames);
    3374         639 :     COPY_STRING_FIELD(idxcomment);
    3375         639 :     COPY_SCALAR_FIELD(indexOid);
    3376         639 :     COPY_SCALAR_FIELD(oldNode);
    3377         639 :     COPY_SCALAR_FIELD(unique);
    3378         639 :     COPY_SCALAR_FIELD(primary);
    3379         639 :     COPY_SCALAR_FIELD(isconstraint);
    3380         639 :     COPY_SCALAR_FIELD(deferrable);
    3381         639 :     COPY_SCALAR_FIELD(initdeferred);
    3382         639 :     COPY_SCALAR_FIELD(transformed);
    3383         639 :     COPY_SCALAR_FIELD(concurrent);
    3384         639 :     COPY_SCALAR_FIELD(if_not_exists);
    3385             : 
    3386         639 :     return newnode;
    3387             : }
    3388             : 
    3389             : static CreateStatsStmt *
    3390           0 : _copyCreateStatsStmt(const CreateStatsStmt *from)
    3391             : {
    3392           0 :     CreateStatsStmt *newnode = makeNode(CreateStatsStmt);
    3393             : 
    3394           0 :     COPY_NODE_FIELD(defnames);
    3395           0 :     COPY_NODE_FIELD(stat_types);
    3396           0 :     COPY_NODE_FIELD(exprs);
    3397           0 :     COPY_NODE_FIELD(relations);
    3398           0 :     COPY_SCALAR_FIELD(if_not_exists);
    3399             : 
    3400           0 :     return newnode;
    3401             : }
    3402             : 
    3403             : static CreateFunctionStmt *
    3404           3 : _copyCreateFunctionStmt(const CreateFunctionStmt *from)
    3405             : {
    3406           3 :     CreateFunctionStmt *newnode = makeNode(CreateFunctionStmt);
    3407             : 
    3408           3 :     COPY_SCALAR_FIELD(replace);
    3409           3 :     COPY_NODE_FIELD(funcname);
    3410           3 :     COPY_NODE_FIELD(parameters);
    3411           3 :     COPY_NODE_FIELD(returnType);
    3412           3 :     COPY_NODE_FIELD(options);
    3413           3 :     COPY_NODE_FIELD(withClause);
    3414             : 
    3415           3 :     return newnode;
    3416             : }
    3417             : 
    3418             : static FunctionParameter *
    3419           0 : _copyFunctionParameter(const FunctionParameter *from)
    3420             : {
    3421           0 :     FunctionParameter *newnode = makeNode(FunctionParameter);
    3422             : 
    3423           0 :     COPY_STRING_FIELD(name);
    3424           0 :     COPY_NODE_FIELD(argType);
    3425           0 :     COPY_SCALAR_FIELD(mode);
    3426           0 :     COPY_NODE_FIELD(defexpr);
    3427             : 
    3428           0 :     return newnode;
    3429             : }
    3430             : 
    3431             : static AlterFunctionStmt *
    3432           0 : _copyAlterFunctionStmt(const AlterFunctionStmt *from)
    3433             : {
    3434           0 :     AlterFunctionStmt *newnode = makeNode(AlterFunctionStmt);
    3435             : 
    3436           0 :     COPY_NODE_FIELD(func);
    3437           0 :     COPY_NODE_FIELD(actions);
    3438             : 
    3439           0 :     return newnode;
    3440             : }
    3441             : 
    3442             : static DoStmt *
    3443           0 : _copyDoStmt(const DoStmt *from)
    3444             : {
    3445           0 :     DoStmt     *newnode = makeNode(DoStmt);
    3446             : 
    3447           0 :     COPY_NODE_FIELD(args);
    3448             : 
    3449           0 :     return newnode;
    3450             : }
    3451             : 
    3452             : static RenameStmt *
    3453           1 : _copyRenameStmt(const RenameStmt *from)
    3454             : {
    3455           1 :     RenameStmt *newnode = makeNode(RenameStmt);
    3456             : 
    3457           1 :     COPY_SCALAR_FIELD(renameType);
    3458           1 :     COPY_SCALAR_FIELD(relationType);
    3459           1 :     COPY_NODE_FIELD(relation);
    3460           1 :     COPY_NODE_FIELD(object);
    3461           1 :     COPY_STRING_FIELD(subname);
    3462           1 :     COPY_STRING_FIELD(newname);
    3463           1 :     COPY_SCALAR_FIELD(behavior);
    3464           1 :     COPY_SCALAR_FIELD(missing_ok);
    3465             : 
    3466           1 :     return newnode;
    3467             : }
    3468             : 
    3469             : static AlterObjectDependsStmt *
    3470           0 : _copyAlterObjectDependsStmt(const AlterObjectDependsStmt *from)
    3471             : {
    3472           0 :     AlterObjectDependsStmt *newnode = makeNode(AlterObjectDependsStmt);
    3473             : 
    3474           0 :     COPY_SCALAR_FIELD(objectType);
    3475           0 :     COPY_NODE_FIELD(relation);
    3476           0 :     COPY_NODE_FIELD(object);
    3477           0 :     COPY_NODE_FIELD(extname);
    3478             : 
    3479           0 :     return newnode;
    3480             : }
    3481             : 
    3482             : static AlterObjectSchemaStmt *
    3483           0 : _copyAlterObjectSchemaStmt(const AlterObjectSchemaStmt *from)
    3484             : {
    3485           0 :     AlterObjectSchemaStmt *newnode = makeNode(AlterObjectSchemaStmt);
    3486             : 
    3487           0 :     COPY_SCALAR_FIELD(objectType);
    3488           0 :     COPY_NODE_FIELD(relation);
    3489           0 :     COPY_NODE_FIELD(object);
    3490           0 :     COPY_STRING_FIELD(newschema);
    3491           0 :     COPY_SCALAR_FIELD(missing_ok);
    3492             : 
    3493           0 :     return newnode;
    3494             : }
    3495             : 
    3496             : static AlterOwnerStmt *
    3497           0 : _copyAlterOwnerStmt(const AlterOwnerStmt *from)
    3498             : {
    3499           0 :     AlterOwnerStmt *newnode = makeNode(AlterOwnerStmt);
    3500             : 
    3501           0 :     COPY_SCALAR_FIELD(objectType);
    3502           0 :     COPY_NODE_FIELD(relation);
    3503           0 :     COPY_NODE_FIELD(object);
    3504           0 :     COPY_NODE_FIELD(newowner);
    3505             : 
    3506           0 :     return newnode;
    3507             : }
    3508             : 
    3509             : static AlterOperatorStmt *
    3510           0 : _copyAlterOperatorStmt(const AlterOperatorStmt *from)
    3511             : {
    3512           0 :     AlterOperatorStmt *newnode = makeNode(AlterOperatorStmt);
    3513             : 
    3514           0 :     COPY_NODE_FIELD(opername);
    3515           0 :     COPY_NODE_FIELD(options);
    3516             : 
    3517           0 :     return newnode;
    3518             : }
    3519             : 
    3520             : static RuleStmt *
    3521           0 : _copyRuleStmt(const RuleStmt *from)
    3522             : {
    3523           0 :     RuleStmt   *newnode = makeNode(RuleStmt);
    3524             : 
    3525           0 :     COPY_NODE_FIELD(relation);
    3526           0 :     COPY_STRING_FIELD(rulename);
    3527           0 :     COPY_NODE_FIELD(whereClause);
    3528           0 :     COPY_SCALAR_FIELD(event);
    3529           0 :     COPY_SCALAR_FIELD(instead);
    3530           0 :     COPY_NODE_FIELD(actions);
    3531           0 :     COPY_SCALAR_FIELD(replace);
    3532             : 
    3533           0 :     return newnode;
    3534             : }
    3535             : 
    3536             : static NotifyStmt *
    3537           1 : _copyNotifyStmt(const NotifyStmt *from)
    3538             : {
    3539           1 :     NotifyStmt *newnode = makeNode(NotifyStmt);
    3540             : 
    3541           1 :     COPY_STRING_FIELD(conditionname);
    3542           1 :     COPY_STRING_FIELD(payload);
    3543             : 
    3544           1 :     return newnode;
    3545             : }
    3546             : 
    3547             : static ListenStmt *
    3548           0 : _copyListenStmt(const ListenStmt *from)
    3549             : {
    3550           0 :     ListenStmt *newnode = makeNode(ListenStmt);
    3551             : 
    3552           0 :     COPY_STRING_FIELD(conditionname);
    3553             : 
    3554           0 :     return newnode;
    3555             : }
    3556             : 
    3557             : static UnlistenStmt *
    3558           0 : _copyUnlistenStmt(const UnlistenStmt *from)
    3559             : {
    3560           0 :     UnlistenStmt *newnode = makeNode(UnlistenStmt);
    3561             : 
    3562           0 :     COPY_STRING_FIELD(conditionname);
    3563             : 
    3564           0 :     return newnode;
    3565             : }
    3566             : 
    3567             : static TransactionStmt *
    3568           0 : _copyTransactionStmt(const TransactionStmt *from)
    3569             : {
    3570           0 :     TransactionStmt *newnode = makeNode(TransactionStmt);
    3571             : 
    3572           0 :     COPY_SCALAR_FIELD(kind);
    3573           0 :     COPY_NODE_FIELD(options);
    3574           0 :     COPY_STRING_FIELD(gid);
    3575             : 
    3576           0 :     return newnode;
    3577             : }
    3578             : 
    3579             : static CompositeTypeStmt *
    3580           1 : _copyCompositeTypeStmt(const CompositeTypeStmt *from)
    3581             : {
    3582           1 :     CompositeTypeStmt *newnode = makeNode(CompositeTypeStmt);
    3583             : 
    3584           1 :     COPY_NODE_FIELD(typevar);
    3585           1 :     COPY_NODE_FIELD(coldeflist);
    3586             : 
    3587           1 :     return newnode;
    3588             : }
    3589             : 
    3590             : static CreateEnumStmt *
    3591           0 : _copyCreateEnumStmt(const CreateEnumStmt *from)
    3592             : {
    3593           0 :     CreateEnumStmt *newnode = makeNode(CreateEnumStmt);
    3594             : 
    3595           0 :     COPY_NODE_FIELD(typeName);
    3596           0 :     COPY_NODE_FIELD(vals);
    3597             : 
    3598           0 :     return newnode;
    3599             : }
    3600             : 
    3601             : static CreateRangeStmt *
    3602           0 : _copyCreateRangeStmt(const CreateRangeStmt *from)
    3603             : {
    3604           0 :     CreateRangeStmt *newnode = makeNode(CreateRangeStmt);
    3605             : 
    3606           0 :     COPY_NODE_FIELD(typeName);
    3607           0 :     COPY_NODE_FIELD(params);
    3608             : 
    3609           0 :     return newnode;
    3610             : }
    3611             : 
    3612             : static AlterEnumStmt *
    3613           0 : _copyAlterEnumStmt(const AlterEnumStmt *from)
    3614             : {
    3615           0 :     AlterEnumStmt *newnode = makeNode(AlterEnumStmt);
    3616             : 
    3617           0 :     COPY_NODE_FIELD(typeName);
    3618           0 :     COPY_STRING_FIELD(oldVal);
    3619           0 :     COPY_STRING_FIELD(newVal);
    3620           0 :     COPY_STRING_FIELD(newValNeighbor);
    3621           0 :     COPY_SCALAR_FIELD(newValIsAfter);
    3622           0 :     COPY_SCALAR_FIELD(skipIfNewValExists);
    3623             : 
    3624           0 :     return newnode;
    3625             : }
    3626             : 
    3627             : static ViewStmt *
    3628           4 : _copyViewStmt(const ViewStmt *from)
    3629             : {
    3630           4 :     ViewStmt   *newnode = makeNode(ViewStmt);
    3631             : 
    3632           4 :     COPY_NODE_FIELD(view);
    3633           4 :     COPY_NODE_FIELD(aliases);
    3634           4 :     COPY_NODE_FIELD(query);
    3635           4 :     COPY_SCALAR_FIELD(replace);
    3636           4 :     COPY_NODE_FIELD(options);
    3637           4 :     COPY_SCALAR_FIELD(withCheckOption);
    3638             : 
    3639           4 :     return newnode;
    3640             : }
    3641             : 
    3642             : static LoadStmt *
    3643           0 : _copyLoadStmt(const LoadStmt *from)
    3644             : {
    3645           0 :     LoadStmt   *newnode = makeNode(LoadStmt);
    3646             : 
    3647           0 :     COPY_STRING_FIELD(filename);
    3648             : 
    3649           0 :     return newnode;
    3650             : }
    3651             : 
    3652             : static CreateDomainStmt *
    3653           0 : _copyCreateDomainStmt(const CreateDomainStmt *from)
    3654             : {
    3655           0 :     CreateDomainStmt *newnode = makeNode(CreateDomainStmt);
    3656             : 
    3657           0 :     COPY_NODE_FIELD(domainname);
    3658           0 :     COPY_NODE_FIELD(typeName);
    3659           0 :     COPY_NODE_FIELD(collClause);
    3660           0 :     COPY_NODE_FIELD(constraints);
    3661             : 
    3662           0 :     return newnode;
    3663             : }
    3664             : 
    3665             : static CreateOpClassStmt *
    3666           0 : _copyCreateOpClassStmt(const CreateOpClassStmt *from)
    3667             : {
    3668           0 :     CreateOpClassStmt *newnode = makeNode(CreateOpClassStmt);
    3669             : 
    3670           0 :     COPY_NODE_FIELD(opclassname);
    3671           0 :     COPY_NODE_FIELD(opfamilyname);
    3672           0 :     COPY_STRING_FIELD(amname);
    3673           0 :     COPY_NODE_FIELD(datatype);
    3674           0 :     COPY_NODE_FIELD(items);
    3675           0 :     COPY_SCALAR_FIELD(isDefault);
    3676             : 
    3677           0 :     return newnode;
    3678             : }
    3679             : 
    3680             : static CreateOpClassItem *
    3681           0 : _copyCreateOpClassItem(const CreateOpClassItem *from)
    3682             : {
    3683           0 :     CreateOpClassItem *newnode = makeNode(CreateOpClassItem);
    3684             : 
    3685           0 :     COPY_SCALAR_FIELD(itemtype);
    3686           0 :     COPY_NODE_FIELD(name);
    3687           0 :     COPY_SCALAR_FIELD(number);
    3688           0 :     COPY_NODE_FIELD(order_family);
    3689           0 :     COPY_NODE_FIELD(class_args);
    3690           0 :     COPY_NODE_FIELD(storedtype);
    3691             : 
    3692           0 :     return newnode;
    3693             : }
    3694             : 
    3695             : static CreateOpFamilyStmt *
    3696           0 : _copyCreateOpFamilyStmt(const CreateOpFamilyStmt *from)
    3697             : {
    3698           0 :     CreateOpFamilyStmt *newnode = makeNode(CreateOpFamilyStmt);
    3699             : 
    3700           0 :     COPY_NODE_FIELD(opfamilyname);
    3701           0 :     COPY_STRING_FIELD(amname);
    3702             : 
    3703           0 :     return newnode;
    3704             : }
    3705             : 
    3706             : static AlterOpFamilyStmt *
    3707           0 : _copyAlterOpFamilyStmt(const AlterOpFamilyStmt *from)
    3708             : {
    3709           0 :     AlterOpFamilyStmt *newnode = makeNode(AlterOpFamilyStmt);
    3710             : 
    3711           0 :     COPY_NODE_FIELD(opfamilyname);
    3712           0 :     COPY_STRING_FIELD(amname);
    3713           0 :     COPY_SCALAR_FIELD(isDrop);
    3714           0 :     COPY_NODE_FIELD(items);
    3715             : 
    3716           0 :     return newnode;
    3717             : }
    3718             : 
    3719             : static CreatedbStmt *
    3720           0 : _copyCreatedbStmt(const CreatedbStmt *from)
    3721             : {
    3722           0 :     CreatedbStmt *newnode = makeNode(CreatedbStmt);
    3723             : 
    3724           0 :     COPY_STRING_FIELD(dbname);
    3725           0 :     COPY_NODE_FIELD(options);
    3726             : 
    3727           0 :     return newnode;
    3728             : }
    3729             : 
    3730             : static AlterDatabaseStmt *
    3731           0 : _copyAlterDatabaseStmt(const AlterDatabaseStmt *from)
    3732             : {
    3733           0 :     AlterDatabaseStmt *newnode = makeNode(AlterDatabaseStmt);
    3734             : 
    3735           0 :     COPY_STRING_FIELD(dbname);
    3736           0 :     COPY_NODE_FIELD(options);
    3737             : 
    3738           0 :     return newnode;
    3739             : }
    3740             : 
    3741             : static AlterDatabaseSetStmt *
    3742           0 : _copyAlterDatabaseSetStmt(const AlterDatabaseSetStmt *from)
    3743             : {
    3744           0 :     AlterDatabaseSetStmt *newnode = makeNode(AlterDatabaseSetStmt);
    3745             : 
    3746           0 :     COPY_STRING_FIELD(dbname);
    3747           0 :     COPY_NODE_FIELD(setstmt);
    3748             : 
    3749           0 :     return newnode;
    3750             : }
    3751             : 
    3752             : static DropdbStmt *
    3753           0 : _copyDropdbStmt(const DropdbStmt *from)
    3754             : {
    3755           0 :     DropdbStmt *newnode = makeNode(DropdbStmt);
    3756             : 
    3757           0 :     COPY_STRING_FIELD(dbname);
    3758           0 :     COPY_SCALAR_FIELD(missing_ok);
    3759             : 
    3760           0 :     return newnode;
    3761             : }
    3762             : 
    3763             : static VacuumStmt *
    3764           4 : _copyVacuumStmt(const VacuumStmt *from)
    3765             : {
    3766           4 :     VacuumStmt *newnode = makeNode(VacuumStmt);
    3767             : 
    3768           4 :     COPY_SCALAR_FIELD(options);
    3769           4 :     COPY_NODE_FIELD(relation);
    3770           4 :     COPY_NODE_FIELD(va_cols);
    3771             : 
    3772           4 :     return newnode;
    3773             : }
    3774             : 
    3775             : static ExplainStmt *
    3776        2499 : _copyExplainStmt(const ExplainStmt *from)
    3777             : {
    3778        2499 :     ExplainStmt *newnode = makeNode(ExplainStmt);
    3779             : 
    3780        2499 :     COPY_NODE_FIELD(query);
    3781        2499 :     COPY_NODE_FIELD(options);
    3782             : 
    3783        2499 :     return newnode;
    3784             : }
    3785             : 
    3786             : static CreateTableAsStmt *
    3787          16 : _copyCreateTableAsStmt(const CreateTableAsStmt *from)
    3788             : {
    3789          16 :     CreateTableAsStmt *newnode = makeNode(CreateTableAsStmt);
    3790             : 
    3791          16 :     COPY_NODE_FIELD(query);
    3792          16 :     COPY_NODE_FIELD(into);
    3793          16 :     COPY_SCALAR_FIELD(relkind);
    3794          16 :     COPY_SCALAR_FIELD(is_select_into);
    3795          16 :     COPY_SCALAR_FIELD(if_not_exists);
    3796             : 
    3797          16 :     return newnode;
    3798             : }
    3799             : 
    3800             : static RefreshMatViewStmt *
    3801           0 : _copyRefreshMatViewStmt(const RefreshMatViewStmt *from)
    3802             : {
    3803           0 :     RefreshMatViewStmt *newnode = makeNode(RefreshMatViewStmt);
    3804             : 
    3805           0 :     COPY_SCALAR_FIELD(concurrent);
    3806           0 :     COPY_SCALAR_FIELD(skipData);
    3807           0 :     COPY_NODE_FIELD(relation);
    3808             : 
    3809           0 :     return newnode;
    3810             : }
    3811             : 
    3812             : static ReplicaIdentityStmt *
    3813          30 : _copyReplicaIdentityStmt(const ReplicaIdentityStmt *from)
    3814             : {
    3815          30 :     ReplicaIdentityStmt *newnode = makeNode(ReplicaIdentityStmt);
    3816             : 
    3817          30 :     COPY_SCALAR_FIELD(identity_type);
    3818          30 :     COPY_STRING_FIELD(name);
    3819             : 
    3820          30 :     return newnode;
    3821             : }
    3822             : 
    3823             : static AlterSystemStmt *
    3824           0 : _copyAlterSystemStmt(const AlterSystemStmt *from)
    3825             : {
    3826           0 :     AlterSystemStmt *newnode = makeNode(AlterSystemStmt);
    3827             : 
    3828           0 :     COPY_NODE_FIELD(setstmt);
    3829             : 
    3830           0 :     return newnode;
    3831             : }
    3832             : 
    3833             : static CreateSeqStmt *
    3834           2 : _copyCreateSeqStmt(const CreateSeqStmt *from)
    3835             : {
    3836           2 :     CreateSeqStmt *newnode = makeNode(CreateSeqStmt);
    3837             : 
    3838           2 :     COPY_NODE_FIELD(sequence);
    3839           2 :     COPY_NODE_FIELD(options);
    3840           2 :     COPY_SCALAR_FIELD(ownerId);
    3841           2 :     COPY_SCALAR_FIELD(for_identity);
    3842           2 :     COPY_SCALAR_FIELD(if_not_exists);
    3843             : 
    3844           2 :     return newnode;
    3845             : }
    3846             : 
    3847             : static AlterSeqStmt *
    3848           2 : _copyAlterSeqStmt(const AlterSeqStmt *from)
    3849             : {
    3850           2 :     AlterSeqStmt *newnode = makeNode(AlterSeqStmt);
    3851             : 
    3852           2 :     COPY_NODE_FIELD(sequence);
    3853           2 :     COPY_NODE_FIELD(options);
    3854           2 :     COPY_SCALAR_FIELD(for_identity);
    3855           2 :     COPY_SCALAR_FIELD(missing_ok);
    3856             : 
    3857           2 :     return newnode;
    3858             : }
    3859             : 
    3860             : static VariableSetStmt *
    3861          36 : _copyVariableSetStmt(const VariableSetStmt *from)
    3862             : {
    3863          36 :     VariableSetStmt *newnode = makeNode(VariableSetStmt);
    3864             : 
    3865          36 :     COPY_SCALAR_FIELD(kind);
    3866          36 :     COPY_STRING_FIELD(name);
    3867          36 :     COPY_NODE_FIELD(args);
    3868          36 :     COPY_SCALAR_FIELD(is_local);
    3869             : 
    3870          36 :     return newnode;
    3871             : }
    3872             : 
    3873             : static VariableShowStmt *
    3874           0 : _copyVariableShowStmt(const VariableShowStmt *from)
    3875             : {
    3876           0 :     VariableShowStmt *newnode = makeNode(VariableShowStmt);
    3877             : 
    3878           0 :     COPY_STRING_FIELD(name);
    3879             : 
    3880           0 :     return newnode;
    3881             : }
    3882             : 
    3883             : static DiscardStmt *
    3884           0 : _copyDiscardStmt(const DiscardStmt *from)
    3885             : {
    3886           0 :     DiscardStmt *newnode = makeNode(DiscardStmt);
    3887             : 
    3888           0 :     COPY_SCALAR_FIELD(target);
    3889             : 
    3890           0 :     return newnode;
    3891             : }
    3892             : 
    3893             : static CreateTableSpaceStmt *
    3894           0 : _copyCreateTableSpaceStmt(const CreateTableSpaceStmt *from)
    3895             : {
    3896           0 :     CreateTableSpaceStmt *newnode = makeNode(CreateTableSpaceStmt);
    3897             : 
    3898           0 :     COPY_STRING_FIELD(tablespacename);
    3899           0 :     COPY_NODE_FIELD(owner);
    3900           0 :     COPY_STRING_FIELD(location);
    3901           0 :     COPY_NODE_FIELD(options);
    3902             : 
    3903           0 :     return newnode;
    3904             : }
    3905             : 
    3906             : static DropTableSpaceStmt *
    3907           0 : _copyDropTableSpaceStmt(const DropTableSpaceStmt *from)
    3908             : {
    3909           0 :     DropTableSpaceStmt *newnode = makeNode(DropTableSpaceStmt);
    3910             : 
    3911           0 :     COPY_STRING_FIELD(tablespacename);
    3912           0 :     COPY_SCALAR_FIELD(missing_ok);
    3913             : 
    3914           0 :     return newnode;
    3915             : }
    3916             : 
    3917             : static AlterTableSpaceOptionsStmt *
    3918           0 : _copyAlterTableSpaceOptionsStmt(const AlterTableSpaceOptionsStmt *from)
    3919             : {
    3920           0 :     AlterTableSpaceOptionsStmt *newnode = makeNode(AlterTableSpaceOptionsStmt);
    3921             : 
    3922           0 :     COPY_STRING_FIELD(tablespacename);
    3923           0 :     COPY_NODE_FIELD(options);
    3924           0 :     COPY_SCALAR_FIELD(isReset);
    3925             : 
    3926           0 :     return newnode;
    3927             : }
    3928             : 
    3929             : static AlterTableMoveAllStmt *
    3930           0 : _copyAlterTableMoveAllStmt(const AlterTableMoveAllStmt *from)
    3931             : {
    3932           0 :     AlterTableMoveAllStmt *newnode = makeNode(AlterTableMoveAllStmt);
    3933             : 
    3934           0 :     COPY_STRING_FIELD(orig_tablespacename);
    3935           0 :     COPY_SCALAR_FIELD(objtype);
    3936           0 :     COPY_NODE_FIELD(roles);
    3937           0 :     COPY_STRING_FIELD(new_tablespacename);
    3938           0 :     COPY_SCALAR_FIELD(nowait);
    3939             : 
    3940           0 :     return newnode;
    3941             : }
    3942             : 
    3943             : static CreateExtensionStmt *
    3944           0 : _copyCreateExtensionStmt(const CreateExtensionStmt *from)
    3945             : {
    3946           0 :     CreateExtensionStmt *newnode = makeNode(CreateExtensionStmt);
    3947             : 
    3948           0 :     COPY_STRING_FIELD(extname);
    3949           0 :     COPY_SCALAR_FIELD(if_not_exists);
    3950           0 :     COPY_NODE_FIELD(options);
    3951             : 
    3952           0 :     return newnode;
    3953             : }
    3954             : 
    3955             : static AlterExtensionStmt *
    3956           0 : _copyAlterExtensionStmt(const AlterExtensionStmt *from)
    3957             : {
    3958           0 :     AlterExtensionStmt *newnode = makeNode(AlterExtensionStmt);
    3959             : 
    3960           0 :     COPY_STRING_FIELD(extname);
    3961           0 :     COPY_NODE_FIELD(options);
    3962             : 
    3963           0 :     return newnode;
    3964             : }
    3965             : 
    3966             : static AlterExtensionContentsStmt *
    3967           0 : _copyAlterExtensionContentsStmt(const AlterExtensionContentsStmt *from)
    3968             : {
    3969           0 :     AlterExtensionContentsStmt *newnode = makeNode(AlterExtensionContentsStmt);
    3970             : 
    3971           0 :     COPY_STRING_FIELD(extname);
    3972           0 :     COPY_SCALAR_FIELD(action);
    3973           0 :     COPY_SCALAR_FIELD(objtype);
    3974           0 :     COPY_NODE_FIELD(object);
    3975             : 
    3976           0 :     return newnode;
    3977             : }
    3978             : 
    3979             : static CreateFdwStmt *
    3980           1 : _copyCreateFdwStmt(const CreateFdwStmt *from)
    3981             : {
    3982           1 :     CreateFdwStmt *newnode = makeNode(CreateFdwStmt);
    3983             : 
    3984           1 :     COPY_STRING_FIELD(fdwname);
    3985           1 :     COPY_NODE_FIELD(func_options);
    3986           1 :     COPY_NODE_FIELD(options);
    3987             : 
    3988           1 :     return newnode;
    3989             : }
    3990             : 
    3991             : static AlterFdwStmt *
    3992           0 : _copyAlterFdwStmt(const AlterFdwStmt *from)
    3993             : {
    3994           0 :     AlterFdwStmt *newnode = makeNode(AlterFdwStmt);
    3995             : 
    3996           0 :     COPY_STRING_FIELD(fdwname);
    3997           0 :     COPY_NODE_FIELD(func_options);
    3998           0 :     COPY_NODE_FIELD(options);
    3999             : 
    4000           0 :     return newnode;
    4001             : }
    4002             : 
    4003             : static CreateForeignServerStmt *
    4004           1 : _copyCreateForeignServerStmt(const CreateForeignServerStmt *from)
    4005             : {
    4006           1 :     CreateForeignServerStmt *newnode = makeNode(CreateForeignServerStmt);
    4007             : 
    4008           1 :     COPY_STRING_FIELD(servername);
    4009           1 :     COPY_STRING_FIELD(servertype);
    4010           1 :     COPY_STRING_FIELD(version);
    4011           1 :     COPY_STRING_FIELD(fdwname);
    4012           1 :     COPY_SCALAR_FIELD(if_not_exists);
    4013           1 :     COPY_NODE_FIELD(options);
    4014             : 
    4015           1 :     return newnode;
    4016             : }
    4017             : 
    4018             : static AlterForeignServerStmt *
    4019           0 : _copyAlterForeignServerStmt(const AlterForeignServerStmt *from)
    4020             : {
    4021           0 :     AlterForeignServerStmt *newnode = makeNode(AlterForeignServerStmt);
    4022             : 
    4023           0 :     COPY_STRING_FIELD(servername);
    4024           0 :     COPY_STRING_FIELD(version);
    4025           0 :     COPY_NODE_FIELD(options);
    4026           0 :     COPY_SCALAR_FIELD(has_version);
    4027             : 
    4028           0 :     return newnode;
    4029             : }
    4030             : 
    4031             : static CreateUserMappingStmt *
    4032           1 : _copyCreateUserMappingStmt(const CreateUserMappingStmt *from)
    4033             : {
    4034           1 :     CreateUserMappingStmt *newnode = makeNode(CreateUserMappingStmt);
    4035             : 
    4036           1 :     COPY_NODE_FIELD(user);
    4037           1 :     COPY_STRING_FIELD(servername);
    4038           1 :     COPY_SCALAR_FIELD(if_not_exists);
    4039           1 :     COPY_NODE_FIELD(options);
    4040             : 
    4041           1 :     return newnode;
    4042             : }
    4043             : 
    4044             : static AlterUserMappingStmt *
    4045           0 : _copyAlterUserMappingStmt(const AlterUserMappingStmt *from)
    4046             : {
    4047           0 :     AlterUserMappingStmt *newnode = makeNode(AlterUserMappingStmt);
    4048             : 
    4049           0 :     COPY_NODE_FIELD(user);
    4050           0 :     COPY_STRING_FIELD(servername);
    4051           0 :     COPY_NODE_FIELD(options);
    4052             : 
    4053           0 :     return newnode;
    4054             : }
    4055             : 
    4056             : static DropUserMappingStmt *
    4057           0 : _copyDropUserMappingStmt(const DropUserMappingStmt *from)
    4058             : {
    4059           0 :     DropUserMappingStmt *newnode = makeNode(DropUserMappingStmt);
    4060             : 
    4061           0 :     COPY_NODE_FIELD(user);
    4062           0 :     COPY_STRING_FIELD(servername);
    4063           0 :     COPY_SCALAR_FIELD(missing_ok);
    4064             : 
    4065           0 :     return newnode;
    4066             : }
    4067             : 
    4068             : static CreateForeignTableStmt *
    4069          14 : _copyCreateForeignTableStmt(const CreateForeignTableStmt *from)
    4070             : {
    4071          14 :     CreateForeignTableStmt *newnode = makeNode(CreateForeignTableStmt);
    4072             : 
    4073          14 :     CopyCreateStmtFields((const CreateStmt *) from, (CreateStmt *) newnode);
    4074             : 
    4075          14 :     COPY_STRING_FIELD(servername);
    4076          14 :     COPY_NODE_FIELD(options);
    4077             : 
    4078          14 :     return newnode;
    4079             : }
    4080             : 
    4081             : static ImportForeignSchemaStmt *
    4082           0 : _copyImportForeignSchemaStmt(const ImportForeignSchemaStmt *from)
    4083             : {
    4084           0 :     ImportForeignSchemaStmt *newnode = makeNode(ImportForeignSchemaStmt);
    4085             : 
    4086           0 :     COPY_STRING_FIELD(server_name);
    4087           0 :     COPY_STRING_FIELD(remote_schema);
    4088           0 :     COPY_STRING_FIELD(local_schema);
    4089           0 :     COPY_SCALAR_FIELD(list_type);
    4090           0 :     COPY_NODE_FIELD(table_list);
    4091           0 :     COPY_NODE_FIELD(options);
    4092             : 
    4093           0 :     return newnode;
    4094             : }
    4095             : 
    4096             : static CreateTransformStmt *
    4097           0 : _copyCreateTransformStmt(const CreateTransformStmt *from)
    4098             : {
    4099           0 :     CreateTransformStmt *newnode = makeNode(CreateTransformStmt);
    4100             : 
    4101           0 :     COPY_SCALAR_FIELD(replace);
    4102           0 :     COPY_NODE_FIELD(type_name);
    4103           0 :     COPY_STRING_FIELD(lang);
    4104           0 :     COPY_NODE_FIELD(fromsql);
    4105           0 :     COPY_NODE_FIELD(tosql);
    4106             : 
    4107           0 :     return newnode;
    4108             : }
    4109             : 
    4110             : static CreateAmStmt *
    4111           0 : _copyCreateAmStmt(const CreateAmStmt *from)
    4112             : {
    4113           0 :     CreateAmStmt *newnode = makeNode(CreateAmStmt);
    4114             : 
    4115           0 :     COPY_STRING_FIELD(amname);
    4116           0 :     COPY_NODE_FIELD(handler_name);
    4117           0 :     COPY_SCALAR_FIELD(amtype);
    4118             : 
    4119           0 :     return newnode;
    4120             : }
    4121             : 
    4122             : static CreateTrigStmt *
    4123           0 : _copyCreateTrigStmt(const CreateTrigStmt *from)
    4124             : {
    4125           0 :     CreateTrigStmt *newnode = makeNode(CreateTrigStmt);
    4126             : 
    4127           0 :     COPY_STRING_FIELD(trigname);
    4128           0 :     COPY_NODE_FIELD(relation);
    4129           0 :     COPY_NODE_FIELD(funcname);
    4130           0 :     COPY_NODE_FIELD(args);
    4131           0 :     COPY_SCALAR_FIELD(row);
    4132           0 :     COPY_SCALAR_FIELD(timing);
    4133           0 :     COPY_SCALAR_FIELD(events);
    4134           0 :     COPY_NODE_FIELD(columns);
    4135           0 :     COPY_NODE_FIELD(whenClause);
    4136           0 :     COPY_SCALAR_FIELD(isconstraint);
    4137           0 :     COPY_NODE_FIELD(transitionRels);
    4138           0 :     COPY_SCALAR_FIELD(deferrable);
    4139           0 :     COPY_SCALAR_FIELD(initdeferred);
    4140           0 :     COPY_NODE_FIELD(constrrel);
    4141             : 
    4142           0 :     return newnode;
    4143             : }
    4144             : 
    4145             : static CreateEventTrigStmt *
    4146           0 : _copyCreateEventTrigStmt(const CreateEventTrigStmt *from)
    4147             : {
    4148           0 :     CreateEventTrigStmt *newnode = makeNode(CreateEventTrigStmt);
    4149             : 
    4150           0 :     COPY_STRING_FIELD(trigname);
    4151           0 :     COPY_STRING_FIELD(eventname);
    4152           0 :     COPY_NODE_FIELD(whenclause);
    4153           0 :     COPY_NODE_FIELD(funcname);
    4154             : 
    4155           0 :     return newnode;
    4156             : }
    4157             : 
    4158             : static AlterEventTrigStmt *
    4159           0 : _copyAlterEventTrigStmt(const AlterEventTrigStmt *from)
    4160             : {
    4161           0 :     AlterEventTrigStmt *newnode = makeNode(AlterEventTrigStmt);
    4162             : 
    4163           0 :     COPY_STRING_FIELD(trigname);
    4164           0 :     COPY_SCALAR_FIELD(tgenabled);
    4165             : 
    4166           0 :     return newnode;
    4167             : }
    4168             : 
    4169             : static CreatePLangStmt *
    4170           0 : _copyCreatePLangStmt(const CreatePLangStmt *from)
    4171             : {
    4172           0 :     CreatePLangStmt *newnode = makeNode(CreatePLangStmt);
    4173             : 
    4174           0 :     COPY_SCALAR_FIELD(replace);
    4175           0 :     COPY_STRING_FIELD(plname);
    4176           0 :     COPY_NODE_FIELD(plhandler);
    4177           0 :     COPY_NODE_FIELD(plinline);
    4178           0 :     COPY_NODE_FIELD(plvalidator);
    4179           0 :     COPY_SCALAR_FIELD(pltrusted);
    4180             : 
    4181           0 :     return newnode;
    4182             : }
    4183             : 
    4184             : static CreateRoleStmt *
    4185           0 : _copyCreateRoleStmt(const CreateRoleStmt *from)
    4186             : {
    4187           0 :     CreateRoleStmt *newnode = makeNode(CreateRoleStmt);
    4188             : 
    4189           0 :     COPY_SCALAR_FIELD(stmt_type);
    4190           0 :     COPY_STRING_FIELD(role);
    4191           0 :     COPY_NODE_FIELD(options);
    4192             : 
    4193           0 :     return newnode;
    4194             : }
    4195             : 
    4196             : static AlterRoleStmt *
    4197           0 : _copyAlterRoleStmt(const AlterRoleStmt *from)
    4198             : {
    4199           0 :     AlterRoleStmt *newnode = makeNode(AlterRoleStmt);
    4200             : 
    4201           0 :     COPY_NODE_FIELD(role);
    4202           0 :     COPY_NODE_FIELD(options);
    4203           0 :     COPY_SCALAR_FIELD(action);
    4204             : 
    4205           0 :     return newnode;
    4206             : }
    4207             : 
    4208             : static AlterRoleSetStmt *
    4209           0 : _copyAlterRoleSetStmt(const AlterRoleSetStmt *from)
    4210             : {
    4211           0 :     AlterRoleSetStmt *newnode = makeNode(AlterRoleSetStmt);
    4212             : 
    4213           0 :     COPY_NODE_FIELD(role);
    4214           0 :     COPY_STRING_FIELD(database);
    4215           0 :     COPY_NODE_FIELD(setstmt);
    4216             : 
    4217           0 :     return newnode;
    4218             : }
    4219             : 
    4220             : static DropRoleStmt *
    4221           0 : _copyDropRoleStmt(const DropRoleStmt *from)
    4222             : {
    4223           0 :     DropRoleStmt *newnode = makeNode(DropRoleStmt);
    4224             : 
    4225           0 :     COPY_NODE_FIELD(roles);
    4226           0 :     COPY_SCALAR_FIELD(missing_ok);
    4227             : 
    4228           0 :     return newnode;
    4229             : }
    4230             : 
    4231             : static LockStmt *
    4232           0 : _copyLockStmt(const LockStmt *from)
    4233             : {
    4234           0 :     LockStmt   *newnode = makeNode(LockStmt);
    4235             : 
    4236           0 :     COPY_NODE_FIELD(relations);
    4237           0 :     COPY_SCALAR_FIELD(mode);
    4238           0 :     COPY_SCALAR_FIELD(nowait);
    4239             : 
    4240           0 :     return newnode;
    4241             : }
    4242             : 
    4243             : static ConstraintsSetStmt *
    4244           4 : _copyConstraintsSetStmt(const ConstraintsSetStmt *from)
    4245             : {
    4246           4 :     ConstraintsSetStmt *newnode = makeNode(ConstraintsSetStmt);
    4247             : 
    4248           4 :     COPY_NODE_FIELD(constraints);
    4249           4 :     COPY_SCALAR_FIELD(deferred);
    4250             : 
    4251           4 :     return newnode;
    4252             : }
    4253             : 
    4254             : static ReindexStmt *
    4255           0 : _copyReindexStmt(const ReindexStmt *from)
    4256             : {
    4257           0 :     ReindexStmt *newnode = makeNode(ReindexStmt);
    4258             : 
    4259           0 :     COPY_SCALAR_FIELD(kind);
    4260           0 :     COPY_NODE_FIELD(relation);
    4261           0 :     COPY_STRING_FIELD(name);
    4262           0 :     COPY_SCALAR_FIELD(options);
    4263             : 
    4264           0 :     return newnode;
    4265             : }
    4266             : 
    4267             : static CreateSchemaStmt *
    4268           1 : _copyCreateSchemaStmt(const CreateSchemaStmt *from)
    4269             : {
    4270           1 :     CreateSchemaStmt *newnode = makeNode(CreateSchemaStmt);
    4271             : 
    4272           1 :     COPY_STRING_FIELD(schemaname);
    4273           1 :     COPY_NODE_FIELD(authrole);
    4274           1 :     COPY_NODE_FIELD(schemaElts);
    4275           1 :     COPY_SCALAR_FIELD(if_not_exists);
    4276             : 
    4277           1 :     return newnode;
    4278             : }
    4279             : 
    4280             : static CreateConversionStmt *
    4281           0 : _copyCreateConversionStmt(const CreateConversionStmt *from)
    4282             : {
    4283           0 :     CreateConversionStmt *newnode = makeNode(CreateConversionStmt);
    4284             : 
    4285           0 :     COPY_NODE_FIELD(conversion_name);
    4286           0 :     COPY_STRING_FIELD(for_encoding_name);
    4287           0 :     COPY_STRING_FIELD(to_encoding_name);
    4288           0 :     COPY_NODE_FIELD(func_name);
    4289           0 :     COPY_SCALAR_FIELD(def);
    4290             : 
    4291           0 :     return newnode;
    4292             : }
    4293             : 
    4294             : static CreateCastStmt *
    4295           0 : _copyCreateCastStmt(const CreateCastStmt *from)
    4296             : {
    4297           0 :     CreateCastStmt *newnode = makeNode(CreateCastStmt);
    4298             : 
    4299           0 :     COPY_NODE_FIELD(sourcetype);
    4300           0 :     COPY_NODE_FIELD(targettype);
    4301           0 :     COPY_NODE_FIELD(func);
    4302           0 :     COPY_SCALAR_FIELD(context);
    4303           0 :     COPY_SCALAR_FIELD(inout);
    4304             : 
    4305           0 :     return newnode;
    4306             : }
    4307             : 
    4308             : static PrepareStmt *
    4309           0 : _copyPrepareStmt(const PrepareStmt *from)
    4310             : {
    4311           0 :     PrepareStmt *newnode = makeNode(PrepareStmt);
    4312             : 
    4313           0 :     COPY_STRING_FIELD(name);
    4314           0 :     COPY_NODE_FIELD(argtypes);
    4315           0 :     COPY_NODE_FIELD(query);
    4316             : 
    4317           0 :     return newnode;
    4318             : }
    4319             : 
    4320             : static ExecuteStmt *
    4321          19 : _copyExecuteStmt(const ExecuteStmt *from)
    4322             : {
    4323          19 :     ExecuteStmt *newnode = makeNode(ExecuteStmt);
    4324             : 
    4325          19 :     COPY_STRING_FIELD(name);
    4326          19 :     COPY_NODE_FIELD(params);
    4327             : 
    4328          19 :     return newnode;
    4329             : }
    4330             : 
    4331             : static DeallocateStmt *
    4332           0 : _copyDeallocateStmt(const DeallocateStmt *from)
    4333             : {
    4334           0 :     DeallocateStmt *newnode = makeNode(DeallocateStmt);
    4335             : 
    4336           0 :     COPY_STRING_FIELD(name);
    4337             : 
    4338           0 :     return newnode;
    4339             : }
    4340             : 
    4341             : static DropOwnedStmt *
    4342           0 : _copyDropOwnedStmt(const DropOwnedStmt *from)
    4343             : {
    4344           0 :     DropOwnedStmt *newnode = makeNode(DropOwnedStmt);
    4345             : 
    4346           0 :     COPY_NODE_FIELD(roles);
    4347           0 :     COPY_SCALAR_FIELD(behavior);
    4348             : 
    4349           0 :     return newnode;
    4350             : }
    4351             : 
    4352             : static ReassignOwnedStmt *
    4353           0 : _copyReassignOwnedStmt(const ReassignOwnedStmt *from)
    4354             : {
    4355           0 :     ReassignOwnedStmt *newnode = makeNode(ReassignOwnedStmt);
    4356             : 
    4357           0 :     COPY_NODE_FIELD(roles);
    4358           0 :     COPY_NODE_FIELD(newrole);
    4359             : 
    4360           0 :     return newnode;
    4361             : }
    4362             : 
    4363             : static AlterTSDictionaryStmt *
    4364           0 : _copyAlterTSDictionaryStmt(const AlterTSDictionaryStmt *from)
    4365             : {
    4366           0 :     AlterTSDictionaryStmt *newnode = makeNode(AlterTSDictionaryStmt);
    4367             : 
    4368           0 :     COPY_NODE_FIELD(dictname);
    4369           0 :     COPY_NODE_FIELD(options);
    4370             : 
    4371           0 :     return newnode;
    4372             : }
    4373             : 
    4374             : static AlterTSConfigurationStmt *
    4375           0 : _copyAlterTSConfigurationStmt(const AlterTSConfigurationStmt *from)
    4376             : {
    4377           0 :     AlterTSConfigurationStmt *newnode = makeNode(AlterTSConfigurationStmt);
    4378             : 
    4379           0 :     COPY_SCALAR_FIELD(kind);
    4380           0 :     COPY_NODE_FIELD(cfgname);
    4381           0 :     COPY_NODE_FIELD(tokentype);
    4382           0 :     COPY_NODE_FIELD(dicts);
    4383           0 :     COPY_SCALAR_FIELD(override);
    4384           0 :     COPY_SCALAR_FIELD(replace);
    4385           0 :     COPY_SCALAR_FIELD(missing_ok);
    4386             : 
    4387           0 :     return newnode;
    4388             : }
    4389             : 
    4390             : static CreatePolicyStmt *
    4391           1 : _copyCreatePolicyStmt(const CreatePolicyStmt *from)
    4392             : {
    4393           1 :     CreatePolicyStmt *newnode = makeNode(CreatePolicyStmt);
    4394             : 
    4395           1 :     COPY_STRING_FIELD(policy_name);
    4396           1 :     COPY_NODE_FIELD(table);
    4397           1 :     COPY_STRING_FIELD(cmd_name);
    4398           1 :     COPY_SCALAR_FIELD(permissive);
    4399           1 :     COPY_NODE_FIELD(roles);
    4400           1 :     COPY_NODE_FIELD(qual);
    4401           1 :     COPY_NODE_FIELD(with_check);
    4402             : 
    4403           1 :     return newnode;
    4404             : }
    4405             : 
    4406             : static AlterPolicyStmt *
    4407           1 : _copyAlterPolicyStmt(const AlterPolicyStmt *from)
    4408             : {
    4409           1 :     AlterPolicyStmt *newnode = makeNode(AlterPolicyStmt);
    4410             : 
    4411           1 :     COPY_STRING_FIELD(policy_name);
    4412           1 :     COPY_NODE_FIELD(table);
    4413           1 :     COPY_NODE_FIELD(roles);
    4414           1 :     COPY_NODE_FIELD(qual);
    4415           1 :     COPY_NODE_FIELD(with_check);
    4416             : 
    4417           1 :     return newnode;
    4418             : }
    4419             : 
    4420             : static PartitionElem *
    4421         140 : _copyPartitionElem(const PartitionElem *from)
    4422             : {
    4423         140 :     PartitionElem *newnode = makeNode(PartitionElem);
    4424             : 
    4425         140 :     COPY_STRING_FIELD(name);
    4426         140 :     COPY_NODE_FIELD(expr);
    4427         140 :     COPY_NODE_FIELD(collation);
    4428         140 :     COPY_NODE_FIELD(opclass);
    4429         140 :     COPY_LOCATION_FIELD(location);
    4430             : 
    4431         140 :     return newnode;
    4432             : }
    4433             : 
    4434             : static PartitionSpec *
    4435          98 : _copyPartitionSpec(const PartitionSpec *from)
    4436             : {
    4437          98 :     PartitionSpec *newnode = makeNode(PartitionSpec);
    4438             : 
    4439          98 :     COPY_STRING_FIELD(strategy);
    4440          98 :     COPY_NODE_FIELD(partParams);
    4441          98 :     COPY_LOCATION_FIELD(location);
    4442             : 
    4443          98 :     return newnode;
    4444             : }
    4445             : 
    4446             : static PartitionBoundSpec *
    4447         442 : _copyPartitionBoundSpec(const PartitionBoundSpec *from)
    4448             : {
    4449         442 :     PartitionBoundSpec *newnode = makeNode(PartitionBoundSpec);
    4450             : 
    4451         442 :     COPY_SCALAR_FIELD(strategy);
    4452         442 :     COPY_NODE_FIELD(listdatums);
    4453         442 :     COPY_NODE_FIELD(lowerdatums);
    4454         442 :     COPY_NODE_FIELD(upperdatums);
    4455         442 :     COPY_LOCATION_FIELD(location);
    4456             : 
    4457         442 :     return newnode;
    4458             : }
    4459             : 
    4460             : static PartitionRangeDatum *
    4461         927 : _copyPartitionRangeDatum(const PartitionRangeDatum *from)
    4462             : {
    4463         927 :     PartitionRangeDatum *newnode = makeNode(PartitionRangeDatum);
    4464             : 
    4465         927 :     COPY_SCALAR_FIELD(kind);
    4466         927 :     COPY_NODE_FIELD(value);
    4467         927 :     COPY_LOCATION_FIELD(location);
    4468             : 
    4469         927 :     return newnode;
    4470             : }
    4471             : 
    4472             : static PartitionCmd *
    4473         135 : _copyPartitionCmd(const PartitionCmd *from)
    4474             : {
    4475         135 :     PartitionCmd *newnode = makeNode(PartitionCmd);
    4476             : 
    4477         135 :     COPY_NODE_FIELD(name);
    4478         135 :     COPY_NODE_FIELD(bound);
    4479             : 
    4480         135 :     return newnode;
    4481             : }
    4482             : 
    4483             : static CreatePublicationStmt *
    4484           0 : _copyCreatePublicationStmt(const CreatePublicationStmt *from)
    4485             : {
    4486           0 :     CreatePublicationStmt *newnode = makeNode(CreatePublicationStmt);
    4487             : 
    4488           0 :     COPY_STRING_FIELD(pubname);
    4489           0 :     COPY_NODE_FIELD(options);
    4490           0 :     COPY_NODE_FIELD(tables);
    4491           0 :     COPY_SCALAR_FIELD(for_all_tables);
    4492             : 
    4493           0 :     return newnode;
    4494             : }
    4495             : 
    4496             : static AlterPublicationStmt *
    4497           0 : _copyAlterPublicationStmt(const AlterPublicationStmt *from)
    4498             : {
    4499           0 :     AlterPublicationStmt *newnode = makeNode(AlterPublicationStmt);
    4500             : 
    4501           0 :     COPY_STRING_FIELD(pubname);
    4502           0 :     COPY_NODE_FIELD(options);
    4503           0 :     COPY_NODE_FIELD(tables);
    4504           0 :     COPY_SCALAR_FIELD(for_all_tables);
    4505           0 :     COPY_SCALAR_FIELD(tableAction);
    4506             : 
    4507           0 :     return newnode;
    4508             : }
    4509             : 
    4510             : static CreateSubscriptionStmt *
    4511           0 : _copyCreateSubscriptionStmt(const CreateSubscriptionStmt *from)
    4512             : {
    4513           0 :     CreateSubscriptionStmt *newnode = makeNode(CreateSubscriptionStmt);
    4514             : 
    4515           0 :     COPY_STRING_FIELD(subname);
    4516           0 :     COPY_STRING_FIELD(conninfo);
    4517           0 :     COPY_NODE_FIELD(publication);
    4518           0 :     COPY_NODE_FIELD(options);
    4519             : 
    4520           0 :     return newnode;
    4521             : }
    4522             : 
    4523             : static AlterSubscriptionStmt *
    4524           0 : _copyAlterSubscriptionStmt(const AlterSubscriptionStmt *from)
    4525             : {
    4526           0 :     AlterSubscriptionStmt *newnode = makeNode(AlterSubscriptionStmt);
    4527             : 
    4528           0 :     COPY_SCALAR_FIELD(kind);
    4529           0 :     COPY_STRING_FIELD(subname);
    4530           0 :     COPY_STRING_FIELD(conninfo);
    4531           0 :     COPY_NODE_FIELD(publication);
    4532           0 :     COPY_NODE_FIELD(options);
    4533             : 
    4534           0 :     return newnode;
    4535             : }
    4536             : 
    4537             : static DropSubscriptionStmt *
    4538           0 : _copyDropSubscriptionStmt(const DropSubscriptionStmt *from)
    4539             : {
    4540           0 :     DropSubscriptionStmt *newnode = makeNode(DropSubscriptionStmt);
    4541             : 
    4542           0 :     COPY_STRING_FIELD(subname);
    4543           0 :     COPY_SCALAR_FIELD(missing_ok);
    4544           0 :     COPY_SCALAR_FIELD(behavior);
    4545             : 
    4546           0 :     return newnode;
    4547             : }
    4548             : 
    4549             : /* ****************************************************************
    4550             :  *                  pg_list.h copy functions
    4551             :  * ****************************************************************
    4552             :  */
    4553             : 
    4554             : /*
    4555             :  * Perform a deep copy of the specified list, using copyObject(). The
    4556             :  * list MUST be of type T_List; T_IntList and T_OidList nodes don't
    4557             :  * need deep copies, so they should be copied via list_copy()
    4558             :  */
    4559             : #define COPY_NODE_CELL(new, old)                    \
    4560             :     (new) = (ListCell *) palloc(sizeof(ListCell));  \
    4561             :     lfirst(new) = copyObjectImpl(lfirst(old));
    4562             : 
    4563             : static List *
    4564      189530 : _copyList(const List *from)
    4565             : {
    4566             :     List       *new;
    4567             :     ListCell   *curr_old;
    4568             :     ListCell   *prev_new;
    4569             : 
    4570      189530 :     Assert(list_length(from) >= 1);
    4571             : 
    4572      189530 :     new = makeNode(List);
    4573      189530 :     new->length = from->length;
    4574             : 
    4575      189530 :     COPY_NODE_CELL(new->head, from->head);
    4576      189530 :     prev_new = new->head;
    4577      189530 :     curr_old = lnext(from->head);
    4578             : 
    4579      825890 :     while (curr_old)
    4580             :     {
    4581      446830 :         COPY_NODE_CELL(prev_new->next, curr_old);
    4582      446830 :         prev_new = prev_new->next;
    4583      446830 :         curr_old = curr_old->next;
    4584             :     }
    4585      189530 :     prev_new->next = NULL;
    4586      189530 :     new->tail = prev_new;
    4587             : 
    4588      189530 :     return new;
    4589             : }
    4590             : 
    4591             : /* ****************************************************************
    4592             :  *                  extensible.h copy functions
    4593             :  * ****************************************************************
    4594             :  */
    4595             : static ExtensibleNode *
    4596           0 : _copyExtensibleNode(const ExtensibleNode *from)
    4597             : {
    4598             :     ExtensibleNode *newnode;
    4599             :     const ExtensibleNodeMethods *methods;
    4600             : 
    4601           0 :     methods = GetExtensibleNodeMethods(from->extnodename, false);
    4602           0 :     newnode = (ExtensibleNode *) newNode(methods->node_size,
    4603             :                                          T_ExtensibleNode);
    4604           0 :     COPY_STRING_FIELD(extnodename);
    4605             : 
    4606             :     /* copy the private fields */
    4607           0 :     methods->nodeCopy(newnode, from);
    4608             : 
    4609           0 :     return newnode;
    4610             : }
    4611             : 
    4612             : /* ****************************************************************
    4613             :  *                  value.h copy functions
    4614             :  * ****************************************************************
    4615             :  */
    4616             : static Value *
    4617      323397 : _copyValue(const Value *from)
    4618             : {
    4619      323397 :     Value      *newnode = makeNode(Value);
    4620             : 
    4621             :     /* See also _copyAConst when changing this code! */
    4622             : 
    4623      323397 :     COPY_SCALAR_FIELD(type);
    4624      323397 :     switch (from->type)
    4625             :     {
    4626             :         case T_Integer:
    4627         240 :             COPY_SCALAR_FIELD(val.ival);
    4628         240 :             break;
    4629             :         case T_Float:
    4630             :         case T_String:
    4631             :         case T_BitString:
    4632      323157 :             COPY_STRING_FIELD(val.str);
    4633      323157 :             break;
    4634             :         case T_Null:
    4635             :             /* nothing to do */
    4636           0 :             break;
    4637             :         default:
    4638           0 :             elog(ERROR, "unrecognized node type: %d",
    4639             :                  (int) from->type);
    4640             :             break;
    4641             :     }
    4642      323397 :     return newnode;
    4643             : }
    4644             : 
    4645             : 
    4646             : static ForeignKeyCacheInfo *
    4647          86 : _copyForeignKeyCacheInfo(const ForeignKeyCacheInfo *from)
    4648             : {
    4649          86 :     ForeignKeyCacheInfo *newnode = makeNode(ForeignKeyCacheInfo);
    4650             : 
    4651          86 :     COPY_SCALAR_FIELD(conrelid);
    4652          86 :     COPY_SCALAR_FIELD(confrelid);
    4653          86 :     COPY_SCALAR_FIELD(nkeys);
    4654             :     /* COPY_SCALAR_FIELD might work for these, but let's not assume that */
    4655          86 :     memcpy(newnode->conkey, from->conkey, sizeof(newnode->conkey));
    4656          86 :     memcpy(newnode->confkey, from->confkey, sizeof(newnode->confkey));
    4657          86 :     memcpy(newnode->conpfeqop, from->conpfeqop, sizeof(newnode->conpfeqop));
    4658             : 
    4659          86 :     return newnode;
    4660             : }
    4661             : 
    4662             : 
    4663             : /*
    4664             :  * copyObjectImpl -- implementation of copyObject(); see nodes/nodes.h
    4665             :  *
    4666             :  * Create a copy of a Node tree or list.  This is a "deep" copy: all
    4667             :  * substructure is copied too, recursively.
    4668             :  */
    4669             : void *
    4670     2012908 : copyObjectImpl(const void *from)
    4671             : {
    4672             :     void       *retval;
    4673             : 
    4674     2012908 :     if (from == NULL)
    4675      849266 :         return NULL;
    4676             : 
    4677             :     /* Guard against stack overflow due to overly complex expressions */
    4678     1163642 :     check_stack_depth();
    4679             : 
    4680     1163642 :     switch (nodeTag(from))
    4681             :     {
    4682             :             /*
    4683             :              * PLAN NODES
    4684             :              */
    4685             :         case T_PlannedStmt:
    4686        4088 :             retval = _copyPlannedStmt(from);
    4687        4088 :             break;
    4688             :         case T_Plan:
    4689           0 :             retval = _copyPlan(from);
    4690           0 :             break;
    4691             :         case T_Result:
    4692        2068 :             retval = _copyResult(from);
    4693        2068 :             break;
    4694             :         case T_ProjectSet:
    4695           2 :             retval = _copyProjectSet(from);
    4696           2 :             break;
    4697             :         case T_ModifyTable:
    4698         209 :             retval = _copyModifyTable(from);
    4699         209 :             break;
    4700             :         case T_Append:
    4701          23 :             retval = _copyAppend(from);
    4702          23 :             break;
    4703             :         case T_MergeAppend:
    4704           0 :             retval = _copyMergeAppend(from);
    4705           0 :             break;
    4706             :         case T_RecursiveUnion:
    4707           0 :             retval = _copyRecursiveUnion(from);
    4708           0 :             break;
    4709             :         case T_BitmapAnd:
    4710           0 :             retval = _copyBitmapAnd(from);
    4711           0 :             break;
    4712             :         case T_BitmapOr:
    4713           0 :             retval = _copyBitmapOr(from);
    4714           0 :             break;
    4715             :         case T_Scan:
    4716           0 :             retval = _copyScan(from);
    4717           0 :             break;
    4718             :         case T_Gather:
    4719           0 :             retval = _copyGather(from);
    4720           0 :             break;
    4721             :         case T_GatherMerge:
    4722           0 :             retval = _copyGatherMerge(from);
    4723           0 :             break;
    4724             :         case T_SeqScan:
    4725         468 :             retval = _copySeqScan(from);
    4726         468 :             break;
    4727             :         case T_SampleScan:
    4728           1 :             retval = _copySampleScan(from);
    4729           1 :             break;
    4730             :         case T_IndexScan:
    4731         558 :             retval = _copyIndexScan(from);
    4732         558 :             break;
    4733             :         case T_IndexOnlyScan:
    4734          31 :             retval = _copyIndexOnlyScan(from);
    4735          31 :             break;
    4736             :         case T_BitmapIndexScan:
    4737          20 :             retval = _copyBitmapIndexScan(from);
    4738          20 :             break;
    4739             :         case T_BitmapHeapScan:
    4740          20 :             retval = _copyBitmapHeapScan(from);
    4741          20 :             break;
    4742             :         case T_TidScan:
    4743          13 :             retval = _copyTidScan(from);
    4744          13 :             break;
    4745             :         case T_SubqueryScan:
    4746           3 :             retval = _copySubqueryScan(from);
    4747           3 :             break;
    4748             :         case T_FunctionScan:
    4749          47 :             retval = _copyFunctionScan(from);
    4750          47 :             break;
    4751             :         case T_TableFuncScan:
    4752           1 :             retval = _copyTableFuncScan(from);
    4753           1 :             break;
    4754             :         case T_ValuesScan:
    4755          14 :             retval = _copyValuesScan(from);
    4756          14 :             break;
    4757             :         case T_CteScan:
    4758           9 :             retval = _copyCteScan(from);
    4759           9 :             break;
    4760             :         case T_NamedTuplestoreScan:
    4761          39 :             retval = _copyNamedTuplestoreScan(from);
    4762          39 :             break;
    4763             :         case T_WorkTableScan:
    4764           0 :             retval = _copyWorkTableScan(from);
    4765           0 :             break;
    4766             :         case T_ForeignScan:
    4767           0 :             retval = _copyForeignScan(from);
    4768           0 :             break;
    4769             :         case T_CustomScan:
    4770           0 :             retval = _copyCustomScan(from);
    4771           0 :             break;
    4772             :         case T_Join:
    4773           0 :             retval = _copyJoin(from);
    4774           0 :             break;
    4775             :         case T_NestLoop:
    4776          25 :             retval = _copyNestLoop(from);
    4777          25 :             break;
    4778             :         case T_MergeJoin:
    4779           7 :             retval = _copyMergeJoin(from);
    4780           7 :             break;
    4781             :         case T_HashJoin:
    4782          35 :             retval = _copyHashJoin(from);
    4783          35 :             break;
    4784             :         case T_Material:
    4785          12 :             retval = _copyMaterial(from);
    4786          12 :             break;
    4787             :         case T_Sort:
    4788          24 :             retval = _copySort(from);
    4789          24 :             break;
    4790             :         case T_Group:
    4791           0 :             retval = _copyGroup(from);
    4792           0 :             break;
    4793             :         case T_Agg:
    4794          71 :             retval = _copyAgg(from);
    4795          71 :             break;
    4796             :         case T_WindowAgg:
    4797           0 :             retval = _copyWindowAgg(from);
    4798           0 :             break;
    4799             :         case T_Unique:
    4800           0 :             retval = _copyUnique(from);
    4801           0 :             break;
    4802             :         case T_Hash:
    4803          35 :             retval = _copyHash(from);
    4804          35 :             break;
    4805             :         case T_SetOp:
    4806           0 :             retval = _copySetOp(from);
    4807           0 :             break;
    4808             :         case T_LockRows:
    4809         313 :             retval = _copyLockRows(from);
    4810         313 :             break;
    4811             :         case T_Limit:
    4812          11 :             retval = _copyLimit(from);
    4813          11 :             break;
    4814             :         case T_NestLoopParam:
    4815           8 :             retval = _copyNestLoopParam(from);
    4816           8 :             break;
    4817             :         case T_PlanRowMark:
    4818         726 :             retval = _copyPlanRowMark(from);
    4819         726 :             break;
    4820             :         case T_PlanInvalItem:
    4821          73 :             retval = _copyPlanInvalItem(from);
    4822          73 :             break;
    4823             : 
    4824             :             /*
    4825             :              * PRIMITIVE NODES
    4826             :              */
    4827             :         case T_Alias:
    4828       46230 :             retval = _copyAlias(from);
    4829       46230 :             break;
    4830             :         case T_RangeVar:
    4831        6697 :             retval = _copyRangeVar(from);
    4832        6697 :             break;
    4833             :         case T_TableFunc:
    4834          13 :             retval = _copyTableFunc(from);
    4835          13 :             break;
    4836             :         case T_IntoClause:
    4837          19 :             retval = _copyIntoClause(from);
    4838          19 :             break;
    4839             :         case T_Var:
    4840      237970 :             retval = _copyVar(from);
    4841      237970 :             break;
    4842             :         case T_Const:
    4843       43022 :             retval = _copyConst(from);
    4844       43022 :             break;
    4845             :         case T_Param:
    4846       18017 :             retval = _copyParam(from);
    4847       18017 :             break;
    4848             :         case T_Aggref:
    4849        3811 :             retval = _copyAggref(from);
    4850        3811 :             break;
    4851             :         case T_GroupingFunc:
    4852          39 :             retval = _copyGroupingFunc(from);
    4853          39 :             break;
    4854             :         case T_WindowFunc:
    4855          43 :             retval = _copyWindowFunc(from);
    4856          43 :             break;
    4857             :         case T_ArrayRef:
    4858         335 :             retval = _copyArrayRef(from);
    4859         335 :             break;
    4860             :         case T_FuncExpr:
    4861       16686 :             retval = _copyFuncExpr(from);
    4862       16686 :             break;
    4863             :         case T_NamedArgExpr:
    4864          27 :             retval = _copyNamedArgExpr(from);
    4865          27 :             break;
    4866             :         case T_OpExpr:
    4867       25718 :             retval = _copyOpExpr(from);
    4868       25718 :             break;
    4869             :         case T_DistinctExpr:
    4870          21 :             retval = _copyDistinctExpr(from);
    4871          21 :             break;
    4872             :         case T_NullIfExpr:
    4873           8 :             retval = _copyNullIfExpr(from);
    4874           8 :             break;
    4875             :         case T_ScalarArrayOpExpr:
    4876        1363 :             retval = _copyScalarArrayOpExpr(from);
    4877        1363 :             break;
    4878             :         case T_BoolExpr:
    4879        6046 :             retval = _copyBoolExpr(from);
    4880        6046 :             break;
    4881             :         case T_SubLink:
    4882        1108 :             retval = _copySubLink(from);
    4883        1108 :             break;
    4884             :         case T_SubPlan:
    4885         113 :             retval = _copySubPlan(from);
    4886         113 :             break;
    4887             :         case T_AlternativeSubPlan:
    4888           0 :             retval = _copyAlternativeSubPlan(from);
    4889           0 :             break;
    4890             :         case T_FieldSelect:
    4891         479 :             retval = _copyFieldSelect(from);
    4892         479 :             break;
    4893             :         case T_FieldStore:
    4894           2 :             retval = _copyFieldStore(from);
    4895           2 :             break;
    4896             :         case T_RelabelType:
    4897        2753 :             retval = _copyRelabelType(from);
    4898        2753 :             break;
    4899             :         case T_CoerceViaIO:
    4900         810 :             retval = _copyCoerceViaIO(from);
    4901         810 :             break;
    4902             :         case T_ArrayCoerceExpr:
    4903          14 :             retval = _copyArrayCoerceExpr(from);
    4904          14 :             break;
    4905             :         case T_ConvertRowtypeExpr:
    4906           2 :             retval = _copyConvertRowtypeExpr(from);
    4907           2 :             break;
    4908             :         case T_CollateExpr:
    4909          12 :             retval = _copyCollateExpr(from);
    4910          12 :             break;
    4911             :         case T_CaseExpr:
    4912        1706 :             retval = _copyCaseExpr(from);
    4913        1706 :             break;
    4914             :         case T_CaseWhen:
    4915        2567 :             retval = _copyCaseWhen(from);
    4916        2567 :             break;
    4917             :         case T_CaseTestExpr:
    4918        2154 :             retval = _copyCaseTestExpr(from);
    4919        2154 :             break;
    4920             :         case T_ArrayExpr:
    4921        1200 :             retval = _copyArrayExpr(from);
    4922        1200 :             break;
    4923             :         case T_RowExpr:
    4924         187 :             retval = _copyRowExpr(from);
    4925         187 :             break;
    4926             :         case T_RowCompareExpr:
    4927           2 :             retval = _copyRowCompareExpr(from);
    4928           2 :             break;
    4929             :         case T_CoalesceExpr:
    4930         930 :             retval = _copyCoalesceExpr(from);
    4931         930 :             break;
    4932             :         case T_MinMaxExpr:
    4933          28 :             retval = _copyMinMaxExpr(from);
    4934          28 :             break;
    4935             :         case T_SQLValueFunction:
    4936        1434 :             retval = _copySQLValueFunction(from);
    4937        1434 :             break;
    4938             :         case T_XmlExpr:
    4939          10 :             retval = _copyXmlExpr(from);
    4940          10 :             break;
    4941             :         case T_NullTest:
    4942        1901 :             retval = _copyNullTest(from);
    4943        1901 :             break;
    4944             :         case T_BooleanTest:
    4945          77 :             retval = _copyBooleanTest(from);
    4946          77 :             break;
    4947             :         case T_CoerceToDomain:
    4948        4812 :             retval = _copyCoerceToDomain(from);
    4949        4812 :             break;
    4950             :         case T_CoerceToDomainValue:
    4951         250 :             retval = _copyCoerceToDomainValue(from);
    4952         250 :             break;
    4953             :         case T_SetToDefault:
    4954          12 :             retval = _copySetToDefault(from);
    4955          12 :             break;
    4956             :         case T_CurrentOfExpr:
    4957         102 :             retval = _copyCurrentOfExpr(from);
    4958         102 :             break;
    4959             :         case T_NextValueExpr:
    4960          30 :             retval = _copyNextValueExpr(from);
    4961          30 :             break;
    4962             :         case T_InferenceElem:
    4963          55 :             retval = _copyInferenceElem(from);
    4964          55 :             break;
    4965             :         case T_TargetEntry:
    4966       58090 :             retval = _copyTargetEntry(from);
    4967       58090 :             break;
    4968             :         case T_RangeTblRef:
    4969       18583 :             retval = _copyRangeTblRef(from);
    4970       18583 :             break;
    4971             :         case T_JoinExpr:
    4972        2792 :             retval = _copyJoinExpr(from);
    4973        2792 :             break;
    4974             :         case T_FromExpr:
    4975       17749 :             retval = _copyFromExpr(from);
    4976       17749 :             break;
    4977             :         case T_OnConflictExpr:
    4978          32 :             retval = _copyOnConflictExpr(from);
    4979          32 :             break;
    4980             : 
    4981             :             /*
    4982             :              * RELATION NODES
    4983             :              */
    4984             :         case T_PathKey:
    4985           0 :             retval = _copyPathKey(from);
    4986           0 :             break;
    4987             :         case T_RestrictInfo:
    4988           0 :             retval = _copyRestrictInfo(from);
    4989           0 :             break;
    4990             :         case T_PlaceHolderVar:
    4991         388 :             retval = _copyPlaceHolderVar(from);
    4992         388 :             break;
    4993             :         case T_SpecialJoinInfo:
    4994           0 :             retval = _copySpecialJoinInfo(from);
    4995           0 :             break;
    4996             :         case T_AppendRelInfo:
    4997          82 :             retval = _copyAppendRelInfo(from);
    4998          82 :             break;
    4999             :         case T_PartitionedChildRelInfo:
    5000           0 :             retval = _copyPartitionedChildRelInfo(from);
    5001           0 :             break;
    5002             :         case T_PlaceHolderInfo:
    5003           0 :             retval = _copyPlaceHolderInfo(from);
    5004           0 :             break;
    5005             : 
    5006             :             /*
    5007             :              * VALUE NODES
    5008             :              */
    5009             :         case T_Integer:
    5010             :         case T_Float:
    5011             :         case T_String:
    5012             :         case T_BitString:
    5013             :         case T_Null:
    5014      323397 :             retval = _copyValue(from);
    5015      323397 :             break;
    5016             : 
    5017             :             /*
    5018             :              * LIST NODES
    5019             :              */
    5020             :         case T_List:
    5021      189530 :             retval = _copyList(from);
    5022      189530 :             break;
    5023             : 
    5024             :             /*
    5025             :              * Lists of integers and OIDs don't need to be deep-copied, so we
    5026             :              * perform a shallow copy via list_copy()
    5027             :              */
    5028             :         case T_IntList:
    5029             :         case T_OidList:
    5030        9132 :             retval = list_copy(from);
    5031        9132 :             break;
    5032             : 
    5033             :             /*
    5034             :              * EXTENSIBLE NODES
    5035             :              */
    5036             :         case T_ExtensibleNode:
    5037           0 :             retval = _copyExtensibleNode(from);
    5038           0 :             break;
    5039             : 
    5040             :             /*
    5041             :              * PARSE NODES
    5042             :              */
    5043             :         case T_Query:
    5044       18820 :             retval = _copyQuery(from);
    5045       18820 :             break;
    5046             :         case T_RawStmt:
    5047        3012 :             retval = _copyRawStmt(from);
    5048        3012 :             break;
    5049             :         case T_InsertStmt:
    5050         108 :             retval = _copyInsertStmt(from);
    5051         108 :             break;
    5052             :         case T_DeleteStmt:
    5053          43 :             retval = _copyDeleteStmt(from);
    5054          43 :             break;
    5055             :         case T_UpdateStmt:
    5056          80 :             retval = _copyUpdateStmt(from);
    5057          80 :             break;
    5058             :         case T_SelectStmt:
    5059        3740 :             retval = _copySelectStmt(from);
    5060        3740 :             break;
    5061             :         case T_SetOperationStmt:
    5062         310 :             retval = _copySetOperationStmt(from);
    5063         310 :             break;
    5064             :         case T_AlterTableStmt:
    5065        1029 :             retval = _copyAlterTableStmt(from);
    5066        1029 :             break;
    5067             :         case T_AlterTableCmd:
    5068        2203 :             retval = _copyAlterTableCmd(from);
    5069        2203 :             break;
    5070             :         case T_AlterCollationStmt:
    5071           0 :             retval = _copyAlterCollationStmt(from);
    5072           0 :             break;
    5073             :         case T_AlterDomainStmt:
    5074           0 :             retval = _copyAlterDomainStmt(from);
    5075           0 :             break;
    5076             :         case T_GrantStmt:
    5077           1 :             retval = _copyGrantStmt(from);
    5078           1 :             break;
    5079             :         case T_GrantRoleStmt:
    5080           0 :             retval = _copyGrantRoleStmt(from);
    5081           0 :             break;
    5082             :         case T_AlterDefaultPrivilegesStmt:
    5083           1 :             retval = _copyAlterDefaultPrivilegesStmt(from);
    5084           1 :             break;
    5085             :         case T_DeclareCursorStmt:
    5086           4 :             retval = _copyDeclareCursorStmt(from);
    5087           4 :             break;
    5088             :         case T_ClosePortalStmt:
    5089           0 :             retval = _copyClosePortalStmt(from);
    5090           0 :             break;
    5091             :         case T_ClusterStmt:
    5092           0 :             retval = _copyClusterStmt(from);
    5093           0 :             break;
    5094             :         case T_CopyStmt:
    5095           0 :             retval = _copyCopyStmt(from);
    5096           0 :             break;
    5097             :         case T_CreateStmt:
    5098        1521 :             retval = _copyCreateStmt(from);
    5099        1521 :             break;
    5100             :         case T_TableLikeClause:
    5101          50 :             retval = _copyTableLikeClause(from);
    5102          50 :             break;
    5103             :         case T_DefineStmt:
    5104           0 :             retval = _copyDefineStmt(from);
    5105           0 :             break;
    5106             :         case T_DropStmt:
    5107           8 :             retval = _copyDropStmt(from);
    5108           8 :             break;
    5109             :         case T_TruncateStmt:
    5110           4 :             retval = _copyTruncateStmt(from);
    5111           4 :             break;
    5112             :         case T_CommentStmt:
    5113           1 :             retval = _copyCommentStmt(from);
    5114           1 :             break;
    5115             :         case T_SecLabelStmt:
    5116           0 :             retval = _copySecLabelStmt(from);
    5117           0 :             break;
    5118             :         case T_FetchStmt:
    5119           0 :             retval = _copyFetchStmt(from);
    5120           0 :             break;
    5121             :         case T_IndexStmt:
    5122         639 :             retval = _copyIndexStmt(from);
    5123         639 :             break;
    5124             :         case T_CreateStatsStmt:
    5125           0 :             retval = _copyCreateStatsStmt(from);
    5126           0 :             break;
    5127             :         case T_CreateFunctionStmt:
    5128           3 :             retval = _copyCreateFunctionStmt(from);
    5129           3 :             break;
    5130             :         case T_FunctionParameter:
    5131           0 :             retval = _copyFunctionParameter(from);
    5132           0 :             break;
    5133             :         case T_AlterFunctionStmt:
    5134           0 :             retval = _copyAlterFunctionStmt(from);
    5135           0 :             break;
    5136             :         case T_DoStmt:
    5137           0 :             retval = _copyDoStmt(from);
    5138           0 :             break;
    5139             :         case T_RenameStmt:
    5140           1 :             retval = _copyRenameStmt(from);
    5141           1 :             break;
    5142             :         case T_AlterObjectDependsStmt:
    5143           0 :             retval = _copyAlterObjectDependsStmt(from);
    5144           0 :             break;
    5145             :         case T_AlterObjectSchemaStmt:
    5146           0 :             retval = _copyAlterObjectSchemaStmt(from);
    5147           0 :             break;
    5148             :         case T_AlterOwnerStmt:
    5149           0 :             retval = _copyAlterOwnerStmt(from);
    5150           0 :             break;
    5151             :         case T_AlterOperatorStmt:
    5152           0 :             retval = _copyAlterOperatorStmt(from);
    5153           0 :             break;
    5154             :         case T_RuleStmt:
    5155           0 :             retval = _copyRuleStmt(from);
    5156           0 :             break;
    5157             :         case T_NotifyStmt:
    5158           1 :             retval = _copyNotifyStmt(from);
    5159           1 :             break;
    5160             :         case T_ListenStmt:
    5161           0 :             retval = _copyListenStmt(from);
    5162           0 :             break;
    5163             :         case T_UnlistenStmt:
    5164           0 :             retval = _copyUnlistenStmt(from);
    5165           0 :             break;
    5166             :         case T_TransactionStmt:
    5167           0 :             retval = _copyTransactionStmt(from);
    5168           0 :             break;
    5169             :         case T_CompositeTypeStmt:
    5170           1 :             retval = _copyCompositeTypeStmt(from);
    5171           1 :             break;
    5172             :         case T_CreateEnumStmt:
    5173           0 :             retval = _copyCreateEnumStmt(from);
    5174           0 :             break;
    5175             :         case T_CreateRangeStmt:
    5176           0 :             retval = _copyCreateRangeStmt(from);
    5177           0 :             break;
    5178             :         case T_AlterEnumStmt:
    5179           0 :             retval = _copyAlterEnumStmt(from);
    5180           0 :             break;
    5181             :         case T_ViewStmt:
    5182           4 :             retval = _copyViewStmt(from);
    5183           4 :             break;
    5184             :         case T_LoadStmt:
    5185           0 :             retval = _copyLoadStmt(from);
    5186           0 :             break;
    5187             :         case T_CreateDomainStmt:
    5188           0 :             retval = _copyCreateDomainStmt(from);
    5189           0 :             break;
    5190             :         case T_CreateOpClassStmt:
    5191           0 :             retval = _copyCreateOpClassStmt(from);
    5192           0 :             break;
    5193             :         case T_CreateOpClassItem:
    5194           0 :             retval = _copyCreateOpClassItem(from);
    5195           0 :             break;
    5196             :         case T_CreateOpFamilyStmt:
    5197           0 :             retval = _copyCreateOpFamilyStmt(from);
    5198           0 :             break;
    5199             :         case T_AlterOpFamilyStmt:
    5200           0 :             retval = _copyAlterOpFamilyStmt(from);
    5201           0 :             break;
    5202             :         case T_CreatedbStmt:
    5203           0 :             retval = _copyCreatedbStmt(from);
    5204           0 :             break;
    5205             :         case T_AlterDatabaseStmt:
    5206           0 :             retval = _copyAlterDatabaseStmt(from);
    5207           0 :             break;
    5208             :         case T_AlterDatabaseSetStmt:
    5209           0 :             retval = _copyAlterDatabaseSetStmt(from);
    5210           0 :             break;
    5211             :         case T_DropdbStmt:
    5212           0 :             retval = _copyDropdbStmt(from);
    5213           0 :             break;
    5214             :         case T_VacuumStmt:
    5215           4 :             retval = _copyVacuumStmt(from);
    5216           4 :             break;
    5217             :         case T_ExplainStmt:
    5218        2499 :             retval = _copyExplainStmt(from);
    5219        2499 :             break;
    5220             :         case T_CreateTableAsStmt:
    5221          16 :             retval = _copyCreateTableAsStmt(from);
    5222          16 :             break;
    5223             :         case T_RefreshMatViewStmt:
    5224           0 :             retval = _copyRefreshMatViewStmt(from);
    5225           0 :             break;
    5226             :         case T_ReplicaIdentityStmt:
    5227          30 :             retval = _copyReplicaIdentityStmt(from);
    5228          30 :             break;
    5229             :         case T_AlterSystemStmt:
    5230           0 :             retval = _copyAlterSystemStmt(from);
    5231           0 :             break;
    5232             :         case T_CreateSeqStmt:
    5233           2 :             retval = _copyCreateSeqStmt(from);
    5234           2 :             break;
    5235             :         case T_AlterSeqStmt:
    5236           2 :             retval = _copyAlterSeqStmt(from);
    5237           2 :             break;
    5238             :         case T_VariableSetStmt:
    5239          36 :             retval = _copyVariableSetStmt(from);
    5240          36 :             break;
    5241             :         case T_VariableShowStmt:
    5242           0 :             retval = _copyVariableShowStmt(from);
    5243           0 :             break;
    5244             :         case T_DiscardStmt:
    5245           0 :             retval = _copyDiscardStmt(from);
    5246           0 :             break;
    5247             :         case T_CreateTableSpaceStmt:
    5248           0 :             retval = _copyCreateTableSpaceStmt(from);
    5249           0 :             break;
    5250             :         case T_DropTableSpaceStmt:
    5251           0 :             retval = _copyDropTableSpaceStmt(from);
    5252           0 :             break;
    5253             :         case T_AlterTableSpaceOptionsStmt:
    5254           0 :             retval = _copyAlterTableSpaceOptionsStmt(from);
    5255           0 :             break;
    5256             :         case T_AlterTableMoveAllStmt:
    5257           0 :             retval = _copyAlterTableMoveAllStmt(from);
    5258           0 :             break;
    5259             :         case T_CreateExtensionStmt:
    5260           0 :             retval = _copyCreateExtensionStmt(from);
    5261           0 :             break;
    5262             :         case T_AlterExtensionStmt:
    5263           0 :             retval = _copyAlterExtensionStmt(from);
    5264           0 :             break;
    5265             :         case T_AlterExtensionContentsStmt:
    5266           0 :             retval = _copyAlterExtensionContentsStmt(from);
    5267           0 :             break;
    5268             :         case T_CreateFdwStmt:
    5269           1 :             retval = _copyCreateFdwStmt(from);
    5270           1 :             break;
    5271             :         case T_AlterFdwStmt:
    5272           0 :             retval = _copyAlterFdwStmt(from);
    5273           0 :             break;
    5274             :         case T_CreateForeignServerStmt:
    5275           1 :             retval = _copyCreateForeignServerStmt(from);
    5276           1 :             break;
    5277             :         case T_AlterForeignServerStmt:
    5278           0 :             retval = _copyAlterForeignServerStmt(from);
    5279           0 :             break;
    5280             :         case T_CreateUserMappingStmt:
    5281           1 :             retval = _copyCreateUserMappingStmt(from);
    5282           1 :             break;
    5283             :         case T_AlterUserMappingStmt:
    5284           0 :             retval = _copyAlterUserMappingStmt(from);
    5285           0 :             break;
    5286             :         case T_DropUserMappingStmt:
    5287           0 :             retval = _copyDropUserMappingStmt(from);
    5288           0 :             break;
    5289             :         case T_CreateForeignTableStmt:
    5290          14 :             retval = _copyCreateForeignTableStmt(from);
    5291          14 :             break;
    5292             :         case T_ImportForeignSchemaStmt:
    5293           0 :             retval = _copyImportForeignSchemaStmt(from);
    5294           0 :             break;
    5295             :         case T_CreateTransformStmt:
    5296           0 :             retval = _copyCreateTransformStmt(from);
    5297           0 :             break;
    5298             :         case T_CreateAmStmt:
    5299           0 :             retval = _copyCreateAmStmt(from);
    5300           0 :             break;
    5301             :         case T_CreateTrigStmt:
    5302           0 :             retval = _copyCreateTrigStmt(from);
    5303           0 :             break;
    5304             :         case T_CreateEventTrigStmt:
    5305           0 :             retval = _copyCreateEventTrigStmt(from);
    5306           0 :             break;
    5307             :         case T_AlterEventTrigStmt:
    5308           0 :             retval = _copyAlterEventTrigStmt(from);
    5309           0 :             break;
    5310             :         case T_CreatePLangStmt:
    5311           0 :             retval = _copyCreatePLangStmt(from);
    5312           0 :             break;
    5313             :         case T_CreateRoleStmt:
    5314           0 :             retval = _copyCreateRoleStmt(from);
    5315           0 :             break;
    5316             :         case T_AlterRoleStmt:
    5317           0 :             retval = _copyAlterRoleStmt(from);
    5318           0 :             break;
    5319             :         case T_AlterRoleSetStmt:
    5320           0 :             retval = _copyAlterRoleSetStmt(from);
    5321           0 :             break;
    5322             :         case T_DropRoleStmt:
    5323           0 :             retval = _copyDropRoleStmt(from);
    5324           0 :             break;
    5325             :         case T_LockStmt:
    5326           0 :             retval = _copyLockStmt(from);
    5327           0 :             break;
    5328             :         case T_ConstraintsSetStmt:
    5329           4 :             retval = _copyConstraintsSetStmt(from);
    5330           4 :             break;
    5331             :         case T_ReindexStmt:
    5332           0 :             retval = _copyReindexStmt(from);
    5333           0 :             break;
    5334             :         case T_CheckPointStmt:
    5335           0 :             retval = (void *) makeNode(CheckPointStmt);
    5336           0 :             break;
    5337             :         case T_CreateSchemaStmt:
    5338           1 :             retval = _copyCreateSchemaStmt(from);
    5339           1 :             break;
    5340             :         case T_CreateConversionStmt:
    5341           0 :             retval = _copyCreateConversionStmt(from);
    5342           0 :             break;
    5343             :         case T_CreateCastStmt:
    5344           0 :             retval = _copyCreateCastStmt(from);
    5345           0 :             break;
    5346             :         case T_PrepareStmt:
    5347           0 :             retval = _copyPrepareStmt(from);
    5348           0 :             break;
    5349             :         case T_ExecuteStmt:
    5350          19 :             retval = _copyExecuteStmt(from);
    5351          19 :             break;
    5352             :         case T_DeallocateStmt:
    5353           0 :             retval = _copyDeallocateStmt(from);
    5354           0 :             break;
    5355             :         case T_DropOwnedStmt:
    5356           0 :             retval = _copyDropOwnedStmt(from);
    5357           0 :             break;
    5358             :         case T_ReassignOwnedStmt:
    5359           0 :             retval = _copyReassignOwnedStmt(from);
    5360           0 :             break;
    5361             :         case T_AlterTSDictionaryStmt:
    5362           0 :             retval = _copyAlterTSDictionaryStmt(from);
    5363           0 :             break;
    5364             :         case T_AlterTSConfigurationStmt:
    5365           0 :             retval = _copyAlterTSConfigurationStmt(from);
    5366           0 :             break;
    5367             :         case T_CreatePolicyStmt:
    5368           1 :             retval = _copyCreatePolicyStmt(from);
    5369           1 :             break;
    5370             :         case T_AlterPolicyStmt:
    5371           1 :             retval = _copyAlterPolicyStmt(from);
    5372           1 :             break;
    5373             :         case T_CreatePublicationStmt:
    5374           0 :             retval = _copyCreatePublicationStmt(from);
    5375           0 :             break;
    5376             :         case T_AlterPublicationStmt:
    5377           0 :             retval = _copyAlterPublicationStmt(from);
    5378           0 :             break;
    5379             :         case T_CreateSubscriptionStmt:
    5380           0 :             retval = _copyCreateSubscriptionStmt(from);
    5381           0 :             break;
    5382             :         case T_AlterSubscriptionStmt:
    5383           0 :             retval = _copyAlterSubscriptionStmt(from);
    5384           0 :             break;
    5385             :         case T_DropSubscriptionStmt:
    5386           0 :             retval = _copyDropSubscriptionStmt(from);
    5387           0 :             break;
    5388             :         case T_A_Expr:
    5389        2985 :             retval = _copyAExpr(from);
    5390        2985 :             break;
    5391             :         case T_ColumnRef:
    5392        7801 :             retval = _copyColumnRef(from);
    5393        7801 :             break;
    5394             :         case T_ParamRef:
    5395         465 :             retval = _copyParamRef(from);
    5396         465 :             break;
    5397             :         case T_A_Const:
    5398        5762 :             retval = _copyAConst(from);
    5399        5762 :             break;
    5400             :         case T_FuncCall:
    5401        1589 :             retval = _copyFuncCall(from);
    5402        1589 :             break;
    5403             :         case T_A_Star:
    5404         488 :             retval = _copyAStar(from);
    5405         488 :             break;
    5406             :         case T_A_Indices:
    5407          88 :             retval = _copyAIndices(from);
    5408          88 :             break;
    5409             :         case T_A_Indirection:
    5410         136 :             retval = _copyA_Indirection(from);
    5411         136 :             break;
    5412             :         case T_A_ArrayExpr:
    5413          24 :             retval = _copyA_ArrayExpr(from);
    5414          24 :             break;
    5415             :         case T_ResTarget:
    5416        5175 :             retval = _copyResTarget(from);
    5417        5175 :             break;
    5418             :         case T_MultiAssignRef:
    5419           0 :             retval = _copyMultiAssignRef(from);
    5420           0 :             break;
    5421             :         case T_TypeCast:
    5422        1619 :             retval = _copyTypeCast(from);
    5423        1619 :             break;
    5424             :         case T_CollateClause:
    5425          26 :             retval = _copyCollateClause(from);
    5426          26 :             break;
    5427             :         case T_SortBy:
    5428          84 :             retval = _copySortBy(from);
    5429          84 :             break;
    5430             :         case T_WindowDef:
    5431           4 :             retval = _copyWindowDef(from);
    5432           4 :             break;
    5433             :         case T_RangeSubselect:
    5434          58 :             retval = _copyRangeSubselect(from);
    5435          58 :             break;
    5436             :         case T_RangeFunction:
    5437         101 :             retval = _copyRangeFunction(from);
    5438         101 :             break;
    5439             :         case T_RangeTableSample:
    5440           2 :             retval = _copyRangeTableSample(from);
    5441           2 :             break;
    5442             :         case T_RangeTableFunc:
    5443           4 :             retval = _copyRangeTableFunc(from);
    5444           4 :             break;
    5445             :         case T_RangeTableFuncCol:
    5446          25 :             retval = _copyRangeTableFuncCol(from);
    5447          25 :             break;
    5448             :         case T_TypeName:
    5449        4806 :             retval = _copyTypeName(from);
    5450        4806 :             break;
    5451             :         case T_IndexElem:
    5452         809 :             retval = _copyIndexElem(from);
    5453         809 :             break;
    5454             :         case T_ColumnDef:
    5455        3097 :             retval = _copyColumnDef(from);
    5456        3097 :             break;
    5457             :         case T_Constraint:
    5458        1283 :             retval = _copyConstraint(from);
    5459        1283 :             break;
    5460             :         case T_DefElem:
    5461         369 :             retval = _copyDefElem(from);
    5462         369 :             break;
    5463             :         case T_LockingClause:
    5464         114 :             retval = _copyLockingClause(from);
    5465         114 :             break;
    5466             :         case T_RangeTblEntry:
    5467       29048 :             retval = _copyRangeTblEntry(from);
    5468       29048 :             break;
    5469             :         case T_RangeTblFunction:
    5470        1136 :             retval = _copyRangeTblFunction(from);
    5471        1136 :             break;
    5472             :         case T_TableSampleClause:
    5473          27 :             retval = _copyTableSampleClause(from);
    5474          27 :             break;
    5475             :         case T_WithCheckOption:
    5476           9 :             retval = _copyWithCheckOption(from);
    5477           9 :             break;
    5478             :         case T_SortGroupClause:
    5479        2214 :             retval = _copySortGroupClause(from);
    5480        2214 :             break;
    5481             :         case T_GroupingSet:
    5482         102 :             retval = _copyGroupingSet(from);
    5483         102 :             break;
    5484             :         case T_WindowClause:
    5485          27 :             retval = _copyWindowClause(from);
    5486          27 :             break;
    5487             :         case T_RowMarkClause:
    5488         430 :             retval = _copyRowMarkClause(from);
    5489         430 :             break;
    5490             :         case T_WithClause:
    5491          17 :             retval = _copyWithClause(from);
    5492          17 :             break;
    5493             :         case T_InferClause:
    5494           2 :             retval = _copyInferClause(from);
    5495           2 :             break;
    5496             :         case T_OnConflictClause:
    5497           3 :             retval = _copyOnConflictClause(from);
    5498           3 :             break;
    5499             :         case T_CommonTableExpr:
    5500          84 :             retval = _copyCommonTableExpr(from);
    5501          84 :             break;
    5502             :         case T_ObjectWithArgs:
    5503           0 :             retval = _copyObjectWithArgs(from);
    5504           0 :             break;
    5505             :         case T_AccessPriv:
    5506           1 :             retval = _copyAccessPriv(from);
    5507           1 :             break;
    5508             :         case T_XmlSerialize:
    5509           2 :             retval = _copyXmlSerialize(from);
    5510           2 :             break;
    5511             :         case T_RoleSpec:
    5512          38 :             retval = _copyRoleSpec(from);
    5513          38 :             break;
    5514             :         case T_TriggerTransition:
    5515           0 :             retval = _copyTriggerTransition(from);
    5516           0 :             break;
    5517             :         case T_PartitionElem:
    5518         140 :             retval = _copyPartitionElem(from);
    5519         140 :             break;
    5520             :         case T_PartitionSpec:
    5521          98 :             retval = _copyPartitionSpec(from);
    5522          98 :             break;
    5523             :         case T_PartitionBoundSpec:
    5524         442 :             retval = _copyPartitionBoundSpec(from);
    5525         442 :             break;
    5526             :         case T_PartitionRangeDatum:
    5527         927 :             retval = _copyPartitionRangeDatum(from);
    5528         927 :             break;
    5529             :         case T_PartitionCmd:
    5530         135 :             retval = _copyPartitionCmd(from);
    5531         135 :             break;
    5532             : 
    5533             :             /*
    5534             :              * MISCELLANEOUS NODES
    5535             :              */
    5536             :         case T_ForeignKeyCacheInfo:
    5537          86 :             retval = _copyForeignKeyCacheInfo(from);
    5538          86 :             break;
    5539             : 
    5540             :         default:
    5541           0 :             elog(ERROR, "unrecognized node type: %d", (int) nodeTag(from));
    5542             :             retval = 0;         /* keep compiler quiet */
    5543             :             break;
    5544             :     }
    5545             : 
    5546     1163642 :     return retval;
    5547             : }

Generated by: LCOV version 1.11