summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 862c40b847d..68fa0ffe140 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -1387,7 +1387,9 @@ bool Field::can_optimize_range(const Item_bool_func *cond,
{
DBUG_ASSERT(cmp_type() != TIME_RESULT); // Handled in Field_temporal
DBUG_ASSERT(cmp_type() != STRING_RESULT); // Handled in Field_str descendants
- return item->cmp_type() != TIME_RESULT;
+ return (item->cmp_type() != TIME_RESULT) &&
+ !(item->type() == Item::SUBSELECT_ITEM &&
+ ((Item_subselect *)item)->is_expensive());
}