| From: | Raja Sai pranav <rajasaipranav0(at)gmail(dot)com> |
|---|---|
| To: | reshkekirill(at)gmail(dot)com |
| Cc: | tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Subject: | Re: btree_gist: <-> fails on same-sign infinite intervals |
| Date: | 2026-12-01 04:32:06 |
| Message-ID: | CAPHduZAbtVJRG_SGN-TY6r71Z7Wa2_e_EC_8eUepRrhbXbb-bQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
On Mon, Nov 30, 2026 at 04:37 AM Kirill Reshke <reshkekirill(at)gmail(dot)com>
wrote:
> Below is a reproducer of behaviour change of c1dd701f leading to seq
> scan vs index scan disagree on query results.
Thanks, I see the same on master (ea39d58e4b). I think the index scan
has the right row, though: '178956971 days -2147483647 hours' is
2147483657 hours long, so it is 10 hours from '2147483647 hours'. The
time fields have opposite signs and their difference overflows, and
c1dd701f turns any field overflow into infinity. That's my mistake.
Your patch makes the index agree with the operator, but both then
report infinity for a 10-hour gap. The attached patch fixes the
operator instead: when a field overflows, it computes the difference
in the linear form interval_cmp uses (int128) and returns it as a
time-only interval if that fits, and +infinity only if it doesn't.
With it, both your queries return "cancellation | 10:00:00".
It adds one test line, which gives infinity without the fix. The
existing sub_overflow and negate_overflow cases still give infinity,
and the btree_gist tests pass on master. On REL_18 it applies with
fuzz in the #include lines; on REL_17 that hunk needs adjusting. I
haven't built either branch.
Regards,
Sai Pranav
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-btree_gist-Don-t-report-a-finite-interval-distanc.patch | text/x-patch | 3.9 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Kirill Reshke | 2026-12-01 04:46:36 | Re: BUG #19936: Planning is slower on 19.0 with many partial indexes on a SQL function |
| Previous Message | Michael Paquier | 2026-12-01 04:07:13 | Re: BUG #19519: REPACK can fail due to missing chunk for toast value |