summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorHe Zhenxing <hezx@mysql.com>2008-09-06 08:51:17 +0800
committerHe Zhenxing <hezx@mysql.com>2008-09-06 08:51:17 +0800
commitb17458dcc14882dcb2565bcbb92115ed786fe7c1 (patch)
tree81eaef221aa476a0279c43f5e5c6df9c91924e44 /mysql-test/t
parentd0edf322306221f2e662a54a9feecc78378d6dfe (diff)
parentd70d171ceef259920d975fa2ddccaa6a41ba91fe (diff)
downloadmariadb-git-b17458dcc14882dcb2565bcbb92115ed786fe7c1.tar.gz
Merge 5.1 main -> 5.1-rpl
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/concurrent_innodb.test20
-rw-r--r--mysql-test/t/concurrent_innodb_safelog-master.opt1
-rw-r--r--mysql-test/t/concurrent_innodb_safelog.test23
-rw-r--r--mysql-test/t/concurrent_innodb_unsafelog-master.opt (renamed from mysql-test/t/concurrent_innodb-master.opt)1
-rw-r--r--mysql-test/t/concurrent_innodb_unsafelog.test23
-rw-r--r--mysql-test/t/csv.test20
-rw-r--r--mysql-test/t/func_regexp.test17
-rw-r--r--mysql-test/t/group_min_max.test19
-rw-r--r--mysql-test/t/innodb-autoinc.test133
-rw-r--r--mysql-test/t/innodb.test15
-rw-r--r--mysql-test/t/innodb_bug34300.test30
-rw-r--r--mysql-test/t/join.test2
-rw-r--r--mysql-test/t/lowercase_table3.test1
-rw-r--r--mysql-test/t/myisam.test15
-rw-r--r--mysql-test/t/mysqlbinlog_row.test446
-rw-r--r--mysql-test/t/mysqlbinlog_row_big.test130
-rw-r--r--mysql-test/t/mysqlbinlog_row_innodb.test24
-rw-r--r--mysql-test/t/mysqlbinlog_row_myisam.test23
-rw-r--r--mysql-test/t/mysqlbinlog_row_trans.test161
-rw-r--r--mysql-test/t/partition.test40
-rw-r--r--mysql-test/t/partition_symlink.test6
-rw-r--r--mysql-test/t/ps_ddl.test36
-rw-r--r--mysql-test/t/show_check.test20
-rw-r--r--mysql-test/t/sp.test24
-rw-r--r--mysql-test/t/subselect.test44
-rw-r--r--mysql-test/t/subselect3.test41
-rw-r--r--mysql-test/t/symlink.test7
-rw-r--r--mysql-test/t/type_bit.test19
-rw-r--r--mysql-test/t/type_newdecimal.test9
29 files changed, 1291 insertions, 59 deletions
diff --git a/mysql-test/t/concurrent_innodb.test b/mysql-test/t/concurrent_innodb.test
deleted file mode 100644
index 5e9258af8f1..00000000000
--- a/mysql-test/t/concurrent_innodb.test
+++ /dev/null
@@ -1,20 +0,0 @@
-# t/concurrent_innodb.test
-#
-# Concurrent InnoDB tests, mainly in UPDATE's
-# Bug#3300
-# Designed and tested by Sinisa Milivojevic, sinisa@mysql.com
-#
-# two non-interfering UPDATE's not changing result set
-#
-# Last update:
-# 2006-07-26 ML test refactored (MySQL 5.1)
-# main code t/innodb_concurrent.test -> include/concurrent.inc
-# new wrapper t/concurrent_innodb.test
-
-# test takes circa 5 minutes to run, so it's big
---source include/big_test.inc
-
---source include/have_innodb.inc
-let $engine_type= InnoDB;
-
---source include/concurrent.inc
diff --git a/mysql-test/t/concurrent_innodb_safelog-master.opt b/mysql-test/t/concurrent_innodb_safelog-master.opt
new file mode 100644
index 00000000000..462f8fbe828
--- /dev/null
+++ b/mysql-test/t/concurrent_innodb_safelog-master.opt
@@ -0,0 +1 @@
+--innodb_lock_wait_timeout=1
diff --git a/mysql-test/t/concurrent_innodb_safelog.test b/mysql-test/t/concurrent_innodb_safelog.test
new file mode 100644
index 00000000000..828df9ef717
--- /dev/null
+++ b/mysql-test/t/concurrent_innodb_safelog.test
@@ -0,0 +1,23 @@
+# t/concurrent_innodb_safelog.test
+#
+# Concurrent InnoDB tests
+#
+# Last update:
+# 2006-07-26 ML test refactored (MySQL 5.1)
+# main code t/innodb_concurrent.test -> include/concurrent.inc
+# new wrapper t/concurrent_innodb.test
+# 2008-06-03 KP test refactored; removed name locks, added comments.
+# renamed wrapper t/concurrent_innodb.test ->
+# t/concurrent_innodb_unsafelog.test
+# new wrapper t/concurrent_innodb_safelog.test
+#
+
+--source include/have_innodb.inc
+
+let $engine_type= InnoDB;
+
+SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+# innodb_locks_unsafe_for_binlog not set for this test
+
+--source include/concurrent.inc
+
diff --git a/mysql-test/t/concurrent_innodb-master.opt b/mysql-test/t/concurrent_innodb_unsafelog-master.opt
index f76bada5208..210212a40bc 100644
--- a/mysql-test/t/concurrent_innodb-master.opt
+++ b/mysql-test/t/concurrent_innodb_unsafelog-master.opt
@@ -1 +1,2 @@
--innodb_locks_unsafe_for_binlog
+--innodb_lock_wait_timeout=1
diff --git a/mysql-test/t/concurrent_innodb_unsafelog.test b/mysql-test/t/concurrent_innodb_unsafelog.test
new file mode 100644
index 00000000000..e2c03655e43
--- /dev/null
+++ b/mysql-test/t/concurrent_innodb_unsafelog.test
@@ -0,0 +1,23 @@
+# t/concurrent_innodb_unsafelog.test
+#
+# Concurrent InnoDB tests
+#
+# Last update:
+# 2006-07-26 ML test refactored (MySQL 5.1)
+# main code t/innodb_concurrent.test -> include/concurrent.inc
+# new wrapper t/concurrent_innodb.test
+# 2008-06-03 KP test refactored; removed name locks, added comments.
+# renamed wrapper t/concurrent_innodb.test ->
+# t/concurrent_innodb_unsafelog.test
+# new wrapper t/concurrent_innodb_safelog.test
+#
+
+--source include/have_innodb.inc
+
+let $engine_type= InnoDB;
+
+SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+# innodb_locks_unsafe_for_binlog is set fro this test.
+
+--source include/concurrent.inc
+
diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test
index d2a00979dc8..52b73af9fd7 100644
--- a/mysql-test/t/csv.test
+++ b/mysql-test/t/csv.test
@@ -1386,6 +1386,9 @@ UNLOCK TABLES;
# cleanup
DROP TABLE test_concurrent_insert;
+connection default;
+--disconnect con1
+--disconnect con2
#
# Test REPAIR/CHECK TABLE (5.1)
@@ -1785,4 +1788,21 @@ update t1 set c1="That" where c1="This";
select * from t1;
drop table t1;
+#
+# Bug#36638 mysqld crashes when open file limit is passed and general query log enabled
+#
+create table t1 (a int not null) engine=csv;
+lock tables t1 read;
+connect (con1,localhost,root,,);
+--connection con1
+--remove_file $MYSQLD_DATADIR/test/t1.CSV
+--replace_result $MYSQLD_DATADIR '' 13 2
+# EE_FILENOTFOUND 29
+--error 29
+select * from t1;
+connection default;
+unlock tables;
+drop table t1;
+--disconnect con1
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/func_regexp.test b/mysql-test/t/func_regexp.test
index 1b35fab9d54..f3677b8f5b0 100644
--- a/mysql-test/t/func_regexp.test
+++ b/mysql-test/t/func_regexp.test
@@ -65,3 +65,20 @@ drop table t1;
SELECT 1 REGEXP NULL;
--echo End of 5.0 tests
+
+
+#
+# Bug #37337: Function returns different results
+#
+CREATE TABLE t1(a INT, b CHAR(4));
+INSERT INTO t1 VALUES (1, '6.1'), (1, '7.0'), (1, '8.0');
+PREPARE stmt1 FROM "SELECT a FROM t1 WHERE a=1 AND '7.0' REGEXP b LIMIT 1";
+EXECUTE stmt1;
+EXECUTE stmt1;
+EXECUTE stmt1;
+EXECUTE stmt1;
+DEALLOCATE PREPARE stmt1;
+DROP TABLE t1;
+
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test
index 7ec7e58ee19..a7f4325b2d1 100644
--- a/mysql-test/t/group_min_max.test
+++ b/mysql-test/t/group_min_max.test
@@ -942,3 +942,22 @@ SELECT a, MIN(b), MAX(b), AVG(b) FROM t1 GROUP BY a ORDER BY a DESC;
SELECT a, MIN(b), MAX(b), AVG(b) FROM t1 GROUP BY a ORDER BY a DESC;
DROP TABLE t1;
+
+#
+# Bug#38195: Incorrect handling of aggregate functions when loose index scan is
+# used causes server crash.
+#
+create table t1 (a int, b int, primary key (a,b), key `index` (a,b)) engine=MyISAM;
+insert into t1 (a,b) values
+(0,0),(0,1),(0,2),(0,3),(0,4),(0,5),(0,6),
+ (0,7),(0,8),(0,9),(0,10),(0,11),(0,12),(0,13),
+(1,0),(1,1),(1,2),(1,3),(1,4),(1,5),(1,6),
+ (1,7),(1,8),(1,9),(1,10),(1,11),(1,12),(1,13),
+(2,0),(2,1),(2,2),(2,3),(2,4),(2,5),(2,6),
+ (2,7),(2,8),(2,9),(2,10),(2,11),(2,12),(2,13),
+(3,0),(3,1),(3,2),(3,3),(3,4),(3,5),(3,6),
+ (3,7),(3,8),(3,9),(3,10),(3,11),(3,12),(3,13);
+insert into t1 (a,b) select a, max(b)+1 from t1 where a = 0 group by a;
+select * from t1;
+explain extended select sql_buffer_result a, max(b)+1 from t1 where a = 0 group by a;
+drop table t1;
diff --git a/mysql-test/t/innodb-autoinc.test b/mysql-test/t/innodb-autoinc.test
new file mode 100644
index 00000000000..b51e8422fff
--- /dev/null
+++ b/mysql-test/t/innodb-autoinc.test
@@ -0,0 +1,133 @@
+-- source include/have_innodb.inc
+# embedded server ignores 'delayed', so skip this
+-- source include/not_embedded.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Bug #34335
+#
+CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (9223372036854775807, null);
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 (c2) VALUES ('innodb');
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+## Test AUTOINC overflow
+##
+
+# TINYINT
+CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (127, null);
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 (c2) VALUES ('innodb');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (255, null);
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 (c2) VALUES ('innodb');
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# SMALLINT
+#
+CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (32767, null);
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 (c2) VALUES ('innodb');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (65535, null);
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 (c2) VALUES ('innodb');
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# MEDIUMINT
+#
+CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (8388607, null);
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 (c2) VALUES ('innodb');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (16777215, null);
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 (c2) VALUES ('innodb');
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# INT
+#
+CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (2147483647, null);
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 (c2) VALUES ('innodb');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (4294967295, null);
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 (c2) VALUES ('innodb');
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# BIGINT
+#
+CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (9223372036854775807, null);
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 (c2) VALUES ('innodb');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (18446744073709551615, null);
+-- error ER_AUTOINC_READ_FAILED,1467
+INSERT INTO t1 (c2) VALUES ('innodb');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# Bug 37531
+# After truncate, auto_increment behaves incorrectly for InnoDB
+#
+CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
+SELECT c1 FROM t1;
+SHOW CREATE TABLE t1;
+TRUNCATE TABLE t1;
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
+SELECT c1 FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+#
+# Deleting all records should not reset the AUTOINC counter.
+#
+CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
+SELECT c1 FROM t1;
+SHOW CREATE TABLE t1;
+DELETE FROM t1;
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
+SELECT c1 FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 0070a35b164..e78daa5511f 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -2458,7 +2458,22 @@ SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2';
DROP TABLE t2;
DROP TABLE t1;
# End 34920 test
+# Bug #29507 TRUNCATE shows to many rows effected
+#
+CONNECTION default;
+CREATE TABLE t1 (c1 int default NULL,
+ c2 int default NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--enable_info
+TRUNCATE TABLE t1;
+INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
+TRUNCATE TABLE t1;
+
+--disable_info
+DROP TABLE t1;
+#
#######################################################################
# #
# Please, DO NOT TOUCH this file as well as the innodb.result file. #
diff --git a/mysql-test/t/innodb_bug34300.test b/mysql-test/t/innodb_bug34300.test
new file mode 100644
index 00000000000..4b4a3fdc8a3
--- /dev/null
+++ b/mysql-test/t/innodb_bug34300.test
@@ -0,0 +1,30 @@
+#
+# Bug#34300 Tinyblob & tinytext fields currupted after export/import and alter in 5.1
+# http://bugs.mysql.com/34300
+#
+
+-- source include/have_innodb.inc
+
+-- disable_query_log
+-- disable_result_log
+
+SET @@max_allowed_packet=16777216;
+
+DROP TABLE IF EXISTS bug34300;
+CREATE TABLE bug34300 (
+ f4 TINYTEXT,
+ f6 MEDIUMTEXT,
+ f8 TINYBLOB
+) ENGINE=InnoDB;
+
+INSERT INTO bug34300 VALUES ('xxx', repeat('a', 8459264), 'zzz');
+
+-- enable_result_log
+
+SELECT f4, f8 FROM bug34300;
+
+ALTER TABLE bug34300 ADD COLUMN (f10 INT);
+
+SELECT f4, f8 FROM bug34300;
+
+DROP TABLE bug34300;
diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test
index ed1b84bb5ec..09082cbd7a7 100644
--- a/mysql-test/t/join.test
+++ b/mysql-test/t/join.test
@@ -547,7 +547,7 @@ select * from v1a join v1b on t1.b = t2.b;
# Bug #17523 natural join and information_schema
#
# We mask out the Privileges column because it differs with embedded server
---replace_column 31 #
+--replace_column 31 # 10 #
select * from information_schema.statistics join information_schema.columns
using(table_name,column_name) where table_name='user';
diff --git a/mysql-test/t/lowercase_table3.test b/mysql-test/t/lowercase_table3.test
index 51385b4b178..d3c9ec5145e 100644
--- a/mysql-test/t/lowercase_table3.test
+++ b/mysql-test/t/lowercase_table3.test
@@ -6,6 +6,7 @@
--source include/have_innodb.inc
--source include/have_lowercase0.inc
+--source include/have_case_insensitive_file_system.inc
--source include/not_windows.inc
--disable_warnings
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index 2f3cdd044b3..6d7e03b1c28 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -1169,6 +1169,21 @@ SELECT * FROM t1;
DROP TABLE t1, t2;
+
+#
+# Bug#37310: 'on update CURRENT_TIMESTAMP' option crashes the table
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM CHECKSUM=1 ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 VALUES (0);
+UPDATE t1 SET a=1;
+SELECT a FROM t1;
+CHECK TABLE t1;
+INSERT INTO t1 VALUES (0), (5), (4), (2);
+UPDATE t1 SET a=2;
+SELECT a FROM t1;
+CHECK TABLE t1;
+DROP TABLE t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/mysqlbinlog_row.test b/mysql-test/t/mysqlbinlog_row.test
new file mode 100644
index 00000000000..9d94e1f55e7
--- /dev/null
+++ b/mysql-test/t/mysqlbinlog_row.test
@@ -0,0 +1,446 @@
+--source include/have_log_bin.inc
+--source include/have_binlog_format_row.inc
+--source include/have_ucs2.inc
+
+--echo #
+--echo # Preparatory cleanup.
+--echo #
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--echo #
+--echo # We need a fixed timestamp to avoid varying results.
+--echo #
+SET timestamp=1000000000;
+
+--echo #
+--echo # Delete all existing binary logs.
+--echo #
+RESET MASTER;
+
+
+CREATE TABLE t1 (c01 BIT);
+INSERT INTO t1 VALUES (0);
+INSERT INTO t1 VALUES (1);
+DROP TABLE t1;
+
+CREATE TABLE t1 (c01 BIT(7));
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (8);
+INSERT INTO t1 VALUES (16);
+INSERT INTO t1 VALUES (32);
+INSERT INTO t1 VALUES (64);
+INSERT INTO t1 VALUES (127);
+DELETE FROM t1 WHERE c01=127;
+UPDATE t1 SET c01=15 WHERE c01=16;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a BIT(20), b CHAR(2));
+INSERT INTO t1 VALUES (b'00010010010010001001', 'ab');
+DROP TABLE t1;
+
+CREATE TABLE t1 (c02 BIT(64));
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (128);
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111111111111111');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (c03 TINYINT);
+INSERT INTO t1 VALUES (1),(2),(3);
+INSERT INTO t1 VALUES (-128);
+UPDATE t1 SET c03=2 WHERE c03=1;
+DELETE FROM t1 WHERE c03=-128;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c04 TINYINT UNSIGNED);
+INSERT INTO t1 VALUES (128), (255);
+UPDATE t1 SET c04=2 WHERE c04=1;
+DELETE FROM t1 WHERE c04=255;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c06 BOOL);
+INSERT INTO t1 VALUES (TRUE);
+DELETE FROM t1 WHERE c06=TRUE;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c07 SMALLINT);
+INSERT INTO t1 VALUES (1234);
+DELETE FROM t1 WHERE c07=1234;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c08 SMALLINT UNSIGNED);
+INSERT INTO t1 VALUES (32768), (65535);
+UPDATE t1 SET c08=2 WHERE c08=32768;
+DELETE FROM t1 WHERE c08=65535;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c10 MEDIUMINT);
+INSERT INTO t1 VALUES (12345);
+DELETE FROM t1 WHERE c10=12345;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c11 MEDIUMINT UNSIGNED);
+INSERT INTO t1 VALUES (8388608), (16777215);
+UPDATE t1 SET c11=2 WHERE c11=8388608;
+DELETE FROM t1 WHERE c11=16777215;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c13 INT);
+INSERT INTO t1 VALUES (123456);
+DELETE FROM t1 WHERE c13=123456;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c14 INT UNSIGNED);
+INSERT INTO t1 VALUES (2147483648), (4294967295);
+UPDATE t1 SET c14=2 WHERE c14=2147483648;
+DELETE FROM t1 WHERE c14=4294967295;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c16 BIGINT);
+INSERT INTO t1 VALUES (1234567890);
+DELETE FROM t1 WHERE c16=1234567890;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c17 BIGINT UNSIGNED);
+INSERT INTO t1 VALUES (9223372036854775808), (18446744073709551615);
+UPDATE t1 SET c17=2 WHERE c17=9223372036854775808;
+DELETE FROM t1 WHERE c17=18446744073709551615;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c19 FLOAT);
+INSERT INTO t1 VALUES (123.2234);
+DELETE FROM t1 WHERE c19>123;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c22 DOUBLE);
+INSERT INTO t1 VALUES (123434.22344545);
+DELETE FROM t1 WHERE c22>123434;
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c25 DECIMAL(10,5));
+INSERT INTO t1 VALUES (124.45);
+INSERT INTO t1 VALUES (-543.21);
+DELETE FROM t1 WHERE c25=124.45;
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c28 DATE);
+INSERT INTO t1 VALUES ('2001-02-03');
+DELETE FROM t1 WHERE c28='2001-02-03';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c29 DATETIME);
+INSERT INTO t1 VALUES ('2001-02-03 10:20:30');
+DELETE FROM t1 WHERE c29='2001-02-03 10:20:30';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c30 TIMESTAMP);
+INSERT INTO t1 VALUES ('2001-02-03 10:20:30');
+DELETE FROM t1 WHERE c30='2001-02-03 10:20:30';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c31 TIME);
+INSERT INTO t1 VALUES ('11:22:33');
+DELETE FROM t1 WHERE c31='11:22:33';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c32 YEAR);
+INSERT INTO t1 VALUES ('2001');
+DELETE FROM t1 WHERE c32=2001;
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c33 CHAR);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c33='a';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c34 CHAR(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c34='';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c35 CHAR(1));
+INSERT INTO t1 VALUES ('b');
+DELETE FROM t1 WHERE c35='b';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c36 CHAR(255));
+INSERT INTO t1 VALUES (repeat('c',255));
+DELETE FROM t1 WHERE c36>'c';
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c37 NATIONAL CHAR);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c37='a';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c38 NATIONAL CHAR(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c38='';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c39 NATIONAL CHAR(1));
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c39='a';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c40 NATIONAL CHAR(255));
+INSERT INTO t1 VALUES (repeat('a', 255));
+INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255));
+DELETE FROM t1 WHERE c40>'a';
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c41 CHAR CHARACTER SET UCS2);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c41='a';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c42 CHAR(0) CHARACTER SET UCS2);
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c42='';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c43 CHAR(1) CHARACTER SET UCS2);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c43='a';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c44 CHAR(255) CHARACTER SET UCS2);
+INSERT INTO t1 VALUES (repeat('a', 255));
+INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255));
+DELETE FROM t1 WHERE c44>'a';
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c45 VARCHAR(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c45='';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c46 VARCHAR(1));
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c46='a';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c47 VARCHAR(255));
+INSERT INTO t1 VALUES (repeat('a',255));
+DELETE FROM t1 WHERE c47>'a';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c48 VARCHAR(261));
+INSERT INTO t1 VALUES (repeat('a',261));
+DELETE FROM t1 WHERE c48>'a';
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c49 NATIONAL VARCHAR(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c49='';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c50 NATIONAL VARCHAR(1));
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c50='a';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c51 NATIONAL VARCHAR(255));
+INSERT INTO t1 VALUES (repeat('a',255));
+INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255));
+DELETE FROM t1 WHERE c51>'a';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c52 NATIONAL VARCHAR(261));
+INSERT INTO t1 VALUES (repeat('a',261));
+INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 261));
+DELETE FROM t1 WHERE c52>'a';
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c53 VARCHAR(0) CHARACTER SET ucs2);
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c53='';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c54 VARCHAR(1) CHARACTER SET ucs2);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c54='a';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c55 VARCHAR(255) CHARACTER SET ucs2);
+INSERT INTO t1 VALUES (repeat('ab', 127));
+DELETE FROM t1 WHERE c55>'a';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c56 VARCHAR(261) CHARACTER SET ucs2);
+INSERT INTO t1 VALUES (repeat('ab', 130));
+DELETE FROM t1 WHERE c56>'a';
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c57 BINARY);
+INSERT INTO t1 VALUES (0x00);
+INSERT INTO t1 VALUES (0x02);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c57='a';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c58 BINARY(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c58='';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c59 BINARY(1));
+INSERT INTO t1 VALUES (0x00);
+INSERT INTO t1 VALUES (0x02);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c59='a';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c60 BINARY(255));
+INSERT INTO t1 VALUES (0x00);
+INSERT INTO t1 VALUES (0x02);
+INSERT INTO t1 VALUES (repeat('a\0',120));
+DELETE FROM t1 WHERE c60<0x02;
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c61 VARBINARY(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c61='';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c62 VARBINARY(1));
+INSERT INTO t1 VALUES (0x00);
+INSERT INTO t1 VALUES (0x02);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c62=0x02;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c63 VARBINARY(255));
+INSERT INTO t1 VALUES (0x00);
+INSERT INTO t1 VALUES (0x02);
+INSERT INTO t1 VALUES (repeat('a\0',120));
+DELETE FROM t1 WHERE c63=0x02;
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c65 TINYBLOB);
+INSERT INTO t1 VALUES ('tinyblob1');
+DELETE FROM t1 WHERE c65='tinyblob1';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c68 BLOB);
+INSERT INTO t1 VALUES ('blob1');
+DELETE FROM t1 WHERE c68='blob1';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c71 MEDIUMBLOB);
+INSERT INTO t1 VALUES ('mediumblob1');
+DELETE FROM t1 WHERE c71='mediumblob1';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c74 LONGBLOB);
+INSERT INTO t1 VALUES ('longblob1');
+DELETE FROM t1 WHERE c74='longblob1';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c66 TINYTEXT);
+INSERT INTO t1 VALUES ('tinytext1');
+DELETE FROM t1 WHERE c66='tinytext1';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c69 TEXT);
+INSERT INTO t1 VALUES ('text1');
+DELETE FROM t1 WHERE c69='text1';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c72 MEDIUMTEXT);
+INSERT INTO t1 VALUES ('mediumtext1');
+DELETE FROM t1 WHERE c72='mediumtext1';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c75 LONGTEXT);
+INSERT INTO t1 VALUES ('longtext1');
+DELETE FROM t1 WHERE c75='longtext1';
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c67 TINYTEXT CHARACTER SET UCS2);
+INSERT INTO t1 VALUES ('tinytext1');
+DELETE FROM t1 WHERE c67='tinytext1';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c70 TEXT CHARACTER SET UCS2);
+INSERT INTO t1 VALUES ('text1');
+DELETE FROM t1 WHERE c70='text1';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c73 MEDIUMTEXT CHARACTER SET UCS2);
+INSERT INTO t1 VALUES ('mediumtext1');
+DELETE FROM t1 WHERE c73='mediumtext1';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c76 LONGTEXT CHARACTER SET UCS2);
+INSERT INTO t1 VALUES ('longtext1');
+DELETE FROM t1 WHERE c76='longtext1';
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c77 ENUM('a','b','c'));
+INSERT INTO t1 VALUES ('b');
+DELETE FROM t1 WHERE c77='b';
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c78 SET('a','b','c','d','e','f'));
+INSERT INTO t1 VALUES ('a,b');
+INSERT INTO t1 VALUES ('a,c');
+INSERT INTO t1 VALUES ('b,c');
+INSERT INTO t1 VALUES ('a,b,c');
+INSERT INTO t1 VALUES ('a,b,c,d');
+INSERT INTO t1 VALUES ('a,b,c,d,e');
+INSERT INTO t1 VALUES ('a,b,c,d,e,f');
+DELETE FROM t1 WHERE c78='a,b';
+DROP TABLE t1;
+
+#
+# Check multi-table update
+#
+CREATE TABLE t1 (a int NOT NULL DEFAULT 0, b int NOT NULL DEFAULT 0);
+CREATE TABLE t2 (a int NOT NULL DEFAULT 0, b int NOT NULL DEFAULT 0);
+INSERT INTO t1 SET a=1;
+INSERT INTO t1 SET b=1;
+INSERT INTO t2 SET a=1;
+INSERT INTO t2 SET b=1;
+UPDATE t1, t2 SET t1.a=10, t2.a=20;
+DROP TABLE t1,t2;
+
+flush logs;
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/
+--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001
diff --git a/mysql-test/t/mysqlbinlog_row_big.test b/mysql-test/t/mysqlbinlog_row_big.test
new file mode 100644
index 00000000000..62c8c7df327
--- /dev/null
+++ b/mysql-test/t/mysqlbinlog_row_big.test
@@ -0,0 +1,130 @@
+# mysqlbinlog_big.test
+#
+# Show that mysqlbinlog can handle big rows.
+#
+
+#
+# The *huge* output of mysqlbinlog will be redirected to
+# $MYSQLTEST_VARDIR/$mysqlbinlog_output
+#
+--let $mysqlbinlog_output= tmp/mysqlbinlog_big_1.out
+
+#--source include/have_myisam.inc
+--let $engine_type= MyISAM
+
+#
+# This test case is insensitive to the binlog format
+# because we don't display the output of mysqlbinlog.
+#
+#--source include/have_binlog_format_row.inc
+
+--source include/have_log_bin.inc
+
+# This is a big test.
+--source include/big_test.inc
+
+--echo #
+--echo # Preparatory cleanup.
+--echo #
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--echo #
+--echo # We need a fixed timestamp to avoid varying results.
+--echo #
+SET timestamp=1000000000;
+
+--echo #
+--echo # We need big packets.
+--echo #
+SET @@session.max_allowed_packet= 1024*1024*1024;
+
+--echo #
+--echo # Delete all existing binary logs.
+--echo #
+RESET MASTER;
+
+--echo #
+--echo # Create a test table.
+--echo #
+eval CREATE TABLE t1 (
+ c1 LONGTEXT
+ ) ENGINE=$engine_type DEFAULT CHARSET latin1;
+
+--echo #
+--echo # Show how much rows are affected by each statement.
+--echo #
+--enable_info
+
+--echo #
+--echo # Insert a big row.
+--echo #
+#
+# 256MB
+#INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 16777216));
+#
+# 32MB
+INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 2097152));
+#
+# 4MB
+#INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 262144));
+#
+# 512KB
+#INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 32768));
+
+--echo #
+--echo # Show what we have in the table.
+--echo # Do not display the column value itself, just its length.
+--echo #
+query_vertical SELECT LENGTH(c1) FROM t1;
+
+--echo #
+--echo # Grow the row by updating.
+--echo #
+UPDATE t1 SET c1 = CONCAT(c1, c1);
+
+--echo #
+--echo # Show what we have in the table.
+--echo # Do not display the column value itself, just its length.
+--echo #
+query_vertical SELECT LENGTH(c1) FROM t1;
+
+--echo #
+--echo # Delete the row.
+--echo #
+DELETE FROM t1 WHERE c1 >= 'ManyMegaByteBlck';
+
+--echo #
+--echo # Hide how much rows are affected by each statement.
+--echo #
+--disable_info
+
+--echo #
+--echo # Flush all log buffers to the log file.
+--echo #
+FLUSH LOGS;
+
+--echo #
+--echo # Call mysqlbinlog to display the log file contents.
+--echo # NOTE: The output of mysqlbinlog is redirected to
+--echo # \$MYSQLTEST_VARDIR/$mysqlbinlog_output
+--echo # If you want to examine it, disable remove_file
+--echo # at the bottom of the test script.
+--echo #
+let $MYSQLD_DATADIR= `select @@datadir`;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/
+--exec $MYSQL_BINLOG -v -v $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/$mysqlbinlog_output
+
+--echo #
+--echo # Cleanup.
+--echo #
+DROP TABLE t1;
+
+--echo remove_file \$MYSQLTEST_VARDIR/$mysqlbinlog_output
+#
+# NOTE: If you want to see the *huge* mysqlbinlog output, disable next line:
+#
+--remove_file $MYSQLTEST_VARDIR/$mysqlbinlog_output
+
diff --git a/mysql-test/t/mysqlbinlog_row_innodb.test b/mysql-test/t/mysqlbinlog_row_innodb.test
new file mode 100644
index 00000000000..cef1a712f7d
--- /dev/null
+++ b/mysql-test/t/mysqlbinlog_row_innodb.test
@@ -0,0 +1,24 @@
+# mysqlbinlog_row_innodb.test
+#
+# Show that mysqlbinlog displays human readable comments to
+# row-based log events.
+#
+# Main module for the InnoDB storage engine.
+#
+# Calls include/mysqlbinlog_row.inc
+# See there for more informaton.
+#
+
+--source include/have_innodb.inc
+let $engine_type=InnoDB;
+
+#
+# The test case would also work with statement based or mixed mode logging.
+# But this would require different result files. To handle this with the
+# current test suite, new main test cases are required.
+#
+--source include/have_binlog_format_row.inc
+--source include/have_ucs2.inc
+
+--source include/mysqlbinlog_row_engine.inc
+
diff --git a/mysql-test/t/mysqlbinlog_row_myisam.test b/mysql-test/t/mysqlbinlog_row_myisam.test
new file mode 100644
index 00000000000..e7b0335812a
--- /dev/null
+++ b/mysql-test/t/mysqlbinlog_row_myisam.test
@@ -0,0 +1,23 @@
+# mysqlbinlog_row.test
+#
+# Show that mysqlbinlog displays human readable comments to
+# row-based log events.
+#
+# Main module for the MyISAM storage engine.
+#
+# Calls include/mysqlbinlog_row.inc
+# See there for more informaton.
+#
+
+#--source include/have_myisam.inc
+let $engine_type=MyISAM;
+
+#
+# The test case would also work with statement based or mixed mode logging.
+# But this would require different result files. To handle this with the
+# current test suite, new main test cases are required.
+#
+--source include/have_binlog_format_row.inc
+--source include/have_ucs2.inc
+
+--source include/mysqlbinlog_row_engine.inc
diff --git a/mysql-test/t/mysqlbinlog_row_trans.test b/mysql-test/t/mysqlbinlog_row_trans.test
new file mode 100644
index 00000000000..d84b1743783
--- /dev/null
+++ b/mysql-test/t/mysqlbinlog_row_trans.test
@@ -0,0 +1,161 @@
+# mysqlbinlog_trans.test
+#
+# Show that mysqlbinlog work correctly with transactions.
+#
+
+#--source include/have_myisam.inc
+--let $engine_type_nontrans= MyISAM
+--source include/have_innodb.inc
+--let $engine_type= InnoDB
+
+#
+# The test case would also work with statement based or mixed mode logging.
+# But this would require different result files. To handle this with the
+# current test suite, new main test cases are required.
+#
+--source include/have_binlog_format_row.inc
+
+--source include/have_log_bin.inc
+
+--echo #
+--echo # Preparatory cleanup.
+--echo #
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+--echo #
+--echo # We need a fixed timestamp to avoid varying results.
+--echo #
+SET timestamp=1000000000;
+
+--echo #
+--echo # Delete all existing binary logs.
+--echo #
+RESET MASTER;
+
+--echo #
+--echo # Create test tables.
+--echo #
+eval CREATE TABLE t1 (
+ c1 INT,
+ c2 VARCHAR(20)
+ ) ENGINE=$engine_type DEFAULT CHARSET latin1;
+eval CREATE TABLE t2 (
+ c1 INT,
+ c2 VARCHAR(20)
+ ) ENGINE=$engine_type_nontrans DEFAULT CHARSET latin1;
+
+--echo #
+--echo # Start transaction #1, transactional table only, commit.
+--echo #
+START TRANSACTION;
+
+--echo #
+--echo # Do some statements.
+--echo #
+INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
+UPDATE t1 SET c1 = c1 + 10;
+DELETE FROM t1 WHERE c1 = 12;
+
+--echo #
+--echo # Commit transaction.
+--echo #
+COMMIT;
+SELECT * FROM t1;
+TRUNCATE TABLE t1;
+
+--echo #
+--echo # Start transaction #2, transactional table only, rollback.
+--echo #
+START TRANSACTION;
+
+--echo #
+--echo # Do some statements.
+--echo #
+INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
+UPDATE t1 SET c1 = c1 + 10;
+DELETE FROM t1 WHERE c1 = 12;
+
+--echo #
+--echo # Rollback transaction.
+--echo #
+ROLLBACK;
+SELECT * FROM t1;
+TRUNCATE TABLE t1;
+
+--echo #
+--echo # Start transaction #3, both tables, commit.
+--echo #
+START TRANSACTION;
+
+--echo #
+--echo # Do some statements on the transactional table.
+--echo #
+INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
+UPDATE t1 SET c1 = c1 + 10;
+DELETE FROM t1 WHERE c1 = 12;
+
+--echo #
+--echo # Do some statements on the non-transactional table.
+--echo #
+INSERT INTO t2 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
+UPDATE t2 SET c1 = c1 + 10;
+DELETE FROM t2 WHERE c1 = 12;
+
+--echo #
+--echo # Commit transaction.
+--echo #
+COMMIT;
+SELECT * FROM t1;
+SELECT * FROM t2;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+
+--echo #
+--echo # Start transaction #4, both tables, rollback.
+--echo #
+START TRANSACTION;
+
+--echo #
+--echo # Do some statements on the transactional table.
+--echo #
+INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
+UPDATE t1 SET c1 = c1 + 10;
+DELETE FROM t1 WHERE c1 = 12;
+
+--echo #
+--echo # Do some statements on the non-transactional table.
+--echo #
+INSERT INTO t2 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
+UPDATE t2 SET c1 = c1 + 10;
+DELETE FROM t2 WHERE c1 = 12;
+
+--echo #
+--echo # Rollback transaction.
+--echo #
+ROLLBACK;
+SELECT * FROM t1;
+SELECT * FROM t2;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+
+--echo #
+--echo # Flush all log buffers to the log file.
+--echo #
+FLUSH LOGS;
+
+--echo #
+--echo # Call mysqlbinlog to display the log file contents.
+--echo #
+let $MYSQLD_DATADIR= `select @@datadir`;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/
+--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001
+
+--echo #
+--echo # Cleanup.
+--echo #
+DROP TABLE t1, t2;
+
+
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index 669da7ee993..5270eced05f 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -1333,11 +1333,9 @@ SHOW TABLE STATUS;
DELETE from t1 where a = 1;
--replace_column 9 0 12 NULL 13 NULL 14 NULL
SHOW TABLE STATUS;
-# restore this after WL#4176 is completed
--- error ER_CHECK_NOT_IMPLEMENTED
ALTER TABLE t1 OPTIMIZE PARTITION p0;
-#--replace_column 12 NULL 13 NULL 14 NULL
-#SHOW TABLE STATUS;
+--replace_column 12 NULL 13 NULL 14 NULL
+SHOW TABLE STATUS;
DROP TABLE t1;
#
@@ -1672,13 +1670,9 @@ PARTITION BY RANGE (a) (
ALTER TABLE t1 OPTIMIZE PARTITION p1 EXTENDED;
--error ER_PARSE_ERROR
ALTER TABLE t1 ANALYZE PARTITION p1 EXTENDED;
---error ER_CHECK_NOT_IMPLEMENTED
ALTER TABLE t1 ANALYZE PARTITION p1;
---error ER_CHECK_NOT_IMPLEMENTED
ALTER TABLE t1 CHECK PARTITION p1;
---error ER_CHECK_NOT_IMPLEMENTED
ALTER TABLE t1 REPAIR PARTITION p1;
---error ER_CHECK_NOT_IMPLEMENTED
ALTER TABLE t1 OPTIMIZE PARTITION p1;
DROP TABLE t1;
@@ -1767,4 +1761,34 @@ while ($n)
--enable_query_log
show create table t1;
drop table t1;
+
+#
+# Bug #38272 timestamps fields incorrectly defaulted on update accross partitions.
+#
+
+CREATE TABLE t1 (
+ `ID` bigint(20) NOT NULL AUTO_INCREMENT,
+ `createdDate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `number` int,
+ PRIMARY KEY (`ID`, number)
+)
+PARTITION BY RANGE (number) (
+ PARTITION p0 VALUES LESS THAN (6),
+ PARTITION p1 VALUES LESS THAN (11)
+);
+
+create table t2 (
+ `ID` bigint(20),
+ `createdDate` TIMESTAMP,
+ `number` int
+);
+
+INSERT INTO t1 SET number=1;
+insert into t2 select * from t1;
+SELECT SLEEP(1);
+UPDATE t1 SET number=6;
+select count(*) from t1, t2 where t1.createdDate = t2.createdDate;
+
+drop table t1, t2;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/partition_symlink.test b/mysql-test/t/partition_symlink.test
index e36e335c0dd..4147d2c6e89 100644
--- a/mysql-test/t/partition_symlink.test
+++ b/mysql-test/t/partition_symlink.test
@@ -154,7 +154,8 @@ set @@sql_mode=@org_mode;
#
# Bug 21350: Data Directory problems
#
--- error ER_WRONG_TABLE_NAME
+# Added ER_WRONG_TABLE_NAME and reported bug#39045
+-- error ER_WRONG_ARGUMENTS, ER_WRONG_TABLE_NAME
create table t1 (a int)
partition by key (a)
(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
@@ -163,7 +164,8 @@ partition by key (a)
# Insert a test that manages to create the first partition and fails with
# the second, ensure that we clean up afterwards in a proper manner.
#
---error ER_WRONG_TABLE_NAME
+# Added ER_WRONG_TABLE_NAME and reported bug#39045
+--error ER_WRONG_ARGUMENTS, ER_WRONG_TABLE_NAME
create table t1 (a int)
partition by key (a)
(partition p0,
diff --git a/mysql-test/t/ps_ddl.test b/mysql-test/t/ps_ddl.test
index 8899ca967ca..fee235cd36c 100644
--- a/mysql-test/t/ps_ddl.test
+++ b/mysql-test/t/ps_ddl.test
@@ -1363,44 +1363,34 @@ drop table if exists t_12093;
drop function if exists f_12093;
drop function if exists f_12093_unrelated;
drop procedure if exists p_12093;
+drop view if exists v_12093_unrelated;
--enable_warnings
create table t_12093 (a int);
-
create function f_12093() returns int return (select count(*) from t_12093);
-
create procedure p_12093(a int) select * from t_12093;
create function f_12093_unrelated() returns int return 2;
create procedure p_12093_unrelated() begin end;
-
-prepare stmt_sf from 'select f_12093();';
-prepare stmt_sp from 'call p_12093(f_12093())';
-
-execute stmt_sf;
-execute stmt_sp;
+create view v_12093_unrelated as select * from t_12093;
connect (con1,localhost,root,,);
-connection con1;
-
-drop function f_12093_unrelated;
-drop procedure p_12093_unrelated;
-
connection default;
---echo # XXX: used to be a bug
-execute stmt_sf;
---echo # XXX: used to be a bug
-execute stmt_sp;
+let $my_drop = drop function f_12093_unrelated;
+--source include/ps_ddl_1.inc
+#
+let $my_drop = drop procedure p_12093_unrelated;
+--source include/ps_ddl_1.inc
+#
+# A reprepare of stmt_sf and stmt_sp is necessary because there is no
+# information about views within the table definition cache.
+let $my_drop = drop view v_12093_unrelated;
+--source include/ps_ddl_1.inc
---echo # XXX: used to be a bug
-execute stmt_sf;
---echo # XXX: used to be a bug
-execute stmt_sp;
-call p_verify_reprepare_count(2);
+call p_verify_reprepare_count(6);
disconnect con1;
-
drop table t_12093;
drop function f_12093;
drop procedure p_12093;
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index bbe432012b0..116298a9c80 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -947,6 +947,26 @@ show status like 'slow_queries';
#
show variables like 'myisam_recover_options';
+#
+# Bug#37301 Length and Max_length differ with no obvious reason
+#
+CREATE TABLE t1 (
+ Codigo int(10) unsigned NOT NULL auto_increment,
+ Nombre varchar(255) default NULL,
+ Telefono varchar(255) default NULL,
+ Observaciones longtext,
+ Direccion varchar(255) default NULL,
+ Dni varchar(255) default NULL,
+ CP int(11) default NULL,
+ Provincia varchar(255) default NULL,
+ Poblacion varchar(255) default NULL,
+ PRIMARY KEY (Codigo)
+) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
+--enable_metadata
+show create table t1;
+--disable_metadata
+drop table t1;
+
--echo End of 5.0 tests
--disable_result_log
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 7f2bf5df421..d7ed5f82b6d 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -7999,6 +7999,30 @@ drop table t1;
###########################################################################
+#
+# Bug#38291 memory corruption and server crash with view/sp/function
+#
+
+create table t1(c1 INT);
+create function f1(p1 int) returns varchar(32)
+ return 'aaa';
+create view v1 as select f1(c1) as parent_control_name from t1;
+
+delimiter //;
+create procedure p1()
+begin
+ select parent_control_name as c1 from v1;
+end //
+delimiter ;//
+
+call p1();
+call p1();
+
+drop procedure p1;
+drop function f1;
+drop view v1;
+drop table t1;
+
--echo # ------------------------------------------------------------------
--echo # -- End of 5.0 tests
--echo # ------------------------------------------------------------------
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index a9a5ef6fdae..5d6ce11edcf 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -3312,4 +3312,48 @@ SELECT * FROM t1
WHERE EXISTS (SELECT DISTINCT a FROM t2 WHERE t1.a < t2.a ORDER BY b);
DROP TABLE t1,t2;
+#
+# Bug #37548: result value erronously reported being NULL in certain subqueries
+#
+
+CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY b (b));
+
+INSERT INTO t1 VALUES (1,NULL), (9,NULL);
+
+CREATE TABLE t2 (
+ a int,
+ b int,
+ c int,
+ d int,
+ PRIMARY KEY (a),
+ UNIQUE KEY b (b,c,d),
+ KEY b_2 (b),
+ KEY c (c),
+ KEY d (d)
+);
+
+INSERT INTO t2 VALUES
+ (43, 2, 11 ,30),
+ (44, 2, 12 ,30),
+ (45, 1, 1 ,10000),
+ (46, 1, 2 ,10000),
+ (556,1, 32 ,10000);
+
+CREATE TABLE t3 (
+ a int,
+ b int,
+ c int,
+ PRIMARY KEY (a),
+ UNIQUE KEY b (b,c),
+ KEY c (c),
+ KEY b_2 (b)
+);
+
+INSERT INTO t3 VALUES (1,1,1), (2,32,1);
+
+explain
+SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a;
+SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a;
+
+DROP TABLE t1,t2,t3;
--echo End of 5.1 tests.
diff --git a/mysql-test/t/subselect3.test b/mysql-test/t/subselect3.test
index d7bb1f7186a..ec13f8af705 100644
--- a/mysql-test/t/subselect3.test
+++ b/mysql-test/t/subselect3.test
@@ -1,5 +1,5 @@
--disable_warnings
-drop table if exists t0, t1, t2, t3, t4;
+drop table if exists t0, t1, t2, t3, t4, t5;
--enable_warnings
#
@@ -619,3 +619,42 @@ SELECT 1 FROM t1 WHERE t1.a NOT IN (SELECT 1 FROM t1, t2 WHERE 0);
DROP TABLE t1, t2;
--echo End of 5.0 tests
+
+#
+# BUG#36135 "void Diagnostics_area::set_eof_status(THD*): Assertion `!is_set()' failed."
+#
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table t1 (
+ a int(11) default null,
+ b int(11) default null,
+ key (a)
+);
+# produce numbers 0..999
+insert into t1 select A.a+10*(B.a+10*C.a),A.a+10*(B.a+10*C.a) from t0 A, t0 B, t0 C;
+
+create table t2 (a int(11) default null);
+insert into t2 values (0),(1);
+
+create table t3 (a int(11) default null);
+insert into t3 values (0),(1);
+
+create table t4 (a int(11) default null);
+insert into t4 values (0),(1);
+
+create table t5 (a int(11) default null);
+insert into t5 values (0),(1),(0),(1);
+
+# this must not fail assertion
+--error 1242
+select * from t2, t3
+where
+ t2.a < 10 and
+ t3.a+1 = 2 and
+ t3.a in (select t1.b from t1
+ where t1.a+1=t1.a+1 and
+ t1.a < (select t4.a+10
+ from t4, t5 limit 2));
+
+drop table t0, t1, t2, t3, t4, t5;
diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test
index d6a95974764..3001775f204 100644
--- a/mysql-test/t/symlink.test
+++ b/mysql-test/t/symlink.test
@@ -65,8 +65,6 @@ drop table t1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
SHOW CREATE TABLE t9;
---error 1103,1103
-create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="tmp";
# Check that we cannot link over a table from another database.
@@ -75,8 +73,9 @@ create database mysqltest;
--error 1,1
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";
---error 1103,1103
-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";
+# temporarily disabled as it returns different result in the embedded server
+# --error 1210, 1210
+# 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'
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
diff --git a/mysql-test/t/type_bit.test b/mysql-test/t/type_bit.test
index 44780fb9d01..5793846a0b2 100644
--- a/mysql-test/t/type_bit.test
+++ b/mysql-test/t/type_bit.test
@@ -333,6 +333,25 @@ SELECT 1 FROM t1 GROUP BY a;
DROP TABLE t1;
+#
+# Bug#37799 SELECT with a BIT column in WHERE clause returns unexpected result
+#
+
+CREATE TABLE t1 (b BIT NOT NULL, i2 INTEGER NOT NULL, s VARCHAR(255) NOT NULL);
+INSERT INTO t1 VALUES(0x01,100,''), (0x00,300,''), (0x01,200,''), (0x00,100,'');
+SELECT HEX(b), i2 FROM t1 WHERE (i2>=100 AND i2<201) AND b=TRUE;
+
+CREATE TABLE t2 (b1 BIT NOT NULL, b2 BIT NOT NULL, i2 INTEGER NOT NULL,
+ s VARCHAR(255) NOT NULL);
+INSERT INTO t2 VALUES (0x01,0x00,100,''), (0x00,0x01,300,''),
+ (0x01,0x00,200,''), (0x00,0x01,100,'');
+SELECT HEX(b1), i2 FROM t2 WHERE (i2>=100 AND i2<201) AND b1=TRUE;
+SELECT HEX(b2), i2 FROM t2 WHERE (i2>=100 AND i2<201) AND b2=FALSE;
+SELECT HEX(b1), HEX(b2), i2 FROM t2
+ WHERE (i2>=100 AND i2<201) AND b1=TRUE AND b2=FALSE;
+
+DROP TABLE t1, t2;
+
--echo End of 5.0 tests
#
diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test
index 4b052a3d1fb..4a6462a8e72 100644
--- a/mysql-test/t/type_newdecimal.test
+++ b/mysql-test/t/type_newdecimal.test
@@ -1226,6 +1226,15 @@ DESC t1;
SELECT f1 FROM t1;
DROP TABLE t1;
+#
+# Bug #36270: incorrect calculation result - works in 4.1 but not in 5.0 or 5.1
+#
+
+# show that if we need to truncate the scale of an operand, we pick the
+# right one (that is, we discard the least significant decimal places)
+select (1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
+ 1.01500000 * 1.01500000 * 0.99500000);
+
--echo End of 5.0 tests
#