-
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
MySql type VARCHAR
with *_bin
collation incorrectly interpreted as VARBINARY
Column
#3387
Comments
The problem is that the only way we know the difference between This affects the macros because they use |
Alternatively, we could special-case for certain |
hm. so i see on line 170 of that file
but I don't think this is necessarily correct - based on 12.8.5 of the mysql docs
So it seems like This is low priority since I'm able to just manually convert |
VARBINARY
to StringVARCHAR
with *_bin
collation incorrectly interpreted as VARBINARY
Column
That's something I've really come to loathe about MySQL. The documentation generally runs the gamut from decent but incomplete, to misleading, to nonexistent, and nothing does what it says on the tin. We just recently addressed a similar issue that had to do with |
@alu from your comment on #3390,
I think this is the source of the issue for me. When I
So I think the issue is that this collation returns the |
…nd, not an ideal fix (launchbadge/sqlx#3387)
…nd, not an ideal fix (launchbadge/sqlx#3387)
@abonander @DrewMcArthur
In other words, are they considered incompatible only if collation is |
@alu I don't know about interchangeable per se, but they should all be compatible with Rust's |
here's another tidbit of helpful documentation: 13.3.4 The BLOB and TEXT Types
From this, I would think that the
I assume "the fn compatible(ty: &MySqlTypeInfo) -> bool {
// TODO: Support more collations being returned from SQL?
matches!(
ty.r#type,
ColumnType::VarChar
| ColumnType::Blob
| ColumnType::TinyBlob
| ColumnType::MediumBlob
| ColumnType::LongBlob
| ColumnType::String
| ColumnType::VarString
| ColumnType::Enum
) && !ty.collation == Collation::BINARY
} of course, this requires adding back a lot of the PR that abonander mentioned earlier, but I think removing collation from consideration conflated |
* Bump SQLx to 0.8 * Bump sea-query * Fix clippy warnings * Blocking Issues: upgrade to SQLx 0.8 on hold, just testing a workaround, not an ideal fix (launchbadge/sqlx#3387) * GetMySqlValue * Bump sea-query
This comment was marked as spam.
This comment was marked as spam.
I am also getting this error, is there any workaround? |
I was able to revert to version 0.7.4 to workaround the issue. |
sadly this is not an option for our stack atm |
sadly is not an option for us since getting it from your PR is making the compile complain that we need tokio-runtime feature and does not work even if I added it explicitly everywhere we have a toml file so, we'll need to wait for your release I guess. |
same error found in 0.8.2. down to 0.7.4 work well. |
Is your feature request related to a problem? Please describe.
I have a column in my MySql DB:
Column: FileName, Collation: utf8mb4_0900_bin, Definition: varchar(255)
, which when I try to convert to a struct:throws an error:
Describe the solution you'd like
This conversion should work, since the actual type is a
VARCHAR
, notVARBINARY
Describe alternatives you've considered
I could store these variables as
Vec<u8>
, or manuallyimpl FromRow
, but that's obviously not ideal.Additional context
I assume the collation is what's causing sqlx to interpret the type as VARBINARY?
The text was updated successfully, but these errors were encountered: