github.com/matrixorigin/matrixone@v0.7.0/test/distributed/cases/function/func_datetime_utc_timestamp.test (about)

     1  #SELECT
     2  -- @bvt:issue#3329
     3  select unix_timestamp(utc_timestamp());
     4  -- @bvt:issue
     5  #select unix_timestamp(current_timestamp());
     6  
     7  
     8  
     9  create table t1 (ts timestamp);
    10  set time_zone='+00:00';
    11  select unix_timestamp(utc_timestamp())-unix_timestamp(utc_timestamp());
    12  insert into t1 (ts) values ('2003-03-30 02:30:00');
    13  set time_zone='+10:30';
    14  select unix_timestamp(utc_timestamp())-unix_timestamp(utc_timestamp());
    15  insert into t1 (ts) values ('2003-03-30 02:30:00');
    16  set time_zone='-10:00';
    17  #select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp());
    18  insert into t1 (ts) values ('2003-03-30 02:30:00');
    19  select * from t1;
    20  drop table t1;
    21  
    22  
    23  #SELECT,  算术运算,嵌套
    24  
    25  
    26  select utc_timestamp()-utc_timestamp(),weekday(utc_timestamp())-weekday(utc_timestamp()),unix_timestamp()-unix_timestamp(utc_timestamp());
    27  
    28  #0.5 not supported
    29  #select utc_timestamp()-curdate()*1000000-curtime();
    30  
    31  #INSERT
    32  #CREATE TABLE t1 (a TIMESTAMP);
    33  #INSERT INTO t1 VALUES (utc_timestamp()), (utc_timestamp());
    34  #SELECT 1 FROM t1 ORDER BY MAKETIME(1, 1, a);
    35  #DROP TABLE t1;
    36  
    37  
    38  CREATE TABLE t1 (a TIMESTAMP);
    39  INSERT INTO t1 select (utc_timestamp());
    40  INSERT INTO t1 select (utc_timestamp());
    41  SELECT 1 FROM t1 ORDER BY 1;
    42  DROP TABLE t1;
    43  
    44  
    45  #INSERT
    46  DROP TABLE if exists t1;
    47  #create table t1 (a int primary key, b int, c int, d timestamp default current_timestamp);
    48  create table t1 (a int primary key, b int, c int, d timestamp);
    49  insert into t1 select 1,1,1,utc_timestamp();
    50  insert into t1 select 2,0,0,null;
    51  select a,b,c,year(d) from t1;
    52  DROP TABLE t1;
    53  
    54  
    55  #比较运算,数据类型
    56  
    57  CREATE TABLE t1 (a TIMESTAMP);
    58  INSERT INTO t1 select (utc_timestamp());
    59  INSERT INTO t1 select (utc_timestamp());
    60  INSERT INTO t1 select (utc_timestamp());
    61  SELECT year(a) FROM t1 WHERE a > '2008-01-01';
    62  DROP TABLE t1;
    63  
    64  
    65  #算术运算,CREATE SELECT
    66  #0.5 not supported
    67  #create table t1 select utc_timestamp() - utc_timestamp(), curtime() - curtime(), sec_to_time(1) + 0, from_unixtime(1) + 0;
    68  #select * from t1;
    69  #drop table t1;