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
2cda7f5d
Commit
2cda7f5d
authored
Jun 28, 2006
by
gkodinov@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
4.1->5.0 merge for bug #16458
parent
7149f48d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
mysql-test/r/distinct.result
mysql-test/r/distinct.result
+1
-1
sql/sql_select.cc
sql/sql_select.cc
+7
-3
No files found.
mysql-test/r/distinct.result
View file @
2cda7f5d
...
@@ -537,7 +537,7 @@ id select_type table type possible_keys key key_len ref rows Extra
...
@@ -537,7 +537,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL PRIMARY 8 NULL 3 Using index
1 SIMPLE t2 index NULL PRIMARY 8 NULL 3 Using index
EXPLAIN SELECT DISTINCT a,a FROM t2;
EXPLAIN SELECT DISTINCT a,a FROM t2;
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 t2 index NULL PRIMARY 8 NULL 3 Using index
; Using temporary
1 SIMPLE t2 index NULL PRIMARY 8 NULL 3 Using index
EXPLAIN SELECT DISTINCT b,a FROM t2;
EXPLAIN SELECT DISTINCT b,a FROM t2;
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 t2 index NULL PRIMARY 8 NULL 3 Using index
1 SIMPLE t2 index NULL PRIMARY 8 NULL 3 Using index
...
...
sql/sql_select.cc
View file @
2cda7f5d
...
@@ -874,7 +874,11 @@ JOIN::optimize()
...
@@ -874,7 +874,11 @@ JOIN::optimize()
The FROM clause must contain a single non-constant table.
The FROM clause must contain a single non-constant table.
*/
*/
if
(
tables
-
const_tables
==
1
&&
(
group_list
||
select_distinct
)
&&
if
(
tables
-
const_tables
==
1
&&
(
group_list
||
select_distinct
)
&&
!
tmp_table_param
.
sum_func_count
)
!
tmp_table_param
.
sum_func_count
&&
(
!
join_tab
[
const_tables
].
select
||
!
join_tab
[
const_tables
].
select
->
quick
||
join_tab
[
const_tables
].
select
->
quick
->
get_type
()
!=
QUICK_SELECT_I
::
QS_TYPE_GROUP_MIN_MAX
))
{
{
if
(
group_list
&&
if
(
group_list
&&
list_contains_unique_index
(
join_tab
[
const_tables
].
table
,
list_contains_unique_index
(
join_tab
[
const_tables
].
table
,
...
@@ -11279,9 +11283,9 @@ static bool
...
@@ -11279,9 +11283,9 @@ static bool
list_contains_unique_index
(
TABLE
*
table
,
list_contains_unique_index
(
TABLE
*
table
,
bool
(
*
find_func
)
(
Field
*
,
void
*
),
void
*
data
)
bool
(
*
find_func
)
(
Field
*
,
void
*
),
void
*
data
)
{
{
for
(
uint
keynr
=
0
;
keynr
<
table
->
keys
;
keynr
++
)
for
(
uint
keynr
=
0
;
keynr
<
table
->
s
->
keys
;
keynr
++
)
{
{
if
(
keynr
==
table
->
primary_key
||
if
(
keynr
==
table
->
s
->
primary_key
||
(
table
->
key_info
[
keynr
].
flags
&
HA_NOSAME
))
(
table
->
key_info
[
keynr
].
flags
&
HA_NOSAME
))
{
{
KEY
*
keyinfo
=
table
->
key_info
+
keynr
;
KEY
*
keyinfo
=
table
->
key_info
+
keynr
;
...
...
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