Files
greptimedb/tests/cases/standalone/common/timestamp/timestamp.result
Ning Sun 14b233c486 test: align chrono and some forked test deps to upstream (#3245)
* test: update chrono and its tests

* chore: switch some deps to upstream version

* test: update timestamp range in sqlness tests
2024-01-26 07:39:51 +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 ('-262143-01-01 00:00:00Z', 4);
Affected Rows: 1
INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('+262142-12-31 23:59:59Z', 5);
Affected Rows: 1
INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('-262143-01-01 00:00:00Z', 6);
Affected Rows: 1
INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('+262142-12-31 23:59:59.999Z', 7);
Affected Rows: 1
INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('-262143-01-01 00:00:00Z', 8);
Affected Rows: 1
INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('+262142-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 |
+-------------------------------+-----+
| -262143-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 |
| +262142-12-31T23:59:59 | 5 |
| +262142-12-31T23:59:59.999 | 7 |
| +262142-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