mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-13 17:27:50 +00:00
fix: decode postgres time without subsecond (#2784)
* fix: decode postgres time without subsecond * update: decode postgres time without subsecond by making subsecond optional
This commit is contained in:
parent
4bac21da37
commit
846dcfe52a
@ -42,7 +42,8 @@ impl<'r> Decode<'r, Postgres> for Time {
|
||||
|
||||
PgValueFormat::Text => Time::parse(
|
||||
value.as_str()?,
|
||||
&format_description!("[hour]:[minute]:[second].[subsecond]"),
|
||||
// Postgres will not include the subsecond part if it's zero.
|
||||
&format_description!("[hour]:[minute]:[second][optional [.[subsecond]]]"),
|
||||
)?,
|
||||
})
|
||||
}
|
||||
|
||||
@ -321,7 +321,8 @@ mod time_tests {
|
||||
|
||||
test_type!(time_time<Time>(
|
||||
Postgres,
|
||||
"TIME '05:10:20.115100'" == time!(5:10:20.115100)
|
||||
"TIME '05:10:20.115100'" == time!(5:10:20.115100),
|
||||
"TIME '05:10:20'" == time!(5:10:20)
|
||||
));
|
||||
|
||||
test_type!(time_date_time<PrimitiveDateTime>(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user