summaryrefslogtreecommitdiff
path: root/src/backend/executor/execAmi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/executor/execAmi.c')
-rw-r--r--src/backend/executor/execAmi.c49
1 files changed, 13 insertions, 36 deletions
diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c
index 643aaace3a..7027d7f805 100644
--- a/src/backend/executor/execAmi.c
+++ b/src/backend/executor/execAmi.c
@@ -271,16 +271,20 @@ ExecReScan(PlanState *node)
* ExecMarkPos
*
* Marks the current scan position.
+ *
+ * NOTE: mark/restore capability is currently needed only for plan nodes
+ * that are the immediate inner child of a MergeJoin node. Since MergeJoin
+ * requires sorted input, there is never any need to support mark/restore in
+ * node types that cannot produce sorted output. There are some cases in
+ * which a node can pass through sorted data from its child; if we don't
+ * implement mark/restore for such a node type, the planner compensates by
+ * inserting a Material node above that node.
*/
void
ExecMarkPos(PlanState *node)
{
switch (nodeTag(node))
{
- case T_SeqScanState:
- ExecSeqMarkPos((SeqScanState *) node);
- break;
-
case T_IndexScanState:
ExecIndexMarkPos((IndexScanState *) node);
break;
@@ -289,14 +293,6 @@ ExecMarkPos(PlanState *node)
ExecIndexOnlyMarkPos((IndexOnlyScanState *) node);
break;
- case T_TidScanState:
- ExecTidMarkPos((TidScanState *) node);
- break;
-
- case T_ValuesScanState:
- ExecValuesMarkPos((ValuesScanState *) node);
- break;
-
case T_CustomScanState:
ExecCustomMarkPos((CustomScanState *) node);
break;
@@ -338,10 +334,6 @@ ExecRestrPos(PlanState *node)
{
switch (nodeTag(node))
{
- case T_SeqScanState:
- ExecSeqRestrPos((SeqScanState *) node);
- break;
-
case T_IndexScanState:
ExecIndexRestrPos((IndexScanState *) node);
break;
@@ -350,14 +342,6 @@ ExecRestrPos(PlanState *node)
ExecIndexOnlyRestrPos((IndexOnlyScanState *) node);
break;
- case T_TidScanState:
- ExecTidRestrPos((TidScanState *) node);
- break;
-
- case T_ValuesScanState:
- ExecValuesRestrPos((ValuesScanState *) node);
- break;
-
case T_CustomScanState:
ExecCustomRestrPos((CustomScanState *) node);
break;
@@ -386,14 +370,6 @@ ExecRestrPos(PlanState *node)
* This is used during planning and so must accept a Path, not a Plan.
* We keep it here to be adjacent to the routines above, which also must
* know which plan types support mark/restore.
- *
- * XXX Ideally, all plan node types would support mark/restore, and this
- * wouldn't be needed. For now, this had better match the routines above.
- *
- * (However, since the only present use of mark/restore is in mergejoin,
- * there is no need to support mark/restore in any plan type that is not
- * capable of generating ordered output. So the seqscan, tidscan,
- * and valuesscan support is actually useless code at present.)
*/
bool
ExecSupportsMarkRestore(Path *pathnode)
@@ -405,11 +381,8 @@ ExecSupportsMarkRestore(Path *pathnode)
*/
switch (pathnode->pathtype)
{
- case T_SeqScan:
case T_IndexScan:
case T_IndexOnlyScan:
- case T_TidScan:
- case T_ValuesScan:
case T_Material:
case T_Sort:
return true;
@@ -426,7 +399,11 @@ ExecSupportsMarkRestore(Path *pathnode)
* Although Result supports mark/restore if it has a child plan
* that does, we presently come here only for ResultPath nodes,
* which represent Result plans without a child plan. So there is
- * nothing to recurse to and we can just say "false".
+ * nothing to recurse to and we can just say "false". (This means
+ * that Result's support for mark/restore is in fact dead code.
+ * We keep it since it's not much code, and someday the planner
+ * might be smart enough to use it. That would require making
+ * this function smarter too, of course.)
*/
Assert(IsA(pathnode, ResultPath));
return false;