From 9a8ee1dc650be623c32b1df103254847be974d01 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Mon, 25 Mar 2019 00:13:42 -0700 Subject: 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 --- src/backend/executor/execMain.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src/backend/executor/execMain.c') diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 018e9912e94..426686b6ef6 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -2649,17 +2649,10 @@ EvalPlanQualFetchRowMarks(EPQState *epqstate) else { /* ordinary table, fetch the tuple */ - HeapTupleData tuple; - Buffer buffer; - - tuple.t_self = *((ItemPointer) DatumGetPointer(datum)); - if (!heap_fetch(erm->relation, SnapshotAny, &tuple, &buffer, - NULL)) + if (!table_fetch_row_version(erm->relation, + (ItemPointer) DatumGetPointer(datum), + SnapshotAny, slot)) elog(ERROR, "failed to fetch tuple for EvalPlanQual recheck"); - - /* successful, store tuple */ - ExecStorePinnedBufferHeapTuple(&tuple, slot, buffer); - ExecMaterializeSlot(slot); } } else -- cgit v1.2.3