---------------------------------------------------------------- * ExecInitProjectSet * * Creates the run-time state information for the ProjectSet node * produced by the planner and initializes outer relations * (child nodes). * ---------------------------------------------------------------- */
| 217 | * ---------------------------------------------------------------- |
| 218 | */ |
| 219 | ProjectSetState * |
| 220 | ExecInitProjectSet(ProjectSet *node, EState *estate, int eflags) |
| 221 | { |
| 222 | ProjectSetState *state; |
| 223 | ListCell *lc; |
| 224 | int off; |
| 225 | |
| 226 | /* check for unsupported flags */ |
| 227 | Assert(!(eflags & (EXEC_FLAG_MARK | EXEC_FLAG_BACKWARD))); |
| 228 | |
| 229 | /* |
| 230 | * create state structure |
| 231 | */ |
| 232 | state = makeNode(ProjectSetState); |
| 233 | state->ps.plan = (Plan *) node; |
| 234 | state->ps.state = estate; |
| 235 | state->ps.ExecProcNode = ExecProjectSet; |
| 236 | |
| 237 | state->pending_srf_tuples = false; |
| 238 | |
| 239 | /* |
| 240 | * Miscellaneous initialization |
| 241 | * |
| 242 | * create expression context for node |
| 243 | */ |
| 244 | ExecAssignExprContext(estate, &state->ps); |
| 245 | |
| 246 | /* |
| 247 | * initialize child nodes |
| 248 | */ |
| 249 | outerPlanState(state) = ExecInitNode(outerPlan(node), estate, eflags); |
| 250 | |
| 251 | /* |
| 252 | * we don't use inner plan |
| 253 | */ |
| 254 | Assert(innerPlan(node) == NULL); |
| 255 | |
| 256 | /* |
| 257 | * tuple table and result type initialization |
| 258 | */ |
| 259 | ExecInitResultTupleSlotTL(&state->ps, &TTSOpsVirtual); |
| 260 | |
| 261 | /* Create workspace for per-tlist-entry expr state & SRF-is-done state */ |
| 262 | state->nelems = list_length(node->plan.targetlist); |
| 263 | state->elems = (Node **) |
| 264 | palloc(sizeof(Node *) * state->nelems); |
| 265 | state->elemdone = (ExprDoneCond *) |
| 266 | palloc(sizeof(ExprDoneCond) * state->nelems); |
| 267 | |
| 268 | /* |
| 269 | * Build expressions to evaluate targetlist. We can't use |
| 270 | * ExecBuildProjectionInfo here, since that doesn't deal with SRFs. |
| 271 | * Instead compile each expression separately, using |
| 272 | * ExecInitFunctionResultSet where applicable. |
| 273 | */ |
| 274 | off = 0; |
| 275 | foreach(lc, node->plan.targetlist) |
| 276 | { |
no test coverage detected