mysql: fix SELECT queries containing "CAST(foo as integer)" (fixes #14496)