diff options
author | Ramil Kalimullin <ramil@mysql.com> | 2008-10-02 13:10:06 +0500 |
---|---|---|
committer | Ramil Kalimullin <ramil@mysql.com> | 2008-10-02 13:10:06 +0500 |
commit | 1ce81aac15f0e7a89aef78f8e25ec7976f37972c (patch) | |
tree | 0c7ed2ea227afd90471853f9cc4cc08c79549230 /mysql-test | |
parent | d3e317d16befe9e6d7ade3e0527dca10609577ad (diff) | |
parent | 652565d3622d2c6a81313aa6faf5e44fd2c9d57b (diff) | |
download | mariadb-git-1ce81aac15f0e7a89aef78f8e25ec7976f37972c.tar.gz |
merge
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/include/ndb_backup_print.inc | 3 | ||||
-rw-r--r-- | mysql-test/r/distinct.result | 59 | ||||
-rw-r--r-- | mysql-test/r/federated.result | 70 | ||||
-rw-r--r-- | mysql-test/r/loaddata.result | 120 | ||||
-rw-r--r-- | mysql-test/r/mysqldump.result | 6 | ||||
-rw-r--r-- | mysql-test/r/sp-error.result | 7 | ||||
-rw-r--r-- | mysql-test/r/sp.result | 10 | ||||
-rw-r--r-- | mysql-test/t/binlog_killed_simulate.test | 4 | ||||
-rw-r--r-- | mysql-test/t/binlog_start_comment.test | 2 | ||||
-rw-r--r-- | mysql-test/t/ctype_big5.test | 3 | ||||
-rw-r--r-- | mysql-test/t/distinct.test | 129 | ||||
-rw-r--r-- | mysql-test/t/federated.test | 105 | ||||
-rw-r--r-- | mysql-test/t/loaddata.test | 182 | ||||
-rw-r--r-- | mysql-test/t/mysqldump.test | 12 | ||||
-rw-r--r-- | mysql-test/t/ndb_autodiscover.test | 62 | ||||
-rw-r--r-- | mysql-test/t/ndb_loaddatalocal.test | 8 | ||||
-rw-r--r-- | mysql-test/t/ndb_restore_print.test | 20 | ||||
-rw-r--r-- | mysql-test/t/outfile.test | 12 | ||||
-rw-r--r-- | mysql-test/t/rpl_EE_error.test | 6 | ||||
-rw-r--r-- | mysql-test/t/rpl_loaddatalocal.test | 4 | ||||
-rw-r--r-- | mysql-test/t/sp-error.test | 8 | ||||
-rw-r--r-- | mysql-test/t/sp.test | 18 | ||||
-rw-r--r-- | mysql-test/t/symlink.test | 17 |
23 files changed, 683 insertions, 184 deletions
diff --git a/mysql-test/include/ndb_backup_print.inc b/mysql-test/include/ndb_backup_print.inc index 57fb279491c..7527f125686 100644 --- a/mysql-test/include/ndb_backup_print.inc +++ b/mysql-test/include/ndb_backup_print.inc @@ -1,6 +1,7 @@ --exec $NDB_TOOLS_DIR/ndb_restore --no-defaults $ndb_restore_opts -b $the_backup_id -n 1 $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id $ndb_restore_filter > $MYSQLTEST_VARDIR/tmp/tmp.dat --exec $NDB_TOOLS_DIR/ndb_restore --no-defaults $ndb_restore_opts -b $the_backup_id -n 2 $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id $ndb_restore_filter >> $MYSQLTEST_VARDIR/tmp/tmp.dat --exec sort $MYSQLTEST_VARDIR/tmp/tmp.dat ---exec rm -f $MYSQLTEST_VARDIR/tmp/tmp.dat +--error 0,1 +--remove_file $MYSQLTEST_VARDIR/tmp/tmp.dat --let ndb_restore_opts= --let ndb_restore_filter= diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index 8cfe5aa78b5..114d3088fe8 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -608,6 +608,65 @@ id select_type table type possible_keys key key_len ref rows Extra SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a; a a DROP TABLE t1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (id INT NOT NULL, fruit_id INT NOT NULL, fruit_name varchar(20) +default NULL); +INSERT INTO t1 VALUES (1,1,'ORANGE'); +INSERT INTO t1 VALUES (2,2,'APPLE'); +INSERT INTO t1 VALUES (3,2,'APPLE'); +INSERT INTO t1 VALUES (4,3,'PEAR'); +SELECT DISTINCT fruit_id, fruit_name INTO @v1, @v2 FROM t1 WHERE fruit_name = +'APPLE'; +SELECT @v1, @v2; +@v1 @v2 +2 APPLE +SELECT DISTINCT fruit_id, fruit_name INTO @v3, @v4 FROM t1 GROUP BY fruit_id, +fruit_name HAVING fruit_name = 'APPLE'; +SELECT @v3, @v4; +@v3 @v4 +2 APPLE +SELECT DISTINCT @v5:= fruit_id, @v6:= fruit_name INTO @v7, @v8 FROM t1 WHERE +fruit_name = 'APPLE'; +SELECT @v5, @v6, @v7, @v8; +@v5 @v6 @v7 @v8 +3 PEAR 3 PEAR +SELECT DISTINCT @v5 + fruit_id, CONCAT(@v6, fruit_name) INTO @v9, @v10 FROM t1 +WHERE fruit_name = 'APPLE'; +SELECT @v5, @v6, @v7, @v8, @v9, @v10; +@v5 @v6 @v7 @v8 @v9 @v10 +3 PEAR 3 PEAR 5 PEARAPPLE +SELECT DISTINCT @v11:= @v5 + fruit_id, @v12:= CONCAT(@v6, fruit_name) INTO +@v13, @v14 FROM t1 WHERE fruit_name = 'APPLE'; +SELECT @v11, @v12, @v13, @v14; +@v11 @v12 @v13 @v14 +6 PEARPEAR 6 PEARPEAR +SELECT DISTINCT @v13, @v14 INTO @v15, @v16 FROM t1 WHERE fruit_name = 'APPLE'; +SELECT @v15, @v16; +@v15 @v16 +6 PEARPEAR +SELECT DISTINCT 2 + 2, 'Bob' INTO @v17, @v18 FROM t1 WHERE fruit_name = +'APPLE'; +SELECT @v17, @v18; +@v17 @v18 +4 Bob +DROP TABLE IF EXISTS t2; +CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20) +default NULL); +SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE +'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE'; +LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2; +SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE +'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE'; +LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2; +SELECT @v19, @v20; +@v19 @v20 +2 APPLE +SELECT * FROM t2; +fruit_id fruit_name +2 APPLE +2 APPLE +DROP TABLE t1; +DROP TABLE t2; CREATE TABLE t1 (a CHAR(1)); INSERT INTO t1 VALUES('A'), (0); SELECT a FROM t1 WHERE a=0; diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result index 2c001a9e860..45b615864ac 100644 --- a/mysql-test/r/federated.result +++ b/mysql-test/r/federated.result @@ -9,6 +9,10 @@ DROP DATABASE IF EXISTS federated; CREATE DATABASE federated; DROP DATABASE IF EXISTS federated; CREATE DATABASE federated; +SET @OLD_MASTER_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT; +SET @@GLOBAL.CONCURRENT_INSERT= 0; +SET @OLD_SLAVE_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT; +SET @@GLOBAL.CONCURRENT_INSERT= 0; DROP TABLE IF EXISTS federated.t1; Warnings: Note 1051 Unknown table 't1' @@ -83,7 +87,7 @@ t2 CREATE TABLE `t2` ( ) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1' INSERT INTO federated.t2 (id, name) VALUES (1, 'foo'); INSERT INTO federated.t2 (id, name) VALUES (2, 'fee'); -SELECT * FROM federated.t2; +SELECT * FROM federated.t2 ORDER BY id, name; id name 1 foo 2 fee @@ -108,7 +112,7 @@ ENGINE="FEDERATED" DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1%'; INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); INSERT INTO federated.t1 (id, name) VALUES (2, 'fee'); -SELECT * FROM federated.t1; +SELECT * FROM federated.t1 ORDER BY id,name; id name 1 foo 2 fee @@ -122,7 +126,7 @@ ENGINE="FEDERATED" DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1%'; INSERT INTO federated.`t1%` (id, name) VALUES (1, 'foo'); INSERT INTO federated.`t1%` (id, name) VALUES (2, 'fee'); -SELECT * FROM federated.`t1%`; +SELECT * FROM federated.`t1%` ORDER BY id, name; id name 1 foo 2 fee @@ -160,6 +164,7 @@ INSERT INTO federated.t1 (name, other) VALUES ('Tenth Name', 101010); SELECT * FROM federated.t1; id name other created 1 First Name 11111 2004-04-04 04:04:04 +10 Tenth Name 101010 2004-04-04 04:04:04 2 Second Name 22222 2004-04-04 04:04:04 3 Third Name 33333 2004-04-04 04:04:04 4 Fourth Name 44444 2004-04-04 04:04:04 @@ -168,7 +173,6 @@ id name other created 7 Seventh Name 77777 2004-04-04 04:04:04 8 Eigth Name 88888 2004-04-04 04:04:04 9 Ninth Name 99999 2004-04-04 04:04:04 -10 Tenth Name 101010 2004-04-04 04:04:04 SELECT * FROM federated.t1 WHERE id = 5; id name other created 5 Fifth Name 55555 2004-04-04 04:04:04 @@ -182,6 +186,7 @@ SELECT * FROM federated.t1 WHERE name = 'Sixth Name' AND other = 44444; id name other created SELECT * FROM federated.t1 WHERE name like '%th%'; id name other created +10 Tenth Name 101010 2004-04-04 04:04:04 3 Third Name 33333 2004-04-04 04:04:04 4 Fourth Name 44444 2004-04-04 04:04:04 5 Fifth Name 55555 2004-04-04 04:04:04 @@ -189,7 +194,6 @@ id name other created 7 Seventh Name 77777 2004-04-04 04:04:04 8 Eigth Name 88888 2004-04-04 04:04:04 9 Ninth Name 99999 2004-04-04 04:04:04 -10 Tenth Name 101010 2004-04-04 04:04:04 UPDATE federated.t1 SET name = '3rd name' WHERE id = 3; SELECT * FROM federated.t1 WHERE name = '3rd name'; id name other created @@ -310,6 +314,7 @@ VALUES ('Tenth Name', 101010, '2005-03-12 12:00:01'); SELECT * FROM federated.t1; id name other created 1 First Name 11111 2004-01-01 01:01:01 +10 Tenth Name 101010 2005-03-12 12:00:01 2 Second Name 22222 2004-01-23 02:43:00 3 Third Name 33333 2004-02-14 02:14:00 4 Fourth Name 44444 2003-04-05 00:00:00 @@ -318,7 +323,6 @@ id name other created 7 Seventh Name 77777 2003-12-12 18:32:00 8 Eigth Name 88888 2005-03-12 11:00:00 9 Ninth Name 99999 2005-03-12 11:00:01 -10 Tenth Name 101010 2005-03-12 12:00:01 SELECT * FROM federated.t1 WHERE id = 5; id name other created 5 Fifth Name 55555 2001-02-02 02:02:02 @@ -330,6 +334,7 @@ id name other created 4 Fourth Name 44444 2003-04-05 00:00:00 SELECT * FROM federated.t1 WHERE name like '%th%'; id name other created +10 Tenth Name 101010 2005-03-12 12:00:01 3 Third Name 33333 2004-02-14 02:14:00 4 Fourth Name 44444 2003-04-05 00:00:00 5 Fifth Name 55555 2001-02-02 02:02:02 @@ -337,7 +342,6 @@ id name other created 7 Seventh Name 77777 2003-12-12 18:32:00 8 Eigth Name 88888 2005-03-12 11:00:00 9 Ninth Name 99999 2005-03-12 11:00:01 -10 Tenth Name 101010 2005-03-12 12:00:01 UPDATE federated.t1 SET name = '3rd name' WHERE id = 3; SELECT * FROM federated.t1 WHERE name = '3rd name'; id name other created @@ -444,17 +448,17 @@ id name other 7 Seventh Name NULL SELECT * FROM federated.t1 WHERE name IS NULL; id name other -4 NULL NULL 10 NULL fee fie foe fum +4 NULL NULL SELECT * FROM federated.t1 WHERE name IS NULL and other IS NULL; id name other 4 NULL NULL SELECT * FROM federated.t1 WHERE name IS NULL or other IS NULL; id name other +10 NULL fee fie foe fum 2 Second Name NULL 4 NULL NULL 7 Seventh Name NULL -10 NULL fee fie foe fum UPDATE federated.t1 SET name = 'Fourth Name', other = 'four four four' WHERE name IS NULL AND other IS NULL; @@ -466,6 +470,7 @@ id name other SELECT * FROM federated.t1; id name other 1 First Name 11111 +10 Tenth Name fee fie foe fum 2 Second Name two two two two 3 Third Name 33333 4 Fourth Name four four four @@ -474,7 +479,6 @@ id name other 7 Seventh Name seven seven 8 Eigth Name 88888 9 Ninth Name 99999 -10 Tenth Name fee fie foe fum DROP TABLE IF EXISTS federated.t1; CREATE TABLE federated.t1 ( `id` int(20) NOT NULL auto_increment, @@ -655,8 +659,8 @@ id col1 col2 col3 col4 SELECT * FROM federated.t1 WHERE (id = 5 AND col2 = 'five 5 five five 5') OR (col2 = 'three Three' AND col3 = 33); id col1 col2 col3 col4 -5 5 five 5 five five 5 5 55555 3 3 three Three 33 33333 +5 5 five 5 five five 5 5 55555 SELECT * FROM federated.t1 WHERE (id = 5 AND col2 = 'Two two') OR (col2 = 444 AND col3 = 4444444); id col1 col2 col3 col4 @@ -667,25 +671,25 @@ OR col3 = 33 OR col4 = 4444444; id col1 col2 col3 col4 1 1 one One 11 1111 +10 10 Tenth ten TEN 1010101 1010 2 2 Two two 22 2222 3 3 three Three 33 33333 4 4 fourfourfour 444 4444444 -10 10 Tenth ten TEN 1010101 1010 SELECT * FROM federated.t1 WHERE id > 5; id col1 col2 col3 col4 +10 10 Tenth ten TEN 1010101 1010 6 6 six six Sixsix 6666 6 7 7 seven Sevenseven 77777 7777 8 8 eight eight eight 88888 88 9 9 nine Nine 999999 999999 -10 10 Tenth ten TEN 1010101 1010 SELECT * FROM federated.t1 WHERE id >= 5; id col1 col2 col3 col4 +10 10 Tenth ten TEN 1010101 1010 5 5 five 5 five five 5 5 55555 6 6 six six Sixsix 6666 6 7 7 seven Sevenseven 77777 7777 8 8 eight eight eight 88888 88 9 9 nine Nine 999999 999999 -10 10 Tenth ten TEN 1010101 1010 SELECT * FROM federated.t1 WHERE id < 5; id col1 col2 col3 col4 1 1 one One 11 1111 @@ -702,6 +706,7 @@ id col1 col2 col3 col4 SELECT * FROM federated.t1 WHERE id != 5; id col1 col2 col3 col4 1 1 one One 11 1111 +10 10 Tenth ten TEN 1010101 1010 2 2 Two two 22 2222 3 3 three Three 33 33333 4 4 fourfourfour 444 4444444 @@ -709,7 +714,6 @@ id col1 col2 col3 col4 7 7 seven Sevenseven 77777 7777 8 8 eight eight eight 88888 88 9 9 nine Nine 999999 999999 -10 10 Tenth ten TEN 1010101 1010 SELECT * FROM federated.t1 WHERE id > 3 AND id < 7; id col1 col2 col3 col4 4 4 fourfourfour 444 4444444 @@ -737,25 +741,25 @@ id col1 col2 col3 col4 SELECT * FROM federated.t1 WHERE id < 3 OR id > 7; id col1 col2 col3 col4 1 1 one One 11 1111 +10 10 Tenth ten TEN 1010101 1010 2 2 Two two 22 2222 8 8 eight eight eight 88888 88 9 9 nine Nine 999999 999999 -10 10 Tenth ten TEN 1010101 1010 SELECT * FROM federated.t1 WHERE col2 = 'three Three'; id col1 col2 col3 col4 3 3 three Three 33 33333 SELECT * FROM federated.t1 WHERE col2 > 'one'; id col1 col2 col3 col4 1 1 one One 11 1111 +10 10 Tenth ten TEN 1010101 1010 2 2 Two two 22 2222 3 3 three Three 33 33333 6 6 six six Sixsix 6666 6 7 7 seven Sevenseven 77777 7777 -10 10 Tenth ten TEN 1010101 1010 SELECT * FROM federated.t1 WHERE col2 LIKE 's%'; id col1 col2 col3 col4 -7 7 seven Sevenseven 77777 7777 6 6 six six Sixsix 6666 6 +7 7 seven Sevenseven 77777 7777 SELECT * FROM federated.t1 WHERE col2 LIKE 'si%'; id col1 col2 col3 col4 6 6 six six Sixsix 6666 6 @@ -765,6 +769,7 @@ id col1 col2 col3 col4 SELECT * FROM federated.t1 WHERE col2 NOT LIKE 'e%'; id col1 col2 col3 col4 1 1 one One 11 1111 +10 10 Tenth ten TEN 1010101 1010 2 2 Two two 22 2222 3 3 three Three 33 33333 4 4 fourfourfour 444 4444444 @@ -772,18 +777,17 @@ id col1 col2 col3 col4 6 6 six six Sixsix 6666 6 7 7 seven Sevenseven 77777 7777 9 9 nine Nine 999999 999999 -10 10 Tenth ten TEN 1010101 1010 SELECT * FROM federated.t1 WHERE col2 <> 'one One'; id col1 col2 col3 col4 -4 4 fourfourfour 444 4444444 -5 5 five 5 five five 5 5 55555 -8 8 eight eight eight 88888 88 -9 9 nine Nine 999999 999999 +10 10 Tenth ten TEN 1010101 1010 2 2 Two two 22 2222 3 3 three Three 33 33333 +4 4 fourfourfour 444 4444444 +5 5 five 5 five five 5 5 55555 6 6 six six Sixsix 6666 6 7 7 seven Sevenseven 77777 7777 -10 10 Tenth ten TEN 1010101 1010 +8 8 eight eight eight 88888 88 +9 9 nine Nine 999999 999999 DROP TABLE IF EXISTS federated.t1; CREATE TABLE federated.t1 ( `col1` varchar(8) NOT NULL DEFAULT '', @@ -950,11 +954,11 @@ INSERT INTO federated.t1 (name, floatval, other) VALUES (0, 00.3333, NULL); SELECT * FROM federated.t1; id name floatval other +1 NULL NULL NULL +NULL 0 0.3333 NULL NULL NULL NULL NULL NULL NULL NULL NULL -1 NULL NULL NULL NULL foo 33.3333 NULL -NULL 0 0.3333 NULL SELECT count(*) FROM federated.t1 WHERE id IS NULL AND name IS NULL @@ -983,13 +987,13 @@ Warning 1101 BLOB/TEXT column 'blurb' can't have a default value INSERT INTO federated.t1 VALUES (1, " MySQL supports a number of column types in several categories: numeric types, date and time types, and string (character) types. This chapter first gives an overview of these column types, and then provides a more detailed description of the properties of the types in each category, and a summary of the column type storage requirements. The overview is intentionally brief. The more detailed descriptions should be consulted for additional information about particular column types, such as the allowable formats in which you can specify values."); INSERT INTO federated.t1 VALUES (2, "All arithmetic is done using signed BIGINT or DOUBLE values, so you should not use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting a BIGINT value to a DOUBLE."); INSERT INTO federated.t1 VALUES (3, " A floating-point number. p represents the precision. It can be from 0 to 24 for a single-precision floating-point number and from 25 to 53 for a double-precision floating-point number. These types are like the FLOAT and DOUBLE types described immediately following. FLOAT(p) has the same range as the corresponding FLOAT and DOUBLE types, but the display size and number of decimals are undefined. "); -INSERT INTO federated.t1 VALUES(4, "Die bersetzung einer so umfangreichen technischen Dokumentation wie des MySQL-Referenzhandbuchs ist schon eine besondere Herausforderung. Zumindest fr jemanden, der seine Zielsprache ernst nimmt:"); +INSERT INTO federated.t1 VALUES(4, "Die Übersetzung einer so umfangreichen technischen Dokumentation wie des MySQL-Referenzhandbuchs ist schon eine besondere Herausforderung. Zumindest für jemanden, der seine Zielsprache ernst nimmt:"); SELECT * FROM federated.t1; blurb_id blurb 1 MySQL supports a number of column types in several categories: numeric types, date and time types, and string (character) types. This chapter first gives an overview of these column types, and then provides a more detailed description of the properties of the types in each category, and a summary of the column type storage requirements. The overview is intentionally brief. The more detailed descriptions should be consulted for additional information about particular column types, such as the allowable formats in which you can specify values. 2 All arithmetic is done using signed BIGINT or DOUBLE values, so you should not use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting a BIGINT value to a DOUBLE. 3 A floating-point number. p represents the precision. It can be from 0 to 24 for a single-precision floating-point number and from 25 to 53 for a double-precision floating-point number. These types are like the FLOAT and DOUBLE types described immediately following. FLOAT(p) has the same range as the corresponding FLOAT and DOUBLE types, but the display size and number of decimals are undefined. -4 Die bersetzung einer so umfangreichen technischen Dokumentation wie des MySQL-Referenzhandbuchs ist schon eine besondere Herausforderung. Zumindest fr jemanden, der seine Zielsprache ernst nimmt: +4 Die Übersetzung einer so umfangreichen technischen Dokumentation wie des MySQL-Referenzhandbuchs ist schon eine besondere Herausforderung. Zumindest für jemanden, der seine Zielsprache ernst nimmt: DROP TABLE IF EXISTS federated.t1; CREATE TABLE federated.t1 ( `a` int NOT NULL, @@ -1741,20 +1745,20 @@ create trigger federated.t1_bi before insert on federated.t1 for each row set ne create table federated.t2 (a int, b int); insert into federated.t2 values (13, 17), (19, 23); insert into federated.t1 (a, b) values (1, 2), (3, 5), (7, 11); -select * from federated.t1; +select * from federated.t1 order by a; a b c 1 2 2 3 5 15 7 11 77 delete from federated.t1; insert into federated.t1 (a, b) select * from federated.t2; -select * from federated.t1; +select * from federated.t1 order by a; a b c 13 17 221 19 23 437 delete from federated.t1; load data infile '../std_data_ln/loaddata5.dat' into table federated.t1 fields terminated by '' enclosed by '' ignore 1 lines (a, b); -select * from federated.t1; +select * from federated.t1 order by a; a b c 3 4 12 5 6 30 @@ -2081,8 +2085,10 @@ Table Checksum test.t1 2465757603 DROP TABLE t1; DROP TABLE t1; +End of 5.0 tests +SET @@GLOBAL.CONCURRENT_INSERT= @OLD_MASTER_CONCURRENT_INSERT; +SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT; DROP TABLE IF EXISTS federated.t1; DROP DATABASE IF EXISTS federated; DROP TABLE IF EXISTS federated.t1; DROP DATABASE IF EXISTS federated; -End of 5.0 tests diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result index 18b0d84a296..6e879114119 100644 --- a/mysql-test/r/loaddata.result +++ b/mysql-test/r/loaddata.result @@ -328,3 +328,123 @@ DROP VIEW v2; DROP VIEW v3; # -- End of Bug#35469. +Bug#37114 +SET SESSION character_set_client=latin1; +SET SESSION character_set_server=latin1; +SET SESSION character_set_connection=latin1; +SET @OLD_SQL_MODE=@@SESSION.SQL_MODE; +test LOAD DATA INFILE +SET sql_mode = ''; +SELECT '1 \\aa\n' INTO DUMPFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt'; +CREATE TABLE t1 (id INT, val1 CHAR(3)) ENGINE=MyISAM; +SET sql_mode = 'NO_BACKSLASH_ESCAPES'; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' REPLACE INTO TABLE t1 FIELDS TERMINATED BY ' '; +SELECT * FROM t1; +id val1 +1 \aa +SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug37114_out.txt' FIELDS ESCAPED BY '' TERMINATED BY ' ' FROM t1; +SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug37114_out.txt' FIELDS TERMINATED BY ' ' FROM t1; +INSERT INTO t1 (id, val1) VALUES (1, '\aa'); +SELECT * FROM t1; +id val1 +1 \aa +1 \aa +SET sql_mode=''; +INSERT INTO t1 (id, val1) VALUES (1, '\aa'); +SELECT * FROM t1; +id val1 +1 \aa +1 \aa +1 aa +DROP TABLE t1; +test SELECT INTO OUTFILE +CREATE TABLE t1 (id INT PRIMARY KEY, val1 CHAR(4)); +CREATE TABLE t2 LIKE t1; +SET sql_mode = ''; +INSERT INTO t1 (id, val1) VALUES (5, '\ttab'); +INSERT INTO t1 (id, val1) VALUES (4, '\\r'); +SET sql_mode = 'NO_BACKSLASH_ESCAPES'; +INSERT INTO t1 (id, val1) VALUES (3, '\tx'); +1.1 NO_BACKSLASH_ESCAPES, use defaults for ESCAPED BY +SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' FIELDS TERMINATED BY ' ' FROM t1 ORDER BY id; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' INTO TABLE t2 FIELDS TERMINATED BY ' '; +SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION +SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC; +t id val1 hex(val1) +before 3 \tx 5C7478 +after 3 \tx 5C7478 +before 4 \r 5C72 +after 4 \r 5C72 +before 5 tab 09746162 +after 5 tab 09746162 +TRUNCATE t2; +SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt"); +LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt") +3 \tx +4 \r +5 tab + +1.2 NO_BACKSLASH_ESCAPES, override defaults for ESCAPED BY +SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' FIELDS ESCAPED BY '\' TERMINATED BY ' ' FROM t1 ORDER BY id; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' INTO TABLE t2 FIELDS ESCAPED BY '\' TERMINATED BY ' '; +SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION +SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC; +t id val1 hex(val1) +before 3 \tx 5C7478 +after 3 \tx 5C7478 +before 4 \r 5C72 +after 4 \r 5C72 +before 5 tab 09746162 +after 5 tab 09746162 +TRUNCATE t2; +SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt"); +LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt") +3 \\tx +4 \\r +5 tab + +SET sql_mode = ''; +2.1 !NO_BACKSLASH_ESCAPES, use defaults for ESCAPED BY +SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' FIELDS TERMINATED BY ' ' FROM t1 ORDER BY id; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' INTO TABLE t2 FIELDS TERMINATED BY ' '; +SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION +SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC; +t id val1 hex(val1) +before 3 \tx 5C7478 +after 3 \tx 5C7478 +before 4 \r 5C72 +after 4 \r 5C72 +before 5 tab 09746162 +after 5 tab 09746162 +TRUNCATE t2; +SET sql_mode = 'NO_BACKSLASH_ESCAPES'; +SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt"); +LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt") +3 \\tx +4 \\r +5 tab + +SET sql_mode = ''; +2.2 !NO_BACKSLASH_ESCAPES, override defaults for ESCAPED BY +SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' FIELDS ESCAPED BY '' TERMINATED BY ' ' FROM t1 ORDER BY id; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' INTO TABLE t2 FIELDS ESCAPED BY '' TERMINATED BY ' '; +SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION +SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC; +t id val1 hex(val1) +before 3 \tx 5C7478 +after 3 \tx 5C7478 +before 4 \r 5C72 +after 4 \r 5C72 +before 5 tab 09746162 +after 5 tab 09746162 +TRUNCATE t2; +SET sql_mode = 'NO_BACKSLASH_ESCAPES'; +SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt"); +LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt") +3 \tx +4 \r +5 tab + +set session sql_mode=@OLD_SQL_MODE; +DROP TABLE t1,t2; +End of 5.0 tests diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 163231c9f66..08a18d8de75 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -1,3 +1,8 @@ +Bug#37938 - Test "mysqldump" lacks various insert statements +Turn off concurrent inserts to avoid random errors +NOTE: We reset the variable back to saved value at the end of test +SET @OLD_CONCURRENT_INSERT = @@GLOBAL.CONCURRENT_INSERT; +SET @@GLOBAL.CONCURRENT_INSERT = 0; DROP TABLE IF EXISTS t1, `"t"1`, t1aa, t2, t2aa, t3; drop database if exists mysqldump_test_db; drop database if exists db1; @@ -3565,6 +3570,7 @@ DROP TABLE t1,t2; -- Dump completed on DATE +SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT; # # End of 5.0 tests # diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 0fc0adc89ad..e83e8c2c71d 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -1513,3 +1513,10 @@ end loop label1; end loop; end| ERROR 42000: End-label label1 without match +CREATE TABLE t1 (a INT)| +INSERT INTO t1 VALUES (1),(2)| +CREATE PROCEDURE p1(a INT) BEGIN END| +CALL p1((SELECT * FROM t1))| +ERROR 21000: Subquery returns more than 1 row +DROP PROCEDURE IF EXISTS p1| +DROP TABLE t1| diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index be21251d92e..e788d30a14b 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -6662,6 +6662,16 @@ drop procedure p1; drop function f1; drop view v1; drop table t1; +drop procedure if exists `p2` $ +create procedure `p2`(in `a` text charset utf8) +begin +declare `pos` int default 1; +declare `str` text charset utf8; +set `str` := `a`; +select substr(`str`, `pos`+ 1 ) into `str`; +end $ +call `p2`('s s s s s s'); +drop procedure `p2`; # ------------------------------------------------------------------ # -- End of 5.0 tests # ------------------------------------------------------------------ diff --git a/mysql-test/t/binlog_killed_simulate.test b/mysql-test/t/binlog_killed_simulate.test index 670cd756803..3f50ac350d5 100644 --- a/mysql-test/t/binlog_killed_simulate.test +++ b/mysql-test/t/binlog_killed_simulate.test @@ -30,7 +30,7 @@ let $error_code= `select @a like "%#%error_code=0%" /* must return 1 */`; eval select $error_code /* must return 1 as query completed before got killed*/; # cleanup for the sub-case -system rm $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog; +remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog; # @@ -58,7 +58,7 @@ let $error_code= `select @a like "%#%error_code=0%" /* must return 0*/`; eval select $error_code /* must return 0 to mean the killed query is in */; # cleanup for the sub-case -system rm $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog; +remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog; drop table t1,t2; diff --git a/mysql-test/t/binlog_start_comment.test b/mysql-test/t/binlog_start_comment.test index 84889167cd2..2834c6d27e3 100644 --- a/mysql-test/t/binlog_start_comment.test +++ b/mysql-test/t/binlog_start_comment.test @@ -21,4 +21,4 @@ select * from t2; # clean up drop table t1,t2; -#--system rm $MYSQLTEST_VARDIR/tmp/binlog_start_comment.binlog +#--remove_file $MYSQLTEST_VARDIR/tmp/binlog_start_comment.binlog diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test index 0ed21091110..5a8a13f2bad 100644 --- a/mysql-test/t/ctype_big5.test +++ b/mysql-test/t/ctype_big5.test @@ -79,7 +79,8 @@ delete from t1; --eval select hex(load_file('$MYSQLTEST_VARDIR/master-data/test/t1.txt')); load data infile 't1.txt' into table t1; select hex(a) from t1; ---exec rm $MYSQLTEST_VARDIR/master-data/test/t1.txt +--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.txt + drop table t1; --echo End of 5.0 tests diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test index 7310f98cd16..2cbd34c0d2c 100644 --- a/mysql-test/t/distinct.test +++ b/mysql-test/t/distinct.test @@ -438,72 +438,71 @@ EXPLAIN SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a; SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a; DROP TABLE t1; -# The test case for bug#20836 should be re-enabled when bug#16861 is resolved -# The results for the test should be the same as in 4.1. -# + #Bug #20836: Selecting into variables results in wrong results being returned -# -#--disable_warnings -#DROP TABLE IF EXISTS t1; -#--enable_warnings -# -#CREATE TABLE t1 (id INT NOT NULL, fruit_id INT NOT NULL, fruit_name varchar(20) -#default NULL); -# -#INSERT INTO t1 VALUES (1,1,'ORANGE'); -#INSERT INTO t1 VALUES (2,2,'APPLE'); -#INSERT INTO t1 VALUES (3,2,'APPLE'); -#INSERT INTO t1 VALUES (4,3,'PEAR'); -# -#SELECT DISTINCT fruit_id, fruit_name INTO @v1, @v2 FROM t1 WHERE fruit_name = -#'APPLE'; -#SELECT @v1, @v2; -# -#SELECT DISTINCT fruit_id, fruit_name INTO @v3, @v4 FROM t1 GROUP BY fruit_id, -#fruit_name HAVING fruit_name = 'APPLE'; -#SELECT @v3, @v4; -# -#SELECT DISTINCT @v5:= fruit_id, @v6:= fruit_name INTO @v7, @v8 FROM t1 WHERE -#fruit_name = 'APPLE'; -#SELECT @v5, @v6, @v7, @v8; -# -#SELECT DISTINCT @v5 + fruit_id, CONCAT(@v6, fruit_name) INTO @v9, @v10 FROM t1 -#WHERE fruit_name = 'APPLE'; -#SELECT @v5, @v6, @v7, @v8, @v9, @v10; -# -#SELECT DISTINCT @v11:= @v5 + fruit_id, @v12:= CONCAT(@v6, fruit_name) INTO -#@v13, @v14 FROM t1 WHERE fruit_name = 'APPLE'; -#SELECT @v11, @v12, @v13, @v14; -# -#SELECT DISTINCT @v13, @v14 INTO @v15, @v16 FROM t1 WHERE fruit_name = 'APPLE'; -#SELECT @v15, @v16; -# -#SELECT DISTINCT 2 + 2, 'Bob' INTO @v17, @v18 FROM t1 WHERE fruit_name = -#'APPLE'; -#SELECT @v17, @v18; -# -#--disable_warnings -#DROP TABLE IF EXISTS t2; -#--enable_warnings -# -#CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20) -#default NULL); -# -#SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE -#'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE'; -#LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2; -#--exec rm $MYSQL_TEST_DIR/var/tmp/data1.tmp -# -#SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE -#'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE'; -#LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2; -#--exec rm $MYSQL_TEST_DIR/var/tmp/data2.tmp -# -#SELECT @v19, @v20; -#SELECT * FROM t2; -# -#DROP TABLE t1; -#DROP TABLE t2; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (id INT NOT NULL, fruit_id INT NOT NULL, fruit_name varchar(20) +default NULL); + +INSERT INTO t1 VALUES (1,1,'ORANGE'); +INSERT INTO t1 VALUES (2,2,'APPLE'); +INSERT INTO t1 VALUES (3,2,'APPLE'); +INSERT INTO t1 VALUES (4,3,'PEAR'); + +SELECT DISTINCT fruit_id, fruit_name INTO @v1, @v2 FROM t1 WHERE fruit_name = +'APPLE'; +SELECT @v1, @v2; + +SELECT DISTINCT fruit_id, fruit_name INTO @v3, @v4 FROM t1 GROUP BY fruit_id, +fruit_name HAVING fruit_name = 'APPLE'; +SELECT @v3, @v4; + +SELECT DISTINCT @v5:= fruit_id, @v6:= fruit_name INTO @v7, @v8 FROM t1 WHERE +fruit_name = 'APPLE'; +SELECT @v5, @v6, @v7, @v8; + +SELECT DISTINCT @v5 + fruit_id, CONCAT(@v6, fruit_name) INTO @v9, @v10 FROM t1 +WHERE fruit_name = 'APPLE'; +SELECT @v5, @v6, @v7, @v8, @v9, @v10; + +SELECT DISTINCT @v11:= @v5 + fruit_id, @v12:= CONCAT(@v6, fruit_name) INTO +@v13, @v14 FROM t1 WHERE fruit_name = 'APPLE'; +SELECT @v11, @v12, @v13, @v14; + +SELECT DISTINCT @v13, @v14 INTO @v15, @v16 FROM t1 WHERE fruit_name = 'APPLE'; +SELECT @v15, @v16; + +SELECT DISTINCT 2 + 2, 'Bob' INTO @v17, @v18 FROM t1 WHERE fruit_name = +'APPLE'; +SELECT @v17, @v18; + +--disable_warnings +DROP TABLE IF EXISTS t2; +--enable_warnings + +CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20) +default NULL); + +SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE +'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE'; +LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2; +--error 0,1 +--remove_file $MYSQLTEST_VARDIR/tmp/data1.tmp + +SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE +'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE'; +LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2; +--remove_file $MYSQLTEST_VARDIR/tmp/data2.tmp + +SELECT @v19, @v20; +SELECT * FROM t2; + +DROP TABLE t1; +DROP TABLE t2; # # Bug #15881: cast problems diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test index 2d98c51a548..8bbb87ccd9c 100644 --- a/mysql-test/t/federated.test +++ b/mysql-test/t/federated.test @@ -1,6 +1,22 @@ -source include/federated.inc; +# Note: This test is tricky. It reuses the prerequisites generated for +# replication tests (master+slave server and connections) for its +# own purposes. But the replication feature itself is stopped. +# + + +--source include/federated.inc + +connection default; + +# Disable concurrent inserts to avoid test failures when reading +# data from concurrent connections (insert might return before +# the data is actually in the table). +SET @OLD_MASTER_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT; +SET @@GLOBAL.CONCURRENT_INSERT= 0; connection slave; +SET @OLD_SLAVE_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT; +SET @@GLOBAL.CONCURRENT_INSERT= 0; DROP TABLE IF EXISTS federated.t1; CREATE TABLE federated.t1 ( `id` int(20) NOT NULL, @@ -11,7 +27,7 @@ CREATE TABLE federated.t1 ( connection master; DROP TABLE IF EXISTS federated.t1; # test too many items (malformed) in the comment string url ---error 1432 +--error ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE CREATE TABLE federated.t1 ( `id` int(20) NOT NULL, `name` varchar(32) NOT NULL default '' @@ -20,7 +36,7 @@ CREATE TABLE federated.t1 ( CONNECTION='mysql://root@127.0.0.1:@/too/many/items/federated/t1'; # test not enough items (malformed) in the comment string url ---error 1432 +--error ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE CREATE TABLE federated.t1 ( `id` int(20) NOT NULL, `name` varchar(32) NOT NULL default '' @@ -36,7 +52,7 @@ eval CREATE TABLE federated.t1 ( ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t3'; ---error 1431 +--error ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST SELECT * FROM federated.t1; DROP TABLE federated.t1; @@ -48,7 +64,7 @@ eval CREATE TABLE federated.t1 ( ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 CONNECTION='mysql://user:pass@127.0.0.1:$SLAVE_MYPORT/federated/t1'; ---error 1429 +--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE SELECT * FROM federated.t1; DROP TABLE federated.t1; @@ -64,6 +80,7 @@ eval CREATE TABLE federated.t1 ( INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); INSERT INTO federated.t1 (id, name) VALUES (2, 'fee'); +--sorted_result SELECT * FROM federated.t1; DELETE FROM federated.t1; DROP TABLE federated.t1; @@ -84,7 +101,7 @@ eval SHOW CREATE TABLE federated.t2; INSERT INTO federated.t2 (id, name) VALUES (1, 'foo'); INSERT INTO federated.t2 (id, name) VALUES (2, 'fee'); -SELECT * FROM federated.t2; +SELECT * FROM federated.t2 ORDER BY id, name; DROP TABLE federated.t2; connection slave; @@ -111,7 +128,7 @@ eval CREATE TABLE federated.t1 ( INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); INSERT INTO federated.t1 (id, name) VALUES (2, 'fee'); -SELECT * FROM federated.t1; +SELECT * FROM federated.t1 ORDER BY id,name; DELETE FROM federated.t1; DROP TABLE IF EXISTS federated.t1; @@ -126,7 +143,7 @@ eval CREATE TABLE federated.`t1%` ( INSERT INTO federated.`t1%` (id, name) VALUES (1, 'foo'); INSERT INTO federated.`t1%` (id, name) VALUES (2, 'fee'); -SELECT * FROM federated.`t1%`; +SELECT * FROM federated.`t1%` ORDER BY id, name; DELETE FROM federated.`t1%`; DROP TABLE IF EXISTS federated.`t1%`; @@ -166,12 +183,14 @@ INSERT INTO federated.t1 (name, other) VALUES ('Ninth Name', 99999); INSERT INTO federated.t1 (name, other) VALUES ('Tenth Name', 101010); # basic select +--sorted_result SELECT * FROM federated.t1; # with PRIMARY KEY index_read_idx SELECT * FROM federated.t1 WHERE id = 5; SELECT * FROM federated.t1 WHERE name = 'Sixth Name'; SELECT * FROM federated.t1 WHERE id = 6 and name = 'Sixth Name'; SELECT * FROM federated.t1 WHERE name = 'Sixth Name' AND other = 44444; +--sorted_result SELECT * FROM federated.t1 WHERE name like '%th%'; UPDATE federated.t1 SET name = '3rd name' WHERE id = 3; SELECT * FROM federated.t1 WHERE name = '3rd name'; @@ -243,6 +262,7 @@ INSERT INTO federated.t1 (name, other, created) VALUES ('Tenth Name', 101010, '2005-03-12 12:00:01'); # basic select +--sorted_result SELECT * FROM federated.t1; # with PRIMARY KEY index_read_idx SELECT * FROM federated.t1 WHERE id = 5; @@ -251,6 +271,7 @@ SELECT * FROM federated.t1 WHERE id = 5; SELECT * FROM federated.t1 WHERE id = 6 and name = 'Sixth Name'; # with regular key index_read -> index_read_idx SELECT * FROM federated.t1 WHERE other = 44444; +--sorted_result SELECT * FROM federated.t1 WHERE name like '%th%'; # update - update_row, index_read_idx UPDATE federated.t1 SET name = '3rd name' WHERE id = 3; @@ -303,9 +324,12 @@ INSERT INTO federated.t1 (name, other) VALUES ('Eigth Name', 88888); INSERT INTO federated.t1 (name, other) VALUES ('Ninth Name', 99999); INSERT INTO federated.t1 (other) VALUES ('fee fie foe fum'); +--sorted_result SELECT * FROM federated.t1 WHERE other IS NULL; +--sorted_result SELECT * FROM federated.t1 WHERE name IS NULL; SELECT * FROM federated.t1 WHERE name IS NULL and other IS NULL; +--sorted_result SELECT * FROM federated.t1 WHERE name IS NULL or other IS NULL; UPDATE federated.t1 @@ -316,6 +340,7 @@ UPDATE federated.t1 SET other = 'two two two two' WHERE name = 'Second Name'; UPDATE federated.t1 SET other = 'seven seven' WHERE name like 'Sev%'; UPDATE federated.t1 SET name = 'Tenth Name' WHERE other like 'fee fie%'; SELECT * FROM federated.t1 WHERE name IS NULL OR other IS NULL ; +--sorted_result SELECT * FROM federated.t1; # test multi-keys @@ -386,6 +411,7 @@ INSERT INTO federated.t1 (name, bincol, floatval, other) VALUES ('second', 0x66, 22.22, 2222); INSERT INTO federated.t1 (name, bincol, floatval, other) VALUES ('third', 'g', 22.22, 2222); +--sorted_result SELECT * FROM federated.t1; SELECT * FROM federated.t1 WHERE name = 'second'; SELECT * FROM federated.t1 WHERE bincol= 'f'; @@ -394,6 +420,7 @@ SELECT * FROM federated.t1 WHERE bincol= 0x67; SELECT * FROM federated.t1 WHERE bincol= 'g'; SELECT * FROM federated.t1 WHERE floatval=11.11; SELECT * FROM federated.t1 WHERE name='third'; +--sorted_result SELECT * FROM federated.t1 WHERE other=2222; SELECT * FROM federated.t1 WHERE name='third' and other=2222; @@ -467,32 +494,47 @@ SELECT * FROM federated.t1 WHERE id = 5 SELECT * FROM federated.t1 WHERE id = 5 AND col2 = 'five 5 five five 5' AND col3 = 5 AND col4 = 55555; +--sorted_result SELECT * FROM federated.t1 WHERE (id = 5 AND col2 = 'five 5 five five 5') OR (col2 = 'three Three' AND col3 = 33); SELECT * FROM federated.t1 WHERE (id = 5 AND col2 = 'Two two') OR (col2 = 444 AND col3 = 4444444); +--sorted_result SELECT * FROM federated.t1 WHERE id = 1 OR col1 = 10 OR col2 = 'Two two' OR col3 = 33 OR col4 = 4444444; +--sorted_result SELECT * FROM federated.t1 WHERE id > 5; +--sorted_result SELECT * FROM federated.t1 WHERE id >= 5; +--sorted_result SELECT * FROM federated.t1 WHERE id < 5; +--sorted_result SELECT * FROM federated.t1 WHERE id <= 5; +--sorted_result SELECT * FROM federated.t1 WHERE id != 5; +--sorted_result SELECT * FROM federated.t1 WHERE id > 3 AND id < 7; +--sorted_result SELECT * FROM federated.t1 WHERE id > 3 AND id <= 7; +--sorted_result SELECT * FROM federated.t1 WHERE id >= 3 AND id <= 7; SELECT * FROM federated.t1 WHERE id < 3 AND id <= 7; SELECT * FROM federated.t1 WHERE id < 3 AND id > 7; +--sorted_result SELECT * FROM federated.t1 WHERE id < 3 OR id > 7; SELECT * FROM federated.t1 WHERE col2 = 'three Three'; +--sorted_result SELECT * FROM federated.t1 WHERE col2 > 'one'; +--sorted_result SELECT * FROM federated.t1 WHERE col2 LIKE 's%'; SELECT * FROM federated.t1 WHERE col2 LIKE 'si%'; SELECT * FROM federated.t1 WHERE col2 LIKE 'se%'; +--sorted_result SELECT * FROM federated.t1 WHERE col2 NOT LIKE 'e%'; +--sorted_result SELECT * FROM federated.t1 WHERE col2 <> 'one One'; # more multi-column indexes, in the primary key @@ -546,13 +588,19 @@ SELECT * FROM federated.t1 WHERE col3 = 'bababababa'; SELECT * FROM federated.t1 WHERE col1 = 'gggg' AND col2 = 'ggggggggggggggggggg'; SELECT * FROM federated.t1 WHERE col1 = 'gggg' AND col3 = 'gagagagaga'; SELECT * FROM federated.t1 WHERE col1 = 'ffff' AND col4 = 'fcfcfcfcfcfcfcfc'; +--sorted_result SELECT * FROM federated.t1 WHERE col1 > 'bbbb'; +--sorted_result SELECT * FROM federated.t1 WHERE col1 >= 'bbbb'; SELECT * FROM federated.t1 WHERE col1 < 'bbbb'; +--sorted_result SELECT * FROM federated.t1 WHERE col1 <= 'bbbb'; +--sorted_result SELECT * FROM federated.t1 WHERE col1 <> 'bbbb'; SELECT * FROM federated.t1 WHERE col1 LIKE 'b%'; +--sorted_result SELECT * FROM federated.t1 WHERE col4 LIKE '%b%'; +--sorted_result SELECT * FROM federated.t1 WHERE col1 NOT LIKE 'c%'; SELECT * FROM federated.t1 WHERE col4 NOT LIKE '%c%'; connection slave; @@ -583,11 +631,13 @@ INSERT INTO federated.t1 VALUES ('ccd', '112', 'zzzz'); # let's see what the foreign database says connection slave; +--sorted_result SELECT col3 FROM federated.t1 WHERE ( (col1 = 'aaa' AND col2 >= '111') OR col1 > 'aaa') AND (col1 < 'ccc' OR ( col1 = 'ccc' AND col2 <= '111')); connection master; +--sorted_result SELECT col3 FROM federated.t1 WHERE ( (col1 = 'aaa' AND col2 >= '111') OR col1 > 'aaa') AND (col1 < 'ccc' OR ( col1 = 'ccc' AND col2 <= '111')); @@ -622,6 +672,7 @@ INSERT INTO federated.t1 (name, floatval, other) VALUES ('foo', 33.33333332, NULL); INSERT INTO federated.t1 (name, floatval, other) VALUES (0, 00.3333, NULL); +--sorted_result SELECT * FROM federated.t1; SELECT count(*) FROM federated.t1 WHERE id IS NULL @@ -651,7 +702,8 @@ eval CREATE TABLE federated.t1 ( INSERT INTO federated.t1 VALUES (1, " MySQL supports a number of column types in several categories: numeric types, date and time types, and string (character) types. This chapter first gives an overview of these column types, and then provides a more detailed description of the properties of the types in each category, and a summary of the column type storage requirements. The overview is intentionally brief. The more detailed descriptions should be consulted for additional information about particular column types, such as the allowable formats in which you can specify values."); INSERT INTO federated.t1 VALUES (2, "All arithmetic is done using signed BIGINT or DOUBLE values, so you should not use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting a BIGINT value to a DOUBLE."); INSERT INTO federated.t1 VALUES (3, " A floating-point number. p represents the precision. It can be from 0 to 24 for a single-precision floating-point number and from 25 to 53 for a double-precision floating-point number. These types are like the FLOAT and DOUBLE types described immediately following. FLOAT(p) has the same range as the corresponding FLOAT and DOUBLE types, but the display size and number of decimals are undefined. "); -INSERT INTO federated.t1 VALUES(4, "Die bersetzung einer so umfangreichen technischen Dokumentation wie des MySQL-Referenzhandbuchs ist schon eine besondere Herausforderung. Zumindest fr jemanden, der seine Zielsprache ernst nimmt:"); +INSERT INTO federated.t1 VALUES(4, "Die Übersetzung einer so umfangreichen technischen Dokumentation wie des MySQL-Referenzhandbuchs ist schon eine besondere Herausforderung. Zumindest für jemanden, der seine Zielsprache ernst nimmt:"); +--sorted_result SELECT * FROM federated.t1; connection slave; @@ -1010,6 +1062,7 @@ eval CREATE TABLE federated.t1 ( INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('ASDFWERQWETWETAWETA', '*()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#<S-F8>*<S-F8><S-F8><S-F8>#<S-F8>#<S-F8>#<S-F8>[[', '2003-03-03 03:03:03'); INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('DEUEUEUEUEUEUEUEUEU', '*()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#<S-F8>*<S-F8><S-F8><S-F8>#<S-F8>#<S-F8>#<S-F8>[[', '2004-04-04 04:04:04'); INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('DEUEUEUEUEUEUEUEUEU', 'jimbob', '2004-04-04 04:04:04'); +--sorted_result SELECT * FROM federated.t1; # test blob indexes SELECT * FROM federated.t1 WHERE fileguts = 'jimbob'; @@ -1030,6 +1083,7 @@ CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; INSERT INTO federated.t1 VALUES (0x00); INSERT INTO federated.t1 VALUES (0x0001); INSERT INTO federated.t1 VALUES (0x0100); +--sorted_result SELECT HEX(a) FROM federated.t1; # # simple tests for cyrillic, given to me by @@ -1044,20 +1098,20 @@ SELECT HEX(a) FROM federated.t1; # CREATE TABLE federated.t1 (a char(20)) charset=cp1251; # # # connection master; -# INSERT INTO federated.t1 values (_cp1251'--1'); -# INSERT INTO federated.t1 values (_cp1251'--2'); +# INSERT INTO federated.t1 values (_cp1251'À-ÁÂÃ-1'); +# INSERT INTO federated.t1 values (_cp1251'Á-ÂÃÄ-2'); # SELECT * FROM federated.t1; # SET names cp1251; -# INSERT INTO federated.t1 values ('--3'); -# INSERT INTO federated.t1 values ('-Ũ-4'); +# INSERT INTO federated.t1 values ('Â-ÃÄÅ-3'); +# INSERT INTO federated.t1 values ('Ã-ŨÆ-4'); # SELECT * FROM federated.t1; # SELECT hex(a) from federated.t1; # SELECT hex(a) from federated.t1 ORDER BY a desc; -# UPDATE federated.t1 SET a='--1' WHERE a='--1'; +# UPDATE federated.t1 SET a='À-ÁÂÃ-1íîâûé' WHERE a='À-ÁÂÃ-1'; # SELECT * FROM federated.t1; -# DELETE FROM federated.t1 WHERE a='-Ũ-4'; +# DELETE FROM federated.t1 WHERE a='Ã-ŨÆ-4'; # SELECT * FROM federated.t1; -# DELETE FROM federated.t1 WHERE a>'-'; +# DELETE FROM federated.t1 WHERE a>'Â-'; # SELECT * FROM federated.t1; # SET names default; # DROP TABLE IF EXISTS federated.t1; @@ -1108,6 +1162,7 @@ INSERT INTO federated.t1 (name, country_id, other) VALUES ('Monty', 4, 33333); INSERT INTO federated.t1 (name, country_id, other) VALUES ('Sanja', 5, 33333); #inner join +--sorted_result SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, federated.t1.other AS other, federated.countries.country AS country FROM federated.t1, federated.countries WHERE @@ -1181,7 +1236,7 @@ INSERT INTO federated.alter_me (id, name) VALUES (2, 'David'); SELECT * FROM federated.alter_me; ---error 1031 +--error ER_ILLEGAL_HA ALTER TABLE federated.alter_me MODIFY COLUMN id int(16) NOT NULL; SELECT * FROM federated.alter_me; @@ -1452,15 +1507,15 @@ insert into federated.t2 values (13, 17), (19, 23); # Each of three statements should correctly set values for all three fields # insert insert into federated.t1 (a, b) values (1, 2), (3, 5), (7, 11); -select * from federated.t1; +select * from federated.t1 order by a; delete from federated.t1; # insert ... select insert into federated.t1 (a, b) select * from federated.t2; -select * from federated.t1; +select * from federated.t1 order by a; delete from federated.t1; # load load data infile '../std_data_ln/loaddata5.dat' into table federated.t1 fields terminated by '' enclosed by '' ignore 1 lines (a, b); -select * from federated.t1; +select * from federated.t1 order by a; drop tables federated.t1, federated.t2; connection slave; @@ -1769,7 +1824,13 @@ DROP TABLE t1; connection master; DROP TABLE t1; - -source include/federated_cleanup.inc; +connection default; --echo End of 5.0 tests + +SET @@GLOBAL.CONCURRENT_INSERT= @OLD_MASTER_CONCURRENT_INSERT; +connection slave; +SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT; + +connection default; +source include/federated_cleanup.inc; diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index e9da2bbadc5..cd22b700430 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -318,4 +318,184 @@ DROP VIEW v3; ########################################################################### -# End of 5.0 tests + +# +# Bug#37114: sql_mode NO_BACKSLASH_ESCAPES does not work properly with +# LOAD DATA INFILE +# + +# - For each plain "SELECT id,...", the 1st pair ("before" SELECT...OUTFILE, +# LOAD...INFILE) and the 2nd pair of lines ("after") in the result should +# look the same, otherwise we broke the dumpe/restore cycle! +# +# - the \r is always { '\\', 'r' } in memory, but on-disk format changes +# +# - the \t is { '\t' } or { '\\', 't' } in memory depending on whether \ +# is magic (that is, NO_BACKSLASH_ESCAPES is not set) at INSERT-time. +# on-disk format varies. +# +# - while INFILE/OUTFILE behaviour changes according to NO_BACKSLASH_ESCAPES, +# we can override these defaults using ESCAPED BY '...' +# 1: NO_BACKSLASH_ESCAPES default, \ on-disk: \,t,x,\r +# 2: NO_BACKSLASH_ESCAPES override, \\ on-disk: \,\,t,x,\,\,r +# 3: !NO_BACKSLASH_ESCAPES default, \\ on-disk: tab,\,\,r +# 3: !NO_BACKSLASH_ESCAPES override, \ on-disk: tab,\,r + +--echo Bug#37114 + +SET SESSION character_set_client=latin1; +SET SESSION character_set_server=latin1; +SET SESSION character_set_connection=latin1; +SET @OLD_SQL_MODE=@@SESSION.SQL_MODE; + +# 0. test LOAD DATA INFILE first; if that works, all issues in +# SELECT INTO OUTFILE / LOAD DATA INFILE cycles below are +# arguably in the saving. + +--echo test LOAD DATA INFILE + +--let $file=$MYSQLTEST_VARDIR/tmp/bug37114.txt +--let $file2=$MYSQLTEST_VARDIR/tmp/bug37114_out.txt + +SET sql_mode = ''; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SELECT '1 \\\\aa\n' INTO DUMPFILE '$file' + +CREATE TABLE t1 (id INT, val1 CHAR(3)) ENGINE=MyISAM; + +SET sql_mode = 'NO_BACKSLASH_ESCAPES'; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval LOAD DATA INFILE '$file' REPLACE INTO TABLE t1 FIELDS TERMINATED BY ' ' +SELECT * FROM t1; + +# show we can write this with OUTFILE, forcing the parameters for now +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SELECT * INTO OUTFILE '$file2' FIELDS ESCAPED BY '' TERMINATED BY ' ' FROM t1 +--diff_files $file $file2 +--remove_file $file2 + +# now show the OUTFILE defaults are correct with NO_BACKSLASH_ESCAPES +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SELECT * INTO OUTFILE '$file2' FIELDS TERMINATED BY ' ' FROM t1 +--diff_files $file $file2 +--remove_file $file2 + +INSERT INTO t1 (id, val1) VALUES (1, '\aa'); +SELECT * FROM t1; + +SET sql_mode=''; +INSERT INTO t1 (id, val1) VALUES (1, '\aa'); +SELECT * FROM t1; + +DROP TABLE t1; + +--remove_file $file + + + +--echo test SELECT INTO OUTFILE + +CREATE TABLE t1 (id INT PRIMARY KEY, val1 CHAR(4)); +CREATE TABLE t2 LIKE t1; + +# 1. with NO_BACKSLASH_ESCAPES on + +SET sql_mode = ''; +INSERT INTO t1 (id, val1) VALUES (5, '\ttab'); +INSERT INTO t1 (id, val1) VALUES (4, '\\r'); +SET sql_mode = 'NO_BACKSLASH_ESCAPES'; +INSERT INTO t1 (id, val1) VALUES (3, '\tx'); + +--echo 1.1 NO_BACKSLASH_ESCAPES, use defaults for ESCAPED BY + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SELECT * INTO OUTFILE '$file' FIELDS TERMINATED BY ' ' FROM t1 ORDER BY id + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS TERMINATED BY ' ' + +SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION + SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC; + +TRUNCATE t2; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval SELECT LOAD_FILE("$file"); +--remove_file $file + + + +--echo 1.2 NO_BACKSLASH_ESCAPES, override defaults for ESCAPED BY + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SELECT * INTO OUTFILE '$file' FIELDS ESCAPED BY '\' TERMINATED BY ' ' FROM t1 ORDER BY id + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS ESCAPED BY '\' TERMINATED BY ' ' + +SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION + SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC; + +TRUNCATE t2; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval SELECT LOAD_FILE("$file"); +--remove_file $file + + + +# 2. with NO_BACKSLASH_ESCAPES off + +SET sql_mode = ''; + +--echo 2.1 !NO_BACKSLASH_ESCAPES, use defaults for ESCAPED BY + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SELECT * INTO OUTFILE '$file' FIELDS TERMINATED BY ' ' FROM t1 ORDER BY id + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS TERMINATED BY ' ' + +SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION + SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC; + +TRUNCATE t2; + +SET sql_mode = 'NO_BACKSLASH_ESCAPES'; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval SELECT LOAD_FILE("$file"); +--remove_file $file + +SET sql_mode = ''; + + + +--echo 2.2 !NO_BACKSLASH_ESCAPES, override defaults for ESCAPED BY + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SELECT * INTO OUTFILE '$file' FIELDS ESCAPED BY '' TERMINATED BY ' ' FROM t1 ORDER BY id + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS ESCAPED BY '' TERMINATED BY ' ' + +SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION + SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC; + +TRUNCATE t2; + +SET sql_mode = 'NO_BACKSLASH_ESCAPES'; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval SELECT LOAD_FILE("$file"); +--remove_file $file + +# clean up +set session sql_mode=@OLD_SQL_MODE; +DROP TABLE t1,t2; + + + +--echo End of 5.0 tests diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 88053ae95fb..2f11685385f 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -5,6 +5,14 @@ # Binlog is required --source include/have_log_bin.inc + +--echo Bug#37938 - Test "mysqldump" lacks various insert statements +--echo Turn off concurrent inserts to avoid random errors +--echo NOTE: We reset the variable back to saved value at the end of test +SET @OLD_CONCURRENT_INSERT = @@GLOBAL.CONCURRENT_INSERT; +SET @@GLOBAL.CONCURRENT_INSERT = 0; + + --disable_warnings DROP TABLE IF EXISTS t1, `"t"1`, t1aa, t2, t2aa, t3; drop database if exists mysqldump_test_db; @@ -1594,6 +1602,10 @@ DROP TABLE t1,t2; --replace_regex /-- [^D][^u][^m][^p].*// /\/\*!.*// / on [0-9 :-]+/ on DATE/ --exec $MYSQL_DUMP test +# We reset concurrent_inserts value to whatever it was at the start of the test +SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT; + + --echo # --echo # End of 5.0 tests --echo # diff --git a/mysql-test/t/ndb_autodiscover.test b/mysql-test/t/ndb_autodiscover.test index 049dcd9755e..dc450aeb9cf 100644 --- a/mysql-test/t/ndb_autodiscover.test +++ b/mysql-test/t/ndb_autodiscover.test @@ -24,7 +24,7 @@ create table t1( insert into t1 values(1, "Autodiscover"); flush tables; -system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ; +remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm ; select * from t1; show status like 'handler_discover%'; @@ -33,13 +33,13 @@ show status like 'handler_discover%'; # flush tables; -system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ; +remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm ; insert into t1 values (2, "Auto 2"); show status like 'handler_discover%'; insert into t1 values (3, "Discover 3"); show status like 'handler_discover%'; flush tables; -system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ; +remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm ; select * from t1 order by id; show status like 'handler_discover%'; @@ -48,7 +48,7 @@ show status like 'handler_discover%'; # flush tables; -system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ; +remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm ; update t1 set name="Autodiscover" where id = 2; show status like 'handler_discover%'; select * from t1 order by id; @@ -59,7 +59,7 @@ show status like 'handler_discover%'; # flush tables; -system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ; +remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm ; delete from t1 where id = 3; select * from t1 order by id; show status like 'handler_discover%'; @@ -111,9 +111,9 @@ show status like 'handler_discover%'; flush tables; # Remove the frm file from disk -system rm $MYSQLTEST_VARDIR/master-data/test/t3.frm ; +remove_file $MYSQLTEST_VARDIR/master-data/test/t3.frm ; ---error 1050 +--error ER_TABLE_EXISTS_ERROR create table t3( id int not null primary key, name char(20), a int, b float, c char(24) @@ -168,14 +168,14 @@ show status like 'handler_discover%'; # Remove the frm file from disk flush tables; -system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm ; +remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm ; show tables from test; show status like 'handler_discover%'; # Remove the frm file from disk again flush tables; -system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm ; +remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm ; --replace_column 7 # 8 # 9 # 12 # 13 # 15 # 18 # show table status; @@ -204,13 +204,13 @@ system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 >> $NDB_TOOLS # # Test that correct error is returned ---error 1146 +--error ER_NO_SUCH_TABLE select * from t4; ---error 1146 +--error ER_NO_SUCH_TABLE select * from t4; show status like 'handler_discover%'; ---error 1051 +--error ER_BAD_TABLE_ERROR drop table t4; create table t4( @@ -223,14 +223,14 @@ select * from t4; # Remove the table from NDB system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 >> $NDB_TOOLS_OUTPUT ; ---error 1146 +--error ER_NO_SUCH_TABLE select * from t4; drop table if exists t4; # Test that dropping a table that does not exists # on disk or in NDB gives same result as above ---error 1051 +--error ER_BAD_TABLE_ERROR drop table t5; drop table if exists t5; @@ -257,7 +257,7 @@ system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 >> $NDB_TOOLS SHOW TABLES; ---error 1146 +--error ER_NO_SUCH_TABLE select * from t4; ####################################################### @@ -290,8 +290,8 @@ insert into t9 values (9); system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 >> $NDB_TOOLS_OUTPUT ; system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 >> $NDB_TOOLS_OUTPUT ; # Remove t6, t7 from disk -system rm $MYSQLTEST_VARDIR/master-data/test/t6.frm > /dev/null ; -system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm > /dev/null ; +remove_file $MYSQLTEST_VARDIR/master-data/test/t6.frm; +remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm; SHOW TABLES; @@ -332,8 +332,8 @@ insert into t9 values (9); system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 > /dev/null ; system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 > /dev/null ; # Remove t6, t7 from disk -system rm $MYSQLTEST_VARDIR/master-data/test/t6.frm > /dev/null ; -system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm > /dev/null ; +remove_file $MYSQLTEST_VARDIR/master-data/test/t6.frm; +remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm; SHOW TABLES LIKE 't6'; @@ -342,9 +342,9 @@ show status like 'handler_discover%'; # Check that t3 or t5 can't be created # frm files for these tables is stilll on disk ---error 1050 +--error ER_TABLE_EXISTS_ERROR create table t3(a int); ---error 1050 +--error ER_TABLE_EXISTS_ERROR create table t5(a int); SHOW TABLES LIKE 't%'; @@ -375,9 +375,9 @@ insert into t3 values (3, "ndb table 3"); insert into t4 values (4); # Remove t1, t2, t3 from disk -system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm > /dev/null ; -system rm $MYSQLTEST_VARDIR/master-data/test/t2.frm > /dev/null ; -system rm $MYSQLTEST_VARDIR/master-data/test/t3.frm > /dev/null ; +remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm; +remove_file $MYSQLTEST_VARDIR/master-data/test/t2.frm; +remove_file $MYSQLTEST_VARDIR/master-data/test/t3.frm; flush tables; # Select from the table which only exists in NDB. @@ -462,7 +462,7 @@ show tables; create database test2; use test2; show tables; ---error 1146 +--error ER_NO_SUCH_TABLE select * from t1; create table t2 (b int,c longblob) engine=ndb; use test; @@ -487,7 +487,7 @@ create table t1 (a int primary key) engine=ndb; select * from t1; --exec $NDB_MGM --no-defaults -e "all restart -n" > /dev/null --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --not-started > /dev/null ---error 1015 +--error ER_CANT_LOCK select * from t1; --exec $NDB_MGM --no-defaults -e "all start" > /dev/null --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults > /dev/null @@ -503,17 +503,17 @@ drop database test_only_ndb_tables; # discovered( for example a table created via NDBAPI) # Test disabled since it doesn't work on case insensitive systems -#--error 1050 +#--error ER_TABLE_EXISTS_ERROR #CREATE TABLE sys.SYSTAB_0 (a int); -#--error 1105 +#--error ER_UNKNOWN_ERROR #select * from sys.SYSTAB_0; #CREATE TABLE IF NOT EXISTS sys.SYSTAB_0 (a int); #show warnings; -#--error 1105 +#--error ER_UNKNOWN_ERROR #select * from sys.SYSTAB_0; -#--error 1051 +#--error ER_BAD_TABLE_ERROR #drop table sys.SYSTAB_0; #drop table IF EXISTS sys.SYSTAB_0; @@ -531,7 +531,7 @@ CREATE TABLE t9 ( insert t9 values(1, 2), (2,3), (3, 4), (4, 5); #Don't drop the table, instead remove the frm file -system rm $MYSQLTEST_VARDIR/master-data/test/t9.frm ; +remove_file $MYSQLTEST_VARDIR/master-data/test/t9.frm ; # Now leave test case, when ndb_autodiscover2 will run, this # MySQL Server will have been restarted because it has a diff --git a/mysql-test/t/ndb_loaddatalocal.test b/mysql-test/t/ndb_loaddatalocal.test index 47054ecfbf5..f8930255a2a 100644 --- a/mysql-test/t/ndb_loaddatalocal.test +++ b/mysql-test/t/ndb_loaddatalocal.test @@ -25,7 +25,7 @@ create table t1(a int) engine=ndb; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1; select count(*) from t1; -system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile ; +remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile ; drop table t1; create table t1(a int) engine=myisam; @@ -37,7 +37,7 @@ drop table t1; create table t1(a int primary key) engine=ndb; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1; -system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile; +remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile; select * from t1 order by a; drop table t1; @@ -50,7 +50,7 @@ drop table t1; create table t1(a int primary key) engine=ndb; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1; -system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile; +remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile; select * from t1 order by a; drop table t1; @@ -63,7 +63,7 @@ drop table t1; create table t1(a int primary key) engine=ndb; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1; -system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile; +remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile; select * from t1 order by a; drop table t1; diff --git a/mysql-test/t/ndb_restore_print.test b/mysql-test/t/ndb_restore_print.test index 6dbbfdf5933..9a880f8968c 100644 --- a/mysql-test/t/ndb_restore_print.test +++ b/mysql-test/t/ndb_restore_print.test @@ -134,10 +134,14 @@ insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35); --let ndb_restore_filter=test t1 --source include/ndb_backup_print.inc ---exec rm -f $MYSQLTEST_VARDIR/tmp/t1.txt ---exec rm -f $MYSQLTEST_VARDIR/tmp/t2.txt ---exec rm -f $MYSQLTEST_VARDIR/tmp/t3.txt ---exec rm -f $MYSQLTEST_VARDIR/tmp/t4.txt +--error 0,1 +--remove_file $MYSQLTEST_VARDIR/tmp/t1.txt +--error 0,1 +--remove_file $MYSQLTEST_VARDIR/tmp/t2.txt +--error 0,1 +--remove_file $MYSQLTEST_VARDIR/tmp/t3.txt +--error 0,1 +--remove_file $MYSQLTEST_VARDIR/tmp/t4.txt --let ndb_restore_opts=--verbose=0 --print_data --hex --tab $MYSQLTEST_VARDIR/tmp --append --let ndb_restore_filter=test @@ -156,10 +160,10 @@ insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35); --source include/show_msg.inc --exec sort $MYSQLTEST_VARDIR/tmp/t4.txt ---exec rm -f $MYSQLTEST_VARDIR/tmp/t1.txt ---exec rm -f $MYSQLTEST_VARDIR/tmp/t2.txt ---exec rm -f $MYSQLTEST_VARDIR/tmp/t3.txt ---exec rm -f $MYSQLTEST_VARDIR/tmp/t4.txt +--remove_file $MYSQLTEST_VARDIR/tmp/t1.txt +--remove_file $MYSQLTEST_VARDIR/tmp/t2.txt +--remove_file $MYSQLTEST_VARDIR/tmp/t3.txt +--remove_file $MYSQLTEST_VARDIR/tmp/t4.txt # now test some other datatypes drop table t1; diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test index 2b80b0b9d93..527a4d398d8 100644 --- a/mysql-test/t/outfile.test +++ b/mysql-test/t/outfile.test @@ -31,13 +31,13 @@ select load_file(concat(@tmpdir,"/outfile-test.3")); # the following should give errors disable_query_log; ---error 1086 +--error ER_FILE_EXISTS_ERROR eval select * into outfile "../tmp/outfile-test.1" from t1; ---error 1086 +--error ER_FILE_EXISTS_ERROR eval select * into dumpfile "../tmp/outfile-test.2" from t1; ---error 1086 +--error ER_FILE_EXISTS_ERROR eval select * into dumpfile "../tmp/outfile-test.3" from t1; enable_query_log; select load_file(concat(@tmpdir,"/outfile-test.not-exist")); @@ -92,7 +92,7 @@ use test; # It should not be possible to write to a file outside of vardir create table t1(a int); --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---error 1290 +--error ER_OPTION_PREVENTS_STATEMENT eval select * into outfile "$MYSQL_TEST_DIR/outfile-test1" from t1; drop table t1; @@ -105,7 +105,7 @@ create user user_1@localhost; grant all on mysqltest.* to user_1@localhost; connect (con28181_1,localhost,user_1,,mysqltest); ---error 1044 +--error ER_DBACCESS_DENIED_ERROR eval select schema_name into outfile "../tmp/outfile-test.4" fields terminated by ',' optionally enclosed by '"' @@ -125,7 +125,7 @@ from information_schema.schemata where schema_name like 'mysqltest'; connection default; ---exec rm $MYSQLTEST_VARDIR/tmp/outfile-test.4 +--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4 use test; revoke all privileges on *.* from user_1@localhost; drop user user_1@localhost; diff --git a/mysql-test/t/rpl_EE_error.test b/mysql-test/t/rpl_EE_error.test index 640a2b1a88c..bf42cf2304e 100644 --- a/mysql-test/t/rpl_EE_error.test +++ b/mysql-test/t/rpl_EE_error.test @@ -6,9 +6,11 @@ source include/master-slave.inc; + create table t1 (a int) engine=myisam; flush tables; -system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYI ; +--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYI + drop table if exists t1; save_master_pos; connection slave; @@ -22,7 +24,7 @@ set sql_log_bin=0; insert into t1 values(2); set sql_log_bin=1; save_master_pos; ---error 1062 +--error ER_DUP_ENTRY insert into t1 values(1),(2); drop table t1; save_master_pos; diff --git a/mysql-test/t/rpl_loaddatalocal.test b/mysql-test/t/rpl_loaddatalocal.test index af4fd0106bd..d3149bea427 100644 --- a/mysql-test/t/rpl_loaddatalocal.test +++ b/mysql-test/t/rpl_loaddatalocal.test @@ -25,7 +25,7 @@ eval select * into outfile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.sele truncate table t1; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval load data local infile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1; -system rm $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile ; +--remove_file $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile save_master_pos; connection slave; sync_with_master; @@ -52,7 +52,7 @@ drop table t1; create table t1(a int primary key); --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval load data local infile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1; -system rm $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile ; +remove_file $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile ; select * from t1; save_master_pos; connection slave; diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index c9b2b1dbd0e..c839b1e4374 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -2173,6 +2173,14 @@ begin end loop; end| +CREATE TABLE t1 (a INT)| +INSERT INTO t1 VALUES (1),(2)| +CREATE PROCEDURE p1(a INT) BEGIN END| +--error ER_SUBQUERY_NO_1_ROW +CALL p1((SELECT * FROM t1))| +DROP PROCEDURE IF EXISTS p1| +DROP TABLE t1| + delimiter ;| # diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 87ab1d2f0d9..21ca2528e4f 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -7818,6 +7818,24 @@ drop function f1; drop view v1; drop table t1; +# +# Bug#38469 invalid memory read and/or crash with utf8 text field, stored procedure, uservar +# +delimiter $; +--disable_warnings +drop procedure if exists `p2` $ +--enable_warnings +create procedure `p2`(in `a` text charset utf8) +begin + declare `pos` int default 1; + declare `str` text charset utf8; + set `str` := `a`; + select substr(`str`, `pos`+ 1 ) into `str`; +end $ +delimiter ;$ +call `p2`('s s s s s s'); +drop procedure `p2`; + --echo # ------------------------------------------------------------------ --echo # -- End of 5.0 tests --echo # ------------------------------------------------------------------ diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test index 9478abe1224..af1867b5b66 100644 --- a/mysql-test/t/symlink.test +++ b/mysql-test/t/symlink.test @@ -80,7 +80,7 @@ create database mysqltest; create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="/this-dir-does-not-exist"; # temporarily disabled as it returns different result in the embedded server -# --error 1210, 1210 +# --error ER_WRONG_ARGUMENTS,ER_WRONG_ARGUMENTS # create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="not-hard-path"; # Should fail becasue the file t9.MYI already exist in 'run' @@ -185,7 +185,12 @@ drop table t1; # # Protect ourselves from data left in tmp/ by a previos possibly failed # test ---system rm -f $MYSQLTEST_VARDIR/tmp/t1.* +--error 0,1 +--remove_file $MYSQLTEST_VARDIR/tmp/t1.frm +--error 0,1 +--remove_file $MYSQLTEST_VARDIR/tmp/t1.MYD +--error 0,1 +--remove_file $MYSQLTEST_VARDIR/tmp/t1.MYI --disable_query_log eval prepare stmt from "create table t1 (c char(10)) data directory='$MYSQLTEST_VARDIR/tmp'"; --enable_query_log @@ -203,19 +208,19 @@ deallocate prepare stmt; # Bug#32167 another privilege bypass with DATA/INDEX DIRECORY # --replace_result $MYSQL_TEST_DIR TEST_DIR ---error 1,1210 +--error 1,ER_WRONG_ARGUMENTS eval CREATE TABLE t1(a INT) DATA DIRECTORY='$MYSQL_TEST_DIR/var/master-data/test'; --replace_result $MYSQL_TEST_DIR TEST_DIR ---error 1,1210 +--error 1,ER_WRONG_ARGUMENTS eval CREATE TABLE t1(a INT) DATA DIRECTORY='$MYSQL_TEST_DIR/var/master-data/'; --replace_result $MYSQL_TEST_DIR TEST_DIR ---error 1,1210 +--error 1,ER_WRONG_ARGUMENTS eval CREATE TABLE t1(a INT) INDEX DIRECTORY='$MYSQL_TEST_DIR/var/master-data'; --replace_result $MYSQL_TEST_DIR TEST_DIR ---error 1,1210 +--error 1,ER_WRONG_ARGUMENTS eval CREATE TABLE t1(a INT) INDEX DIRECTORY='$MYSQL_TEST_DIR/var/master-data_var'; |