summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2006-05-30 19:16:30 +0400
committerunknown <evgen@moonbone.local>2006-05-30 19:16:30 +0400
commit7b639f05f8916537bf3d6e36c7e07b2e80be8f49 (patch)
tree124637154b2ebae6aa7b8032d151173f289dedb0 /sql/item_cmpfunc.cc
parentc56193330101e6dfeb6afd43f76553aae8a3929e (diff)
parenta9824f263dcaedaabfbbc9e398eb55117f19a41f (diff)
downloadmariadb-git-7b639f05f8916537bf3d6e36c7e07b2e80be8f49.tar.gz
Manually merged
mysql-test/t/func_in.test: Auto merged
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 725be547a8a..1701af2325f 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -76,11 +76,19 @@ static void agg_cmp_type(THD *thd, Item_result *type, Item **items, uint nitems)
field= NULL;
type[0]= items[0]->result_type();
- for (i= 1; i < nitems; i++)
+ /* Reset to 0 on first occurence of non-const item. 1 otherwise */
+ bool is_const= items[0]->const_item();
+
+ for (i= 1 ; i < nitems ; i++)
{
- type[0]= item_cmp_type(type[0], items[i]->result_type());
- if (field && convert_constant_item(thd, field, &items[i]))
- type[0]= INT_RESULT;
+ if (!items[i]->const_item())
+ {
+ type[0]= is_const ? items[i]->result_type() :
+ item_cmp_type(type[0], items[i]->result_type());
+ is_const= 0;
+ }
+ else if (is_const)
+ type[0]= item_cmp_type(type[0], items[i]->result_type());
}
}