From: | Joseph Koshakow <koshy44(at)gmail(dot)com> |
---|---|
To: | jian he <jian(dot)universality(at)gmail(dot)com> |
Cc: | Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Infinite Interval |
Date: | 2023-01-02 18:53:08 |
Message-ID: | CAAvxfHd3izXmKPyNNZPOROp-+8a56nbmJ3R0DiT9mR7r27qCQA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Jan 2, 2023 at 1:21 PM Joseph Koshakow <koshy44(at)gmail(dot)com> wrote:
>
> On Sat, Dec 31, 2022 at 12:09 AM jian he <jian(dot)universality(at)gmail(dot)com> wrote:
> > In float8, select float8 'inf' / float8 'inf' return NaN. Now in your patch select interval 'infinity' / float8 'infinity'; returns infinity.
> > I am not sure it's right. I found this related post (https://math.stackexchange.com/questions/181304/what-is-infinity-divided-by-infinity)
>
> Good point, I agree this should return an error. We also need to
> properly handle multiplication and division of infinite intervals by
> float8 'nan'. My patch is returning an infinite interval, but it should
> be returning an error. I'll upload a new patch shortly.
>
> - Joe
Attached is the patch to handle these scenarios. Apparently dividing by
NaN is currently broken:
postgres=# SELECT INTERVAL '1 day' / float8 'nan';
?column?
---------------------------------------------------
-178956970 years -8 mons -2562047788:00:54.775808
(1 row)
This patch will fix the issue, but we may want a separate patch that
handles this specific, existing issue. Any thoughts?
- Joe
Attachment | Content-Type | Size |
---|---|---|
v6-0001-Support-infinite-interval.patch | text/x-patch | 65.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Cramer | 2023-01-02 19:09:40 | Why is char an internal-use category |
Previous Message | Peter Geoghegan | 2023-01-02 18:31:51 | Re: Fixing a couple of buglets in how VACUUM sets visibility map bits |