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:
Yudai Fukushima
2023-10-05 08:56:14 +09:00
committed by GitHub
parent 4bac21da37
commit 846dcfe52a
2 changed files with 4 additions and 2 deletions

View File

@@ -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]]]"),
)?,
})
}