Description:
-- wrong
mysql> SELECT `col_float_key_signed` FROM table_10_utf8_undef WHERE MOD( `col_float_key_signed`, ( `col_float_key_signed` = `col_float_key_signed` ) ) ;
Empty set (0.00 sec)
mysql> SELECT `col_float_key_signed` FROM table_10_utf8_undef WHERE MOD( `col_float_key_signed`, ( `col_float_key_signed` = `col_float_key_signed` ) ) IS TRUE;
+----------------------+
| col_float_key_signed |
+----------------------+
| -9.183 |
| 6.1806 |
+----------------------+
2 rows in set (0.00 sec)
-- worong
mysql> SELECT `col_float_key_signed` FROM table_10_utf8_undef HAVING MOD( `col_float_key_signed`, ( `col_float_key_signed` = `col_float_key_signed` ) ) ;
Empty set (0.00 sec)
mysql> SELECT `col_float_key_signed` FROM table_10_utf8_undef HAVING MOD( `col_float_key_signed`, ( `col_float_key_signed` = `col_float_key_signed` ) ) IS TRUE;
+----------------------+
| col_float_key_signed |
+----------------------+
| -9.183 |
| 6.1806 |
+----------------------+
2 rows in set (0.00 sec)
How to repeat:
create table table_10_utf8_undef (
`pk` int primary key,
`col_float_key_signed` float ,
key (`col_float_key_signed`)
) character set utf8 ;
insert into table_10_utf8_undef values (0, -9.183), (1, 6.1806);
-- wrong
SELECT `col_float_key_signed` FROM table_10_utf8_undef WHERE MOD( `col_float_key_signed`, ( `col_float_key_signed` = `col_float_key_signed` ) ) ;
-- correct
SELECT `col_float_key_signed` FROM table_10_utf8_undef WHERE MOD( `col_float_key_signed`, ( `col_float_key_signed` = `col_float_key_signed` ) ) IS TRUE;
-- wrong
SELECT `col_float_key_signed` FROM table_10_utf8_undef HAVING MOD( `col_float_key_signed`, ( `col_float_key_signed` = `col_float_key_signed` ) ) ;
-- correct
SELECT `col_float_key_signed` FROM table_10_utf8_undef HAVING MOD( `col_float_key_signed`, ( `col_float_key_signed` = `col_float_key_signed` ) ) IS TRUE;
Suggested fix:
fix the implicit conversion from float to boolean