Header And Logo

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

Functions

nodeSeqscan.h File Reference

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

Go to the source code of this file.

Functions

SeqScanStateExecInitSeqScan (SeqScan *node, EState *estate, int eflags)
TupleTableSlotExecSeqScan (SeqScanState *node)
void ExecEndSeqScan (SeqScanState *node)
void ExecSeqMarkPos (SeqScanState *node)
void ExecSeqRestrPos (SeqScanState *node)
void ExecReScanSeqScan (SeqScanState *node)

Function Documentation

void ExecEndSeqScan ( SeqScanState node  ) 

Definition at line 221 of file nodeSeqscan.c.

References ExecClearTuple(), ExecCloseScanRelation(), ExecFreeExprContext(), heap_endscan(), ScanState::ps, PlanState::ps_ResultTupleSlot, ScanState::ss_currentRelation, ScanState::ss_currentScanDesc, and ScanState::ss_ScanTupleSlot.

Referenced by ExecEndNode().

{
    Relation    relation;
    HeapScanDesc scanDesc;

    /*
     * get information from node
     */
    relation = node->ss_currentRelation;
    scanDesc = node->ss_currentScanDesc;

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

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

    /*
     * close heap scan
     */
    heap_endscan(scanDesc);

    /*
     * close the heap relation.
     */
    ExecCloseScanRelation(relation);
}

SeqScanState* ExecInitSeqScan ( SeqScan node,
EState estate,
int  eflags 
)

Definition at line 157 of file nodeSeqscan.c.

References Assert, ExecAssignExprContext(), ExecAssignResultTypeFromTL(), ExecAssignScanProjectionInfo(), ExecInitExpr(), ExecInitResultTupleSlot(), ExecInitScanTupleSlot(), InitScanRelation(), innerPlan, makeNode, NULL, outerPlan, Scan::plan, PlanState::plan, ScanState::ps, PlanState::ps_TupFromTlist, Plan::qual, PlanState::qual, PlanState::state, Plan::targetlist, and PlanState::targetlist.

Referenced by ExecInitNode().

{
    SeqScanState *scanstate;

    /*
     * Once upon a time it was possible to have an outerPlan of a SeqScan, but
     * not any more.
     */
    Assert(outerPlan(node) == NULL);
    Assert(innerPlan(node) == NULL);

    /*
     * create state structure
     */
    scanstate = makeNode(SeqScanState);
    scanstate->ps.plan = (Plan *) node;
    scanstate->ps.state = estate;

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

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

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

    /*
     * initialize scan relation
     */
    InitScanRelation(scanstate, estate, eflags);

    scanstate->ps.ps_TupFromTlist = false;

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

    return scanstate;
}

void ExecReScanSeqScan ( SeqScanState node  ) 

Definition at line 266 of file nodeSeqscan.c.

References ExecScanReScan(), heap_rescan(), NULL, and ScanState::ss_currentScanDesc.

Referenced by ExecReScan().

{
    HeapScanDesc scan;

    scan = node->ss_currentScanDesc;

    heap_rescan(scan,           /* scan desc */
                NULL);          /* new scan keys */

    ExecScanReScan((ScanState *) node);
}

void ExecSeqMarkPos ( SeqScanState node  ) 

Definition at line 285 of file nodeSeqscan.c.

References heap_markpos(), and ScanState::ss_currentScanDesc.

Referenced by ExecMarkPos().

{
    HeapScanDesc scan = node->ss_currentScanDesc;

    heap_markpos(scan);
}

void ExecSeqRestrPos ( SeqScanState node  ) 

Definition at line 299 of file nodeSeqscan.c.

References ExecClearTuple(), heap_restrpos(), ScanState::ss_currentScanDesc, and ScanState::ss_ScanTupleSlot.

Referenced by ExecRestrPos().

{
    HeapScanDesc scan = node->ss_currentScanDesc;

    /*
     * Clear any reference to the previously returned tuple.  This is needed
     * because the slot is simply pointing at scan->rs_cbuf, which
     * heap_restrpos will change; we'd have an internally inconsistent slot if
     * we didn't do this.
     */
    ExecClearTuple(node->ss_ScanTupleSlot);

    heap_restrpos(scan);
}

TupleTableSlot* ExecSeqScan ( SeqScanState node  ) 

Definition at line 111 of file nodeSeqscan.c.

References ExecScan(), SeqNext(), and SeqRecheck().

Referenced by ExecProcNode().