Header And Logo

| The world's most advanced open source database.


nodeWorktablescan.h File Reference

#include "nodes/execnodes.h"
Include dependency graph for nodeWorktablescan.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


WorkTableScanStateExecInitWorkTableScan (WorkTableScan *node, EState *estate, int eflags)
TupleTableSlotExecWorkTableScan (WorkTableScanState *node)
void ExecEndWorkTableScan (WorkTableScanState *node)
void ExecReScanWorkTableScan (WorkTableScanState *node)

Function Documentation

void ExecEndWorkTableScan ( WorkTableScanState node  ) 

Definition at line 189 of file nodeWorktablescan.c.

References ExecClearTuple(), ExecFreeExprContext(), ScanState::ps, PlanState::ps_ResultTupleSlot, WorkTableScanState::ss, and ScanState::ss_ScanTupleSlot.

Referenced by ExecEndNode().

     * Free exprcontext

     * clean out the tuple table

WorkTableScanState* ExecInitWorkTableScan ( WorkTableScan node,
EState estate,
int  eflags 

Definition at line 128 of file nodeWorktablescan.c.

References Assert, EXEC_FLAG_BACKWARD, EXEC_FLAG_MARK, ExecAssignExprContext(), ExecAssignResultTypeFromTL(), ExecInitExpr(), ExecInitResultTupleSlot(), ExecInitScanTupleSlot(), innerPlan, makeNode, NULL, outerPlan, Scan::plan, PlanState::plan, ScanState::ps, PlanState::ps_TupFromTlist, Plan::qual, PlanState::qual, WorkTableScanState::rustate, WorkTableScan::scan, WorkTableScanState::ss, PlanState::state, Plan::targetlist, and PlanState::targetlist.

Referenced by ExecInitNode().

    WorkTableScanState *scanstate;

    /* check for unsupported flags */
    Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));

     * WorkTableScan should not have any children.
    Assert(outerPlan(node) == NULL);
    Assert(innerPlan(node) == NULL);

     * create new WorkTableScanState for node
    scanstate = makeNode(WorkTableScanState);
    scanstate->ss.ps.plan = (Plan *) node;
    scanstate->ss.ps.state = estate;
    scanstate->rustate = NULL;  /* we'll set this later */

     * Miscellaneous initialization
     * create expression context for node
    ExecAssignExprContext(estate, &scanstate->ss.ps);

     * initialize child expressions
    scanstate->ss.ps.targetlist = (List *)
        ExecInitExpr((Expr *) node->scan.plan.targetlist,
                     (PlanState *) scanstate);
    scanstate->ss.ps.qual = (List *)
        ExecInitExpr((Expr *) node->scan.plan.qual,
                     (PlanState *) scanstate);

     * tuple table initialization
    ExecInitResultTupleSlot(estate, &scanstate->ss.ps);
    ExecInitScanTupleSlot(estate, &scanstate->ss);

     * Initialize result tuple type, but not yet projection info.

    scanstate->ss.ps.ps_TupFromTlist = false;

    return scanstate;

void ExecReScanWorkTableScan ( WorkTableScanState node  ) 
TupleTableSlot* ExecWorkTableScan ( WorkTableScanState node  ) 

Definition at line 81 of file nodeWorktablescan.c.

References Assert, DatumGetPointer, ExecAssignScanProjectionInfo(), ExecAssignScanType(), ExecGetResultType(), ExecScan(), IsA, NULL, PlanState::plan, RecursiveUnionState::ps, ScanState::ps, WorkTableScanState::rustate, WorkTableScanState::ss, PlanState::state, WorkTableScanNext(), WorkTableScanRecheck(), and WorkTableScan::wtParam.

Referenced by ExecProcNode().

     * On the first call, find the ancestor RecursiveUnion's state via the
     * Param slot reserved for it.  (We can't do this during node init because
     * there are corner cases where we'll get the init call before the
     * RecursiveUnion does.)
    if (node->rustate == NULL)
        WorkTableScan *plan = (WorkTableScan *) node->ss.ps.plan;
        EState     *estate = node->ss.ps.state;
        ParamExecData *param;

        param = &(estate->es_param_exec_vals[plan->wtParam]);
        Assert(param->execPlan == NULL);
        node->rustate = (RecursiveUnionState *) DatumGetPointer(param->value);
        Assert(node->rustate && IsA(node->rustate, RecursiveUnionState));

         * The scan tuple type (ie, the rowtype we expect to find in the work
         * table) is the same as the result rowtype of the ancestor
         * RecursiveUnion node.  Note this depends on the assumption that
         * RecursiveUnion doesn't allow projection.

         * Now we can initialize the projection info.  This must be completed
         * before we can call ExecScan().

    return ExecScan(&node->ss,
                    (ExecScanAccessMtd) WorkTableScanNext,
                    (ExecScanRecheckMtd) WorkTableScanRecheck);