diff options
author | unknown <serg@serg.mylan> | 2003-08-08 19:13:27 +0200 |
---|---|---|
committer | unknown <serg@serg.mylan> | 2003-08-08 19:13:27 +0200 |
commit | a71ef9e643f21b79fa9051cc6fc8ea27705fe8cb (patch) | |
tree | 61eae20a2c39ae18b114db54388a986cfc775424 /sql/opt_range.cc | |
parent | 2e6d30072c501f30daff34c134cc4b4cba565950 (diff) | |
download | mariadb-git-a71ef9e643f21b79fa9051cc6fc8ea27705fe8cb.tar.gz |
between range optimization bug (between with const on one end only)
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r-- | sql/opt_range.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 2d949810b63..c7bad3b18f3 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -794,18 +794,15 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond) DBUG_RETURN(new SEL_TREE(SEL_TREE::ALWAYS)); DBUG_RETURN(new SEL_TREE(SEL_TREE::IMPOSSIBLE)); } + table_map ref_tables=cond->used_tables(); - if (ref_tables & ~(param->prev_tables | param->read_tables | - param->current_table)) - DBUG_RETURN(0); // Can't be calculated yet if (cond->type() != Item::FUNC_ITEM) { // Should be a field if (ref_tables & param->current_table) DBUG_RETURN(0); DBUG_RETURN(new SEL_TREE(SEL_TREE::MAYBE)); } - if (!(ref_tables & param->current_table)) - DBUG_RETURN(new SEL_TREE(SEL_TREE::MAYBE)); // This may be false or true + Item_func *cond_func= (Item_func*) cond; if (cond_func->select_optimize() == Item_func::OPTIMIZE_NONE) DBUG_RETURN(0); // Can't be calculated @@ -847,6 +844,12 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond) DBUG_RETURN(0); // Can't optimize this IN } + if (ref_tables & ~(param->prev_tables | param->read_tables | + param->current_table)) + DBUG_RETURN(0); // Can't be calculated yet + if (!(ref_tables & param->current_table)) + DBUG_RETURN(new SEL_TREE(SEL_TREE::MAYBE)); // This may be false or true + /* check field op const */ /* btw, ft_func's arguments()[0] isn't FIELD_ITEM. SerG*/ if (cond_func->arguments()[0]->type() == Item::FIELD_ITEM) |