mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
IN now aggregates all argument types for comparison
This commit is contained in:
@ -143,3 +143,24 @@ select * from t1 where 'a' in (a,b,c collate latin1_bin);
|
||||
a b c
|
||||
a c c
|
||||
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);
|
||||
select * from t1 where 'a' collate latin1_bin in (a,b,c);
|
||||
select * from t1 where 'a' in (a,b,c collate latin1_bin);
|
||||
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()
|
||||
Item **arg, **arg_end;
|
||||
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)))
|
||||
return;
|
||||
|
||||
@ -1418,7 +1419,7 @@ void Item_func_in::fix_length_and_dec()
|
||||
*/
|
||||
if (const_itm && !nulls_in_row())
|
||||
{
|
||||
switch (args[0]->result_type()) {
|
||||
switch (cmp_type) {
|
||||
case STRING_RESULT:
|
||||
uint i;
|
||||
array=new in_string(arg_count-1,(qsort2_cmp) srtcmp_in,
|
||||
@ -1452,7 +1453,7 @@ void Item_func_in::fix_length_and_dec()
|
||||
else
|
||||
{
|
||||
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;
|
||||
}
|
||||
maybe_null= args[0]->maybe_null;
|
||||
|
@ -611,6 +611,7 @@ public:
|
||||
|
||||
class Item_func_in :public Item_int_func
|
||||
{
|
||||
Item_result cmp_type;
|
||||
in_vector *array;
|
||||
cmp_item *in_item;
|
||||
bool have_null;
|
||||
|
Reference in New Issue
Block a user