Commit 3483f433 authored by Robert Haas's avatar Robert Haas

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.
parent 1b09630f
...@@ -133,6 +133,7 @@ ...@@ -133,6 +133,7 @@
#include "utils/pg_locale.h" #include "utils/pg_locale.h"
#include "utils/rel.h" #include "utils/rel.h"
#include "utils/selfuncs.h" #include "utils/selfuncs.h"
#include "utils/snapmgr.h"
#include "utils/spccache.h" #include "utils/spccache.h"
#include "utils/syscache.h" #include "utils/syscache.h"
#include "utils/timestamp.h" #include "utils/timestamp.h"
...@@ -4989,8 +4990,8 @@ get_actual_variable_range(PlannerInfo *root, VariableStatData *vardata, ...@@ -4989,8 +4990,8 @@ get_actual_variable_range(PlannerInfo *root, VariableStatData *vardata,
/* If min is requested ... */ /* If min is requested ... */
if (min) if (min)
{ {
index_scan = index_beginscan(heapRel, indexRel, SnapshotNow, index_scan = index_beginscan(heapRel, indexRel,
1, 0); GetActiveSnapshot(), 1, 0);
index_rescan(index_scan, scankeys, 1, NULL, 0); index_rescan(index_scan, scankeys, 1, NULL, 0);
/* Fetch first tuple in sortop's direction */ /* Fetch first tuple in sortop's direction */
...@@ -5021,8 +5022,8 @@ get_actual_variable_range(PlannerInfo *root, VariableStatData *vardata, ...@@ -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 is requested, and we didn't find the index is empty */
if (max && have_data) if (max && have_data)
{ {
index_scan = index_beginscan(heapRel, indexRel, SnapshotNow, index_scan = index_beginscan(heapRel, indexRel,
1, 0); GetActiveSnapshot(), 1, 0);
index_rescan(index_scan, scankeys, 1, NULL, 0); index_rescan(index_scan, scankeys, 1, NULL, 0);
/* Fetch first tuple in reverse direction */ /* Fetch first tuple in reverse direction */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment