summaryrefslogtreecommitdiff
path: root/sql/opt_subselect.cc
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2011-09-06 17:06:04 +0400
committerSergey Petrunya <psergey@askmonty.org>2011-09-06 17:06:04 +0400
commitfc6b6435b4c3f5203e6ffc3de289f0413a7ef33f (patch)
treeea2257094662595e5841c7fa1f25efa5720c3d23 /sql/opt_subselect.cc
parente1435a51786f7975da79f62fc430fc3b3bf1a45f (diff)
downloadmariadb-git-fc6b6435b4c3f5203e6ffc3de289f0413a7ef33f.tar.gz
BUG#823930: Wrong result with semijoin materialization and blob fields
- Make subquery_types_allow_materialization() detect a case where create_tmp_table() would create a blob column which would make it impossible to use materialization Non-semi-join materialization worked because it detected that this case and felt back to use IN->EXISTS. Semi-join Materialization cannot easily fallback, so we have to detect this case early.
Diffstat (limited to 'sql/opt_subselect.cc')
-rw-r--r--sql/opt_subselect.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index 9ea55390fc5..3cb13b0b88c 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -559,6 +559,16 @@ bool subquery_types_allow_materialization(Item_in_subselect *in_subs)
if (inner->field_type() == MYSQL_TYPE_BLOB ||
inner->field_type() == MYSQL_TYPE_GEOMETRY)
DBUG_RETURN(FALSE);
+ /*
+ Materialization also is unable to work when create_tmp_table() will
+ create a blob column because item->max_length is too big.
+ The following check is copied from Item::make_string_field():
+ */
+ if (inner->max_length / inner->collation.collation->mbmaxlen >
+ CONVERT_IF_BIGGER_TO_BLOB)
+ {
+ DBUG_RETURN(FALSE);
+ }
break;
case TIME_RESULT:
if (mysql_type_to_time_type(outer->field_type()) !=