public inbox for [email protected]  
help / color / mirror / Atom feed
From: Michael Paquier <[email protected]>
To: Peter Eisentraut <[email protected]>
Cc: Joseph Koshakow <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: date_trunc invalid units with infinite value
Date: Thu, 7 Aug 2025 11:51:37 +0900
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <CAAvxfHc4084dGzEJR0_pBZkDuqbPGc5wn7gK_M0XR_kRiCdUJQ@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>

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' );
> 
> 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. 

Thanks for the report!
--
Michael


Attachments:

  [application/pgp-signature] signature.asc (833B, ../[email protected]/2-signature.asc)
  download

view thread (8+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: date_trunc invalid units with infinite value
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox