mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Remove dead code supporting mark/restore in SeqScan, TidScan, ValuesScan.
There seems no prospect that any of this will ever be useful, and indeed it's questionable whether some of it would work if it ever got called; it's certainly not been exercised in a very long time, if ever. So let's get rid of it, and make the comments about mark/restore in execAmi.c less wishy-washy. The mark/restore support for Result nodes is also currently dead code, but that's due to planner limitations not because it's impossible that it could be useful. So I left it in.
This commit is contained in:
@ -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;
|
||||
|
@ -19,8 +19,6 @@
|
||||
* ExecInitSeqScan creates and initializes a seqscan node.
|
||||
* ExecEndSeqScan releases any storage allocated.
|
||||
* ExecReScanSeqScan rescans the relation
|
||||
* ExecSeqMarkPos marks scan position
|
||||
* ExecSeqRestrPos restores scan position
|
||||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
@ -274,39 +272,3 @@ ExecReScanSeqScan(SeqScanState *node)
|
||||
|
||||
ExecScanReScan((ScanState *) node);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* ExecSeqMarkPos(node)
|
||||
*
|
||||
* Marks scan position.
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
ExecSeqMarkPos(SeqScanState *node)
|
||||
{
|
||||
HeapScanDesc scan = node->ss_currentScanDesc;
|
||||
|
||||
heap_markpos(scan);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* ExecSeqRestrPos
|
||||
*
|
||||
* Restores scan position.
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
ExecSeqRestrPos(SeqScanState *node)
|
||||
{
|
||||
HeapScanDesc scan = node->ss_currentScanDesc;
|
||||
|
||||
/*
|
||||
* Clear any reference to the previously returned tuple. This is needed
|
||||
* because the slot is simply pointing at scan->rs_cbuf, which
|
||||
* heap_restrpos will change; we'd have an internally inconsistent slot if
|
||||
* we didn't do this.
|
||||
*/
|
||||
ExecClearTuple(node->ss_ScanTupleSlot);
|
||||
|
||||
heap_restrpos(scan);
|
||||
}
|
||||
|
@ -19,8 +19,6 @@
|
||||
* ExecInitTidScan creates and initializes state info.
|
||||
* ExecReScanTidScan rescans the tid relation.
|
||||
* ExecEndTidScan releases all storage.
|
||||
* ExecTidMarkPos marks scan position.
|
||||
* ExecTidRestrPos restores scan position.
|
||||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
@ -440,34 +438,6 @@ ExecEndTidScan(TidScanState *node)
|
||||
ExecCloseScanRelation(node->ss.ss_currentRelation);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* ExecTidMarkPos
|
||||
*
|
||||
* Marks scan position by marking the current tid.
|
||||
* Returns nothing.
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
ExecTidMarkPos(TidScanState *node)
|
||||
{
|
||||
node->tss_MarkTidPtr = node->tss_TidPtr;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* ExecTidRestrPos
|
||||
*
|
||||
* Restores scan position by restoring the current tid.
|
||||
* Returns nothing.
|
||||
*
|
||||
* XXX Assumes previously marked scan position belongs to current tid
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
ExecTidRestrPos(TidScanState *node)
|
||||
{
|
||||
node->tss_TidPtr = node->tss_MarkTidPtr;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* ExecInitTidScan
|
||||
*
|
||||
|
@ -246,7 +246,6 @@ ExecInitValuesScan(ValuesScan *node, EState *estate, int eflags)
|
||||
/*
|
||||
* Other node-specific setup
|
||||
*/
|
||||
scanstate->marked_idx = -1;
|
||||
scanstate->curr_idx = -1;
|
||||
scanstate->array_len = list_length(node->values_lists);
|
||||
|
||||
@ -293,30 +292,6 @@ ExecEndValuesScan(ValuesScanState *node)
|
||||
ExecClearTuple(node->ss.ss_ScanTupleSlot);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* ExecValuesMarkPos
|
||||
*
|
||||
* Marks scan position.
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
ExecValuesMarkPos(ValuesScanState *node)
|
||||
{
|
||||
node->marked_idx = node->curr_idx;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* ExecValuesRestrPos
|
||||
*
|
||||
* Restores scan position.
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
ExecValuesRestrPos(ValuesScanState *node)
|
||||
{
|
||||
node->curr_idx = node->marked_idx;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* ExecReScanValuesScan
|
||||
*
|
||||
|
Reference in New Issue
Block a user