summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2003-11-28 15:55:43 +0200
committerunknown <monty@mysql.com>2003-11-28 15:55:43 +0200
commitd80953f8312a89f04e5c89fd2bcb5f43b0a7d97e (patch)
tree93fd46c73f839b74713646337e22a966326fae92 /mysql-test
parent4420c2e662db3bd278fc8a4b53adea10cb8f8d9a (diff)
parent0400f880424a774124a91d83a30717ca8bf99b7e (diff)
downloadmariadb-git-d80953f8312a89f04e5c89fd2bcb5f43b0a7d97e.tar.gz
merge with 4.0 to get fix for range bug
libmysql/libmysql.c: Auto merged sql/opt_range.cc: Auto merged
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/range.result10
-rw-r--r--mysql-test/t/range.test11
2 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index 1b66f442a9a..0c8f2cb5323 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -279,6 +279,16 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
a b
DROP TABLE t1;
+CREATE TABLE t1 (a int, b int, c int, INDEX (c,a,b));
+INSERT INTO t1 VALUES (1,0,0),(1,0,0),(1,0,0);
+INSERT INTO t1 VALUES (0,1,0),(0,1,0),(0,1,0);
+SELECT COUNT(*) FROM t1 WHERE (c=0 and a=1) or (c=0 and b=1);
+COUNT(*)
+6
+SELECT COUNT(*) FROM t1 WHERE (c=0 and b=1) or (c=0 and a=1);
+COUNT(*)
+6
+DROP TABLE t1;
create table t1 (id int(10) primary key);
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9);
select id from t1 where id in (2,5,9) ;
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index 75cbb756998..b1b846221e7 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -226,7 +226,18 @@ INSERT INTO t1 VALUES
# we expect that optimizer will choose index on A
EXPLAIN SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
+DROP TABLE t1;
+
+#
+# Test error with
+#
+CREATE TABLE t1 (a int, b int, c int, INDEX (c,a,b));
+INSERT INTO t1 VALUES (1,0,0),(1,0,0),(1,0,0);
+INSERT INTO t1 VALUES (0,1,0),(0,1,0),(0,1,0);
+# -- First reports 3; second reports 6
+SELECT COUNT(*) FROM t1 WHERE (c=0 and a=1) or (c=0 and b=1);
+SELECT COUNT(*) FROM t1 WHERE (c=0 and b=1) or (c=0 and a=1);
DROP TABLE t1;
# test for a bug with in() and unique key