* EvalPlanQualInit -- initialize during creation of a plan state node * that might need to invoke EPQ processing. * * Note: subplan/auxrowmarks can be NULL/NIL if they will be set later * with EvalPlanQualSetPlan. */
| 3673 | * with EvalPlanQualSetPlan. |
| 3674 | */ |
| 3675 | void |
| 3676 | EvalPlanQualInit(EPQState *epqstate, EState *parentestate, |
| 3677 | Plan *subplan, List *auxrowmarks, int epqParam) |
| 3678 | { |
| 3679 | Index rtsize = parentestate->es_range_table_size; |
| 3680 | |
| 3681 | /* initialize data not changing over EPQState's lifetime */ |
| 3682 | epqstate->parentestate = parentestate; |
| 3683 | epqstate->epqParam = epqParam; |
| 3684 | |
| 3685 | /* |
| 3686 | * Allocate space to reference a slot for each potential rti - do so now |
| 3687 | * rather than in EvalPlanQualBegin(), as done for other dynamically |
| 3688 | * allocated resources, so EvalPlanQualSlot() can be used to hold tuples |
| 3689 | * that *may* need EPQ later, without forcing the overhead of |
| 3690 | * EvalPlanQualBegin(). |
| 3691 | */ |
| 3692 | epqstate->tuple_table = NIL; |
| 3693 | epqstate->relsubs_slot = (TupleTableSlot **) |
| 3694 | palloc0(rtsize * sizeof(TupleTableSlot *)); |
| 3695 | |
| 3696 | /* ... and remember data that EvalPlanQualBegin will need */ |
| 3697 | epqstate->plan = subplan; |
| 3698 | epqstate->arowMarks = auxrowmarks; |
| 3699 | |
| 3700 | /* ... and mark the EPQ state inactive */ |
| 3701 | epqstate->origslot = NULL; |
| 3702 | epqstate->recheckestate = NULL; |
| 3703 | epqstate->recheckplanstate = NULL; |
| 3704 | epqstate->relsubs_rowmark = NULL; |
| 3705 | epqstate->relsubs_done = NULL; |
| 3706 | } |
| 3707 | |
| 3708 | /* |
| 3709 | * EvalPlanQualSetPlan -- set or change subplan of an EPQState. |
no test coverage detected