diff options
Diffstat (limited to 'sql/opt_table_elimination.cc')
-rw-r--r-- | sql/opt_table_elimination.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc index 2ef565517b5..6434c36aaf2 100644 --- a/sql/opt_table_elimination.cc +++ b/sql/opt_table_elimination.cc @@ -1486,6 +1486,8 @@ void check_equality(Dep_analysis_context *ctx, Dep_module_expr **eq_mod, left->real_item()->type() == Item::FIELD_ITEM) { Field *field= ((Item_field*)left->real_item())->field; + if (right->cmp_type() == TIME_RESULT && field->cmp_type() != TIME_RESULT) + return; if (field->result_type() == STRING_RESULT) { if (right->result_type() != STRING_RESULT) @@ -1499,7 +1501,9 @@ void check_equality(Dep_analysis_context *ctx, Dep_module_expr **eq_mod, We can't assume there's a functional dependency if the effective collation of the operation differ from the field collation. */ - if (field->cmp_type() == STRING_RESULT && + if ((field->cmp_type() == STRING_RESULT || + field->real_type() == MYSQL_TYPE_ENUM || + field->real_type() == MYSQL_TYPE_SET) && field->charset() != cond->compare_collation()) return; } |