Header And Logo

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

Functions

nodeForeignscan.h File Reference

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

Go to the source code of this file.

Functions

ForeignScanStateExecInitForeignScan (ForeignScan *node, EState *estate, int eflags)
TupleTableSlotExecForeignScan (ForeignScanState *node)
void ExecEndForeignScan (ForeignScanState *node)
void ExecReScanForeignScan (ForeignScanState *node)

Function Documentation

void ExecEndForeignScan ( ForeignScanState node  ) 
TupleTableSlot* ExecForeignScan ( ForeignScanState node  ) 

Definition at line 89 of file nodeForeignscan.c.

References ExecScan(), ForeignNext(), and ForeignRecheck().

Referenced by ExecProcNode().

ForeignScanState* ExecInitForeignScan ( ForeignScan node,
EState estate,
int  eflags 
)

Definition at line 102 of file nodeForeignscan.c.

References Assert, FdwRoutine::BeginForeignScan, EXEC_FLAG_BACKWARD, EXEC_FLAG_MARK, ExecAssignExprContext(), ExecAssignResultTypeFromTL(), ExecAssignScanProjectionInfo(), ExecAssignScanType(), ExecInitExpr(), ExecInitResultTupleSlot(), ExecInitScanTupleSlot(), ExecOpenScanRelation(), ForeignScanState::fdw_state, ForeignScanState::fdwroutine, GetFdwRoutineForRelation(), makeNode, Scan::plan, PlanState::plan, ScanState::ps, PlanState::ps_TupFromTlist, Plan::qual, PlanState::qual, RelationGetDescr, ForeignScan::scan, Scan::scanrelid, ForeignScanState::ss, ScanState::ss_currentRelation, PlanState::state, Plan::targetlist, and PlanState::targetlist.

Referenced by ExecInitNode().

{
    ForeignScanState *scanstate;
    Relation    currentRelation;
    FdwRoutine *fdwroutine;

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

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

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

    scanstate->ss.ps.ps_TupFromTlist = false;

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

    /*
     * open the base relation and acquire appropriate lock on it.
     */
    currentRelation = ExecOpenScanRelation(estate, node->scan.scanrelid, eflags);
    scanstate->ss.ss_currentRelation = currentRelation;

    /*
     * get the scan type from the relation descriptor.  (XXX at some point we
     * might want to let the FDW editorialize on the scan tupdesc.)
     */
    ExecAssignScanType(&scanstate->ss, RelationGetDescr(currentRelation));

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

    /*
     * Acquire function pointers from the FDW's handler, and init fdw_state.
     */
    fdwroutine = GetFdwRoutineForRelation(currentRelation, true);
    scanstate->fdwroutine = fdwroutine;
    scanstate->fdw_state = NULL;

    /*
     * Tell the FDW to initiate the scan.
     */
    fdwroutine->BeginForeignScan(scanstate, eflags);

    return scanstate;
}

void ExecReScanForeignScan ( ForeignScanState node  )