Commit 33b73c20 authored by unknown's avatar unknown
Browse files

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

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


mysql-test/r/view.result:
  Auto merged
mysql-test/t/innodb.test:
  Auto merged
mysql-test/t/view.test:
  Auto merged
sql/item.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
parents 8b2d0133 4d7994ad
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -176,6 +176,14 @@ create table t1 (a int);
delete `4.t1` from t1 as `4.t1` where `4.t1`.a = 5;
delete FROM `4.t1` USING t1 as `4.t1` where `4.t1`.a = 5;
drop table t1;
create table t1(f1 int primary key);
insert into t1 values (4),(3),(1),(2);
delete from t1 where (@a:= f1) order by f1 limit 1;
select @a;
@a
1
drop table t1;
End of 4.1 tests
CREATE TABLE t1 (a int not null,b int not null);
CREATE TABLE t2 (a int not null, b int not null, primary key (a,b));
CREATE TABLE t3 (a int not null, b int not null, primary key (a,b));
+23 −0
Original line number Diff line number Diff line
@@ -67,3 +67,26 @@ id d e m_id f
4	bword	aword	NULL	NULL
5	aword and bword	NULL	5	
drop table t1,t2;
CREATE TABLE t1 (
id int(10) NOT NULL auto_increment,
link int(10) default NULL,
name mediumtext default NULL,
PRIMARY KEY (id),
FULLTEXT (name)
);
INSERT INTO t1 VALUES (1, 1, 'string');
INSERT INTO t1 VALUES (2, 0, 'string');
CREATE TABLE t2 (
id int(10) NOT NULL auto_increment,
name mediumtext default NULL,
PRIMARY KEY (id),
FULLTEXT (name)
);
INSERT INTO t2 VALUES (1, 'string');
SELECT t1.*, MATCH(t1.name) AGAINST('string') AS relevance 
FROM t1 LEFT JOIN t2 ON t1.link = t2.id
WHERE MATCH(t1.name, t2.name) AGAINST('string' IN BOOLEAN MODE);
id	link	name	relevance
1	1	string	0
2	0	string	0
DROP TABLE t1,t2;
+3 −3
Original line number Diff line number Diff line
@@ -380,7 +380,7 @@ Warnings:
Warning	1292	Truncated incorrect DOUBLE value: 'b'
explain select f1 from t1 where f1 in ('a',1);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	index	NULL	t1f1_idx	2	NULL	3	Using where; Using index
1	SIMPLE	t1	index	t1f1_idx	t1f1_idx	2	NULL	3	Using where; Using index
select f1 from t1 where f1 in ('a','b');
f1
a
@@ -409,7 +409,7 @@ Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning	1292	Truncated incorrect DOUBLE value: 'a'
explain select f2 from t2 where f2 in ('a',2);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	index	NULL	t2f2	5	NULL	3	Using where; Using index
1	SIMPLE	t2	index	t2f2	t2f2	5	NULL	3	Using where; Using index
select f2 from t2 where f2 in ('a','b');
f2
0
@@ -431,6 +431,6 @@ Warning 1292 Truncated incorrect DOUBLE value: 'b'
Warning	1292	Truncated incorrect DOUBLE value: 'b'
explain select f2 from t2 where f2 in (1,'b');
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	index	NULL	t2f2	5	NULL	3	Using where; Using index
1	SIMPLE	t2	index	t2f2	t2f2	5	NULL	3	Using where; Using index
drop table t1, t2;
End of 5.1 tests
+40 −5
Original line number Diff line number Diff line
@@ -177,11 +177,46 @@ drop table t1;
select abs(-2) * -2;
abs(-2) * -2
-4
create table t1 (i int);
insert into t1 values (1);
select rand(i) from t1;
ERROR HY000: Incorrect arguments to RAND
drop table t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(1),(1),(2);
SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(a) * 1000 AS UNSIGNED) 
FROM t1;
CAST(RAND(2) * 1000 AS UNSIGNED)	CAST(RAND(a) * 1000 AS UNSIGNED)
656	405
122	405
645	405
858	656
SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(a) * 1000 AS UNSIGNED) 
FROM t1 WHERE a = 1;
CAST(RAND(2) * 1000 AS UNSIGNED)	CAST(RAND(a) * 1000 AS UNSIGNED)
656	405
122	405
645	405
INSERT INTO t1 VALUES (3);
SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(a) * 1000 AS UNSIGNED) 
FROM t1;
CAST(RAND(2) * 1000 AS UNSIGNED)	CAST(RAND(a) * 1000 AS UNSIGNED)
656	405
122	405
645	405
858	656
354	906
SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(a) * 1000 AS UNSIGNED) 
FROM t1 WHERE a = 1;
CAST(RAND(2) * 1000 AS UNSIGNED)	CAST(RAND(a) * 1000 AS UNSIGNED)
656	405
122	405
645	405
PREPARE stmt FROM 
"SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(?) * 1000 AS UNSIGNED)
    FROM t1 WHERE a = 1";
set @var=2;
EXECUTE stmt USING @var;
CAST(RAND(2) * 1000 AS UNSIGNED)	CAST(RAND(?) * 1000 AS UNSIGNED)
656	656
122	122
645	645
DROP TABLE t1;
create table t1 (a varchar(90), ts datetime not null, index (a)) engine=innodb default charset=utf8;
insert into t1 values ('http://www.foo.com/', now());
select a from t1 where a='http://www.foo.com/' order by abs(timediff(ts, 0));
+12 −0
Original line number Diff line number Diff line
@@ -1304,6 +1304,18 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note	1003	select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(both _latin1'y' from `test`.`t1`.`s`) > _latin1'ab')
DROP TABLE t1;
create table t1(f1 varchar(4));
explain extended select encode(f1,'zxcv') as 'enc' from t1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	system	NULL	NULL	NULL	NULL	0	0.00	const row not found
Warnings:
Note	1003	select encode(`test`.`t1`.`f1`,_latin1'zxcv') AS `enc` from `test`.`t1`
explain extended select decode(f1,'zxcv') as 'enc' from t1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	system	NULL	NULL	NULL	NULL	0	0.00	const row not found
Warnings:
Note	1003	select decode(`test`.`t1`.`f1`,_latin1'zxcv') AS `enc` from `test`.`t1`
drop table t1;
End of 4.1 tests
create table t1 (d decimal default null);
insert into t1 values (null);
Loading