diff options
author | unknown <monty@mysql.com> | 2005-02-07 18:13:57 +0200 |
---|---|---|
committer | unknown <monty@mysql.com> | 2005-02-07 18:13:57 +0200 |
commit | 9d01e93c298048d1e1a184797248d6cec19e983e (patch) | |
tree | 3fa14495db5e1376fa69b1a6f662a5e7afdc82da /mysql-test/r/group_by.result | |
parent | 9641fc85e96add76e7c9d74925b909af3bd2648f (diff) | |
download | mariadb-git-9d01e93c298048d1e1a184797248d6cec19e983e.tar.gz |
Fixed bug in HAVING when refering to RAND() through alias
(BUG 8216)
mysql-test/r/group_by.result:
New test case
mysql-test/r/user_var.result:
Test changed (to be more correct) with bug fix
mysql-test/t/group_by.test:
Added test for HAVING bug
sql/item_cmpfunc.cc:
Fixed bug in HAVING when refering to RAND()
sql/item_func.cc:
Fixed bug in HAVING when refering to RAND()
sql/item_row.cc:
Fixed bug in HAVING when refering to RAND()
sql/item_strfunc.cc:
Fixed bug in HAVING when refering to RAND()
sql/unireg.h:
Added PSEUDO_TABLES_BITS for easy testing of real table reference
Diffstat (limited to 'mysql-test/r/group_by.result')
-rw-r--r-- | mysql-test/r/group_by.result | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index f92b3ea4f4d..17b1bb03d1d 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -629,15 +629,6 @@ explain SELECT i, COUNT(DISTINCT(i)) FROM t1 GROUP BY j ORDER BY NULL; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort DROP TABLE t1; -create table t1 ( col1 int, col2 int ); -insert into t1 values (1,1),(1,2),(1,3),(2,1),(2,2); -select group_concat( distinct col1 ) as alias from t1 -group by col2 having alias like '%'; -alias -1,2 -1,2 -1 -drop table t1; create table t1 (a int); insert into t1 values(null); select min(a) is null from t1; @@ -650,3 +641,39 @@ select 1 and min(a) is null from t1; 1 and min(a) is null 1 drop table t1; +create table t1 ( col1 int, col2 int ); +insert into t1 values (1,1),(1,2),(1,3),(2,1),(2,2); +select group_concat( distinct col1 ) as alias from t1 +group by col2 having alias like '%'; +alias +1,2 +1,2 +1 +drop table t1; +create table t1 (a integer, b integer, c integer); +insert into t1 (a,b) values (1,2),(1,3),(2,5); +select a, 0.1*0+1 r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2=1; +a r2 r1 +1 1.0 2 +select a, rand()*0+1 r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2=1; +a r2 r1 +1 1 2 +select a,sum(b) from t1 where a=1 group by c; +a sum(b) +1 5 +select a*sum(b) from t1 where a=1 group by c; +a*sum(b) +5 +select sum(a)*sum(b) from t1 where a=1 group by c; +sum(a)*sum(b) +10 +select a,sum(b) from t1 where a=1 group by c having a=1; +a sum(b) +1 5 +select a as d,sum(b) from t1 where a=1 group by c having d=1; +d sum(b) +1 5 +select sum(a)*sum(b) as d from t1 where a=1 group by c having d > 0; +d +10 +drop table t1; |