Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tzcSs-004Lum-Ty for pgsql-bugs@arkaria.postgresql.org; Tue, 01 Apr 2025 14:19:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tzcSr-0033PL-HH for pgsql-bugs@arkaria.postgresql.org; Tue, 01 Apr 2025 14:19:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tzcSr-0033Oi-8T for pgsql-bugs@lists.postgresql.org; Tue, 01 Apr 2025 14:19:41 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tzcSo-002ldn-33 for pgsql-bugs@lists.postgresql.org; Tue, 01 Apr 2025 14:19:40 +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 531EJahP346946; Tue, 1 Apr 2025 10:19:36 -0400 From: Tom Lane To: Milan Novotny cc: pgsql-bugs@lists.postgresql.org Subject: Re: Summing of INTERVAL returns incorrect number of days and hours In-reply-to: References: Comments: In-reply-to Milan Novotny message dated "Tue, 01 Apr 2025 15:13:08 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <346944.1743517176.1@sss.pgh.pa.us> Date: Tue, 01 Apr 2025 10:19:36 -0400 Message-ID: <346945.1743517176@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Milan Novotny writes: > 581 days 61:06:36.805| > --> should be 583 days .. If you don't like that result, justify_hours() might help you. But interval summing doesn't assume that it can always overflow seconds into days, because a day isn't always 24 hours. regards, tom lane