Skip to content

SimpleExpr::Constant conversion to string drops second fractions #808

@davidhewitt

Description

@davidhewitt

Looking at

#[cfg(feature = "with-chrono")]
Value::ChronoDateTimeUtc(Some(v)) => {
write!(s, "'{}'", v.format("%Y-%m-%d %H:%M:%S %:z")).unwrap()
}
#[cfg(feature = "with-chrono")]
Value::ChronoDateTimeLocal(Some(v)) => {
write!(s, "'{}'", v.format("%Y-%m-%d %H:%M:%S %:z")).unwrap()
}
#[cfg(feature = "with-chrono")]
Value::ChronoDateTimeWithTimeZone(Some(v)) => {
write!(s, "'{}'", v.format("%Y-%m-%d %H:%M:%S %:z")).unwrap()
}

I think these format strings don't account for second fractions. I hit a case where I was trying to feed constant date-times into a query and the microseconds were getting dropped, I believe the cause was in these lines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions