You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by rl...@apache.org on 2017/12/01 06:30:43 UTC

[3/3] incubator-hawq git commit: HAWQ-1532. test cases on 'Asia' timezone

HAWQ-1532. test cases on 'Asia' timezone


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/5e152951
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/5e152951
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/5e152951

Branch: refs/heads/master
Commit: 5e152951d9a648a797199f2d21513bb8e30e4644
Parents: 7d522a8
Author: Kuien Liu <ku...@alibaba-inc.com>
Authored: Thu Nov 30 17:43:12 2017 +0800
Committer: rlei <rl...@pivotal.io>
Committed: Fri Dec 1 14:29:51 2017 +0800

----------------------------------------------------------------------
 src/test/feature/catalog/ans/time.ans | 76 ++++++++++++++++++++++++++++++
 src/test/feature/catalog/sql/time.sql | 25 ++++++++++
 2 files changed, 101 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/5e152951/src/test/feature/catalog/ans/time.ans
----------------------------------------------------------------------
diff --git a/src/test/feature/catalog/ans/time.ans b/src/test/feature/catalog/ans/time.ans
index ddeea98..f854cdb 100755
--- a/src/test/feature/catalog/ans/time.ans
+++ b/src/test/feature/catalog/ans/time.ans
@@ -95,3 +95,79 @@ psql:/tmp/TestType_time.sql:44: ERROR:  operator is not unique: time without tim
 LINE 1: SELECT f1 + time '00:01' AS "Illegal" FROM TIME_TBL;
                   ^
 HINT:  Could not choose a best candidate operator. You may need to add explicit type casts.
+--
+-- Support timezone_abbreviations = 'Asia'
+--
+-- For some reason this seems to have been missed to support
+-- CST (China Standard Time). On some platforms, for example,
+-- Linux, CST is used as time string suffix of GMT+8, especially
+-- for users in China. In such case, the timestamp of log is
+-- '14 hours' ahead of the actual China time (GMT+8).
+SHOW timezone_abbreviations; -- info for debug, should always be 'Default'
+ timezone_abbreviations 
+------------------------
+ Default
+(1 row)
+
+SET timezone_abbreviations TO 'Asia';
+SET
+SELECT abbrev, utc_offset FROM pg_timezone_abbrevs WHERE abbrev = 'CST';
+ abbrev | utc_offset 
+--------+------------
+ CST    | 08:00:00
+(1 row)
+
+SELECT '2002-09-24 10:10 CST'::TIMESTAMP WITH TIME ZONE;
+         timestamptz          
+------------------------------
+ Mon Sep 23 19:10:00 2002 PDT
+(1 row)
+
+SELECT '2002-09-24 10:10 Asia/Shanghai'::TIMESTAMP WITH TIME ZONE; -- won't change
+         timestamptz          
+------------------------------
+ Mon Sep 23 19:10:00 2002 PDT
+(1 row)
+
+SELECT '2002-09-24 10:10 GST'::TIMESTAMP WITH TIME ZONE; -- Gulf Standard Time, Asia/Dubai
+         timestamptz          
+------------------------------
+ Mon Sep 23 23:10:00 2002 PDT
+(1 row)
+
+SELECT '2002-09-24 10:10 IST'::TIMESTAMP WITH TIME ZONE; -- Indian Standard Time
+         timestamptz          
+------------------------------
+ Mon Sep 23 21:40:00 2002 PDT
+(1 row)
+
+SET timezone_abbreviations TO 'Default';
+SET
+SELECT abbrev, utc_offset FROM pg_timezone_abbrevs WHERE abbrev = 'CST';
+ abbrev | utc_offset 
+--------+------------
+ CST    | -06:00:00
+(1 row)
+
+SELECT '2002-09-24 10:10 CST'::TIMESTAMP WITH TIME ZONE;
+         timestamptz          
+------------------------------
+ Tue Sep 24 09:10:00 2002 PDT
+(1 row)
+
+SELECT '2002-09-24 10:10 Asia/Shanghai'::TIMESTAMP WITH TIME ZONE; -- won't change
+         timestamptz          
+------------------------------
+ Mon Sep 23 19:10:00 2002 PDT
+(1 row)
+
+SELECT '2002-09-24 10:10 GST'::TIMESTAMP WITH TIME ZONE; -- 'GST' is invalid in Default
+psql:/tmp/TestType_time.sql:68: ERROR:  invalid input syntax for type timestamp with time zone: "2002-09-24 10:10 GST"
+LINE 1: SELECT '2002-09-24 10:10 GST'::TIMESTAMP WITH TIME ZONE;
+               ^
+SELECT '2002-09-24 10:10 IST'::TIMESTAMP WITH TIME ZONE; -- Israel Standard Time
+         timestamptz          
+------------------------------
+ Tue Sep 24 01:10:00 2002 PDT
+(1 row)
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/5e152951/src/test/feature/catalog/sql/time.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/catalog/sql/time.sql b/src/test/feature/catalog/sql/time.sql
index 02c4b7e..94a944e 100644
--- a/src/test/feature/catalog/sql/time.sql
+++ b/src/test/feature/catalog/sql/time.sql
@@ -39,3 +39,28 @@ SELECT f1 AS "Eight" FROM TIME_TBL WHERE f1 >= '00:00' ORDER BY 1;
 -- where we do mixed-type arithmetic. - thomas 2000-12-02
 
 SELECT f1 + time '00:01' AS "Illegal" FROM TIME_TBL;
+
+--
+-- Support timezone_abbreviations = 'Asia'
+--
+-- For some reason this seems to have been missed to support
+-- CST (China Standard Time). On some platforms, for example,
+-- Linux, CST is used as time string suffix of GMT+8, especially
+-- for users in China. In such case, the timestamp of log is
+-- '14 hours' ahead of the actual China time (GMT+8).
+
+SHOW timezone_abbreviations; -- info for debug, should always be 'Default'
+
+SET timezone_abbreviations TO 'Asia';
+SELECT abbrev, utc_offset FROM pg_timezone_abbrevs WHERE abbrev = 'CST';
+SELECT '2002-09-24 10:10 CST'::TIMESTAMP WITH TIME ZONE;
+SELECT '2002-09-24 10:10 Asia/Shanghai'::TIMESTAMP WITH TIME ZONE; -- won't change
+SELECT '2002-09-24 10:10 GST'::TIMESTAMP WITH TIME ZONE; -- Gulf Standard Time, Asia/Dubai
+SELECT '2002-09-24 10:10 IST'::TIMESTAMP WITH TIME ZONE; -- Indian Standard Time
+
+SET timezone_abbreviations TO 'Default';
+SELECT abbrev, utc_offset FROM pg_timezone_abbrevs WHERE abbrev = 'CST';
+SELECT '2002-09-24 10:10 CST'::TIMESTAMP WITH TIME ZONE;
+SELECT '2002-09-24 10:10 Asia/Shanghai'::TIMESTAMP WITH TIME ZONE; -- won't change
+SELECT '2002-09-24 10:10 GST'::TIMESTAMP WITH TIME ZONE; -- 'GST' is invalid in Default
+SELECT '2002-09-24 10:10 IST'::TIMESTAMP WITH TIME ZONE; -- Israel Standard Time