summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/utils/adt/selfuncs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index e5e066a5537..cb23ad52782 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -6575,6 +6575,13 @@ get_actual_variable_range(PlannerInfo *root, VariableStatData *vardata,
continue;
/*
+ * get_actual_variable_endpoint uses the index-only-scan machinery, so
+ * ignore indexes that can't use it on their first column.
+ */
+ if (!index->canreturn[0])
+ continue;
+
+ /*
* The first index column must match the desired variable, sortop, and
* collation --- but we can use a descending-order index.
*/