summaryrefslogtreecommitdiff
path: root/mysql-test/t/func_group.test
diff options
context:
space:
mode:
authorunknown <igor@linux.local>2005-03-04 20:24:13 -0800
committerunknown <igor@linux.local>2005-03-04 20:24:13 -0800
commitf1c81bf66960527140d6fe4251ded1a818a3a45e (patch)
tree72f84de3e52863a097fb641a744c97492b1c6ea3 /mysql-test/t/func_group.test
parent58002dddc105f9f87e03bdaa67574d16c8673423 (diff)
downloadmariadb-git-f1c81bf66960527140d6fe4251ded1a818a3a45e.tar.gz
logging_ok:
Logging to logging@openlogging.org accepted func_group.result, func_group.test: Added a test case for bug #8893. opt_sum.cc: A misplaced initialization for the returned parameter prefix_len in the function find_key_for_maxmin caused usage of a wrong key prefix by the min/max optimization in cases when the matching index was not the first index that contained the min/max field. sql/opt_sum.cc: A misplaced initialization for the returned parameter prefix_len in the function find_key_for_maxmin caused usage of a wrong key prefix by the min/max optimization in cases when the matching index was not the first index that contained the min/max field. mysql-test/t/func_group.test: Added a test case for bug #8893. mysql-test/r/func_group.result: Added a test case for bug #8893. BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'mysql-test/t/func_group.test')
-rw-r--r--mysql-test/t/func_group.test30
1 files changed, 30 insertions, 0 deletions
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 1ee812e5c2f..78e7d3c5ed6 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -496,3 +496,33 @@ drop table t2;
create table t2 select f2 from (select now() f2 from t1) a;
show columns from t2;
drop table t2, t1;
+
+#
+# Bug 8893: wrong result for min/max optimization with 2 indexes
+#
+
+CREATE TABLE t1(
+ id int PRIMARY KEY,
+ a int,
+ b int,
+ INDEX i_b_id(a,b,id),
+ INDEX i_id(a,id)
+);
+INSERT INTO t1 VALUES
+ (1,1,4), (2,2,1), (3,1,3), (4,2,1), (5,1,1);
+SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
+DROP TABLE t1;
+
+# change the order of the last two index definitions
+
+CREATE TABLE t1(
+ id int PRIMARY KEY,
+ a int,
+ b int,
+ INDEX i_id(a,id),
+ INDEX i_b_id(a,b,id)
+);
+INSERT INTO t1 VALUES
+ (1,1,4), (2,2,1), (3,1,3), (4,2,1), (5,1,1);
+SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
+DROP TABLE t1;