Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/sql-mysql-varbinary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"sql": patch
"sql-js": patch
---

Fix MySQL `BINARY` and `VARBINARY` columns failing to decode with `unsupported datatype: VARBINARY`. This notably affects `VARCHAR` columns using a binary collation such as `utf8mb4_bin`, which MySQL reports as `VARBINARY`. They are now decoded as byte arrays like the other binary types. Also fix a typo (`TINIYBLOB`) that prevented `TINYBLOB` columns from being decoded.
2 changes: 1 addition & 1 deletion plugins/sql/src/decode/mysql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub(crate) fn to_json(v: MySqlValueRef) -> Result<JsonValue, Error> {
}
}
"JSON" => ValueRef::to_owned(&v).try_decode().unwrap_or_default(),
"TINIYBLOB" | "MEDIUMBLOB" | "BLOB" | "LONGBLOB" => {
"BINARY" | "VARBINARY" | "TINYBLOB" | "MEDIUMBLOB" | "BLOB" | "LONGBLOB" => {
if let Ok(v) = ValueRef::to_owned(&v).try_decode::<Vec<u8>>() {
JsonValue::Array(v.into_iter().map(|n| JsonValue::Number(n.into())).collect())
} else {
Expand Down