diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2020-06-19 13:55:21 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2020-06-19 13:55:21 -0400 |
commit | e7c183cd1fd1a7b2fb7ebbe1084bac836fbefac7 (patch) | |
tree | 8a4124b0b903de921958ccc05c8655ebda30afab /src | |
parent | e6ba7056b499a566af7c792794a5c6f51620c866 (diff) | |
download | postgresql-e7c183cd1fd1a7b2fb7ebbe1084bac836fbefac7.tar.gz postgresql-e7c183cd1fd1a7b2fb7ebbe1084bac836fbefac7.zip |
Future-proof regression tests against possibly-missing posixrules file.
The IANA time zone folk have deprecated use of a "posixrules" file in
the tz database. While for now it's our choice whether to keep
supplying one in our own builds, installations built with
--with-system-tzdata will soon be needing to cope with that file not
being present, at least on some platforms.
This causes a problem for the horology test, which expected the
nonstandard POSIX zone spec "CST7CDT" to apply pre-2007 US daylight
savings rules. That does happen if the posixrules file supplies such
information, but otherwise the test produces undesired results.
To fix, add an explicit transition date rule that matches 2005 practice.
(We could alternatively have switched the test to use some real time
zone, but it seems useful to have coverage of this type of zone spec.)
While at it, update a documentation example that also relied on
"CST7CDT"; use a real-world zone name instead. Also, document why
the zone names EST5EDT, CST6CDT, MST7MDT, PST8PDT aren't subject to
similar failures when "posixrules" is missing.
Back-patch to all supported branches, since the hazard is the same
for all.
Discussion: https://postgr.es/m/1665379.1592581287@sss.pgh.pa.us
Diffstat (limited to 'src')
-rw-r--r-- | src/test/regress/expected/horology.out | 3 | ||||
-rw-r--r-- | src/test/regress/sql/horology.sql | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/test/regress/expected/horology.out b/src/test/regress/expected/horology.out index 3064749cc4e..5c4e2a6fcf6 100644 --- a/src/test/regress/expected/horology.out +++ b/src/test/regress/expected/horology.out @@ -652,7 +652,8 @@ SELECT (timestamp with time zone 'tomorrow' > 'now') as "True"; (1 row) -- timestamp with time zone, interval arithmetic around DST change -SET TIME ZONE 'CST7CDT'; +-- (just for fun, let's use an intentionally nonstandard POSIX zone spec) +SET TIME ZONE 'CST7CDT,M4.1.0,M10.5.0'; SELECT timestamp with time zone '2005-04-02 12:00-07' + interval '1 day' as "Apr 3, 12:00"; Apr 3, 12:00 ------------------------------ diff --git a/src/test/regress/sql/horology.sql b/src/test/regress/sql/horology.sql index 87fdcdcf297..9ac3f234484 100644 --- a/src/test/regress/sql/horology.sql +++ b/src/test/regress/sql/horology.sql @@ -122,7 +122,8 @@ SELECT (timestamp with time zone 'tomorrow' = (timestamp with time zone 'yesterd SELECT (timestamp with time zone 'tomorrow' > 'now') as "True"; -- timestamp with time zone, interval arithmetic around DST change -SET TIME ZONE 'CST7CDT'; +-- (just for fun, let's use an intentionally nonstandard POSIX zone spec) +SET TIME ZONE 'CST7CDT,M4.1.0,M10.5.0'; SELECT timestamp with time zone '2005-04-02 12:00-07' + interval '1 day' as "Apr 3, 12:00"; SELECT timestamp with time zone '2005-04-02 12:00-07' + interval '24 hours' as "Apr 3, 13:00"; SELECT timestamp with time zone '2005-04-03 12:00-06' - interval '1 day' as "Apr 2, 12:00"; |