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
05c4f3f3
Commit
05c4f3f3
authored
Nov 06, 2009
by
Alexey Kopytov
Browse files
Options
Browse Files
Download
Plain Diff
Automerge.
parents
eb03f819
39f9a3ff
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
7 deletions
+41
-7
mysql-test/r/olap.result
mysql-test/r/olap.result
+12
-0
mysql-test/t/olap.test
mysql-test/t/olap.test
+13
-0
sql/sql_select.cc
sql/sql_select.cc
+16
-7
No files found.
mysql-test/r/olap.result
View file @
05c4f3f3
...
@@ -753,4 +753,16 @@ b
...
@@ -753,4 +753,16 @@ b
100
100
NULL
NULL
DROP TABLE t1, t2;
DROP TABLE t1, t2;
#
# Bug #48475: DISTINCT is ignored with GROUP BY WITH ROLLUP
# and only const tables
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (b INT);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
SELECT DISTINCT b FROM t1, t2 GROUP BY a, b WITH ROLLUP;
b
1
NULL
DROP TABLE t1, t2;
End of 5.0 tests
End of 5.0 tests
mysql-test/t/olap.test
View file @
05c4f3f3
...
@@ -390,4 +390,17 @@ SELECT DISTINCT b FROM t1, t2 GROUP BY a, b WITH ROLLUP;
...
@@ -390,4 +390,17 @@ SELECT DISTINCT b FROM t1, t2 GROUP BY a, b WITH ROLLUP;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# Bug #48475: DISTINCT is ignored with GROUP BY WITH ROLLUP
--
echo
# and only const tables
CREATE
TABLE
t1
(
a
INT
);
CREATE
TABLE
t2
(
b
INT
);
INSERT
INTO
t1
VALUES
(
1
);
INSERT
INTO
t2
VALUES
(
1
);
SELECT
DISTINCT
b
FROM
t1
,
t2
GROUP
BY
a
,
b
WITH
ROLLUP
;
DROP
TABLE
t1
,
t2
;
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
sql/sql_select.cc
View file @
05c4f3f3
...
@@ -982,14 +982,20 @@ JOIN::optimize()
...
@@ -982,14 +982,20 @@ JOIN::optimize()
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
}
}
if
(
select_lex
->
olap
==
ROLLUP_TYPE
&&
rollup_process_const_fields
())
if
(
rollup
.
state
!=
ROLLUP
::
STATE_NONE
)
{
if
(
rollup_process_const_fields
())
{
{
DBUG_PRINT
(
"error"
,
(
"Error: rollup_process_fields() failed"
));
DBUG_PRINT
(
"error"
,
(
"Error: rollup_process_fields() failed"
));
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
}
}
}
else
{
/* Remove distinct if only const tables */
/* Remove distinct if only const tables */
select_distinct
=
select_distinct
&&
(
const_tables
!=
tables
);
select_distinct
=
select_distinct
&&
(
const_tables
!=
tables
);
}
thd_proc_info
(
thd
,
"preparing"
);
thd_proc_info
(
thd
,
"preparing"
);
if
(
result
->
initialize_tables
(
this
))
if
(
result
->
initialize_tables
(
this
))
{
{
...
@@ -1288,11 +1294,14 @@ JOIN::optimize()
...
@@ -1288,11 +1294,14 @@ JOIN::optimize()
- We are using an ORDER BY or GROUP BY on fields not in the first table
- We are using an ORDER BY or GROUP BY on fields not in the first table
- We are using different ORDER BY and GROUP BY orders
- We are using different ORDER BY and GROUP BY orders
- The user wants us to buffer the result.
- The user wants us to buffer the result.
When the WITH ROLLUP modifier is present, we cannot skip temporary table
creation for the DISTINCT clause just because there are only const tables.
*/
*/
need_tmp
=
(
const_tables
!=
tables
&&
need_tmp
=
(
(
const_tables
!=
tables
&&
((
select_distinct
||
!
simple_order
||
!
simple_group
)
||
((
select_distinct
||
!
simple_order
||
!
simple_group
)
||
(
group_list
&&
order
)
||
(
group_list
&&
order
)
||
test
(
select_options
&
OPTION_BUFFER_RESULT
)));
test
(
select_options
&
OPTION_BUFFER_RESULT
)))
||
rollup
.
state
!=
ROLLUP
::
STATE_NONE
&&
select_distinct
);
// No cache for MATCH
// No cache for MATCH
make_join_readinfo
(
this
,
make_join_readinfo
(
this
,
...
...
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