Skip to content

Commit

Permalink
restrict days integer size for method
Browse files Browse the repository at this point in the history
  • Loading branch information
mhov committed Aug 26, 2022
1 parent 408e610 commit 28c0649
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pgx/src/datum/interval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ pub struct Interval(pg_sys::Interval);
impl Interval {
pub fn try_from_months_days_usecs(
months: i32,
days: i32,
days: i8,
usecs: i64,
) -> Result<Self, IntervalConversionError> {
if days.abs() >= pg_sys::DAYS_PER_MONTH as i32 {
if days.abs() >= pg_sys::DAYS_PER_MONTH as i8 {
return Err(IntervalConversionError::FromDaysOutOfBounds);
}
if usecs.abs() >= USECS_PER_DAY {
return Err(IntervalConversionError::FromUSecOutOfBounds);
}
Ok(Interval(pg_sys::Interval {
day: days,
day: days as i32,
month: months,
time: usecs,
}))
Expand Down

0 comments on commit 28c0649

Please sign in to comment.