diff options
author | pem@mysql.com <> | 2005-10-17 15:12:38 +0200 |
---|---|---|
committer | pem@mysql.com <> | 2005-10-17 15:12:38 +0200 |
commit | ddc36a2784706a2f05503901ee9d4127e6f2206d (patch) | |
tree | f8c0716ae44a4ab19b58972c4cbd327128b6e8e5 /mysql-test/t | |
parent | e58531570371b640e963d01e5714b636e7bad82b (diff) | |
parent | 1cb37294dee5a6882b0ff387854ffd110ab2c8a3 (diff) | |
download | mariadb-git-ddc36a2784706a2f05503901ee9d4127e6f2206d.tar.gz |
Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/home/pem/work/bug7049/mysql-5.0
Diffstat (limited to 'mysql-test/t')
33 files changed, 631 insertions, 73 deletions
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index 2e5b68c1dc7..bae94656125 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -278,7 +278,7 @@ insert into t1 values ('ิลำิ'); select a,hex(a) from t1; alter table t1 change a a char(10) character set cp1251; select a,hex(a) from t1; -alter table t1 change a a binary(10); +alter table t1 change a a binary(4); select a,hex(a) from t1; alter table t1 change a a char(10) character set cp1251; select a,hex(a) from t1; diff --git a/mysql-test/t/binary.test b/mysql-test/t/binary.test index 02773b32302..1ac0cfebb28 100644 --- a/mysql-test/t/binary.test +++ b/mysql-test/t/binary.test @@ -56,7 +56,7 @@ drop table t1; # # Test of binary and upper/lower # -create table t1 (a char(15) binary, b binary(15)); +create table t1 (a char(3) binary, b binary(3)); insert into t1 values ('aaa','bbb'),('AAA','BBB'); select upper(a),upper(b) from t1; select lower(a),lower(b) from t1; diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test index 6220b4cbae7..70eb87131df 100644 --- a/mysql-test/t/cast.test +++ b/mysql-test/t/cast.test @@ -101,7 +101,7 @@ drop table t1; # Bug 2202 # CAST from BINARY to non-BINARY and from non-BINARY to BINARY # -create table t1 (a binary(10), b char(10) character set koi8r); +create table t1 (a binary(4), b char(4) character set koi8r); insert into t1 values (_binary'ิลำิ',_binary'ิลำิ'); select a,b,cast(a as char character set cp1251),cast(b as binary) from t1; set names koi8r; @@ -160,6 +160,11 @@ select cast(concat('184467440','73709551615') as signed); select cast(repeat('1',20) as unsigned); select cast(repeat('1',20) as signed); +# +# Bug #13344: cast of large decimal to signed int not handled correctly +# +select cast(1.0e+300 as signed int); + # End of 4.1 tests diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test index 1788dce755b..ffe2a12234e 100644 --- a/mysql-test/t/ctype_big5.test +++ b/mysql-test/t/ctype_big5.test @@ -38,4 +38,19 @@ INSERT INTO t1 VALUES(0xA741ADCCA66EB6DC20A7DAADCCABDCA66E); SELECT HEX(a) FROM t1 WHERE MATCH(a) AGAINST (0xA741ADCCA66EB6DC IN BOOLEAN MODE); DROP TABLE t1; +# +# Bug#12476 Some big5 codes are still missing. +# +set names big5; +create table t1 (a char character set big5); +insert into t1 values (0xF9D6),(0xF9D7),(0xF9D8),(0xF9D9); +insert into t1 values (0xF9DA),(0xF9DB),(0xF9DC); +# Check round trip +select hex(a) a, hex(@u:=convert(a using utf8)) b, +hex(convert(@u using big5)) c from t1 order by a; +# Check that there is no "illegal mix of collations" error with Unicode. +alter table t1 convert to character set utf8; +select hex(a) from t1 where a = _big5 0xF9DC; +drop table t1; + # End of 4.1 tests diff --git a/mysql-test/t/ctype_cp1251.test b/mysql-test/t/ctype_cp1251.test index 1aafe7b7266..463a9cea4bc 100644 --- a/mysql-test/t/ctype_cp1251.test +++ b/mysql-test/t/ctype_cp1251.test @@ -21,7 +21,7 @@ drop table t1; # # Test of binary and upper/lower # -create table t1 (a char(15) binary, b binary(15)) character set cp1251; +create table t1 (a char(3) binary, b binary(3)) character set cp1251; insert into t1 values ('aaa','bbb'),('AAA','BBB'); select upper(a),upper(b) from t1; select lower(a),lower(b) from t1; diff --git a/mysql-test/t/ctype_cp932.test b/mysql-test/t/ctype_cp932.test index 3d630311b3a..082786e38af 100644 --- a/mysql-test/t/ctype_cp932.test +++ b/mysql-test/t/ctype_cp932.test @@ -424,3 +424,13 @@ SET collation_connection='cp932_japanese_ci'; -- source include/ctype_filesort.inc SET collation_connection='cp932_bin'; -- source include/ctype_filesort.inc + +# +# Bug#12547: Inserting long string into varchar causes table crash in cp932 +# +create table t1 (col1 varchar(1)) character set cp932; +insert into t1 values ('a'); +insert into t1 values ('ab'); +select * from t1; +insert into t1 values ('abc'); +select * from t1; diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test index 8953aaecaf8..a005b4769c4 100644 --- a/mysql-test/t/ctype_latin1.test +++ b/mysql-test/t/ctype_latin1.test @@ -55,6 +55,23 @@ SELECT DROP TABLE t1; # +# Bug#13145: A table named "C-cedilla" can't be dropped. +# Accept extended cp1252 letters as valid identifiers. +# This test partially checks that "ctype" array is correct +# for cp1252 extended characters 0x80-0x9F. +# +# 0x83 0x0192 #LATIN SMALL LETTER F WITH HOOK +# 0x8A 0x0160 #LATIN CAPITAL LETTER S WITH CARON +# 0x8C 0x0152 #LATIN CAPITAL LIGATURE OE +# 0x8E 0x017D #LATIN CAPITAL LETTER Z WITH CARON +# 0x9A 0x0161 #LATIN SMALL LETTER S WITH CARON +# 0x9C 0x0153 #LATIN SMALL LIGATURE OE +# 0x9E 0x017E #LATIN SMALL LETTER Z WITH CARON +# 0x9F 0x0178 #LATIN CAPITAL LETTER Y WITH DIAERESIS +# +SELECT 1 as , 2 as , 3 as , 4 as , 5 as , 6 as , 7 as , 8 as ; + +# # Bug #6737: REGEXP gives wrong result with case sensitive collation # select 'a' regexp 'A' collate latin1_general_ci; diff --git a/mysql-test/t/ctype_many.test b/mysql-test/t/ctype_many.test index 22e844c6868..0903c3dd7fa 100644 --- a/mysql-test/t/ctype_many.test +++ b/mysql-test/t/ctype_many.test @@ -148,7 +148,7 @@ SET CHARACTER SET koi8r; SELECT * FROM t1; -ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL default ''; +ALTER TABLE t1 ADD bin_f CHAR(1) BYTE NOT NULL default ''; UPDATE t1 SET bin_f=koi8_ru_f; SELECT COUNT(DISTINCT bin_f),COUNT(DISTINCT koi8_ru_f),COUNT(DISTINCT utf8_f) FROM t1; @@ -204,7 +204,7 @@ UPDATE t1 SET greek_f=CONVERT(ucs2_f USING greek) WHERE comment LIKE _latin2'GRE UPDATE t1 SET armscii8_f=CONVERT(ucs2_f USING armscii8) WHERE comment LIKE _latin2'ARM%'; UPDATE t1 SET utf8_f=CONVERT(ucs2_f USING utf8) WHERE utf8_f=_utf8''; UPDATE t1 SET ucs2_f=CONVERT(utf8_f USING ucs2) WHERE ucs2_f=_ucs2''; -SELECT * FROM t1; +SELECT comment, koi8_ru_f, utf8_f, hex(bin_f), ucs2_f, armscii8_f, greek_f FROM t1; SET CHARACTER SET 'binary'; SELECT * FROM t1; SELECT min(comment),count(*) FROM t1 GROUP BY ucs2_f; diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index d186ca8a1f6..6628175198c 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -851,6 +851,14 @@ insert into t1 values (_utf8 0x5b); select hex(a) from t1; drop table t1; +# +# Bug#13751 find_in_set: Illegal mix of collations +# +set names 'latin1'; +create table t1 (a varchar(255)) default charset=utf8; +select * from t1 where find_in_set('-1', a); +drop table t1; + # End of 4.1 tests # @@ -871,22 +879,32 @@ DROP TABLE t1; # set names utf8; # correct value -select hex(char(1)); -select char(0xd1,0x8f); -select char(0xd18f); -select char(53647); +select hex(char(1 using utf8)); +select char(0xd1,0x8f using utf8); +select char(0xd18f using utf8); +select char(53647 using utf8); # incorrect value: return with warning -select char(0xff,0x8f); +select char(0xff,0x8f using utf8); # incorrect value in strict mode: return NULL with "Error" level warning set sql_mode=traditional; -select char(0xff,0x8f); -select convert(char(0xff,0x8f) using utf8); -select char(195); -select convert(char(195) using utf8); -select char(196); -select convert(char(196) using utf8); +select char(0xff,0x8f using utf8); +select char(195 using utf8); +select char(196 using utf8); +select char(2557 using utf8); + +# +# Check convert + char + using +# +select hex(convert(char(2557 using latin1) using utf8)); + +# +# char() without USING returns "binary" by default, any argument is ok +# +select hex(char(195)); +select hex(char(196)); select hex(char(2557)); -select hex(convert(char(2557) using utf8)); + + # # Bug#12891: UNION doesn't return DISTINCT result for multi-byte characters diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test index 453343e6f09..9880cd78653 100644 --- a/mysql-test/t/federated.test +++ b/mysql-test/t/federated.test @@ -75,7 +75,8 @@ eval CREATE TABLE federated.t2 ( ENGINE="FEDERATED" DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; -SHOW CREATE TABLE federated.t2; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval SHOW CREATE TABLE federated.t2; INSERT INTO federated.t2 (id, name) VALUES (1, 'foo'); INSERT INTO federated.t2 (id, name) VALUES (2, 'fee'); @@ -350,7 +351,7 @@ DROP TABLE IF EXISTS federated.t1; CREATE TABLE federated.t1 ( `id` int NOT NULL auto_increment, `name` char(32) NOT NULL DEFAULT '', - `bincol` binary(4) NOT NULL, + `bincol` binary(1) NOT NULL, `floatval` decimal(5,2) NOT NULL DEFAULT 0.0, `other` int NOT NULL DEFAULT 0, PRIMARY KEY (id), @@ -365,7 +366,7 @@ DROP TABLE IF EXISTS federated.t1; eval CREATE TABLE federated.t1 ( `id` int NOT NULL auto_increment, `name` char(32) NOT NULL DEFAULT '', - `bincol` binary(4) NOT NULL, + `bincol` binary(1) NOT NULL, `floatval` decimal(5,2) NOT NULL DEFAULT 0.0, `other` int NOT NULL DEFAULT 0, PRIMARY KEY (id), diff --git a/mysql-test/t/func_crypt.test b/mysql-test/t/func_crypt.test index 5e0283feb28..cc3cdb9564d 100644 --- a/mysql-test/t/func_crypt.test +++ b/mysql-test/t/func_crypt.test @@ -49,4 +49,10 @@ select old_password(' i d k f a '); explain extended select password('idkfa '), old_password('idkfa'); +# +# Bug #13619: Crash on FreeBSD with salt like '_.' +# +--replace_column 1 # +select encrypt('1234','_.'); + # End of 4.1 tests diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index 19596c1b55a..9237205eeb5 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -2,6 +2,8 @@ # simple test of all group functions # +--source include/have_innodb.inc + --disable_warnings drop table if exists t1,t2; --enable_warnings diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index dd4edd8ca48..0472968f918 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -97,7 +97,7 @@ select 1 in ('1.1',2.0); # Test case for bug #6365 -create table t1 (a char(20) character set binary); +create table t1 (a char(2) character set binary); insert into t1 values ('aa'), ('bb'); select * from t1 where a in (NULL, 'aa'); drop table t1; diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test index 97842d6b4e6..7f3a9932d31 100644 --- a/mysql-test/t/kill.test +++ b/mysql-test/t/kill.test @@ -25,6 +25,7 @@ select ((@id := kill_id) - kill_id) from t1; kill @id; connection con1; +--sleep 1 # this statement should fail --error 2006,2013 diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 7dafac2bde5..377a8c8179e 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -907,3 +907,58 @@ DROP PROCEDURE bug9056_proc1; DROP PROCEDURE bug9056_proc2; drop table t1; +# +# BUG# 13052 - mysqldump timestamp reloads broken +# +--disable_warnings +drop table if exists t1; +--enable_warnings + +create table t1 (`d` timestamp, unique (`d`)); +set time_zone='+00:00'; +insert into t1 values ('2003-10-25 22:00:00'),('2003-10-25 23:00:00'); +# results should show two different time values +select * from t1; +set time_zone='Europe/Moscow'; +# results should show two same time values, despite unique +select * from t1; +set global time_zone='Europe/Moscow'; +--exec $MYSQL_DUMP --skip-comments --databases test +--exec $MYSQL_DUMP --skip-tz-utc --skip-comments --databases test +drop table t1; +set global time_zone=default; +set time_zone=default; + +# +# Test of fix to BUG 13146 - ansi quotes break loading of triggers +# +--disable_warnings +DROP TABLE IF EXISTS `t1 test`; +CREATE TABLE `t1 test` ( + `a1` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +DROP TABLE IF EXISTS `t2 test`; +CREATE TABLE `t2 test` ( + `a2` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +--enable_warnings + +DELIMITER //; +CREATE TRIGGER `test trig` BEFORE INSERT ON `t1 test` FOR EACH ROW BEGIN +INSERT INTO `t2 test` SET a2 = NEW.a1; END // +DELIMITER ;// + +INSERT INTO `t1 test` VALUES (1); +INSERT INTO `t1 test` VALUES (2); +INSERT INTO `t1 test` VALUES (3); +SELECT * FROM `t2 test`; +# dump with compatible=ansi. Everything except triggers should be double +# quoted +--exec $MYSQL_DUMP --skip-comments --compatible=ansi --triggers test + +--disable_warnings +DROP TRIGGER `test trig`; +DROP TABLE `t1 test`; +DROP TABLE `t2 test`; +--enable_warnings diff --git a/mysql-test/t/ndb_condition_pushdown.test b/mysql-test/t/ndb_condition_pushdown.test index d090d12e81b..9f512430085 100644 --- a/mysql-test/t/ndb_condition_pushdown.test +++ b/mysql-test/t/ndb_condition_pushdown.test @@ -12,7 +12,7 @@ CREATE TABLE t1 ( auto int(5) unsigned NOT NULL auto_increment, string char(10), vstring varchar(10), - bin binary(7), + bin binary(2), vbin varbinary(7), tiny tinyint(4) DEFAULT '0' NOT NULL , short smallint(6) DEFAULT '1' NOT NULL , diff --git a/mysql-test/t/ndb_config.test b/mysql-test/t/ndb_config.test index 9d1c107472f..e40e89d76bd 100644 --- a/mysql-test/t/ndb_config.test +++ b/mysql-test/t/ndb_config.test @@ -11,3 +11,8 @@ # End of 4.1 tests --exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.jonas --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf1.cnf --query=type,nodeid,host,IndexMemory,DataMemory --mycnf 2> /dev/null + +--exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster0 --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --query=type,nodeid,host --mycnf 2> /dev/null +--exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster1 --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --query=type,nodeid,host --mycnf 2> /dev/null +--exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster2 --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --query=type,nodeid,host --mycnf 2> /dev/null +--exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster2 --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --ndb-shm --connections --query=type,nodeid1,nodeid2,group,nodeidserver --mycnf 2> /dev/null diff --git a/mysql-test/t/ndb_types.test b/mysql-test/t/ndb_types.test index 3446a409b2a..10b8eb87e2c 100644 --- a/mysql-test/t/ndb_types.test +++ b/mysql-test/t/ndb_types.test @@ -12,7 +12,7 @@ CREATE TABLE t1 ( auto int(5) unsigned NOT NULL auto_increment, string char(10) default "hello", vstring varchar(10) default "hello", - bin binary(7), + bin binary(2), vbin varbinary(7), tiny tinyint(4) DEFAULT '0' NOT NULL , short smallint(6) DEFAULT '1' NOT NULL , diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 89376d33f61..f6493bac244 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -628,6 +628,6 @@ explain select * from t2 where a = 'a' or a='a '; update t1 set a='b' where a<>'a'; --replace_column 9 # explain select * from t1 where a not between 'b' and 'b'; -select * from t1 where a not between 'b' and 'b'; +select a, hex(filler) from t1 where a not between 'b' and 'b'; drop table t1,t2,t3; diff --git a/mysql-test/t/rpl_ddl.test b/mysql-test/t/rpl_ddl.test index 60a00a7b1b4..d2a41a305b6 100644 --- a/mysql-test/t/rpl_ddl.test +++ b/mysql-test/t/rpl_ddl.test @@ -392,6 +392,113 @@ connection master; --horizontal_results ############################################################### +# Cases with VIEWs +############################################################### +let $my_stmt= CREATE OR REPLACE VIEW v1 as select * from t1; +let $my_master_commit= true; +let $my_slave_commit= true; +--source include/rpl_stmt_seq.inc +SHOW CREATE VIEW v1; +--disable_query_log +SELECT '-------- switch to slave -------' as ""; +--enable_query_log +connection slave; +SHOW CREATE VIEW v1; +connection master; + +let $my_stmt= ALTER VIEW v1 AS select f1 from t1; +let $my_master_commit= true; +let $my_slave_commit= true; +--source include/rpl_stmt_seq.inc +SHOW CREATE VIEW v1; +--disable_query_log +SELECT '-------- switch to slave -------' as ""; +--enable_query_log +connection slave; +SHOW CREATE VIEW v1; +connection master; + +let $my_stmt= DROP VIEW IF EXISTS v1; +let $my_master_commit= true; +let $my_slave_commit= true; +--source include/rpl_stmt_seq.inc +--error 1146 +SHOW CREATE VIEW v1; +--disable_query_log +SELECT '-------- switch to slave -------' as ""; +--enable_query_log +connection slave; +--error 1146 +SHOW CREATE VIEW v1; +connection master; + +############################################################### +# Cases with TRIGGERs +############################################################### +let $my_stmt= CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1; +let $my_master_commit= true; +let $my_slave_commit= true; +--source include/rpl_stmt_seq.inc +SHOW TRIGGERS; +--disable_query_log +SELECT '-------- switch to slave -------' as ""; +--enable_query_log +connection slave; +SHOW TRIGGERS; +connection master; + +let $my_stmt= DROP TRIGGER trg1; +let $my_master_commit= true; +let $my_slave_commit= true; +--source include/rpl_stmt_seq.inc +SHOW TRIGGERS; +--disable_query_log +SELECT '-------- switch to slave -------' as ""; +--enable_query_log +connection slave; +SHOW TRIGGERS; +connection master; + +############################################################### +# Cases with USERs +############################################################### +let $my_stmt= CREATE USER user1@localhost; +let $my_master_commit= true; +let $my_slave_commit= true; +--source include/rpl_stmt_seq.inc +SELECT user FROM mysql.user WHERE user = 'user1'; +--disable_query_log +SELECT '-------- switch to slave -------' as ""; +--enable_query_log +connection slave; +SELECT user FROM mysql.user WHERE user = 'user1'; +connection master; + +let $my_stmt= RENAME USER user1@localhost TO rename1@localhost; +let $my_master_commit= true; +let $my_slave_commit= true; +--source include/rpl_stmt_seq.inc +SELECT user FROM mysql.user WHERE user = 'rename1'; +--disable_query_log +SELECT '-------- switch to slave -------' as ""; +--enable_query_log +connection slave; +SELECT user FROM mysql.user WHERE user = 'rename1'; +connection master; + +let $my_stmt= DROP USER rename1@localhost; +let $my_master_commit= true; +let $my_slave_commit= true; +--source include/rpl_stmt_seq.inc +SELECT user FROM mysql.user WHERE user = 'rename1'; +--disable_query_log +SELECT '-------- switch to slave -------' as ""; +--enable_query_log +connection slave; +SELECT user FROM mysql.user WHERE user = 'rename1'; +connection master; + +############################################################### # Cleanup ############################################################### --disable_warnings diff --git a/mysql-test/t/rpl_dual_pos_advance-master.opt b/mysql-test/t/rpl_dual_pos_advance-master.opt new file mode 100644 index 00000000000..35fcc5f30c6 --- /dev/null +++ b/mysql-test/t/rpl_dual_pos_advance-master.opt @@ -0,0 +1 @@ +--loose-to-force-a-restart diff --git a/mysql-test/t/rpl_dual_pos_advance.test b/mysql-test/t/rpl_dual_pos_advance.test new file mode 100644 index 00000000000..518fa9df885 --- /dev/null +++ b/mysql-test/t/rpl_dual_pos_advance.test @@ -0,0 +1,108 @@ +# This test checks that in a dual-head setup +# A->B->A, where A has --log-slave-updates (why would it? +# assume that there is a C as slave of A), +# then the Exec_master_log_pos of SHOW SLAVE STATUS does +# not stay too low on B(BUG#13023 due to events ignored because +# of their server id). +# It also will test BUG#13861. + +source include/master-slave.inc; + + +# set up "dual head" + +connection slave; +reset master; + +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval change master to master_host="127.0.0.1",master_port=$SLAVE_MYPORT,master_user="root"; + +start slave; + +# now we test it + +connection slave; + +create table t1 (n int); + +save_master_pos; +connection master; +sync_with_master; + +# Now test BUG#13861. This will be enabled when Guilhem fixes this +# bug. + +# stop slave + +# create table t2 (n int); # create one ignored event + +# save_master_pos; +# connection slave; +# sync_with_master; + +# connection slave; + +# show tables; + +# save_master_pos; + +# create table t3 (n int); + +# connection master; + +# bug is that START SLAVE UNTIL may stop too late, we test that by +# asking it to stop before creation of t3. + +# start slave until master_log_file="slave-bin.000001",master_log_pos=195; + +# wait until it's started (the position below is the start of "CREATE +# TABLE t2") (otherwise wait_for_slave_to_stop may return at once) + +# select master_pos_wait("slave-bin.000001",137); + +# wait_for_slave_to_stop; + +# then BUG#13861 causes t3 to show up below (because stopped too +# late). + +# show tables; + +# start slave; + +# BUG#13023 is that Exec_master_log_pos may stay too low "forever": + +connection master; + +create table t4 (n int); # create 3 ignored events +create table t5 (n int); +create table t6 (n int); + +save_master_pos; +connection slave; +sync_with_master; + +connection slave; + +save_master_pos; + +connection master; + +# then BUG#13023 caused hang below ("master" looks behind, while it's +# not in terms of updates done). + +sync_with_master; + +show tables; + +# cleanup + +stop slave; +reset slave; +drop table t1,t4,t5,t6; # add t2 and t3 later + +save_master_pos; +connection slave; +sync_with_master; + +# End of 4.1 tests diff --git a/mysql-test/t/rpl_multi_update2.test b/mysql-test/t/rpl_multi_update2.test index f92c5504f43..a78b1901f51 100644 --- a/mysql-test/t/rpl_multi_update2.test +++ b/mysql-test/t/rpl_multi_update2.test @@ -4,6 +4,10 @@ source include/master-slave.inc; +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + CREATE TABLE t1 ( a int unsigned not null auto_increment primary key, b int unsigned @@ -32,4 +36,27 @@ sync_with_master; SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; +connection master; +drop table t1,t2; +sync_slave_with_master; + +# +# BUG#13236 multi-update with subquery & --replicate-ignore-table +# +reset master; + +connection master; +CREATE TABLE t1 ( a INT ); +INSERT INTO t1 VALUES (0); +UPDATE t1, (SELECT 3 as b) AS x SET t1.a = x.b; +select * from t1; +sync_slave_with_master; + +connection slave; +select * from t1; + +connection master; +drop table t1; +sync_slave_with_master; + # End of 4.1 tests diff --git a/mysql-test/t/rpl_sp.test b/mysql-test/t/rpl_sp.test index fa44b68bd8c..e62a6c73c0a 100644 --- a/mysql-test/t/rpl_sp.test +++ b/mysql-test/t/rpl_sp.test @@ -258,6 +258,23 @@ sync_slave_with_master; select * from t1; +# +# Test for bug #13969 "Routines which are replicated from master can't be +# executed on slave". +# +connection master; +create procedure foo() + not deterministic + reads sql data + select * from t1; +sync_slave_with_master; +# This should not fail +call foo(); +connection master; +drop procedure foo; +sync_slave_with_master; + + # Clean up connection master; drop function fn1; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 3bfcce832c1..6fc149e2e1f 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -7,7 +7,7 @@ # --disable_warnings -drop table if exists t1,t2,t3,t4; +drop table if exists t1,t2,t3,t4,t11; # The following may be left from older tests drop table if exists t1_1,t1_2,t9_1,t9_2,t1aa,t2aa; drop view if exists v1; @@ -2070,6 +2070,7 @@ AND FK_firma_id = 2; drop table t1; # +# # Test for Bug#8009, SELECT failed on bigint unsigned when using HEX # @@ -2182,6 +2183,16 @@ select found_rows(); DROP TABLE t1; # +# Bug 7672 Unknown column error in order clause +# +CREATE TABLE t1 (a INT, b INT); +(SELECT a, b AS c FROM t1) ORDER BY c+1; +(SELECT a, b AS c FROM t1) ORDER BY b+1; +SELECT a, b AS c FROM t1 ORDER BY c+1; +SELECT a, b AS c FROM t1 ORDER BY b+1; +drop table t1; + +# # Bug #13356 assertion failed in resolve_const_item() # create table t1(f1 int, f2 int); @@ -2195,6 +2206,44 @@ select * from t1,t2 where f1=f3 and (f1,f2) = (2,null); select * from t1,t2 where f1=f3 and (f1,f2) <=> (2,null); drop table t1,t2; +# +# Bug #13535 +# +create table t1 (f1 int not null auto_increment primary key, f2 varchar(10)); +create table t11 like t1; +insert into t1 values(1,""),(2,""); +--replace_column 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X +show table status like 't1%'; +select 123 as a from t1 where f1 is null; +drop table t1,t11; + +# Bug 7672 Unknown column error in order clause +# +CREATE TABLE t1 (a INT, b INT); +(SELECT a, b AS c FROM t1) ORDER BY c+1; +(SELECT a, b AS c FROM t1) ORDER BY b+1; +SELECT a, b AS c FROM t1 ORDER BY c+1; +SELECT a, b AS c FROM t1 ORDER BY b+1; +drop table t1; + +# +# Bug #3874 (function in GROUP and LEFT JOIN) +# + +CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL, UNIQUE idx (a,b) ); +INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4); +CREATE TABLE t2 ( a INT NOT NULL, b INT NOT NULL, e INT ); +INSERT INTO t2 VALUES ( 1,10,1), (1,10,2), (1,11,1), (1,11,2), (1,2,1), (1,2,2),(1,2,3); +SELECT t2.a, t2.b, IF(t1.b IS NULL,'',e) AS c, COUNT(*) AS d FROM t2 LEFT JOIN +t1 ON t2.a = t1.a AND t2.b = t1.b GROUP BY a, b, c; +SELECT t2.a, t2.b, IF(t1.b IS NULL,'',e) AS c, COUNT(*) AS d FROM t2 LEFT JOIN +t1 ON t2.a = t1.a AND t2.b = t1.b GROUP BY t1.a, t1.b, c; +SELECT t2.a, t2.b, IF(t1.b IS NULL,'',e) AS c, COUNT(*) AS d FROM t2 LEFT JOIN +t1 ON t2.a = t1.a AND t2.b = t1.b GROUP BY t2.a, t2.b, c; +SELECT t2.a, t2.b, IF(t1.b IS NULL,'',e) AS c, COUNT(*) AS d FROM t2,t1 +WHERE t2.a = t1.a AND t2.b = t1.b GROUP BY a, b, c; +DROP TABLE IF EXISTS t1, t2; + # End of 4.1 tests # @@ -2585,31 +2634,18 @@ drop view v1, v2, v3; # nested right join. # -create table a ( - id int(11) not null default '0' -) engine=myisam default charset=latin1; - -insert into a values (123),(191),(192); - -create table b ( - id char(16) character set utf8 not null default '' -) engine=myisam default charset=latin1; - -insert into b values ('58013'),('58014'),('58015'),('58016'); - -create table c ( - a_id int(11) not null default '0', - b_id char(16) character set utf8 default null -) engine=myisam default charset=latin1; - -insert into c values -(123,null),(123,null),(123,null),(123,null),(123,null),(123,'58013'); +create table t1 (id int(11) not null default '0'); +insert into t1 values (123),(191),(192); +create table t2 (id char(16) character set utf8 not null); +insert into t2 values ('58013'),('58014'),('58015'),('58016'); +create table t3 (a_id int(11) not null, b_id char(16) character set utf8); +insert into t3 values (123,null),(123,null),(123,null),(123,null),(123,null),(123,'58013'); -- both queries are equivalent select count(*) -from a inner join (c left join b on b.id = c.b_id) on a.id = c.a_id; +from t1 inner join (t3 left join t2 on t2.id = t3.b_id) on t1.id = t3.a_id; select count(*) -from a inner join (b right join c on b.id = c.b_id) on a.id = c.a_id; +from t1 inner join (t2 right join t3 on t2.id = t3.b_id) on t1.id = t3.a_id; -drop table a, b, c; +drop table t1,t2,t3; diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test index 6f1332f80d5..afbc383a17a 100644 --- a/mysql-test/t/sp-security.test +++ b/mysql-test/t/sp-security.test @@ -412,4 +412,28 @@ drop database mysqltest_1; revoke usage on *.* from mysqltest_1@localhost; drop user mysqltest_1@localhost; +# +# BUG#12812 create view calling a function works without execute right +# on function +delimiter |; +--disable_warnings +drop function if exists bug12812| +--enable_warnings +create function bug12812() returns char(2) +begin + return 'ok'; +end; +create user user_bug12812@localhost IDENTIFIED BY 'ABC'| +--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK +connect (test_user_12812,localhost,user_bug12812,ABC,test)| +--error 1370 +SELECT test.bug12812()| +--error 1370 +CREATE VIEW v1 AS SELECT test.bug12812()| +# Cleanup +connection default| +disconnect test_user_12812| +DROP USER user_bug12812@localhost| +drop function bug12812| +delimiter ;| # End of 5.0 bugs. diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 36a77545f8b..4b9987c2803 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -2431,7 +2431,7 @@ create function bug3788() returns date return cast("2005-03-04" as date)| select bug3788()| drop function bug3788| -create function bug3788() returns binary(5) return 5| +create function bug3788() returns binary(1) return 5| select bug3788()| drop function bug3788| @@ -4037,28 +4037,6 @@ begin end| drop function bug9048| -# -# BUG#12812 create view calling a function works without execute right -# on function ---disable_warnings -drop function if exists bug12812| ---enable_warnings -create function bug12812() returns char(2) -begin - return 'ok'; -end; -create user user_bug12812@localhost IDENTIFIED BY 'ABC'| ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (test_user_12812,localhost,user_bug12812,ABC,test)| ---error 1370 -SELECT test.bug12812()| ---error 1370 -CREATE VIEW v1 AS SELECT test.bug12812()| -# Cleanup -connection default| -disconnect test_user_12812| -DROP USER user_bug12812@localhost| -drop function bug12812| # Bug #12849 Stored Procedure: Crash on procedure call with CHAR type # 'INOUT' parameter # diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 5020902009d..cc621fb5835 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -1962,4 +1962,9 @@ insert into t1 values ('1'); select * from (select max(fld) from t1) as foo; drop table t1; +# +# BUG #10308: purge log with subselect +# + +purge master logs before (select adddate(current_timestamp(), interval -4 day)); diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test index 3b1d2f393c2..a07cc93ad68 100644 --- a/mysql-test/t/subselect_innodb.test +++ b/mysql-test/t/subselect_innodb.test @@ -161,3 +161,25 @@ deallocate prepare my_stmt; drop table t1,t2; # End of 4.1 tests + +CREATE TABLE t1 ( + school_name varchar(45) NOT NULL, + country varchar(45) NOT NULL, + funds_requested float NOT NULL, + schooltype varchar(45) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +insert into t1 values ("the school", "USA", 1200, "Human"); + +select count(country) as countrycount, sum(funds_requested) as smcnt, + country, (select sum(funds_requested) from t1) as total_funds +from t1 +group by country; + +select count(country) as countrycount, sum(funds_requested) as smcnt, + country, (select sum(funds_requested) from t1) as total_funds +from t1 +group by country; + +drop table t1; + diff --git a/mysql-test/t/type_binary.test b/mysql-test/t/type_binary.test new file mode 100644 index 00000000000..b5928cb14c4 --- /dev/null +++ b/mysql-test/t/type_binary.test @@ -0,0 +1,67 @@ +# check 0x00 padding +create table t1 (s1 binary(3)); +insert into t1 values (0x61), (0x6120), (0x612020); +select hex(s1) from t1; +drop table t1; + +# check that 0x00 is not stripped in val_str +create table t1 (s1 binary(2), s2 varbinary(2)); +insert into t1 values (0x4100,0x4100); +select length(concat('*',s1,'*',s2,'*')) from t1; +delete from t1; +insert into t1 values (0x4120,0x4120); +select length(concat('*',s1,'*',s2,'*')) from t1; +drop table t1; + +# check that trailing 0x00 and 0x20 do matter on comparison +create table t1 (s1 varbinary(20), s2 varbinary(20)); +show create table t1; +insert into t1 values (0x41,0x4100),(0x41,0x4120),(0x4100,0x4120); +select hex(s1), hex(s2) from t1; +select count(*) from t1 where s1 < s2; +drop table t1; + +# check that trailing 0x00 do matter on filesort +create table t1 (s1 varbinary(2), s2 varchar(1)); +insert into t1 values (0x41,'a'), (0x4100,'b'), (0x41,'c'), (0x4100,'d'); +select hex(s1),s2 from t1 order by s1,s2; +drop table t1; + +# check that 0x01 is padded to 0x0100 and thus we get a duplicate value +create table t1 (s1 binary(2) primary key); +insert into t1 values (0x01); +insert into t1 values (0x0120); +--error 1062 +insert into t1 values (0x0100); +select hex(s1) from t1 order by s1; +# check index search +select hex(s1) from t1 where s1=0x01; +select hex(s1) from t1 where s1=0x0120; +select hex(s1) from t1 where s1=0x0100; +select count(distinct s1) from t1; +alter table t1 drop primary key; +# check non-indexed search +select hex(s1) from t1 where s1=0x01; +select hex(s1) from t1 where s1=0x0120; +select hex(s1) from t1 where s1=0x0100; +select count(distinct s1) from t1; +drop table t1; + +# check that 0x01 is not padded, and all three values are unique +create table t1 (s1 varbinary(2) primary key); +insert into t1 values (0x01); +insert into t1 values (0x0120); +insert into t1 values (0x0100); +select hex(s1) from t1 order by s1; +# check index search +select hex(s1) from t1 where s1=0x01; +select hex(s1) from t1 where s1=0x0120; +select hex(s1) from t1 where s1=0x0100; +select count(distinct s1) from t1; +alter table t1 drop primary key; +# check non-indexed search +select hex(s1) from t1 where s1=0x01; +select hex(s1) from t1 where s1=0x0120; +select hex(s1) from t1 where s1=0x0100; +select count(distinct s1) from t1; +drop table t1; diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test index 1ec5c600296..503d7ffc0b9 100644 --- a/mysql-test/t/type_blob.test +++ b/mysql-test/t/type_blob.test @@ -67,9 +67,9 @@ select * from t1; drop table t1; # -# test of blob, text, char and char binary +# test of blob, text, char and varbinary # -create table t1 (t text,c char(10),b blob, d binary(10)); +create table t1 (t text,c char(10),b blob, d varbinary(10)); insert into t1 values (NULL,NULL,NULL,NULL); insert into t1 values ("","","",""); insert into t1 values ("hello","hello","hello","hello"); @@ -404,3 +404,22 @@ alter table t1 add primary key (a,b,c(255),d); alter table t1 add key (a,b,d,e); show create table t1; drop table t1; + +# +# Test that blob's and varbinary are sorted according to length +# + +CREATE table t1 (a blob); +insert into t1 values ('b'),('a\0'),('a'),('a '),('aa'),(NULL); +select hex(a) from t1 order by a; +select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0'); +alter table t1 modify a varbinary(5); +select hex(a) from t1 order by a; +select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0'); +alter table t1 modify a char(5); +select hex(a) from t1 order by a; +select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0'); +alter table t1 modify a binary(5); +select hex(a) from t1 order by a; +select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0'); +drop table t1; diff --git a/mysql-test/t/wait_timeout-master.opt b/mysql-test/t/wait_timeout-master.opt new file mode 100644 index 00000000000..0ad622e9677 --- /dev/null +++ b/mysql-test/t/wait_timeout-master.opt @@ -0,0 +1 @@ +--wait-timeout=2 diff --git a/mysql-test/t/wait_timeout.test b/mysql-test/t/wait_timeout.test new file mode 100644 index 00000000000..26f91569868 --- /dev/null +++ b/mysql-test/t/wait_timeout.test @@ -0,0 +1,11 @@ +# +# Bug #8731: wait_timeout does not work on Mac OS X +# +--disable_reconnect +select 1; +# wait_timeout is 2, so we should get disconnected now +--sleep 5 +--error 2006 +select 2; +--enable_reconnect +select 3; |