1/* ------------------------------------------------------------------------
4 * Routines to handle execution of custom scan node
6 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
9 * ------------------------------------------------------------------------
35 * Allocate the CustomScanState object. We let the custom scan provider
36 * do the palloc, in case it wants to make a larger object that embeds
37 * CustomScanState as the first field. It must set the node tag and the
38 * methods field correctly at this time. Other standard fields should be
44 /* ensure flags is filled correctly */
47 /* fill up fields of ScanState */
52 /* create expression context for node */
56 * open the scan relation, if any
65 * Use a custom slot if specified in CustomScanState or use virtual slot
73 * Determine the scan tuple type. If the custom scan provider provided a
74 * targetlist describing the scan tuples, use that; else use base
83 /* Node's targetlist will contain Vars with varno = INDEX_VAR */
90 /* Node's targetlist will contain Vars with varno = scanrelid */
91 tlistvarno = scanrelid;
95 * Initialize result slot, type and projection.
100 /* initialize child expressions */
105 * The callback of custom-scan provider applies the final initialization
106 * of the custom-scan-state node according to its logic.
143 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
144 errmsg(
"custom scan \"%s\" does not support MarkPos",
154 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
155 errmsg(
"custom scan \"%s\" does not support MarkPos",
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
ExprState * ExecInitQual(List *qual, PlanState *parent)
void ExecAssignScanProjectionInfoWithVarno(ScanState *node, int varno)
const TupleTableSlotOps TTSOpsVirtual
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
void ExecInitResultTupleSlotTL(PlanState *planstate, const TupleTableSlotOps *tts_ops)
TupleDesc ExecTypeFromTL(List *targetList)
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags)
Assert(PointerIsAligned(start, uint64))
#define CHECK_FOR_INTERRUPTS()
void ExecCustomScanInitializeDSM(CustomScanState *node, ParallelContext *pcxt)
void ExecShutdownCustomScan(CustomScanState *node)
void ExecCustomScanEstimate(CustomScanState *node, ParallelContext *pcxt)
void ExecCustomRestrPos(CustomScanState *node)
void ExecReScanCustomScan(CustomScanState *node)
void ExecCustomScanReInitializeDSM(CustomScanState *node, ParallelContext *pcxt)
void ExecEndCustomScan(CustomScanState *node)
void ExecCustomScanInitializeWorker(CustomScanState *node, ParallelWorkerContext *pwcxt)
void ExecCustomMarkPos(CustomScanState *node)
CustomScanState * ExecInitCustomScan(CustomScan *cscan, EState *estate, int eflags)
static TupleTableSlot * ExecCustomScan(PlanState *pstate)
#define castNode(_type_, nodeptr)
#define RelationGetDescr(relation)
void * shm_toc_allocate(shm_toc *toc, Size nbytes)
void shm_toc_insert(shm_toc *toc, uint64 key, void *address)
void * shm_toc_lookup(shm_toc *toc, uint64 key, bool noError)
#define shm_toc_estimate_chunk(e, sz)
#define shm_toc_estimate_keys(e, cnt)
void(* BeginCustomScan)(CustomScanState *node, EState *estate, int eflags)
void(* EndCustomScan)(CustomScanState *node)
void(* ShutdownCustomScan)(CustomScanState *node)
void(* ReInitializeDSMCustomScan)(CustomScanState *node, ParallelContext *pcxt, void *coordinate)
TupleTableSlot *(* ExecCustomScan)(CustomScanState *node)
void(* InitializeDSMCustomScan)(CustomScanState *node, ParallelContext *pcxt, void *coordinate)
void(* RestrPosCustomScan)(CustomScanState *node)
Size(* EstimateDSMCustomScan)(CustomScanState *node, ParallelContext *pcxt)
void(* MarkPosCustomScan)(CustomScanState *node)
void(* InitializeWorkerCustomScan)(CustomScanState *node, shm_toc *toc, void *coordinate)
void(* ReScanCustomScan)(CustomScanState *node)
Node *(* CreateCustomScanState)(CustomScan *cscan)
const struct TupleTableSlotOps * slotOps
const struct CustomExecMethods * methods
const struct CustomScanMethods * methods
shm_toc_estimator estimator
ExecProcNodeMtd ExecProcNode
Relation ss_currentRelation