Skip to content

Commit

Permalink
Run regression tests with timezone America/Los_Angeles.
Browse files Browse the repository at this point in the history
Historically we've used timezone "PST8PDT", but the recent release
2024b of tzdb changes the definition of that zone in a way that
breaks many test cases concerned with dates before 1970.  Although
we've not yet adopted 2024b into our own tree, this is already
problematic for people using --with-system-tzdata if their platform
has already adopted 2024b.  To work with both older and newer
versions of tzdb, switch to using "America/Los_Angeles", accepting
the ensuing changes in regression test results.

Back-patch to all supported branches.

Per report and patch from Wolfgang Walther.

Discussion: https://postgr.es/m/[email protected]
(cherry picked from commit 2b94ee58bf256e1b4682f21f13d0f2c73e1b0cc2)
  • Loading branch information
tglsfdc authored and shardgupta committed Dec 6, 2024
1 parent dcb5c51 commit 516a630
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 105 deletions.
4 changes: 2 additions & 2 deletions doc/src/sgml/ref/set.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ SELECT setseed(<replaceable>value</replaceable>);

<variablelist>
<varlistentry>
<term><literal>'PST8PDT'</literal></term>
<term><literal>'America/Los_Angeles'</literal></term>
<listitem>
<para>
The time zone for Berkeley, California.
Expand Down Expand Up @@ -298,7 +298,7 @@ SET datestyle TO postgres, dmy;
<para>
Set the time zone for Berkeley, California:
<screen>
SET TIME ZONE 'PST8PDT';
SET TIME ZONE 'America/Los_Angeles';
</screen>
</para>

Expand Down
6 changes: 3 additions & 3 deletions doc/src/sgml/regress.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -521,11 +521,11 @@ make check NO_LOCALE=1
<para>
Most of the date and time results are dependent on the time zone
environment. The reference files are generated for time zone
<literal>PST8PDT</literal> (Berkeley, California), and there will be
<literal>America/Los_Angeles</literal>, and there will be
apparent failures if the tests are not run with that time zone setting.
The regression test driver sets environment variable
<envar>PGTZ</envar> to <literal>PST8PDT</literal>, which normally
ensures proper results.
<envar>PGTZ</envar> to <literal>America/Los_Angeles</literal>,
which normally ensures proper results.
</para>
</sect2>

Expand Down
10 changes: 5 additions & 5 deletions src/test/regress/expected/date.out
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ SELECT DATE_TRUNC('MILLENNIUM', TIMESTAMP '1970-03-20 04:30:00.00000'); -- 1001
SELECT DATE_TRUNC('MILLENNIUM', DATE '1970-03-20'); -- 1001-01-01
date_trunc
------------------------------
Thu Jan 01 00:00:00 1001 PST
Thu Jan 01 00:00:00 1001 LMT
(1 row)

SELECT DATE_TRUNC('CENTURY', TIMESTAMP '1970-03-20 04:30:00.00000'); -- 1901
Expand All @@ -1288,13 +1288,13 @@ SELECT DATE_TRUNC('CENTURY', DATE '2004-08-10'); -- 2001-01-01
SELECT DATE_TRUNC('CENTURY', DATE '0002-02-04'); -- 0001-01-01
date_trunc
------------------------------
Mon Jan 01 00:00:00 0001 PST
Mon Jan 01 00:00:00 0001 LMT
(1 row)

SELECT DATE_TRUNC('CENTURY', DATE '0055-08-10 BC'); -- 0100-01-01 BC
date_trunc
---------------------------------
Tue Jan 01 00:00:00 0100 PST BC
Tue Jan 01 00:00:00 0100 LMT BC
(1 row)

SELECT DATE_TRUNC('DECADE', DATE '1993-12-25'); -- 1990-01-01
Expand All @@ -1306,13 +1306,13 @@ SELECT DATE_TRUNC('DECADE', DATE '1993-12-25'); -- 1990-01-01
SELECT DATE_TRUNC('DECADE', DATE '0004-12-25'); -- 0001-01-01 BC
date_trunc
---------------------------------
Sat Jan 01 00:00:00 0001 PST BC
Sat Jan 01 00:00:00 0001 LMT BC
(1 row)

SELECT DATE_TRUNC('DECADE', DATE '0002-12-31 BC'); -- 0011-01-01 BC
date_trunc
---------------------------------
Mon Jan 01 00:00:00 0011 PST BC
Mon Jan 01 00:00:00 0011 LMT BC
(1 row)

--
Expand Down
57 changes: 31 additions & 26 deletions src/test/regress/expected/horology.out
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
--
-- HOROLOGY
--
SET DateStyle = 'Postgres, MDY';
SHOW TimeZone; -- Many of these tests depend on the prevailing setting
TimeZone
----------
PST8PDT
SHOW TimeZone; -- Many of these tests depend on the prevailing settings
TimeZone
---------------------
America/Los_Angeles
(1 row)

SHOW DateStyle;
DateStyle
---------------
Postgres, MDY
(1 row)

