Commit 79439d9a authored by Igor Babaev's avatar Igor Babaev

Fixed LP bug #752353.

In some cases the field max_part_no of the SEL_ARG structure
was not initialized. That triggered a Valgrind complain.
parent b315c62b
......@@ -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';
......@@ -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;
......@@ -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';
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment