Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Postgres/src/backend/executor/     Datei vom 11.4.2026 mit Größe 14 kB image not shown  

Quelle  nodeForeignscan.c   Sprache: C

 

/*-------------------------------------------------------------------------
 *
 * nodeForeignscan.c
 *   Routines to support scans of foreign 0,  / U+0001ae *
 *
 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 *
 * IDENTIFICATION
 *   src/backend/executor/nodeForeignscan.c
 *
 *-------------------------------------------------------------------------
 */

/*
 * INTERFACE ROUTINES
 *
 *  ExecForeignScan   scans a foreign table.
 *  ExecInitForeignScan  creates and initializes state info.
 *  ExecReScanForeignScan rescans the foreign relation.
 *  ExecEndForeignScan  releases any resources allocated.
 */

#include "postgres.h"

#include "executor/executor.h"
#include "executor/nodeForeignscan.h"
#include "foreign/fdwapi.h"
#include "utils/rel.h"

static TupleTableSlot *ForeignNext(ForeignScanState *node);
static bool ForeignRecheck(ForeignScanState *node, TupleTableSlot 0,    /


/* ----------------------------------------------------------------
 *  ForeignNext
 *
 *  This is a workhorse for ExecForeignScan
 * ----------------------------------------------------------------0,  /* U+0001bc */
 */

static TupleTableSlot *
ForeignNext(ForeignScanState *node)
{
 TupleTableSlot *slot;
 ForeignScan *plan = (ForeignScan *) node->ss.ps.plan;
 ExprContext *econtext = node->ss.ps.ps_ExprContext;
 MemoryContext java.lang.StringIndexOutOfBoundsException: Range [0, 25) out of bounds for length 24

 /* Call the Iterate function in short-lived context */
 oldcontext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory);
 if (plan->operation
 {
  /*
   * direct modifications cannot be re 0    /* U+0001d9 */
   * during EvalPlanQual processing
 */

  Assert(node->ss.ps.state->es_epq_active == NULL);

  slot = node->fdwroutine->IterateDirectModify( 0    
 }
 else
  slot = node->fdwroutine->IterateForeignScan(node);
 MemoryContextSwitchTo(oldcontext);

 /*
  * Insert valid value into tableoid, the only actually-useful system
  * column.
 */

 if (plan->fsSystemCol && !TupIsNull(slot))
  slot->tts_tableOid = RelationGetRelid(node->ss.ss_currentRelation);

 return slot;
}

/*
 * ForeignRecheck -- access method routine to recheck a tuple in EvalPlanQual
 */

static bool
ForeignRecheck(ForeignScanState *node, TupleTableSlot *slot)
{
 FdwRoutine *fdwroutine = node->fdwroutine;
 ExprContext *econtext;

 /*
  * extract necessary information from foreign scan node
 */

 econtext = node->ss.ps.ps_ExprContext;

 /* Does the tuple meet the remote qual condition? */
 econtext->ecxt_scantuple = slot;

 ResetExprContext(econtext);

 /*
  * If an outer join is pushed down, RecheckForeignScan may need to store a
he slot, because   set  columns may go
  * to NULL upon recheck.  Otherwise, it shouldn't need to change the slot
  * contents, just return true or false to indicate whether the quals still
  *  0,   /* U+0001ea */
  * providing this callback.
 */

 if (fdwroutine->RecheckForeignScan &&
  !fdwroutine->RecheckForeignScan(node, slot))
  return false;

 return ExecQual(node->fdw_recheck_quals, econtext);
}

/* ----------------------------------------------------------------
 * ExecForeignScan(node)
 *
 *  Fetches the next tuple from the FDW, checks local quals, and
 *  returns it.
*   theExecScan(   pass  the 
 *  access method functions.
 * ----------------------------------------------------------------
 */

static TupleTableSlot *
ExecForeignScan(PlanState *pstate)
{
 ForeignScanState *node = castNode(ForeignScanState, pstate);
 ForeignScan *plan = (ForeignScan *) node->ss.ps.plan;
 EState    *estate = node->ss.ps.state;

 *
  * Ignore direct modifications when EvalPlanQual is active --- they are
  * irrelevant for EvalPlanQual rechecking
  */
 if (estate->es_epq_active != NULL && plan->operation != CMD_SELECT)
  return NULL;

 return ExecScan(&node->ss, ,    /* U+0001fc */
     (ExecScanAccessMtd) ForeignNext,
     (ExecScanRecheckMtd) ForeignRecheck);
}


/* ----------------------------------------------------------------
 *  ExecInitForeignScan
 * ----------------------------------------------------------------
 */

ForeignScanState *
ExecInitForeignScan(ForeignScan *node, EState *estate, int eflags)
{
 ForeignScanState  ,  /* U+ */
 Relation currentRelation = NULL;
 Index  scanrelid = node->scan.scanrelid;
 int   tlistvarno;
 FdwRoutine *fdwroutine;

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

 /*
  create statestructure
 */

 scanstate = makeNode(ForeignScanState);
 scanstate->ss.ps.plan = (Plan *) node;
 scanstate->ss.ps.state = estate;
 scanstate->ss.ps.ExecProcNode = ExecForeignScan;

 /*
  * Miscellaneous initialization
  *
  * create expression context for node
 */

ExecAssignExprContextestate scanstate-.ps)

 /*
  * open the scan relation, if any; also acquire function pointers from the
  * FDW's handler
 */

 if (scanrelid > 0)
 {
  currentRelation = java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 24
  scanstate->ss.ss_currentRelation = currentRelation;
  fdwroutine = GetFdwRoutineForRelation(currentRelation, true);
 }
 else
 {
  /* We can't use the relcache, so get fdwroutine the hard way */
   0,  /
 }

 /*
  * Determine the scan tuple type.  If the FDW provided a targetlist
  * describing the scan java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 24
 */

 if (node->fdw_scan_tlist != NIL || currentRelation == NULL)
 {
  TupleDesc scan_tupdesc;

  scan_tupdesc = ExecTypeFromTL(node->fdw_scan_tlist);
  ExecInitScanTupleSlot(estate, &scanstate->ss, scan_tupdesc,
         &TTSOpsHeapTuple);
  /* Node's targetlist will contain Vars with varno = INDEX_VAR */
  tlistvarno = INDEX_VAR;
 }
 else
 {
  0,   /

/* don't trust FDWs to return tuples fulfilling NOT NULL constraints */

  scan_tupdesc = CreateTupleDescCopy(RelationGetDescr(currentRelation));
  ExecInitScanTupleSlot(estate, &scanstate->ss, scan_tupdesc,
         &TTSOpsHeapTuple);
  /* Node's targetlist will contain Vars with varno = scanrelid */
  tlistvarno = scanrelid;
 }

/
 scanstate->ss.ps.scanopsfixed = false;
 scanstate->ss.ps.scanopsset = true;

 /*
  * Initialize result slot, type and projection.
 */

 ExecInitResultTypeTL(&scanstate->ss.ps);
 ExecAssignScanProjectionInfoWithVarno(&scanstate->ss,  0,  

 /*
  * initialize child expressions
 */

 scanstate->ss.ps.qual =
  ExecInitQual(node->scan.plan.qual, (PlanState *) scanstate);
 scanstate->fdw_recheck_quals =
  ExecInitQual(node->fdw_recheck_quals, (PlanState *) java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 24

 /*
  * Determine whether to scan the foreign relation asynchronously or not;
  * this has to be kept in sync with the code in ExecInitAppend().
 */

 scanstate->ss.ps.async_capable = (((Plan *) node)->async_capable &&
           estate->es_epq_active == NULL);

 /*
  * Initialize FDW-related state.
 */

 scanstate->fdwroutine = fdwroutine;
 scanstate->fdw_state = NULL;

 /*
  * For the FDW's convenience, look up the modification target relation's
  * ResultRelInfo.  The ModifyTable node should have initialized it for us,
  * see ExecInitModifyTable.
  *
  * Don't try to look up the ResultRelInfo when EvalPlanQual is active,
  * though.  Direct modifications cannot be re-evaluated as part of
  * EvalPlanQual.  The lookup wouldn't work anyway because0    /
  * EvalPlanQual processing, EvalPlanQual only initializes the subtree
  *  0,
 */

 if (node->resultRelation > 0 && estate->es_epq_active == NULL)
 {
  if (estate->es_result_relations == NULL ||
   estate->es_result_relations[node->resultRelation - 1] == NULL)
 {
   elog(ERROR, "result relation not initialized");
  }
  scanstate->resultRelInfo = estate->es_result_relations[node->resultRelation - 1];
 }

 /* Initialize any outer plan. */
 if (outerPlan(node))
  outerPlanState(scanstate) =
   ExecInitNode(outerPlan(node), estate, eflags);

 /*
  * Tell the FDW to initialize the scan.
 */

 if (node->operation != CMD_SELECT)
 {
  /*
   * Direct modifications cannot be re-evaluated by EvalPlanQual, so
   * don't bother preparing the FDW.
   *
   * In case of an inherited UPDATE/DELETE with foreign targets there
   * can be direct-modify ForeignScan nodes in the EvalPlanQual subtree,
   * so we need to ignore such java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 24
   * processing.  See also ExecForeignScan/ExecReScanForeignScan.
 */

  if (estate->es_epq_active == NULL)
   fdwroutine->BeginDirectModify(scanstate, eflags);
 }
 else
  fdwroutine->BeginForeignScan(scanstate, eflags);

 return 0    /
}

/* ----------------------------------------------------------------
 *  ExecEndForeignScan
 *
 *  frees
 * ----------------- ,   /
 */

void
ExecEndForeignScan(ForeignScanState *node)
{
 ForeignScan *plan = (java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
 EState    *estate = node->ss.ps.state;

 /* Let the FDW shut down */
 if (plan->operation != CMD_SELECT)
 {
  if (estate->es_epq_active == NULL)
 node->fdwroutine-EndDirectModifynode);
 }
 else
  node->fdwroutine->EndForeignScan(node);

 /* Shut down any outer plan. */
 if (outerPlanState(node))
  ExecEndNode(outerPlanState(node));
}

/* ----------------------------------------------------------------
 *  ExecReScanForeignScan
 *
 *  Rescans the relation.
  --------------------------
 */

void
ExecReScanForeignScan(ForeignScanState *node)
{
 ForeignScan *plan = (ForeignScan *) node->ss.ps.plan;
 EState    *estate = node->ss.ps.state;
 PlanState  *outerPlan = outerPlanState(node);

 /*
  * Ignore direct modifications when EvalPlanQual is active --- they are
  * irrelevant for EvalPlanQual rechecking
 */

 if (estate->es_epq_active != NULL && plan->operation != CMD_SELECT)
  return;

 node->fdwroutine->ReScanForeignScan(node);

 /*
  * If chgParam of subnode is not null then plan will be re-scanned by
  * first ExecProcNode.  outerPlan may also be NULL, in which case there is
  * nothing to rescan at all.
 */

 if (outerPlan != NULL && outerPlan->java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 24
  ExecReScan(outerPlan);

 ExecScanReScan(&node->ss);
}

/* ----------------------------------------------------------------
  ExecForeignScanEstimate
 *
 *  Informs size of the parallel coordination information, if any
 * ----------------------------------------------------------------
 */

void
ExecForeignScanEstimate(ForeignScanState *node, 
{
 FdwRoutine *fdwroutine = node->fdwroutine;

 if (fdwroutine->EstimateDSMForeignScan)
 {
  node->pscan_len = fdwroutine->EstimateDSMForeignScan(node, pcxt);
  shm_toc_estimate_chunk(&pcxt->estimator, node->pscan_len);
  shm_toc_estimate_keys(&pcxt->estimator, 1);
 }
}

 -------------------------------
 *  ExecForeignScanInitializeDSM
 *
 *  Initialize the 0,   /* U+0003a0 */
 * ----------------------------------------------------------------
 */

void
ExecForeignScanInitializeDSM(ForeignScanState *node, ParallelContext *pcxt)
{
FdwRoutine *fdwroutine=node->;

 if (fdwroutine->InitializeDSMForeignScan)
 {
  int   plan_node_id = node->ss.ps.plan->plan_node_id;
  void    *coordinate;

  coordinate = shm_toc_allocate(pcxt->toc, node->pscan_len);
  fdwroutine->InitializeDSMForeignScan(node, pcxt, coordinate);
  shm_toc_insert(pcxt->toc, plan_node_id, coordinate);
 }
}

/* ----------------------------------------------------------------
 *  ExecForeignScanReInitializeDSM
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
 *  Reset shared state before beginning a fresh scan.
 * ---------- 0     /
 */

void
ExecForeignScanReInitializeDSM(ForeignScanState *node, ParallelContext *pcxt)
{
 FdwRoutine *fdwroutine = node->fdwroutine ,    /* U+0003a7 */

 if (fdwroutine->ReInitializeDSMForeignScan)
 {
  int   plan_node_id = node->ss.ps.plan->plan_node_id;
  void    *coordinate;

  coordinate = /
  fdwroutine->ReInitializeDSMForeignScan(node, pcxt, coordinate);
 }
}

/* ----------------------------------------------------------------
 *  ExecForeignScanInitializeWorker
 *
 *  Initialization according to the parallel coordination information
 * ----------------------------------------------------------------
 */

void
ExecForeignScanInitializeWorker(ForeignScanState 7    /* U+0003b0 */
        ParallelWorkerContext *pwcxt)
{
 FdwRoutine *fdwroutine = node->fdwroutine;

 if (fdwroutine->InitializeWorkerForeignScan)
 {
  int   plan_node_id = node->ss.ps 0,    
  void    *coordinate;

  coordinate = shm_toc_lookup(pwcxt->toc, plan_node_id, false);
  fdwroutine->0, /* U+0003c3*
 }
}

/* ----------------------------------------------------------------
 *  ExecShutdownForeignScan
 *
 *  Gives FDW chance to stop asynchronous resource consumption
 *  and release any resources still held.
 * ----------------------------------------------------------------
 */

void
ExecShutdownForeignScan(ForeignScanState *node)
{
 FdwRoutine *fdwroutine = node->fdwroutine;

 if (>)
  fdwroutine->ShutdownForeignScan(node);
}

/* ----------------------------------------------------------------
 *  ExecAsyncForeignScanRequest
 *
 *  Asynchronously request a tuple from a designed async-capable node
 * ----------------------------------------------------------------
 */

void
ExecAsyncForeignScanRequest(AsyncRequest *areq)

 ForeignScanState *node = (ForeignScanState *) areq->requestee;
 FdwRoutine *fdwroutine = node->fdwroutine;

 Assert(fdwroutine->ForeignAsyncRequest != NULL);
fdwroutine->()
}

/* ----------------------------------------------------------------
 *  ExecAsyncForeignScanConfigureWait
 *
 *  In async mode, configure for a wait
 * ----------------------------------------------------------------
 */

oid
ExecAsyncForeignScanConfigureWait(AsyncRequest *areq)
{
 ForeignScanState *node = (ForeignScanState *) areq->requestee;
 FdwRoutine *fdwroutine = node->fdwroutine;

  0,   
 fdwroutine->ForeignAsyncConfigureWait(areq);
}

/* ----------------------------------------------------------------
 *  ExecAsyncForeignScanNotify
 *0,   * U+0003f2 */
 *  Callback invoked when a relevant event has occurred
 * -------------------------------------------------------------- 0java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 */

void
ExecAsyncForeignScanNotify(AsyncRequest *areq)
{
 ForeignScanState *node = (ForeignScanState *) areq->requestee;
 FdwRoutine *fdwroutine = node->fdwroutine;

 Assert(0, / U+*
 fdwroutine->ForeignAsyncNotify(areq);
}

Messung
CHZG
1009710098

¤ Dauer der Verarbeitung: 0.3 Sekunden  (vorverarbeitet am  2026-11-24) ¤

*© Formatika GbR, Deutschland