summaryrefslogtreecommitdiff
path: root/sql/opt_subselect.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2017-04-24 10:57:31 +0400
committerAlexander Barkov <bar@mariadb.org>2017-04-24 10:57:31 +0400
commit3cd7690a5e79d73ccb3f8e1e071c523e7c6ef9b1 (patch)
tree9399a4b36b9a1a268ce495c889ceaab8fd8c0605 /sql/opt_subselect.cc
parent5a759d31f766087d5e135e1d3d3d987693bc9b88 (diff)
downloadmariadb-git-3cd7690a5e79d73ccb3f8e1e071c523e7c6ef9b1.tar.gz
MDEV-12568 Add Type_handler::subquery_type_allows_materialization()
Diffstat (limited to 'sql/opt_subselect.cc')
-rw-r--r--sql/opt_subselect.cc29
1 files changed, 2 insertions, 27 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index b5808ea9315..b18fb8f2ae5 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -843,34 +843,9 @@ bool subquery_types_allow_materialization(Item_in_subselect *in_subs)
all_are_fields &= (outer->real_item()->type() == Item::FIELD_ITEM &&
inner->real_item()->type() == Item::FIELD_ITEM);
total_key_length += inner->max_length;
- if (outer->cmp_type() != inner->cmp_type())
+ if (!inner->type_handler()->subquery_type_allows_materialization(inner,
+ outer))
DBUG_RETURN(FALSE);
- switch (outer->cmp_type()) {
- case STRING_RESULT:
- if (!(outer->collation.collation == inner->collation.collation))
- DBUG_RETURN(FALSE);
- // Materialization does not work with BLOB columns
- 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->too_big_for_varchar())
- {
- DBUG_RETURN(FALSE);
- }
- break;
- case TIME_RESULT:
- if (mysql_type_to_time_type(outer->field_type()) !=
- mysql_type_to_time_type(inner->field_type()))
- DBUG_RETURN(FALSE);
- default:
- /* suitable for materialization */
- break;
- }
}
/*