Skip to content

Commit f02dc33

Browse files
ZENOTMEpiperRyan
authored andcommitted
fix: add zero check of day field in is_zeroed of IntervalNorm
1 parent f684c2c commit f02dc33

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/interval_norm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ impl IntervalNorm {
8181
pub fn is_zeroed(&self) -> bool {
8282
self.years == 0
8383
&& self.months == 0
84+
&& self.days == 0
8485
&& self.hours == 0
8586
&& self.minutes == 0
8687
&& self.seconds == 0

src/pg_interval.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,13 @@ mod tests {
312312
assert_eq!(String::from("-01:10:15"), output);
313313
}
314314

315+
#[test]
316+
fn test_postgres_19(){
317+
let interval = Interval::new(0, 3, 0);
318+
let output = interval.to_postgres();
319+
assert_eq!(String::from("3 days"), output);
320+
}
321+
315322
#[test]
316323
fn test_sql_1() {
317324
let interval = Interval::new(12, 0, 0);

0 commit comments

Comments
 (0)