------------------------------------------------------------------ * ExecInitShareInputScan * ------------------------------------------------------------------ */
| 404 | * ------------------------------------------------------------------ |
| 405 | */ |
| 406 | ShareInputScanState * |
| 407 | ExecInitShareInputScan(ShareInputScan *node, EState *estate, int eflags) |
| 408 | { |
| 409 | ShareInputScanState *sisstate; |
| 410 | Plan *outerPlan; |
| 411 | PlanState *childState; |
| 412 | |
| 413 | Assert(innerPlan(node) == NULL); |
| 414 | |
| 415 | /* create state data structure */ |
| 416 | sisstate = makeNode(ShareInputScanState); |
| 417 | sisstate->ss.ps.plan = (Plan *) node; |
| 418 | sisstate->ss.ps.state = estate; |
| 419 | sisstate->ss.ps.ExecProcNode = ExecShareInputScan; |
| 420 | |
| 421 | sisstate->ts_state = NULL; |
| 422 | sisstate->ts_pos = -1; |
| 423 | |
| 424 | /* |
| 425 | * init child node. |
| 426 | * if outerPlan is NULL, this is no-op (so that the ShareInput node will be |
| 427 | * only init-ed once). |
| 428 | */ |
| 429 | |
| 430 | /* |
| 431 | * initialize child nodes |
| 432 | * |
| 433 | * Like a Material node, we shield the child node from the need to support |
| 434 | * BACKWARD, or MARK/RESTORE. |
| 435 | */ |
| 436 | eflags &= ~(EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK); |
| 437 | |
| 438 | outerPlan = outerPlan(node); |
| 439 | childState = ExecInitNode(outerPlan, estate, eflags); |
| 440 | outerPlanState(sisstate) = childState; |
| 441 | |
| 442 | Assert(node->scan.plan.qual == NULL); |
| 443 | sisstate->ss.ps.qual = NULL; |
| 444 | |
| 445 | /* Misc initialization |
| 446 | * |
| 447 | * Create expression context |
| 448 | */ |
| 449 | ExecAssignExprContext(estate, &sisstate->ss.ps); |
| 450 | |
| 451 | /* |
| 452 | * Initialize result slot and type. |
| 453 | */ |
| 454 | ExecInitResultTupleSlotTL(&sisstate->ss.ps, &TTSOpsMinimalTuple); |
| 455 | |
| 456 | sisstate->ss.ps.ps_ProjInfo = NULL; |
| 457 | |
| 458 | /* |
| 459 | * When doing EXPLAIN only, we won't actually execute anything, so don't |
| 460 | * bother initializing the state. This isn't merely an optimization: |
| 461 | * closing a cross-slice ShareInputScan waits for the consumers to finish, |
| 462 | * but if we don't execute anything, it will hang forever. |
| 463 | * |
no test coverage detected