Commit 536adef6 authored by unknown's avatar unknown
Browse files

Merge mysql.com:/home/gluh/MySQL/Merge/5.1

into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt


sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_cmpfunc.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/opt_range.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_union.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
parents 1eb71c68 bab42f67
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -128,6 +128,21 @@ show binlog events;

drop table t1,t2,t3;

#
#Bug#19717: DELETE Query Error on BLACKHOLE when using WHERE on column with UNIQUE INDEX
#
CREATE TABLE t1(a INT, b INT) ENGINE=BLACKHOLE;
DELETE FROM t1 WHERE a=10;
ALTER TABLE t1 ADD INDEX(a);
DELETE FROM t1 WHERE a=10;
ALTER TABLE t1 DROP INDEX a;
ALTER TABLE t1 ADD UNIQUE INDEX(a);
DELETE FROM t1 WHERE a=10;
ALTER TABLE t1 DROP INDEX a;
ALTER TABLE t1 ADD PRIMARY KEY(a);
DELETE FROM t1 WHERE a=10;
DROP TABLE t1;

# End of 4.1 tests
# Test that a transaction which is rolled back does not go into binlog
# and that a transaction which is committed does
+11 −0
Original line number Diff line number Diff line
@@ -123,6 +123,17 @@ master-bin.000001 # Query 1 # use `test`; create table t3 like t1
master-bin.000001	#	Query	1	#	use `test`; insert into t1 select * from t3
master-bin.000001	#	Query	1	#	use `test`; replace into t1 select * from t3
drop table t1,t2,t3;
CREATE TABLE t1(a INT, b INT) ENGINE=BLACKHOLE;
DELETE FROM t1 WHERE a=10;
ALTER TABLE t1 ADD INDEX(a);
DELETE FROM t1 WHERE a=10;
ALTER TABLE t1 DROP INDEX a;
ALTER TABLE t1 ADD UNIQUE INDEX(a);
DELETE FROM t1 WHERE a=10;
ALTER TABLE t1 DROP INDEX a;
ALTER TABLE t1 ADD PRIMARY KEY(a);
DELETE FROM t1 WHERE a=10;
DROP TABLE t1;
reset master;
create table t1 (a int) engine=blackhole;
set autocommit=0;
+1 −1
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ concat('|', text1, '|')
|teststring |
explain select concat('|', text1, '|') from t1 where text1='teststring ';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	range	key1	key1	22	NULL	2	Using where
1	SIMPLE	t1	ref	key1	key1	22	const	2	Using where
select concat('|', text1, '|') from t1 where text1 like 'teststring_%';
concat('|', text1, '|')
|teststring	|
+44 −0
Original line number Diff line number Diff line
@@ -355,6 +355,50 @@ some_id
1
2
drop table t1;
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a));
INSERT INTO t1 VALUES (1,1),(2,1),(3,1),(4,1),(5,1),(6,1);
CREATE TABLE t2 (a int, b int, PRIMARY KEY (a));
INSERT INTO t2 VALUES (3,2),(4,2),(100,100),(101,201),(102,102);
CREATE TABLE t3 (a int PRIMARY KEY);
INSERT INTO t3 VALUES (1),(2),(3),(4);
CREATE TABLE t4 (a int PRIMARY KEY,b int);
INSERT INTO t4 VALUES (1,1),(2,2),(1000,1000),(1001,1001),(1002,1002),
(1003,1003),(1004,1004);
EXPLAIN SELECT STRAIGHT_JOIN * FROM t3 
JOIN t1 ON t3.a=t1.a 
JOIN t2 ON t3.a=t2.a
JOIN t4 WHERE t4.a IN (t1.b, t2.b);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t3	index	PRIMARY	PRIMARY	4	NULL	4	Using index
1	SIMPLE	t1	eq_ref	PRIMARY	PRIMARY	4	test.t3.a	1	
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	test.t3.a	1	
1	SIMPLE	t4	ALL	PRIMARY	NULL	NULL	NULL	7	Range checked for each record (index map: 0x1)
SELECT STRAIGHT_JOIN * FROM t3 
JOIN t1 ON t3.a=t1.a 
JOIN t2 ON t3.a=t2.a
JOIN t4 WHERE t4.a IN (t1.b, t2.b);
a	a	b	a	b	a	b
3	3	1	3	2	1	1
3	3	1	3	2	2	2
4	4	1	4	2	1	1
4	4	1	4	2	2	2
EXPLAIN SELECT STRAIGHT_JOIN 
(SELECT SUM(t4.a) FROM t4 WHERE t4.a IN (t1.b, t2.b)) 
FROM t3, t1, t2
WHERE t3.a=t1.a AND t3.a=t2.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	PRIMARY	t3	index	PRIMARY	PRIMARY	4	NULL	4	Using index
1	PRIMARY	t1	eq_ref	PRIMARY	PRIMARY	4	test.t3.a	1	
1	PRIMARY	t2	eq_ref	PRIMARY	PRIMARY	4	test.t3.a	1	
2	DEPENDENT SUBQUERY	t4	index	NULL	PRIMARY	4	NULL	7	Using where; Using index
SELECT STRAIGHT_JOIN 
(SELECT SUM(t4.a) FROM t4 WHERE t4.a IN (t1.b, t2.b)) 
FROM t3, t1, t2
WHERE t3.a=t1.a AND t3.a=t2.a;
(SELECT SUM(t4.a) FROM t4 WHERE t4.a IN (t1.b, t2.b))
3
3
DROP TABLE t1,t2,t3,t4;
End of 5.0 tests
create table t1(f1 char(1));
insert into t1 values ('a'),('b'),('1');
+1 −1
Original line number Diff line number Diff line
@@ -1984,7 +1984,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1	SIMPLE	t1	ref	c	c	11	const	#	Using where; Using index
explain select count(*) from t1 where t='a  ';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	range	t	t	13	NULL	#	Using where
1	SIMPLE	t1	ref	t	t	13	const	#	Using where
explain select count(*) from t1 where v like 'a%';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	range	v	v	13	NULL	#	Using where; Using index
Loading