summaryrefslogtreecommitdiff
path: root/mysql-test/t/select.test
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2005-10-14 01:22:24 +0400
committerunknown <evgen@moonbone.local>2005-10-14 01:22:24 +0400
commit0390de8672255aed7d35734fa8bc0d87efbe532e (patch)
treee887a6ffbda953ab8bcb31e4c30fe52a546b8f43 /mysql-test/t/select.test
parentf4e6fca1bdc9fbf67cff12723c3f9fe15bb72956 (diff)
downloadmariadb-git-0390de8672255aed7d35734fa8bc0d87efbe532e.tar.gz
Fix bug #13855 select distinct with group by caused server crash
DISTINCT wasn't optimized away and caused creation of tmp table in wrong case. This result in integer overrun and running out of memory. Fix backported from 4.1. Now if optimizer founds that in result be only 1 row it removes distinct. sql/sql_select.cc: Fix bug #13855 select distinct with group by caused server crash mysql-test/r/select.result: Test case for bug#13855 select distinct with group by caused server crash mysql-test/t/select.test: Test case for bug#13855 select distinct with group by caused server crash
Diffstat (limited to 'mysql-test/t/select.test')
-rw-r--r--mysql-test/t/select.test9
1 files changed, 9 insertions, 0 deletions
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 2607a00bed4..984b467d435 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -2013,3 +2013,12 @@ SELECT t2.a, t2.b, IF(t1.b IS NULL,'',c) AS c, COUNT(*) AS d FROM t2,t1
WHERE t2.a = t1.a AND t2.b = t1.b GROUP BY a, b, c;
DROP TABLE IF EXISTS t1, t2;
+#
+# Bug #13855 select distinct with group by caused server crash
+#
+create table t1 (f1 int primary key, f2 int);
+create table t2 (f3 int, f4 int, primary key(f3,f4));
+insert into t1 values (1,1);
+insert into t2 values (1,1),(1,2);
+select distinct count(f2) >0 from t1 left join t2 on f1=f3 group by f1;
+drop table t1,t2;