---------------------------------------------------------------- * ExecSubPlan * * This is the main entry point for execution of a regular SubPlan. * ---------------------------------------------------------------- */
| 71 | * ---------------------------------------------------------------- |
| 72 | */ |
| 73 | Datum |
| 74 | ExecSubPlan(SubPlanState *node, |
| 75 | ExprContext *econtext, |
| 76 | bool *isNull) |
| 77 | { |
| 78 | SubPlan *subplan = node->subplan; |
| 79 | EState *estate = node->planstate->state; |
| 80 | ScanDirection dir = estate->es_direction; |
| 81 | Datum retval; |
| 82 | |
| 83 | CHECK_FOR_INTERRUPTS(); |
| 84 | |
| 85 | /* Set non-null as default */ |
| 86 | *isNull = false; |
| 87 | |
| 88 | /* Sanity checks */ |
| 89 | if (subplan->subLinkType == CTE_SUBLINK) |
| 90 | elog(ERROR, "CTE subplans should not be executed via ExecSubPlan"); |
| 91 | if (subplan->setParam != NIL && subplan->subLinkType != MULTIEXPR_SUBLINK) |
| 92 | elog(ERROR, "cannot set parent params from subquery"); |
| 93 | |
| 94 | /* Force forward-scan mode for evaluation */ |
| 95 | estate->es_direction = ForwardScanDirection; |
| 96 | |
| 97 | /* Select appropriate evaluation strategy */ |
| 98 | if (subplan->useHashTable) |
| 99 | retval = ExecHashSubPlan(node, econtext, isNull); |
| 100 | else |
| 101 | retval = ExecScanSubPlan(node, econtext, isNull); |
| 102 | |
| 103 | /* restore scan direction */ |
| 104 | estate->es_direction = dir; |
| 105 | |
| 106 | return retval; |
| 107 | } |
| 108 | |
| 109 | /* |
| 110 | * ExecHashSubPlan: store subselect result in an in-memory hash table |
no test coverage detected