summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <cmiller@zippy.(none)>2006-07-05 16:16:09 -0400
committerunknown <cmiller@zippy.(none)>2006-07-05 16:16:09 -0400
commit30de4903ae2b9cd03bd5f853715e7fc7b648c2c7 (patch)
treea0c67909c6e1a1b67caf4558144a68911d8dfb15 /mysql-test
parentf92fd7c98adad9542e7d8d29ee24db504980541f (diff)
parent2ef57b836248f945657c7bd0fe02fa7fe3660b54 (diff)
downloadmariadb-git-30de4903ae2b9cd03bd5f853715e7fc7b648c2c7.tar.gz
Merge zippy.(none):/home/cmiller/work/mysql/merge/mysql-5.1
into zippy.(none):/home/cmiller/work/mysql/merge/mysql-5.1-new-maint BUILD/compile-dist: Auto merged BitKeeper/deleted/.del-partition_innodb.result: Auto merged BitKeeper/deleted/.del-partition_innodb.test: Auto merged client/mysqltest.c: Auto merged mysql-test/r/create.result: Auto merged mysql-test/r/create_not_windows.result: Auto merged mysql-test/r/func_group.result: Auto merged mysql-test/r/innodb_mysql.result: Auto merged mysql-test/r/partition.result: Auto merged mysql-test/r/sp.result: Auto merged mysql-test/t/innodb_mysql.test: Auto merged mysql-test/t/partition.test: Auto merged mysql-test/t/ps_1general.test: Auto merged mysql-test/t/sp.test: Auto merged mysql-test/t/wait_timeout.test: Auto merged mysys/my_lib.c: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/unireg.cc: Auto merged mysql-test/extra/rpl_tests/rpl_log.test: manuakl merge mysql-test/lib/mtr_process.pl: manuakl merge mysql-test/mysql-test-run.pl: manuakl merge mysql-test/r/type_newdecimal.result: manuakl merge mysql-test/t/create.test: manuakl merge mysql-test/t/func_group.test: manuakl merge mysql-test/t/type_newdecimal.test: manuakl merge
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/extra/rpl_tests/rpl_ddl.test10
-rw-r--r--mysql-test/extra/rpl_tests/rpl_log.test21
-rw-r--r--mysql-test/extra/rpl_tests/rpl_truncate.test36
-rw-r--r--mysql-test/extra/rpl_tests/rpl_truncate_helper.test41
-rw-r--r--mysql-test/include/have_binlog_format_mixed_or_row.inc5
-rw-r--r--mysql-test/include/master-slave-reset.inc22
-rw-r--r--mysql-test/include/master-slave.inc24
-rw-r--r--mysql-test/lib/mtr_process.pl4
-rwxr-xr-xmysql-test/mysql-test-run.pl107
-rw-r--r--mysql-test/r/archive.result2
-rw-r--r--mysql-test/r/auto_increment.result22
-rw-r--r--mysql-test/r/binlog_row_blackhole.result16
-rw-r--r--mysql-test/r/binlog_row_mix_innodb_myisam.result35
-rw-r--r--mysql-test/r/binlog_stm_blackhole.result9
-rw-r--r--mysql-test/r/csv.result4
-rw-r--r--mysql-test/r/ctype_latin1.result14
-rw-r--r--mysql-test/r/ctype_ucs.result26
-rw-r--r--mysql-test/r/ctype_utf8.result169
-rw-r--r--mysql-test/r/delayed.result30
-rw-r--r--mysql-test/r/distinct.result51
-rw-r--r--mysql-test/r/events.result12
-rw-r--r--mysql-test/r/events_bugs.result23
-rw-r--r--mysql-test/r/events_grant.result78
-rw-r--r--mysql-test/r/events_logs_tests.result13
-rw-r--r--mysql-test/r/events_stress.result8
-rw-r--r--mysql-test/r/federated.result6
-rw-r--r--mysql-test/r/fulltext2.result8
-rw-r--r--mysql-test/r/fulltext_left_join.result17
-rw-r--r--mysql-test/r/func_concat.result14
-rw-r--r--mysql-test/r/func_group.result35
-rw-r--r--mysql-test/r/func_str.result15
-rw-r--r--mysql-test/r/func_time.result64
-rw-r--r--mysql-test/r/func_timestamp.result2
-rw-r--r--mysql-test/r/grant_cache.result16
-rw-r--r--mysql-test/r/im_daemon_life_cycle.result1
-rw-r--r--mysql-test/r/im_instance_conf.result83
-rw-r--r--mysql-test/r/im_life_cycle.result34
-rw-r--r--mysql-test/r/im_options.result7
-rw-r--r--mysql-test/r/im_utils.result3
-rw-r--r--mysql-test/r/information_schema.result65
-rw-r--r--mysql-test/r/information_schema_part.result4
-rw-r--r--mysql-test/r/innodb.result42
-rw-r--r--mysql-test/r/innodb_mysql.result6
-rw-r--r--mysql-test/r/insert.result32
-rw-r--r--mysql-test/r/insert_select.result9
-rw-r--r--mysql-test/r/join.result24
-rw-r--r--mysql-test/r/key.result18
-rw-r--r--mysql-test/r/lock_multi.result22
-rw-r--r--mysql-test/r/log_state.result155
-rw-r--r--mysql-test/r/lowercase_table2.result9
-rw-r--r--mysql-test/r/merge.result6
-rw-r--r--mysql-test/r/multi_update.result5
-rw-r--r--mysql-test/r/myisam.result21
-rw-r--r--mysql-test/r/mysqldump.result100
-rw-r--r--mysql-test/r/ndb_alter_table.result7
-rw-r--r--mysql-test/r/ndb_binlog_ignore_db.result2
-rw-r--r--mysql-test/r/ndb_binlog_multi.result6
-rw-r--r--mysql-test/r/ndb_blob_partition.result104
-rw-r--r--mysql-test/r/ndb_condition_pushdown.result24
-rw-r--r--mysql-test/r/ndb_dd_backuprestore.result323
-rw-r--r--mysql-test/r/ndb_dd_ddl.result76
-rw-r--r--mysql-test/r/ndb_dd_dump.result2
-rw-r--r--mysql-test/r/ndb_loaddatalocal.result46
-rw-r--r--mysql-test/r/ndb_partition_error.result47
-rw-r--r--mysql-test/r/ndb_partition_key.result199
-rw-r--r--mysql-test/r/ndb_partition_list.result51
-rw-r--r--mysql-test/r/ndb_partition_range.result263
-rw-r--r--mysql-test/r/ndb_replace.result23
-rw-r--r--mysql-test/r/ndb_restore_partition.result469
-rw-r--r--mysql-test/r/partition.result142
-rw-r--r--mysql-test/r/partition_02myisam.result58
-rw-r--r--mysql-test/r/partition_error.result67
-rw-r--r--mysql-test/r/partition_list.result10
-rw-r--r--mysql-test/r/partition_mgm.result14
-rw-r--r--mysql-test/r/partition_mgm_err.result2
-rw-r--r--mysql-test/r/partition_pruning.result2
-rw-r--r--mysql-test/r/partition_range.result35
-rw-r--r--mysql-test/r/query_cache.result1
-rw-r--r--mysql-test/r/range.result2
-rw-r--r--mysql-test/r/renamedb.result4
-rw-r--r--mysql-test/r/replace.result6
-rw-r--r--mysql-test/r/rpl_auto_increment_11932.result47
-rw-r--r--mysql-test/r/rpl_ddl.result2
-rw-r--r--mysql-test/r/rpl_ndb_charset.result10
-rw-r--r--mysql-test/r/rpl_ndb_dd_partitions.result726
-rw-r--r--mysql-test/r/rpl_ndb_log.result16
-rw-r--r--mysql-test/r/rpl_row_basic_11bugs.result16
-rw-r--r--mysql-test/r/rpl_row_basic_8partition.result36
-rw-r--r--mysql-test/r/rpl_row_charset.result10
-rw-r--r--mysql-test/r/rpl_row_create_table.result22
-rw-r--r--mysql-test/r/rpl_row_inexist_tbl.result17
-rw-r--r--mysql-test/r/rpl_row_log.result16
-rw-r--r--mysql-test/r/rpl_row_log_innodb.result16
-rw-r--r--mysql-test/r/rpl_sp_effects.result6
-rw-r--r--mysql-test/r/rpl_stm_log.result17
-rw-r--r--mysql-test/r/rpl_truncate_2myisam.result202
-rw-r--r--mysql-test/r/rpl_truncate_3innodb.result214
-rw-r--r--mysql-test/r/rpl_truncate_7ndb.result91
-rw-r--r--mysql-test/r/rpl_truncate_7ndb_2.result91
-rw-r--r--mysql-test/r/select.result139
-rw-r--r--mysql-test/r/show_check.result32
-rw-r--r--mysql-test/r/sp-error.result6
-rw-r--r--mysql-test/r/sp-prelocking.result18
-rw-r--r--mysql-test/r/sp.result129
-rw-r--r--mysql-test/r/sql_mode.result4
-rw-r--r--mysql-test/r/status.result50
-rw-r--r--mysql-test/r/sysdate_is_now.result2
-rw-r--r--mysql-test/r/temp_table.result2
-rw-r--r--mysql-test/r/timezone2.result10
-rw-r--r--mysql-test/r/trigger-grant.result4
-rw-r--r--mysql-test/r/trigger.result32
-rw-r--r--mysql-test/r/type_datetime.result2
-rw-r--r--mysql-test/r/type_newdecimal.result10
-rw-r--r--mysql-test/r/type_ranges.result2
-rw-r--r--mysql-test/r/type_timestamp.result10
-rw-r--r--mysql-test/r/udf.result18
-rw-r--r--mysql-test/r/union.result53
-rw-r--r--mysql-test/r/view.result10
-rw-r--r--mysql-test/r/view_grant.result41
-rw-r--r--mysql-test/r/xml.result32
-rw-r--r--mysql-test/t/archive.test3
-rw-r--r--mysql-test/t/auto_increment.test17
-rw-r--r--mysql-test/t/bdb.test1
-rw-r--r--mysql-test/t/ctype_latin1.test11
-rw-r--r--mysql-test/t/ctype_ucs.test26
-rw-r--r--mysql-test/t/ctype_utf8.test114
-rw-r--r--mysql-test/t/delayed.test49
-rw-r--r--mysql-test/t/disabled.def9
-rw-r--r--mysql-test/t/distinct.test28
-rw-r--r--mysql-test/t/events.test9
-rw-r--r--mysql-test/t/events_bugs.test37
-rw-r--r--mysql-test/t/events_grant.test21
-rw-r--r--mysql-test/t/events_logs_tests.test16
-rw-r--r--mysql-test/t/events_microsec.test6
-rw-r--r--mysql-test/t/events_scheduling.test3
-rw-r--r--mysql-test/t/events_stress.test26
-rw-r--r--mysql-test/t/federated.test6
-rw-r--r--mysql-test/t/fulltext2.test10
-rw-r--r--mysql-test/t/fulltext_left_join.test15
-rw-r--r--mysql-test/t/func_concat.test15
-rw-r--r--mysql-test/t/func_group.test28
-rw-r--r--mysql-test/t/func_str.test12
-rw-r--r--mysql-test/t/func_time.test37
-rw-r--r--mysql-test/t/func_timestamp.test6
-rw-r--r--mysql-test/t/im_cmd_line.imtest4
-rw-r--r--mysql-test/t/im_daemon_life_cycle.imtest17
-rw-r--r--mysql-test/t/im_instance_conf.imtest49
-rw-r--r--mysql-test/t/im_life_cycle.imtest55
-rw-r--r--mysql-test/t/im_options.imtest10
-rw-r--r--mysql-test/t/im_utils.imtest16
-rw-r--r--mysql-test/t/information_schema.test85
-rw-r--r--mysql-test/t/innodb.test13
-rw-r--r--mysql-test/t/innodb_mysql.test8
-rw-r--r--mysql-test/t/insert.test33
-rw-r--r--mysql-test/t/insert_select.test22
-rw-r--r--mysql-test/t/join.test26
-rw-r--r--mysql-test/t/key.test12
-rwxr-xr-xmysql-test/t/kill_n_check.sh109
-rw-r--r--mysql-test/t/lock_multi.test58
-rw-r--r--mysql-test/t/log_state-master.opt1
-rw-r--r--mysql-test/t/log_state.test122
-rw-r--r--mysql-test/t/lowercase_table2.test11
-rw-r--r--mysql-test/t/merge.test9
-rw-r--r--mysql-test/t/multi_update.test8
-rw-r--r--mysql-test/t/myisam.test22
-rw-r--r--mysql-test/t/mysqldump.test51
-rw-r--r--mysql-test/t/ndb_alter_table.test13
-rw-r--r--mysql-test/t/ndb_binlog_multi.test11
-rw-r--r--mysql-test/t/ndb_blob_partition.test93
-rw-r--r--mysql-test/t/ndb_condition_pushdown.test22
-rw-r--r--mysql-test/t/ndb_dd_backuprestore.test170
-rw-r--r--mysql-test/t/ndb_dd_ddl.test97
-rw-r--r--mysql-test/t/ndb_loaddatalocal.test70
-rw-r--r--mysql-test/t/ndb_partition_error.test71
-rw-r--r--mysql-test/t/ndb_partition_key.test198
-rw-r--r--mysql-test/t/ndb_partition_list.test64
-rw-r--r--mysql-test/t/ndb_partition_range.test260
-rw-r--r--mysql-test/t/ndb_replace.test30
-rw-r--r--mysql-test/t/ndb_restore_partition-master.opt1
-rw-r--r--mysql-test/t/ndb_restore_partition.test375
-rw-r--r--mysql-test/t/partition.test115
-rw-r--r--mysql-test/t/partition_error.test38
-rw-r--r--mysql-test/t/partition_list.test12
-rw-r--r--mysql-test/t/partition_mgm.test7
-rw-r--r--mysql-test/t/partition_range.test25
-rw-r--r--mysql-test/t/ps_1general.test3
-rw-r--r--mysql-test/t/query_cache.test3
-rw-r--r--mysql-test/t/range.test2
-rw-r--r--mysql-test/t/renamedb.test8
-rw-r--r--mysql-test/t/replace.test10
-rw-r--r--mysql-test/t/rpl_auto_increment_11932.test63
-rw-r--r--mysql-test/t/rpl_ndb_auto_inc.test3
-rw-r--r--mysql-test/t/rpl_ndb_dd_partitions.test310
-rw-r--r--mysql-test/t/rpl_openssl.test4
-rw-r--r--mysql-test/t/rpl_rbr_to_sbr.test1
-rw-r--r--mysql-test/t/rpl_row_basic_11bugs.test18
-rw-r--r--mysql-test/t/rpl_row_basic_8partition.test1
-rw-r--r--mysql-test/t/rpl_row_create_table.test8
-rw-r--r--mysql-test/t/rpl_row_inexist_tbl-slave.opt1
-rw-r--r--mysql-test/t/rpl_row_inexist_tbl.test14
-rw-r--r--mysql-test/t/rpl_sp_effects.test4
-rw-r--r--mysql-test/t/rpl_truncate_2myisam.test4
-rw-r--r--mysql-test/t/rpl_truncate_3innodb.test5
-rw-r--r--mysql-test/t/rpl_truncate_7ndb.test69
-rw-r--r--mysql-test/t/rpl_truncate_7ndb_2-master.opt1
-rw-r--r--mysql-test/t/rpl_truncate_7ndb_2.test6
-rw-r--r--mysql-test/t/select.test146
-rw-r--r--mysql-test/t/show_check.test19
-rw-r--r--mysql-test/t/sp-error.test6
-rw-r--r--mysql-test/t/sp-prelocking.test31
-rw-r--r--mysql-test/t/sp.test114
-rw-r--r--mysql-test/t/sql_mode.test3
-rw-r--r--mysql-test/t/status.test34
-rw-r--r--mysql-test/t/timezone2.test10
-rw-r--r--mysql-test/t/trigger-grant.test4
-rw-r--r--mysql-test/t/trigger.test40
-rw-r--r--mysql-test/t/type_datetime.test2
-rw-r--r--mysql-test/t/type_newdecimal.test8
-rw-r--r--mysql-test/t/type_ranges.test2
-rw-r--r--mysql-test/t/type_timestamp.test14
-rw-r--r--mysql-test/t/udf.test12
-rw-r--r--mysql-test/t/union.test48
-rw-r--r--mysql-test/t/view.test10
-rw-r--r--mysql-test/t/view_grant.test59
-rwxr-xr-xmysql-test/t/wait_for_process.sh66
-rw-r--r--mysql-test/t/wait_timeout.test1
-rw-r--r--mysql-test/t/xml.test13
-rw-r--r--mysql-test/valgrind.supp35
228 files changed, 8860 insertions, 1024 deletions
diff --git a/mysql-test/extra/rpl_tests/rpl_ddl.test b/mysql-test/extra/rpl_tests/rpl_ddl.test
index 4aab45db18b..15794e5e035 100644
--- a/mysql-test/extra/rpl_tests/rpl_ddl.test
+++ b/mysql-test/extra/rpl_tests/rpl_ddl.test
@@ -228,15 +228,11 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SELECT * FROM mysqltest1.t7;
-connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
+--echo -------- switch to slave --------
+sync_slave_with_master;
SELECT * FROM mysqltest1.t7;
+--echo -------- switch to master -------
connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
###############################################################
# Cases with LOCK/UNLOCK
diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test
index 74bde7b48c1..cc3a9b4ffb5 100644
--- a/mysql-test/extra/rpl_tests/rpl_log.test
+++ b/mysql-test/extra/rpl_tests/rpl_log.test
@@ -126,7 +126,26 @@ show slave status;
show binlog events in 'slave-bin.000005' from 4;
# The table drops caused Cluster Replication wrapper to fail as event ID would never be the same.# Moving drops here.
-connection master;
+
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
+
+#
+# Bug #6880: LAST_INSERT_ID() within a statement
+#
+
+create table t1(a int auto_increment primary key, b int);
+insert into t1 values (NULL, 1);
+reset master;
+set insert_id=5;
+insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
+--replace_result $VERSION VERSION
+--replace_column 2 # 5 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
+show binlog events;
+select * from t1;
+drop table t1;
+
+# End of 4.1 tests
+
diff --git a/mysql-test/extra/rpl_tests/rpl_truncate.test b/mysql-test/extra/rpl_tests/rpl_truncate.test
new file mode 100644
index 00000000000..37fd9fbc064
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_truncate.test
@@ -0,0 +1,36 @@
+#
+# Copyright 2006 MySQL. All rights reserved.
+#
+# Test to check for the different version of truncating a table.
+# The statements are "TRUNCATE tbl" and "DELETE FROM tbl". We check
+# the behaviour of each possible value for BINLOG_FORMAT.
+#
+# Author(s): Mats Kindahl
+
+--source include/have_row_based.inc
+--source include/master-slave.inc
+
+let $format = STATEMENT;
+let $stmt = TRUNCATE TABLE;
+--source extra/rpl_tests/rpl_truncate_helper.test
+
+let $format = MIXED;
+let $stmt = TRUNCATE TABLE;
+--source extra/rpl_tests/rpl_truncate_helper.test
+
+let $format = ROW;
+let $stmt = TRUNCATE TABLE;
+--source extra/rpl_tests/rpl_truncate_helper.test
+
+let $format = STATEMENT;
+let $stmt = DELETE FROM;
+--source extra/rpl_tests/rpl_truncate_helper.test
+
+let $format = MIXED;
+let $stmt = DELETE FROM;
+--source extra/rpl_tests/rpl_truncate_helper.test
+
+let $format = ROW;
+let $stmt = DELETE FROM;
+--source extra/rpl_tests/rpl_truncate_helper.test
+
diff --git a/mysql-test/extra/rpl_tests/rpl_truncate_helper.test b/mysql-test/extra/rpl_tests/rpl_truncate_helper.test
new file mode 100644
index 00000000000..1e485baca36
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_truncate_helper.test
@@ -0,0 +1,41 @@
+
+--disable_query_log
+--disable_warnings
+connection slave;
+STOP SLAVE;
+connection master;
+DROP TABLE IF EXISTS t1;
+RESET MASTER;
+connection slave;
+DROP TABLE IF EXISTS t1;
+RESET SLAVE;
+START SLAVE;
+--enable_warnings
+--enable_query_log
+
+--echo **** On Master ****
+connection master;
+eval SET SESSION BINLOG_FORMAT=$format;
+eval SET GLOBAL BINLOG_FORMAT=$format;
+
+eval CREATE TABLE t1 (a INT, b LONG) ENGINE=$engine;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+--echo **** On Slave ****
+sync_slave_with_master;
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+--echo **** On Master ****
+connection master;
+eval $stmt t1;
+SELECT * FROM t1;
+--echo **** On Slave ****
+sync_slave_with_master;
+# Should be empty
+SELECT * FROM t1;
+--echo **** On Master ****
+connection master;
+DROP TABLE t1;
+--replace_result $SERVER_VERSION SERVER_VERSION
+--replace_regex /\/\* xid=[0-9]+ \*\//\/* xid= *\// /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS;
diff --git a/mysql-test/include/have_binlog_format_mixed_or_row.inc b/mysql-test/include/have_binlog_format_mixed_or_row.inc
new file mode 100644
index 00000000000..c38b8f3d601
--- /dev/null
+++ b/mysql-test/include/have_binlog_format_mixed_or_row.inc
@@ -0,0 +1,5 @@
+--require r/have_binlog_format_row.require
+--disable_query_log
+--replace_result MIXED ROW
+show variables like "binlog_format";
+--enable_query_log
diff --git a/mysql-test/include/master-slave-reset.inc b/mysql-test/include/master-slave-reset.inc
new file mode 100644
index 00000000000..204c6c5f5f6
--- /dev/null
+++ b/mysql-test/include/master-slave-reset.inc
@@ -0,0 +1,22 @@
+connection slave;
+#we expect STOP SLAVE to produce a warning as the slave is stopped
+#(the server was started with skip-slave-start)
+--disable_warnings
+stop slave;
+--wait_for_slave_to_stop
+--enable_warnings
+connection master;
+--disable_warnings
+--disable_query_log
+use test;
+--enable_query_log
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+--enable_warnings
+reset master;
+connection slave;
+reset slave;
+# Clean up old test tables
+--disable_warnings
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+--enable_warnings
+start slave;
diff --git a/mysql-test/include/master-slave.inc b/mysql-test/include/master-slave.inc
index ea09f4e842b..fe1dacb433e 100644
--- a/mysql-test/include/master-slave.inc
+++ b/mysql-test/include/master-slave.inc
@@ -2,28 +2,8 @@ connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,);
-connection slave;
-#we expect STOP SLAVE to produce a warning as the slave is stopped
-#(the server was started with skip-slave-start)
---disable_warnings
-stop slave;
---enable_warnings
---require r/slave-stopped.result
-show status like 'Slave_running';
-connection master;
---disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
---enable_warnings
-reset master;
-connection slave;
-reset slave;
-# Clean up old test tables
---disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
---enable_warnings
-start slave;
---require r/slave-running.result
-show status like 'Slave_running';
+
+-- source include/master-slave-reset.inc
# Set the default connection to 'master'
connection master;
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index 79be0cf3561..143bb40c3d1 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -951,8 +951,10 @@ sub mtr_kill_process ($$$) {
my $timeout= shift; # Seconds to wait for process
my $max_loop= $timeout*10; # Sleeping 0.1 between each kill attempt
- while (1)
+ for (my $cur_attempt= 1; $cur_attempt <= $total_retries; ++$cur_attempt)
{
+ mtr_debug("Sending $signal to $pid...");
+
kill($signal, $pid);
last unless kill (0, $pid) and $max_loop--;
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 1135cc5e8c0..9192ea20529 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -286,7 +286,7 @@ our $opt_user_test;
our $opt_valgrind= 0;
our $opt_valgrind_mysqld= 0;
our $opt_valgrind_mysqltest= 0;
-our $opt_valgrind_all= 0;
+our $default_valgrind_options= "-v --show-reachable=yes";
our $opt_valgrind_options;
our $opt_valgrind_path;
@@ -624,10 +624,9 @@ sub command_line_setup () {
# Coverage, profiling etc
'gcov' => \$opt_gcov,
'gprof' => \$opt_gprof,
- 'valgrind' => \$opt_valgrind,
+ 'valgrind|valgrind-all' => \$opt_valgrind,
'valgrind-mysqltest' => \$opt_valgrind_mysqltest,
'valgrind-mysqld' => \$opt_valgrind_mysqld,
- 'valgrind-all' => \$opt_valgrind_all,
'valgrind-options=s' => \$opt_valgrind_options,
'valgrind-path=s' => \$opt_valgrind_path,
@@ -848,20 +847,32 @@ sub command_line_setup () {
}
}
- # Turn on valgrinding of all executables if "valgrind" or "valgrind-all"
- if ( $opt_valgrind or $opt_valgrind_all )
+ # Check valgrind arguments
+ if ( $opt_valgrind or $opt_valgrind_path or defined $opt_valgrind_options)
{
mtr_report("Turning on valgrind for all executables");
$opt_valgrind= 1;
$opt_valgrind_mysqld= 1;
$opt_valgrind_mysqltest= 1;
}
- elsif ( $opt_valgrind_mysqld or $opt_valgrind_mysqltest )
+ elsif ( $opt_valgrind_mysqld )
{
- # If test's are run for a specific executable, turn on
- # verbose and show-reachable
+ mtr_report("Turning on valgrind for mysqld(s) only");
+ $opt_valgrind= 1;
+ }
+ elsif ( $opt_valgrind_mysqltest )
+ {
+ mtr_report("Turning on valgrind for mysqltest only");
$opt_valgrind= 1;
- $opt_valgrind_all= 1;
+ }
+
+ if ( $opt_valgrind )
+ {
+ # Set valgrind_options to default unless already defined
+ $opt_valgrind_options=$default_valgrind_options
+ unless defined $opt_valgrind_options;
+
+ mtr_report("Running valgrind with options \"$opt_valgrind_options\"");
}
if ( ! $opt_testcase_timeout )
@@ -1129,7 +1140,9 @@ sub executable_setup () {
# New CMake locations.
"$glob_basedir/client/release",
"$glob_basedir/client/debug");
- $exe_mysqld= mtr_exe_exists ("$path_client_bindir/mysqld-nt",
+ $exe_mysqld= mtr_exe_exists ("$path_client_bindir/mysqld-max-nt",
+ "$path_client_bindir/mysqld-max",
+ "$path_client_bindir/mysqld-nt",
"$path_client_bindir/mysqld",
"$path_client_bindir/mysqld-debug",
"$path_client_bindir/mysqld-max",
@@ -3440,22 +3453,58 @@ sub im_stop($) {
# Try graceful shutdown.
+ mtr_debug("IM-main pid: $instance_manager->{'pid'}");
+ mtr_debug("Stopping IM-main...");
+
mtr_kill_process($instance_manager->{'pid'}, 'TERM', 10);
+ # If necessary, wait for angel process to die.
+
+ if (defined $instance_manager->{'angel_pid'})
+ {
+ mtr_debug("IM-angel pid: $instance_manager->{'angel_pid'}");
+ mtr_debug("Waiting for IM-angel to die...");
+
+ my $total_attempts= 10;
+
+ for (my $cur_attempt=1; $cur_attempt <= $total_attempts; ++$cur_attempt)
+ {
+ unless (kill (0, $instance_manager->{'angel_pid'}))
+ {
+ mtr_debug("IM-angel died.");
+ last;
+ }
+
+ sleep(1);
+ }
+ }
+
# Check that all processes died.
my $clean_shutdown= 0;
while (1)
{
- last if kill (0, $instance_manager->{'pid'});
+ if (kill (0, $instance_manager->{'pid'}))
+ {
+ mtr_debug("IM-main is still alive.");
+ last;
+ }
- last if (defined $instance_manager->{'angel_pid'}) &&
- kill (0, $instance_manager->{'angel_pid'});
+ if (defined $instance_manager->{'angel_pid'} &&
+ kill (0, $instance_manager->{'angel_pid'}))
+ {
+ mtr_debug("IM-angel is still alive.");
+ last;
+ }
foreach my $pid (@mysqld_pids)
{
- last if kill (0, $pid);
+ if (kill (0, $pid))
+ {
+ mtr_debug("Guarded mysqld ($pid) is still alive.");
+ last;
+ }
}
$clean_shutdown= 1;
@@ -3466,15 +3515,21 @@ sub im_stop($) {
unless ($clean_shutdown)
{
- mtr_kill_process($instance_manager->{'angel_pid'}, 'KILL', 10)
- if defined $instance_manager->{'angel_pid'};
+
+ if (defined $instance_manager->{'angel_pid'})
+ {
+ mtr_debug("Killing IM-angel...");
+ mtr_kill_process($instance_manager->{'angel_pid'}, 'KILL', 10)
+ }
+ mtr_debug("Killing IM-main...");
mtr_kill_process($instance_manager->{'pid'}, 'KILL', 10);
# Shutdown managed mysqld-processes. Some of them may be nonguarded, so IM
# will not stop them on shutdown. So, we should firstly try to end them
# legally.
+ mtr_debug("Killing guarded mysqld(s)...");
mtr_kill_processes(\@mysqld_pids);
# Complain in error log so that a warning will be shown.
@@ -4040,17 +4095,8 @@ sub valgrind_arguments {
mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir)
if -f "$glob_mysql_test_dir/valgrind.supp";
- if ( $opt_valgrind_all )
- {
- mtr_add_arg($args, "-v");
- mtr_add_arg($args, "--show-reachable=yes");
- }
-
- if ( $opt_valgrind_options )
- {
- mtr_add_arg($args, '%s', $_) for (split(' ', $opt_valgrind_options));
- }
-
+ # Add valgrind options, can be overriden by user
+ mtr_add_arg($args, '%s', $_) for (split(' ', $opt_valgrind_options));
mtr_add_arg($args, $$exe);
@@ -4164,12 +4210,11 @@ Options for coverage, profiling etc
gcov FIXME
gprof FIXME
valgrind Run the "mysqltest" and "mysqld" executables using
- valgrind
- valgrind-all Same as "valgrind" but will also add "verbose" and
- "--show-reachable" flags to valgrind
+ valgrind with options($default_valgrind_options)
+ valgrind-all Synonym for --valgrind
valgrind-mysqltest Run the "mysqltest" executable with valgrind
valgrind-mysqld Run the "mysqld" executable with valgrind
- valgrind-options=ARGS Extra options to give valgrind
+ valgrind-options=ARGS Options to give valgrind, replaces default options
valgrind-path=[EXE] Path to the valgrind executable
Misc options
diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result
index 19cb0c9768f..cacf4aaf304 100644
--- a/mysql-test/r/archive.result
+++ b/mysql-test/r/archive.result
@@ -6254,6 +6254,7 @@ auto fld1 companynr fld3 fld4 fld5 fld6
3 011402 37 Romans scholastics jarring
4 011403 37 intercepted audiology tinily
DELETE FROM t2;
+ERROR HY000: Table storage engine for 't2' doesn't have this option
SELECT * FROM t2;
auto fld1 companynr fld3 fld4 fld5 fld6
1 000001 00 Omaha teethe neat
@@ -8685,6 +8686,7 @@ auto fld1 companynr fld3 fld4 fld5 fld6
3 011402 37 Romans scholastics jarring
4 011403 37 intercepted audiology tinily
TRUNCATE TABLE t2;
+ERROR HY000: Table storage engine for 't2' doesn't have this option
SELECT * FROM t2;
auto fld1 companynr fld3 fld4 fld5 fld6
1 000001 00 Omaha teethe neat
diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result
index d9e9392f618..10f26c40553 100644
--- a/mysql-test/r/auto_increment.result
+++ b/mysql-test/r/auto_increment.result
@@ -378,6 +378,28 @@ t1 CREATE TABLE `t1` (
KEY `t1_name` (`t1_name`)
) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1
DROP TABLE `t1`;
+create table t1(a int not null auto_increment primary key);
+create table t2(a int not null auto_increment primary key, t1a int);
+insert into t1 values(NULL);
+insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID());
+insert into t1 values (NULL);
+insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID()),
+(NULL, LAST_INSERT_ID());
+insert into t1 values (NULL);
+insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID()),
+(NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID());
+select * from t2;
+a t1a
+1 1
+2 1
+3 2
+4 2
+5 2
+6 3
+7 3
+8 3
+9 3
+drop table t1, t2;
End of 4.1 tests
CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`));
insert into t1 (b) values (1);
diff --git a/mysql-test/r/binlog_row_blackhole.result b/mysql-test/r/binlog_row_blackhole.result
index 42bf7a10888..29738fcf426 100644
--- a/mysql-test/r/binlog_row_blackhole.result
+++ b/mysql-test/r/binlog_row_blackhole.result
@@ -111,32 +111,16 @@ master-bin.000001 # Query 1 # use `test`; drop table t1,t2
master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=blackhole
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Query 1 # use `test`; COMMIT
-master-bin.000001 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Query 1 # use `test`; COMMIT
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Query 1 # use `test`; COMMIT
-master-bin.000001 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Query 1 # use `test`; COMMIT
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Query 1 # use `test`; COMMIT
master-bin.000001 # Query 1 # use `test`; create table t2 (a varchar(200)) engine=blackhole
master-bin.000001 # Table_map 1 # table_id: # (test.t2)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Query 1 # use `test`; COMMIT
master-bin.000001 # Query 1 # use `test`; alter table t1 add b int
master-bin.000001 # Query 1 # use `test`; alter table t1 drop b
master-bin.000001 # Query 1 # use `test`; create table t3 like t1
-master-bin.000001 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Query 1 # use `test`; COMMIT
-master-bin.000001 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Query 1 # use `test`; COMMIT
drop table t1,t2,t3;
reset master;
create table t1 (a int) engine=blackhole;
diff --git a/mysql-test/r/binlog_row_mix_innodb_myisam.result b/mysql-test/r/binlog_row_mix_innodb_myisam.result
index 84959684c42..32c21a01f27 100644
--- a/mysql-test/r/binlog_row_mix_innodb_myisam.result
+++ b/mysql-test/r/binlog_row_mix_innodb_myisam.result
@@ -261,26 +261,21 @@ master-bin.000001 243 Table_map 1 # table_id: # (test.t1)
master-bin.000001 282 Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 316 Xid 1 # COMMIT /* xid= */
master-bin.000001 343 Table_map 1 # table_id: # (test.t1)
-master-bin.000001 382 Query 1 # use `test`; delete from t1
-master-bin.000001 459 Xid 1 # COMMIT /* xid= */
-master-bin.000001 486 Table_map 1 # table_id: # (test.t2)
-master-bin.000001 525 Query 1 # use `test`; delete from t2
-master-bin.000001 602 Xid 1 # COMMIT /* xid= */
-master-bin.000001 629 Query 1 # use `test`; alter table t2 engine=MyISAM
-master-bin.000001 720 Table_map 1 # table_id: # (test.t1)
-master-bin.000001 759 Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 793 Xid 1 # COMMIT /* xid= */
-master-bin.000001 820 Query 1 # use `test`; BEGIN
-master-bin.000001 888 Table_map 1 # table_id: # (test.t1)
-master-bin.000001 927 Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 956 Xid 1 # COMMIT /* xid= */
-master-bin.000001 983 Query 1 # use `test`; drop table t1,t2
-master-bin.000001 1062 Query 1 # use `test`; create table t0 (n int)
-master-bin.000001 1148 Table_map 1 # table_id: # (test.t0)
-master-bin.000001 1187 Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 1221 Table_map 1 # table_id: # (test.t0)
-master-bin.000001 1260 Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 1294 Query 1 # use `test`; create table t2 (n int) engine=innodb
+master-bin.000001 382 Delete_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 421 Xid 1 # COMMIT /* xid= */
+master-bin.000001 448 Query 1 # use `test`; alter table t2 engine=MyISAM
+master-bin.000001 539 Table_map 1 # table_id: # (test.t1)
+master-bin.000001 578 Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 612 Xid 1 # COMMIT /* xid= */
+master-bin.000001 639 Table_map 1 # table_id: # (test.t2)
+master-bin.000001 678 Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 712 Query 1 # use `test`; drop table t1,t2
+master-bin.000001 791 Query 1 # use `test`; create table t0 (n int)
+master-bin.000001 877 Table_map 1 # table_id: # (test.t0)
+master-bin.000001 916 Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 950 Table_map 1 # table_id: # (test.t0)
+master-bin.000001 989 Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 1023 Query 1 # use `test`; create table t2 (n int) engine=innodb
do release_lock("lock1");
drop table t0,t2;
set autocommit=0;
diff --git a/mysql-test/r/binlog_stm_blackhole.result b/mysql-test/r/binlog_stm_blackhole.result
index 64569993a7b..3f4b058003b 100644
--- a/mysql-test/r/binlog_stm_blackhole.result
+++ b/mysql-test/r/binlog_stm_blackhole.result
@@ -110,27 +110,18 @@ master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000001 # Query 1 # use `test`; drop table t1,t2
master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=blackhole
master-bin.000001 # Query 1 # use `test`; delete from t1 where a=10
-master-bin.000001 # Query 1 # use `test`; COMMIT
master-bin.000001 # Query 1 # use `test`; update t1 set a=11 where a=15
-master-bin.000001 # Query 1 # use `test`; COMMIT
master-bin.000001 # Query 1 # use `test`; insert into t1 values(1)
-master-bin.000001 # Query 1 # use `test`; COMMIT
master-bin.000001 # Query 1 # use `test`; insert ignore into t1 values(1)
-master-bin.000001 # Query 1 # use `test`; COMMIT
master-bin.000001 # Query 1 # use `test`; replace into t1 values(100)
-master-bin.000001 # Query 1 # use `test`; COMMIT
master-bin.000001 # Query 1 # use `test`; create table t2 (a varchar(200)) engine=blackhole
master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
-master-bin.000001 # Query 1 # use `test`; COMMIT
master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../std_data_ln/words.dat' into table t2 ;file_id=1
-master-bin.000001 # Query 1 # use `test`; COMMIT
master-bin.000001 # Query 1 # use `test`; alter table t1 add b int
master-bin.000001 # Query 1 # use `test`; alter table t1 drop b
master-bin.000001 # Query 1 # use `test`; create table t3 like t1
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t3
-master-bin.000001 # Query 1 # use `test`; COMMIT
master-bin.000001 # Query 1 # use `test`; replace into t1 select * from t3
-master-bin.000001 # Query 1 # use `test`; COMMIT
drop table t1,t2,t3;
reset master;
create table t1 (a int) engine=blackhole;
diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result
index 3adcc895474..04f0636d400 100644
--- a/mysql-test/r/csv.result
+++ b/mysql-test/r/csv.result
@@ -4944,10 +4944,10 @@ val
UPDATE bug13894 SET val=6 WHERE val=10;
SELECT * FROM bug13894;
val
-5
-11
6
6
+5
+11
DROP TABLE bug13894;
DROP TABLE IF EXISTS bug14672;
CREATE TABLE bug14672 (c1 integer) engine = CSV;
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
index f8e07e1eb6f..32871563b64 100644
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@ -391,3 +391,17 @@ ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈÌÒÙ @ abc
SELECT convert(@str collate latin1_swedish_ci using utf8);
convert(@str collate latin1_swedish_ci using utf8)
ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈÌÒÙ @ abc
+SET NAMES latin1;
+DROP TABLE IF EXISTS `abcÿdef`;
+CREATE TABLE `abcÿdef` (i int);
+INSERT INTO `abcÿdef` VALUES (1);
+INSERT INTO abcÿdef VALUES (2);
+SELECT * FROM `abcÿdef`;
+i
+1
+2
+SELECT * FROM abcÿdef;
+i
+1
+2
+DROP TABLE `abcÿdef`;
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 62e2085ae09..dc2bb4c6c73 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -704,6 +704,32 @@ select f1 from t1 where f1 like 'a%';
f1
a
drop table t1;
+create table t1 (utext varchar(20) character set ucs2);
+insert into t1 values ("lily");
+insert into t1 values ("river");
+prepare stmt from 'select utext from t1 where utext like ?';
+set @param1='%%';
+execute stmt using @param1;
+utext
+lily
+river
+execute stmt using @param1;
+utext
+lily
+river
+select utext from t1 where utext like '%%';
+utext
+lily
+river
+drop table t1;
+deallocate prepare stmt;
+CREATE TABLE t1 (id int, s char(5) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci);
+INSERT INTO t1 VALUES (1, 'ZZZZZ'), (1, 'ZZZ'), (2, 'ZZZ'), (2, 'ZZZZZ');
+SELECT id, MIN(s) FROM t1 GROUP BY id;
+id MIN(s)
+1 ZZZ
+2 ZZZ
+DROP TABLE t1;
CREATE TABLE t1 (a varchar(64) character set ucs2, b decimal(10,3));
INSERT INTO t1 VALUES ("1.1", 0), ("2.1", 0);
update t1 set b=a;
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index 1246c6f3d5d..3dcf88b8df5 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -1112,6 +1112,175 @@ check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
+SET NAMES utf8;
+CREATE TABLE t1 (id int PRIMARY KEY,
+a varchar(16) collate utf8_unicode_ci NOT NULL default '',
+b int,
+f varchar(128) default 'XXX',
+INDEX (a(4))
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+INSERT INTO t1(id, a, b) VALUES
+(1, 'cccc', 50), (2, 'cccc', 70), (3, 'cccc', 30),
+(4, 'cccc', 30), (5, 'cccc', 20), (6, 'bbbbbb', 40),
+(7, 'dddd', 30), (8, 'aaaa', 10), (9, 'aaaa', 50),
+(10, 'eeeee', 40), (11, 'bbbbbb', 60);
+SELECT id, a, b FROM t1;
+id a b
+1 cccc 50
+2 cccc 70
+3 cccc 30
+4 cccc 30
+5 cccc 20
+6 bbbbbb 40
+7 dddd 30
+8 aaaa 10
+9 aaaa 50
+10 eeeee 40
+11 bbbbbb 60
+SELECT id, a, b FROM t1 WHERE a BETWEEN 'aaaa' AND 'bbbbbb';
+id a b
+8 aaaa 10
+9 aaaa 50
+6 bbbbbb 40
+11 bbbbbb 60
+SELECT id, a FROM t1 WHERE a='bbbbbb';
+id a
+6 bbbbbb
+11 bbbbbb
+SELECT id, a FROM t1 WHERE a='bbbbbb' ORDER BY b;
+id a
+6 bbbbbb
+11 bbbbbb
+DROP TABLE t1;
+SET NAMES utf8;
+CREATE TABLE t1 (
+a CHAR(13) DEFAULT '',
+INDEX(a)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
+INSERT INTO t1 VALUES
+('Käli Käli 2-4'), ('Käli Käli 2-4'),
+('Käli Käli 2+4'), ('Käli Käli 2+4'),
+('Käli Käli 2-6'), ('Käli Käli 2-6');
+INSERT INTO t1 SELECT * FROM t1;
+CREATE TABLE t2 (
+a CHAR(13) DEFAULT '',
+INDEX(a)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
+INSERT INTO t2 VALUES
+('Kali Kali 2-4'), ('Kali Kali 2-4'),
+('Kali Kali 2+4'), ('Kali Kali 2+4'),
+('Kali Kali 2-6'), ('Kali Kali 2-6');
+INSERT INTO t2 SELECT * FROM t2;
+SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4';
+a
+Käli Käli 2+4
+Käli Käli 2+4
+Käli Käli 2+4
+Käli Käli 2+4
+SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4';
+a
+Kali Kali 2+4
+Kali Kali 2+4
+Kali Kali 2+4
+Kali Kali 2+4
+EXPLAIN SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 40 NULL 4 Using where; Using index
+EXPLAIN SELECT a FROM t1 WHERE a = 'Käli Käli 2+4';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 40 const 4 Using where; Using index
+EXPLAIN SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range a a 14 NULL 4 Using where; Using index
+EXPLAIN SELECT a FROM t2 WHERE a = 'Kali Kali 2+4';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref a a 14 const 4 Using where; Using index
+DROP TABLE t1,t2;
+CREATE TABLE t1 (
+a char(255) DEFAULT '',
+KEY(a(10))
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
+INSERT INTO t1 VALUES ('Käli Käli 2-4');
+SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
+a
+Käli Käli 2-4
+INSERT INTO t1 VALUES ('Käli Käli 2-4');
+SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
+a
+Käli Käli 2-4
+Käli Käli 2-4
+DROP TABLE t1;
+CREATE TABLE t1 (
+a char(255) DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
+INSERT INTO t1 VALUES ('Käli Käli 2-4');
+INSERT INTO t1 VALUES ('Käli Käli 2-4');
+SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
+a
+Käli Käli 2-4
+Käli Käli 2-4
+ALTER TABLE t1 ADD KEY (a(10));
+SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
+a
+Käli Käli 2-4
+Käli Käli 2-4
+DROP TABLE t1;
+SET NAMES latin2;
+CREATE TABLE t1 (
+id int(11) NOT NULL default '0',
+tid int(11) NOT NULL default '0',
+val text NOT NULL,
+INDEX idx(tid, val(10))
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES
+(40988,72,'VOLNÝ ADSL'),(41009,72,'VOLNÝ ADSL'),
+(41032,72,'VOLNÝ ADSL'),(41038,72,'VOLNÝ ADSL'),
+(41063,72,'VOLNÝ ADSL'),(41537,72,'VOLNÝ ADSL Office'),
+(42141,72,'VOLNÝ ADSL'),(42565,72,'VOLNÝ ADSL Combi'),
+(42749,72,'VOLNÝ ADSL'),(44205,72,'VOLNÝ ADSL');
+SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLNY ADSL';
+id tid val
+40988 72 VOLNÝ ADSL
+41009 72 VOLNÝ ADSL
+41032 72 VOLNÝ ADSL
+41038 72 VOLNÝ ADSL
+41063 72 VOLNÝ ADSL
+42141 72 VOLNÝ ADSL
+42749 72 VOLNÝ ADSL
+44205 72 VOLNÝ ADSL
+SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLNÝ ADSL';
+id tid val
+40988 72 VOLNÝ ADSL
+41009 72 VOLNÝ ADSL
+41032 72 VOLNÝ ADSL
+41038 72 VOLNÝ ADSL
+41063 72 VOLNÝ ADSL
+42141 72 VOLNÝ ADSL
+42749 72 VOLNÝ ADSL
+44205 72 VOLNÝ ADSL
+SELECT * FROM t1 WHERE tid=72 and val LIKE '%VOLNÝ ADSL';
+id tid val
+40988 72 VOLNÝ ADSL
+41009 72 VOLNÝ ADSL
+41032 72 VOLNÝ ADSL
+41038 72 VOLNÝ ADSL
+41063 72 VOLNÝ ADSL
+42141 72 VOLNÝ ADSL
+42749 72 VOLNÝ ADSL
+44205 72 VOLNÝ ADSL
+ALTER TABLE t1 DROP KEY idx;
+ALTER TABLE t1 ADD KEY idx (tid,val(11));
+SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLNÝ ADSL';
+id tid val
+40988 72 VOLNÝ ADSL
+41009 72 VOLNÝ ADSL
+41032 72 VOLNÝ ADSL
+41038 72 VOLNÝ ADSL
+41063 72 VOLNÝ ADSL
+42141 72 VOLNÝ ADSL
+42749 72 VOLNÝ ADSL
+44205 72 VOLNÝ ADSL
+DROP TABLE t1;
CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa');
SELECT id FROM t1;
diff --git a/mysql-test/r/delayed.result b/mysql-test/r/delayed.result
index f8ae61b03fb..a336f3b4108 100644
--- a/mysql-test/r/delayed.result
+++ b/mysql-test/r/delayed.result
@@ -39,3 +39,33 @@ select * from t1;
a
1
drop table t1;
+CREATE TABLE t1 ( a int(10) NOT NULL auto_increment, PRIMARY KEY (a));
+insert delayed into t1 values(null);
+insert into t1 values(null);
+insert into t1 values(null);
+insert delayed into t1 values(null);
+insert delayed into t1 values(null);
+insert delayed into t1 values(null);
+insert into t1 values(null);
+insert into t1 values(null);
+insert into t1 values(null);
+delete from t1 where a=6;
+insert delayed into t1 values(null);
+insert delayed into t1 values(null);
+insert delayed into t1 values(null);
+insert delayed into t1 values(null);
+select * from t1 order by a;
+a
+1
+2
+3
+4
+5
+7
+8
+9
+10
+11
+12
+13
+DROP TABLE t1;
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index 89b17d69f40..a3d1e8bf3bb 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -504,6 +504,57 @@ a 2 b
2 2 4
3 2 5
DROP TABLE t1,t2;
+CREATE TABLE t1(a INT PRIMARY KEY, b INT);
+INSERT INTO t1 VALUES (1,1), (2,1), (3,1);
+EXPLAIN SELECT DISTINCT a FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 3 Using index
+EXPLAIN SELECT DISTINCT a,b FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+EXPLAIN SELECT DISTINCT t1_1.a, t1_1.b FROM t1 t1_1, t1 t1_2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1_1 ALL NULL NULL NULL NULL 3 Using temporary
+1 SIMPLE t1_2 index NULL PRIMARY 4 NULL 3 Using index; Distinct
+EXPLAIN SELECT DISTINCT t1_1.a, t1_1.b FROM t1 t1_1, t1 t1_2
+WHERE t1_1.a = t1_2.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1_1 ALL PRIMARY NULL NULL NULL 3 Using temporary
+1 SIMPLE t1_2 eq_ref PRIMARY PRIMARY 4 test.t1_1.a 1 Using index; Distinct
+EXPLAIN SELECT a FROM t1 GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 3 Using index
+EXPLAIN SELECT a,b FROM t1 GROUP BY a,b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+EXPLAIN SELECT DISTINCT a,b FROM t1 GROUP BY a,b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+CREATE TABLE t2(a INT, b INT, c INT, d INT, PRIMARY KEY (a,b));
+INSERT INTO t2 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4);
+EXPLAIN SELECT DISTINCT a FROM t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL PRIMARY 8 NULL 3 Using index
+EXPLAIN SELECT DISTINCT a,a FROM t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL PRIMARY 8 NULL 3 Using index
+EXPLAIN SELECT DISTINCT b,a FROM t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL PRIMARY 8 NULL 3 Using index
+EXPLAIN SELECT DISTINCT a,c FROM t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using temporary
+EXPLAIN SELECT DISTINCT c,a,b FROM t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3
+EXPLAIN SELECT DISTINCT a,b,d FROM t2 GROUP BY c,b,d;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
+CREATE UNIQUE INDEX c_b_unq ON t2 (c,b);
+EXPLAIN SELECT DISTINCT a,b,d FROM t2 GROUP BY c,b,d;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3
+DROP TABLE t1,t2;
create table t1 (id int, dsc varchar(50));
insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line number three");
select distinct id, IFNULL(dsc, '-') from t1;
diff --git a/mysql-test/r/events.result b/mysql-test/r/events.result
index 77280f99b7c..e115e077535 100644
--- a/mysql-test/r/events.result
+++ b/mysql-test/r/events.result
@@ -365,19 +365,19 @@ on schedule every 10 hour
disable
do
select 1;
-select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
-event_schema event_name definer event_body
+select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
+event_schema event_name definer event_definition
events_test white_space root@localhost select 1
drop event white_space;
create event white_space on schedule every 10 hour disable do
select 2;
-select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
-event_schema event_name definer event_body
+select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
+event_schema event_name definer event_definition
events_test white_space root@localhost select 2
drop event white_space;
create event white_space on schedule every 10 hour disable do select 3;
-select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
-event_schema event_name definer event_body
+select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
+event_schema event_name definer event_definition
events_test white_space root@localhost select 3
drop event white_space;
create event e1 on schedule every 1 year do set @a = 5;
diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result
index bc89c692f9a..a7c2964a253 100644
--- a/mysql-test/r/events_bugs.result
+++ b/mysql-test/r/events_bugs.result
@@ -178,4 +178,27 @@ drop procedure ee_16407_6_pendant;
set global event_scheduler= 2;
drop table events_smode_test;
set sql_mode=@old_sql_mode;
+set global event_scheduler=2;
+delete from mysql.user where User like 'mysqltest_%';
+delete from mysql.db where User like 'mysqltest_%';
+flush privileges;
+drop database if exists mysqltest_db1;
+create user mysqltest_user1@localhost;
+create database mysqltest_db1;
+grant event on events_test.* to mysqltest_user1@localhost;
+create event mysqltest_user1 on schedule every 10 second do select 42;
+alter event mysqltest_user1 rename to mysqltest_db1.mysqltest_user1;
+ERROR 42000: Access denied for user 'mysqltest_user1'@'localhost' to database 'mysqltest_db1'
+"Let's test now rename when there is no select DB"
+select database();
+database()
+NULL
+alter event events_test.mysqltest_user1 rename to mysqltest_user1;
+ERROR 3D000: No database selected
+select event_schema, event_name, definer, event_type, status from information_schema.events;
+event_schema event_name definer event_type status
+events_test mysqltest_user1 mysqltest_user1@localhost RECURRING ENABLED
+drop event events_test.mysqltest_user1;
+drop user mysqltest_user1@localhost;
+drop database mysqltest_db1;
drop database events_test;
diff --git a/mysql-test/r/events_grant.result b/mysql-test/r/events_grant.result
index 6c140f91eaa..eda0759d518 100644
--- a/mysql-test/r/events_grant.result
+++ b/mysql-test/r/events_grant.result
@@ -4,9 +4,9 @@ CREATE EVENT one_event ON SCHEDULE EVERY 10 SECOND DO SELECT 123;
SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test one_event root@localhost RECURRING NULL 10 SECOND # # ENABLED
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT from information_schema.events;
-EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
-NULL events_test one_event root@localhost SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT from information_schema.events;
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+NULL events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
CREATE DATABASE events_test2;
CREATE USER ev_test@localhost;
GRANT ALL ON events_test.* to ev_test@localhost;
@@ -57,65 +57,65 @@ USE events_test2;
CREATE EVENT four_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
USE events_test;
"We should see 4 events : one_event, two_event, three_event & four_event"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
-EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
-NULL events_test one_event root@localhost SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
-NULL events_test two_event ev_test@localhost SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
-NULL events_test three_event ev_test@localhost SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
-NULL events_test2 four_event ev_test@localhost SELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+NULL events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
+NULL events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
+NULL events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
+NULL events_test2 four_event ev_test@localhost SQL SELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE
DROP DATABASE events_test2;
"We should see 3 events : one_event, two_event, three_event"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
-EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
-NULL events_test one_event root@localhost SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
-NULL events_test two_event ev_test@localhost SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
-NULL events_test three_event ev_test@localhost SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+NULL events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
+NULL events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
+NULL events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
CREATE DATABASE events_test2;
USE events_test2;
CREATE EVENT five_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
"Should see 4 events - one, two, three & five"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
-EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
-NULL events_test one_event root@localhost SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
-NULL events_test two_event ev_test@localhost SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
-NULL events_test three_event ev_test@localhost SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
-NULL events_test2 five_event root@localhost SELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+NULL events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
+NULL events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
+NULL events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
+NULL events_test2 five_event root@localhost SQL SELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE
REVOKE EVENT ON events_test2.* FROM ev_test@localhost;
USE test;
"Should see 3 events - one, two & three"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
-EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
-NULL events_test one_event root@localhost SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
-NULL events_test two_event ev_test@localhost SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
-NULL events_test three_event ev_test@localhost SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+NULL events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
+NULL events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
+NULL events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
"Let's test ALTER EVENT which changes the definer"
USE events_test;
ALTER EVENT one_event ON SCHEDULE EVERY 10 SECOND;
"The definer should be ev_test@localhost"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
-EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
-NULL events_test one_event ev_test@localhost SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+NULL events_test one_event ev_test@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
USE events_test;
ALTER EVENT one_event COMMENT "comment";
"The definer should be root@localhost"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
-EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
-NULL events_test one_event root@localhost SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE comment
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+NULL events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE comment
ALTER EVENT one_event DO SELECT 12;
"The definer should be ev_test@localhost"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
-EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
-NULL events_test one_event ev_test@localhost SELECT 12 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE comment
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+NULL events_test one_event ev_test@localhost SQL SELECT 12 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE comment
"make the definer again root@localhost"
ALTER EVENT one_event COMMENT "new comment";
"test DROP by another user"
DROP EVENT one_event;
"One event should not be there"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
-EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
-NULL events_test two_event ev_test@localhost SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
-NULL events_test three_event ev_test@localhost SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
-NULL events_test2 five_event root@localhost SELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+NULL events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
+NULL events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
+NULL events_test2 five_event root@localhost SQL SELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE
DROP USER ev_test@localhost;
DROP DATABASE events_test2;
DROP DATABASE events_test;
diff --git a/mysql-test/r/events_logs_tests.result b/mysql-test/r/events_logs_tests.result
index ce58e0ec059..9202d63fd2c 100644
--- a/mysql-test/r/events_logs_tests.result
+++ b/mysql-test/r/events_logs_tests.result
@@ -31,6 +31,8 @@ SHOW VARIABLES LIKE 'log_slow_queries';
Variable_name Value
log_slow_queries ON
DROP FUNCTION get_value;
+"Make it quite long"
+SET SESSION long_query_time=300;
TRUNCATE mysql.slow_log;
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
user_host query_time db sql_text
@@ -44,7 +46,10 @@ SLEEP(2)
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
user_host query_time db sql_text
USER_HOST SLEEPVAL events_test SELECT SLEEP(2)
+SET SESSION long_query_time=300;
+"Make it quite long"
TRUNCATE mysql.slow_log;
+SET SESSION long_query_time=1;
CREATE TABLE slow_event_test (slo_val tinyint, val tinyint);
"This won't go to the slow log"
CREATE EVENT long_event ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(3);
@@ -63,9 +68,9 @@ slo_val val
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
user_host query_time db sql_text
"This should go to the slow log"
+DROP EVENT long_event;
SET SESSION long_query_time=10;
SET GLOBAL long_query_time=1;
-DROP EVENT long_event;
CREATE EVENT long_event2 ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(2);
"Sleep some more time than the actual event run will take"
"Check our table. Should see 2 rows"
@@ -78,8 +83,10 @@ SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
user_host query_time db sql_text
USER_HOST SLEEPVAL events_test INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(2)
DROP EVENT long_event2;
-SET GLOBAL long_query_time =@old_global_long_query_time;
-SET SESSION long_query_time =@old_session_long_query_time;
+"Make it quite long"
+SET SESSION long_query_time=300;
TRUNCATE mysql.slow_log;
DROP TABLE slow_event_test;
+SET GLOBAL long_query_time =@old_global_long_query_time;
+SET SESSION long_query_time =@old_session_long_query_time;
drop database events_test;
diff --git a/mysql-test/r/events_stress.result b/mysql-test/r/events_stress.result
index ead618e8136..050fe324426 100644
--- a/mysql-test/r/events_stress.result
+++ b/mysql-test/r/events_stress.result
@@ -1,6 +1,8 @@
CREATE DATABASE IF NOT EXISTS events_test;
CREATE DATABASE events_conn1_test2;
-CREATE TABLE events_test.fill_it(test_name varchar(20), occur datetime);
+CREATE TABLE events_test.fill_it1(test_name varchar(20), occur datetime);
+CREATE TABLE events_test.fill_it2(test_name varchar(20), occur datetime);
+CREATE TABLE events_test.fill_it3(test_name varchar(20), occur datetime);
CREATE USER event_user2@localhost;
CREATE DATABASE events_conn2_db;
GRANT ALL ON *.* TO event_user2@localhost;
@@ -57,5 +59,7 @@ SET GLOBAL event_scheduler=2;
DROP DATABASE events_conn1_test4;
SET GLOBAL event_scheduler=1;
USE events_test;
-DROP TABLE fill_it;
+DROP TABLE fill_it1;
+DROP TABLE fill_it2;
+DROP TABLE fill_it3;
DROP DATABASE events_test;
diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result
index b3d6e10448b..5f5cd94c216 100644
--- a/mysql-test/r/federated.result
+++ b/mysql-test/r/federated.result
@@ -82,7 +82,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
@@ -107,7 +107,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
@@ -121,7 +121,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
diff --git a/mysql-test/r/fulltext2.result b/mysql-test/r/fulltext2.result
index f6a4b20bc22..7e3e25370d3 100644
--- a/mysql-test/r/fulltext2.result
+++ b/mysql-test/r/fulltext2.result
@@ -241,3 +241,11 @@ select * from t1 where match a against('ab c' in boolean mode);
a
drop table t1;
set names latin1;
+SET NAMES utf8;
+CREATE TABLE t1(a VARCHAR(255), FULLTEXT(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES('„MySQL“');
+SELECT a FROM t1 WHERE MATCH a AGAINST('“MySQL„' IN BOOLEAN MODE);
+a
+„MySQL“
+DROP TABLE t1;
+SET NAMES latin1;
diff --git a/mysql-test/r/fulltext_left_join.result b/mysql-test/r/fulltext_left_join.result
index f3dad290525..68a424fa3a5 100644
--- a/mysql-test/r/fulltext_left_join.result
+++ b/mysql-test/r/fulltext_left_join.result
@@ -50,3 +50,20 @@ venue_id venue_text dt name entity_id
1 a1 2003-05-23 19:30:00 aberdeen town hall 1
NULL a2 2003-05-23 19:30:00 NULL NULL
drop table t1,t2;
+create table t1 (id int not null primary key, d char(200) not null, e char(200));
+insert into t1 values (1, 'aword', null), (2, 'aword', 'bword'), (3, 'bword', null), (4, 'bword', 'aword'), (5, 'aword and bword', null);
+select * from t1 where match(d, e) against ('+aword +bword' in boolean mode);
+id d e
+2 aword bword
+4 bword aword
+5 aword and bword NULL
+create table t2 (m_id int not null, f char(200), key (m_id));
+insert into t2 values (1, 'bword'), (3, 'aword'), (5, '');
+select * from t1 left join t2 on m_id = id where match(d, e, f) against ('+aword +bword' in boolean mode);
+id d e m_id f
+1 aword NULL 1 bword
+2 aword bword NULL NULL
+3 bword NULL 3 aword
+4 bword aword NULL NULL
+5 aword and bword NULL 5
+drop table t1,t2;
diff --git a/mysql-test/r/func_concat.result b/mysql-test/r/func_concat.result
index 0bd53b32dd7..66808afd4e9 100644
--- a/mysql-test/r/func_concat.result
+++ b/mysql-test/r/func_concat.result
@@ -68,3 +68,17 @@ select 'a' union select concat('a', -0.0000);
a
a
a0.0000
+select concat((select x from (select 'a' as x) as t1 ),
+(select y from (select 'b' as y) as t2 )) from (select 1 union select 2 )
+as t3;
+concat((select x from (select 'a' as x) as t1 ),
+(select y from (select 'b' as y) as t2 ))
+ab
+ab
+create table t1(f1 varchar(6)) charset=utf8;
+insert into t1 values ("123456");
+select concat(f1, 2) a from t1 union select 'x' a from t1;
+a
+1234562
+x
+drop table t1;
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index f4c7d268aee..6ea28efd91c 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -812,6 +812,41 @@ SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
MAX(id)
NULL
DROP TABLE t1;
+CREATE TABLE t1 (id int PRIMARY KEY, b char(3), INDEX(b));
+INSERT INTO t1 VALUES (1,'xx'), (2,'aa');
+SELECT * FROM t1;
+id b
+1 xx
+2 aa
+SELECT MAX(b) FROM t1 WHERE b < 'ppppp';
+MAX(b)
+aa
+SHOW WARNINGS;
+Level Code Message
+SELECT MAX(b) FROM t1 WHERE b < 'pp';
+MAX(b)
+aa
+DROP TABLE t1;
+CREATE TABLE t1 (id int PRIMARY KEY, b char(16), INDEX(b(4)));
+INSERT INTO t1 VALUES (1, 'xxxxbbbb'), (2, 'xxxxaaaa');
+SELECT MAX(b) FROM t1;
+MAX(b)
+xxxxbbbb
+EXPLAIN SELECT MAX(b) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2
+DROP TABLE t1;
+CREATE TABLE t1 (id int , b varchar(512), INDEX(b(250))) COLLATE latin1_bin;
+INSERT INTO t1 VALUES
+(1,CONCAT(REPEAT('_', 250), "qq")), (1,CONCAT(REPEAT('_', 250), "zz")),
+(1,CONCAT(REPEAT('_', 250), "aa")), (1,CONCAT(REPEAT('_', 250), "ff"));
+SELECT MAX(b) FROM t1;
+MAX(b)
+__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________zz
+EXPLAIN SELECT MAX(b) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4
+DROP TABLE t1;
create table t2 (ff double);
insert into t2 values (2.2);
select cast(sum(distinct ff) as decimal(5,2)) from t2;
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 354c886b19b..54960765c56 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -1023,6 +1023,21 @@ NULL
select ifnull(load_file("lkjlkj"),"it's null");
ifnull(load_file("lkjlkj"),"it's null")
it's null
+create table t1 (f1 varchar(4), f2 varchar(64), unique key k1 (f1,f2));
+insert into t1 values ( 'test',md5('test')), ('test', sha('test'));
+select * from t1 where f1='test' and (f2= md5("test") or f2= md5("TEST"));
+f1 f2
+test 098f6bcd4621d373cade4e832627b4f6
+select * from t1 where f1='test' and (f2= md5("TEST") or f2= md5("test"));
+f1 f2
+test 098f6bcd4621d373cade4e832627b4f6
+select * from t1 where f1='test' and (f2= sha("test") or f2= sha("TEST"));
+f1 f2
+test a94a8fe5ccb19ba61c4c0873d391e987982fbbd3
+select * from t1 where f1='test' and (f2= sha("TEST") or f2= sha("test"));
+f1 f2
+test a94a8fe5ccb19ba61c4c0873d391e987982fbbd3
+drop table t1;
End of 4.1 tests
create table t1 (d decimal default null);
insert into t1 values (null);
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 283dd11ca1e..34f4f5fb98d 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -1,4 +1,5 @@
drop table if exists t1,t2,t3;
+set time_zone="+03:00";
select from_days(to_days("960101")),to_days(960201)-to_days("19960101"),to_days(date_add(curdate(), interval 1 day))-to_days(curdate()),weekday("1997-11-29");
from_days(to_days("960101")) to_days(960201)-to_days("19960101") to_days(date_add(curdate(), interval 1 day))-to_days(curdate()) weekday("1997-11-29")
1996-01-01 31 1 5
@@ -7,20 +8,20 @@ period_add("9602",-12) period_diff(199505,"9404")
199502 13
select now()-now(),weekday(curdate())-weekday(now()),unix_timestamp()-unix_timestamp(now());
now()-now() weekday(curdate())-weekday(now()) unix_timestamp()-unix_timestamp(now())
-0 0 0
+0.000000 0 0
select from_unixtime(unix_timestamp("1994-03-02 10:11:12")),from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s"),from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0;
from_unixtime(unix_timestamp("1994-03-02 10:11:12")) from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s") from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0
-1994-03-02 10:11:12 1994-03-02 10:11:12 19940302101112
+1994-03-02 10:11:12 1994-03-02 10:11:12 19940302101112.000000
select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"),
sec_to_time(time_to_sec("0:30:47")/6.21);
sec_to_time(9001) sec_to_time(9001)+0 time_to_sec("15:12:22") sec_to_time(time_to_sec("0:30:47")/6.21)
-02:30:01 23001 54742 00:04:57
+02:30:01 23001.000000 54742 00:04:57
select sec_to_time(time_to_sec('-838:59:59'));
sec_to_time(time_to_sec('-838:59:59'))
-838:59:59
select now()-curdate()*1000000-curtime();
now()-curdate()*1000000-curtime()
-0
+0.000000
select strcmp(current_timestamp(),concat(current_date()," ",current_time()));
strcmp(current_timestamp(),concat(current_date()," ",current_time()))
0
@@ -751,6 +752,60 @@ select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
monthname(str_to_date(null, '%m')) monthname(str_to_date(null, '%m')) monthname(str_to_date(1, '%m')) monthname(str_to_date(0, '%m'))
NULL NULL January NULL
+create table t1(f1 date, f2 time, f3 datetime);
+insert into t1 values ("2006-01-01", "12:01:01", "2006-01-01 12:01:01");
+insert into t1 values ("2006-01-02", "12:01:02", "2006-01-02 12:01:02");
+select f1 from t1 where f1 between "2006-1-1" and 20060101;
+f1
+2006-01-01
+select f1 from t1 where f1 between "2006-1-1" and "2006.1.1";
+f1
+2006-01-01
+select f1 from t1 where date(f1) between "2006-1-1" and "2006.1.1";
+f1
+2006-01-01
+select f2 from t1 where f2 between "12:1:2" and "12:2:2";
+f2
+12:01:02
+select f2 from t1 where time(f2) between "12:1:2" and "12:2:2";
+f2
+12:01:02
+select f3 from t1 where f3 between "2006-1-1 12:1:1" and "2006-1-1 12:1:2";
+f3
+2006-01-01 12:01:01
+select f3 from t1 where timestamp(f3) between "2006-1-1 12:1:1" and "2006-1-1 12:1:2";
+f3
+2006-01-01 12:01:01
+select f1 from t1 where "2006-1-1" between f1 and f3;
+f1
+2006-01-01
+select f1 from t1 where "2006-1-1" between date(f1) and date(f3);
+f1
+2006-01-01
+select f1 from t1 where "2006-1-1" between f1 and 'zzz';
+f1
+Warnings:
+Warning 1292 Incorrect date value: 'zzz' for column 'f1' at row 1
+Warning 1292 Truncated incorrect DOUBLE value: 'zzz'
+Warning 1292 Truncated incorrect DOUBLE value: 'zzz'
+select f1 from t1 where makedate(2006,1) between date(f1) and date(f3);
+f1
+2006-01-01
+select f1 from t1 where makedate(2006,2) between date(f1) and date(f3);
+f1
+2006-01-02
+drop table t1;
+create table t1 select now() - now(), curtime() - curtime(),
+sec_to_time(1) + 0, from_unixtime(1) + 0;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `now() - now()` double(23,6) NOT NULL DEFAULT '0.000000',
+ `curtime() - curtime()` double(23,6) NOT NULL DEFAULT '0.000000',
+ `sec_to_time(1) + 0` double(23,6) DEFAULT NULL,
+ `from_unixtime(1) + 0` double(23,6) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
End of 4.1 tests
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2;
@@ -878,6 +933,7 @@ id day id day
1 2005-06-01 3 2005-07-15
3 2005-07-01 3 2005-07-15
DROP TABLE t1,t2;
+set time_zone= @@global.time_zone;
End of 5.0 tests
select date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND);
date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND)
diff --git a/mysql-test/r/func_timestamp.result b/mysql-test/r/func_timestamp.result
index d9912f08b72..495fedea9e6 100644
--- a/mysql-test/r/func_timestamp.result
+++ b/mysql-test/r/func_timestamp.result
@@ -1,4 +1,5 @@
drop table if exists t1;
+set time_zone="+03:00";
create table t1 (Zeit time, Tag tinyint not null, Monat tinyint not null,
Jahr smallint not null, index(Tag), index(Monat), index(Jahr) );
insert into t1 values ("09:26:00",16,9,1998),("09:26:00",16,9,1998);
@@ -9,3 +10,4 @@ Date Unix
1998-9-16 09:26:00 905927160
1998-9-16 09:26:00 905927160
drop table t1;
+set time_zone= @@global.time_zone;
diff --git a/mysql-test/r/grant_cache.result b/mysql-test/r/grant_cache.result
index 925a5918c1b..2c6840d77d0 100644
--- a/mysql-test/r/grant_cache.result
+++ b/mysql-test/r/grant_cache.result
@@ -60,7 +60,7 @@ Variable_name Value
Qcache_hits 0
show status like "Qcache_not_cached";
Variable_name Value
-Qcache_not_cached 5
+Qcache_not_cached 0
select "user1";
user1
user1
@@ -72,7 +72,7 @@ Variable_name Value
Qcache_hits 0
show status like "Qcache_not_cached";
Variable_name Value
-Qcache_not_cached 9
+Qcache_not_cached 1
select * from t1;
a b c
1 1 1
@@ -85,7 +85,7 @@ Variable_name Value
Qcache_hits 1
show status like "Qcache_not_cached";
Variable_name Value
-Qcache_not_cached 12
+Qcache_not_cached 1
select a from t1 ;
a
1
@@ -98,7 +98,7 @@ Variable_name Value
Qcache_hits 2
show status like "Qcache_not_cached";
Variable_name Value
-Qcache_not_cached 15
+Qcache_not_cached 1
select c from t1;
c
1
@@ -111,7 +111,7 @@ Variable_name Value
Qcache_hits 3
show status like "Qcache_not_cached";
Variable_name Value
-Qcache_not_cached 18
+Qcache_not_cached 1
show grants for current_user();
Grants for @localhost
GRANT USAGE ON *.* TO ''@'localhost'
@@ -144,7 +144,7 @@ Variable_name Value
Qcache_hits 7
show status like "Qcache_not_cached";
Variable_name Value
-Qcache_not_cached 22
+Qcache_not_cached 2
select "user3";
user3
user3
@@ -168,7 +168,7 @@ Variable_name Value
Qcache_hits 7
show status like "Qcache_not_cached";
Variable_name Value
-Qcache_not_cached 30
+Qcache_not_cached 7
select "user4";
user4
user4
@@ -198,7 +198,7 @@ Variable_name Value
Qcache_hits 8
show status like "Qcache_not_cached";
Variable_name Value
-Qcache_not_cached 34
+Qcache_not_cached 8
set names binary;
delete from mysql.user where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
delete from mysql.db where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
diff --git a/mysql-test/r/im_daemon_life_cycle.result b/mysql-test/r/im_daemon_life_cycle.result
index 29c9ea2047d..a5526a31384 100644
--- a/mysql-test/r/im_daemon_life_cycle.result
+++ b/mysql-test/r/im_daemon_life_cycle.result
@@ -1,3 +1,4 @@
+Success: the process has been started.
SHOW INSTANCES;
instance_name state
mysqld1 online
diff --git a/mysql-test/r/im_instance_conf.result b/mysql-test/r/im_instance_conf.result
index efda9439f38..f68fcca25a3 100644
--- a/mysql-test/r/im_instance_conf.result
+++ b/mysql-test/r/im_instance_conf.result
@@ -13,7 +13,9 @@ Variable_name Value
server_id 1
---> connection: default
-CREATE INSTANCE mysqld3;
+CREATE INSTANCE mysqld3
+server_id = 3,
+socket = "$MYSQL_TMP_DIR/mysqld_3.sock";
SHOW INSTANCES;
instance_name state
mysqld3 offline
@@ -22,6 +24,7 @@ mysqld1 online
--------------------------------------------------------------------
server_id = 1
server_id = 2
+server_id=3
--------------------------------------------------------------------
CREATE INSTANCE mysqld1;
ERROR HY000: Instance already exists
@@ -32,7 +35,10 @@ ERROR HY000: Instance already exists
--------------------------------------------------------------------
nonguarded
--------------------------------------------------------------------
-CREATE INSTANCE mysqld4 nonguarded;
+CREATE INSTANCE mysqld4
+nonguarded,
+server_id = 4,
+socket = "$MYSQL_TMP_DIR/mysqld_4.sock";
SHOW INSTANCES;
instance_name state
mysqld3 offline
@@ -46,7 +52,11 @@ nonguarded
--------------------------------------------------------------------
--------------------------------------------------------------------
--------------------------------------------------------------------
-CREATE INSTANCE mysqld5 test-A = 000, test-B = test;
+CREATE INSTANCE mysqld5
+test-A = 000,
+test-B = test,
+server_id = 5,
+socket = "$MYSQL_TMP_DIR/mysqld_5.sock";
SHOW INSTANCES;
instance_name state
mysqld1 online
@@ -61,7 +71,11 @@ test-B=test
--------------------------------------------------------------------
--------------------------------------------------------------------
--------------------------------------------------------------------
-CREATE INSTANCE mysqld6 test-C1 = 10 , test-C2 = 02 ;
+CREATE INSTANCE mysqld6
+test-C1 = 10 ,
+test-C2 = 02 ,
+server_id = 6,
+socket = "$MYSQL_TMP_DIR/mysqld_6.sock";
SHOW INSTANCES;
instance_name state
mysqld1 online
@@ -116,7 +130,11 @@ mysqld4 offline
--------------------------------------------------------------------
--------------------------------------------------------------------
--------------------------------------------------------------------
-CREATE INSTANCE mysqld9 test-1=" hello world ", test-2=' ';
+CREATE INSTANCE mysqld9
+test-1=" hello world ",
+test-2=' ',
+server_id = 9,
+socket = "$MYSQL_TMP_DIR/mysqld_9.sock";
SHOW INSTANCES;
instance_name state
mysqld1 online
@@ -126,56 +144,67 @@ mysqld6 offline
mysqld3 offline
mysqld4 offline
mysqld9 offline
-CREATE INSTANCE mysqld9a test-3='\b\babc\sdef';
+CREATE INSTANCE mysqld10
+test-3='\b\babc\sdef',
+server_id = 10,
+socket = "$MYSQL_TMP_DIR/mysqld_10.sock";
SHOW INSTANCES;
instance_name state
mysqld1 online
-mysqld9a offline
+mysqld9 offline
mysqld5 offline
mysqld6 offline
mysqld3 offline
mysqld4 offline
-mysqld9 offline
+mysqld10 offline
mysqld2 offline
-CREATE INSTANCE mysqld9b test-4='abc\tdef', test-5='abc\ndef';
+CREATE INSTANCE mysqld11
+test-4='abc\tdef',
+test-5='abc\ndef',
+server_id = 11,
+socket = "$MYSQL_TMP_DIR/mysqld_11.sock";
SHOW INSTANCES;
instance_name state
-mysqld9b offline
-mysqld9a offline
+mysqld1 online
+mysqld11 offline
mysqld5 offline
mysqld6 offline
mysqld3 offline
mysqld4 offline
-mysqld9 offline
+mysqld10 offline
mysqld2 offline
-mysqld1 online
-CREATE INSTANCE mysqld9c test-6="abc\rdef", test-7="abc\\def";
+mysqld9 offline
+CREATE INSTANCE mysqld12
+test-6="abc\rdef",
+test-7="abc\\def",
+server_id = 12,
+socket = "$MYSQL_TMP_DIR/mysqld_12.sock";
SHOW INSTANCES;
instance_name state
-mysqld9b offline
-mysqld6 offline
+mysqld1 online
+mysqld9 offline
mysqld5 offline
-mysqld9c offline
+mysqld6 offline
mysqld3 offline
mysqld4 offline
-mysqld9 offline
+mysqld10 offline
mysqld2 offline
-mysqld1 online
-mysqld9a offline
-CREATE INSTANCE mysqld10 test-bad=' \ ';
+mysqld12 offline
+mysqld11 offline
+CREATE INSTANCE mysqld13 test-bad=' \ ';
ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
SHOW INSTANCES;
instance_name state
-mysqld9b offline
-mysqld6 offline
+mysqld1 online
+mysqld9 offline
mysqld5 offline
-mysqld9c offline
+mysqld6 offline
mysqld3 offline
mysqld4 offline
-mysqld9 offline
+mysqld10 offline
mysqld2 offline
-mysqld1 online
-mysqld9a offline
+mysqld12 offline
+mysqld11 offline
--------------------------------------------------------------------
test-1= hello world
--------------------------------------------------------------------
diff --git a/mysql-test/r/im_life_cycle.result b/mysql-test/r/im_life_cycle.result
index 876fbb38eee..b6d3bb8361c 100644
--- a/mysql-test/r/im_life_cycle.result
+++ b/mysql-test/r/im_life_cycle.result
@@ -2,6 +2,7 @@
--------------------------------------------------------------------
-- 1.1.1.
--------------------------------------------------------------------
+Success: the process has been started.
SHOW INSTANCES;
instance_name state
mysqld1 online
@@ -11,10 +12,7 @@ mysqld2 offline
-- 1.1.2.
--------------------------------------------------------------------
START INSTANCE mysqld2;
-SHOW INSTANCES;
-instance_name state
-mysqld1 online
-mysqld2 online
+Success: the process has been started.
SHOW VARIABLES LIKE 'port';
Variable_name Value
port IM_MYSQLD2_PORT
@@ -23,16 +21,7 @@ port IM_MYSQLD2_PORT
-- 1.1.3.
--------------------------------------------------------------------
STOP INSTANCE mysqld2;
-SHOW INSTANCES;
-instance_name state
-mysqld1 online
-mysqld2 offline
-SHOW INSTANCE STATUS mysqld1;
-instance_name state version_number version mysqld_compatible
-mysqld1 online VERSION_NUMBER VERSION no
-SHOW INSTANCE STATUS mysqld2;
-instance_name state version_number version mysqld_compatible
-mysqld2 offline VERSION_NUMBER VERSION no
+Success: the process has been stopped.
--------------------------------------------------------------------
-- 1.1.4.
@@ -58,26 +47,19 @@ mysqld2 offline
Killing the process...
Sleeping...
Success: the process was restarted.
-
---------------------------------------------------------------------
--- 1.1.7.
---------------------------------------------------------------------
SHOW INSTANCES;
instance_name state
mysqld1 online
mysqld2 offline
+
+--------------------------------------------------------------------
+-- 1.1.7.
+--------------------------------------------------------------------
START INSTANCE mysqld2;
-SHOW INSTANCES;
-instance_name state
-mysqld1 online
-mysqld2 online
+Success: the process has been started.
Killing the process...
Sleeping...
Success: the process was killed.
-SHOW INSTANCES;
-instance_name state
-mysqld1 online
-mysqld2 offline
--------------------------------------------------------------------
-- 1.1.8.
diff --git a/mysql-test/r/im_options.result b/mysql-test/r/im_options.result
index 8039333b7d9..cb678581533 100644
--- a/mysql-test/r/im_options.result
+++ b/mysql-test/r/im_options.result
@@ -13,7 +13,10 @@ UNSET mysqld1.server_id;
ERROR HY000: The instance is active. Stop the instance first
SET mysqld1.server_id = 11;
ERROR HY000: The instance is active. Stop the instance first
-CREATE INSTANCE mysqld3 datadir = '/';
+CREATE INSTANCE mysqld3
+datadir = '/',
+server_id = 3,
+socket = "$MYSQL_TMP_DIR/mysqld_3.sock";
START INSTANCE mysqld3;
UNSET mysqld3.server_id;
ERROR HY000: The instance is active. Stop the instance first
@@ -101,12 +104,14 @@ ERROR HY000: Bad instance name. Check that the instance with such a name exists
--------------------------------------------------------------------
server_id = 1
server_id=2
+server_id=3
--------------------------------------------------------------------
UNSET mysqld2.server_id, mysqld3.server_id, mysqld1.ccc;
ERROR HY000: The instance is active. Stop the instance first
--------------------------------------------------------------------
server_id = 1
server_id=2
+server_id=3
--------------------------------------------------------------------
DROP INSTANCE mysqld3;
SET mysqld2.server_id=222;
diff --git a/mysql-test/r/im_utils.result b/mysql-test/r/im_utils.result
index ae8e03bf8ea..df20a7fb5c7 100644
--- a/mysql-test/r/im_utils.result
+++ b/mysql-test/r/im_utils.result
@@ -1,3 +1,4 @@
+Success: the process has been started.
SHOW INSTANCES;
instance_name state
mysqld1 online
@@ -42,7 +43,9 @@ skip-ndbcluster VALUE
nonguarded VALUE
log-output VALUE
START INSTANCE mysqld2;
+Success: the process has been started.
STOP INSTANCE mysqld2;
+Success: the process has been stopped.
SHOW mysqld1 LOG FILES;
Logfile Path File size
ERROR LOG PATH FILE_SIZE
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 603b7815d5b..308a92cb800 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -199,6 +199,8 @@ select table_name, column_name, privileges from information_schema.columns
where table_schema = 'mysqltest' and table_name = 'v1';
table_name column_name privileges
v1 c select
+explain select * from v1;
+ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
drop view v1, mysqltest.v1;
drop tables mysqltest.t4, mysqltest.t1, t2, t3, t5;
drop database mysqltest;
@@ -754,7 +756,7 @@ information_schema.columns
where data_type = 'longtext';
table_schema table_name column_name
information_schema COLUMNS COLUMN_TYPE
-information_schema EVENTS EVENT_BODY
+information_schema EVENTS EVENT_DEFINITION
information_schema EVENTS SQL_MODE
information_schema PARTITIONS PARTITION_EXPRESSION
information_schema PARTITIONS SUBPARTITION_EXPRESSION
@@ -912,58 +914,62 @@ grant select (f1) on mysqltest.t1 to user1@localhost;
grant select on mysqltest.t2 to user2@localhost;
grant select on mysqltest.* to user3@localhost;
grant select on *.* to user4@localhost;
-select * from information_schema.column_privileges;
+select * from information_schema.column_privileges order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
'user1'@'localhost' NULL mysqltest t1 f1 SELECT NO
-select * from information_schema.table_privileges;
+select * from information_schema.table_privileges order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
-select * from information_schema.schema_privileges;
+select * from information_schema.schema_privileges order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
-select * from information_schema.user_privileges;
+select * from information_schema.user_privileges order by grantee;
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
'user1'@'localhost' NULL USAGE NO
show grants;
Grants for user1@localhost
GRANT USAGE ON *.* TO 'user1'@'localhost'
GRANT SELECT (f1) ON `mysqltest`.`t1` TO 'user1'@'localhost'
-select * from information_schema.column_privileges;
+select * from information_schema.column_privileges order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
-select * from information_schema.table_privileges;
+select * from information_schema.table_privileges order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
'user2'@'localhost' NULL mysqltest t2 SELECT NO
-select * from information_schema.schema_privileges;
+select * from information_schema.schema_privileges order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
-select * from information_schema.user_privileges;
+select * from information_schema.user_privileges order by grantee;
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
'user2'@'localhost' NULL USAGE NO
show grants;
Grants for user2@localhost
GRANT USAGE ON *.* TO 'user2'@'localhost'
GRANT SELECT ON `mysqltest`.`t2` TO 'user2'@'localhost'
-select * from information_schema.column_privileges;
+select * from information_schema.column_privileges order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
-select * from information_schema.table_privileges;
+select * from information_schema.table_privileges order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
-select * from information_schema.schema_privileges;
+select * from information_schema.schema_privileges order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'user3'@'localhost' NULL mysqltest SELECT NO
-select * from information_schema.user_privileges;
+select * from information_schema.user_privileges order by grantee;
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
'user3'@'localhost' NULL USAGE NO
show grants;
Grants for user3@localhost
GRANT USAGE ON *.* TO 'user3'@'localhost'
GRANT SELECT ON `mysqltest`.* TO 'user3'@'localhost'
-select * from information_schema.column_privileges where grantee like '%user%';
+select * from information_schema.column_privileges where grantee like '%user%'
+order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
'user1'@'localhost' NULL mysqltest t1 f1 SELECT NO
-select * from information_schema.table_privileges where grantee like '%user%';
+select * from information_schema.table_privileges where grantee like '%user%'
+order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
'user2'@'localhost' NULL mysqltest t2 SELECT NO
-select * from information_schema.schema_privileges where grantee like '%user%';
+select * from information_schema.schema_privileges where grantee like '%user%'
+order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'user3'@'localhost' NULL mysqltest SELECT NO
-select * from information_schema.user_privileges where grantee like '%user%';
+select * from information_schema.user_privileges where grantee like '%user%'
+order by grantee;
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
'user1'@'localhost' NULL USAGE NO
'user2'@'localhost' NULL USAGE NO
@@ -1154,14 +1160,6 @@ routine_name
delete from proc where name='';
use test;
-select * from information_schema.engines WHERE ENGINE="MyISAM";
-ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
-MyISAM ENABLED Default engine as of MySQL 3.23 with great performance NO NO NO
-grant select on *.* to user3148@localhost;
-select user,db from information_schema.processlist;
-user db
-user3148 test
-drop user user3148@localhost;
grant select on test.* to mysqltest_1@localhost;
create table t1 (id int);
create view v1 as select * from t1;
@@ -1175,3 +1173,20 @@ NULL test v2 select 1 AS `1` NONE NO mysqltest_1@localhost DEFINER
drop view v1, v2;
drop table t1;
drop user mysqltest_1@localhost;
+set @a:= '.';
+create table t1(f1 char(5));
+create table t2(f1 char(5));
+select concat(@a, table_name), @a, table_name
+from information_schema.tables where table_schema = 'test';
+concat(@a, table_name) @a table_name
+.t1 . t1
+.t2 . t2
+drop table t1,t2;
+select * from information_schema.engines WHERE ENGINE="MyISAM";
+ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
+MyISAM ENABLED Default engine as of MySQL 3.23 with great performance NO NO NO
+grant select on *.* to user3148@localhost;
+select user,db from information_schema.processlist;
+user db
+user3148 test
+drop user user3148@localhost;
diff --git a/mysql-test/r/information_schema_part.result b/mysql-test/r/information_schema_part.result
index ef3ee19656b..2fd241ed4e4 100644
--- a/mysql-test/r/information_schema_part.result
+++ b/mysql-test/r/information_schema_part.result
@@ -119,7 +119,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) SUBPARTITION BY LINEAR HASH (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) SUBPARTITION BY LINEAR HASH (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM) */
select SUBPARTITION_METHOD FROM information_schema.partitions WHERE
table_schema="test" AND table_name="t1";
SUBPARTITION_METHOD
@@ -134,7 +134,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (a) (PARTITION p0 VALUES IN (10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53) ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) (PARTITION p0 VALUES IN (10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53) ENGINE = MyISAM) */
SELECT PARTITION_DESCRIPTION FROM information_schema.partitions WHERE
table_schema = "test" AND table_name = "t1";
PARTITION_DESCRIPTION
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index eca6d148567..72ae29185bc 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -1378,9 +1378,9 @@ insert into `t2`values ( 1 ) ;
create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb;
insert into `t3`values ( 1 ) ;
delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
ERROR 42S22: Unknown column 't1.id' in 'where clause'
drop table t3,t2,t1;
@@ -1392,7 +1392,7 @@ foreign key(pid) references t1(id) on delete cascade) engine=innodb;
insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),
(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);
delete from t1 where id=0;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `t1` (`id`) ON DELETE CASCADE)
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `t1` (`id`) ON DELETE CASCADE)
delete from t1 where id=15;
delete from t1 where id=0;
drop table t1;
@@ -2633,18 +2633,18 @@ v INT,
CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id)
) ENGINE=InnoDB;
INSERT INTO t2 VALUES(2);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
INSERT INTO t1 VALUES(1);
INSERT INTO t2 VALUES(1);
DELETE FROM t1 WHERE id = 1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
DROP TABLE t1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE t1;
SET FOREIGN_KEY_CHECKS=1;
INSERT INTO t2 VALUES(3);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
DROP TABLE t2;
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
insert into t1 values (1),(2);
@@ -2922,23 +2922,23 @@ create table t4(a int primary key,constraint foreign key(a)references t3(a)) row
insert into t1 values(1);
insert into t3 values(1);
insert into t2 values(2);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
insert into t4 values(2);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
insert into t2 values(1);
insert into t4 values(1);
update t1 set a=2;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
update t2 set a=2;
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
update t3 set a=2;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
update t4 set a=2;
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
truncate t1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
truncate t3;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
truncate t2;
truncate t4;
truncate t1;
@@ -2993,7 +2993,7 @@ create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=innod
create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42);
insert into t2 values(0x42);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
insert into t2 values(0x41);
select hex(s1) from t2;
hex(s1)
@@ -3003,11 +3003,11 @@ select hex(s1) from t2;
hex(s1)
4100
update t1 set s1=0x12 where a=1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
update t1 set s1=0x12345678 where a=1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
update t1 set s1=0x123457 where a=1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
update t1 set s1=0x1220 where a=1;
select hex(s1) from t2;
hex(s1)
@@ -3021,11 +3021,11 @@ select hex(s1) from t2;
hex(s1)
4200
delete from t1 where a=1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
delete from t1 where a=2;
update t2 set s1=0x4120;
delete from t1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
delete from t1 where a!=3;
select a,hex(s1) from t1;
a hex(s1)
@@ -3051,7 +3051,7 @@ hex(s1)
12
delete from t1 where a=1;
delete from t1 where a=2;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
select a,hex(s1) from t1;
a hex(s1)
2 12
diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result
index d79f957559c..d5b52feb06c 100644
--- a/mysql-test/r/innodb_mysql.result
+++ b/mysql-test/r/innodb_mysql.result
@@ -1,4 +1,10 @@
drop table if exists t1,t2,t1m,t1i,t2m,t2i,t4;
+create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
+character set utf8 collate utf8_general_ci;
+Warnings:
+Warning 1071 Specified key was too long; max key length is 765 bytes
+insert into t1 values('aaa');
+drop table t1;
create table t1 (
c_id int(11) not null default '0',
org_id int(11) default null,
diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result
index 18bd6d7e796..235c3f61fe9 100644
--- a/mysql-test/r/insert.result
+++ b/mysql-test/r/insert.result
@@ -321,3 +321,35 @@ ERROR 42000: Column 'b' specified twice
INSERT INTO t1 (b,b) SELECT 0,0 ON DUPLICATE KEY UPDATE a = a + VALUES (a);
ERROR 42000: Column 'b' specified twice
drop table t1;
+create table t1 (n int);
+create view v1 as select * from t1;
+insert delayed into v1 values (1);
+ERROR HY000: 'test.v1' is not BASE TABLE
+drop table t1;
+drop view v1;
+create table t1 (id int primary key, data int);
+insert into t1 values (1, 1), (2, 2), (3, 3);
+select row_count();
+row_count()
+3
+insert ignore into t1 values (1, 1);
+select row_count();
+row_count()
+0
+replace into t1 values (1, 11);
+select row_count();
+row_count()
+2
+replace into t1 values (4, 4);
+select row_count();
+row_count()
+1
+insert into t1 values (2, 2) on duplicate key update data= data + 10;
+select row_count();
+row_count()
+2
+insert into t1 values (5, 5) on duplicate key update data= data + 10;
+select row_count();
+row_count()
+1
+drop table t1;
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index 772179d758a..390e76caf2c 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -686,3 +686,12 @@ ERROR 42S22: Unknown column 'z' in 'field list'
insert into t1(x,y) select x,z from t2 on duplicate key update x=values(t2.x);
ERROR 42S22: Unknown column 't2.x' in 'field list'
drop table t1,t2;
+CREATE TABLE t1 (a int PRIMARY KEY);
+INSERT INTO t1 values (1), (2);
+INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1;
+DROP TABLE t1;
+CREATE TABLE t1 (x int, y int);
+CREATE TABLE t2 (z int, y int);
+CREATE TABLE t3 (a int, b int);
+INSERT INTO t3 (SELECT x, y FROM t1 JOIN t2 USING (y) WHERE z = 1);
+DROP TABLE IF EXISTS t1,t2,t3;
diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result
index 86288caf398..8ad6f344c4f 100644
--- a/mysql-test/r/join.result
+++ b/mysql-test/r/join.result
@@ -700,8 +700,8 @@ ERROR 42S22: Unknown column 't1.b' in 'on clause'
select * from information_schema.statistics join information_schema.columns
using(table_name,column_name) where table_name='user';
TABLE_NAME COLUMN_NAME TABLE_CATALOG TABLE_SCHEMA NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
-user Host NULL mysql 0 mysql PRIMARY 1 A NULL NULL NULL BTREE NULL mysql 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
-user User NULL mysql 0 mysql PRIMARY 2 A 5 NULL NULL BTREE NULL mysql 2 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
+user Host NULL mysql 0 mysql PRIMARY 1 A NULL NULL NULL BTREE NULL mysql 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI #
+user User NULL mysql 0 mysql PRIMARY 2 A 5 NULL NULL BTREE NULL mysql 2 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI #
drop table t1;
drop table t2;
drop table t3;
@@ -744,3 +744,23 @@ select a2 from ((t1 natural join t2) join t3 on b=c1) natural join t4;
a2
1
drop table t1,t2,t3,t4;
+create table t1 (c int, b int);
+create table t2 (a int, b int);
+create table t3 (b int, c int);
+create table t4 (y int, c int);
+create table t5 (y int, z int);
+insert into t1 values (3,2);
+insert into t2 values (1,2);
+insert into t3 values (2,3);
+insert into t4 values (1,3);
+insert into t5 values (1,4);
+prepare stmt1 from "select * from ((t3 natural join (t1 natural join t2))
+natural join t4) natural join t5";
+execute stmt1;
+y c b a z
+1 3 2 1 4
+select * from ((t3 natural join (t1 natural join t2)) natural join t4)
+natural join t5;
+y c b a z
+1 3 2 1 4
+drop table t1, t2, t3, t4, t5;
diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result
index 68174774531..ea8d4338d08 100644
--- a/mysql-test/r/key.result
+++ b/mysql-test/r/key.result
@@ -330,6 +330,24 @@ alter table t1 add key (c1,c1,c2);
ERROR 42S21: Duplicate column name 'c1'
drop table t1;
create table t1 (
+i1 INT NOT NULL,
+i2 INT NOT NULL,
+UNIQUE i1idx (i1),
+UNIQUE i2idx (i2));
+desc t1;
+Field Type Null Key Default Extra
+i1 int(11) NO PRI
+i2 int(11) NO UNI
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i1` int(11) NOT NULL,
+ `i2` int(11) NOT NULL,
+ UNIQUE KEY `i1idx` (`i1`),
+ UNIQUE KEY `i2idx` (`i2`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (
c1 int,
c2 varchar(20) not null,
primary key (c1),
diff --git a/mysql-test/r/lock_multi.result b/mysql-test/r/lock_multi.result
index 6d31d01d154..f8cf539bd02 100644
--- a/mysql-test/r/lock_multi.result
+++ b/mysql-test/r/lock_multi.result
@@ -50,6 +50,22 @@ Field Type Null Key Default Extra
a int(11) YES NULL
unlock tables;
drop table t1;
+use mysql;
+LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
+FLUSH TABLES;
+use mysql;
+ SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
+OPTIMIZE TABLES columns_priv, db, host, user;
+Table Op Msg_type Msg_text
+mysql.columns_priv optimize status OK
+mysql.db optimize status OK
+mysql.host optimize status OK
+mysql.user optimize status OK
+UNLOCK TABLES;
+Select_priv
+N
+use test;
+use test;
CREATE DATABASE mysqltest_1;
FLUSH TABLES WITH READ LOCK;
DROP DATABASE mysqltest_1;
@@ -58,6 +74,12 @@ ERROR HY000: Can't execute the query because you have a conflicting read lock
UNLOCK TABLES;
DROP DATABASE mysqltest_1;
ERROR HY000: Can't drop database 'mysqltest_1'; database doesn't exist
+create table t1 (f1 int(12) unsigned not null auto_increment, primary key(f1)) engine=innodb;
+lock tables t1 write;
+ alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
+ alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
+unlock tables;
+drop table t1;
use mysql;
LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
FLUSH TABLES;
diff --git a/mysql-test/r/log_state.result b/mysql-test/r/log_state.result
new file mode 100644
index 00000000000..43735243787
--- /dev/null
+++ b/mysql-test/r/log_state.result
@@ -0,0 +1,155 @@
+set global general_log= OFF;
+truncate table mysql.general_log;
+truncate table mysql.slow_log;
+show global variables
+where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
+Variable_name = 'general_log' or Variable_name = 'slow_query_log';
+Variable_name Value
+general_log OFF
+log OFF
+log_slow_queries OFF
+slow_query_log OFF
+flush logs;
+set global general_log= ON;
+create table t1(f1 int);
+select * from mysql.general_log;
+event_time user_host thread_id server_id command_type argument
+TIMESTAMP USER_HOST # 1 Query create table t1(f1 int)
+TIMESTAMP USER_HOST # 1 Query select * from mysql.general_log
+set global general_log= OFF;
+drop table t1;
+select * from mysql.general_log;
+event_time user_host thread_id server_id command_type argument
+TIMESTAMP USER_HOST # 1 Query create table t1(f1 int)
+TIMESTAMP USER_HOST # 1 Query select * from mysql.general_log
+TIMESTAMP USER_HOST # 1 Query set global general_log= OFF
+set global general_log= ON;
+flush logs;
+show global variables
+where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
+Variable_name = 'general_log' or Variable_name = 'slow_query_log';
+Variable_name Value
+general_log ON
+log ON
+log_slow_queries OFF
+slow_query_log OFF
+set session long_query_time=1;
+select sleep(2);
+sleep(2)
+0
+select * from mysql.slow_log;
+start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text
+set global slow_query_log= ON;
+set session long_query_time=1;
+select sleep(2);
+sleep(2)
+0
+select * from mysql.slow_log;
+start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text
+TIMESTAMP USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 select sleep(2)
+show global variables
+where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
+Variable_name = 'general_log' or Variable_name = 'slow_query_log';
+Variable_name Value
+general_log ON
+log ON
+log_slow_queries ON
+slow_query_log ON
+set global general_log= ON;
+set global general_log= OFF;
+set global general_log= OFF;
+set global slow_query_log= ON;
+set global slow_query_log= OFF;
+set global slow_query_log= OFF;
+set global general_log= ON;
+truncate table mysql.general_log;
+create table t1(f1 int);
+drop table t1;
+select * from mysql.general_log;
+event_time user_host thread_id server_id command_type argument
+TIMESTAMP USER_HOST # 1 Query create table t1(f1 int)
+TIMESTAMP USER_HOST # 1 Query drop table t1
+TIMESTAMP USER_HOST # 1 Query select * from mysql.general_log
+set global general_log= OFF;
+truncate table mysql.general_log;
+select * from mysql.general_log;
+event_time user_host thread_id server_id command_type argument
+set global general_log= ON;
+show global variables
+where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
+Variable_name = 'general_log' or Variable_name = 'slow_query_log';
+Variable_name Value
+general_log ON
+log ON
+log_slow_queries OFF
+slow_query_log OFF
+show variables like 'general_log_file';
+Variable_name Value
+general_log_file #
+show variables like 'slow_query_log_file';
+Variable_name Value
+slow_query_log_file #
+show variables like 'log_output';
+Variable_name Value
+log_output FILE,TABLE
+set global general_log_file='/not exiting path/log.master';
+ERROR 42000: Variable 'general_log_file' can't be set to the value of '/not exiting path/log.master'
+set global general_log_file='/tmp';
+ERROR 42000: Variable 'general_log_file' can't be set to the value of '/tmp'
+set global general_log_file='';
+ERROR 42000: Variable 'general_log_file' can't be set to the value of ''
+show variables like 'general_log_file';
+Variable_name Value
+general_log_file #
+set global general_log= OFF;
+set global general_log_file='/tmp/log.master';
+set global general_log= ON;
+create table t1(f1 int);
+drop table t1;
+set global general_log= OFF;
+set global general_log_file=default;
+set global general_log= ON;
+create table t1(f1 int);
+drop table t1;
+show variables like 'general_log_file';
+Variable_name Value
+general_log_file #
+show variables like 'slow_query_log_file';
+Variable_name Value
+slow_query_log_file #
+set global general_log= default;
+set global slow_query_log= default;
+set global general_log_file= default;
+set global slow_query_log_file= default;
+show variables like 'general_log';
+Variable_name Value
+general_log OFF
+show variables like 'slow_query_log';
+Variable_name Value
+slow_query_log OFF
+set global general_log=ON;
+set global log_output=default;
+show variables like 'log_output';
+Variable_name Value
+log_output TABLE
+set global general_log=OFF;
+set global log_output=FILE;
+truncate table mysql.general_log;
+show variables like 'log_output';
+Variable_name Value
+log_output FILE
+set global general_log=ON;
+create table t1(f1 int);
+select * from mysql.general_log;
+event_time user_host thread_id server_id command_type argument
+set global general_log=OFF;
+set global log_output="FILE,TABLE";
+show variables like 'log_output';
+Variable_name Value
+log_output FILE,TABLE
+set global general_log=ON;
+drop table t1;
+select * from mysql.general_log;
+event_time user_host thread_id server_id command_type argument
+TIMESTAMP USER_HOST # 1 Query drop table t1
+TIMESTAMP USER_HOST # 1 Query select * from mysql.general_log
diff --git a/mysql-test/r/lowercase_table2.result b/mysql-test/r/lowercase_table2.result
index a55ebaf7766..51c2ac0faf5 100644
--- a/mysql-test/r/lowercase_table2.result
+++ b/mysql-test/r/lowercase_table2.result
@@ -165,3 +165,12 @@ create table t1Aa (col1 int);
select t1Aa.col1 from t1aA,t2Aa where t1Aa.col1 = t2aA.col1;
col1
drop table t2aA, t1Aa;
+create database mysqltest_LC2;
+use mysqltest_LC2;
+create table myUC (i int);
+select TABLE_SCHEMA,TABLE_NAME FROM information_schema.TABLES
+where TABLE_SCHEMA ='mysqltest_LC2';
+TABLE_SCHEMA TABLE_NAME
+mysqltest_LC2 myUC
+use test;
+drop database mysqltest_LC2;
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index 2f5f382028a..38ade38747e 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -779,3 +779,9 @@ insert into t1 values ("Monty"),("WAX"),("Walrus");
alter table t1 engine=MERGE;
ERROR HY000: Table storage engine for 't1' doesn't have this option
drop table t1;
+create table t1 (b bit(1));
+create table t2 (b bit(1));
+create table tm (b bit(1)) engine = merge union = (t1,t2);
+select * from tm;
+b
+drop table tm, t1, t2;
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 6fdd105fd6c..8791b8cc080 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -476,6 +476,11 @@ aclid bigint, index idx_acl(aclid)
insert into t2 values(1,null);
delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1';
drop table t1, t2;
+create table t1(a int);
+create table t2(a int);
+delete from t1,t2 using t1,t2 where t1.a=(select a from t1);
+ERROR HY000: You can't specify target table 't1' for update in FROM clause
+drop table t1, t2;
create table t1 ( c char(8) not null ) engine=innodb;
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index 3226351f966..bb62f2a063b 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -747,6 +747,27 @@ select count(id1) from t1 where id2 = 10;
count(id1)
5
drop table t1;
+CREATE TABLE t1(a TINYINT, KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES(1);
+SELECT MAX(a) FROM t1 IGNORE INDEX(a);
+MAX(a)
+1
+ALTER TABLE t1 DISABLE KEYS;
+SELECT MAX(a) FROM t1;
+MAX(a)
+1
+SELECT MAX(a) FROM t1 IGNORE INDEX(a);
+MAX(a)
+1
+DROP TABLE t1;
+CREATE TABLE t1(a CHAR(9), b VARCHAR(7)) ENGINE=MyISAM;
+INSERT INTO t1(a) VALUES('xxxxxxxxx'),('xxxxxxxxx');
+UPDATE t1 AS ta1,t1 AS ta2 SET ta1.b='aaaaaa',ta2.b='bbbbbb';
+SELECT * FROM t1;
+a b
+xxxxxxxxx bbbbbb
+xxxxxxxxx bbbbbb
+DROP TABLE t1;
set storage_engine=MyISAM;
drop table if exists t1,t2,t3;
--- Testing varchar ---
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 7075e7dec6d..4331d7da977 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -1459,7 +1459,6 @@ UNLOCK TABLES;
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
-/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 CREATE TABLE `v2` (
`a` varchar(30)
) */;
@@ -1871,7 +1870,6 @@ UNLOCK TABLES;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `v1`;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
-/*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 CREATE TABLE `v1` (
`a` int(11)
) */;
@@ -1929,7 +1927,6 @@ UNLOCK TABLES;
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
-/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 CREATE TABLE `v2` (
`a` varchar(30)
) */;
@@ -2022,7 +2019,6 @@ UNLOCK TABLES;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `v1`;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
-/*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 CREATE TABLE `v1` (
`a` int(11),
`b` int(11),
@@ -2030,13 +2026,11 @@ DROP TABLE IF EXISTS `v1`;
) */;
DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
-/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 CREATE TABLE `v2` (
`a` int(11)
) */;
DROP TABLE IF EXISTS `v3`;
/*!50001 DROP VIEW IF EXISTS `v3`*/;
-/*!50001 DROP TABLE IF EXISTS `v3`*/;
/*!50001 CREATE TABLE `v3` (
`a` int(11),
`b` int(11),
@@ -2597,7 +2591,6 @@ UNLOCK TABLES;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `v0`;
/*!50001 DROP VIEW IF EXISTS `v0`*/;
-/*!50001 DROP TABLE IF EXISTS `v0`*/;
/*!50001 CREATE TABLE `v0` (
`a` int(11),
`b` varchar(32),
@@ -2605,7 +2598,6 @@ DROP TABLE IF EXISTS `v0`;
) */;
DROP TABLE IF EXISTS `v1`;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
-/*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 CREATE TABLE `v1` (
`a` int(11),
`b` varchar(32),
@@ -2613,16 +2605,11 @@ DROP TABLE IF EXISTS `v1`;
) */;
DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
-/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 CREATE TABLE `v2` (
`a` int(11),
`b` varchar(32),
`c` varchar(32)
) */;
-
-CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */;
-
-USE `test`;
/*!50001 DROP TABLE IF EXISTS `v0`*/;
/*!50001 DROP VIEW IF EXISTS `v0`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
@@ -2795,6 +2782,25 @@ end AFTER # root@localhost
drop trigger tr1;
drop trigger tr2;
drop table t1, t2;
+create table t (qty int, price int);
+insert into t values(3, 50);
+insert into t values(5, 51);
+create view v1 as select qty, price, qty*price as value from t;
+create view v2 as select qty from v1;
+mysqldump {
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50001 VIEW `v1` AS select `t`.`qty` AS `qty`,`t`.`price` AS `price`,(`t`.`qty` * `t`.`price`) AS `value` from `t` */;
+
+} mysqldump {
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50001 VIEW `v2` AS select `v1`.`qty` AS `qty` from `v1` */;
+
+} mysqldump
+drop view v1;
+drop view v2;
+drop table t;
/*!50003 CREATE FUNCTION `f`() RETURNS bigint(20)
return 42 */|
/*!50003 CREATE PROCEDURE `p`()
@@ -2809,6 +2815,15 @@ p CREATE DEFINER=`root`@`localhost` PROCEDURE `p`()
select 42
drop function f;
drop procedure p;
+create table t1 ( id serial );
+create view v1 as select * from t1;
+drop table t1;
+mysqldump {
+
+-- failed on view `v1`: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`id` AS `id` from `t1`
+
+} mysqldump
+drop view v1;
create table t1 (a text , b text);
create table t2 (a text , b text);
insert t1 values ("Duck, Duck", "goose");
@@ -3021,3 +3036,62 @@ third ee3 root@localhost ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLE
drop database third;
set time_zone = 'SYSTEM';
use test;
+create database mysqldump_test_db;
+use mysqldump_test_db;
+create table t1 (id int);
+create view v1 as select * from t1;
+insert into t1 values (1232131);
+insert into t1 values (4711);
+insert into t1 values (3231);
+insert into t1 values (0815);
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+/*!40000 DROP DATABASE IF EXISTS `mysqldump_test_db`*/;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_test_db` /*!40100 DEFAULT CHARACTER SET latin1 */;
+
+USE `mysqldump_test_db`;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `id` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES (1232131),(4711),(3231),(815);
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+DROP TABLE IF EXISTS `v1`;
+/*!50001 DROP VIEW IF EXISTS `v1`*/;
+/*!50001 CREATE TABLE `v1` (
+ `id` int(11)
+) */;
+/*!50001 DROP TABLE IF EXISTS `v1`*/;
+/*!50001 DROP VIEW IF EXISTS `v1`*/;
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50001 VIEW `v1` AS select `t1`.`id` AS `id` from `t1` */;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+drop view v1;
+drop table t1;
+drop database mysqldump_test_db;
diff --git a/mysql-test/r/ndb_alter_table.result b/mysql-test/r/ndb_alter_table.result
index e506973f347..7facb5fa286 100644
--- a/mysql-test/r/ndb_alter_table.result
+++ b/mysql-test/r/ndb_alter_table.result
@@ -320,8 +320,13 @@ LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
set @t1_id = (select id from ndb_show_tables where name like '%t1%');
truncate ndb_show_tables;
alter table t1 change tiny new_tiny tinyint(4) DEFAULT '0' NOT NULL;
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+select 'no_copy' from ndb_show_tables where id = @t1_id and name like '%t1%';
+no_copy
+set @t1_id = (select id from ndb_show_tables where name like '%t1%');
+truncate ndb_show_tables;
create index i1 on t1(medium);
-alter table t1 add index i2(long_int);
+alter table t1 add index i2(new_tiny);
drop index i1 on t1;
LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
select 'no_copy' from ndb_show_tables where id = @t1_id and name like '%t1%';
diff --git a/mysql-test/r/ndb_binlog_ignore_db.result b/mysql-test/r/ndb_binlog_ignore_db.result
index 2f411fcd03d..8dc2c1ff1f8 100644
--- a/mysql-test/r/ndb_binlog_ignore_db.result
+++ b/mysql-test/r/ndb_binlog_ignore_db.result
@@ -7,6 +7,4 @@ insert into t1 values (1, 1);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; drop table if exists t1
-master-bin.000001 # Table_map # # table_id: # (mysql.proc)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
drop database mysqltest;
diff --git a/mysql-test/r/ndb_binlog_multi.result b/mysql-test/r/ndb_binlog_multi.result
index be5dc695d24..119174039f9 100644
--- a/mysql-test/r/ndb_binlog_multi.result
+++ b/mysql-test/r/ndb_binlog_multi.result
@@ -1,5 +1,7 @@
-drop table if exists t1,t2;
-drop table if exists t1,t2;
+drop table if exists t1,t2,t3;
+drop table if exists t1,t2,t3;
+CREATE TABLE t3 (dummy INT PRIMARY KEY) ENGINE = NDB;
+DROP TABLE t3;
reset master;
reset master;
CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB;
diff --git a/mysql-test/r/ndb_blob_partition.result b/mysql-test/r/ndb_blob_partition.result
new file mode 100644
index 00000000000..b08a91f0cdd
--- /dev/null
+++ b/mysql-test/r/ndb_blob_partition.result
@@ -0,0 +1,104 @@
+drop table if exists t1;
+create table t1 (
+a mediumint not null,
+b text not null,
+c int not null,
+d longblob,
+primary key using hash (a,c),
+unique key (c)
+)
+engine=ndb
+partition by range (c)
+partitions 3
+( partition p1 values less than (200),
+partition p2 values less than (300),
+partition p3 values less than (400));
+insert into t1 values (1, @v1, 101, @v2);
+insert into t1 values (1, @v2, 102, @v3);
+insert into t1 values (1, @v3, 103, @v4);
+insert into t1 values (2, @v4, 201, @v5);
+insert into t1 values (2, @v5, 202, @v6);
+insert into t1 values (2, @v6, 203, @v7);
+insert into t1 values (3, @v7, 301, @v8);
+insert into t1 values (3, @v8, 302, @v9);
+insert into t1 values (3, @v9, 303, @v1);
+select a, sha1(b), c, sha1(d) from t1 order by a;
+a sha1(b) c sha1(d)
+1 1d42dd9090cf78314a06665d4ea938c35cc760f4 101 10d3c783026b310218d10b7188da96a2401648c6
+1 10d3c783026b310218d10b7188da96a2401648c6 102 a33549d9844092289a58ac348dd59f09fc28406a
+1 a33549d9844092289a58ac348dd59f09fc28406a 103 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
+2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 201 70fc9a7d08beebc522258bfb02000a30c77a8f1d
+2 70fc9a7d08beebc522258bfb02000a30c77a8f1d 202 090565c580809efed3d369481a4bbb168b20713e
+2 090565c580809efed3d369481a4bbb168b20713e 203 1e0070bec426871a46291de27b9bd6e4255ab4e5
+3 1e0070bec426871a46291de27b9bd6e4255ab4e5 301 acbaba01bc2e682f015f40e79d9cbe475db3002e
+3 acbaba01bc2e682f015f40e79d9cbe475db3002e 302 9ee30d99162574f79c66ae95cdf132dcf9cbc259
+3 9ee30d99162574f79c66ae95cdf132dcf9cbc259 303 1d42dd9090cf78314a06665d4ea938c35cc760f4
+select a, sha1(b), c, sha1(d) from t1 where a = 1 and c = 101;
+a sha1(b) c sha1(d)
+1 1d42dd9090cf78314a06665d4ea938c35cc760f4 101 10d3c783026b310218d10b7188da96a2401648c6
+select a, sha1(b), c, sha1(d) from t1 where a = 2 and c = 201;
+a sha1(b) c sha1(d)
+2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 201 70fc9a7d08beebc522258bfb02000a30c77a8f1d
+select a, sha1(b), c, sha1(d) from t1 where a = 3 and c = 301;
+a sha1(b) c sha1(d)
+3 1e0070bec426871a46291de27b9bd6e4255ab4e5 301 acbaba01bc2e682f015f40e79d9cbe475db3002e
+update t1 set b = @v3, d = @v4 where a = 1 and c = 102;
+update t1 set b = @v6, d = @v7 where a = 2 and c = 202;
+update t1 set b = @v9, d = @v1 where a = 3 and c = 302;
+select a, sha1(b), c, sha1(d) from t1 order by a;
+a sha1(b) c sha1(d)
+1 1d42dd9090cf78314a06665d4ea938c35cc760f4 101 10d3c783026b310218d10b7188da96a2401648c6
+1 a33549d9844092289a58ac348dd59f09fc28406a 102 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
+1 a33549d9844092289a58ac348dd59f09fc28406a 103 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
+2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 201 70fc9a7d08beebc522258bfb02000a30c77a8f1d
+2 090565c580809efed3d369481a4bbb168b20713e 202 1e0070bec426871a46291de27b9bd6e4255ab4e5
+2 090565c580809efed3d369481a4bbb168b20713e 203 1e0070bec426871a46291de27b9bd6e4255ab4e5
+3 1e0070bec426871a46291de27b9bd6e4255ab4e5 301 acbaba01bc2e682f015f40e79d9cbe475db3002e
+3 9ee30d99162574f79c66ae95cdf132dcf9cbc259 302 1d42dd9090cf78314a06665d4ea938c35cc760f4
+3 9ee30d99162574f79c66ae95cdf132dcf9cbc259 303 1d42dd9090cf78314a06665d4ea938c35cc760f4
+update t1 set b = @v4, d = @v5 where c = 103;
+update t1 set b = @v7, d = @v8 where c = 203;
+update t1 set b = @v1, d = @v2 where c = 303;
+select a, sha1(b), c, sha1(d) from t1 order by a;
+a sha1(b) c sha1(d)
+1 1d42dd9090cf78314a06665d4ea938c35cc760f4 101 10d3c783026b310218d10b7188da96a2401648c6
+1 a33549d9844092289a58ac348dd59f09fc28406a 102 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
+1 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 103 70fc9a7d08beebc522258bfb02000a30c77a8f1d
+2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 201 70fc9a7d08beebc522258bfb02000a30c77a8f1d
+2 090565c580809efed3d369481a4bbb168b20713e 202 1e0070bec426871a46291de27b9bd6e4255ab4e5
+2 1e0070bec426871a46291de27b9bd6e4255ab4e5 203 acbaba01bc2e682f015f40e79d9cbe475db3002e
+3 1e0070bec426871a46291de27b9bd6e4255ab4e5 301 acbaba01bc2e682f015f40e79d9cbe475db3002e
+3 9ee30d99162574f79c66ae95cdf132dcf9cbc259 302 1d42dd9090cf78314a06665d4ea938c35cc760f4
+3 1d42dd9090cf78314a06665d4ea938c35cc760f4 303 10d3c783026b310218d10b7188da96a2401648c6
+update t1 set b = @v5, d = @v6;
+select a, sha1(b), c, sha1(d) from t1 order by a;
+a sha1(b) c sha1(d)
+1 70fc9a7d08beebc522258bfb02000a30c77a8f1d 101 090565c580809efed3d369481a4bbb168b20713e
+1 70fc9a7d08beebc522258bfb02000a30c77a8f1d 102 090565c580809efed3d369481a4bbb168b20713e
+1 70fc9a7d08beebc522258bfb02000a30c77a8f1d 103 090565c580809efed3d369481a4bbb168b20713e
+2 70fc9a7d08beebc522258bfb02000a30c77a8f1d 201 090565c580809efed3d369481a4bbb168b20713e
+2 70fc9a7d08beebc522258bfb02000a30c77a8f1d 202 090565c580809efed3d369481a4bbb168b20713e
+2 70fc9a7d08beebc522258bfb02000a30c77a8f1d 203 090565c580809efed3d369481a4bbb168b20713e
+3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 301 090565c580809efed3d369481a4bbb168b20713e
+3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 302 090565c580809efed3d369481a4bbb168b20713e
+3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 303 090565c580809efed3d369481a4bbb168b20713e
+update t1 set b = @v1, d = @v2 where 100 < c and c < 200;
+update t1 set b = @v4, d = @v5 where 200 < c and c < 300;
+update t1 set b = @v7, d = @v8 where 300 < c and c < 400;
+select a, sha1(b), c, sha1(d) from t1 order by a;
+a sha1(b) c sha1(d)
+1 1d42dd9090cf78314a06665d4ea938c35cc760f4 101 10d3c783026b310218d10b7188da96a2401648c6
+1 1d42dd9090cf78314a06665d4ea938c35cc760f4 102 10d3c783026b310218d10b7188da96a2401648c6
+1 1d42dd9090cf78314a06665d4ea938c35cc760f4 103 10d3c783026b310218d10b7188da96a2401648c6
+2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 201 70fc9a7d08beebc522258bfb02000a30c77a8f1d
+2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 202 70fc9a7d08beebc522258bfb02000a30c77a8f1d
+2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 203 70fc9a7d08beebc522258bfb02000a30c77a8f1d
+3 1e0070bec426871a46291de27b9bd6e4255ab4e5 301 acbaba01bc2e682f015f40e79d9cbe475db3002e
+3 1e0070bec426871a46291de27b9bd6e4255ab4e5 302 acbaba01bc2e682f015f40e79d9cbe475db3002e
+3 1e0070bec426871a46291de27b9bd6e4255ab4e5 303 acbaba01bc2e682f015f40e79d9cbe475db3002e
+delete from t1 where a = 1 and c = 101;
+delete from t1 where c = 102;
+delete from t1;
+select a, sha1(b), c, sha1(d) from t1 order by a;
+a sha1(b) c sha1(d)
+drop table t1;
diff --git a/mysql-test/r/ndb_condition_pushdown.result b/mysql-test/r/ndb_condition_pushdown.result
index 140324a21d8..2fc1e8f3127 100644
--- a/mysql-test/r/ndb_condition_pushdown.result
+++ b/mysql-test/r/ndb_condition_pushdown.result
@@ -1842,5 +1842,29 @@ a b
select * from t1 where b like 'abc' or b like 'abc';
a b
3 abc
+drop table t1;
+create table t1 ( fname varchar(255), lname varchar(255) )
+engine=ndbcluster;
+insert into t1 values ("Young","Foo");
+set engine_condition_pushdown = 0;
+SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
+fname lname
+Young Foo
+set engine_condition_pushdown = 1;
+SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
+fname lname
+Young Foo
+insert into t1 values ("aaa", "aaa");
+insert into t1 values ("bbb", "bbb");
+insert into t1 values ("ccc", "ccc");
+insert into t1 values ("ddd", "ddd");
+set engine_condition_pushdown = 0;
+SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
+fname lname
+Young Foo
+set engine_condition_pushdown = 1;
+SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
+fname lname
+Young Foo
set engine_condition_pushdown = @old_ecpd;
DROP TABLE t1,t2,t3,t4,t5;
diff --git a/mysql-test/r/ndb_dd_backuprestore.result b/mysql-test/r/ndb_dd_backuprestore.result
index 33edf6783e6..cb6c62b16da 100644
--- a/mysql-test/r/ndb_dd_backuprestore.result
+++ b/mysql-test/r/ndb_dd_backuprestore.result
@@ -155,10 +155,333 @@ DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
DROP TABLE test.t4;
+**** Test 3 Adding partition Test backup and restore ****
+CREATE TABLESPACE table_space2
+ADD DATAFILE './table_space2/datafile.dat'
+USE LOGFILE GROUP log_group1
+INITIAL_SIZE 12M
+ENGINE NDB;
+CREATE TABLE test.t1 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(150) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space1 STORAGE DISK ENGINE=NDB PARTITION BY HASH(c3) PARTITIONS 4;
+CREATE TABLE test.t4 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(180) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY HASH(c3) PARTITIONS 2;
+CREATE TABLE test.t2 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space2 STORAGE DISK ENGINE=NDB PARTITION BY KEY(c3) (PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
+CREATE TABLE test.t5 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY KEY(pk1) (PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
+CREATE TABLE test.t3 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(202) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space2 STORAGE DISK ENGINE=NDB PARTITION BY RANGE (c3) PARTITIONS 3 (PARTITION x1 VALUES LESS THAN (105), PARTITION x2 VALUES LESS THAN (333), PARTITION x3 VALUES LESS THAN (720));
+CREATE TABLE test.t6 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(220) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY RANGE (pk1) PARTITIONS 2 (PARTITION x1 VALUES LESS THAN (333), PARTITION x2 VALUES LESS THAN (720));
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(150) NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */
+SHOW CREATE TABLE test.t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` text NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
+SHOW CREATE TABLE test.t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(202) NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */
+SHOW CREATE TABLE test.t4;
+Table Create Table
+t4 CREATE TABLE `t4` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(180) NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 2 */
+SHOW CREATE TABLE test.t5;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` text NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (pk1) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
+SHOW CREATE TABLE test.t6;
+Table Create Table
+t6 CREATE TABLE `t6` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(220) NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (pk1) (PARTITION x1 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (720) ENGINE = ndbcluster) */
+SELECT * FROM information_schema.partitions WHERE table_name= 't1';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t1 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+NULL test t1 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+NULL test t1 p2 NULL 3 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+NULL test t1 p3 NULL 4 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+SELECT * FROM information_schema.partitions WHERE table_name= 't2';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t2 p0 NULL 1 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+NULL test t2 p1 NULL 2 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+SELECT * FROM information_schema.partitions WHERE table_name= 't3';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t3 x1 NULL 1 NULL RANGE NULL c3 NULL 105 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+NULL test t3 x2 NULL 2 NULL RANGE NULL c3 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+NULL test t3 x3 NULL 3 NULL RANGE NULL c3 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+SELECT * FROM information_schema.partitions WHERE table_name= 't4';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t4 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+NULL test t4 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+SELECT * FROM information_schema.partitions WHERE table_name= 't5';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t5 p0 NULL 1 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+NULL test t5 p1 NULL 2 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+SELECT * FROM information_schema.partitions WHERE table_name= 't6';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t6 x1 NULL 1 NULL RANGE NULL pk1 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+NULL test t6 x2 NULL 2 NULL RANGE NULL pk1 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+SELECT COUNT(*) FROM test.t1;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 Sweden, Texas 2 0
+249 Sweden, Texas 4 0
+248 Sweden, Texas 6 0
+247 Sweden, Texas 8 0
+246 Sweden, Texas 10 0
+SELECT COUNT(*) FROM test.t2;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 1 1
+249 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 3 1
+248 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 5 1
+247 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 7 1
+246 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 9 1
+SELECT COUNT(*) FROM test.t3;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t3 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 0 1
+249 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 2 1
+248 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 4 1
+247 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 6 1
+246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1
+SELECT COUNT(*) FROM test.t4;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t4 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 Sweden, Texas 2 0
+249 Sweden, Texas 4 0
+248 Sweden, Texas 6 0
+247 Sweden, Texas 8 0
+246 Sweden, Texas 10 0
+SELECT COUNT(*) FROM test.t5;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t5 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 1 1
+249 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 3 1
+248 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 5 1
+247 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 7 1
+246 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 9 1
+SELECT COUNT(*) FROM test.t6;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t6 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 0 1
+249 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 2 1
+248 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 4 1
+247 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 6 1
+246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM test.backup_info;
+LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM test.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+DROP TABLE test.backup_info;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
+DROP TABLE test.t4;
+DROP TABLE test.t5;
+DROP TABLE test.t6;
ALTER TABLESPACE table_space1
DROP DATAFILE './table_space1/datafile.dat'
ENGINE = NDB;
+ALTER TABLESPACE table_space2
+DROP DATAFILE './table_space2/datafile.dat'
+ENGINE = NDB;
DROP TABLESPACE table_space1
ENGINE = NDB;
+DROP TABLESPACE table_space2
+ENGINE = NDB;
DROP LOGFILE GROUP log_group1
ENGINE =NDB;
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(150) NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */
+SHOW CREATE TABLE test.t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` text NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
+SHOW CREATE TABLE test.t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(202) NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */
+SHOW CREATE TABLE test.t4;
+Table Create Table
+t4 CREATE TABLE `t4` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(180) NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 2 */
+SHOW CREATE TABLE test.t5;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` text NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (pk1) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
+SHOW CREATE TABLE test.t6;
+Table Create Table
+t6 CREATE TABLE `t6` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(220) NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (pk1) (PARTITION x1 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (720) ENGINE = ndbcluster) */
+SELECT * FROM information_schema.partitions WHERE table_name= 't1';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t1 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+NULL test t1 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+NULL test t1 p2 NULL 3 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+NULL test t1 p3 NULL 4 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+SELECT * FROM information_schema.partitions WHERE table_name= 't2';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t2 p0 NULL 1 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+NULL test t2 p1 NULL 2 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+SELECT * FROM information_schema.partitions WHERE table_name= 't3';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t3 x1 NULL 1 NULL RANGE NULL c3 NULL 105 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+NULL test t3 x2 NULL 2 NULL RANGE NULL c3 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+NULL test t3 x3 NULL 3 NULL RANGE NULL c3 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+SELECT * FROM information_schema.partitions WHERE table_name= 't4';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t4 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+NULL test t4 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+SELECT * FROM information_schema.partitions WHERE table_name= 't5';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t5 p0 NULL 1 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+NULL test t5 p1 NULL 2 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+SELECT * FROM information_schema.partitions WHERE table_name= 't6';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t6 x1 NULL 1 NULL RANGE NULL pk1 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+NULL test t6 x2 NULL 2 NULL RANGE NULL pk1 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
+SELECT COUNT(*) FROM test.t1;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 Sweden, Texas 2 0
+249 Sweden, Texas 4 0
+248 Sweden, Texas 6 0
+247 Sweden, Texas 8 0
+246 Sweden, Texas 10 0
+SELECT COUNT(*) FROM test.t2;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 1 1
+249 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 3 1
+248 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 5 1
+247 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 7 1
+246 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 9 1
+SELECT COUNT(*) FROM test.t3;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t3 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 0 1
+249 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 2 1
+248 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 4 1
+247 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 6 1
+246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1
+SELECT COUNT(*) FROM test.t4;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t4 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 Sweden, Texas 2 0
+249 Sweden, Texas 4 0
+248 Sweden, Texas 6 0
+247 Sweden, Texas 8 0
+246 Sweden, Texas 10 0
+SELECT COUNT(*) FROM test.t5;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t5 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 1 1
+249 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 3 1
+248 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 5 1
+247 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 7 1
+246 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 9 1
+SELECT COUNT(*) FROM test.t6;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t6 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 0 1
+249 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 2 1
+248 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 4 1
+247 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 6 1
+246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
+DROP TABLE test.t4;
+DROP TABLE test.t5;
+DROP TABLE test.t6;
+ALTER TABLESPACE table_space1 DROP DATAFILE './table_space1/datafile.dat' ENGINE=NDB;
+ALTER TABLESPACE table_space2 DROP DATAFILE './table_space2/datafile.dat' ENGINE=NDB;
+DROP TABLESPACE table_space1 ENGINE = NDB;
+DROP TABLESPACE table_space2 ENGINE = NDB;
+DROP LOGFILE GROUP log_group1 ENGINE = NDB;
diff --git a/mysql-test/r/ndb_dd_ddl.result b/mysql-test/r/ndb_dd_ddl.result
index 47b95214024..eea80090768 100644
--- a/mysql-test/r/ndb_dd_ddl.result
+++ b/mysql-test/r/ndb_dd_ddl.result
@@ -4,12 +4,12 @@ CREATE DATABASE mysqltest;
**** Begin Duplicate Statement Testing ****
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
-INITIAL_SIZE 16M
+INITIAL_SIZE 1M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
CREATE LOGFILE GROUP lg2
ADD UNDOFILE 'undofile2.dat'
-INITIAL_SIZE 16M
+INITIAL_SIZE 1M
UNDO_BUFFER_SIZE 1M
ENGINE NDB;
ERROR HY000: Failed to create LOGFILE GROUP
@@ -19,35 +19,35 @@ Error 1296 Got error 1514 'Currently there is a limit of one logfile group' from
Error 1515 Failed to create LOGFILE GROUP
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
-INITIAL_SIZE 16M
+INITIAL_SIZE 1M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
ERROR HY000: Failed to create LOGFILE GROUP
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
-INITIAL_SIZE 4M ENGINE NDB;
+INITIAL_SIZE 1M ENGINE NDB;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
-INITIAL_SIZE 4M ENGINE=NDB;
+INITIAL_SIZE 1M ENGINE=NDB;
ERROR HY000: Failed to alter: CREATE UNDOFILE
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
-INITIAL_SIZE 12M
+INITIAL_SIZE 1M
ENGINE NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
-INITIAL_SIZE 12M
+INITIAL_SIZE 1M
ENGINE NDB;
ERROR HY000: Failed to create TABLESPACE
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
-INITIAL_SIZE 12M
+INITIAL_SIZE 1M
ENGINE=NDB;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
-INITIAL_SIZE 12M
+INITIAL_SIZE 1M
ENGINE=NDB;
ERROR HY000: Failed to alter: CREATE DATAFILE
CREATE TABLE mysqltest.t1
@@ -94,20 +94,20 @@ DROP DATABASE IF EXISTS mysqltest;
**** Begin Statment CaSe Testing ****
creaTE LOgfilE GrOuP lg1
adD undoFILE 'undofile.dat'
-initiAL_siZE 16M
+initiAL_siZE 1M
UnDo_BuFfEr_SiZe = 1M
ENGInE=NDb;
altER LOgFiLE GrOUp lg1
AdD UnDOfILe 'uNdOfiLe02.daT'
-INItIAl_SIzE 4M ENgINE nDB;
+INItIAl_SIzE 1M ENgINE nDB;
CrEAtE TABLEspaCE ts1
ADD DATAfilE 'datafile.dat'
UsE LoGFiLE GRoUP lg1
-INITiaL_SizE 12M
+INITiaL_SizE 1M
ENGiNe NDb;
AlTeR tAbLeSpAcE ts1
AdD DaTaFiLe 'dAtAfiLe2.daT'
-InItIaL_SiZe 12M
+InItIaL_SiZe 1M
EnGiNe=NDB;
CREATE TABLE t1
(pk1 int not null primary key, b int not null, c int not null)
@@ -129,21 +129,21 @@ EnGiNe=nDb;
**** Begin = And No = Testing ****
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
-INITIAL_SIZE=16M
+INITIAL_SIZE=1M
UNDO_BUFFER_SIZE=1M
ENGINE=NDB;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
-INITIAL_SIZE=4M
+INITIAL_SIZE=1M
ENGINE=NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
-INITIAL_SIZE=12M
+INITIAL_SIZE=1M
ENGINE=NDB;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
-INITIAL_SIZE=12M
+INITIAL_SIZE=1M
ENGINE=NDB;
CREATE TABLE t1
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
@@ -165,21 +165,21 @@ ENGINE=NDB;
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
-INITIAL_SIZE 16M
+INITIAL_SIZE 1M
UNDO_BUFFER_SIZE 1M
ENGINE NDB;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
-INITIAL_SIZE 4M
+INITIAL_SIZE 1M
ENGINE NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
-INITIAL_SIZE 12M
+INITIAL_SIZE 1M
ENGINE NDB;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
-INITIAL_SIZE 12M
+INITIAL_SIZE 1M
ENGINE NDB;
CREATE TABLE t1
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
@@ -188,6 +188,19 @@ ENGINE NDB;
CREATE INDEX b_i on t1(b);
CREATE INDEX bc_i on t1(b, c);
DROP TABLE t1;
+CREATE TABLESPACE ts2
+ADD DATAFILE 'datafile3.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 1M
+ENGINE NDB;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile3.dat'
+ENGINE NDB;
+ERROR HY000: Failed to alter: NO SUCH FILE
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile2.dat'
+ENGINE NDB;
+ERROR HY000: Failed to alter: NO SUCH FILE
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile2.dat'
ENGINE NDB;
@@ -196,6 +209,27 @@ DROP DATAFILE 'datafile.dat'
ENGINE NDB;
DROP TABLESPACE ts1
ENGINE NDB;
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile3.dat'
+ENGINE NDB;
+DROP TABLESPACE ts2
+ENGINE NDB;
DROP LOGFILE GROUP lg1
ENGINE NDB;
**** End = And No = ****
+create table t1 (a int primary key) engine = myisam;
+create logfile group lg1 add undofile 'MYSQLTEST_VARDIR/master-data/test/t1.frm' initial_size 1M undo_buffer_size = 1M engine=ndb;;
+ERROR HY000: Failed to create UNDOFILE
+create logfile group lg1
+add undofile 'undofile.dat'
+initial_size 1M
+undo_buffer_size = 1M
+engine=ndb;
+create tablespace ts1 add datafile 'MYSQLTEST_VARDIR/master-data/test/t1.frm' use logfile group lg1 initial_size 1M engine ndb;;
+ERROR HY000: Failed to create DATAFILE
+drop tablespace ts1
+engine ndb;
+ERROR HY000: Failed to drop TABLESPACE
+drop logfile group lg1
+engine ndb;
+drop table t1;
diff --git a/mysql-test/r/ndb_dd_dump.result b/mysql-test/r/ndb_dd_dump.result
index 6572f0228d0..52e88b7db86 100644
--- a/mysql-test/r/ndb_dd_dump.result
+++ b/mysql-test/r/ndb_dd_dump.result
@@ -172,7 +172,7 @@ INITIAL_SIZE,
ENGINE
FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE="UNDO LOG" ORDER BY FILE_NAME;
LOGFILE_GROUP_NAME FILE_NAME TOTAL_EXTENTS INITIAL_SIZE ENGINE
-lg1 undofile_lg1_01.dat 1048576 2097152 ndbcluster
+lg1 undofile_lg1_01.dat 524288 2097152 ndbcluster
lg1 undofile_lg1_02.dat 1048576 4194304 ndbcluster
SELECT DISTINCT
TABLESPACE_NAME,
diff --git a/mysql-test/r/ndb_loaddatalocal.result b/mysql-test/r/ndb_loaddatalocal.result
new file mode 100644
index 00000000000..1d15c608f03
--- /dev/null
+++ b/mysql-test/r/ndb_loaddatalocal.result
@@ -0,0 +1,46 @@
+DROP TABLE IF EXISTS t1;
+create table t1(a int) engine=myisam;
+select * into outfile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
+drop table t1;
+create table t1(a int) engine=ndb;
+load data local infile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
+select count(*) from t1;
+count(*)
+10000
+drop table t1;
+create table t1(a int) engine=myisam;
+insert into t1 values (1), (2), (2), (3);
+select * into outfile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
+drop table t1;
+create table t1(a int primary key) engine=ndb;
+load data local infile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
+select * from t1 order by a;
+a
+1
+2
+3
+drop table t1;
+create table t1(a int) engine=myisam;
+insert into t1 values (1), (1), (2), (3);
+select * into outfile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
+drop table t1;
+create table t1(a int primary key) engine=ndb;
+load data local infile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
+select * from t1 order by a;
+a
+1
+2
+3
+drop table t1;
+create table t1(a int) engine=myisam;
+insert into t1 values (1), (2), (3), (3);
+select * into outfile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
+drop table t1;
+create table t1(a int primary key) engine=ndb;
+load data local infile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
+select * from t1 order by a;
+a
+1
+2
+3
+drop table t1;
diff --git a/mysql-test/r/ndb_partition_error.result b/mysql-test/r/ndb_partition_error.result
new file mode 100644
index 00000000000..d86dc382185
--- /dev/null
+++ b/mysql-test/r/ndb_partition_error.result
@@ -0,0 +1,47 @@
+drop table if exists t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b),
+index (a))
+engine = ndb
+partition by range (a)
+partitions 3
+(partition x1 values less than (5) nodegroup 12,
+partition x2 values less than (10) nodegroup 13,
+partition x3 values less than (20) nodegroup 14);
+ERROR HY000: Can't create table 'test.t1' (errno: 140)
+show warnings;
+Level Code Message
+Error 1296 Got error 771 'Given NODEGROUP doesn't exist in this cluster' from NDB
+Error 1005 Can't create table 'test.t1' (errno: 140)
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a))
+engine = ndb
+partition by range (a)
+partitions 3
+(partition x1 values less than (5),
+partition x2 values less than (10),
+partition x3 values less than (20));
+drop table t1;
+CREATE TABLE t1 (id INT) ENGINE=NDB
+PARTITION BY LIST(id)
+(PARTITION p0 VALUES IN (2, 4),
+PARTITION p1 VALUES IN (42, 142));
+INSERT INTO t1 VALUES (2);
+UPDATE t1 SET id=5 WHERE id=2;
+ERROR HY000: Table has no partition for value 5
+DROP TABLE t1;
+create table t1 (a int,b int, c int)
+engine = ndb
+partition by list(a)
+partitions 2
+(partition x123 values in (11, 12),
+partition x234 values in (5, 1));
+insert into t1 values (NULL,1,1);
+ERROR HY000: Table has no partition for value NULL
+drop table t1;
diff --git a/mysql-test/r/ndb_partition_key.result b/mysql-test/r/ndb_partition_key.result
new file mode 100644
index 00000000000..fd793c4c2c7
--- /dev/null
+++ b/mysql-test/r/ndb_partition_key.result
@@ -0,0 +1,199 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a int, b int, c int, d int, PRIMARY KEY(a,b,c))
+ENGINE = NDB
+PARTITION BY KEY (a,b);
+insert into t1 values (1,1,1,1);
+select * from t1;
+a b c d
+1 1 1 1
+update t1 set d = 2 where a = 1 and b = 1 and c = 1;
+select * from t1;
+a b c d
+1 1 1 2
+delete from t1;
+select * from t1;
+a b c d
+drop table t1;
+CREATE TABLE t1 (a int, b int, c int, d int, PRIMARY KEY(a,b))
+ENGINE = NDB
+PARTITION BY KEY (c);
+ERROR HY000: A PRIMARY KEY need to include all fields in the partition function
+CREATE TABLE t1 (a int, b int, c int, PRIMARY KEY(a,b))
+ENGINE = NDB
+PARTITION BY KEY (a);
+insert into t1 values
+(1,1,3),(1,2,3),(1,3,3),(1,4,3),(1,5,3),(1,6,3),
+(1,7,3),(1,8,3),(1,9,3),(1,10,3),(1,11,3),(1,12,3);
+select * from t1 order by b;
+a b c
+1 1 3
+1 2 3
+1 3 3
+1 4 3
+1 5 3
+1 6 3
+1 7 3
+1 8 3
+1 9 3
+1 10 3
+1 11 3
+1 12 3
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b CHAR(10) COLLATE latin1_bin, c INT, d INT,
+PRIMARY KEY (a,b,c) USING HASH)
+ENGINE=NDB
+DEFAULT CHARSET=latin1
+PARTITION BY KEY (b);
+insert into t1 values (1,"a",1,1),(2,"a",1,1),(3,"a",1,1);
+-- t1 --
+
+Fragment type: 5
+K Value: 6
+Min load factor: 78
+Max load factor: 80
+Temporary table: no
+Number of attributes: 4
+Number of primary keys: 3
+Length of frm data: #
+Row Checksum: 1
+Row GCI: 1
+TableStatus: Retrieved
+-- Attributes --
+a Int PRIMARY KEY AT=FIXED ST=MEMORY
+b Char(10;latin1_bin) PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
+c Int PRIMARY KEY AT=FIXED ST=MEMORY
+d Int NULL AT=FIXED ST=MEMORY
+
+-- Indexes --
+PRIMARY KEY(a, b, c) - UniqueHashIndex
+
+
+NDBT_ProgramExit: 0 - OK
+
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL DEFAULT '0',
+ `b` char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
+ `c` int(11) NOT NULL DEFAULT '0',
+ `d` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`,`b`,`c`) USING HASH
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (b) */
+DROP TABLE t1;
+CREATE TABLE t1 (a int not null primary key)
+PARTITION BY KEY(a)
+(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
+drop table t1;
+CREATE TABLE t1 (a int not null primary key);
+ALTER TABLE t1
+PARTITION BY KEY(a)
+(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
+drop table t1;
+create table t1 (a int)
+engine=ndb
+partition by key(a)
+(partition p0, partition p1);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
+alter table t1 engine=heap;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY) */
+alter table t1 engine=ndb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
+alter table t1 engine=heap remove partitioning;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+alter table t1 engine=ndb
+partition by key(a)
+(partition p0, partition p1 engine = ndb);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
+alter table t1
+partition by key (a)
+(partition p0 engine=ndb, partition p1 engine=ndb);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
+alter table t1 remove partitioning;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+alter table t1
+partition by key(a)
+(partition p0 engine=ndb, partition p1);
+ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
+alter table t1
+engine=ndb
+partition by key(a)
+(partition p0 engine=ndb, partition p1 engine = ndb);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
+drop table t1;
+CREATE TABLE t1 (
+c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
+c2 TEXT NOT NULL,
+c3 INT NOT NULL,
+c4 BIT NOT NULL,
+c5 FLOAT,
+c6 VARCHAR(255),
+c7 TIMESTAMP,
+PRIMARY KEY(c1,c3))
+ENGINE=NDB
+PARTITION BY KEY(c3) PARTITIONS 5;
+ALTER TABLE t1 COALESCE PARTITION 4;
+DROP TABLE t1;
+CREATE TABLE t1 (a int primary key)
+ENGINE=NDB
+PARTITION BY KEY(a);
+ALTER TABLE t1 OPTIMIZE PARTITION p0;
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+ALTER TABLE t1 CHECK PARTITION p0;
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+ALTER TABLE t1 REPAIR PARTITION p0;
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+ALTER TABLE t1 ANALYZE PARTITION p0;
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+ALTER TABLE t1 REBUILD PARTITION p0;
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+DROP TABLE t1;
+CREATE TABLE t1 (
+c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
+c2 TEXT NOT NULL,
+c3 INT NOT NULL,
+PRIMARY KEY(c1,c3))
+ENGINE=NDB
+PARTITION BY KEY(c3) PARTITIONS 5;
+ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1;
+DROP TABLE t1;
+CREATE TABLE t1 (
+c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
+c2 TEXT NOT NULL,
+c3 INT NOT NULL,
+PRIMARY KEY(c1,c3))
+ENGINE=NDB
+PARTITION BY KEY(c3);
+ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1;
+DROP TABLE t1;
diff --git a/mysql-test/r/ndb_partition_list.result b/mysql-test/r/ndb_partition_list.result
new file mode 100644
index 00000000000..ce2574ddcc4
--- /dev/null
+++ b/mysql-test/r/ndb_partition_list.result
@@ -0,0 +1,51 @@
+drop table if exists t1;
+CREATE TABLE t1 ( f_int1 INTEGER NOT NULL, f_int2 INTEGER NOT NULL,
+f_char1 CHAR(10),
+f_char2 CHAR(10), f_charbig VARCHAR(1000),
+PRIMARY KEY (f_int1,f_int2))
+ENGINE = NDB
+PARTITION BY LIST(MOD(f_int1 + f_int2,4))
+(PARTITION part_3 VALUES IN (-3),
+PARTITION part_2 VALUES IN (-2),
+PARTITION part_1 VALUES IN (-1),
+PARTITION part0 VALUES IN (0),
+PARTITION part1 VALUES IN (1),
+PARTITION part2 VALUES IN (2),
+PARTITION part3 VALUES IN (3,4,5));
+INSERT INTO t1 SET f_int1 = -2, f_int2 = 20, f_char1 = '20', f_char2 = '20', f_charbig = '===20===';
+INSERT INTO t1 SET f_int1 = 1, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 2, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 3, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 4, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 5, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 20, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+SELECT * FROM t1 ORDER BY f_int1;
+f_int1 f_int2 f_char1 f_char2 f_charbig
+-2 20 20 20 ===20===
+1 1 1 1 ===1===
+2 1 1 1 ===1===
+3 1 1 1 ===1===
+4 1 1 1 ===1===
+5 1 1 1 ===1===
+20 1 1 1 ===1===
+DROP TABLE t1;
+CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(10),
+f_char2 CHAR(10), f_charbig VARCHAR(1000))
+ENGINE = NDB
+PARTITION BY LIST(f_int1)
+(PARTITION part_1 VALUES IN (-1),
+PARTITION part0 VALUES IN (0,1),
+PARTITION part1 VALUES IN (2));
+INSERT INTO t1 SET f_int1 = -1, f_int2 = 20, f_char1 = '20', f_char2 = '20', f_charbig = '===20===';
+INSERT INTO t1 SET f_int1 = 0, f_int2 = 20, f_char1 = '20', f_char2 = '20', f_charbig = '===20===';
+INSERT INTO t1 SET f_int1 = 1, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 2, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 20, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+ERROR HY000: Table has no partition for value 20
+SELECT * FROM t1 ORDER BY f_int1;
+f_int1 f_int2 f_char1 f_char2 f_charbig
+-1 20 20 20 ===20===
+0 20 20 20 ===20===
+1 1 1 1 ===1===
+2 1 1 1 ===1===
+DROP TABLE t1;
diff --git a/mysql-test/r/ndb_partition_range.result b/mysql-test/r/ndb_partition_range.result
new file mode 100644
index 00000000000..9cc9aa2cda9
--- /dev/null
+++ b/mysql-test/r/ndb_partition_range.result
@@ -0,0 +1,263 @@
+drop table if exists t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b),
+index (a))
+engine = ndb
+partition by range (a)
+partitions 3
+(partition x1 values less than (5),
+partition x2 values less than (10),
+partition x3 values less than (20));
+INSERT into t1 values (1, 1, 1);
+INSERT into t1 values (6, 1, 1);
+INSERT into t1 values (10, 1, 1);
+INSERT into t1 values (15, 1, 1);
+select * from information_schema.partitions where table_name= 't1';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t1 x1 NULL 1 NULL RANGE NULL a NULL 5 0 0 0 # 0 0 # # NULL NULL default 0 default
+NULL test t1 x2 NULL 2 NULL RANGE NULL a NULL 10 0 0 0 # 0 0 # # NULL NULL default 0 default
+NULL test t1 x3 NULL 3 NULL RANGE NULL a NULL 20 0 0 0 # 0 0 # # NULL NULL default 0 default
+select * from t1 order by a;
+a b c
+1 1 1
+6 1 1
+10 1 1
+15 1 1
+select * from t1 where a=1 order by a;
+a b c
+1 1 1
+select * from t1 where a=15 and b=1 order by a;
+a b c
+15 1 1
+select * from t1 where a=21 and b=1 order by a;
+a b c
+select * from t1 where a=21 order by a;
+a b c
+select * from t1 where a in (1,6,10,21) order by a;
+a b c
+1 1 1
+6 1 1
+10 1 1
+select * from t1 where b=1 and a in (1,6,10,21) order by a;
+a b c
+1 1 1
+6 1 1
+10 1 1
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(b),
+unique (a))
+engine = ndb
+partition by range (b)
+partitions 3
+(partition x1 values less than (5),
+partition x2 values less than (10),
+partition x3 values less than (20));
+INSERT into t1 values (1, 1, 1);
+INSERT into t1 values (2, 6, 1);
+INSERT into t1 values (3, 10, 1);
+INSERT into t1 values (4, 15, 1);
+select * from t1 order by a;
+a b c
+1 1 1
+2 6 1
+3 10 1
+4 15 1
+UPDATE t1 set a = 5 WHERE b = 15;
+select * from t1 order by a;
+a b c
+1 1 1
+2 6 1
+3 10 1
+5 15 1
+UPDATE t1 set a = 6 WHERE a = 5;
+select * from t1 order by a;
+a b c
+1 1 1
+2 6 1
+3 10 1
+6 15 1
+select * from t1 where b=1 order by b;
+a b c
+1 1 1
+select * from t1 where b=15 and a=1 order by b;
+a b c
+select * from t1 where b=21 and a=1 order by b;
+a b c
+select * from t1 where b=21 order by b;
+a b c
+select * from t1 where b in (1,6,10,21) order by b;
+a b c
+1 1 1
+2 6 1
+3 10 1
+select * from t1 where a in (1,2,5,6) order by b;
+a b c
+1 1 1
+2 6 1
+6 15 1
+select * from t1 where a=1 and b in (1,6,10,21) order by b;
+a b c
+1 1 1
+DELETE from t1 WHERE b = 6;
+DELETE from t1 WHERE a = 6;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` int(11) NOT NULL,
+ `c` int(11) NOT NULL,
+ PRIMARY KEY (`b`),
+ UNIQUE KEY `a` (`a`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (b) (PARTITION x1 VALUES LESS THAN (5) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (10) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (20) ENGINE = ndbcluster) */
+drop table t1;
+CREATE TABLE t1
+(id MEDIUMINT NOT NULL,
+b1 BIT(8),
+vc VARCHAR(255),
+bc CHAR(255),
+d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0,
+total BIGINT UNSIGNED,
+y YEAR,
+t DATE) ENGINE=NDB
+PARTITION BY RANGE (YEAR(t))
+(PARTITION p0 VALUES LESS THAN (1901),
+PARTITION p1 VALUES LESS THAN (1946),
+PARTITION p2 VALUES LESS THAN (1966),
+PARTITION p3 VALUES LESS THAN (1986),
+PARTITION p4 VALUES LESS THAN (2005),
+PARTITION p5 VALUES LESS THAN MAXVALUE);
+INSERT INTO t1 VALUES (0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+SELECT * FROM t1;
+id b1 vc bc d f total y t
+0 NULL NULL NULL NULL NULL NULL NULL NULL
+ALTER TABLE t1 ENGINE=MYISAM;
+SELECT * FROM t1;
+id b1 vc bc d f total y t
+0 NULL NULL NULL NULL NULL NULL NULL NULL
+DROP TABLE t1;
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+ INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE=1M
+ENGINE=NDB;
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+ USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M
+ENGINE NDB;
+CREATE TABLE test.t1 (
+a1 INT,
+a2 TEXT NOT NULL,
+a3 BIT NOT NULL,
+a4 DECIMAL(8,3),
+a5 INT NOT NULL,
+a6 INT,
+PRIMARY KEY(a1))
+TABLESPACE ts1 STORAGE DISK ENGINE=NDB
+PARTITION BY LIST (a1)
+(PARTITION p0 VALUES IN (1,2,3,4,5),
+PARTITION p1 VALUES IN (6,7,8,9, 10),
+PARTITION p2 VALUES IN (11, 12, 13, 14, 15));
+ALTER TABLE test.t1 DROP COLUMN a6;
+ALTER TABLE test.t1 ADD COLUMN a6 VARCHAR(255);
+SELECT COUNT(*) FROM test.t1;
+COUNT(*)
+15
+ALTER TABLE test.t1 DROP COLUMN a4;
+SELECT COUNT(*) FROM test.t1;
+COUNT(*)
+15
+DROP TABLE t1;
+CREATE TABLE test.t1 (
+a1 INT,
+a2 TEXT NOT NULL,
+a3 BIT NOT NULL,
+a4 DECIMAL(8,3),
+a5 INT NOT NULL,
+a6 VARCHAR(255),
+PRIMARY KEY(a1))
+TABLESPACE ts1 STORAGE DISK ENGINE=NDB
+PARTITION BY HASH(a1)
+PARTITIONS 4;
+SELECT COUNT(*) FROM test.t1;
+COUNT(*)
+15
+ALTER TABLE test.t1 DROP COLUMN a4;
+SELECT COUNT(*) FROM test.t1;
+COUNT(*)
+15
+DROP TABLE t1;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile.dat'
+ENGINE=NDB;
+DROP TABLESPACE ts1 ENGINE=NDB;
+DROP LOGFILE GROUP lg1 ENGINE=NDB;
+CREATE TABLE t1
+(id MEDIUMINT NOT NULL,
+b1 BIT(8),
+vc VARCHAR(255),
+bc CHAR(255),
+d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0,
+total BIGINT UNSIGNED,
+y YEAR,
+t DATE) ENGINE=NDB
+PARTITION BY LIST(id)
+(PARTITION p0 VALUES IN (2, 4),
+PARTITION p1 VALUES IN (42, 142));
+INSERT INTO t1 VALUES (2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+SELECT * FROM t1;
+id b1 vc bc d f total y t
+2 NULL NULL NULL NULL NULL NULL NULL NULL
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p2 VALUES IN (412));
+SELECT * FROM t1;
+id b1 vc bc d f total y t
+2 NULL NULL NULL NULL NULL NULL NULL NULL
+DROP TABLE t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null)
+partition by list(a)
+partitions 2
+(partition x123 values in (1,5,6),
+partition x234 values in (4,7,8));
+INSERT into t1 VALUES (5,1,1);
+select * from t1;
+a b c
+5 1 1
+UPDATE t1 SET a=8 WHERE a=5 AND b=1;
+select * from t1;
+a b c
+8 1 1
+drop table t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20)) engine=ndb
+PARTITION BY RANGE(f1)
+( PARTITION part1 VALUES LESS THAN (2),
+PARTITION part2 VALUES LESS THAN (1000));
+INSERT INTO t1 VALUES(1, '---1---');
+INSERT INTO t1 VALUES(2, '---2---');
+select * from t1 order by f1;
+f1 f2
+1 ---1---
+2 ---2---
+UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 2;
+select * from t1 order by f1;
+f1 f2
+1 ---1---
+6 ---2---
+UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 1;
+select * from t1 order by f1;
+f1 f2
+5 ---1---
+6 ---2---
+drop table t1;
diff --git a/mysql-test/r/ndb_replace.result b/mysql-test/r/ndb_replace.result
index cdcd935bfcc..8e85feb3bd3 100644
--- a/mysql-test/r/ndb_replace.result
+++ b/mysql-test/r/ndb_replace.result
@@ -1,4 +1,4 @@
-drop table if exists t1;
+drop table if exists t1,t2;
CREATE TABLE t1 (
gesuchnr int(11) DEFAULT '0' NOT NULL,
benutzer_id int(11) DEFAULT '0' NOT NULL,
@@ -31,3 +31,24 @@ SELECT * from t1 ORDER BY i;
i j k
3 1 42
17 2 NULL
+CREATE TABLE t2 (a INT(11) NOT NULL,
+b INT(11) NOT NULL,
+c INT(11) NOT NULL,
+x TEXT,
+y TEXT,
+z TEXT,
+id INT(10) unsigned NOT NULL AUTO_INCREMENT,
+i INT(11) DEFAULT NULL,
+PRIMARY KEY (id),
+UNIQUE KEY a (a,b,c)
+) ENGINE=ndbcluster;
+REPLACE INTO t2 (a,b,c,x,y,z,i) VALUES (1,1,1,'a','a','a',1),(1,1,1,'b','b','b',2), (1,1,1,'c','c','c',3);
+SELECT * FROM t2 ORDER BY id;
+a b c x y z id i
+1 1 1 c c c 3 3
+REPLACE INTO t2(a,b,c,x,y,z,i) values (1,1,1,'a','a','a',1);
+REPLACE INTO t2(a,b,c,x,y,z,i) values (1,1,1,'b','b','b',2);
+SELECT * FROM t2 ORDER BY id;
+a b c x y z id i
+1 1 1 b b b 5 2
+DROP TABLE t2;
diff --git a/mysql-test/r/ndb_restore_partition.result b/mysql-test/r/ndb_restore_partition.result
new file mode 100644
index 00000000000..7dc4057e615
--- /dev/null
+++ b/mysql-test/r/ndb_restore_partition.result
@@ -0,0 +1,469 @@
+use test;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+CREATE TABLE `t1_c` (
+`capgoaledatta` smallint(5) unsigned NOT NULL auto_increment,
+`goaledatta` char(2) NOT NULL default '',
+`maturegarbagefa` varchar(32) NOT NULL default '',
+PRIMARY KEY (`capgoaledatta`,`goaledatta`,`maturegarbagefa`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t1_c` VALUES (2,'3','q3plus.qt'),(4,'4','q3plus.qt'),(1,'3','q3.net'),(3,'4','q3.net'),(3,'20','threetrees.qt');
+CREATE TABLE `t2_c` (
+`capgotod` smallint(5) unsigned NOT NULL auto_increment,
+`gotod` smallint(5) unsigned NOT NULL default '0',
+`goaledatta` char(2) default NULL,
+`maturegarbagefa` varchar(32) default NULL,
+`descrpooppo` varchar(64) default NULL,
+`svcutonsa` varchar(64) NOT NULL default '',
+PRIMARY KEY (`capgotod`),
+KEY `i_quadaddsvr` (`gotod`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t2_c` VALUES (5,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST');
+CREATE TABLE `t3_c` (
+`CapGoaledatta` smallint(5) unsigned NOT NULL default '0',
+`capgotod` smallint(5) unsigned NOT NULL default '0',
+PRIMARY KEY (`capgotod`,`CapGoaledatta`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t3_c` VALUES (5,3),(2,4),(5,4),(1,3);
+CREATE TABLE `t4_c` (
+`capfa` bigint(20) unsigned NOT NULL auto_increment,
+`realm` varchar(32) NOT NULL default '',
+`authpwchap` varchar(32) default NULL,
+`fa` varchar(32) NOT NULL default '',
+`payyingatta` tinyint(4) NOT NULL default '0',
+`status` char(1) default NULL,
+PRIMARY KEY (`fa`,`realm`),
+KEY `capfa` (`capfa`),
+KEY `i_quadentity` (`fa`,`realm`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t4_c` VALUES (18,'john.smith','q3.net','dessjohn.smith',0,NULL),(21,'quad_katt_with_brandtad','q3.net','acne',0,NULL),(22,'quad_katt_carattoaa','q3.net','acne',0,NULL),(26,'436462612809','sqasdt.q3.net','N/A',0,'6'),(19,'john','smith.qt','dessjohn',0,NULL),(33,'436643196120','sqasdt.q3.net','N/A',1,'6'),(28,'436642900019','sqasdt.q3.net','N/A',0,'6'),(30,'436462900209','sqasdt.q3.net','N/A',0,'6'),(16,'436640006666','sqasdt.q3.net','',0,NULL),(19,'dette','el-redun.com','dessdette',0,NULL),(12,'quad_kattPP','q3.net','acne',2,NULL),(14,'436640008888','sqasdt.q3.net','',0,NULL),(29,'463624900028','sqasdt.q3.net','N/A',0,'6'),(15,'436640099099','sqasdt.q3.net','',0,NULL),(13,'pap','q3plus.qt','acne',1,NULL),(19,'436642612091','sqasdt.q3.net','N/A',0,'6'),(12,'quad_katt','q3.net','acne',0,NULL),(11,'quad_kattVK','q3.net','acne',1,NULL),(32,'463641969502','sqasdt.q3.net','N/A',1,'6'),(20,'joe','q3.net','joedesswd',0,NULL),(29,'436642900034','sqasdt.q3.net','N/A',0,'6'),(25,'contind','armerde.qt','acne',1,NULL);
+CREATE TABLE `t5_c` (
+`capfa` bigint(20) unsigned NOT NULL default '0',
+`gotod` smallint(5) unsigned NOT NULL default '0',
+`orderutonsa` varchar(64) NOT NULL default '',
+PRIMARY KEY (`capfa`,`gotod`,`orderutonsa`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t5_c` VALUES (21,2,''),(21,1,''),(22,4,'');
+CREATE TABLE `t6_c` (
+`capfa_parent` bigint(20) unsigned NOT NULL default '0',
+`capfa_child` bigint(20) unsigned NOT NULL default '0',
+`relatta` smallint(5) unsigned NOT NULL default '0',
+PRIMARY KEY (`capfa_child`,`capfa_parent`,`relatta`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t6_c` VALUES (15,16,0),(19,20,0),(18326932092909551615,30,0),(26,29,0),(18326932092909551615,29,0),(19,18,0),(26,28,0),(12,14,0);
+CREATE TABLE `t7_c` (
+`dardpo` char(15) NOT NULL default '',
+`dardtestard` tinyint(3) unsigned NOT NULL default '0',
+`FastFA` char(5) NOT NULL default '',
+`FastCode` char(6) NOT NULL default '',
+`Fastca` char(1) NOT NULL default '',
+`Fastmag` char(1) NOT NULL default '',
+`Beareratta` char(2) NOT NULL default '',
+PRIMARY KEY (`dardpo`,`dardtestard`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t7_c` VALUES ('2.6.2.4',24,'CECHP','54545','0','0','5'),('2.2.5.4',26,'CANFA','33223','1','1','4'),('4.3.2.4',28,'ITALD','54222','1','0','5'),('129..0.0.eins',28,'G','99999','1','1','5'),('1.1.1.1',24,'AUTPT','32323','0','1','3');
+CREATE TABLE `t8_c` (
+`kattjame` varchar(32) NOT NULL default '',
+`realm` varchar(32) NOT NULL default '',
+`realm_entered` varchar(32) NOT NULL default '',
+`maturegarbagefa` varchar(32) NOT NULL default '',
+`hunderaaarbagefa_parent` varchar(32) NOT NULL default '',
+`kattjame_entered` varchar(32) NOT NULL default '',
+`hunderaaarbagefa` varchar(32) NOT NULL default '',
+`gest` varchar(16) default NULL,
+`hassetino` varchar(16) NOT NULL default '',
+`aaaproxysessfa` varchar(255) default NULL,
+`autologonallowed` char(1) default NULL,
+`squardporoot` varchar(15) NOT NULL default '',
+`naspo` varchar(15) default NULL,
+`beareratta` char(2) default NULL,
+`fastCode` varchar(6) default NULL,
+`fastFA` varchar(5) default NULL,
+`fastca` char(1) default NULL,
+`fastmag` char(1) default NULL,
+`lastupdate` datetime default NULL,
+`hassetistart` datetime NOT NULL default '0000-00-00 00:00:00',
+`accthassetitime` int(10) unsigned default NULL,
+`acctoutputoctets` bigint(20) unsigned default NULL,
+`acctinputoctets` bigint(20) unsigned default NULL,
+PRIMARY KEY (`kattjame`,`hunderaaarbagefa`,`hassetistart`,`hassetino`),
+KEY `squardporoot` (`squardporoot`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t8_c` VALUES ('4tt45345235','pap','q3plus.qt','q3plus.qt','q3.net','436643196120','436643196929','8956234534568968','5524595699','uxasmt21.net.acne.qt/481889229462692422','','1.1.1.1','2.2.4.6','4','86989','34','x','x','2012-03-12 12:55:34','2012-12-05 11:20:04',3223433,3369,9565),('4545435545','john','q3.net','q3.net','acne.li','436643196120','436643196929','45345234568968','995696699','uxasmt21.net.acne.qt/481889229462692423','','1.1.1.1','2.2.9.8','2','86989','34','x','x','2012-03-12 11:35:03','2012-12-05 08:50:04',8821923,169,3565),('versteckter_q3net_katt','joe','q3.net','elredun.com','q3.net','436643196120','436643196939','91341234568968','695595699','uxasmt21.net.acne.qt/481889229462692421','','1.1.1.1','2.5.2.5','3','86989','34','x','x','2012-03-12 18:35:04','2012-12-05 12:35:04',1923123,9569,6565);
+CREATE TABLE `t9_c` (
+`kattjame` varchar(32) NOT NULL default '',
+`kattjame_entered` varchar(32) NOT NULL default '',
+`realm` varchar(32) NOT NULL default '',
+`realm_entered` varchar(32) NOT NULL default '',
+`maturegarbagefa` varchar(32) NOT NULL default '',
+`hunderaaarbagefa` varchar(32) NOT NULL default '',
+`hunderaaarbagefa_parent` varchar(32) NOT NULL default '',
+`gest` varchar(16) default NULL,
+`hassetino` varchar(16) NOT NULL default '',
+`squardporoot` varchar(15) NOT NULL default '',
+`naspo` varchar(15) default NULL,
+`beareratta` char(2) default NULL,
+`fastCode` varchar(6) default NULL,
+`fastFA` varchar(5) default NULL,
+`fastca` char(1) default NULL,
+`fastmag` char(1) default NULL,
+`lastupdate` datetime default NULL,
+`hassetistart` datetime NOT NULL default '0000-00-00 00:00:00',
+`accthassetitime` int(10) unsigned default NULL,
+`actcoutpuocttets` bigint(20) unsigned default NULL,
+`actinputocctets` bigint(20) unsigned default NULL,
+`terminateraste` tinyint(3) unsigned default NULL,
+PRIMARY KEY (`kattjame`,`hunderaaarbagefa`,`hassetistart`,`hassetino`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t9_c` VALUES ('3g4jh8gar2t','joe','q3.net','elredun.com','q3.net','436643316120','436643316939','91341234568968','695595699','1.1.1.1','2.2.6.2','3','86989','34','x','x','2012-03-12 18:35:04','2012-12-05 12:35:04',3123123,9569,6565,1),('4tt45345235','pap','q3plus.qt','q3plus.qt','q3.net','436643316120','436643316939','8956234534568968','5254595969','1.1.1.1','8.6.2.2','4','86989','34','x','x','2012-03-12 12:55:34','2012-12-05 11:20:04',3223433,3369,9565,2),('4545435545','john','q3.net','q3.net','acne.li','436643316120','436643316939','45345234568968','995696699','1.1.1.1','2.9.9.2','2','86998','34','x','x','2012-03-12 11:35:03','2012-12-05 08:50:04',8823123,169,3565,3);
+create table t1 engine=myisam as select * from t1_c;
+create table t2 engine=myisam as select * from t2_c;
+create table t3 engine=myisam as select * from t3_c;
+create table t4 engine=myisam as select * from t4_c;
+create table t5 engine=myisam as select * from t5_c;
+create table t6 engine=myisam as select * from t6_c;
+create table t7 engine=myisam as select * from t7_c;
+create table t8 engine=myisam as select * from t8_c;
+create table t9 engine=myisam as select * from t9_c;
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM test.backup_info;
+LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM test.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+DROP TABLE test.backup_info;
+drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+select count(*) from t1;
+count(*)
+5
+select count(*) from t1_c;
+count(*)
+5
+select count(*)
+from (select * from t1 union
+select * from t1_c) a;
+count(*)
+5
+select count(*) from t2;
+count(*)
+6
+select count(*) from t2_c;
+count(*)
+6
+select count(*)
+from (select * from t2 union
+select * from t2_c) a;
+count(*)
+6
+select count(*) from t3;
+count(*)
+4
+select count(*) from t3_c;
+count(*)
+4
+select count(*)
+from (select * from t3 union
+select * from t3_c) a;
+count(*)
+4
+select count(*) from t4;
+count(*)
+22
+select count(*) from t4_c;
+count(*)
+22
+select count(*)
+from (select * from t4 union
+select * from t4_c) a;
+count(*)
+22
+select count(*) from t5;
+count(*)
+3
+select count(*) from t5_c;
+count(*)
+3
+select count(*)
+from (select * from t5 union
+select * from t5_c) a;
+count(*)
+3
+select count(*) from t6;
+count(*)
+8
+select count(*) from t6_c;
+count(*)
+8
+select count(*)
+from (select * from t6 union
+select * from t6_c) a;
+count(*)
+8
+select count(*) from t7;
+count(*)
+5
+select count(*) from t7_c;
+count(*)
+5
+select count(*)
+from (select * from t7 union
+select * from t7_c) a;
+count(*)
+5
+select count(*) from t8;
+count(*)
+3
+select count(*) from t8_c;
+count(*)
+3
+select count(*)
+from (select * from t8 union
+select * from t8_c) a;
+count(*)
+3
+select count(*) from t9;
+count(*)
+3
+select count(*) from t9_c;
+count(*)
+3
+select count(*)
+from (select * from t9 union
+select * from t9_c) a;
+count(*)
+3
+ALTER TABLE t1_c
+PARTITION BY RANGE (`capgoaledatta`)
+(PARTITION p0 VALUES LESS THAN MAXVALUE);
+ALTER TABLE t2_c
+PARTITION BY LIST(`capgotod`)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6));
+ALTER TABLE t3_c
+PARTITION BY HASH (`CapGoaledatta`);
+ALTER TABLE t5_c
+PARTITION BY HASH (`capfa`)
+PARTITIONS 4;
+ALTER TABLE t6_c
+PARTITION BY LINEAR HASH (`relatta`)
+PARTITIONS 4;
+ALTER TABLE t7_c
+PARTITION BY LINEAR KEY (`dardtestard`);
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM test.backup_info;
+LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM test.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+DROP TABLE test.backup_info;
+drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+select count(*) from t1;
+count(*)
+5
+select count(*) from t1_c;
+count(*)
+5
+select count(*)
+from (select * from t1 union
+select * from t1_c) a;
+count(*)
+5
+select count(*) from t2;
+count(*)
+6
+select count(*) from t2_c;
+count(*)
+6
+select count(*)
+from (select * from t2 union
+select * from t2_c) a;
+count(*)
+6
+select count(*) from t3;
+count(*)
+4
+select count(*) from t3_c;
+count(*)
+4
+select count(*)
+from (select * from t3 union
+select * from t3_c) a;
+count(*)
+4
+select count(*) from t4;
+count(*)
+22
+select count(*) from t4_c;
+count(*)
+22
+select count(*)
+from (select * from t4 union
+select * from t4_c) a;
+count(*)
+22
+select count(*) from t5;
+count(*)
+3
+select count(*) from t5_c;
+count(*)
+3
+select count(*)
+from (select * from t5 union
+select * from t5_c) a;
+count(*)
+3
+select count(*) from t6;
+count(*)
+8
+select count(*) from t6_c;
+count(*)
+8
+select count(*)
+from (select * from t6 union
+select * from t6_c) a;
+count(*)
+8
+select count(*) from t7;
+count(*)
+5
+select count(*) from t7_c;
+count(*)
+5
+select count(*)
+from (select * from t7 union
+select * from t7_c) a;
+count(*)
+5
+select count(*) from t8;
+count(*)
+3
+select count(*) from t8_c;
+count(*)
+3
+select count(*)
+from (select * from t8 union
+select * from t8_c) a;
+count(*)
+3
+select count(*) from t9;
+count(*)
+3
+select count(*) from t9_c;
+count(*)
+3
+select count(*)
+from (select * from t9 union
+select * from t9_c) a;
+count(*)
+3
+drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+select count(*) from t1;
+count(*)
+5
+select count(*) from t1_c;
+count(*)
+5
+select count(*)
+from (select * from t1 union
+select * from t1_c) a;
+count(*)
+5
+select count(*) from t2;
+count(*)
+6
+select count(*) from t2_c;
+count(*)
+6
+select count(*)
+from (select * from t2 union
+select * from t2_c) a;
+count(*)
+6
+select count(*) from t3;
+count(*)
+4
+select count(*) from t3_c;
+count(*)
+4
+select count(*)
+from (select * from t3 union
+select * from t3_c) a;
+count(*)
+4
+select count(*) from t4;
+count(*)
+22
+select count(*) from t4_c;
+count(*)
+22
+select count(*)
+from (select * from t4 union
+select * from t4_c) a;
+count(*)
+22
+select count(*) from t5;
+count(*)
+3
+select count(*) from t5_c;
+count(*)
+3
+select count(*)
+from (select * from t5 union
+select * from t5_c) a;
+count(*)
+3
+select count(*) from t6;
+count(*)
+8
+select count(*) from t6_c;
+count(*)
+8
+select count(*)
+from (select * from t6 union
+select * from t6_c) a;
+count(*)
+8
+select count(*) from t7;
+count(*)
+5
+select count(*) from t7_c;
+count(*)
+5
+select count(*)
+from (select * from t7 union
+select * from t7_c) a;
+count(*)
+5
+select count(*) from t8;
+count(*)
+3
+select count(*) from t8_c;
+count(*)
+3
+select count(*)
+from (select * from t8 union
+select * from t8_c) a;
+count(*)
+3
+select count(*) from t9;
+count(*)
+3
+select count(*) from t9_c;
+count(*)
+3
+select count(*)
+from (select * from t9 union
+select * from t9_c) a;
+count(*)
+3
+drop table t1_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM test.backup_info;
+LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM test.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+DROP TABLE test.backup_info;
+Create table test/def/t2_c failed: Translate frm error
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+drop table if exists t2_c;
+520093696,<the_backup_id>
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index 1731146f901..e18bc51f981 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -1,5 +1,48 @@
drop table if exists t1;
create table t1 (a int)
+partition by list (a)
+(partition p0 values in (1));
+create procedure pz()
+alter table t1 engine = myisam;
+call pz();
+call pz();
+drop procedure pz;
+drop table t1;
+create table t1 (a int)
+engine = csv
+partition by list (a)
+(partition p0 values in (null));
+ERROR HY000: CSV handler cannot be used in partitioned tables
+create table t1 (a bigint)
+partition by range (a)
+(partition p0 values less than (0xFFFFFFFFFFFFFFFF),
+partition p1 values less than (10));
+ERROR 42000: VALUES value must be of same type as partition function near '),
+partition p1 values less than (10))' at line 3
+create table t1 (a bigint)
+partition by list (a)
+(partition p0 values in (0xFFFFFFFFFFFFFFFF),
+partition p1 values in (10));
+ERROR 42000: VALUES value must be of same type as partition function near '),
+partition p1 values in (10))' at line 3
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (100),
+partition p1 values less than MAXVALUE);
+insert into t1 values (1);
+drop table t1;
+create table t1 (a bigint unsigned)
+partition by hash (a);
+insert into t1 values (0xFFFFFFFFFFFFFFFD);
+insert into t1 values (0xFFFFFFFFFFFFFFFE);
+select * from t1 where (a + 1) < 10;
+a
+select * from t1 where (a + 1) > 10;
+a
+18446744073709551613
+18446744073709551614
+drop table t1;
+create table t1 (a int)
engine = csv
partition by list (a)
(partition p0 values in (null));
@@ -17,13 +60,13 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) SUBPARTITION BY KEY (a) (PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (2) ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) SUBPARTITION BY KEY (a) (PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (2) ENGINE = MyISAM) */
alter table t1 reorganize partition p1 into (partition p1 values less than (3));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) SUBPARTITION BY KEY (a) (PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (3) ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) SUBPARTITION BY KEY (a) (PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (3) ENGINE = MyISAM) */
drop table t1;
CREATE TABLE t1 (
a int not null,
@@ -41,7 +84,7 @@ t1 CREATE TABLE `t1` (
`b` int(11) NOT NULL,
`c` int(11) NOT NULL,
PRIMARY KEY (`a`,`b`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) */
drop table t1;
CREATE TABLE t1 (
a int not null,
@@ -211,7 +254,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=MEMORY DEFAULT CHARSET=latin1 PARTITION BY LIST (a) (PARTITION x1 VALUES IN (1) ENGINE = MEMORY)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) (PARTITION x1 VALUES IN (1) ENGINE = MEMORY) */
drop table t1;
CREATE TABLE t1 (a int, unique(a))
PARTITION BY LIST (a)
@@ -235,7 +278,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (a) PARTITIONS 5
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (a) PARTITIONS 5 */
drop table t1;
CREATE TABLE t1 (a int)
PARTITION BY RANGE (a)
@@ -274,7 +317,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (20) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (30) ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (20) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (30) ENGINE = MyISAM) */
drop table t1;
CREATE TABLE t1 (a int, b int)
PARTITION BY RANGE (a)
@@ -295,7 +338,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) (PARTITION x1 VALUES LESS THAN (6) ENGINE = MyISAM, PARTITION x3 VALUES LESS THAN (8) ENGINE = MyISAM, PARTITION x4 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION x5 VALUES LESS THAN (12) ENGINE = MyISAM, PARTITION x6 VALUES LESS THAN (14) ENGINE = MyISAM, PARTITION x7 VALUES LESS THAN (16) ENGINE = MyISAM, PARTITION x8 VALUES LESS THAN (18) ENGINE = MyISAM, PARTITION x9 VALUES LESS THAN (20) ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) (PARTITION x1 VALUES LESS THAN (6) ENGINE = MyISAM, PARTITION x3 VALUES LESS THAN (8) ENGINE = MyISAM, PARTITION x4 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION x5 VALUES LESS THAN (12) ENGINE = MyISAM, PARTITION x6 VALUES LESS THAN (14) ENGINE = MyISAM, PARTITION x7 VALUES LESS THAN (16) ENGINE = MyISAM, PARTITION x8 VALUES LESS THAN (18) ENGINE = MyISAM, PARTITION x9 VALUES LESS THAN (20) ENGINE = MyISAM) */
drop table t1;
create table t1 (a int not null, b int not null) partition by LIST (a+b) (
partition p0 values in (12),
@@ -349,25 +392,25 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM) */
alter table t1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM) */
alter table t1 engine=myisam;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM) */
alter table t1 engine=heap;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=MEMORY DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY) */
alter table t1 remove partitioning;
show create table t1;
Table Create Table
@@ -384,7 +427,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM) */
alter table t1 add column b int remove partitioning;
show create table t1;
Table Create Table
@@ -401,7 +444,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM) */
alter table t1
engine=heap
partition by key(a)
@@ -411,7 +454,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
-) ENGINE=MEMORY DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY) */
alter table t1 engine=myisam, add column c int remove partitioning;
show create table t1;
Table Create Table
@@ -430,7 +473,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL
-) ENGINE=MEMORY DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY) */
alter table t1
partition by key (a)
(partition p0, partition p1);
@@ -440,7 +483,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL
-) ENGINE=MEMORY DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY) */
alter table t1
engine=heap
partition by key (a)
@@ -451,7 +494,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL
-) ENGINE=MEMORY DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY) */
alter table t1
partition by key(a)
(partition p0, partition p1 engine=heap);
@@ -596,14 +639,14 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM) */
alter table t1 add partition (partition p1 values less than (200)
(subpartition subpart21));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION p0 VALUES LESS THAN (100) (SUBPARTITION p0sp0 ENGINE = MyISAM), PARTITION p1 VALUES LESS THAN (200) (SUBPARTITION subpart21 ENGINE = MyISAM))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION p0 VALUES LESS THAN (100) (SUBPARTITION p0sp0 ENGINE = MyISAM), PARTITION p1 VALUES LESS THAN (200) (SUBPARTITION subpart21 ENGINE = MyISAM)) */
drop table t1;
create table t1 (a int)
partition by key (a);
@@ -611,13 +654,13 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) */
alter table t1 add partition (partition p1);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM) */
drop table t1;
create table t1 (a int, b int)
partition by range (a)
@@ -694,7 +737,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (a) (PARTITION p1 VALUES IN (1) ENGINE = MyISAM, PARTITION p2 VALUES IN (2) ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) (PARTITION p1 VALUES IN (1) ENGINE = MyISAM, PARTITION p2 VALUES IN (2) ENGINE = MyISAM) */
drop table t1;
create table t1 (a int unsigned not null auto_increment primary key)
partition by key(a);
@@ -705,7 +748,7 @@ t2 CREATE TABLE `t2` (
`a` int(10) unsigned NOT NULL AUTO_INCREMENT,
`c` char(10) DEFAULT NULL,
PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='no comment' PARTITION BY KEY (a)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='no comment' /*!50100 PARTITION BY KEY (a) */
drop table t2;
create table t1 (s1 char(2) character set utf8)
partition by list (case when s1 > 'cz' then 1 else 2 end)
@@ -775,6 +818,18 @@ insert into t1 values (null);
select * from t1 where f1 is null;
f1
NULL
+select * from t1 where f1 < 1;
+f1
+select * from t1 where f1 <= NULL;
+f1
+select * from t1 where f1 < NULL;
+f1
+select * from t1 where f1 >= NULL;
+f1
+select * from t1 where f1 > NULL;
+f1
+select * from t1 where f1 > 1;
+f1
drop table t1;
create table t1 (f1 smallint)
partition by range (f1) (partition p0 values less than (0));
@@ -861,6 +916,16 @@ SHOW TABLE STATUS;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Dynamic 0 0 0 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
DROP TABLE t1;
+create table t1 (a bigint unsigned)
+partition by list (a)
+(partition p0 values in (0-1));
+ERROR HY000: Partition constant is out of partition function domain
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (10));
+insert into t1 values (0xFFFFFFFFFFFFFFFF);
+ERROR HY000: Table has no partition for value 18446744073709551615
+drop table t1;
create table t1 (a int)
partition by list (a)
(partition `s1 s2` values in (0));
@@ -885,7 +950,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (a) (PARTITION p0 VALUES IN (NULL) ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) (PARTITION p0 VALUES IN (NULL) ENGINE = MyISAM) */
DROP TABLE t1;
CREATE TABLE t1 (a int)
PARTITION BY RANGE(a)
@@ -921,7 +986,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) PARTITION BY KEY (a) (PARTITION p0)
+) /*!50100 PARTITION BY KEY (a) (PARTITION p0) */
set session sql_mode='';
drop table t1;
create table t1 (a int)
@@ -946,7 +1011,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) */
drop table t1;
CREATE TABLE t1 (a int) ENGINE = MYISAM PARTITION BY KEY(a);
INSERT into t1 values (1), (2);
@@ -988,4 +1053,29 @@ alter table t1 add partition (partition p2 values in (3));
alter table t1 drop partition p2;
use test;
drop database db99;
+drop procedure if exists mysqltest_1;
+create table t1 (a int)
+partition by list (a)
+(partition p0 values in (0));
+insert into t1 values (0);
+create procedure mysqltest_1 ()
+begin
+begin
+declare continue handler for sqlexception begin end;
+update ignore t1 set a = 1 where a = 0;
+end;
+prepare stmt1 from 'alter table t1';
+execute stmt1;
+end//
+call mysqltest_1()//
+drop table t1;
+drop procedure mysqltest_1;
+create table t1 (a int, index(a))
+partition by hash(a);
+insert into t1 values (1),(2);
+select * from t1 ORDER BY a DESC;
+a
+2
+1
+drop table t1;
End of 5.1 tests
diff --git a/mysql-test/r/partition_02myisam.result b/mysql-test/r/partition_02myisam.result
index 35ee0fe22ee..55263e4f8ce 100644
--- a/mysql-test/r/partition_02myisam.result
+++ b/mysql-test/r/partition_02myisam.result
@@ -92,7 +92,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) PARTITIONS 2
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) PARTITIONS 2 */
SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value
1
@@ -147,7 +147,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) */
SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value
1
@@ -205,7 +205,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) */
SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value
1
@@ -260,7 +260,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) */
SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value
1
@@ -313,7 +313,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) */
SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value
1
@@ -371,7 +371,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) */
SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value
1
@@ -429,7 +429,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) */
SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value
1
@@ -489,7 +489,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) */
SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value
1
@@ -547,7 +547,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) */
SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value
1
@@ -603,7 +603,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) */
SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value
1
@@ -661,7 +661,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) */
SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value
1
@@ -721,7 +721,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) */
SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value
1
@@ -782,7 +782,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) */
SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value
1
@@ -833,7 +833,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) */
SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value
1
@@ -891,7 +891,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (200) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (2147483647) (SUBPARTITION subpart31 ENGINE = MyISAM, SUBPARTITION subpart32 ENGINE = MyISAM))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (200) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (2147483647) (SUBPARTITION subpart31 ENGINE = MyISAM, SUBPARTITION subpart32 ENGINE = MyISAM)) */
SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value
1
@@ -944,7 +944,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) PARTITIONS 2
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) PARTITIONS 2 */
SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value
1
@@ -996,7 +996,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) SUBPARTITIONS 2 (PARTITION part1 VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION part2 VALUES LESS THAN (2147483647) ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) SUBPARTITIONS 2 (PARTITION part1 VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION part2 VALUES LESS THAN (2147483647) ENGINE = MyISAM) */
SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value
1
@@ -1046,7 +1046,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) PARTITIONS 1
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) PARTITIONS 1 */
SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value
1
@@ -1098,7 +1098,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) SUBPARTITIONS 1 (PARTITION part1 VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION part2 VALUES LESS THAN (2147483647) ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) SUBPARTITIONS 1 (PARTITION part1 VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION part2 VALUES LESS THAN (2147483647) ENGINE = MyISAM) */
SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value
1
@@ -1304,7 +1304,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) */
DROP TABLE t1;
CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
PARTITION BY RANGE(f1) PARTITIONS 2
@@ -1319,7 +1319,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (1000) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (1000) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) */
DROP TABLE t1;
# 3.3.2 (positive) number of partition/subpartition ,
# 0 (= no) named partition/subpartition
@@ -1446,7 +1446,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) */
INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 100 - 1;
ALTER TABLE t1 ADD PARTITION (PARTITION part1);
SHOW CREATE TABLE t1;
@@ -1454,7 +1454,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM) */
INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 100 AND 200;
SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
AS my_value FROM t1;
@@ -1502,7 +1502,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM) */
INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 100 - 1;
ALTER TABLE t1 ADD PARTITION (PARTITION part0);
SHOW CREATE TABLE t1;
@@ -1510,7 +1510,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM, PARTITION part0 ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM, PARTITION part0 ENGINE = MyISAM) */
INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 100 AND 200;
SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
AS my_value FROM t1;
@@ -1557,7 +1557,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM, PARTITION part0 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM, PARTITION part0 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) */
INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 100 AND 200;
SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
AS my_value FROM t1;
@@ -1603,7 +1603,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM, PARTITION part0 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM, PARTITION part0 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) */
INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 100 AND 200;
SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
AS my_value FROM t1;
@@ -1651,14 +1651,14 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM) */
INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 100 - 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM) */
INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 100 AND 200;
SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
AS my_value FROM t1;
diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result
index a7ca3d9b2fa..a51aaf22f69 100644
--- a/mysql-test/r/partition_error.result
+++ b/mysql-test/r/partition_error.result
@@ -1,4 +1,28 @@
drop table if exists t1;
+create table t1 (a int)
+engine = x
+partition by key (a);
+Warnings:
+Error 1286 Unknown table engine 'x'
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) */
+drop table t1;
+create table t1 (a int)
+engine = innodb
+partition by list (a)
+(partition p0 values in (0));
+alter table t1 engine = x;
+Warnings:
+Error 1286 Unknown table engine 'x'
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0) ENGINE = InnoDB) */
+drop table t1;
partition by list (a)
partitions 3
(partition x1 values in (1,2,9,4) tablespace ts1,
@@ -65,6 +89,9 @@ partitions 3
partition x2 tablespace ts2,
partition x3 tablespace ts3);
ERROR HY000: Field in list of fields for partition function not found in table
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -139,6 +166,9 @@ partitions 2
(partition x1 values less than (4),
partition x2 values less than (5));
ERROR HY000: Only RANGE PARTITIONING can use VALUES LESS THAN in partition definition
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -149,6 +179,9 @@ partitions 2
(partition x1 values in (4),
partition x2 values in (5));
ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -159,6 +192,9 @@ partitions 2
(partition x1 values in (4,6),
partition x2 values in (5,7));
ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -167,6 +203,9 @@ primary key (a,b))
partition by key (a)
subpartition by key (b);
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -175,6 +214,9 @@ primary key (a,b))
partition by key (a)
subpartition by key (a, b);
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -183,6 +225,9 @@ primary key (a,b))
partition by key (a)
subpartition by hash (a+b);
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -191,6 +236,9 @@ primary key (a,b))
partition by key (a)
subpartition by key (b);
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -199,6 +247,9 @@ primary key (a,b))
partition by key (a)
subpartition by key (a, b);
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -207,6 +258,9 @@ primary key (a,b))
partition by key (a)
subpartition by hash (a+b);
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -225,6 +279,9 @@ subpartition by hash (sin(a+b))
(partition x1 (subpartition x11, subpartition x12),
partition x2 (subpartition x21, subpartition x22));
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -247,6 +304,9 @@ subpartition by key (a,d)
(partition x1 values less than (1) (subpartition x11, subpartition x12),
partition x2 values less than (2) (subpartition x21, subpartition x22));
ERROR HY000: Field in list of fields for partition function not found in table
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -272,6 +332,9 @@ c int not null,
primary key(a,b))
partition by range (a);
ERROR HY000: For RANGE partitions each partition must be defined
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -554,6 +617,10 @@ PARTITION BY RANGE (a) (PARTITION p1 VALUES LESS THAN(5));
insert into t1 values (10);
ERROR HY000: Table has no partition for value 10
drop table t1;
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (-1));
+ERROR HY000: Partition constant is out of partition function domain
create table t1 (v varchar(12))
partition by range (ascii(v))
(partition p0 values less than (10));
diff --git a/mysql-test/r/partition_list.result b/mysql-test/r/partition_list.result
index 26974e5221d..c722a3c6be3 100644
--- a/mysql-test/r/partition_list.result
+++ b/mysql-test/r/partition_list.result
@@ -191,3 +191,13 @@ SELECT COUNT(*) FROM t1 WHERE s1 < 3;
COUNT(*)
2
DROP TABLE t1;
+create table t1 (a int auto_increment primary key)
+auto_increment=100
+partition by list (a)
+(partition p0 values in (1, 100));
+create index inx on t1 (a);
+insert into t1 values (null);
+select * from t1;
+a
+100
+drop table t1;
diff --git a/mysql-test/r/partition_mgm.result b/mysql-test/r/partition_mgm.result
index 48bbdf57b93..0f2c8c57872 100644
--- a/mysql-test/r/partition_mgm.result
+++ b/mysql-test/r/partition_mgm.result
@@ -6,11 +6,21 @@ Table Create Table
t1 CREATE TABLE `t1` (
`f_date` date DEFAULT NULL,
`f_varchar` varchar(30) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2 */
+hello/master-data/test/t1#P#p0.MYD
+hello/master-data/test/t1#P#p0.MYI
+hello/master-data/test/t1#P#p1.MYD
+hello/master-data/test/t1#P#p1.MYI
+hello/master-data/test/t1.frm
+hello/master-data/test/t1.par
ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_date` date DEFAULT NULL,
`f_varchar` varchar(30) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 1
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 1 */
+hello/master-data/test/t1#P#p0.MYD
+hello/master-data/test/t1#P#p0.MYI
+hello/master-data/test/t1.frm
+hello/master-data/test/t1.par
diff --git a/mysql-test/r/partition_mgm_err.result b/mysql-test/r/partition_mgm_err.result
index f899801e7cd..764f6fb5632 100644
--- a/mysql-test/r/partition_mgm_err.result
+++ b/mysql-test/r/partition_mgm_err.result
@@ -136,7 +136,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a) PARTITIONS 2
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) PARTITIONS 2 */
DROP TABLE t1;
CREATE TABLE t1 (a INT) PARTITION BY HASH(a);
ALTER TABLE t1 ADD PARTITION PARTITIONS 4;
diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result
index 950a83c6d4f..ee294242bf7 100644
--- a/mysql-test/r/partition_pruning.result
+++ b/mysql-test/r/partition_pruning.result
@@ -31,7 +31,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0,p1 ALL NULL NULL NULL NULL 3 Using where
explain partitions select * from t2 where a=1 and b=1;
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 3 Using where
+1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 2 Using where
create table t3 (
a int
)
diff --git a/mysql-test/r/partition_range.result b/mysql-test/r/partition_range.result
index 518d3a8e1d4..3cbb517053a 100644
--- a/mysql-test/r/partition_range.result
+++ b/mysql-test/r/partition_range.result
@@ -26,7 +26,7 @@ t1 CREATE TABLE `t1` (
`b` int(11) NOT NULL,
`c` int(11) NOT NULL,
PRIMARY KEY (`a`,`b`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) (PARTITION x1 VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM, PARTITION x2 VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM, PARTITION x3 VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) (PARTITION x1 VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM, PARTITION x2 VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM, PARTITION x3 VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM) */
ALTER TABLE t1
partition by range (a)
partitions 3
@@ -46,7 +46,7 @@ t1 CREATE TABLE `t1` (
`b` int(11) NOT NULL,
`c` int(11) NOT NULL,
PRIMARY KEY (`a`,`b`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) (PARTITION x1 VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM, PARTITION x2 VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM, PARTITION x3 VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) (PARTITION x1 VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM, PARTITION x2 VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM, PARTITION x3 VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM) */
drop table if exists t1;
CREATE TABLE t1 (
a int not null,
@@ -143,7 +143,7 @@ t1 CREATE TABLE `t1` (
`b` int(11) NOT NULL,
`c` int(11) NOT NULL,
PRIMARY KEY (`a`,`b`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a+b) (PARTITION x1 VALUES LESS THAN (1) (SUBPARTITION x11 ENGINE = MyISAM, SUBPARTITION x12 ENGINE = MyISAM), PARTITION x2 VALUES LESS THAN (5) (SUBPARTITION x21 ENGINE = MyISAM, SUBPARTITION x22 ENGINE = MyISAM))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a+b) (PARTITION x1 VALUES LESS THAN (1) (SUBPARTITION x11 ENGINE = MyISAM, SUBPARTITION x12 ENGINE = MyISAM), PARTITION x2 VALUES LESS THAN (5) (SUBPARTITION x21 ENGINE = MyISAM, SUBPARTITION x22 ENGINE = MyISAM)) */
ALTER TABLE t1 ADD COLUMN d int;
show create table t1;
Table Create Table
@@ -153,7 +153,7 @@ t1 CREATE TABLE `t1` (
`c` int(11) NOT NULL,
`d` int(11) DEFAULT NULL,
PRIMARY KEY (`a`,`b`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a+b) (PARTITION x1 VALUES LESS THAN (1) (SUBPARTITION x11 ENGINE = MyISAM, SUBPARTITION x12 ENGINE = MyISAM), PARTITION x2 VALUES LESS THAN (5) (SUBPARTITION x21 ENGINE = MyISAM, SUBPARTITION x22 ENGINE = MyISAM))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a+b) (PARTITION x1 VALUES LESS THAN (1) (SUBPARTITION x11 ENGINE = MyISAM, SUBPARTITION x12 ENGINE = MyISAM), PARTITION x2 VALUES LESS THAN (5) (SUBPARTITION x21 ENGINE = MyISAM, SUBPARTITION x22 ENGINE = MyISAM)) */
drop table t1;
CREATE TABLE t1 (
a int not null,
@@ -363,6 +363,33 @@ SELECT COUNT(*) FROM t1 WHERE c3 < '2000-12-31';
COUNT(*)
10
DROP TABLE t1;
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (10),
+partition p1 values less than (0));
+ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (0),
+partition p1 values less than (10));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (10) ENGINE = MyISAM) */
+drop table t1;
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (2),
+partition p1 values less than (10));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (2) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (10) ENGINE = MyISAM) */
+insert into t1 values (0xFFFFFFFFFFFFFFFF);
+ERROR HY000: Table has no partition for value 18446744073709551615
+drop table t1;
create table t1 (a int)
partition by range (MOD(a,3))
subpartition by hash(a)
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index 40aa88439b9..5f72b229ab5 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -1050,6 +1050,7 @@ Qcache_hits 1
drop table t1;
create table t1 (a int);
insert into t1 values (1),(2);
+drop procedure if exists p1;
CREATE PROCEDURE `p1`()
begin
Declare c1 cursor for select a from t1;
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index f6b7409ea6a..f687ab7e2c6 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -406,7 +406,7 @@ insert into t2(uid, name) values
(24, CHAR(64+24)),
(25, CHAR(64+25)),
(26, CHAR(64+26));
-insert into t1(uid, name) select uid, name from t2;
+insert into t1(uid, name) select uid, name from t2 order by uid;
delete from t2;
insert into t2(id, uid, name) select id, uid, name from t1;
select count(*) from t1;
diff --git a/mysql-test/r/renamedb.result b/mysql-test/r/renamedb.result
index 26ae42e72aa..b22322fbe8d 100644
--- a/mysql-test/r/renamedb.result
+++ b/mysql-test/r/renamedb.result
@@ -27,3 +27,7 @@ a
2
3
drop database testdb2;
+create database testdb1;
+rename database testdb1 to testdb1;
+ERROR HY000: Can't create database 'testdb1'; database exists
+drop database testdb1;
diff --git a/mysql-test/r/replace.result b/mysql-test/r/replace.result
index ca32b3d45bf..842302c89ac 100644
--- a/mysql-test/r/replace.result
+++ b/mysql-test/r/replace.result
@@ -24,3 +24,9 @@ a b
63 default_value
127 last
drop table t1;
+CREATE TABLE t1 (f1 INT);
+CREATE VIEW v1 AS SELECT f1 FROM t1 WHERE f1 = 0 WITH CHECK OPTION;
+REPLACE INTO v1 (f1) VALUES (1);
+ERROR HY000: CHECK OPTION failed 'test.v1'
+DROP TABLE t1;
+DROP VIEW v1;
diff --git a/mysql-test/r/rpl_auto_increment_11932.result b/mysql-test/r/rpl_auto_increment_11932.result
new file mode 100644
index 00000000000..25eda6ee454
--- /dev/null
+++ b/mysql-test/r/rpl_auto_increment_11932.result
@@ -0,0 +1,47 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists test1;
+create database test1;
+use test1;
+CREATE TABLE `t1` (
+`id` int(10) unsigned NOT NULL auto_increment,
+`fname` varchar(100) default NULL,
+PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
+INSERT INTO `t1` VALUES (1, 'blablabla');
+CREATE TABLE `t2` (
+`id` int(10) NOT NULL auto_increment,
+`comment` varchar(255) NOT NULL default '',
+PRIMARY KEY (`id`)
+) ENGINE=MyISAM AUTO_INCREMENT=3 ;
+INSERT INTO `t2` VALUES (1, 'testtest 1');
+INSERT INTO `t2` VALUES (2, 'test 2');
+CREATE PROCEDURE simpleproc3 ()
+NOT DETERMINISTIC
+BEGIN
+INSERT INTO t1 (fname) (SELECT t2.comment FROM t2 WHERE t2.id = '1');
+INSERT INTO t1 (fname) VALUES('test');
+END
+$
+CALL simpleproc3();
+select * from t2;
+id comment
+1 testtest 1
+2 test 2
+TRUNCATE TABLE `t1`;
+CALL simpleproc3();
+select * from t1;
+id fname
+1 testtest 1
+2 test
+use test1;
+select * from t1;
+id fname
+1 testtest 1
+2 test
+drop database test1;
+drop database test1;
diff --git a/mysql-test/r/rpl_ddl.result b/mysql-test/r/rpl_ddl.result
index cfa2b4dc76d..ace86532b12 100644
--- a/mysql-test/r/rpl_ddl.result
+++ b/mysql-test/r/rpl_ddl.result
@@ -646,11 +646,9 @@ flush logs;
-------- switch to master -------
SELECT * FROM mysqltest1.t7;
f1
-
-------- switch to slave --------
SELECT * FROM mysqltest1.t7;
f1
-
-------- switch to master -------
######## LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ ########
diff --git a/mysql-test/r/rpl_ndb_charset.result b/mysql-test/r/rpl_ndb_charset.result
index 31a7e1368f3..0ce4446c8a5 100644
--- a/mysql-test/r/rpl_ndb_charset.result
+++ b/mysql-test/r/rpl_ndb_charset.result
@@ -112,16 +112,10 @@ drop database mysqltest3;
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # drop database if exists mysqltest2
-master-bin.000001 # Table_map 1 # table_id: # (mysql.proc)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # drop database if exists mysqltest3
-master-bin.000001 # Table_map 1 # table_id: # (mysql.proc)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # create database mysqltest2 character set latin2
master-bin.000001 # Query 1 # create database mysqltest3
master-bin.000001 # Query 1 # drop database mysqltest3
-master-bin.000001 # Table_map 1 # table_id: # (mysql.proc)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # create database mysqltest3
master-bin.000001 # Query 1 # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100))
master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
@@ -147,11 +141,7 @@ master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1
master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # drop database mysqltest2
-master-bin.000001 # Table_map 1 # table_id: # (mysql.proc)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # drop database mysqltest3
-master-bin.000001 # Table_map 1 # table_id: # (mysql.proc)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
select "--- --global--" as "";
--- --global--
diff --git a/mysql-test/r/rpl_ndb_dd_partitions.result b/mysql-test/r/rpl_ndb_dd_partitions.result
new file mode 100644
index 00000000000..ece6b84c227
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_dd_partitions.result
@@ -0,0 +1,726 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+--- Doing pre test cleanup ---
+DROP TABLE IF EXISTS t1;
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE = 4M
+ENGINE=NDB;
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M
+ENGINE NDB;
+ALTER TABLESPACE ts1
+ADD DATAFILE 'datafile02.dat'
+INITIAL_SIZE = 4M
+ENGINE=NDB;
+--- Start test 2 partition RANGE testing --
+--- Do setup --
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63),
+bc CHAR(63), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE)
+TABLESPACE ts1 STORAGE DISK
+ENGINE=NDB
+PARTITION BY RANGE (YEAR(t))
+(PARTITION p0 VALUES LESS THAN (1901),
+PARTITION p1 VALUES LESS THAN (1946),
+PARTITION p2 VALUES LESS THAN (1966),
+PARTITION p3 VALUES LESS THAN (1986),
+PARTITION p4 VALUES LESS THAN (2005),
+PARTITION p5 VALUES LESS THAN MAXVALUE);
+--- Show table on master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(63) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster)
+--- Show table on slave --
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(63) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster)
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 MODIFY vc VARCHAR(255);
+--- Show the new improved table on the master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster)
+--- Make sure that our tables on slave are still same engine ---
+--- and that the alter statements replicated correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster)
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- End test 2 partition RANGE testing ---
+--- Do Cleanup ---
+DROP TABLE IF EXISTS t1;
+--- Start test 3 partition LIST testing ---
+--- Do setup ---
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63),
+bc CHAR(63), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE)
+TABLESPACE ts1 STORAGE DISK
+ENGINE=NDB
+PARTITION BY LIST(id)
+(PARTITION p0 VALUES IN (2, 4),
+PARTITION p1 VALUES IN (42, 142));
+--- Test 3 Alter to add partition ---
+ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412));
+--- Show table on master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(63) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster)
+--- Show table on slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(63) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster)
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 MODIFY vc VARCHAR(255);
+--- Show the new improved table on the master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster)
+--- Make sure that our tables on slave are still same engine ---
+--- and that the alter statements replicated correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster)
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- End test 3 partition LIST testing ---
+--- Do Cleanup --
+DROP TABLE IF EXISTS t1;
+--- Start test 4 partition HASH testing ---
+--- Do setup ---
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63),
+bc CHAR(63), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE)
+TABLESPACE ts1 STORAGE DISK
+ENGINE=NDB
+PARTITION BY HASH( YEAR(t) )
+PARTITIONS 4;
+--- show that tables have been created correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(63) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(63) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 MODIFY vc VARCHAR(255);
+--- Show the new improved table on the master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4
+--- Make sure that our tables on slave are still same engine ---
+--- and that the alter statements replicated correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- End test 4 partition HASH testing ---
+--- Do Cleanup --
+DROP TABLE IF EXISTS t1;
+--- Start test 5 partition by key testing ---
+--- Create Table Section ---
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63),
+bc CHAR(63), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE,PRIMARY KEY(id))
+TABLESPACE ts1 STORAGE DISK
+ENGINE=NDB
+PARTITION BY KEY()
+PARTITIONS 4;
+--- Show that tables on master are ndbcluster tables ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(63) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Show that tables on slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(63) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
+--- Show the new improved table on the master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(63) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Make sure that our tables on slave are still right type ---
+--- and that the alter statements replicated correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(63) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 MODIFY vc VARCHAR(255);
+--- Show the new improved table on the master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Make sure that our tables on slave are still same engine ---
+--- and that the alter statements replicated correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- End test 5 key partition testing ---
+--- Do Cleanup ---
+DROP TABLE IF EXISTS t1;
+alter tablespace ts1
+drop datafile 'datafile.dat'
+engine=ndb;
+alter tablespace ts1
+drop datafile 'datafile02.dat'
+engine=ndb;
+DROP TABLESPACE ts1 ENGINE=NDB;
+DROP LOGFILE GROUP lg1 ENGINE=NDB;
diff --git a/mysql-test/r/rpl_ndb_log.result b/mysql-test/r/rpl_ndb_log.result
index c435fb37531..e0135a94c63 100644
--- a/mysql-test/r/rpl_ndb_log.result
+++ b/mysql-test/r/rpl_ndb_log.result
@@ -132,3 +132,19 @@ ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find tar
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
+create table t1(a int auto_increment primary key, b int);
+insert into t1 values (NULL, 1);
+reset master;
+set insert_id=5;
+insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000001 # Table_map 2 # table_id: # (test.t1)
+slave-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
+select * from t1;
+a b
+1 1
+5 1
+6 1
+drop table t1;
diff --git a/mysql-test/r/rpl_row_basic_11bugs.result b/mysql-test/r/rpl_row_basic_11bugs.result
index 4ed7d54647b..e8be537816e 100644
--- a/mysql-test/r/rpl_row_basic_11bugs.result
+++ b/mysql-test/r/rpl_row_basic_11bugs.result
@@ -44,3 +44,19 @@ t1
USE test_ignore;
ERROR 42000: Unknown database 'test_ignore'
DROP DATABASE test_ignore;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (a INT);
+DELETE FROM t1;
+INSERT INTO t1 VALUES (1),(2);
+DELETE FROM t1 WHERE a = 0;
+UPDATE t1 SET a=99 WHERE a = 0;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 188 use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001 188 Table_map 1 227 table_id: # (test.t1)
+master-bin.000001 227 Write_rows 1 266 table_id: # flags: STMT_END_F
diff --git a/mysql-test/r/rpl_row_basic_8partition.result b/mysql-test/r/rpl_row_basic_8partition.result
index 3316e42b869..a6728303a4c 100644
--- a/mysql-test/r/rpl_row_basic_8partition.result
+++ b/mysql-test/r/rpl_row_basic_8partition.result
@@ -31,7 +31,7 @@ t1 CREATE TABLE `t1` (
`total` bigint(20) unsigned DEFAULT NULL,
`y` year(4) DEFAULT NULL,
`t` date DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
--- On slave --
SHOW CREATE TABLE t1;
Table Create Table
@@ -45,7 +45,7 @@ t1 CREATE TABLE `t1` (
`total` bigint(20) unsigned DEFAULT NULL,
`y` year(4) DEFAULT NULL,
`t` date DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
"--- Insert into t1 --" as "";
--- Select from t1 on master ---
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
@@ -98,7 +98,7 @@ t1 CREATE TABLE `t1` (
`total` bigint(20) unsigned DEFAULT NULL,
`y` year(4) DEFAULT NULL,
`t` date DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
--- On slave ---
SHOW CREATE TABLE t1;
Table Create Table
@@ -112,7 +112,7 @@ t1 CREATE TABLE `t1` (
`total` bigint(20) unsigned DEFAULT NULL,
`y` year(4) DEFAULT NULL,
`t` date DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
"--- Insert into t1 --" as "";
--- Select from t1 on master ---
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
@@ -174,7 +174,7 @@ t1 CREATE TABLE `t1` (
`total` bigint(20) unsigned DEFAULT NULL,
`y` year(4) DEFAULT NULL,
`t` date DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM) */
--- On slave ---
SHOW CREATE TABLE t1;
Table Create Table
@@ -188,7 +188,7 @@ t1 CREATE TABLE `t1` (
`total` bigint(20) unsigned DEFAULT NULL,
`y` year(4) DEFAULT NULL,
`t` date DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM) */
"--- Insert into t1 --" as "";
--- Select from t1 on master ---
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
@@ -241,7 +241,7 @@ t1 CREATE TABLE `t1` (
`total` bigint(20) unsigned DEFAULT NULL,
`y` year(4) DEFAULT NULL,
`t` date DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM) */
--- On slave ---
SHOW CREATE TABLE t1;
Table Create Table
@@ -255,7 +255,7 @@ t1 CREATE TABLE `t1` (
`total` bigint(20) unsigned DEFAULT NULL,
`y` year(4) DEFAULT NULL,
`t` date DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM) */
"--- Insert into t1 --" as "";
--- Select from t1 on master ---
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
@@ -315,7 +315,7 @@ t1 CREATE TABLE `t1` (
`total` bigint(20) unsigned DEFAULT NULL,
`y` year(4) DEFAULT NULL,
`t` date DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 */
--- On slave ---
SHOW CREATE TABLE t1;
Table Create Table
@@ -329,7 +329,7 @@ t1 CREATE TABLE `t1` (
`total` bigint(20) unsigned DEFAULT NULL,
`y` year(4) DEFAULT NULL,
`t` date DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 */
"--- Insert into t1 --" as "";
--- Select from t1 on master ---
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
@@ -382,7 +382,7 @@ t1 CREATE TABLE `t1` (
`total` bigint(20) unsigned DEFAULT NULL,
`y` year(4) DEFAULT NULL,
`t` date DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 */
--- On slave ---
SHOW CREATE TABLE t1;
Table Create Table
@@ -396,7 +396,7 @@ t1 CREATE TABLE `t1` (
`total` bigint(20) unsigned DEFAULT NULL,
`y` year(4) DEFAULT NULL,
`t` date DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 */
"--- Insert into t1 --" as "";
--- Select from t1 on master ---
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
@@ -457,7 +457,7 @@ t1 CREATE TABLE `t1` (
`y` year(4) DEFAULT NULL,
`t` date DEFAULT NULL,
PRIMARY KEY (`id`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */
--- On slave ---
SHOW CREATE TABLE t1;
Table Create Table
@@ -472,7 +472,7 @@ t1 CREATE TABLE `t1` (
`y` year(4) DEFAULT NULL,
`t` date DEFAULT NULL,
PRIMARY KEY (`id`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */
"--- Insert into t1 --" as "";
--- Select from t1 on master ---
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
@@ -526,7 +526,7 @@ t1 CREATE TABLE `t1` (
`y` year(4) DEFAULT NULL,
`t` date DEFAULT NULL,
PRIMARY KEY (`id`,`total`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */
--- On slave ---
SHOW CREATE TABLE t1;
Table Create Table
@@ -541,7 +541,7 @@ t1 CREATE TABLE `t1` (
`y` year(4) DEFAULT NULL,
`t` date DEFAULT NULL,
PRIMARY KEY (`id`,`total`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */
"--- Insert into t1 --" as "";
--- Select from t1 on master ---
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
@@ -595,7 +595,7 @@ t1 CREATE TABLE `t1` (
`y` year(4) DEFAULT NULL,
`t` date DEFAULT NULL,
PRIMARY KEY (`id`,`total`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */
--- On slave ---
SHOW CREATE TABLE t1;
Table Create Table
@@ -610,7 +610,7 @@ t1 CREATE TABLE `t1` (
`y` year(4) DEFAULT NULL,
`t` date DEFAULT NULL,
PRIMARY KEY (`id`,`total`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */
"--- Insert into t1 --" as "";
--- Select from t1 on master ---
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
diff --git a/mysql-test/r/rpl_row_charset.result b/mysql-test/r/rpl_row_charset.result
index d80b5fa60de..79cf75c8cc1 100644
--- a/mysql-test/r/rpl_row_charset.result
+++ b/mysql-test/r/rpl_row_charset.result
@@ -112,16 +112,10 @@ drop database mysqltest3;
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # drop database if exists mysqltest2
-master-bin.000001 # Table_map 1 # table_id: # (mysql.proc)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # drop database if exists mysqltest3
-master-bin.000001 # Table_map 1 # table_id: # (mysql.proc)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # create database mysqltest2 character set latin2
master-bin.000001 # Query 1 # create database mysqltest3
master-bin.000001 # Query 1 # drop database mysqltest3
-master-bin.000001 # Table_map 1 # table_id: # (mysql.proc)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # create database mysqltest3
master-bin.000001 # Query 1 # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100))
master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
@@ -147,11 +141,7 @@ master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1
master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # drop database mysqltest2
-master-bin.000001 # Table_map 1 # table_id: # (mysql.proc)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # drop database mysqltest3
-master-bin.000001 # Table_map 1 # table_id: # (mysql.proc)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
select "--- --global--" as "";
--- --global--
diff --git a/mysql-test/r/rpl_row_create_table.result b/mysql-test/r/rpl_row_create_table.result
index b3a8f5e1a0f..2f6fcc5c5ea 100644
--- a/mysql-test/r/rpl_row_create_table.result
+++ b/mysql-test/r/rpl_row_create_table.result
@@ -127,7 +127,7 @@ NULL 5 10
NULL 6 12
CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
ERROR 23000: Duplicate entry '2' for key 'b'
-SHOW BINLOG EVENTS FROM 1326;
+SHOW BINLOG EVENTS FROM 1256;
Log_name Pos Event_type Server_id End_log_pos Info
CREATE TABLE t7 (a INT, b INT UNIQUE);
INSERT INTO t7 SELECT a,b FROM tt3;
@@ -137,11 +137,11 @@ a b
1 2
2 4
3 6
-SHOW BINLOG EVENTS FROM 1326;
+SHOW BINLOG EVENTS FROM 1118;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 1326 Query 1 1426 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE)
-master-bin.000001 1426 Table_map 1 1466 table_id: # (test.t7)
-master-bin.000001 1466 Write_rows 1 1522 table_id: # flags: STMT_END_F
+master-bin.000001 1118 Query 1 1218 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE)
+master-bin.000001 1218 Table_map 1 1258 table_id: # (test.t7)
+master-bin.000001 1258 Write_rows 1 1314 table_id: # flags: STMT_END_F
SELECT * FROM t7 ORDER BY a,b;
a b
1 2
@@ -154,10 +154,10 @@ INSERT INTO t7 SELECT a,b FROM tt4;
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
-SHOW BINLOG EVENTS FROM 1522;
+SHOW BINLOG EVENTS FROM 1314;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 1522 Table_map 1 1562 table_id: # (test.t7)
-master-bin.000001 1562 Write_rows 1 1618 table_id: # flags: STMT_END_F
+master-bin.000001 1314 Table_map 1 1354 table_id: # (test.t7)
+master-bin.000001 1354 Write_rows 1 1410 table_id: # flags: STMT_END_F
SELECT * FROM t7 ORDER BY a,b;
a b
1 2
@@ -191,10 +191,10 @@ Create Table CREATE TABLE `t9` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-SHOW BINLOG EVENTS FROM 1618;
+SHOW BINLOG EVENTS FROM 1410;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 1618 Query 1 1704 use `test`; CREATE TABLE t8 LIKE t4
-master-bin.000001 1704 Query 1 1843 use `test`; CREATE TABLE `t9` (
+master-bin.000001 1410 Query 1 1496 use `test`; CREATE TABLE t8 LIKE t4
+master-bin.000001 1496 Query 1 1635 use `test`; CREATE TABLE `t9` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
)
diff --git a/mysql-test/r/rpl_row_inexist_tbl.result b/mysql-test/r/rpl_row_inexist_tbl.result
index 1d18819fdd6..5f5a4556d76 100644
--- a/mysql-test/r/rpl_row_inexist_tbl.result
+++ b/mysql-test/r/rpl_row_inexist_tbl.result
@@ -5,9 +5,18 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create table t1 (a int not null primary key);
+insert into t1 values (1);
+create table t2 (a int);
+insert into t2 values (1);
+update t1, t2 set t1.a = 0 where t1.a = t2.a;
+show tables;
+Tables_in_test
+t1
+select * from t1;
+a
+0
drop table t1;
insert into t1 values (1);
-insert into t1 values (2);
show slave status;
Slave_IO_State #
Master_Host 127.0.0.1
@@ -24,13 +33,13 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
-Replicate_Ignore_Table
+Replicate_Ignore_Table test.t2
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1146
Last_Error Error 'Table 'test.t1' doesn't exist' on opening table `test`.`t1`
Skip_Counter 0
-Exec_Master_Log_Pos 209
+Exec_Master_Log_Pos 519
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -42,4 +51,4 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
-drop table t1;
+drop table t1, t2;
diff --git a/mysql-test/r/rpl_row_log.result b/mysql-test/r/rpl_row_log.result
index 65e9ee9fb9f..89163e1e37b 100644
--- a/mysql-test/r/rpl_row_log.result
+++ b/mysql-test/r/rpl_row_log.result
@@ -100,3 +100,19 @@ ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find tar
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
+create table t1(a int auto_increment primary key, b int);
+insert into t1 values (NULL, 1);
+reset master;
+set insert_id=5;
+insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000001 # Table_map 2 # table_id: # (test.t1)
+slave-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
+select * from t1;
+a b
+1 1
+5 1
+6 1
+drop table t1;
diff --git a/mysql-test/r/rpl_row_log_innodb.result b/mysql-test/r/rpl_row_log_innodb.result
index 2c89ca5f8ff..3bcd8a6a0fb 100644
--- a/mysql-test/r/rpl_row_log_innodb.result
+++ b/mysql-test/r/rpl_row_log_innodb.result
@@ -108,3 +108,19 @@ ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find tar
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
+create table t1(a int auto_increment primary key, b int);
+insert into t1 values (NULL, 1);
+reset master;
+set insert_id=5;
+insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000001 # Table_map 2 # table_id: # (test.t1)
+slave-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
+select * from t1;
+a b
+1 1
+5 1
+6 1
+drop table t1;
diff --git a/mysql-test/r/rpl_sp_effects.result b/mysql-test/r/rpl_sp_effects.result
index 26455b65beb..b42fe64e603 100644
--- a/mysql-test/r/rpl_sp_effects.result
+++ b/mysql-test/r/rpl_sp_effects.result
@@ -124,9 +124,9 @@ delete from t1;
delete from t2;
delete from t1;
insert into t2 values(1),(2);
-create view v1 as select f1(a) from t2;
-select * from v1;
-f1(a)
+create view v1 as select f1(a) as f from t2;
+select * from v1 order by f;
+f
2
3
SELECT 'master:',a FROM t1 ORDER BY a;
diff --git a/mysql-test/r/rpl_stm_log.result b/mysql-test/r/rpl_stm_log.result
index 02a861ceb53..e0b1aa12c9b 100644
--- a/mysql-test/r/rpl_stm_log.result
+++ b/mysql-test/r/rpl_stm_log.result
@@ -98,3 +98,20 @@ ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find tar
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
+create table t1(a int auto_increment primary key, b int);
+insert into t1 values (NULL, 1);
+reset master;
+set insert_id=5;
+insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000001 # Intvar 2 # LAST_INSERT_ID=1
+slave-bin.000001 # Intvar 2 # INSERT_ID=5
+slave-bin.000001 # Query 2 # use `test`; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id())
+select * from t1;
+a b
+1 1
+5 1
+6 1
+drop table t1;
diff --git a/mysql-test/r/rpl_truncate_2myisam.result b/mysql-test/r/rpl_truncate_2myisam.result
new file mode 100644
index 00000000000..41640a709b9
--- /dev/null
+++ b/mysql-test/r/rpl_truncate_2myisam.result
@@ -0,0 +1,202 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** On Master ****
+SET SESSION BINLOG_FORMAT=STATEMENT;
+SET GLOBAL BINLOG_FORMAT=STATEMENT;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 210 Query 1 307 use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 307 Query 1 387 use `test`; TRUNCATE TABLE t1
+master-bin.000001 387 Query 1 463 use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=MIXED;
+SET GLOBAL BINLOG_FORMAT=MIXED;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 210 Query 1 307 use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 307 Query 1 387 use `test`; TRUNCATE TABLE t1
+master-bin.000001 387 Query 1 463 use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=ROW;
+SET GLOBAL BINLOG_FORMAT=ROW;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 210 Table_map 1 250 table_id: # (test.t1)
+master-bin.000001 250 Write_rows 1 297 table_id: # flags: STMT_END_F
+master-bin.000001 297 Query 1 377 use `test`; TRUNCATE TABLE t1
+master-bin.000001 377 Query 1 453 use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=STATEMENT;
+SET GLOBAL BINLOG_FORMAT=STATEMENT;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 210 Query 1 307 use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 307 Query 1 384 use `test`; DELETE FROM t1
+master-bin.000001 384 Query 1 460 use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=MIXED;
+SET GLOBAL BINLOG_FORMAT=MIXED;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 210 Query 1 307 use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 307 Query 1 384 use `test`; DELETE FROM t1
+master-bin.000001 384 Query 1 460 use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=ROW;
+SET GLOBAL BINLOG_FORMAT=ROW;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+3 3
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 210 Table_map 1 250 table_id: # (test.t1)
+master-bin.000001 250 Write_rows 1 297 table_id: # flags: STMT_END_F
+master-bin.000001 297 Table_map 1 337 table_id: # (test.t1)
+master-bin.000001 337 Delete_rows 1 384 table_id: # flags: STMT_END_F
+master-bin.000001 384 Query 1 460 use `test`; DROP TABLE t1
diff --git a/mysql-test/r/rpl_truncate_3innodb.result b/mysql-test/r/rpl_truncate_3innodb.result
new file mode 100644
index 00000000000..062c9704ae0
--- /dev/null
+++ b/mysql-test/r/rpl_truncate_3innodb.result
@@ -0,0 +1,214 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** On Master ****
+SET SESSION BINLOG_FORMAT=STATEMENT;
+SET GLOBAL BINLOG_FORMAT=STATEMENT;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 210 Query 1 97 use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 307 Xid 1 334 COMMIT /* xid= */
+master-bin.000001 334 Query 1 80 use `test`; TRUNCATE TABLE t1
+master-bin.000001 414 Xid 1 441 COMMIT /* xid= */
+master-bin.000001 441 Query 1 517 use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=MIXED;
+SET GLOBAL BINLOG_FORMAT=MIXED;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 210 Query 1 97 use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 307 Xid 1 334 COMMIT /* xid= */
+master-bin.000001 334 Query 1 80 use `test`; TRUNCATE TABLE t1
+master-bin.000001 414 Xid 1 441 COMMIT /* xid= */
+master-bin.000001 441 Query 1 517 use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=ROW;
+SET GLOBAL BINLOG_FORMAT=ROW;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 210 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 250 Write_rows 1 87 table_id: # flags: STMT_END_F
+master-bin.000001 297 Xid 1 324 COMMIT /* xid= */
+master-bin.000001 324 Query 1 80 use `test`; TRUNCATE TABLE t1
+master-bin.000001 404 Xid 1 431 COMMIT /* xid= */
+master-bin.000001 431 Query 1 507 use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=STATEMENT;
+SET GLOBAL BINLOG_FORMAT=STATEMENT;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 210 Query 1 97 use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 307 Xid 1 334 COMMIT /* xid= */
+master-bin.000001 334 Query 1 77 use `test`; DELETE FROM t1
+master-bin.000001 411 Xid 1 438 COMMIT /* xid= */
+master-bin.000001 438 Query 1 514 use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=MIXED;
+SET GLOBAL BINLOG_FORMAT=MIXED;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 210 Query 1 97 use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 307 Xid 1 334 COMMIT /* xid= */
+master-bin.000001 334 Query 1 77 use `test`; DELETE FROM t1
+master-bin.000001 411 Xid 1 438 COMMIT /* xid= */
+master-bin.000001 438 Query 1 514 use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=ROW;
+SET GLOBAL BINLOG_FORMAT=ROW;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+3 3
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 210 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 250 Write_rows 1 87 table_id: # flags: STMT_END_F
+master-bin.000001 297 Xid 1 324 COMMIT /* xid= */
+master-bin.000001 324 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 364 Delete_rows 1 87 table_id: # flags: STMT_END_F
+master-bin.000001 411 Xid 1 438 COMMIT /* xid= */
+master-bin.000001 438 Query 1 514 use `test`; DROP TABLE t1
diff --git a/mysql-test/r/rpl_truncate_7ndb.result b/mysql-test/r/rpl_truncate_7ndb.result
new file mode 100644
index 00000000000..0e1b21d31aa
--- /dev/null
+++ b/mysql-test/r/rpl_truncate_7ndb.result
@@ -0,0 +1,91 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** On Master ****
+CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1 ORDER BY a,b;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1 ORDER BY a,b;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1 ORDER BY a,b;
+a b
+**** On Slave ****
+SELECT * FROM t1 ORDER BY a,b;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 219 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 219 Query 1 283 BEGIN
+master-bin.000001 283 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 323 Table_map 1 93 table_id: # (cluster.apply_status)
+master-bin.000001 376 Write_rows 1 135 table_id: #
+master-bin.000001 418 Write_rows 1 182 table_id: # flags: STMT_END_F
+master-bin.000001 465 Query 1 530 COMMIT
+master-bin.000001 530 Query 1 610 use `test`; TRUNCATE TABLE t1
+master-bin.000001 610 Query 1 686 use `test`; DROP TABLE t1
+**** On Master ****
+CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1 ORDER BY a,b;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1 ORDER BY a,b;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1 ORDER BY a,b;
+a b
+**** On Slave ****
+SELECT * FROM t1 ORDER BY a,b;
+a b
+3 3
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 219 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 219 Query 1 283 BEGIN
+master-bin.000001 283 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 323 Table_map 1 93 table_id: # (cluster.apply_status)
+master-bin.000001 376 Write_rows 1 135 table_id: #
+master-bin.000001 418 Write_rows 1 182 table_id: # flags: STMT_END_F
+master-bin.000001 465 Query 1 530 COMMIT
+master-bin.000001 530 Query 1 610 use `test`; TRUNCATE TABLE t1
+master-bin.000001 610 Query 1 686 use `test`; DROP TABLE t1
+master-bin.000001 686 Query 1 803 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 803 Query 1 867 BEGIN
+master-bin.000001 867 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 907 Table_map 1 93 table_id: # (cluster.apply_status)
+master-bin.000001 960 Write_rows 1 135 table_id: #
+master-bin.000001 1002 Write_rows 1 182 table_id: # flags: STMT_END_F
+master-bin.000001 1049 Query 1 1114 COMMIT
+master-bin.000001 1114 Query 1 1178 BEGIN
+master-bin.000001 1178 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 1218 Table_map 1 93 table_id: # (cluster.apply_status)
+master-bin.000001 1271 Write_rows 1 135 table_id: #
+master-bin.000001 1313 Delete_rows 1 174 table_id: # flags: STMT_END_F
+master-bin.000001 1352 Query 1 1417 COMMIT
+master-bin.000001 1417 Query 1 1493 use `test`; DROP TABLE t1
diff --git a/mysql-test/r/rpl_truncate_7ndb_2.result b/mysql-test/r/rpl_truncate_7ndb_2.result
new file mode 100644
index 00000000000..0e1b21d31aa
--- /dev/null
+++ b/mysql-test/r/rpl_truncate_7ndb_2.result
@@ -0,0 +1,91 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** On Master ****
+CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1 ORDER BY a,b;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1 ORDER BY a,b;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1 ORDER BY a,b;
+a b
+**** On Slave ****
+SELECT * FROM t1 ORDER BY a,b;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 219 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 219 Query 1 283 BEGIN
+master-bin.000001 283 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 323 Table_map 1 93 table_id: # (cluster.apply_status)
+master-bin.000001 376 Write_rows 1 135 table_id: #
+master-bin.000001 418 Write_rows 1 182 table_id: # flags: STMT_END_F
+master-bin.000001 465 Query 1 530 COMMIT
+master-bin.000001 530 Query 1 610 use `test`; TRUNCATE TABLE t1
+master-bin.000001 610 Query 1 686 use `test`; DROP TABLE t1
+**** On Master ****
+CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1 ORDER BY a,b;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1 ORDER BY a,b;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1 ORDER BY a,b;
+a b
+**** On Slave ****
+SELECT * FROM t1 ORDER BY a,b;
+a b
+3 3
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 219 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 219 Query 1 283 BEGIN
+master-bin.000001 283 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 323 Table_map 1 93 table_id: # (cluster.apply_status)
+master-bin.000001 376 Write_rows 1 135 table_id: #
+master-bin.000001 418 Write_rows 1 182 table_id: # flags: STMT_END_F
+master-bin.000001 465 Query 1 530 COMMIT
+master-bin.000001 530 Query 1 610 use `test`; TRUNCATE TABLE t1
+master-bin.000001 610 Query 1 686 use `test`; DROP TABLE t1
+master-bin.000001 686 Query 1 803 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 803 Query 1 867 BEGIN
+master-bin.000001 867 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 907 Table_map 1 93 table_id: # (cluster.apply_status)
+master-bin.000001 960 Write_rows 1 135 table_id: #
+master-bin.000001 1002 Write_rows 1 182 table_id: # flags: STMT_END_F
+master-bin.000001 1049 Query 1 1114 COMMIT
+master-bin.000001 1114 Query 1 1178 BEGIN
+master-bin.000001 1178 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 1218 Table_map 1 93 table_id: # (cluster.apply_status)
+master-bin.000001 1271 Write_rows 1 135 table_id: #
+master-bin.000001 1313 Delete_rows 1 174 table_id: # flags: STMT_END_F
+master-bin.000001 1352 Query 1 1417 COMMIT
+master-bin.000001 1417 Query 1 1493 use `test`; DROP TABLE t1
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index d47d49b5298..f2d60a682e7 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -2656,16 +2656,6 @@ t11 MyISAM 10 Dynamic 0 0 X X X X X X X X latin1_swedish_ci NULL
select 123 as a from t1 where f1 is null;
a
drop table t1,t11;
-CREATE TABLE t1 (a INT, b INT);
-(SELECT a, b AS c FROM t1) ORDER BY c+1;
-a c
-(SELECT a, b AS c FROM t1) ORDER BY b+1;
-a c
-SELECT a, b AS c FROM t1 ORDER BY c+1;
-a c
-SELECT a, b AS c FROM t1 ORDER BY b+1;
-a c
-drop table t1;
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 );
@@ -2716,6 +2706,20 @@ select * from t1 where f1 in (select f3 from t2 where (f3,f4)= (select f3,f4 fro
f1 f2
1 1
drop table t1,t2;
+CREATE TABLE t1(a int, b int, c int, KEY b(b), KEY c(c));
+insert into t1 values (1,0,0),(2,0,0);
+CREATE TABLE t2 (a int, b varchar(2), c varchar(2), PRIMARY KEY(a));
+insert into t2 values (1,'',''), (2,'','');
+CREATE TABLE t3 (a int, b int, PRIMARY KEY (a,b), KEY a (a), KEY b (b));
+insert into t3 values (1,1),(1,2);
+explain select straight_join DISTINCT t2.a,t2.b, t1.c from t1, t3, t2
+where (t1.c=t2.a or (t1.c=t3.a and t2.a=t3.b)) and t1.b=556476786 and
+t2.b like '%%' order by t2.b limit 0,1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref b,c b 5 const 1 Using where; Using temporary; Using filesort
+1 SIMPLE t3 index PRIMARY,a,b PRIMARY 8 NULL 2 Using index
+1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 Range checked for each record (index map: 0x1)
+DROP TABLE t1,t2,t3;
CREATE TABLE t1 (a int, INDEX idx(a));
INSERT INTO t1 VALUES (2), (3), (1);
EXPLAIN SELECT * FROM t1 IGNORE INDEX (idx);
@@ -2726,61 +2730,12 @@ ERROR 42000: Key 'a' doesn't exist in table 't1'
EXPLAIN SELECT * FROM t1 FORCE INDEX (a);
ERROR 42000: Key 'a' doesn't exist in table 't1'
DROP TABLE t1;
-CREATE TABLE t1 ( city char(30) );
-INSERT INTO t1 VALUES ('London');
-INSERT INTO t1 VALUES ('Paris');
-SELECT * FROM t1 WHERE city='London';
-city
-London
-SELECT * FROM t1 WHERE city='london';
-city
-London
-EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
-SELECT * FROM t1 WHERE city='London' AND city='london';
-city
-London
-EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
-SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
-city
-London
+CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
+INSERT INTO t1 VALUES (10);
+SELECT i='1e+01',i=1e+01, i in (1e+01,1e+01), i in ('1e+01','1e+01') FROM t1;
+i='1e+01' i=1e+01 i in (1e+01,1e+01) i in ('1e+01','1e+01')
+0 1 1 1
DROP TABLE t1;
-create table t1 (a int(11) unsigned, b int(11) unsigned);
-insert into t1 values (1,0), (1,1), (1,2);
-select a-b from t1 order by 1;
-a-b
-0
-1
-18446744073709551615
-select a-b , (a-b < 0) from t1 order by 1;
-a-b (a-b < 0)
-0 0
-1 0
-18446744073709551615 0
-select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
-d (a-b >= 0) b
-1 1 0
-0 1 1
-18446744073709551615 1 2
-select cast((a - b) as unsigned) from t1 order by 1;
-cast((a - b) as unsigned)
-0
-1
-18446744073709551615
-drop table t1;
-create table t1 (a int(11));
-select all all * from t1;
-a
-select distinct distinct * from t1;
-a
-select all distinct * from t1;
-ERROR HY000: Incorrect usage of ALL and DISTINCT
-select distinct all * from t1;
-ERROR HY000: Incorrect usage of ALL and DISTINCT
-drop table t1;
CREATE TABLE t1 (
K2C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '',
K4N4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '0000',
@@ -2814,19 +2769,6 @@ WART 0100 1
WART 0200 1
WART 0300 3
DROP TABLE t1;
-CREATE TABLE t1 ( a BLOB, INDEX (a(20)) );
-CREATE TABLE t2 ( a BLOB, INDEX (a(20)) );
-INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five');
-INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');
-EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 5
-1 SIMPLE t2 ref a a 23 test.t1.a 2
-EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 5
-1 SIMPLE t2 ref a a 23 test.t1.a 2
-DROP TABLE t1, t2;
create table t1 (a int, b int);
create table t2 like t1;
select t1.a from (t1 inner join t2 on t1.a=t2.a) where t2.a=1;
@@ -2857,29 +2799,6 @@ x
NULL
1.0000
drop table t1;
-create table t1 (a int(11));
-select all all * from t1;
-a
-select distinct distinct * from t1;
-a
-select all distinct * from t1;
-ERROR HY000: Incorrect usage of ALL and DISTINCT
-select distinct all * from t1;
-ERROR HY000: Incorrect usage of ALL and DISTINCT
-drop table t1;
-CREATE TABLE t1 ( a BLOB, INDEX (a(20)) );
-CREATE TABLE t2 ( a BLOB, INDEX (a(20)) );
-INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five');
-INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');
-EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 5
-1 SIMPLE t2 ref a a 23 test.t1.a 2
-EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 5
-1 SIMPLE t2 ref a a 23 test.t1.a 2
-DROP TABLE t1, t2;
CREATE TABLE t1 (a int);
CREATE TABLE t2 (a int);
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
@@ -3456,3 +3375,23 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using where
1 SIMPLE t2 ref c c 5 test.t1.a 2 Using where
DROP TABLE t1, t2;
+create table t1 (
+a int unsigned not null auto_increment primary key,
+b bit not null,
+c bit not null
+);
+create table t2 (
+a int unsigned not null auto_increment primary key,
+b bit not null,
+c int unsigned not null,
+d varchar(50)
+);
+insert into t1 (b,c) values (0,1), (0,1);
+insert into t2 (b,c) values (0,1);
+select t1.a, t1.b + 0, t1.c + 0, t2.a, t2.b + 0, t2.c, t2.d
+from t1 left outer join t2 on t1.a = t2.c and t2.b <> 1
+where t1.b <> 1 order by t1.a;
+a t1.b + 0 t1.c + 0 a t2.b + 0 c d
+1 0 1 1 0 1 NULL
+2 0 1 NULL NULL NULL NULL
+drop table t1,t2;
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 5dcb8b2afd6..7237cf11fc0 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -148,14 +148,12 @@ flush tables;
show open tables;
Database Table In_use Name_locked
mysql general_log 1 0
-mysql slow_log 1 0
create table t1(n int);
insert into t1 values (1);
show open tables;
Database Table In_use Name_locked
-mysql general_log 1 0
-mysql slow_log 1 0
test t1 0 0
+mysql general_log 1 0
drop table t1;
create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed;
show create table t1;
@@ -382,9 +380,9 @@ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length I
t1 MEMORY 10 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
t2 MEMORY 10 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
t3 MEMORY 10 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
-delete from t1;
-delete from t2;
-delete from t3;
+truncate table t1;
+truncate table t2;
+truncate table t3;
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MEMORY 10 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
@@ -568,23 +566,21 @@ SELECT 1 FROM mysql.db, mysql.proc, mysql.user, mysql.time_zone, mysql.time_zone
1
SHOW OPEN TABLES;
Database Table In_use Name_locked
-mysql proc 0 0
+mysql db 0 0
test urkunde 0 0
mysql time_zone 0 0
-mysql db 0 0
+mysql general_log 1 0
test txt1 0 0
-mysql slow_log 1 0
+mysql proc 0 0
test tyt2 0 0
-mysql general_log 1 0
mysql user 0 0
mysql time_zone_name 0 0
SHOW OPEN TABLES FROM mysql;
Database Table In_use Name_locked
-mysql proc 0 0
-mysql time_zone 0 0
mysql db 0 0
-mysql slow_log 1 0
+mysql time_zone 0 0
mysql general_log 1 0
+mysql proc 0 0
mysql user 0 0
mysql time_zone_name 0 0
SHOW OPEN TABLES FROM mysql LIKE 'u%';
@@ -598,16 +594,14 @@ test tyt2 0 0
mysql time_zone_name 0 0
SHOW OPEN TABLES LIKE '%o%';
Database Table In_use Name_locked
-mysql proc 0 0
mysql time_zone 0 0
-mysql slow_log 1 0
mysql general_log 1 0
+mysql proc 0 0
mysql time_zone_name 0 0
FLUSH TABLES;
SHOW OPEN TABLES;
Database Table In_use Name_locked
mysql general_log 1 0
-mysql slow_log 1 0
DROP TABLE txt1;
DROP TABLE tyt2;
DROP TABLE urkunde;
@@ -629,4 +623,10 @@ delete from mysql.db where user='mysqltest_4';
delete from mysql.tables_priv where user='mysqltest_4';
flush privileges;
drop database mysqltest;
+show full plugin;
+show warnings;
+Level Code Message
+Warning 1541 The syntax 'SHOW PLUGIN' is deprecated and will be removed in MySQL 5.2. Please use 'SHOW PLUGINS' instead.
+show plugin;
+show plugins;
End of 5.1 tests
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
index fde273c55ee..29206393b04 100644
--- a/mysql-test/r/sp-error.result
+++ b/mysql-test/r/sp-error.result
@@ -368,7 +368,7 @@ end|
insert into t1 values (666, 51.3)|
call bug2272()|
ERROR 42S22: Unknown column 'v' in 'field list'
-delete from t1|
+truncate table t1|
drop procedure bug2272|
create procedure bug2329_1()
begin
@@ -520,7 +520,7 @@ declare exit handler for sqlexception select 'Error!';
open c;
fetch c into v;
end|
-delete from t1|
+truncate table t1|
call bug7299()|
ERROR 02000: No data - zero rows fetched, selected, or processed
drop procedure bug7299|
@@ -621,7 +621,7 @@ val x bug8408()
3 3.14 3
7 7 3
drop function bug8408|
-delete from t1|
+truncate table t1|
drop procedure if exists bug10537|
create procedure bug10537()
load data local infile '/tmp/somefile' into table t1|
diff --git a/mysql-test/r/sp-prelocking.result b/mysql-test/r/sp-prelocking.result
index 2335513b28a..7d8dd862748 100644
--- a/mysql-test/r/sp-prelocking.result
+++ b/mysql-test/r/sp-prelocking.result
@@ -237,3 +237,21 @@ deallocate prepare stmt;
drop table t1;
drop view v1, v2, v3;
drop function bug15683;
+drop table if exists t1, t2, t3;
+drop function if exists bug19634;
+create table t1 (id int, data int);
+create table t2 (id int);
+create table t3 (data int);
+create function bug19634() returns int return (select count(*) from t3);
+prepare stmt from "delete t1 from t1, t2 where t1.id = t2.id and bug19634()";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+create trigger t1_bi before delete on t1 for each row insert into t3 values (old.data);
+prepare stmt from "delete t1 from t1, t2 where t1.id = t2.id";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+drop function bug19634;
+drop table t1, t2, t3;
+End of 5.0 tests
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 17145619f0f..45f96b08425 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -78,7 +78,7 @@ replace t1 set data = data, id = "bar";
update t1 set id = "kaka", data = 3 where t1.data = data;
end|
call setcontext()|
-select * from t1|
+select * from t1 order by data|
id data
foo 1
kaka 3
@@ -191,7 +191,7 @@ drop procedure if exists inc|
create procedure inc(inout io int)
set io = io + 1|
call iotest("io1", "io2", 1)|
-select * from t1|
+select * from t1 order by data desc|
id data
io2 2
io1 1
@@ -224,7 +224,7 @@ set y2 = 4711;
insert into test.t1 values ("cbv2", y1);
end|
call cbv1()|
-select * from t1|
+select * from t1 order by data|
id data
cbv2 4
cbv1 4711
@@ -251,7 +251,7 @@ call sub1("sub1c", (select i,d from t2 limit 1))|
ERROR 21000: Operand should contain 1 column(s)
call sub1("sub1d", (select 1 from (select 1) a))|
call sub2("sub2")|
-select * from t1|
+select * from t1 order by id|
id data
sub1a 7
sub1b 3
@@ -272,7 +272,7 @@ set x = x-1;
insert into test.t1 values ("a0", x);
end while|
call a0(3)|
-select * from t1|
+select * from t1 order by data desc|
id data
a0 2
a0 1
@@ -286,7 +286,7 @@ set x = x-1;
insert into test.t1 values ("a", x);
end while|
call a(3)|
-select * from t1|
+select * from t1 order by data desc|
id data
a 2
a 1
@@ -300,7 +300,7 @@ insert into test.t1 values (repeat("b",3), x);
set x = x-1;
until x = 0 end repeat|
call b(3)|
-select * from t1|
+select * from t1 order by data desc|
id data
bbb 3
bbb 2
@@ -323,7 +323,7 @@ iterate hmm;
insert into test.t1 values ("x", x);
end while hmm|
call c(3)|
-select * from t1|
+select * from t1 order by data desc|
id data
c 3
c 2
@@ -354,7 +354,7 @@ insert into test.t1 values ("e", x);
set x = x-1;
end loop foo|
call e(3)|
-select * from t1|
+select * from t1 order by data desc|
id data
e 3
e 2
@@ -373,7 +373,7 @@ end if|
call f(-2)|
call f(0)|
call f(4)|
-select * from t1|
+select * from t1 order by data|
id data
f 0
f 1
@@ -393,7 +393,7 @@ end case|
call g(-42)|
call g(0)|
call g(1)|
-select * from t1|
+select * from t1 order by data|
id data
g 0
g 1
@@ -413,7 +413,7 @@ end case|
call h(0)|
call h(1)|
call h(17)|
-select * from t1|
+select * from t1 order by data|
id data
h0 0
h1 1
@@ -441,7 +441,7 @@ insert into t2 values ("x", 9, 4.1), ("y", -1, 19.2), ("z", 3, 2.2)|
drop procedure if exists sel1|
create procedure sel1()
begin
-select * from t1;
+select * from t1 order by data;
end|
call sel1()|
id data
@@ -451,8 +451,8 @@ drop procedure sel1|
drop procedure if exists sel2|
create procedure sel2()
begin
-select * from t1;
-select * from t2;
+select * from t1 order by data;
+select * from t2 order by s;
end|
call sel2()|
id data
@@ -473,7 +473,7 @@ select id,data into x,y from test.t1 limit 1;
insert into test.t1 values (concat(x, "2"), y+2);
end|
call into_test("into", 100)|
-select * from t1|
+select * from t1 order by data|
id data
into 100
into2 102
@@ -487,7 +487,7 @@ select id,data into x,@z from test.t1 limit 1;
insert into test.t1 values (concat(x, "2"), y+2);
end|
call into_test2("into", 100)|
-select id,data,@z from t1|
+select id,data,@z from t1 order by data|
id data @z
into 100 100
into2 102 100
@@ -619,14 +619,14 @@ insert into t2 values (append("a", "b"), mul(2,mul(3,4)), fun(1.7, 4, 6))|
select * from t2 where s = append("a", "b")|
s i d
ab 24 1324.36598821719
-select * from t2 where i = mul(4,3) or i = mul(mul(3,4),2)|
+select * from t2 where i = mul(4,3) or i = mul(mul(3,4),2) order by i|
s i d
xxxyyy 12 2.71828182845905
ab 24 1324.36598821719
select * from t2 where d = e()|
s i d
xxxyyy 12 2.71828182845905
-select * from t2|
+select * from t2 order by i|
s i d
xxxyyy 12 2.71828182845905
ab 24 1324.36598821719
@@ -745,8 +745,8 @@ drop procedure if exists cur2|
create procedure cur2()
begin
declare done int default 0;
-declare c1 cursor for select id,data from test.t1;
-declare c2 cursor for select i from test.t2;
+declare c1 cursor for select id,data from test.t1 order by id,data;
+declare c2 cursor for select i from test.t2 order by i;
declare continue handler for sqlstate '02000' set done = 1;
open c1;
open c2;
@@ -769,10 +769,10 @@ close c1;
close c2;
end|
call cur2()|
-select * from t3|
+select * from t3 order by i,s|
s i
-foo 40
bar 3
+foo 40
zap 663
delete from t1|
delete from t2|
@@ -935,16 +935,16 @@ return (select sum(data) from t1)|
select f1()|
f1()
3
-select id, f1() from t1|
+select id, f1() from t1 order by id|
id f1()
a 3
b 3
create function f2() returns int
-return (select data from t1 where data <= (select sum(data) from t1) limit 1)|
+return (select data from t1 where data <= (select sum(data) from t1) order by data limit 1)|
select f2()|
f2()
1
-select id, f2() from t1|
+select id, f2() from t1 order by id|
id f2()
a 1
b 1
@@ -959,14 +959,14 @@ end|
select f3()|
f3()
1
-select id, f3() from t1|
+select id, f3() from t1 order by id|
id f3()
a 1
b 1
select f1(), f3()|
f1() f3()
3 1
-select id, f1(), f3() from t1|
+select id, f1(), f3() from t1 order by id|
id f1() f3()
a 3 1
b 3 1
@@ -975,7 +975,7 @@ return (select d from t1, t2 where t1.data = t2.i and t1.id= "b")|
select f4()|
f4()
2
-select s, f4() from t2|
+select s, f4() from t2 order by s|
s f4()
a 2
b 2
@@ -1008,7 +1008,7 @@ return (select sum(data) from t1 where data <= f1())|
select f6()|
f6()
2
-select id, f6() from t1|
+select id, f6() from t1 order by id|
id f6()
a 2
b 2
@@ -1016,7 +1016,7 @@ create view v1 (a) as select f1()|
select * from v1|
a
3
-select id, a from t1, v1|
+select id, a from t1, v1 order by id|
id a
a 3
b 3
@@ -1027,7 +1027,7 @@ create view v2 (a) as select a*10 from v1|
select * from v2|
a
30
-select id, a from t1, v2|
+select id, a from t1, v2 order by id|
id a
a 30
b 30
@@ -1072,7 +1072,7 @@ lock tables t1 read, t1 as t11 read|
select f3()|
f3()
1
-select id, f3() from t1 as t11|
+select id, f3() from t1 as t11 order by id|
id f3()
a 1
b 1
@@ -1175,8 +1175,8 @@ drop function f12_2|
drop view v0|
drop view v1|
drop view v2|
-delete from t1 |
-delete from t2 |
+truncate table t1 |
+truncate table t2 |
drop table t4|
drop table if exists t3|
create table t3 (n int unsigned not null primary key, f bigint unsigned)|
@@ -1355,7 +1355,7 @@ f
1
1
2
-delete from t3|
+truncate table t3|
insert into t3 values (0), (1)|
call fib(10)|
select * from t3 order by f asc|
@@ -1814,7 +1814,7 @@ delete from t1|
call bug822('foo', 42)|
call bug822('foo', 42)|
call bug822('bar', 666)|
-select * from t1|
+select * from t1 order by data|
id data
foo 42
bar 666
@@ -1837,7 +1837,7 @@ delete from t1 where id='foo'|
insert into t1 values ('bar', 7)|
call bug1495()|
delete from t1 where id='bar'|
-select * from t1|
+select * from t1 order by data|
id data
less 2
more 17
@@ -1857,10 +1857,10 @@ end|
insert into t1 values ("foo", 12), ("bar", 7)|
call bug1547("foo")|
call bug1547("bar")|
-select * from t1|
+select * from t1 order by id|
id data
-foo 12
bar 7
+foo 12
less 2
more 17
delete from t1|
@@ -1908,12 +1908,12 @@ insert into t2 values ("avg", 0, y);
end|
insert into t1 (data) values (3), (1), (5), (9), (4)|
call bug1874()|
-select * from t2|
+select * from t2 order by i|
s i d
-max 9 0
+avg 0 4.4
min 1 0
+max 9 0
sum 22 0
-avg 0 4.4
delete from t1|
delete from t2|
drop procedure bug1874|
@@ -4466,7 +4466,7 @@ Error 1347 'test.v1' is not BASE TABLE
Error 1347 'test.v1' is not BASE TABLE
drop procedure bug13012|
drop view v1;
-select * from t1|
+select * from t1 order by data|
id data
aa 0
aa 1
@@ -4803,7 +4803,7 @@ insert into t1 values ('c', 2), ('b', 3), ('a', 1)|
create procedure bug16474_1()
begin
declare x int;
-select id from t1 order by x;
+select id from t1 order by x, id;
end|
drop procedure if exists bug14945|
create table t3 (id int not null auto_increment primary key)|
@@ -4817,30 +4817,30 @@ id
drop table t3|
drop procedure bug14945|
create procedure bug16474_2(x int)
-select id from t1 order by x|
+select id from t1 order by x, id|
call bug16474_1()|
id
-c
-b
a
+b
+c
call bug16474_2(1)|
id
-c
-b
a
+b
+c
call bug16474_2(2)|
id
-c
-b
a
+b
+c
drop procedure bug16474_1|
drop procedure bug16474_2|
set @x = 2|
-select * from t1 order by @x|
+select * from t1 order by @x, data|
id data
+a 1
c 2
b 3
-a 1
delete from t1|
drop function if exists bug15728|
drop table if exists t3|
@@ -4984,4 +4984,25 @@ CALL bug18037_p2()|
DROP FUNCTION bug18037_f1|
DROP PROCEDURE bug18037_p1|
DROP PROCEDURE bug18037_p2|
+drop table if exists t3|
+drop procedure if exists bug15217|
+create table t3 as select 1|
+create procedure bug15217()
+begin
+declare var1 char(255);
+declare cur1 cursor for select * from t3;
+open cur1;
+fetch cur1 into var1;
+select concat('data was: /', var1, '/');
+close cur1;
+end |
+call bug15217()|
+concat('data was: /', var1, '/')
+data was: /1/
+flush tables |
+call bug15217()|
+concat('data was: /', var1, '/')
+data was: /1/
+drop table t3|
+drop procedure bug15217|
drop table t1,t2;
diff --git a/mysql-test/r/sql_mode.result b/mysql-test/r/sql_mode.result
index 3466282a4b1..c7be653ca2e 100644
--- a/mysql-test/r/sql_mode.result
+++ b/mysql-test/r/sql_mode.result
@@ -467,6 +467,10 @@ set sql_mode=2097152;
select @@sql_mode;
@@sql_mode
STRICT_TRANS_TABLES
+set sql_mode=4194304;
+select @@sql_mode;
+@@sql_mode
+STRICT_ALL_TABLES
set sql_mode=16384+(65536*4);
select @@sql_mode;
@@sql_mode
diff --git a/mysql-test/r/status.result b/mysql-test/r/status.result
index e83ade78cf6..83c6a6f5288 100644
--- a/mysql-test/r/status.result
+++ b/mysql-test/r/status.result
@@ -23,6 +23,32 @@ select 1;
show status like 'last_query_cost';
Variable_name Value
Last_query_cost 0.000000
+create table t1 (a int);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+select * from t1 where a=6;
+a
+6
+6
+6
+6
+6
+show status like 'last_query_cost';
+Variable_name Value
+Last_query_cost 12.084449
+show status like 'last_query_cost';
+Variable_name Value
+Last_query_cost 12.084449
+select 1;
+1
+1
+show status like 'last_query_cost';
+Variable_name Value
+Last_query_cost 0.000000
+drop table t1;
FLUSH STATUS;
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
@@ -43,3 +69,27 @@ SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections 5
SET GLOBAL thread_cache_size=@save_thread_cache_size;
+show status like 'com_show_status';
+Variable_name Value
+Com_show_status 3
+show status like 'hand%write%';
+Variable_name Value
+Handler_write 0
+show status like '%tmp%';
+Variable_name Value
+Created_tmp_disk_tables 0
+Created_tmp_files 0
+Created_tmp_tables 0
+show status like 'hand%write%';
+Variable_name Value
+Handler_write 0
+show status like '%tmp%';
+Variable_name Value
+Created_tmp_disk_tables 0
+Created_tmp_files 0
+Created_tmp_tables 0
+show status like 'com_show_status';
+Variable_name Value
+Com_show_status 8
+rnd_diff tmp_table_diff
+20 8
diff --git a/mysql-test/r/sysdate_is_now.result b/mysql-test/r/sysdate_is_now.result
index 82861436ff6..1ebbb8c1588 100644
--- a/mysql-test/r/sysdate_is_now.result
+++ b/mysql-test/r/sysdate_is_now.result
@@ -1,4 +1,4 @@
set timestamp=1;
SELECT sleep(1),NOW()-SYSDATE() as zero;
sleep(1) zero
-0 0
+0 0.000000
diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result
index 2b3e9087cf7..637f74a1d50 100644
--- a/mysql-test/r/temp_table.result
+++ b/mysql-test/r/temp_table.result
@@ -98,7 +98,7 @@ d
show status like "created_tmp%tables";
Variable_name Value
Created_tmp_disk_tables 0
-Created_tmp_tables 2
+Created_tmp_tables 1
drop table t1;
create temporary table v1 as select 'This is temp. table' A;
create view v1 as select 'This is view' A;
diff --git a/mysql-test/r/timezone2.result b/mysql-test/r/timezone2.result
index fe9e971af2f..af8d52a017d 100644
--- a/mysql-test/r/timezone2.result
+++ b/mysql-test/r/timezone2.result
@@ -70,7 +70,7 @@ i ts
1067129999 2003-10-26 00:59:59
1067137200 2003-10-26 03:00:00
1067129999 2003-10-26 00:59:59
-delete from t1;
+truncate table t1;
set time_zone='Europe/Moscow';
insert into t1 (i, ts) values
(unix_timestamp('2004-01-01 00:00:00'),'2004-01-01 00:00:00'),
@@ -85,7 +85,7 @@ i ts
1080428400 2004-03-28 03:00:00
1091304000 2003-08-01 00:00:00
1099175400 2004-10-31 02:30:00
-delete from t1;
+truncate table t1;
set time_zone='leap/Europe/Moscow';
insert into t1 (i, ts) values
(unix_timestamp('2004-01-01 00:00:00'),'2004-01-01 00:00:00'),
@@ -100,7 +100,7 @@ i ts
1080428422 2004-03-28 03:00:00
1091304022 2003-08-01 00:00:00
1099175422 2004-10-31 02:30:00
-delete from t1;
+truncate table t1;
insert into t1 (i, ts) values
(unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
(unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
@@ -129,7 +129,7 @@ ts
1970-01-01 00:00:01
2037-12-31 23:59:59
0000-00-00 00:00:00
-delete from t1;
+truncate table t1;
set time_zone='MET';
insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 00:30:00'),
('1970-01-01 01:00:00'),('1970-01-01 01:00:01'),
@@ -146,7 +146,7 @@ ts
1970-01-01 01:00:01
2038-01-01 00:59:59
0000-00-00 00:00:00
-delete from t1;
+truncate table t1;
set time_zone='+01:30';
insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 01:00:00'),
('1970-01-01 01:30:00'),('1970-01-01 01:30:01'),
diff --git a/mysql-test/r/trigger-grant.result b/mysql-test/r/trigger-grant.result
index fec5d4812d9..eb211be0270 100644
--- a/mysql-test/r/trigger-grant.result
+++ b/mysql-test/r/trigger-grant.result
@@ -51,8 +51,8 @@ GRANT TRIGGER ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
---> connection: wl2818_definer_con
INSERT INTO t1 VALUES(0);
DROP TRIGGER trg1;
-DELETE FROM t1;
-DELETE FROM t2;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
---> connection: default
REVOKE SUPER ON *.* FROM mysqltest_dfn@localhost;
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index 24675f2cd66..145579201a9 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -169,21 +169,22 @@ select @log;
@log
(BEFORE_INSERT: new=(id=1, data=2))
set @log:= "";
-replace t1 values (1, 3), (2, 2);
+insert into t1 (id, data) values (1, 3), (2, 2) on duplicate key update data= data + 1;
select @log;
@log
-(BEFORE_INSERT: new=(id=1, data=3))(BEFORE_UPDATE: old=(id=1, data=1) new=(id=1, data=3))(AFTER_UPDATE: old=(id=1, data=1) new=(id=1, data=3))(BEFORE_INSERT: new=(id=2, data=2))(AFTER_INSERT: new=(id=2, data=2))
-alter table t1 add ts timestamp default now();
+(BEFORE_INSERT: new=(id=1, data=3))(BEFORE_UPDATE: old=(id=1, data=1) new=(id=1, data=2))(AFTER_UPDATE: old=(id=1, data=1) new=(id=1, data=2))(BEFORE_INSERT: new=(id=2, data=2))(AFTER_INSERT: new=(id=2, data=2))
set @log:= "";
-replace t1 (id, data) values (1, 4);
+replace t1 values (1, 4), (3, 3);
select @log;
@log
-(BEFORE_INSERT: new=(id=1, data=4))(BEFORE_DELETE: old=(id=1, data=3))(AFTER_DELETE: old=(id=1, data=3))(AFTER_INSERT: new=(id=1, data=4))
+(BEFORE_INSERT: new=(id=1, data=4))(BEFORE_DELETE: old=(id=1, data=2))(AFTER_DELETE: old=(id=1, data=2))(AFTER_INSERT: new=(id=1, data=4))(BEFORE_INSERT: new=(id=3, data=3))(AFTER_INSERT: new=(id=3, data=3))
+drop trigger t1_bd;
+drop trigger t1_ad;
set @log:= "";
-insert into t1 (id, data) values (1, 5), (3, 3) on duplicate key update data= data + 2;
+replace t1 values (1, 5);
select @log;
@log
-(BEFORE_INSERT: new=(id=1, data=5))(BEFORE_UPDATE: old=(id=1, data=4) new=(id=1, data=6))(AFTER_UPDATE: old=(id=1, data=4) new=(id=1, data=6))(BEFORE_INSERT: new=(id=3, data=3))(AFTER_INSERT: new=(id=3, data=3))
+(BEFORE_INSERT: new=(id=1, data=5))(AFTER_INSERT: new=(id=1, data=5))
drop table t1;
create table t1 (id int primary key, data varchar(10), fk int);
create table t2 (event varchar(100));
@@ -493,15 +494,9 @@ select * from t1;
i k
3 13
replace into t1 values (3, 3);
-ERROR 42S22: Unknown column 'at' in 'NEW'
-select * from t1;
-i k
-3 3
-alter table t1 add ts timestamp default now();
-replace into t1 (i, k) values (3, 13);
ERROR 42S22: Unknown column 'at' in 'OLD'
select * from t1;
-i k ts
+i k
drop table t1, t2;
create table t1 (i int, bt int, k int, key(k)) engine=myisam;
create table t2 (i int);
@@ -574,18 +569,11 @@ i k
1 1
2 2
replace into t1 values (2, 4);
-ERROR 42S22: Unknown column 'bt' in 'NEW'
+ERROR 42S22: Unknown column 'bt' in 'OLD'
select * from t1;
i k
1 1
2 2
-alter table t1 add ts timestamp default now();
-replace into t1 (i, k) values (2, 11);
-ERROR 42S22: Unknown column 'bt' in 'OLD'
-select * from t1;
-i k ts
-1 1 0000-00-00 00:00:00
-2 2 0000-00-00 00:00:00
drop table t1, t2;
drop function if exists bug5893;
create table t1 (col1 int, col2 int);
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index 5eba97a9eda..6f1a45f27c5 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -151,7 +151,7 @@ insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00
Warnings:
Warning 1264 Out of range value for column 't' at row 1
Warning 1264 Out of range value for column 't' at row 2
-select * from t1;
+select * from t1 order by t;
t
0000-00-00 00:00:00
2003-01-01 00:00:00
diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result
index a6cf657a278..31291ab07a4 100644
--- a/mysql-test/r/type_newdecimal.result
+++ b/mysql-test/r/type_newdecimal.result
@@ -1406,4 +1406,14 @@ alter table t1 modify a decimal(10,2);
select * from t1;
a
123.12
+create table t1 (i int, j int);
+insert into t1 values (1,1), (1,2), (2,3), (2,4);
+select i, count(distinct j) from t1 group by i;
+i count(distinct j)
+1 2
+2 2
+select i+0.0 as i2, count(distinct j) from t1 group by i2;
+i2 count(distinct j)
+1.0 2
+2.0 2
drop table t1;
diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result
index ba401a22945..df3298bad1a 100644
--- a/mysql-test/r/type_ranges.result
+++ b/mysql-test/r/type_ranges.result
@@ -323,7 +323,7 @@ select * from t3;
id_A id_B
1 1
2 NULL
-delete from t3;
+truncate table t3;
insert into t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 on (t1.id = t2.id);
select * from t3;
id_A id_B
diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result
index 95ec7526473..b1c55c517ac 100644
--- a/mysql-test/r/type_timestamp.result
+++ b/mysql-test/r/type_timestamp.result
@@ -1,4 +1,5 @@
drop table if exists t1,t2;
+set time_zone="+03:00";
CREATE TABLE t1 (a int, t timestamp);
CREATE TABLE t2 (a int, t datetime);
SET TIMESTAMP=1234;
@@ -59,7 +60,7 @@ ix+0
19990501000000
19991101000000
19990501000000
-delete from t1;
+truncate table t1;
insert into t1 values ("19991101000000"),("19990102030405"),("19990630232922"),("19990601000000");
select ix+0 from t1;
ix+0
@@ -140,7 +141,7 @@ ix+0
0
0
0
-delete from t1;
+truncate table t1;
insert into t1 values ("00000000000000"),("20030101010160"),("20030101016001"),("20030101240101"),("20030132010101"),("20031301010101"),("20031200000000"),("20030000000000");
Warnings:
Warning 1265 Data truncated for column 'ix' at row 2
@@ -160,7 +161,7 @@ ix+0
0
0
0
-delete from t1;
+truncate table t1;
insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
Warnings:
Warning 1265 Data truncated for column 'ix' at row 1
@@ -329,7 +330,7 @@ show columns from t1;
Field Type Null Key Default Extra
t1 timestamp YES CURRENT_TIMESTAMP
t2 datetime YES NULL
-delete from t1;
+truncate table t1;
insert into t1 values ('2004-04-01 00:00:00', '2004-04-01 00:00:00');
SET TIMESTAMP=1000000012;
update t1 set t1= '2004-04-02 00:00:00';
@@ -491,3 +492,4 @@ a b c
5 NULL 2001-09-09 04:46:59
6 NULL 2006-06-06 06:06:06
drop table t1;
+set time_zone= @@global.time_zone;
diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result
index 01aa8539262..d6b96bae8d4 100644
--- a/mysql-test/r/udf.result
+++ b/mysql-test/r/udf.result
@@ -76,6 +76,24 @@ call XXX2();
metaphon(testval)
HL
drop procedure xxx2;
+CREATE TABLE bug19904(n INT, v varchar(10));
+INSERT INTO bug19904 VALUES (1,'one'),(2,'two'),(NULL,NULL),(3,'three'),(4,'four');
+SELECT myfunc_double(n) AS f FROM bug19904;
+f
+49.00
+50.00
+NULL
+51.00
+52.00
+SELECT metaphon(v) AS f FROM bug19904;
+f
+ON
+TW
+NULL
+0R
+FR
+DROP TABLE bug19904;
+End of 5.0 tests.
DROP FUNCTION metaphon;
DROP FUNCTION myfunc_double;
DROP FUNCTION myfunc_nonexist;
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 57beb6e4197..43598caa86f 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -836,27 +836,27 @@ count(*)
26
show status like 'Slow_queries';
Variable_name Value
-Slow_queries 1
+Slow_queries 0
select count(*) from t1 where b=13;
count(*)
10
show status like 'Slow_queries';
Variable_name Value
-Slow_queries 3
+Slow_queries 1
select count(*) from t1 where b=13 union select count(*) from t1 where a=7;
count(*)
10
26
show status like 'Slow_queries';
Variable_name Value
-Slow_queries 5
+Slow_queries 2
select count(*) from t1 where a=7 union select count(*) from t1 where b=13;
count(*)
26
10
show status like 'Slow_queries';
Variable_name Value
-Slow_queries 7
+Slow_queries 3
flush status;
select a from t1 where b not in (1,2,3) union select a from t1 where b not in (4,5,6);
a
@@ -1306,3 +1306,48 @@ id
5
99
drop table t1;
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1));
+avg(1)
+NULL
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 9fabb0ad2d8..7f3c0f79520 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -1106,21 +1106,21 @@ insert ignore into v1 SELECT a from t2;
Warnings:
Error 1369 CHECK OPTION failed 'test.v1'
Error 1369 CHECK OPTION failed 'test.v1'
-select * from t1;
+select * from t1 order by a desc;
a
1
0
update v1 set a=-1 where a=0;
update v1 set a=2 where a=1;
ERROR HY000: CHECK OPTION failed 'test.v1'
-select * from t1;
+select * from t1 order by a desc;
a
1
-1
update v1 set a=0 where a=0;
insert into t2 values (1);
update v1,t2 set v1.a=v1.a-1 where v1.a=t2.a;
-select * from t1;
+select * from t1 order by a desc;
a
0
-1
@@ -1310,12 +1310,12 @@ Warning 1264 Out of range value for column 'a' at row 3
Error 1369 CHECK OPTION failed 'test.v1'
Warning 1264 Out of range value for column 'a' at row 4
Error 1369 CHECK OPTION failed 'test.v1'
-select * from t1;
+select * from t1 order by a,b;
a b
1 row 1
2 row 2
3 row 3
-select * from v1;
+select * from v1 order by a,b;
a b
1 row 1
2 row 2
diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result
index db82016f398..5f91127d284 100644
--- a/mysql-test/r/view_grant.result
+++ b/mysql-test/r/view_grant.result
@@ -620,3 +620,44 @@ ERROR HY000: There is no 'no-such-user'@'localhost' registered
DROP VIEW v;
DROP TABLE t1;
USE test;
+CREATE USER mysqltest_db1@localhost identified by 'PWD';
+GRANT ALL ON mysqltest_db1.* TO mysqltest_db1@localhost WITH GRANT OPTION;
+CREATE SCHEMA mysqltest_db1 ;
+USE mysqltest_db1 ;
+CREATE TABLE t1 (f1 INTEGER);
+CREATE VIEW view1 AS
+SELECT * FROM t1;
+SHOW CREATE VIEW view1;
+View Create View
+view1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_db1`@`localhost` SQL SECURITY DEFINER VIEW `view1` AS select `t1`.`f1` AS `f1` from `t1`
+CREATE VIEW view2 AS
+SELECT * FROM view1;
+# Here comes a suspicious warning
+SHOW CREATE VIEW view2;
+View Create View
+view2 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_db1`@`localhost` SQL SECURITY DEFINER VIEW `view2` AS select `view1`.`f1` AS `f1` from `view1`
+# But the view view2 is usable
+SELECT * FROM view2;
+f1
+CREATE VIEW view3 AS
+SELECT * FROM view2;
+SELECT * from view3;
+f1
+DROP VIEW mysqltest_db1.view3;
+DROP VIEW mysqltest_db1.view2;
+DROP VIEW mysqltest_db1.view1;
+DROP TABLE mysqltest_db1.t1;
+DROP SCHEMA mysqltest_db1;
+DROP USER mysqltest_db1@localhost;
+CREATE DATABASE test1;
+CREATE DATABASE test2;
+CREATE TABLE test1.t0 (a VARCHAR(20));
+CREATE TABLE test2.t1 (a VARCHAR(20));
+CREATE VIEW test2.t3 AS SELECT * FROM test1.t0;
+CREATE OR REPLACE VIEW test.v1 AS
+SELECT ta.a AS col1, tb.a AS col2 FROM test2.t3 ta, test2.t1 tb;
+DROP VIEW test.v1;
+DROP VIEW test2.t3;
+DROP TABLE test2.t1, test1.t0;
+DROP DATABASE test2;
+DROP DATABASE test1;
diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result
index 06dc2f3d78a..21e8f804192 100644
--- a/mysql-test/r/xml.result
+++ b/mysql-test/r/xml.result
@@ -132,7 +132,7 @@ xb1 xc1
SELECT extractValue(@xml,'/a//@x[2]');
extractValue(@xml,'/a//@x[2]')
xb2 xc2
-SET @xml='<a><b>b1</b><b>b2</b><c><b>c1b1</b><b>c1b2</b></c><c><b>c2b1</c></b>/a>';
+SET @xml='<a><b>b1</b><b>b2</b><c><b>c1b1</b><b>c1b2</b></c><c><b>c2b1</c></b></a>';
SELECT extractValue(@xml,'//b[1]');
extractValue(@xml,'//b[1]')
b1 c1b1 c2b1
@@ -636,6 +636,36 @@ extractvalue('<a>Jack</a>' collate latin1_bin,'/a[contains(../a,"j")]')
select ExtractValue('<tag1><![CDATA[test]]></tag1>','/tag1');
ExtractValue('<tag1><![CDATA[test]]></tag1>','/tag1')
test
+select extractValue('<a>a','/a');
+extractValue('<a>a','/a')
+NULL
+Warnings:
+Warning 1512 Incorrect XML value: 'parse error at line 1 pos 5: unexpected END-OF-INPUT'
+select extractValue('<a>a<','/a');
+extractValue('<a>a<','/a')
+NULL
+Warnings:
+Warning 1512 Incorrect XML value: 'parse error at line 1 pos 6: END-OF-INPUT unexpected (ident or '/' wanted)'
+select extractValue('<a>a</','/a');
+extractValue('<a>a</','/a')
+NULL
+Warnings:
+Warning 1512 Incorrect XML value: 'parse error at line 1 pos 7: END-OF-INPUT unexpected (ident wanted)'
+select extractValue('<a>a</a','/a');
+extractValue('<a>a</a','/a')
+NULL
+Warnings:
+Warning 1512 Incorrect XML value: 'parse error at line 1 pos 8: END-OF-INPUT unexpected ('>' wanted)'
+select extractValue('<a>a</a></b>','/a');
+extractValue('<a>a</a></b>','/a')
+NULL
+Warnings:
+Warning 1512 Incorrect XML value: 'parse error at line 1 pos 12: '</b>' unexpected (END-OF-INPUT wanted)'
+select extractValue('<a b=>a</a>','/a');
+extractValue('<a b=>a</a>','/a')
+NULL
+Warnings:
+Warning 1512 Incorrect XML value: 'parse error at line 1 pos 7: '>' unexpected (ident or string wanted)'
select extractValue('<e>1</e>','position()');
ERROR HY000: XPATH syntax error: ''
select extractValue('<e>1</e>','last()');
diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test
index c89d31c69b9..294e7730e07 100644
--- a/mysql-test/t/archive.test
+++ b/mysql-test/t/archive.test
@@ -3,6 +3,7 @@
# Taken FROM the select test
#
-- source include/have_archive.inc
+-- source include/have_binlog_format_statement.inc
--disable_warnings
drop table if exists t1,t2,t3;
@@ -1330,12 +1331,14 @@ SELECT * FROM t2;
#
# For bug #12836
# Delete was allowing all rows to be removed
+--error 1031
DELETE FROM t2;
SELECT * FROM t2;
INSERT INTO t2 VALUES (2,011401,37,'breaking','dreaded','Steinberg','W');
INSERT INTO t2 VALUES (3,011402,37,'Romans','scholastics','jarring','');
INSERT INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily','');
SELECT * FROM t2;
+--error 1031
TRUNCATE TABLE t2;
SELECT * FROM t2;
diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test
index e0b024d021b..2674639d0ac 100644
--- a/mysql-test/t/auto_increment.test
+++ b/mysql-test/t/auto_increment.test
@@ -238,6 +238,23 @@ SHOW CREATE TABLE `t1`;
DROP TABLE `t1`;
+#
+# Bug #6880: LAST_INSERT_ID() within a statement
+#
+
+create table t1(a int not null auto_increment primary key);
+create table t2(a int not null auto_increment primary key, t1a int);
+insert into t1 values(NULL);
+insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID());
+insert into t1 values (NULL);
+insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID()),
+(NULL, LAST_INSERT_ID());
+insert into t1 values (NULL);
+insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID()),
+(NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID());
+select * from t2;
+drop table t1, t2;
+
--echo End of 4.1 tests
#
diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test
index dbf5559943a..ebee341907c 100644
--- a/mysql-test/t/bdb.test
+++ b/mysql-test/t/bdb.test
@@ -1045,6 +1045,7 @@ commit;
alter table t1 add primary key(a);
drop table t1;
+
--echo End of 5.0 tests
#
diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test
index dead9a7a0bc..0a112233ffb 100644
--- a/mysql-test/t/ctype_latin1.test
+++ b/mysql-test/t/ctype_latin1.test
@@ -110,3 +110,14 @@ SELECT convert(@str collate latin1_german2_ci using utf8);
SELECT convert(@str collate latin1_swedish_ci using utf8);
# End of 4.1 tests
+
+SET NAMES latin1;
+--disable_warnings
+DROP TABLE IF EXISTS `abcÿdef`;
+--enable_warnings
+CREATE TABLE `abcÿdef` (i int);
+INSERT INTO `abcÿdef` VALUES (1);
+INSERT INTO abcÿdef VALUES (2);
+SELECT * FROM `abcÿdef`;
+SELECT * FROM abcÿdef;
+DROP TABLE `abcÿdef`;
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index c7662f4f85a..eea0b06b224 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -439,6 +439,32 @@ insert into t1 values('a');
create index t1f1 on t1(f1);
select f1 from t1 where f1 like 'a%';
drop table t1;
+
+#
+# Bug#9442 Set parameter make query fail if column character set is UCS2
+#
+create table t1 (utext varchar(20) character set ucs2);
+insert into t1 values ("lily");
+insert into t1 values ("river");
+prepare stmt from 'select utext from t1 where utext like ?';
+set @param1='%%';
+execute stmt using @param1;
+execute stmt using @param1;
+select utext from t1 where utext like '%%';
+drop table t1;
+deallocate prepare stmt;
+
+#
+# Bug #20076: server crashes for a query with GROUP BY if MIN/MAX aggregation
+# over a 'ucs2' field uses a temporary table
+#
+
+CREATE TABLE t1 (id int, s char(5) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci);
+INSERT INTO t1 VALUES (1, 'ZZZZZ'), (1, 'ZZZ'), (2, 'ZZZ'), (2, 'ZZZZZ');
+
+SELECT id, MIN(s) FROM t1 GROUP BY id;
+
+DROP TABLE t1;
# End of 4.1 tests
#
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 5ca1f58d233..77b76a14171 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -912,6 +912,120 @@ INSERT INTO t1 VALUES('uUABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbb
check table t1;
drop table t1;
+#
+# Bug#14896: Comparison with a key in a partial index over mb chararacter field
+#
+
+SET NAMES utf8;
+CREATE TABLE t1 (id int PRIMARY KEY,
+ a varchar(16) collate utf8_unicode_ci NOT NULL default '',
+ b int,
+ f varchar(128) default 'XXX',
+ INDEX (a(4))
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+INSERT INTO t1(id, a, b) VALUES
+ (1, 'cccc', 50), (2, 'cccc', 70), (3, 'cccc', 30),
+ (4, 'cccc', 30), (5, 'cccc', 20), (6, 'bbbbbb', 40),
+ (7, 'dddd', 30), (8, 'aaaa', 10), (9, 'aaaa', 50),
+ (10, 'eeeee', 40), (11, 'bbbbbb', 60);
+
+SELECT id, a, b FROM t1;
+
+SELECT id, a, b FROM t1 WHERE a BETWEEN 'aaaa' AND 'bbbbbb';
+
+SELECT id, a FROM t1 WHERE a='bbbbbb';
+SELECT id, a FROM t1 WHERE a='bbbbbb' ORDER BY b;
+
+DROP TABLE t1;
+
+#
+# Bug#16674: LIKE predicate for a utf8 character set column
+#
+
+SET NAMES utf8;
+
+CREATE TABLE t1 (
+ a CHAR(13) DEFAULT '',
+ INDEX(a)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
+INSERT INTO t1 VALUES
+ ('Käli Käli 2-4'), ('Käli Käli 2-4'),
+ ('Käli Käli 2+4'), ('Käli Käli 2+4'),
+ ('Käli Käli 2-6'), ('Käli Käli 2-6');
+INSERT INTO t1 SELECT * FROM t1;
+
+CREATE TABLE t2 (
+ a CHAR(13) DEFAULT '',
+ INDEX(a)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
+
+INSERT INTO t2 VALUES
+ ('Kali Kali 2-4'), ('Kali Kali 2-4'),
+ ('Kali Kali 2+4'), ('Kali Kali 2+4'),
+ ('Kali Kali 2-6'), ('Kali Kali 2-6');
+INSERT INTO t2 SELECT * FROM t2;
+
+SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4';
+SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4';
+
+EXPLAIN SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4';
+EXPLAIN SELECT a FROM t1 WHERE a = 'Käli Käli 2+4';
+EXPLAIN SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4';
+EXPLAIN SELECT a FROM t2 WHERE a = 'Kali Kali 2+4';
+
+DROP TABLE t1,t2;
+
+CREATE TABLE t1 (
+ a char(255) DEFAULT '',
+ KEY(a(10))
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
+INSERT INTO t1 VALUES ('Käli Käli 2-4');
+SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
+INSERT INTO t1 VALUES ('Käli Käli 2-4');
+SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ a char(255) DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
+INSERT INTO t1 VALUES ('Käli Käli 2-4');
+INSERT INTO t1 VALUES ('Käli Käli 2-4');
+SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
+ALTER TABLE t1 ADD KEY (a(10));
+SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
+DROP TABLE t1;
+
+#
+# Bug#18359: LIKE predicate for a 'utf8' text column with a partial index
+# (see bug #16674 as well)
+#
+
+SET NAMES latin2;
+
+CREATE TABLE t1 (
+ id int(11) NOT NULL default '0',
+ tid int(11) NOT NULL default '0',
+ val text NOT NULL,
+ INDEX idx(tid, val(10))
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+INSERT INTO t1 VALUES
+ (40988,72,'VOLNÝ ADSL'),(41009,72,'VOLNÝ ADSL'),
+ (41032,72,'VOLNÝ ADSL'),(41038,72,'VOLNÝ ADSL'),
+ (41063,72,'VOLNÝ ADSL'),(41537,72,'VOLNÝ ADSL Office'),
+ (42141,72,'VOLNÝ ADSL'),(42565,72,'VOLNÝ ADSL Combi'),
+ (42749,72,'VOLNÝ ADSL'),(44205,72,'VOLNÝ ADSL');
+
+SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLNY ADSL';
+SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLNÝ ADSL';
+SELECT * FROM t1 WHERE tid=72 and val LIKE '%VOLNÝ ADSL';
+
+ALTER TABLE t1 DROP KEY idx;
+ALTER TABLE t1 ADD KEY idx (tid,val(11));
+
+SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLNÝ ADSL';
+
+DROP TABLE t1;
# End of 4.1 tests
#
diff --git a/mysql-test/t/delayed.test b/mysql-test/t/delayed.test
index 5ae757b1fde..55e8f81f763 100644
--- a/mysql-test/t/delayed.test
+++ b/mysql-test/t/delayed.test
@@ -50,3 +50,52 @@ insert into t1 values (1);
insert delayed into t1 values (1);
select * from t1;
drop table t1;
+
+#
+# Bug #20195: INSERT DELAYED with auto_increment is assigned wrong values
+#
+CREATE TABLE t1 ( a int(10) NOT NULL auto_increment, PRIMARY KEY (a));
+
+# Make one delayed insert to start the separate thread
+insert delayed into t1 values(null);
+
+# Do some normal inserts
+insert into t1 values(null);
+insert into t1 values(null);
+
+# Discarded, since the delayed-counter is 2, which is already used
+insert delayed into t1 values(null);
+
+# Discarded, since the delayed-counter is 3, which is already used
+insert delayed into t1 values(null);
+
+# Works, since the delayed-counter is 4, which is unused
+insert delayed into t1 values(null);
+
+# Do some more inserts
+insert into t1 values(null);
+insert into t1 values(null);
+insert into t1 values(null);
+
+# Delete one of the above to make a hole
+delete from t1 where a=6;
+
+# Discarded, since the delayed-counter is 5, which is already used
+insert delayed into t1 values(null);
+
+# Works, since the delayed-counter is 6, which is unused (the row we deleted)
+insert delayed into t1 values(null);
+
+# Discarded, since the delayed-counter is 7, which is already used
+insert delayed into t1 values(null);
+
+# Works, since the delayed-counter is 8, which is unused
+insert delayed into t1 values(null);
+
+# Check what we have now
+# must wait so that the delayed thread finishes
+# Note: this must be increased if the test fails
+--sleep 1
+select * from t1 order by a;
+
+DROP TABLE t1;
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index 96f31133e65..6f26847f8d7 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -13,9 +13,9 @@
#events_stress : BUG#17619 2006-02-21 andrey Race conditions
#events : BUG#17619 2006-02-21 andrey Race conditions
#events_scheduling : BUG#19170 2006-04-26 andrey Test case of 19170 fails on some platforms. Has to be checked.
-im_instance_conf : Bug#20294 2006-06-06 monty Instance manager test im_instance_conf fails randomly
-im_options : Bug#20294 2006-06-06 monty Instance manager test im_instance_conf fails randomly
-im_life_cycle : Bug#20368 2006-06-10 alik im_life_cycle test fails
+#im_instance_conf : Bug#20294 2006-06-06 monty Instance manager test im_instance_conf fails randomly
+#im_options : Bug#20294 2006-06-06 monty Instance manager test im_instance_conf fails randomly
+#im_life_cycle : Bug#20368 2006-06-10 alik im_life_cycle test fails
ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
#ndb_binlog_discover : BUG#19395 2006-04-28 tomas/knielsen mysqld does not always detect cluster shutdown
@@ -26,7 +26,6 @@ partition_03ndb : BUG#16385 2006-03-24 mikael Partitions: crash when up
ps_7ndb : BUG#18950 2006-02-16 jmiller create table like does not obtain LOCK_open
rpl_ndb_2innodb : BUG#19227 2006-04-20 pekka pk delete apparently not replicated
rpl_ndb_2myisam : BUG#19227 Seems to pass currently
-rpl_ndb_auto_inc : BUG#17086 2006-02-16 jmiller CR: auto_increment_increment and auto_increment_offset produce duplicate key er
#rpl_ndb_commit_afterflush : BUG#19328 2006-05-04 tomas Slave timeout with COM_REGISTER_SLAVE error causing stop
rpl_ndb_dd_partitions : BUG#19259 2006-04-21 rpl_ndb_dd_partitions fails on s/AMD
rpl_ndb_ddl : BUG#18946 result file needs update + test needs to checked
@@ -36,8 +35,8 @@ rpl_ndb_myisam2ndb : Bug #19710 Cluster replication to partition table fa
rpl_switch_stm_row_mixed : BUG#18590 2006-03-28 brian
rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly
rpl_row_func003 : BUG#19074 2006-13-04 andrei test failed
-rpl_row_inexist_tbl : BUG#18948 2006-03-09 mats Disabled since patch makes this test wait forever
rpl_sp : BUG#16456 2006-02-16 jmiller
+rpl_sp_effects : BUG#19862 2006-06-15 mkindahl
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
#ndb_binlog_ddl_multi : BUG#18976 2006-04-10 kent CRBR: multiple binlog, second binlog may miss schema log events
diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test
index 09f07c2852f..61250a7105e 100644
--- a/mysql-test/t/distinct.test
+++ b/mysql-test/t/distinct.test
@@ -349,6 +349,34 @@ SELECT DISTINCT 2, a, b FROM t2;
SELECT DISTINCT a, 2, b FROM t2;
DROP TABLE t1,t2;
+#
+# Bug#16458: Simple SELECT FOR UPDATE causes "Result Set not updatable"
+# error.
+#
+CREATE TABLE t1(a INT PRIMARY KEY, b INT);
+INSERT INTO t1 VALUES (1,1), (2,1), (3,1);
+EXPLAIN SELECT DISTINCT a FROM t1;
+EXPLAIN SELECT DISTINCT a,b FROM t1;
+EXPLAIN SELECT DISTINCT t1_1.a, t1_1.b FROM t1 t1_1, t1 t1_2;
+EXPLAIN SELECT DISTINCT t1_1.a, t1_1.b FROM t1 t1_1, t1 t1_2
+ WHERE t1_1.a = t1_2.a;
+EXPLAIN SELECT a FROM t1 GROUP BY a;
+EXPLAIN SELECT a,b FROM t1 GROUP BY a,b;
+EXPLAIN SELECT DISTINCT a,b FROM t1 GROUP BY a,b;
+
+CREATE TABLE t2(a INT, b INT, c INT, d INT, PRIMARY KEY (a,b));
+INSERT INTO t2 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4);
+EXPLAIN SELECT DISTINCT a FROM t2;
+EXPLAIN SELECT DISTINCT a,a FROM t2;
+EXPLAIN SELECT DISTINCT b,a FROM t2;
+EXPLAIN SELECT DISTINCT a,c FROM t2;
+EXPLAIN SELECT DISTINCT c,a,b FROM t2;
+
+EXPLAIN SELECT DISTINCT a,b,d FROM t2 GROUP BY c,b,d;
+CREATE UNIQUE INDEX c_b_unq ON t2 (c,b);
+EXPLAIN SELECT DISTINCT a,b,d FROM t2 GROUP BY c,b,d;
+
+DROP TABLE t1,t2;
# Bug 9784 DISTINCT IFNULL truncates data
#
diff --git a/mysql-test/t/events.test b/mysql-test/t/events.test
index a3e2bbc0998..aac13a55dd3 100644
--- a/mysql-test/t/events.test
+++ b/mysql-test/t/events.test
@@ -1,3 +1,6 @@
+# Can't test with embedded server that doesn't support grants
+-- source include/not_embedded.inc
+
create database if not exists events_test;
use events_test;
@@ -327,15 +330,15 @@ on schedule every 10 hour
disable
do
select 1;
-select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
+select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
drop event white_space;
create event white_space on schedule every 10 hour disable do
select 2;
-select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
+select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
drop event white_space;
create event white_space on schedule every 10 hour disable do select 3;
-select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
+select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
drop event white_space;
#
# END: BUG #17453: Creating Event crash the server
diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test
index e3b79a6bd13..9434de7be7d 100644
--- a/mysql-test/t/events_bugs.test
+++ b/mysql-test/t/events_bugs.test
@@ -1,3 +1,6 @@
+# Can't test with embedded server that doesn't support grants
+-- source include/not_embedded.inc
+
create database if not exists events_test;
use events_test;
@@ -172,4 +175,38 @@ set sql_mode=@old_sql_mode;
#
# End - 16407: Events: Changes in sql_mode won't be taken into account
#
+
+#
+# START - 18897: Events: unauthorized action possible with alter event rename
+#
+set global event_scheduler=2;
+--disable_warnings
+delete from mysql.user where User like 'mysqltest_%';
+delete from mysql.db where User like 'mysqltest_%';
+flush privileges;
+drop database if exists mysqltest_db1;
+--enable_warnings
+create user mysqltest_user1@localhost;
+create database mysqltest_db1;
+grant event on events_test.* to mysqltest_user1@localhost;
+connect (conn2,localhost,mysqltest_user1,,events_test);
+create event mysqltest_user1 on schedule every 10 second do select 42;
+--error ER_DBACCESS_DENIED_ERROR
+alter event mysqltest_user1 rename to mysqltest_db1.mysqltest_user1;
+--echo "Let's test now rename when there is no select DB"
+disconnect conn2;
+connect (conn2,localhost,mysqltest_user1,,*NO-ONE*);
+select database();
+--error ER_NO_DB_ERROR
+alter event events_test.mysqltest_user1 rename to mysqltest_user1;
+select event_schema, event_name, definer, event_type, status from information_schema.events;
+drop event events_test.mysqltest_user1;
+disconnect conn2;
+connection default;
+drop user mysqltest_user1@localhost;
+drop database mysqltest_db1;
+#
+# END - 18897: Events: unauthorized action possible with alter event rename
+#
+
drop database events_test;
diff --git a/mysql-test/t/events_grant.test b/mysql-test/t/events_grant.test
index ba94944a3cf..3ead141c27c 100644
--- a/mysql-test/t/events_grant.test
+++ b/mysql-test/t/events_grant.test
@@ -1,3 +1,6 @@
+# Can't test with embedded server that doesn't support grants
+-- source include/not_embedded.inc
+
CREATE DATABASE IF NOT EXISTS events_test;
use events_test;
#
@@ -6,7 +9,7 @@ use events_test;
CREATE EVENT one_event ON SCHEDULE EVERY 10 SECOND DO SELECT 123;
--replace_column 8 # 9 #
SHOW EVENTS;
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT from information_schema.events;
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT from information_schema.events;
CREATE DATABASE events_test2;
CREATE USER ev_test@localhost;
GRANT ALL ON events_test.* to ev_test@localhost;
@@ -52,10 +55,10 @@ CREATE EVENT four_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
connection default;
USE events_test;
--echo "We should see 4 events : one_event, two_event, three_event & four_event"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
DROP DATABASE events_test2;
--echo "We should see 3 events : one_event, two_event, three_event"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
connection default;
CREATE DATABASE events_test2;
@@ -64,27 +67,27 @@ CREATE EVENT five_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
connection ev_con1;
--echo "Should see 4 events - one, two, three & five"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
connection default;
REVOKE EVENT ON events_test2.* FROM ev_test@localhost;
connection ev_con1;
USE test;
--echo "Should see 3 events - one, two & three"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
--echo "Let's test ALTER EVENT which changes the definer"
USE events_test;
ALTER EVENT one_event ON SCHEDULE EVERY 10 SECOND;
--echo "The definer should be ev_test@localhost"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
connection default;
USE events_test;
ALTER EVENT one_event COMMENT "comment";
connection ev_con1;
--echo "The definer should be root@localhost"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
ALTER EVENT one_event DO SELECT 12;
--echo "The definer should be ev_test@localhost"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
connection default;
--echo "make the definer again root@localhost"
ALTER EVENT one_event COMMENT "new comment";
@@ -93,7 +96,7 @@ connection ev_con1;
DROP EVENT one_event;
connection default;
--echo "One event should not be there"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
disconnect ev_con1;
connection default;
DROP USER ev_test@localhost;
diff --git a/mysql-test/t/events_logs_tests.test b/mysql-test/t/events_logs_tests.test
index 6d3b3292630..5f4ec852cd3 100644
--- a/mysql-test/t/events_logs_tests.test
+++ b/mysql-test/t/events_logs_tests.test
@@ -1,3 +1,6 @@
+# Can't test with embedded server that doesn't support grants
+-- source include/not_embedded.inc
+
create database if not exists events_test;
use events_test;
--echo "We use procedure here because its statements won't be logged into the general log"
@@ -51,6 +54,8 @@ SET @old_global_long_query_time:=(select get_value());
SET @old_session_long_query_time:=@@long_query_time;
SHOW VARIABLES LIKE 'log_slow_queries';
DROP FUNCTION get_value;
+--echo "Make it quite long"
+SET SESSION long_query_time=300;
TRUNCATE mysql.slow_log;
--replace_column 1 USER_HOST
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
@@ -61,7 +66,10 @@ SET SESSION long_query_time=1;
SELECT SLEEP(2);
--replace_column 1 USER_HOST 2 SLEEPVAL
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
+SET SESSION long_query_time=300;
+--echo "Make it quite long"
TRUNCATE mysql.slow_log;
+SET SESSION long_query_time=1;
CREATE TABLE slow_event_test (slo_val tinyint, val tinyint);
--echo "This won't go to the slow log"
CREATE EVENT long_event ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(3);
@@ -75,9 +83,9 @@ SELECT * FROM slow_event_test;
--echo "Check slow log. Should not see anything because 3 is under the threshold of 4 for GLOBAL, though over SESSION which is 2"
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
--echo "This should go to the slow log"
+DROP EVENT long_event;
SET SESSION long_query_time=10;
SET GLOBAL long_query_time=1;
-DROP EVENT long_event;
CREATE EVENT long_event2 ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(2);
--echo "Sleep some more time than the actual event run will take"
--sleep 3
@@ -87,9 +95,11 @@ SELECT * FROM slow_event_test;
--replace_column 1 USER_HOST 2 SLEEPVAL
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
DROP EVENT long_event2;
-SET GLOBAL long_query_time =@old_global_long_query_time;
-SET SESSION long_query_time =@old_session_long_query_time;
+--echo "Make it quite long"
+SET SESSION long_query_time=300;
TRUNCATE mysql.slow_log;
DROP TABLE slow_event_test;
+SET GLOBAL long_query_time =@old_global_long_query_time;
+SET SESSION long_query_time =@old_session_long_query_time;
drop database events_test;
diff --git a/mysql-test/t/events_microsec.test b/mysql-test/t/events_microsec.test
index e01120a0756..3e9abf6ec56 100644
--- a/mysql-test/t/events_microsec.test
+++ b/mysql-test/t/events_microsec.test
@@ -1,4 +1,10 @@
+# Can't test with embedded server that doesn't support grants
+-- source include/not_embedded.inc
+
+--disable_warnings
create database if not exists events_test;
+--enable_warnings
+
use events_test;
--error ER_NOT_SUPPORTED_YET
diff --git a/mysql-test/t/events_scheduling.test b/mysql-test/t/events_scheduling.test
index c688864a1e6..987939bc162 100644
--- a/mysql-test/t/events_scheduling.test
+++ b/mysql-test/t/events_scheduling.test
@@ -1,3 +1,6 @@
+# Can't test with embedded server that doesn't support grants
+-- source include/not_embedded.inc
+
CREATE DATABASE IF NOT EXISTS events_test;
USE events_test;
CREATE TABLE table_1(a int);
diff --git a/mysql-test/t/events_stress.test b/mysql-test/t/events_stress.test
index 8d0034c232e..6546bce3a76 100644
--- a/mysql-test/t/events_stress.test
+++ b/mysql-test/t/events_stress.test
@@ -1,9 +1,17 @@
+# Can't test with embedded server that doesn't support grants
+--source include/not_embedded.inc
+--source include/big_test.inc
+
CREATE DATABASE IF NOT EXISTS events_test;
#
# DROP DATABASE test start (bug #16406)
#
CREATE DATABASE events_conn1_test2;
-CREATE TABLE events_test.fill_it(test_name varchar(20), occur datetime);
+# BUG#20676: MySQL in debug mode has a limit of 100 waiters
+# (in mysys/thr_lock.c), so use three different tables to insert into.
+CREATE TABLE events_test.fill_it1(test_name varchar(20), occur datetime);
+CREATE TABLE events_test.fill_it2(test_name varchar(20), occur datetime);
+CREATE TABLE events_test.fill_it3(test_name varchar(20), occur datetime);
CREATE USER event_user2@localhost;
CREATE DATABASE events_conn2_db;
GRANT ALL ON *.* TO event_user2@localhost;
@@ -16,7 +24,7 @@ connect (conn2,localhost,event_user2,,events_conn2_db);
let $1= 50;
while ($1)
{
- eval CREATE EVENT conn2_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it VALUES("conn2_ev$1", NOW());
+ eval CREATE EVENT conn2_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it1 VALUES("conn2_ev$1", NOW());
dec $1;
}
--enable_query_log
@@ -26,7 +34,7 @@ connect (conn3,localhost,event_user3,,events_conn3_db);
let $1= 50;
while ($1)
{
- eval CREATE EVENT conn3_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it VALUES("conn3_ev$1", NOW());
+ eval CREATE EVENT conn3_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it1 VALUES("conn3_ev$1", NOW());
dec $1;
}
--enable_query_log
@@ -48,7 +56,7 @@ USE events_conn1_test2;
let $1= 50;
while ($1)
{
- eval CREATE EVENT conn1_round1_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it VALUES("conn1_round1_ev$1", NOW());
+ eval CREATE EVENT conn1_round1_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it2 VALUES("conn1_round1_ev$1", NOW());
dec $1;
}
--enable_query_log
@@ -65,7 +73,7 @@ USE events_conn1_test3;
let $1= 50;
while ($1)
{
- eval CREATE EVENT conn1_round2_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it VALUES("conn1_round2_ev$1", NOW());
+ eval CREATE EVENT conn1_round2_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it2 VALUES("conn1_round2_ev$1", NOW());
dec $1;
}
--enable_query_log
@@ -77,7 +85,7 @@ USE events_conn1_test4;
let $1= 50;
while ($1)
{
- eval CREATE EVENT conn1_round3_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it VALUES("conn1_round3_ev$1", NOW());
+ eval CREATE EVENT conn1_round3_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it3 VALUES("conn1_round3_ev$1", NOW());
dec $1;
}
--enable_query_log
@@ -88,7 +96,7 @@ USE events_conn1_test2;
let $1= 50;
while ($1)
{
- eval CREATE EVENT ev_round4_drop$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it VALUES("conn1_round4_ev$1", NOW());
+ eval CREATE EVENT ev_round4_drop$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it3 VALUES("conn1_round4_ev$1", NOW());
dec $1;
}
--enable_query_log
@@ -115,7 +123,9 @@ reap;
disconnect conn3;
connection default;
USE events_test;
-DROP TABLE fill_it;
+DROP TABLE fill_it1;
+DROP TABLE fill_it2;
+DROP TABLE fill_it3;
--disable_query_log
DROP USER event_user2@localhost;
DROP USER event_user3@localhost;
diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test
index f6799f3630a..5f5c8d44f35 100644
--- a/mysql-test/t/federated.test
+++ b/mysql-test/t/federated.test
@@ -83,7 +83,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;
@@ -110,7 +110,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;
@@ -125,7 +125,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%`;
diff --git a/mysql-test/t/fulltext2.test b/mysql-test/t/fulltext2.test
index fd97f795534..88967a5dd04 100644
--- a/mysql-test/t/fulltext2.test
+++ b/mysql-test/t/fulltext2.test
@@ -221,3 +221,13 @@ drop table t1;
set names latin1;
# End of 4.1 tests
+
+#
+# BUG#19580 - FULLTEXT search produces wrong results on UTF-8 columns
+#
+SET NAMES utf8;
+CREATE TABLE t1(a VARCHAR(255), FULLTEXT(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES('„MySQL“');
+SELECT a FROM t1 WHERE MATCH a AGAINST('“MySQL„' IN BOOLEAN MODE);
+DROP TABLE t1;
+SET NAMES latin1;
diff --git a/mysql-test/t/fulltext_left_join.test b/mysql-test/t/fulltext_left_join.test
index 3bb1f0b7309..7c22f49ed8c 100644
--- a/mysql-test/t/fulltext_left_join.test
+++ b/mysql-test/t/fulltext_left_join.test
@@ -32,7 +32,7 @@ select match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE)
drop table t1, t2;
#
-# Bug #484, reported by Stephen Brandon <stephen@brandonitconsulting.co.uk>
+# BUG#484, reported by Stephen Brandon <stephen@brandonitconsulting.co.uk>
#
create table t1 (venue_id int(11) default null, venue_text varchar(255) default null, dt datetime default null) engine=myisam;
@@ -45,4 +45,17 @@ select * from t1 left join t2 on (venue_id = entity_id and match(name) against('
select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen')) where dt = '2003-05-23 19:30:00';
drop table t1,t2;
+#
+# BUG#14708
+# Inconsistent treatment of NULLs in LEFT JOINed FULLTEXT matching without index
+#
+
+create table t1 (id int not null primary key, d char(200) not null, e char(200));
+insert into t1 values (1, 'aword', null), (2, 'aword', 'bword'), (3, 'bword', null), (4, 'bword', 'aword'), (5, 'aword and bword', null);
+select * from t1 where match(d, e) against ('+aword +bword' in boolean mode);
+create table t2 (m_id int not null, f char(200), key (m_id));
+insert into t2 values (1, 'bword'), (3, 'aword'), (5, '');
+select * from t1 left join t2 on m_id = id where match(d, e, f) against ('+aword +bword' in boolean mode);
+drop table t1,t2;
+
# End of 4.1 tests
diff --git a/mysql-test/t/func_concat.test b/mysql-test/t/func_concat.test
index 37fc0e105b8..5487ad9c56b 100644
--- a/mysql-test/t/func_concat.test
+++ b/mysql-test/t/func_concat.test
@@ -52,4 +52,19 @@ select 'a' union select concat('a', -0.0);
--replace_result a-0.0000 a0.0000
select 'a' union select concat('a', -0.0000);
+#
+# Bug#16716: subselect in concat() may lead to a wrong result
+#
+select concat((select x from (select 'a' as x) as t1 ),
+ (select y from (select 'b' as y) as t2 )) from (select 1 union select 2 )
+ as t3;
+
# End of 4.1 tests
+
+#
+# Bug#15962: CONCAT() in UNION may lead to a data trucation.
+#
+create table t1(f1 varchar(6)) charset=utf8;
+insert into t1 values ("123456");
+select concat(f1, 2) a from t1 union select 'x' a from t1;
+drop table t1;
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index eacc4fc6710..760745dc14e 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -546,6 +546,34 @@ DROP TABLE t1;
# Bug #12882 min/max inconsistent on empty table
#
# Test case moved to func_group_innodb
+#
+# Bug #18206: min/max optimization cannot be applied to partial index
+#
+
+CREATE TABLE t1 (id int PRIMARY KEY, b char(3), INDEX(b));
+INSERT INTO t1 VALUES (1,'xx'), (2,'aa');
+SELECT * FROM t1;
+
+SELECT MAX(b) FROM t1 WHERE b < 'ppppp';
+SHOW WARNINGS;
+SELECT MAX(b) FROM t1 WHERE b < 'pp';
+DROP TABLE t1;
+
+CREATE TABLE t1 (id int PRIMARY KEY, b char(16), INDEX(b(4)));
+INSERT INTO t1 VALUES (1, 'xxxxbbbb'), (2, 'xxxxaaaa');
+SELECT MAX(b) FROM t1;
+EXPLAIN SELECT MAX(b) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (id int , b varchar(512), INDEX(b(250))) COLLATE latin1_bin;
+INSERT INTO t1 VALUES
+ (1,CONCAT(REPEAT('_', 250), "qq")), (1,CONCAT(REPEAT('_', 250), "zz")),
+ (1,CONCAT(REPEAT('_', 250), "aa")), (1,CONCAT(REPEAT('_', 250), "ff"));
+
+SELECT MAX(b) FROM t1;
+EXPLAIN SELECT MAX(b) FROM t1;
+DROP TABLE t1;
+
# End of 4.1 tests
#
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 7f809dbc4a1..b13fe039261 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -673,6 +673,18 @@ drop table t1;
select load_file("lkjlkj");
select ifnull(load_file("lkjlkj"),"it's null");
+#
+# Bug#15351: Wrong collation used for comparison of md5() and sha()
+# parameter can lead to a wrong result.
+#
+create table t1 (f1 varchar(4), f2 varchar(64), unique key k1 (f1,f2));
+insert into t1 values ( 'test',md5('test')), ('test', sha('test'));
+select * from t1 where f1='test' and (f2= md5("test") or f2= md5("TEST"));
+select * from t1 where f1='test' and (f2= md5("TEST") or f2= md5("test"));
+select * from t1 where f1='test' and (f2= sha("test") or f2= sha("TEST"));
+select * from t1 where f1='test' and (f2= sha("TEST") or f2= sha("test"));
+drop table t1;
+
--echo End of 4.1 tests
#
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index e6c1ddfcf1f..7428ac45422 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -5,6 +5,9 @@
drop table if exists t1,t2,t3;
--enable_warnings
+# Set timezone to GMT-3, to make it possible to use "interval 3 hour"
+set time_zone="+03:00";
+
select from_days(to_days("960101")),to_days(960201)-to_days("19960101"),to_days(date_add(curdate(), interval 1 day))-to_days(curdate()),weekday("1997-11-29");
select period_add("9602",-12),period_diff(199505,"9404") ;
@@ -335,6 +338,7 @@ select last_day("1997-12-1")+0.0;
# Test SAPDB UTC_% functions. This part is TZ dependant (It is supposed that
# TZ variable set to GMT-3
+
select strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0;
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%T"), utc_time())=0;
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0;
@@ -367,6 +371,36 @@ select last_day('2005-01-00');
select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
+#
+# Bug#16377 result of DATE/TIME functions were compared as strings which
+# can lead to a wrong result.
+#
+create table t1(f1 date, f2 time, f3 datetime);
+insert into t1 values ("2006-01-01", "12:01:01", "2006-01-01 12:01:01");
+insert into t1 values ("2006-01-02", "12:01:02", "2006-01-02 12:01:02");
+select f1 from t1 where f1 between "2006-1-1" and 20060101;
+select f1 from t1 where f1 between "2006-1-1" and "2006.1.1";
+select f1 from t1 where date(f1) between "2006-1-1" and "2006.1.1";
+select f2 from t1 where f2 between "12:1:2" and "12:2:2";
+select f2 from t1 where time(f2) between "12:1:2" and "12:2:2";
+select f3 from t1 where f3 between "2006-1-1 12:1:1" and "2006-1-1 12:1:2";
+select f3 from t1 where timestamp(f3) between "2006-1-1 12:1:1" and "2006-1-1 12:1:2";
+select f1 from t1 where "2006-1-1" between f1 and f3;
+select f1 from t1 where "2006-1-1" between date(f1) and date(f3);
+select f1 from t1 where "2006-1-1" between f1 and 'zzz';
+select f1 from t1 where makedate(2006,1) between date(f1) and date(f3);
+select f1 from t1 where makedate(2006,2) between date(f1) and date(f3);
+drop table t1;
+
+#
+# Bug #16546
+#
+
+create table t1 select now() - now(), curtime() - curtime(),
+ sec_to_time(1) + 0, from_unixtime(1) + 0;
+show create table t1;
+drop table t1;
+
--echo End of 4.1 tests
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
@@ -475,6 +509,9 @@ SELECT * FROM t1, t2
DROP TABLE t1,t2;
+
+# Restore timezone to default
+set time_zone= @@global.time_zone;
--echo End of 5.0 tests
#
diff --git a/mysql-test/t/func_timestamp.test b/mysql-test/t/func_timestamp.test
index e1bb7e878ee..05a91b06d28 100644
--- a/mysql-test/t/func_timestamp.test
+++ b/mysql-test/t/func_timestamp.test
@@ -6,6 +6,9 @@
drop table if exists t1;
--enable_warnings
+# Set timezone to GMT-3, to make it possible to use "interval 3 hour"
+set time_zone="+03:00";
+
create table t1 (Zeit time, Tag tinyint not null, Monat tinyint not null,
Jahr smallint not null, index(Tag), index(Monat), index(Jahr) );
insert into t1 values ("09:26:00",16,9,1998),("09:26:00",16,9,1998);
@@ -15,3 +18,6 @@ FROM t1;
drop table t1;
# End of 4.1 tests
+
+# Restore timezone to default
+set time_zone= @@global.time_zone;
diff --git a/mysql-test/t/im_cmd_line.imtest b/mysql-test/t/im_cmd_line.imtest
index 00e8351535e..29ed420439d 100644
--- a/mysql-test/t/im_cmd_line.imtest
+++ b/mysql-test/t/im_cmd_line.imtest
@@ -26,7 +26,7 @@
--echo
--echo --> Printing out line for 'testuser'...
---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --passwd --username=testuser --password=abc | tail -1
+--exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --print-password-line --username=testuser --password=abc | tail -1
--echo
--echo --> Listing users...
@@ -45,7 +45,7 @@
--echo
--echo --> Printing out line for 'testuser'...
---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --passwd --username=testuser --password=xyz | tail -1
+--exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --print-password-line --username=testuser --password=xyz | tail -1
--echo
--echo --> Listing users...
diff --git a/mysql-test/t/im_daemon_life_cycle.imtest b/mysql-test/t/im_daemon_life_cycle.imtest
index d173ce2a6e2..3afc36935f8 100644
--- a/mysql-test/t/im_daemon_life_cycle.imtest
+++ b/mysql-test/t/im_daemon_life_cycle.imtest
@@ -10,9 +10,22 @@
###########################################################################
+# Wait for mysqld1 (guarded instance) to start.
+
+--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD1_PATH_PID 30 started
+
+# Let IM detect that mysqld1 is online. This delay should be longer than
+# monitoring interval.
+
--sleep 3
-# should be longer than monitoring interval and enough to start instance.
+
+# Check that start conditions are as expected.
SHOW INSTANCES;
---exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_PATH_PID restarted
+###########################################################################
+
+# Kill the IM main process and check that the IM Angel will restart the main
+# process.
+
+--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_PATH_PID restarted 30
diff --git a/mysql-test/t/im_instance_conf.imtest b/mysql-test/t/im_instance_conf.imtest
index 17703fdd303..3d254b16ca5 100644
--- a/mysql-test/t/im_instance_conf.imtest
+++ b/mysql-test/t/im_instance_conf.imtest
@@ -21,6 +21,9 @@
# - DROP INSTANCE fails for active instance.
# - DROP INSTANCE updates both config file and internal configuration cache;
#
+# NOTE: each CREATE INSTANCE statement must specify socket-file-name, otherwise
+# this results of the test can be affected by another running test suite.
+#
###########################################################################
--source include/im_check_os.inc
@@ -69,7 +72,9 @@ SHOW VARIABLES LIKE 'server_id';
# Check that CREATE INSTANCE succeeds for non-existing instance and also check
# that both config file and internal configuration cache have been updated.
-CREATE INSTANCE mysqld3;
+CREATE INSTANCE mysqld3
+ server_id = 3,
+ socket = "$MYSQL_TMP_DIR/mysqld_3.sock";
SHOW INSTANCES;
@@ -99,7 +104,10 @@ CREATE INSTANCE mysqld3;
--exec grep nonguarded $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
-CREATE INSTANCE mysqld4 nonguarded;
+CREATE INSTANCE mysqld4
+ nonguarded,
+ server_id = 4,
+ socket = "$MYSQL_TMP_DIR/mysqld_4.sock";
SHOW INSTANCES;
@@ -115,7 +123,11 @@ SHOW INSTANCES;
--exec grep test-B $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
-CREATE INSTANCE mysqld5 test-A = 000, test-B = test;
+CREATE INSTANCE mysqld5
+ test-A = 000,
+ test-B = test,
+ server_id = 5,
+ socket = "$MYSQL_TMP_DIR/mysqld_5.sock";
SHOW INSTANCES;
@@ -135,7 +147,11 @@ SHOW INSTANCES;
--exec grep test-C $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
-CREATE INSTANCE mysqld6 test-C1 = 10 , test-C2 = 02 ;
+CREATE INSTANCE mysqld6
+ test-C1 = 10 ,
+ test-C2 = 02 ,
+ server_id = 6,
+ socket = "$MYSQL_TMP_DIR/mysqld_6.sock";
SHOW INSTANCES;
@@ -183,22 +199,37 @@ SHOW INSTANCES;
--exec grep test-4 $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
-CREATE INSTANCE mysqld9 test-1=" hello world ", test-2=' ';
+CREATE INSTANCE mysqld9
+ test-1=" hello world ",
+ test-2=' ',
+ server_id = 9,
+ socket = "$MYSQL_TMP_DIR/mysqld_9.sock";
SHOW INSTANCES;
-CREATE INSTANCE mysqld9a test-3='\b\babc\sdef';
+CREATE INSTANCE mysqld10
+ test-3='\b\babc\sdef',
+ server_id = 10,
+ socket = "$MYSQL_TMP_DIR/mysqld_10.sock";
# test-3='abc def'
SHOW INSTANCES;
-CREATE INSTANCE mysqld9b test-4='abc\tdef', test-5='abc\ndef';
+CREATE INSTANCE mysqld11
+ test-4='abc\tdef',
+ test-5='abc\ndef',
+ server_id = 11,
+ socket = "$MYSQL_TMP_DIR/mysqld_11.sock";
SHOW INSTANCES;
-CREATE INSTANCE mysqld9c test-6="abc\rdef", test-7="abc\\def";
+CREATE INSTANCE mysqld12
+ test-6="abc\rdef",
+ test-7="abc\\def",
+ server_id = 12,
+ socket = "$MYSQL_TMP_DIR/mysqld_12.sock";
# test-6=abc
SHOW INSTANCES;
--error ER_SYNTAX_ERROR
-CREATE INSTANCE mysqld10 test-bad=' \ ';
+CREATE INSTANCE mysqld13 test-bad=' \ ';
SHOW INSTANCES;
--echo --------------------------------------------------------------------
diff --git a/mysql-test/t/im_life_cycle.imtest b/mysql-test/t/im_life_cycle.imtest
index d71cdc86624..2cbe53a7b28 100644
--- a/mysql-test/t/im_life_cycle.imtest
+++ b/mysql-test/t/im_life_cycle.imtest
@@ -22,8 +22,16 @@
--echo -- 1.1.1.
--echo --------------------------------------------------------------------
+# Wait for mysqld1 (guarded instance) to start.
+
+--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD1_PATH_PID 30 started
+
+# Let IM detect that mysqld1 is online. This delay should be longer than
+# monitoring interval.
+
--sleep 3
-# should be longer than monitoring interval and enough to start instance.
+
+# Check that start conditions are as expected.
SHOW INSTANCES;
@@ -44,10 +52,12 @@ SHOW INSTANCES;
START INSTANCE mysqld2;
# FIXME: START INSTANCE should be synchronous.
---sleep 3
-# should be longer than monitoring interval and enough to start instance.
+--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started
-SHOW INSTANCES;
+# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is
+# synchronous. Even waiting for mysqld to start by looking at its pid file is
+# not enough, because IM may not detect that mysqld has started.
+# SHOW INSTANCES;
--connect (mysql_con,localhost,root,,mysql,$IM_MYSQLD2_PORT,$IM_MYSQLD2_SOCK)
--connection mysql_con
@@ -74,14 +84,12 @@ SHOW VARIABLES LIKE 'port';
STOP INSTANCE mysqld2;
# FIXME: STOP INSTANCE should be synchronous.
---sleep 3
-# should be longer than monitoring interval and enough to stop instance.
+--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped
-SHOW INSTANCES;
---replace_column 3 VERSION_NUMBER 4 VERSION
-SHOW INSTANCE STATUS mysqld1;
---replace_column 3 VERSION_NUMBER 4 VERSION
-SHOW INSTANCE STATUS mysqld2;
+# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is
+# synchronous. Even waiting for mysqld to start by looking at its pid file is
+# not enough, because IM may not detect that mysqld has started.
+# SHOW INSTANCES;
###########################################################################
#
@@ -140,10 +148,14 @@ STOP INSTANCE mysqld3;
SHOW INSTANCES;
---exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD1_PATH_PID restarted
+--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD1_PATH_PID restarted 30
+
+# Give some time to IM to detect that mysqld was restarted. It should be longer
+# than monitoring interval.
--sleep 3
-# should be longer than monitoring interval and enough to start instance.
+
+SHOW INSTANCES;
###########################################################################
#
@@ -156,18 +168,21 @@ SHOW INSTANCES;
--echo -- 1.1.7.
--echo --------------------------------------------------------------------
-SHOW INSTANCES;
-
START INSTANCE mysqld2;
# FIXME: START INSTANCE should be synchronous.
---sleep 3
-# should be longer than monitoring interval and enough to start instance.
+--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started
-SHOW INSTANCES;
+# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is
+# synchronous. Even waiting for mysqld to start by looking at its pid file is
+# not enough, because IM may not detect that mysqld has started.
+# SHOW INSTANCES;
---exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed
+--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed 10
-SHOW INSTANCES;
+# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is
+# synchronous. Even waiting for mysqld to start by looking at its pid file is
+# not enough, because IM may not detect that mysqld has started.
+# SHOW INSTANCES;
###########################################################################
#
diff --git a/mysql-test/t/im_options.imtest b/mysql-test/t/im_options.imtest
index cd905416cda..55bd29c9ee1 100644
--- a/mysql-test/t/im_options.imtest
+++ b/mysql-test/t/im_options.imtest
@@ -21,12 +21,15 @@
# - server_id
# - port
# - nonguarded
-
+#
# Let's test SET statement on the option 'server_id'. It's expected that
# originally the instances have the following server ids and states:
# - mysqld1: server_id: 1; running (online)
# - mysqld2: server_id: 2; stopped (offline)
#
+# NOTE: each CREATE INSTANCE statement must specify socket-file-name, otherwise
+# this results of the test can be affected by another running test suite.
+#
###########################################################################
--source include/im_check_os.inc
@@ -76,7 +79,10 @@ SET mysqld1.server_id = 11;
# - start it;
# - try to set/unset options;
-CREATE INSTANCE mysqld3 datadir = '/';
+CREATE INSTANCE mysqld3
+ datadir = '/',
+ server_id = 3,
+ socket = "$MYSQL_TMP_DIR/mysqld_3.sock";
START INSTANCE mysqld3;
# FIXME: START INSTANCE should be synchronous.
diff --git a/mysql-test/t/im_utils.imtest b/mysql-test/t/im_utils.imtest
index 8e8d475cfee..47902eeba52 100644
--- a/mysql-test/t/im_utils.imtest
+++ b/mysql-test/t/im_utils.imtest
@@ -17,8 +17,16 @@
# - the second instance is offline;
#
+# Wait for mysqld1 (guarded instance) to start.
+
+--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD1_PATH_PID 30 started
+
+# Let IM detect that mysqld1 is online. This delay should be longer than
+# monitoring interval.
+
--sleep 3
-# should be longer than monitoring interval and enough to start instance.
+
+# Check that start conditions are as expected.
SHOW INSTANCES;
@@ -43,12 +51,10 @@ SHOW INSTANCE OPTIONS mysqld2;
#
START INSTANCE mysqld2;
-
-# FIXME: START INSTANCE should be synchronous.
---sleep 3
-# should be longer than monitoring interval and enough to start instance.
+--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started
STOP INSTANCE mysqld2;
+--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped
#
# Check 'SHOW LOG FILES' command:
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index acb877e1e74..73aea01dfa2 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -80,6 +80,8 @@ connect (user4,localhost,mysqltest_3,,mysqltest);
connection user4;
select table_name, column_name, privileges from information_schema.columns
where table_schema = 'mysqltest' and table_name = 'v1';
+--error 1345
+explain select * from v1;
connection default;
drop view v1, mysqltest.v1;
@@ -580,28 +582,32 @@ connect (con2,localhost,user2,,mysqltest);
connect (con3,localhost,user3,,mysqltest);
connect (con4,localhost,user4,,);
connection con1;
-select * from information_schema.column_privileges;
-select * from information_schema.table_privileges;
-select * from information_schema.schema_privileges;
-select * from information_schema.user_privileges;
+select * from information_schema.column_privileges order by grantee;
+select * from information_schema.table_privileges order by grantee;
+select * from information_schema.schema_privileges order by grantee;
+select * from information_schema.user_privileges order by grantee;
show grants;
connection con2;
-select * from information_schema.column_privileges;
-select * from information_schema.table_privileges;
-select * from information_schema.schema_privileges;
-select * from information_schema.user_privileges;
+select * from information_schema.column_privileges order by grantee;
+select * from information_schema.table_privileges order by grantee;
+select * from information_schema.schema_privileges order by grantee;
+select * from information_schema.user_privileges order by grantee;
show grants;
connection con3;
-select * from information_schema.column_privileges;
-select * from information_schema.table_privileges;
-select * from information_schema.schema_privileges;
-select * from information_schema.user_privileges;
+select * from information_schema.column_privileges order by grantee;
+select * from information_schema.table_privileges order by grantee;
+select * from information_schema.schema_privileges order by grantee;
+select * from information_schema.user_privileges order by grantee;
show grants;
connection con4;
-select * from information_schema.column_privileges where grantee like '%user%';
-select * from information_schema.table_privileges where grantee like '%user%';
-select * from information_schema.schema_privileges where grantee like '%user%';
-select * from information_schema.user_privileges where grantee like '%user%';
+select * from information_schema.column_privileges where grantee like '%user%'
+order by grantee;
+select * from information_schema.table_privileges where grantee like '%user%'
+order by grantee;
+select * from information_schema.schema_privileges where grantee like '%user%'
+order by grantee;
+select * from information_schema.user_privileges where grantee like '%user%'
+order by grantee;
show grants;
connection default;
drop user user1@localhost, user2@localhost, user3@localhost, user4@localhost;
@@ -825,25 +831,6 @@ delete from proc where name='';
use test;
#
-# End of 5.0 tests.
-#
-# Show engines
-#
-
-select * from information_schema.engines WHERE ENGINE="MyISAM";
-
-#
-# INFORMATION_SCHEMA.PROCESSLIST
-#
-
-grant select on *.* to user3148@localhost;
-connect (con3148,localhost,user3148,,test);
-connection con3148;
-select user,db from information_schema.processlist;
-connection default;
-drop user user3148@localhost;
-
-#
# Bug#16681 information_schema shows forbidden VIEW details
#
grant select on test.* to mysqltest_1@localhost;
@@ -862,3 +849,31 @@ drop view v1, v2;
drop table t1;
drop user mysqltest_1@localhost;
+#
+# Bug#19599 duplication of information_schema column value in a CONCAT expr with user var
+#
+set @a:= '.';
+create table t1(f1 char(5));
+create table t2(f1 char(5));
+select concat(@a, table_name), @a, table_name
+from information_schema.tables where table_schema = 'test';
+drop table t1,t2;
+
+# End of 5.0 tests.
+#
+# Show engines
+#
+
+select * from information_schema.engines WHERE ENGINE="MyISAM";
+
+#
+# INFORMATION_SCHEMA.PROCESSLIST
+#
+
+grant select on *.* to user3148@localhost;
+connect (con3148,localhost,user3148,,test);
+connection con3148;
+select user,db from information_schema.processlist;
+connection default;
+drop user user3148@localhost;
+
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 92e060eed92..5b1b374e487 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -2510,3 +2510,16 @@ BEGIN;
INSERT INTO t1 VALUES (1);
OPTIMIZE TABLE t1;
DROP TABLE t1;
+
+#######################################################################
+# #
+# Please, DO NOT TOUCH this file as well as the innodb.result file. #
+# These files are to be modified ONLY BY INNOBASE guys. #
+# #
+# Use innodb_mysql.[test|result] files instead. #
+# #
+# If nevertheless you need to make some changes here, please, forward #
+# your commit message To: dev@innodb.com Cc: dev-innodb@mysql.com #
+# (otherwise your changes may be erased). #
+# #
+#######################################################################
diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test
index bea2d3bc8e0..6796840f2d2 100644
--- a/mysql-test/t/innodb_mysql.test
+++ b/mysql-test/t/innodb_mysql.test
@@ -4,6 +4,14 @@
drop table if exists t1,t2,t1m,t1i,t2m,t2i,t4;
--enable_warnings
+#
+# Bug#17530: Incorrect key truncation on table creation caused server crash.
+#
+create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
+ character set utf8 collate utf8_general_ci;
+insert into t1 values('aaa');
+drop table t1;
+
# BUG#16798: Uninitialized row buffer reads in ref-or-null optimizer
# (repeatable only w/innodb).
create table t1 (
diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test
index e2514083ea7..3711e2986ed 100644
--- a/mysql-test/t/insert.test
+++ b/mysql-test/t/insert.test
@@ -201,3 +201,36 @@ insert into t1 (b,b) select 1,2;
--error 1110
INSERT INTO t1 (b,b) SELECT 0,0 ON DUPLICATE KEY UPDATE a = a + VALUES (a);
drop table t1;
+# Test for INSERT DELAYED INTO a <view>
+# BUG#13683: INSERT DELAYED into a view creates an infinite loop
+#
+
+create table t1 (n int);
+create view v1 as select * from t1;
+--error 1347
+insert delayed into v1 values (1);
+drop table t1;
+drop view v1;
+
+#
+# Test for values returned by ROW_COUNT() function
+# (and thus for values returned by mysql_affected_rows())
+# for various forms of INSERT
+#
+create table t1 (id int primary key, data int);
+insert into t1 values (1, 1), (2, 2), (3, 3);
+select row_count();
+insert ignore into t1 values (1, 1);
+select row_count();
+# Reports that 2 rows are affected (1 deleted + 1 inserted)
+replace into t1 values (1, 11);
+select row_count();
+replace into t1 values (4, 4);
+select row_count();
+# Reports that 2 rows are affected. This conforms to documentation.
+# (Useful for differentiating inserts from updates).
+insert into t1 values (2, 2) on duplicate key update data= data + 10;
+select row_count();
+insert into t1 values (5, 5) on duplicate key update data= data + 10;
+select row_count();
+drop table t1;
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test
index 5dd6f338865..05953a1fd49 100644
--- a/mysql-test/t/insert_select.test
+++ b/mysql-test/t/insert_select.test
@@ -224,4 +224,26 @@ insert into t1(x,y) select x,z from t2 on duplicate key update x=values(z);
insert into t1(x,y) select x,z from t2 on duplicate key update x=values(t2.x);
drop table t1,t2;
+#
+# Bug #9676: INSERT INTO x SELECT .. FROM x LIMIT 1; slows down with big
+# tables
+#
+
+#Note: not an exsaustive test : just a check of the code path.
+CREATE TABLE t1 (a int PRIMARY KEY);
+INSERT INTO t1 values (1), (2);
+
+INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1;
+
+DROP TABLE t1;
+
# End of 4.1 tests
+
+#
+# Bug #18080: INSERT ... SELECT ... JOIN results in ambiguous field list error
+#
+CREATE TABLE t1 (x int, y int);
+CREATE TABLE t2 (z int, y int);
+CREATE TABLE t3 (a int, b int);
+INSERT INTO t3 (SELECT x, y FROM t1 JOIN t2 USING (y) WHERE z = 1);
+DROP TABLE IF EXISTS t1,t2,t3;
diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test
index f6a57d5e230..e156ccd82a8 100644
--- a/mysql-test/t/join.test
+++ b/mysql-test/t/join.test
@@ -520,6 +520,7 @@ select * from v1a join v1b on t1.b = t2.b;
#
# Bug #17523 natural join and information_schema
#
+--replace_column 31 #
select * from information_schema.statistics join information_schema.columns
using(table_name,column_name) where table_name='user';
@@ -563,4 +564,29 @@ select a2 from ((t1 natural join t2) join t3 on b=c1) natural join t4;
drop table t1,t2,t3,t4;
+#
+# BUG#15355: Common natural join column not resolved in prepared statement nested query
+#
+create table t1 (c int, b int);
+create table t2 (a int, b int);
+create table t3 (b int, c int);
+create table t4 (y int, c int);
+create table t5 (y int, z int);
+
+insert into t1 values (3,2);
+insert into t2 values (1,2);
+insert into t3 values (2,3);
+insert into t4 values (1,3);
+insert into t5 values (1,4);
+
+-- this fails
+prepare stmt1 from "select * from ((t3 natural join (t1 natural join t2))
+natural join t4) natural join t5";
+execute stmt1;
+
+-- this works
+select * from ((t3 natural join (t1 natural join t2)) natural join t4)
+ natural join t5;
+drop table t1, t2, t3, t4, t5;
+
# End of tests for WL#2486 - natural/using join
diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test
index f95cee8e8eb..7c6b38cb871 100644
--- a/mysql-test/t/key.test
+++ b/mysql-test/t/key.test
@@ -326,6 +326,18 @@ alter table t1 add key (c1,c1,c2);
drop table t1;
#
+# Bug#11228: DESC shows arbitrary column as "PRI"
+#
+create table t1 (
+ i1 INT NOT NULL,
+ i2 INT NOT NULL,
+ UNIQUE i1idx (i1),
+ UNIQUE i2idx (i2));
+desc t1;
+show create table t1;
+drop table t1;
+
+#
# Bug#12565 - ERROR 1034 when running simple UPDATE or DELETE
# on large MyISAM table
#
diff --git a/mysql-test/t/kill_n_check.sh b/mysql-test/t/kill_n_check.sh
index e722b3a180d..64cc869d1ec 100755
--- a/mysql-test/t/kill_n_check.sh
+++ b/mysql-test/t/kill_n_check.sh
@@ -1,66 +1,115 @@
#!/bin/sh
-if [ $# -ne 2 ]; then
- echo "Usage: kill_n_check.sh <pid file path> killed|restarted"
+###########################################################################
+
+# NOTE: this script returns 0 (success) even in case of failure. This is
+# because this script is executed under mysql-test-run[.pl] and it's better to
+# examine particular problem in log file, than just having said that the test
+# case has failed.
+
+###########################################################################
+
+check_restart()
+{
+ if [ ! -r "$pid_path" ]; then
+ user_msg='the process was killed'
+ return 1
+ fi
+
+ new_pid=`cat "$pid_path" 2>/dev/null`
+
+ if [ $? -eq 0 -a "$original_pid" = "$new_pid" ]; then
+ user_msg='the process was not restarted'
+ return 1
+ fi
+
+ user_msg='the process was restarted'
+ return 0
+}
+
+###########################################################################
+
+if [ $# -ne 3 ]; then
+ echo "Usage: kill_n_check.sh <pid file path> killed|restarted <timeout>"
exit 0
fi
pid_path="$1"
expected_result="$2"
+total_timeout="$3"
-if [ -z "$pid_path" -o ! -r "$pid_path" ]; then
- echo "Error: invalid PID path ($pid_path) or PID file does not exist."
+if [ "$expected_result" != 'killed' -a \
+ "$expected_result" != 'restarted' ]; then
+ echo "Error: invalid second argument ('killed' or 'restarted' expected)."
exit 0
fi
-if [ "$expected_result" != "killed" -a \
- "$expected_result" != "restarted" ]; then
- echo "Error: expected result must be either 'killed' or 'restarted'."
+if [ -z "$pid_path" ]; then
+ echo "Error: invalid PID path ($pid_path)."
exit 0
fi
-# echo "PID path: '$pid_path'"
+if [ $expected_result = 'killed' -a ! -r "$pid_path" ]; then
+ echo "Error: PID file ($pid_path) does not exist."
+ exit 0
+fi
-original_pid=`cat "$pid_path"`
+if [ -z "$total_timeout" ]; then
+ echo "Error: timeout is not specified."
+ exit 0
+fi
-# echo "Original PID: $original_pid"
+###########################################################################
+
+original_pid=`cat "$pid_path"`
echo "Killing the process..."
kill -9 $original_pid
+###########################################################################
+
echo "Sleeping..."
-sleep 3
+if [ "$expected_result" = "restarted" ]; then
-new_pid=""
+ # Wait for the process to restart.
-[ -r "$pid_path" ] && new_pid=`cat "$pid_path"`
+ cur_attempt=1
-# echo "New PID: $new_pid"
+ while true; do
-if [ "$expected_result" = "restarted" ]; then
+ if check_restart; then
+ echo "Success: $user_msg."
+ exit 0
+ fi
- if [ -z "$new_pid" ]; then
- echo "Error: the process was killed."
- exit 0
- fi
+ [ $cur_attempt -ge $total_timeout ] && break
- if [ "$original_pid" -eq "$new_pid" ]; then
- echo "Error: the process was not restarted."
- exit 0
- fi
-
- echo "Success: the process was restarted."
+ sleep 1
+
+ cur_attempt=`expr $cur_attempt + 1`
+
+ done
+
+ echo "Error: $user_msg."
exit 0
-
-else # $expected_result = killed
-
+
+else # $expected_result == killed
+
+ # Here we have to sleep for some long time to ensure that the process will
+ # not be restarted.
+
+ sleep $total_timeout
+
+ new_pid=`cat "$pid_path" 2>/dev/null`
+
if [ "$new_pid" -a "$new_pid" -ne "$original_pid" ]; then
echo "Error: the process was restarted."
- exit 0
+ else
+ echo "Success: the process was killed."
fi
- echo "Success: the process was killed."
exit 0
+
fi
diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test
index 7fc65f52214..5bebec49b88 100644
--- a/mysql-test/t/lock_multi.test
+++ b/mysql-test/t/lock_multi.test
@@ -128,6 +128,36 @@ unlock tables;
drop table t1;
#
+# Bug#16986 - Deadlock condition with MyISAM tables
+#
+connection locker;
+use mysql;
+LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
+FLUSH TABLES;
+--sleep 1
+#
+connection reader;
+use mysql;
+#NOTE: This must be a multi-table select, otherwise the deadlock will not occur
+send SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
+--sleep 1
+#
+connection locker;
+# Make test case independent from earlier grants.
+--replace_result "Table is already up to date" "OK"
+OPTIMIZE TABLES columns_priv, db, host, user;
+UNLOCK TABLES;
+#
+connection reader;
+reap;
+use test;
+#
+connection locker;
+use test;
+#
+connection default;
+
+#
# Bug#19815 - CREATE/RENAME/DROP DATABASE can deadlock on a global read lock
#
connect (con1,localhost,root,,);
@@ -161,6 +191,33 @@ disconnect con2;
--error ER_DB_DROP_EXISTS
DROP DATABASE mysqltest_1;
+#
+# Bug #17264: MySQL Server freeze
+#
+connection locker;
+create table t1 (f1 int(12) unsigned not null auto_increment, primary key(f1)) engine=innodb;
+lock tables t1 write;
+connection writer;
+--sleep 2
+delimiter //;
+send alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
+delimiter ;//
+connection reader;
+--sleep 2
+delimiter //;
+send alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
+delimiter ;//
+connection locker;
+--sleep 2
+unlock tables;
+connection writer;
+reap;
+connection reader;
+reap;
+connection locker;
+drop table t1;
+
+# End of 5.0 tests
# Bug#16986 - Deadlock condition with MyISAM tables
#
connection locker;
@@ -190,4 +247,3 @@ use test;
#
connection default;
-# End of 5.0 tests
diff --git a/mysql-test/t/log_state-master.opt b/mysql-test/t/log_state-master.opt
new file mode 100644
index 00000000000..445c6223d47
--- /dev/null
+++ b/mysql-test/t/log_state-master.opt
@@ -0,0 +1 @@
+--log-output=TABLE,FILE --log --general-log=0 --log-slow-queries --slow-query-log=0
diff --git a/mysql-test/t/log_state.test b/mysql-test/t/log_state.test
new file mode 100644
index 00000000000..41fbd068dce
--- /dev/null
+++ b/mysql-test/t/log_state.test
@@ -0,0 +1,122 @@
+-- source include/not_embedded.inc
+--source include/have_csv.inc
+
+--disable_ps_protocol
+set global general_log= OFF;
+truncate table mysql.general_log;
+truncate table mysql.slow_log;
+show global variables
+where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
+Variable_name = 'general_log' or Variable_name = 'slow_query_log';
+flush logs;
+set global general_log= ON;
+create table t1(f1 int);
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
+select * from mysql.general_log;
+set global general_log= OFF;
+drop table t1;
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
+select * from mysql.general_log;
+set global general_log= ON;
+flush logs;
+show global variables
+where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
+Variable_name = 'general_log' or Variable_name = 'slow_query_log';
+
+connect (con1,localhost,root,,);
+connection con1;
+set session long_query_time=1;
+select sleep(2);
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME
+select * from mysql.slow_log;
+connection default;
+
+set global slow_query_log= ON;
+connection con1;
+set session long_query_time=1;
+select sleep(2);
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME
+select * from mysql.slow_log;
+disconnect con1;
+connection default;
+show global variables
+where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
+Variable_name = 'general_log' or Variable_name = 'slow_query_log';
+
+set global general_log= ON;
+set global general_log= OFF;
+set global general_log= OFF;
+set global slow_query_log= ON;
+set global slow_query_log= OFF;
+set global slow_query_log= OFF;
+
+set global general_log= ON;
+truncate table mysql.general_log;
+create table t1(f1 int);
+drop table t1;
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
+select * from mysql.general_log;
+set global general_log= OFF;
+truncate table mysql.general_log;
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
+select * from mysql.general_log;
+set global general_log= ON;
+show global variables
+where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
+Variable_name = 'general_log' or Variable_name = 'slow_query_log';
+
+--replace_column 2 #
+show variables like 'general_log_file';
+--replace_column 2 #
+show variables like 'slow_query_log_file';
+show variables like 'log_output';
+
+--error 1231
+set global general_log_file='/not exiting path/log.master';
+--error 1231
+set global general_log_file='/tmp';
+--error 1231
+set global general_log_file='';
+--replace_column 2 #
+show variables like 'general_log_file';
+set global general_log= OFF;
+set global general_log_file='/tmp/log.master';
+set global general_log= ON;
+create table t1(f1 int);
+drop table t1;
+set global general_log= OFF;
+set global general_log_file=default;
+set global general_log= ON;
+create table t1(f1 int);
+drop table t1;
+--replace_column 2 #
+show variables like 'general_log_file';
+--replace_column 2 #
+show variables like 'slow_query_log_file';
+
+set global general_log= default;
+set global slow_query_log= default;
+set global general_log_file= default;
+set global slow_query_log_file= default;
+show variables like 'general_log';
+show variables like 'slow_query_log';
+set global general_log=ON;
+set global log_output=default;
+show variables like 'log_output';
+set global general_log=OFF;
+set global log_output=FILE;
+truncate table mysql.general_log;
+show variables like 'log_output';
+set global general_log=ON;
+create table t1(f1 int);
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
+select * from mysql.general_log;
+set global general_log=OFF;
+set global log_output="FILE,TABLE";
+show variables like 'log_output';
+set global general_log=ON;
+drop table t1;
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
+select * from mysql.general_log;
+
+--enable_ps_protocol
diff --git a/mysql-test/t/lowercase_table2.test b/mysql-test/t/lowercase_table2.test
index c02ae8f5073..521df01cc9b 100644
--- a/mysql-test/t/lowercase_table2.test
+++ b/mysql-test/t/lowercase_table2.test
@@ -139,3 +139,14 @@ select t1Aa.col1 from t1aA,t2Aa where t1Aa.col1 = t2aA.col1;
drop table t2aA, t1Aa;
# End of 4.1 tests
+
+#
+# Bug#17661 information_schema.SCHEMATA returns uppercase with lower_case_table_names = 1
+#
+create database mysqltest_LC2;
+use mysqltest_LC2;
+create table myUC (i int);
+select TABLE_SCHEMA,TABLE_NAME FROM information_schema.TABLES
+where TABLE_SCHEMA ='mysqltest_LC2';
+use test;
+drop database mysqltest_LC2;
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index 9fee4a03b81..c211ff2ac29 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -393,4 +393,13 @@ insert into t1 values ("Monty"),("WAX"),("Walrus");
alter table t1 engine=MERGE;
drop table t1;
+#
+# BUG#19648 - Merge table does not work with bit types
+#
+create table t1 (b bit(1));
+create table t2 (b bit(1));
+create table tm (b bit(1)) engine = merge union = (t1,t2);
+select * from tm;
+drop table tm, t1, t2;
+
# End of 5.0 tests
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index 04c33e9d709..21271517564 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -452,6 +452,14 @@ insert into t2 values(1,null);
delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1';
drop table t1, t2;
+#
+# Bug#19225: unchecked error leads to server crash
+#
+create table t1(a int);
+create table t2(a int);
+--error 1093
+delete from t1,t2 using t1,t2 where t1.a=(select a from t1);
+drop table t1, t2;
# End of 4.1 tests
#
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index a77537f3ff5..9936b8bfc44 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -697,6 +697,27 @@ select count(*) from t1 where id2 = 10;
select count(id1) from t1 where id2 = 10;
drop table t1;
+#
+# BUG##20357 - Got error 124 from storage engine using MIN and MAX functions
+# in queries
+#
+CREATE TABLE t1(a TINYINT, KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES(1);
+SELECT MAX(a) FROM t1 IGNORE INDEX(a);
+ALTER TABLE t1 DISABLE KEYS;
+SELECT MAX(a) FROM t1;
+SELECT MAX(a) FROM t1 IGNORE INDEX(a);
+DROP TABLE t1;
+
+#
+# BUG#18036 - update of table joined to self reports table as crashed
+#
+CREATE TABLE t1(a CHAR(9), b VARCHAR(7)) ENGINE=MyISAM;
+INSERT INTO t1(a) VALUES('xxxxxxxxx'),('xxxxxxxxx');
+UPDATE t1 AS ta1,t1 AS ta2 SET ta1.b='aaaaaa',ta2.b='bbbbbb';
+SELECT * FROM t1;
+DROP TABLE t1;
+
# End of 4.1 tests
#
@@ -869,4 +890,3 @@ drop table t1;
create table t1 (a int not null, key key_block_size=1024 (a));
--error 1064
create table t1 (a int not null, key `a` key_block_size=1024 (a));
-
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 98e881b67d5..74c3bb2e1d5 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -1159,6 +1159,27 @@ drop table t1, t2;
#
+# Bug#18462 mysqldump does not dump view structures correctly
+#
+#
+create table t (qty int, price int);
+insert into t values(3, 50);
+insert into t values(5, 51);
+create view v1 as select qty, price, qty*price as value from t;
+create view v2 as select qty from v1;
+--echo mysqldump {
+--exec $MYSQL_DUMP --compact -F --tab . test
+--exec cat v1.sql
+--echo } mysqldump {
+--exec cat v2.sql
+--echo } mysqldump
+--rm v.sql t.sql t.txt
+drop view v1;
+drop view v2;
+drop table t;
+
+
+#
# Bug#14857 Reading dump files with single statement stored routines fails.
# fixed by patch for bug#16878
#
@@ -1174,6 +1195,19 @@ show create procedure p;
drop function f;
drop procedure p;
+#
+# Bug #17371 Unable to dump a schema with invalid views
+#
+#
+create table t1 ( id serial );
+create view v1 as select * from t1;
+drop table t1;
+# mysqldump gets 1356 from server, but gives us 2
+--echo mysqldump {
+--error 2
+--exec $MYSQL_DUMP --force -N --compact --skip-comments test
+--echo } mysqldump
+drop view v1;
# Added for use-thread option
#
create table t1 (a text , b text);
@@ -1252,3 +1286,20 @@ set time_zone = 'SYSTEM';
use test;
#####
+#
+# BUG#17201 Spurious 'DROP DATABASE' in output,
+# also confusion between tables and views.
+# Example code from Markus Popp
+
+create database mysqldump_test_db;
+use mysqldump_test_db;
+create table t1 (id int);
+create view v1 as select * from t1;
+insert into t1 values (1232131);
+insert into t1 values (4711);
+insert into t1 values (3231);
+insert into t1 values (0815);
+--exec $MYSQL_DUMP --skip-comments --add-drop-database --databases mysqldump_test_db
+drop view v1;
+drop table t1;
+drop database mysqldump_test_db;
diff --git a/mysql-test/t/ndb_alter_table.test b/mysql-test/t/ndb_alter_table.test
index 8e3b4a6ca89..73c612b203f 100644
--- a/mysql-test/t/ndb_alter_table.test
+++ b/mysql-test/t/ndb_alter_table.test
@@ -367,12 +367,23 @@ CREATE TEMPORARY TABLE ndb_show_tables (id INT, type VARCHAR(20), state VARCHAR(
LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
--enable_warnings
+# Ndb doesn't support renaming attributes on-line
set @t1_id = (select id from ndb_show_tables where name like '%t1%');
truncate ndb_show_tables;
alter table t1 change tiny new_tiny tinyint(4) DEFAULT '0' NOT NULL;
+--disable_warnings
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+--enable_warnings
+
+select 'no_copy' from ndb_show_tables where id = @t1_id and name like '%t1%';
+
+set @t1_id = (select id from ndb_show_tables where name like '%t1%');
+truncate ndb_show_tables;
+
create index i1 on t1(medium);
-alter table t1 add index i2(long_int);
+alter table t1 add index i2(new_tiny);
drop index i1 on t1;
--disable_warnings
diff --git a/mysql-test/t/ndb_binlog_multi.test b/mysql-test/t/ndb_binlog_multi.test
index 6adacf73208..e023a54b61c 100644
--- a/mysql-test/t/ndb_binlog_multi.test
+++ b/mysql-test/t/ndb_binlog_multi.test
@@ -4,11 +4,18 @@
--disable_warnings
connection server2;
-drop table if exists t1,t2;
+drop table if exists t1,t2,t3;
connection server1;
-drop table if exists t1,t2;
+drop table if exists t1,t2,t3;
--enable_warnings
+# Dummy table create/drop to avoid a race where table is created
+# before event subscription is set up, causing test failure (BUG#20677).
+connection server2;
+CREATE TABLE t3 (dummy INT PRIMARY KEY) ENGINE = NDB;
+connection server1;
+DROP TABLE t3;
+
# reset for test
connection server1;
reset master;
diff --git a/mysql-test/t/ndb_blob_partition.test b/mysql-test/t/ndb_blob_partition.test
new file mode 100644
index 00000000000..a3948cc9491
--- /dev/null
+++ b/mysql-test/t/ndb_blob_partition.test
@@ -0,0 +1,93 @@
+--source include/have_ndb.inc
+-- source include/not_embedded.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Minimal NDB blobs test with range partitions.
+#
+
+create table t1 (
+ a mediumint not null,
+ b text not null,
+ c int not null,
+ d longblob,
+ primary key using hash (a,c),
+ unique key (c)
+)
+ engine=ndb
+ partition by range (c)
+ partitions 3
+ ( partition p1 values less than (200),
+ partition p2 values less than (300),
+ partition p3 values less than (400));
+
+--disable_query_log
+sleep 1;
+
+# length 61
+set @s0 = 'rggurloniukyehuxdbfkkyzlceixzrehqhvxvxbpwizzvjzpucqmzrhzxzfau';
+set @s1 = 'ykyymbzqgqlcjhlhmyqelfoaaohvtbekvifukdtnvcrrjveevfakxarxexomz';
+set @s2 = 'dbnfqyzgtqxalcrwtfsqabknvtfcbpoonxsjiqvmhnfikxxhcgoexlkoezvah';
+
+set @v1 = repeat(@s0, 100); -- 1d42dd9090cf78314a06665d4ea938c35cc760f4
+set @v2 = repeat(@s1, 200); -- 10d3c783026b310218d10b7188da96a2401648c6
+set @v3 = repeat(@s2, 300); -- a33549d9844092289a58ac348dd59f09fc28406a
+set @v4 = repeat(@s0, 400); -- daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
+set @v5 = repeat(@s1, 500); -- 70fc9a7d08beebc522258bfb02000a30c77a8f1d
+set @v6 = repeat(@s2, 600); -- 090565c580809efed3d369481a4bbb168b20713e
+set @v7 = repeat(@s0, 700); -- 1e0070bec426871a46291de27b9bd6e4255ab4e5
+set @v8 = repeat(@s1, 800); -- acbaba01bc2e682f015f40e79d9cbe475db3002e
+set @v9 = repeat(@s2, 900); -- 9ee30d99162574f79c66ae95cdf132dcf9cbc259
+--enable_query_log
+
+# -- insert --
+insert into t1 values (1, @v1, 101, @v2);
+insert into t1 values (1, @v2, 102, @v3);
+insert into t1 values (1, @v3, 103, @v4);
+insert into t1 values (2, @v4, 201, @v5);
+insert into t1 values (2, @v5, 202, @v6);
+insert into t1 values (2, @v6, 203, @v7);
+insert into t1 values (3, @v7, 301, @v8);
+insert into t1 values (3, @v8, 302, @v9);
+insert into t1 values (3, @v9, 303, @v1);
+select a, sha1(b), c, sha1(d) from t1 order by a;
+
+# -- pk read --
+select a, sha1(b), c, sha1(d) from t1 where a = 1 and c = 101;
+select a, sha1(b), c, sha1(d) from t1 where a = 2 and c = 201;
+select a, sha1(b), c, sha1(d) from t1 where a = 3 and c = 301;
+
+# -- pk update --
+update t1 set b = @v3, d = @v4 where a = 1 and c = 102;
+update t1 set b = @v6, d = @v7 where a = 2 and c = 202;
+update t1 set b = @v9, d = @v1 where a = 3 and c = 302;
+select a, sha1(b), c, sha1(d) from t1 order by a;
+
+# -- hash index update --
+update t1 set b = @v4, d = @v5 where c = 103;
+update t1 set b = @v7, d = @v8 where c = 203;
+update t1 set b = @v1, d = @v2 where c = 303;
+select a, sha1(b), c, sha1(d) from t1 order by a;
+
+# -- full scan update --
+update t1 set b = @v5, d = @v6;
+select a, sha1(b), c, sha1(d) from t1 order by a;
+
+# -- range scan update
+update t1 set b = @v1, d = @v2 where 100 < c and c < 200;
+update t1 set b = @v4, d = @v5 where 200 < c and c < 300;
+update t1 set b = @v7, d = @v8 where 300 < c and c < 400;
+select a, sha1(b), c, sha1(d) from t1 order by a;
+
+# -- delete --
+delete from t1 where a = 1 and c = 101;
+delete from t1 where c = 102;
+# delete from t1 where c < 300; # XXX coredump
+delete from t1;
+select a, sha1(b), c, sha1(d) from t1 order by a;
+
+# -- clean up --
+drop table t1;
diff --git a/mysql-test/t/ndb_condition_pushdown.test b/mysql-test/t/ndb_condition_pushdown.test
index 3b53f7b3431..9795c831161 100644
--- a/mysql-test/t/ndb_condition_pushdown.test
+++ b/mysql-test/t/ndb_condition_pushdown.test
@@ -1686,5 +1686,27 @@ select * from t1 where b like 'ab' or b like 'ab';
select * from t1 where b like 'abc';
select * from t1 where b like 'abc' or b like 'abc';
+# bug#20406 (maybe same as bug#17421 -1, not seen on 32-bit x86)
+drop table t1;
+create table t1 ( fname varchar(255), lname varchar(255) )
+engine=ndbcluster;
+insert into t1 values ("Young","Foo");
+
+set engine_condition_pushdown = 0;
+SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
+set engine_condition_pushdown = 1;
+SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
+
+# make sure optimizer does not do some crazy shortcut
+insert into t1 values ("aaa", "aaa");
+insert into t1 values ("bbb", "bbb");
+insert into t1 values ("ccc", "ccc");
+insert into t1 values ("ddd", "ddd");
+
+set engine_condition_pushdown = 0;
+SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
+set engine_condition_pushdown = 1;
+SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
+
set engine_condition_pushdown = @old_ecpd;
DROP TABLE t1,t2,t3,t4,t5;
diff --git a/mysql-test/t/ndb_dd_backuprestore.test b/mysql-test/t/ndb_dd_backuprestore.test
index 1508cccb46d..be6d73e27b4 100644
--- a/mysql-test/t/ndb_dd_backuprestore.test
+++ b/mysql-test/t/ndb_dd_backuprestore.test
@@ -159,15 +159,185 @@ DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
DROP TABLE test.t4;
+###################### Adding partition #################################
+-- echo **** Test 3 Adding partition Test backup and restore ****
+
+CREATE TABLESPACE table_space2
+ADD DATAFILE './table_space2/datafile.dat'
+USE LOGFILE GROUP log_group1
+INITIAL_SIZE 12M
+ENGINE NDB;
+
+CREATE TABLE test.t1 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(150) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space1 STORAGE DISK ENGINE=NDB PARTITION BY HASH(c3) PARTITIONS 4;
+
+CREATE TABLE test.t4 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(180) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY HASH(c3) PARTITIONS 2;
+
+CREATE TABLE test.t2 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space2 STORAGE DISK ENGINE=NDB PARTITION BY KEY(c3) (PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
+
+CREATE TABLE test.t5 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY KEY(pk1) (PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
+
+CREATE TABLE test.t3 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(202) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space2 STORAGE DISK ENGINE=NDB PARTITION BY RANGE (c3) PARTITIONS 3 (PARTITION x1 VALUES LESS THAN (105), PARTITION x2 VALUES LESS THAN (333), PARTITION x3 VALUES LESS THAN (720));
+
+CREATE TABLE test.t6 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(220) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY RANGE (pk1) PARTITIONS 2 (PARTITION x1 VALUES LESS THAN (333), PARTITION x2 VALUES LESS THAN (720));
+
+SHOW CREATE TABLE test.t1;
+
+SHOW CREATE TABLE test.t2;
+
+SHOW CREATE TABLE test.t3;
+
+SHOW CREATE TABLE test.t4;
+
+SHOW CREATE TABLE test.t5;
+
+SHOW CREATE TABLE test.t6;
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't1';
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't2';
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't3';
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't4';
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't5';
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't6';
+
+
+let $j= 500;
+--disable_query_log
+while ($j)
+{
+ eval INSERT INTO test.t1 VALUES (NULL, "Sweden, Texas", $j, b'0');
+ eval INSERT INTO test.t4 VALUES (NULL, "Sweden, Texas", $j, b'0');
+ dec $j;
+ eval INSERT INTO test.t2 VALUES (NULL, "Sweden, Texas, ITALY, Kyle, JO, JBM,TU", $j, b'1');
+ eval INSERT INTO test.t5 VALUES (NULL, "Sweden, Texas, ITALY, Kyle, JO, JBM,TU", $j, b'1');
+ dec $j;
+ eval INSERT INTO test.t3 VALUES (NULL, "TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU", $j, b'1');
+ eval INSERT INTO test.t6 VALUES (NULL, "TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU", $j, b'1'); } --enable_query_log
+
+SELECT COUNT(*) FROM test.t1;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY c3 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t2;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY c3 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t3;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t3 ORDER BY c3 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t4;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t4 ORDER BY c3 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t5;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t5 ORDER BY c3 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t6;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t6 ORDER BY c3 LIMIT 5;
+
+-- source include/ndb_backup.inc
+
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
+DROP TABLE test.t4;
+DROP TABLE test.t5;
+DROP TABLE test.t6;
ALTER TABLESPACE table_space1
DROP DATAFILE './table_space1/datafile.dat'
ENGINE = NDB;
+ALTER TABLESPACE table_space2
+DROP DATAFILE './table_space2/datafile.dat'
+ENGINE = NDB;
+
DROP TABLESPACE table_space1
ENGINE = NDB;
+DROP TABLESPACE table_space2
+ENGINE = NDB;
+
DROP LOGFILE GROUP log_group1
ENGINE =NDB;
+-- source include/ndb_restore_master.inc
+
+
+SHOW CREATE TABLE test.t1;
+
+SHOW CREATE TABLE test.t2;
+
+SHOW CREATE TABLE test.t3;
+
+SHOW CREATE TABLE test.t4;
+
+SHOW CREATE TABLE test.t5;
+
+SHOW CREATE TABLE test.t6;
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't1';
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't2';
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't3';
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't4';
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't5';
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't6';
+
+SELECT COUNT(*) FROM test.t1;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY c3 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t2;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY c3 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t3;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t3 ORDER BY c3 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t4;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t4 ORDER BY c3 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t5;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t5 ORDER BY c3 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t6;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t6 ORDER BY c3 LIMIT 5;
+
+# Cleanup
+
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
+DROP TABLE test.t4;
+DROP TABLE test.t5;
+DROP TABLE test.t6;
+
+ALTER TABLESPACE table_space1 DROP DATAFILE './table_space1/datafile.dat' ENGINE=NDB;
+
+ALTER TABLESPACE table_space2 DROP DATAFILE './table_space2/datafile.dat' ENGINE=NDB;
+
+DROP TABLESPACE table_space1 ENGINE = NDB;
+
+DROP TABLESPACE table_space2 ENGINE = NDB;
+
+DROP LOGFILE GROUP log_group1 ENGINE = NDB;
+
#End 5.1 test case
+
+
diff --git a/mysql-test/t/ndb_dd_ddl.test b/mysql-test/t/ndb_dd_ddl.test
index 339f7bc2f22..1a470d52c6c 100644
--- a/mysql-test/t/ndb_dd_ddl.test
+++ b/mysql-test/t/ndb_dd_ddl.test
@@ -40,7 +40,7 @@ CREATE DATABASE mysqltest;
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
-INITIAL_SIZE 16M
+INITIAL_SIZE 1M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
@@ -48,7 +48,7 @@ ENGINE=NDB;
--error ER_CREATE_FILEGROUP_FAILED
CREATE LOGFILE GROUP lg2
ADD UNDOFILE 'undofile2.dat'
-INITIAL_SIZE 16M
+INITIAL_SIZE 1M
UNDO_BUFFER_SIZE 1M
ENGINE NDB;
SHOW WARNINGS;
@@ -56,42 +56,42 @@ SHOW WARNINGS;
--error ER_CREATE_FILEGROUP_FAILED
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
-INITIAL_SIZE 16M
+INITIAL_SIZE 1M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
-INITIAL_SIZE 4M ENGINE NDB;
+INITIAL_SIZE 1M ENGINE NDB;
--error ER_ALTER_FILEGROUP_FAILED
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
-INITIAL_SIZE 4M ENGINE=NDB;
+INITIAL_SIZE 1M ENGINE=NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
-INITIAL_SIZE 12M
+INITIAL_SIZE 1M
ENGINE NDB;
--error ER_CREATE_FILEGROUP_FAILED
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
-INITIAL_SIZE 12M
+INITIAL_SIZE 1M
ENGINE NDB;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
-INITIAL_SIZE 12M
+INITIAL_SIZE 1M
ENGINE=NDB;
--error ER_ALTER_FILEGROUP_FAILED
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
-INITIAL_SIZE 12M
+INITIAL_SIZE 1M
ENGINE=NDB;
CREATE TABLE mysqltest.t1
@@ -155,23 +155,23 @@ DROP DATABASE IF EXISTS mysqltest;
creaTE LOgfilE GrOuP lg1
adD undoFILE 'undofile.dat'
-initiAL_siZE 16M
+initiAL_siZE 1M
UnDo_BuFfEr_SiZe = 1M
ENGInE=NDb;
altER LOgFiLE GrOUp lg1
AdD UnDOfILe 'uNdOfiLe02.daT'
-INItIAl_SIzE 4M ENgINE nDB;
+INItIAl_SIzE 1M ENgINE nDB;
CrEAtE TABLEspaCE ts1
ADD DATAfilE 'datafile.dat'
UsE LoGFiLE GRoUP lg1
-INITiaL_SizE 12M
+INITiaL_SizE 1M
ENGiNe NDb;
AlTeR tAbLeSpAcE ts1
AdD DaTaFiLe 'dAtAfiLe2.daT'
-InItIaL_SiZe 12M
+InItIaL_SiZe 1M
EnGiNe=NDB;
CREATE TABLE t1
@@ -203,24 +203,24 @@ EnGiNe=nDb;
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
-INITIAL_SIZE=16M
+INITIAL_SIZE=1M
UNDO_BUFFER_SIZE=1M
ENGINE=NDB;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
-INITIAL_SIZE=4M
+INITIAL_SIZE=1M
ENGINE=NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
-INITIAL_SIZE=12M
+INITIAL_SIZE=1M
ENGINE=NDB;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
-INITIAL_SIZE=12M
+INITIAL_SIZE=1M
ENGINE=NDB;
CREATE TABLE t1
@@ -250,24 +250,24 @@ ENGINE=NDB;
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
-INITIAL_SIZE 16M
+INITIAL_SIZE 1M
UNDO_BUFFER_SIZE 1M
ENGINE NDB;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
-INITIAL_SIZE 4M
+INITIAL_SIZE 1M
ENGINE NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
-INITIAL_SIZE 12M
+INITIAL_SIZE 1M
ENGINE NDB;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
-INITIAL_SIZE 12M
+INITIAL_SIZE 1M
ENGINE NDB;
CREATE TABLE t1
@@ -280,6 +280,25 @@ CREATE INDEX bc_i on t1(b, c);
DROP TABLE t1;
+# bug#20053
+
+CREATE TABLESPACE ts2
+ADD DATAFILE 'datafile3.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 1M
+ENGINE NDB;
+
+--error ER_ALTER_FILEGROUP_FAILED
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile3.dat'
+ENGINE NDB;
+
+--error ER_ALTER_FILEGROUP_FAILED
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile2.dat'
+ENGINE NDB;
+# bug#20053
+
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile2.dat'
ENGINE NDB;
@@ -291,11 +310,45 @@ ENGINE NDB;
DROP TABLESPACE ts1
ENGINE NDB;
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile3.dat'
+ENGINE NDB;
+
+DROP TABLESPACE ts2
+ENGINE NDB;
+
DROP LOGFILE GROUP lg1
ENGINE NDB;
--echo **** End = And No = ****
############ End = And No = ##################
-# End 5.1 test
+###
+#
+# bug#16341
+create table t1 (a int primary key) engine = myisam;
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--error ER_CREATE_FILEGROUP_FAILED
+--eval create logfile group lg1 add undofile '$MYSQLTEST_VARDIR/master-data/test/t1.frm' initial_size 1M undo_buffer_size = 1M engine=ndb;
+
+create logfile group lg1
+add undofile 'undofile.dat'
+initial_size 1M
+undo_buffer_size = 1M
+engine=ndb;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--error ER_CREATE_FILEGROUP_FAILED
+--eval create tablespace ts1 add datafile '$MYSQLTEST_VARDIR/master-data/test/t1.frm' use logfile group lg1 initial_size 1M engine ndb;
+
+--error ER_DROP_FILEGROUP_FAILED
+drop tablespace ts1
+engine ndb;
+
+drop logfile group lg1
+engine ndb;
+
+drop table t1;
+
+# End 5.1 test
diff --git a/mysql-test/t/ndb_loaddatalocal.test b/mysql-test/t/ndb_loaddatalocal.test
new file mode 100644
index 00000000000..47054ecfbf5
--- /dev/null
+++ b/mysql-test/t/ndb_loaddatalocal.test
@@ -0,0 +1,70 @@
+-- source include/have_ndb.inc
+-- source include/not_embedded.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+create table t1(a int) engine=myisam;
+let $1=10000;
+disable_query_log;
+set SQL_LOG_BIN=0;
+while ($1)
+{
+ insert into t1 values(1);
+ dec $1;
+}
+set SQL_LOG_BIN=1;
+enable_query_log;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval select * into outfile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
+#This will generate a 20KB file, now test LOAD DATA LOCAL
+drop table t1;
+
+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 ;
+drop table t1;
+
+create table t1(a int) engine=myisam;
+insert into t1 values (1), (2), (2), (3);
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval select * into outfile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
+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;
+select * from t1 order by a;
+drop table t1;
+
+create table t1(a int) engine=myisam;
+insert into t1 values (1), (1), (2), (3);
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval select * into outfile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
+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;
+select * from t1 order by a;
+drop table t1;
+
+create table t1(a int) engine=myisam;
+insert into t1 values (1), (2), (3), (3);
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval select * into outfile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
+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;
+select * from t1 order by a;
+drop table t1;
+
+# End of 4.1 tests
diff --git a/mysql-test/t/ndb_partition_error.test b/mysql-test/t/ndb_partition_error.test
new file mode 100644
index 00000000000..06581f1270f
--- /dev/null
+++ b/mysql-test/t/ndb_partition_error.test
@@ -0,0 +1,71 @@
+-- source include/have_ndb.inc
+#--disable_abort_on_error
+#
+# Simple test for the partition storage engine
+# Focuses on range partitioning tests
+#
+#-- source include/have_partition.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Partition by range, generate node group error
+#
+--error 1005
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b),
+index (a))
+engine = ndb
+partition by range (a)
+partitions 3
+(partition x1 values less than (5) nodegroup 12,
+ partition x2 values less than (10) nodegroup 13,
+ partition x3 values less than (20) nodegroup 14);
+show warnings;
+
+#
+# Partition by range, create normal valid table
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a))
+engine = ndb
+partition by range (a)
+partitions 3
+(partition x1 values less than (5),
+ partition x2 values less than (10),
+ partition x3 values less than (20));
+
+drop table t1;
+
+#
+# Bug #17763 mysqld cores with list partitioning if update to missing partition
+#
+CREATE TABLE t1 (id INT) ENGINE=NDB
+ PARTITION BY LIST(id)
+ (PARTITION p0 VALUES IN (2, 4),
+ PARTITION p1 VALUES IN (42, 142));
+INSERT INTO t1 VALUES (2);
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+UPDATE t1 SET id=5 WHERE id=2;
+DROP TABLE t1;
+
+#
+# NULL for LIST partition
+#
+create table t1 (a int,b int, c int)
+engine = ndb
+partition by list(a)
+partitions 2
+(partition x123 values in (11, 12),
+ partition x234 values in (5, 1));
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+insert into t1 values (NULL,1,1);
+drop table t1;
diff --git a/mysql-test/t/ndb_partition_key.test b/mysql-test/t/ndb_partition_key.test
new file mode 100644
index 00000000000..fb0581eb6f6
--- /dev/null
+++ b/mysql-test/t/ndb_partition_key.test
@@ -0,0 +1,198 @@
+-- source include/have_ndb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+#
+# Basic syntax test
+#
+
+# Support for partition key verified
+CREATE TABLE t1 (a int, b int, c int, d int, PRIMARY KEY(a,b,c))
+ ENGINE = NDB
+ PARTITION BY KEY (a,b);
+
+insert into t1 values (1,1,1,1);
+select * from t1;
+update t1 set d = 2 where a = 1 and b = 1 and c = 1;
+select * from t1;
+delete from t1;
+select * from t1;
+
+drop table t1;
+
+# only support for partition key on primary key
+--error ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF
+CREATE TABLE t1 (a int, b int, c int, d int, PRIMARY KEY(a,b))
+ ENGINE = NDB
+ PARTITION BY KEY (c);
+
+CREATE TABLE t1 (a int, b int, c int, PRIMARY KEY(a,b))
+ ENGINE = NDB
+ PARTITION BY KEY (a);
+
+insert into t1 values
+ (1,1,3),(1,2,3),(1,3,3),(1,4,3),(1,5,3),(1,6,3),
+ (1,7,3),(1,8,3),(1,9,3),(1,10,3),(1,11,3),(1,12,3);
+
+select * from t1 order by b;
+
+DROP TABLE t1;
+
+#
+# Test partition and char support
+#
+
+CREATE TABLE t1 (a INT, b CHAR(10) COLLATE latin1_bin, c INT, d INT,
+ PRIMARY KEY (a,b,c) USING HASH)
+ ENGINE=NDB
+ DEFAULT CHARSET=latin1
+ PARTITION BY KEY (b);
+
+insert into t1 values (1,"a",1,1),(2,"a",1,1),(3,"a",1,1);
+
+# should show only one attribute with DISTRIBUTION KEY
+--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | sed 's/Version: [0-9]*//' | sed 's/\(Length of frm data: \)[0-9]*/\1#/'
+
+#
+# Test that explicit partition info is not shown in show create table
+# result should not contain (PARTITION P0 ... etc) since this is what shows up in
+# mysqldump, and we don't want that info there
+#
+show create table t1;
+
+DROP TABLE t1;
+
+#
+# Bug #13155: Problem in Create Table using SHOW CREATE TABLE syntax
+#
+CREATE TABLE t1 (a int not null primary key)
+PARTITION BY KEY(a)
+(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
+
+drop table t1;
+
+CREATE TABLE t1 (a int not null primary key);
+ALTER TABLE t1
+PARTITION BY KEY(a)
+(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
+
+drop table t1;
+
+#
+# Bug #17754 Improper handling of removal of partitioning in ALTER TABLE
+# Also added a number of general test cases in the same area
+#
+create table t1 (a int)
+engine=ndb
+partition by key(a)
+(partition p0, partition p1);
+show create table t1;
+
+alter table t1 engine=heap;
+show create table t1;
+
+alter table t1 engine=ndb;
+show create table t1;
+
+alter table t1 engine=heap remove partitioning;
+show create table t1;
+
+alter table t1 engine=ndb
+partition by key(a)
+(partition p0, partition p1 engine = ndb);
+show create table t1;
+
+alter table t1
+partition by key (a)
+(partition p0 engine=ndb, partition p1 engine=ndb);
+show create table t1;
+
+alter table t1 remove partitioning;
+show create table t1;
+
+--error ER_MIX_HANDLER_ERROR
+alter table t1
+partition by key(a)
+(partition p0 engine=ndb, partition p1);
+
+alter table t1
+engine=ndb
+partition by key(a)
+(partition p0 engine=ndb, partition p1 engine = ndb);
+show create table t1;
+
+drop table t1;
+
+#
+# BUG 16810 Out of memory when coalesce partition
+#
+CREATE TABLE t1 (
+ c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
+ c2 TEXT NOT NULL,
+ c3 INT NOT NULL,
+ c4 BIT NOT NULL,
+ c5 FLOAT,
+ c6 VARCHAR(255),
+ c7 TIMESTAMP,
+ PRIMARY KEY(c1,c3))
+ ENGINE=NDB
+ PARTITION BY KEY(c3) PARTITIONS 5;
+
+let $j= 11;
+--disable_query_log
+while ($j)
+{
+ eval INSERT INTO t1 VALUES (NULL, "Tested Remotely from Texas, USA", $j,
+b'0',
+ $j.00,"By JBM $j","2006-01-26");
+ dec $j;
+}
+--enable_query_log
+ALTER TABLE t1 COALESCE PARTITION 4;
+
+DROP TABLE t1;
+
+#
+# Bug 16822: OPTIMIZE TABLE hangs test
+#
+CREATE TABLE t1 (a int primary key)
+ENGINE=NDB
+PARTITION BY KEY(a);
+--error 1031
+ALTER TABLE t1 OPTIMIZE PARTITION p0;
+--error 1031
+ALTER TABLE t1 CHECK PARTITION p0;
+--error 1031
+ALTER TABLE t1 REPAIR PARTITION p0;
+--error 1031
+ALTER TABLE t1 ANALYZE PARTITION p0;
+--error 1031
+ALTER TABLE t1 REBUILD PARTITION p0;
+DROP TABLE t1;
+
+#
+# BUG 16806: ALTER TABLE fails
+#
+CREATE TABLE t1 (
+ c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
+ c2 TEXT NOT NULL,
+ c3 INT NOT NULL,
+ PRIMARY KEY(c1,c3))
+ ENGINE=NDB
+ PARTITION BY KEY(c3) PARTITIONS 5;
+
+ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
+ c2 TEXT NOT NULL,
+ c3 INT NOT NULL,
+ PRIMARY KEY(c1,c3))
+ ENGINE=NDB
+ PARTITION BY KEY(c3);
+
+ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1;
+DROP TABLE t1;
diff --git a/mysql-test/t/ndb_partition_list.test b/mysql-test/t/ndb_partition_list.test
new file mode 100644
index 00000000000..2ad37b8768c
--- /dev/null
+++ b/mysql-test/t/ndb_partition_list.test
@@ -0,0 +1,64 @@
+--source include/have_ndb.inc
+#
+# Simple test for the partition storage engine
+# Focuses on range partitioning tests
+#
+#-- source include/have_partition.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Partition by list, basic
+#
+
+CREATE TABLE t1 ( f_int1 INTEGER NOT NULL, f_int2 INTEGER NOT NULL,
+ f_char1 CHAR(10),
+ f_char2 CHAR(10), f_charbig VARCHAR(1000),
+PRIMARY KEY (f_int1,f_int2))
+ENGINE = NDB
+PARTITION BY LIST(MOD(f_int1 + f_int2,4))
+(PARTITION part_3 VALUES IN (-3),
+ PARTITION part_2 VALUES IN (-2),
+ PARTITION part_1 VALUES IN (-1),
+ PARTITION part0 VALUES IN (0),
+ PARTITION part1 VALUES IN (1),
+ PARTITION part2 VALUES IN (2),
+ PARTITION part3 VALUES IN (3,4,5));
+
+INSERT INTO t1 SET f_int1 = -2, f_int2 = 20, f_char1 = '20', f_char2 = '20', f_charbig = '===20===';
+INSERT INTO t1 SET f_int1 = 1, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 2, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 3, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 4, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 5, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 20, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+
+SELECT * FROM t1 ORDER BY f_int1;
+
+DROP TABLE t1;
+
+#
+# Partition by list, no pk
+#
+
+CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(10),
+ f_char2 CHAR(10), f_charbig VARCHAR(1000))
+ENGINE = NDB
+PARTITION BY LIST(f_int1)
+(PARTITION part_1 VALUES IN (-1),
+ PARTITION part0 VALUES IN (0,1),
+ PARTITION part1 VALUES IN (2));
+
+INSERT INTO t1 SET f_int1 = -1, f_int2 = 20, f_char1 = '20', f_char2 = '20', f_charbig = '===20===';
+INSERT INTO t1 SET f_int1 = 0, f_int2 = 20, f_char1 = '20', f_char2 = '20', f_charbig = '===20===';
+INSERT INTO t1 SET f_int1 = 1, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 2, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+INSERT INTO t1 SET f_int1 = 20, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+
+SELECT * FROM t1 ORDER BY f_int1;
+
+DROP TABLE t1;
+
diff --git a/mysql-test/t/ndb_partition_range.test b/mysql-test/t/ndb_partition_range.test
new file mode 100644
index 00000000000..981467d4055
--- /dev/null
+++ b/mysql-test/t/ndb_partition_range.test
@@ -0,0 +1,260 @@
+-- source include/have_ndb.inc
+#--disable_abort_on_error
+#
+# Simple test for the partition storage engine
+# Focuses on range partitioning tests
+#
+#-- source include/have_partition.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Partition by range, basic
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b),
+index (a))
+engine = ndb
+partition by range (a)
+partitions 3
+(partition x1 values less than (5),
+ partition x2 values less than (10),
+ partition x3 values less than (20));
+
+# Simple insert and verify test
+INSERT into t1 values (1, 1, 1);
+INSERT into t1 values (6, 1, 1);
+INSERT into t1 values (10, 1, 1);
+INSERT into t1 values (15, 1, 1);
+
+--replace_column 16 # 19 # 20 #
+select * from information_schema.partitions where table_name= 't1';
+
+select * from t1 order by a;
+
+select * from t1 where a=1 order by a;
+select * from t1 where a=15 and b=1 order by a;
+select * from t1 where a=21 and b=1 order by a;
+select * from t1 where a=21 order by a;
+select * from t1 where a in (1,6,10,21) order by a;
+select * from t1 where b=1 and a in (1,6,10,21) order by a;
+
+drop table t1;
+
+#
+# Partition by range, basic
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(b),
+unique (a))
+engine = ndb
+partition by range (b)
+partitions 3
+(partition x1 values less than (5),
+ partition x2 values less than (10),
+ partition x3 values less than (20));
+
+# Simple insert and verify test
+INSERT into t1 values (1, 1, 1);
+INSERT into t1 values (2, 6, 1);
+INSERT into t1 values (3, 10, 1);
+INSERT into t1 values (4, 15, 1);
+
+select * from t1 order by a;
+UPDATE t1 set a = 5 WHERE b = 15;
+select * from t1 order by a;
+UPDATE t1 set a = 6 WHERE a = 5;
+select * from t1 order by a;
+
+select * from t1 where b=1 order by b;
+select * from t1 where b=15 and a=1 order by b;
+select * from t1 where b=21 and a=1 order by b;
+select * from t1 where b=21 order by b;
+select * from t1 where b in (1,6,10,21) order by b;
+select * from t1 where a in (1,2,5,6) order by b;
+select * from t1 where a=1 and b in (1,6,10,21) order by b;
+
+DELETE from t1 WHERE b = 6;
+DELETE from t1 WHERE a = 6;
+
+#
+# Test that explicit partition info _is_ shown in show create table
+# result _should_ contain (PARTITION x1 ... etc)
+#
+show create table t1;
+
+drop table t1;
+
+#
+# Bug #17499, #17687
+# Alter partitioned NDB table causes mysqld to core
+#
+
+CREATE TABLE t1
+ (id MEDIUMINT NOT NULL,
+ b1 BIT(8),
+ vc VARCHAR(255),
+ bc CHAR(255),
+ d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0,
+ total BIGINT UNSIGNED,
+ y YEAR,
+ t DATE) ENGINE=NDB
+ PARTITION BY RANGE (YEAR(t))
+ (PARTITION p0 VALUES LESS THAN (1901),
+ PARTITION p1 VALUES LESS THAN (1946),
+ PARTITION p2 VALUES LESS THAN (1966),
+ PARTITION p3 VALUES LESS THAN (1986),
+ PARTITION p4 VALUES LESS THAN (2005),
+ PARTITION p5 VALUES LESS THAN MAXVALUE);
+
+INSERT INTO t1 VALUES (0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+SELECT * FROM t1;
+ALTER TABLE t1 ENGINE=MYISAM;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE LOGFILE GROUP lg1
+ ADD UNDOFILE 'undofile.dat'
+ INITIAL_SIZE 16M
+ UNDO_BUFFER_SIZE=1M
+ ENGINE=NDB;
+
+CREATE TABLESPACE ts1
+ ADD DATAFILE 'datafile.dat'
+ USE LOGFILE GROUP lg1
+ INITIAL_SIZE 12M
+ ENGINE NDB;
+
+CREATE TABLE test.t1 (
+ a1 INT,
+ a2 TEXT NOT NULL,
+ a3 BIT NOT NULL,
+ a4 DECIMAL(8,3),
+ a5 INT NOT NULL,
+ a6 INT,
+ PRIMARY KEY(a1))
+ TABLESPACE ts1 STORAGE DISK ENGINE=NDB
+ PARTITION BY LIST (a1)
+ (PARTITION p0 VALUES IN (1,2,3,4,5),
+ PARTITION p1 VALUES IN (6,7,8,9, 10),
+ PARTITION p2 VALUES IN (11, 12, 13, 14, 15));
+
+# Alter table directly without any statements inbetween
+ALTER TABLE test.t1 DROP COLUMN a6;
+ALTER TABLE test.t1 ADD COLUMN a6 VARCHAR(255);
+
+let $j= 15;
+--disable_query_log
+while ($j)
+{
+eval INSERT INTO test.t1 VALUES ($j, "Tested Remotely from Texas, USA",
+b'1',$j.00,$j+1,"By NIK $j");
+dec $j;
+}
+--enable_query_log
+SELECT COUNT(*) FROM test.t1;
+
+ALTER TABLE test.t1 DROP COLUMN a4;
+SELECT COUNT(*) FROM test.t1;
+
+DROP TABLE t1;
+
+CREATE TABLE test.t1 (
+ a1 INT,
+ a2 TEXT NOT NULL,
+ a3 BIT NOT NULL,
+ a4 DECIMAL(8,3),
+ a5 INT NOT NULL,
+ a6 VARCHAR(255),
+ PRIMARY KEY(a1))
+ TABLESPACE ts1 STORAGE DISK ENGINE=NDB
+ PARTITION BY HASH(a1)
+ PARTITIONS 4;
+
+let $j= 15;
+--disable_query_log
+while ($j)
+{
+eval INSERT INTO test.t1 VALUES ($j, "Tested Remotely from Texas, USA",
+b'1',$j.00,$j+1,"By NIK $j");
+dec $j;
+}
+--enable_query_log
+SELECT COUNT(*) FROM test.t1;
+
+ALTER TABLE test.t1 DROP COLUMN a4;
+SELECT COUNT(*) FROM test.t1;
+
+DROP TABLE t1;
+
+ALTER TABLESPACE ts1
+ DROP DATAFILE 'datafile.dat'
+ ENGINE=NDB;
+DROP TABLESPACE ts1 ENGINE=NDB;
+DROP LOGFILE GROUP lg1 ENGINE=NDB;
+
+
+#
+# Bug #17701 ALTER TABLE t1 ADD PARTITION for PARTITION BY LIST hangs test
+#
+
+CREATE TABLE t1
+ (id MEDIUMINT NOT NULL,
+ b1 BIT(8),
+ vc VARCHAR(255),
+ bc CHAR(255),
+ d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0,
+ total BIGINT UNSIGNED,
+ y YEAR,
+ t DATE) ENGINE=NDB
+ PARTITION BY LIST(id)
+ (PARTITION p0 VALUES IN (2, 4),
+ PARTITION p1 VALUES IN (42, 142));
+
+INSERT INTO t1 VALUES (2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+SELECT * FROM t1;
+ALTER TABLE t1 ADD PARTITION
+ (PARTITION p2 VALUES IN (412));
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# Bug #17806 Update on NDB table with list partition causes mysqld to core
+# Bug #16385 Partitions: crash when updating a range partitioned NDB table
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null)
+partition by list(a)
+partitions 2
+(partition x123 values in (1,5,6),
+ partition x234 values in (4,7,8));
+INSERT into t1 VALUES (5,1,1);
+select * from t1;
+UPDATE t1 SET a=8 WHERE a=5 AND b=1;
+select * from t1;
+drop table t1;
+
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20)) engine=ndb
+PARTITION BY RANGE(f1)
+( PARTITION part1 VALUES LESS THAN (2),
+PARTITION part2 VALUES LESS THAN (1000));
+INSERT INTO t1 VALUES(1, '---1---');
+INSERT INTO t1 VALUES(2, '---2---');
+select * from t1 order by f1;
+UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 2;
+select * from t1 order by f1;
+UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 1;
+select * from t1 order by f1;
+drop table t1;
diff --git a/mysql-test/t/ndb_replace.test b/mysql-test/t/ndb_replace.test
index 6cad80ef8ea..94a11f7dfb2 100644
--- a/mysql-test/t/ndb_replace.test
+++ b/mysql-test/t/ndb_replace.test
@@ -6,7 +6,7 @@
#
--disable_warnings
-drop table if exists t1;
+drop table if exists t1,t2;
--enable_warnings
CREATE TABLE t1 (
@@ -27,6 +27,8 @@ replace into t1 (gesuchnr,benutzer_id) values (1,1);
select * from t1 order by gesuchnr;
drop table t1;
+# End of 4.1 tests
+
# bug#17431
CREATE TABLE t1(i INT PRIMARY KEY AUTO_INCREMENT,
j INT,
@@ -38,4 +40,28 @@ REPLACE INTO t1 (j,k) VALUES (1,42);
REPLACE INTO t1 (i,j) VALUES (17,2);
SELECT * from t1 ORDER BY i;
-# End of 4.1 tests
+# bug#19906
+CREATE TABLE t2 (a INT(11) NOT NULL,
+ b INT(11) NOT NULL,
+ c INT(11) NOT NULL,
+ x TEXT,
+ y TEXT,
+ z TEXT,
+ id INT(10) unsigned NOT NULL AUTO_INCREMENT,
+ i INT(11) DEFAULT NULL,
+ PRIMARY KEY (id),
+ UNIQUE KEY a (a,b,c)
+) ENGINE=ndbcluster;
+
+REPLACE INTO t2 (a,b,c,x,y,z,i) VALUES (1,1,1,'a','a','a',1),(1,1,1,'b','b','b',2), (1,1,1,'c','c','c',3);
+
+SELECT * FROM t2 ORDER BY id;
+
+REPLACE INTO t2(a,b,c,x,y,z,i) values (1,1,1,'a','a','a',1);
+REPLACE INTO t2(a,b,c,x,y,z,i) values (1,1,1,'b','b','b',2);
+
+SELECT * FROM t2 ORDER BY id;
+
+DROP TABLE t2;
+
+
diff --git a/mysql-test/t/ndb_restore_partition-master.opt b/mysql-test/t/ndb_restore_partition-master.opt
new file mode 100644
index 00000000000..075c6392dde
--- /dev/null
+++ b/mysql-test/t/ndb_restore_partition-master.opt
@@ -0,0 +1 @@
+--new
diff --git a/mysql-test/t/ndb_restore_partition.test b/mysql-test/t/ndb_restore_partition.test
new file mode 100644
index 00000000000..f11324492c2
--- /dev/null
+++ b/mysql-test/t/ndb_restore_partition.test
@@ -0,0 +1,375 @@
+-- source include/have_ndb.inc
+-- source include/ndb_default_cluster.inc
+-- source include/not_embedded.inc
+
+--disable_warnings
+use test;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+--enable_warnings
+
+CREATE TABLE `t1_c` (
+ `capgoaledatta` smallint(5) unsigned NOT NULL auto_increment,
+ `goaledatta` char(2) NOT NULL default '',
+ `maturegarbagefa` varchar(32) NOT NULL default '',
+ PRIMARY KEY (`capgoaledatta`,`goaledatta`,`maturegarbagefa`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t1_c` VALUES (2,'3','q3plus.qt'),(4,'4','q3plus.qt'),(1,'3','q3.net'),(3,'4','q3.net'),(3,'20','threetrees.qt');
+
+CREATE TABLE `t2_c` (
+ `capgotod` smallint(5) unsigned NOT NULL auto_increment,
+ `gotod` smallint(5) unsigned NOT NULL default '0',
+ `goaledatta` char(2) default NULL,
+ `maturegarbagefa` varchar(32) default NULL,
+ `descrpooppo` varchar(64) default NULL,
+ `svcutonsa` varchar(64) NOT NULL default '',
+ PRIMARY KEY (`capgotod`),
+ KEY `i_quadaddsvr` (`gotod`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t2_c` VALUES (5,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST');
+
+CREATE TABLE `t3_c` (
+ `CapGoaledatta` smallint(5) unsigned NOT NULL default '0',
+ `capgotod` smallint(5) unsigned NOT NULL default '0',
+ PRIMARY KEY (`capgotod`,`CapGoaledatta`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t3_c` VALUES (5,3),(2,4),(5,4),(1,3);
+
+CREATE TABLE `t4_c` (
+ `capfa` bigint(20) unsigned NOT NULL auto_increment,
+ `realm` varchar(32) NOT NULL default '',
+ `authpwchap` varchar(32) default NULL,
+ `fa` varchar(32) NOT NULL default '',
+ `payyingatta` tinyint(4) NOT NULL default '0',
+ `status` char(1) default NULL,
+ PRIMARY KEY (`fa`,`realm`),
+ KEY `capfa` (`capfa`),
+ KEY `i_quadentity` (`fa`,`realm`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t4_c` VALUES (18,'john.smith','q3.net','dessjohn.smith',0,NULL),(21,'quad_katt_with_brandtad','q3.net','acne',0,NULL),(22,'quad_katt_carattoaa','q3.net','acne',0,NULL),(26,'436462612809','sqasdt.q3.net','N/A',0,'6'),(19,'john','smith.qt','dessjohn',0,NULL),(33,'436643196120','sqasdt.q3.net','N/A',1,'6'),(28,'436642900019','sqasdt.q3.net','N/A',0,'6'),(30,'436462900209','sqasdt.q3.net','N/A',0,'6'),(16,'436640006666','sqasdt.q3.net','',0,NULL),(19,'dette','el-redun.com','dessdette',0,NULL),(12,'quad_kattPP','q3.net','acne',2,NULL),(14,'436640008888','sqasdt.q3.net','',0,NULL),(29,'463624900028','sqasdt.q3.net','N/A',0,'6'),(15,'436640099099','sqasdt.q3.net','',0,NULL),(13,'pap','q3plus.qt','acne',1,NULL),(19,'436642612091','sqasdt.q3.net','N/A',0,'6'),(12,'quad_katt','q3.net','acne',0,NULL),(11,'quad_kattVK','q3.net','acne',1,NULL),(32,'463641969502','sqasdt.q3.net','N/A',1,'6'),(20,'joe','q3.net','joedesswd',0,NULL),(29,'436642900034','sqasdt.q3.net','N/A',0,'6'),(25,'contind','armerde.qt','acne',1,NULL);
+
+CREATE TABLE `t5_c` (
+ `capfa` bigint(20) unsigned NOT NULL default '0',
+ `gotod` smallint(5) unsigned NOT NULL default '0',
+ `orderutonsa` varchar(64) NOT NULL default '',
+ PRIMARY KEY (`capfa`,`gotod`,`orderutonsa`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t5_c` VALUES (21,2,''),(21,1,''),(22,4,'');
+
+CREATE TABLE `t6_c` (
+ `capfa_parent` bigint(20) unsigned NOT NULL default '0',
+ `capfa_child` bigint(20) unsigned NOT NULL default '0',
+ `relatta` smallint(5) unsigned NOT NULL default '0',
+ PRIMARY KEY (`capfa_child`,`capfa_parent`,`relatta`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t6_c` VALUES (15,16,0),(19,20,0),(18326932092909551615,30,0),(26,29,0),(18326932092909551615,29,0),(19,18,0),(26,28,0),(12,14,0);
+
+CREATE TABLE `t7_c` (
+ `dardpo` char(15) NOT NULL default '',
+ `dardtestard` tinyint(3) unsigned NOT NULL default '0',
+ `FastFA` char(5) NOT NULL default '',
+ `FastCode` char(6) NOT NULL default '',
+ `Fastca` char(1) NOT NULL default '',
+ `Fastmag` char(1) NOT NULL default '',
+ `Beareratta` char(2) NOT NULL default '',
+ PRIMARY KEY (`dardpo`,`dardtestard`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t7_c` VALUES ('2.6.2.4',24,'CECHP','54545','0','0','5'),('2.2.5.4',26,'CANFA','33223','1','1','4'),('4.3.2.4',28,'ITALD','54222','1','0','5'),('129..0.0.eins',28,'G','99999','1','1','5'),('1.1.1.1',24,'AUTPT','32323','0','1','3');
+
+CREATE TABLE `t8_c` (
+ `kattjame` varchar(32) NOT NULL default '',
+ `realm` varchar(32) NOT NULL default '',
+ `realm_entered` varchar(32) NOT NULL default '',
+ `maturegarbagefa` varchar(32) NOT NULL default '',
+ `hunderaaarbagefa_parent` varchar(32) NOT NULL default '',
+ `kattjame_entered` varchar(32) NOT NULL default '',
+ `hunderaaarbagefa` varchar(32) NOT NULL default '',
+ `gest` varchar(16) default NULL,
+ `hassetino` varchar(16) NOT NULL default '',
+ `aaaproxysessfa` varchar(255) default NULL,
+ `autologonallowed` char(1) default NULL,
+ `squardporoot` varchar(15) NOT NULL default '',
+ `naspo` varchar(15) default NULL,
+ `beareratta` char(2) default NULL,
+ `fastCode` varchar(6) default NULL,
+ `fastFA` varchar(5) default NULL,
+ `fastca` char(1) default NULL,
+ `fastmag` char(1) default NULL,
+ `lastupdate` datetime default NULL,
+ `hassetistart` datetime NOT NULL default '0000-00-00 00:00:00',
+ `accthassetitime` int(10) unsigned default NULL,
+ `acctoutputoctets` bigint(20) unsigned default NULL,
+ `acctinputoctets` bigint(20) unsigned default NULL,
+ PRIMARY KEY (`kattjame`,`hunderaaarbagefa`,`hassetistart`,`hassetino`),
+ KEY `squardporoot` (`squardporoot`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t8_c` VALUES ('4tt45345235','pap','q3plus.qt','q3plus.qt','q3.net','436643196120','436643196929','8956234534568968','5524595699','uxasmt21.net.acne.qt/481889229462692422','','1.1.1.1','2.2.4.6','4','86989','34','x','x','2012-03-12 12:55:34','2012-12-05 11:20:04',3223433,3369,9565),('4545435545','john','q3.net','q3.net','acne.li','436643196120','436643196929','45345234568968','995696699','uxasmt21.net.acne.qt/481889229462692423','','1.1.1.1','2.2.9.8','2','86989','34','x','x','2012-03-12 11:35:03','2012-12-05 08:50:04',8821923,169,3565),('versteckter_q3net_katt','joe','q3.net','elredun.com','q3.net','436643196120','436643196939','91341234568968','695595699','uxasmt21.net.acne.qt/481889229462692421','','1.1.1.1','2.5.2.5','3','86989','34','x','x','2012-03-12 18:35:04','2012-12-05 12:35:04',1923123,9569,6565);
+
+CREATE TABLE `t9_c` (
+ `kattjame` varchar(32) NOT NULL default '',
+ `kattjame_entered` varchar(32) NOT NULL default '',
+ `realm` varchar(32) NOT NULL default '',
+ `realm_entered` varchar(32) NOT NULL default '',
+ `maturegarbagefa` varchar(32) NOT NULL default '',
+ `hunderaaarbagefa` varchar(32) NOT NULL default '',
+ `hunderaaarbagefa_parent` varchar(32) NOT NULL default '',
+ `gest` varchar(16) default NULL,
+ `hassetino` varchar(16) NOT NULL default '',
+ `squardporoot` varchar(15) NOT NULL default '',
+ `naspo` varchar(15) default NULL,
+ `beareratta` char(2) default NULL,
+ `fastCode` varchar(6) default NULL,
+ `fastFA` varchar(5) default NULL,
+ `fastca` char(1) default NULL,
+ `fastmag` char(1) default NULL,
+ `lastupdate` datetime default NULL,
+ `hassetistart` datetime NOT NULL default '0000-00-00 00:00:00',
+ `accthassetitime` int(10) unsigned default NULL,
+ `actcoutpuocttets` bigint(20) unsigned default NULL,
+ `actinputocctets` bigint(20) unsigned default NULL,
+ `terminateraste` tinyint(3) unsigned default NULL,
+ PRIMARY KEY (`kattjame`,`hunderaaarbagefa`,`hassetistart`,`hassetino`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t9_c` VALUES ('3g4jh8gar2t','joe','q3.net','elredun.com','q3.net','436643316120','436643316939','91341234568968','695595699','1.1.1.1','2.2.6.2','3','86989','34','x','x','2012-03-12 18:35:04','2012-12-05 12:35:04',3123123,9569,6565,1),('4tt45345235','pap','q3plus.qt','q3plus.qt','q3.net','436643316120','436643316939','8956234534568968','5254595969','1.1.1.1','8.6.2.2','4','86989','34','x','x','2012-03-12 12:55:34','2012-12-05 11:20:04',3223433,3369,9565,2),('4545435545','john','q3.net','q3.net','acne.li','436643316120','436643316939','45345234568968','995696699','1.1.1.1','2.9.9.2','2','86998','34','x','x','2012-03-12 11:35:03','2012-12-05 08:50:04',8823123,169,3565,3);
+
+create table t1 engine=myisam as select * from t1_c;
+create table t2 engine=myisam as select * from t2_c;
+create table t3 engine=myisam as select * from t3_c;
+create table t4 engine=myisam as select * from t4_c;
+create table t5 engine=myisam as select * from t5_c;
+create table t6 engine=myisam as select * from t6_c;
+create table t7 engine=myisam as select * from t7_c;
+create table t8 engine=myisam as select * from t8_c;
+create table t9 engine=myisam as select * from t9_c;
+
+
+--source include/ndb_backup.inc
+drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+
+# random output order??
+#show tables;
+
+select count(*) from t1;
+select count(*) from t1_c;
+select count(*)
+ from (select * from t1 union
+ select * from t1_c) a;
+
+select count(*) from t2;
+select count(*) from t2_c;
+select count(*)
+ from (select * from t2 union
+ select * from t2_c) a;
+
+select count(*) from t3;
+select count(*) from t3_c;
+select count(*)
+ from (select * from t3 union
+ select * from t3_c) a;
+
+select count(*) from t4;
+select count(*) from t4_c;
+select count(*)
+ from (select * from t4 union
+ select * from t4_c) a;
+
+select count(*) from t5;
+select count(*) from t5_c;
+select count(*)
+ from (select * from t5 union
+ select * from t5_c) a;
+
+select count(*) from t6;
+select count(*) from t6_c;
+select count(*)
+ from (select * from t6 union
+ select * from t6_c) a;
+
+select count(*) from t7;
+select count(*) from t7_c;
+select count(*)
+ from (select * from t7 union
+ select * from t7_c) a;
+
+select count(*) from t8;
+select count(*) from t8_c;
+select count(*)
+ from (select * from t8 union
+ select * from t8_c) a;
+
+select count(*) from t9;
+select count(*) from t9_c;
+select count(*)
+ from (select * from t9 union
+ select * from t9_c) a;
+
+#
+# Try Partitioned tables as well
+#
+ALTER TABLE t1_c
+PARTITION BY RANGE (`capgoaledatta`)
+(PARTITION p0 VALUES LESS THAN MAXVALUE);
+
+ALTER TABLE t2_c
+PARTITION BY LIST(`capgotod`)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6));
+
+ALTER TABLE t3_c
+PARTITION BY HASH (`CapGoaledatta`);
+
+ALTER TABLE t5_c
+PARTITION BY HASH (`capfa`)
+PARTITIONS 4;
+
+ALTER TABLE t6_c
+PARTITION BY LINEAR HASH (`relatta`)
+PARTITIONS 4;
+
+ALTER TABLE t7_c
+PARTITION BY LINEAR KEY (`dardtestard`);
+
+--source include/ndb_backup.inc
+drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+
+select count(*) from t1;
+select count(*) from t1_c;
+select count(*)
+ from (select * from t1 union
+ select * from t1_c) a;
+
+select count(*) from t2;
+select count(*) from t2_c;
+select count(*)
+ from (select * from t2 union
+ select * from t2_c) a;
+
+select count(*) from t3;
+select count(*) from t3_c;
+select count(*)
+ from (select * from t3 union
+ select * from t3_c) a;
+
+select count(*) from t4;
+select count(*) from t4_c;
+select count(*)
+ from (select * from t4 union
+ select * from t4_c) a;
+
+select count(*) from t5;
+select count(*) from t5_c;
+select count(*)
+ from (select * from t5 union
+ select * from t5_c) a;
+
+select count(*) from t6;
+select count(*) from t6_c;
+select count(*)
+ from (select * from t6 union
+ select * from t6_c) a;
+
+select count(*) from t7;
+select count(*) from t7_c;
+select count(*)
+ from (select * from t7 union
+ select * from t7_c) a;
+
+select count(*) from t8;
+select count(*) from t8_c;
+select count(*)
+ from (select * from t8 union
+ select * from t8_c) a;
+
+select count(*) from t9;
+select count(*) from t9_c;
+select count(*)
+ from (select * from t9 union
+ select * from t9_c) a;
+
+drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 1 -m -r --ndb-nodegroup_map '(0,0)' --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+
+select count(*) from t1;
+select count(*) from t1_c;
+select count(*)
+ from (select * from t1 union
+ select * from t1_c) a;
+
+select count(*) from t2;
+select count(*) from t2_c;
+select count(*)
+ from (select * from t2 union
+ select * from t2_c) a;
+
+select count(*) from t3;
+select count(*) from t3_c;
+select count(*)
+ from (select * from t3 union
+ select * from t3_c) a;
+
+select count(*) from t4;
+select count(*) from t4_c;
+select count(*)
+ from (select * from t4 union
+ select * from t4_c) a;
+
+select count(*) from t5;
+select count(*) from t5_c;
+select count(*)
+ from (select * from t5 union
+ select * from t5_c) a;
+
+select count(*) from t6;
+select count(*) from t6_c;
+select count(*)
+ from (select * from t6 union
+ select * from t6_c) a;
+
+select count(*) from t7;
+select count(*) from t7_c;
+select count(*)
+ from (select * from t7 union
+ select * from t7_c) a;
+
+select count(*) from t8;
+select count(*) from t8_c;
+select count(*)
+ from (select * from t8 union
+ select * from t8_c) a;
+
+select count(*) from t9;
+select count(*) from t9_c;
+select count(*)
+ from (select * from t9 union
+ select * from t9_c) a;
+
+#
+# Drop all table except t2_c
+# This to make sure that error returned from ndb_restore above is
+# guaranteed to be from t2_c, this since order of tables in backup
+# is none deterministic
+#
+drop table t1_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+--source include/ndb_backup.inc
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --core=0 -b $the_backup_id -n 1 -m -r --ndb-nodegroup_map '(0,1)' $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id 2>&1 | grep Translate || true
+
+#
+# Cleanup
+#
+
+--disable_warnings
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+drop table if exists t2_c;
+--enable_warnings
+
+#
+# Test BUG#10287
+#
+
+--exec $NDB_TOOLS_DIR/ndb_select_all --no-defaults -d sys -D , SYSTAB_0 | grep 520093696, | sed "s/,$the_backup_id/,<the_backup_id>/"
+
+# End of 4.1 tests
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index 6e5ea515710..5056a7f9b91 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -10,6 +10,59 @@ drop table if exists t1;
--enable_warnings
#
+# Bug 19309 Partitions: Crash if double procedural alter
+#
+create table t1 (a int)
+partition by list (a)
+(partition p0 values in (1));
+
+create procedure pz()
+alter table t1 engine = myisam;
+
+call pz();
+call pz();
+drop procedure pz;
+drop table t1;
+
+#
+# Bug 19307: CSV engine crashes
+#
+--error ER_PARTITION_MERGE_ERROR
+create table t1 (a int)
+engine = csv
+partition by list (a)
+(partition p0 values in (null));
+
+#
+# BUG 16002: Handle unsigned integer functions properly
+#
+--error 1064
+create table t1 (a bigint)
+partition by range (a)
+(partition p0 values less than (0xFFFFFFFFFFFFFFFF),
+ partition p1 values less than (10));
+--error 1064
+create table t1 (a bigint)
+partition by list (a)
+(partition p0 values in (0xFFFFFFFFFFFFFFFF),
+ partition p1 values in (10));
+
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (100),
+ partition p1 values less than MAXVALUE);
+insert into t1 values (1);
+drop table t1;
+
+create table t1 (a bigint unsigned)
+partition by hash (a);
+insert into t1 values (0xFFFFFFFFFFFFFFFD);
+insert into t1 values (0xFFFFFFFFFFFFFFFE);
+select * from t1 where (a + 1) < 10;
+select * from t1 where (a + 1) > 10;
+drop table t1;
+
+#
# Bug 19307: CSV engine crashes
#
--error ER_PARTITION_MERGE_ERROR
@@ -19,6 +72,7 @@ partition by list (a)
(partition p0 values in (null));
#
+# Added test case
#
create table t1 (a int)
partition by key(a)
@@ -913,6 +967,12 @@ create table t1 (f1 smallint)
partition by list (f1) (partition p0 values in (null));
insert into t1 values (null);
select * from t1 where f1 is null;
+select * from t1 where f1 < 1;
+select * from t1 where f1 <= NULL;
+select * from t1 where f1 < NULL;
+select * from t1 where f1 >= NULL;
+select * from t1 where f1 > NULL;
+select * from t1 where f1 > 1;
drop table t1;
create table t1 (f1 smallint)
@@ -980,6 +1040,23 @@ SHOW TABLE STATUS;
DROP TABLE t1;
#
+#BUG 16002 Erroneus handling of unsigned partition functions
+#
+--error ER_PARTITION_CONST_DOMAIN_ERROR
+create table t1 (a bigint unsigned)
+partition by list (a)
+(partition p0 values in (0-1));
+
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (10));
+
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+insert into t1 values (0xFFFFFFFFFFFFFFFF);
+
+drop table t1;
+
+#
#BUG 18750 Problems with partition names
#
create table t1 (a int)
@@ -1140,4 +1217,42 @@ alter table t1 drop partition p2;
use test;
drop database db99;
+#
+#BUG 17138 Problem with stored procedure and analyze partition
+#
+--disable_warnings
+drop procedure if exists mysqltest_1;
+--enable_warnings
+
+create table t1 (a int)
+partition by list (a)
+(partition p0 values in (0));
+
+insert into t1 values (0);
+delimiter //;
+
+create procedure mysqltest_1 ()
+begin
+ begin
+ declare continue handler for sqlexception begin end;
+ update ignore t1 set a = 1 where a = 0;
+ end;
+ prepare stmt1 from 'alter table t1';
+ execute stmt1;
+end//
+
+call mysqltest_1()//
+delimiter ;//
+drop table t1;
+drop procedure mysqltest_1;
+
+#
+# Bug 20583 Partitions: Crash using index_last
+#
+create table t1 (a int, index(a))
+partition by hash(a);
+insert into t1 values (1),(2);
+select * from t1 ORDER BY a DESC;
+drop table t1;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test
index 659f0b8cef4..d0e3f355292 100644
--- a/mysql-test/t/partition_error.test
+++ b/mysql-test/t/partition_error.test
@@ -9,6 +9,24 @@ drop table if exists t1;
--enable_warnings
#
+# Bug 20397: Partitions: Crash when using non-existing engine
+#
+create table t1 (a int)
+engine = x
+partition by key (a);
+show create table t1;
+drop table t1;
+
+create table t1 (a int)
+engine = innodb
+partition by list (a)
+(partition p0 values in (0));
+
+alter table t1 engine = x;
+show create table t1;
+drop table t1;
+
+#
# Partition by key stand-alone error
#
--error 1064
@@ -89,6 +107,8 @@ partitions 3
(partition x1 tablespace ts1,
partition x2 tablespace ts2,
partition x3 tablespace ts3);
+
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
#
# Partition by hash, invalid field in function
#
@@ -184,6 +204,7 @@ partition by hash (a)
partitions 2
(partition x1 values less than (4),
partition x2 values less than (5));
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
#
# Partition by hash, values in error
@@ -198,6 +219,7 @@ partition by hash (a)
partitions 2
(partition x1 values in (4),
partition x2 values in (5));
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
#
# Partition by hash, values in error
@@ -212,6 +234,7 @@ partition by hash (a)
partitions 2
(partition x1 values in (4,6),
partition x2 values in (5,7));
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
#
# Subpartition by key, no partitions defined, single field
@@ -224,6 +247,7 @@ c int not null,
primary key (a,b))
partition by key (a)
subpartition by key (b);
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
#
# Subpartition by key, no partitions defined, list of fields
@@ -236,6 +260,7 @@ c int not null,
primary key (a,b))
partition by key (a)
subpartition by key (a, b);
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
#
# Subpartition by hash, no partitions defined
@@ -248,6 +273,7 @@ c int not null,
primary key (a,b))
partition by key (a)
subpartition by hash (a+b);
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
#
# Subpartition by key, no partitions defined, single field
@@ -260,6 +286,7 @@ c int not null,
primary key (a,b))
partition by key (a)
subpartition by key (b);
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
#
# Subpartition by key, no partitions defined, list of fields
@@ -272,6 +299,7 @@ c int not null,
primary key (a,b))
partition by key (a)
subpartition by key (a, b);
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
#
# Subpartition by hash, no partitions defined
@@ -284,6 +312,7 @@ c int not null,
primary key (a,b))
partition by key (a)
subpartition by hash (a+b);
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
#
# Subpartition by hash, no partitions defined, wrong subpartition function
@@ -310,6 +339,7 @@ partition by key (a)
subpartition by hash (sin(a+b))
(partition x1 (subpartition x11, subpartition x12),
partition x2 (subpartition x21, subpartition x22));
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
#
# Subpartition by hash, no partitions defined, wrong subpartition function
@@ -338,6 +368,7 @@ partition by range (a)
subpartition by key (a,d)
(partition x1 values less than (1) (subpartition x11, subpartition x12),
partition x2 values less than (2) (subpartition x21, subpartition x22));
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
#
# Subpartition by hash, no partitions defined, wrong subpartition function
@@ -375,6 +406,7 @@ b int not null,
c int not null,
primary key(a,b))
partition by range (a);
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
#
# Partition by range, invalid field in function
@@ -748,6 +780,10 @@ CREATE TABLE t1(a int)
insert into t1 values (10);
drop table t1;
+--error ER_PARTITION_CONST_DOMAIN_ERROR
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (-1));
#
# Bug 18198 Partitions: Verify that erroneus partition functions doesn't work
#
@@ -775,3 +811,5 @@ partition by range (a + (select count(*) from t1))
-- error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR
create table t1 (a char(10))
partition by hash (extractvalue(a,'a'));
+
+
diff --git a/mysql-test/t/partition_list.test b/mysql-test/t/partition_list.test
index 3e0eaa45f32..e243ec468e1 100644
--- a/mysql-test/t/partition_list.test
+++ b/mysql-test/t/partition_list.test
@@ -124,3 +124,15 @@ INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
SELECT COUNT(*) FROM t1 WHERE s1 < 3;
DROP TABLE t1;
+#
+# Bug 19281 Partitions: Auto-increment value lost
+#
+create table t1 (a int auto_increment primary key)
+auto_increment=100
+partition by list (a)
+(partition p0 values in (1, 100));
+create index inx on t1 (a);
+insert into t1 values (null);
+select * from t1;
+drop table t1;
+
diff --git a/mysql-test/t/partition_mgm.test b/mysql-test/t/partition_mgm.test
index 67c0619f28c..cfb76192de4 100644
--- a/mysql-test/t/partition_mgm.test
+++ b/mysql-test/t/partition_mgm.test
@@ -1,3 +1,4 @@
+-- source include/have_partition.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -5,10 +6,12 @@ CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30))
PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2;
SHOW CREATE TABLE t1;
-#--exec ls $MYSQLTEST_VARDIR/master-data/test/t1*
+--replace_result $MYSQLTEST_VARDIR "hello"
+--exec ls $MYSQLTEST_VARDIR/master-data/test/t1*
ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
-#--exec ls $MYSQLTEST_VARDIR/master-data/test/t1*
+--replace_result $MYSQLTEST_VARDIR "hello"
+--exec ls $MYSQLTEST_VARDIR/master-data/test/t1*
diff --git a/mysql-test/t/partition_range.test b/mysql-test/t/partition_range.test
index 42ce4e0d879..8e1e2e72e69 100644
--- a/mysql-test/t/partition_range.test
+++ b/mysql-test/t/partition_range.test
@@ -389,6 +389,31 @@ SELECT COUNT(*) FROM t1 WHERE c3 < '2000-12-31';
DROP TABLE t1;
#
+# BUG 16002: Unsigned partition functions not handled correctly
+#
+--error ER_RANGE_NOT_INCREASING_ERROR
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (10),
+ partition p1 values less than (0));
+
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (0),
+ partition p1 values less than (10));
+show create table t1;
+drop table t1;
+
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (2),
+ partition p1 values less than (10));
+show create table t1;
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+insert into t1 values (0xFFFFFFFFFFFFFFFF);
+drop table t1;
+
+#
# BUG 18962 Errors in DROP PARTITION
#
create table t1 (a int)
diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test
index 79bb09605fe..5e5211ffa09 100644
--- a/mysql-test/t/ps_1general.test
+++ b/mysql-test/t/ps_1general.test
@@ -325,11 +325,12 @@ execute stmt4;
# That is the reason why, we switch the output here off.
# (The real output will be tested in ps_6bdb.test)
--disable_warnings
+prepare stmt4 from ' show engine bdb logs ';
+--enable_warnings
--disable_result_log
prepare stmt4 from ' show engine bdb logs ';
execute stmt4;
--enable_result_log
---enable_warnings
prepare stmt4 from ' show grants for user ';
--error 1295
prepare stmt4 from ' show create table t2 ';
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index e2ff20e6ecc..2c94fe63c04 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -765,6 +765,9 @@ drop table t1;
create table t1 (a int);
insert into t1 values (1),(2);
+--disable_warnings
+drop procedure if exists p1;
+--enable_warnings
delimiter //;
CREATE PROCEDURE `p1`()
begin
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index f6493bac244..d1ce1104322 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -370,7 +370,7 @@ insert into t2(uid, name) values
(25, CHAR(64+25)),
(26, CHAR(64+26));
-insert into t1(uid, name) select uid, name from t2;
+insert into t1(uid, name) select uid, name from t2 order by uid;
delete from t2;
insert into t2(id, uid, name) select id, uid, name from t1;
diff --git a/mysql-test/t/renamedb.test b/mysql-test/t/renamedb.test
index 5cfb2ce0c12..1e71adb3bf3 100644
--- a/mysql-test/t/renamedb.test
+++ b/mysql-test/t/renamedb.test
@@ -16,3 +16,11 @@ select database();
show tables;
select a from t1 order by a;
drop database testdb2;
+
+#
+# Bug#19392 Rename Database: Crash if case change
+#
+create database testdb1;
+--error 1007
+rename database testdb1 to testdb1;
+drop database testdb1;
diff --git a/mysql-test/t/replace.test b/mysql-test/t/replace.test
index 10703eaafb8..269854fb180 100644
--- a/mysql-test/t/replace.test
+++ b/mysql-test/t/replace.test
@@ -35,3 +35,13 @@ select * from t1;
drop table t1;
# End of 4.1 tests
+
+#
+# Bug#19789: REPLACE was allowed for a VIEW with CHECK OPTION enabled.
+#
+CREATE TABLE t1 (f1 INT);
+CREATE VIEW v1 AS SELECT f1 FROM t1 WHERE f1 = 0 WITH CHECK OPTION;
+--error 1369
+REPLACE INTO v1 (f1) VALUES (1);
+DROP TABLE t1;
+DROP VIEW v1;
diff --git a/mysql-test/t/rpl_auto_increment_11932.test b/mysql-test/t/rpl_auto_increment_11932.test
new file mode 100644
index 00000000000..d4b7872fb2b
--- /dev/null
+++ b/mysql-test/t/rpl_auto_increment_11932.test
@@ -0,0 +1,63 @@
+#
+# Test of auto_increment
+# BUG#11932
+#
+# Bug reported that master and slave get out of sync after TRUNCATE
+# TABLE.
+#
+# Test supplied by Are Casilla
+
+source include/master-slave.inc;
+--disable_warnings
+connection master;
+drop database if exists test1;
+--enable_warnings
+create database test1;
+use test1;
+
+CREATE TABLE `t1` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `fname` varchar(100) default NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
+
+INSERT INTO `t1` VALUES (1, 'blablabla');
+
+CREATE TABLE `t2` (
+ `id` int(10) NOT NULL auto_increment,
+ `comment` varchar(255) NOT NULL default '',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM AUTO_INCREMENT=3 ;
+
+INSERT INTO `t2` VALUES (1, 'testtest 1');
+INSERT INTO `t2` VALUES (2, 'test 2');
+
+DELIMITER $;
+CREATE PROCEDURE simpleproc3 ()
+ NOT DETERMINISTIC
+ BEGIN
+ INSERT INTO t1 (fname) (SELECT t2.comment FROM t2 WHERE t2.id = '1');
+ INSERT INTO t1 (fname) VALUES('test');
+ END
+ $
+DELIMITER ;$
+
+CALL simpleproc3();
+
+select * from t2;
+
+TRUNCATE TABLE `t1`;
+CALL simpleproc3();
+
+select * from t1;
+
+save_master_pos;
+connection slave;
+sync_with_master;
+
+use test1;
+select * from t1;
+
+drop database test1;
+connection master;
+drop database test1;
diff --git a/mysql-test/t/rpl_ndb_auto_inc.test b/mysql-test/t/rpl_ndb_auto_inc.test
index a9cc9563d88..0fc31de9b3a 100644
--- a/mysql-test/t/rpl_ndb_auto_inc.test
+++ b/mysql-test/t/rpl_ndb_auto_inc.test
@@ -6,7 +6,8 @@
# Date: 2006-02-10
# Change: Augmented test to use with cluster
#####################################
--- source include/master-slave.inc
+--source include/master-slave.inc
+--source include/have_binlog_format_mixed_or_row.inc
--echo ***************** Test 1 ************************
--echo
diff --git a/mysql-test/t/rpl_ndb_dd_partitions.test b/mysql-test/t/rpl_ndb_dd_partitions.test
new file mode 100644
index 00000000000..9291f38e8db
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_dd_partitions.test
@@ -0,0 +1,310 @@
+#######################################
+# Author: JBM #
+# Date: 2006-03-09 #
+# Purpose: To test the replication of #
+# Cluster Disk Data using partitions #
+#######################################
+
+--source include/have_ndb.inc
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+--echo --- Doing pre test cleanup ---
+
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_query_log
+
+
+# Start by creating a logfile group
+##################################
+
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE = 4M
+ENGINE=NDB;
+
+###################################################
+# Create a tablespace connected to the logfile group
+###################################################
+
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M
+ENGINE NDB;
+
+ALTER TABLESPACE ts1
+ADD DATAFILE 'datafile02.dat'
+INITIAL_SIZE = 4M
+ENGINE=NDB;
+
+#################################################################
+
+--echo --- Start test 2 partition RANGE testing --
+--echo --- Do setup --
+
+
+#################################################
+# Requirment: Create table that is partitioned #
+# by range on year i.e. year(t) and replicate #
+# basice operations such at insert, update #
+# delete between 2 different storage engines #
+# Alter table and ensure table is handled #
+# Correctly on the slave #
+#################################################
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63),
+ bc CHAR(63), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE)
+ TABLESPACE ts1 STORAGE DISK
+ ENGINE=NDB
+ PARTITION BY RANGE (YEAR(t))
+ (PARTITION p0 VALUES LESS THAN (1901),
+ PARTITION p1 VALUES LESS THAN (1946),
+ PARTITION p2 VALUES LESS THAN (1966),
+ PARTITION p3 VALUES LESS THAN (1986),
+ PARTITION p4 VALUES LESS THAN (2005),
+ PARTITION p5 VALUES LESS THAN MAXVALUE);
+
+--echo --- Show table on master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Show table on slave --
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 MODIFY vc VARCHAR(255);
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still same engine ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+--enable_query_log
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- End test 2 partition RANGE testing ---
+--echo --- Do Cleanup ---
+
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+--echo --- Start test 3 partition LIST testing ---
+--echo --- Do setup ---
+#################################################
+
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63),
+ bc CHAR(63), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE)
+ TABLESPACE ts1 STORAGE DISK
+ ENGINE=NDB
+ PARTITION BY LIST(id)
+ (PARTITION p0 VALUES IN (2, 4),
+ PARTITION p1 VALUES IN (42, 142));
+
+--echo --- Test 3 Alter to add partition ---
+
+ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412));
+
+--echo --- Show table on master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Show table on slave ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 MODIFY vc VARCHAR(255);
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still same engine ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- End test 3 partition LIST testing ---
+--echo --- Do Cleanup --
+
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+--echo --- Start test 4 partition HASH testing ---
+--echo --- Do setup ---
+#################################################
+
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63),
+ bc CHAR(63), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE)
+ TABLESPACE ts1 STORAGE DISK
+ ENGINE=NDB
+ PARTITION BY HASH( YEAR(t) )
+ PARTITIONS 4;
+
+--echo --- show that tables have been created correctly ---
+
+SHOW CREATE TABLE t1;
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 MODIFY vc VARCHAR(255);
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still same engine ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- End test 4 partition HASH testing ---
+--echo --- Do Cleanup --
+
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+--echo --- Start test 5 partition by key testing ---
+--echo --- Create Table Section ---
+
+#################################################
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63),
+ bc CHAR(63), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE,PRIMARY KEY(id))
+ TABLESPACE ts1 STORAGE DISK
+ ENGINE=NDB
+ PARTITION BY KEY()
+ PARTITIONS 4;
+
+--echo --- Show that tables on master are ndbcluster tables ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Show that tables on slave ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+# Okay lets see how it holds up to table changes
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still right type ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 MODIFY vc VARCHAR(255);
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still same engine ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- End test 5 key partition testing ---
+--echo --- Do Cleanup ---
+
+DROP TABLE IF EXISTS t1;
+alter tablespace ts1
+drop datafile 'datafile.dat'
+engine=ndb;
+alter tablespace ts1
+drop datafile 'datafile02.dat'
+engine=ndb;
+DROP TABLESPACE ts1 ENGINE=NDB;
+DROP LOGFILE GROUP lg1 ENGINE=NDB;
+--sync_slave_with_master
+
+# End of 5.1 test case
diff --git a/mysql-test/t/rpl_openssl.test b/mysql-test/t/rpl_openssl.test
index 00ae5c935bf..313e22193f5 100644
--- a/mysql-test/t/rpl_openssl.test
+++ b/mysql-test/t/rpl_openssl.test
@@ -1,3 +1,7 @@
+# TODO: THIS TEST DOES NOT WORK ON WINDOWS
+# This should be fixed.
+--source include/not_windows.inc
+
source include/have_openssl.inc;
source include/master-slave.inc;
diff --git a/mysql-test/t/rpl_rbr_to_sbr.test b/mysql-test/t/rpl_rbr_to_sbr.test
index f04caf05057..c10199f8ff5 100644
--- a/mysql-test/t/rpl_rbr_to_sbr.test
+++ b/mysql-test/t/rpl_rbr_to_sbr.test
@@ -1,3 +1,4 @@
+-- source include/have_row_based.inc
-- source include/have_binlog_format_statement.inc
-- source include/master-slave.inc
diff --git a/mysql-test/t/rpl_row_basic_11bugs.test b/mysql-test/t/rpl_row_basic_11bugs.test
index 3a686ea6b3d..af7e9af4005 100644
--- a/mysql-test/t/rpl_row_basic_11bugs.test
+++ b/mysql-test/t/rpl_row_basic_11bugs.test
@@ -2,6 +2,8 @@
--source include/have_binlog_format_row.inc
+let $SERVER_VERSION=`select version()`;
+
#This test case is not written for NDB, the result files
#will not match when NDB is the default engine
-- source include/not_ndb_default.inc
@@ -36,3 +38,19 @@ USE test_ignore;
connection master;
DROP DATABASE test_ignore;
sync_slave_with_master;
+
+# Bug#19995: Extreneous table maps generated for statements that does
+# not generate rows
+--disable_query_log
+--source include/master-slave-reset.inc
+--enable_query_log
+
+connection master;
+CREATE TABLE t1 (a INT);
+DELETE FROM t1;
+INSERT INTO t1 VALUES (1),(2);
+DELETE FROM t1 WHERE a = 0;
+UPDATE t1 SET a=99 WHERE a = 0;
+--replace_result $SERVER_VERSION SERVER_VERSION
+--replace_regex /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS;
diff --git a/mysql-test/t/rpl_row_basic_8partition.test b/mysql-test/t/rpl_row_basic_8partition.test
index 8cad2226d4a..640a420c10e 100644
--- a/mysql-test/t/rpl_row_basic_8partition.test
+++ b/mysql-test/t/rpl_row_basic_8partition.test
@@ -7,6 +7,7 @@
# partition tables with same engine (MyISAM) in both ends. #
############################################################
+--source include/have_row_based.inc
--source include/have_partition.inc
--source include/master-slave.inc
connection master;
diff --git a/mysql-test/t/rpl_row_create_table.test b/mysql-test/t/rpl_row_create_table.test
index 0cb0fd766a3..a42089441d2 100644
--- a/mysql-test/t/rpl_row_create_table.test
+++ b/mysql-test/t/rpl_row_create_table.test
@@ -67,7 +67,7 @@ connection master;
CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
# Shouldn't be written to the binary log
--replace_regex /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 1326;
+SHOW BINLOG EVENTS FROM 1256;
# Test that INSERT-SELECT works the same way as for SBR.
CREATE TABLE t7 (a INT, b INT UNIQUE);
@@ -76,7 +76,7 @@ INSERT INTO t7 SELECT a,b FROM tt3;
SELECT * FROM t7 ORDER BY a,b;
# Should be written to the binary log
--replace_regex /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 1326;
+SHOW BINLOG EVENTS FROM 1118;
sync_slave_with_master;
SELECT * FROM t7 ORDER BY a,b;
@@ -87,7 +87,7 @@ BEGIN;
INSERT INTO t7 SELECT a,b FROM tt4;
ROLLBACK;
--replace_regex /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 1522;
+SHOW BINLOG EVENTS FROM 1314;
SELECT * FROM t7 ORDER BY a,b;
sync_slave_with_master;
SELECT * FROM t7 ORDER BY a,b;
@@ -101,7 +101,7 @@ CREATE TEMPORARY TABLE tt6 LIKE tt4;
--query_vertical SHOW CREATE TABLE t8
--query_vertical SHOW CREATE TABLE t9
--replace_regex /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 1618;
+SHOW BINLOG EVENTS FROM 1410;
sync_slave_with_master;
--echo **** On Slave ****
--query_vertical SHOW CREATE TABLE t8
diff --git a/mysql-test/t/rpl_row_inexist_tbl-slave.opt b/mysql-test/t/rpl_row_inexist_tbl-slave.opt
new file mode 100644
index 00000000000..abd717f8222
--- /dev/null
+++ b/mysql-test/t/rpl_row_inexist_tbl-slave.opt
@@ -0,0 +1 @@
+--replicate-ignore-table=test.t2
diff --git a/mysql-test/t/rpl_row_inexist_tbl.test b/mysql-test/t/rpl_row_inexist_tbl.test
index e77ea216571..741cc8b7ba3 100644
--- a/mysql-test/t/rpl_row_inexist_tbl.test
+++ b/mysql-test/t/rpl_row_inexist_tbl.test
@@ -6,15 +6,23 @@ source include/master-slave.inc;
connection master;
create table t1 (a int not null primary key);
+insert into t1 values (1);
+create table t2 (a int);
+insert into t2 values (1);
+update t1, t2 set t1.a = 0 where t1.a = t2.a;
+
sync_slave_with_master;
+# t2 should not have been replicated
+# t1 should have been properly updated
+show tables;
+select * from t1;
drop table t1;
connection master;
insert into t1 values (1);
-insert into t1 values (2);
connection slave;
-# slave should have stopped because can't find table
+# slave should have stopped because can't find table t1
wait_for_slave_to_stop;
# see if we have a good error message:
--replace_result $MASTER_MYPORT MASTER_MYPORT
@@ -24,4 +32,4 @@ show slave status;
# cleanup
connection master;
-drop table t1;
+drop table t1, t2;
diff --git a/mysql-test/t/rpl_sp_effects.test b/mysql-test/t/rpl_sp_effects.test
index 40c9a5d0b74..e1746682b76 100644
--- a/mysql-test/t/rpl_sp_effects.test
+++ b/mysql-test/t/rpl_sp_effects.test
@@ -106,8 +106,8 @@ delete from t2;
# 4. VIEWs
delete from t1;
insert into t2 values(1),(2);
-create view v1 as select f1(a) from t2;
-select * from v1;
+create view v1 as select f1(a) as f from t2;
+select * from v1 order by f;
SELECT 'master:',a FROM t1 ORDER BY a;
sync_slave_with_master;
diff --git a/mysql-test/t/rpl_truncate_2myisam.test b/mysql-test/t/rpl_truncate_2myisam.test
new file mode 100644
index 00000000000..1a2cb1d0fb3
--- /dev/null
+++ b/mysql-test/t/rpl_truncate_2myisam.test
@@ -0,0 +1,4 @@
+
+let $engine=MyISAM;
+--source extra/rpl_tests/rpl_truncate.test
+
diff --git a/mysql-test/t/rpl_truncate_3innodb.test b/mysql-test/t/rpl_truncate_3innodb.test
new file mode 100644
index 00000000000..7f3145feb1b
--- /dev/null
+++ b/mysql-test/t/rpl_truncate_3innodb.test
@@ -0,0 +1,5 @@
+
+--source include/have_innodb.inc
+
+let $engine=InnoDB;
+--source extra/rpl_tests/rpl_truncate.test
diff --git a/mysql-test/t/rpl_truncate_7ndb.test b/mysql-test/t/rpl_truncate_7ndb.test
new file mode 100644
index 00000000000..2921e7df45a
--- /dev/null
+++ b/mysql-test/t/rpl_truncate_7ndb.test
@@ -0,0 +1,69 @@
+
+--source include/have_ndb.inc
+--source include/master-slave.inc
+--source include/have_binlog_format_mixed_or_row.inc
+
+--disable_query_log
+--disable_warnings
+connection slave;
+STOP SLAVE;
+connection master;
+DROP TABLE IF EXISTS t1;
+RESET MASTER;
+connection slave;
+DROP TABLE IF EXISTS t1;
+RESET SLAVE;
+START SLAVE;
+--enable_warnings
+--enable_query_log
+
+--echo **** On Master ****
+connection master;
+CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1 ORDER BY a,b;
+--echo **** On Slave ****
+# This is silly, but NDB doesn't add to the binlog fast enough
+--real_sleep 10
+sync_slave_with_master;
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1 ORDER BY a,b;
+--echo **** On Master ****
+connection master;
+TRUNCATE TABLE t1;
+SELECT * FROM t1 ORDER BY a,b;
+--echo **** On Slave ****
+sync_slave_with_master;
+# Should be empty
+SELECT * FROM t1 ORDER BY a,b;
+--echo **** On Master ****
+connection master;
+DROP TABLE t1;
+--replace_regex /\/\* xid=[0-9]+ \*\//\/* xid= *\// /table_id: [0-9]+/table_id: #/
+--replace_result $SERVER_VERSION SERVER_VERSION
+SHOW BINLOG EVENTS;
+
+--echo **** On Master ****
+connection master;
+CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1 ORDER BY a,b;
+--echo **** On Slave ****
+sync_slave_with_master;
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1 ORDER BY a,b;
+--echo **** On Master ****
+connection master;
+DELETE FROM t1;
+SELECT * FROM t1 ORDER BY a,b;
+--echo **** On Slave ****
+sync_slave_with_master;
+# Should be empty
+SELECT * FROM t1 ORDER BY a,b;
+--echo **** On Master ****
+connection master;
+DROP TABLE t1;
+--replace_regex /table_id: [0-9]+/table_id: #/
+--replace_result $SERVER_VERSION SERVER_VERSION
+SHOW BINLOG EVENTS;
+
diff --git a/mysql-test/t/rpl_truncate_7ndb_2-master.opt b/mysql-test/t/rpl_truncate_7ndb_2-master.opt
new file mode 100644
index 00000000000..01cf3e0520f
--- /dev/null
+++ b/mysql-test/t/rpl_truncate_7ndb_2-master.opt
@@ -0,0 +1 @@
+--binlog-format=mixed
diff --git a/mysql-test/t/rpl_truncate_7ndb_2.test b/mysql-test/t/rpl_truncate_7ndb_2.test
new file mode 100644
index 00000000000..4ee6c98d463
--- /dev/null
+++ b/mysql-test/t/rpl_truncate_7ndb_2.test
@@ -0,0 +1,6 @@
+# Same test as rpl_truncate_7ndb.test, but with mixed mode
+# This is marked with 'big_test' just because the rpl_truncate_7ndb test is
+# so slow...
+
+--source include/big_test.inc
+--source t/rpl_truncate_7ndb.test
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 8cd15463c62..b75d0dd8bb6 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -2217,15 +2217,6 @@ 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)
#
@@ -2265,6 +2256,21 @@ select * from t1 where f1 in (select f3 from t2 where (f3,f4)= (select f3,f4 fro
drop table t1,t2;
#
+# Bug #4981: 4.x and 5.x produce non-optimal execution path, 3.23 regression test failure
+#
+CREATE TABLE t1(a int, b int, c int, KEY b(b), KEY c(c));
+insert into t1 values (1,0,0),(2,0,0);
+CREATE TABLE t2 (a int, b varchar(2), c varchar(2), PRIMARY KEY(a));
+insert into t2 values (1,'',''), (2,'','');
+CREATE TABLE t3 (a int, b int, PRIMARY KEY (a,b), KEY a (a), KEY b (b));
+insert into t3 values (1,1),(1,2);
+# must have "range checked" for t2
+explain select straight_join DISTINCT t2.a,t2.b, t1.c from t1, t3, t2
+ where (t1.c=t2.a or (t1.c=t3.a and t2.a=t3.b)) and t1.b=556476786 and
+ t2.b like '%%' order by t2.b limit 0,1;
+DROP TABLE t1,t2,t3;
+
+#
# Bug #17873: confusing error message when IGNORE INDEX refers a column name
#
@@ -2279,49 +2285,26 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX (a);
DROP TABLE t1;
-# End of 4.1 tests
-
#
-# Test case for bug 7098: substitution of a constant for a string field
+# Bug #18759 "Incorrect string to numeric conversion"
#
-
-CREATE TABLE t1 ( city char(30) );
-INSERT INTO t1 VALUES ('London');
-INSERT INTO t1 VALUES ('Paris');
-
-SELECT * FROM t1 WHERE city='London';
-SELECT * FROM t1 WHERE city='london';
-EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london';
-SELECT * FROM t1 WHERE city='London' AND city='london';
-EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
-SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
-
-DROP TABLE t1;
-
+# This test is here so that the behavior will not be changed to 4.1
+# and not to 5.0 either. In 4.1 and 5.0 sending an integer as a string
+# will be converted internally to real (double) value and it is not
+# as accurate as bigint (longlong) for integers. Thus the results may
+# vary. In 5.1 internally it is decimal, which is a string type and
+# will be more accurate. Due to rather big changes needed to fix this
+# in 4.1 or 5.0 it is not desired to do it in the stable versions.
#
-# Bug#7425 inconsistent sort order on unsigned columns result of substraction
+# This test is here only to make sure that behavior is not changed in
+# 4.1 and 5.0
#
+CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
+INSERT INTO t1 VALUES (10);
+SELECT i='1e+01',i=1e+01, i in (1e+01,1e+01), i in ('1e+01','1e+01') FROM t1;
+DROP TABLE t1;
-create table t1 (a int(11) unsigned, b int(11) unsigned);
-insert into t1 values (1,0), (1,1), (1,2);
-select a-b from t1 order by 1;
-select a-b , (a-b < 0) from t1 order by 1;
-select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
-select cast((a - b) as unsigned) from t1 order by 1;
-drop table t1;
-
-
-#
-# Bug#8733 server accepts malformed query (multiply mentioned distinct)
-#
-create table t1 (a int(11));
-select all all * from t1;
-select distinct distinct * from t1;
---error 1221
-select all distinct * from t1;
---error 1221
-select distinct all * from t1;
-drop table t1;
+# End of 4.1 tests
#
# Test for bug #6474
@@ -2358,21 +2341,6 @@ SELECT K2C4, K4N4, F2I4 FROM t1
DROP TABLE t1;
#
-# Test case for bug 7520: a wrong cost of the index for a BLOB field
-#
-
-CREATE TABLE t1 ( a BLOB, INDEX (a(20)) );
-CREATE TABLE t2 ( a BLOB, INDEX (a(20)) );
-
-INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five');
-INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');
-
-EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
-EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
-
-DROP TABLE t1, t2;
-
-#
# Bug#8670
#
create table t1 (a int, b int);
@@ -2411,34 +2379,6 @@ drop table t1;
#
-# Bug#8733 server accepts malformed query (multiply mentioned distinct)
-#
-create table t1 (a int(11));
-select all all * from t1;
-select distinct distinct * from t1;
---error 1221
-select all distinct * from t1;
---error 1221
-select distinct all * from t1;
-drop table t1;
-
-
-#
-# Test case for bug 7520: a wrong cost of the index for a BLOB field
-#
-
-CREATE TABLE t1 ( a BLOB, INDEX (a(20)) );
-CREATE TABLE t2 ( a BLOB, INDEX (a(20)) );
-
-INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five');
-INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');
-
-EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
-EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
-
-DROP TABLE t1, t2;
-
-#
# Test for bug #10084: STRAIGHT_JOIN with ON expression
#
@@ -2935,3 +2875,29 @@ EXPLAIN
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
DROP TABLE t1, t2;
+
+#
+# Bug #18895: BIT values cause joins to fail
+#
+create table t1 (
+ a int unsigned not null auto_increment primary key,
+ b bit not null,
+ c bit not null
+);
+
+create table t2 (
+ a int unsigned not null auto_increment primary key,
+ b bit not null,
+ c int unsigned not null,
+ d varchar(50)
+);
+
+insert into t1 (b,c) values (0,1), (0,1);
+insert into t2 (b,c) values (0,1);
+
+-- Row 1 should succeed. Row 2 should fail. Both fail.
+select t1.a, t1.b + 0, t1.c + 0, t2.a, t2.b + 0, t2.c, t2.d
+from t1 left outer join t2 on t1.a = t2.c and t2.b <> 1
+where t1.b <> 1 order by t1.a;
+
+drop table t1,t2;
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index a7b24a5e06c..94894ef50de 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -255,9 +255,9 @@ delete from t2 where b=3;
delete from t3 where a=3;
--replace_column 6 # 7 # 8 # 9 # 10 #
show table status;
-delete from t1;
-delete from t2;
-delete from t3;
+truncate table t1;
+truncate table t2;
+truncate table t3;
--replace_column 6 # 7 # 8 # 9 #
show table status;
insert into t1 values (5);
@@ -445,4 +445,17 @@ delete from mysql.tables_priv where user='mysqltest_4';
flush privileges;
drop database mysqltest;
+#
+# Ensure that show plugin code is tested
+#
+
+--disable_result_log
+show full plugin;
+--enable_result_log
+show warnings;
+--disable_result_log
+show plugin;
+show plugins;
+--enable_result_log
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index c9ce26b6dda..24b0d4674c5 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -508,7 +508,7 @@ end|
insert into t1 values (666, 51.3)|
--error 1054
call bug2272()|
-delete from t1|
+truncate table t1|
drop procedure bug2272|
#
@@ -742,7 +742,7 @@ begin
fetch c into v;
end|
-delete from t1|
+truncate table t1|
--error ER_SP_FETCH_NO_DATA
call bug7299()|
drop procedure bug7299|
@@ -871,7 +871,7 @@ insert into t1 value (2, 2.7), (3, 3.14), (7, 7.0)|
select *,bug8408() from t1|
drop function bug8408|
-delete from t1|
+truncate table t1|
#
diff --git a/mysql-test/t/sp-prelocking.test b/mysql-test/t/sp-prelocking.test
index 6287950d216..b94de6236d3 100644
--- a/mysql-test/t/sp-prelocking.test
+++ b/mysql-test/t/sp-prelocking.test
@@ -271,6 +271,35 @@ deallocate prepare stmt;
drop table t1;
drop view v1, v2, v3;
drop function bug15683;
+
+
#
-# End of 5.0 tests
+# Bug#19634 "Re-execution of multi-delete which involve trigger/stored
+# function crashes server"
#
+--disable_warnings
+drop table if exists t1, t2, t3;
+drop function if exists bug19634;
+--enable_warnings
+create table t1 (id int, data int);
+create table t2 (id int);
+create table t3 (data int);
+create function bug19634() returns int return (select count(*) from t3);
+prepare stmt from "delete t1 from t1, t2 where t1.id = t2.id and bug19634()";
+# This should not crash server
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+create trigger t1_bi before delete on t1 for each row insert into t3 values (old.data);
+prepare stmt from "delete t1 from t1, t2 where t1.id = t2.id";
+
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+drop function bug19634;
+drop table t1, t2, t3;
+
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 885d76ff3f9..201d362f2da 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -143,7 +143,7 @@ begin
end|
call setcontext()|
-select * from t1|
+select * from t1 order by data|
delete from t1|
drop procedure setcontext|
@@ -287,7 +287,7 @@ create procedure inc(inout io int)
set io = io + 1|
call iotest("io1", "io2", 1)|
-select * from t1|
+select * from t1 order by data desc|
delete from t1|
drop procedure iotest|
drop procedure inc2|
@@ -333,7 +333,7 @@ begin
end|
call cbv1()|
-select * from t1|
+select * from t1 order by data|
delete from t1|
drop procedure cbv1|
drop procedure cbv2|
@@ -371,7 +371,7 @@ call sub1("sub1b", (select max(i) from t2))|
call sub1("sub1c", (select i,d from t2 limit 1))|
call sub1("sub1d", (select 1 from (select 1) a))|
call sub2("sub2")|
-select * from t1|
+select * from t1 order by id|
select sub3((select max(i) from t2))|
drop procedure sub1|
drop procedure sub2|
@@ -392,7 +392,7 @@ while x do
end while|
call a0(3)|
-select * from t1|
+select * from t1 order by data desc|
delete from t1|
drop procedure a0|
@@ -408,7 +408,7 @@ while x > 0 do
end while|
call a(3)|
-select * from t1|
+select * from t1 order by data desc|
delete from t1|
drop procedure a|
@@ -424,7 +424,7 @@ repeat
until x = 0 end repeat|
call b(3)|
-select * from t1|
+select * from t1 order by data desc|
delete from t1|
drop procedure b|
@@ -456,7 +456,7 @@ hmm: while x > 0 do
end while hmm|
call c(3)|
-select * from t1|
+select * from t1 order by data desc|
delete from t1|
drop procedure c|
@@ -493,7 +493,7 @@ foo: loop
end loop foo|
call e(3)|
-select * from t1|
+select * from t1 order by data desc|
delete from t1|
drop procedure e|
@@ -514,7 +514,7 @@ end if|
call f(-2)|
call f(0)|
call f(4)|
-select * from t1|
+select * from t1 order by data|
delete from t1|
drop procedure f|
@@ -536,7 +536,7 @@ end case|
call g(-42)|
call g(0)|
call g(1)|
-select * from t1|
+select * from t1 order by data|
delete from t1|
drop procedure g|
@@ -558,7 +558,7 @@ end case|
call h(0)|
call h(1)|
call h(17)|
-select * from t1|
+select * from t1 order by data|
delete from t1|
drop procedure h|
@@ -592,7 +592,7 @@ drop procedure if exists sel1|
--enable_warnings
create procedure sel1()
begin
- select * from t1;
+ select * from t1 order by data;
end|
call sel1()|
@@ -603,8 +603,8 @@ drop procedure if exists sel2|
--enable_warnings
create procedure sel2()
begin
- select * from t1;
- select * from t2;
+ select * from t1 order by data;
+ select * from t2 order by s;
end|
call sel2()|
@@ -624,7 +624,7 @@ begin
end|
call into_test("into", 100)|
-select * from t1|
+select * from t1 order by data|
delete from t1|
drop procedure into_test|
@@ -641,7 +641,7 @@ begin
end|
call into_test2("into", 100)|
-select id,data,@z from t1|
+select id,data,@z from t1 order by data|
delete from t1|
drop procedure into_test2|
@@ -819,9 +819,9 @@ insert into t2 values (append("a", "b"), mul(2,mul(3,4)), fun(1.7, 4, 6))|
# Disable PS because double's give a bit different values
--disable_ps_protocol
select * from t2 where s = append("a", "b")|
-select * from t2 where i = mul(4,3) or i = mul(mul(3,4),2)|
+select * from t2 where i = mul(4,3) or i = mul(mul(3,4),2) order by i|
select * from t2 where d = e()|
-select * from t2|
+select * from t2 order by i|
--enable_ps_protocol
delete from t2|
@@ -976,8 +976,8 @@ drop procedure if exists cur2|
create procedure cur2()
begin
declare done int default 0;
- declare c1 cursor for select id,data from test.t1;
- declare c2 cursor for select i from test.t2;
+ declare c1 cursor for select id,data from test.t1 order by id,data;
+ declare c2 cursor for select i from test.t2 order by i;
declare continue handler for sqlstate '02000' set done = 1;
open c1;
@@ -1003,7 +1003,7 @@ begin
end|
call cur2()|
-select * from t3|
+select * from t3 order by i,s|
delete from t1|
delete from t2|
drop table t3|
@@ -1178,13 +1178,13 @@ create function f1() returns int
return (select sum(data) from t1)|
select f1()|
# This should work too (and give 2 rows as result)
-select id, f1() from t1|
+select id, f1() from t1 order by id|
# Function which uses two instances of table simultaneously
create function f2() returns int
- return (select data from t1 where data <= (select sum(data) from t1) limit 1)|
+ return (select data from t1 where data <= (select sum(data) from t1) order by data limit 1)|
select f2()|
-select id, f2() from t1|
+select id, f2() from t1 order by id|
# Function which uses the same table twice in different queries
create function f3() returns int
@@ -1196,17 +1196,17 @@ begin
return n < m;
end|
select f3()|
-select id, f3() from t1|
+select id, f3() from t1 order by id|
# Calling two functions using same table
select f1(), f3()|
-select id, f1(), f3() from t1|
+select id, f1(), f3() from t1 order by id|
# Function which uses two different tables
create function f4() returns double
return (select d from t1, t2 where t1.data = t2.i and t1.id= "b")|
select f4()|
-select s, f4() from t2|
+select s, f4() from t2 order by s|
# Recursive functions which due to this recursion require simultaneous
# access to several instance of the same table won't work
@@ -1239,7 +1239,7 @@ end|
create function f7() returns int
return (select sum(data) from t1 where data <= f1())|
select f6()|
-select id, f6() from t1|
+select id, f6() from t1 order by id|
#
# Let us test how new locking work with views
@@ -1247,12 +1247,12 @@ select id, f6() from t1|
# The most trivial view
create view v1 (a) as select f1()|
select * from v1|
-select id, a from t1, v1|
+select id, a from t1, v1 order by id|
select * from v1, v1 as v|
# A bit more complex construction
create view v2 (a) as select a*10 from v1|
select * from v2|
-select id, a from t1, v2|
+select id, a from t1, v2 order by id|
select * from v1, v2|
# Nice example where the same view is used on
@@ -1297,7 +1297,7 @@ select *, f0() from v0|
lock tables t1 read, t1 as t11 read|
# These should work well
select f3()|
-select id, f3() from t1 as t11|
+select id, f3() from t1 as t11 order by id|
# Degenerate cases work too :)
select f0()|
select * from v0|
@@ -1407,8 +1407,8 @@ drop function f12_2|
drop view v0|
drop view v1|
drop view v2|
-delete from t1 |
-delete from t2 |
+truncate table t1 |
+truncate table t2 |
drop table t4|
# End of non-bug tests
@@ -1596,7 +1596,7 @@ call fib(3)|
select * from t3 order by f asc|
-delete from t3|
+truncate table t3|
# The original test, 20 levels, ran into memory limits on some machines
# and builds. Try 10 instead...
@@ -1693,7 +1693,6 @@ begin
end if;
return x;
end|
-
select * from t1 where data = getcount("bar")|
select * from t3|
select getcount("zip")|
@@ -2120,7 +2119,7 @@ delete from t1|
call bug822('foo', 42)|
call bug822('foo', 42)|
call bug822('bar', 666)|
-select * from t1|
+select * from t1 order by data|
delete from t1|
drop procedure bug822|
@@ -2148,7 +2147,7 @@ delete from t1 where id='foo'|
insert into t1 values ('bar', 7)|
call bug1495()|
delete from t1 where id='bar'|
-select * from t1|
+select * from t1 order by data|
delete from t1|
drop procedure bug1495|
@@ -2173,7 +2172,7 @@ end|
insert into t1 values ("foo", 12), ("bar", 7)|
call bug1547("foo")|
call bug1547("bar")|
-select * from t1|
+select * from t1 order by id|
delete from t1|
drop procedure bug1547|
@@ -2240,7 +2239,7 @@ end|
insert into t1 (data) values (3), (1), (5), (9), (4)|
call bug1874()|
-select * from t2|
+select * from t2 order by i|
delete from t1|
delete from t2|
drop procedure bug1874|
@@ -5260,7 +5259,7 @@ call bug13012()|
call bug13012()|
drop procedure bug13012|
drop view v1;
-select * from t1|
+select * from t1 order by data|
#
# A test case for Bug#15392 "Server crashes during prepared statement
@@ -5652,7 +5651,7 @@ create procedure bug16474_1()
begin
declare x int;
- select id from t1 order by x;
+ select id from t1 order by x, id;
end|
#
@@ -5672,7 +5671,7 @@ drop procedure bug14945|
# This does NOT order by column index; variable is an expression.
create procedure bug16474_2(x int)
- select id from t1 order by x|
+ select id from t1 order by x, id|
call bug16474_1()|
call bug16474_2(1)|
@@ -5682,7 +5681,7 @@ drop procedure bug16474_2|
# For reference: user variables are expressions too and do not affect ordering.
set @x = 2|
-select * from t1 order by @x|
+select * from t1 order by @x, data|
delete from t1|
@@ -5877,6 +5876,33 @@ DROP FUNCTION bug18037_f1|
DROP PROCEDURE bug18037_p1|
DROP PROCEDURE bug18037_p2|
+#
+# Bug#15217 "Using a SP cursor on a table created with PREPARE fails with
+# weird error". Check that the code that is supposed to work at
+# the first execution of a stored procedure actually works for
+# sp_instr_copen.
+
+--disable_warnings
+drop table if exists t3|
+drop procedure if exists bug15217|
+--enable_warnings
+create table t3 as select 1|
+create procedure bug15217()
+begin
+ declare var1 char(255);
+ declare cur1 cursor for select * from t3;
+ open cur1;
+ fetch cur1 into var1;
+ select concat('data was: /', var1, '/');
+ close cur1;
+end |
+# Returns expected result
+call bug15217()|
+flush tables |
+# Returns error with garbage as column name
+call bug15217()|
+drop table t3|
+drop procedure bug15217|
#
# BUG#NNNN: New bug synopsis
diff --git a/mysql-test/t/sql_mode.test b/mysql-test/t/sql_mode.test
index b4225ef8c4e..8542c2b7927 100644
--- a/mysql-test/t/sql_mode.test
+++ b/mysql-test/t/sql_mode.test
@@ -258,6 +258,9 @@ drop table t1, t2;
select @@sql_mode;
set sql_mode=2097152;
select @@sql_mode;
+# BUG#14675
+set sql_mode=4194304;
+select @@sql_mode;
set sql_mode=16384+(65536*4);
select @@sql_mode;
--error 1231
diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test
index 1a71425d2a7..55f9d95adc5 100644
--- a/mysql-test/t/status.test
+++ b/mysql-test/t/status.test
@@ -48,6 +48,19 @@ connection default;
select 1;
show status like 'last_query_cost';
+create table t1 (a int);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+select * from t1 where a=6;
+show status like 'last_query_cost';
+# Ensure value dosn't change by second status call
+show status like 'last_query_cost';
+select 1;
+show status like 'last_query_cost';
+drop table t1;
#
# Test for Bug #15933 max_used_connections is wrong after FLUSH STATUS
@@ -144,3 +157,24 @@ disconnect con2;
disconnect con1;
# End of 5.0 tests
+
+#
+# Ensure that SHOW STATUS only changes global status variables
+#
+
+connect (con1,localhost,root,,);
+let $rnd_next = `show global status like 'handler_read_rnd_next'`;
+let $tmp_table = `show global status like 'Created_tmp_tables'`;
+show status like 'com_show_status';
+show status like 'hand%write%';
+show status like '%tmp%';
+show status like 'hand%write%';
+show status like '%tmp%';
+show status like 'com_show_status';
+let $rnd_next2 = `show global status like 'handler_read_rnd_next'`;
+let $tmp_table2 = `show global status like 'Created_tmp_tables'`;
+--disable_query_log
+eval select substring_index('$rnd_next2',0x9,-1)-substring_index('$rnd_next',0x9,-1) as rnd_diff, substring_index('$tmp_table2',0x9,-1)-substring_index('$tmp_table',0x9,-1) as tmp_table_diff;
+--enable_query_log
+
+# End of 5.1 tests
diff --git a/mysql-test/t/timezone2.test b/mysql-test/t/timezone2.test
index bfc909d6995..bad1df554d9 100644
--- a/mysql-test/t/timezone2.test
+++ b/mysql-test/t/timezone2.test
@@ -69,7 +69,7 @@ set time_zone='UTC';
select * from t1;
-delete from t1;
+truncate table t1;
# Simple check for 'Europe/Moscow' time zone just for showing that it works
set time_zone='Europe/Moscow';
@@ -79,7 +79,7 @@ insert into t1 (i, ts) values
(unix_timestamp('2004-08-01 00:00:00'),'2003-08-01 00:00:00'),
(unix_timestamp('2004-10-31 02:30:00'),'2004-10-31 02:30:00');
select * from t1;
-delete from t1;
+truncate table t1;
#
@@ -94,7 +94,7 @@ insert into t1 (i, ts) values
(unix_timestamp('2004-08-01 00:00:00'),'2003-08-01 00:00:00'),
(unix_timestamp('2004-10-31 02:30:00'),'2004-10-31 02:30:00');
select * from t1;
-delete from t1;
+truncate table t1;
# Let us test leap jump
insert into t1 (i, ts) values
(unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
@@ -115,14 +115,14 @@ insert into t1 values ('0000-00-00 00:00:00'),('1969-12-31 23:59:59'),
('1970-01-01 00:00:00'),('1970-01-01 00:00:01'),
('2037-12-31 23:59:59'),('2038-01-01 00:00:00');
select * from t1;
-delete from t1;
+truncate table t1;
# MET time zone has range shifted by one hour
set time_zone='MET';
insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 00:30:00'),
('1970-01-01 01:00:00'),('1970-01-01 01:00:01'),
('2038-01-01 00:59:59'),('2038-01-01 01:00:00');
select * from t1;
-delete from t1;
+truncate table t1;
# same for +01:30 time zone
set time_zone='+01:30';
insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 01:00:00'),
diff --git a/mysql-test/t/trigger-grant.test b/mysql-test/t/trigger-grant.test
index 8ca8ffe904b..6dd0c83dc92 100644
--- a/mysql-test/t/trigger-grant.test
+++ b/mysql-test/t/trigger-grant.test
@@ -151,8 +151,8 @@ INSERT INTO t1 VALUES(0);
# Cleanup for further tests.
DROP TRIGGER trg1;
-DELETE FROM t1;
-DELETE FROM t2;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
--disconnect wl2818_definer_con
diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test
index a87f289e94e..58adffc6e87 100644
--- a/mysql-test/t/trigger.test
+++ b/mysql-test/t/trigger.test
@@ -185,24 +185,26 @@ select @log;
set @log:= "";
insert ignore t1 values (1, 2);
select @log;
-# REPLACE: before insert trigger should be called for both records,
-# but then for first one update will be executed (and both update
-# triggers should fire). For second after insert trigger will be
-# called as for usual insert
+# INSERT ... ON DUPLICATE KEY UPDATE ...
set @log:= "";
-replace t1 values (1, 3), (2, 2);
+insert into t1 (id, data) values (1, 3), (2, 2) on duplicate key update data= data + 1;
select @log;
-# Now let us change table in such way that REPLACE on won't be executed
-# using update.
-alter table t1 add ts timestamp default now();
+# REPLACE (also test for bug#13479 "REPLACE activates UPDATE trigger,
+# not the DELETE and INSERT triggers")
+# We define REPLACE as INSERT which DELETEs old rows which conflict with
+# row being inserted. So for the first record in statement below we will
+# call before insert trigger, then delete will be executed (and both delete
+# triggers should fire). Finally after insert trigger will be called.
+# For the second record we will just call both on insert triggers.
set @log:= "";
-# This REPLACE should be executed via DELETE and INSERT so proper
-# triggers should be invoked.
-replace t1 (id, data) values (1, 4);
+replace t1 values (1, 4), (3, 3);
select @log;
-# Finally let us test INSERT ... ON DUPLICATE KEY UPDATE ...
+# Now we will drop ON DELETE triggers to test REPLACE which is internally
+# executed via update
+drop trigger t1_bd;
+drop trigger t1_ad;
set @log:= "";
-insert into t1 (id, data) values (1, 5), (3, 3) on duplicate key update data= data + 2;
+replace t1 values (1, 5);
select @log;
# This also drops associated triggers
@@ -531,14 +533,11 @@ alter table t1 add primary key (i);
--error 1054
insert into t1 values (3, 4) on duplicate key update k= k + 10;
select * from t1;
+# The following statement will delete old row and won't
+# insert new one since after delete trigger will fail.
--error 1054
replace into t1 values (3, 3);
select * from t1;
-# Change table in such way that REPLACE will delete row
-alter table t1 add ts timestamp default now();
---error 1054
-replace into t1 (i, k) values (3, 13);
-select * from t1;
# Also drops all triggers
drop table t1, t2;
@@ -594,11 +593,6 @@ select * from t1;
--error 1054
replace into t1 values (2, 4);
select * from t1;
-# Change table in such way that REPLACE will delete row
-alter table t1 add ts timestamp default now();
---error 1054
-replace into t1 (i, k) values (2, 11);
-select * from t1;
# Also drops all triggers
drop table t1, t2;
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index 4b6741b4242..f8953686c89 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -98,7 +98,7 @@ insert into t1 values
select * from t1;
delete from t1;
insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
-select * from t1;
+select * from t1 order by t;
drop table t1;
#
diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test
index 22f746d0220..404a26324ed 100644
--- a/mysql-test/t/type_newdecimal.test
+++ b/mysql-test/t/type_newdecimal.test
@@ -1105,4 +1105,12 @@ insert into t1 values(123.12);
select * from t1;
alter table t1 modify a decimal(10,2);
select * from t1;
+
+#
+# Bug#19667 group by a decimal expression yields wrong result
+#
+create table t1 (i int, j int);
+insert into t1 values (1,1), (1,2), (2,3), (2,4);
+select i, count(distinct j) from t1 group by i;
+select i+0.0 as i2, count(distinct j) from t1 group by i2;
drop table t1;
diff --git a/mysql-test/t/type_ranges.test b/mysql-test/t/type_ranges.test
index 03ee91f14d8..4a897c1e440 100644
--- a/mysql-test/t/type_ranges.test
+++ b/mysql-test/t/type_ranges.test
@@ -162,7 +162,7 @@ select t1.id as id_A, t2.id as id_B from t1 left join t2 on (t1.id = t2.id);
create table t3 (id_A integer unsigned not null, id_B integer unsigned null );
insert into t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );
select * from t3;
-delete from t3;
+truncate table t3;
insert into t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 on (t1.id = t2.id);
select * from t3;
drop table t3;
diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test
index f96beedbebc..6873569d0e9 100644
--- a/mysql-test/t/type_timestamp.test
+++ b/mysql-test/t/type_timestamp.test
@@ -6,6 +6,9 @@
drop table if exists t1,t2;
--enable_warnings
+# Set timezone to GMT-3, to make it possible to use "interval 3 hour"
+set time_zone="+03:00";
+
CREATE TABLE t1 (a int, t timestamp);
CREATE TABLE t2 (a int, t datetime);
SET TIMESTAMP=1234;
@@ -41,7 +44,7 @@ drop table t1;
create table t1 (ix timestamp);
insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000);
select ix+0 from t1;
-delete from t1;
+truncate table t1;
insert into t1 values ("19991101000000"),("19990102030405"),("19990630232922"),("19990601000000");
select ix+0 from t1;
drop table t1;
@@ -82,10 +85,10 @@ drop table t1;
create table t1 (ix timestamp);
insert into t1 values (0),(20030101010160),(20030101016001),(20030101240101),(20030132010101),(20031301010101),(20031200000000),(20030000000000);
select ix+0 from t1;
-delete from t1;
+truncate table t1;
insert into t1 values ("00000000000000"),("20030101010160"),("20030101016001"),("20030101240101"),("20030132010101"),("20031301010101"),("20031200000000"),("20030000000000");
select ix+0 from t1;
-delete from t1;
+truncate table t1;
insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
select ix+0 from t1;
drop table t1;
@@ -186,7 +189,7 @@ insert into t1 (t1) values (default);
select * from t1;
show create table t1;
show columns from t1;
-delete from t1;
+truncate table t1;
#
# Let us test some cases when auto-set should be disabled or influence
@@ -322,3 +325,6 @@ select * from t1;
drop table t1;
# End of 4.1 tests
+
+# Restore timezone to default
+set time_zone= @@global.time_zone;
diff --git a/mysql-test/t/udf.test b/mysql-test/t/udf.test
index e2556692612..f3be08c8537 100644
--- a/mysql-test/t/udf.test
+++ b/mysql-test/t/udf.test
@@ -99,6 +99,17 @@ delimiter ;//
call XXX2();
drop procedure xxx2;
+#
+# Bug#19904: UDF: not initialized *is_null per row
+#
+
+CREATE TABLE bug19904(n INT, v varchar(10));
+INSERT INTO bug19904 VALUES (1,'one'),(2,'two'),(NULL,NULL),(3,'three'),(4,'four');
+SELECT myfunc_double(n) AS f FROM bug19904;
+SELECT metaphon(v) AS f FROM bug19904;
+DROP TABLE bug19904;
+
+--echo End of 5.0 tests.
#
# Drop the example functions from udf_example
@@ -114,3 +125,4 @@ DROP FUNCTION lookup;
DROP FUNCTION reverse_lookup;
DROP FUNCTION avgcost;
+
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 692f1f509fa..7dfe4ac482f 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -793,3 +793,51 @@ select id from t1 union all select 99 order by 1;
drop table t1;
# End of 4.1 tests
+
+#
+# Bug#18175: Union select over 129 tables with a sum function fails.
+#
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1));
+
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 0db97f6d4af..b432a4c39ca 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -1035,18 +1035,18 @@ create table t2 (a int);
insert into t2 values (2),(3),(0);
# INSERT SELECT with ignore test
insert ignore into v1 SELECT a from t2;
-select * from t1;
+select * from t1 order by a desc;
#simple UPDATE test
update v1 set a=-1 where a=0;
-- error 1369
update v1 set a=2 where a=1;
-select * from t1;
+select * from t1 order by a desc;
# prepare data for next check
update v1 set a=0 where a=0;
insert into t2 values (1);
# multiupdate test
update v1,t2 set v1.a=v1.a-1 where v1.a=t2.a;
-select * from t1;
+select * from t1 order by a desc;
# prepare data for next check
update v1 set a=a+1;
# multiupdate with ignore test
@@ -1226,8 +1226,8 @@ select * from t1;
select * from v1;
delete from t1;
load data infile '../std_data_ln/loaddata3.dat' ignore into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
-select * from t1;
-select * from v1;
+select * from t1 order by a,b;
+select * from v1 order by a,b;
drop view v1;
drop table t1;
# variable length fields
diff --git a/mysql-test/t/view_grant.test b/mysql-test/t/view_grant.test
index aa420689149..801bd13fab7 100644
--- a/mysql-test/t/view_grant.test
+++ b/mysql-test/t/view_grant.test
@@ -813,3 +813,62 @@ SELECT * FROM v;
DROP VIEW v;
DROP TABLE t1;
USE test;
+
+#
+# Bug#20363: Create view on just created view is now denied
+#
+eval CREATE USER mysqltest_db1@localhost identified by 'PWD';
+eval GRANT ALL ON mysqltest_db1.* TO mysqltest_db1@localhost WITH GRANT OPTION;
+
+# The session with the non root user is needed.
+--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
+connect (session1,localhost,mysqltest_db1,PWD,test);
+
+CREATE SCHEMA mysqltest_db1 ;
+USE mysqltest_db1 ;
+
+CREATE TABLE t1 (f1 INTEGER);
+
+CREATE VIEW view1 AS
+SELECT * FROM t1;
+SHOW CREATE VIEW view1;
+
+CREATE VIEW view2 AS
+SELECT * FROM view1;
+--echo # Here comes a suspicious warning
+SHOW CREATE VIEW view2;
+--echo # But the view view2 is usable
+SELECT * FROM view2;
+
+CREATE VIEW view3 AS
+SELECT * FROM view2;
+
+SELECT * from view3;
+
+connection default;
+DROP VIEW mysqltest_db1.view3;
+DROP VIEW mysqltest_db1.view2;
+DROP VIEW mysqltest_db1.view1;
+DROP TABLE mysqltest_db1.t1;
+DROP SCHEMA mysqltest_db1;
+DROP USER mysqltest_db1@localhost;
+#
+# BUG#20482: failure on Create join view with sources views/tables
+# in different schemas
+#
+--disable_warnings
+CREATE DATABASE test1;
+CREATE DATABASE test2;
+--enable_warnings
+
+CREATE TABLE test1.t0 (a VARCHAR(20));
+CREATE TABLE test2.t1 (a VARCHAR(20));
+CREATE VIEW test2.t3 AS SELECT * FROM test1.t0;
+CREATE OR REPLACE VIEW test.v1 AS
+ SELECT ta.a AS col1, tb.a AS col2 FROM test2.t3 ta, test2.t1 tb;
+
+DROP VIEW test.v1;
+DROP VIEW test2.t3;
+DROP TABLE test2.t1, test1.t0;
+DROP DATABASE test2;
+DROP DATABASE test1;
diff --git a/mysql-test/t/wait_for_process.sh b/mysql-test/t/wait_for_process.sh
new file mode 100755
index 00000000000..df0f4a17e3a
--- /dev/null
+++ b/mysql-test/t/wait_for_process.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+###########################################################################
+
+pid_path="$1"
+total_attempts="$2"
+event="$3"
+
+case "$3" in
+ started)
+ check_fn='check_started';
+ ;;
+
+ stopped)
+ check_fn='check_stopped';
+ ;;
+
+ *)
+ echo "Error: invalid third argument ('started' or 'stopped' expected)."
+ exit 0
+esac
+
+###########################################################################
+
+check_started()
+{
+ [ ! -r "$pid_path" ] && return 1
+
+ new_pid=`cat "$pid_path" 2>/dev/null`
+
+ [ $? -eq 0 -a "$original_pid" = "$new_pid" ] && return 1
+
+ return 0
+}
+
+###########################################################################
+
+check_stopped()
+{
+ [ -r "$pid_path" ] && return 1
+
+ return 0
+}
+
+###########################################################################
+
+cur_attempt=1
+
+while true; do
+
+ if ( eval $check_fn ); then
+ echo "Success: the process has been $event."
+ exit 0
+ fi
+
+ [ $cur_attempt -ge $total_attempts ] && break
+
+ sleep 1
+
+ cur_attempt=`expr $cur_attempt + 1`
+
+done
+
+echo "Error: the process has not been $event in $total_attempts secs."
+exit 0
+
diff --git a/mysql-test/t/wait_timeout.test b/mysql-test/t/wait_timeout.test
index b17e5314d36..fef77f7cdc7 100644
--- a/mysql-test/t/wait_timeout.test
+++ b/mysql-test/t/wait_timeout.test
@@ -11,6 +11,7 @@
connect (wait_con,localhost,root,,test,,);
flush status; # Reset counters
connection wait_con;
+set session wait_timeout=100;
let $retries=300;
let $aborted_clients = `SHOW STATUS LIKE 'aborted_clients'`;
set @aborted_clients= 0;
diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test
index 65d0a40291f..c20c4cbccc1 100644
--- a/mysql-test/t/xml.test
+++ b/mysql-test/t/xml.test
@@ -53,7 +53,7 @@ SELECT extractValue(@xml,'/a//@x');
SELECT extractValue(@xml,'/a//@x[1]');
SELECT extractValue(@xml,'/a//@x[2]');
-SET @xml='<a><b>b1</b><b>b2</b><c><b>c1b1</b><b>c1b2</b></c><c><b>c2b1</c></b>/a>';
+SET @xml='<a><b>b1</b><b>b2</b><c><b>c1b1</b><b>c1b2</b></c><c><b>c2b1</c></b></a>';
SELECT extractValue(@xml,'//b[1]');
SELECT extractValue(@xml,'/descendant::b[1]');
@@ -299,6 +299,17 @@ select extractvalue('<a>Jack</a>' collate latin1_bin,'/a[contains(../a,"j")]');
select ExtractValue('<tag1><![CDATA[test]]></tag1>','/tag1');
#
+# Bug#18201: XML: ExtractValue works even if the xml fragment
+# is not well-formed xml
+#
+select extractValue('<a>a','/a');
+select extractValue('<a>a<','/a');
+select extractValue('<a>a</','/a');
+select extractValue('<a>a</a','/a');
+select extractValue('<a>a</a></b>','/a');
+select extractValue('<a b=>a</a>','/a');
+
+#
# Bug #18171 XML: ExtractValue: the XPath position()
# function crashes the server!
#
diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp
index 9061a71364d..6dd11df5de6 100644
--- a/mysql-test/valgrind.supp
+++ b/mysql-test/valgrind.supp
@@ -249,6 +249,18 @@
}
#
+# Warning from my_thread_init becasue mysqld dies before kill thread exists
+#
+
+{
+ my_thread_init kill thread memory loss second
+ Memcheck:Leak
+ fun:calloc
+ fun:my_thread_init
+ fun:kill_server_thread
+}
+
+#
# Leaks reported in _dl_* internal functions on Linux amd64 / glibc2.3.2.
#
@@ -408,6 +420,19 @@
}
#
+# BUG#19940: NDB sends uninitialized parts of field buffers across the wire.
+# This is "works as designed"; the uninitialized part is not used at the
+# other end (but Valgrind cannot see this).
+#
+{
+ bug19940
+ Memcheck:Param
+ socketcall.sendto(msg)
+ fun:send
+ fun:_ZN15TCP_Transporter6doSendEv
+ fun:_ZN19TransporterRegistry11performSendEv
+ fun:_ZN19TransporterRegistry14forceSendCheckEi
+}
# Warning when printing stack trace (to suppress some not needed warnings)
#
@@ -433,3 +458,13 @@
fun:ListAdd
fun:_db_set_
}
+
+{
+ dbug initialization by kill_server
+ Memcheck:Leak
+ fun:malloc
+ fun:DbugMalloc
+ fun:code_state
+ fun:_db_enter_
+ fun:kill_server
+}