Header And Logo

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

Functions

nodeValuesscan.h File Reference

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

Go to the source code of this file.

Functions

ValuesScanStateExecInitValuesScan (ValuesScan *node, EState *estate, int eflags)
TupleTableSlotExecValuesScan (ValuesScanState *node)
void ExecEndValuesScan (ValuesScanState *node)
void ExecValuesMarkPos (ValuesScanState *node)
void ExecValuesRestrPos (ValuesScanState *node)
void ExecReScanValuesScan (ValuesScanState *node)

Function Documentation

void ExecEndValuesScan ( ValuesScanState node  ) 
ValuesScanState* ExecInitValuesScan ( ValuesScan node,
EState estate,
int  eflags 
)

Definition at line 189 of file nodeValuesscan.c.

References ValuesScanState::array_len, Assert, Alias::colnames, ValuesScanState::curr_idx, RangeTblEntry::eref, EState::es_range_table, ExecAssignExprContext(), ExecAssignResultTypeFromTL(), ExecAssignScanProjectionInfo(), ExecAssignScanType(), ExecInitExpr(), ExecInitResultTupleSlot(), ExecInitScanTupleSlot(), ExecTypeFromExprList(), ValuesScanState::exprlists, i, innerPlan, lfirst, linitial, list_length(), makeNode, ValuesScanState::marked_idx, NULL, outerPlan, palloc(), Scan::plan, PlanState::plan, ScanState::ps, PlanState::ps_ExprContext, PlanState::ps_TupFromTlist, Plan::qual, PlanState::qual, ValuesScanState::rowcontext, rt_fetch, ValuesScan::scan, Scan::scanrelid, ValuesScanState::ss, PlanState::state, Plan::targetlist, PlanState::targetlist, and ValuesScan::values_lists.

Referenced by ExecInitNode().

{
    ValuesScanState *scanstate;
    RangeTblEntry *rte = rt_fetch(node->scan.scanrelid,
                                  estate->es_range_table);
    TupleDesc   tupdesc;
    ListCell   *vtl;
    int         i;
    PlanState  *planstate;

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

    /*
     * create new ScanState for node
     */
    scanstate = makeNode(ValuesScanState);
    scanstate->ss.ps.plan = (Plan *) node;
    scanstate->ss.ps.state = estate;

    /*
     * Miscellaneous initialization
     */
    planstate = &scanstate->ss.ps;

    /*
     * Create expression contexts.  We need two, one for per-sublist
     * processing and one for execScan.c to use for quals and projections. We
     * cheat a little by using ExecAssignExprContext() to build both.
     */
    ExecAssignExprContext(estate, planstate);
    scanstate->rowcontext = planstate->ps_ExprContext;
    ExecAssignExprContext(estate, planstate);

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

    /*
     * 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);

    /*
     * get info about values list
     */
    tupdesc = ExecTypeFromExprList((List *) linitial(node->values_lists),
                                   rte->eref->colnames);

    ExecAssignScanType(&scanstate->ss, tupdesc);

    /*
     * Other node-specific setup
     */
    scanstate->marked_idx = -1;
    scanstate->curr_idx = -1;
    scanstate->array_len = list_length(node->values_lists);

    /* convert list of sublists into array of sublists for easy addressing */
    scanstate->exprlists = (List **)
        palloc(scanstate->array_len * sizeof(List *));
    i = 0;
    foreach(vtl, node->values_lists)
    {
        scanstate->exprlists[i++] = (List *) lfirst(vtl);
    }

    scanstate->ss.ps.ps_TupFromTlist = false;

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

    return scanstate;
}

void ExecReScanValuesScan ( ValuesScanState node  ) 
void ExecValuesMarkPos ( ValuesScanState node  ) 

Definition at line 307 of file nodeValuesscan.c.

References ValuesScanState::curr_idx, and ValuesScanState::marked_idx.

Referenced by ExecMarkPos().

{
    node->marked_idx = node->curr_idx;
}

void ExecValuesRestrPos ( ValuesScanState node  ) 

Definition at line 319 of file nodeValuesscan.c.

References ValuesScanState::curr_idx, and ValuesScanState::marked_idx.

Referenced by ExecRestrPos().

{
    node->curr_idx = node->marked_idx;
}

TupleTableSlot* ExecValuesScan ( ValuesScanState node  )