mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fixes of testcases after merge with MySQL 5.1.59
This commit is contained in:
@ -346,7 +346,7 @@ SELECT a
|
|||||||
FROM t1
|
FROM t1
|
||||||
WHERE c = 1 AND b = 1 AND d = 1;
|
WHERE c = 1 AND b = 1 AND d = 1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 index_merge c,bd c,bd 5,10 NULL 1 Using intersect(c,bd); Using where; Using index
|
1 SIMPLE t1 ref c,bd bd 10 const,const 2 Using where
|
||||||
CREATE TABLE t2 ( a INT )
|
CREATE TABLE t2 ( a INT )
|
||||||
SELECT a
|
SELECT a
|
||||||
FROM t1
|
FROM t1
|
||||||
@ -690,7 +690,7 @@ SELECT COUNT(*) FROM
|
|||||||
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
|
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||||
2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 11419 Using sort_union(idx,PRIMARY); Using where
|
2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 6144 Using sort_union(idx,PRIMARY); Using where
|
||||||
SELECT COUNT(*) FROM
|
SELECT COUNT(*) FROM
|
||||||
(SELECT * FROM t1 FORCE INDEX(primary,idx)
|
(SELECT * FROM t1 FORCE INDEX(primary,idx)
|
||||||
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
|
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
|
||||||
|
@ -15,7 +15,7 @@ insert into t1 values (-5, 1, 1),
|
|||||||
(10, 1, 1);
|
(10, 1, 1);
|
||||||
explain select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
|
explain select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 4 Using sort_union(key1,key2); Using where
|
1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 5 Using sort_union(key1,key2); Using where
|
||||||
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
|
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
|
||||||
pk1 key1 key2
|
pk1 key1 key2
|
||||||
-100 1 1
|
-100 1 1
|
||||||
|
@ -233,7 +233,7 @@ a+0 b+0
|
|||||||
127 403
|
127 403
|
||||||
explain select a+0, b+0 from t1 where a > 40 and b > 200 order by 1;
|
explain select a+0, b+0 from t1 where a > 40 and b > 200 order by 1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a a 2 NULL 19 Using where; Using index; Using filesort
|
1 SIMPLE t1 range a a 2 NULL 27 Using where; Using index; Using filesort
|
||||||
select a+0, b+0 from t1 where a > 40 and b > 200 order by 1;
|
select a+0, b+0 from t1 where a > 40 and b > 200 order by 1;
|
||||||
a+0 b+0
|
a+0 b+0
|
||||||
44 307
|
44 307
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
flush tables;
|
||||||
CREATE TABLE t(a INT PRIMARY KEY, b INT)ENGINE=InnoDB;
|
CREATE TABLE t(a INT PRIMARY KEY, b INT)ENGINE=InnoDB;
|
||||||
INSERT INTO t VALUES(2,2),(4,4),(8,8),(16,16),(32,32);
|
INSERT INTO t VALUES(2,2),(4,4),(8,8),(16,16),(32,32);
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
@ -572,7 +572,7 @@ COUNT(*)
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 ref p p 28 const 1 Using where
|
1 SIMPLE t2 ref p p 28 const 2 Using where
|
||||||
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
2
|
2
|
||||||
|
@ -889,13 +889,13 @@ EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
|
|||||||
id 1
|
id 1
|
||||||
select_type SIMPLE
|
select_type SIMPLE
|
||||||
table t1
|
table t1
|
||||||
type range
|
type index
|
||||||
possible_keys bkey
|
possible_keys bkey
|
||||||
key bkey
|
key PRIMARY
|
||||||
key_len 5
|
key_len 4
|
||||||
ref NULL
|
ref NULL
|
||||||
rows 16
|
rows 32
|
||||||
Extra Using where; Using index; Using filesort
|
Extra Using where
|
||||||
SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
|
SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
|
||||||
a b
|
a b
|
||||||
1 2
|
1 2
|
||||||
@ -934,12 +934,12 @@ EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
|
|||||||
id 1
|
id 1
|
||||||
select_type SIMPLE
|
select_type SIMPLE
|
||||||
table t1
|
table t1
|
||||||
type range
|
type index
|
||||||
possible_keys bkey
|
possible_keys bkey
|
||||||
key bkey
|
key bkey
|
||||||
key_len 5
|
key_len 5
|
||||||
ref NULL
|
ref NULL
|
||||||
rows 16
|
rows 32
|
||||||
Extra Using where; Using index
|
Extra Using where; Using index
|
||||||
SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
|
SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
|
||||||
a b
|
a b
|
||||||
@ -989,7 +989,7 @@ possible_keys bkey
|
|||||||
key bkey
|
key bkey
|
||||||
key_len 5
|
key_len 5
|
||||||
ref const
|
ref const
|
||||||
rows 8
|
rows 16
|
||||||
Extra Using where; Using index; Using filesort
|
Extra Using where; Using index; Using filesort
|
||||||
SELECT * FROM t2 WHERE b=1 ORDER BY a;
|
SELECT * FROM t2 WHERE b=1 ORDER BY a;
|
||||||
a b c
|
a b c
|
||||||
@ -1018,7 +1018,7 @@ possible_keys bkey
|
|||||||
key bkey
|
key bkey
|
||||||
key_len 10
|
key_len 10
|
||||||
ref const,const
|
ref const,const
|
||||||
rows 8
|
rows 16
|
||||||
Extra Using where; Using index
|
Extra Using where; Using index
|
||||||
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a;
|
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a;
|
||||||
a b c
|
a b c
|
||||||
@ -1047,7 +1047,7 @@ possible_keys bkey
|
|||||||
key bkey
|
key bkey
|
||||||
key_len 10
|
key_len 10
|
||||||
ref const,const
|
ref const,const
|
||||||
rows 8
|
rows 16
|
||||||
Extra Using where; Using index
|
Extra Using where; Using index
|
||||||
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a;
|
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a;
|
||||||
a b c
|
a b c
|
||||||
@ -1076,7 +1076,7 @@ possible_keys bkey
|
|||||||
key bkey
|
key bkey
|
||||||
key_len 10
|
key_len 10
|
||||||
ref const,const
|
ref const,const
|
||||||
rows 8
|
rows 16
|
||||||
Extra Using where; Using index
|
Extra Using where; Using index
|
||||||
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a;
|
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a;
|
||||||
a b c
|
a b c
|
||||||
@ -1211,7 +1211,7 @@ possible_keys b
|
|||||||
key b
|
key b
|
||||||
key_len 5
|
key_len 5
|
||||||
ref const
|
ref const
|
||||||
rows 1
|
rows 2
|
||||||
Extra Using where; Using index
|
Extra Using where; Using index
|
||||||
SELECT * FROM t1 WHERE b=2 ORDER BY a ASC;
|
SELECT * FROM t1 WHERE b=2 ORDER BY a ASC;
|
||||||
a b
|
a b
|
||||||
@ -1226,7 +1226,7 @@ possible_keys b
|
|||||||
key b
|
key b
|
||||||
key_len 5
|
key_len 5
|
||||||
ref const
|
ref const
|
||||||
rows 1
|
rows 2
|
||||||
Extra Using where; Using index
|
Extra Using where; Using index
|
||||||
SELECT * FROM t1 WHERE b=2 ORDER BY a DESC;
|
SELECT * FROM t1 WHERE b=2 ORDER BY a DESC;
|
||||||
a b
|
a b
|
||||||
@ -1370,7 +1370,7 @@ INSERT INTO t1 (a,b,c) VALUES (1,1,1), (2,1,1), (3,1,1), (4,1,1);
|
|||||||
INSERT INTO t1 (a,b,c) SELECT a+4,b,c FROM t1;
|
INSERT INTO t1 (a,b,c) SELECT a+4,b,c FROM t1;
|
||||||
EXPLAIN SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
|
EXPLAIN SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 index t1_b PRIMARY 4 NULL 8 Using where
|
1 SIMPLE t1 range t1_b t1_b 5 NULL 8 Using where
|
||||||
SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
|
SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
|
||||||
a b c
|
a b c
|
||||||
8 1 1
|
8 1 1
|
||||||
@ -1739,7 +1739,7 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
|
|||||||
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
|
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
||||||
2 DERIVED t1 index c3,c2 c2 10 NULL 5
|
2 DERIVED t1 ALL c3,c2 c3 5 5 Using filesort
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE TABLE t1 (c1 REAL, c2 REAL, c3 REAL, KEY (c3), KEY (c2, c3))
|
CREATE TABLE t1 (c1 REAL, c2 REAL, c3 REAL, KEY (c3), KEY (c2, c3))
|
||||||
ENGINE=InnoDB;
|
ENGINE=InnoDB;
|
||||||
@ -1753,7 +1753,7 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
|
|||||||
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
|
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
||||||
2 DERIVED t1 index c3,c2 c2 18 NULL 5
|
2 DERIVED t1 ALL c3,c2 c3 9 5 Using filesort
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE TABLE t1 (c1 DECIMAL(12,2), c2 DECIMAL(12,2), c3 DECIMAL(12,2),
|
CREATE TABLE t1 (c1 DECIMAL(12,2), c2 DECIMAL(12,2), c3 DECIMAL(12,2),
|
||||||
KEY (c3), KEY (c2, c3))
|
KEY (c3), KEY (c2, c3))
|
||||||
@ -1768,7 +1768,7 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
|
|||||||
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
|
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
||||||
2 DERIVED t1 index c3,c2 c2 14 NULL 5
|
2 DERIVED t1 ALL c3,c2 c3 7 5 Using filesort
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
End of 5.1 tests
|
End of 5.1 tests
|
||||||
drop table if exists t1, t2, t3;
|
drop table if exists t1, t2, t3;
|
||||||
@ -1844,7 +1844,7 @@ possible_keys b
|
|||||||
key b
|
key b
|
||||||
key_len 5
|
key_len 5
|
||||||
ref NULL
|
ref NULL
|
||||||
rows 3
|
rows 5
|
||||||
Extra Using where; Using index
|
Extra Using where; Using index
|
||||||
EXPLAIN SELECT c FROM bar WHERE c>2;;
|
EXPLAIN SELECT c FROM bar WHERE c>2;;
|
||||||
id 1
|
id 1
|
||||||
@ -2306,6 +2306,28 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
# Bug #39653: find_shortest_key in sql_select.cc does not consider
|
||||||
|
# clustered primary keys
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, d INT, e INT, f INT,
|
||||||
|
KEY (b,c)) ENGINE=INNODB;
|
||||||
|
INSERT INTO t1 VALUES (1,1,1,1,1,1), (2,2,2,2,2,2), (3,3,3,3,3,3),
|
||||||
|
(4,4,4,4,4,4), (5,5,5,5,5,5), (6,6,6,6,6,6),
|
||||||
|
(7,7,7,7,7,7), (8,8,8,8,8,8), (9,9,9,9,9,9),
|
||||||
|
(11,11,11,11,11,11);
|
||||||
|
EXPLAIN SELECT COUNT(*) FROM t1;
|
||||||
|
id 1
|
||||||
|
select_type SIMPLE
|
||||||
|
table t1
|
||||||
|
type index
|
||||||
|
possible_keys NULL
|
||||||
|
key PRIMARY
|
||||||
|
key_len 4
|
||||||
|
ref NULL
|
||||||
|
rows 10
|
||||||
|
Extra Using index
|
||||||
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
# Bug #49838: DROP INDEX and ADD UNIQUE INDEX for same index may
|
# Bug #49838: DROP INDEX and ADD UNIQUE INDEX for same index may
|
||||||
# corrupt definition at engine
|
# corrupt definition at engine
|
||||||
#
|
#
|
||||||
@ -2515,7 +2537,7 @@ f1 f2 f3 f4
|
|||||||
EXPLAIN SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE
|
EXPLAIN SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE
|
||||||
ORDER BY f1 DESC LIMIT 5;
|
ORDER BY f1 DESC LIMIT 5;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range f2,f4 f4 1 NULL 11 Using where
|
1 SIMPLE t1 range f2,f4 f4 1 NULL 22 Using where
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
# Bug#54117 crash in thr_multi_unlock, temporary table
|
# Bug#54117 crash in thr_multi_unlock, temporary table
|
||||||
@ -2617,13 +2639,8 @@ rows 3
|
|||||||
Extra Using index
|
Extra Using index
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
# ALTER TABLE IGNORE didn't ignore duplicates for unique add index
|
# Bug#56862 Execution of a query that uses index merge returns a wrong result
|
||||||
#
|
#
|
||||||
create table t1 (a int primary key, b int) engine = innodb;
|
|
||||||
insert into t1 values (1,1),(2,1);
|
|
||||||
alter ignore table t1 add unique `main` (b);
|
|
||||||
drop table t1;
|
|
||||||
End of 5.1 tests
|
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
pk int NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
pk int NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
a int,
|
a int,
|
||||||
@ -2654,7 +2671,7 @@ SELECT COUNT(*) FROM
|
|||||||
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
|
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||||
2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 3537 Using sort_union(idx,PRIMARY); Using where
|
2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 1536 Using sort_union(idx,PRIMARY); Using where
|
||||||
SELECT COUNT(*) FROM
|
SELECT COUNT(*) FROM
|
||||||
(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
|
(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
|
||||||
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
|
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
|
||||||
@ -2663,6 +2680,16 @@ COUNT(*)
|
|||||||
SET SESSION sort_buffer_size = DEFAULT;
|
SET SESSION sort_buffer_size = DEFAULT;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
|
# ALTER TABLE IGNORE didn't ignore duplicates for unique add index
|
||||||
|
#
|
||||||
|
create table t1 (a int primary key, b int) engine = innodb;
|
||||||
|
insert into t1 values (1,1),(2,1);
|
||||||
|
alter ignore table t1 add unique `main` (b);
|
||||||
|
select * from t1;
|
||||||
|
a b
|
||||||
|
1 1
|
||||||
|
drop table t1;
|
||||||
|
#
|
||||||
# Test for bug #39932 "create table fails if column for FK is in different
|
# Test for bug #39932 "create table fails if column for FK is in different
|
||||||
# case than in corr index".
|
# case than in corr index".
|
||||||
#
|
#
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
-- source include/not_embedded.inc
|
-- source include/not_embedded.inc
|
||||||
-- source include/have_innodb.inc
|
-- source include/have_innodb.inc
|
||||||
|
|
||||||
|
# Close tables used by other tests (to not get crashed myisam tables)
|
||||||
|
flush tables;
|
||||||
|
|
||||||
CREATE TABLE t(a INT PRIMARY KEY, b INT)ENGINE=InnoDB;
|
CREATE TABLE t(a INT PRIMARY KEY, b INT)ENGINE=InnoDB;
|
||||||
INSERT INTO t VALUES(2,2),(4,4),(8,8),(16,16),(32,32);
|
INSERT INTO t VALUES(2,2),(4,4),(8,8),(16,16),(32,32);
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
@ -558,6 +558,23 @@ drop table t1,t2;
|
|||||||
--echo #
|
--echo #
|
||||||
|
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug #39653: find_shortest_key in sql_select.cc does not consider
|
||||||
|
--echo # clustered primary keys
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, d INT, e INT, f INT,
|
||||||
|
KEY (b,c)) ENGINE=INNODB;
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES (1,1,1,1,1,1), (2,2,2,2,2,2), (3,3,3,3,3,3),
|
||||||
|
(4,4,4,4,4,4), (5,5,5,5,5,5), (6,6,6,6,6,6),
|
||||||
|
(7,7,7,7,7,7), (8,8,8,8,8,8), (9,9,9,9,9,9),
|
||||||
|
(11,11,11,11,11,11);
|
||||||
|
|
||||||
|
--query_vertical EXPLAIN SELECT COUNT(*) FROM t1
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # Bug #49838: DROP INDEX and ADD UNIQUE INDEX for same index may
|
--echo # Bug #49838: DROP INDEX and ADD UNIQUE INDEX for same index may
|
||||||
--echo # corrupt definition at engine
|
--echo # corrupt definition at engine
|
||||||
@ -840,6 +857,50 @@ CREATE INDEX b ON t1(a,b,c,d);
|
|||||||
|
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug#56862 Execution of a query that uses index merge returns a wrong result
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
pk int NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
a int,
|
||||||
|
b int,
|
||||||
|
INDEX idx(a))
|
||||||
|
ENGINE=INNODB;
|
||||||
|
|
||||||
|
INSERT INTO t1(a,b) VALUES
|
||||||
|
(11, 1100), (2, 200), (1, 100), (14, 1400), (5, 500),
|
||||||
|
(3, 300), (17, 1700), (4, 400), (12, 1200), (8, 800),
|
||||||
|
(6, 600), (18, 1800), (9, 900), (10, 1000), (7, 700),
|
||||||
|
(13, 1300), (15, 1500), (19, 1900), (16, 1600), (20, 2000);
|
||||||
|
INSERT INTO t1(a,b) SELECT a+20, b+2000 FROM t1;
|
||||||
|
INSERT INTO t1(a,b) SELECT a+40, b+4000 FROM t1;
|
||||||
|
INSERT INTO t1(a,b) SELECT a+80, b+8000 FROM t1;
|
||||||
|
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
||||||
|
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
||||||
|
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
||||||
|
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
||||||
|
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
||||||
|
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
||||||
|
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
||||||
|
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
||||||
|
INSERT INTO t1 VALUES (1000000, 0, 0);
|
||||||
|
|
||||||
|
SET SESSION sort_buffer_size = 1024*36;
|
||||||
|
|
||||||
|
EXPLAIN
|
||||||
|
SELECT COUNT(*) FROM
|
||||||
|
(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
|
||||||
|
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
|
||||||
|
|
||||||
|
SELECT COUNT(*) FROM
|
||||||
|
(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
|
||||||
|
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
|
||||||
|
|
||||||
|
SET SESSION sort_buffer_size = DEFAULT;
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # ALTER TABLE IGNORE didn't ignore duplicates for unique add index
|
--echo # ALTER TABLE IGNORE didn't ignore duplicates for unique add index
|
||||||
--echo #
|
--echo #
|
||||||
@ -847,6 +908,7 @@ DROP TABLE t1;
|
|||||||
create table t1 (a int primary key, b int) engine = innodb;
|
create table t1 (a int primary key, b int) engine = innodb;
|
||||||
insert into t1 values (1,1),(2,1);
|
insert into t1 values (1,1),(2,1);
|
||||||
alter ignore table t1 add unique `main` (b);
|
alter ignore table t1 add unique `main` (b);
|
||||||
|
select * from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
flush tables;
|
||||||
CREATE TABLE t(a INT PRIMARY KEY, b INT)ENGINE=InnoDB;
|
CREATE TABLE t(a INT PRIMARY KEY, b INT)ENGINE=InnoDB;
|
||||||
INSERT INTO t VALUES(2,2),(4,4),(8,8),(16,16),(32,32);
|
INSERT INTO t VALUES(2,2),(4,4),(8,8),(16,16),(32,32);
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
@ -572,7 +572,7 @@ COUNT(*)
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 ref p p 28 const 1 Using where
|
1 SIMPLE t2 ref p p 28 const 2 Using where
|
||||||
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
2
|
2
|
||||||
|
@ -889,13 +889,13 @@ EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
|
|||||||
id 1
|
id 1
|
||||||
select_type SIMPLE
|
select_type SIMPLE
|
||||||
table t1
|
table t1
|
||||||
type range
|
type index
|
||||||
possible_keys bkey
|
possible_keys bkey
|
||||||
key bkey
|
key PRIMARY
|
||||||
key_len 5
|
key_len 4
|
||||||
ref NULL
|
ref NULL
|
||||||
rows 16
|
rows 32
|
||||||
Extra Using where; Using index; Using filesort
|
Extra Using where
|
||||||
SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
|
SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
|
||||||
a b
|
a b
|
||||||
1 2
|
1 2
|
||||||
@ -934,12 +934,12 @@ EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
|
|||||||
id 1
|
id 1
|
||||||
select_type SIMPLE
|
select_type SIMPLE
|
||||||
table t1
|
table t1
|
||||||
type range
|
type index
|
||||||
possible_keys bkey
|
possible_keys bkey
|
||||||
key bkey
|
key bkey
|
||||||
key_len 5
|
key_len 5
|
||||||
ref NULL
|
ref NULL
|
||||||
rows 16
|
rows 32
|
||||||
Extra Using where; Using index
|
Extra Using where; Using index
|
||||||
SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
|
SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
|
||||||
a b
|
a b
|
||||||
@ -989,7 +989,7 @@ possible_keys bkey
|
|||||||
key bkey
|
key bkey
|
||||||
key_len 5
|
key_len 5
|
||||||
ref const
|
ref const
|
||||||
rows 8
|
rows 16
|
||||||
Extra Using where; Using index; Using filesort
|
Extra Using where; Using index; Using filesort
|
||||||
SELECT * FROM t2 WHERE b=1 ORDER BY a;
|
SELECT * FROM t2 WHERE b=1 ORDER BY a;
|
||||||
a b c
|
a b c
|
||||||
@ -1018,7 +1018,7 @@ possible_keys bkey
|
|||||||
key bkey
|
key bkey
|
||||||
key_len 10
|
key_len 10
|
||||||
ref const,const
|
ref const,const
|
||||||
rows 8
|
rows 16
|
||||||
Extra Using where; Using index
|
Extra Using where; Using index
|
||||||
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a;
|
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a;
|
||||||
a b c
|
a b c
|
||||||
@ -1047,7 +1047,7 @@ possible_keys bkey
|
|||||||
key bkey
|
key bkey
|
||||||
key_len 10
|
key_len 10
|
||||||
ref const,const
|
ref const,const
|
||||||
rows 8
|
rows 16
|
||||||
Extra Using where; Using index
|
Extra Using where; Using index
|
||||||
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a;
|
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a;
|
||||||
a b c
|
a b c
|
||||||
@ -1076,7 +1076,7 @@ possible_keys bkey
|
|||||||
key bkey
|
key bkey
|
||||||
key_len 10
|
key_len 10
|
||||||
ref const,const
|
ref const,const
|
||||||
rows 8
|
rows 16
|
||||||
Extra Using where; Using index
|
Extra Using where; Using index
|
||||||
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a;
|
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a;
|
||||||
a b c
|
a b c
|
||||||
@ -1211,7 +1211,7 @@ possible_keys b
|
|||||||
key b
|
key b
|
||||||
key_len 5
|
key_len 5
|
||||||
ref const
|
ref const
|
||||||
rows 1
|
rows 2
|
||||||
Extra Using where; Using index
|
Extra Using where; Using index
|
||||||
SELECT * FROM t1 WHERE b=2 ORDER BY a ASC;
|
SELECT * FROM t1 WHERE b=2 ORDER BY a ASC;
|
||||||
a b
|
a b
|
||||||
@ -1226,7 +1226,7 @@ possible_keys b
|
|||||||
key b
|
key b
|
||||||
key_len 5
|
key_len 5
|
||||||
ref const
|
ref const
|
||||||
rows 1
|
rows 2
|
||||||
Extra Using where; Using index
|
Extra Using where; Using index
|
||||||
SELECT * FROM t1 WHERE b=2 ORDER BY a DESC;
|
SELECT * FROM t1 WHERE b=2 ORDER BY a DESC;
|
||||||
a b
|
a b
|
||||||
@ -1370,7 +1370,7 @@ INSERT INTO t1 (a,b,c) VALUES (1,1,1), (2,1,1), (3,1,1), (4,1,1);
|
|||||||
INSERT INTO t1 (a,b,c) SELECT a+4,b,c FROM t1;
|
INSERT INTO t1 (a,b,c) SELECT a+4,b,c FROM t1;
|
||||||
EXPLAIN SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
|
EXPLAIN SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 index t1_b PRIMARY 4 NULL 8 Using where
|
1 SIMPLE t1 range t1_b t1_b 5 NULL 8 Using where
|
||||||
SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
|
SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
|
||||||
a b c
|
a b c
|
||||||
8 1 1
|
8 1 1
|
||||||
@ -1739,7 +1739,7 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
|
|||||||
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
|
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
||||||
2 DERIVED t1 index c3,c2 c2 10 NULL 5
|
2 DERIVED t1 ALL c3,c2 c3 5 5 Using filesort
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE TABLE t1 (c1 REAL, c2 REAL, c3 REAL, KEY (c3), KEY (c2, c3))
|
CREATE TABLE t1 (c1 REAL, c2 REAL, c3 REAL, KEY (c3), KEY (c2, c3))
|
||||||
ENGINE=InnoDB;
|
ENGINE=InnoDB;
|
||||||
@ -1753,7 +1753,7 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
|
|||||||
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
|
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
||||||
2 DERIVED t1 index c3,c2 c2 18 NULL 5
|
2 DERIVED t1 ALL c3,c2 c3 9 5 Using filesort
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE TABLE t1 (c1 DECIMAL(12,2), c2 DECIMAL(12,2), c3 DECIMAL(12,2),
|
CREATE TABLE t1 (c1 DECIMAL(12,2), c2 DECIMAL(12,2), c3 DECIMAL(12,2),
|
||||||
KEY (c3), KEY (c2, c3))
|
KEY (c3), KEY (c2, c3))
|
||||||
@ -1768,7 +1768,7 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
|
|||||||
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
|
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
||||||
2 DERIVED t1 index c3,c2 c2 14 NULL 5
|
2 DERIVED t1 ALL c3,c2 c3 7 5 Using filesort
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
End of 5.1 tests
|
End of 5.1 tests
|
||||||
drop table if exists t1, t2, t3;
|
drop table if exists t1, t2, t3;
|
||||||
@ -1844,7 +1844,7 @@ possible_keys b
|
|||||||
key b
|
key b
|
||||||
key_len 5
|
key_len 5
|
||||||
ref NULL
|
ref NULL
|
||||||
rows 3
|
rows 5
|
||||||
Extra Using where; Using index
|
Extra Using where; Using index
|
||||||
EXPLAIN SELECT c FROM bar WHERE c>2;;
|
EXPLAIN SELECT c FROM bar WHERE c>2;;
|
||||||
id 1
|
id 1
|
||||||
@ -2440,7 +2440,7 @@ SELECT COUNT(*) FROM
|
|||||||
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
|
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||||
2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 3537 Using sort_union(idx,PRIMARY); Using where
|
2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 1536 Using sort_union(idx,PRIMARY); Using where
|
||||||
SELECT COUNT(*) FROM
|
SELECT COUNT(*) FROM
|
||||||
(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
|
(SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
|
||||||
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
|
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
|
||||||
|
@ -11,3 +11,4 @@
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
innodb_bug52745: Disabled as this has valgrind failures (also in MySQL 5.1.50)
|
innodb_bug52745: Disabled as this has valgrind failures (also in MySQL 5.1.50)
|
||||||
|
innodb-index: Disabled until merging with XtraDB 5.1.60
|
||||||
|
@ -5,6 +5,9 @@
|
|||||||
|
|
||||||
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
|
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
|
||||||
|
|
||||||
|
# Close tables used by other tests (to not get crashed myisam tables)
|
||||||
|
flush tables;
|
||||||
|
|
||||||
CREATE TABLE t(a INT PRIMARY KEY, b INT)ENGINE=InnoDB;
|
CREATE TABLE t(a INT PRIMARY KEY, b INT)ENGINE=InnoDB;
|
||||||
INSERT INTO t VALUES(2,2),(4,4),(8,8),(16,16),(32,32);
|
INSERT INTO t VALUES(2,2),(4,4),(8,8),(16,16),(32,32);
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
@ -93,7 +93,9 @@ alter table t1 modify text1 text not null, pack_keys=1;
|
|||||||
select * from t1 where text1 like 'teststring_%';
|
select * from t1 where text1 like 'teststring_%';
|
||||||
|
|
||||||
# The following gives wrong result in InnoDB
|
# The following gives wrong result in InnoDB
|
||||||
|
--sorted_result
|
||||||
select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%';
|
select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%';
|
||||||
|
--sorted_result
|
||||||
select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t';
|
select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t';
|
||||||
select concat('|', text1, '|') from t1 order by text1;
|
select concat('|', text1, '|') from t1 order by text1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
Reference in New Issue
Block a user