Re: Compute the distance between a point and a box exactly

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Burd <greg(at)burd(dot)me>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Compute the distance between a point and a box exactly
Date: 2026-12-05 16:14:10
Message-ID: CAGRkXqQ+YGTwV2mpPm2Cxk2tRXxV5ySN05Y9ez_Jqw=dNcm2NA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Greg,

Thanks for v2. Index and seq scan order now agree for box and point in
my tests.

One note on the commit message. It says the bounding boxes of circles
and polygons are always a lower bound. Rounding can make them too high
even with one row:

CREATE TABLE cm (c circle);
INSERT INTO cm VALUES ('<(37.2,1.9999998957559666),26.6>');
CREATE INDEX ON cm USING gist (c);
SET enable_seqscan = off;
SELECT * FROM cm ORDER BY c <-> point '(0.9999996,2)';
ERROR: index returned tuples in wrong order

Thanks,
Shihao

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message shihao zhong 2026-12-05 16:21:59 Re: reducing planner memory usage #1 - simpler patches
Previous Message Alexander Lakhin 2026-12-05 16:00:00 003_standby_restarts.pl fails on thorntail due to sparc-linux-ext4-specific bug