Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lW68R-0002Cw-P3 for pgsql-hackers@arkaria.postgresql.org; Mon, 12 Apr 2021 23:38:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lW68Q-0007GW-NY for pgsql-hackers@arkaria.postgresql.org; Mon, 12 Apr 2021 23:38:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lW68Q-0007GO-HS for pgsql-hackers@lists.postgresql.org; Mon, 12 Apr 2021 23:38:26 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lW68O-0005mH-LW for pgsql-hackers@postgresql.org; Mon, 12 Apr 2021 23:38:26 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 13CNcLXQ3135042; Mon, 12 Apr 2021 19:38:21 -0400 From: Tom Lane To: Bruce Momjian cc: Bryn Llewellyn , Zhihong Yu , Justin Pryzby , Isaac Morland , John W Higgins , PostgreSQL-development Subject: Re: Have I found an interval arithmetic bug? In-reply-to: <20210412232237.GA4231@momjian.us> References: <20210403022126.GG29126@momjian.us> <20210405163310.GP6592@telsasoft.com> <20210405180158.GB12179@momjian.us> <20210408172444.GC6909@momjian.us> <20210412161842.GA22319@momjian.us> <8707105F-C45D-4ACB-8F71-51CE5BED58A5@yugabyte.com> <20210412232237.GA4231@momjian.us> Comments: In-reply-to Bruce Momjian message dated "Mon, 12 Apr 2021 19:22:37 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3135040.1618270701.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 12 Apr 2021 19:38:21 -0400 Message-ID: <3135041.1618270701@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Bruce Momjian writes: > On Mon, Apr 12, 2021 at 03:09:48PM -0700, Bryn Llewellyn wrote: >> After all, you've bitten the bullet now and changed the behavior. This = means that the semantics of some extant applications will change. So... in= for a penny, in for a pound? > The docs now say: > Field values can have fractional parts; for example, '1.5 > weeks' or '01:02:03.45'. The fraction= al > --> parts are used to compute appropriate values for the next lower-ord= er > internal fields (months, days, seconds). > meaning fractional years flows to the next lower internal unit, months, > and no further. Fractional months would flow to days. The idea of not > flowing past the next lower-order internal field is that the > approximations between units are not precise enough to flow accurately. Um, what's the argument for down-converting AT ALL? The problem is precisely that any such conversion is mostly fictional. > With my patch, the output is now: > SELECT INTERVAL '3 years 10.241604 months'; > interval > ------------------------ > 3 years 10 mons 7 days > It used to flow to seconds. Yeah, that's better than before, but I don't see any principled argument for it not to be "3 years 10 months", full stop. regards, tom lane