Bug #100270 Use MOD result (float number) in HAVING/WHERE is not considered as TRUE
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
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.