Re: btree_gist: <-> fails on same-sign infinite intervals

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Raja Sai pranav <rajasaipranav0(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: btree_gist: <-> fails on same-sign infinite intervals
Date: 2026-11-29 16:47:25
Message-ID: 707303.1795970845@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Raja Sai pranav <rajasaipranav0(at)gmail(dot)com> writes:
> v2 subtracts the smaller input from the larger (by interval_cmp), so
> the result is never negative and isn't negated, and does the
> finite_interval_mi() arithmetic inline, returning +infinity when it
> overflows. The tests now cover the subtraction overflow, the negation
> overflow and an ORDER BY with a sort; each of the three fails with
> "interval out of range" with the v1 code and passes with v2.

I pushed this, but without the "ORDER BY with a sort" test, because
I have no faith in that being stable across platforms. The ordering
value will be infinity for all table rows, so the system could
legitimately return any three rows, and I suspect the results could
actually vary between e.g. 32-bit and 64-bit machines. In any case
it was a lot of cycles to prove nothing that wasn't proven by the
other tests.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2026-11-29 17:30:26 Re: Removed left join leaves its key in the outer rel's target list
Previous Message Alexander Lakhin 2026-11-29 16:00:00 Re: BUG #19928: pg_upgrade fails on v18 schema with NOT NULL ... NO INHERIT and inheritance