There is a table with the following columns: text1, type longtext text2, type longtext

There is a third-party reporting system that receives the request and wraps it up, for example, sent the request:

SELECT text1, text2 FROM test 

He converts it to this form:

 SELECT CAST(`text1` as VARCHAR(100)) as text1, CAST(`text2` as VARCHAR(100)) as text2 FROM ( SELECT text1, text2 FROM test ) t 

Accordingly, now mysql swears that CAST cannot be used like this:

 MySQL][ODBC 3.51 Driver][mysqld-5.5.50-0+deb8u1]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VARCHAR(100)) AS text1, CAST(`text2` AS VARCHAR(100)) AS text2 at line 1 

Actually the question is, how can you change the initial request so that the system request executes without errors?

    1 answer 1

    In CAST functions, there is generally no option for VARCHAR, respectively, a bug in a third-party system. The question is incorrect.