mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Minor fixes of the patch for BUG#6303
This commit is contained in:
@ -1354,6 +1354,18 @@ c a a b311 d311
|
|||||||
c a b e312 h312
|
c a b e312 h312
|
||||||
d a a b411 d411
|
d a a b411 d411
|
||||||
d a b e412 h412
|
d a b e412 h412
|
||||||
|
explain select a1,a2,b,min(c),max(c) from t1
|
||||||
|
where exists ( select * from t2 where t2.c = t1.c )
|
||||||
|
group by a1,a2,b;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index
|
||||||
|
2 DEPENDENT SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
|
||||||
|
explain select a1,a2,b,min(c),max(c) from t1
|
||||||
|
where exists ( select * from t2 where t2.c > 'b1' )
|
||||||
|
group by a1,a2,b;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by
|
||||||
|
2 SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using index
|
||||||
explain select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
|
explain select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by
|
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by
|
||||||
@ -1637,6 +1649,14 @@ a1 a2 b
|
|||||||
select distinct b from t2 where (a2 >= 'b') and (b = 'a');
|
select distinct b from t2 where (a2 >= 'b') and (b = 'a');
|
||||||
b
|
b
|
||||||
a
|
a
|
||||||
|
select distinct t_00.a1
|
||||||
|
from t1 t_00
|
||||||
|
where exists ( select * from t2 where a1 = t_00.a1 );
|
||||||
|
a1
|
||||||
|
a
|
||||||
|
b
|
||||||
|
c
|
||||||
|
d
|
||||||
explain select distinct a1,a2,b from t1;
|
explain select distinct a1,a2,b from t1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by
|
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by
|
||||||
|
@ -372,15 +372,15 @@ select a1,a2,b,min(c),max(c) from t2 where (c > 'b111') and (c <= 'g112') group
|
|||||||
select a1,a2,b,min(c),max(c) from t2 where (c < 'c5') or (c = 'g412') or (c = 'k421') group by a1,a2,b;
|
select a1,a2,b,min(c),max(c) from t2 where (c < 'c5') or (c = 'g412') or (c = 'k421') group by a1,a2,b;
|
||||||
select a1,a2,b,min(c),max(c) from t2 where ((c > 'b111') and (c <= 'g112')) or ((c > 'd000') and (c <= 'i110')) group by a1,a2,b;
|
select a1,a2,b,min(c),max(c) from t2 where ((c > 'b111') and (c <= 'g112')) or ((c > 'd000') and (c <= 'i110')) group by a1,a2,b;
|
||||||
|
|
||||||
#-- analyze the sub-select
|
-- analyze the sub-select
|
||||||
#explain select a1,a2,b,min(c),max(c) from t1
|
explain select a1,a2,b,min(c),max(c) from t1
|
||||||
#where exists ( select * from t2 where t2.c = t1.c )
|
where exists ( select * from t2 where t2.c = t1.c )
|
||||||
#group by a1,a2,b;
|
group by a1,a2,b;
|
||||||
|
|
||||||
#-- the sub-select is unrelated to MIN/MAX
|
-- the sub-select is unrelated to MIN/MAX
|
||||||
#explain select a1,a2,b,min(c),max(c) from t1
|
explain select a1,a2,b,min(c),max(c) from t1
|
||||||
#where exists ( select * from t2 where t2.c > 'b1' )
|
where exists ( select * from t2 where t2.c > 'b1' )
|
||||||
#group by a1,a2,b;
|
group by a1,a2,b;
|
||||||
|
|
||||||
|
|
||||||
-- A,B,C) Predicates referencing mixed classes of attributes
|
-- A,B,C) Predicates referencing mixed classes of attributes
|
||||||
@ -474,10 +474,10 @@ select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121
|
|||||||
select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
|
select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
|
||||||
select distinct b from t2 where (a2 >= 'b') and (b = 'a');
|
select distinct b from t2 where (a2 >= 'b') and (b = 'a');
|
||||||
|
|
||||||
#-- BUG 6303
|
-- BUG 6303
|
||||||
#select distinct t_00.a1
|
select distinct t_00.a1
|
||||||
#from t1 t_00
|
from t1 t_00
|
||||||
#where exists ( select * from t2 where a1 = t_00.a1 );
|
where exists ( select * from t2 where a1 = t_00.a1 );
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@ -6965,8 +6965,9 @@ check_group_min_max_predicates(COND *cond, Item_field *min_max_arg_item,
|
|||||||
if (cur_arg->type() == Item::FIELD_ITEM)
|
if (cur_arg->type() == Item::FIELD_ITEM)
|
||||||
{
|
{
|
||||||
if (min_max_arg_item->eq(cur_arg, 1))
|
if (min_max_arg_item->eq(cur_arg, 1))
|
||||||
{/*
|
{
|
||||||
If pred references the MIN/MAX argument check whether pred is a range
|
/*
|
||||||
|
If pred references the MIN/MAX argument, check whether pred is a range
|
||||||
condition that compares the MIN/MAX argument with a constant.
|
condition that compares the MIN/MAX argument with a constant.
|
||||||
*/
|
*/
|
||||||
Item_func::Functype pred_type= pred->functype();
|
Item_func::Functype pred_type= pred->functype();
|
||||||
|
Reference in New Issue
Block a user