mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
Remove dead NoMovementScanDirection code
Here remove some dead code from heapgettup() and heapgettup_pagemode() which was trying to support NoMovementScanDirection scans. This code can never be reached as standard_ExecutorRun() never calls ExecutePlan with NoMovementScanDirection. Additionally, plans which were scanning an unordered index would use NoMovementScanDirection rather than ForwardScanDirection. There was no real need for this, so here we adjust this so we use ForwardScanDirection for unordered index scans. A comment in pathnodes.h claimed that NoMovementScanDirection was used for PathKey reasons, but if that was true, it no longer is, per code in build_index_paths(). This does change the non-text format of the EXPLAIN output so that unordered index scans now have a "Forward" scan direction rather than "NoMovement". The text format of EXPLAIN has not changed. Author: Melanie Plageman Reviewed-by: Tom Lane, David Rowley Discussion: https://postgr.es/m/CAAKRu_bvkhka0CZQun28KTqhuUh5ZqY=_T8QEqZqOL02rpi2bw@mail.gmail.com
This commit is contained in:
@@ -490,9 +490,6 @@ heapgetpage(TableScanDesc sscan, BlockNumber block)
|
||||
* tuple as indicated by "dir"; return the next tuple in scan->rs_ctup,
|
||||
* or set scan->rs_ctup.t_data = NULL if no more tuples.
|
||||
*
|
||||
* dir == NoMovementScanDirection means "re-fetch the tuple indicated
|
||||
* by scan->rs_ctup".
|
||||
*
|
||||
* Note: the reason nkeys/key are passed separately, even though they are
|
||||
* kept in the scan descriptor, is that the caller may not want us to check
|
||||
* the scankeys.
|
||||
@@ -583,7 +580,7 @@ heapgettup(HeapScanDesc scan,
|
||||
|
||||
linesleft = lines - lineoff + 1;
|
||||
}
|
||||
else if (backward)
|
||||
else
|
||||
{
|
||||
/* backward parallel scan not supported */
|
||||
Assert(scan->rs_base.rs_parallel == NULL);
|
||||
@@ -653,34 +650,6 @@ heapgettup(HeapScanDesc scan,
|
||||
|
||||
linesleft = lineoff;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* ``no movement'' scan direction: refetch prior tuple
|
||||
*/
|
||||
if (!scan->rs_inited)
|
||||
{
|
||||
Assert(!BufferIsValid(scan->rs_cbuf));
|
||||
tuple->t_data = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
block = ItemPointerGetBlockNumber(&(tuple->t_self));
|
||||
if (block != scan->rs_cblock)
|
||||
heapgetpage((TableScanDesc) scan, block);
|
||||
|
||||
/* Since the tuple was previously fetched, needn't lock page here */
|
||||
page = BufferGetPage(scan->rs_cbuf);
|
||||
TestForOldSnapshot(snapshot, scan->rs_base.rs_rd, page);
|
||||
lineoff = ItemPointerGetOffsetNumber(&(tuple->t_self));
|
||||
lpp = PageGetItemId(page, lineoff);
|
||||
Assert(ItemIdIsNormal(lpp));
|
||||
|
||||
tuple->t_data = (HeapTupleHeader) PageGetItem(page, lpp);
|
||||
tuple->t_len = ItemIdGetLength(lpp);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* advance the scan until we find a qualifying tuple or run out of stuff
|
||||
@@ -918,7 +887,7 @@ heapgettup_pagemode(HeapScanDesc scan,
|
||||
|
||||
linesleft = lines - lineindex;
|
||||
}
|
||||
else if (backward)
|
||||
else
|
||||
{
|
||||
/* backward parallel scan not supported */
|
||||
Assert(scan->rs_base.rs_parallel == NULL);
|
||||
@@ -978,38 +947,6 @@ heapgettup_pagemode(HeapScanDesc scan,
|
||||
|
||||
linesleft = lineindex + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* ``no movement'' scan direction: refetch prior tuple
|
||||
*/
|
||||
if (!scan->rs_inited)
|
||||
{
|
||||
Assert(!BufferIsValid(scan->rs_cbuf));
|
||||
tuple->t_data = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
block = ItemPointerGetBlockNumber(&(tuple->t_self));
|
||||
if (block != scan->rs_cblock)
|
||||
heapgetpage((TableScanDesc) scan, block);
|
||||
|
||||
/* Since the tuple was previously fetched, needn't lock page here */
|
||||
page = BufferGetPage(scan->rs_cbuf);
|
||||
TestForOldSnapshot(scan->rs_base.rs_snapshot, scan->rs_base.rs_rd, page);
|
||||
lineoff = ItemPointerGetOffsetNumber(&(tuple->t_self));
|
||||
lpp = PageGetItemId(page, lineoff);
|
||||
Assert(ItemIdIsNormal(lpp));
|
||||
|
||||
tuple->t_data = (HeapTupleHeader) PageGetItem(page, lpp);
|
||||
tuple->t_len = ItemIdGetLength(lpp);
|
||||
|
||||
/* check that rs_cindex is in sync */
|
||||
Assert(scan->rs_cindex < scan->rs_ntuples);
|
||||
Assert(lineoff == scan->rs_vistuples[scan->rs_cindex]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* advance the scan until we find a qualifying tuple or run out of stuff
|
||||
|
||||
Reference in New Issue
Block a user