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 1ujo9U-00CEW8-W2 for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Aug 2025 00:06:37 +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 1ujo9T-001kCM-I8 for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Aug 2025 00:06:35 +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 1ujo9T-001kCA-85 for pgsql-hackers@lists.postgresql.org; Thu, 07 Aug 2025 00:06:35 +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 1ujo9Q-0019e5-2J for pgsql-hackers@lists.postgresql.org; Thu, 07 Aug 2025 00:06:34 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id B1256EC0197; Wed, 6 Aug 2025 20:06:30 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Wed, 06 Aug 2025 20:06:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc: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=fm3; t=1754525190; x=1754611590; bh=GLzc6mM9tz 0vGlU0R6klm1n5t5GCvEhc3OGc4FTDX64=; b=liszHzp7yvXT2QZf9PLsqqR1yT LbQyajNp3poT9R58mIQWySfaUp1BoluZG/cy+tx4jr4M3Ax3xKfgjn1Ed27xM4ez zBPwVBfus/XEawL66mTFKVx4WY7qSc6V+mUQvYJtzDN6QhHO6IoKah5SSx5Mbwb2 G23whfW+E6jo7sErJZ3mWWPCJZPQ7f92ubQBi5iz7U6VWvcjAfrRyAcDi48AV4GH 11v8It5VYCMCXQoa8rv2uwuFQGmcHUDp0GUNul1NcZcPiz5jhebzDOPHXUkMl5JD ddaivnwyFZ21wMrQ1EdH7wEG1quEhnO9Iq+PFfucPudLrbIQi/CBbIi9yQZg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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=fm3; t= 1754525190; x=1754611590; bh=GLzc6mM9tz0vGlU0R6klm1n5t5GCvEhc3OG c4FTDX64=; b=Xu5EoiHpdtmQFmW+vgXdjublHRdLLPGi0FwTmz46d+7tdqdGk3d KBm6ifxTV6QV7/QJ5nUJa4yHD/jeSpOzOUkUqCzzk2PTBikVE7QfzqHxOmr8pHTc BwL29i7Sxydb6c7Mnsim3lgWxezq87mGr+e79fI+K39wJNngXGvmkm6bc+m4H+Oo +RNuaSoPkoBZetiqkC+p12kakCiZN5VCTRb/FjZLQhVMmK7ltN0wT9iHQKZljfXK C4LiXIrb2mVb8B9zizWpoYwiYki64pn0YW4J91t1w5mac+JhjQfWl3jvbon2P6lr iEuhz4cSm593bRx8VHbmlzxBHYa1CNrVU3A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduudelgeehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrh hlucfvnfffucdlfeehmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepgeffjeevgfevuddvjedtvddtieej heduueelvddufedtgfefjedvkeevkeeivddvnecuffhomhgrihhnpehpohhsthhgrhgvsh hqlhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhr ohhmpehmihgthhgrvghlsehprghquhhivghrrdighiiipdhnsggprhgtphhtthhopeefpd hmohguvgepshhmthhpohhuthdprhgtphhtthhopehpvghtvghrsegvihhsvghnthhrrghu thdrohhrghdprhgtphhtthhopehkohhshhihgeegsehgmhgrihhlrdgtohhmpdhrtghpth htohepphhgshhqlhdqhhgrtghkvghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdho rhhg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 6 Aug 2025 20:06:28 -0400 (EDT) Date: Thu, 7 Aug 2025 09:06:25 +0900 From: Michael Paquier To: Peter Eisentraut Cc: Joseph Koshakow , PostgreSQL Hackers Subject: Re: date_trunc invalid units with infinite value Message-ID: References: <4bf60a84-2862-4a53-acd5-8eddf134a60e@eisentraut.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="GilEzjPSs0C2ER9z" Content-Disposition: inline In-Reply-To: <4bf60a84-2862-4a53-acd5-8eddf134a60e@eisentraut.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --GilEzjPSs0C2ER9z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 06, 2025 at 01:07:25PM +0200, Peter Eisentraut wrote: > It turned out this had a bug, and also the newly added test cases didn't > actually cover the new code, otherwise this would have shown up. >=20 > Please review the attached patches with additional test cases and the fix. >=20 > See also [0] for further context: >=20 > [0]: https://www.postgresql.org/message-id/8246d7ff-f4b7-4363-913e-827dad= feb145%40eisentraut.org Yes, confirmed the broken case on 32-bit builds with the incorrect result returned by timestamptz_trunc_internal(): SELECT date_trunc( 'week', timestamp with time zone 'infinity' ); And confirmed that we don't have any coverage for two code paths as of HEAD: - "not supported" in timestamp_trunc() for the entire new section of where TIMESTAMP_NOT_FINITE() is satisfied. - "not supported" in timestamptz_trunc_internal() for the entire section where TIMESTAMP_NOT_FINITE() is satisfied. 0001 adds three new tests for timestamp: - TIMESTAMP_NOT_FINITE + a valid unit, new path. - TIMESTAMP_NOT_FINITE + "not supported" unit, new error path - !TIMESTAMP_NOT_FINITE + "not supported" unit, old error path 0001 four new tests for timestamptz: 1) Three tests for timestamptz_trunc(): - TIMESTAMP_NOT_FINITE + a valid unit, new path. - TIMESTAMP_NOT_FINITE + "not supported" unit, new path. - !TIMESTAMP_NOT_FINITE + 2) One test for timestamptz_trunc_zone(): - !TIMESTAMP_NOT_FINITE + "not supported" unit With what I am reading in your patch, what you are suggesting to add, and a double-check at the interval tests, that seems complete to me. This is a v18 open item, for something that I am an owner of as the committer of d85ce012f99f, so I'll go take care of it. Thanks! -- Michael --GilEzjPSs0C2ER9z Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmiT7gEACgkQnvQgOdby QH2jhQ/6ArXZuRWlR3KjMMHF3d2WAc8evob7pPGR/j6scQZEPu5DR1QoCZYoZ3+x tkcvz2LXcz7xmPwnAXLzwFQ5SjES3O4outqaGdQsyEESZ9v5i7NR3oru0rDMyZ04 Ws/OQUWst9w5CHNOX0ER/pqkg/EZ5KMSQtPcoB9w6mPVZ5y3EbJ5cm+PWDMEfcWb lQqiBT9woNG0b3S9wcqIoALTCjaZctYlSogfg9+o3AIaKrCtMZDGKGjzngcHM/eP Y1TNSzBBOwfzf5bzLQNQDbr542bNRJUtci75K08wzIFCxUwxHcy8CDgD0lEsUk8W SJm8tCotcsbNFxLGgSkuAZYUcy2ZjQoS9/HQxEEdgf2C4k1KK42rgTxgZP8DDfm2 P56hpUWbFmieTsOKsms7W4/NTZhoBVsEBh3TRCtXmKTna+mCZvavyjT7CCZmoPe7 31DuPEVRcbN3J8+FPe1cl8/gqLYGL842xmE0HK+RVU4utn0aH4gpbXgL2qOGgt8C zRWz+V7ChpzBKLUWB/113Fe9QCfcY18hmAUpH/Xw1Pk0ztsPUSvjKj/k6HkVWx4V BSoOFNR2045F7ailsdpnjRiV6ygFzMPjus43dlQC/kO4ZuDBAJOgYBQnkWtc6NfB xFNLL01taOKM/d96VpG47fAbY632YPwm1jXJOwcn8d29xZATZWg= =O5tH -----END PGP SIGNATURE----- --GilEzjPSs0C2ER9z--