Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
157dfcf4
Commit
157dfcf4
authored
Nov 01, 2004
by
timour@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor fixes of the patch for BUG#6303
parent
b67f8672
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
14 deletions
+35
-14
mysql-test/r/group_min_max.result
mysql-test/r/group_min_max.result
+20
-0
mysql-test/t/group_min_max.test
mysql-test/t/group_min_max.test
+12
-12
sql/opt_range.cc
sql/opt_range.cc
+3
-2
No files found.
mysql-test/r/group_min_max.result
View file @
157dfcf4
...
@@ -1354,6 +1354,18 @@ c a a b311 d311
...
@@ -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
...
@@ -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
...
...
mysql-test/t/group_min_max.test
View file @
157dfcf4
...
@@ -372,15 +372,15 @@ select a1,a2,b,min(c),max(c) from t2 where (c > 'b111') and (c <= 'g112') group
...
@@ -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
...
@@ -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 );
--
--
...
...
sql/opt_range.cc
View file @
157dfcf4
...
@@ -6965,8 +6965,9 @@ check_group_min_max_predicates(COND *cond, Item_field *min_max_arg_item,
...
@@ -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
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment