Commit 71371a9d authored by Sergey Petrunya's avatar Sergey Petrunya

Merge of fix for BUG#723822

parents 227f1103 0f265b82
...@@ -689,3 +689,21 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -689,3 +689,21 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY X ALL NULL NULL NULL NULL 10 2 DEPENDENT SUBQUERY X ALL NULL NULL NULL NULL 10
2 DEPENDENT SUBQUERY B ALL a,b NULL NULL NULL 1000 Range checked for each record (index map: 0x3) 2 DEPENDENT SUBQUERY B ALL a,b NULL NULL NULL 1000 Range checked for each record (index map: 0x3)
drop table t1, t2; drop table t1, t2;
#
# BUG#723822: Crash in get_constant_key_infix with EXISTS ( SELECT .. DISTINCT )
#
CREATE TABLE t1 ( f1 int(11), f3 varchar(1)) ;
INSERT INTO t1 VALUES ('8','c'),('5','f');
ALTER TABLE t1 ADD KEY (f3,f1);
CREATE TABLE t2 ( f4 varchar(1)) ;
INSERT INTO t2 VALUES ('f'),('d');
SELECT * FROM t2
WHERE EXISTS (
SELECT DISTINCT f3
FROM t1
WHERE f3 <= t2.f4
);
f4
f
d
drop table t1,t2;
...@@ -619,3 +619,24 @@ select a, ...@@ -619,3 +619,24 @@ select a,
from t1 A; from t1 A;
drop table t1, t2; drop table t1, t2;
--echo #
--echo # BUG#723822: Crash in get_constant_key_infix with EXISTS ( SELECT .. DISTINCT )
--echo #
CREATE TABLE t1 ( f1 int(11), f3 varchar(1)) ;
INSERT INTO t1 VALUES ('8','c'),('5','f');
ALTER TABLE t1 ADD KEY (f3,f1);
CREATE TABLE t2 ( f4 varchar(1)) ;
INSERT INTO t2 VALUES ('f'),('d');
SELECT * FROM t2
WHERE EXISTS (
SELECT DISTINCT f3
FROM t1
WHERE f3 <= t2.f4
);
drop table t1,t2;
...@@ -11857,7 +11857,8 @@ get_constant_key_infix(KEY *index_info, SEL_ARG *index_range_tree, ...@@ -11857,7 +11857,8 @@ get_constant_key_infix(KEY *index_info, SEL_ARG *index_range_tree,
Find the range tree for the current keypart. We assume that Find the range tree for the current keypart. We assume that
index_range_tree points to the leftmost keypart in the index. index_range_tree points to the leftmost keypart in the index.
*/ */
for (cur_range= index_range_tree; cur_range; for (cur_range= index_range_tree;
cur_range && cur_range->type == SEL_ARG::KEY_RANGE;
cur_range= cur_range->next_key_part) cur_range= cur_range->next_key_part)
{ {
if (cur_range->field->eq(cur_part->field)) if (cur_range->field->eq(cur_part->field))
......
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