aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/executor/nodeCustom.c13
-rw-r--r--src/include/nodes/execnodes.h1
2 files changed, 12 insertions, 2 deletions
diff --git a/src/backend/executor/nodeCustom.c b/src/backend/executor/nodeCustom.c
index 8f56bd8a23a..a76ec43b9fe 100644
--- a/src/backend/executor/nodeCustom.c
+++ b/src/backend/executor/nodeCustom.c
@@ -29,6 +29,7 @@ CustomScanState *
ExecInitCustomScan(CustomScan *cscan, EState *estate, int eflags)
{
CustomScanState *css;
+ const TupleTableSlotOps *slotOps;
Relation scan_rel = NULL;
Index scanrelid = cscan->scan.scanrelid;
int tlistvarno;
@@ -64,6 +65,14 @@ ExecInitCustomScan(CustomScan *cscan, EState *estate, int eflags)
}
/*
+ * 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
* relation's rowtype.
@@ -73,14 +82,14 @@ ExecInitCustomScan(CustomScan *cscan, EState *estate, int eflags)
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;
}
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index 01b1727fc09..0f10d4432bd 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -1949,6 +1949,7 @@ typedef struct CustomScanState
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;
/* ----------------------------------------------------------------