Re: Have I found an interval arithmetic bug? - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Have I found an interval arithmetic bug?
Date
Msg-id 20210723202738.GC8025@momjian.us
Whole thread Raw
In response to Re: Have I found an interval arithmetic bug?  (Bryn Llewellyn <bryn@yugabyte.com>)
Responses Re: Have I found an interval arithmetic bug?
List pgsql-hackers
On Fri, Jul 23, 2021 at 10:55:11AM -0700, Bryn Llewellyn wrote:
> SELECT
>   '1.2345 months 1.2345 days 1.2345 seconds'::interval = 
>   '1 month 1 day 1 second'::interval*1.2345;
> 
> In 13.3, the result is TRUE. (I know that this doesn’t guarantee that the
> internal representations of the two compared interval values are the same. But
> it’s a necessary condition for the outcome that I’m referring to and serves to
> indecate the pont I’m making. A more careful test can be made.

So you are saying fractional unit output should match multiplication
output?  It doesn't now for all units:

    SELECT interval '1.3443 years';
       interval
    ---------------
     1 year 4 mons
    
    SELECT interval '1 years' * 1.3443;
                ?column?
    ---------------------------------
     1 year 4 mons 3 days 22:45:07.2

It is true this patch is further reducing that matching.  Do people
think I should make them match as part of this patch?

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  If only the physical world exists, free will is an illusion.




pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [Patch] ALTER SYSTEM READ ONLY
Next
From: Robert Haas
Date:
Subject: Re: Followup Timestamp to timestamp with TZ conversion