Re: Incorrect behaviour when using a GiST index on points

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: Noah Misch <noah(at)leadboat(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Oleg Bartunov <obartunov(at)gmail(dot)com>, Teodor Sigaev <teodor(at)sigaev(dot)ru>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Incorrect behaviour when using a GiST index on points
Date: 2013-02-08 23:32:53
Message-ID: 25625.1360366373@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alexander Korotkov <aekorotkov(at)gmail(dot)com> writes:
> On Sat, Nov 3, 2012 at 4:23 AM, Noah Misch <noah(at)leadboat(dot)com> wrote:
>> ... At internal pages, gist_point_consistent() should implement
>> "point <@ box" with an algorithm near-equivalent to box_overlap(). (As an
>> optional deviation, it may use exact comparisons despite box_overlap() using
>> fuzzy comparisons.) Looking at the math again, your latest code does achieve
>> that, too. I was thrown off by your use of a different, albeit mathematically
>> equivalent, algorithm from the one used in box_overlap(). Please don't do
>> that; either use box_overlap()'s algorithm here, or change box_overlap() to
>> use the shorter algorithm you have introduced. Formulating the same
>> calculation differently in related code is a recipe for confusion. (Then
>> again, perhaps the equivalence of the algorithms is obvious to everyone
>> entitled to travel within 1 km of the geometric type implementation.)

> I've added comment for clarifying this situation.

Applied and back-patched with some cosmetic changes (mostly the
comments) and a better version of the regression test.

As a separate commit, I also simplified box_overlap() to match this
logic, since I agree with Noah that it's not good for them to look so
different. Besides, it should be at least a bit faster this way.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit kapila 2013-02-09 01:26:45 Re: Identity projection
Previous Message Tom Lane 2013-02-08 23:01:27 Re: Time for an autoconf update