summaryrefslogtreecommitdiff
path: root/sql/item_subselect.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-03-17 11:41:25 +0100
committerSergei Golubchik <sergii@pisem.net>2013-03-17 11:41:25 +0100
commit495fd27c0e3781013904666f302a3d3e4f011e50 (patch)
tree53422be325dfde77ac5b01cdc5929bbd701d6638 /sql/item_subselect.cc
parentecd4bf62d439b300facb4d5758c4670e6c96b7c5 (diff)
downloadmariadb-git-495fd27c0e3781013904666f302a3d3e4f011e50.tar.gz
MDEV-4284 Assertion `cmp_items[(uint)cmp_type]' fails in sql/item_cmpfunc.cc
Flip the switch and create Item_cache based on the argument's cmp_type, not argument's result_type(). Fix subselect_engine to calculate cmp_type correctly sql/item_subselect.h: mdev:4284
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r--sql/item_subselect.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 152b50da616..9042e92f1da 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -1087,6 +1087,11 @@ enum Item_result Item_singlerow_subselect::result_type() const
return engine->type();
}
+enum Item_result Item_singlerow_subselect::cmp_type() const
+{
+ return engine->cmptype();
+}
+
/*
Don't rely on the result type to calculate field type.
Ask the engine instead.
@@ -3044,12 +3049,13 @@ void subselect_engine::set_row(List<Item> &item_list, Item_cache **row)
{
Item *sel_item;
List_iterator_fast<Item> li(item_list);
- res_type= STRING_RESULT;
+ cmp_type= res_type= STRING_RESULT;
res_field_type= MYSQL_TYPE_VAR_STRING;
for (uint i= 0; (sel_item= li++); i++)
{
item->max_length= sel_item->max_length;
res_type= sel_item->result_type();
+ cmp_type= sel_item->cmp_type();
res_field_type= sel_item->field_type();
item->decimals= sel_item->decimals;
item->unsigned_flag= sel_item->unsigned_flag;
@@ -3060,7 +3066,7 @@ void subselect_engine::set_row(List<Item> &item_list, Item_cache **row)
//psergey-backport-timours: row[i]->store(sel_item);
}
if (item_list.elements > 1)
- res_type= ROW_RESULT;
+ cmp_type= res_type= ROW_RESULT;
}
void subselect_single_select_engine::fix_length_and_dec(Item_cache **row)