mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-09 06:42:57 +00:00
* 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
67 lines
1.4 KiB
Plaintext
67 lines
1.4 KiB
Plaintext
--- 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));
|
|
|
|
Affected Rows: 0
|
|
|
|
INSERT INTO test1 VALUES (1, DEFAULT), (2, DEFAULT), (3, '2024-01-31 00:01:01'), (4, '2025-02-01 00:01:01');
|
|
|
|
Affected Rows: 4
|
|
|
|
SELECT * FROM test1;
|
|
|
|
+---+---------------------+
|
|
| i | j |
|
|
+---+---------------------+
|
|
| 1 | 2024-01-30T00:01:01 |
|
|
| 2 | 2024-01-30T00:01:01 |
|
|
| 3 | 2024-01-31T00:01:01 |
|
|
| 4 | 2025-02-01T00:01:01 |
|
|
+---+---------------------+
|
|
|
|
SET time_zone = 'Asia/Shanghai';
|
|
|
|
Affected Rows: 0
|
|
|
|
CREATE TABLE test2 (i INTEGER, j TIMESTAMP default '2024-01-30 00:01:01' TIME INDEX, PRIMARY KEY(i));
|
|
|
|
Affected Rows: 0
|
|
|
|
INSERT INTO test2 VALUES (1, DEFAULT), (2, DEFAULT), (3, '2024-01-31 00:01:01'), (4, '2025-02-01 00:01:01');
|
|
|
|
Affected Rows: 4
|
|
|
|
SELECT * FROM test2;
|
|
|
|
+---+---------------------+
|
|
| i | j |
|
|
+---+---------------------+
|
|
| 1 | 2024-01-29T16:01:01 |
|
|
| 2 | 2024-01-29T16:01:01 |
|
|
| 3 | 2024-01-30T16:01:01 |
|
|
| 4 | 2025-01-31T16:01:01 |
|
|
+---+---------------------+
|
|
|
|
SELECT * FROM test1;
|
|
|
|
+---+---------------------+
|
|
| i | j |
|
|
+---+---------------------+
|
|
| 1 | 2024-01-30T00:01:01 |
|
|
| 2 | 2024-01-30T00:01:01 |
|
|
| 3 | 2024-01-31T00:01:01 |
|
|
| 4 | 2025-02-01T00:01:01 |
|
|
+---+---------------------+
|
|
|
|
SET time_zone = 'UTC';
|
|
|
|
Affected Rows: 0
|
|
|
|
DROP TABLE test1;
|
|
|
|
Affected Rows: 0
|
|
|
|
DROP TABLE test2;
|
|
|
|
Affected Rows: 0
|
|
|