aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeTidscan.c
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2019-03-25 00:13:42 -0700
committerAndres Freund <andres@anarazel.de>2019-03-25 00:17:59 -0700
commit9a8ee1dc650be623c32b1df103254847be974d01 (patch)
treeff0b827f8a082f076037a17cbd91a9a2ca0b743f /src/backend/executor/nodeTidscan.c
parentc77e12208cd8540a209cc698373a3cfba8802639 (diff)
downloadpostgresql-9a8ee1dc650be623c32b1df103254847be974d01.tar.gz
postgresql-9a8ee1dc650be623c32b1df103254847be974d01.zip
tableam: Add and use table_fetch_row_version().
This is essentially the tableam version of heapam_fetch(), i.e. fetching a tuple identified by a tid, performing visibility checks. Note that this different from table_index_fetch_tuple(), which is for index lookups. It therefore has to handle a tid pointing to an earlier version of a tuple if the AM uses an optimization like heap's HOT. Add comments to that end. This commit removes the stats_relation argument from heap_fetch, as it's been unused for a long time. Author: Andres Freund Reviewed-By: Haribabu Kommi Discussion: https://postgr.es/m/20180703070645.wchpu5muyto5n647@alap3.anarazel.de
Diffstat (limited to 'src/backend/executor/nodeTidscan.c')
-rw-r--r--src/backend/executor/nodeTidscan.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/backend/executor/nodeTidscan.c b/src/backend/executor/nodeTidscan.c
index 0e6a0748c8c..d8f9eb35570 100644
--- a/src/backend/executor/nodeTidscan.c
+++ b/src/backend/executor/nodeTidscan.c
@@ -310,7 +310,6 @@ TidNext(TidScanState *node)
Relation heapRelation;
HeapTuple tuple;
TupleTableSlot *slot;
- Buffer buffer = InvalidBuffer;
ItemPointerData *tidList;
int numTids;
bool bBackward;
@@ -376,19 +375,10 @@ TidNext(TidScanState *node)
if (node->tss_isCurrentOf)
heap_get_latest_tid(heapRelation, snapshot, &tuple->t_self);
- if (heap_fetch(heapRelation, snapshot, tuple, &buffer, NULL))
- {
- /*
- * Store the scanned tuple in the scan tuple slot of the scan
- * state, transferring the pin to the slot.
- */
- ExecStorePinnedBufferHeapTuple(tuple, /* tuple to store */
- slot, /* slot to store in */
- buffer); /* buffer associated with
- * tuple */
-
+ if (table_fetch_row_version(heapRelation, &tuple->t_self, snapshot,
+ slot))
return slot;
- }
+
/* Bad TID or failed snapshot qual; try next */
if (bBackward)
node->tss_TidPtr--;