diff options
author | unknown <timour@mysql.com> | 2004-10-29 18:20:09 +0300 |
---|---|---|
committer | unknown <timour@mysql.com> | 2004-10-29 18:20:09 +0300 |
commit | 4cdb957bf609d0c82db377632e8a0c56907dc6f8 (patch) | |
tree | 2df5c2d7a297deac3e4fe1a58de23c83e187a212 /mysql-test/t/group_min_max.test | |
parent | bbfb40404f18f718a7fa400057f3971d11f7578a (diff) | |
download | mariadb-git-4cdb957bf609d0c82db377632e8a0c56907dc6f8.tar.gz |
Fix for BUG#6303 + fix for discovered bug with sub-queries when analyzin queries for MIN/MAX optimization (WL#1724).
BitKeeper/etc/ignore:
Added stamp-h1.in stamp-h2.in to the ignore list
mysql-test/t/group_min_max.test:
- Added test for BUG#6303
- Added test for MIN/MAX optimizable queries with subqueries
sql/opt_range.cc:
- check_group_min_max_predicates should not be called when there is no MIN/MAX function
- skip queries from GROUP BY with MIN/MAX optimization when there is a subselect in the WHERE clause
Diffstat (limited to 'mysql-test/t/group_min_max.test')
-rw-r--r-- | mysql-test/t/group_min_max.test | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test index 677b3ecf7ec..5b48f89470d 100644 --- a/mysql-test/t/group_min_max.test +++ b/mysql-test/t/group_min_max.test @@ -372,6 +372,17 @@ 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 > 'b111') and (c <= 'g112')) or ((c > 'd000') and (c <= 'i110')) group by a1,a2,b; +#-- analyze the sub-select +#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; + +#-- the sub-select is unrelated to MIN/MAX +#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; + + -- A,B,C) Predicates referencing mixed classes of attributes -- plans 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; @@ -463,6 +474,11 @@ 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 b from t2 where (a2 >= 'b') and (b = 'a'); +#-- BUG 6303 +#select distinct t_00.a1 +#from t1 t_00 +#where exists ( select * from t2 where a1 = t_00.a1 ); + -- -- DISTINCT queries with GROUP-BY |