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 1sez1g-00FFP6-1F for pgsql-bugs@arkaria.postgresql.org; Fri, 16 Aug 2024 15:38:04 +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 1sez1e-006BGG-B3 for pgsql-bugs@arkaria.postgresql.org; Fri, 16 Aug 2024 15:38:02 +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 1sez1e-006BFv-2I for pgsql-bugs@lists.postgresql.org; Fri, 16 Aug 2024 15:38:02 +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 1sez1b-0052Zx-Ci for pgsql-bugs@lists.postgresql.org; Fri, 16 Aug 2024 15:38:00 +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 47GFbtbt755166; Fri, 16 Aug 2024 11:37:55 -0400 From: Tom Lane To: Bruce Momjian cc: jian he , Francisco Olarte , Michael Bondarenko , pgsql-bugs@lists.postgresql.org, dgrowleyml@gmail.com, Peter Eisentraut Subject: Re: BUG #18348: Inconsistency with EXTRACT([field] from INTERVAL); In-reply-to: References: <3749306.1708222748@sss.pgh.pa.us> <222870.1708458150@sss.pgh.pa.us> <270582.1708462564@sss.pgh.pa.us> <166456.1715117228@sss.pgh.pa.us> <476283.1715177448@sss.pgh.pa.us> <1079670.1720458208@sss.pgh.pa.us> Comments: In-reply-to Bruce Momjian message dated "Fri, 16 Aug 2024 11:26:58 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <755164.1723822675.1@sss.pgh.pa.us> Date: Fri, 16 Aug 2024 11:37:55 -0400 Message-ID: <755165.1723822675@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Bruce Momjian writes: > On Thu, Aug 15, 2024 at 10:45:58PM -0400, Bruce Momjian wrote: >> I tested master, patch version 2 and patch version 3 with some sample >> extract() queires, attached. I like patch version 2. I'm still pretty dissatisfied with both versions :-( > I think there are two more issues. In patch version 3, when months is > zero and you check days, you should also check seconds if days is zero. Eh? v3 does that: + else if (interval->day > 0 || + (interval->day == 0 && interval->time >= 0)) But I'm starting to despair of reaching a solution that's actually self-consistent. Maybe we should leave the DTK_QUARTER behavior alone, and content ourselves with adding DTK_WEEK. regards, tom lane