summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/item.cc2
-rw-r--r--sql/item.h6
-rw-r--r--sql/item_func.h16
-rw-r--r--sql/item_strfunc.h2
-rw-r--r--sql/sql_func_dep.cc34
5 files changed, 20 insertions, 40 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 521e96b6d9b..4000549097d 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -10623,7 +10623,5 @@ bool Item::is_deterministic_arg()
(collation.collation->state & MY_CS_NOPAD))))
return false;
}
- if (field_type() == MYSQL_TYPE_FLOAT)
- return false;
return true;
}
diff --git a/sql/item.h b/sql/item.h
index a3ba67d99cf..44955b80fac 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -2389,12 +2389,6 @@ public:
Checks if this item consists in the left part of arg IN subquery predicate
*/
bool pushable_equality_checker_for_subquery(uchar *arg);
- bool is_number()
- {
- return (cmp_type() == INT_RESULT ||
- cmp_type() == DECIMAL_RESULT ||
- cmp_type() == REAL_RESULT);
- }
bool is_deterministic_arg();
};
diff --git a/sql/item_func.h b/sql/item_func.h
index a3caa08aac2..b91c386b2c8 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -1027,22 +1027,6 @@ class Item_num_op :public Item_func_numhybrid
set_handler(type_handler_long_or_longlong());
}
bool need_parentheses_in_default() { return true; }
- bool is_deterministic_func()
- {
- Item *args0= args[0];
- for (uint i= 0; i < arg_count; i++)
- {
- if (args[i]->field_type() == MYSQL_TYPE_FLOAT ||
- args[i]->field_type() == MYSQL_TYPE_GEOMETRY ||
- (args0->field_type() != MYSQL_TYPE_BIT &&
- i != 0 &&
- args[i]->field_type() == MYSQL_TYPE_BIT) ||
- (args[i]->cmp_type() != args0->cmp_type() &&
- (!args0->is_number() || !args[i]->is_number())))
- return false;
- }
- return true;
- }
};
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 3c5bebbad66..7bc7723eec0 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -605,6 +605,8 @@ public:
const char *mode_name() const { return "leading"; }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_ltrim>(thd, this); }
+ bool is_deterministic_func()
+ { return Item_args::has_deterministic_args(); }
};
diff --git a/sql/sql_func_dep.cc b/sql/sql_func_dep.cc
index eec1e9f0489..709e599707f 100644
--- a/sql/sql_func_dep.cc
+++ b/sql/sql_func_dep.cc
@@ -74,6 +74,7 @@
2. Contain non IS or FD fields from the left LEFT JOIN tables.
3. Contain no IS or FD fields from the left LEFT JOIN tables if the
considered LEFT JOIN is not the most outer LEFT JOIN.
+ 4. Contain subquery.
3. From Virtual column definition.
@@ -664,10 +665,11 @@ bool check_on_expr_and_get_equalities_info(FD_select_info *sl_info,
return false;
}
if ((!sl_info->top_level && // 2
- !(on_expr->used_tables() & (~sl_info->cur_level_tabs))) ||
- ((on_expr->used_tables() & (~sl_info->cur_level_tabs)) && // 3
- on_expr->walk(&Item::check_reject_fd_extraction_processor, 0,
- &sl_info->cur_level_tabs)))
+ !(on_expr->used_tables() & (~sl_info->cur_level_tabs))) ||
+ ((on_expr->used_tables() & (~sl_info->cur_level_tabs)) && // 3
+ on_expr->walk(&Item::check_reject_fd_extraction_processor, 0,
+ &sl_info->cur_level_tabs)) ||
+ on_expr->with_subquery())
{
/*
Check that this ON expression doesn't contain
@@ -1075,11 +1077,12 @@ bool are_select_fields_fd(st_select_lex *sl, List<Item> *gb_items,
bool st_select_lex::check_func_dep()
{
+ DBUG_ENTER("st_select_lex::check_func_dep");
/* Stop if no tables are used or fake SELECT is processed. */
if (leaf_tables.is_empty() ||
select_number == UINT_MAX ||
select_number == INT_MAX)
- return false;
+ DBUG_RETURN(0);
bool need_check= (group_list.elements > 0) ||
(master_unit()->outer_select() &&
@@ -1097,7 +1100,8 @@ bool st_select_lex::check_func_dep()
}
set_update_table_fields(this); /* UPDATE query processing. */
- if (group_list.elements == 0 && !having)
+ if (group_list.elements == 0 &&
+ !having && !agg_func_used())
{
/*
This SELECT has no GROUP BY clause and HAVING.
@@ -1111,31 +1115,29 @@ bool st_select_lex::check_func_dep()
bitmap_set_all(&tbl->table->tmp_set);
}
if (!need_check)
- return false;
+ DBUG_RETURN(0);
}
List<Item> gb_items;
/* Collect fields from the GROUP BY of this SELECT. */
if (collect_gb_items(this, gb_items))
- return true;
+ DBUG_RETURN(1);
if (olap != UNSPECIFIED_OLAP_TYPE)
{
table_map map= 0;
/* If ROLLUP is used don't expand FD fields set. */
if (!are_select_fields_fd(this, &gb_items, map))
- return true;
- return false;
+ DBUG_RETURN(1);
+ DBUG_RETURN(0);
}
List<Item_equal_fd_info> eq_info;
FD_select_info *sl_info=
new (join->thd->mem_root) FD_select_info(this, &eq_info, "WHERE clause");
- if (expand_fdfs_with_top_join_tables_fields(sl_info))
- return true;
-
- if (!are_select_fields_fd(this, &gb_items, sl_info->forbid_fd_expansion))
- return true;
+ if (expand_fdfs_with_top_join_tables_fields(sl_info) ||
+ !are_select_fields_fd(this, &gb_items, sl_info->forbid_fd_expansion))
+ DBUG_RETURN(1);
- return false;
+ DBUG_RETURN(0);
}