llow negative coordinate for ~> (cube, int) operator

Teodor Sigaev <teodor@sigaev.ru>

Commit: f50c80dbb17efa39c169f6c510e9464486ff5edc
Author: Teodor Sigaev <teodor@sigaev.ru>
Date: 2018-01-11T11:49:36Z
Releases: 11.0
llow negative coordinate for ~> (cube, int) operator

~> (cube, int) operator was especially designed for knn-gist search.
However, knn-gist supports only ascending ordering of results. Nevertheless
it would be useful to support descending ordering by ~> (cube, int) operator.
We provide workaround for that: negative coordinate give us inversed value
of corresponding cube bound. Therefore, knn search using negative coordinate
gives us an effect of descending ordering by cube bound.

Author: Alexander Korotkov
Reviewed by: Tomas Vondra, Andrey Borodin
Discussion: https://www.postgresql.org/message-id/flat/a9657f6a-b497-36ff-e56-482a2c7e3292@2ndquadrant.com

Files

PathChange+/−
contrib/cube/cube.c modified +36 −8
contrib/cube/expected/cube_2.out modified +166 −2
contrib/cube/expected/cube.out modified +166 −2
contrib/cube/sql/cube.sql modified +8 −0
doc/src/sgml/cube.sgml modified +3 −2

Documentation touched

Discussion

Cited messages not in the archive: a9657f6a-b497-36ff-e56-482a2c7e3292@2ndquadrant.com