Re: Wrong results from in_range() tests with infinite offset

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Wrong results from in_range() tests with infinite offset
Date: 2020-07-18 14:06:13
Message-ID: 3941233.1595081173@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> writes:
> if (isinf(base) && isinf(offset))
> {
> if ((base > 0 && sub) || (base < 0 && !sub))
> PG_RETURN_BOOL(true);
> }

Yeah, I'd experimented with more-or-less that logic before arriving at
my v2 patch. I didn't like the outcome that "inf both infinitely precedes
and infinitely follows itself". Still, it is nicely simple.

To make sense of this behavior, you have to argue that +/-inf are not
in any way concrete values, but represent some sort of infinite ranges;
then there could be some members of the class "inf" that infinitely
precede other members. I thought that was bending the mathematical
concept a bit too far. However, this isn't an area of math that I've
studied in any detail, so maybe it's a standard interpretation.

Still, I think the results my v2 patch gets make more sense than these.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ranier Vilela 2020-07-18 14:34:54 CID 1428952 (#1 of 1): Out-of-bounds access (OVERRUN) (src/backend/commands/async.c)
Previous Message Michael Paquier 2020-07-18 13:48:47 Re: Stale external URL in doc?