summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2011-02-25 21:43:57 +0300
committerSergey Petrunya <psergey@askmonty.org>2011-02-25 21:43:57 +0300
commit0f265b825136ef5a51913ce7f18255c6c432eb96 (patch)
tree76d8134be1abe16c2dd0041a185280c01cd3e99e /sql
parent22e1ee5f5f5b1fb5a571a58c63ee805deb8ea43a (diff)
downloadmariadb-git-0f265b825136ef5a51913ce7f18255c6c432eb96.tar.gz
BUG#723822: Crash in get_constant_key_infix with EXISTS ( SELECT .. DISTINCT )
- Make get_constant_key_infix() take into account that there may be SEL_TREEs with type=SEL_ARG::MAYBE_KEY, which it cannot process, because they are not real ranges but rather indications that we might have been able to construct a range if we had values for some other tables' fields. (check_quick_select() already has such check)
Diffstat (limited to 'sql')
-rw-r--r--sql/opt_range.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 633fb3d571c..e6ff36f1307 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -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
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)
{
if (cur_range->field->eq(cur_part->field))