diff options
author | unknown <igor@rurik.mysql.com> | 2005-05-30 03:01:51 -0700 |
---|---|---|
committer | unknown <igor@rurik.mysql.com> | 2005-05-30 03:01:51 -0700 |
commit | 5a548200037183e1afeaccc6bc5f34c09420abe0 (patch) | |
tree | ce45837598480961456b95e1d42beee07c932bed /mysql-test/t/olap.test | |
parent | 755d2018ada199005b70b4836f6fbb56e2e7b892 (diff) | |
download | mariadb-git-5a548200037183e1afeaccc6bc5f34c09420abe0.tar.gz |
olap.result, olap.test:
Added test cases for bug #7894.
sql_select.cc:
Fixed bug #7894: GROUP BY queries with ROLLUP returned
wrong results for expressions containing group by columns.
The fix ensured correct results by replacement of all
occurrences of group by fields in non-aggregate expressions
for corresponding ref objects and preventing creation of
fields in temporary tables for expression containing group
by fields.
sql/sql_select.cc:
Fixed bug #7894: GROUP BY queries with ROLLUP returned
wrong results for expressions containing group by columns.
The fix ensured correct results by replacement of all
occurrences of group by fields in non-aggregate expressions
for corresponding ref objects and preventing creation of
fields in temporary tables for expression containing group
by fields.
mysql-test/t/olap.test:
Added test cases for bug #7894.
mysql-test/r/olap.result:
Added test cases for bug #7894.
Diffstat (limited to 'mysql-test/t/olap.test')
-rw-r--r-- | mysql-test/t/olap.test | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/mysql-test/t/olap.test b/mysql-test/t/olap.test index 09ba537bf3b..b9387d15320 100644 --- a/mysql-test/t/olap.test +++ b/mysql-test/t/olap.test @@ -208,3 +208,33 @@ SELECT a, SUM(a), SUM(a)+1, CONCAT(SUM(a),'x'), SUM(a)+SUM(a), SUM(a) DROP TABLE t1; +# +# Tests for bug #7894: ROLLUP over expressions on group by attributes +# + +CREATE TABLE t1 (a int(11)); +INSERT INTO t1 VALUES (1),(2); + +SELECT a, a+1, SUM(a) FROM t1 GROUP BY a WITH ROLLUP; +SELECT a+1 FROM t1 GROUP BY a WITH ROLLUP; +SELECT a+SUM(a) FROM t1 GROUP BY a WITH ROLLUP; +SELECT a, a+1 as b FROM t1 GROUP BY a WITH ROLLUP HAVING b > 2; +SELECT a, a+1 as b FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL; +SELECT a, a+1 as b FROM t1 GROUP BY a WITH ROLLUP HAVING b IS NULL; +SELECT IFNULL(a, 'TEST') FROM t1 GROUP BY a WITH ROLLUP; + +CREATE TABLE t2 (a int, b int); +INSERT INTO t2 VALUES + (1,4), + (2,2), (2,2), + (4,1), (4,1), (4,1), (4,1), + (2,1), (2,1); + +SELECT a,b,SUM(b) FROM t2 GROUP BY a,b WITH ROLLUP; +SELECT a,b,SUM(b), a+b as c FROM t2 + GROUP BY a,b WITH ROLLUP HAVING c IS NULL; +SELECT IFNULL(a, 'TEST'), COALESCE(b, 'TEST') FROM t2 + GROUP BY a, b WITH ROLLUP; + +DROP TABLE t1,t2; + |