-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix type info access in Any
database driver
#1848
Conversation
sqlx-core/src/error.rs
Outdated
@@ -138,9 +138,8 @@ impl Error { | |||
pub(crate) fn mismatched_types<DB: Database, T: Type<DB>>(ty: &DB::TypeInfo) -> BoxDynError { | |||
// TODO: `#name` only produces `TINYINT` but perhaps we want to show `TINYINT(1)` | |||
format!( | |||
"mismatched types; Rust type `{}` (as SQL type `{}`) is not compatible with SQL type `{}`", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm loathe to lose this information as I think it could be really helpful with debugging.
I think instead we should fix this one level up, calling this function with the underlying DB
type instead of Any
:
- Override
Row::try_get()
in the impl forAnyRow
- Override
Value::try_decode
in the impl forAnyValue
I'd probably make a version of this function as a method on AnyTypeInfo
and match on AnyTypeInfoKind
, then you can just call that method from the overridden trait methods above.
If you rebase it should fix the spurious CI failures. |
3493139
to
9050290
Compare
@abonander Can you run the workflow? Thanks! |
Do you think the test failure is due to my changes in this PR? |
You need to rebase on |
9050290
to
4d17b20
Compare
Ah sorry, I was rebasing against the It should be up to date now. |
Also, feel free to edit my branch if necessary. |
Sorry, one more rebase should do it. |
This reverts commit a2845c7.
Co-authored-by: Yota Toyama <raviqqe@gmail.com>
4d17b20
to
49bad74
Compare
Done! |
Thanks! |
Thank you so much for merging this too!!! 😄 |
Close #1408.
The
Type<Any>::type_info()
is not implemented currently and doesn't seem to be any time soon.sqlx/sqlx-core/src/any/type.rs
Line 11 in 826e63f