Details
-
Task
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
None
-
None
Description
Some scripts compose SQL queries without checking if some input fields are empty. As a result, they can produce queries containing LIKE '%%'. This clause does not appear to be optimized away:
MariaDB [test]> EXPLAIN EXTENDED SELECT c FROM t WHERE c LIKE '%%'; |
+------+-------------+-------+------+---------------+------+---------+------+------+----------+-------------+ |
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra | |
+------+-------------+-------+------+---------------+------+---------+------+------+----------+-------------+ |
| 1 | SIMPLE | t | ALL | NULL | NULL | NULL | NULL | 5 | 100.00 | Using where | |
+------+-------------+-------+------+---------------+------+---------+------+------+----------+-------------+ |
1 row in set, 1 warning (0.05 sec) |
 |
Note (Code 1003): select `test`.`t`.`c` AS `c` from `test`.`t` where (`test`.`t`.`c` like '%%') |