I have a mysql database and created a LIST:INTEGER field
It is created in MYSQL as LONGTEXT type of data
In one of my queries I have received an error:
WEB2PY QUERY:db.table.id_field_list.contains(
db.table2.id)
MYSQL QUERY:SELECT * FROM table, table2 WHERE (table.id_field_list LIKE (CONCAT('%|',(REPLACE((REPLACE(CAST(
table2.id AS LONGTEXT),'%','%%')),'|','||')),'|%')))
The error is with CAST()
Reading mysql documentation, CAST() does not support LONGTEXT
http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html#function_castAnd there are some discussions on google about CAST with LONGTEXT in MYSQL that also said it is not compatible
If you want to test this behavior, try this command in MYSQL:
SELECT CAST(123 as LONGTEXT);
you will receive the error
then try:
SELECT CAST(123 as char);
and everything goes fine
Is there any way to fix this issue in official version by removing the CAST from list: fields for MYSQL or any other better idea?
Thanks