--
Expand Down Expand Up @@ -769,12 +774,12 @@ SELECT d1 + interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL;
Sat Feb 14 17:32:01 1998 PST
Sun Feb 15 17:32:01 1998 PST
Mon Feb 16 17:32:01 1998 PST
Thu Feb 16 17:32:01 0096 PST BC
Sun Feb 16 17:32:01 0098 PST
Fri Feb 16 17:32:01 0598 PST
Wed Feb 16 17:32:01 1098 PST
Sun Feb 16 17:32:01 1698 PST
Fri Feb 16 17:32:01 1798 PST
Thu Feb 16 17:32:01 0096 LMT BC
Sun Feb 16 17:32:01 0098 LMT
Fri Feb 16 17:32:01 0598 LMT
Wed Feb 16 17:32:01 1098 LMT
Sun Feb 16 17:32:01 1698 LMT
Fri Feb 16 17:32:01 1798 LMT
Wed Feb 16 17:32:01 1898 PST
Mon Feb 16 17:32:01 1998 PST
Sun Feb 16 17:32:01 2098 PST
Expand Down Expand Up @@ -840,12 +845,12 @@ SELECT d1 - interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL;
Wed Feb 14 17:32:01 1996 PST
Thu Feb 15 17:32:01 1996 PST
Fri Feb 16 17:32:01 1996 PST
Mon Feb 16 17:32:01 0098 PST BC
Thu Feb 16 17:32:01 0096 PST
Tue Feb 16 17:32:01 0596 PST
Sun Feb 16 17:32:01 1096 PST
Thu Feb 16 17:32:01 1696 PST
Tue Feb 16 17:32:01 1796 PST
Mon Feb 16 17:32:01 0098 LMT BC
Thu Feb 16 17:32:01 0096 LMT
Tue Feb 16 17:32:01 0596 LMT
Sun Feb 16 17:32:01 1096 LMT
Thu Feb 16 17:32:01 1696 LMT
Tue Feb 16 17:32:01 1796 LMT
Sun Feb 16 17:32:01 1896 PST
Fri Feb 16 17:32:01 1996 PST
Thu Feb 16 17:32:01 2096 PST
Expand Down Expand Up @@ -2124,7 +2129,7 @@ SELECT '2020-10-05'::timestamptz > '2202020-10-05'::date as f;
SELECT '4714-11-24 BC'::date::timestamptz;
timestamptz
---------------------------------
Mon Nov 24 00:00:00 4714 PST BC
Mon Nov 24 00:00:00 4714 LMT BC
(1 row)

SET TimeZone = 'UTC-2';
Expand Down Expand Up @@ -2702,13 +2707,13 @@ RESET DateStyle;
SELECT to_timestamp('0097/Feb/16 --> 08:14:30', 'YYYY/Mon/DD --> HH:MI:SS');
to_timestamp
------------------------------
Sat Feb 16 08:14:30 0097 PST
Sat Feb 16 08:14:30 0097 LMT
(1 row)

SELECT to_timestamp('97/2/16 8:14:30', 'FMYYYY/FMMM/FMDD FMHH:FMMI:FMSS');
to_timestamp
------------------------------
Sat Feb 16 08:14:30 0097 PST
Sat Feb 16 08:14:30 0097 LMT
(1 row)

SELECT to_timestamp('2011$03!18 23_38_15', 'YYYY-MM-DD HH24:MI:SS');
Expand Down Expand Up @@ -2745,7 +2750,7 @@ SELECT to_timestamp('My birthday-> Year: 1976, Month: May, Day: 16',
SELECT to_timestamp('1,582nd VIII 21', 'Y,YYYth FMRM DD');
to_timestamp
------------------------------
Sat Aug 21 00:00:00 1582 PST
Sat Aug 21 00:00:00 1582 LMT
(1 row)

SELECT to_timestamp('15 "text between quote marks" 98 54 45',
Expand Down Expand Up @@ -2809,7 +2814,7 @@ SELECT to_timestamp('1997 AD 11 16', 'YYYY BC MM DD');
SELECT to_timestamp('1997 BC 11 16', 'YYYY BC MM DD');
to_timestamp
---------------------------------
Tue Nov 16 00:00:00 1997 PST BC
Tue Nov 16 00:00:00 1997 LMT BC
(1 row)

SELECT to_timestamp('1997 A.D. 11 16', 'YYYY B.C. MM DD');
Expand All @@ -2821,7 +2826,7 @@ SELECT to_timestamp('1997 A.D. 11 16', 'YYYY B.C. MM DD');
SELECT to_timestamp('1997 B.C. 11 16', 'YYYY B.C. MM DD');
to_timestamp
---------------------------------
Tue Nov 16 00:00:00 1997 PST BC
Tue Nov 16 00:00:00 1997 LMT BC
(1 row)

SELECT to_timestamp('9-1116', 'Y-MMDD');
Expand Down Expand Up @@ -3091,19 +3096,19 @@ SELECT to_date('-44-02-01 BC','YYYY-MM-DD BC');
SELECT to_timestamp('44-02-01 11:12:13 BC','YYYY-MM-DD HH24:MI:SS BC');
to_timestamp
---------------------------------
Fri Feb 01 11:12:13 0044 PST BC
Fri Feb 01 11:12:13 0044 LMT BC
(1 row)

SELECT to_timestamp('-44-02-01 11:12:13','YYYY-MM-DD HH24:MI:SS');
to_timestamp
---------------------------------
Fri Feb 01 11:12:13 0044 PST BC
Fri Feb 01 11:12:13 0044 LMT BC
(1 row)

SELECT to_timestamp('-44-02-01 11:12:13 BC','YYYY-MM-DD HH24:MI:SS BC');
to_timestamp
------------------------------
Mon Feb 01 11:12:13 0044 PST
Mon Feb 01 11:12:13 0044 LMT
(1 row)

--
Expand Down
Loading

0 comments on commit 516a630

Please sign in to comment.