mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-30 03:40:37 +00:00
feat: try cast timestamp types from number string (#6060)
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
@@ -107,6 +107,8 @@ fn parse_string_to_value(
|
||||
target_unit: t.unit(),
|
||||
},
|
||||
)?))
|
||||
} else if let Ok(ts) = i64::from_str(s.as_str()) {
|
||||
Ok(Value::Timestamp(Timestamp::new(ts, t.unit())))
|
||||
} else {
|
||||
ParseSqlValueSnafu {
|
||||
msg: format!("Failed to parse {s} to Timestamp value"),
|
||||
|
||||
@@ -13,7 +13,7 @@ INSERT INTO integers VALUES (11, 1), (12, 2);
|
||||
affected_rows: 2
|
||||
|
||||
-- SQLNESS PROTOCOL MYSQL
|
||||
INSERT INTO integers VALUES ('13', 3), ('14', 4);
|
||||
INSERT INTO integers VALUES ('13', '3'), ('14', '4');
|
||||
|
||||
affected_rows: 2
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ CREATE TABLE integers (
|
||||
INSERT INTO integers VALUES (11, 1), (12, 2);
|
||||
|
||||
-- SQLNESS PROTOCOL MYSQL
|
||||
INSERT INTO integers VALUES ('13', 3), ('14', 4);
|
||||
INSERT INTO integers VALUES ('13', '3'), ('14', '4');
|
||||
|
||||
-- SQLNESS PROTOCOL MYSQL
|
||||
INSERT INTO integers VALUES ('15a', 5), ('16', 6);
|
||||
|
||||
Reference in New Issue
Block a user