diff options
Diffstat (limited to 'mysql-test/t')
-rw-r--r-- | mysql-test/t/olap.test | 22 | ||||
-rw-r--r-- | mysql-test/t/type_datetime.test | 4 |
2 files changed, 20 insertions, 6 deletions
diff --git a/mysql-test/t/olap.test b/mysql-test/t/olap.test index e6cbfe3166c..05934bff492 100644 --- a/mysql-test/t/olap.test +++ b/mysql-test/t/olap.test @@ -292,6 +292,25 @@ select left(a,10), a, sum(b) from t1 group by 1,2 with rollup; select left(a,10) x, a, sum(b) from t1 group by x,a with rollup; drop table t1; +# +# Bug #24856: ROLLUP by const item in a query with DISTINCT +# + +CREATE TABLE t1 (a int, b int); +INSERT INTO t1 + VALUES (2,10),(3,30),(2,40),(1,10),(2,30),(1,20),(2,10); + +SELECT a, SUM(b) FROM t1 GROUP BY a WITH ROLLUP; +SELECT DISTINCT a, SUM(b) FROM t1 GROUP BY a WITH ROLLUP; +SELECT a, b, COUNT(*) FROM t1 GROUP BY a,b WITH ROLLUP; +SELECT DISTINCT a, b, COUNT(*) FROM t1 GROUP BY a,b WITH ROLLUP; + +SELECT 'x', a, SUM(b) FROM t1 GROUP BY 1,2 WITH ROLLUP; +SELECT DISTINCT 'x', a, SUM(b) FROM t1 GROUP BY 1,2 WITH ROLLUP; +SELECT DISTINCT 'x', a, SUM(b) FROM t1 GROUP BY 1,2 WITH ROLLUP; + +DROP TABLE t1; + # End of 4.1 tests # @@ -339,6 +358,3 @@ SELECT * FROM (SELECT a, SUM(a) FROM t1 GROUP BY a WITH ROLLUP) as t; DROP TABLE t1; - - - diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index eeed14acf15..cdf0e1464dc 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -157,9 +157,7 @@ select f1, f3 from t1 where f1 >= '2001-02-05 00:00:00' and f3 <= '2001-04-15'; select f1, f3 from t1 where f1 >= '2001-2-5 0:0:0' and f2 <= '2001-4-15'; select f1, f2 from t1 where if(1, f1, 0) >= f2; select 1 from dual where cast('2001-1-1 2:3:4' as date) = cast('2001-01-01' as datetime); -select f1, f2, UNIX_TIMESTAMP(f2), UNIX_TIMESTAMP(f1), - f1 > f2, f1 = f2, f1 < f2 - from t1; +select f1, f2, f1 > f2, f1 = f2, f1 < f2 from t1; drop table t1; # |