Re: BUG #19761: btree_gist: "cannot subtract infinite dates" when inserting 'infinity' into a GiST index on date

From: Nitin Motiani <nitinmotiani(at)google(dot)com>
To: alpkeles99(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19761: btree_gist: "cannot subtract infinite dates" when inserting 'infinity' into a GiST index on date
Date: 2026-10-16 09:15:26
Message-ID: CAH5HC95Bv34Drxh4DLt1qvCtc5suwKVcmfuQaixqiERJtHSHgg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

Thanks for the analysis. I was able to reproduce the issue.

On Thu, Oct 15, 2026 at 9:03 PM PG Bug reporting form
<noreply(at)postgresql(dot)org> wrote:
>
> btree_ts.c avoids this. gbt_ts_penalty does its own double arithmetic on the
> raw int64 values, gbt_ts_dist returns get_float8_infinity() for non-finite
> input, and ts_dist/tstz_dist return a saturated interval.
>

I'm attaching a patch which uses the same logic as btree_ts.c and
btree_int.c in btree_date.co to handle these issues. Please take a
look.

Thanks & Regards

Nitin Motiani,
Google

Attachment Content-Type Size
v1-0001-btree_gist-Fix-cannot-subtract-infinite-dates-err.patch application/x-patch 4.9 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Previous Message Ayush Tiwari 2026-10-16 09:09:35 Re: BUG #19760: CLUSTER loses a row the transaction inserted and then updated in a rolled-back subtransaction