Simple fix: MySQL restricts what can be used within cast to a really limited subset of types. Switched to using chars (supported) and it works.