summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/auto_increment.result26
-rw-r--r--mysql-test/r/bdb.result11
-rw-r--r--mysql-test/r/binary.result1
-rw-r--r--mysql-test/r/func_group.result25
-rw-r--r--mysql-test/r/func_op.result18
-rw-r--r--mysql-test/r/func_str.result21
-rw-r--r--mysql-test/r/func_time.result36
-rw-r--r--mysql-test/r/group_by.result31
-rw-r--r--mysql-test/r/have_mest_timezone.require2
-rw-r--r--mysql-test/r/have_met_timezone.require2
-rw-r--r--mysql-test/r/innodb.result26
-rw-r--r--mysql-test/r/insert.result2
-rw-r--r--mysql-test/r/join_outer.result17
-rw-r--r--mysql-test/r/limit.result23
-rw-r--r--mysql-test/r/loaddata.result28
-rw-r--r--mysql-test/r/lowercase_table.result10
-rw-r--r--mysql-test/r/multi_update.result33
-rw-r--r--mysql-test/r/mysqldump.result60
-rw-r--r--mysql-test/r/query_cache.result11
-rw-r--r--mysql-test/r/rpl_EE_error.result16
-rw-r--r--mysql-test/r/rpl_multi_update.result26
-rw-r--r--mysql-test/r/rpl_rotate_logs.result3
-rw-r--r--mysql-test/r/select_found.result19
-rw-r--r--mysql-test/r/symlink.result22
-rw-r--r--mysql-test/r/timezone.result9
-rw-r--r--mysql-test/r/truncate.result9
-rw-r--r--mysql-test/r/type_blob.result146
-rw-r--r--mysql-test/r/type_datetime.result21
-rw-r--r--mysql-test/r/type_decimal.result8
-rw-r--r--mysql-test/r/type_enum.result15
-rw-r--r--mysql-test/r/type_timestamp.result28
-rw-r--r--mysql-test/r/union.result10
-rw-r--r--mysql-test/r/warnings.result4
-rw-r--r--mysql-test/std_data/loaddata3.dat6
-rw-r--r--mysql-test/std_data/loaddata4.dat1
-rw-r--r--mysql-test/t/auto_increment.test19
-rw-r--r--mysql-test/t/bdb.test19
-rw-r--r--mysql-test/t/func_group.test8
-rw-r--r--mysql-test/t/func_op.test9
-rw-r--r--mysql-test/t/func_str.test7
-rw-r--r--mysql-test/t/func_time.test19
-rw-r--r--mysql-test/t/group_by.test24
-rw-r--r--mysql-test/t/innodb.test37
-rw-r--r--mysql-test/t/insert.test2
-rw-r--r--mysql-test/t/join_outer.test13
-rw-r--r--mysql-test/t/limit.test22
-rw-r--r--mysql-test/t/loaddata.test11
-rw-r--r--mysql-test/t/lowercase_table.test7
-rw-r--r--mysql-test/t/multi_update.test39
-rw-r--r--mysql-test/t/mysqldump.test30
-rw-r--r--mysql-test/t/query_cache.test4
-rw-r--r--mysql-test/t/rpl_EE_error.test30
-rw-r--r--mysql-test/t/rpl_multi_update.test24
-rw-r--r--mysql-test/t/rpl_rotate_logs.test1
-rw-r--r--mysql-test/t/select_found.test14
-rw-r--r--mysql-test/t/symlink.test22
-rw-r--r--mysql-test/t/timezone.test18
-rw-r--r--mysql-test/t/truncate.test12
-rw-r--r--mysql-test/t/type_blob.test49
-rw-r--r--mysql-test/t/type_datetime.test5
-rw-r--r--mysql-test/t/type_decimal.test6
-rw-r--r--mysql-test/t/type_enum.test11
-rw-r--r--mysql-test/t/type_timestamp.test13
-rw-r--r--mysql-test/t/union.test13
64 files changed, 1136 insertions, 78 deletions
diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result
index 05317c0f845..89d07af6cf3 100644
--- a/mysql-test/r/auto_increment.result
+++ b/mysql-test/r/auto_increment.result
@@ -106,6 +106,32 @@ Table Op Msg_type Msg_text
test.t1 check warning Found row where the auto_increment column has the value 0
test.t1 check status OK
drop table t1;
+create table t1 (a int not null auto_increment primary key);
+insert into t1 values (NULL);
+insert into t1 values (-1);
+select last_insert_id();
+last_insert_id()
+1
+insert into t1 values (NULL);
+select * from t1;
+a
+-1
+1
+2
+drop table t1;
+create table t1 (a int not null auto_increment primary key) /*!41002 type=heap */;
+insert into t1 values (NULL);
+insert into t1 values (-1);
+select last_insert_id();
+last_insert_id()
+1
+insert into t1 values (NULL);
+select * from t1;
+a
+-1
+1
+2
+drop table t1;
create table t1 (i tinyint unsigned not null auto_increment primary key);
insert into t1 set i = 254;
insert into t1 set i = null;
diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result
index 6021f02f2a6..b02574cf8a3 100644
--- a/mysql-test/r/bdb.result
+++ b/mysql-test/r/bdb.result
@@ -1145,3 +1145,14 @@ x
7
6
drop table t1;
+create table t1 ( c char(8) not null ) engine=bdb;
+insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
+insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
+alter table t1 add b char(8) not null;
+alter table t1 add a char(8) not null;
+alter table t1 add primary key (a,b,c);
+update t1 set a=c, b=c;
+create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=bdb;
+insert into t2 select * from t1;
+delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
+drop table t1,t2;
diff --git a/mysql-test/r/binary.result b/mysql-test/r/binary.result
index 5da627a30b9..d4576791aed 100644
--- a/mysql-test/r/binary.result
+++ b/mysql-test/r/binary.result
@@ -66,6 +66,7 @@ concat("-",a,"-",b,"-")
alter table t1 modify b tinytext not null, drop key b, add key (b(100));
select concat("-",a,"-",b,"-") from t1 where b="hello ";
concat("-",a,"-",b,"-")
+-hello-hello-
select concat("-",a,"-",b,"-") from t1 ignore index (b) where b="hello ";
concat("-",a,"-",b,"-")
-hello-hello-
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index bdac40d3378..6a704f2847d 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -47,7 +47,7 @@ sum(all a) count(all a) avg(all a) std(all a) variance(all a) bit_or(all a) bit_
21 6 3.5000 1.7078 2.9167 7 0 1 6 E
select grp, sum(a),count(a),avg(a),std(a),variance(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1 group by grp;
grp sum(a) count(a) avg(a) std(a) variance(a) bit_or(a) bit_and(a) min(a) max(a) min(c) max(c)
-NULL NULL 0 NULL NULL NULL 0 0 NULL NULL
+NULL NULL 0 NULL NULL NULL 0 18446744073709551615 NULL NULL
1 1 1 1.0000 0.0000 0.0000 1 1 1 1 a a
2 5 2 2.5000 0.5000 0.2500 3 2 2 3 b c
3 15 3 5.0000 0.8165 0.6667 7 4 4 6 C E
@@ -576,8 +576,8 @@ insert into t1 values (1,null);
insert into t1 values (2,null);
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
-1 0 NULL NULL NULL NULL NULL 0 0
-2 0 NULL NULL NULL NULL NULL 0 0
+1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
+2 0 NULL NULL NULL NULL NULL 18446744073709551615 0
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
@@ -585,8 +585,8 @@ a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
insert into t1 values (2,1);
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
-1 0 NULL NULL NULL NULL NULL 0 0
-2 1 1 1.0000 0.0000 1 1 0 1
+1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
+2 1 1 1.0000 0.0000 1 1 1 1
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
@@ -594,8 +594,8 @@ a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
insert into t1 values (3,1);
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
-1 0 NULL NULL NULL NULL NULL 0 0
-2 1 1 1.0000 0.0000 1 1 0 1
+1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
+2 1 1 1.0000 0.0000 1 1 1 1
3 1 1 1.0000 0.0000 1 1 1 1
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b) bit_xor(b)
@@ -632,3 +632,14 @@ select a from t1 having a=1;
a
1
drop table t1;
+create table t1 (col int);
+insert into t1 values (-1), (-2), (-3);
+select bit_and(col), bit_or(col) from t1;
+bit_and(col) bit_or(col)
+18446744073709551612 18446744073709551615
+select SQL_BIG_RESULT bit_and(col), bit_or(col) from t1 group by col;
+bit_and(col) bit_or(col)
+18446744073709551613 18446744073709551613
+18446744073709551614 18446744073709551614
+18446744073709551615 18446744073709551615
+drop table t1;
diff --git a/mysql-test/r/func_op.result b/mysql-test/r/func_op.result
index 25a7ac20b66..fb1e715ac3b 100644
--- a/mysql-test/r/func_op.result
+++ b/mysql-test/r/func_op.result
@@ -17,3 +17,21 @@ Note 1003 select high_priority (1 | (1 + 1)) AS `1 | (1+1)`,(5 & 3) AS `5 & 3`,b
select 1 << 32,1 << 63, 1 << 64, 4 >> 2, 4 >> 63, 1<< 63 >> 60;
1 << 32 1 << 63 1 << 64 4 >> 2 4 >> 63 1<< 63 >> 60
4294967296 9223372036854775808 0 1 0 8
+select -1 | 0, -1 ^ 0, -1 & 0;
+-1 | 0 -1 ^ 0 -1 & 0
+18446744073709551615 18446744073709551615 0
+select -1 | 1, -1 ^ 1, -1 & 1;
+-1 | 1 -1 ^ 1 -1 & 1
+18446744073709551615 18446744073709551614 1
+select 1 | -1, 1 ^ -1, 1 & -1;
+1 | -1 1 ^ -1 1 & -1
+18446744073709551615 18446744073709551614 1
+select 0 | -1, 0 ^ -1, 0 & -1;
+0 | -1 0 ^ -1 0 & -1
+18446744073709551615 18446744073709551615 0
+select -1 >> 0, -1 << 0;
+-1 >> 0 -1 << 0
+18446744073709551615 18446744073709551615
+select -1 >> 1, -1 << 1;
+-1 >> 1 -1 << 1
+9223372036854775807 18446744073709551614
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index ac075e129ee..c74feccfb7f 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -144,12 +144,12 @@ montymontymontymontymonty * *
select reverse('abc'),reverse('abcd');
reverse('abc') reverse('abcd')
cba dcba
-select rpad('a',4,'1'),rpad('a',4,'12'),rpad('abcd',3,'12');
-rpad('a',4,'1') rpad('a',4,'12') rpad('abcd',3,'12')
-a111 a121 abc
-select lpad('a',4,'1'),lpad('a',4,'12'),lpad('abcd',3,'12');
-lpad('a',4,'1') lpad('a',4,'12') lpad('abcd',3,'12')
-111a 121a abc
+select rpad('a',4,'1'),rpad('a',4,'12'),rpad('abcd',3,'12'), rpad(11, 10 , 22), rpad("ab", 10, 22);
+rpad('a',4,'1') rpad('a',4,'12') rpad('abcd',3,'12') rpad(11, 10 , 22) rpad("ab", 10, 22)
+a111 a121 abc 1122222222 ab22222222
+select lpad('a',4,'1'),lpad('a',4,'12'),lpad('abcd',3,'12'), lpad(11, 10 , 22);
+lpad('a',4,'1') lpad('a',4,'12') lpad('abcd',3,'12') lpad(11, 10 , 22)
+111a 121a abc 2222222211
select rpad(741653838,17,'0'),lpad(741653838,17,'0');
rpad(741653838,17,'0') lpad(741653838,17,'0')
74165383800000000 00000000741653838
@@ -159,6 +159,12 @@ abcdaba abaabcd
select rpad('abcd',1,'ab'),lpad('abcd',1,'ab');
rpad('abcd',1,'ab') lpad('abcd',1,'ab')
a a
+select rpad('STRING', 20, CONCAT('p','a','d') );
+rpad('STRING', 20, CONCAT('p','a','d') )
+STRINGpadpadpadpadpa
+select lpad('STRING', 20, CONCAT('p','a','d') );
+lpad('STRING', 20, CONCAT('p','a','d') )
+padpadpadpadpaSTRING
select LEAST(NULL,'HARRY','HARRIOT',NULL,'HAROLD'),GREATEST(NULL,'HARRY','HARRIOT',NULL,'HAROLD');
LEAST(NULL,'HARRY','HARRIOT',NULL,'HAROLD') GREATEST(NULL,'HARRY','HARRIOT',NULL,'HAROLD')
HAROLD HARRY
@@ -183,6 +189,9 @@ NULL '\0\Z'
select length(quote(concat(char(0),"test")));
length(quote(concat(char(0),"test")))
8
+select hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))));
+hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))))
+27E0E3E6E7E8EAEB27
select reverse("");
reverse("")
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index b3c3d8dff5c..0998f7b8bcf 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -95,11 +95,34 @@ week(19981231,2) week(19981231,3) week(20000101,2) week(20000101,3)
52 53 52 52
select week(20001231,2),week(20001231,3);
week(20001231,2) week(20001231,3)
-1 52
+53 52
+select week(19981231,0) as '0', week(19981231,1) as '1', week(19981231,2) as '2', week(19981231,3) as '3', week(19981231,4) as '4', week(19981231,5) as '5', week(19981231,6) as '6', week(19981231,7) as '7';
+0 1 2 3 4 5 6 7
+52 53 52 53 52 52 52 52
+select week(20000101,0) as '0', week(20000101,1) as '1', week(20000101,2) as '2', week(20000101,3) as '3', week(20000101,4) as '4', week(20000101,5) as '5', week(20000101,6) as '6', week(20000101,7) as '7';
+0 1 2 3 4 5 6 7
+0 0 52 52 0 0 52 52
+select week(20000106,0) as '0', week(20000106,1) as '1', week(20000106,2) as '2', week(20000106,3) as '3', week(20000106,4) as '4', week(20000106,5) as '5', week(20000106,6) as '6', week(20000106,7) as '7';
+0 1 2 3 4 5 6 7
+1 1 1 1 1 1 1 1
+select week(20001231,0) as '0', week(20001231,1) as '1', week(20001231,2) as '2', week(20001231,3) as '3', week(20001231,4) as '4', week(20001231,5) as '5', week(20001231,6) as '6', week(20001231,7) as '7';
+0 1 2 3 4 5 6 7
+53 52 53 52 53 52 1 52
+select week(20010101,0) as '0', week(20010101,1) as '1', week(20010101,2) as '2', week(20010101,3) as '3', week(20010101,4) as '4', week(20010101,5) as '5', week(20010101,6) as '6', week(20010101,7) as '7';
+0 1 2 3 4 5 6 7
+0 1 53 1 1 1 1 1
+select yearweek(20001231,0), yearweek(20001231,1), yearweek(20001231,2), yearweek(20001231,3), yearweek(20001231,4), yearweek(20001231,5), yearweek(20001231,6), yearweek(20001231,7);
+yearweek(20001231,0) yearweek(20001231,1) yearweek(20001231,2) yearweek(20001231,3) yearweek(20001231,4) yearweek(20001231,5) yearweek(20001231,6) yearweek(20001231,7)
+200053 200052 200053 200052 200101 200052 200101 200052
+set default_week_format = 6;
+select week(20001231), week(20001231,6);
+week(20001231) week(20001231,6)
+1 1
+set default_week_format = 0;
set default_week_format = 2;
select week(20001231),week(20001231,2),week(20001231,0);
week(20001231) week(20001231,2) week(20001231,0)
-1 1 53
+53 53 53
set default_week_format = 0;
select date_format('1998-12-31','%x-%v'),date_format('1999-01-01','%x-%v');
date_format('1998-12-31','%x-%v') date_format('1999-01-01','%x-%v')
@@ -408,6 +431,15 @@ select * from t1, t3 where t1.start between t3.ctime1 and t3.ctime2;
start ctime1 ctime2
2002-11-04 00:00:00 2002-10-29 16:51:06 2002-11-05 16:47:31
drop table t1,t2,t3;
+select @a:=FROM_UNIXTIME(1);
+@a:=FROM_UNIXTIME(1)
+1970-01-01 03:00:01
+select unix_timestamp(@a);
+unix_timestamp(@a)
+1
+select unix_timestamp('1969-12-01 19:00:01');
+unix_timestamp('1969-12-01 19:00:01')
+0
CREATE TABLE t1 (datetime datetime, timestamp timestamp, date date, time time);
INSERT INTO t1 values ("2001-01-02 03:04:05", "2002-01-02 03:04:05", "2003-01-02", "06:07:08");
SELECT * from t1;
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 853260a0164..bbe3326fd34 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -291,7 +291,7 @@ Warnings:
Note 1003 select high_priority big_result test.t1.spID AS `spid`,sum(test.t1.userID) AS `sum(userid)` from test.t1 group by test.t1.spID desc
explain select sql_big_result spid,sum(userid) from t1 group by spid desc order by null;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 8
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using filesort
select sql_big_result spid,sum(userid) from t1 group by spid desc;
spid sum(userid)
7 3
@@ -600,3 +600,32 @@ count(*) category
1 3
1 4
drop table t1;
+CREATE TABLE t1 (
+userid int(10) unsigned,
+score smallint(5) unsigned,
+key (score)
+);
+INSERT INTO t1 VALUES (1,1),(2,2),(1,1),(3,3),(3,3),(3,3),(3,3),(3,3);
+SELECT userid,count(*) FROM t1 GROUP BY userid DESC;
+userid count(*)
+3 5
+2 1
+1 2
+EXPLAIN SELECT userid,count(*) FROM t1 GROUP BY userid DESC;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort
+DROP TABLE t1;
+CREATE TABLE t1 (
+i int(11) default NULL,
+j int(11) default NULL
+);
+INSERT INTO t1 VALUES (1,2),(2,3),(4,5),(3,5),(1,5),(23,5);
+SELECT i, COUNT(DISTINCT(i)) FROM t1 GROUP BY j ORDER BY NULL;
+i COUNT(DISTINCT(i))
+1 1
+2 1
+4 4
+explain SELECT i, COUNT(DISTINCT(i)) FROM t1 GROUP BY j ORDER BY NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
+DROP TABLE t1;
diff --git a/mysql-test/r/have_mest_timezone.require b/mysql-test/r/have_mest_timezone.require
deleted file mode 100644
index 2a219f39b7e..00000000000
--- a/mysql-test/r/have_mest_timezone.require
+++ /dev/null
@@ -1,2 +0,0 @@
-Variable_name Value
-timezone MEST
diff --git a/mysql-test/r/have_met_timezone.require b/mysql-test/r/have_met_timezone.require
new file mode 100644
index 00000000000..b3fde075ebd
--- /dev/null
+++ b/mysql-test/r/have_met_timezone.require
@@ -0,0 +1,2 @@
+FROM_UNIXTIME(24*3600)
+1970-01-02 01:00:00
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 58c0042e122..eb0b9af8e38 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -1312,17 +1312,41 @@ a b
111 100
111 100
drop table t1;
+create table t1 ( c char(8) not null ) engine=innodb;
+insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
+insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
+alter table t1 add b char(8) not null;
+alter table t1 add a char(8) not null;
+alter table t1 add primary key (a,b,c);
+update t1 set a=c, b=c;
+create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=innodb;
+insert into t2 select * from t1;
+delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
+drop table t1,t2;
+SET AUTOCOMMIT=1;
+create table t1 (a integer auto_increment primary key) engine=innodb;
+insert into t1 (a) values (NULL),(NULL);
+truncate table t1;
+insert into t1 (a) values (NULL),(NULL);
+SELECT * from t1;
+a
+3
+4
+drop table t1;
CREATE TABLE t1 (col1 int(1))ENGINE=InnoDB;
CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx
(stamp))ENGINE=InnoDB;
insert into t1 values (1),(2),(3);
-insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 );
+insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000);
+Warnings:
+Warning 1264 Data truncated for column 'stamp' at row 3
SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp <
'20020204120000' GROUP BY col1;
col1
1
2
3
+4
drop table t1,t2;
CREATE TABLE t1 (
`id` int(10) unsigned NOT NULL auto_increment,
diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result
index 23eef0b3c59..ff5111c552e 100644
--- a/mysql-test/r/insert.result
+++ b/mysql-test/r/insert.result
@@ -73,7 +73,7 @@ drop table t1;
create table t1 (email varchar(50));
insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'),('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com');
create table t2(id int not null auto_increment primary key, t2 varchar(50), unique(t2));
-insert into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
+insert delayed into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
select * from t2;
id t2
1 mysql.com
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index 76c1b06b638..c40f86827f8 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -665,3 +665,20 @@ left outer join t2 using (f2)
left outer join t3 using (f3);
ERROR 42S22: Unknown column 'test.t2.f3' in 'on clause'
drop table t1,t2,t3;
+create table t1 (a1 int, a2 int);
+create table t2 (b1 int not null, b2 int);
+create table t3 (c1 int, c2 int);
+insert into t1 values (1,2), (2,2), (3,2);
+insert into t2 values (1,3), (2,3);
+insert into t3 values (2,4), (3,4);
+select * from t1 left join t2 on b1 = a1 left join t3 on c1 = a1 and b1 is null;
+a1 a2 b1 b2 c1 c2
+1 2 1 3 NULL NULL
+2 2 2 3 NULL NULL
+3 2 NULL NULL 3 4
+explain select * from t1 left join t2 on b1 = a1 left join t3 on c1 = a1 and b1 is null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2
+drop table t1, t2, t3;
diff --git a/mysql-test/r/limit.result b/mysql-test/r/limit.result
index 5a8edc99c12..c82105e6a49 100644
--- a/mysql-test/r/limit.result
+++ b/mysql-test/r/limit.result
@@ -36,9 +36,7 @@ a b
3 4
drop table t1;
create table t1 (i int);
-insert into t1 (i) values(1);
-insert into t1 (i) values(1);
-insert into t1 (i) values(1);
+insert into t1 (i) values(1),(1),(1);
delete from t1 limit 1;
update t1 set i=2 limit 1;
delete from t1 limit 0;
@@ -50,3 +48,22 @@ i
drop table t1;
select 0 limit 0;
0
+CREATE TABLE t1(id int auto_increment primary key, id2 int, index(id2));
+INSERT INTO t1 (id2) values (0),(0),(0);
+DELETE FROM t1 WHERE id=1;
+INSERT INTO t1 SET id2=0;
+SELECT * FROM t1;
+id id2
+4 0
+2 0
+3 0
+DELETE FROM t1 WHERE id2 = 0 ORDER BY id LIMIT 1;
+SELECT * FROM t1;
+id id2
+4 0
+3 0
+DELETE FROM t1 WHERE id2 = 0 ORDER BY id desc LIMIT 1;
+SELECT * FROM t1;
+id id2
+3 0
+DROP TABLE t1;
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index d738431e016..0547596dfbd 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -31,7 +31,7 @@ drop table t1;
create table t1 (a text, b text);
load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
Warnings:
-Warning 1260 Record count is fewer than the column count at row 3
+Warning 1260 Row 3 doesn't contain data for all columns
select concat('|',a,'|'), concat('|',b,'|') from t1;
concat('|',a,'|') concat('|',b,'|')
|Field A| |Field B|
@@ -40,3 +40,29 @@ Field 3,'Field 4|
|Field 5' ,'Field 6| NULL
|Field 6| | 'Field 7'|
drop table t1;
+create table t1 (a int, b char(10));
+load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
+Warnings:
+Warning 1264 Data truncated for column 'a' at row 3
+Warning 1261 Row 3 was truncated; It contained more data than there where input columns
+Warning 1264 Data truncated for column 'a' at row 5
+Warning 1261 Row 5 was truncated; It contained more data than there where input columns
+select * from t1;
+a b
+1 row 1
+2 row 2
+0 1234567890
+3 row 3
+0 1234567890
+truncate table t1;
+load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
+Warnings:
+Warning 1264 Data truncated for column 'a' at row 4
+Warning 1260 Row 4 doesn't contain data for all columns
+select * from t1;
+a b
+1 row 1
+2 row 2
+3 row 3
+0
+drop table t1;
diff --git a/mysql-test/r/lowercase_table.result b/mysql-test/r/lowercase_table.result
index 9c6b212a4b6..0ba4a4be945 100644
--- a/mysql-test/r/lowercase_table.result
+++ b/mysql-test/r/lowercase_table.result
@@ -1,6 +1,8 @@
-drop table if exists t1,t2,t3;
+drop table if exists t1,t2,t3,t4,T1;
create table T1 (id int primary key, Word varchar(40) not null, Index(Word));
+create table t4 (id int primary key, Word varchar(40) not null);
INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c');
+INSERT INTO T4 VALUES(1,'match');
SELECT * FROM t1;
id Word
1 a
@@ -12,6 +14,9 @@ id
SELECT T2.id from t1 as T2 LIMIT 1;
id
1
+SELECT * from t1 left join t4 on (test.t1.id= TEST.t4.id) where TEST.t1.id >= test.t4.id;
+id Word id Word
+1 a 1 match
SELECT T2.id from t1 as t2 LIMIT 1;
id
1
@@ -21,7 +26,8 @@ ALTER TABLE T2 RENAME T3;
show tables like 't_';
Tables_in_test (t_)
t3
-drop table t3;
+t4
+drop table t3,t4;
create table t1 (a int);
select count(*) from T1;
count(*)
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 38d60cd21d5..d335c9c1d10 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -341,6 +341,38 @@ select t1.a, t1.b,t2.a, t2.b from t1 left join t2 on t1.a=t2.a where t1.b=1 and
a b a b
2 2 NULL NULL
drop table t1,t2;
+create table t1 (a int not null auto_increment primary key, b int not null);
+insert into t1 (b) values (1),(2),(3),(4);
+update t1, t1 as t2 set t1.b=t2.b+1 where t1.a=t2.a;
+select * from t1;
+a b
+1 2
+2 3
+3 4
+4 5
+drop table t1;
+create table t1(id1 smallint(5), field char(5));
+create table t2(id2 smallint(5), field char(5));
+insert into t1 values (1, 'a'), (2, 'aa');
+insert into t2 values (1, 'b'), (2, 'bb');
+select * from t1;
+id1 field
+1 a
+2 aa
+select * from t2;
+id2 field
+1 b
+2 bb
+update t2 inner join t1 on t1.id1=t2.id2
+set t2.field=t1.field
+where 0=1;
+update t2, t1 set t2.field=t1.field
+where t1.id1=t2.id2 and 0=1;
+delete t1, t2 from t2 inner join t1 on t1.id1=t2.id2
+where 0=1;
+delete t1, t2 from t2,t1
+where t1.id1=t2.id2 and 0=1;
+drop table t1,t2;
create table t1 ( a int not null, b int not null) ;
alter table t1 add index i1(a);
delete from t1 where a > 2000000;
@@ -363,3 +395,4 @@ t2 rows after big delete 1900001
select 't1 rows after big delete', count(*) from t1;
t1 rows after big delete count(*)
t1 rows after big delete 1900001
+drop table t1,t2;
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index b49f8012776..04effdfef7c 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -18,6 +18,47 @@ INSERT INTO t1 VALUES (1), (2);
</database>
</mysqldump>
DROP TABLE t1;
+CREATE TABLE t1 (a decimal(240, 20));
+INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
+("0987654321098765432109876543210987654321");
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+ a decimal(240,20) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE t1 DISABLE KEYS */;
+LOCK TABLES t1 WRITE;
+INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890.00000000000000000000"),("0987654321098765432109876543210987654321.00000000000000000000");
+UNLOCK TABLES;
+/*!40000 ALTER TABLE t1 ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+
+DROP TABLE t1;
+CREATE TABLE t1 (a double);
+INSERT INTO t1 VALUES (-9e999999);
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+ a double default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE t1 DISABLE KEYS */;
+LOCK TABLES t1 WRITE;
+INSERT INTO t1 VALUES (RES);
+UNLOCK TABLES;
+/*!40000 ALTER TABLE t1 ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+
+DROP TABLE t1;
CREATE TABLE t1(a int, b text, c varchar(3));
INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
<?xml version="1.0"?>
@@ -64,30 +105,11 @@ INSERT INTO t1 VALUES ("1\""), ("\"2");
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5');
--- MySQL dump 10.3
---
--- Host: localhost Database: test
--- ------------------------------------------------------
--- Server version 4.1.2-alpha-debug-log
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
-/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
-
---
--- Table structure for table `t1`
---
-
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
a varchar(255) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=koi8r;
---
--- Dumping data for table `t1`
---
-
/*!40000 ALTER TABLE t1 DISABLE KEYS */;
LOCK TABLES t1 WRITE;
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index bf658bae89e..fe2ded691d4 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -370,16 +370,23 @@ insert into mysqltest.t1 (a) values (1);
select * from mysqltest.t1 where i is null;
i a
1 1
+create table t1(a int);
+select * from t1;
+a
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
select * from mysqltest.t1;
i a
1 1
show status like "Qcache_queries_in_cache";
Variable_name Value
-Qcache_queries_in_cache 1
+Qcache_queries_in_cache 2
drop database mysqltest;
show status like "Qcache_queries_in_cache";
Variable_name Value
-Qcache_queries_in_cache 0
+Qcache_queries_in_cache 1
+drop table t1;
create table t1 (a char(1) not null collate koi8r_general_ci);
insert into t1 values(_koi8r"á");
set CHARACTER SET koi8r;
diff --git a/mysql-test/r/rpl_EE_error.result b/mysql-test/r/rpl_EE_error.result
new file mode 100644
index 00000000000..49ad4832c81
--- /dev/null
+++ b/mysql-test/r/rpl_EE_error.result
@@ -0,0 +1,16 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int) engine=myisam;
+flush tables;
+drop table t1;
+create table t1 (a int, unique(a)) engine=myisam;
+set sql_log_bin=0;
+insert into t1 values(2);
+set sql_log_bin=1;
+insert into t1 values(1),(2);
+ERROR 23000: Duplicate entry '2' for key 1
+drop table t1;
diff --git a/mysql-test/r/rpl_multi_update.result b/mysql-test/r/rpl_multi_update.result
new file mode 100644
index 00000000000..65587d25f63
--- /dev/null
+++ b/mysql-test/r/rpl_multi_update.result
@@ -0,0 +1,26 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned,
+) ENGINE=MyISAM;
+CREATE TABLE t2 (
+a int unsigned not null auto_increment primary key,
+b int unsigned
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (NULL, 0);
+INSERT INTO t1 SELECT NULL, 0 FROM t1;
+INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
+SELECT * FROM t1 ORDER BY a;
+a b
+1 0
+2 0
+SELECT * FROM t2 ORDER BY a;
+a b
+1 0
+2 1
+UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a;
diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result
index 87ebf870f38..2264272051a 100644
--- a/mysql-test/r/rpl_rotate_logs.result
+++ b/mysql-test/r/rpl_rotate_logs.result
@@ -68,6 +68,9 @@ m
create temporary table temp_table (a char(80) not null);
insert into temp_table values ("testing temporary tables part 2");
create table t3 (n int);
+select count(*) from t3 where n >= 4;
+count(*)
+100
create table t4 select * from temp_table;
show binary logs;
Log_name
diff --git a/mysql-test/r/select_found.result b/mysql-test/r/select_found.result
index 42f7257dbba..e302a0cefeb 100644
--- a/mysql-test/r/select_found.result
+++ b/mysql-test/r/select_found.result
@@ -189,3 +189,22 @@ SELECT FOUND_ROWS();
FOUND_ROWS()
3
drop table t1;
+create table t1 (id int, primary key (id));
+insert into t1 values (1), (2), (3), (4), (5);
+select SQL_CALC_FOUND_ROWS * from t1 where id > 3 limit 0, 1;
+id
+4
+select FOUND_ROWS();
+FOUND_ROWS()
+2
+select SQL_CALC_FOUND_ROWS * from t1 where id > 3 AND 1=2 limit 0, 1;
+id
+select FOUND_ROWS();
+FOUND_ROWS()
+0
+select SQL_CALC_FOUND_ROWS * from t1 where id > 6 limit 0, 1;
+id
+select FOUND_ROWS();
+FOUND_ROWS()
+0
+drop table t1;
diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result
index 48a44fc2b44..4ba0ca0eac4 100644
--- a/mysql-test/r/symlink.result
+++ b/mysql-test/r/symlink.result
@@ -64,3 +64,25 @@ t9 CREATE TABLE `t9` (
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='TEST_DIR/var/tmp/' INDEX DIRECTORY='TEST_DIR/var/run/'
drop database mysqltest;
+create table t1 (a int not null) type=myisam;
+Warnings:
+Warning 1286 'TYPE=database_engine' is deprecated. Use 'ENGINE=database_engine' instead.
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL default '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t1 add b int;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL default '0',
+ `b` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL default '0',
+ `b` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
diff --git a/mysql-test/r/timezone.result b/mysql-test/r/timezone.result
index b82b39da262..20706408075 100644
--- a/mysql-test/r/timezone.result
+++ b/mysql-test/r/timezone.result
@@ -1,4 +1,13 @@
DROP TABLE IF EXISTS t1;
+show variables like "timezone";
+Variable_name Value
+timezone MET
+select @a:=FROM_UNIXTIME(1);
+@a:=FROM_UNIXTIME(1)
+1970-01-01 01:00:01
+select unix_timestamp(@a);
+unix_timestamp(@a)
+1
CREATE TABLE t1 (ts int);
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 01:00'));
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 02:00'));
diff --git a/mysql-test/r/truncate.result b/mysql-test/r/truncate.result
index 0e256c1bf8e..d777bd184b2 100644
--- a/mysql-test/r/truncate.result
+++ b/mysql-test/r/truncate.result
@@ -23,3 +23,12 @@ n
drop table t1;
truncate non_existing_table;
ERROR 42S02: Table 'test.non_existing_table' doesn't exist
+create table t1 (a integer auto_increment primary key);
+insert into t1 (a) values (NULL),(NULL);
+truncate table t1;
+insert into t1 (a) values (NULL),(NULL);
+SELECT * from t1;
+a
+1
+2
+drop table t1;
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index a69e3308f0a..255b7f0d942 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -510,3 +510,149 @@ show full fields from t1;
Field Type Collation Null Key Default Extra Privileges Comment
load_file('../../std_data/words.dat') longblob NULL YES NULL select,insert,update,references
drop table t1;
+create table t1 (id integer primary key auto_increment, txt text not null, unique index txt_index (txt (20)));
+insert into t1 (txt) values ('Chevy'), ('Chevy ');
+select * from t1 where txt='Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt='Chevy ' or txt='Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt='Chevy' or txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where id='1' or id='2';
+id txt
+1 Chevy
+2 Chevy
+insert into t1 (txt) values('Ford');
+select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
+id txt
+1 Chevy
+2 Chevy
+3 Ford
+select * from t1 where txt='Chevy' or txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt in ('Chevy ','Chevy');
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt in ('Chevy');
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt between 'Chevy' and 'Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt between 'Chevy' and 'Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt < 'Chevy ';
+id txt
+select * from t1 where txt <= 'Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt > 'Chevy';
+id txt
+3 Ford
+select * from t1 where txt >= 'Chevy';
+id txt
+1 Chevy
+2 Chevy
+3 Ford
+drop table t1;
+create table t1 (id integer primary key auto_increment, txt text, unique index txt_index (txt (20)));
+insert into t1 (txt) values ('Chevy'), ('Chevy '), (NULL);
+select * from t1 where txt='Chevy' or txt is NULL;
+id txt
+1 Chevy
+2 Chevy
+3 NULL
+select * from t1 where txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt='Chevy ' or txt='Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt='Chevy' or txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where id='1' or id='2';
+id txt
+1 Chevy
+2 Chevy
+insert into t1 (txt) values('Ford');
+select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
+id txt
+1 Chevy
+2 Chevy
+4 Ford
+select * from t1 where txt='Chevy' or txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt in ('Chevy ','Chevy');
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt in ('Chevy');
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt between 'Chevy' and 'Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt between 'Chevy' and 'Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt < 'Chevy ';
+id txt
+select * from t1 where txt < 'Chevy ' or txt is NULL;
+id txt
+3 NULL
+select * from t1 where txt <= 'Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt > 'Chevy';
+id txt
+4 Ford
+select * from t1 where txt >= 'Chevy';
+id txt
+1 Chevy
+2 Chevy
+4 Ford
+drop table t1;
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index 204266d6ec2..c1ee621697d 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -1,6 +1,12 @@
drop table if exists t1;
create table t1 (t datetime);
-insert into t1 values(101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959);
+insert into t1 values(101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959),(20030102030460),(20030102036301),(20030102240401),(20030132030401),(20031302030460);
+Warnings:
+Warning 1264 Data truncated for column 't' at row 13
+Warning 1264 Data truncated for column 't' at row 14
+Warning 1264 Data truncated for column 't' at row 15
+Warning 1264 Data truncated for column 't' at row 16
+Warning 1264 Data truncated for column 't' at row 17
select * from t1;
t
2000-01-01 00:00:00
@@ -15,6 +21,11 @@ t
1999-12-31 23:59:59
1000-01-01 00:00:00
9999-12-31 23:59:59
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+0000-00-00 00:00:00
delete from t1 where t > 0;
optimize table t1;
Table Op Msg_type Msg_text
@@ -22,7 +33,8 @@ test.t1 optimize status OK
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
-insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959");
+delete from t1;
+insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030102030460"),("20030102036301"),("20030102240401"),("20030132030401"),("20031302030460");
select * from t1;
t
2000-01-01 00:00:00
@@ -38,6 +50,11 @@ t
1999-12-31 23:59:59
1000-01-01 00:00:00
9999-12-31 23:59:59
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+0000-00-00 00:00:00
drop table t1;
CREATE TABLE t1 (a timestamp, b date, c time, d datetime);
insert into t1 (b,c,d) values(now(),curtime(),now());
diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result
index da25394eb08..3d3e5082b8a 100644
--- a/mysql-test/r/type_decimal.result
+++ b/mysql-test/r/type_decimal.result
@@ -444,3 +444,11 @@ CREATE TABLE t1 (a_dec DECIMAL(-2,1));
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '-2,1))' at line 1
CREATE TABLE t1 (a_dec DECIMAL(-1,1));
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '-1,1))' at line 1
+create table t1(a decimal(10,4));
+insert into t1 values ("+0000100000000");
+Warnings:
+Warning 1263 Data truncated, out of range for column 'a' at row 1
+select * from t1;
+a
+9999999.9999
+drop table t1;
diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result
index 2ab6695e5c6..db14a658bd2 100644
--- a/mysql-test/r/type_enum.result
+++ b/mysql-test/r/type_enum.result
@@ -1636,7 +1636,20 @@ t1 CREATE TABLE `t1` (
`a` enum('','a','b') NOT NULL default 'b'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
-set names latin1;
+create table t1 (a enum ('0','1'));
+insert into t1 set a='foobar';
+Warnings:
+Warning 1264 Data truncated for column 'a' at row 1
+select * from t1;
+a
+
+update t1 set a = replace(a,'x','y');
+Warnings:
+Warning 1264 Data truncated for column 'a' at row 1
+select * from t1;
+a
+
+drop table t1;
create table t1 (a enum(0xE4, '1', '2') not null default 0xE4);
show columns from t1;
Field Type Null Key Default Extra
diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result
index 0c75155146d..172ccc440f4 100644
--- a/mysql-test/r/type_timestamp.result
+++ b/mysql-test/r/type_timestamp.result
@@ -43,7 +43,13 @@ date_format(a,"%Y %y") year(a) year(now())
1970 70 1970 1970
drop table t1;
create table t1 (ix timestamp);
-insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000);
+insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000),(20030101010160),(20030101016001),(20030101240101),(20030132010101),(20031301010101);
+Warnings:
+Warning 1264 Data truncated for column 'ix' at row 10
+Warning 1264 Data truncated for column 'ix' at row 11
+Warning 1264 Data truncated for column 'ix' at row 12
+Warning 1264 Data truncated for column 'ix' at row 13
+Warning 1264 Data truncated for column 'ix' at row 14
select ix+0 from t1;
ix+0
19991101000000
@@ -55,6 +61,24 @@ ix+0
19990501000000
19991101000000
19990501000000
+0
+0
+0
+0
+0
+delete from t1;
+insert into t1 values ("19991101000000"),("19990102030405"),("19990630232922"),("19990601000000"),("20030101010160"),("20030101016001"),("20030101240101"),("20030132010101"),("20031301010101");
+select ix+0 from t1;
+ix+0
+19991101000000
+19990102030405
+19990630232922
+19990601000000
+0
+0
+0
+0
+0
drop table t1;
CREATE TABLE t1 (date date, date_time datetime, time_stamp timestamp);
INSERT INTO t1 VALUES ("1998-12-31","1998-12-31 23:59:59",19981231235959);
@@ -104,3 +128,5 @@ t2 t4 t6 t8 t10 t12 t14
0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00
1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59
drop table t1;
+create table t1 (a timestamp default 1);
+ERROR 42000: Invalid default value for 'a'
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index b3bf95bdf3d..4a514e3dd18 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -3,7 +3,7 @@ CREATE TABLE t1 (a int not null, b char (10) not null);
insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
CREATE TABLE t2 (a int not null, b char (10) not null);
insert into t2 values (3,'c'),(4,'d'),(5,'f'),(6,'e');
-select a,b from t1 union select a,b from t2;
+select a,b from t1 union distinct select a,b from t2;
a b
1 a
2 b
@@ -434,7 +434,15 @@ a
3
(SELECT * FROM t1) UNION all (SELECT SQL_CALC_FOUND_ROWS * FROM t2) LIMIT 1;
ERROR 42000: Wrong usage/placement of 'SQL_CALC_FOUND_ROWS'
+create temporary table t1 select a from t1 union select a from t2;
+drop temporary table t1;
+create table t1 select a from t1 union select a from t2;
+ERROR HY000: You can't specify target table 't1' for update in FROM clause
drop table t1,t2;
+select length(version()) > 1 as `*` UNION select 2;
+*
+1
+2
CREATE TABLE t1 ( id int(3) unsigned default '0') ENGINE=MyISAM;
INSERT INTO t1 (id) VALUES("1");
CREATE TABLE t2 ( id int(3) unsigned default '0', id_master int(5) default '0', text1 varchar(5) default NULL, text2 varchar(5) default NULL) ENGINE=MyISAM;
diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result
index 39435d24ee1..5c7c75bac00 100644
--- a/mysql-test/r/warnings.result
+++ b/mysql-test/r/warnings.result
@@ -49,9 +49,9 @@ Warnings:
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'b' at row 2
Warning 1264 Data truncated for column 'd' at row 3
Warning 1264 Data truncated for column 'c' at row 4
-Warning 1260 Record count is fewer than the column count at row 5
+Warning 1260 Row 5 doesn't contain data for all columns
Warning 1264 Data truncated for column 'b' at row 6
-Warning 1261 Record count is more than the column count at row 7
+Warning 1261 Row 7 was truncated; It contained more data than there where input columns
Warning 1263 Data truncated, out of range for column 'a' at row 8
select @@warning_count;
@@warning_count
diff --git a/mysql-test/std_data/loaddata3.dat b/mysql-test/std_data/loaddata3.dat
new file mode 100644
index 00000000000..4c82f1396c5
--- /dev/null
+++ b/mysql-test/std_data/loaddata3.dat
@@ -0,0 +1,6 @@
+number row data
+1 row 1
+2 row 2
+error 12345678901234567890123456789012345678901234567890
+3 row 3
+wrong end 12345678901234567890123456789012345678901234567890
diff --git a/mysql-test/std_data/loaddata4.dat b/mysql-test/std_data/loaddata4.dat
new file mode 100644
index 00000000000..9c0d744438c
--- /dev/null
+++ b/mysql-test/std_data/loaddata4.dat
@@ -0,0 +1 @@
+test row data 1 row 1 2 row 2 3 row 3
diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test
index 6cf286f86c0..f2a769d9f06 100644
--- a/mysql-test/t/auto_increment.test
+++ b/mysql-test/t/auto_increment.test
@@ -74,6 +74,25 @@ check table t1;
drop table t1;
#
+# Test negative values (Bug #1366)
+#
+
+create table t1 (a int not null auto_increment primary key);
+insert into t1 values (NULL);
+insert into t1 values (-1);
+select last_insert_id();
+insert into t1 values (NULL);
+select * from t1;
+drop table t1;
+
+create table t1 (a int not null auto_increment primary key) /*!41002 type=heap */;
+insert into t1 values (NULL);
+insert into t1 values (-1);
+select last_insert_id();
+insert into t1 values (NULL);
+select * from t1;
+drop table t1;
+#
# last_insert_id() madness
#
create table t1 (i tinyint unsigned not null auto_increment primary key);
diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test
index 44bb753d6a1..12b81f27147 100644
--- a/mysql-test/t/bdb.test
+++ b/mysql-test/t/bdb.test
@@ -789,3 +789,22 @@ select * from t1 where x <= 10 and x >= 7 order by x desc;
select * from t1 where x <= 8 and x >= 5 order by x desc;
select * from t1 where x < 8 and x > 5 order by x desc;
drop table t1;
+
+#
+# Test of multi-table-updates (bug #1980).
+#
+
+create table t1 ( c char(8) not null ) engine=bdb;
+insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
+insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
+
+alter table t1 add b char(8) not null;
+alter table t1 add a char(8) not null;
+alter table t1 add primary key (a,b,c);
+update t1 set a=c, b=c;
+
+create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=bdb;
+insert into t2 select * from t1;
+
+delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
+drop table t1,t2;
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 17ed4c03b5a..ce89cbe1b22 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -370,3 +370,11 @@ insert into t1 values (1);
select max(a) as b from t1 having b=1;
select a from t1 having a=1;
drop table t1;
+#
+# Bug #1972: test for bit_and(), bit_or() and negative values
+#
+create table t1 (col int);
+insert into t1 values (-1), (-2), (-3);
+select bit_and(col), bit_or(col) from t1;
+select SQL_BIG_RESULT bit_and(col), bit_or(col) from t1 group by col;
+drop table t1;
diff --git a/mysql-test/t/func_op.test b/mysql-test/t/func_op.test
index cb6ca58f193..33a2884b424 100644
--- a/mysql-test/t/func_op.test
+++ b/mysql-test/t/func_op.test
@@ -7,3 +7,12 @@ explain extended select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
select 1 | (1+1),5 & 3,bit_count(7) ;
explain extended select 1 | (1+1),5 & 3,bit_count(7) ;
select 1 << 32,1 << 63, 1 << 64, 4 >> 2, 4 >> 63, 1<< 63 >> 60;
+#
+# bug #1993: bit functions must be unsigned
+#
+select -1 | 0, -1 ^ 0, -1 & 0;
+select -1 | 1, -1 ^ 1, -1 & 1;
+select 1 | -1, 1 ^ -1, 1 & -1;
+select 0 | -1, 0 ^ -1, 0 & -1;
+select -1 >> 0, -1 << 0;
+select -1 >> 1, -1 << 1;
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 0003f14c9ca..ad7b9b21b51 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -61,11 +61,13 @@ select aes_decrypt("a","a");
select aes_decrypt(aes_encrypt("","a"),"a");
select repeat('monty',5),concat('*',space(5),'*');
select reverse('abc'),reverse('abcd');
-select rpad('a',4,'1'),rpad('a',4,'12'),rpad('abcd',3,'12');
-select lpad('a',4,'1'),lpad('a',4,'12'),lpad('abcd',3,'12');
+select rpad('a',4,'1'),rpad('a',4,'12'),rpad('abcd',3,'12'), rpad(11, 10 , 22), rpad("ab", 10, 22);
+select lpad('a',4,'1'),lpad('a',4,'12'),lpad('abcd',3,'12'), lpad(11, 10 , 22);
select rpad(741653838,17,'0'),lpad(741653838,17,'0');
select rpad('abcd',7,'ab'),lpad('abcd',7,'ab');
select rpad('abcd',1,'ab'),lpad('abcd',1,'ab');
+select rpad('STRING', 20, CONCAT('p','a','d') );
+select lpad('STRING', 20, CONCAT('p','a','d') );
select LEAST(NULL,'HARRY','HARRIOT',NULL,'HAROLD'),GREATEST(NULL,'HARRY','HARRIOT',NULL,'HAROLD');
select least(1,2,3) | greatest(16,32,8), least(5,4)*1,greatest(-1.0,1.0)*1,least(3,2,1)*1.0,greatest(1,1.1,1.0),least("10",9),greatest("A","B","0");
@@ -77,6 +79,7 @@ select quote('\'\"\\test');
select quote(concat('abc\'', '\\cba'));
select quote(1/0), quote('\0\Z');
select length(quote(concat(char(0),"test")));
+select hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))));
#
# Wrong usage of functions
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 6f114fe18ae..06d0ff3fa1d 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -42,6 +42,18 @@ select yearweek("2000-01-06",1) as '2000', yearweek("2001-01-06",1) as '2001', y
select week(19981231,2), week(19981231,3), week(20000101,2), week(20000101,3);
select week(20001231,2),week(20001231,3);
+select week(19981231,0) as '0', week(19981231,1) as '1', week(19981231,2) as '2', week(19981231,3) as '3', week(19981231,4) as '4', week(19981231,5) as '5', week(19981231,6) as '6', week(19981231,7) as '7';
+select week(20000101,0) as '0', week(20000101,1) as '1', week(20000101,2) as '2', week(20000101,3) as '3', week(20000101,4) as '4', week(20000101,5) as '5', week(20000101,6) as '6', week(20000101,7) as '7';
+select week(20000106,0) as '0', week(20000106,1) as '1', week(20000106,2) as '2', week(20000106,3) as '3', week(20000106,4) as '4', week(20000106,5) as '5', week(20000106,6) as '6', week(20000106,7) as '7';
+select week(20001231,0) as '0', week(20001231,1) as '1', week(20001231,2) as '2', week(20001231,3) as '3', week(20001231,4) as '4', week(20001231,5) as '5', week(20001231,6) as '6', week(20001231,7) as '7';
+select week(20010101,0) as '0', week(20010101,1) as '1', week(20010101,2) as '2', week(20010101,3) as '3', week(20010101,4) as '4', week(20010101,5) as '5', week(20010101,6) as '6', week(20010101,7) as '7';
+
+select yearweek(20001231,0), yearweek(20001231,1), yearweek(20001231,2), yearweek(20001231,3), yearweek(20001231,4), yearweek(20001231,5), yearweek(20001231,6), yearweek(20001231,7);
+
+set default_week_format = 6;
+select week(20001231), week(20001231,6);
+set default_week_format = 0;
+
set default_week_format = 2;
select week(20001231),week(20001231,2),week(20001231,0);
set default_week_format = 0;
@@ -194,6 +206,13 @@ select * from t1, t3 where t1.start between t3.ctime1 and t3.ctime2;
drop table t1,t2,t3;
#
+# Test unix timestamp
+#
+select @a:=FROM_UNIXTIME(1);
+select unix_timestamp(@a);
+select unix_timestamp('1969-12-01 19:00:01');
+
+#
# Test types from + INTERVAL
#
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 1e65bef19b7..d6d1922c10f 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -432,3 +432,27 @@ select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sum(q
select count(*), case interval(qty,2,3,4,5,6,7,8) when -1 then NULL when 0 then "zero" when 1 then "one" when 2 then "two" end as category from t1 group by category;
select count(*), interval(qty,2,3,4,5,6,7,8) as category from t1 group by category;
drop table t1;
+#
+# Tests for bug #1355: 'Using filesort' is missing in EXPLAIN when ORDER BY
+# NULL is used.
+#
+CREATE TABLE t1 (
+ userid int(10) unsigned,
+ score smallint(5) unsigned,
+ key (score)
+);
+INSERT INTO t1 VALUES (1,1),(2,2),(1,1),(3,3),(3,3),(3,3),(3,3),(3,3);
+# Here we select unordered GROUP BY into a temporary talbe,
+# and then sort it with filesort (GROUP BY in MySQL
+# implies sorted order of results)
+SELECT userid,count(*) FROM t1 GROUP BY userid DESC;
+EXPLAIN SELECT userid,count(*) FROM t1 GROUP BY userid DESC;
+DROP TABLE t1;
+CREATE TABLE t1 (
+ i int(11) default NULL,
+ j int(11) default NULL
+);
+INSERT INTO t1 VALUES (1,2),(2,3),(4,5),(3,5),(1,5),(23,5);
+SELECT i, COUNT(DISTINCT(i)) FROM t1 GROUP BY j ORDER BY NULL;
+explain SELECT i, COUNT(DISTINCT(i)) FROM t1 GROUP BY j ORDER BY NULL;
+DROP TABLE t1;
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 6f7a0e100c3..b227614e7ae 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -902,12 +902,47 @@ update t1 set a=a+10+b where a=1 order by b;
select * from t1 order by a,b;
drop table t1;
+#
+# Test of multi-table-updates (bug #1980).
+#
+
+create table t1 ( c char(8) not null ) engine=innodb;
+insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
+insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
+
+alter table t1 add b char(8) not null;
+alter table t1 add a char(8) not null;
+alter table t1 add primary key (a,b,c);
+update t1 set a=c, b=c;
+
+create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=innodb;
+insert into t2 select * from t1;
+
+delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
+drop table t1,t2;
+
+#
+# test autoincrement with TRUNCATE
+#
+
+SET AUTOCOMMIT=1;
+create table t1 (a integer auto_increment primary key) engine=innodb;
+insert into t1 (a) values (NULL),(NULL);
+truncate table t1;
+insert into t1 (a) values (NULL),(NULL);
+SELECT * from t1;
+drop table t1;
+
+#
+# Test timestamps
+#
CREATE TABLE t1 (col1 int(1))ENGINE=InnoDB;
CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx
(stamp))ENGINE=InnoDB;
insert into t1 values (1),(2),(3);
-insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 );
+# Note that timestamp 3 is wrong
+insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000);
SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp <
'20020204120000' GROUP BY col1;
drop table t1,t2;
diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test
index 62d277bfad5..73b5f453bb4 100644
--- a/mysql-test/t/insert.test
+++ b/mysql-test/t/insert.test
@@ -71,7 +71,7 @@ drop table t1;
create table t1 (email varchar(50));
insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'),('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com');
create table t2(id int not null auto_increment primary key, t2 varchar(50), unique(t2));
-insert into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
+insert delayed into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
select * from t2;
drop table t1,t2;
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index d048208a8ff..4ffe1c075b6 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -438,3 +438,16 @@ select * from t1
left outer join t2 using (f2)
left outer join t3 using (f3);
drop table t1,t2,t3;
+
+create table t1 (a1 int, a2 int);
+create table t2 (b1 int not null, b2 int);
+create table t3 (c1 int, c2 int);
+
+insert into t1 values (1,2), (2,2), (3,2);
+insert into t2 values (1,3), (2,3);
+insert into t3 values (2,4), (3,4);
+
+select * from t1 left join t2 on b1 = a1 left join t3 on c1 = a1 and b1 is null;
+explain select * from t1 left join t2 on b1 = a1 left join t3 on c1 = a1 and b1 is null;
+
+drop table t1, t2, t3;
diff --git a/mysql-test/t/limit.test b/mysql-test/t/limit.test
index 88a9831aa68..61c57c9b468 100644
--- a/mysql-test/t/limit.test
+++ b/mysql-test/t/limit.test
@@ -22,9 +22,7 @@ select * from t1;
drop table t1;
create table t1 (i int);
-insert into t1 (i) values(1);
-insert into t1 (i) values(1);
-insert into t1 (i) values(1);
+insert into t1 (i) values(1),(1),(1);
delete from t1 limit 1;
update t1 set i=2 limit 1;
delete from t1 limit 0;
@@ -32,4 +30,22 @@ update t1 set i=3 limit 0;
select * from t1;
drop table t1;
+# LIMIT 0
+
select 0 limit 0;
+
+#
+# Test with DELETE, ORDER BY and limit (bug #1024)
+#
+
+CREATE TABLE t1(id int auto_increment primary key, id2 int, index(id2));
+INSERT INTO t1 (id2) values (0),(0),(0);
+DELETE FROM t1 WHERE id=1;
+INSERT INTO t1 SET id2=0;
+SELECT * FROM t1;
+DELETE FROM t1 WHERE id2 = 0 ORDER BY id LIMIT 1;
+# should have deleted WHERE id=2
+SELECT * FROM t1;
+DELETE FROM t1 WHERE id2 = 0 ORDER BY id desc LIMIT 1;
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index 1720ae69bbb..aa0ea0a2f55 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -20,3 +20,14 @@ create table t1 (a text, b text);
load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
select concat('|',a,'|'), concat('|',b,'|') from t1;
drop table t1;
+
+create table t1 (a int, b char(10));
+load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
+select * from t1;
+truncate table t1;
+load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
+
+# The empty line last comes from the end line field in the file
+select * from t1;
+drop table t1;
+
diff --git a/mysql-test/t/lowercase_table.test b/mysql-test/t/lowercase_table.test
index 28e45bde5c5..601f1734ac6 100644
--- a/mysql-test/t/lowercase_table.test
+++ b/mysql-test/t/lowercase_table.test
@@ -3,21 +3,24 @@
#
--disable_warnings
-drop table if exists t1,t2,t3;
+drop table if exists t1,t2,t3,t4,T1;
--enable_warnings
create table T1 (id int primary key, Word varchar(40) not null, Index(Word));
+create table t4 (id int primary key, Word varchar(40) not null);
INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c');
+INSERT INTO T4 VALUES(1,'match');
SELECT * FROM t1;
SELECT T1.id from T1 LIMIT 1;
SELECT T2.id from t1 as T2 LIMIT 1;
+SELECT * from t1 left join t4 on (test.t1.id= TEST.t4.id) where TEST.t1.id >= test.t4.id;
# This gave an error in 4.0, but it's fixed in 4.1
SELECT T2.id from t1 as t2 LIMIT 1;
RENAME TABLE T1 TO T2;
ALTER TABLE T2 ADD new_col int not null;
ALTER TABLE T2 RENAME T3;
show tables like 't_';
-drop table t3;
+drop table t3,t4;
#
# Test alias
#
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index 115007d9e63..6f012801972 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -60,8 +60,8 @@ delete from t1, t2, t3 using t1,t2,t3 where t1.id1 = t2.id2 and t2.id2 = t3.id3
select count(*) from t1 where id1;
select count(*) from t2 where id2;
select count(*) from t3 where id3;
-
drop table t1,t2,t3;
+
create table t1(id1 int not null primary key, t varchar(100)) pack_keys = 1;
create table t2(id2 int not null, t varchar(100), index(id2)) pack_keys = 1;
disable_query_log;
@@ -277,6 +277,41 @@ select t1.a, t1.b,t2.a, t2.b from t1 left join t2 on t1.a=t2.a where t1.b=1 and
drop table t1,t2;
#
+# Test reuse of same table
+#
+
+create table t1 (a int not null auto_increment primary key, b int not null);
+insert into t1 (b) values (1),(2),(3),(4);
+update t1, t1 as t2 set t1.b=t2.b+1 where t1.a=t2.a;
+select * from t1;
+drop table t1;
+
+# Test multi-update and multi-delete with impossible where
+
+create table t1(id1 smallint(5), field char(5));
+create table t2(id2 smallint(5), field char(5));
+
+insert into t1 values (1, 'a'), (2, 'aa');
+insert into t2 values (1, 'b'), (2, 'bb');
+
+select * from t1;
+select * from t2;
+
+update t2 inner join t1 on t1.id1=t2.id2
+ set t2.field=t1.field
+ where 0=1;
+update t2, t1 set t2.field=t1.field
+ where t1.id1=t2.id2 and 0=1;
+
+delete t1, t2 from t2 inner join t1 on t1.id1=t2.id2
+ where 0=1;
+delete t1, t2 from t2,t1
+ where t1.id1=t2.id2 and 0=1;
+
+drop table t1,t2;
+
+
+#
# Test for bug #1820.
#
@@ -309,4 +344,4 @@ delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 100*1000;
select 't2 rows after big delete', count(*) from t2;
select 't1 rows after big delete', count(*) from t1;
-#drop table t1,t2;
+drop table t1,t2;
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 582fae0da36..1299d73eb99 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -6,12 +6,34 @@ DROP TABLE IF EXISTS t1, `"t"1`;
CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2);
---exec $MYSQL_DUMP --skip-all -X test t1
+--exec $MYSQL_DUMP --skip-all --skip-comments -X test t1
+DROP TABLE t1;
+
+#
+# Bug #2005
+#
+
+CREATE TABLE t1 (a decimal(240, 20));
+INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
+("0987654321098765432109876543210987654321");
+--exec $MYSQL_DUMP --skip-comments test t1
+DROP TABLE t1;
+
+#
+# Bug #2055
+#
+
+CREATE TABLE t1 (a double);
+INSERT INTO t1 VALUES (-9e999999);
+# The following replaces is here because some systems replaces the above
+# double with '-inf' and others with MAX_DOUBLE
+--replace_result (-1.79769313486232e+308) (RES) (NULL) (RES)
+--exec $MYSQL_DUMP --skip-comments test t1
DROP TABLE t1;
CREATE TABLE t1(a int, b text, c varchar(3));
INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
---exec $MYSQL_DUMP --skip-all -X test t1
+--exec $MYSQL_DUMP --skip-all --skip-comments -X test t1
DROP TABLE t1;
#
@@ -20,7 +42,7 @@ DROP TABLE t1;
CREATE TABLE t1 (`a"b"` char(2));
INSERT INTO t1 VALUES ("1\""), ("\"2");
---exec $MYSQL_DUMP --skip-all -X test t1
+--exec $MYSQL_DUMP --skip-all --skip-comments -X test t1
DROP TABLE t1;
#
@@ -29,5 +51,5 @@ DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5');
---exec $MYSQL_DUMP test t1
+--exec $MYSQL_DUMP --skip-comments test t1
DROP TABLE t1;
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index c93d616b379..d7681e9c2ec 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -254,10 +254,14 @@ select * from mysqltest.t1 where i is null;
#
# drop db
#
+create table t1(a int);
+select * from t1;
+show status like "Qcache_queries_in_cache";
select * from mysqltest.t1;
show status like "Qcache_queries_in_cache";
drop database mysqltest;
show status like "Qcache_queries_in_cache";
+drop table t1;
#
# Charset convertion (cp1251_koi8 always present)
diff --git a/mysql-test/t/rpl_EE_error.test b/mysql-test/t/rpl_EE_error.test
new file mode 100644
index 00000000000..1a1572b48b0
--- /dev/null
+++ b/mysql-test/t/rpl_EE_error.test
@@ -0,0 +1,30 @@
+# See if an EE_ error in one event of the master's binlog stops replication
+# (it should not: in this configuration the EE_ error is probably not
+# critical). Example: you do a DROP TABLE on a table which has no MYI file
+# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and
+# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986).
+
+source include/master-slave.inc;
+
+create table t1 (a int) engine=myisam;
+flush tables;
+system rm ./var/master-data/test/t1.MYI ;
+drop table t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+# Now a real error.
+
+connection master;
+create table t1 (a int, unique(a)) engine=myisam;
+set sql_log_bin=0;
+insert into t1 values(2);
+set sql_log_bin=1;
+save_master_pos;
+--error 1062;
+insert into t1 values(1),(2);
+drop table t1;
+save_master_pos;
+connection slave;
+wait_for_slave_to_stop;
diff --git a/mysql-test/t/rpl_multi_update.test b/mysql-test/t/rpl_multi_update.test
new file mode 100644
index 00000000000..98a199ae412
--- /dev/null
+++ b/mysql-test/t/rpl_multi_update.test
@@ -0,0 +1,24 @@
+source include/master-slave.inc;
+
+CREATE TABLE t1 (
+ a int unsigned not null auto_increment primary key,
+ b int unsigned,
+) ENGINE=MyISAM;
+
+CREATE TABLE t2 (
+ a int unsigned not null auto_increment primary key,
+ b int unsigned
+) ENGINE=MyISAM;
+
+INSERT INTO t1 VALUES (NULL, 0);
+INSERT INTO t1 SELECT NULL, 0 FROM t1;
+
+INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
+
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+
+UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a;
+save_master_pos;
+connection slave;
+sync_with_master;
diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test
index 7560d56af1c..0d447b8d1a3 100644
--- a/mysql-test/t/rpl_rotate_logs.test
+++ b/mysql-test/t/rpl_rotate_logs.test
@@ -130,6 +130,7 @@ while ($1)
dec $1;
}
enable_query_log;
+select count(*) from t3 where n >= 4;
create table t4 select * from temp_table;
show binary logs;
show master status;
diff --git a/mysql-test/t/select_found.test b/mysql-test/t/select_found.test
index f787cec6533..3cf736cafb0 100644
--- a/mysql-test/t/select_found.test
+++ b/mysql-test/t/select_found.test
@@ -95,3 +95,17 @@ SELECT FOUND_ROWS();
SELECT SQL_CALC_FOUND_ROWS * FROM t1 ORDER BY numeropost LIMIT 0;
SELECT FOUND_ROWS();
drop table t1;
+
+#
+# Test problem with impossible WHERE (Bug #1468)
+#
+
+create table t1 (id int, primary key (id));
+insert into t1 values (1), (2), (3), (4), (5);
+select SQL_CALC_FOUND_ROWS * from t1 where id > 3 limit 0, 1;
+select FOUND_ROWS();
+select SQL_CALC_FOUND_ROWS * from t1 where id > 3 AND 1=2 limit 0, 1;
+select FOUND_ROWS();
+select SQL_CALC_FOUND_ROWS * from t1 where id > 6 limit 0, 1;
+select FOUND_ROWS();
+drop table t1;
diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test
index 716eed7abc0..c0a9ce1bbcf 100644
--- a/mysql-test/t/symlink.test
+++ b/mysql-test/t/symlink.test
@@ -93,3 +93,25 @@ select count(*) from mysqltest.t9;
--replace_result $MYSQL_TEST_DIR TEST_DIR
show create table mysqltest.t9;
drop database mysqltest;
+
+#
+# Test changing data dir (Bug #1662)
+#
+
+create table t1 (a int not null) type=myisam;
+disable_query_log;
+eval alter table t1 data directory="$MYSQL_TEST_DIR/var/tmp";
+enable_query_log;
+--replace_result $MYSQL_TEST_DIR TEST_DIR
+show create table t1;
+alter table t1 add b int;
+disable_query_log;
+eval alter table t1 data directory="$MYSQL_TEST_DIR/var/log";
+enable_query_log;
+--replace_result $MYSQL_TEST_DIR TEST_DIR
+show create table t1;
+disable_query_log;
+eval alter table t1 index directory="$MYSQL_TEST_DIR/var/log";
+enable_query_log;
+show create table t1;
+drop table t1;
diff --git a/mysql-test/t/timezone.test b/mysql-test/t/timezone.test
index 14facc0374a..ab732c11a34 100644
--- a/mysql-test/t/timezone.test
+++ b/mysql-test/t/timezone.test
@@ -1,9 +1,9 @@
#
-# Test of timezone handling. This script must be run with TZ=MEST
+# Test of timezone handling. This script must be run with TZ=MET
--- require r/have_mest_timezone.require
+-- require r/have_met_timezone.require
disable_query_log;
-show variables like "timezone";
+select FROM_UNIXTIME(24*3600);
enable_query_log;
# Initialization
@@ -11,6 +11,17 @@ enable_query_log;
DROP TABLE IF EXISTS t1;
--enable_warnings
+show variables like "timezone";
+
+#
+# Test unix timestamp
+#
+select @a:=FROM_UNIXTIME(1);
+select unix_timestamp(@a);
+
+#
+# Test of some values, including some with daylight saving time
+#
CREATE TABLE t1 (ts int);
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 01:00'));
@@ -26,3 +37,4 @@ INSERT INTO t1 (ts) VALUES (Unix_timestamp('2003-03-30 04:00:01'));
SELECT ts,from_unixtime(ts) FROM t1;
DROP TABLE t1;
+
diff --git a/mysql-test/t/truncate.test b/mysql-test/t/truncate.test
index dd80baba269..434a1907e42 100644
--- a/mysql-test/t/truncate.test
+++ b/mysql-test/t/truncate.test
@@ -24,3 +24,15 @@ select * from t1;
drop table t1;
--error 1146
truncate non_existing_table;
+
+#
+# test autoincrement with TRUNCATE
+#
+
+create table t1 (a integer auto_increment primary key);
+insert into t1 (a) values (NULL),(NULL);
+truncate table t1;
+insert into t1 (a) values (NULL),(NULL);
+SELECT * from t1;
+drop table t1;
+
diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test
index c9c3284fe0d..70fa2f9b172 100644
--- a/mysql-test/t/type_blob.test
+++ b/mysql-test/t/type_blob.test
@@ -308,3 +308,52 @@ drop table t1;
create table t1 select load_file('../../std_data/words.dat');
show full fields from t1;
drop table t1;
+
+#
+# Test blob's with end space (Bug #1651)
+#
+
+create table t1 (id integer primary key auto_increment, txt text not null, unique index txt_index (txt (20)));
+insert into t1 (txt) values ('Chevy'), ('Chevy ');
+select * from t1 where txt='Chevy';
+select * from t1 where txt='Chevy ';
+select * from t1 where txt='Chevy ' or txt='Chevy';
+select * from t1 where txt='Chevy' or txt='Chevy ';
+select * from t1 where id='1' or id='2';
+insert into t1 (txt) values('Ford');
+select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
+select * from t1 where txt='Chevy' or txt='Chevy ';
+select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
+select * from t1 where txt in ('Chevy ','Chevy');
+select * from t1 where txt in ('Chevy');
+select * from t1 where txt between 'Chevy' and 'Chevy';
+select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
+select * from t1 where txt between 'Chevy' and 'Chevy ';
+select * from t1 where txt < 'Chevy ';
+select * from t1 where txt <= 'Chevy';
+select * from t1 where txt > 'Chevy';
+select * from t1 where txt >= 'Chevy';
+drop table t1;
+
+create table t1 (id integer primary key auto_increment, txt text, unique index txt_index (txt (20)));
+insert into t1 (txt) values ('Chevy'), ('Chevy '), (NULL);
+select * from t1 where txt='Chevy' or txt is NULL;
+select * from t1 where txt='Chevy ';
+select * from t1 where txt='Chevy ' or txt='Chevy';
+select * from t1 where txt='Chevy' or txt='Chevy ';
+select * from t1 where id='1' or id='2';
+insert into t1 (txt) values('Ford');
+select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
+select * from t1 where txt='Chevy' or txt='Chevy ';
+select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
+select * from t1 where txt in ('Chevy ','Chevy');
+select * from t1 where txt in ('Chevy');
+select * from t1 where txt between 'Chevy' and 'Chevy';
+select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
+select * from t1 where txt between 'Chevy' and 'Chevy ';
+select * from t1 where txt < 'Chevy ';
+select * from t1 where txt < 'Chevy ' or txt is NULL;
+select * from t1 where txt <= 'Chevy';
+select * from t1 where txt > 'Chevy';
+select * from t1 where txt >= 'Chevy';
+drop table t1;
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index 7cedbc087e4..cec2aa3582b 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -7,12 +7,13 @@ drop table if exists t1;
--enable_warnings
create table t1 (t datetime);
-insert into t1 values(101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959);
+insert into t1 values(101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959),(20030102030460),(20030102036301),(20030102240401),(20030132030401),(20031302030460);
select * from t1;
delete from t1 where t > 0;
optimize table t1;
check table t1;
-insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959");
+delete from t1;
+insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030102030460"),("20030102036301"),("20030102240401"),("20030132030401"),("20031302030460");
select * from t1;
drop table t1;
diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test
index 36bd8eb48e4..8250f40fc99 100644
--- a/mysql-test/t/type_decimal.test
+++ b/mysql-test/t/type_decimal.test
@@ -244,3 +244,9 @@ CREATE TABLE t1 (a_dec DECIMAL(-1,0));
CREATE TABLE t1 (a_dec DECIMAL(-2,1));
--error 1064
CREATE TABLE t1 (a_dec DECIMAL(-1,1));
+
+# Zero prepend overflow bug
+create table t1(a decimal(10,4));
+insert into t1 values ("+0000100000000");
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test
index c53277334a6..b8f32107892 100644
--- a/mysql-test/t/type_enum.test
+++ b/mysql-test/t/type_enum.test
@@ -26,6 +26,17 @@ show create table t1;
drop table t1;
#
+# Tests of wrong enum values (bug #2023)
+#
+
+create table t1 (a enum ('0','1'));
+insert into t1 set a='foobar';
+select * from t1;
+update t1 set a = replace(a,'x','y');
+select * from t1;
+drop table t1;
+
+#
# Bug #2077
#
diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test
index cd76dbe6ab0..fc7cd019171 100644
--- a/mysql-test/t/type_timestamp.test
+++ b/mysql-test/t/type_timestamp.test
@@ -37,8 +37,11 @@ select date_format(a,"%Y %y"),year(a),year(now()) from t1;
drop table t1;
create table t1 (ix timestamp);
-insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000);
-select ix+0 from t1;
+insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000),(20030101010160),(20030101016001),(20030101240101),(20030132010101),(20031301010101);
+select ix+0 from t1;
+delete from t1;
+insert into t1 values ("19991101000000"),("19990102030405"),("19990630232922"),("19990601000000"),("20030101010160"),("20030101016001"),("20030101240101"),("20030132010101"),("20031301010101");
+select ix+0 from t1;
drop table t1;
CREATE TABLE t1 (date date, date_time datetime, time_stamp timestamp);
@@ -72,3 +75,9 @@ set new=1;
select * from t1;
drop table t1;
+#
+# Bug #1885
+#
+
+--error 1067
+create table t1 (a timestamp default 1);
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 6138bba5a31..8ce4aa997fc 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -11,7 +11,7 @@ insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
CREATE TABLE t2 (a int not null, b char (10) not null);
insert into t2 values (3,'c'),(4,'d'),(5,'f'),(6,'e');
-select a,b from t1 union select a,b from t2;
+select a,b from t1 union distinct select a,b from t2;
select a,b from t1 union all select a,b from t2;
select a,b from t1 union all select a,b from t2 order by b;
select a,b from t1 union all select a,b from t2 union select 7,'g';
@@ -247,9 +247,19 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a desc LIMIT 1;
--error 1234
(SELECT * FROM t1) UNION all (SELECT SQL_CALC_FOUND_ROWS * FROM t2) LIMIT 1;
+create temporary table t1 select a from t1 union select a from t2;
+drop temporary table t1;
+--error 1093
+create table t1 select a from t1 union select a from t2;
drop table t1,t2;
#
+# Problem with alias '*' (BUG #1249)
+#
+
+select length(version()) > 1 as `*` UNION select 2;
+
+#
# Test for another bug with UNION and LEFT JOIN
#
CREATE TABLE t1 ( id int(3) unsigned default '0') ENGINE=MyISAM;
@@ -455,4 +465,3 @@ show status like 'Slow_queries';
select count(*) from t1 where a=7 union select count(*) from t1 where b=13;
show status like 'Slow_queries';
drop table t1;
-