fix: SQL insertion and column default constraint aware of timezone (#3266)

* fix: missing timezone when parsing sql value to greptimedb value

* test: sql_value_to_value

* fix: column default constraint missing timezone

* test: column def default constraint  with timezone

* test: adds sqlness test for default constraint aware of timezone

* fix: typo

* chore: comment
This commit is contained in:
dennis zhuang
2024-01-30 09:15:38 +00:00
committed by GitHub
parent e0e635105e
commit 43ef0820c0
15 changed files with 563 additions and 73 deletions
@@ -0,0 +1,23 @@
--- insert timestamp with default values aware of session timezone test ---
CREATE TABLE test1 (i INTEGER, j TIMESTAMP default '2024-01-30 00:01:01' TIME INDEX, PRIMARY KEY(i));
INSERT INTO test1 VALUES (1, DEFAULT), (2, DEFAULT), (3, '2024-01-31 00:01:01'), (4, '2025-02-01 00:01:01');
SELECT * FROM test1;
SET time_zone = 'Asia/Shanghai';
CREATE TABLE test2 (i INTEGER, j TIMESTAMP default '2024-01-30 00:01:01' TIME INDEX, PRIMARY KEY(i));
INSERT INTO test2 VALUES (1, DEFAULT), (2, DEFAULT), (3, '2024-01-31 00:01:01'), (4, '2025-02-01 00:01:01');
SELECT * FROM test2;
SELECT * FROM test1;
SET time_zone = 'UTC';
DROP TABLE test1;
DROP TABLE test2;