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 1tJ4Vz-000l0M-JG for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Dec 2024 05:35:03 +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 1tJ4Vw-004Sxa-VD for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Dec 2024 05:35:02 +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 1tJ4Vv-004SxR-Rx for pgsql-hackers@lists.postgresql.org; Thu, 05 Dec 2024 05:35:01 +0000 Received: from fhigh-a3-smtp.messagingengine.com ([103.168.172.154]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tJ4Vs-0018De-Rz for pgsql-hackers@lists.postgresql.org; Thu, 05 Dec 2024 05:35:00 +0000 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfhigh.phl.internal (Postfix) with ESMTP id DC0541140179; Thu, 5 Dec 2024 00:34:54 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-12.internal (MEProxy); Thu, 05 Dec 2024 00:34:54 -0500 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=fm1; t=1733376894; x=1733463294; bh=VTKt9gpwBt 8J/B+w1NKC73hRvc0FMgMntmXibHvOscQ=; b=G72XJ7vIkp8ohIdZEDNbgNl6EM EN8YKLIRQ8Df0EBevpb8JCBgkMEAC7H1nkI6k/IxfS7WFt9m9cYlaUbyu6IOaFX2 QVtT41B8TuO65tjKPbFjWX6MBB2aeV6/N4F+dRQ5c6gylv6W1s2A8lQmY4uLk4p4 z//YzyQDJp6vGrPs3A0cjZ/CWilzifVkrXeEHBT3hEfEGEJW9jL2hovRfutf2ae7 OHEvpzd3vV2ZBNTSdz1zb+QBvadyH9Q32Mb0421mii+aKYXuDt7ShEbpRcMfAqxq 8YlKyUmVsrpLQYDbTK+j+VIQs3IUfjNhTy2Ccp0iiT5DcUOcsb/RmbebqtbQ== 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=fm1; t= 1733376894; x=1733463294; bh=VTKt9gpwBt8J/B+w1NKC73hRvc0FMgMntmX ibHvOscQ=; b=koL4axbBRRob55B2nWu7WWdEBLomki3/oWOGez1r+WJV8HPVlp5 IBlj8wK97Hz2ABVupBjE5Ao8tJXB1fSHou++XKG3ipbVFu1d8z4UFSst9cSuhsrI 3SOSvjbMhgWELy/G7yedIP4o1UMBSKJJNCMNL7P6RmJrB5DdFiI7aJcFgzwJiph5 yetoc+7jU8RHP6D+QPbjNJmUwUZ2rNbmcBFyjbCkZYmSwdmKqKeN43j1r53xerC8 33JecTNpfE9axC7n42X4+z3+dCdqjwUHxf69UWOeYAgGiJRUN30HNOOXhW1dMlYS V2oM1x/2I6suxaY8utQqAEpEBeCyhs5CdPA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrieeigdekudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenfghrlhcuvffnffculdejtddmnecujfgurhepfffhvfevuffkfhgg tggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoe hmihgthhgrvghlsehprghquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeetleei fedufffhhfdtteelgeeggeffhfekueevteeigfduudevudetgfegiedvjeenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehp rghquhhivghrrdighiiipdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuth dprhgtphhtthhopehkohhshhihgeegsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhg shhqlhdqhhgrtghkvghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 5 Dec 2024 00:34:53 -0500 (EST) Date: Thu, 5 Dec 2024 14:34:41 +0900 From: Michael Paquier To: Joseph Koshakow Cc: PostgreSQL Hackers Subject: Re: date_trunc invalid units with infinite value Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="wkf2lqwQa4TZdQyn" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --wkf2lqwQa4TZdQyn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Dec 01, 2024 at 03:09:17PM -0500, Joseph Koshakow wrote: > When looking at the date_trunc function, I noticed that it wasn't > rejecting invalid units if the value was infinite. It's slightly > annoying to fix this, but we already do something very similar for > date_part. I have attached a patch that would fix this issue, let me > know if you think it's worth pursuing. I agree that it is inconsistent that we allow infinite values to go through this function call even for fields that are not listed as supported by the documentation. So, yes, I think that what you are doing the right thing by applying the check based on the units supported, but I also doubt that it is something that we could backpatch as it would cause queries to work now to suddenly break. Thoughts and comments from others are welcome. -- Michael --wkf2lqwQa4TZdQyn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmdRO3EACgkQnvQgOdby QH3tFw/+NqkMdsbuKhfjxa2bAMaoYWLhlbk/Dutn+Zz9+vBcJNct9+YV03GwSsh8 FbTtHB8+kNfF2De8iXIjhEXBC4v8M8w8VhK/xs8Y0ZzLdh06To6KozoT0qt0vdBq RRhZRuu3CWJ1SbKnPY9YV4c/sY1AXRC72GZuTkPFapYOe4q0P2ADRScgZc4jGX/e xlm2x1tlklZ1a9xlLvll75T+mCYi8T+VQfylr4IC1uxGmpGg3v/qZR7ccsrRHl1u Aydp73ZehudoTUJvYm5xfJm0vm/qs+PfUZW1q21MuizmLxBQM5gEzkPS9DOgeLAd /k1XMShP21nuQ6lKJnlZck1Owsz/NDscxtagO2HXuWa48kArAdmZqPO7+sipMNAu daAQTt9TAaYvup75OMBhaDo5odurOiLLW2gqLtESsdQbrhf+BLySSlwl6D8fKrUY 5FIBx6b9k8x7qxCHXhAeCMM6MNPlo2fa7FALkkW+B/Z21Z84ArsbqgTG+VMXvHu7 6PQetS1T7TPuNtaqmkNp3agn94eJNLyIWFqfx6p2NHNO8RpNrfg/A7x78oI8g+S9 0+BpVTVogAFSVX5tLdZHeOVArG2wk2vNsMjK6lGWTKw23p297HRJzFUEwEUPdZ4l Ire2JxYVTzZnpLg+isC+KQ5yrX4lNR4IVFuQU0TNmC5CmLGTpQ0= =Fd0Y -----END PGP SIGNATURE----- --wkf2lqwQa4TZdQyn--