aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2015-05-23 16:24:31 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2015-05-23 16:24:31 -0400
commitf84c8601d604811a530dadb53ddb52f08639e72b (patch)
treed582ce3cd5dbe9613b9c1afa4579588622d5ea3b /src
parent72809480d658fbc0654239b2f089991c077c676a (diff)
downloadpostgresql-f84c8601d604811a530dadb53ddb52f08639e72b.tar.gz
postgresql-f84c8601d604811a530dadb53ddb52f08639e72b.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/backend/executor/nodeIndexonlyscan.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/backend/executor/nodeIndexonlyscan.c b/src/backend/executor/nodeIndexonlyscan.c
index 61bd644ab71..976c77b76c6 100644
--- a/src/backend/executor/nodeIndexonlyscan.c
+++ b/src/backend/executor/nodeIndexonlyscan.c
@@ -166,6 +166,19 @@ IndexOnlyNext(IndexOnlyScanState *node)
}
/*
+ * We don't currently support rechecking ORDER BY distances. (In
+ * principle, if the index can support retrieval of the originally
+ * indexed value, it should be able to produce an exact distance
+ * calculation too. So it's not clear that adding code here for
+ * recheck/re-sort would be worth the trouble. But we should at least
+ * throw an error if someone tries it.)
+ */
+ if (scandesc->numberOfOrderBys > 0 && scandesc->xs_recheckorderby)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("lossy distance functions are not supported in index-only scans")));
+
+ /*
* Predicate locks for index-only scans must be acquired at the page
* level when the heap is not accessed, since tuple-level predicate
* locks need the tuple's xmin value. If we had to visit the tuple