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 1ujqjP-00CiiL-0O for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Aug 2025 02:51:51 +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 1ujqjN-002Neo-Mt for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Aug 2025 02:51:49 +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 1ujqjM-002NeY-UU for pgsql-hackers@lists.postgresql.org; Thu, 07 Aug 2025 02:51:49 +0000 Received: from fhigh-a1-smtp.messagingengine.com ([103.168.172.152]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ujqjK-001Awx-0E for pgsql-hackers@lists.postgresql.org; Thu, 07 Aug 2025 02:51:48 +0000 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfhigh.phl.internal (Postfix) with ESMTP id 2DE121400088; Wed, 6 Aug 2025 22:51:44 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Wed, 06 Aug 2025 22:51:44 -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=1754535104; x=1754621504; bh=GPMVlz0Pcs tyUwhmyU3rQBVXPSv73jX6sMtXhykSRP0=; b=JXlQ0ePx+JulsMKUhAemqZMRr+ OHqyeklUb8cySwwjFc1lU27JksHiUh+4/2Wb2IhLey77JeC+G6BBoyGKYW9N3VI1 aEocv3vG8832DSJki3eC2LEb/OS1H7qwMofc2AdEIa5CqrJU6CCuDsRTrHeU9tov nW7PwaMYBnNLD8L6+M6dfvPwKiRSykLgl0m8IqinvbvUd2ZmFK53iDjThLFNjP7C j6u/x3oDqRGogALVp7QoSZKcy6nh2hVgvtBTo7M1qb8fSqgHftmLUusM0QsV+pjj zBBufk9zJcP2mFpRJAcFuhSzGmhb6zg6NUh38XM1Hk41k4q9bRgtANWyhkiA== 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= 1754535104; x=1754621504; bh=GPMVlz0PcstyUwhmyU3rQBVXPSv73jX6sMt XhykSRP0=; b=G6aOqBOFiupPTKZWDPXpIscqBu7wdf9caKdWS7d5s1J5kNizh4g DJzTV6IM0jkNr4diyriGKsp3MYrnhL9BywwqQlI//2pHd/0QtCsKBG1K9zAUqUaO njFi/CafePY0eEvYaqmbvYVKkcG77cqvpdzbODrkvix06dWkYYL5OV00W8W5q68f yxr1go52nfXibT+q4XdVtvN5s5XjeAvMnTMQ8mb4HcHQl23SQ7BjXJcAbkSvwb3L PTBMuO5sUR6bEwCIvvCLXti9nQPl/6AGl9GRtSeGEPctTm/bkTTGA77qjV8SAB+I 8SfDwNOLlwdBXIRwBmERHkjLZWaQRb8YImA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduudeljeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrh hlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeggeeg fffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidp nhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepphgvth gvrhesvghishgvnhhtrhgruhhtrdhorhhgpdhrtghpthhtohepkhhoshhhhieggeesghhm rghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrd hpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 6 Aug 2025 22:51:41 -0400 (EDT) Date: Thu, 7 Aug 2025 11:51:37 +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="/sPBWkvl9oc/Hqd3" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --/sPBWkvl9oc/Hqd3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 07, 2025 at 09:06:25AM +0900, Michael Paquier wrote: > 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' ); >=20 > 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 + Blurp here. I meant !TIMESTAMP_NOT_FINITE with unsupported unit, old code path. > 2) One test for timestamptz_trunc_zone(): > - !TIMESTAMP_NOT_FINITE + "not supported" unit There can be an extra test here, for the case of an infinite value with a valid unit and a time zone specified, which would also have failed with the bug as timestamptz_trunc_internal() is also used by timestamptz_trunc_zone(), like: SELECT date_trunc( 'week', timestamp with time zone 'infinity', 'GMT') AS inf_zone_trunc; I have added one more test, reversed the order to avoid spurious failures should one have the idea to do a bisect with a 32b build, and applied both things.=20 Thanks for the report! -- Michael --/sPBWkvl9oc/Hqd3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmiUFLkACgkQnvQgOdby QH1vmA/8DC/qSAQmMxd5GBnEHr+U4eDy+N7RaTKjDmPwoZkgDwOC2DNjctZr65Nd rRUpQuosz8WyMVBPsyw9puW6vTE13j0cD7ghUfZ1S99tDPKrK6zUwntaVwEhbrAa /MUOh5HuwZVU/ba7LMIGb/i1LZ1lMS1SPDANIy7mwKhgZJd51QQtJtEYEj+nUyxb jVIOIlLLih5vpG39B6YoAmsbvxtnlJy1YdccADNHIzudK0c4kgRZhnrgRuxCr1Wf Jdn88n81HHXmhvDrxj14vGQijljRcds5+8ujLUMn4YuzZ4ssA+InKua3Q9pWwq+W EVB6N6njrfCgCYBPS9T4gf3m1tTGEuguiZIvQmFrm+RbHLAbgs9iPxrXRnkesLvR vGMemy9L3CLmWyDQQtVDzTP2cdTZTW+8O0bCvC6JNOXGhLPaVfSPelm/Y5+WFuLa 5QdFdbi5ObHtjCB6V7oVt7t+/N12l581Og8KTonnxG+lZJz+Qbr8UZFBimcytYEY uF7aDVpibMtMlsKBqktjjxpWlGn1Hl29Zdwl5tYff+f6XOl5HIRNzMdjapY9h4vn f3HGJJERJweHm8LZFnm6zlto9Rh9Fa82mCHSOAP1LHBIAIlvD5IEXL/unIvGmCov 4Cxoc7bnrJnz3yNgccnsMIpZCKIYnSz16lZwnjw7bebUZgmyx2c= =VtB8 -----END PGP SIGNATURE----- --/sPBWkvl9oc/Hqd3--