From 0171e72d4da2da7974ff13c63130e2175cebee88 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 16 Feb 2008 21:16:04 +0000 Subject: Update timezone code to track the upstream changes since 2003. In particular this adds support for 64-bit tzdata files, which is needed to support DST calculations beyond 2038. Add a regression test case to give some minimal confidence that that really works. Heikki Linnakangas --- src/test/regress/expected/timestamptz.out | 25 +++++++++++++++++++++++++ src/test/regress/sql/timestamptz.sql | 7 +++++++ 2 files changed, 32 insertions(+) (limited to 'src/test') diff --git a/src/test/regress/expected/timestamptz.out b/src/test/regress/expected/timestamptz.out index 7c95e53d671..706aa099481 100644 --- a/src/test/regress/expected/timestamptz.out +++ b/src/test/regress/expected/timestamptz.out @@ -114,6 +114,31 @@ INSERT INTO TIMESTAMPTZ_TBL VALUES ('19970710 173201 America/Does_not_exist'); ERROR: time zone "america/does_not_exist" not recognized SELECT '19970710 173201' AT TIME ZONE 'America/Does_not_exist'; ERROR: time zone "America/Does_not_exist" not recognized +-- Daylight saving time for timestamps beyond 32-bit time_t range. +SELECT '20500710 173201 Europe/Helsinki'::timestamptz; -- DST + timestamptz +------------------------------ + Sun Jul 10 07:32:01 2050 PDT +(1 row) + +SELECT '20500110 173201 Europe/Helsinki'::timestamptz; -- non-DST + timestamptz +------------------------------ + Mon Jan 10 07:32:01 2050 PST +(1 row) + +SELECT '205000-07-10 17:32:01 Europe/Helsinki'::timestamptz; -- DST + timestamptz +-------------------------------- + Thu Jul 10 07:32:01 205000 PDT +(1 row) + +SELECT '205000-01-10 17:32:01 Europe/Helsinki'::timestamptz; -- non-DST + timestamptz +-------------------------------- + Fri Jan 10 07:32:01 205000 PST +(1 row) + -- Check date conversion and date arithmetic INSERT INTO TIMESTAMPTZ_TBL VALUES ('1997-06-10 18:32:01 PDT'); INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 10 17:32:01 1997'); diff --git a/src/test/regress/sql/timestamptz.sql b/src/test/regress/sql/timestamptz.sql index 7ed0963b009..731855d584d 100644 --- a/src/test/regress/sql/timestamptz.sql +++ b/src/test/regress/sql/timestamptz.sql @@ -86,6 +86,13 @@ SELECT '19970710 173201' AT TIME ZONE 'America/New_York'; INSERT INTO TIMESTAMPTZ_TBL VALUES ('19970710 173201 America/Does_not_exist'); SELECT '19970710 173201' AT TIME ZONE 'America/Does_not_exist'; +-- Daylight saving time for timestamps beyond 32-bit time_t range. +SELECT '20500710 173201 Europe/Helsinki'::timestamptz; -- DST +SELECT '20500110 173201 Europe/Helsinki'::timestamptz; -- non-DST + +SELECT '205000-07-10 17:32:01 Europe/Helsinki'::timestamptz; -- DST +SELECT '205000-01-10 17:32:01 Europe/Helsinki'::timestamptz; -- non-DST + -- Check date conversion and date arithmetic INSERT INTO TIMESTAMPTZ_TBL VALUES ('1997-06-10 18:32:01 PDT'); -- cgit v1.2.3