diff options
author | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2009-11-06 09:44:01 +0300 |
---|---|---|
committer | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2009-11-06 09:44:01 +0300 |
commit | 39f9a3ffd0de8828be2a43b9674a19fa58c52f98 (patch) | |
tree | deebaa6d3b8c53f993b541d23de94fc1a893f385 /mysql-test/r/olap.result | |
parent | 43358bccd1227d8b7a28c64b1e2e262ab8f643d2 (diff) | |
download | mariadb-git-39f9a3ffd0de8828be2a43b9674a19fa58c52f98.tar.gz |
Bug #48475: DISTINCT is ignored with GROUP BY WITH ROLLUP and
only const tables
The problem was caused by two shortcuts in the optimizer that
are inapplicable in the ROLLUP case.
Normally in a case when only const tables are involved in a
query, DISTINCT clause can be safely optimized away since there
may be only one row produced by the join. Similarly, we don't
need to create a temporary table to resolve DISTINCT/GROUP
BY/ORDER BY. Both of these are inapplicable when the WITH
ROLLUP modifier is present.
Fixed by disabling the said optimizations for the WITH ROLLUP
case.
mysql-test/r/olap.result:
Added a test case for bug #48475.
mysql-test/t/olap.test:
Added a test case for bug #48475.
sql/sql_select.cc:
Disabled const-only table optimizations for the WITH ROLLUP
case.
Diffstat (limited to 'mysql-test/r/olap.result')
-rw-r--r-- | mysql-test/r/olap.result | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/mysql-test/r/olap.result b/mysql-test/r/olap.result index 56e06f03378..eabe3a50309 100644 --- a/mysql-test/r/olap.result +++ b/mysql-test/r/olap.result @@ -753,4 +753,16 @@ b 100 NULL 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 |