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