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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
7a211296
Commit
7a211296
authored
Nov 24, 2005
by
evgen@moonbone.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0
into moonbone.local:/work/13293-bug-5.0-mysql
parents
01de5ef5
e093fb1f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
0 deletions
+33
-0
mysql-test/r/group_min_max.result
mysql-test/r/group_min_max.result
+10
-0
mysql-test/t/group_min_max.test
mysql-test/t/group_min_max.test
+10
-0
sql/opt_range.cc
sql/opt_range.cc
+13
-0
No files found.
mysql-test/r/group_min_max.result
View file @
7a211296
...
...
@@ -2002,3 +2002,13 @@ a count(a)
1 1
NULL 1
drop table t1;
create table t1 (f1 int, f2 char(1), primary key(f1,f2)) engine=innodb;
insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d");
alter table t1 drop primary key, add primary key (f2, f1);
explain select distinct f1 a, f1 b from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index; Using temporary
explain select distinct f1, f2 from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL PRIMARY 5 NULL 3 Using index for group-by; Using temporary
drop table t1;
mysql-test/t/group_min_max.test
View file @
7a211296
...
...
@@ -693,3 +693,13 @@ create table t1(a int, key(a)) engine=innodb;
insert
into
t1
values
(
1
);
select
a
,
count
(
a
)
from
t1
group
by
a
with
rollup
;
drop
table
t1
;
#
# Bug #13293 Wrongly used index results in endless loop.
#
create
table
t1
(
f1
int
,
f2
char
(
1
),
primary
key
(
f1
,
f2
))
engine
=
innodb
;
insert
into
t1
values
(
1
,
"e"
),(
2
,
"a"
),(
3
,
"c"
),(
4
,
"d"
);
alter
table
t1
drop
primary
key
,
add
primary
key
(
f2
,
f1
);
explain
select
distinct
f1
a
,
f1
b
from
t1
;
explain
select
distinct
f1
,
f2
from
t1
;
drop
table
t1
;
sql/opt_range.cc
View file @
7a211296
...
...
@@ -7197,6 +7197,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
{
select_items_it
.
rewind
();
cur_used_key_parts
.
clear_all
();
uint
max_key_part
=
0
;
while
((
item
=
select_items_it
++
))
{
item_field
=
(
Item_field
*
)
item
;
/* (SA5) already checked above. */
...
...
@@ -7214,7 +7215,19 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
cur_group_prefix_len
+=
cur_part
->
store_length
;
cur_used_key_parts
.
set_bit
(
key_part_nr
);
++
cur_group_key_parts
;
max_key_part
=
max
(
max_key_part
,
key_part_nr
);
}
/*
Check that used key parts forms a prefix of the index.
To check this we compare bits in all_parts and cur_parts.
all_parts have all bits set from 0 to (max_key_part-1).
cur_parts have bits set for only used keyparts.
*/
ulonglong
all_parts
,
cur_parts
;
all_parts
=
(
1
<<
max_key_part
)
-
1
;
cur_parts
=
cur_used_key_parts
.
to_ulonglong
()
>>
1
;
if
(
all_parts
!=
cur_parts
)
goto
next_index
;
}
else
DBUG_ASSERT
(
FALSE
);
...
...
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