DateTimeUtc is recognized as TimestampWithTimeZone
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 9.9k
- Forks
- 735
- Avg merge
- 6h 36m
- Merged PRs (30d)
- 8
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how the column_type = "Timestamp" model attribute and DateTimeUtc are mapped and decoded for PostgreSQL and MySQL. Add regression coverage for the PostgreSQL TIMESTAMP case while preserving the existing MySQL behavior; the mismatch error in the issue provides the completion criterion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, postgresql, rust
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100