MySQL block shows varchar columns as bytes

When I use the MySQL block I’m seeing values from varchar fields displayed as a list of decimal byte values instead of strings.

Schema:

    Field    |    Type     | Collation  | Null | Key | Default | Extra |           Privileges            | Comment
-------------+-------------+------------+------+-----+---------+-------+---------------------------------+---------
 account_id  | varchar(64) | latin1_bin | NO   |     |         |       | select,insert,update,references |
 vendor_type | varchar(32) | latin1_bin | NO   |     |         |       | select,insert,update,references |
 enabled     | tinyint(1)  |            | NO   |     |         |       | select,insert,update,references |
 update_time | timestamp   |            | YES  |     |         |       | select,insert,update,references |

Oh oops! That’s definitely an issue with how we handle MySQL type conversion. Will get it fixed - thanks!

Ok I’ve looked into it, and this is why. Because you’re using latin1_bin, the MySQL driver is receiving those types as VARBINARY. It is a bug with upstream: MySql type `VARCHAR` with `*_bin` collation incorrectly interpreted as `VARBINARY` Column · Issue #3387 · launchbadge/sqlx · GitHub

I’ve implemented a workaround for now that should be shipped later on today

1 Like

The fix is shipped in 0.0.82.

4 Likes

Just tried it out with the fix and it looks good, thanks!