Below is the list of changes that have just been committed into a local
5.0 repository of psergey. When psergey 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
1.1984 05/09/21 02:07:25 sergefp@stripped +3 -0
Fix for BUG#13317: Make range optimizer able to produce ranges for "view.field IN
(c1,c2)"
sql/opt_range.cc
1.189 05/09/21 02:07:20 sergefp@stripped +2 -2
Fix for BUG#13317: Make range optimizer able to produce ranges for "view.field IN
(c1,c2)"
mysql-test/t/range.test
1.34 05/09/21 02:07:20 sergefp@stripped +18 -0
Testcase for BUG#13317
mysql-test/r/range.result
1.41 05/09/21 02:07:19 sergefp@stripped +13 -0
Testcase for BUG#13317
# 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: sergefp
# Host: newbox.mylan
# Root: /home/psergey/mysql-5.0-bug13317
--- 1.188/sql/opt_range.cc 2005-09-16 01:18:31 +04:00
+++ 1.189/sql/opt_range.cc 2005-09-21 02:07:20 +04:00
@@ -3541,9 +3541,9 @@
case Item_func::IN_FUNC:
{
Item_func_in *func=(Item_func_in*) cond_func;
- if (func->key_item()->type() != Item::FIELD_ITEM)
+ if (func->key_item()->real_item()->type() != Item::FIELD_ITEM)
DBUG_RETURN(0);
- field_item= (Item_field*) (func->key_item());
+ field_item= (Item_field*) (func->key_item()->real_item());
value= NULL;
break;
}
--- 1.40/mysql-test/r/range.result 2005-09-14 02:41:37 +04:00
+++ 1.41/mysql-test/r/range.result 2005-09-21 02:07:19 +04:00
@@ -768,3 +768,16 @@
a
2
DROP TABLE t1;
+create table t1 (a int, b int, primary key(a,b));
+create view v1 as select a, b from t1;
+INSERT INTO `t1` VALUES
+(0,0),(1,0),(2,0),(3,0),(4,0),(5,1),(6,1),(7,1),(8,1),(9,1),(10,2),(11,2),(12,2)
+,(13,2),(14,2),(15,3),(16,3),(17,3),(18,3),(19,3);
+explain select * from t1 where a in (3,4) and b in (1,2,3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range PRIMARY PRIMARY 8 NULL # Using where; Using index
+explain select * from v1 where a in (3,4) and b in (1,2,3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 range PRIMARY PRIMARY 8 NULL # Using where; Using index
+drop view v1;
+drop table t1;
--- 1.33/mysql-test/t/range.test 2005-09-14 02:41:37 +04:00
+++ 1.34/mysql-test/t/range.test 2005-09-21 02:07:20 +04:00
@@ -578,3 +578,21 @@
SELECT * FROM t1;
DROP TABLE t1;
+
+#
+# BUG#13317: range optimization doesn't work for IN over VIEW.
+#
+create table t1 (a int, b int, primary key(a,b));
+create view v1 as select a, b from t1;
+
+INSERT INTO `t1` VALUES
+(0,0),(1,0),(2,0),(3,0),(4,0),(5,1),(6,1),(7,1),(8,1),(9,1),(10,2),(11,2),(12,2)
+,(13,2),(14,2),(15,3),(16,3),(17,3),(18,3),(19,3);
+
+--replace_column 9 #
+explain select * from t1 where a in (3,4) and b in (1,2,3);
+--replace_column 9 #
+explain select * from v1 where a in (3,4) and b in (1,2,3);
+
+drop view v1;
+drop table t1;
| Thread |
|---|
| • bk commit into 5.0 tree (sergefp:1.1984) BUG#13317 | Sergey Petrunia | 21 Sep |