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 1tVcKj-00A2bz-9R for pgsql-general@arkaria.postgresql.org; Wed, 08 Jan 2025 20:07:17 +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 1tVcKi-005yI4-Kz for pgsql-general@arkaria.postgresql.org; Wed, 08 Jan 2025 20:07:16 +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 1tVcKi-005yHv-9t for pgsql-general@lists.postgresql.org; Wed, 08 Jan 2025 20:07:15 +0000 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tVcKe-000aos-2n for pgsql-general@postgresql.org; Wed, 08 Jan 2025 20:07:15 +0000 Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id 77B9113802A3; Wed, 8 Jan 2025 15:07:12 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Wed, 08 Jan 2025 15:07:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1736366832; x=1736453232; bh=uhWUGWZqNgovpvWfhN6Rmu17UF+qz/DDMsG0RNuvTdM=; b= JhqwEwJ8MmSEIkES9AMH5ocwFYKKlMaPw2pqhnBeP54qoRTMssedRlLEGZuSAk6V 7qI9b9Sm2PlCOdH13G1/QuyOnANn51lyC2x+hWFml3330kUBXbjqoxUUUVSPnyDR Xd0gftysA5x8F1Qdl99RvM381A8HxFSg81KNtXUVjCCMV9EftIxonmOqFwOJYQ6R juMFD1LDH2H9Cl8egFQQ++EK121UHxXVRo0dI0P0MqQBT70CyJ2BpRNDUIacJhU/ yhVnRO43DqzKgSw4Idx72PM9/8emUrz+NSVmuAvTzIYRB5HL6aY+5DNtebjS5faO RfWPPFgQtDvWmjxJAKvzSQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1736366832; x=1736453232; bh=u hWUGWZqNgovpvWfhN6Rmu17UF+qz/DDMsG0RNuvTdM=; b=GKVzBf9AVCloRspPP CyZAKEkB7kFdsszW162FAH/n6OxU5a9b7NguMRlJy9vT3Tr/5C64iKPUd3WDDvxt ELvOywiQdXK5UhWd6oYU9Ruld6k/CsU4BNb+O+Ap3knd4bNMlY/XuLli4g86L/f+ oeZdt/qbE/JtNwq46g9YGXfOo6n49lgBuh4addqrPgTGfchFmDtAE9xmlt/rWDOP S2EUhMhavOAuEWR46bhWKumqJjluFUERH8RsIWRjUV5Nak/jcMaVxfwwlQ78lG72 5hI1m6k94hIfK06njtH7OtZw0wVkdUJDLYMxe06jM2CS14YRmZwFzibTTfL4D8uD 9/nFg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudeggedgudefvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhepkfffgg gfuffvfhfhjggtgfesthekredttddvjeenucfhrhhomheptegurhhirghnucfmlhgrvhgv rhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrg htthgvrhhnpeelgeevkeekkeeuiefgtdevieeluefhfedufeetkeejffekjeeujeehgeeh geektdenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgv rhesrghklhgrvhgvrhdrtghomhdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtph houhhtpdhrtghpthhtoheprhhonhhljhhohhhnshhonhhjrhesghhmrghilhdrtghomhdp rhgtphhtthhopehpghhsqhhlqdhgvghnvghrrghlsehpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 8 Jan 2025 15:07:10 -0500 (EST) Message-ID: <071854d0-c524-436c-84d1-309aa096904d@aklaver.com> Date: Wed, 8 Jan 2025 12:07:09 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: INTERVAL MINUTE TO SECOND didn't do what I thought it would do To: Ron Johnson , pgsql-general References: <8c663eab-6dbd-44f1-a8b5-d25a6a227ea9@aklaver.com> Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 1/8/25 11:58 AM, Ron Johnson wrote: > On Wed, Jan 8, 2025 at 2:43 PM Adrian Klaver > wrote: > > > I'd hoped that ::INTERVAL MINUTE TO SECOND would do the trick, but > > MINUTE TO SECOND seems to be ignored. > >  From here: > > https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-INPUT > > "Also, field values “to the right” of the least significant field > allowed by the fields specification are silently discarded. For > example, > writing INTERVAL '1 day 2:03:04' HOUR TO MINUTE results in dropping the > seconds field, but not the day field." > > > I read that, but it did not mention that the day values are retained. I suggest reading the entire section(8.5.4. Interval Input) as well as 8.5.5. Interval Output. > > > > > Is there cast magic that does what I want? > > The only way I can think of extract the epoch from the interval and > pass > to a function that builds what you want. > > > I was afraid of that.  Must decide if it's worth the time. > If you don't mind decimal minutes, a quick and dirty solution is: select extract(epoch from (now() - '2025-01-07 14:15:32'::timestamptz)) / 60; 1301.5244606333333333 -- Adrian Klaver adrian.klaver@aklaver.com