Files
greptimedb/tests/cases/standalone/common/timestamp/timestamp.result
Ruihang Xia 0ce2b50676 feat!: do not get TZ info from server local env (#2905)
* feat: do not get TZ info from server local env

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* add sqlness case

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* add empty line

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* fix typo

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

---------

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
2023-12-12 12:41:05 +00:00

113 lines
2.8 KiB
Plaintext

SELECT timestamp ' 2017-07-23 13:10:11 ';
+-----------------------------+
| Utf8("2017-07-23 13:10:11") |
+-----------------------------+
| 2017-07-23T13:10:11 |
+-----------------------------+
SELECT timestamp ' 2017-07-23 13:10:11 ';
+-----------------------------+
| Utf8("2017-07-23 13:10:11") |
+-----------------------------+
| 2017-07-23T13:10:11 |
+-----------------------------+
CREATE TABLE timestamp_with_precision (ts TIMESTAMP(6) TIME INDEX, cnt INT);
Affected Rows: 0
INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('2023-04-04 08:00:00.0052+0000', 1);
Affected Rows: 1
INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('2023-04-04 08:00:00.0052+0800', 2);
Affected Rows: 1
INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('+100000-01-01 00:00:01.5Z', 3);
Affected Rows: 1
INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('-262144-01-01 00:00:00Z', 4);
Affected Rows: 1
INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('+262143-12-31 23:59:59Z', 5);
Affected Rows: 1
INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('-262144-01-01 00:00:00Z', 6);
Affected Rows: 1
INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('+262143-12-31 23:59:59.999Z', 7);
Affected Rows: 1
INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('-262144-01-01 00:00:00Z', 8);
Affected Rows: 1
INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('+262143-12-31 23:59:59.999999Z', 9);
Affected Rows: 1
INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('1677-09-21 00:12:43.145225Z', 10);
Affected Rows: 1
INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('2262-04-11 23:47:16.854775807Z', 11);
Affected Rows: 1
SELECT * FROM timestamp_with_precision ORDER BY ts ASC;
+-------------------------------+-----+
| ts | cnt |
+-------------------------------+-----+
| -262144-01-01T00:00:00 | 8 |
| 1677-09-21T00:12:43.145225 | 10 |
| 2023-04-04T00:00:00.005200 | 2 |
| 2023-04-04T08:00:00.005200 | 1 |
| 2262-04-11T23:47:16.854775 | 11 |
| +100000-01-01T00:00:01.500 | 3 |
| +262143-12-31T23:59:59 | 5 |
| +262143-12-31T23:59:59.999 | 7 |
| +262143-12-31T23:59:59.999999 | 9 |
+-------------------------------+-----+
DROP TABLE timestamp_with_precision;
Affected Rows: 0
CREATE TABLE plain_timestamp (ts TIMESTAMP TIME INDEX);
Affected Rows: 0
INSERT INTO plain_timestamp VALUES (1);
Affected Rows: 1
SELECT * FROM plain_timestamp;
+-------------------------+
| ts |
+-------------------------+
| 1970-01-01T00:00:00.001 |
+-------------------------+
SELECT * FROM plain_timestamp where ts = '1970-01-01 00:00:00.001000';
+-------------------------+
| ts |
+-------------------------+
| 1970-01-01T00:00:00.001 |
+-------------------------+
DROP TABLE plain_timestamp;
Affected Rows: 0