Files
greptimedb/tests/cases/standalone/common/system/timezone.sql
dennis zhuang e5ec65988b feat: administration functions (#3236)
* feat: adds database() function to return current db

* refactor: refactor meta src and client with new protos

* feat: impl migrate_region and query_procedure_state for procedure service/client

* fix: format

* temp commit

* feat: impl migrate_region SQL function

* chore: clean code for review

* fix: license header

* fix: toml format

* chore: update proto dependency

* chore: apply suggestion

Co-authored-by: Weny Xu <wenymedia@gmail.com>

* chore: apply suggestion

Co-authored-by: Weny Xu <wenymedia@gmail.com>

* chore: apply suggestion

Co-authored-by: JeremyHi <jiachun_feng@proton.me>

* chore: apply suggestion

Co-authored-by: fys <40801205+fengys1996@users.noreply.github.com>

* chore: print key when parsing procedure id fails

* chore: comment

* chore: comment for MigrateRegionFunction

---------

Co-authored-by: Weny Xu <wenymedia@gmail.com>
Co-authored-by: JeremyHi <jiachun_feng@proton.me>
Co-authored-by: fys <40801205+fengys1996@users.noreply.github.com>
2024-02-07 01:12:32 +00:00

79 lines
1.5 KiB
SQL

--- tests for timezone ---
SHOW VARIABLES time_zone;
SHOW VARIABLES system_time_zone;
select timezone();
CREATE TABLE test(d double, ts timestamp_ms time index);
INSERT INTO test values
(1, '2024-01-01 00:00:00'),
(2, '2024-01-02 08:00:00'),
(3, '2024-01-03 16:00:00'),
(4, '2024-01-04 00:00:00'),
(5, '2024-01-05 00:00:00+08:00');
SELECT * from test;
SELECT * from test where ts >= '2024-01-02 08:00:00';
SELECT * from test where ts <= '2024-01-03 16:00:00';
select date_format(ts, '%Y-%m-%d %H:%M:%S:%3f') from test;
select to_unixtime('2024-01-02 00:00:00');
select to_unixtime('2024-01-02T00:00:00+08:00');
--- UTC+8 ---
SET TIME_ZONE = '+8:00';
SHOW VARIABLES time_zone;
SHOW VARIABLES system_time_zone;
select timezone();
SELECT * from test;
SELECT * from test where ts >= '2024-01-02 08:00:00';
SELECT * from test where ts <= '2024-01-03 16:00:00';
select date_format(ts, '%Y-%m-%d %H:%M:%S:%3f') from test;
select to_unixtime('2024-01-02 00:00:00');
select to_unixtime('2024-01-02 00:00:00+08:00');
--- UTC-8 ---
SET TIME_ZONE = '-8:00';
SHOW VARIABLES time_zone;
SHOW VARIABLES system_time_zone;
select timezone();
SELECT * from test;
SELECT * from test where ts >= '2024-01-02 08:00:00';
SELECT * from test where ts <= '2024-01-03 16:00:00';
select date_format(ts, '%Y-%m-%d %H:%M:%S:%3f') from test;
select to_unixtime('2024-01-02 00:00:00');
select to_unixtime('2024-01-02 00:00:00+08:00');
drop table test;
-- revert timezone to UTC
SET TIME_ZONE = 'UTC';
SHOW VARIABLES time_zone;
select timezone();