diff options
-rw-r--r-- | mysql-test/r/range_vs_index_merge.result | 10 | ||||
-rw-r--r-- | mysql-test/r/range_vs_index_merge_innodb.result | 10 | ||||
-rwxr-xr-x | mysql-test/t/range_vs_index_merge.test | 19 | ||||
-rw-r--r-- | sql/opt_range.cc | 1 |
4 files changed, 40 insertions, 0 deletions
diff --git a/mysql-test/r/range_vs_index_merge.result b/mysql-test/r/range_vs_index_merge.result index 6f79fa98fa5..07b54400b9f 100644 --- a/mysql-test/r/range_vs_index_merge.result +++ b/mysql-test/r/range_vs_index_merge.result @@ -1367,4 +1367,14 @@ f1 f2 f3 f4 9 0 2 6 SET SESSION optimizer_switch=DEFAULT; DROP TABLE t1; +CREATE TABLE t1 (f1 int) ; +INSERT INTO t1 VALUES (0), (0); +CREATE TABLE t2 (f1 int, f2 int, f3 int, f4 int, INDEX idx (f3,f2)) ; +INSERT INTO t2 VALUES (5,6,0,0), (0,4,0,0); +CREATE TABLE t3 (f1 int, f2 int, INDEX idx1 (f2,f1) , INDEX idx2 (f1)) ; +INSERT INTO t3 VALUES (6,0),( 4,0); +SELECT * FROM t1,t2,t3 +WHERE (t2.f3 = 1 OR t3.f1=t2.f1) AND t3.f1 <> t2.f2 AND t3.f2 = t2.f4; +f1 f1 f2 f3 f4 f1 f2 +DROP TABLE t1,t2,t3; set session optimizer_switch='index_merge_sort_intersection=default'; diff --git a/mysql-test/r/range_vs_index_merge_innodb.result b/mysql-test/r/range_vs_index_merge_innodb.result index 85bf5244d13..2ca8c0ca37a 100644 --- a/mysql-test/r/range_vs_index_merge_innodb.result +++ b/mysql-test/r/range_vs_index_merge_innodb.result @@ -1368,5 +1368,15 @@ f1 f2 f3 f4 9 0 2 6 SET SESSION optimizer_switch=DEFAULT; DROP TABLE t1; +CREATE TABLE t1 (f1 int) ; +INSERT INTO t1 VALUES (0), (0); +CREATE TABLE t2 (f1 int, f2 int, f3 int, f4 int, INDEX idx (f3,f2)) ; +INSERT INTO t2 VALUES (5,6,0,0), (0,4,0,0); +CREATE TABLE t3 (f1 int, f2 int, INDEX idx1 (f2,f1) , INDEX idx2 (f1)) ; +INSERT INTO t3 VALUES (6,0),( 4,0); +SELECT * FROM t1,t2,t3 +WHERE (t2.f3 = 1 OR t3.f1=t2.f1) AND t3.f1 <> t2.f2 AND t3.f2 = t2.f4; +f1 f1 f2 f3 f4 f1 f2 +DROP TABLE t1,t2,t3; set session optimizer_switch='index_merge_sort_intersection=default'; SET SESSION STORAGE_ENGINE=DEFAULT; diff --git a/mysql-test/t/range_vs_index_merge.test b/mysql-test/t/range_vs_index_merge.test index f101048339c..1f7065dcb0a 100755 --- a/mysql-test/t/range_vs_index_merge.test +++ b/mysql-test/t/range_vs_index_merge.test @@ -1010,5 +1010,24 @@ SET SESSION optimizer_switch=DEFAULT; DROP TABLE t1; +# +# Bug #752353: valgrind complain on a jump depending +# on an uninitialised value +# + +CREATE TABLE t1 (f1 int) ; +INSERT INTO t1 VALUES (0), (0); + +CREATE TABLE t2 (f1 int, f2 int, f3 int, f4 int, INDEX idx (f3,f2)) ; +INSERT INTO t2 VALUES (5,6,0,0), (0,4,0,0); + +CREATE TABLE t3 (f1 int, f2 int, INDEX idx1 (f2,f1) , INDEX idx2 (f1)) ; +INSERT INTO t3 VALUES (6,0),( 4,0); + +SELECT * FROM t1,t2,t3 + WHERE (t2.f3 = 1 OR t3.f1=t2.f1) AND t3.f1 <> t2.f2 AND t3.f2 = t2.f4; + +DROP TABLE t1,t2,t3; + #the following command must be the last one in the file set session optimizer_switch='index_merge_sort_intersection=default'; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 91ac52f6246..0eb1bd3ce36 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -7338,6 +7338,7 @@ get_mm_parts(RANGE_OPT_PARAM *param, COND *cond_func, Field *field, DBUG_RETURN(0); // OOM } sel_arg->part=(uchar) key_part->part; + sel_arg->max_part_no= sel_arg->part+1; tree->keys[key_part->key]=sel_add(tree->keys[key_part->key],sel_arg); tree->keys_map.set_bit(key_part->key); } |