-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
Description
Bug Description
When a field is defined PrimitiveDateTime
it cannot be fetched from SQLite3 database using a macro.
Compiler emits: the trait From<OffsetDateTime> is not implemented for PrimitiveDateTime, which is required by OffsetDateTime: Into<_>
The query_as!
macro gets expanded to something contaning:
#[allow(non_snake_case)]
let sqlx_query_as_last_check = row.try_get_unchecked:: <sqlx::types::time::OffsetDateTime,_>(5usize)? .into();
Minimal Reproduction
struct Package {
id: i64
last_check: PrimitiveDateTime,
}
impl Package {
async fn get(pool: &SqlitePool, id: i64) -> Result<Self, SqlxError> {
query_as!(
Self,
"SELECT last_check FROM package WHERE id = $1",
id
)
.fetch_one(pool)
.await
}
}
Info
- SQLx version: v0.8.2
- SQLx features enabled: "runtime-tokio-native-tls", "sqlite", "time"
- Database server and version: SQLite 3.47.1
- Operating system: macOS (Darwin Kernel Version 24.2.0)
rustc --version
: rustc 1.83.0 (90b35a623 2024-11-26) (built from a source tarball)
izderadicka