diff --git a/Cargo.lock b/Cargo.lock index 1eeca6b5bf..8b3fb86713 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -790,6 +790,24 @@ dependencies = [ "tower-service", ] +[[package]] +name = "axum-test-helper" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "298f62fa902c2515c169ab0bfb56c593229f33faa01131215d58e3d4898e3aa9" +dependencies = [ + "axum", + "bytes", + "http", + "http-body", + "hyper", + "reqwest", + "serde", + "tokio", + "tower", + "tower-service", +] + [[package]] name = "backon" version = "0.4.1" @@ -1279,9 +1297,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb" dependencies = [ "android-tzdata", "iana-time-zone", @@ -1289,7 +1307,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.48.5", + "windows-targets 0.52.0", ] [[package]] @@ -3935,7 +3953,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.10", + "socket2 0.5.5", "tokio", "tower-service", "tracing", @@ -6833,7 +6851,7 @@ dependencies = [ "indoc", "libc", "memoffset 0.9.0", - "parking_lot 0.11.2", + "parking_lot 0.12.1", "pyo3-build-config", "pyo3-ffi", "pyo3-macros", @@ -8503,7 +8521,7 @@ dependencies = [ "auth", "axum", "axum-macros", - "axum-test-helper", + "axum-test-helper 0.3.0", "base64 0.21.5", "build-data", "bytes", @@ -9560,7 +9578,7 @@ dependencies = [ "async-trait", "auth", "axum", - "axum-test-helper", + "axum-test-helper 0.1.1", "catalog", "chrono", "client", @@ -9887,16 +9905,17 @@ dependencies = [ [[package]] name = "tokio-postgres-rustls" -version = "0.10.0" -source = "git+https://github.com/ol-teuto/tokio-postgres-rustls.git?branch=rustls-update#d78fad4c4ece18ec51b9d139101285f8ad3b8024" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea13f22eda7127c827983bdaf0d7fff9df21c8817bab02815ac277a21143677" dependencies = [ "futures", - "ring 0.16.20", + "ring 0.17.7", "rustls 0.22.1", - "rustls-pki-types", "tokio", "tokio-postgres", "tokio-rustls 0.25.0", + "x509-certificate", ] [[package]] @@ -10337,7 +10356,7 @@ version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "rand", "static_assertions", ] diff --git a/src/common/time/src/timestamp.rs b/src/common/time/src/timestamp.rs index 6aeac49b25..8fa01cd8be 100644 --- a/src/common/time/src/timestamp.rs +++ b/src/common/time/src/timestamp.rs @@ -1253,27 +1253,31 @@ mod tests { #[test] fn test_from_naive_date_time() { - let min_sec = Timestamp::new_second(-8334632851200); - let max_sec = Timestamp::new_second(8210298412799); + let naive_date_time_min = NaiveDateTime::MIN; + let naive_date_time_max = NaiveDateTime::MAX; + + let min_sec = Timestamp::new_second(naive_date_time_min.timestamp()); + let max_sec = Timestamp::new_second(naive_date_time_max.timestamp()); check_conversion(min_sec, true); check_conversion(Timestamp::new_second(min_sec.value - 1), false); check_conversion(max_sec, true); check_conversion(Timestamp::new_second(max_sec.value + 1), false); - let min_millis = Timestamp::new_millisecond(-8334632851200000); - let max_millis = Timestamp::new_millisecond(8210298412799999); + let min_millis = Timestamp::new_millisecond(naive_date_time_min.timestamp_millis()); + let max_millis = Timestamp::new_millisecond(naive_date_time_max.timestamp_millis()); check_conversion(min_millis, true); check_conversion(Timestamp::new_millisecond(min_millis.value - 1), false); check_conversion(max_millis, true); check_conversion(Timestamp::new_millisecond(max_millis.value + 1), false); - let min_micros = Timestamp::new_microsecond(-8334632851200000000); - let max_micros = Timestamp::new_microsecond(8210298412799999999); + let min_micros = Timestamp::new_microsecond(naive_date_time_min.timestamp_micros()); + let max_micros = Timestamp::new_microsecond(naive_date_time_max.timestamp_micros()); check_conversion(min_micros, true); check_conversion(Timestamp::new_microsecond(min_micros.value - 1), false); check_conversion(max_micros, true); check_conversion(Timestamp::new_microsecond(max_micros.value + 1), false); + // the min time that can be represented by nanoseconds is: 1677-09-21T00:12:43.145224192 let min_nanos = Timestamp::new_nanosecond(-9223372036854775000); let max_nanos = Timestamp::new_nanosecond(i64::MAX); check_conversion(min_nanos, true); @@ -1283,13 +1287,16 @@ mod tests { #[test] fn test_parse_timestamp_range() { + let datetime_min = NaiveDateTime::MIN.format("%Y-%m-%d %H:%M:%SZ").to_string(); + assert_eq!("-262143-01-01 00:00:00Z", datetime_min); + let datetime_max = NaiveDateTime::MAX.format("%Y-%m-%d %H:%M:%SZ").to_string(); + assert_eq!("+262142-12-31 23:59:59Z", datetime_max); + let valid_strings = vec![ - "-262144-01-01 00:00:00Z", - "+262143-12-31 23:59:59Z", - "-262144-01-01 00:00:00Z", - "+262143-12-31 23:59:59.999Z", - "-262144-01-01 00:00:00Z", - "+262143-12-31 23:59:59.999999Z", + "-262143-01-01 00:00:00Z", + "+262142-12-31 23:59:59Z", + "+262142-12-31 23:59:59.999Z", + "+262142-12-31 23:59:59.999999Z", "1677-09-21 00:12:43.145225Z", "2262-04-11 23:47:16.854775807Z", "+100000-01-01 00:00:01.5Z", diff --git a/src/servers/Cargo.toml b/src/servers/Cargo.toml index 295b1b2811..1b4fb8db50 100644 --- a/src/servers/Cargo.toml +++ b/src/servers/Cargo.toml @@ -105,7 +105,7 @@ tikv-jemalloc-ctl = { version = "0.5", features = ["use_std"] } [dev-dependencies] auth = { workspace = true, features = ["testing"] } -axum-test-helper = { git = "https://github.com/sunng87/axum-test-helper.git", branch = "patch-1" } +axum-test-helper = "0.3" catalog = { workspace = true, features = ["testing"] } client.workspace = true common-base.workspace = true @@ -119,7 +119,7 @@ serde_json.workspace = true session = { workspace = true, features = ["testing"] } table.workspace = true tokio-postgres = "0.7" -tokio-postgres-rustls = { git = "https://github.com/ol-teuto/tokio-postgres-rustls.git", branch = "rustls-update" } +tokio-postgres-rustls = "0.11" tokio-test = "0.4" [build-dependencies] diff --git a/tests/cases/standalone/common/timestamp/timestamp.result b/tests/cases/standalone/common/timestamp/timestamp.result index 3039fb65a4..6502c97088 100644 --- a/tests/cases/standalone/common/timestamp/timestamp.result +++ b/tests/cases/standalone/common/timestamp/timestamp.result @@ -30,27 +30,27 @@ INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('+100000-01-01 00:00:01.5Z' Affected Rows: 1 -INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('-262144-01-01 00:00:00Z', 4); +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 ('+262143-12-31 23:59:59Z', 5); +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 ('-262144-01-01 00:00:00Z', 6); +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 ('+262143-12-31 23:59:59.999Z', 7); +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 ('-262144-01-01 00:00:00Z', 8); +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 ('+262143-12-31 23:59:59.999999Z', 9); +INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('+262142-12-31 23:59:59.999999Z', 9); Affected Rows: 1 @@ -67,15 +67,15 @@ SELECT * FROM timestamp_with_precision ORDER BY ts ASC; +-------------------------------+-----+ | ts | cnt | +-------------------------------+-----+ -| -262144-01-01T00:00:00 | 8 | +| -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 | -| +262143-12-31T23:59:59 | 5 | -| +262143-12-31T23:59:59.999 | 7 | -| +262143-12-31T23:59:59.999999 | 9 | +| +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; diff --git a/tests/cases/standalone/common/timestamp/timestamp.sql b/tests/cases/standalone/common/timestamp/timestamp.sql index 2e2fb9ec44..2afc15ef1d 100644 --- a/tests/cases/standalone/common/timestamp/timestamp.sql +++ b/tests/cases/standalone/common/timestamp/timestamp.sql @@ -10,17 +10,17 @@ INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('2023-04-04 08:00:00.0052+0 INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('+100000-01-01 00:00:01.5Z', 3); -INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('-262144-01-01 00:00:00Z', 4); +INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('-262143-01-01 00:00:00Z', 4); -INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('+262143-12-31 23:59:59Z', 5); +INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('+262142-12-31 23:59:59Z', 5); -INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('-262144-01-01 00:00:00Z', 6); +INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('-262143-01-01 00:00:00Z', 6); -INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('+262143-12-31 23:59:59.999Z', 7); +INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('+262142-12-31 23:59:59.999Z', 7); -INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('-262144-01-01 00:00:00Z', 8); +INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('-262143-01-01 00:00:00Z', 8); -INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('+262143-12-31 23:59:59.999999Z', 9); +INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('+262142-12-31 23:59:59.999999Z', 9); INSERT INTO timestamp_with_precision(ts,cnt) VALUES ('1677-09-21 00:12:43.145225Z', 10);