diff options
author | Robert Haas | 2013-07-25 18:30:00 +0000 |
---|---|---|
committer | Robert Haas | 2013-07-25 18:30:00 +0000 |
commit | 3483f4332de73e038db64be0614219b64fd3c971 (patch) | |
tree | 5d787d946f935156fd729724ad1530a94447b4d8 | |
parent | 1b09630fce1dfd4116eaaf154766a8a435168193 (diff) |
Don't use SnapshotNow in get_actual_variable_range.
Instead, use the active snapshot. Per Tom Lane, this function is
most interested in knowing the range of tuples our scan will actually
see.
This is another step towards full removal of SnapshotNow.
-rw-r--r-- | src/backend/utils/adt/selfuncs.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index d8c1a889edc..edfd8435aaa 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -133,6 +133,7 @@ #include "utils/pg_locale.h" #include "utils/rel.h" #include "utils/selfuncs.h" +#include "utils/snapmgr.h" #include "utils/spccache.h" #include "utils/syscache.h" #include "utils/timestamp.h" @@ -4989,8 +4990,8 @@ get_actual_variable_range(PlannerInfo *root, VariableStatData *vardata, /* If min is requested ... */ if (min) { - index_scan = index_beginscan(heapRel, indexRel, SnapshotNow, - 1, 0); + index_scan = index_beginscan(heapRel, indexRel, + GetActiveSnapshot(), 1, 0); index_rescan(index_scan, scankeys, 1, NULL, 0); /* Fetch first tuple in sortop's direction */ @@ -5021,8 +5022,8 @@ get_actual_variable_range(PlannerInfo *root, VariableStatData *vardata, /* If max is requested, and we didn't find the index is empty */ if (max && have_data) { - index_scan = index_beginscan(heapRel, indexRel, SnapshotNow, - 1, 0); + index_scan = index_beginscan(heapRel, indexRel, + GetActiveSnapshot(), 1, 0); index_rescan(index_scan, scankeys, 1, NULL, 0); /* Fetch first tuple in reverse direction */ |