Description:
The following EXPLAIN command:
EXPLAIN SELECT * FROM t1 WHERE (1 XOR 1);
returns
+----+-------------+-------+------+---------------+------+---------+------+------+-----------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref |
rows | Extra |
+----+-------------+-------+------+---------------+------+---------+------+------+-----------------------------------------------------+
| 1 | SIMPLE | NULL | NULL | NULL | NULL | NULL | NULL |
NULL | Impossible WHERE noticed after reading const tables |
+----+-------------+-------+------+---------------+------+---------+------+------+-----------------------------------------------------+
It should return:
+----+-------------+-------+------+---------------+------+---------+------+------+------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref |
rows | Extra |
+----+-------------+-------+------+---------------+------+---------+------+------+------------------+
| 1 | SIMPLE | NULL | NULL | NULL | NULL | NULL | NULL |
NULL | Impossible WHERE |
+----+-------------+-------+------+---------------+------+---------+------+------+------------------+
How to repeat:
mysql> create table t1 (a int);
Query OK, 0 rows affected (0.00 sec)
mysql> insert into t1 values (1), (2);
Query OK, 2 rows affected (0.00 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> EXPLAIN SELECT * FROM t1 WHERE (1 XOR 1);
+----+-------------+-------+------+---------------+------+---------+------+------+-----------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref |
rows | Extra |
+----+-------------+-------+------+---------------+------+---------+------+------+-----------------------------------------------------+
| 1 | SIMPLE | NULL | NULL | NULL | NULL | NULL | NULL |
NULL | Impossible WHERE noticed after reading const tables |
+----+-------------+-------+------+---------------+------+---------+------+------+-----------------------------------------------------+
1 row in set (0.00 sec)
Suggested fix:
The problem is a result of an incorrect initial setting for const_item_cache
in Item_cond::fix_fields.
The same bug exists in Item_cond::split_sum_func.
[20 Oct 2004 21:18]
Igor Babaev
The bug can be found in all versions down to 3.23.
Probably it makes sense to downport the fix.
[23 Oct 2004 2:10]
Igor Babaev
ChangeSet
1.1663 04/10/20 14:52:30 igor@rurik.mysql.com +2 -0
func_test.result, item_cmpfunc.cc:
Fixed bug #6187: a wrong initial setting for const_item_cache
in Item_cond::fix_fields.
As I mentioned the fix probably should be downported.
Page generated in 0.052 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.