Commit e6cd5437 authored by bar@bar.mysql.r18.ru's avatar bar@bar.mysql.r18.ru

IN now aggregates all argument types for comparison

parent c8ecb452
...@@ -143,3 +143,24 @@ select * from t1 where 'a' in (a,b,c collate latin1_bin); ...@@ -143,3 +143,24 @@ select * from t1 where 'a' in (a,b,c collate latin1_bin);
a b c a b c
a c c a c c
drop table t1; drop table t1;
select '1.0' in (1,2);
'1.0' in (1,2)
1
select 1 in ('1.0',2);
1 in ('1.0',2)
1
select 1 in (1,'2.0');
1 in (1,'2.0')
1
select 1 in ('1.0',2.0);
1 in ('1.0',2.0)
1
select 1 in (1.0,'2.0');
1 in (1.0,'2.0')
1
select 1 in ('1.1',2);
1 in ('1.1',2)
0
select 1 in ('1.1',2.0);
1 in ('1.1',2.0)
0
...@@ -73,3 +73,11 @@ select * from t1 where 'a' collate latin1_general_ci in (a,b,c); ...@@ -73,3 +73,11 @@ select * from t1 where 'a' collate latin1_general_ci in (a,b,c);
select * from t1 where 'a' collate latin1_bin in (a,b,c); select * from t1 where 'a' collate latin1_bin in (a,b,c);
select * from t1 where 'a' in (a,b,c collate latin1_bin); select * from t1 where 'a' in (a,b,c collate latin1_bin);
drop table t1; drop table t1;
select '1.0' in (1,2);
select 1 in ('1.0',2);
select 1 in (1,'2.0');
select 1 in ('1.0',2.0);
select 1 in (1.0,'2.0');
select 1 in ('1.1',2);
select 1 in ('1.1',2.0);
...@@ -1405,7 +1405,8 @@ void Item_func_in::fix_length_and_dec() ...@@ -1405,7 +1405,8 @@ void Item_func_in::fix_length_and_dec()
Item **arg, **arg_end; Item **arg, **arg_end;
uint const_itm= 1; uint const_itm= 1;
if ((args[0]->result_type() == STRING_RESULT) && agg_cmp_type(&cmp_type, args, arg_count);
if ((cmp_type == STRING_RESULT) &&
(agg_arg_collations_for_comparison(cmp_collation, args, arg_count))) (agg_arg_collations_for_comparison(cmp_collation, args, arg_count)))
return; return;
...@@ -1418,7 +1419,7 @@ void Item_func_in::fix_length_and_dec() ...@@ -1418,7 +1419,7 @@ void Item_func_in::fix_length_and_dec()
*/ */
if (const_itm && !nulls_in_row()) if (const_itm && !nulls_in_row())
{ {
switch (args[0]->result_type()) { switch (cmp_type) {
case STRING_RESULT: case STRING_RESULT:
uint i; uint i;
array=new in_string(arg_count-1,(qsort2_cmp) srtcmp_in, array=new in_string(arg_count-1,(qsort2_cmp) srtcmp_in,
...@@ -1452,7 +1453,7 @@ void Item_func_in::fix_length_and_dec() ...@@ -1452,7 +1453,7 @@ void Item_func_in::fix_length_and_dec()
else else
{ {
in_item= cmp_item::get_comparator(args[0]); in_item= cmp_item::get_comparator(args[0]);
if (args[0]->result_type() == STRING_RESULT) if (cmp_type == STRING_RESULT)
in_item->cmp_charset= cmp_collation.collation; in_item->cmp_charset= cmp_collation.collation;
} }
maybe_null= args[0]->maybe_null; maybe_null= args[0]->maybe_null;
......
...@@ -611,6 +611,7 @@ public: ...@@ -611,6 +611,7 @@ public:
class Item_func_in :public Item_int_func class Item_func_in :public Item_int_func
{ {
Item_result cmp_type;
in_vector *array; in_vector *array;
cmp_item *in_item; cmp_item *in_item;
bool have_null; bool have_null;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment