diff --git a/.changes/sql-mysql-varbinary.md b/.changes/sql-mysql-varbinary.md new file mode 100644 index 0000000000..32e74f66aa --- /dev/null +++ b/.changes/sql-mysql-varbinary.md @@ -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. diff --git a/plugins/sql/src/decode/mysql.rs b/plugins/sql/src/decode/mysql.rs index 53fd20c7c4..e8f4da5694 100644 --- a/plugins/sql/src/decode/mysql.rs +++ b/plugins/sql/src/decode/mysql.rs @@ -86,7 +86,7 @@ pub(crate) fn to_json(v: MySqlValueRef) -> Result { } } "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::>() { JsonValue::Array(v.into_iter().map(|n| JsonValue::Number(n.into())).collect()) } else {