Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-03-01 00:21:21+03:00, evgen@stripped +3 -0
Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized
away.
During optimization stage WHERE and HAVING conditions can be changed or even
be removed at all. Thus they aren't showed in the EXPLAIN EXTENDED which
prints conditions after optimization.
Now if all elements of an Item_cond were removed this Item_cond is substituted
for an Item_int with the int value of the Item_cond.
mysql-test/r/explain.result@stripped, 2007-03-01 00:05:00+03:00, evgen@stripped +9 -0
Added a test case for the bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized away.
mysql-test/t/explain.test@stripped, 2007-03-01 00:04:19+03:00, evgen@stripped +10 -0
Added a test case for the bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized away.
sql/sql_select.cc@stripped, 2007-03-01 00:05:43+03:00, evgen@stripped +2 -0
Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized
away.
Now if all elements of an Item_cond were removed this Item_cond is substituted
for an Item_int with the int value of the Item_cond.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: evgen
# Host: moonbone.local
# Root: /mnt/gentoo64/work/22331-bug-5.0-opt-mysql
--- 1.490/sql/sql_select.cc 2007-02-13 10:10:29 +03:00
+++ 1.491/sql/sql_select.cc 2007-03-01 00:05:43 +03:00
@@ -7535,6 +7535,8 @@
break;
}
}
+ if (!((Item_cond*)cond)->argument_list()->elements)
+ cond= new Item_int(cond->val_int());
}
else if (cond->type() == Item::FUNC_ITEM &&
((Item_cond*) cond)->functype() == Item_func::MULT_EQUAL_FUNC)
--- 1.17/mysql-test/r/explain.result 2006-06-01 04:39:05 +04:00
+++ 1.18/mysql-test/r/explain.result 2007-03-01 00:05:00 +03:00
@@ -57,3 +57,12 @@
explain select 3 into @v1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+create table t1(f1 int, f2 int);
+insert into t1 values (1,1);
+create view v1 as select * from t1 where f1=1;
+explain extended select * from v1 where f2=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1
+Warnings:
+Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2` from `test`.`t1` where 1
+drop table t1;
--- 1.10/mysql-test/t/explain.test 2006-06-01 04:39:06 +04:00
+++ 1.11/mysql-test/t/explain.test 2007-03-01 00:04:19 +03:00
@@ -51,4 +51,14 @@
select 3 into @v1;
explain select 3 into @v1;
+#
+# Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were
+# optimized away.
+#
+create table t1(f1 int, f2 int);
+insert into t1 values (1,1);
+create view v1 as select * from t1 where f1=1;
+explain extended select * from v1 where f2=1;
+drop table t1;
+
# End of 5.0 tests.
| Thread |
|---|
| • bk commit into 5.0 tree (evgen:1.2411) BUG#22331 | eugene | 28 Feb |