| From: | Raja Sai pranav <rajasaipranav0(at)gmail(dot)com> |
|---|---|
| To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Cc: | tgl(at)sss(dot)pgh(dot)pa(dot)us |
| Subject: | btree_gist: <-> fails on same-sign infinite intervals |
| Date: | 2026-11-26 10:11:49 |
| Message-ID: | CAPHduZBBQngHopmSnOJ589EKOQPehFaoJD+7eG=tJ5_jN-aOqQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Hi,
Commit 15b3dc140d (bug #19761) made same-sign infinities zero distance
apart in btree_gist's date and timestamp opclasses. The interval opclass
still fails:
CREATE EXTENSION btree_gist;
SELECT 'infinity'::interval <-> 'infinity'::interval;
ERROR: interval out of range
interval_dist() computes the result with interval_mi(), which rejects
the difference of two same-sign infinities. So ORDER BY a <-> 'infinity'
(or '-infinity') on an interval column that holds that value fails,
with a KNN index scan as well as with a sort. I see it on master and
18.7; infinite intervals exist since v17.
The attached patch does what ts_dist() now does: same-sign infinities
are zero apart, any other infinite input is infinitely far. It adds
tests to the interval test, which fail without the code change. It
applies to master, REL_18_STABLE and REL_17_STABLE.
Regards,
Sai Pranav
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-btree_gist-Don-t-report-overflow-for-on-same-sign.patch | text/x-patch | 5.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Shuntian Jiao | 2026-11-26 10:26:55 | Re: reltuples kept decreasing with each autovacuum run Re: BUG #18773 |
| Previous Message | Raja Sai pranav | 2026-11-26 09:59:29 | Re: BUG #19928: pg_upgrade fails on v18 schema with NOT NULL ... NO INHERIT and inheritance |