pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Wrong results from in_range() tests with infinite offset
Date: Sat, 18 Jul 2020 10:06:13 -0400
Message-ID: <3941233.1595081173@sss.pgh.pa.us> (raw)
In-Reply-To: <CAEZATCVQO1vUXo0PjHToxvyZ8piwH-u-mTMqMhrGku2dYMhWbw@mail.gmail.com>
References: <3393130.1594925893@sss.pgh.pa.us>
	<3464257.1594936216@sss.pgh.pa.us>
	<CAEZATCVXfxCR+2gCSwFMQPfyFUVNzY7U6oHfCfjD1OCCVfWUiQ@mail.gmail.com>
	<3506768.1594947597@sss.pgh.pa.us>
	<CAEZATCVQO1vUXo0PjHToxvyZ8piwH-u-mTMqMhrGku2dYMhWbw@mail.gmail.com>

Dean Rasheed <dean.a.rasheed@gmail.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





view thread (9+ messages)  latest in thread

Message-ID: <3941233.1595081173@sss.pgh.pa.us>
Permalink:  ../3941233.1595081173@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3941233.1595081173@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dean.a.rasheed@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Wrong results from in_range() tests with infinite offset
  In-Reply-To: <3941233.1595081173@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox