ExecInitCustomScan(CustomScan *cscan, EState *estate, int eflags)
{
CustomScanState *css;
+ const TupleTableSlotOps *slotOps;
Relation scan_rel = NULL;
Index scanrelid = cscan->scan.scanrelid;
int tlistvarno;
css->ss.ss_currentRelation = scan_rel;
}
+ /*
+ * Use a custom slot if specified in CustomScanState or use virtual slot
+ * otherwise.
+ */
+ slotOps = css->slotOps;
+ if (!slotOps)
+ slotOps = &TTSOpsVirtual;
+
/*
* Determine the scan tuple type. If the custom scan provider provided a
* targetlist describing the scan tuples, use that; else use base
TupleDesc scan_tupdesc;
scan_tupdesc = ExecTypeFromTL(cscan->custom_scan_tlist);
- ExecInitScanTupleSlot(estate, &css->ss, scan_tupdesc, &TTSOpsVirtual);
+ ExecInitScanTupleSlot(estate, &css->ss, scan_tupdesc, slotOps);
/* Node's targetlist will contain Vars with varno = INDEX_VAR */
tlistvarno = INDEX_VAR;
}
else
{
ExecInitScanTupleSlot(estate, &css->ss, RelationGetDescr(scan_rel),
- &TTSOpsVirtual);
+ slotOps);
/* Node's targetlist will contain Vars with varno = scanrelid */
tlistvarno = scanrelid;
}
List *custom_ps; /* list of child PlanState nodes, if any */
Size pscan_len; /* size of parallel coordination information */
const struct CustomExecMethods *methods;
+ const struct TupleTableSlotOps *slotOps;
} CustomScanState;
/* ----------------------------------------------------------------