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 1s0S2r-004HyH-Rw for pgsql-bugs@arkaria.postgresql.org; Fri, 26 Apr 2024 20:19:45 +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 1s0S2o-00FUFj-V8 for pgsql-bugs@arkaria.postgresql.org; Fri, 26 Apr 2024 20:19:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s0S2o-00FUFZ-Mn for pgsql-bugs@lists.postgresql.org; Fri, 26 Apr 2024 20:19:43 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s0S2k-000CHw-PC for pgsql-bugs@lists.postgresql.org; Fri, 26 Apr 2024 20:19:42 +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 43QKJaht024616; Fri, 26 Apr 2024 16:19:36 -0400 From: Tom Lane To: =?UTF-8?Q?Marek_L=C3=A4ll?= cc: "David G. Johnston" , "fcaldasdesou@bloomberg.net" , "pgsql-bugs@lists.postgresql.org" Subject: Re: BUG #18445: date_part / extract range for hours do not match documentation In-reply-to: References: <18445-2bdf6f3c730abe6d@postgresql.org> <3332891.1713883193@sss.pgh.pa.us> Comments: In-reply-to =?UTF-8?Q?Marek_L=C3=A4ll?= message dated "Fri, 26 Apr 2024 22:27:49 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <24614.1714162776.1@sss.pgh.pa.us> Date: Fri, 26 Apr 2024 16:19:36 -0400 Message-ID: <24615.1714162776@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk =?UTF-8?Q?Marek_L=C3=A4ll?= writes: >> We tend not to introduce breaking changes if the only motivation is to be >> consistent. > Other mistakes are minor, but why is time '24:00:00' allowed, and it's > actually 00:00:00 of the next day, that's something I'd like to read a > well-argued design decision. [ shrug... ] You're about twenty-five years too late to argue about this. The SQL spec does say that the HOUR field of a time value should be 0-23, so allowing '24:00:00' is an extension, most likely decided by Thomas Lockhart who wrote most of PG's datetime code to begin with. He's long gone from the project and probably doesn't remember his exact reasoning anyway. But we're not likely to remove that extension now, because there might be applications out there depending on it, and it's quite unclear what it's hurting. Arguing from principles of consistency when discussing common timekeeping rules is pointless anyway --- what in the world is consistent about any of it? It could be that Thomas deemed this a more sensible representation of '23:59:60', an input that's explicitly allowed by the SQL spec. But that's just guessing. regards, tom lane