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 1lW6sb-0003RA-Gb for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Apr 2021 00:26:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lW6sZ-0004o9-4W for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Apr 2021 00:26:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lW6sY-0004o2-Gf for pgsql-hackers@lists.postgresql.org; Tue, 13 Apr 2021 00:26:06 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lW6sR-0007Td-WA for pgsql-hackers@postgresql.org; Tue, 13 Apr 2021 00:26:05 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1lW6sQ-0005Xc-DH; Mon, 12 Apr 2021 20:25:58 -0400 Date: Mon, 12 Apr 2021 20:25:58 -0400 From: Bruce Momjian To: Bryn Llewellyn Cc: Tom Lane PostgreSQL , Zhihong Yu , Justin Pryzby , Isaac Morland , John W Higgins , PostgreSQL-development Subject: Re: Have I found an interval arithmetic bug? Message-ID: <20210413002558.GC4231@momjian.us> References: <20210408172444.GC6909@momjian.us> <20210412161842.GA22319@momjian.us> <8707105F-C45D-4ACB-8F71-51CE5BED58A5@yugabyte.com> <20210412232237.GA4231@momjian.us> <3135041.1618270701@sss.pgh.pa.us> <20210413000027.GB4231@momjian.us> <45B3B182-960F-4588-8977-623A599C7EFA@yugabyte.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <45B3B182-960F-4588-8977-623A599C7EFA@yugabyte.com> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Apr 12, 2021 at 05:20:43PM -0700, Bryn Llewellyn wrote: > I’d argue that the fact that this: > > ('0.3 months'::interval) + ('0.7 months'::interval) > > Is reported as '30 days' and not '1 month' is yet another > bug—precisely because of what I said in my previous email (sorry > that I forked the thread) where I referred to the fact that, in the > right test, adding 1 month gets a different answer than adding 30 > days. Flowing _up_ is what these functions do: \df *justify* List of functions Schema | Name | Result data type | Argument data types | Type ------------+------------------+------------------+---------------------+------ pg_catalog | justify_days | interval | interval | func pg_catalog | justify_hours | interval | interval | func pg_catalog | justify_interval | interval | interval | func > Yet another convincing reason to get rid of this flow down > business altogether. We can certainly get rid of all downflow, which in the current patch is only when fractional internal units are specified. > If some application wants to model flow-down, then it can do so with > trivial programming and full control over its own definition of the > rules. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com If only the physical world exists, free will is an illusion.