summaryrefslogtreecommitdiff
path: root/sql/sql_tvc.cc
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2020-11-27 22:06:54 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2020-11-30 17:16:43 +0530
commitb4379df5b485143209c35b9f6f07b00049c8d455 (patch)
tree8f34d436dfaaa584cc416cf703c6bbacd50af385 /sql/sql_tvc.cc
parentf3b10354a97a0815d36abbfd25a5f10489a3eaab (diff)
downloadmariadb-git-b4379df5b485143209c35b9f6f07b00049c8d455.tar.gz
MDEV-21265: IN predicate conversion to IN subquery should be allowed for a broader set of datatype comparison
Allow materialization strategy when collations on the inner and outer sides of an IN subquery are the same and the character set of the inner side is a proper subset of the character set on the outer side. This allows conversion from utf8mb3 to utf8mb4 as the former is a subset of the later. This is only allowed when IN predicate is converted to an IN subquery Backported part of the patch (d6a00d9b18f) of MDEV-17905.
Diffstat (limited to 'sql/sql_tvc.cc')
-rw-r--r--sql/sql_tvc.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/sql_tvc.cc b/sql/sql_tvc.cc
index def519035d9..10a279b92ed 100644
--- a/sql/sql_tvc.cc
+++ b/sql/sql_tvc.cc
@@ -829,7 +829,8 @@ static bool cmp_row_types(Item* item1, Item* item2)
Item *inner= item1->element_index(i);
Item *outer= item2->element_index(i);
if (!inner->type_handler()->subquery_type_allows_materialization(inner,
- outer))
+ outer,
+ true))
return true;
}
return false;
@@ -895,7 +896,7 @@ Item *Item_func_in::in_predicate_to_in_subs_transformer(THD *thd,
for (uint i=1; i < arg_count; i++)
{
- if (!args[i]->const_item() || cmp_row_types(args[0], args[i]))
+ if (!args[i]->const_item() || cmp_row_types(args[i], args[0]))
return this;
}
@@ -975,6 +976,7 @@ Item *Item_func_in::in_predicate_to_in_subs_transformer(THD *thd,
if (!(in_subs=
new (thd->mem_root) Item_in_subselect(thd, args[0], sq_select)))
goto err;
+ in_subs->converted_from_in_predicate= TRUE;
sq= in_subs;
if (negated)
sq= negate_expression(thd, in_subs);