Skip to content

Commit f84c860

Browse files
committed
Add error check for lossy distance functions in index-only scans.
Maybe we should actually support this, but for the moment let's just throw an error if the opclass tries it.
1 parent 7280948 commit f84c860

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/backend/executor/nodeIndexonlyscan.c

+13
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,19 @@ IndexOnlyNext(IndexOnlyScanState *node)
165165
}
166166
}
167167

168+
/*
169+
* We don't currently support rechecking ORDER BY distances. (In
170+
* principle, if the index can support retrieval of the originally
171+
* indexed value, it should be able to produce an exact distance
172+
* calculation too. So it's not clear that adding code here for
173+
* recheck/re-sort would be worth the trouble. But we should at least
174+
* throw an error if someone tries it.)
175+
*/
176+
if (scandesc->numberOfOrderBys > 0 && scandesc->xs_recheckorderby)
177+
ereport(ERROR,
178+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
179+
errmsg("lossy distance functions are not supported in index-only scans")));
180+
168181
/*
169182
* Predicate locks for index-only scans must be acquired at the page
170183
* level when the heap is not accessed, since tuple-level predicate

0 commit comments

Comments
 (0)