DateTimeUtc is recognized as TimestampWithTimeZone
Author: xtexxCreated Jan 31, 2024Updated Aug 11, 2026
LabelsArea:type-mapCategory:enhancement
As the document:
DateTimeUtc should be regarded as Timestamp, however, it is regarded as TimestampWithTimeZone
From the following Model:
#[sea_orm(column_type = "Timestamp", nullable, default_value = "None")]
pub col: Option<DateTimeUtc>,I can get this error: Query Error: error occurred while decoding column \"col\": mismatched types; Rust type core::option::Option<chrono::datetime::DateTime<chrono::offset::utc::Utc>> (as SQL type TIMESTAMPTZ) is not compatible with SQL type TIMESTAMP
On PostgresQL, TIMESTAMP is the same as DATETIME. col, which is with Timestamp column type, should be decoded as the same as DateTime.
However the current behaviour should be kept when using with MySQL.
Source: SeaQL/sea-orm