Header And Logo

PostgreSQL
| The world's most advanced open source database.

Functions

nodeSubqueryscan.h File Reference

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

Go to the source code of this file.

Functions

SubqueryScanStateExecInitSubqueryScan (SubqueryScan *node, EState *estate, int eflags)
TupleTableSlotExecSubqueryScan (SubqueryScanState *node)
void ExecEndSubqueryScan (SubqueryScanState *node)
void ExecReScanSubqueryScan (SubqueryScanState *node)

Function Documentation

void ExecEndSubqueryScan ( SubqueryScanState node  ) 

Definition at line 165 of file nodeSubqueryscan.c.

References ExecClearTuple(), ExecEndNode(), ExecFreeExprContext(), ScanState::ps, PlanState::ps_ResultTupleSlot, SubqueryScanState::ss, ScanState::ss_ScanTupleSlot, and SubqueryScanState::subplan.

Referenced by ExecEndNode().

{
    /*
     * Free the exprcontext
     */
    ExecFreeExprContext(&node->ss.ps);

    /*
     * clean out the upper tuple table
     */
    ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
    ExecClearTuple(node->ss.ss_ScanTupleSlot);

    /*
     * close down subquery
     */
    ExecEndNode(node->subplan);
}

SubqueryScanState* ExecInitSubqueryScan ( SubqueryScan node,
EState estate,
int  eflags 
)

Definition at line 95 of file nodeSubqueryscan.c.

References Assert, EXEC_FLAG_MARK, ExecAssignExprContext(), ExecAssignResultTypeFromTL(), ExecAssignScanProjectionInfo(), ExecAssignScanType(), ExecGetResultType(), ExecInitExpr(), ExecInitNode(), ExecInitResultTupleSlot(), ExecInitScanTupleSlot(), innerPlan, makeNode, NULL, outerPlan, Scan::plan, PlanState::plan, ScanState::ps, PlanState::ps_TupFromTlist, Plan::qual, PlanState::qual, SubqueryScan::scan, SubqueryScanState::ss, PlanState::state, SubqueryScan::subplan, SubqueryScanState::subplan, Plan::targetlist, and PlanState::targetlist.

Referenced by ExecInitNode().

{
    SubqueryScanState *subquerystate;

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

    /* SubqueryScan should not have any "normal" children */
    Assert(outerPlan(node) == NULL);
    Assert(innerPlan(node) == NULL);

    /*
     * create state structure
     */
    subquerystate = makeNode(SubqueryScanState);
    subquerystate->ss.ps.plan = (Plan *) node;
    subquerystate->ss.ps.state = estate;

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

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

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

    /*
     * initialize subquery
     */
    subquerystate->subplan = ExecInitNode(node->subplan, estate, eflags);

    subquerystate->ss.ps.ps_TupFromTlist = false;

    /*
     * Initialize scan tuple type (needed by ExecAssignScanProjectionInfo)
     */
    ExecAssignScanType(&subquerystate->ss,
                       ExecGetResultType(subquerystate->subplan));

    /*
     * Initialize result tuple type and projection info.
     */
    ExecAssignResultTypeFromTL(&subquerystate->ss.ps);
    ExecAssignScanProjectionInfo(&subquerystate->ss);

    return subquerystate;
}

void ExecReScanSubqueryScan ( SubqueryScanState node  ) 

Definition at line 191 of file nodeSubqueryscan.c.

References PlanState::chgParam, ExecReScan(), ExecScanReScan(), NULL, ScanState::ps, SubqueryScanState::ss, SubqueryScanState::subplan, and UpdateChangedParamSet().

Referenced by ExecReScan().

{
    ExecScanReScan(&node->ss);

    /*
     * ExecReScan doesn't know about my subplan, so I have to do
     * changed-parameter signaling myself.  This is just as well, because the
     * subplan has its own memory context in which its chgParam state lives.
     */
    if (node->ss.ps.chgParam != NULL)
        UpdateChangedParamSet(node->subplan, node->ss.ps.chgParam);

    /*
     * if chgParam of subnode is not null then plan will be re-scanned by
     * first ExecProcNode.
     */
    if (node->subplan->chgParam == NULL)
        ExecReScan(node->subplan);
}

TupleTableSlot* ExecSubqueryScan ( SubqueryScanState node  )