Reading a row with a timestamp with value -infinity results in a panic:
thread 'tokio-runtime-worker' panicked at '`NaiveDateTime + Duration` overflowed', /home/.../.cargo/registry/src/github.com-1ecc6299db9ec823/chrono-0.4.22/src/naive/datetime/mod.rs:1281:38
stack backtrace:
0: rust_begin_unwind
at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/panicking.rs:142:14
2: core::panicking::panic_display
at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/panicking.rs:72:5
3: core::panicking::panic_str
at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/panicking.rs:56:5
4: core::option::expect_failed
at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/option.rs:1874:5
5: core::option::Option<T>::expect
at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/option.rs:738:21
6: <chrono::naive::datetime::NaiveDateTime as core::ops::arith::Add<time::duration::Duration>>::add
at /home/.../.cargo/registry/src/github.com-1ecc6299db9ec823/chrono-0.4.22/src/naive/datetime/mod.rs:1281:9
7: sqlx_core::postgres::types::chrono::datetime::<impl sqlx_core::decode::Decode<sqlx_core::postgres::database::Postgres> for chrono::naive::datetime::NaiveDateTime>::decode
at /home/.../.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-core-0.6.2/src/postgres/types/chrono/datetime.rs:61:17
8: sqlx_core::row::Row::try_get_unchecked
at /home/.../.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-core-0.6.2/src/row.rs:159:9
TBH I was just expecting it to return the epoch (or earliest valid chrono timestamp), but I guess there may be use cases where a panic might uncover bugs with software dealing with early history times.
Bug Description
Reading a row with a timestamp with value
-infinity
results in a panic:Minimal Reproduction
TBA
Info
rustc --version
:rustc 1.63.0 (4b91a6ea7 2022-08-08)