Re: Add missing operator <->(box, point)

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add missing operator <->(box, point)
Date: 2019-04-20 13:41:11
Message-ID: alpine.DEB.2.21.1904201526100.29102@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello Nikita,

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

Indeed.

> 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 <->.

About this first patch: applies cleanly, compiles, "make check" ok.

No doc changes, but this was expected to work in the first place,
according to the documention.

About the test, I'd suggest to name the result columns, eg "pt to box
dist" and "box to pt dist", otherwise why all is repeated is unclear.

I notice that other distance tests do not test for commutativity. Are they
also not implemented, or just not tested? If not implemented, I'd suggest
to add them in the same batch. If not tested, maybe the patch should do as
others, or maybe given the trivial implementation there should just be one
test per commutted operator for coverage.

ISTM that the committer would need to "bump the catalog revision number"
because it adds new functions & operators.

--
Fabien.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-04-20 15:50:01 Re: TM format can mix encodings in to_char()
Previous Message Bruce Momjian 2019-04-20 13:18:32 Re: finding changed blocks using WAL scanning