generate_series for timestamptz and time zone problem - Mailing list pgsql-hackers

From Przemysław Sztoch
Subject generate_series for timestamptz and time zone problem
Date
Msg-id 01a84551-48dd-1359-bf7e-f6b0203a6bd0@sztoch.pl
Whole thread Raw
Responses Re: generate_series for timestamptz and time zone problem
List pgsql-hackers
generate_series ( start timestamp with time zone, stop timestamp with time zone, step interval )
produces results depending on the timezone value set:

SET timezone = 'UTC';
SELECT ts, ts AT TIME ZONE 'UTC'
FROM generate_series('2022-03-26 00:00:00+01'::timestamptz, '2022-03-30 00:00:00+01'::timestamptz, '1 day') AS ts
;

SET timezone = 'Europe/Warsaw';
SELECT ts, ts AT TIME ZONE 'UTC'
FROM generate_series('2022-03-26 00:00:00+01'::timestamptz, '2022-03-30 00:00:00+01'::timestamptz, '1 day') AS ts
;

Sometimes this is a very big problem.

The fourth argument with the time zone will be very useful:
generate_series ( start timestamp with time zone, stop timestamp with time zone, step interval  [, zone text] )

The situation is similar with the function timestamptz_pl_interval. The third parameter for specifying the zone would be very useful.

--
Przemysław Sztoch | Mobile +48 509 99 00 66

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Prevent writes on large objects in read-only transactions
Next
From: Robert Haas
Date:
Subject: Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)