Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3483f43

Browse files
committed
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.
1 parent 1b09630 commit 3483f43

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/backend/utils/adt/selfuncs.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@
133133
#include "utils/pg_locale.h"
134134
#include "utils/rel.h"
135135
#include "utils/selfuncs.h"
136+
#include "utils/snapmgr.h"
136137
#include "utils/spccache.h"
137138
#include "utils/syscache.h"
138139
#include "utils/timestamp.h"
@@ -4989,8 +4990,8 @@ get_actual_variable_range(PlannerInfo *root, VariableStatData *vardata,
49894990
/* If min is requested ... */
49904991
if (min)
49914992
{
4992-
index_scan = index_beginscan(heapRel, indexRel, SnapshotNow,
4993-
1, 0);
4993+
index_scan = index_beginscan(heapRel, indexRel,
4994+
GetActiveSnapshot(), 1, 0);
49944995
index_rescan(index_scan, scankeys, 1, NULL, 0);
49954996

49964997
/* Fetch first tuple in sortop's direction */
@@ -5021,8 +5022,8 @@ get_actual_variable_range(PlannerInfo *root, VariableStatData *vardata,
50215022
/* If max is requested, and we didn't find the index is empty */
50225023
if (max && have_data)
50235024
{
5024-
index_scan = index_beginscan(heapRel, indexRel, SnapshotNow,
5025-
1, 0);
5025+
index_scan = index_beginscan(heapRel, indexRel,
5026+
GetActiveSnapshot(), 1, 0);
50265027
index_rescan(index_scan, scankeys, 1, NULL, 0);
50275028

50285029
/* Fetch first tuple in reverse direction */

0 commit comments

Comments
 (0)