We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3e75caa commit 8d18c3dCopy full SHA for 8d18c3d
runtimes/core/src/sqldb/val.rs
@@ -212,7 +212,13 @@ impl ToSql for PValue {
212
}
213
214
},
215
- PValue::DateTime(dt) => dt.to_sql(ty, out),
+ PValue::DateTime(dt) => match *ty {
216
+ Type::DATE => dt.naive_utc().date().to_sql(ty, out),
217
+ Type::TIMESTAMP => dt.naive_utc().to_sql(ty, out),
218
+ Type::TIMESTAMPTZ => dt.to_sql(ty, out),
219
+ Type::TEXT | Type::VARCHAR => dt.to_rfc3339().to_sql(ty, out),
220
+ _ => Err(format!("unsupported type for DateTime: {}", ty).into()),
221
+ },
222
PValue::Array(arr) => arr.to_sql(ty, out),
223
PValue::Object(_) => {
224
Err(format!("object not supported for column of type {}", ty).into())
0 commit comments