Add missing operator <->(box, point)

From: Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Add missing operator <->(box, point)
Date: 2019-03-10 23:49:07
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi, hackers.

Attached patches add missing distance operator <->(box, point).

We already have reverse operator <->(point, box), but it can't be used for kNN
search in GiST and SP-GiST. GiST and SP-GiST now support kNN searches over more
complex polygons and circles, but do not support more simple boxes, which seems
to be inconsistent.

Description of the patches:
1. Add function dist_pb(box, point) and operator <->.

2. Add <-> to GiST box_ops.
Extracted gist_box_distance_helper() common for gist_box_distance() and

3. Add <-> to SP-GiST.
Changed only catalog and tests. Box case is already checked in
out->recheckDistances = distfnoid == F_DIST_POLYP;

Nikita Glukhov
Postgres Professional:
The Russian Postgres Company

Attachment Content-Type Size
0001-Add-box-point-distance-operator-v01.patch text/x-patch 10.2 KB
0002-Add-box-point-distance-operator-to-GiST-box_ops-v01.patch text/x-patch 9.0 KB
0003-Add-box-point-distance-operator-to-SP-GiST-box_ops-v01.patch text/x-patch 9.4 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2019-03-11 00:17:20 Re: Making all nbtree entries unique by having heap TIDs participate in comparisons
Previous Message Dagfinn Ilmari Mannsåker 2019-03-10 23:37:30 Re: pgbench MAX_ARGS