summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorunknown <igor@rurik.mysql.com>2006-02-06 11:35:13 -0800
committerunknown <igor@rurik.mysql.com>2006-02-06 11:35:13 -0800
commitd8c96f286fcaa071372621f634ece8b9c78ca253 (patch)
tree78664d1be83ff2bdc0bc470468d99442b83fb40e /mysql-test/t
parent26a81f6fb1dc253e9d0ed99768594ac27dae5bb3 (diff)
downloadmariadb-git-d8c96f286fcaa071372621f634ece8b9c78ca253.tar.gz
Fixed bug #16203.
If check_quick_select returns non-empty range then the function cost_group_min_max cannot return 0 as an estimate of the number of retrieved records. Yet the function erroneously returned 0 as the estimate in some situations. mysql-test/r/group_min_max.result: Added a test case for bug #16203. mysql-test/t/group_min_max.test: Added a test case for bug #16203.
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/group_min_max.test21
1 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test
index e15ef92116c..8dc55532bbf 100644
--- a/mysql-test/t/group_min_max.test
+++ b/mysql-test/t/group_min_max.test
@@ -715,3 +715,24 @@ select distinct c1, c2 from t1 order by c2;
select c1,min(c2) as c2 from t1 group by c1 order by c2;
select c1,c2 from t1 group by c1,c2 order by c2;
drop table t1;
+
+#
+# Bug #16203: Analysis for possible min/max optimization erroneously
+# returns impossible range
+#
+
+CREATE TABLE t1 (a varchar(5), b int(11), PRIMARY KEY (a,b));
+INSERT INTO t1 VALUES ('AA',1), ('AA',2), ('AA',3), ('BB',1), ('AA',4);
+OPTIMIZE TABLE t1;
+
+SELECT a FROM t1 WHERE a='AA' GROUP BY a;
+SELECT a FROM t1 WHERE a='BB' GROUP BY a;
+
+EXPLAIN SELECT a FROM t1 WHERE a='AA' GROUP BY a;
+EXPLAIN SELECT a FROM t1 WHERE a='BB' GROUP BY a;
+
+SELECT DISTINCT a FROM t1 WHERE a='BB';
+SELECT DISTINCT a FROM t1 WHERE a LIKE 'B%';
+SELECT a FROM t1 WHERE a LIKE 'B%' GROUP BY a;
+
+DROP TABLE t1;