Loading mysql-test/r/index_merge_innodb.result +11 −0 Original line number Diff line number Diff line Loading @@ -123,3 +123,14 @@ key1a = 2 and key1b is null and key3a = 2 and key3b is null; count(*) 4 drop table t1,t2; create table t1 ( id1 int, id2 date , index idx2 (id1,id2), index idx1 (id2) ) engine = innodb; insert into t1 values(1,'20040101'), (2,'20040102'); select * from t1 where id1 = 1 and id2= '20040101'; id1 id2 1 2004-01-01 drop table t1; mysql-test/r/subselect.result +21 −0 Original line number Diff line number Diff line Loading @@ -2816,3 +2816,24 @@ select * from t1; EMPNUM E1 DROP TABLE t1,t2; CREATE TABLE t1(select_id BIGINT, values_id BIGINT); INSERT INTO t1 VALUES (1, 1); CREATE TABLE t2 (select_id BIGINT, values_id BIGINT, PRIMARY KEY(select_id,values_id)); INSERT INTO t2 VALUES (0, 1), (0, 2), (0, 3), (1, 5); SELECT values_id FROM t1 WHERE values_id IN (SELECT values_id FROM t2 WHERE select_id IN (1, 0)); values_id 1 SELECT values_id FROM t1 WHERE values_id IN (SELECT values_id FROM t2 WHERE select_id BETWEEN 0 AND 1); values_id 1 SELECT values_id FROM t1 WHERE values_id IN (SELECT values_id FROM t2 WHERE select_id = 0 OR select_id = 1); values_id 1 DROP TABLE t1, t2; mysql-test/t/index_merge_innodb.test +11 −0 Original line number Diff line number Diff line Loading @@ -120,3 +120,14 @@ select count(*) from t1 where drop table t1,t2; # Test for BUG#8441 create table t1 ( id1 int, id2 date , index idx2 (id1,id2), index idx1 (id2) ) engine = innodb; insert into t1 values(1,'20040101'), (2,'20040102'); select * from t1 where id1 = 1 and id2= '20040101'; drop table t1; mysql-test/t/subselect.test +22 −0 Original line number Diff line number Diff line Loading @@ -1837,3 +1837,25 @@ WHERE t1.EMPNUM NOT IN WHERE t1.EMPNUM = t2.EMPNUM); select * from t1; DROP TABLE t1,t2; # # Test for bug #11487: range access in a subquery # CREATE TABLE t1(select_id BIGINT, values_id BIGINT); INSERT INTO t1 VALUES (1, 1); CREATE TABLE t2 (select_id BIGINT, values_id BIGINT, PRIMARY KEY(select_id,values_id)); INSERT INTO t2 VALUES (0, 1), (0, 2), (0, 3), (1, 5); SELECT values_id FROM t1 WHERE values_id IN (SELECT values_id FROM t2 WHERE select_id IN (1, 0)); SELECT values_id FROM t1 WHERE values_id IN (SELECT values_id FROM t2 WHERE select_id BETWEEN 0 AND 1); SELECT values_id FROM t1 WHERE values_id IN (SELECT values_id FROM t2 WHERE select_id = 0 OR select_id = 1); DROP TABLE t1, t2; sql/opt_range.cc +6 −3 Original line number Diff line number Diff line Loading @@ -2593,12 +2593,12 @@ static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info, { tuple_arg= scan->sel_arg; /* Here we use the length of the first key part */ tuple_arg->store_min(key_part->length, &key_ptr, 0); tuple_arg->store_min(key_part->store_length, &key_ptr, 0); } while (tuple_arg->next_key_part != sel_arg) { tuple_arg= tuple_arg->next_key_part; tuple_arg->store_min(key_part[tuple_arg->part].length, &key_ptr, 0); tuple_arg->store_min(key_part[tuple_arg->part].store_length, &key_ptr, 0); } min_range.length= max_range.length= ((char*) key_ptr - (char*) key_val); records= (info->param->table->file-> Loading Loading @@ -5993,6 +5993,9 @@ int QUICK_RANGE_SELECT::reset() range= NULL; cur_range= (QUICK_RANGE**) ranges.buffer; if (file->inited == handler::NONE && (error= file->ha_index_init(index))) DBUG_RETURN(error); /* Do not allocate the buffers twice. */ if (multi_range_length) { Loading Loading
mysql-test/r/index_merge_innodb.result +11 −0 Original line number Diff line number Diff line Loading @@ -123,3 +123,14 @@ key1a = 2 and key1b is null and key3a = 2 and key3b is null; count(*) 4 drop table t1,t2; create table t1 ( id1 int, id2 date , index idx2 (id1,id2), index idx1 (id2) ) engine = innodb; insert into t1 values(1,'20040101'), (2,'20040102'); select * from t1 where id1 = 1 and id2= '20040101'; id1 id2 1 2004-01-01 drop table t1;
mysql-test/r/subselect.result +21 −0 Original line number Diff line number Diff line Loading @@ -2816,3 +2816,24 @@ select * from t1; EMPNUM E1 DROP TABLE t1,t2; CREATE TABLE t1(select_id BIGINT, values_id BIGINT); INSERT INTO t1 VALUES (1, 1); CREATE TABLE t2 (select_id BIGINT, values_id BIGINT, PRIMARY KEY(select_id,values_id)); INSERT INTO t2 VALUES (0, 1), (0, 2), (0, 3), (1, 5); SELECT values_id FROM t1 WHERE values_id IN (SELECT values_id FROM t2 WHERE select_id IN (1, 0)); values_id 1 SELECT values_id FROM t1 WHERE values_id IN (SELECT values_id FROM t2 WHERE select_id BETWEEN 0 AND 1); values_id 1 SELECT values_id FROM t1 WHERE values_id IN (SELECT values_id FROM t2 WHERE select_id = 0 OR select_id = 1); values_id 1 DROP TABLE t1, t2;
mysql-test/t/index_merge_innodb.test +11 −0 Original line number Diff line number Diff line Loading @@ -120,3 +120,14 @@ select count(*) from t1 where drop table t1,t2; # Test for BUG#8441 create table t1 ( id1 int, id2 date , index idx2 (id1,id2), index idx1 (id2) ) engine = innodb; insert into t1 values(1,'20040101'), (2,'20040102'); select * from t1 where id1 = 1 and id2= '20040101'; drop table t1;
mysql-test/t/subselect.test +22 −0 Original line number Diff line number Diff line Loading @@ -1837,3 +1837,25 @@ WHERE t1.EMPNUM NOT IN WHERE t1.EMPNUM = t2.EMPNUM); select * from t1; DROP TABLE t1,t2; # # Test for bug #11487: range access in a subquery # CREATE TABLE t1(select_id BIGINT, values_id BIGINT); INSERT INTO t1 VALUES (1, 1); CREATE TABLE t2 (select_id BIGINT, values_id BIGINT, PRIMARY KEY(select_id,values_id)); INSERT INTO t2 VALUES (0, 1), (0, 2), (0, 3), (1, 5); SELECT values_id FROM t1 WHERE values_id IN (SELECT values_id FROM t2 WHERE select_id IN (1, 0)); SELECT values_id FROM t1 WHERE values_id IN (SELECT values_id FROM t2 WHERE select_id BETWEEN 0 AND 1); SELECT values_id FROM t1 WHERE values_id IN (SELECT values_id FROM t2 WHERE select_id = 0 OR select_id = 1); DROP TABLE t1, t2;
sql/opt_range.cc +6 −3 Original line number Diff line number Diff line Loading @@ -2593,12 +2593,12 @@ static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info, { tuple_arg= scan->sel_arg; /* Here we use the length of the first key part */ tuple_arg->store_min(key_part->length, &key_ptr, 0); tuple_arg->store_min(key_part->store_length, &key_ptr, 0); } while (tuple_arg->next_key_part != sel_arg) { tuple_arg= tuple_arg->next_key_part; tuple_arg->store_min(key_part[tuple_arg->part].length, &key_ptr, 0); tuple_arg->store_min(key_part[tuple_arg->part].store_length, &key_ptr, 0); } min_range.length= max_range.length= ((char*) key_ptr - (char*) key_val); records= (info->param->table->file-> Loading Loading @@ -5993,6 +5993,9 @@ int QUICK_RANGE_SELECT::reset() range= NULL; cur_range= (QUICK_RANGE**) ranges.buffer; if (file->inited == handler::NONE && (error= file->ha_index_init(index))) DBUG_RETURN(error); /* Do not allocate the buffers twice. */ if (multi_range_length) { Loading