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 1kC3LS-0001B5-2X for pgsql-sql@arkaria.postgresql.org; Sat, 29 Aug 2020 16:04:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kC3LQ-0002W2-1k for pgsql-sql@arkaria.postgresql.org; Sat, 29 Aug 2020 16:04:44 +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 1kC3LP-0002Sj-9L for pgsql-sql@lists.postgresql.org; Sat, 29 Aug 2020 16:04:43 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kC3LI-0005el-Pt for pgsql-sql@lists.postgresql.org; Sat, 29 Aug 2020 16:04: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 07TG4W9f3563363; Sat, 29 Aug 2020 12:04:32 -0400 From: Tom Lane To: John Lumby cc: "David G. Johnston" , pgsql-sql Subject: Re: value returned by EXTRACT, date_part In-reply-to: References: <3517945.1598665173@sss.pgh.pa.us> Comments: In-reply-to John Lumby message dated "Sat, 29 Aug 2020 09:13:46 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3563361.1598717072.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 29 Aug 2020 12:04:32 -0400 Message-ID: <3563362.1598717072@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk John Lumby writes: > What is not clear to me is how the "components" (aka "subfields") of an = > interval are defined. The spec says that year,month,day,hour,minute,second are independent fields. Postgres doesn't implement it quite that way: we treat the basic fields as being months, days, and (micro)seconds, folding the other values into those for storage. That's why "14 months" comes out as "1 year 2 months", for example. regards, tom lane