* Start execution of an EvalPlanQual plan tree. * * This is a cut-down version of ExecutorStart(): we copy some state from * the top-level estate rather than initializing it fresh. */
| 3943 | * the top-level estate rather than initializing it fresh. |
| 3944 | */ |
| 3945 | static void |
| 3946 | EvalPlanQualStart(EPQState *epqstate, Plan *planTree) |
| 3947 | { |
| 3948 | EState *parentestate = epqstate->parentestate; |
| 3949 | Index rtsize = parentestate->es_range_table_size; |
| 3950 | EState *rcestate; |
| 3951 | MemoryContext oldcontext; |
| 3952 | ListCell *l; |
| 3953 | |
| 3954 | epqstate->recheckestate = rcestate = CreateExecutorState(); |
| 3955 | |
| 3956 | oldcontext = MemoryContextSwitchTo(rcestate->es_query_cxt); |
| 3957 | |
| 3958 | /* signal that this is an EState for executing EPQ */ |
| 3959 | rcestate->es_epq_active = epqstate; |
| 3960 | |
| 3961 | /* |
| 3962 | * Child EPQ EStates share the parent's copy of unchanging state such as |
| 3963 | * the snapshot, rangetable, and external Param info. They need their own |
| 3964 | * copies of local state, including a tuple table, es_param_exec_vals, |
| 3965 | * result-rel info, etc. |
| 3966 | */ |
| 3967 | rcestate->es_direction = ForwardScanDirection; |
| 3968 | rcestate->es_snapshot = parentestate->es_snapshot; |
| 3969 | rcestate->es_crosscheck_snapshot = parentestate->es_crosscheck_snapshot; |
| 3970 | rcestate->es_range_table = parentestate->es_range_table; |
| 3971 | rcestate->es_range_table_size = parentestate->es_range_table_size; |
| 3972 | rcestate->es_relations = parentestate->es_relations; |
| 3973 | rcestate->es_queryEnv = parentestate->es_queryEnv; |
| 3974 | rcestate->es_rowmarks = parentestate->es_rowmarks; |
| 3975 | rcestate->es_plannedstmt = parentestate->es_plannedstmt; |
| 3976 | rcestate->es_junkFilter = parentestate->es_junkFilter; |
| 3977 | rcestate->es_output_cid = parentestate->es_output_cid; |
| 3978 | |
| 3979 | /* |
| 3980 | * ResultRelInfos needed by subplans are initialized from scratch when the |
| 3981 | * subplans themselves are initialized. |
| 3982 | */ |
| 3983 | rcestate->es_result_relations = NULL; |
| 3984 | /* es_trig_target_relations must NOT be copied */ |
| 3985 | rcestate->es_top_eflags = parentestate->es_top_eflags; |
| 3986 | rcestate->es_instrument = parentestate->es_instrument; |
| 3987 | /* es_auxmodifytables must NOT be copied */ |
| 3988 | |
| 3989 | /* |
| 3990 | * The external param list is simply shared from parent. The internal |
| 3991 | * param workspace has to be local state, but we copy the initial values |
| 3992 | * from the parent, so as to have access to any param values that were |
| 3993 | * already set from other parts of the parent's plan tree. |
| 3994 | */ |
| 3995 | rcestate->es_param_list_info = parentestate->es_param_list_info; |
| 3996 | if (parentestate->es_plannedstmt->paramExecTypes != NIL) |
| 3997 | { |
| 3998 | int i; |
| 3999 | |
| 4000 | /* |
| 4001 | * Force evaluation of any InitPlan outputs that could be needed by |
| 4002 | * the subplan. (With more complexity, maybe we could postpone this |
no test coverage detected