---------------------------------------------------------------- * ExecReScanRecursiveUnion * * Rescans the relation. * ---------------------------------------------------------------- */
| 317 | * ---------------------------------------------------------------- |
| 318 | */ |
| 319 | void |
| 320 | ExecReScanRecursiveUnion(RecursiveUnionState *node) |
| 321 | { |
| 322 | PlanState *outerPlan = outerPlanState(node); |
| 323 | PlanState *innerPlan = innerPlanState(node); |
| 324 | RecursiveUnion *plan = (RecursiveUnion *) node->ps.plan; |
| 325 | |
| 326 | /* |
| 327 | * Set recursive term's chgParam to tell it that we'll modify the working |
| 328 | * table and therefore it has to rescan. |
| 329 | */ |
| 330 | innerPlan->chgParam = bms_add_member(innerPlan->chgParam, plan->wtParam); |
| 331 | |
| 332 | /* |
| 333 | * if chgParam of subnode is not null then plan will be re-scanned by |
| 334 | * first ExecProcNode. Because of above, we only have to do this to the |
| 335 | * non-recursive term. |
| 336 | */ |
| 337 | if (outerPlan->chgParam == NULL) |
| 338 | ExecReScan(outerPlan); |
| 339 | |
| 340 | /* Release any hashtable storage */ |
| 341 | if (node->tableContext) |
| 342 | MemoryContextResetAndDeleteChildren(node->tableContext); |
| 343 | |
| 344 | /* And rebuild empty hashtable if needed */ |
| 345 | /* |
| 346 | * RECURSIVE_CTE_FIXME: It suppose plan->numCols should be 0 if we don't |
| 347 | * support recursive union. QP should fix this later. |
| 348 | */ |
| 349 | if (plan->numCols > 0) |
| 350 | ResetTupleHashTable(node->hashtable); |
| 351 | |
| 352 | /* reset processing state */ |
| 353 | node->recursing = false; |
| 354 | node->intermediate_empty = true; |
| 355 | tuplestore_clear(node->working_table); |
| 356 | tuplestore_clear(node->intermediate_table); |
| 357 | } |
| 358 | |
| 359 | void |
| 360 | ExecSquelchRecursiveUnion(RecursiveUnionState *node, bool force) |
no test coverage detected