diff options
author | unknown <tomas@poseidon.ndb.mysql.com> | 2004-10-07 13:42:55 +0000 |
---|---|---|
committer | unknown <tomas@poseidon.ndb.mysql.com> | 2004-10-07 13:42:55 +0000 |
commit | b67205dd432398af781377677d616f2aa21808bc (patch) | |
tree | 974a0109e0ad353ad65b66c7c80718c2c320d1e1 /mysql-test | |
parent | a4475441c46e0f45ec8f8974ff14c17f827bd1de (diff) | |
parent | 57fedc40708ed3266d79347cd71e829297352409 (diff) | |
download | mariadb-git-b67205dd432398af781377677d616f2aa21808bc.tar.gz |
Merge tulin@bk-internal.mysql.com:/home/bk/mysql-4.1
into poseidon.ndb.mysql.com:/home/tomas/mysql-4.1-ndb
Diffstat (limited to 'mysql-test')
38 files changed, 918 insertions, 119 deletions
diff --git a/mysql-test/include/ps_query.inc b/mysql-test/include/ps_query.inc index 27ab85410c8..e807e897161 100644 --- a/mysql-test/include/ps_query.inc +++ b/mysql-test/include/ps_query.inc @@ -115,15 +115,15 @@ execute stmt1 using @arg00; # variations on 'group_concat' set @arg00='MySQL' ; -select group_concat(@arg00,b) from t1 +select group_concat(@arg00,b order by a) from t1 group by 'a' ; -prepare stmt1 from ' select group_concat(?,b) from t1 +prepare stmt1 from ' select group_concat(?,b order by a) from t1 group by ''a'' ' ; execute stmt1 using @arg00; # -select group_concat(b,@arg00) from t1 +select group_concat(b,@arg00 order by a) from t1 group by 'a' ; -prepare stmt1 from ' select group_concat(b,?) from t1 +prepare stmt1 from ' select group_concat(b,? order by a) from t1 group by ''a'' ' ; execute stmt1 using @arg00; @@ -223,7 +223,7 @@ execute stmt1 using @arg00, @arg01; set @arg00= 'one' ; set @arg01= 'two' ; set @arg02= 'five' ; -prepare stmt1 from ' select b FROM t1 where b in (?,?,?) ' ; +prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ; execute stmt1 using @arg00, @arg01, @arg02 ; # parameter in LIKE prepare stmt1 from ' select b FROM t1 where b like ? '; diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result index f5ec5f1f852..428b2769fdb 100644 --- a/mysql-test/r/auto_increment.result +++ b/mysql-test/r/auto_increment.result @@ -289,3 +289,55 @@ a b 0 13 500 14 drop table t1; +create table t1 (a bigint); +insert into t1 values (1), (2), (3), (NULL), (NULL); +alter table t1 modify a bigint not null auto_increment primary key; +select * from t1; +a +1 +2 +3 +4 +5 +drop table t1; +create table t1 (a bigint); +insert into t1 values (1), (2), (3), (0), (0); +alter table t1 modify a bigint not null auto_increment primary key; +select * from t1; +a +1 +2 +3 +4 +5 +drop table t1; +create table t1 (a bigint); +insert into t1 values (0), (1), (2), (3); +set sql_mode=NO_AUTO_VALUE_ON_ZERO; +alter table t1 modify a bigint not null auto_increment primary key; +set sql_mode= ''; +select * from t1; +a +0 +1 +2 +3 +drop table t1; +create table t1 (a int auto_increment primary key , b int null); +set sql_mode=NO_AUTO_VALUE_ON_ZERO; +insert into t1 values (0,1),(1,2),(2,3); +select * from t1; +a b +0 1 +1 2 +2 3 +set sql_mode= ''; +alter table t1 modify b varchar(255); +insert into t1 values (0,4); +select * from t1; +a b +0 1 +1 2 +2 3 +3 4 +drop table t1; diff --git a/mysql-test/r/ctype_latin1_de.result b/mysql-test/r/ctype_latin1_de.result index c500019042f..50af5464f54 100644 --- a/mysql-test/r/ctype_latin1_de.result +++ b/mysql-test/r/ctype_latin1_de.result @@ -280,6 +280,20 @@ word word2 ß ß drop table t1; CREATE TABLE t1 ( +autor varchar(80) NOT NULL default '', +PRIMARY KEY (autor) +); +INSERT INTO t1 VALUES ('Powell, B.'),('Powell, Bud.'),('Powell, L. H.'),('Power, H.'), +('Poynter, M. A. L. Lane'),('Poynting, J. H. und J. J. Thomson.'),('Pozzi, S(amuel-Jean).'), +('Pozzi, Samuel-Jean.'),('Pozzo, A.'),('Pozzoli, Serge.'); +SELECT * FROM t1 WHERE autor LIKE 'Poz%' ORDER BY autor; +autor +Pozzi, S(amuel-Jean). +Pozzi, Samuel-Jean. +Pozzo, A. +Pozzoli, Serge. +DROP TABLE t1; +CREATE TABLE t1 ( s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci ); show create table t1; diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result index c6b7a40214d..5575ee1bf98 100644 --- a/mysql-test/r/delete.result +++ b/mysql-test/r/delete.result @@ -58,6 +58,17 @@ select count(*) from t1; count(*) 0 drop table t1; +create table t1 (a int not null auto_increment primary key, b char(32)); +insert into t1 (b) values ('apple'), ('apple'); +select * from t1; +a b +1 apple +2 apple +delete t1 from t1, t1 as t2 where t1.b = t2.b and t1.a > t2.a; +select * from t1; +a b +1 apple +drop table t1; create table t11 (a int NOT NULL, b int, primary key (a)); create table t12 (a int NOT NULL, b int, primary key (a)); create table t2 (a int NOT NULL, b int, primary key (a)); diff --git a/mysql-test/r/flush_table.result b/mysql-test/r/flush_table.result index 257f69fa6d9..2ef4ab5b52b 100644 --- a/mysql-test/r/flush_table.result +++ b/mysql-test/r/flush_table.result @@ -30,14 +30,23 @@ test.t2 flush tables; handler a1 read first limit 9; -ERROR 42S02: Unknown table 'a1' in HANDLER +table_id +test.t1 + handler a2 read first limit 9; -ERROR 42S02: Unknown table 'a2' in HANDLER +table_id +test.t1 + handler t2 read first limit 9; -ERROR 42S02: Unknown table 't2' in HANDLER +table_id +test.t2 + handler t1 open as a1; +ERROR 42000: Not unique table/alias: 'a1' handler t1 open as a2; +ERROR 42000: Not unique table/alias: 'a2' handler t2 open; +ERROR 42000: Not unique table/alias: 't2' handler a1 read first limit 9; table_id test.t1 @@ -52,15 +61,43 @@ test.t2 flush table t1; handler a1 read first limit 9; -ERROR 42S02: Unknown table 'a1' in HANDLER +table_id +test.t1 + handler a2 read first limit 9; -ERROR 42S02: Unknown table 'a2' in HANDLER +table_id +test.t1 + handler t2 read first limit 9; table_id test.t2 flush table t2; handler t2 close; -ERROR 42S02: Unknown table 't2' in HANDLER drop table t1; drop table t2; +create table t1(table_id char(20) primary key); +insert into t1 values ('Record-01'); +insert into t1 values ('Record-02'); +insert into t1 values ('Record-03'); +insert into t1 values ('Record-04'); +insert into t1 values ('Record-05'); +handler t1 open; +handler t1 read first limit 1; +table_id +Record-01 +handler t1 read next limit 1; +table_id +Record-02 +handler t1 read next limit 1; +table_id +Record-03 +flush table t1; +handler t1 read next limit 1; +table_id +Record-01 +handler t1 read next limit 1; +table_id +Record-02 +handler t1 close; +drop table t1; diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result index dd916d06372..508a50caf02 100644 --- a/mysql-test/r/func_if.result +++ b/mysql-test/r/func_if.result @@ -83,3 +83,6 @@ select if(1>2,a,avg(a)) from t1; if(1>2,a,avg(a)) 1.5000 drop table t1; +SELECT NULLIF(5,5) IS NULL, NULLIF(5,5) IS NOT NULL; +NULLIF(5,5) IS NULL NULLIF(5,5) IS NOT NULL +1 0 diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 7b2fc4b21a5..4a3a70274fd 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -316,6 +316,12 @@ NULL NULL 1 1 n two 'two' 0 0 'two' four 'four' 0 0 'four' drop table t1; +select trim(trailing 'foo' from 'foo'); +trim(trailing 'foo' from 'foo') + +select trim(leading 'foo' from 'foo'); +trim(leading 'foo' from 'foo') + select 1=_latin1'1'; 1=_latin1'1' 1 diff --git a/mysql-test/r/handler.result b/mysql-test/r/handler.result index f66e9f1759d..072d4582cbc 100644 --- a/mysql-test/r/handler.result +++ b/mysql-test/r/handler.result @@ -205,3 +205,243 @@ handler t1 read a=(1) where b=1; a b handler t1 close; drop table t1; +drop database if exists test_test; +create database test_test; +use test_test; +create table t1(table_id char(20) primary key); +insert into t1 values ('test_test.t1'); +insert into t1 values (''); +handler t1 open; +handler t1 read first limit 9; +table_id +test_test.t1 + +create table t2(table_id char(20) primary key); +insert into t2 values ('test_test.t2'); +insert into t2 values (''); +handler t2 open; +handler t2 read first limit 9; +table_id +test_test.t2 + +use test; +drop table if exists t1; +create table t1(table_id char(20) primary key); +insert into t1 values ('test.t1'); +insert into t1 values (''); +handler t1 open; +ERROR 42000: Not unique table/alias: 't1' +use test; +handler test.t1 read first limit 9; +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 'read first limit 9' at line 1 +handler test_test.t1 read first limit 9; +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 'read first limit 9' at line 1 +handler t1 read first limit 9; +table_id +test_test.t1 + +handler test_test.t2 read first limit 9; +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 'read first limit 9' at line 1 +handler t2 read first limit 9; +table_id +test_test.t2 + +handler test_test.t1 close; +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 'close' at line 1 +handler t1 close; +drop table test_test.t1; +handler test_test.t2 close; +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 'close' at line 1 +handler t2 close; +drop table test_test.t2; +drop database test_test; +use test; +handler test.t1 close; +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 'close' at line 1 +handler t1 close; +ERROR 42S02: Unknown table 't1' in HANDLER +drop table test.t1; +drop database if exists test_test; +drop table if exists t1; +drop table if exists t2; +drop table if exists t3; +create database test_test; +use test_test; +create table t1 (c1 char(20)); +insert into t1 values ('test_test.t1'); +create table t3 (c1 char(20)); +insert into t3 values ('test_test.t3'); +handler t1 open; +handler t1 read first limit 9; +c1 +test_test.t1 +handler t1 open h1; +handler h1 read first limit 9; +c1 +test_test.t1 +use test; +create table t1 (c1 char(20)); +create table t2 (c1 char(20)); +create table t3 (c1 char(20)); +insert into t1 values ('t1'); +insert into t2 values ('t2'); +insert into t3 values ('t3'); +handler t1 open; +ERROR 42000: Not unique table/alias: 't1' +handler t2 open t1; +ERROR 42000: Not unique table/alias: 't1' +handler t3 open t1; +ERROR 42000: Not unique table/alias: 't1' +handler t1 read first limit 9; +c1 +test_test.t1 +handler test.t1 close; +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 'close' at line 1 +handler test.t1 open h1; +ERROR 42000: Not unique table/alias: 'h1' +handler test_test.t1 open h1; +ERROR 42000: Not unique table/alias: 'h1' +handler test_test.t3 open h3; +handler test.t1 open h2; +handler t1 read first limit 9; +c1 +test_test.t1 +handler h1 read first limit 9; +c1 +test_test.t1 +handler h2 read first limit 9; +c1 +t1 +handler h3 read first limit 9; +c1 +test_test.t3 +handler h2 read first limit 9; +c1 +t1 +handler test.h1 close; +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 'close' at line 1 +handler t1 close; +handler h1 close; +handler h2 close; +handler t1 read first limit 9; +ERROR 42S02: Unknown table 't1' in HANDLER +handler h1 read first limit 9; +ERROR 42S02: Unknown table 'h1' in HANDLER +handler h2 read first limit 9; +ERROR 42S02: Unknown table 'h2' in HANDLER +handler h3 read first limit 9; +c1 +test_test.t3 +handler h3 read first limit 9; +c1 +test_test.t3 +use test_test; +handler h3 read first limit 9; +c1 +test_test.t3 +handler test.h3 read first limit 9; +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 'read first limit 9' at line 1 +handler h3 close; +use test; +drop table t3; +drop table t2; +drop table t1; +drop database test_test; +create table t1 (c1 char(20)); +insert into t1 values ("t1"); +handler t1 open as h1; +handler h1 read first limit 9; +c1 +t1 +create table t2 (c1 char(20)); +insert into t2 values ("t2"); +handler t2 open as h2; +handler h2 read first limit 9; +c1 +t2 +create table t3 (c1 char(20)); +insert into t3 values ("t3"); +handler t3 open as h3; +handler h3 read first limit 9; +c1 +t3 +create table t4 (c1 char(20)); +insert into t4 values ("t4"); +handler t4 open as h4; +handler h4 read first limit 9; +c1 +t4 +create table t5 (c1 char(20)); +insert into t5 values ("t5"); +handler t5 open as h5; +handler h5 read first limit 9; +c1 +t5 +alter table t1 engine=MyISAM; +handler h1 read first limit 9; +ERROR 42S02: Unknown table 'h1' in HANDLER +handler h2 read first limit 9; +c1 +t2 +handler h3 read first limit 9; +c1 +t3 +handler h4 read first limit 9; +c1 +t4 +handler h5 read first limit 9; +c1 +t5 +alter table t5 engine=MyISAM; +handler h1 read first limit 9; +ERROR 42S02: Unknown table 'h1' in HANDLER +handler h2 read first limit 9; +c1 +t2 +handler h3 read first limit 9; +c1 +t3 +handler h4 read first limit 9; +c1 +t4 +handler h5 read first limit 9; +ERROR 42S02: Unknown table 'h5' in HANDLER +alter table t3 engine=MyISAM; +handler h1 read first limit 9; +ERROR 42S02: Unknown table 'h1' in HANDLER +handler h2 read first limit 9; +c1 +t2 +handler h3 read first limit 9; +ERROR 42S02: Unknown table 'h3' in HANDLER +handler h4 read first limit 9; +c1 +t4 +handler h5 read first limit 9; +ERROR 42S02: Unknown table 'h5' in HANDLER +handler h2 close; +handler h4 close; +handler t1 open as h1_1; +handler t1 open as h1_2; +handler t1 open as h1_3; +handler h1_1 read first limit 9; +c1 +t1 +handler h1_2 read first limit 9; +c1 +t1 +handler h1_3 read first limit 9; +c1 +t1 +alter table t1 engine=MyISAM; +handler h1_1 read first limit 9; +ERROR 42S02: Unknown table 'h1_1' in HANDLER +handler h1_2 read first limit 9; +ERROR 42S02: Unknown table 'h1_2' in HANDLER +handler h1_3 read first limit 9; +ERROR 42S02: Unknown table 'h1_3' in HANDLER +drop table t1; +drop table t2; +drop table t3; +drop table t4; +drop table t5; diff --git a/mysql-test/r/lock_multi.result b/mysql-test/r/lock_multi.result index a0efce727d3..9eedbf50064 100644 --- a/mysql-test/r/lock_multi.result +++ b/mysql-test/r/lock_multi.result @@ -17,6 +17,18 @@ unlock tables; n 1 drop table t1; +create table t1 (a int, b int); +create table t2 (c int, d int); +insert into t1 values(1,1); +insert into t1 values(2,2); +insert into t2 values(1,2); +lock table t1 read; + update t1,t2 set c=a where b=d; +select c from t2; +c +2 +drop table t1; +drop table t2; create table t1 (a int); create table t2 (a int); lock table t1 write, t2 write; diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index 780ceb36ad6..045a1b05e47 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -1,5 +1,8 @@ drop table if exists t1,t2,t3; drop database if exists mysqltest; +revoke all privileges on mysqltest.t1 from mysqltest_1@localhost; +revoke all privileges on mysqltest.* from mysqltest_1@localhost; +delete from mysql.user where user=_binary'mysqltest_1'; create table t1(id1 int not null auto_increment primary key, t char(12)); create table t2(id2 int not null, t char(12)); create table t3(id3 int not null, t char(12), index(id3)); @@ -152,7 +155,6 @@ ERROR HY000: Table 't2' was locked with a READ lock and can't be updated UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n; ERROR HY000: Table 't2' was locked with a READ lock and can't be updated UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n; -ERROR HY000: Table 't2' was locked with a READ lock and can't be updated unlock tables; LOCK TABLES t1 write, t2 write; UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n; diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index 63463baabfd..7abac3bfb48 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -192,23 +192,23 @@ a concat(b,?) 3 threeMySQL 4 fourMySQL set @arg00='MySQL' ; -select group_concat(@arg00,b) from t1 +select group_concat(@arg00,b order by a) from t1 group by 'a' ; -group_concat(@arg00,b) +group_concat(@arg00,b order by a) MySQLone,MySQLtwo,MySQLthree,MySQLfour -prepare stmt1 from ' select group_concat(?,b) from t1 +prepare stmt1 from ' select group_concat(?,b order by a) from t1 group by ''a'' ' ; execute stmt1 using @arg00; -group_concat(?,b) +group_concat(?,b order by a) MySQLone,MySQLtwo,MySQLthree,MySQLfour -select group_concat(b,@arg00) from t1 +select group_concat(b,@arg00 order by a) from t1 group by 'a' ; -group_concat(b,@arg00) +group_concat(b,@arg00 order by a) oneMySQL,twoMySQL,threeMySQL,fourMySQL -prepare stmt1 from ' select group_concat(b,?) from t1 +prepare stmt1 from ' select group_concat(b,? order by a) from t1 group by ''a'' ' ; execute stmt1 using @arg00; -group_concat(b,?) +group_concat(b,? order by a) oneMySQL,twoMySQL,threeMySQL,fourMySQL set @arg00='first' ; set @arg01='second' ; @@ -319,7 +319,7 @@ a set @arg00= 'one' ; set @arg01= 'two' ; set @arg02= 'five' ; -prepare stmt1 from ' select b FROM t1 where b in (?,?,?) ' ; +prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ; execute stmt1 using @arg00, @arg01, @arg02 ; b one diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result index 70ba4a109d7..e404eb7e97b 100644 --- a/mysql-test/r/ps_3innodb.result +++ b/mysql-test/r/ps_3innodb.result @@ -192,23 +192,23 @@ a concat(b,?) 3 threeMySQL 4 fourMySQL set @arg00='MySQL' ; -select group_concat(@arg00,b) from t1 +select group_concat(@arg00,b order by a) from t1 group by 'a' ; -group_concat(@arg00,b) +group_concat(@arg00,b order by a) MySQLone,MySQLtwo,MySQLthree,MySQLfour -prepare stmt1 from ' select group_concat(?,b) from t1 +prepare stmt1 from ' select group_concat(?,b order by a) from t1 group by ''a'' ' ; execute stmt1 using @arg00; -group_concat(?,b) +group_concat(?,b order by a) MySQLone,MySQLtwo,MySQLthree,MySQLfour -select group_concat(b,@arg00) from t1 +select group_concat(b,@arg00 order by a) from t1 group by 'a' ; -group_concat(b,@arg00) +group_concat(b,@arg00 order by a) oneMySQL,twoMySQL,threeMySQL,fourMySQL -prepare stmt1 from ' select group_concat(b,?) from t1 +prepare stmt1 from ' select group_concat(b,? order by a) from t1 group by ''a'' ' ; execute stmt1 using @arg00; -group_concat(b,?) +group_concat(b,? order by a) oneMySQL,twoMySQL,threeMySQL,fourMySQL set @arg00='first' ; set @arg01='second' ; @@ -319,7 +319,7 @@ a set @arg00= 'one' ; set @arg01= 'two' ; set @arg02= 'five' ; -prepare stmt1 from ' select b FROM t1 where b in (?,?,?) ' ; +prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ; execute stmt1 using @arg00, @arg01, @arg02 ; b one diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result index 4c68f0c8593..94c9b2c357a 100644 --- a/mysql-test/r/ps_4heap.result +++ b/mysql-test/r/ps_4heap.result @@ -193,23 +193,23 @@ a concat(b,?) 3 threeMySQL 4 fourMySQL set @arg00='MySQL' ; -select group_concat(@arg00,b) from t1 +select group_concat(@arg00,b order by a) from t1 group by 'a' ; -group_concat(@arg00,b) +group_concat(@arg00,b order by a) MySQLone,MySQLtwo,MySQLthree,MySQLfour -prepare stmt1 from ' select group_concat(?,b) from t1 +prepare stmt1 from ' select group_concat(?,b order by a) from t1 group by ''a'' ' ; execute stmt1 using @arg00; -group_concat(?,b) +group_concat(?,b order by a) MySQLone,MySQLtwo,MySQLthree,MySQLfour -select group_concat(b,@arg00) from t1 +select group_concat(b,@arg00 order by a) from t1 group by 'a' ; -group_concat(b,@arg00) +group_concat(b,@arg00 order by a) oneMySQL,twoMySQL,threeMySQL,fourMySQL -prepare stmt1 from ' select group_concat(b,?) from t1 +prepare stmt1 from ' select group_concat(b,? order by a) from t1 group by ''a'' ' ; execute stmt1 using @arg00; -group_concat(b,?) +group_concat(b,? order by a) oneMySQL,twoMySQL,threeMySQL,fourMySQL set @arg00='first' ; set @arg01='second' ; @@ -320,7 +320,7 @@ a set @arg00= 'one' ; set @arg01= 'two' ; set @arg02= 'five' ; -prepare stmt1 from ' select b FROM t1 where b in (?,?,?) ' ; +prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ; execute stmt1 using @arg00, @arg01, @arg02 ; b one diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result index af5d08d5eb4..f4903baf979 100644 --- a/mysql-test/r/ps_5merge.result +++ b/mysql-test/r/ps_5merge.result @@ -235,23 +235,23 @@ a concat(b,?) 3 threeMySQL 4 fourMySQL set @arg00='MySQL' ; -select group_concat(@arg00,b) from t1 +select group_concat(@arg00,b order by a) from t1 group by 'a' ; -group_concat(@arg00,b) +group_concat(@arg00,b order by a) MySQLone,MySQLtwo,MySQLthree,MySQLfour -prepare stmt1 from ' select group_concat(?,b) from t1 +prepare stmt1 from ' select group_concat(?,b order by a) from t1 group by ''a'' ' ; execute stmt1 using @arg00; -group_concat(?,b) +group_concat(?,b order by a) MySQLone,MySQLtwo,MySQLthree,MySQLfour -select group_concat(b,@arg00) from t1 +select group_concat(b,@arg00 order by a) from t1 group by 'a' ; -group_concat(b,@arg00) +group_concat(b,@arg00 order by a) oneMySQL,twoMySQL,threeMySQL,fourMySQL -prepare stmt1 from ' select group_concat(b,?) from t1 +prepare stmt1 from ' select group_concat(b,? order by a) from t1 group by ''a'' ' ; execute stmt1 using @arg00; -group_concat(b,?) +group_concat(b,? order by a) oneMySQL,twoMySQL,threeMySQL,fourMySQL set @arg00='first' ; set @arg01='second' ; @@ -362,7 +362,7 @@ a set @arg00= 'one' ; set @arg01= 'two' ; set @arg02= 'five' ; -prepare stmt1 from ' select b FROM t1 where b in (?,?,?) ' ; +prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ; execute stmt1 using @arg00, @arg01, @arg02 ; b one @@ -3243,23 +3243,23 @@ a concat(b,?) 3 threeMySQL 4 fourMySQL set @arg00='MySQL' ; -select group_concat(@arg00,b) from t1 +select group_concat(@arg00,b order by a) from t1 group by 'a' ; -group_concat(@arg00,b) +group_concat(@arg00,b order by a) MySQLone,MySQLtwo,MySQLthree,MySQLfour -prepare stmt1 from ' select group_concat(?,b) from t1 +prepare stmt1 from ' select group_concat(?,b order by a) from t1 group by ''a'' ' ; execute stmt1 using @arg00; -group_concat(?,b) +group_concat(?,b order by a) MySQLone,MySQLtwo,MySQLthree,MySQLfour -select group_concat(b,@arg00) from t1 +select group_concat(b,@arg00 order by a) from t1 group by 'a' ; -group_concat(b,@arg00) +group_concat(b,@arg00 order by a) oneMySQL,twoMySQL,threeMySQL,fourMySQL -prepare stmt1 from ' select group_concat(b,?) from t1 +prepare stmt1 from ' select group_concat(b,? order by a) from t1 group by ''a'' ' ; execute stmt1 using @arg00; -group_concat(b,?) +group_concat(b,? order by a) oneMySQL,twoMySQL,threeMySQL,fourMySQL set @arg00='first' ; set @arg01='second' ; @@ -3370,7 +3370,7 @@ a set @arg00= 'one' ; set @arg01= 'two' ; set @arg02= 'five' ; -prepare stmt1 from ' select b FROM t1 where b in (?,?,?) ' ; +prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ; execute stmt1 using @arg00, @arg01, @arg02 ; b one diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result index 75358bd201b..0d5054dacdc 100644 --- a/mysql-test/r/ps_6bdb.result +++ b/mysql-test/r/ps_6bdb.result @@ -192,23 +192,23 @@ a concat(b,?) 3 threeMySQL 4 fourMySQL set @arg00='MySQL' ; -select group_concat(@arg00,b) from t1 +select group_concat(@arg00,b order by a) from t1 group by 'a' ; -group_concat(@arg00,b) +group_concat(@arg00,b order by a) MySQLone,MySQLtwo,MySQLthree,MySQLfour -prepare stmt1 from ' select group_concat(?,b) from t1 +prepare stmt1 from ' select group_concat(?,b order by a) from t1 group by ''a'' ' ; execute stmt1 using @arg00; -group_concat(?,b) +group_concat(?,b order by a) MySQLone,MySQLtwo,MySQLthree,MySQLfour -select group_concat(b,@arg00) from t1 +select group_concat(b,@arg00 order by a) from t1 group by 'a' ; -group_concat(b,@arg00) +group_concat(b,@arg00 order by a) oneMySQL,twoMySQL,threeMySQL,fourMySQL -prepare stmt1 from ' select group_concat(b,?) from t1 +prepare stmt1 from ' select group_concat(b,? order by a) from t1 group by ''a'' ' ; execute stmt1 using @arg00; -group_concat(b,?) +group_concat(b,? order by a) oneMySQL,twoMySQL,threeMySQL,fourMySQL set @arg00='first' ; set @arg01='second' ; @@ -319,7 +319,7 @@ a set @arg00= 'one' ; set @arg01= 'two' ; set @arg02= 'five' ; -prepare stmt1 from ' select b FROM t1 where b in (?,?,?) ' ; +prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ; execute stmt1 using @arg00, @arg01, @arg02 ; b one diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result index e33bbd7002c..2d3fea3236e 100644 --- a/mysql-test/r/ps_7ndb.result +++ b/mysql-test/r/ps_7ndb.result @@ -193,24 +193,24 @@ a concat(b,?) 3 threeMySQL 4 fourMySQL set @arg00='MySQL' ; -select group_concat(@arg00,b) from t1 +select group_concat(@arg00,b order by a) from t1 group by 'a' ; -group_concat(@arg00,b) -MySQLtwo,MySQLfour,MySQLthree,MySQLone -prepare stmt1 from ' select group_concat(?,b) from t1 +group_concat(@arg00,b order by a) +MySQLone,MySQLtwo,MySQLthree,MySQLfour +prepare stmt1 from ' select group_concat(?,b order by a) from t1 group by ''a'' ' ; execute stmt1 using @arg00; -group_concat(?,b) -MySQLtwo,MySQLfour,MySQLthree,MySQLone -select group_concat(b,@arg00) from t1 +group_concat(?,b order by a) +MySQLone,MySQLtwo,MySQLthree,MySQLfour +select group_concat(b,@arg00 order by a) from t1 group by 'a' ; -group_concat(b,@arg00) -twoMySQL,fourMySQL,threeMySQL,oneMySQL -prepare stmt1 from ' select group_concat(b,?) from t1 +group_concat(b,@arg00 order by a) +oneMySQL,twoMySQL,threeMySQL,fourMySQL +prepare stmt1 from ' select group_concat(b,? order by a) from t1 group by ''a'' ' ; execute stmt1 using @arg00; -group_concat(b,?) -twoMySQL,fourMySQL,threeMySQL,oneMySQL +group_concat(b,? order by a) +oneMySQL,twoMySQL,threeMySQL,fourMySQL set @arg00='first' ; set @arg01='second' ; set @arg02=NULL; @@ -320,11 +320,11 @@ a set @arg00= 'one' ; set @arg01= 'two' ; set @arg02= 'five' ; -prepare stmt1 from ' select b FROM t1 where b in (?,?,?) ' ; +prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ; execute stmt1 using @arg00, @arg01, @arg02 ; b -two one +two prepare stmt1 from ' select b FROM t1 where b like ? '; set @arg00='two' ; execute stmt1 using @arg00 ; @@ -1334,7 +1334,7 @@ prepare stmt1 from 'update t1 set a=? where b=? execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ; affected rows: 0 info: Rows matched: 0 Changed: 0 Warnings: 0 -select a,b from t1 order by a; +select a,b from t1 order by a ; a b 1 one 2 two diff --git a/mysql-test/r/rename.result b/mysql-test/r/rename.result index ec36f015412..76c0f4422fe 100644 --- a/mysql-test/r/rename.result +++ b/mysql-test/r/rename.result @@ -1,5 +1,5 @@ drop table if exists t0,t1,t2,t3,t4; -drop table if exists t0,t5,t6,t7,t8,t9; +drop table if exists t0,t5,t6,t7,t8,t9,t1_1,t1_2,t9_1,t9_2; create table t0 SELECT 1,"table 1"; create table t2 SELECT 2,"table 2"; create table t3 SELECT 3,"table 3"; diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index f0618c0f153..ba0a80331b1 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -1,4 +1,5 @@ drop table if exists t1,t2,t3,t4; +drop table if exists t1_1,t1_2,t9_1,t9_2; CREATE TABLE t1 ( Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 8b52e6efedc..8256c8d692a 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -1,5 +1,8 @@ drop table if exists t1,t2; drop database if exists mysqltest; +delete from mysql.user where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3'; +delete from mysql.db where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3'; +flush privileges; create table t1 (a int not null primary key, b int not null,c int not null, key(b,c)); insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4); check table t1 fast; diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result index 6a7cecdd460..42fdc7e50c6 100644 --- a/mysql-test/r/type_timestamp.result +++ b/mysql-test/r/type_timestamp.result @@ -92,9 +92,6 @@ date date_time time_stamp 2005-01-01 2005-01-01 00:00:00 2005-01-01 00:00:00 2030-01-01 2030-01-01 00:00:00 2030-01-01 00:00:00 drop table t1; -show variables like 'new'; -Variable_name Value -new OFF create table t1 (t2 timestamp(2), t4 timestamp(4), t6 timestamp(6), t8 timestamp(8), t10 timestamp(10), t12 timestamp(12), t14 timestamp(14)); @@ -106,7 +103,6 @@ select * from t1; 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 -set new=1; select * from t1; 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 @@ -409,15 +405,20 @@ a b NULL NULL NULL 2003-01-01 00:00:00 drop table t1; -create table t1 (ts timestamp(19)); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `ts` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -set TIMESTAMP=1000000000; -insert into t1 values (); +create table t1 (a bigint, b bigint); +insert into t1 values (NULL, NULL), (20030101000000, 20030102000000); +set timestamp=1000000019; +alter table t1 modify a timestamp, modify b timestamp; select * from t1; -ts -2001-09-09 04:46:40 +a b +2001-09-09 04:46:59 2001-09-09 04:46:59 +2003-01-01 00:00:00 2003-01-02 00:00:00 +drop table t1; +create table t1 (a char(2), t timestamp); +insert into t1 values ('a', '2004-01-01 00:00:00'), ('a', '2004-01-01 01:00:00'), +('b', '2004-02-01 00:00:00'); +select max(t) from t1 group by a; +max(t) +2004-01-01 01:00:00 +2004-02-01 00:00:00 drop table t1; diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result index 0037fb9ea95..6d2e623a6fb 100644 --- a/mysql-test/r/update.result +++ b/mysql-test/r/update.result @@ -169,3 +169,40 @@ F1 F2 F3 cnt groupid 2 0 1 2 4 2 2 0 1 7 drop table t1; +CREATE TABLE t1 ( +`colA` int(10) unsigned NOT NULL auto_increment, +`colB` int(11) NOT NULL default '0', +PRIMARY KEY (`colA`) +); +INSERT INTO t1 VALUES (4433,5424); +CREATE TABLE t2 ( +`colC` int(10) unsigned NOT NULL default '0', +`colA` int(10) unsigned NOT NULL default '0', +`colD` int(10) unsigned NOT NULL default '0', +`colE` int(10) unsigned NOT NULL default '0', +`colF` int(10) unsigned NOT NULL default '0', +PRIMARY KEY (`colC`,`colA`,`colD`,`colE`) +); +INSERT INTO t2 VALUES (3,4433,10005,495,500); +INSERT INTO t2 VALUES (3,4433,10005,496,500); +INSERT INTO t2 VALUES (3,4433,10009,494,500); +INSERT INTO t2 VALUES (3,4433,10011,494,500); +INSERT INTO t2 VALUES (3,4433,10005,497,500); +INSERT INTO t2 VALUES (3,4433,10013,489,500); +INSERT INTO t2 VALUES (3,4433,10005,494,500); +INSERT INTO t2 VALUES (3,4433,10005,493,500); +INSERT INTO t2 VALUES (3,4433,10005,492,500); +UPDATE IGNORE t2,t1 set t2.colE = t2.colE + 1,colF=0 WHERE t1.colA = t2.colA AND (t1.colB & 4096) > 0 AND (colE + 1) < colF; +SELECT * FROM t2; +colC colA colD colE colF +3 4433 10005 495 500 +3 4433 10005 496 500 +3 4433 10009 495 0 +3 4433 10011 495 0 +3 4433 10005 498 0 +3 4433 10013 490 0 +3 4433 10005 494 500 +3 4433 10005 493 500 +3 4433 10005 492 500 +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test index e5986e6755d..8e11a3d68a5 100644 --- a/mysql-test/t/auto_increment.test +++ b/mysql-test/t/auto_increment.test @@ -168,3 +168,41 @@ update t1 set a=NULL where b=13; update t1 set a=500 where b=14; select * from t1 order by b; drop table t1; + +# +# Test of behavior of ALTER TABLE when coulmn containing NULL or zeroes is +# converted to AUTO_INCREMENT column +# +create table t1 (a bigint); +insert into t1 values (1), (2), (3), (NULL), (NULL); +alter table t1 modify a bigint not null auto_increment primary key; +select * from t1; +drop table t1; + +create table t1 (a bigint); +insert into t1 values (1), (2), (3), (0), (0); +alter table t1 modify a bigint not null auto_increment primary key; +select * from t1; +drop table t1; + +# We still should be able to preserve zero in NO_AUTO_VALUE_ON_ZERO mode +create table t1 (a bigint); +insert into t1 values (0), (1), (2), (3); +set sql_mode=NO_AUTO_VALUE_ON_ZERO; +alter table t1 modify a bigint not null auto_increment primary key; +set sql_mode= ''; +select * from t1; +drop table t1; + +# It also sensible to preserve zeroes if we are converting auto_increment +# column to auto_increment column (or not touching it at all, which is more +# common case probably) +create table t1 (a int auto_increment primary key , b int null); +set sql_mode=NO_AUTO_VALUE_ON_ZERO; +insert into t1 values (0,1),(1,2),(2,3); +select * from t1; +set sql_mode= ''; +alter table t1 modify b varchar(255); +insert into t1 values (0,4); +select * from t1; +drop table t1; diff --git a/mysql-test/t/ctype_latin1_de.test b/mysql-test/t/ctype_latin1_de.test index e29e43496af..1c9576c1c56 100644 --- a/mysql-test/t/ctype_latin1_de.test +++ b/mysql-test/t/ctype_latin1_de.test @@ -86,6 +86,23 @@ select * from t1 where word like binary 0xDF; select * from t1 where word like CAST(0xDF as CHAR); drop table t1; +# +# Bug #5447 Select does not find records +# +CREATE TABLE t1 ( + autor varchar(80) NOT NULL default '', + PRIMARY KEY (autor) +); +INSERT INTO t1 VALUES ('Powell, B.'),('Powell, Bud.'),('Powell, L. H.'),('Power, H.'), +('Poynter, M. A. L. Lane'),('Poynting, J. H. und J. J. Thomson.'),('Pozzi, S(amuel-Jean).'), +('Pozzi, Samuel-Jean.'),('Pozzo, A.'),('Pozzoli, Serge.'); +SELECT * FROM t1 WHERE autor LIKE 'Poz%' ORDER BY autor; +DROP TABLE t1; + +# +# Test of special character in german collation +# + CREATE TABLE t1 ( s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci ); diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test index 56c8ce77627..5f60445d765 100644 --- a/mysql-test/t/delete.test +++ b/mysql-test/t/delete.test @@ -71,6 +71,16 @@ delete from t1 where 3 > 2; select count(*) from t1; drop table t1; +# +# Bug #5733: Table handler error with self-join multi-table DELETE +# + +create table t1 (a int not null auto_increment primary key, b char(32)); +insert into t1 (b) values ('apple'), ('apple'); +select * from t1; +delete t1 from t1, t1 as t2 where t1.b = t2.b and t1.a > t2.a; +select * from t1; +drop table t1; # # IGNORE option diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index fbfd3ccdef1..64e3fe8929b 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -101,7 +101,7 @@ SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1; # # Connect without a database create table t1 select 1 as a; -connect (con1,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,master.sock); +connect (con1,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK); connection con1; --error 1046 select 2 as a from (select * from t1) b; diff --git a/mysql-test/t/flush_table.test b/mysql-test/t/flush_table.test index 8bee94cf21f..afb30d21da7 100644 --- a/mysql-test/t/flush_table.test +++ b/mysql-test/t/flush_table.test @@ -16,7 +16,8 @@ drop table t1; # # In the following test FLUSH TABLES produces a deadlock -# (hang forever) if the fix for bug#3565 is missing. +# (hang forever) if the fix for BUG #3565 is missing. +# And it shows that handler tables are re-opened after flush (BUG #4286). # create table t1(table_id char(20) primary key); create table t2(table_id char(20) primary key); @@ -31,28 +32,43 @@ handler a1 read first limit 9; handler a2 read first limit 9; handler t2 read first limit 9; flush tables; ---error 1109; handler a1 read first limit 9; ---error 1109; handler a2 read first limit 9; ---error 1109; handler t2 read first limit 9; # +--error 1066 handler t1 open as a1; +--error 1066 handler t1 open as a2; +--error 1066 handler t2 open; handler a1 read first limit 9; handler a2 read first limit 9; handler t2 read first limit 9; flush table t1; ---error 1109; handler a1 read first limit 9; ---error 1109; handler a2 read first limit 9; handler t2 read first limit 9; flush table t2; ---error 1109; handler t2 close; drop table t1; drop table t2; +# +# The fix for BUG #4286 cannot restore the position after a flush. +# +create table t1(table_id char(20) primary key); +insert into t1 values ('Record-01'); +insert into t1 values ('Record-02'); +insert into t1 values ('Record-03'); +insert into t1 values ('Record-04'); +insert into t1 values ('Record-05'); +handler t1 open; +handler t1 read first limit 1; +handler t1 read next limit 1; +handler t1 read next limit 1; +flush table t1; +handler t1 read next limit 1; +handler t1 read next limit 1; +handler t1 close; +drop table t1; diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test index 7048d188604..693773b18c8 100644 --- a/mysql-test/t/func_if.test +++ b/mysql-test/t/func_if.test @@ -56,3 +56,7 @@ insert t1 values (1),(2); select if(1>2,a,avg(a)) from t1; drop table t1; +# +# Bug #5595 NULLIF() IS NULL returns false if NULLIF() returns NULL +# +SELECT NULLIF(5,5) IS NULL, NULLIF(5,5) IS NOT NULL; diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index e7852df40b3..3eab694ee05 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -182,6 +182,13 @@ select a, quote(a), isnull(quote(a)), quote(a) is null, ifnull(quote(a), 'n') fr drop table t1; # +# Bug #5498: TRIM fails with LEADING or TRAILING if remstr = str +# + +select trim(trailing 'foo' from 'foo'); +select trim(leading 'foo' from 'foo'); + +# # Test collation and coercibility # diff --git a/mysql-test/t/handler.test b/mysql-test/t/handler.test index 685f438712c..3de8e8ae784 100644 --- a/mysql-test/t/handler.test +++ b/mysql-test/t/handler.test @@ -138,3 +138,211 @@ handler t1 read a=(1) where b=1; handler t1 close; drop table t1; +# +# Check if two database names beginning the same are seen as different. +# +# This database begins like the usual 'test' database. +# +--disable_warnings +drop database if exists test_test; +--enable_warnings +create database test_test; +use test_test; +create table t1(table_id char(20) primary key); +insert into t1 values ('test_test.t1'); +insert into t1 values (''); +handler t1 open; +handler t1 read first limit 9; +create table t2(table_id char(20) primary key); +insert into t2 values ('test_test.t2'); +insert into t2 values (''); +handler t2 open; +handler t2 read first limit 9; +# +# This is the usual 'test' database. +# +use test; +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1(table_id char(20) primary key); +insert into t1 values ('test.t1'); +insert into t1 values (''); +--error 1066 +handler t1 open; +# +# Check accesibility of all the tables. +# +use test; +--error 1064 +handler test.t1 read first limit 9; +--error 1064 +handler test_test.t1 read first limit 9; +handler t1 read first limit 9; +--error 1064 +handler test_test.t2 read first limit 9; +handler t2 read first limit 9; + +# +# Cleanup. +# + +--error 1064 +handler test_test.t1 close; +handler t1 close; +drop table test_test.t1; +--error 1064 +handler test_test.t2 close; +handler t2 close; +drop table test_test.t2; +drop database test_test; + +# +use test; +--error 1064 +handler test.t1 close; +--error 1109 +handler t1 close; +drop table test.t1; + +# +# BUG#4335 +# +--disable_warnings +drop database if exists test_test; +drop table if exists t1; +drop table if exists t2; +drop table if exists t3; +--enable_warnings +create database test_test; +use test_test; +create table t1 (c1 char(20)); +insert into t1 values ('test_test.t1'); +create table t3 (c1 char(20)); +insert into t3 values ('test_test.t3'); +handler t1 open; +handler t1 read first limit 9; +handler t1 open h1; +handler h1 read first limit 9; +use test; +create table t1 (c1 char(20)); +create table t2 (c1 char(20)); +create table t3 (c1 char(20)); +insert into t1 values ('t1'); +insert into t2 values ('t2'); +insert into t3 values ('t3'); +--error 1066 +handler t1 open; +--error 1066 +handler t2 open t1; +--error 1066 +handler t3 open t1; +handler t1 read first limit 9; +--error 1064 +handler test.t1 close; +--error 1066 +handler test.t1 open h1; +--error 1066 +handler test_test.t1 open h1; +handler test_test.t3 open h3; +handler test.t1 open h2; +handler t1 read first limit 9; +handler h1 read first limit 9; +handler h2 read first limit 9; +handler h3 read first limit 9; +handler h2 read first limit 9; +--error 1064 +handler test.h1 close; +handler t1 close; +handler h1 close; +handler h2 close; +--error 1109 +handler t1 read first limit 9; +--error 1109 +handler h1 read first limit 9; +--error 1109 +handler h2 read first limit 9; +handler h3 read first limit 9; +handler h3 read first limit 9; +use test_test; +handler h3 read first limit 9; +--error 1064 +handler test.h3 read first limit 9; +handler h3 close; +use test; +drop table t3; +drop table t2; +drop table t1; +drop database test_test; + +# +# Test if fix for BUG#4286 correctly closes handler tables. +# +create table t1 (c1 char(20)); +insert into t1 values ("t1"); +handler t1 open as h1; +handler h1 read first limit 9; +create table t2 (c1 char(20)); +insert into t2 values ("t2"); +handler t2 open as h2; +handler h2 read first limit 9; +create table t3 (c1 char(20)); +insert into t3 values ("t3"); +handler t3 open as h3; +handler h3 read first limit 9; +create table t4 (c1 char(20)); +insert into t4 values ("t4"); +handler t4 open as h4; +handler h4 read first limit 9; +create table t5 (c1 char(20)); +insert into t5 values ("t5"); +handler t5 open as h5; +handler h5 read first limit 9; +# close first +alter table t1 engine=MyISAM; +--error 1109; +handler h1 read first limit 9; +handler h2 read first limit 9; +handler h3 read first limit 9; +handler h4 read first limit 9; +handler h5 read first limit 9; +# close last +alter table t5 engine=MyISAM; +--error 1109; +handler h1 read first limit 9; +handler h2 read first limit 9; +handler h3 read first limit 9; +handler h4 read first limit 9; +--error 1109; +handler h5 read first limit 9; +# close middle +alter table t3 engine=MyISAM; +--error 1109; +handler h1 read first limit 9; +handler h2 read first limit 9; +--error 1109; +handler h3 read first limit 9; +handler h4 read first limit 9; +--error 1109; +handler h5 read first limit 9; +handler h2 close; +handler h4 close; +# close all depending handler tables +handler t1 open as h1_1; +handler t1 open as h1_2; +handler t1 open as h1_3; +handler h1_1 read first limit 9; +handler h1_2 read first limit 9; +handler h1_3 read first limit 9; +alter table t1 engine=MyISAM; +--error 1109; +handler h1_1 read first limit 9; +--error 1109; +handler h1_2 read first limit 9; +--error 1109; +handler h1_3 read first limit 9; +drop table t1; +drop table t2; +drop table t3; +drop table t4; +drop table t5; diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test index fa095275182..cbda47ac864 100644 --- a/mysql-test/t/lock_multi.test +++ b/mysql-test/t/lock_multi.test @@ -53,6 +53,30 @@ reap; drop table t1; # +# Test problem when using locks with multi-updates +# It should not block when multi-update is reading on a read-locked table +# + +connection locker; +create table t1 (a int, b int); +create table t2 (c int, d int); +insert into t1 values(1,1); +insert into t1 values(2,2); +insert into t2 values(1,2); +lock table t1 read; +connection writer; +--sleep 2 +send update t1,t2 set c=a where b=d; +connection reader; +--sleep 2 +select c from t2; +connection writer; +reap; +connection locker; +drop table t1; +drop table t2; + +# # Test problem when using locks on many tables and droping a table that # is to-be-locked by another thread # diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index 40e742679f8..e2aebd014f8 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -5,6 +5,11 @@ --disable_warnings drop table if exists t1,t2,t3; drop database if exists mysqltest; +--error 0,1141 +revoke all privileges on mysqltest.t1 from mysqltest_1@localhost; +--error 0,1141 +revoke all privileges on mysqltest.* from mysqltest_1@localhost; +delete from mysql.user where user=_binary'mysqltest_1'; --enable_warnings create table t1(id1 int not null auto_increment primary key, t char(12)); @@ -154,8 +159,6 @@ LOCK TABLES t1 write, t2 read; DELETE t1.*, t2.* FROM t1,t2 where t1.n=t2.n; --error 1099 UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n; -# The following should be fixed to not give an error ---error 1099 UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n; unlock tables; LOCK TABLES t1 write, t2 write; @@ -385,10 +388,10 @@ select * from t2; drop table t1, t2; # -# prevelege chexk for multiupdate with other tables +# privilege check for multiupdate with other tables # -connect (root,localhost,root,,test,$MASTER_MYPORT,master.sock); +connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connection root; --disable_warnings create database mysqltest; @@ -398,7 +401,7 @@ create table mysqltest.t2 (a int, b int, primary key (a)); create table mysqltest.t3 (a int, b int, primary key (a)); grant select on mysqltest.* to mysqltest_1@localhost; grant update on mysqltest.t1 to mysqltest_1@localhost; -connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,master.sock); +connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK); connection user1; update t1, t2 set t1.b=1 where t1.a=t2.a; update t1, t2 set t1.b=(select t3.b from t3 where t1.a=t3.a) where t1.a=t2.a; diff --git a/mysql-test/t/ps_7ndb.test b/mysql-test/t/ps_7ndb.test index 30e45f44a0e..af669a26400 100644 --- a/mysql-test/t/ps_7ndb.test +++ b/mysql-test/t/ps_7ndb.test @@ -177,7 +177,7 @@ prepare stmt1 from 'update t1 set a=? where b=? --enable_info execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ; --disable_info -select a,b from t1 order by a; +select a,b from t1 order by a ; drop table t2 ; ## update with parameters in limit diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 61886221fcf..cd6620f7126 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -423,6 +423,9 @@ select count(*) from t1 where x=0; select count(*) from t1 where x<0; select count(*) from t1 where x < -16; select count(*) from t1 where x = -16; +# The following query returns wrong value because the range optimizer can't +# handle search on a signed value for an unsigned parameter. This will be fixed in +# 5.0 select count(*) from t1 where x > -16; select count(*) from t1 where x = 18446744073709551601; diff --git a/mysql-test/t/rename.test b/mysql-test/t/rename.test index e6dc6ce9456..497ff721c99 100644 --- a/mysql-test/t/rename.test +++ b/mysql-test/t/rename.test @@ -5,7 +5,7 @@ --disable_warnings drop table if exists t0,t1,t2,t3,t4; # Clear up from other tests (to ensure that SHOW TABLES below is right) -drop table if exists t0,t5,t6,t7,t8,t9; +drop table if exists t0,t5,t6,t7,t8,t9,t1_1,t1_2,t9_1,t9_2; --enable_warnings create table t0 SELECT 1,"table 1"; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 4490f97765b..c260c7777e2 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -8,6 +8,8 @@ --disable_warnings drop table if exists t1,t2,t3,t4; +# The following may be left from older tests +drop table if exists t1_1,t1_2,t9_1,t9_2; --enable_warnings CREATE TABLE t1 ( diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index 759ed7d22b3..681127eab5e 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -5,6 +5,10 @@ --disable_warnings drop table if exists t1,t2; drop database if exists mysqltest; + +delete from mysql.user where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3'; +delete from mysql.db where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3'; +flush privileges; --enable_warnings create table t1 (a int not null primary key, b int not null,c int not null, key(b,c)); diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test index 3f0b41d7221..a8a0cf8703c 100644 --- a/mysql-test/t/type_timestamp.test +++ b/mysql-test/t/type_timestamp.test @@ -62,7 +62,6 @@ INSERT INTO t1 VALUES ("2030-01-01","2030-01-01 00:00:00",20300101000000); SELECT * FROM t1; drop table t1; -show variables like 'new'; create table t1 (t2 timestamp(2), t4 timestamp(4), t6 timestamp(6), t8 timestamp(8), t10 timestamp(10), t12 timestamp(12), t14 timestamp(14)); @@ -71,7 +70,6 @@ insert t1 values (0,0,0,0,0,0,0), "1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59"); select * from t1; -set new=1; select * from t1; drop table t1; @@ -258,6 +256,9 @@ select * from t1; drop table t1; # It is also OK to specify NULL as default explicitly for such fields. +# This is also a test for bug #2464, DEFAULT keyword in INSERT statement +# should return default value for column. + create table t1 (a timestamp null default null, b timestamp null default '2003-01-01 00:00:00'); show create table t1; insert into t1 values (NULL, NULL); @@ -266,12 +267,22 @@ select * from t1; drop table t1; # -# Test for bug #4491, TIMESTAMP(19) should be possible to create and not -# only read in 4.0 +# Let us test behavior of ALTER TABLE when it converts columns +# containing NULL to TIMESTAMP columns. # -create table t1 (ts timestamp(19)); -show create table t1; -set TIMESTAMP=1000000000; -insert into t1 values (); +create table t1 (a bigint, b bigint); +insert into t1 values (NULL, NULL), (20030101000000, 20030102000000); +set timestamp=1000000019; +alter table t1 modify a timestamp, modify b timestamp; select * from t1; drop table t1; + +# +# Test for bug #4131, TIMESTAMP columns missing minutes and seconds when +# using GROUP BY in @@new=1 mode. +# +create table t1 (a char(2), t timestamp); +insert into t1 values ('a', '2004-01-01 00:00:00'), ('a', '2004-01-01 01:00:00'), + ('b', '2004-02-01 00:00:00'); +select max(t) from t1 group by a; +drop table t1; diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test index 6ca75cf0c26..aeefa3c33f5 100644 --- a/mysql-test/t/update.test +++ b/mysql-test/t/update.test @@ -128,3 +128,36 @@ insert into t1 (F1,F2,F3,cnt,groupid) values ('0','0','0',1,6), delete from m1 using t1 m1,t1 m2 where m1.groupid=m2.groupid and (m1.cnt < m2.cnt or m1.cnt=m2.cnt and m1.F3>m2.F3); select * from t1; drop table t1; + +# +# Bug#5553 - Multi table UPDATE IGNORE fails on duplicate keys +# + +CREATE TABLE t1 ( + `colA` int(10) unsigned NOT NULL auto_increment, + `colB` int(11) NOT NULL default '0', + PRIMARY KEY (`colA`) +); +INSERT INTO t1 VALUES (4433,5424); +CREATE TABLE t2 ( + `colC` int(10) unsigned NOT NULL default '0', + `colA` int(10) unsigned NOT NULL default '0', + `colD` int(10) unsigned NOT NULL default '0', + `colE` int(10) unsigned NOT NULL default '0', + `colF` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`colC`,`colA`,`colD`,`colE`) +); +INSERT INTO t2 VALUES (3,4433,10005,495,500); +INSERT INTO t2 VALUES (3,4433,10005,496,500); +INSERT INTO t2 VALUES (3,4433,10009,494,500); +INSERT INTO t2 VALUES (3,4433,10011,494,500); +INSERT INTO t2 VALUES (3,4433,10005,497,500); +INSERT INTO t2 VALUES (3,4433,10013,489,500); +INSERT INTO t2 VALUES (3,4433,10005,494,500); +INSERT INTO t2 VALUES (3,4433,10005,493,500); +INSERT INTO t2 VALUES (3,4433,10005,492,500); +UPDATE IGNORE t2,t1 set t2.colE = t2.colE + 1,colF=0 WHERE t1.colA = t2.colA AND (t1.colB & 4096) > 0 AND (colE + 1) < colF; +SELECT * FROM t2; +DROP TABLE t1; +DROP TABLE t2; + |