summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/bigint.test16
-rw-r--r--mysql-test/t/binary.test38
-rw-r--r--mysql-test/t/binlog_innodb.test133
-rw-r--r--mysql-test/t/binlog_multi_engine.test85
-rw-r--r--mysql-test/t/binlog_row_blackhole.test11
-rw-r--r--mysql-test/t/binlog_row_mix_innodb_myisam.test1
-rw-r--r--mysql-test/t/binlog_unsafe.test18
-rw-r--r--mysql-test/t/check.test3
-rw-r--r--mysql-test/t/create.test333
-rw-r--r--mysql-test/t/ctype_big5.test18
-rw-r--r--mysql-test/t/ctype_collate.test11
-rw-r--r--mysql-test/t/ctype_ldml-master.opt2
-rw-r--r--mysql-test/t/ctype_ldml.test63
-rw-r--r--mysql-test/t/ctype_ujis_ucs2.test1306
-rw-r--r--mysql-test/t/ctype_utf8.test25
-rw-r--r--mysql-test/t/ddl_i18n_koi8r.test1112
-rw-r--r--mysql-test/t/ddl_i18n_utf8.test1112
-rw-r--r--mysql-test/t/disabled.def5
-rw-r--r--mysql-test/t/errors.test13
-rw-r--r--mysql-test/t/events.test25
-rw-r--r--mysql-test/t/events_bugs.test64
-rw-r--r--mysql-test/t/flush.test26
-rw-r--r--mysql-test/t/func_misc.test2
-rw-r--r--mysql-test/t/func_str.test48
-rw-r--r--mysql-test/t/group_min_max.test22
-rw-r--r--mysql-test/t/information_schema.test2
-rw-r--r--mysql-test/t/innodb.test75
-rw-r--r--mysql-test/t/insert_select.test25
-rw-r--r--mysql-test/t/kill.test4
-rw-r--r--mysql-test/t/loaddata_autocom_ndb.test1
-rw-r--r--mysql-test/t/metadata.test21
-rw-r--r--mysql-test/t/multi_update.test48
-rw-r--r--mysql-test/t/mysqlbinlog.test17
-rw-r--r--mysql-test/t/mysqltest.test4
-rw-r--r--mysql-test/t/ndb_alter_table.test1
-rw-r--r--mysql-test/t/ndb_alter_table2.test1
-rw-r--r--mysql-test/t/ndb_alter_table3.test1
-rw-r--r--mysql-test/t/ndb_autodiscover.test1
-rw-r--r--mysql-test/t/ndb_autodiscover2.test1
-rw-r--r--mysql-test/t/ndb_autodiscover3.test1
-rw-r--r--mysql-test/t/ndb_backup_print.test2
-rw-r--r--mysql-test/t/ndb_basic.test1
-rw-r--r--mysql-test/t/ndb_binlog_basic2.test15
-rw-r--r--mysql-test/t/ndb_binlog_log_bin.test1
-rw-r--r--mysql-test/t/ndb_binlog_multi.test1
-rw-r--r--mysql-test/t/ndb_bitfield.test1
-rw-r--r--mysql-test/t/ndb_blob.test1
-rw-r--r--mysql-test/t/ndb_blob_partition.test1
-rw-r--r--mysql-test/t/ndb_cache.test1
-rw-r--r--mysql-test/t/ndb_cache2.test1
-rw-r--r--mysql-test/t/ndb_cache_multi.test1
-rw-r--r--mysql-test/t/ndb_cache_multi2.test1
-rw-r--r--mysql-test/t/ndb_charset.test1
-rw-r--r--mysql-test/t/ndb_condition_pushdown.test1
-rw-r--r--mysql-test/t/ndb_config.test1
-rw-r--r--mysql-test/t/ndb_config2.test1
-rw-r--r--mysql-test/t/ndb_cursor.test1
-rw-r--r--mysql-test/t/ndb_database.test1
-rw-r--r--mysql-test/t/ndb_dd_alter.test1
-rw-r--r--mysql-test/t/ndb_dd_backuprestore.test1
-rw-r--r--mysql-test/t/ndb_dd_basic.test1
-rw-r--r--mysql-test/t/ndb_dd_ddl.test1
-rw-r--r--mysql-test/t/ndb_dd_disk2memory.test1
-rw-r--r--mysql-test/t/ndb_dd_dump.test1
-rw-r--r--mysql-test/t/ndb_dd_sql_features.test1
-rw-r--r--mysql-test/t/ndb_gis.test1
-rw-r--r--mysql-test/t/ndb_index.test1
-rw-r--r--mysql-test/t/ndb_index_ordered.test1
-rw-r--r--mysql-test/t/ndb_index_unique.test1
-rw-r--r--mysql-test/t/ndb_insert.test1
-rw-r--r--mysql-test/t/ndb_limit.test1
-rw-r--r--mysql-test/t/ndb_loaddatalocal.test1
-rw-r--r--mysql-test/t/ndb_lock.test1
-rw-r--r--mysql-test/t/ndb_minmax.test1
-rw-r--r--mysql-test/t/ndb_multi.test1
-rw-r--r--mysql-test/t/ndb_partition_error.test1
-rw-r--r--mysql-test/t/ndb_partition_key.test1
-rw-r--r--mysql-test/t/ndb_partition_list.test1
-rw-r--r--mysql-test/t/ndb_partition_range.test1
-rw-r--r--mysql-test/t/ndb_read_multi_range.test1
-rw-r--r--mysql-test/t/ndb_rename.test1
-rw-r--r--mysql-test/t/ndb_replace.test1
-rw-r--r--mysql-test/t/ndb_restore.test1
-rw-r--r--mysql-test/t/ndb_restore_partition.test1
-rw-r--r--mysql-test/t/ndb_restore_print.test1
-rw-r--r--mysql-test/t/ndb_row_format.test1
-rw-r--r--mysql-test/t/ndb_single_user.test1
-rw-r--r--mysql-test/t/ndb_sp.test1
-rw-r--r--mysql-test/t/ndb_subquery.test1
-rw-r--r--mysql-test/t/ndb_temporary.test1
-rw-r--r--mysql-test/t/ndb_transaction.test1
-rw-r--r--mysql-test/t/ndb_trigger.test1
-rw-r--r--mysql-test/t/ndb_truncate.test1
-rw-r--r--mysql-test/t/ndb_types.test1
-rw-r--r--mysql-test/t/ndb_update.test1
-rw-r--r--mysql-test/t/ndb_view.test1
-rw-r--r--mysql-test/t/ndbapi.test1
-rw-r--r--mysql-test/t/partition.test15
-rw-r--r--mysql-test/t/partition_hash.test1
-rw-r--r--mysql-test/t/ps_1general.test4
-rw-r--r--mysql-test/t/ps_7ndb.test1
-rw-r--r--mysql-test/t/query_cache.test34
-rw-r--r--mysql-test/t/rpl_000015.test16
-rw-r--r--mysql-test/t/rpl_change_master.test12
-rw-r--r--mysql-test/t/rpl_commit_after_flush.test1
-rw-r--r--mysql-test/t/rpl_delete_no_where.test1
-rw-r--r--mysql-test/t/rpl_empty_master_crash.test3
-rw-r--r--mysql-test/t/rpl_flushlog_loop.test5
-rw-r--r--mysql-test/t/rpl_grant.test42
-rw-r--r--mysql-test/t/rpl_innodb.test67
-rw-r--r--mysql-test/t/rpl_insert_ignore.test1
-rw-r--r--mysql-test/t/rpl_invoked_features-master.opt1
-rw-r--r--mysql-test/t/rpl_invoked_features-slave.opt1
-rw-r--r--mysql-test/t/rpl_invoked_features.test282
-rw-r--r--mysql-test/t/rpl_loaddata_fatal-slave.opt1
-rw-r--r--mysql-test/t/rpl_loaddata_fatal.test29
-rw-r--r--mysql-test/t/rpl_log_pos.test34
-rw-r--r--mysql-test/t/rpl_multi_update2.test1
-rw-r--r--mysql-test/t/rpl_multi_update3.test1
-rw-r--r--mysql-test/t/rpl_ndb_2innodb.test2
-rw-r--r--mysql-test/t/rpl_ndb_2myisam.test2
-rw-r--r--mysql-test/t/rpl_ndb_UUID.test2
-rw-r--r--mysql-test/t/rpl_ndb_auto_inc.test2
-rw-r--r--mysql-test/t/rpl_ndb_bank.test4
-rw-r--r--mysql-test/t/rpl_ndb_basic.test4
-rw-r--r--mysql-test/t/rpl_ndb_blob.test2
-rw-r--r--mysql-test/t/rpl_ndb_blob2.test2
-rw-r--r--mysql-test/t/rpl_ndb_charset.test2
-rw-r--r--mysql-test/t/rpl_ndb_circular.test2
-rw-r--r--mysql-test/t/rpl_ndb_circular_simplex.test2
-rw-r--r--mysql-test/t/rpl_ndb_commit_afterflush.test2
-rw-r--r--mysql-test/t/rpl_ndb_dd_advance.test2
-rw-r--r--mysql-test/t/rpl_ndb_dd_basic.test2
-rw-r--r--mysql-test/t/rpl_ndb_dd_partitions.test2
-rw-r--r--mysql-test/t/rpl_ndb_ddl.test4
-rw-r--r--mysql-test/t/rpl_ndb_delete_nowhere.test1
-rw-r--r--mysql-test/t/rpl_ndb_do_db.test2
-rw-r--r--mysql-test/t/rpl_ndb_do_table.test2
-rw-r--r--mysql-test/t/rpl_ndb_extraCol.test4
-rw-r--r--mysql-test/t/rpl_ndb_func003.test2
-rw-r--r--mysql-test/t/rpl_ndb_idempotent.test8
-rw-r--r--mysql-test/t/rpl_ndb_innodb2ndb.test6
-rw-r--r--mysql-test/t/rpl_ndb_innodb_trans.test3
-rw-r--r--mysql-test/t/rpl_ndb_insert_ignore.test1
-rw-r--r--mysql-test/t/rpl_ndb_load.test2
-rw-r--r--mysql-test/t/rpl_ndb_log.test1
-rw-r--r--mysql-test/t/rpl_ndb_multi.test3
-rw-r--r--mysql-test/t/rpl_ndb_multi_update2.test1
-rw-r--r--mysql-test/t/rpl_ndb_multi_update3.test1
-rw-r--r--mysql-test/t/rpl_ndb_myisam2ndb.test5
-rw-r--r--mysql-test/t/rpl_ndb_relayrotate.test1
-rw-r--r--mysql-test/t/rpl_ndb_rep_ignore.test2
-rw-r--r--mysql-test/t/rpl_ndb_row_001.test2
-rw-r--r--mysql-test/t/rpl_ndb_sp003.test2
-rw-r--r--mysql-test/t/rpl_ndb_sp006.test2
-rw-r--r--mysql-test/t/rpl_ndb_stm_innodb.test10
-rw-r--r--mysql-test/t/rpl_ndb_sync.test6
-rw-r--r--mysql-test/t/rpl_ndb_trig004.test2
-rw-r--r--mysql-test/t/rpl_ndbapi_multi.test2
-rw-r--r--mysql-test/t/rpl_partition.test160
-rw-r--r--mysql-test/t/rpl_rbr_to_sbr.test2
-rw-r--r--mysql-test/t/rpl_redirect.test4
-rw-r--r--mysql-test/t/rpl_relayrotate.test1
-rw-r--r--mysql-test/t/rpl_replicate_do.test4
-rw-r--r--mysql-test/t/rpl_rotate_logs.test12
-rw-r--r--mysql-test/t/rpl_row_001.test2
-rw-r--r--mysql-test/t/rpl_row_UUID.test2
-rw-r--r--mysql-test/t/rpl_row_basic_11bugs.test39
-rw-r--r--mysql-test/t/rpl_row_basic_2myisam.test3
-rw-r--r--mysql-test/t/rpl_row_basic_3innodb.test2
-rw-r--r--mysql-test/t/rpl_row_basic_7ndb.test3
-rw-r--r--mysql-test/t/rpl_row_blob_innodb.test2
-rw-r--r--mysql-test/t/rpl_row_blob_myisam.test2
-rw-r--r--mysql-test/t/rpl_row_charset.test2
-rw-r--r--mysql-test/t/rpl_row_func003.test2
-rw-r--r--mysql-test/t/rpl_row_inexist_tbl.test6
-rw-r--r--mysql-test/t/rpl_row_log.test1
-rw-r--r--mysql-test/t/rpl_row_log_innodb.test1
-rw-r--r--mysql-test/t/rpl_row_sp003.test2
-rw-r--r--mysql-test/t/rpl_row_sp006_InnoDB.test2
-rw-r--r--mysql-test/t/rpl_row_until.test29
-rw-r--r--mysql-test/t/rpl_server_id1.test4
-rw-r--r--mysql-test/t/rpl_server_id2.test4
-rw-r--r--mysql-test/t/rpl_skip_error.test22
-rw-r--r--mysql-test/t/rpl_slave_skip.test71
-rw-r--r--mysql-test/t/rpl_slave_status.test2
-rw-r--r--mysql-test/t/rpl_ssl.test6
-rw-r--r--mysql-test/t/rpl_ssl1.test6
-rw-r--r--mysql-test/t/rpl_stm_log.test1
-rw-r--r--mysql-test/t/rpl_stm_until.test29
-rw-r--r--mysql-test/t/rpl_truncate_7ndb.test2
-rw-r--r--mysql-test/t/show_check.test298
-rw-r--r--mysql-test/t/sp-destruct.test15
-rw-r--r--mysql-test/t/sp-dynamic.test12
-rw-r--r--mysql-test/t/sp-error.test10
-rw-r--r--mysql-test/t/sp.test2
-rw-r--r--mysql-test/t/strict_autoinc_5ndb.test1
-rw-r--r--mysql-test/t/subselect.test42
-rw-r--r--mysql-test/t/type_enum.test37
-rw-r--r--mysql-test/t/udf.test24
-rw-r--r--mysql-test/t/view.test34
201 files changed, 6081 insertions, 253 deletions
diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test
index 52f34e58e97..9b4fc3f39b0 100644
--- a/mysql-test/t/bigint.test
+++ b/mysql-test/t/bigint.test
@@ -295,6 +295,22 @@ drop table t1;
select cast(19999999999999999999 as signed);
select cast(-19999999999999999999 as signed);
+#
+# Bug #28625: -9223372036854775808 doesn't fit in BIGINT.
+#
+
+# PS protocol gives different metadata for `Max length' column
+--disable_ps_protocol
+--enable_metadata
+select -9223372036854775808;
+select -(9223372036854775808);
+select -((9223372036854775808));
+select -(-(9223372036854775808));
+--disable_metadata
+--endble_ps_protocol
+select --9223372036854775808, ---9223372036854775808, ----9223372036854775808;
+select -(-9223372036854775808), -(-(-9223372036854775808));
+
# Bug #28005 Partitions: can't use -9223372036854775808
create table t1 select -9223372036854775808 bi;
describe t1;
diff --git a/mysql-test/t/binary.test b/mysql-test/t/binary.test
index 4ab6ee9eaf1..1cc6ae07675 100644
--- a/mysql-test/t/binary.test
+++ b/mysql-test/t/binary.test
@@ -101,3 +101,41 @@ select hex(col1) from t1;
insert into t1 values ('b'),('b ');
select hex(col1) from t1;
drop table t1;
+
+#
+# Bug #29087: assertion abort for a search in a BINARY non-nullable index
+# by a key with trailing spaces
+#
+
+CREATE TABLE t1 (
+ a binary(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
+ index idx(a)
+);
+INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029087575');
+INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020');
+INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029080707');
+
+SELECT hex(a) FROM t1 order by a;
+EXPLAIN SELECT hex(a) FROM t1 order by a;
+
+SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020');
+EXPLAIN
+SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020');
+
+SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF02908');
+
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ id numeric(20) NOT NULL,
+ lang varchar(8) NOT NULL,
+ msg varchar(32) NOT NULL,
+ PRIMARY KEY (id,lang)
+);
+INSERT INTO t1 VALUES (33, 'en', 'zzzzzzz');
+INSERT INTO t1 VALUES (31, 'en', 'xxxxxxx');
+INSERT INTO t1 VALUES (32, 'en', 'yyyyyyy');
+SELECT * FROM t1 WHERE id=32;
+
+DROP TABLE t1;
+
diff --git a/mysql-test/t/binlog_innodb.test b/mysql-test/t/binlog_innodb.test
new file mode 100644
index 00000000000..3bad61db23a
--- /dev/null
+++ b/mysql-test/t/binlog_innodb.test
@@ -0,0 +1,133 @@
+source include/have_innodb.inc;
+source include/have_log_bin.inc;
+
+SET BINLOG_FORMAT=MIXED;
+
+RESET MASTER;
+
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6);
+
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+# Should be logged as statement
+UPDATE t1 SET b = 2*a WHERE a > 1;
+COMMIT;
+
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+# Should be logged as rows
+UPDATE t1 SET b = a * a WHERE a > 3;
+COMMIT;
+
+# Check that errors are generated when trying to use READ COMMITTED
+# transaction isolation level in STATEMENT binlog mode.
+
+SET BINLOG_FORMAT=STATEMENT;
+
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+error ER_BINLOG_LOGGING_IMPOSSIBLE;
+UPDATE t1 SET b = 1*a WHERE a > 1;
+COMMIT;
+
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+error ER_BINLOG_LOGGING_IMPOSSIBLE;
+UPDATE t1 SET b = 2*a WHERE a > 2;
+COMMIT;
+
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+UPDATE t1 SET b = 3*a WHERE a > 3;
+COMMIT;
+
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+UPDATE t1 SET b = 4*a WHERE a > 4;
+COMMIT;
+
+SET BINLOG_FORMAT=MIXED;
+
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+UPDATE t1 SET b = 1*a WHERE a > 1;
+COMMIT;
+
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+UPDATE t1 SET b = 2*a WHERE a > 2;
+COMMIT;
+
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+UPDATE t1 SET b = 3*a WHERE a > 3;
+COMMIT;
+
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+UPDATE t1 SET b = 4*a WHERE a > 4;
+COMMIT;
+
+SET BINLOG_FORMAT=ROW;
+
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+UPDATE t1 SET b = 1*a WHERE a > 1;
+COMMIT;
+
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+UPDATE t1 SET b = 2*a WHERE a > 2;
+COMMIT;
+
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+UPDATE t1 SET b = 3*a WHERE a > 3;
+COMMIT;
+
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+UPDATE t1 SET b = 4*a WHERE a > 4;
+COMMIT;
+
+source include/show_binlog_events.inc;
+
+DROP TABLE t1;
+
+
+#
+# Let us test binlog_cache_use and binlog_cache_disk_use status vars.
+# Actually this test has nothing to do with innodb per se, it just requires
+# transactional table.
+#
+show status like "binlog_cache_use";
+show status like "binlog_cache_disk_use";
+
+create table t1 (a int) engine=innodb;
+
+# Now we are going to create transaction which is long enough so its
+# transaction binlog will be flushed to disk...
+let $1=2000;
+disable_query_log;
+begin;
+while ($1)
+{
+ eval insert into t1 values( $1 );
+ dec $1;
+}
+commit;
+enable_query_log;
+show status like "binlog_cache_use";
+show status like "binlog_cache_disk_use";
+
+# Transaction which should not be flushed to disk and so should not
+# increase binlog_cache_disk_use.
+begin;
+delete from t1;
+commit;
+show status like "binlog_cache_use";
+show status like "binlog_cache_disk_use";
+drop table t1;
+
+--echo End of tests
diff --git a/mysql-test/t/binlog_multi_engine.test b/mysql-test/t/binlog_multi_engine.test
new file mode 100644
index 00000000000..6614b9e5d44
--- /dev/null
+++ b/mysql-test/t/binlog_multi_engine.test
@@ -0,0 +1,85 @@
+source include/have_blackhole.inc;
+source include/have_ndb.inc;
+source include/have_binlog_format_mixed_or_row.inc;
+
+CREATE TABLE t1m (m INT, n INT) ENGINE=MYISAM;
+CREATE TABLE t1b (b INT, c INT) ENGINE=BLACKHOLE;
+CREATE TABLE t1n (e INT, f INT) ENGINE=NDB;
+
+RESET MASTER;
+
+SET SESSION BINLOG_FORMAT=STATEMENT;
+
+INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
+INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
+
+UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
+
+# I cannot use these statements since the rows logged to the NDB table
+# eventually shows up in the binary log. I use them anyway, since once
+# BUG#29222 is fixed, there will be a difference here.
+echo *** Please look in binlog_multi_engine.test if you have a diff here ****;
+START TRANSACTION;
+INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
+UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
+UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
+COMMIT;
+
+TRUNCATE t1m;
+TRUNCATE t1b;
+TRUNCATE t1n;
+
+source include/show_binlog_events.inc;
+
+RESET MASTER;
+
+SET SESSION BINLOG_FORMAT=MIXED;
+
+INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
+INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
+INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
+
+UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
+
+# Not possible to test this since NDB writes its own binlog, which
+# might cause it to be out of sync with the results from MyISAM.
+# This will generate an error once BUG#28722 is fixed.
+
+#UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
+
+error ER_BINLOG_LOGGING_IMPOSSIBLE;
+UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
+
+TRUNCATE t1m;
+TRUNCATE t1b;
+TRUNCATE t1n;
+
+source include/show_binlog_events.inc;
+
+RESET MASTER;
+
+SET SESSION BINLOG_FORMAT=ROW;
+
+INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
+error ER_BINLOG_LOGGING_IMPOSSIBLE;
+INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
+INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
+
+error ER_BINLOG_LOGGING_IMPOSSIBLE;
+UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
+
+# Not possible to test this since NDB writes its own binlog, which
+# might cause it to be out of sync with the results from MyISAM.
+# This will generate an error once BUG#28722 is fixed.
+
+#UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
+
+error ER_BINLOG_LOGGING_IMPOSSIBLE;
+UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
+
+source include/show_binlog_events.inc;
+
+RESET MASTER;
+
+DROP TABLE t1m, t1b, t1n;
+
diff --git a/mysql-test/t/binlog_row_blackhole.test b/mysql-test/t/binlog_row_blackhole.test
deleted file mode 100644
index d5355ad1ff0..00000000000
--- a/mysql-test/t/binlog_row_blackhole.test
+++ /dev/null
@@ -1,11 +0,0 @@
-# This is a wrapper for binlog.test so that the same test case can be used
-# For both statement and row based bin logs 9/19/2005 [jbm]
-
--- source include/have_binlog_format_row.inc
-
-# Bug#18326: Do not lock table for writing during prepare of statement
-# The use of the ps protocol causes extra table maps in the binlog, so
-# we disable the ps-protocol for this statement.
---disable_ps_protocol
--- source extra/binlog_tests/blackhole.test
---enable_ps_protocol
diff --git a/mysql-test/t/binlog_row_mix_innodb_myisam.test b/mysql-test/t/binlog_row_mix_innodb_myisam.test
index 335a05be146..346866b01a6 100644
--- a/mysql-test/t/binlog_row_mix_innodb_myisam.test
+++ b/mysql-test/t/binlog_row_mix_innodb_myisam.test
@@ -25,6 +25,7 @@ flush logs;
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
is not null;
+
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval select
@a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%",
diff --git a/mysql-test/t/binlog_unsafe.test b/mysql-test/t/binlog_unsafe.test
new file mode 100644
index 00000000000..f34c22dc5f7
--- /dev/null
+++ b/mysql-test/t/binlog_unsafe.test
@@ -0,0 +1,18 @@
+# Test to check that a warning is generated for unsafe statements
+# executed under statement mode logging.
+
+source include/have_log_bin.inc;
+
+SET BINLOG_FORMAT=STATEMENT;
+
+CREATE TABLE t1 (a CHAR(40));
+CREATE TABLE t2 (a INT AUTO_INCREMENT PRIMARY KEY);
+CREATE TABLE t3 (b INT AUTO_INCREMENT PRIMARY KEY);
+CREATE VIEW v1(a,b) AS SELECT a,b FROM t2,t3;
+
+INSERT INTO t1 SELECT UUID();
+query_vertical SHOW WARNINGS;
+
+DROP TABLE t1,t2,t3;
+
+
diff --git a/mysql-test/t/check.test b/mysql-test/t/check.test
index 8d9d70bd29a..eb72d75da3c 100644
--- a/mysql-test/t/check.test
+++ b/mysql-test/t/check.test
@@ -2,7 +2,8 @@ connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
--disable_warnings
-drop table if exists t1;
+drop table if exists t1,t2;
+drop view if exists v1;
--enable_warnings
# Add a lot of keys to slow down check
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 149982e23c5..dd3037ce88d 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -790,6 +790,339 @@ drop table t1, t2;
create table t1 (upgrade int);
drop table t1;
+
+#
+# Bug #26642: create index corrupts table definition in .frm
+#
+# Problem with creating keys with maximum key-parts and maximum name length
+# This test is made for a mysql server supporting names up to 64 bytes
+# and a maximum of 16 key segements per Key
+#
+
+create table t1 (
+ c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, c8 int,
+ c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int,
+
+ key a001_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a002_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a003_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a004_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a005_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a006_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a007_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a008_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a009_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ key a010_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a011_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a012_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a013_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a014_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a015_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a016_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a017_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a018_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a019_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ key a020_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a021_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a022_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a023_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a024_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a025_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a026_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a027_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a028_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a029_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ key a030_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a031_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a032_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a033_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a034_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a035_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a036_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a037_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a038_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a039_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ key a040_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a041_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a042_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a043_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a044_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a045_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a046_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a047_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a048_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a049_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ key a050_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a051_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a052_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a053_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a054_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a055_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a056_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a057_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a058_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a059_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ key a060_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a061_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a062_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a063_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a064_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16)
+);
+
+# Check that the table is not corrupted
+show create table t1;
+flush tables;
+show create table t1;
+
+# Repeat test using ALTER to add indexes
+
+drop table t1;
+create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int,
+c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int);
+
+alter table t1
+
+ add key a001_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a002_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a003_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a004_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a005_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a006_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a007_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a008_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a009_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ add key a010_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a011_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a012_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a013_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a014_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a015_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a016_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a017_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a018_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a019_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ add key a020_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a021_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a022_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a023_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a024_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a025_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a026_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a027_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a028_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a029_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ add key a030_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a031_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a032_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a033_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a034_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a035_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a036_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a037_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a038_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a039_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ add key a040_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a041_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a042_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a043_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a044_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a045_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a046_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a047_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a048_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a049_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ add key a050_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a051_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a052_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a053_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a054_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a055_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a056_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a057_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a058_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a059_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ add key a060_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a061_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a062_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a063_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a064_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16);
+
+show create table t1;
+flush tables;
+show create table t1;
+
+# Test the server limits; if any of these pass, all above tests need
+# to be rewritten to hit the limit
+#
+# Ensure limit is really 64 keys
+--error 1069
+alter table t1 add key
+ a065_long_123456789_123456789_123456789_123456789_123456789_1234 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16);
+
+drop table t1;
+
+# Ensure limit is really 16 key parts per key
+
+create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int,
+c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int,
+c16 int, c17 int);
+
+# Get error for max key parts
+--error 1070
+alter table t1 add key i1 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16, c17);
+
+# Get error for max key-name length
+--error 1059
+alter table t1 add key
+ a001_long_123456789_123456789_123456789_123456789_123456789_12345 (c1);
+
+show create table t1;
+
+drop table t1;
+
+
--echo End of 5.0 tests
#
diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test
index 200002cd235..8e17a27c550 100644
--- a/mysql-test/t/ctype_big5.test
+++ b/mysql-test/t/ctype_big5.test
@@ -63,4 +63,20 @@ drop table t1;
#
select hex(convert(_big5 0xC84041 using ucs2));
-# End of 4.1 tests
+--echo End of 4.1 tests
+
+#
+# Bug#26711 "binary content 0x00 sometimes becomes 0x5C 0x00 after dump/load"
+#
+create table t1 (a blob);
+insert into t1 values (0xEE00);
+--exec $MYSQL_DUMP --default-character-set=big5 -T $MYSQLTEST_VARDIR/master-data/test test t1
+delete from t1;
+select hex(load_file('test/t1.txt'));
+load data infile 't1.txt' into table t1;
+select hex(a) from t1;
+--exec rm $MYSQLTEST_VARDIR/master-data/test/t1.txt
+--exec rm $MYSQLTEST_VARDIR/master-data/test/t1.sql
+drop table t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/ctype_collate.test b/mysql-test/t/ctype_collate.test
index aca240b46bc..4bbae42559a 100644
--- a/mysql-test/t/ctype_collate.test
+++ b/mysql-test/t/ctype_collate.test
@@ -207,3 +207,14 @@ EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci;
DROP TABLE t1;
# End of 4.1 tests
+
+#
+# Bug#29261: Sort order of the collation wasn't used when comparing trailing
+# spaces.
+#
+create table t1(f1 varchar(10) character set latin2 collate latin2_hungarian_ci, key(f1));
+insert into t1 set f1=0x3F3F9DC73F;
+insert into t1 set f1=0x3F3F1E563F;
+insert into t1 set f1=0x3F3F;
+check table t1 extended;
+drop table t1;
diff --git a/mysql-test/t/ctype_ldml-master.opt b/mysql-test/t/ctype_ldml-master.opt
new file mode 100644
index 00000000000..a2532d4cfd9
--- /dev/null
+++ b/mysql-test/t/ctype_ldml-master.opt
@@ -0,0 +1,2 @@
+--character-sets-dir=$MYSQL_TEST_DIR/std_data/
+
diff --git a/mysql-test/t/ctype_ldml.test b/mysql-test/t/ctype_ldml.test
new file mode 100644
index 00000000000..fc6ed0f2579
--- /dev/null
+++ b/mysql-test/t/ctype_ldml.test
@@ -0,0 +1,63 @@
+--source include/have_ucs2.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+set names utf8;
+
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+show variables like 'character_sets_dir%';
+
+show collation like 'utf8_test_ci';
+create table t1 (c1 char(1) character set utf8 collate utf8_test_ci);
+insert into t1 values ('a');
+select * from t1 where c1='b';
+drop table t1;
+
+show collation like 'ucs2_test_ci';
+create table t1 (c1 char(1) character set ucs2 collate ucs2_test_ci);
+insert into t1 values ('a');
+select * from t1 where c1='b';
+drop table t1;
+
+#
+# Vietnamese experimental collation
+#
+
+show collation like 'ucs2_vn_ci';
+create table t1 (c1 char(1) character set ucs2 collate ucs2_vn_ci);
+insert into t1 values (0x0061),(0x0041),(0x00E0),(0x00C0),(0x1EA3),(0x1EA2),
+ (0x00E3),(0x00C3),(0x00E1),(0x00C1),(0x1EA1),(0x1EA0);
+insert into t1 values (0x0103),(0x0102),(0x1EB1),(0x1EB0),(0x1EB3),(0x1EB2),
+ (0x1EB5),(0x1EB4),(0x1EAF),(0x1EAE),(0x1EB7),(0x1EB6);
+insert into t1 values (0x00E2),(0x00C2),(0x1EA7),(0x1EA6),(0x1EA9),(0x1EA8),
+ (0x1EAB),(0x1EAA),(0x1EA5),(0x1EA4),(0x1EAD),(0x1EAC);
+insert into t1 values ('b'),('B'),('c'),('C');
+insert into t1 values ('d'),('D'),(0x0111),(0x0110);
+insert into t1 values (0x0065),(0x0045),(0x00E8),(0x00C8),(0x1EBB),(0x1EBA),
+ (0x1EBD),(0x1EBC),(0x00E9),(0x00C9),(0x1EB9),(0x1EB8);
+insert into t1 values (0x00EA),(0x00CA),(0x1EC1),(0x1EC0),(0x1EC3),(0x1EC2),
+ (0x1EC5),(0x1EC4),(0x1EBF),(0x1EBE),(0x1EC7),(0x1EC6);
+insert into t1 values ('g'),('G'),('h'),('H');
+insert into t1 values (0x0069),(0x0049),(0x00EC),(0x00CC),(0x1EC9),(0x1EC8),
+ (0x0129),(0x0128),(0x00ED),(0x00CD),(0x1ECB),(0x1ECA);
+insert into t1 values ('k'),('K'),('l'),('L'),('m'),('M');
+insert into t1 values (0x006F),(0x004F),(0x00F2),(0x00D2),(0x1ECF),(0x1ECE),
+ (0x00F5),(0x00D5),(0x00F3),(0x00D3),(0x1ECD),(0x1ECC);
+insert into t1 values (0x00F4),(0x00D4),(0x1ED3),(0x1ED2),(0x1ED5),(0x1ED4),
+ (0x1ED7),(0x1ED6),(0x1ED1),(0x1ED0),(0x1ED9),(0x1ED8);
+insert into t1 values (0x01A1),(0x01A0),(0x1EDD),(0x1EDC),(0x1EDF),(0x1EDE),
+ (0x1EE1),(0x1EE0),(0x1EDB),(0x1EDA),(0x1EE3),(0x1EE2);
+insert into t1 values ('p'),('P'),('q'),('Q'),('r'),('R'),('s'),('S'),('t'),('T');
+insert into t1 values (0x0075),(0x0055),(0x00F9),(0x00D9),(0x1EE7),(0x1EE6),
+ (0x0169),(0x0168),(0x00FA),(0x00DA),(0x1EE5),(0x1EE4);
+insert into t1 values (0x01B0),(0x01AF),(0x1EEB),(0x1EEA),(0x1EED),(0x1EEC),
+ (0x1EEF),(0x1EEE),(0x1EE9),(0x1EE8),(0x1EF1),(0x1EF0);
+insert into t1 values ('v'),('V'),('x'),('X');
+insert into t1 values (0x0079),(0x0059),(0x1EF3),(0x1EF2),(0x1EF7),(0x1EF6),
+ (0x1EF9),(0x1EF8),(0x00FD),(0x00DD),(0x1EF5),(0x1EF4);
+select hex(c1) as h, c1 from t1 order by c1, h;
+select group_concat(hex(c1) order by hex(c1)) from t1 group by c1;
+select group_concat(c1 order by hex(c1) SEPARATOR '') from t1 group by c1;
+drop table t1;
diff --git a/mysql-test/t/ctype_ujis_ucs2.test b/mysql-test/t/ctype_ujis_ucs2.test
new file mode 100644
index 00000000000..1a8702b2aa9
--- /dev/null
+++ b/mysql-test/t/ctype_ujis_ucs2.test
@@ -0,0 +1,1306 @@
+-- source include/have_ujis.inc
+-- source include/have_ucs2.inc
+
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+
+#
+# Tests for UJIS-to-Unicode and Unicode-to-UJIS mapping
+#
+# MySQL's "ujis" is x-eucjp-unicode-0.9.
+#
+
+#
+# A helper table, with codes 0xA1..0xFE
+#
+create table t2 (code binary(1));
+insert into t2 values (0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7);
+insert into t2 values (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF);
+insert into t2 values (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7);
+insert into t2 values (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF);
+insert into t2 values (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7);
+insert into t2 values (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF);
+insert into t2 values (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7);
+insert into t2 values (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF);
+insert into t2 values (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7);
+insert into t2 values (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF);
+insert into t2 values (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7);
+insert into t2 values (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE);
+
+create table t1
+(
+ ujis varchar(1) character set ujis collate ujis_bin primary key,
+ ucs2 varchar(1) character set ucs2 not null default '',
+ ujis2 varchar(1) character set ujis not null default '',
+ name varchar(64) character set ujis not null default ''
+);
+
+#
+# A character from the ASCII (code set 0)
+# is represented by one byte, in the range 0x00 - 0x7E.
+#
+
+insert into t1 set ujis=0x00, name='U+0000 NULL';
+insert into t1 set ujis=0x01, name='U+0001 START OF HEADING';
+insert into t1 set ujis=0x02, name='U+0002 START OF TEXT';
+insert into t1 set ujis=0x03, name='U+0003 END OF TEXT';
+insert into t1 set ujis=0x04, name='U+0004 END OF TRANSMISSION';
+insert into t1 set ujis=0x05, name='U+0005 ENQUIRY';
+insert into t1 set ujis=0x06, name='U+0006 ACKNOWLEDGE';
+insert into t1 set ujis=0x07, name='U+0007 BELL';
+insert into t1 set ujis=0x08, name='U+0008 BACKSPACE';
+insert into t1 set ujis=0x09, name='U+0009 HORIZONTAL TABULATION';
+insert into t1 set ujis=0x0A, name='U+000A LINE FEED';
+insert into t1 set ujis=0x0B, name='U+000B VERTICAL TABULATION';
+insert into t1 set ujis=0x0C, name='U+000C FORM FEED';
+insert into t1 set ujis=0x0D, name='U+000D CARRIAGE RETURN';
+insert into t1 set ujis=0x0E, name='U+000E SHIFT OUT';
+insert into t1 set ujis=0x0F, name='U+000F SHIFT IN';
+insert into t1 set ujis=0x10, name='U+0010 DATA LINK ESCAPE';
+insert into t1 set ujis=0x11, name='U+0011 DEVICE CONTROL ONE';
+insert into t1 set ujis=0x12, name='U+0012 DEVICE CONTROL TWO';
+insert into t1 set ujis=0x13, name='U+0013 DEVICE CONTROL THREE';
+insert into t1 set ujis=0x14, name='U+0014 DEVICE CONTROL FOUR';
+insert into t1 set ujis=0x15, name='U+0015 NEGATIVE ACKNOWLEDGE';
+insert into t1 set ujis=0x16, name='U+0016 SYNCHRONOUS IDLE';
+insert into t1 set ujis=0x17, name='U+0017 END OF TRANSMISSION BLOCK';
+insert into t1 set ujis=0x18, name='U+0018 CANCEL';
+insert into t1 set ujis=0x19, name='U+0019 END OF MEDIUM';
+insert into t1 set ujis=0x1A, name='U+001A SUBSTITUTE';
+insert into t1 set ujis=0x1B, name='U+001B ESCAPE';
+insert into t1 set ujis=0x1C, name='U+001C FILE SEPARATOR';
+insert into t1 set ujis=0x1D, name='U+001D GROUP SEPARATOR';
+insert into t1 set ujis=0x1E, name='U+001E RECORD SEPARATOR';
+insert into t1 set ujis=0x1F, name='U+001F UNIT SEPARATOR';
+insert into t1 set ujis=0x20, name='U+0020 SPACE';
+insert into t1 set ujis=0x21, name='U+0021 EXCLAMATION MARK';
+insert into t1 set ujis=0x22, name='U+0022 QUOTATION MARK';
+insert into t1 set ujis=0x23, name='U+0023 NUMBER SIGN';
+insert into t1 set ujis=0x24, name='U+0024 DOLLAR SIGN';
+insert into t1 set ujis=0x25, name='U+0025 PERCENT SIGN';
+insert into t1 set ujis=0x26, name='U+0026 AMPERSAND';
+insert into t1 set ujis=0x27, name='U+0027 APOSTROPHE';
+insert into t1 set ujis=0x28, name='U+0028 LEFT PARENTHESIS';
+insert into t1 set ujis=0x29, name='U+0029 RIGHT PARENTHESIS';
+insert into t1 set ujis=0x2A, name='U+002A ASTERISK';
+insert into t1 set ujis=0x2B, name='U+002B PLUS SIGN';
+insert into t1 set ujis=0x2C, name='U+002C COMMA';
+insert into t1 set ujis=0x2D, name='U+002D HYPHEN-MINUS';
+insert into t1 set ujis=0x2E, name='U+002E FULL STOP';
+insert into t1 set ujis=0x2F, name='U+002F SOLIDUS';
+insert into t1 set ujis=0x30, name='U+0030 DIGIT ZERO';
+insert into t1 set ujis=0x31, name='U+0031 DIGIT ONE';
+insert into t1 set ujis=0x32, name='U+0032 DIGIT TWO';
+insert into t1 set ujis=0x33, name='U+0033 DIGIT THREE';
+insert into t1 set ujis=0x34, name='U+0034 DIGIT FOUR';
+insert into t1 set ujis=0x35, name='U+0035 DIGIT FIVE';
+insert into t1 set ujis=0x36, name='U+0036 DIGIT SIX';
+insert into t1 set ujis=0x37, name='U+0037 DIGIT SEVEN';
+insert into t1 set ujis=0x38, name='U+0038 DIGIT EIGHT';
+insert into t1 set ujis=0x39, name='U+0039 DIGIT NINE';
+insert into t1 set ujis=0x3A, name='U+003A COLON';
+insert into t1 set ujis=0x3B, name='U+003B SEMICOLON';
+insert into t1 set ujis=0x3C, name='U+003C LESS-THAN SIGN';
+insert into t1 set ujis=0x3D, name='U+003D EQUALS SIGN';
+insert into t1 set ujis=0x3E, name='U+003E GREATER-THAN SIGN';
+insert into t1 set ujis=0x3F, name='U+003F QUESTION MARK';
+insert into t1 set ujis=0x40, name='U+0040 COMMERCIAL AT';
+insert into t1 set ujis=0x41, name='U+0041 LATIN CAPITAL LETTER A';
+insert into t1 set ujis=0x42, name='U+0042 LATIN CAPITAL LETTER B';
+insert into t1 set ujis=0x43, name='U+0043 LATIN CAPITAL LETTER C';
+insert into t1 set ujis=0x44, name='U+0044 LATIN CAPITAL LETTER D';
+insert into t1 set ujis=0x45, name='U+0045 LATIN CAPITAL LETTER E';
+insert into t1 set ujis=0x46, name='U+0046 LATIN CAPITAL LETTER F';
+insert into t1 set ujis=0x47, name='U+0047 LATIN CAPITAL LETTER G';
+insert into t1 set ujis=0x48, name='U+0048 LATIN CAPITAL LETTER H';
+insert into t1 set ujis=0x49, name='U+0049 LATIN CAPITAL LETTER I';
+insert into t1 set ujis=0x4A, name='U+004A LATIN CAPITAL LETTER J';
+insert into t1 set ujis=0x4B, name='U+004B LATIN CAPITAL LETTER K';
+insert into t1 set ujis=0x4C, name='U+004C LATIN CAPITAL LETTER L';
+insert into t1 set ujis=0x4D, name='U+004D LATIN CAPITAL LETTER M';
+insert into t1 set ujis=0x4E, name='U+004E LATIN CAPITAL LETTER N';
+insert into t1 set ujis=0x4F, name='U+004F LATIN CAPITAL LETTER O';
+insert into t1 set ujis=0x50, name='U+0050 LATIN CAPITAL LETTER P';
+insert into t1 set ujis=0x51, name='U+0051 LATIN CAPITAL LETTER Q';
+insert into t1 set ujis=0x52, name='U+0052 LATIN CAPITAL LETTER R';
+insert into t1 set ujis=0x53, name='U+0053 LATIN CAPITAL LETTER S';
+insert into t1 set ujis=0x54, name='U+0054 LATIN CAPITAL LETTER T';
+insert into t1 set ujis=0x55, name='U+0055 LATIN CAPITAL LETTER U';
+insert into t1 set ujis=0x56, name='U+0056 LATIN CAPITAL LETTER V';
+insert into t1 set ujis=0x57, name='U+0057 LATIN CAPITAL LETTER W';
+insert into t1 set ujis=0x58, name='U+0058 LATIN CAPITAL LETTER X';
+insert into t1 set ujis=0x59, name='U+0059 LATIN CAPITAL LETTER Y';
+insert into t1 set ujis=0x5A, name='U+005A LATIN CAPITAL LETTER Z';
+insert into t1 set ujis=0x5B, name='U+005B LEFT SQUARE BRACKET';
+insert into t1 set ujis=0x5C, name='U+005C REVERSE SOLIDUS';
+insert into t1 set ujis=0x5D, name='U+005D RIGHT SQUARE BRACKET';
+insert into t1 set ujis=0x5E, name='U+005E CIRCUMFLEX ACCENT';
+insert into t1 set ujis=0x5F, name='U+005F LOW LINE';
+insert into t1 set ujis=0x60, name='U+0060 GRAVE ACCENT';
+insert into t1 set ujis=0x61, name='U+0061 LATIN SMALL LETTER A';
+insert into t1 set ujis=0x62, name='U+0062 LATIN SMALL LETTER B';
+insert into t1 set ujis=0x63, name='U+0063 LATIN SMALL LETTER C';
+insert into t1 set ujis=0x64, name='U+0064 LATIN SMALL LETTER D';
+insert into t1 set ujis=0x65, name='U+0065 LATIN SMALL LETTER E';
+insert into t1 set ujis=0x66, name='U+0066 LATIN SMALL LETTER F';
+insert into t1 set ujis=0x67, name='U+0067 LATIN SMALL LETTER G';
+insert into t1 set ujis=0x68, name='U+0068 LATIN SMALL LETTER H';
+insert into t1 set ujis=0x69, name='U+0069 LATIN SMALL LETTER I';
+insert into t1 set ujis=0x6A, name='U+006A LATIN SMALL LETTER J';
+insert into t1 set ujis=0x6B, name='U+006B LATIN SMALL LETTER K';
+insert into t1 set ujis=0x6C, name='U+006C LATIN SMALL LETTER L';
+insert into t1 set ujis=0x6D, name='U+006D LATIN SMALL LETTER M';
+insert into t1 set ujis=0x6E, name='U+006E LATIN SMALL LETTER N';
+insert into t1 set ujis=0x6F, name='U+006F LATIN SMALL LETTER O';
+insert into t1 set ujis=0x70, name='U+0070 LATIN SMALL LETTER P';
+insert into t1 set ujis=0x71, name='U+0071 LATIN SMALL LETTER Q';
+insert into t1 set ujis=0x72, name='U+0072 LATIN SMALL LETTER R';
+insert into t1 set ujis=0x73, name='U+0073 LATIN SMALL LETTER S';
+insert into t1 set ujis=0x74, name='U+0074 LATIN SMALL LETTER T';
+insert into t1 set ujis=0x75, name='U+0075 LATIN SMALL LETTER U';
+insert into t1 set ujis=0x76, name='U+0076 LATIN SMALL LETTER V';
+insert into t1 set ujis=0x77, name='U+0077 LATIN SMALL LETTER W';
+insert into t1 set ujis=0x78, name='U+0078 LATIN SMALL LETTER X';
+insert into t1 set ujis=0x79, name='U+0079 LATIN SMALL LETTER Y';
+insert into t1 set ujis=0x7A, name='U+007A LATIN SMALL LETTER Z';
+insert into t1 set ujis=0x7B, name='U+007B LEFT CURLY BRACKET';
+insert into t1 set ujis=0x7C, name='U+007C VERTICAL LINE';
+insert into t1 set ujis=0x7D, name='U+007D RIGHT CURLY BRACKET';
+insert into t1 set ujis=0x7E, name='U+007E TILDE';
+insert into t1 set ujis=0x7F, name='U+007F DELETE';
+
+
+#
+# A character from JIS-X-0208 (code set 1)
+# is represented by two bytes,
+# both in the range 0xA1 - 0xFE.
+# Codes according to:
+# ftp://ftp.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/JIS/JIS0208.TXT
+#
+# Fill table t1 with codes "[A1..FE][A1..FE]" using helper table t2.
+# 8836 codes total:
+#
+insert into t1 (ujis) select concat(t21.code,t22.code) from t2 t21, t2 t22 order by 1;
+
+update t1 set name='U+3000 IDEOGRAPHIC SPACE' where ujis=0xA1A1;
+update t1 set name='U+3001 IDEOGRAPHIC COMMA' where ujis=0xA1A2;
+update t1 set name='U+3002 IDEOGRAPHIC FULL STOP' where ujis=0xA1A3;
+update t1 set name='U+FF0C FULLWIDTH COMMA' where ujis=0xA1A4;
+update t1 set name='U+FF0E FULLWIDTH FULL STOP' where ujis=0xA1A5;
+update t1 set name='U+30FB KATAKANA MIDDLE DOT' where ujis=0xA1A6;
+update t1 set name='U+FF1A FULLWIDTH COLON' where ujis=0xA1A7;
+update t1 set name='U+FF1B FULLWIDTH SEMICOLON' where ujis=0xA1A8;
+update t1 set name='U+FF1F FULLWIDTH QUESTION MARK' where ujis=0xA1A9;
+update t1 set name='U+FF01 FULLWIDTH EXCLAMATION MARK' where ujis=0xA1AA;
+update t1 set name='U+309B KATAKANA-HIRAGANA VOICED SOUND MARK' where ujis=0xA1AB;
+update t1 set name='U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK' where ujis=0xA1AC;
+update t1 set name='U+00B4 ACUTE ACCENT' where ujis=0xA1AD;
+update t1 set name='U+FF40 FULLWIDTH GRAVE ACCENT' where ujis=0xA1AE;
+update t1 set name='U+00A8 DIAERESIS' where ujis=0xA1AF;
+update t1 set name='U+FF3E FULLWIDTH CIRCUMFLEX ACCENT' where ujis=0xA1B0;
+update t1 set name='U+FFE3 FULLWIDTH MACRON' where ujis=0xA1B1;
+update t1 set name='U+FF3F FULLWIDTH LOW LINE' where ujis=0xA1B2;
+update t1 set name='U+30FD KATAKANA ITERATION MARK' where ujis=0xA1B3;
+update t1 set name='U+30FE KATAKANA VOICED ITERATION MARK' where ujis=0xA1B4;
+update t1 set name='U+309D HIRAGANA ITERATION MARK' where ujis=0xA1B5;
+update t1 set name='U+309E HIRAGANA VOICED ITERATION MARK' where ujis=0xA1B6;
+update t1 set name='U+3003 DITTO MARK' where ujis=0xA1B7;
+update t1 set name='U+4EDD <CJK>' where ujis=0xA1B8;
+update t1 set name='U+3005 IDEOGRAPHIC ITERATION MARK' where ujis=0xA1B9;
+update t1 set name='U+3006 IDEOGRAPHIC CLOSING MARK' where ujis=0xA1BA;
+update t1 set name='U+3007 IDEOGRAPHIC NUMBER ZERO' where ujis=0xA1BB;
+update t1 set name='U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK' where ujis=0xA1BC;
+update t1 set name='U+2015 HORIZONTAL BAR' where ujis=0xA1BD;
+update t1 set name='U+2010 HYPHEN' where ujis=0xA1BE;
+update t1 set name='U+FF0F FULLWIDTH SOLIDUS' where ujis=0xA1BF;
+update t1 set name='U+005C REVERSE SOLIDUS' where ujis=0xA1C0;
+update t1 set name='U+301C WAVE DASH' where ujis=0xA1C1;
+update t1 set name='U+2016 DOUBLE VERTICAL LINE' where ujis=0xA1C2;
+update t1 set name='U+FF5C FULLWIDTH VERTICAL LINE' where ujis=0xA1C3;
+update t1 set name='U+2026 HORIZONTAL ELLIPSIS' where ujis=0xA1C4;
+update t1 set name='U+2025 TWO DOT LEADER' where ujis=0xA1C5;
+update t1 set name='U+2018 LEFT SINGLE QUOTATION MARK' where ujis=0xA1C6;
+update t1 set name='U+2019 RIGHT SINGLE QUOTATION MARK' where ujis=0xA1C7;
+update t1 set name='U+201C LEFT DOUBLE QUOTATION MARK' where ujis=0xA1C8;
+update t1 set name='U+201D RIGHT DOUBLE QUOTATION MARK' where ujis=0xA1C9;
+update t1 set name='U+FF08 FULLWIDTH LEFT PARENTHESIS' where ujis=0xA1CA;
+update t1 set name='U+FF09 FULLWIDTH RIGHT PARENTHESIS' where ujis=0xA1CB;
+update t1 set name='U+3014 LEFT TORTOISE SHELL BRACKET' where ujis=0xA1CC;
+update t1 set name='U+3015 RIGHT TORTOISE SHELL BRACKET' where ujis=0xA1CD;
+update t1 set name='U+FF3B FULLWIDTH LEFT SQUARE BRACKET' where ujis=0xA1CE;
+update t1 set name='U+FF3D FULLWIDTH RIGHT SQUARE BRACKET' where ujis=0xA1CF;
+update t1 set name='U+FF5B FULLWIDTH LEFT CURLY BRACKET' where ujis=0xA1D0;
+update t1 set name='U+FF5D FULLWIDTH RIGHT CURLY BRACKET' where ujis=0xA1D1;
+update t1 set name='U+3008 LEFT ANGLE BRACKET' where ujis=0xA1D2;
+update t1 set name='U+3009 RIGHT ANGLE BRACKET' where ujis=0xA1D3;
+update t1 set name='U+300A LEFT DOUBLE ANGLE BRACKET' where ujis=0xA1D4;
+update t1 set name='U+300B RIGHT DOUBLE ANGLE BRACKET' where ujis=0xA1D5;
+update t1 set name='U+300C LEFT CORNER BRACKET' where ujis=0xA1D6;
+update t1 set name='U+300D RIGHT CORNER BRACKET' where ujis=0xA1D7;
+update t1 set name='U+300E LEFT WHITE CORNER BRACKET' where ujis=0xA1D8;
+update t1 set name='U+300F RIGHT WHITE CORNER BRACKET' where ujis=0xA1D9;
+update t1 set name='U+3010 LEFT BLACK LENTICULAR BRACKET' where ujis=0xA1DA;
+update t1 set name='U+3011 RIGHT BLACK LENTICULAR BRACKET' where ujis=0xA1DB;
+update t1 set name='U+FF0B FULLWIDTH PLUS SIGN' where ujis=0xA1DC;
+update t1 set name='U+2212 MINUS SIGN' where ujis=0xA1DD;
+update t1 set name='U+00B1 PLUS-MINUS SIGN' where ujis=0xA1DE;
+update t1 set name='U+00D7 MULTIPLICATION SIGN' where ujis=0xA1DF;
+update t1 set name='U+00F7 DIVISION SIGN' where ujis=0xA1E0;
+update t1 set name='U+FF1D FULLWIDTH EQUALS SIGN' where ujis=0xA1E1;
+update t1 set name='U+2260 NOT EQUAL TO' where ujis=0xA1E2;
+update t1 set name='U+FF1C FULLWIDTH LESS-THAN SIGN' where ujis=0xA1E3;
+update t1 set name='U+FF1E FULLWIDTH GREATER-THAN SIGN' where ujis=0xA1E4;
+update t1 set name='U+2266 LESS-THAN OVER EQUAL TO' where ujis=0xA1E5;
+update t1 set name='U+2267 GREATER-THAN OVER EQUAL TO' where ujis=0xA1E6;
+update t1 set name='U+221E INFINITY' where ujis=0xA1E7;
+update t1 set name='U+2234 THEREFORE' where ujis=0xA1E8;
+update t1 set name='U+2642 MALE SIGN' where ujis=0xA1E9;
+update t1 set name='U+2640 FEMALE SIGN' where ujis=0xA1EA;
+update t1 set name='U+00B0 DEGREE SIGN' where ujis=0xA1EB;
+update t1 set name='U+2032 PRIME' where ujis=0xA1EC;
+update t1 set name='U+2033 DOUBLE PRIME' where ujis=0xA1ED;
+update t1 set name='U+2103 DEGREE CELSIUS' where ujis=0xA1EE;
+update t1 set name='U+FFE5 FULLWIDTH YEN SIGN' where ujis=0xA1EF;
+update t1 set name='U+FF04 FULLWIDTH DOLLAR SIGN' where ujis=0xA1F0;
+update t1 set name='U+00A2 CENT SIGN' where ujis=0xA1F1;
+update t1 set name='U+00A3 POUND SIGN' where ujis=0xA1F2;
+update t1 set name='U+FF05 FULLWIDTH PERCENT SIGN' where ujis=0xA1F3;
+update t1 set name='U+FF03 FULLWIDTH NUMBER SIGN' where ujis=0xA1F4;
+update t1 set name='U+FF06 FULLWIDTH AMPERSAND' where ujis=0xA1F5;
+update t1 set name='U+FF0A FULLWIDTH ASTERISK' where ujis=0xA1F6;
+update t1 set name='U+FF20 FULLWIDTH COMMERCIAL AT' where ujis=0xA1F7;
+update t1 set name='U+00A7 SECTION SIGN' where ujis=0xA1F8;
+update t1 set name='U+2606 WHITE STAR' where ujis=0xA1F9;
+update t1 set name='U+2605 BLACK STAR' where ujis=0xA1FA;
+update t1 set name='U+25CB WHITE CIRCLE' where ujis=0xA1FB;
+update t1 set name='U+25CF BLACK CIRCLE' where ujis=0xA1FC;
+update t1 set name='U+25CE BULLSEYE' where ujis=0xA1FD;
+update t1 set name='U+25C7 WHITE DIAMOND' where ujis=0xA1FE;
+update t1 set name='U+25C6 BLACK DIAMOND' where ujis=0xA2A1;
+update t1 set name='U+25A1 WHITE SQUARE' where ujis=0xA2A2;
+update t1 set name='U+25A0 BLACK SQUARE' where ujis=0xA2A3;
+update t1 set name='U+25B3 WHITE UP-POINTING TRIANGLE' where ujis=0xA2A4;
+update t1 set name='U+25B2 BLACK UP-POINTING TRIANGLE' where ujis=0xA2A5;
+update t1 set name='U+25BD WHITE DOWN-POINTING TRIANGLE' where ujis=0xA2A6;
+update t1 set name='U+25BC BLACK DOWN-POINTING TRIANGLE' where ujis=0xA2A7;
+update t1 set name='U+203B REFERENCE MARK' where ujis=0xA2A8;
+update t1 set name='U+3012 POSTAL MARK' where ujis=0xA2A9;
+update t1 set name='U+2192 RIGHTWARDS ARROW' where ujis=0xA2AA;
+update t1 set name='U+2190 LEFTWARDS ARROW' where ujis=0xA2AB;
+update t1 set name='U+2191 UPWARDS ARROW' where ujis=0xA2AC;
+update t1 set name='U+2193 DOWNWARDS ARROW' where ujis=0xA2AD;
+update t1 set name='U+3013 GETA MARK' where ujis=0xA2AE;
+update t1 set name='U+2208 ELEMENT OF' where ujis=0xA2BA;
+update t1 set name='U+220B CONTAINS AS MEMBER' where ujis=0xA2BB;
+update t1 set name='U+2286 SUBset OF OR EQUAL TO' where ujis=0xA2BC;
+update t1 set name='U+2287 SUPERset OF OR EQUAL TO' where ujis=0xA2BD;
+update t1 set name='U+2282 SUBset OF' where ujis=0xA2BE;
+update t1 set name='U+2283 SUPERset OF' where ujis=0xA2BF;
+update t1 set name='U+222A UNION' where ujis=0xA2C0;
+update t1 set name='U+2229 INTERSECTION' where ujis=0xA2C1;
+update t1 set name='U+2227 LOGICAL AND' where ujis=0xA2CA;
+update t1 set name='U+2228 LOGICAL OR' where ujis=0xA2CB;
+update t1 set name='U+00AC NOT SIGN' where ujis=0xA2CC;
+update t1 set name='U+21D2 RIGHTWARDS DOUBLE ARROW' where ujis=0xA2CD;
+update t1 set name='U+21D4 LEFT RIGHT DOUBLE ARROW' where ujis=0xA2CE;
+update t1 set name='U+2200 FOR ALL' where ujis=0xA2CF;
+update t1 set name='U+2203 THERE EXISTS' where ujis=0xA2D0;
+update t1 set name='U+2220 ANGLE' where ujis=0xA2DC;
+update t1 set name='U+22A5 UP TACK' where ujis=0xA2DD;
+update t1 set name='U+2312 ARC' where ujis=0xA2DE;
+update t1 set name='U+2202 PARTIAL DIFFERENTIAL' where ujis=0xA2DF;
+update t1 set name='U+2207 NABLA' where ujis=0xA2E0;
+update t1 set name='U+2261 IDENTICAL TO' where ujis=0xA2E1;
+update t1 set name='U+2252 APPROXIMATELY EQUAL TO OR THE IMAGE OF' where ujis=0xA2E2;
+update t1 set name='U+226A MUCH LESS-THAN' where ujis=0xA2E3;
+update t1 set name='U+226B MUCH GREATER-THAN' where ujis=0xA2E4;
+update t1 set name='U+221A SQUARE ROOT' where ujis=0xA2E5;
+update t1 set name='U+223D REVERSED TILDE' where ujis=0xA2E6;
+update t1 set name='U+221D PROPORTIONAL TO' where ujis=0xA2E7;
+update t1 set name='U+2235 BECAUSE' where ujis=0xA2E8;
+update t1 set name='U+222B INTEGRAL' where ujis=0xA2E9;
+update t1 set name='U+222C DOUBLE INTEGRAL' where ujis=0xA2EA;
+update t1 set name='U+212B ANGSTROM SIGN' where ujis=0xA2F2;
+update t1 set name='U+2030 PER MILLE SIGN' where ujis=0xA2F3;
+update t1 set name='U+266F MUSIC SHARP SIGN' where ujis=0xA2F4;
+update t1 set name='U+266D MUSIC FLAT SIGN' where ujis=0xA2F5;
+update t1 set name='U+266A EIGHTH NOTE' where ujis=0xA2F6;
+update t1 set name='U+2020 DAGGER' where ujis=0xA2F7;
+update t1 set name='U+2021 DOUBLE DAGGER' where ujis=0xA2F8;
+update t1 set name='U+00B6 PILCROW SIGN' where ujis=0xA2F9;
+update t1 set name='U+25EF LARGE CIRCLE' where ujis=0xA2FE;
+update t1 set name='U+FF10 FULLWIDTH DIGIT ZERO' where ujis=0xA3B0;
+update t1 set name='U+FF11 FULLWIDTH DIGIT ONE' where ujis=0xA3B1;
+update t1 set name='U+FF12 FULLWIDTH DIGIT TWO' where ujis=0xA3B2;
+update t1 set name='U+FF13 FULLWIDTH DIGIT THREE' where ujis=0xA3B3;
+update t1 set name='U+FF14 FULLWIDTH DIGIT FOUR' where ujis=0xA3B4;
+update t1 set name='U+FF15 FULLWIDTH DIGIT FIVE' where ujis=0xA3B5;
+update t1 set name='U+FF16 FULLWIDTH DIGIT SIX' where ujis=0xA3B6;
+update t1 set name='U+FF17 FULLWIDTH DIGIT SEVEN' where ujis=0xA3B7;
+update t1 set name='U+FF18 FULLWIDTH DIGIT EIGHT' where ujis=0xA3B8;
+update t1 set name='U+FF19 FULLWIDTH DIGIT NINE' where ujis=0xA3B9;
+update t1 set name='U+FF21 FULLWIDTH LATIN CAPITAL LETTER A' where ujis=0xA3C1;
+update t1 set name='U+FF22 FULLWIDTH LATIN CAPITAL LETTER B' where ujis=0xA3C2;
+update t1 set name='U+FF23 FULLWIDTH LATIN CAPITAL LETTER C' where ujis=0xA3C3;
+update t1 set name='U+FF24 FULLWIDTH LATIN CAPITAL LETTER D' where ujis=0xA3C4;
+update t1 set name='U+FF25 FULLWIDTH LATIN CAPITAL LETTER E' where ujis=0xA3C5;
+update t1 set name='U+FF26 FULLWIDTH LATIN CAPITAL LETTER F' where ujis=0xA3C6;
+update t1 set name='U+FF27 FULLWIDTH LATIN CAPITAL LETTER G' where ujis=0xA3C7;
+update t1 set name='U+FF28 FULLWIDTH LATIN CAPITAL LETTER H' where ujis=0xA3C8;
+update t1 set name='U+FF29 FULLWIDTH LATIN CAPITAL LETTER I' where ujis=0xA3C9;
+update t1 set name='U+FF2A FULLWIDTH LATIN CAPITAL LETTER J' where ujis=0xA3CA;
+update t1 set name='U+FF2B FULLWIDTH LATIN CAPITAL LETTER K' where ujis=0xA3CB;
+update t1 set name='U+FF2C FULLWIDTH LATIN CAPITAL LETTER L' where ujis=0xA3CC;
+update t1 set name='U+FF2D FULLWIDTH LATIN CAPITAL LETTER M' where ujis=0xA3CD;
+update t1 set name='U+FF2E FULLWIDTH LATIN CAPITAL LETTER N' where ujis=0xA3CE;
+update t1 set name='U+FF2F FULLWIDTH LATIN CAPITAL LETTER O' where ujis=0xA3CF;
+update t1 set name='U+FF30 FULLWIDTH LATIN CAPITAL LETTER P' where ujis=0xA3D0;
+update t1 set name='U+FF31 FULLWIDTH LATIN CAPITAL LETTER Q' where ujis=0xA3D1;
+update t1 set name='U+FF32 FULLWIDTH LATIN CAPITAL LETTER R' where ujis=0xA3D2;
+update t1 set name='U+FF33 FULLWIDTH LATIN CAPITAL LETTER S' where ujis=0xA3D3;
+update t1 set name='U+FF34 FULLWIDTH LATIN CAPITAL LETTER T' where ujis=0xA3D4;
+update t1 set name='U+FF35 FULLWIDTH LATIN CAPITAL LETTER U' where ujis=0xA3D5;
+update t1 set name='U+FF36 FULLWIDTH LATIN CAPITAL LETTER V' where ujis=0xA3D6;
+update t1 set name='U+FF37 FULLWIDTH LATIN CAPITAL LETTER W' where ujis=0xA3D7;
+update t1 set name='U+FF38 FULLWIDTH LATIN CAPITAL LETTER X' where ujis=0xA3D8;
+update t1 set name='U+FF39 FULLWIDTH LATIN CAPITAL LETTER Y' where ujis=0xA3D9;
+update t1 set name='U+FF3A FULLWIDTH LATIN CAPITAL LETTER Z' where ujis=0xA3DA;
+update t1 set name='U+FF41 FULLWIDTH LATIN SMALL LETTER A' where ujis=0xA3E1;
+update t1 set name='U+FF42 FULLWIDTH LATIN SMALL LETTER B' where ujis=0xA3E2;
+update t1 set name='U+FF43 FULLWIDTH LATIN SMALL LETTER C' where ujis=0xA3E3;
+update t1 set name='U+FF44 FULLWIDTH LATIN SMALL LETTER D' where ujis=0xA3E4;
+update t1 set name='U+FF45 FULLWIDTH LATIN SMALL LETTER E' where ujis=0xA3E5;
+update t1 set name='U+FF46 FULLWIDTH LATIN SMALL LETTER F' where ujis=0xA3E6;
+update t1 set name='U+FF47 FULLWIDTH LATIN SMALL LETTER G' where ujis=0xA3E7;
+update t1 set name='U+FF48 FULLWIDTH LATIN SMALL LETTER H' where ujis=0xA3E8;
+update t1 set name='U+FF49 FULLWIDTH LATIN SMALL LETTER I' where ujis=0xA3E9;
+update t1 set name='U+FF4A FULLWIDTH LATIN SMALL LETTER J' where ujis=0xA3EA;
+update t1 set name='U+FF4B FULLWIDTH LATIN SMALL LETTER K' where ujis=0xA3EB;
+update t1 set name='U+FF4C FULLWIDTH LATIN SMALL LETTER L' where ujis=0xA3EC;
+update t1 set name='U+FF4D FULLWIDTH LATIN SMALL LETTER M' where ujis=0xA3ED;
+update t1 set name='U+FF4E FULLWIDTH LATIN SMALL LETTER N' where ujis=0xA3EE;
+update t1 set name='U+FF4F FULLWIDTH LATIN SMALL LETTER O' where ujis=0xA3EF;
+update t1 set name='U+FF50 FULLWIDTH LATIN SMALL LETTER P' where ujis=0xA3F0;
+update t1 set name='U+FF51 FULLWIDTH LATIN SMALL LETTER Q' where ujis=0xA3F1;
+update t1 set name='U+FF52 FULLWIDTH LATIN SMALL LETTER R' where ujis=0xA3F2;
+update t1 set name='U+FF53 FULLWIDTH LATIN SMALL LETTER S' where ujis=0xA3F3;
+update t1 set name='U+FF54 FULLWIDTH LATIN SMALL LETTER T' where ujis=0xA3F4;
+update t1 set name='U+FF55 FULLWIDTH LATIN SMALL LETTER U' where ujis=0xA3F5;
+update t1 set name='U+FF56 FULLWIDTH LATIN SMALL LETTER V' where ujis=0xA3F6;
+update t1 set name='U+FF57 FULLWIDTH LATIN SMALL LETTER W' where ujis=0xA3F7;
+update t1 set name='U+FF58 FULLWIDTH LATIN SMALL LETTER X' where ujis=0xA3F8;
+update t1 set name='U+FF59 FULLWIDTH LATIN SMALL LETTER Y' where ujis=0xA3F9;
+update t1 set name='U+FF5A FULLWIDTH LATIN SMALL LETTER Z' where ujis=0xA3FA;
+update t1 set name='U+3041 HIRAGANA LETTER SMALL A' where ujis=0xA4A1;
+update t1 set name='U+3042 HIRAGANA LETTER A' where ujis=0xA4A2;
+update t1 set name='U+3043 HIRAGANA LETTER SMALL I' where ujis=0xA4A3;
+update t1 set name='U+3044 HIRAGANA LETTER I' where ujis=0xA4A4;
+update t1 set name='U+3045 HIRAGANA LETTER SMALL U' where ujis=0xA4A5;
+update t1 set name='U+3046 HIRAGANA LETTER U' where ujis=0xA4A6;
+update t1 set name='U+3047 HIRAGANA LETTER SMALL E' where ujis=0xA4A7;
+update t1 set name='U+3048 HIRAGANA LETTER E' where ujis=0xA4A8;
+update t1 set name='U+3049 HIRAGANA LETTER SMALL O' where ujis=0xA4A9;
+update t1 set name='U+304A HIRAGANA LETTER O' where ujis=0xA4AA;
+update t1 set name='U+304B HIRAGANA LETTER KA' where ujis=0xA4AB;
+update t1 set name='U+304C HIRAGANA LETTER GA' where ujis=0xA4AC;
+update t1 set name='U+304D HIRAGANA LETTER KI' where ujis=0xA4AD;
+update t1 set name='U+304E HIRAGANA LETTER GI' where ujis=0xA4AE;
+update t1 set name='U+304F HIRAGANA LETTER KU' where ujis=0xA4AF;
+update t1 set name='U+3050 HIRAGANA LETTER GU' where ujis=0xA4B0;
+update t1 set name='U+3051 HIRAGANA LETTER KE' where ujis=0xA4B1;
+update t1 set name='U+3052 HIRAGANA LETTER GE' where ujis=0xA4B2;
+update t1 set name='U+3053 HIRAGANA LETTER KO' where ujis=0xA4B3;
+update t1 set name='U+3054 HIRAGANA LETTER GO' where ujis=0xA4B4;
+update t1 set name='U+3055 HIRAGANA LETTER SA' where ujis=0xA4B5;
+update t1 set name='U+3056 HIRAGANA LETTER ZA' where ujis=0xA4B6;
+update t1 set name='U+3057 HIRAGANA LETTER SI' where ujis=0xA4B7;
+update t1 set name='U+3058 HIRAGANA LETTER ZI' where ujis=0xA4B8;
+update t1 set name='U+3059 HIRAGANA LETTER SU' where ujis=0xA4B9;
+update t1 set name='U+305A HIRAGANA LETTER ZU' where ujis=0xA4BA;
+update t1 set name='U+305B HIRAGANA LETTER SE' where ujis=0xA4BB;
+update t1 set name='U+305C HIRAGANA LETTER ZE' where ujis=0xA4BC;
+update t1 set name='U+305D HIRAGANA LETTER SO' where ujis=0xA4BD;
+update t1 set name='U+305E HIRAGANA LETTER ZO' where ujis=0xA4BE;
+update t1 set name='U+305F HIRAGANA LETTER TA' where ujis=0xA4BF;
+update t1 set name='U+3060 HIRAGANA LETTER DA' where ujis=0xA4C0;
+update t1 set name='U+3061 HIRAGANA LETTER TI' where ujis=0xA4C1;
+update t1 set name='U+3062 HIRAGANA LETTER DI' where ujis=0xA4C2;
+update t1 set name='U+3063 HIRAGANA LETTER SMALL TU' where ujis=0xA4C3;
+update t1 set name='U+3064 HIRAGANA LETTER TU' where ujis=0xA4C4;
+update t1 set name='U+3065 HIRAGANA LETTER DU' where ujis=0xA4C5;
+update t1 set name='U+3066 HIRAGANA LETTER TE' where ujis=0xA4C6;
+update t1 set name='U+3067 HIRAGANA LETTER DE' where ujis=0xA4C7;
+update t1 set name='U+3068 HIRAGANA LETTER TO' where ujis=0xA4C8;
+update t1 set name='U+3069 HIRAGANA LETTER DO' where ujis=0xA4C9;
+update t1 set name='U+306A HIRAGANA LETTER NA' where ujis=0xA4CA;
+update t1 set name='U+306B HIRAGANA LETTER NI' where ujis=0xA4CB;
+update t1 set name='U+306C HIRAGANA LETTER NU' where ujis=0xA4CC;
+update t1 set name='U+306D HIRAGANA LETTER NE' where ujis=0xA4CD;
+update t1 set name='U+306E HIRAGANA LETTER NO' where ujis=0xA4CE;
+update t1 set name='U+306F HIRAGANA LETTER HA' where ujis=0xA4CF;
+update t1 set name='U+3070 HIRAGANA LETTER BA' where ujis=0xA4D0;
+update t1 set name='U+3071 HIRAGANA LETTER PA' where ujis=0xA4D1;
+update t1 set name='U+3072 HIRAGANA LETTER HI' where ujis=0xA4D2;
+update t1 set name='U+3073 HIRAGANA LETTER BI' where ujis=0xA4D3;
+update t1 set name='U+3074 HIRAGANA LETTER PI' where ujis=0xA4D4;
+update t1 set name='U+3075 HIRAGANA LETTER HU' where ujis=0xA4D5;
+update t1 set name='U+3076 HIRAGANA LETTER BU' where ujis=0xA4D6;
+update t1 set name='U+3077 HIRAGANA LETTER PU' where ujis=0xA4D7;
+update t1 set name='U+3078 HIRAGANA LETTER HE' where ujis=0xA4D8;
+update t1 set name='U+3079 HIRAGANA LETTER BE' where ujis=0xA4D9;
+update t1 set name='U+307A HIRAGANA LETTER PE' where ujis=0xA4DA;
+update t1 set name='U+307B HIRAGANA LETTER HO' where ujis=0xA4DB;
+update t1 set name='U+307C HIRAGANA LETTER BO' where ujis=0xA4DC;
+update t1 set name='U+307D HIRAGANA LETTER PO' where ujis=0xA4DD;
+update t1 set name='U+307E HIRAGANA LETTER MA' where ujis=0xA4DE;
+update t1 set name='U+307F HIRAGANA LETTER MI' where ujis=0xA4DF;
+update t1 set name='U+3080 HIRAGANA LETTER MU' where ujis=0xA4E0;
+update t1 set name='U+3081 HIRAGANA LETTER ME' where ujis=0xA4E1;
+update t1 set name='U+3082 HIRAGANA LETTER MO' where ujis=0xA4E2;
+update t1 set name='U+3083 HIRAGANA LETTER SMALL YA' where ujis=0xA4E3;
+update t1 set name='U+3084 HIRAGANA LETTER YA' where ujis=0xA4E4;
+update t1 set name='U+3085 HIRAGANA LETTER SMALL YU' where ujis=0xA4E5;
+update t1 set name='U+3086 HIRAGANA LETTER YU' where ujis=0xA4E6;
+update t1 set name='U+3087 HIRAGANA LETTER SMALL YO' where ujis=0xA4E7;
+update t1 set name='U+3088 HIRAGANA LETTER YO' where ujis=0xA4E8;
+update t1 set name='U+3089 HIRAGANA LETTER RA' where ujis=0xA4E9;
+update t1 set name='U+308A HIRAGANA LETTER RI' where ujis=0xA4EA;
+update t1 set name='U+308B HIRAGANA LETTER RU' where ujis=0xA4EB;
+update t1 set name='U+308C HIRAGANA LETTER RE' where ujis=0xA4EC;
+update t1 set name='U+308D HIRAGANA LETTER RO' where ujis=0xA4ED;
+update t1 set name='U+308E HIRAGANA LETTER SMALL WA' where ujis=0xA4EE;
+update t1 set name='U+308F HIRAGANA LETTER WA' where ujis=0xA4EF;
+update t1 set name='U+3090 HIRAGANA LETTER WI' where ujis=0xA4F0;
+update t1 set name='U+3091 HIRAGANA LETTER WE' where ujis=0xA4F1;
+update t1 set name='U+3092 HIRAGANA LETTER WO' where ujis=0xA4F2;
+update t1 set name='U+3093 HIRAGANA LETTER N' where ujis=0xA4F3;
+update t1 set name='U+30A1 KATAKANA LETTER SMALL A' where ujis=0xA5A1;
+update t1 set name='U+30A2 KATAKANA LETTER A' where ujis=0xA5A2;
+update t1 set name='U+30A3 KATAKANA LETTER SMALL I' where ujis=0xA5A3;
+update t1 set name='U+30A4 KATAKANA LETTER I' where ujis=0xA5A4;
+update t1 set name='U+30A5 KATAKANA LETTER SMALL U' where ujis=0xA5A5;
+update t1 set name='U+30A6 KATAKANA LETTER U' where ujis=0xA5A6;
+update t1 set name='U+30A7 KATAKANA LETTER SMALL E' where ujis=0xA5A7;
+update t1 set name='U+30A8 KATAKANA LETTER E' where ujis=0xA5A8;
+update t1 set name='U+30A9 KATAKANA LETTER SMALL O' where ujis=0xA5A9;
+update t1 set name='U+30AA KATAKANA LETTER O' where ujis=0xA5AA;
+update t1 set name='U+30AB KATAKANA LETTER KA' where ujis=0xA5AB;
+update t1 set name='U+30AC KATAKANA LETTER GA' where ujis=0xA5AC;
+update t1 set name='U+30AD KATAKANA LETTER KI' where ujis=0xA5AD;
+update t1 set name='U+30AE KATAKANA LETTER GI' where ujis=0xA5AE;
+update t1 set name='U+30AF KATAKANA LETTER KU' where ujis=0xA5AF;
+update t1 set name='U+30B0 KATAKANA LETTER GU' where ujis=0xA5B0;
+update t1 set name='U+30B1 KATAKANA LETTER KE' where ujis=0xA5B1;
+update t1 set name='U+30B2 KATAKANA LETTER GE' where ujis=0xA5B2;
+update t1 set name='U+30B3 KATAKANA LETTER KO' where ujis=0xA5B3;
+update t1 set name='U+30B4 KATAKANA LETTER GO' where ujis=0xA5B4;
+update t1 set name='U+30B5 KATAKANA LETTER SA' where ujis=0xA5B5;
+update t1 set name='U+30B6 KATAKANA LETTER ZA' where ujis=0xA5B6;
+update t1 set name='U+30B7 KATAKANA LETTER SI' where ujis=0xA5B7;
+update t1 set name='U+30B8 KATAKANA LETTER ZI' where ujis=0xA5B8;
+update t1 set name='U+30B9 KATAKANA LETTER SU' where ujis=0xA5B9;
+update t1 set name='U+30BA KATAKANA LETTER ZU' where ujis=0xA5BA;
+update t1 set name='U+30BB KATAKANA LETTER SE' where ujis=0xA5BB;
+update t1 set name='U+30BC KATAKANA LETTER ZE' where ujis=0xA5BC;
+update t1 set name='U+30BD KATAKANA LETTER SO' where ujis=0xA5BD;
+update t1 set name='U+30BE KATAKANA LETTER ZO' where ujis=0xA5BE;
+update t1 set name='U+30BF KATAKANA LETTER TA' where ujis=0xA5BF;
+update t1 set name='U+30C0 KATAKANA LETTER DA' where ujis=0xA5C0;
+update t1 set name='U+30C1 KATAKANA LETTER TI' where ujis=0xA5C1;
+update t1 set name='U+30C2 KATAKANA LETTER DI' where ujis=0xA5C2;
+update t1 set name='U+30C3 KATAKANA LETTER SMALL TU' where ujis=0xA5C3;
+update t1 set name='U+30C4 KATAKANA LETTER TU' where ujis=0xA5C4;
+update t1 set name='U+30C5 KATAKANA LETTER DU' where ujis=0xA5C5;
+update t1 set name='U+30C6 KATAKANA LETTER TE' where ujis=0xA5C6;
+update t1 set name='U+30C7 KATAKANA LETTER DE' where ujis=0xA5C7;
+update t1 set name='U+30C8 KATAKANA LETTER TO' where ujis=0xA5C8;
+update t1 set name='U+30C9 KATAKANA LETTER DO' where ujis=0xA5C9;
+update t1 set name='U+30CA KATAKANA LETTER NA' where ujis=0xA5CA;
+update t1 set name='U+30CB KATAKANA LETTER NI' where ujis=0xA5CB;
+update t1 set name='U+30CC KATAKANA LETTER NU' where ujis=0xA5CC;
+update t1 set name='U+30CD KATAKANA LETTER NE' where ujis=0xA5CD;
+update t1 set name='U+30CE KATAKANA LETTER NO' where ujis=0xA5CE;
+update t1 set name='U+30CF KATAKANA LETTER HA' where ujis=0xA5CF;
+update t1 set name='U+30D0 KATAKANA LETTER BA' where ujis=0xA5D0;
+update t1 set name='U+30D1 KATAKANA LETTER PA' where ujis=0xA5D1;
+update t1 set name='U+30D2 KATAKANA LETTER HI' where ujis=0xA5D2;
+update t1 set name='U+30D3 KATAKANA LETTER BI' where ujis=0xA5D3;
+update t1 set name='U+30D4 KATAKANA LETTER PI' where ujis=0xA5D4;
+update t1 set name='U+30D5 KATAKANA LETTER HU' where ujis=0xA5D5;
+update t1 set name='U+30D6 KATAKANA LETTER BU' where ujis=0xA5D6;
+update t1 set name='U+30D7 KATAKANA LETTER PU' where ujis=0xA5D7;
+update t1 set name='U+30D8 KATAKANA LETTER HE' where ujis=0xA5D8;
+update t1 set name='U+30D9 KATAKANA LETTER BE' where ujis=0xA5D9;
+update t1 set name='U+30DA KATAKANA LETTER PE' where ujis=0xA5DA;
+update t1 set name='U+30DB KATAKANA LETTER HO' where ujis=0xA5DB;
+update t1 set name='U+30DC KATAKANA LETTER BO' where ujis=0xA5DC;
+update t1 set name='U+30DD KATAKANA LETTER PO' where ujis=0xA5DD;
+update t1 set name='U+30DE KATAKANA LETTER MA' where ujis=0xA5DE;
+update t1 set name='U+30DF KATAKANA LETTER MI' where ujis=0xA5DF;
+update t1 set name='U+30E0 KATAKANA LETTER MU' where ujis=0xA5E0;
+update t1 set name='U+30E1 KATAKANA LETTER ME' where ujis=0xA5E1;
+update t1 set name='U+30E2 KATAKANA LETTER MO' where ujis=0xA5E2;
+update t1 set name='U+30E3 KATAKANA LETTER SMALL YA' where ujis=0xA5E3;
+update t1 set name='U+30E4 KATAKANA LETTER YA' where ujis=0xA5E4;
+update t1 set name='U+30E5 KATAKANA LETTER SMALL YU' where ujis=0xA5E5;
+update t1 set name='U+30E6 KATAKANA LETTER YU' where ujis=0xA5E6;
+update t1 set name='U+30E7 KATAKANA LETTER SMALL YO' where ujis=0xA5E7;
+update t1 set name='U+30E8 KATAKANA LETTER YO' where ujis=0xA5E8;
+update t1 set name='U+30E9 KATAKANA LETTER RA' where ujis=0xA5E9;
+update t1 set name='U+30EA KATAKANA LETTER RI' where ujis=0xA5EA;
+update t1 set name='U+30EB KATAKANA LETTER RU' where ujis=0xA5EB;
+update t1 set name='U+30EC KATAKANA LETTER RE' where ujis=0xA5EC;
+update t1 set name='U+30ED KATAKANA LETTER RO' where ujis=0xA5ED;
+update t1 set name='U+30EE KATAKANA LETTER SMALL WA' where ujis=0xA5EE;
+update t1 set name='U+30EF KATAKANA LETTER WA' where ujis=0xA5EF;
+update t1 set name='U+30F0 KATAKANA LETTER WI' where ujis=0xA5F0;
+update t1 set name='U+30F1 KATAKANA LETTER WE' where ujis=0xA5F1;
+update t1 set name='U+30F2 KATAKANA LETTER WO' where ujis=0xA5F2;
+update t1 set name='U+30F3 KATAKANA LETTER N' where ujis=0xA5F3;
+update t1 set name='U+30F4 KATAKANA LETTER VU' where ujis=0xA5F4;
+update t1 set name='U+30F5 KATAKANA LETTER SMALL KA' where ujis=0xA5F5;
+update t1 set name='U+30F6 KATAKANA LETTER SMALL KE' where ujis=0xA5F6;
+update t1 set name='U+0391 GREEK CAPITAL LETTER ALPHA' where ujis=0xA6A1;
+update t1 set name='U+0392 GREEK CAPITAL LETTER BETA' where ujis=0xA6A2;
+update t1 set name='U+0393 GREEK CAPITAL LETTER GAMMA' where ujis=0xA6A3;
+update t1 set name='U+0394 GREEK CAPITAL LETTER DELTA' where ujis=0xA6A4;
+update t1 set name='U+0395 GREEK CAPITAL LETTER EPSILON' where ujis=0xA6A5;
+update t1 set name='U+0396 GREEK CAPITAL LETTER ZETA' where ujis=0xA6A6;
+update t1 set name='U+0397 GREEK CAPITAL LETTER ETA' where ujis=0xA6A7;
+update t1 set name='U+0398 GREEK CAPITAL LETTER THETA' where ujis=0xA6A8;
+update t1 set name='U+0399 GREEK CAPITAL LETTER IOTA' where ujis=0xA6A9;
+update t1 set name='U+039A GREEK CAPITAL LETTER KAPPA' where ujis=0xA6AA;
+update t1 set name='U+039B GREEK CAPITAL LETTER LAMDA' where ujis=0xA6AB;
+update t1 set name='U+039C GREEK CAPITAL LETTER MU' where ujis=0xA6AC;
+update t1 set name='U+039D GREEK CAPITAL LETTER NU' where ujis=0xA6AD;
+update t1 set name='U+039E GREEK CAPITAL LETTER XI' where ujis=0xA6AE;
+update t1 set name='U+039F GREEK CAPITAL LETTER OMICRON' where ujis=0xA6AF;
+update t1 set name='U+03A0 GREEK CAPITAL LETTER PI' where ujis=0xA6B0;
+update t1 set name='U+03A1 GREEK CAPITAL LETTER RHO' where ujis=0xA6B1;
+update t1 set name='U+03A3 GREEK CAPITAL LETTER SIGMA' where ujis=0xA6B2;
+update t1 set name='U+03A4 GREEK CAPITAL LETTER TAU' where ujis=0xA6B3;
+update t1 set name='U+03A5 GREEK CAPITAL LETTER UPSILON' where ujis=0xA6B4;
+update t1 set name='U+03A6 GREEK CAPITAL LETTER PHI' where ujis=0xA6B5;
+update t1 set name='U+03A7 GREEK CAPITAL LETTER CHI' where ujis=0xA6B6;
+update t1 set name='U+03A8 GREEK CAPITAL LETTER PSI' where ujis=0xA6B7;
+update t1 set name='U+03A9 GREEK CAPITAL LETTER OMEGA' where ujis=0xA6B8;
+update t1 set name='U+03B1 GREEK SMALL LETTER ALPHA' where ujis=0xA6C1;
+update t1 set name='U+03B2 GREEK SMALL LETTER BETA' where ujis=0xA6C2;
+update t1 set name='U+03B3 GREEK SMALL LETTER GAMMA' where ujis=0xA6C3;
+update t1 set name='U+03B4 GREEK SMALL LETTER DELTA' where ujis=0xA6C4;
+update t1 set name='U+03B5 GREEK SMALL LETTER EPSILON' where ujis=0xA6C5;
+update t1 set name='U+03B6 GREEK SMALL LETTER ZETA' where ujis=0xA6C6;
+update t1 set name='U+03B7 GREEK SMALL LETTER ETA' where ujis=0xA6C7;
+update t1 set name='U+03B8 GREEK SMALL LETTER THETA' where ujis=0xA6C8;
+update t1 set name='U+03B9 GREEK SMALL LETTER IOTA' where ujis=0xA6C9;
+update t1 set name='U+03BA GREEK SMALL LETTER KAPPA' where ujis=0xA6CA;
+update t1 set name='U+03BB GREEK SMALL LETTER LAMDA' where ujis=0xA6CB;
+update t1 set name='U+03BC GREEK SMALL LETTER MU' where ujis=0xA6CC;
+update t1 set name='U+03BD GREEK SMALL LETTER NU' where ujis=0xA6CD;
+update t1 set name='U+03BE GREEK SMALL LETTER XI' where ujis=0xA6CE;
+update t1 set name='U+03BF GREEK SMALL LETTER OMICRON' where ujis=0xA6CF;
+update t1 set name='U+03C0 GREEK SMALL LETTER PI' where ujis=0xA6D0;
+update t1 set name='U+03C1 GREEK SMALL LETTER RHO' where ujis=0xA6D1;
+update t1 set name='U+03C3 GREEK SMALL LETTER SIGMA' where ujis=0xA6D2;
+update t1 set name='U+03C4 GREEK SMALL LETTER TAU' where ujis=0xA6D3;
+update t1 set name='U+03C5 GREEK SMALL LETTER UPSILON' where ujis=0xA6D4;
+update t1 set name='U+03C6 GREEK SMALL LETTER PHI' where ujis=0xA6D5;
+update t1 set name='U+03C7 GREEK SMALL LETTER CHI' where ujis=0xA6D6;
+update t1 set name='U+03C8 GREEK SMALL LETTER PSI' where ujis=0xA6D7;
+update t1 set name='U+03C9 GREEK SMALL LETTER OMEGA' where ujis=0xA6D8;
+update t1 set name='U+0410 CYRILLIC CAPITAL LETTER A' where ujis=0xA7A1;
+update t1 set name='U+0411 CYRILLIC CAPITAL LETTER BE' where ujis=0xA7A2;
+update t1 set name='U+0412 CYRILLIC CAPITAL LETTER VE' where ujis=0xA7A3;
+update t1 set name='U+0413 CYRILLIC CAPITAL LETTER GHE' where ujis=0xA7A4;
+update t1 set name='U+0414 CYRILLIC CAPITAL LETTER DE' where ujis=0xA7A5;
+update t1 set name='U+0415 CYRILLIC CAPITAL LETTER IE' where ujis=0xA7A6;
+update t1 set name='U+0401 CYRILLIC CAPITAL LETTER IO' where ujis=0xA7A7;
+update t1 set name='U+0416 CYRILLIC CAPITAL LETTER ZHE' where ujis=0xA7A8;
+update t1 set name='U+0417 CYRILLIC CAPITAL LETTER ZE' where ujis=0xA7A9;
+update t1 set name='U+0418 CYRILLIC CAPITAL LETTER I' where ujis=0xA7AA;
+update t1 set name='U+0419 CYRILLIC CAPITAL LETTER SHORT I' where ujis=0xA7AB;
+update t1 set name='U+041A CYRILLIC CAPITAL LETTER KA' where ujis=0xA7AC;
+update t1 set name='U+041B CYRILLIC CAPITAL LETTER EL' where ujis=0xA7AD;
+update t1 set name='U+041C CYRILLIC CAPITAL LETTER EM' where ujis=0xA7AE;
+update t1 set name='U+041D CYRILLIC CAPITAL LETTER EN' where ujis=0xA7AF;
+update t1 set name='U+041E CYRILLIC CAPITAL LETTER O' where ujis=0xA7B0;
+update t1 set name='U+041F CYRILLIC CAPITAL LETTER PE' where ujis=0xA7B1;
+update t1 set name='U+0420 CYRILLIC CAPITAL LETTER ER' where ujis=0xA7B2;
+update t1 set name='U+0421 CYRILLIC CAPITAL LETTER ES' where ujis=0xA7B3;
+update t1 set name='U+0422 CYRILLIC CAPITAL LETTER TE' where ujis=0xA7B4;
+update t1 set name='U+0423 CYRILLIC CAPITAL LETTER U' where ujis=0xA7B5;
+update t1 set name='U+0424 CYRILLIC CAPITAL LETTER EF' where ujis=0xA7B6;
+update t1 set name='U+0425 CYRILLIC CAPITAL LETTER HA' where ujis=0xA7B7;
+update t1 set name='U+0426 CYRILLIC CAPITAL LETTER TSE' where ujis=0xA7B8;
+update t1 set name='U+0427 CYRILLIC CAPITAL LETTER CHE' where ujis=0xA7B9;
+update t1 set name='U+0428 CYRILLIC CAPITAL LETTER SHA' where ujis=0xA7BA;
+update t1 set name='U+0429 CYRILLIC CAPITAL LETTER SHCHA' where ujis=0xA7BB;
+update t1 set name='U+042A CYRILLIC CAPITAL LETTER HARD SIGN' where ujis=0xA7BC;
+update t1 set name='U+042B CYRILLIC CAPITAL LETTER YERU' where ujis=0xA7BD;
+update t1 set name='U+042C CYRILLIC CAPITAL LETTER SOFT SIGN' where ujis=0xA7BE;
+update t1 set name='U+042D CYRILLIC CAPITAL LETTER E' where ujis=0xA7BF;
+update t1 set name='U+042E CYRILLIC CAPITAL LETTER YU' where ujis=0xA7C0;
+update t1 set name='U+042F CYRILLIC CAPITAL LETTER YA' where ujis=0xA7C1;
+update t1 set name='U+0430 CYRILLIC SMALL LETTER A' where ujis=0xA7D1;
+update t1 set name='U+0431 CYRILLIC SMALL LETTER BE' where ujis=0xA7D2;
+update t1 set name='U+0432 CYRILLIC SMALL LETTER VE' where ujis=0xA7D3;
+update t1 set name='U+0433 CYRILLIC SMALL LETTER GHE' where ujis=0xA7D4;
+update t1 set name='U+0434 CYRILLIC SMALL LETTER DE' where ujis=0xA7D5;
+update t1 set name='U+0435 CYRILLIC SMALL LETTER IE' where ujis=0xA7D6;
+update t1 set name='U+0451 CYRILLIC SMALL LETTER IO' where ujis=0xA7D7;
+update t1 set name='U+0436 CYRILLIC SMALL LETTER ZHE' where ujis=0xA7D8;
+update t1 set name='U+0437 CYRILLIC SMALL LETTER ZE' where ujis=0xA7D9;
+update t1 set name='U+0438 CYRILLIC SMALL LETTER I' where ujis=0xA7DA;
+update t1 set name='U+0439 CYRILLIC SMALL LETTER SHORT I' where ujis=0xA7DB;
+update t1 set name='U+043A CYRILLIC SMALL LETTER KA' where ujis=0xA7DC;
+update t1 set name='U+043B CYRILLIC SMALL LETTER EL' where ujis=0xA7DD;
+update t1 set name='U+043C CYRILLIC SMALL LETTER EM' where ujis=0xA7DE;
+update t1 set name='U+043D CYRILLIC SMALL LETTER EN' where ujis=0xA7DF;
+update t1 set name='U+043E CYRILLIC SMALL LETTER O' where ujis=0xA7E0;
+update t1 set name='U+043F CYRILLIC SMALL LETTER PE' where ujis=0xA7E1;
+update t1 set name='U+0440 CYRILLIC SMALL LETTER ER' where ujis=0xA7E2;
+update t1 set name='U+0441 CYRILLIC SMALL LETTER ES' where ujis=0xA7E3;
+update t1 set name='U+0442 CYRILLIC SMALL LETTER TE' where ujis=0xA7E4;
+update t1 set name='U+0443 CYRILLIC SMALL LETTER U' where ujis=0xA7E5;
+update t1 set name='U+0444 CYRILLIC SMALL LETTER EF' where ujis=0xA7E6;
+update t1 set name='U+0445 CYRILLIC SMALL LETTER HA' where ujis=0xA7E7;
+update t1 set name='U+0446 CYRILLIC SMALL LETTER TSE' where ujis=0xA7E8;
+update t1 set name='U+0447 CYRILLIC SMALL LETTER CHE' where ujis=0xA7E9;
+update t1 set name='U+0448 CYRILLIC SMALL LETTER SHA' where ujis=0xA7EA;
+update t1 set name='U+0449 CYRILLIC SMALL LETTER SHCHA' where ujis=0xA7EB;
+update t1 set name='U+044A CYRILLIC SMALL LETTER HARD SIGN' where ujis=0xA7EC;
+update t1 set name='U+044B CYRILLIC SMALL LETTER YERU' where ujis=0xA7ED;
+update t1 set name='U+044C CYRILLIC SMALL LETTER SOFT SIGN' where ujis=0xA7EE;
+update t1 set name='U+044D CYRILLIC SMALL LETTER E' where ujis=0xA7EF;
+update t1 set name='U+044E CYRILLIC SMALL LETTER YU' where ujis=0xA7F0;
+update t1 set name='U+044F CYRILLIC SMALL LETTER YA' where ujis=0xA7F1;
+update t1 set name='U+2500 BOX DRAWINGS LIGHT HORIZONTAL' where ujis=0xA8A1;
+update t1 set name='U+2502 BOX DRAWINGS LIGHT VERTICAL' where ujis=0xA8A2;
+update t1 set name='U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT' where ujis=0xA8A3;
+update t1 set name='U+2510 BOX DRAWINGS LIGHT DOWN AND LEFT' where ujis=0xA8A4;
+update t1 set name='U+2518 BOX DRAWINGS LIGHT UP AND LEFT' where ujis=0xA8A5;
+update t1 set name='U+2514 BOX DRAWINGS LIGHT UP AND RIGHT' where ujis=0xA8A6;
+update t1 set name='U+251C BOX DRAWINGS LIGHT VERTICAL AND RIGHT' where ujis=0xA8A7;
+update t1 set name='U+252C BOX DRAWINGS LIGHT DOWN AND HORIZONTAL' where ujis=0xA8A8;
+update t1 set name='U+2524 BOX DRAWINGS LIGHT VERTICAL AND LEFT' where ujis=0xA8A9;
+update t1 set name='U+2534 BOX DRAWINGS LIGHT UP AND HORIZONTAL' where ujis=0xA8AA;
+update t1 set name='U+253C BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL' where ujis=0xA8AB;
+update t1 set name='U+2501 BOX DRAWINGS HEAVY HORIZONTAL' where ujis=0xA8AC;
+update t1 set name='U+2503 BOX DRAWINGS HEAVY VERTICAL' where ujis=0xA8AD;
+update t1 set name='U+250F BOX DRAWINGS HEAVY DOWN AND RIGHT' where ujis=0xA8AE;
+update t1 set name='U+2513 BOX DRAWINGS HEAVY DOWN AND LEFT' where ujis=0xA8AF;
+update t1 set name='U+251B BOX DRAWINGS HEAVY UP AND LEFT' where ujis=0xA8B0;
+update t1 set name='U+2517 BOX DRAWINGS HEAVY UP AND RIGHT' where ujis=0xA8B1;
+update t1 set name='U+2523 BOX DRAWINGS HEAVY VERTICAL AND RIGHT' where ujis=0xA8B2;
+update t1 set name='U+2533 BOX DRAWINGS HEAVY DOWN AND HORIZONTAL' where ujis=0xA8B3;
+update t1 set name='U+252B BOX DRAWINGS HEAVY VERTICAL AND LEFT' where ujis=0xA8B4;
+update t1 set name='U+253B BOX DRAWINGS HEAVY UP AND HORIZONTAL' where ujis=0xA8B5;
+update t1 set name='U+254B BOX DRAWINGS HEAVY VERTICAL AND HORIZONTAL' where ujis=0xA8B6;
+update t1 set name='U+2520 BOX DRAWINGS VERTICAL HEAVY AND RIGHT LIGHT' where ujis=0xA8B7;
+update t1 set name='U+252F BOX DRAWINGS DOWN LIGHT AND HORIZONTAL HEAVY' where ujis=0xA8B8;
+update t1 set name='U+2528 BOX DRAWINGS VERTICAL HEAVY AND LEFT LIGHT' where ujis=0xA8B9;
+update t1 set name='U+2537 BOX DRAWINGS UP LIGHT AND HORIZONTAL HEAVY' where ujis=0xA8BA;
+update t1 set name='U+253F BOX DRAWINGS VERTICAL LIGHT AND HORIZONTAL HEAVY' where ujis=0xA8BB;
+update t1 set name='U+251D BOX DRAWINGS VERTICAL LIGHT AND RIGHT HEAVY' where ujis=0xA8BC;
+update t1 set name='U+2530 BOX DRAWINGS DOWN HEAVY AND HORIZONTAL LIGHT' where ujis=0xA8BD;
+update t1 set name='U+2525 BOX DRAWINGS VERTICAL LIGHT AND LEFT HEAVY' where ujis=0xA8BE;
+update t1 set name='U+2538 BOX DRAWINGS UP HEAVY AND HORIZONTAL LIGHT' where ujis=0xA8BF;
+update t1 set name='U+2542 BOX DRAWINGS VERTICAL HEAVY AND HORIZONTAL LIGHT' where ujis=0xA8C0;
+
+#
+# [B0..BF][A1..FE] - 16*94=1504 codes assigned
+#
+update t1 set name='<CJK>' where ujis >= 0xB0A1 AND ujis <= 0xBFFE;
+
+#
+# [C0..CE][A1..FE] = 15*94=1410 codes assigned
+#
+update t1 set name='<CJK>' where ujis >= 0xC0A1 AND ujis <= 0xCEFE;
+
+#
+# 0xCFxx - 51 codes assigned
+#
+update t1 set name='U+84EE <CJK>' where ujis=0xCFA1;
+update t1 set name='U+9023 <CJK>' where ujis=0xCFA2;
+update t1 set name='U+932C <CJK>' where ujis=0xCFA3;
+update t1 set name='U+5442 <CJK>' where ujis=0xCFA4;
+update t1 set name='U+9B6F <CJK>' where ujis=0xCFA5;
+update t1 set name='U+6AD3 <CJK>' where ujis=0xCFA6;
+update t1 set name='U+7089 <CJK>' where ujis=0xCFA7;
+update t1 set name='U+8CC2 <CJK>' where ujis=0xCFA8;
+update t1 set name='U+8DEF <CJK>' where ujis=0xCFA9;
+update t1 set name='U+9732 <CJK>' where ujis=0xCFAA;
+update t1 set name='U+52B4 <CJK>' where ujis=0xCFAB;
+update t1 set name='U+5A41 <CJK>' where ujis=0xCFAC;
+update t1 set name='U+5ECA <CJK>' where ujis=0xCFAD;
+update t1 set name='U+5F04 <CJK>' where ujis=0xCFAE;
+update t1 set name='U+6717 <CJK>' where ujis=0xCFAF;
+update t1 set name='U+697C <CJK>' where ujis=0xCFB0;
+update t1 set name='U+6994 <CJK>' where ujis=0xCFB1;
+update t1 set name='U+6D6A <CJK>' where ujis=0xCFB2;
+update t1 set name='U+6F0F <CJK>' where ujis=0xCFB3;
+update t1 set name='U+7262 <CJK>' where ujis=0xCFB4;
+update t1 set name='U+72FC <CJK>' where ujis=0xCFB5;
+update t1 set name='U+7BED <CJK>' where ujis=0xCFB6;
+update t1 set name='U+8001 <CJK>' where ujis=0xCFB7;
+update t1 set name='U+807E <CJK>' where ujis=0xCFB8;
+update t1 set name='U+874B <CJK>' where ujis=0xCFB9;
+update t1 set name='U+90CE <CJK>' where ujis=0xCFBA;
+update t1 set name='U+516D <CJK>' where ujis=0xCFBB;
+update t1 set name='U+9E93 <CJK>' where ujis=0xCFBC;
+update t1 set name='U+7984 <CJK>' where ujis=0xCFBD;
+update t1 set name='U+808B <CJK>' where ujis=0xCFBE;
+update t1 set name='U+9332 <CJK>' where ujis=0xCFBF;
+update t1 set name='U+8AD6 <CJK>' where ujis=0xCFC0;
+update t1 set name='U+502D <CJK>' where ujis=0xCFC1;
+update t1 set name='U+548C <CJK>' where ujis=0xCFC2;
+update t1 set name='U+8A71 <CJK>' where ujis=0xCFC3;
+update t1 set name='U+6B6A <CJK>' where ujis=0xCFC4;
+update t1 set name='U+8CC4 <CJK>' where ujis=0xCFC5;
+update t1 set name='U+8107 <CJK>' where ujis=0xCFC6;
+update t1 set name='U+60D1 <CJK>' where ujis=0xCFC7;
+update t1 set name='U+67A0 <CJK>' where ujis=0xCFC8;
+update t1 set name='U+9DF2 <CJK>' where ujis=0xCFC9;
+update t1 set name='U+4E99 <CJK>' where ujis=0xCFCA;
+update t1 set name='U+4E98 <CJK>' where ujis=0xCFCB;
+update t1 set name='U+9C10 <CJK>' where ujis=0xCFCC;
+update t1 set name='U+8A6B <CJK>' where ujis=0xCFCD;
+update t1 set name='U+85C1 <CJK>' where ujis=0xCFCE;
+update t1 set name='U+8568 <CJK>' where ujis=0xCFCF;
+update t1 set name='U+6900 <CJK>' where ujis=0xCFD0;
+update t1 set name='U+6E7E <CJK>' where ujis=0xCFD1;
+update t1 set name='U+7897 <CJK>' where ujis=0xCFD2;
+update t1 set name='U+8155 <CJK>' where ujis=0xCFD3;
+
+#
+# [D0..DF][A1..FE] - all 16*94=1504 codes assigned
+#
+update t1 set name='<CJK>' where ujis >= 0xD0A1 AND ujis <= 0xDFFE;
+
+#
+# [E0..EF][A1..FE] - all codes assigned, 16*94=1504 total
+#
+update t1 set name='<CJK>' where ujis >= 0xE0A1 AND ujis <= 0xEFFE;
+
+#
+# [F0..F3][A1..FE] - all codes assigned, 4*94=376 total
+#
+update t1 set name='<CJK>' where ujis >= 0xF0A1 AND ujis <= 0xF3FE;
+
+# 0xF4xx - six codes assigned
+update t1 set name='U+582F <CJK>' where ujis=0xF4A1;
+update t1 set name='U+69C7 <CJK>' where ujis=0xF4A2;
+update t1 set name='U+9059 <CJK>' where ujis=0xF4A3;
+update t1 set name='U+7464 <CJK>' where ujis=0xF4A4;
+update t1 set name='U+51DC <CJK>' where ujis=0xF4A5;
+update t1 set name='U+7199 <CJK>' where ujis=0xF4A6;
+
+# [F5..FE][A1..FE] - User defined range
+update t1 set name='User defined range #1' where ujis >= 0xF5A1 AND ujis <= 0xFEFE;
+
+
+# A character from the upper half of JIS-X-0201
+# (half-width kana, code set 2)
+# is represented by two bytes:
+# the first being 0x8E,
+# the second in the range 0xA1 - 0xDF.
+# Codes according to:
+# ftp://ftp.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/JIS/JIS0201.TXT
+
+insert into t1 (ujis,name) values (0x8EA1,'U+FF61 HALFWIDTH IDEOGRAPHIC FULL STOP');
+insert into t1 (ujis,name) values (0x8EA2,'U+FF62 HALFWIDTH LEFT CORNER BRACKET');
+insert into t1 (ujis,name) values (0x8EA3,'U+FF63 HALFWIDTH RIGHT CORNER BRACKET');
+insert into t1 (ujis,name) values (0x8EA4,'U+FF64 HALFWIDTH IDEOGRAPHIC COMMA');
+insert into t1 (ujis,name) values (0x8EA5,'U+FF65 HALFWIDTH KATAKANA MIDDLE DOT');
+insert into t1 (ujis,name) values (0x8EA6,'U+FF66 HALFWIDTH KATAKANA LETTER WO');
+insert into t1 (ujis,name) values (0x8EA7,'U+FF67 HALFWIDTH KATAKANA LETTER SMALL A');
+insert into t1 (ujis,name) values (0x8EA8,'U+FF68 HALFWIDTH KATAKANA LETTER SMALL I');
+insert into t1 (ujis,name) values (0x8EA9,'U+FF69 HALFWIDTH KATAKANA LETTER SMALL U');
+insert into t1 (ujis,name) values (0x8EAA,'U+FF6A HALFWIDTH KATAKANA LETTER SMALL E');
+insert into t1 (ujis,name) values (0x8EAB,'U+FF6B HALFWIDTH KATAKANA LETTER SMALL O');
+insert into t1 (ujis,name) values (0x8EAC,'U+FF6C HALFWIDTH KATAKANA LETTER SMALL YA');
+insert into t1 (ujis,name) values (0x8EAD,'U+FF6D HALFWIDTH KATAKANA LETTER SMALL YU');
+insert into t1 (ujis,name) values (0x8EAE,'U+FF6E HALFWIDTH KATAKANA LETTER SMALL YO');
+insert into t1 (ujis,name) values (0x8EAF,'U+FF6F HALFWIDTH KATAKANA LETTER SMALL TU');
+insert into t1 (ujis,name) values (0x8EB0,'U+FF70 HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK');
+insert into t1 (ujis,name) values (0x8EB1,'U+FF71 HALFWIDTH KATAKANA LETTER A');
+insert into t1 (ujis,name) values (0x8EB2,'U+FF72 HALFWIDTH KATAKANA LETTER I');
+insert into t1 (ujis,name) values (0x8EB3,'U+FF73 HALFWIDTH KATAKANA LETTER U');
+insert into t1 (ujis,name) values (0x8EB4,'U+FF74 HALFWIDTH KATAKANA LETTER E');
+insert into t1 (ujis,name) values (0x8EB5,'U+FF75 HALFWIDTH KATAKANA LETTER O');
+insert into t1 (ujis,name) values (0x8EB6,'U+FF76 HALFWIDTH KATAKANA LETTER KA');
+insert into t1 (ujis,name) values (0x8EB7,'U+FF77 HALFWIDTH KATAKANA LETTER KI');
+insert into t1 (ujis,name) values (0x8EB8,'U+FF78 HALFWIDTH KATAKANA LETTER KU');
+insert into t1 (ujis,name) values (0x8EB9,'U+FF79 HALFWIDTH KATAKANA LETTER KE');
+insert into t1 (ujis,name) values (0x8EBA,'U+FF7A HALFWIDTH KATAKANA LETTER KO');
+insert into t1 (ujis,name) values (0x8EBB,'U+FF7B HALFWIDTH KATAKANA LETTER SA');
+insert into t1 (ujis,name) values (0x8EBC,'U+FF7C HALFWIDTH KATAKANA LETTER SI');
+insert into t1 (ujis,name) values (0x8EBD,'U+FF7D HALFWIDTH KATAKANA LETTER SU');
+insert into t1 (ujis,name) values (0x8EBE,'U+FF7E HALFWIDTH KATAKANA LETTER SE');
+insert into t1 (ujis,name) values (0x8EBF,'U+FF7F HALFWIDTH KATAKANA LETTER SO');
+insert into t1 (ujis,name) values (0x8EC0,'U+FF80 HALFWIDTH KATAKANA LETTER TA');
+insert into t1 (ujis,name) values (0x8EC1,'U+FF81 HALFWIDTH KATAKANA LETTER TI');
+insert into t1 (ujis,name) values (0x8EC2,'U+FF82 HALFWIDTH KATAKANA LETTER TU');
+insert into t1 (ujis,name) values (0x8EC3,'U+FF83 HALFWIDTH KATAKANA LETTER TE');
+insert into t1 (ujis,name) values (0x8EC4,'U+FF84 HALFWIDTH KATAKANA LETTER TO');
+insert into t1 (ujis,name) values (0x8EC5,'U+FF85 HALFWIDTH KATAKANA LETTER NA');
+insert into t1 (ujis,name) values (0x8EC6,'U+FF86 HALFWIDTH KATAKANA LETTER NI');
+insert into t1 (ujis,name) values (0x8EC7,'U+FF87 HALFWIDTH KATAKANA LETTER NU');
+insert into t1 (ujis,name) values (0x8EC8,'U+FF88 HALFWIDTH KATAKANA LETTER NE');
+insert into t1 (ujis,name) values (0x8EC9,'U+FF89 HALFWIDTH KATAKANA LETTER NO');
+insert into t1 (ujis,name) values (0x8ECA,'U+FF8A HALFWIDTH KATAKANA LETTER HA');
+insert into t1 (ujis,name) values (0x8ECB,'U+FF8B HALFWIDTH KATAKANA LETTER HI');
+insert into t1 (ujis,name) values (0x8ECC,'U+FF8C HALFWIDTH KATAKANA LETTER HU');
+insert into t1 (ujis,name) values (0x8ECD,'U+FF8D HALFWIDTH KATAKANA LETTER HE');
+insert into t1 (ujis,name) values (0x8ECE,'U+FF8E HALFWIDTH KATAKANA LETTER HO');
+insert into t1 (ujis,name) values (0x8ECF,'U+FF8F HALFWIDTH KATAKANA LETTER MA');
+insert into t1 (ujis,name) values (0x8ED0,'U+FF90 HALFWIDTH KATAKANA LETTER MI');
+insert into t1 (ujis,name) values (0x8ED1,'U+FF91 HALFWIDTH KATAKANA LETTER MU');
+insert into t1 (ujis,name) values (0x8ED2,'U+FF92 HALFWIDTH KATAKANA LETTER ME');
+insert into t1 (ujis,name) values (0x8ED3,'U+FF93 HALFWIDTH KATAKANA LETTER MO');
+insert into t1 (ujis,name) values (0x8ED4,'U+FF94 HALFWIDTH KATAKANA LETTER YA');
+insert into t1 (ujis,name) values (0x8ED5,'U+FF95 HALFWIDTH KATAKANA LETTER YU');
+insert into t1 (ujis,name) values (0x8ED6,'U+FF96 HALFWIDTH KATAKANA LETTER YO');
+insert into t1 (ujis,name) values (0x8ED7,'U+FF97 HALFWIDTH KATAKANA LETTER RA');
+insert into t1 (ujis,name) values (0x8ED8,'U+FF98 HALFWIDTH KATAKANA LETTER RI');
+insert into t1 (ujis,name) values (0x8ED9,'U+FF99 HALFWIDTH KATAKANA LETTER RU');
+insert into t1 (ujis,name) values (0x8EDA,'U+FF9A HALFWIDTH KATAKANA LETTER RE');
+insert into t1 (ujis,name) values (0x8EDB,'U+FF9B HALFWIDTH KATAKANA LETTER RO');
+insert into t1 (ujis,name) values (0x8EDC,'U+FF9C HALFWIDTH KATAKANA LETTER WA');
+insert into t1 (ujis,name) values (0x8EDD,'U+FF9D HALFWIDTH KATAKANA LETTER N');
+insert into t1 (ujis,name) values (0x8EDE,'U+FF9E HALFWIDTH KATAKANA VOICED SOUND MARK');
+insert into t1 (ujis,name) values (0x8EDF,'U+FF9F HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK');
+
+
+#
+# A character from JIS-X-0212 (code set 3)
+# is represented by three bytes,
+# the first being 0x8F,
+# the following two in the range 0xA1 - 0xFE.
+# ftp://ftp.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/JIS/JIS0212.TXT
+#
+# Fill table t1 with codes [8F][A1..FE][A1..FE] using helper table t2,
+# 8836 codes total
+#
+insert into t1 (ujis) select concat(0x8F,t21.code,t22.code) from t2 t21, t2 t22 order by 1;
+
+update t1 set name='U+02D8 BREVE' where ujis=0x8FA2AF;
+update t1 set name='U+02C7 CARON (Mandarin Chinese third tone)' where ujis=0x8FA2B0;
+update t1 set name='U+00B8 CEDILLA' where ujis=0x8FA2B1;
+update t1 set name='U+02D9 DOT ABOVE (Mandarin Chinese light tone)' where ujis=0x8FA2B2;
+update t1 set name='U+02DD DOUBLE ACUTE ACCENT' where ujis=0x8FA2B3;
+update t1 set name='U+00AF MACRON' where ujis=0x8FA2B4;
+update t1 set name='U+02DB OGONEK' where ujis=0x8FA2B5;
+update t1 set name='U+02DA RING ABOVE' where ujis=0x8FA2B6;
+update t1 set name='U+007E TILDE' where ujis=0x8FA2B7;
+update t1 set name='U+0384 GREEK TONOS' where ujis=0x8FA2B8;
+update t1 set name='U+0385 GREEK DIALYTIKA TONOS' where ujis=0x8FA2B9;
+update t1 set name='U+00A1 INVERTED EXCLAMATION MARK' where ujis=0x8FA2C2;
+update t1 set name='U+00A6 BROKEN BAR' where ujis=0x8FA2C3;
+update t1 set name='U+00BF INVERTED QUESTION MARK' where ujis=0x8FA2C4;
+update t1 set name='U+00BA MASCULINE ORDINAL INDICATOR' where ujis=0x8FA2EB;
+update t1 set name='U+00AA FEMININE ORDINAL INDICATOR' where ujis=0x8FA2EC;
+update t1 set name='U+00A9 COPYRIGHT SIGN' where ujis=0x8FA2ED;
+update t1 set name='U+00AE REGISTERED SIGN' where ujis=0x8FA2EE;
+update t1 set name='U+2122 TRADE MARK SIGN' where ujis=0x8FA2EF;
+update t1 set name='U+00A4 CURRENCY SIGN' where ujis=0x8FA2F0;
+update t1 set name='U+2116 NUMERO SIGN' where ujis=0x8FA2F1;
+update t1 set name='U+0386 GREEK CAPITAL LETTER ALPHA WITH TONOS' where ujis=0x8FA6E1;
+update t1 set name='U+0388 GREEK CAPITAL LETTER EPSILON WITH TONOS' where ujis=0x8FA6E2;
+update t1 set name='U+0389 GREEK CAPITAL LETTER ETA WITH TONOS' where ujis=0x8FA6E3;
+update t1 set name='U+038A GREEK CAPITAL LETTER IOTA WITH TONOS' where ujis=0x8FA6E4;
+update t1 set name='U+03AA GREEK CAPITAL LETTER IOTA WITH DIALYTIKA' where ujis=0x8FA6E5;
+update t1 set name='U+038C GREEK CAPITAL LETTER OMICRON WITH TONOS' where ujis=0x8FA6E7;
+update t1 set name='U+038E GREEK CAPITAL LETTER UPSILON WITH TONOS' where ujis=0x8FA6E9;
+update t1 set name='U+03AB GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA' where ujis=0x8FA6EA;
+update t1 set name='U+038F GREEK CAPITAL LETTER OMEGA WITH TONOS' where ujis=0x8FA6EC;
+update t1 set name='U+03AC GREEK SMALL LETTER ALPHA WITH TONOS' where ujis=0x8FA6F1;
+update t1 set name='U+03AD GREEK SMALL LETTER EPSILON WITH TONOS' where ujis=0x8FA6F2;
+update t1 set name='U+03AE GREEK SMALL LETTER ETA WITH TONOS' where ujis=0x8FA6F3;
+update t1 set name='U+03AF GREEK SMALL LETTER IOTA WITH TONOS' where ujis=0x8FA6F4;
+update t1 set name='U+03CA GREEK SMALL LETTER IOTA WITH DIALYTIKA' where ujis=0x8FA6F5;
+update t1 set name='U+0390 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS' where ujis=0x8FA6F6;
+update t1 set name='U+03CC GREEK SMALL LETTER OMICRON WITH TONOS' where ujis=0x8FA6F7;
+update t1 set name='U+03C2 GREEK SMALL LETTER FINAL SIGMA' where ujis=0x8FA6F8;
+update t1 set name='U+03CD GREEK SMALL LETTER UPSILON WITH TONOS' where ujis=0x8FA6F9;
+update t1 set name='U+03CB GREEK SMALL LETTER UPSILON WITH DIALYTIKA' where ujis=0x8FA6FA;
+update t1 set name='U+03B0 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS' where ujis=0x8FA6FB;
+update t1 set name='U+03CE GREEK SMALL LETTER OMEGA WITH TONOS' where ujis=0x8FA6FC;
+update t1 set name='U+0402 CYRILLIC CAPITAL LETTER DJE' where ujis=0x8FA7C2;
+update t1 set name='U+0403 CYRILLIC CAPITAL LETTER GJE' where ujis=0x8FA7C3;
+update t1 set name='U+0404 CYRILLIC CAPITAL LETTER UKRAINIAN IE' where ujis=0x8FA7C4;
+update t1 set name='U+0405 CYRILLIC CAPITAL LETTER DZE' where ujis=0x8FA7C5;
+update t1 set name='U+0406 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I' where ujis=0x8FA7C6;
+update t1 set name='U+0407 CYRILLIC CAPITAL LETTER YI' where ujis=0x8FA7C7;
+update t1 set name='U+0408 CYRILLIC CAPITAL LETTER JE' where ujis=0x8FA7C8;
+update t1 set name='U+0409 CYRILLIC CAPITAL LETTER LJE' where ujis=0x8FA7C9;
+update t1 set name='U+040A CYRILLIC CAPITAL LETTER NJE' where ujis=0x8FA7CA;
+update t1 set name='U+040B CYRILLIC CAPITAL LETTER TSHE' where ujis=0x8FA7CB;
+update t1 set name='U+040C CYRILLIC CAPITAL LETTER KJE' where ujis=0x8FA7CC;
+update t1 set name='U+040E CYRILLIC CAPITAL LETTER SHORT U' where ujis=0x8FA7CD;
+update t1 set name='U+040F CYRILLIC CAPITAL LETTER DZHE' where ujis=0x8FA7CE;
+update t1 set name='U+0452 CYRILLIC SMALL LETTER DJE' where ujis=0x8FA7F2;
+update t1 set name='U+0453 CYRILLIC SMALL LETTER GJE' where ujis=0x8FA7F3;
+update t1 set name='U+0454 CYRILLIC SMALL LETTER UKRAINIAN IE' where ujis=0x8FA7F4;
+update t1 set name='U+0455 CYRILLIC SMALL LETTER DZE' where ujis=0x8FA7F5;
+update t1 set name='U+0456 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I' where ujis=0x8FA7F6;
+update t1 set name='U+0457 CYRILLIC SMALL LETTER YI' where ujis=0x8FA7F7;
+update t1 set name='U+0458 CYRILLIC SMALL LETTER JE' where ujis=0x8FA7F8;
+update t1 set name='U+0459 CYRILLIC SMALL LETTER LJE' where ujis=0x8FA7F9;
+update t1 set name='U+045A CYRILLIC SMALL LETTER NJE' where ujis=0x8FA7FA;
+update t1 set name='U+045B CYRILLIC SMALL LETTER TSHE' where ujis=0x8FA7FB;
+update t1 set name='U+045C CYRILLIC SMALL LETTER KJE' where ujis=0x8FA7FC;
+update t1 set name='U+045E CYRILLIC SMALL LETTER SHORT U' where ujis=0x8FA7FD;
+update t1 set name='U+045F CYRILLIC SMALL LETTER DZHE' where ujis=0x8FA7FE;
+update t1 set name='U+00C6 LATIN CAPITAL LIGATURE AE' where ujis=0x8FA9A1;
+update t1 set name='U+0110 LATIN CAPITAL LETTER D WITH STROKE' where ujis=0x8FA9A2;
+update t1 set name='U+0126 LATIN CAPITAL LETTER H WITH STROKE' where ujis=0x8FA9A4;
+update t1 set name='U+0132 LATIN CAPITAL LIGATURE IJ' where ujis=0x8FA9A6;
+update t1 set name='U+0141 LATIN CAPITAL LETTER L WITH STROKE' where ujis=0x8FA9A8;
+update t1 set name='U+013F LATIN CAPITAL LETTER L WITH MIDDLE DOT' where ujis=0x8FA9A9;
+update t1 set name='U+014A LATIN CAPITAL LETTER ENG' where ujis=0x8FA9AB;
+update t1 set name='U+00D8 LATIN CAPITAL LETTER O WITH STROKE' where ujis=0x8FA9AC;
+update t1 set name='U+0152 LATIN CAPITAL LIGATURE OE' where ujis=0x8FA9AD;
+update t1 set name='U+0166 LATIN CAPITAL LETTER T WITH STROKE' where ujis=0x8FA9AF;
+update t1 set name='U+00DE LATIN CAPITAL LETTER THORN' where ujis=0x8FA9B0;
+update t1 set name='U+00E6 LATIN SMALL LIGATURE AE' where ujis=0x8FA9C1;
+update t1 set name='U+0111 LATIN SMALL LETTER D WITH STROKE' where ujis=0x8FA9C2;
+update t1 set name='U+00F0 LATIN SMALL LETTER ETH' where ujis=0x8FA9C3;
+update t1 set name='U+0127 LATIN SMALL LETTER H WITH STROKE' where ujis=0x8FA9C4;
+update t1 set name='U+0131 LATIN SMALL LETTER DOTLESS I' where ujis=0x8FA9C5;
+update t1 set name='U+0133 LATIN SMALL LIGATURE IJ' where ujis=0x8FA9C6;
+update t1 set name='U+0138 LATIN SMALL LETTER KRA' where ujis=0x8FA9C7;
+update t1 set name='U+0142 LATIN SMALL LETTER L WITH STROKE' where ujis=0x8FA9C8;
+update t1 set name='U+0140 LATIN SMALL LETTER L WITH MIDDLE DOT' where ujis=0x8FA9C9;
+update t1 set name='U+0149 LATIN SMALL LETTER N PRECEDED BY APOSTROPHE' where ujis=0x8FA9CA;
+update t1 set name='U+014B LATIN SMALL LETTER ENG' where ujis=0x8FA9CB;
+update t1 set name='U+00F8 LATIN SMALL LETTER O WITH STROKE' where ujis=0x8FA9CC;
+update t1 set name='U+0153 LATIN SMALL LIGATURE OE' where ujis=0x8FA9CD;
+update t1 set name='U+00DF LATIN SMALL LETTER SHARP S' where ujis=0x8FA9CE;
+update t1 set name='U+0167 LATIN SMALL LETTER T WITH STROKE' where ujis=0x8FA9CF;
+update t1 set name='U+00FE LATIN SMALL LETTER THORN' where ujis=0x8FA9D0;
+update t1 set name='U+00C1 LATIN CAPITAL LETTER A WITH ACUTE' where ujis=0x8FAAA1;
+update t1 set name='U+00C0 LATIN CAPITAL LETTER A WITH GRAVE' where ujis=0x8FAAA2;
+update t1 set name='U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS' where ujis=0x8FAAA3;
+update t1 set name='U+00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX' where ujis=0x8FAAA4;
+update t1 set name='U+0102 LATIN CAPITAL LETTER A WITH BREVE' where ujis=0x8FAAA5;
+update t1 set name='U+01CD LATIN CAPITAL LETTER A WITH CARON' where ujis=0x8FAAA6;
+update t1 set name='U+0100 LATIN CAPITAL LETTER A WITH MACRON' where ujis=0x8FAAA7;
+update t1 set name='U+0104 LATIN CAPITAL LETTER A WITH OGONEK' where ujis=0x8FAAA8;
+update t1 set name='U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE' where ujis=0x8FAAA9;
+update t1 set name='U+00C3 LATIN CAPITAL LETTER A WITH TILDE' where ujis=0x8FAAAA;
+update t1 set name='U+0106 LATIN CAPITAL LETTER C WITH ACUTE' where ujis=0x8FAAAB;
+update t1 set name='U+0108 LATIN CAPITAL LETTER C WITH CIRCUMFLEX' where ujis=0x8FAAAC;
+update t1 set name='U+010C LATIN CAPITAL LETTER C WITH CARON' where ujis=0x8FAAAD;
+update t1 set name='U+00C7 LATIN CAPITAL LETTER C WITH CEDILLA' where ujis=0x8FAAAE;
+update t1 set name='U+010A LATIN CAPITAL LETTER C WITH DOT ABOVE' where ujis=0x8FAAAF;
+update t1 set name='U+010E LATIN CAPITAL LETTER D WITH CARON' where ujis=0x8FAAB0;
+update t1 set name='U+00C9 LATIN CAPITAL LETTER E WITH ACUTE' where ujis=0x8FAAB1;
+update t1 set name='U+00C8 LATIN CAPITAL LETTER E WITH GRAVE' where ujis=0x8FAAB2;
+update t1 set name='U+00CB LATIN CAPITAL LETTER E WITH DIAERESIS' where ujis=0x8FAAB3;
+update t1 set name='U+00CA LATIN CAPITAL LETTER E WITH CIRCUMFLEX' where ujis=0x8FAAB4;
+update t1 set name='U+011A LATIN CAPITAL LETTER E WITH CARON' where ujis=0x8FAAB5;
+update t1 set name='U+0116 LATIN CAPITAL LETTER E WITH DOT ABOVE' where ujis=0x8FAAB6;
+update t1 set name='U+0112 LATIN CAPITAL LETTER E WITH MACRON' where ujis=0x8FAAB7;
+update t1 set name='U+0118 LATIN CAPITAL LETTER E WITH OGONEK' where ujis=0x8FAAB8;
+update t1 set name='U+011C LATIN CAPITAL LETTER G WITH CIRCUMFLEX' where ujis=0x8FAABA;
+update t1 set name='U+011E LATIN CAPITAL LETTER G WITH BREVE' where ujis=0x8FAABB;
+update t1 set name='U+0122 LATIN CAPITAL LETTER G WITH CEDILLA' where ujis=0x8FAABC;
+update t1 set name='U+0120 LATIN CAPITAL LETTER G WITH DOT ABOVE' where ujis=0x8FAABD;
+update t1 set name='U+0124 LATIN CAPITAL LETTER H WITH CIRCUMFLEX' where ujis=0x8FAABE;
+update t1 set name='U+00CD LATIN CAPITAL LETTER I WITH ACUTE' where ujis=0x8FAABF;
+update t1 set name='U+00CC LATIN CAPITAL LETTER I WITH GRAVE' where ujis=0x8FAAC0;
+update t1 set name='U+00CF LATIN CAPITAL LETTER I WITH DIAERESIS' where ujis=0x8FAAC1;
+update t1 set name='U+00CE LATIN CAPITAL LETTER I WITH CIRCUMFLEX' where ujis=0x8FAAC2;
+update t1 set name='U+01CF LATIN CAPITAL LETTER I WITH CARON' where ujis=0x8FAAC3;
+update t1 set name='U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE' where ujis=0x8FAAC4;
+update t1 set name='U+012A LATIN CAPITAL LETTER I WITH MACRON' where ujis=0x8FAAC5;
+update t1 set name='U+012E LATIN CAPITAL LETTER I WITH OGONEK' where ujis=0x8FAAC6;
+update t1 set name='U+0128 LATIN CAPITAL LETTER I WITH TILDE' where ujis=0x8FAAC7;
+update t1 set name='U+0134 LATIN CAPITAL LETTER J WITH CIRCUMFLEX' where ujis=0x8FAAC8;
+update t1 set name='U+0136 LATIN CAPITAL LETTER K WITH CEDILLA' where ujis=0x8FAAC9;
+update t1 set name='U+0139 LATIN CAPITAL LETTER L WITH ACUTE' where ujis=0x8FAACA;
+update t1 set name='U+013D LATIN CAPITAL LETTER L WITH CARON' where ujis=0x8FAACB;
+update t1 set name='U+013B LATIN CAPITAL LETTER L WITH CEDILLA' where ujis=0x8FAACC;
+update t1 set name='U+0143 LATIN CAPITAL LETTER N WITH ACUTE' where ujis=0x8FAACD;
+update t1 set name='U+0147 LATIN CAPITAL LETTER N WITH CARON' where ujis=0x8FAACE;
+update t1 set name='U+0145 LATIN CAPITAL LETTER N WITH CEDILLA' where ujis=0x8FAACF;
+update t1 set name='U+00D1 LATIN CAPITAL LETTER N WITH TILDE' where ujis=0x8FAAD0;
+update t1 set name='U+00D3 LATIN CAPITAL LETTER O WITH ACUTE' where ujis=0x8FAAD1;
+update t1 set name='U+00D2 LATIN CAPITAL LETTER O WITH GRAVE' where ujis=0x8FAAD2;
+update t1 set name='U+00D6 LATIN CAPITAL LETTER O WITH DIAERESIS' where ujis=0x8FAAD3;
+update t1 set name='U+00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX' where ujis=0x8FAAD4;
+update t1 set name='U+01D1 LATIN CAPITAL LETTER O WITH CARON' where ujis=0x8FAAD5;
+update t1 set name='U+0150 LATIN CAPITAL LETTER O WITH DOUBLE ACUTE' where ujis=0x8FAAD6;
+update t1 set name='U+014C LATIN CAPITAL LETTER O WITH MACRON' where ujis=0x8FAAD7;
+update t1 set name='U+00D5 LATIN CAPITAL LETTER O WITH TILDE' where ujis=0x8FAAD8;
+update t1 set name='U+0154 LATIN CAPITAL LETTER R WITH ACUTE' where ujis=0x8FAAD9;
+update t1 set name='U+0158 LATIN CAPITAL LETTER R WITH CARON' where ujis=0x8FAADA;
+update t1 set name='U+0156 LATIN CAPITAL LETTER R WITH CEDILLA' where ujis=0x8FAADB;
+update t1 set name='U+015A LATIN CAPITAL LETTER S WITH ACUTE' where ujis=0x8FAADC;
+update t1 set name='U+015C LATIN CAPITAL LETTER S WITH CIRCUMFLEX' where ujis=0x8FAADD;
+update t1 set name='U+0160 LATIN CAPITAL LETTER S WITH CARON' where ujis=0x8FAADE;
+update t1 set name='U+015E LATIN CAPITAL LETTER S WITH CEDILLA' where ujis=0x8FAADF;
+update t1 set name='U+0164 LATIN CAPITAL LETTER T WITH CARON' where ujis=0x8FAAE0;
+update t1 set name='U+0162 LATIN CAPITAL LETTER T WITH CEDILLA' where ujis=0x8FAAE1;
+update t1 set name='U+00DA LATIN CAPITAL LETTER U WITH ACUTE' where ujis=0x8FAAE2;
+update t1 set name='U+00D9 LATIN CAPITAL LETTER U WITH GRAVE' where ujis=0x8FAAE3;
+update t1 set name='U+00DC LATIN CAPITAL LETTER U WITH DIAERESIS' where ujis=0x8FAAE4;
+update t1 set name='U+00DB LATIN CAPITAL LETTER U WITH CIRCUMFLEX' where ujis=0x8FAAE5;
+update t1 set name='U+016C LATIN CAPITAL LETTER U WITH BREVE' where ujis=0x8FAAE6;
+update t1 set name='U+01D3 LATIN CAPITAL LETTER U WITH CARON' where ujis=0x8FAAE7;
+update t1 set name='U+0170 LATIN CAPITAL LETTER U WITH DOUBLE ACUTE' where ujis=0x8FAAE8;
+update t1 set name='U+016A LATIN CAPITAL LETTER U WITH MACRON' where ujis=0x8FAAE9;
+update t1 set name='U+0172 LATIN CAPITAL LETTER U WITH OGONEK' where ujis=0x8FAAEA;
+update t1 set name='U+016E LATIN CAPITAL LETTER U WITH RING ABOVE' where ujis=0x8FAAEB;
+update t1 set name='U+0168 LATIN CAPITAL LETTER U WITH TILDE' where ujis=0x8FAAEC;
+update t1 set name='U+01D7 LATIN CAPITAL LETTER U WITH DIAERESIS AND ACUTE' where ujis=0x8FAAED;
+update t1 set name='U+01DB LATIN CAPITAL LETTER U WITH DIAERESIS AND GRAVE' where ujis=0x8FAAEE;
+update t1 set name='U+01D9 LATIN CAPITAL LETTER U WITH DIAERESIS AND CARON' where ujis=0x8FAAEF;
+update t1 set name='U+01D5 LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON' where ujis=0x8FAAF0;
+update t1 set name='U+0174 LATIN CAPITAL LETTER W WITH CIRCUMFLEX' where ujis=0x8FAAF1;
+update t1 set name='U+00DD LATIN CAPITAL LETTER Y WITH ACUTE' where ujis=0x8FAAF2;
+update t1 set name='U+0178 LATIN CAPITAL LETTER Y WITH DIAERESIS' where ujis=0x8FAAF3;
+update t1 set name='U+0176 LATIN CAPITAL LETTER Y WITH CIRCUMFLEX' where ujis=0x8FAAF4;
+update t1 set name='U+0179 LATIN CAPITAL LETTER Z WITH ACUTE' where ujis=0x8FAAF5;
+update t1 set name='U+017D LATIN CAPITAL LETTER Z WITH CARON' where ujis=0x8FAAF6;
+update t1 set name='U+017B LATIN CAPITAL LETTER Z WITH DOT ABOVE' where ujis=0x8FAAF7;
+update t1 set name='U+00E1 LATIN SMALL LETTER A WITH ACUTE' where ujis=0x8FABA1;
+update t1 set name='U+00E0 LATIN SMALL LETTER A WITH GRAVE' where ujis=0x8FABA2;
+update t1 set name='U+00E4 LATIN SMALL LETTER A WITH DIAERESIS' where ujis=0x8FABA3;
+update t1 set name='U+00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX' where ujis=0x8FABA4;
+update t1 set name='U+0103 LATIN SMALL LETTER A WITH BREVE' where ujis=0x8FABA5;
+update t1 set name='U+01CE LATIN SMALL LETTER A WITH CARON' where ujis=0x8FABA6;
+update t1 set name='U+0101 LATIN SMALL LETTER A WITH MACRON' where ujis=0x8FABA7;
+update t1 set name='U+0105 LATIN SMALL LETTER A WITH OGONEK' where ujis=0x8FABA8;
+update t1 set name='U+00E5 LATIN SMALL LETTER A WITH RING ABOVE' where ujis=0x8FABA9;
+update t1 set name='U+00E3 LATIN SMALL LETTER A WITH TILDE' where ujis=0x8FABAA;
+update t1 set name='U+0107 LATIN SMALL LETTER C WITH ACUTE' where ujis=0x8FABAB;
+update t1 set name='U+0109 LATIN SMALL LETTER C WITH CIRCUMFLEX' where ujis=0x8FABAC;
+update t1 set name='U+010D LATIN SMALL LETTER C WITH CARON' where ujis=0x8FABAD;
+update t1 set name='U+00E7 LATIN SMALL LETTER C WITH CEDILLA' where ujis=0x8FABAE;
+update t1 set name='U+010B LATIN SMALL LETTER C WITH DOT ABOVE' where ujis=0x8FABAF;
+update t1 set name='U+010F LATIN SMALL LETTER D WITH CARON' where ujis=0x8FABB0;
+update t1 set name='U+00E9 LATIN SMALL LETTER E WITH ACUTE' where ujis=0x8FABB1;
+update t1 set name='U+00E8 LATIN SMALL LETTER E WITH GRAVE' where ujis=0x8FABB2;
+update t1 set name='U+00EB LATIN SMALL LETTER E WITH DIAERESIS' where ujis=0x8FABB3;
+update t1 set name='U+00EA LATIN SMALL LETTER E WITH CIRCUMFLEX' where ujis=0x8FABB4;
+update t1 set name='U+011B LATIN SMALL LETTER E WITH CARON' where ujis=0x8FABB5;
+update t1 set name='U+0117 LATIN SMALL LETTER E WITH DOT ABOVE' where ujis=0x8FABB6;
+update t1 set name='U+0113 LATIN SMALL LETTER E WITH MACRON' where ujis=0x8FABB7;
+update t1 set name='U+0119 LATIN SMALL LETTER E WITH OGONEK' where ujis=0x8FABB8;
+update t1 set name='U+01F5 LATIN SMALL LETTER G WITH ACUTE' where ujis=0x8FABB9;
+update t1 set name='U+011D LATIN SMALL LETTER G WITH CIRCUMFLEX' where ujis=0x8FABBA;
+update t1 set name='U+011F LATIN SMALL LETTER G WITH BREVE' where ujis=0x8FABBB;
+update t1 set name='U+0121 LATIN SMALL LETTER G WITH DOT ABOVE' where ujis=0x8FABBD;
+update t1 set name='U+0125 LATIN SMALL LETTER H WITH CIRCUMFLEX' where ujis=0x8FABBE;
+update t1 set name='U+00ED LATIN SMALL LETTER I WITH ACUTE' where ujis=0x8FABBF;
+update t1 set name='U+00EC LATIN SMALL LETTER I WITH GRAVE' where ujis=0x8FABC0;
+update t1 set name='U+00EF LATIN SMALL LETTER I WITH DIAERESIS' where ujis=0x8FABC1;
+update t1 set name='U+00EE LATIN SMALL LETTER I WITH CIRCUMFLEX' where ujis=0x8FABC2;
+update t1 set name='U+01D0 LATIN SMALL LETTER I WITH CARON' where ujis=0x8FABC3;
+update t1 set name='U+012B LATIN SMALL LETTER I WITH MACRON' where ujis=0x8FABC5;
+update t1 set name='U+012F LATIN SMALL LETTER I WITH OGONEK' where ujis=0x8FABC6;
+update t1 set name='U+0129 LATIN SMALL LETTER I WITH TILDE' where ujis=0x8FABC7;
+update t1 set name='U+0135 LATIN SMALL LETTER J WITH CIRCUMFLEX' where ujis=0x8FABC8;
+update t1 set name='U+0137 LATIN SMALL LETTER K WITH CEDILLA' where ujis=0x8FABC9;
+update t1 set name='U+013A LATIN SMALL LETTER L WITH ACUTE' where ujis=0x8FABCA;
+update t1 set name='U+013E LATIN SMALL LETTER L WITH CARON' where ujis=0x8FABCB;
+update t1 set name='U+013C LATIN SMALL LETTER L WITH CEDILLA' where ujis=0x8FABCC;
+update t1 set name='U+0144 LATIN SMALL LETTER N WITH ACUTE' where ujis=0x8FABCD;
+update t1 set name='U+0148 LATIN SMALL LETTER N WITH CARON' where ujis=0x8FABCE;
+update t1 set name='U+0146 LATIN SMALL LETTER N WITH CEDILLA' where ujis=0x8FABCF;
+update t1 set name='U+00F1 LATIN SMALL LETTER N WITH TILDE' where ujis=0x8FABD0;
+update t1 set name='U+00F3 LATIN SMALL LETTER O WITH ACUTE' where ujis=0x8FABD1;
+update t1 set name='U+00F2 LATIN SMALL LETTER O WITH GRAVE' where ujis=0x8FABD2;
+update t1 set name='U+00F6 LATIN SMALL LETTER O WITH DIAERESIS' where ujis=0x8FABD3;
+update t1 set name='U+00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX' where ujis=0x8FABD4;
+update t1 set name='U+01D2 LATIN SMALL LETTER O WITH CARON' where ujis=0x8FABD5;
+update t1 set name='U+0151 LATIN SMALL LETTER O WITH DOUBLE ACUTE' where ujis=0x8FABD6;
+update t1 set name='U+014D LATIN SMALL LETTER O WITH MACRON' where ujis=0x8FABD7;
+update t1 set name='U+00F5 LATIN SMALL LETTER O WITH TILDE' where ujis=0x8FABD8;
+update t1 set name='U+0155 LATIN SMALL LETTER R WITH ACUTE' where ujis=0x8FABD9;
+update t1 set name='U+0159 LATIN SMALL LETTER R WITH CARON' where ujis=0x8FABDA;
+update t1 set name='U+0157 LATIN SMALL LETTER R WITH CEDILLA' where ujis=0x8FABDB;
+update t1 set name='U+015B LATIN SMALL LETTER S WITH ACUTE' where ujis=0x8FABDC;
+update t1 set name='U+015D LATIN SMALL LETTER S WITH CIRCUMFLEX' where ujis=0x8FABDD;
+update t1 set name='U+0161 LATIN SMALL LETTER S WITH CARON' where ujis=0x8FABDE;
+update t1 set name='U+015F LATIN SMALL LETTER S WITH CEDILLA' where ujis=0x8FABDF;
+update t1 set name='U+0165 LATIN SMALL LETTER T WITH CARON' where ujis=0x8FABE0;
+update t1 set name='U+0163 LATIN SMALL LETTER T WITH CEDILLA' where ujis=0x8FABE1;
+update t1 set name='U+00FA LATIN SMALL LETTER U WITH ACUTE' where ujis=0x8FABE2;
+update t1 set name='U+00F9 LATIN SMALL LETTER U WITH GRAVE' where ujis=0x8FABE3;
+update t1 set name='U+00FC LATIN SMALL LETTER U WITH DIAERESIS' where ujis=0x8FABE4;
+update t1 set name='U+00FB LATIN SMALL LETTER U WITH CIRCUMFLEX' where ujis=0x8FABE5;
+update t1 set name='U+016D LATIN SMALL LETTER U WITH BREVE' where ujis=0x8FABE6;
+update t1 set name='U+01D4 LATIN SMALL LETTER U WITH CARON' where ujis=0x8FABE7;
+update t1 set name='U+0171 LATIN SMALL LETTER U WITH DOUBLE ACUTE' where ujis=0x8FABE8;
+update t1 set name='U+016B LATIN SMALL LETTER U WITH MACRON' where ujis=0x8FABE9;
+update t1 set name='U+0173 LATIN SMALL LETTER U WITH OGONEK' where ujis=0x8FABEA;
+update t1 set name='U+016F LATIN SMALL LETTER U WITH RING ABOVE' where ujis=0x8FABEB;
+update t1 set name='U+0169 LATIN SMALL LETTER U WITH TILDE' where ujis=0x8FABEC;
+update t1 set name='U+01D8 LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE' where ujis=0x8FABED;
+update t1 set name='U+01DC LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE' where ujis=0x8FABEE;
+update t1 set name='U+01DA LATIN SMALL LETTER U WITH DIAERESIS AND CARON' where ujis=0x8FABEF;
+update t1 set name='U+01D6 LATIN SMALL LETTER U WITH DIAERESIS AND MACRON' where ujis=0x8FABF0;
+update t1 set name='U+0175 LATIN SMALL LETTER W WITH CIRCUMFLEX' where ujis=0x8FABF1;
+update t1 set name='U+00FD LATIN SMALL LETTER Y WITH ACUTE' where ujis=0x8FABF2;
+update t1 set name='U+00FF LATIN SMALL LETTER Y WITH DIAERESIS' where ujis=0x8FABF3;
+update t1 set name='U+0177 LATIN SMALL LETTER Y WITH CIRCUMFLEX' where ujis=0x8FABF4;
+update t1 set name='U+017A LATIN SMALL LETTER Z WITH ACUTE' where ujis=0x8FABF5;
+update t1 set name='U+017E LATIN SMALL LETTER Z WITH CARON' where ujis=0x8FABF6;
+update t1 set name='U+017C LATIN SMALL LETTER Z WITH DOT ABOVE' where ujis=0x8FABF7;
+
+# [8F][B0..BF][A1..FE] - all 16*94=1504 codes assigned
+update t1 set name='<CJK>' where ujis >= 0x8FB0A1 AND ujis <= 0x8FBFFE;
+
+# [8F][C0..CF][A1..FE] - all 16*94=1504 codes assigned
+update t1 set name='<CJK>' where ujis >= 0x8FC0A1 AND ujis <= 0x8FCFFE;
+
+# [8F][D0..DF][A1..FE] - all 16*94=1504 codes assigned
+update t1 set name='<CJK>' where ujis >= 0x8FD0A1 AND ujis <= 0x8FDFFE;
+
+# [8F][E0..EC][A1..FE] - all 13*94=1222 codes assigned
+update t1 set name='<CJK>' where ujis >= 0x8FE0A1 AND ujis <= 0x8FECFE;
+
+#
+update t1 set name='U+9EF8 <CJK>' where ujis=0x8FEDA1;
+update t1 set name='U+9EFF <CJK>' where ujis=0x8FEDA2;
+update t1 set name='U+9F02 <CJK>' where ujis=0x8FEDA3;
+update t1 set name='U+9F03 <CJK>' where ujis=0x8FEDA4;
+update t1 set name='U+9F09 <CJK>' where ujis=0x8FEDA5;
+update t1 set name='U+9F0F <CJK>' where ujis=0x8FEDA6;
+update t1 set name='U+9F10 <CJK>' where ujis=0x8FEDA7;
+update t1 set name='U+9F11 <CJK>' where ujis=0x8FEDA8;
+update t1 set name='U+9F12 <CJK>' where ujis=0x8FEDA9;
+update t1 set name='U+9F14 <CJK>' where ujis=0x8FEDAA;
+update t1 set name='U+9F16 <CJK>' where ujis=0x8FEDAB;
+update t1 set name='U+9F17 <CJK>' where ujis=0x8FEDAC;
+update t1 set name='U+9F19 <CJK>' where ujis=0x8FEDAD;
+update t1 set name='U+9F1A <CJK>' where ujis=0x8FEDAE;
+update t1 set name='U+9F1B <CJK>' where ujis=0x8FEDAF;
+
+update t1 set name='U+9F1F <CJK>' where ujis=0x8FEDB0;
+update t1 set name='U+9F22 <CJK>' where ujis=0x8FEDB1;
+update t1 set name='U+9F26 <CJK>' where ujis=0x8FEDB2;
+update t1 set name='U+9F2A <CJK>' where ujis=0x8FEDB3;
+update t1 set name='U+9F2B <CJK>' where ujis=0x8FEDB4;
+update t1 set name='U+9F2F <CJK>' where ujis=0x8FEDB5;
+update t1 set name='U+9F31 <CJK>' where ujis=0x8FEDB6;
+update t1 set name='U+9F32 <CJK>' where ujis=0x8FEDB7;
+update t1 set name='U+9F34 <CJK>' where ujis=0x8FEDB8;
+update t1 set name='U+9F37 <CJK>' where ujis=0x8FEDB9;
+update t1 set name='U+9F39 <CJK>' where ujis=0x8FEDBA;
+update t1 set name='U+9F3A <CJK>' where ujis=0x8FEDBB;
+update t1 set name='U+9F3C <CJK>' where ujis=0x8FEDBC;
+update t1 set name='U+9F3D <CJK>' where ujis=0x8FEDBD;
+update t1 set name='U+9F3F <CJK>' where ujis=0x8FEDBE;
+update t1 set name='U+9F41 <CJK>' where ujis=0x8FEDBF;
+
+update t1 set name='U+9F43 <CJK>' where ujis=0x8FEDC0;
+update t1 set name='U+9F44 <CJK>' where ujis=0x8FEDC1;
+update t1 set name='U+9F45 <CJK>' where ujis=0x8FEDC2;
+update t1 set name='U+9F46 <CJK>' where ujis=0x8FEDC3;
+update t1 set name='U+9F47 <CJK>' where ujis=0x8FEDC4;
+update t1 set name='U+9F53 <CJK>' where ujis=0x8FEDC5;
+update t1 set name='U+9F55 <CJK>' where ujis=0x8FEDC6;
+update t1 set name='U+9F56 <CJK>' where ujis=0x8FEDC7;
+update t1 set name='U+9F57 <CJK>' where ujis=0x8FEDC8;
+update t1 set name='U+9F58 <CJK>' where ujis=0x8FEDC9;
+update t1 set name='U+9F5A <CJK>' where ujis=0x8FEDCA;
+update t1 set name='U+9F5D <CJK>' where ujis=0x8FEDCB;
+update t1 set name='U+9F5E <CJK>' where ujis=0x8FEDCC;
+update t1 set name='U+9F68 <CJK>' where ujis=0x8FEDCD;
+update t1 set name='U+9F69 <CJK>' where ujis=0x8FEDCE;
+update t1 set name='U+9F6D <CJK>' where ujis=0x8FEDCF;
+
+update t1 set name='U+9F6E <CJK>' where ujis=0x8FEDD0;
+update t1 set name='U+9F6F <CJK>' where ujis=0x8FEDD1;
+update t1 set name='U+9F70 <CJK>' where ujis=0x8FEDD2;
+update t1 set name='U+9F71 <CJK>' where ujis=0x8FEDD3;
+update t1 set name='U+9F73 <CJK>' where ujis=0x8FEDD4;
+update t1 set name='U+9F75 <CJK>' where ujis=0x8FEDD5;
+update t1 set name='U+9F7A <CJK>' where ujis=0x8FEDD6;
+update t1 set name='U+9F7D <CJK>' where ujis=0x8FEDD7;
+update t1 set name='U+9F8F <CJK>' where ujis=0x8FEDD8;
+update t1 set name='U+9F90 <CJK>' where ujis=0x8FEDD9;
+update t1 set name='U+9F91 <CJK>' where ujis=0x8FEDDA;
+update t1 set name='U+9F92 <CJK>' where ujis=0x8FEDDB;
+update t1 set name='U+9F94 <CJK>' where ujis=0x8FEDDC;
+update t1 set name='U+9F96 <CJK>' where ujis=0x8FEDDD;
+update t1 set name='U+9F97 <CJK>' where ujis=0x8FEDDE;
+update t1 set name='U+9F9E <CJK>' where ujis=0x8FEDDF;
+
+update t1 set name='U+9FA1 <CJK>' where ujis=0x8FEDE0;
+update t1 set name='U+9FA2 <CJK>' where ujis=0x8FEDE1;
+update t1 set name='U+9FA3 <CJK>' where ujis=0x8FEDE2;
+update t1 set name='U+9FA5 <CJK>' where ujis=0x8FEDE3;
+
+# [8F][F5..FE][A1..FE] - User defined range
+update t1 set name='User defined range #2' where ujis >= 0x8FF5A1 and ujis <= 0x8FFEFE;
+
+# Other characters are not assigned
+update t1 set name='UNASSIGNED' where name='';
+
+update t1 set ucs2=ujis, ujis2=ucs2;
+--echo Characters with safe Unicode round trip
+select hex(ujis), hex(ucs2), hex(ujis2), name from t1 where ujis=ujis2 order by ujis;
+--echo Characters with unsafe Unicode round trip
+select hex(ujis), hex(ucs2), hex(ujis2), name from t1 where ujis<>ujis2 order by ujis;
+drop table t1;
+
+drop table t2;
+
+#
+# Tricky characters, which have different mapping
+# in various euc-jp versions. See WL#1820 for details.
+#
+create table t1 (
+ ujis varchar(1) character set ujis,
+ name varchar(64),
+ ucs2 varchar(1) character set ucs2,
+ ujis2 varchar(1) character set ujis
+);
+insert into t1 (ujis,name) values (0x5C, 'U+005C REVERSE SOLIDUS');
+insert into t1 (ujis,name) values (0x7E, 'U+007E TILDE');
+insert into t1 (ujis,name) values (0xA1B1, 'U+FFE3 FULLWIDTH MACRON');
+insert into t1 (ujis,name) values (0xA1BD, 'U+2015 HORIZONTAL BAR');
+insert into t1 (ujis,name) values (0xA1C0, 'U+005C REVERSE SOLIDUS');
+insert into t1 (ujis,name) values (0xA1C1, 'U+301C WAVE DASH');
+insert into t1 (ujis,name) values (0xA1C2, 'U+2016 DOUBLE VERTICAL LINE');
+insert into t1 (ujis,name) values (0xA1DD, 'U+2212 MINUS SIGN');
+insert into t1 (ujis,name) values (0xA1F1, 'U+00A2 CENT SIGN');
+insert into t1 (ujis,name) values (0xA1F2, 'U+00A3 POUND SIGN');
+insert into t1 (ujis,name) values (0xA1EF, 'U+FFE5 FULLWIDTH YEN SIGN');
+insert into t1 (ujis,name) values (0xA2CC, 'U+00AC NOT SIGN');
+insert into t1 (ujis,name) values (0x8FA2B7, 'U+007E TILDE');
+insert into t1 (ujis,name) values (0x8FA2C3, 'U+00A6 BROKEN BAR');
+update t1 set ucs2=ujis, ujis2=ucs2;
+select hex(ujis), hex(ucs2), hex(ujis2), name from t1;
+drop table t1;
+
+#
+# Unicode characters which are not in x-eucjp-unicode-0.9
+#
+create table t1 (
+ ujis char(1) character set ujis,
+ ucs2 char(1) character set ucs2,
+ name char(64)
+);
+insert into t1 (ucs2,name) values (0x00A5,'U+00A5 YEN SIGN');
+insert into t1 (ucs2,name) values (0x2014,'U+2014 EM DASH');
+insert into t1 (ucs2,name) values (0x203E,'U+203E OVERLINE');
+insert into t1 (ucs2,name) values (0x2225,'U+2225 PARALLEL TO');
+insert into t1 (ucs2,name) values (0xFF0D,'U+FF0D FULLWIDTH HYPHEN-MINUS');
+insert into t1 (ucs2,name) values (0xFF3C,'U+FF3C FULLWIDTH REVERSE SOLIDUS');
+insert into t1 (ucs2,name) values (0xFF5E,'U+FF5E FULLWIDTH TILDE');
+insert into t1 (ucs2,name) values (0xFFE0,'U+FFE0 FULLWIDTH CENT SIGN');
+insert into t1 (ucs2,name) values (0xFFE1,'U+FFE1 FULLWIDTH POUND SIGN');
+insert into t1 (ucs2,name) values (0xFFE2,'U+FFE2 FULLWIDTH NOT SIGN');
+insert into t1 (ucs2,name) values (0xFFE4,'U+FFE4 FULLWIDTH BROKEN BAR');
+update t1 set ujis=ucs2;
+select hex(ucs2),hex(ujis),name from t1 order by name;
+drop table t1;
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 03b3df44c73..204d59589e4 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -1339,3 +1339,28 @@ INSERT INTO t2 (colA, colB) VALUES (1, 'foo'),(2, 'foo bar');
SELECT * FROM t1 JOIN t2 ON t1.colA=t2.colA AND t1.colB=t2.colB
WHERE t1.colA < 3;
DROP TABLE t1, t2;
+
+#
+# Bug#29205: truncation of UTF8 values when the UNION statement
+# forces collation to the binary charset
+#
+
+SELECT 'н1234567890' UNION SELECT _binary '1';
+SELECT 'н1234567890' UNION SELECT 1;
+
+SELECT '1' UNION SELECT 'н1234567890';
+SELECT 1 UNION SELECT 'н1234567890';
+
+CREATE TABLE t1 (c VARCHAR(11)) CHARACTER SET utf8;
+CREATE TABLE t2 (b CHAR(1) CHARACTER SET binary, i INT);
+
+INSERT INTO t1 (c) VALUES ('н1234567890');
+INSERT INTO t2 (b, i) VALUES ('1', 1);
+
+SELECT c FROM t1 UNION SELECT b FROM t2;
+SELECT c FROM t1 UNION SELECT i FROM t2;
+
+SELECT b FROM t2 UNION SELECT c FROM t1;
+SELECT i FROM t2 UNION SELECT c FROM t1;
+
+DROP TABLE t1, t2;
diff --git a/mysql-test/t/ddl_i18n_koi8r.test b/mysql-test/t/ddl_i18n_koi8r.test
new file mode 100644
index 00000000000..e636d801b07
--- /dev/null
+++ b/mysql-test/t/ddl_i18n_koi8r.test
@@ -0,0 +1,1112 @@
+# Objects to test:
+# - stored procedures/functions;
+# - triggers;
+# - events;
+# - views;
+#
+# For stored routines:
+# - create a database with collation utf8_unicode_ci;
+# - create an object, which
+# - contains SP-var with explicit CHARSET-clause;
+# - contains SP-var without CHARSET-clause;
+# - contains text constant;
+# - has localized routine/parameter names;
+# - check:
+# - execute;
+# - SHOW CREATE output;
+# - SHOW output;
+# - SELECT FROM INFORMATION_SCHEMA output;
+# - alter database character set;
+# - change connection collation;
+# - check again;
+# - dump definition using mysqldump;
+# - drop object;
+# - restore object;
+#
+
+###########################################################################
+#
+# NOTE: this file contains text in UTF8 and KOI8-R encodings.
+#
+###########################################################################
+
+--source include/have_utf8.inc
+--source include/have_cp866.inc
+--source include/have_cp1251.inc
+--source include/have_koi8r.inc
+
+###########################################################################
+
+set names koi8r;
+delimiter |;
+
+###########################################################################
+#
+# * Views.
+#
+###########################################################################
+
+--echo
+--echo -------------------------------------------------------------------
+--echo Views
+--echo -------------------------------------------------------------------
+--echo
+
+#
+# Preparation:
+#
+
+# - Create database with fixed, pre-defined character set.
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1|
+--enable_warnings
+
+CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
+
+use mysqltest1|
+
+CREATE TABLE t1( INT)|
+INSERT INTO t1 VALUES(1)|
+
+# - Create views;
+
+--echo
+
+CREATE VIEW v1 AS
+ SELECT '' AS c1, AS c2
+ FROM t1|
+
+--echo
+
+CREATE VIEW v2 AS SELECT _utf8'тест' as c1|
+
+--echo
+
+#
+# First-round checks.
+#
+
+--source include/ddl_i18n.check_views.inc
+
+#
+# Change running environment (alter database character set, change session
+# variables).
+#
+
+--echo
+--echo
+
+ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
+
+#
+# Second-round checks:
+#
+
+# - Change connection to flush cache;
+
+--connect (con2,localhost,root,,)
+--echo
+--echo ---> connection: con2
+
+# - Switch environment variables and trigger loading views;
+
+SET @@character_set_client= cp1251|
+SET @@character_set_results= cp1251|
+SET @@collation_connection= cp1251_general_ci|
+
+--disable_result_log
+SELECT * FROM mysqltest1.v1|
+SELECT * FROM mysqltest1.v2|
+--enable_result_log
+
+use mysqltest1|
+
+# - Restore environment;
+
+set names koi8r|
+
+# - Check!
+
+--source include/ddl_i18n.check_views.inc
+
+#
+# Check mysqldump.
+#
+
+# - Dump mysqltest1;
+
+--echo
+--echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.views.mysqltest1.sql
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.views.mysqltest1.sql
+
+# - Clean mysqltest1;
+
+--echo
+--echo
+
+DROP DATABASE mysqltest1|
+
+# - Restore mysqltest1;
+
+--echo
+--echo
+
+--echo ---> Restoring mysqltest1...
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.views.mysqltest1.sql
+
+#
+# Third-round checks.
+#
+
+# - Change connection to flush cache;
+
+--connect (con3,localhost,root,,)
+--echo
+--echo ---> connection: con3
+
+# - Switch environment variables and trigger loading stored procedures;
+
+SET @@character_set_client= cp1251|
+SET @@character_set_results= cp1251|
+SET @@collation_connection= cp1251_general_ci|
+
+--disable_result_log
+SELECT * FROM mysqltest1.v1|
+SELECT * FROM mysqltest1.v2|
+--enable_result_log
+
+use mysqltest1|
+
+# - Restore environment;
+
+set names koi8r|
+
+# - Check!
+
+--source include/ddl_i18n.check_views.inc
+
+#
+# Cleanup.
+#
+
+--connection default
+--echo
+--echo ---> connection: default
+
+--disconnect con2
+--disconnect con3
+
+use test|
+
+DROP DATABASE mysqltest1|
+
+###########################################################################
+#
+# * Stored procedures/functions.
+#
+###########################################################################
+
+--echo
+--echo -------------------------------------------------------------------
+--echo Stored procedures/functions
+--echo -------------------------------------------------------------------
+--echo
+
+#
+# Preparation:
+#
+
+# - Create database with fixed, pre-defined character set.
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1|
+DROP DATABASE IF EXISTS mysqltest2|
+--enable_warnings
+
+CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
+CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
+
+use mysqltest1|
+
+# - Create two stored routines -- with and without explicit
+# CHARSET-clause for SP-variable;
+#
+
+--echo
+
+# - Procedure p1
+
+CREATE PROCEDURE p1(
+ INOUT 1 CHAR(10),
+ OUT 2 CHAR(10))
+BEGIN
+ DECLARE 1 CHAR(10);
+
+ SELECT
+ COLLATION(1) AS c1,
+ COLLATION(1) AS c2,
+ COLLATION(2) AS c3;
+
+ SELECT
+ COLLATION('') AS c4,
+ COLLATION(_koi8r '') AS c5,
+ COLLATION(_utf8 'текст') AS c6,
+ @@collation_connection AS c7,
+ @@character_set_client AS c8;
+
+ SET 1 = 'a';
+ SET 2 = 'b';
+END|
+
+--echo
+
+# - Procedure p2
+
+CREATE PROCEDURE p2(
+ INOUT 1 CHAR(10) CHARACTER SET utf8,
+ OUT 2 CHAR(10) CHARACTER SET utf8)
+BEGIN
+ DECLARE 1 CHAR(10) CHARACTER SET utf8;
+
+ SELECT
+ COLLATION(1) AS c1,
+ COLLATION(1) AS c2,
+ COLLATION(2) AS c3;
+
+ SELECT
+ COLLATION('') AS c4,
+ COLLATION(_koi8r '') AS c5,
+ COLLATION(_utf8 'текст') AS c6,
+ @@collation_connection AS c7,
+ @@character_set_client AS c8;
+
+ SET 1 = 'a';
+ SET 2 = 'b';
+END|
+
+--echo
+
+# - Procedure p3
+
+CREATE PROCEDURE mysqltest2.p3(
+ INOUT 1 CHAR(10),
+ OUT 2 CHAR(10))
+BEGIN
+ DECLARE 1 CHAR(10);
+
+ SELECT
+ COLLATION(1) AS c1,
+ COLLATION(1) AS c2,
+ COLLATION(2) AS c3;
+
+ SELECT
+ COLLATION('') AS c4,
+ COLLATION(_koi8r '') AS c5,
+ COLLATION(_utf8 'текст') AS c6,
+ @@collation_connection AS c7,
+ @@character_set_client AS c8;
+
+ SET 1 = 'a';
+ SET 2 = 'b';
+END|
+
+--echo
+
+# - Procedure p4
+
+CREATE PROCEDURE mysqltest2.p4(
+ INOUT 1 CHAR(10) CHARACTER SET utf8,
+ OUT 2 CHAR(10) CHARACTER SET utf8)
+BEGIN
+ DECLARE 1 CHAR(10) CHARACTER SET utf8;
+
+ SELECT
+ COLLATION(1) AS c1,
+ COLLATION(1) AS c2,
+ COLLATION(2) AS c3;
+
+ SELECT
+ COLLATION('') AS c4,
+ COLLATION(_koi8r '') AS c5,
+ COLLATION(_utf8 'текст') AS c6,
+ @@collation_connection AS c7,
+ @@character_set_client AS c8;
+
+ SET 1 = 'a';
+ SET 2 = 'b';
+END|
+
+#
+# First-round checks.
+#
+
+--source include/ddl_i18n.check_sp.inc
+
+#
+# Change running environment (alter database character set, change session
+# variables).
+#
+
+--echo
+--echo
+
+ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
+ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
+
+#
+# Second-round checks:
+#
+
+# - Change connection to flush SP-cache;
+
+--connect (con2,localhost,root,,mysqltest1)
+--echo
+--echo ---> connection: con2
+
+# - Switch environment variables and trigger loading stored procedures;
+
+SET @@character_set_client= cp1251|
+SET @@character_set_results= cp1251|
+SET @@collation_connection= cp1251_general_ci|
+
+CALL p1(@a, @b)|
+CALL p2(@a, @b)|
+CALL mysqltest2.p3(@a, @b)|
+CALL mysqltest2.p4(@a, @b)|
+
+# - Restore environment;
+
+set names koi8r|
+
+# - Check!
+
+--source include/ddl_i18n.check_sp.inc
+
+#
+# Check mysqldump.
+#
+
+# - Dump mysqltest1, mysqltest2;
+
+--echo
+--echo ---> Dump of mysqltest1
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest1
+
+--echo
+--echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.sp.mysqltest1.sql
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.sp.mysqltest1.sql
+
+--echo
+--echo ---> Dump of mysqltest2
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest2
+
+--echo
+--echo ---> Dumping mysqltest2 to ddl_i18n_koi8r.sp.mysqltest2.sql
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.sp.mysqltest2.sql
+
+# - Clean mysqltest1, mysqltest2;
+
+--echo
+--echo
+
+DROP DATABASE mysqltest1|
+DROP DATABASE mysqltest2|
+
+# - Restore mysqltest1;
+
+--echo
+--echo
+
+--echo ---> Restoring mysqltest1...
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.sp.mysqltest1.sql
+
+--echo ---> Restoring mysqltest2...
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.sp.mysqltest2.sql
+
+#
+# Third-round checks.
+#
+
+# - Change connection to flush SP-cache;
+
+--connect (con3,localhost,root,,mysqltest1)
+--echo
+--echo ---> connection: con3
+
+# - Switch environment variables and trigger loading stored procedures;
+
+SET @@character_set_client= cp1251|
+SET @@character_set_results= cp1251|
+SET @@collation_connection= cp1251_general_ci|
+
+CALL p1(@a, @b)|
+CALL p2(@a, @b)|
+CALL mysqltest2.p3(@a, @b)|
+CALL mysqltest2.p4(@a, @b)|
+
+# - Restore environment;
+
+set names koi8r|
+
+# - Check!
+
+--source include/ddl_i18n.check_sp.inc
+
+#
+# Cleanup.
+#
+
+--connection default
+--echo
+--echo ---> connection: default
+
+--disconnect con2
+--disconnect con3
+
+use test|
+
+DROP DATABASE mysqltest1|
+DROP DATABASE mysqltest2|
+
+###########################################################################
+#
+# * Triggers.
+#
+###########################################################################
+
+--echo
+--echo -------------------------------------------------------------------
+--echo Triggers
+--echo -------------------------------------------------------------------
+--echo
+
+#
+# Preparation:
+#
+
+# - Create database with fixed, pre-defined character set;
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1|
+DROP DATABASE IF EXISTS mysqltest2|
+--enable_warnings
+
+CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
+CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
+
+use mysqltest1|
+
+# - Create tables for triggers;
+
+CREATE TABLE t1(c INT)|
+CREATE TABLE mysqltest2.t1(c INT)|
+
+# - Create log tables;
+
+CREATE TABLE log(msg VARCHAR(255))|
+CREATE TABLE mysqltest2.log(msg VARCHAR(255))|
+
+
+# - Create triggers -- with and without explicit CHARSET-clause for
+# SP-variable;
+#
+
+--echo
+
+# - Trigger trg1
+
+CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+ DECLARE 1 CHAR(10);
+
+ INSERT INTO log VALUES(COLLATION(1));
+ INSERT INTO log VALUES(COLLATION(''));
+ INSERT INTO log VALUES(COLLATION(_koi8r ''));
+ INSERT INTO log VALUES(COLLATION(_utf8 'текст'));
+ INSERT INTO log VALUES(@@collation_connection);
+ INSERT INTO log VALUES(@@character_set_client);
+
+ SET @a1 = '';
+ SET @a1 = _koi8r '';
+ SET @a2 = _utf8 'текст';
+END|
+
+--echo
+
+# - Trigger trg2
+
+CREATE TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW
+BEGIN
+ DECLARE 1 CHAR(10) CHARACTER SET utf8;
+
+ INSERT INTO log VALUES(COLLATION(1));
+ INSERT INTO log VALUES(COLLATION(''));
+ INSERT INTO log VALUES(COLLATION(_koi8r ''));
+ INSERT INTO log VALUES(COLLATION(_utf8 'текст'));
+ INSERT INTO log VALUES(@@collation_connection);
+ INSERT INTO log VALUES(@@character_set_client);
+
+ SET @b1 = '';
+ SET @b1 = _koi8r '';
+ SET @b2 = _utf8 'текст';
+END|
+
+--echo
+
+# - Trigger trg3
+
+CREATE TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW
+BEGIN
+ DECLARE 1 CHAR(10);
+
+ INSERT INTO log VALUES(COLLATION(1));
+ INSERT INTO log VALUES(COLLATION(''));
+ INSERT INTO log VALUES(COLLATION(_koi8r ''));
+ INSERT INTO log VALUES(COLLATION(_utf8 'текст'));
+ INSERT INTO log VALUES(@@collation_connection);
+ INSERT INTO log VALUES(@@character_set_client);
+
+ SET @a1 = '';
+ SET @a1 = _koi8r '';
+ SET @a2 = _utf8 'текст';
+END|
+
+--echo
+
+# - Trigger trg4
+
+CREATE TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW
+BEGIN
+ DECLARE 1 CHAR(10) CHARACTER SET utf8;
+
+ INSERT INTO log VALUES(COLLATION(1));
+ INSERT INTO log VALUES(COLLATION(''));
+ INSERT INTO log VALUES(COLLATION(_koi8r ''));
+ INSERT INTO log VALUES(COLLATION(_utf8 'текст'));
+ INSERT INTO log VALUES(@@collation_connection);
+ INSERT INTO log VALUES(@@character_set_client);
+
+ SET @b1 = '';
+ SET @b1 = _koi8r '';
+ SET @b2 = _utf8 'текст';
+END|
+
+--echo
+
+#
+# First-round checks.
+#
+
+--source include/ddl_i18n.check_triggers.inc
+
+#
+# Change running environment (alter database character set, change session
+# variables).
+#
+
+--echo
+--echo
+
+ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
+ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
+
+#
+# Second-round checks:
+#
+
+# - Flush table cache;
+
+ALTER TABLE t1 ADD COLUMN fake INT|
+ALTER TABLE t1 DROP COLUMN fake|
+
+ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT|
+ALTER TABLE mysqltest2.t1 DROP COLUMN fake|
+
+# - Switch environment variables and initiate loading of triggers
+# (connect using NULL database);
+
+--connect (con2,localhost,root,,)
+--echo
+--echo ---> connection: con2
+
+SET @@character_set_client= cp1251|
+SET @@character_set_results= cp1251|
+SET @@collation_connection= cp1251_general_ci|
+
+INSERT INTO mysqltest1.t1 VALUES(0)|
+INSERT INTO mysqltest2.t1 VALUES(0)|
+
+DELETE FROM mysqltest1.log|
+DELETE FROM mysqltest2.log|
+
+# - Restore environment;
+
+set names koi8r|
+
+use mysqltest1|
+
+# - Check!
+
+--source include/ddl_i18n.check_triggers.inc
+
+#
+# Check mysqldump.
+#
+
+# - Dump mysqltest1, mysqltest2;
+
+--echo
+--echo ---> Dump of mysqltest1
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest1
+
+--echo
+--echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.triggers.mysqltest1.sql
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.triggers.mysqltest1.sql
+
+--echo
+--echo ---> Dump of mysqltest2
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest2
+
+--echo
+--echo ---> Dumping mysqltest2 to ddl_i18n_koi8r.triggers.mysqltest2.sql
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.triggers.mysqltest2.sql
+
+# - Clean mysqltest1, mysqltest2;
+
+--echo
+--echo
+
+DROP DATABASE mysqltest1|
+DROP DATABASE mysqltest2|
+
+# - Restore mysqltest1;
+
+--echo
+--echo
+
+--echo ---> Restoring mysqltest1...
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.triggers.mysqltest1.sql
+
+--echo ---> Restoring mysqltest2...
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.triggers.mysqltest2.sql
+
+#
+# Third-round checks.
+#
+
+# - Flush table cache;
+
+ALTER TABLE mysqltest1.t1 ADD COLUMN fake INT|
+ALTER TABLE mysqltest1.t1 DROP COLUMN fake|
+
+ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT|
+ALTER TABLE mysqltest2.t1 DROP COLUMN fake|
+
+# - Switch environment variables and initiate loading of triggers
+# (connect using NULL database);
+
+--connect (con3,localhost,root,,)
+--echo
+--echo ---> connection: con3
+
+SET @@character_set_client= cp1251|
+SET @@character_set_results= cp1251|
+SET @@collation_connection= cp1251_general_ci|
+
+INSERT INTO mysqltest1.t1 VALUES(0)|
+INSERT INTO mysqltest2.t1 VALUES(0)|
+
+DELETE FROM mysqltest1.log|
+DELETE FROM mysqltest2.log|
+
+# - Restore environment;
+
+set names koi8r|
+
+use mysqltest1|
+
+# - Check!
+
+--source include/ddl_i18n.check_triggers.inc
+
+#
+# Cleanup.
+#
+
+--connection default
+--echo
+--echo ---> connection: default
+
+--disconnect con2
+--disconnect con3
+
+use test|
+
+DROP DATABASE mysqltest1|
+DROP DATABASE mysqltest2|
+
+###########################################################################
+#
+# * Events
+#
+# We don't have EXECUTE EVENT so far, so this test is limited. It checks that
+# event with non-latin1 symbols can be created, dumped, restored and SHOW
+# statements work properly.
+#
+###########################################################################
+
+--echo
+--echo -------------------------------------------------------------------
+--echo Events
+--echo -------------------------------------------------------------------
+--echo
+
+#
+# Preparation:
+#
+
+# - Create database with fixed, pre-defined character set.
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1|
+DROP DATABASE IF EXISTS mysqltest2|
+--enable_warnings
+
+CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
+CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
+
+use mysqltest1|
+
+# - Create two stored routines -- with and without explicit
+# CHARSET-clause for SP-variable;
+#
+
+--echo
+
+# - Event ev1
+
+CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO
+BEGIN
+ DECLARE 1 CHAR(10);
+
+ SELECT
+ COLLATION(1) AS c1,
+ COLLATION('') AS c2,
+ COLLATION(_koi8r '') AS c3,
+ COLLATION(_utf8 'текст') AS c4,
+ @@collation_connection AS c5,
+ @@character_set_client AS c6;
+END|
+
+--echo
+
+# - Event ev2
+
+CREATE EVENT ev2 ON SCHEDULE AT '2030-01-01 00:00:00' DO
+BEGIN
+ DECLARE 1 CHAR(10) CHARACTER SET utf8;
+
+ SELECT
+ COLLATION(1) AS c1,
+ COLLATION('') AS c2,
+ COLLATION(_koi8r '') AS c3,
+ COLLATION(_utf8 'текст') AS c4,
+ @@collation_connection AS c5,
+ @@character_set_client AS c6;
+END|
+
+--echo
+
+# - Event ev3
+
+CREATE EVENT mysqltest2.ev3 ON SCHEDULE AT '2030-01-01 00:00:00' DO
+BEGIN
+ DECLARE 1 CHAR(10) CHARACTER SET utf8;
+
+ SELECT
+ COLLATION(1) AS c1,
+ COLLATION('') AS c2,
+ COLLATION(_koi8r '') AS c3,
+ COLLATION(_utf8 'текст') AS c4,
+ @@collation_connection AS c5,
+ @@character_set_client AS c6;
+END|
+
+--echo
+
+# - Event ev4
+
+CREATE EVENT mysqltest2.ev4 ON SCHEDULE AT '2030-01-01 00:00:00' DO
+BEGIN
+ DECLARE 1 CHAR(10) CHARACTER SET utf8;
+
+ SELECT
+ COLLATION(1) AS c1,
+ COLLATION('') AS c2,
+ COLLATION(_koi8r '') AS c3,
+ COLLATION(_utf8 'текст') AS c4,
+ @@collation_connection AS c5,
+ @@character_set_client AS c6;
+END|
+
+--echo
+
+
+#
+# First-round checks.
+#
+
+--source include/ddl_i18n.check_events.inc
+
+#
+# Change running environment (alter database character set, change session
+# variables).
+#
+
+--echo
+--echo
+
+ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
+ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
+
+#
+# Second-round checks:
+#
+
+# - Change connection to flush cache;
+
+--connect (con2,localhost,root,,mysqltest1)
+--echo
+--echo ---> connection: con2
+
+# - Switch environment variables and trigger loading stored procedures;
+
+SET @@character_set_client= cp1251|
+SET @@character_set_results= cp1251|
+SET @@collation_connection= cp1251_general_ci|
+
+--disable_result_log
+SHOW CREATE EVENT ev1|
+SHOW CREATE EVENT ev2|
+SHOW CREATE EVENT mysqltest2.ev3|
+SHOW CREATE EVENT mysqltest2.ev4|
+--enable_result_log
+
+# - Restore environment;
+
+set names koi8r|
+
+# - Check!
+
+--source include/ddl_i18n.check_events.inc
+
+#
+# Check mysqldump.
+#
+
+# - Dump mysqltest1, mysqltest2;
+
+--echo
+--echo ---> Dump of mysqltest1
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest1
+
+--echo
+--echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.events.mysqltest1.sql
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.events.mysqltest1.sql
+
+--echo
+--echo ---> Dump of mysqltest2
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest2
+
+--echo
+--echo ---> Dumping mysqltest2 to ddl_i18n_koi8r.events.mysqltest2.sql
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.events.mysqltest2.sql
+
+# - Clean mysqltest1, mysqltest2;
+
+--echo
+--echo
+
+DROP DATABASE mysqltest1|
+DROP DATABASE mysqltest2|
+
+# - Restore mysqltest1;
+
+--echo
+--echo
+
+--echo ---> Restoring mysqltest1...
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.events.mysqltest1.sql
+
+--echo ---> Restoring mysqltest2...
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.events.mysqltest2.sql
+
+#
+# Third-round checks.
+#
+
+# - Change connection to flush cache;
+
+--connect (con3,localhost,root,,mysqltest1)
+--echo
+--echo ---> connection: con3
+
+# - Switch environment variables and trigger loading stored procedures;
+
+SET @@character_set_client= cp1251|
+SET @@character_set_results= cp1251|
+SET @@collation_connection= cp1251_general_ci|
+
+--disable_result_log
+SHOW CREATE EVENT ev1|
+SHOW CREATE EVENT ev2|
+SHOW CREATE EVENT mysqltest2.ev3|
+SHOW CREATE EVENT mysqltest2.ev4|
+--enable_result_log
+
+# - Restore environment;
+
+set names koi8r|
+
+# - Check!
+
+--source include/ddl_i18n.check_events.inc
+
+###########################################################################
+#
+# * DDL statements inside stored routine.
+#
+# Here we check that DDL statements use actual database collation even if they
+# are called from stored routine.
+#
+###########################################################################
+
+--echo
+--echo -------------------------------------------------------------------
+--echo DDL statements within stored routine.
+--echo -------------------------------------------------------------------
+--echo
+
+#
+# Preparation:
+#
+
+# - Create database with fixed, pre-defined character set.
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1|
+DROP DATABASE IF EXISTS mysqltest2|
+--enable_warnings
+
+CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
+CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
+
+use mysqltest1|
+
+# - Create procedures;
+
+--echo
+
+CREATE PROCEDURE p1()
+BEGIN
+ CREATE TABLE t1(col1 VARCHAR(10));
+ SHOW CREATE TABLE t1;
+END|
+
+--echo
+
+CREATE PROCEDURE mysqltest2.p2()
+BEGIN
+ CREATE TABLE t2(col1 VARCHAR(10));
+ SHOW CREATE TABLE t2;
+END|
+
+--echo
+
+#
+# First-round checks.
+#
+
+CALL p1()|
+
+--echo
+
+SHOW CREATE TABLE t1|
+
+--echo
+--echo
+
+CALL mysqltest2.p2()|
+
+--echo
+
+SHOW CREATE TABLE mysqltest2.t2|
+
+#
+# Alter database.
+#
+
+--echo
+
+ALTER DATABASE mysqltest1 COLLATE cp1251_general_cs|
+ALTER DATABASE mysqltest2 COLLATE cp1251_general_cs|
+
+DROP TABLE t1|
+DROP TABLE mysqltest2.t2|
+
+--echo
+
+#
+# Second-round checks.
+#
+
+CALL p1()|
+
+--echo
+
+SHOW CREATE TABLE t1|
+
+--echo
+--echo
+
+CALL mysqltest2.p2()|
+
+--echo
+
+SHOW CREATE TABLE mysqltest2.t2|
+
+###########################################################################
+#
+# That's it.
+#
+###########################################################################
+
+#
+# Cleanup.
+#
+
+--connection default
+--echo
+--echo ---> connection: default
+
+--disconnect con2
+--disconnect con3
+
+use test|
+
+DROP DATABASE mysqltest1|
+DROP DATABASE mysqltest2|
diff --git a/mysql-test/t/ddl_i18n_utf8.test b/mysql-test/t/ddl_i18n_utf8.test
new file mode 100644
index 00000000000..5f032232e56
--- /dev/null
+++ b/mysql-test/t/ddl_i18n_utf8.test
@@ -0,0 +1,1112 @@
+# Objects to test:
+# - stored procedures/functions;
+# - triggers;
+# - events;
+# - views;
+#
+# For stored routines:
+# - create a database with collation utf8_unicode_ci;
+# - create an object, which
+# - contains SP-var with explicit CHARSET-clause;
+# - contains SP-var without CHARSET-clause;
+# - contains text constant;
+# - has localized routine/parameter names;
+# - check:
+# - execute;
+# - SHOW CREATE output;
+# - SHOW output;
+# - SELECT FROM INFORMATION_SCHEMA output;
+# - alter database character set;
+# - change connection collation;
+# - check again;
+# - dump definition using mysqldump;
+# - drop object;
+# - restore object;
+#
+
+###########################################################################
+#
+# NOTE: this file contains text in UTF8 and KOI8-R encodings.
+#
+###########################################################################
+
+--source include/have_utf8.inc
+--source include/have_cp866.inc
+--source include/have_cp1251.inc
+--source include/have_koi8r.inc
+
+###########################################################################
+
+set names utf8;
+delimiter |;
+
+###########################################################################
+#
+# * Views.
+#
+###########################################################################
+
+--echo
+--echo -------------------------------------------------------------------
+--echo Views
+--echo -------------------------------------------------------------------
+--echo
+
+#
+# Preparation:
+#
+
+# - Create database with fixed, pre-defined character set.
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1|
+--enable_warnings
+
+CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
+
+use mysqltest1|
+
+CREATE TABLE t1(кол INT)|
+INSERT INTO t1 VALUES(1)|
+
+# - Create views;
+
+--echo
+
+CREATE VIEW v1 AS
+ SELECT 'тест' AS c1, кол AS c2
+ FROM t1|
+
+--echo
+
+CREATE VIEW v2 AS SELECT _koi8r'' as c1|
+
+--echo
+
+#
+# First-round checks.
+#
+
+--source include/ddl_i18n.check_views.inc
+
+#
+# Change running environment (alter database character set, change session
+# variables).
+#
+
+--echo
+--echo
+
+ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
+
+#
+# Second-round checks:
+#
+
+# - Change connection to flush cache;
+
+--connect (con2,localhost,root,,)
+--echo
+--echo ---> connection: con2
+
+# - Switch environment variables and trigger loading views;
+
+SET @@character_set_client= cp1251|
+SET @@character_set_results= cp1251|
+SET @@collation_connection= cp1251_general_ci|
+
+--disable_result_log
+SELECT * FROM mysqltest1.v1|
+SELECT * FROM mysqltest1.v2|
+--enable_result_log
+
+use mysqltest1|
+
+# - Restore environment;
+
+set names utf8|
+
+# - Check!
+
+--source include/ddl_i18n.check_views.inc
+
+#
+# Check mysqldump.
+#
+
+# - Dump mysqltest1;
+
+--echo
+--echo ---> Dumping mysqltest1 to ddl_i18n_utf8views.mysqltest1.sql
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8views.mysqltest1.sql
+
+# - Clean mysqltest1;
+
+--echo
+--echo
+
+DROP DATABASE mysqltest1|
+
+# - Restore mysqltest1;
+
+--echo
+--echo
+
+--echo ---> Restoring mysqltest1...
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8views.mysqltest1.sql
+
+#
+# Third-round checks.
+#
+
+# - Change connection to flush cache;
+
+--connect (con3,localhost,root,,)
+--echo
+--echo ---> connection: con3
+
+# - Switch environment variables and trigger loading stored procedures;
+
+SET @@character_set_client= cp1251|
+SET @@character_set_results= cp1251|
+SET @@collation_connection= cp1251_general_ci|
+
+--disable_result_log
+SELECT * FROM mysqltest1.v1|
+SELECT * FROM mysqltest1.v2|
+--enable_result_log
+
+use mysqltest1|
+
+# - Restore environment;
+
+set names utf8|
+
+# - Check!
+
+--source include/ddl_i18n.check_views.inc
+
+#
+# Cleanup.
+#
+
+--connection default
+--echo
+--echo ---> connection: default
+
+--disconnect con2
+--disconnect con3
+
+use test|
+
+DROP DATABASE mysqltest1|
+
+###########################################################################
+#
+# * Stored procedures/functions.
+#
+###########################################################################
+
+--echo
+--echo -------------------------------------------------------------------
+--echo Stored procedures/functions
+--echo -------------------------------------------------------------------
+--echo
+
+#
+# Preparation:
+#
+
+# - Create database with fixed, pre-defined character set.
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1|
+DROP DATABASE IF EXISTS mysqltest2|
+--enable_warnings
+
+CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
+CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
+
+use mysqltest1|
+
+# - Create two stored routines -- with and without explicit
+# CHARSET-clause for SP-variable;
+#
+
+--echo
+
+# - Procedure p1
+
+CREATE PROCEDURE p1(
+ INOUT парам1 CHAR(10),
+ OUT парам2 CHAR(10))
+BEGIN
+ DECLARE перем1 CHAR(10);
+
+ SELECT
+ COLLATION(перем1) AS c1,
+ COLLATION(парам1) AS c2,
+ COLLATION(парам2) AS c3;
+
+ SELECT
+ COLLATION('текст') AS c4,
+ COLLATION(_utf8 'текст') AS c5,
+ COLLATION(_koi8r '') AS c6,
+ @@collation_connection AS c7,
+ @@character_set_client AS c8;
+
+ SET парам1 = 'a';
+ SET парам2 = 'b';
+END|
+
+--echo
+
+# - Procedure p2
+
+CREATE PROCEDURE p2(
+ INOUT парам1 CHAR(10) CHARACTER SET utf8,
+ OUT парам2 CHAR(10) CHARACTER SET utf8)
+BEGIN
+ DECLARE перем1 CHAR(10) CHARACTER SET utf8;
+
+ SELECT
+ COLLATION(перем1) AS c1,
+ COLLATION(парам1) AS c2,
+ COLLATION(парам2) AS c3;
+
+ SELECT
+ COLLATION('текст') AS c4,
+ COLLATION(_utf8 'текст') AS c5,
+ COLLATION(_koi8r '') AS c6,
+ @@collation_connection AS c7,
+ @@character_set_client AS c8;
+
+ SET парам1 = 'a';
+ SET парам2 = 'b';
+END|
+
+--echo
+
+# - Procedure p3
+
+CREATE PROCEDURE mysqltest2.p3(
+ INOUT парам1 CHAR(10),
+ OUT парам2 CHAR(10))
+BEGIN
+ DECLARE перем1 CHAR(10);
+
+ SELECT
+ COLLATION(перем1) AS c1,
+ COLLATION(парам1) AS c2,
+ COLLATION(парам2) AS c3;
+
+ SELECT
+ COLLATION('текст') AS c4,
+ COLLATION(_utf8 'текст') AS c5,
+ COLLATION(_koi8r '') AS c6,
+ @@collation_connection AS c7,
+ @@character_set_client AS c8;
+
+ SET парам1 = 'a';
+ SET парам2 = 'b';
+END|
+
+--echo
+
+# - Procedure p4
+
+CREATE PROCEDURE mysqltest2.p4(
+ INOUT парам1 CHAR(10) CHARACTER SET utf8,
+ OUT парам2 CHAR(10) CHARACTER SET utf8)
+BEGIN
+ DECLARE перем1 CHAR(10) CHARACTER SET utf8;
+
+ SELECT
+ COLLATION(перем1) AS c1,
+ COLLATION(парам1) AS c2,
+ COLLATION(парам2) AS c3;
+
+ SELECT
+ COLLATION('текст') AS c4,
+ COLLATION(_utf8 'текст') AS c5,
+ COLLATION(_koi8r '') AS c6,
+ @@collation_connection AS c7,
+ @@character_set_client AS c8;
+
+ SET парам1 = 'a';
+ SET парам2 = 'b';
+END|
+
+#
+# First-round checks.
+#
+
+--source include/ddl_i18n.check_sp.inc
+
+#
+# Change running environment (alter database character set, change session
+# variables).
+#
+
+--echo
+--echo
+
+ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
+ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
+
+#
+# Second-round checks:
+#
+
+# - Change connection to flush SP-cache;
+
+--connect (con2,localhost,root,,mysqltest1)
+--echo
+--echo ---> connection: con2
+
+# - Switch environment variables and trigger loading stored procedures;
+
+SET @@character_set_client= cp1251|
+SET @@character_set_results= cp1251|
+SET @@collation_connection= cp1251_general_ci|
+
+CALL p1(@a, @b)|
+CALL p2(@a, @b)|
+CALL mysqltest2.p3(@a, @b)|
+CALL mysqltest2.p4(@a, @b)|
+
+# - Restore environment;
+
+set names utf8|
+
+# - Check!
+
+--source include/ddl_i18n.check_sp.inc
+
+#
+# Check mysqldump.
+#
+
+# - Dump mysqltest1, mysqltest2;
+
+--echo
+--echo ---> Dump of mysqltest1
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest1
+
+--echo
+--echo ---> Dumping mysqltest1 to ddl_i18n_utf8sp.mysqltest1.sql
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8sp.mysqltest1.sql
+
+--echo
+--echo ---> Dump of mysqltest2
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest2
+
+--echo
+--echo ---> Dumping mysqltest2 to ddl_i18n_utf8sp.mysqltest2.sql
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8sp.mysqltest2.sql
+
+# - Clean mysqltest1, mysqltest2;
+
+--echo
+--echo
+
+DROP DATABASE mysqltest1|
+DROP DATABASE mysqltest2|
+
+# - Restore mysqltest1;
+
+--echo
+--echo
+
+--echo ---> Restoring mysqltest1...
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8sp.mysqltest1.sql
+
+--echo ---> Restoring mysqltest2...
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8sp.mysqltest2.sql
+
+#
+# Third-round checks.
+#
+
+# - Change connection to flush SP-cache;
+
+--connect (con3,localhost,root,,mysqltest1)
+--echo
+--echo ---> connection: con3
+
+# - Switch environment variables and trigger loading stored procedures;
+
+SET @@character_set_client= cp1251|
+SET @@character_set_results= cp1251|
+SET @@collation_connection= cp1251_general_ci|
+
+CALL p1(@a, @b)|
+CALL p2(@a, @b)|
+CALL mysqltest2.p3(@a, @b)|
+CALL mysqltest2.p4(@a, @b)|
+
+# - Restore environment;
+
+set names utf8|
+
+# - Check!
+
+--source include/ddl_i18n.check_sp.inc
+
+#
+# Cleanup.
+#
+
+--connection default
+--echo
+--echo ---> connection: default
+
+--disconnect con2
+--disconnect con3
+
+use test|
+
+DROP DATABASE mysqltest1|
+DROP DATABASE mysqltest2|
+
+###########################################################################
+#
+# * Triggers.
+#
+###########################################################################
+
+--echo
+--echo -------------------------------------------------------------------
+--echo Triggers
+--echo -------------------------------------------------------------------
+--echo
+
+#
+# Preparation:
+#
+
+# - Create database with fixed, pre-defined character set;
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1|
+DROP DATABASE IF EXISTS mysqltest2|
+--enable_warnings
+
+CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
+CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
+
+use mysqltest1|
+
+# - Create tables for triggers;
+
+CREATE TABLE t1(c INT)|
+CREATE TABLE mysqltest2.t1(c INT)|
+
+# - Create log tables;
+
+CREATE TABLE log(msg VARCHAR(255))|
+CREATE TABLE mysqltest2.log(msg VARCHAR(255))|
+
+
+# - Create triggers -- with and without explicit CHARSET-clause for
+# SP-variable;
+#
+
+--echo
+
+# - Trigger trg1
+
+CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+ DECLARE перем1 CHAR(10);
+
+ INSERT INTO log VALUES(COLLATION(перем1));
+ INSERT INTO log VALUES(COLLATION('текст'));
+ INSERT INTO log VALUES(COLLATION(_utf8 'текст'));
+ INSERT INTO log VALUES(COLLATION(_koi8r ''));
+ INSERT INTO log VALUES(@@collation_connection);
+ INSERT INTO log VALUES(@@character_set_client);
+
+ SET @a1 = 'текст';
+ SET @a2 = _utf8 'текст';
+ SET @a3 = _koi8r '';
+END|
+
+--echo
+
+# - Trigger trg2
+
+CREATE TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW
+BEGIN
+ DECLARE перем1 CHAR(10) CHARACTER SET utf8;
+
+ INSERT INTO log VALUES(COLLATION(перем1));
+ INSERT INTO log VALUES(COLLATION('текст'));
+ INSERT INTO log VALUES(COLLATION(_utf8 'текст'));
+ INSERT INTO log VALUES(COLLATION(_koi8r ''));
+ INSERT INTO log VALUES(@@collation_connection);
+ INSERT INTO log VALUES(@@character_set_client);
+
+ SET @b1 = 'текст';
+ SET @b2 = _utf8 'текст';
+ SET @b3 = _koi8r '';
+END|
+
+--echo
+
+# - Trigger trg3
+
+CREATE TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW
+BEGIN
+ DECLARE перем1 CHAR(10);
+
+ INSERT INTO log VALUES(COLLATION(перем1));
+ INSERT INTO log VALUES(COLLATION('текст'));
+ INSERT INTO log VALUES(COLLATION(_utf8 'текст'));
+ INSERT INTO log VALUES(COLLATION(_koi8r ''));
+ INSERT INTO log VALUES(@@collation_connection);
+ INSERT INTO log VALUES(@@character_set_client);
+
+ SET @a1 = 'текст';
+ SET @a2 = _utf8 'текст';
+ SET @a3 = _koi8r '';
+END|
+
+--echo
+
+# - Trigger trg4
+
+CREATE TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW
+BEGIN
+ DECLARE перем1 CHAR(10) CHARACTER SET utf8;
+
+ INSERT INTO log VALUES(COLLATION(перем1));
+ INSERT INTO log VALUES(COLLATION('текст'));
+ INSERT INTO log VALUES(COLLATION(_utf8 'текст'));
+ INSERT INTO log VALUES(COLLATION(_koi8r ''));
+ INSERT INTO log VALUES(@@collation_connection);
+ INSERT INTO log VALUES(@@character_set_client);
+
+ SET @b1 = 'текст';
+ SET @b2 = _utf8 'текст';
+ SET @b3 = _koi8r '';
+END|
+
+--echo
+
+#
+# First-round checks.
+#
+
+--source include/ddl_i18n.check_triggers.inc
+
+#
+# Change running environment (alter database character set, change session
+# variables).
+#
+
+--echo
+--echo
+
+ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
+ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
+
+#
+# Second-round checks:
+#
+
+# - Flush table cache;
+
+ALTER TABLE t1 ADD COLUMN fake INT|
+ALTER TABLE t1 DROP COLUMN fake|
+
+ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT|
+ALTER TABLE mysqltest2.t1 DROP COLUMN fake|
+
+# - Switch environment variables and initiate loading of triggers
+# (connect using NULL database);
+
+--connect (con2,localhost,root,,)
+--echo
+--echo ---> connection: con2
+
+SET @@character_set_client= cp1251|
+SET @@character_set_results= cp1251|
+SET @@collation_connection= cp1251_general_ci|
+
+INSERT INTO mysqltest1.t1 VALUES(0)|
+INSERT INTO mysqltest2.t1 VALUES(0)|
+
+DELETE FROM mysqltest1.log|
+DELETE FROM mysqltest2.log|
+
+# - Restore environment;
+
+set names utf8|
+
+use mysqltest1|
+
+# - Check!
+
+--source include/ddl_i18n.check_triggers.inc
+
+#
+# Check mysqldump.
+#
+
+# - Dump mysqltest1, mysqltest2;
+
+--echo
+--echo ---> Dump of mysqltest1
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest1
+
+--echo
+--echo ---> Dumping mysqltest1 to ddl_i18n_utf8triggers.mysqltest1.sql
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8triggers.mysqltest1.sql
+
+--echo
+--echo ---> Dump of mysqltest2
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest2
+
+--echo
+--echo ---> Dumping mysqltest2 to ddl_i18n_utf8triggers.mysqltest2.sql
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8triggers.mysqltest2.sql
+
+# - Clean mysqltest1, mysqltest2;
+
+--echo
+--echo
+
+DROP DATABASE mysqltest1|
+DROP DATABASE mysqltest2|
+
+# - Restore mysqltest1;
+
+--echo
+--echo
+
+--echo ---> Restoring mysqltest1...
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8triggers.mysqltest1.sql
+
+--echo ---> Restoring mysqltest2...
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8triggers.mysqltest2.sql
+
+#
+# Third-round checks.
+#
+
+# - Flush table cache;
+
+ALTER TABLE mysqltest1.t1 ADD COLUMN fake INT|
+ALTER TABLE mysqltest1.t1 DROP COLUMN fake|
+
+ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT|
+ALTER TABLE mysqltest2.t1 DROP COLUMN fake|
+
+# - Switch environment variables and initiate loading of triggers
+# (connect using NULL database);
+
+--connect (con3,localhost,root,,)
+--echo
+--echo ---> connection: con3
+
+SET @@character_set_client= cp1251|
+SET @@character_set_results= cp1251|
+SET @@collation_connection= cp1251_general_ci|
+
+INSERT INTO mysqltest1.t1 VALUES(0)|
+INSERT INTO mysqltest2.t1 VALUES(0)|
+
+DELETE FROM mysqltest1.log|
+DELETE FROM mysqltest2.log|
+
+# - Restore environment;
+
+set names utf8|
+
+use mysqltest1|
+
+# - Check!
+
+--source include/ddl_i18n.check_triggers.inc
+
+#
+# Cleanup.
+#
+
+--connection default
+--echo
+--echo ---> connection: default
+
+--disconnect con2
+--disconnect con3
+
+use test|
+
+DROP DATABASE mysqltest1|
+DROP DATABASE mysqltest2|
+
+###########################################################################
+#
+# * Events
+#
+# We don't have EXECUTE EVENT so far, so this test is limited. It checks that
+# event with non-latin1 symbols can be created, dumped, restored and SHOW
+# statements work properly.
+#
+###########################################################################
+
+--echo
+--echo -------------------------------------------------------------------
+--echo Events
+--echo -------------------------------------------------------------------
+--echo
+
+#
+# Preparation:
+#
+
+# - Create database with fixed, pre-defined character set.
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1|
+DROP DATABASE IF EXISTS mysqltest2|
+--enable_warnings
+
+CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
+CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
+
+use mysqltest1|
+
+# - Create two stored routines -- with and without explicit
+# CHARSET-clause for SP-variable;
+#
+
+--echo
+
+# - Event ev1
+
+CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO
+BEGIN
+ DECLARE перем1 CHAR(10);
+
+ SELECT
+ COLLATION(перем1) AS c1,
+ COLLATION('текст') AS c2,
+ COLLATION(_utf8 'текст') AS c3,
+ COLLATION(_koi8r '') AS c4,
+ @@collation_connection AS c5,
+ @@character_set_client AS c6;
+END|
+
+--echo
+
+# - Event ev2
+
+CREATE EVENT ev2 ON SCHEDULE AT '2030-01-01 00:00:00' DO
+BEGIN
+ DECLARE перем1 CHAR(10) CHARACTER SET utf8;
+
+ SELECT
+ COLLATION(перем1) AS c1,
+ COLLATION('текст') AS c2,
+ COLLATION(_utf8 'текст') AS c3,
+ COLLATION(_koi8r '') AS c4,
+ @@collation_connection AS c5,
+ @@character_set_client AS c6;
+END|
+
+--echo
+
+# - Event ev3
+
+CREATE EVENT mysqltest2.ev3 ON SCHEDULE AT '2030-01-01 00:00:00' DO
+BEGIN
+ DECLARE перем1 CHAR(10) CHARACTER SET utf8;
+
+ SELECT
+ COLLATION(перем1) AS c1,
+ COLLATION('текст') AS c2,
+ COLLATION(_utf8 'текст') AS c3,
+ COLLATION(_koi8r '') AS c4,
+ @@collation_connection AS c5,
+ @@character_set_client AS c6;
+END|
+
+--echo
+
+# - Event ev4
+
+CREATE EVENT mysqltest2.ev4 ON SCHEDULE AT '2030-01-01 00:00:00' DO
+BEGIN
+ DECLARE перем1 CHAR(10) CHARACTER SET utf8;
+
+ SELECT
+ COLLATION(перем1) AS c1,
+ COLLATION('текст') AS c2,
+ COLLATION(_utf8 'текст') AS c3,
+ COLLATION(_koi8r '') AS c4,
+ @@collation_connection AS c5,
+ @@character_set_client AS c6;
+END|
+
+--echo
+
+
+#
+# First-round checks.
+#
+
+--source include/ddl_i18n.check_events.inc
+
+#
+# Change running environment (alter database character set, change session
+# variables).
+#
+
+--echo
+--echo
+
+ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
+ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
+
+#
+# Second-round checks:
+#
+
+# - Change connection to flush cache;
+
+--connect (con2,localhost,root,,mysqltest1)
+--echo
+--echo ---> connection: con2
+
+# - Switch environment variables and trigger loading stored procedures;
+
+SET @@character_set_client= cp1251|
+SET @@character_set_results= cp1251|
+SET @@collation_connection= cp1251_general_ci|
+
+--disable_result_log
+SHOW CREATE EVENT ev1|
+SHOW CREATE EVENT ev2|
+SHOW CREATE EVENT mysqltest2.ev3|
+SHOW CREATE EVENT mysqltest2.ev4|
+--enable_result_log
+
+# - Restore environment;
+
+set names utf8|
+
+# - Check!
+
+--source include/ddl_i18n.check_events.inc
+
+#
+# Check mysqldump.
+#
+
+# - Dump mysqltest1, mysqltest2;
+
+--echo
+--echo ---> Dump of mysqltest1
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest1
+
+--echo
+--echo ---> Dumping mysqltest1 to ddl_i18n_utf8events.mysqltest1.sql
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8events.mysqltest1.sql
+
+--echo
+--echo ---> Dump of mysqltest2
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest2
+
+--echo
+--echo ---> Dumping mysqltest2 to ddl_i18n_utf8events.mysqltest2.sql
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8events.mysqltest2.sql
+
+# - Clean mysqltest1, mysqltest2;
+
+--echo
+--echo
+
+DROP DATABASE mysqltest1|
+DROP DATABASE mysqltest2|
+
+# - Restore mysqltest1;
+
+--echo
+--echo
+
+--echo ---> Restoring mysqltest1...
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8events.mysqltest1.sql
+
+--echo ---> Restoring mysqltest2...
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8events.mysqltest2.sql
+
+#
+# Third-round checks.
+#
+
+# - Change connection to flush cache;
+
+--connect (con3,localhost,root,,mysqltest1)
+--echo
+--echo ---> connection: con3
+
+# - Switch environment variables and trigger loading stored procedures;
+
+SET @@character_set_client= cp1251|
+SET @@character_set_results= cp1251|
+SET @@collation_connection= cp1251_general_ci|
+
+--disable_result_log
+SHOW CREATE EVENT ev1|
+SHOW CREATE EVENT ev2|
+SHOW CREATE EVENT mysqltest2.ev3|
+SHOW CREATE EVENT mysqltest2.ev4|
+--enable_result_log
+
+# - Restore environment;
+
+set names utf8|
+
+# - Check!
+
+--source include/ddl_i18n.check_events.inc
+
+###########################################################################
+#
+# * DDL statements inside stored routine.
+#
+# Here we check that DDL statements use actual database collation even if they
+# are called from stored routine.
+#
+###########################################################################
+
+--echo
+--echo -------------------------------------------------------------------
+--echo DDL statements within stored routine.
+--echo -------------------------------------------------------------------
+--echo
+
+#
+# Preparation:
+#
+
+# - Create database with fixed, pre-defined character set.
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1|
+DROP DATABASE IF EXISTS mysqltest2|
+--enable_warnings
+
+CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
+CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
+
+use mysqltest1|
+
+# - Create procedures;
+
+--echo
+
+CREATE PROCEDURE p1()
+BEGIN
+ CREATE TABLE t1(col1 VARCHAR(10));
+ SHOW CREATE TABLE t1;
+END|
+
+--echo
+
+CREATE PROCEDURE mysqltest2.p2()
+BEGIN
+ CREATE TABLE t2(col1 VARCHAR(10));
+ SHOW CREATE TABLE t2;
+END|
+
+--echo
+
+#
+# First-round checks.
+#
+
+CALL p1()|
+
+--echo
+
+SHOW CREATE TABLE t1|
+
+--echo
+--echo
+
+CALL mysqltest2.p2()|
+
+--echo
+
+SHOW CREATE TABLE mysqltest2.t2|
+
+#
+# Alter database.
+#
+
+--echo
+
+ALTER DATABASE mysqltest1 COLLATE cp1251_general_cs|
+ALTER DATABASE mysqltest2 COLLATE cp1251_general_cs|
+
+DROP TABLE t1|
+DROP TABLE mysqltest2.t2|
+
+--echo
+
+#
+# Second-round checks.
+#
+
+CALL p1()|
+
+--echo
+
+SHOW CREATE TABLE t1|
+
+--echo
+--echo
+
+CALL mysqltest2.p2()|
+
+--echo
+
+SHOW CREATE TABLE mysqltest2.t2|
+
+###########################################################################
+#
+# That's it.
+#
+###########################################################################
+
+#
+# Cleanup.
+#
+
+--connection default
+--echo
+--echo ---> connection: default
+
+--disconnect con2
+--disconnect con3
+
+use test|
+
+DROP DATABASE mysqltest1|
+DROP DATABASE mysqltest2|
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index 29336e1050d..32de2077e81 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -19,7 +19,7 @@ im_instance_conf : Bug#20294 2007-05-30 alik Instance manager tests
im_life_cycle : BUG#27851 Instance manager dies on ASSERT in ~Thread_registry() or from not being able to close a mysqld instance.
im_instance_conf : BUG#28743 Instance manager generates warnings in test suite
im_utils : BUG#28743 Instance manager generates warnings in test suite
-
+innodb : Disabling test case awaiting reply from Innobase
concurrent_innodb : BUG#21579 2006-08-11 mleich innodb_concurrent random failures with varying differences
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
@@ -36,6 +36,9 @@ rpl_ndb_myisam2ndb : Bug #19710 Cluster replication to partition table fa
#rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly
rpl_ndb_ddl : BUG#28798 2007-05-31 lars Valgrind failure in NDB
+rpl_invoked_features : BUG#29020 2007-06-21 Lars Non-deterministic test case
+ctype_big5 : BUG#26711 2007-06-21 Lars Test has never worked on Double Whopper
+
# 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
#ndb_binlog_discover : bug#21806 2006-08-24
diff --git a/mysql-test/t/errors.test b/mysql-test/t/errors.test
index 4fbdcba635f..89579ec1739 100644
--- a/mysql-test/t/errors.test
+++ b/mysql-test/t/errors.test
@@ -53,4 +53,17 @@ INSERT INTO t1 VALUES(2),(3);
SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
DROP TABLE t1;
+#
+# Bug #28677: SELECT on missing column gives extra error
+#
+CREATE TABLE t1( a INT );
+--error ER_BAD_FIELD_ERROR
+SELECT b FROM t1;
+SHOW ERRORS;
+--error ER_BAD_FIELD_ERROR
+CREATE TABLE t2 SELECT b FROM t1;
+SHOW ERRORS;
+--error ER_BAD_FIELD_ERROR
+INSERT INTO t1 SELECT b FROM t1;
+DROP TABLE t1;
# End of 5.0 tests
diff --git a/mysql-test/t/events.test b/mysql-test/t/events.test
index dcb591352a8..d7232705b81 100644
--- a/mysql-test/t/events.test
+++ b/mysql-test/t/events.test
@@ -185,7 +185,30 @@ set names cp1251;
create event 21 on schedule every '50:23:59:95' day_second COMMENT ' 1251 ' do select 1;
--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT 21;
-insert into mysql.event (db, name, body, definer, interval_value, interval_field, originator) values (database(), "root22", "select 1", user(), 100, "SECOND_MICROSECOND", 1);
+insert into mysql.event (
+ db,
+ name,
+ body,
+ definer,
+ interval_value,
+ interval_field,
+ originator,
+ character_set_client,
+ collation_connection,
+ db_collation,
+ body_utf8)
+values (
+ database(),
+ "root22",
+ "select 1",
+ user(),
+ 100,
+ "SECOND_MICROSECOND",
+ 1,
+ 'utf8',
+ 'utf8_general_ci',
+ 'utf8_general_ci',
+ 'select 1');
--error ER_NOT_SUPPORTED_YET
show create event root22;
--error ER_NOT_SUPPORTED_YET
diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test
index f369fbecd66..4186b4701fa 100644
--- a/mysql-test/t/events_bugs.test
+++ b/mysql-test/t/events_bugs.test
@@ -648,7 +648,69 @@ CREATE EVENT new_event ON SCHEDULE AT NOW() ENDS NOW() DO SELECT 1;
--error ER_PARSE_ERROR
CREATE EVENT new_event ON SCHEDULE AT NOW() STARTS NOW() ENDS NOW() DO SELECT 1;
-
+#
+# START - BUG#28924 If I drop the user who is the definer of an active event then server cores
+#
+let $engine=MyISAM;
+USE test;
+SHOW GRANTS FOR CURRENT_USER;
+SET GLOBAL event_scheduler = ON;
+eval CREATE TABLE event_log (id int KEY AUTO_INCREMENT,
+ ev_nm char(40), ev_cnt int,
+ ev_tm timestamp) ENGINE=$engine;
+SET @ev_base_date = 20281224180000;
+--disable_warnings
+SET autocommit=0;
+#DROP DATABASE IF EXISTS ev_db_1;
+#CREATE DATABASE ev_db_1;
+--enable_warnings
+CREATE USER evtest1@localhost;
+SET PASSWORD FOR evtest1@localhost = password('ev1');
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM evtest1@localhost;
+GRANT create, insert, select, event ON events_test.* TO evtest1@localhost;
+GRANT select,insert ON test.* TO evtest1@localhost;
+SHOW GRANTS FOR evtest1@localhost;
+
+--echo connection e1;
+--replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
+connect (e1,localhost,evtest1,ev1,events_test,$MASTER_MYPORT,$MASTER_MYSOCK);
+USE events_test;
+
+DELIMITER |;
+CREATE EVENT ev_sched_1823 ON SCHEDULE EVERY 2 SECOND
+DO BEGIN
+ SET AUTOCOMMIT = 0;
+ SET @evname = 'ev_sched_1823';
+ SET @cnt = 0;
+ SELECT COUNT(*) INTO @cnt FROM test.event_log WHERE ev_nm = @evname;
+ IF @cnt < 6 THEN
+ INSERT INTO test.event_log VALUES (NULL,@evname,@cnt+1,current_timestamp());
+ COMMIT;
+ END IF;
+ SELECT COUNT(*) INTO @cnt FROM test.event_log WHERE ev_nm = @evname;
+ IF @cnt < 6 THEN
+ INSERT INTO test.event_log VALUES (NULL,@evname,@cnt+1,current_timestamp());
+ ROLLBACK;
+ END IF;
+END;|
+DELIMITER ;|
+
+--sleep 6
+--echo connection default;
+DROP EVENT ev_sched_1823;
+connection default;
+DROP USER evtest1@localhost;
+
+--sleep 6
+USE test;
+--echo =====================================================================================
+--sleep 5
+#--disable_result_log
+select id,ev_nm,ev_cnt from event_log order by id;
+#--enable_result_log
+DROP TABLE event_log;
+#DROP DATABASE ev_db_1;
+SET GLOBAL event_scheduler = OFF;
#
# End of tests
diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test
index 3a4f2f2f5f2..d58d038c3ea 100644
--- a/mysql-test/t/flush.test
+++ b/mysql-test/t/flush.test
@@ -133,4 +133,28 @@ disconnect con3;
connection default;
drop table t1, t2;
-# End of 5.0 tests
+--echo End of 5.0 tests
+
+#
+# Bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock
+#
+set @old_general_log= @@general_log;
+set @old_read_only= @@read_only;
+set global general_log= on;
+
+flush tables with read lock;
+flush logs;
+unlock tables;
+
+set global read_only=1;
+flush logs;
+unlock tables;
+
+flush tables with read lock;
+flush logs;
+unlock tables;
+
+set global general_log= @old_general_log;
+set global read_only= @old_read_only;
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
index 4d28ebf9404..9e0e6b9caf9 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -95,7 +95,9 @@ select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
#
# Test for BUG#9535
#
+--disable_warnings
create table t1 as select uuid(), length(uuid());
+--enable_warnings
show create table t1;
drop table t1;
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index ddb3d2baf7f..945f5a050f4 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -1183,4 +1183,52 @@ SELECT * FROM (SELECT * FROM v1) x;
DROP TABLE t1, t2;
DROP VIEW v1;
+#
+# Bug #27932: LOCATE with argument evaluated to NULL
+#
+
+SELECT LOCATE('foo', NULL) FROM DUAL;
+SELECT LOCATE(NULL, 'o') FROM DUAL;
+SELECT LOCATE(NULL, NULL) FROM DUAL;
+SELECT LOCATE('foo', NULL) IS NULL FROM DUAL;
+SELECT LOCATE(NULL, 'o') IS NULL FROM DUAL;
+SELECT LOCATE(NULL, NULL) IS NULL FROM DUAL;
+SELECT ISNULL(LOCATE('foo', NULL)) FROM DUAL;
+SELECT ISNULL(LOCATE(NULL, 'o')) FROM DUAL;
+SELECT ISNULL(LOCATE(NULL, NULL)) FROM DUAL;
+SELECT LOCATE('foo', NULL) <=> NULL FROM DUAL;
+SELECT LOCATE(NULL, 'o') <=> NULL FROM DUAL;
+SELECT LOCATE(NULL, NULL) <=> NULL FROM DUAL;
+
+CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a varchar(10), p varchar(10));
+
+INSERT INTO t1 VALUES (1, 'foo', 'o');
+INSERT INTO t1 VALUES (2, 'foo', NULL);
+INSERT INTO t1 VALUES (3, NULL, 'o');
+INSERT INTO t1 VALUES (4, NULL, NULL);
+
+SELECT id, LOCATE(a,p) FROM t1;
+SELECT id, LOCATE(a,p) IS NULL FROM t1;
+SELECT id, ISNULL(LOCATE(a,p)) FROM t1;
+SELECT id, LOCATE(a,p) <=> NULL FROM t1;
+SELECT id FROM t1 WHERE LOCATE(a,p) IS NULL;
+SELECT id FROM t1 WHERE LOCATE(a,p) <=> NULL;
+
+DROP TABLE t1;
+
+#
+# Bug #27130: SUBSTR with UNSIGNED 0 as the last argument
+#
+
+SELECT SUBSTR('foo',1,0) FROM DUAL;
+SELECT SUBSTR('foo',1,CAST(0 AS SIGNED)) FROM DUAL;
+SELECT SUBSTR('foo',1,CAST(0 AS UNSIGNED)) FROM DUAL;
+
+CREATE TABLE t1 (a varchar(10), len int unsigned);
+INSERT INTO t1 VALUES ('bar', 2), ('foo', 0);
+
+SELECT SUBSTR(a,1,len) FROM t1;
+
+DROP TABLE t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test
index 7324e8582de..cf25b4c61be 100644
--- a/mysql-test/t/group_min_max.test
+++ b/mysql-test/t/group_min_max.test
@@ -895,3 +895,25 @@ DELETE FROM t3 WHERE (SELECT (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) x
SHOW STATUS LIKE 'handler_read__e%';
DROP TABLE t1,t2,t3;
+
+#
+# Bug#25602: queries with DISTINCT and SQL_BIG_RESULT hint
+# for which loose scan optimization is applied
+#
+
+CREATE TABLE t1 (a int, INDEX idx(a));
+INSERT INTO t1 VALUES
+ (4), (2), (1), (2), (4), (2), (1), (4),
+ (4), (2), (1), (2), (2), (4), (1), (4);
+
+EXPLAIN SELECT DISTINCT(a) FROM t1;
+SELECT DISTINCT(a) FROM t1;
+EXPLAIN SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1;
+SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1;
+
+DROP TABLE t1;
+
+
+
+
+
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 755419cbf52..9babeddbae2 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -825,7 +825,7 @@ drop table t1;
use mysql;
INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL',
'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03',
-'2006-03-02 18:40:03','','');
+'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a');
select routine_name from information_schema.routines;
delete from proc where name='';
use test;
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 92714492dcf..1ca6b8b4d98 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -13,7 +13,6 @@
-- source include/not_embedded.inc
-- source include/have_innodb.inc
--- source include/have_log_bin.inc
#
# Small basic test with ignore
@@ -756,6 +755,45 @@ select * from t2;
drop table t1,t2;
#
+# Bug#27716 multi-update did partially and has not binlogged
+#
+
+CREATE TABLE `t1` (
+ `a` int(11) NOT NULL auto_increment,
+ `b` int(11) default NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
+
+CREATE TABLE `t2` (
+ `a` int(11) NOT NULL auto_increment,
+ `b` int(11) default NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=INNODB DEFAULT CHARSET=latin1 ;
+
+# A. testing multi_update::send_eof() execution branch
+insert into t1 values (1,1),(2,2);
+insert into t2 values (1,1),(4,4);
+reset master;
+--error ER_DUP_ENTRY_WITH_KEY_NAME
+UPDATE t2,t1 SET t2.a=t1.a+2;
+# check
+select * from t2 /* must be (3,1), (4,4) */;
+show master status /* there must no UPDATE in binlog */;
+
+# B. testing multi_update::send_error() execution branch
+delete from t1;
+delete from t2;
+insert into t1 values (1,2),(3,4),(4,4);
+insert into t2 values (1,2),(3,4),(4,4);
+reset master;
+--error ER_DUP_ENTRY_WITH_KEY_NAME
+UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
+show master status /* there must be no UPDATE query event */;
+
+# cleanup bug#27716
+drop table t1, t2;
+
+#
# Testing of IFNULL
#
create table t1 (a int, b int) engine=innodb;
@@ -1149,41 +1187,6 @@ drop table t2, t1;
#
-# Let us test binlog_cache_use and binlog_cache_disk_use status vars.
-# Actually this test has nothing to do with innodb per se, it just requires
-# transactional table.
-#
-flush status;
-show status like "binlog_cache_use";
-show status like "binlog_cache_disk_use";
-
-create table t1 (a int) engine=innodb;
-
-# Now we are going to create transaction which is long enough so its
-# transaction binlog will be flushed to disk...
-let $1=2000;
-disable_query_log;
-begin;
-while ($1)
-{
- eval insert into t1 values( $1 );
- dec $1;
-}
-commit;
-enable_query_log;
-show status like "binlog_cache_use";
-show status like "binlog_cache_disk_use";
-
-# Transaction which should not be flushed to disk and so should not
-# increase binlog_cache_disk_use.
-begin;
-delete from t1;
-commit;
-show status like "binlog_cache_use";
-show status like "binlog_cache_disk_use";
-drop table t1;
-
-#
# Bug #6126: Duplicate columns in keys gives misleading error message
#
--error 1060
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test
index 655b43d65ad..10bc58303ca 100644
--- a/mysql-test/t/insert_select.test
+++ b/mysql-test/t/insert_select.test
@@ -233,7 +233,9 @@ drop table t1,t2;
CREATE TABLE t1 (a int PRIMARY KEY);
INSERT INTO t1 values (1), (2);
+flush status;
INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1;
+show status like 'Handler_read%';
DROP TABLE t1;
@@ -319,3 +321,26 @@ INSERT INTO t2 (d)
SELECT * FROM t2;
DROP TABLE t1,t2;
+
+#
+# Bug #29095: incorrect pushing of LIMIT into the temporary
+# table ignoring ORDER BY clause
+#
+
+CREATE TABLE t1 (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ prev_id INT,
+ join_id INT DEFAULT 0);
+
+INSERT INTO t1 (prev_id) VALUES (NULL), (1), (2);
+SELECT * FROM t1;
+
+CREATE TABLE t2 (join_id INT);
+INSERT INTO t2 (join_id) VALUES (0);
+
+INSERT INTO t1 (prev_id) SELECT id
+ FROM t2 LEFT JOIN t1 ON t1.join_id = t2.join_id
+ ORDER BY id DESC LIMIT 1;
+SELECT * FROM t1;
+
+DROP TABLE t1,t2;
diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test
index 959938dcb03..5d5095f7d61 100644
--- a/mysql-test/t/kill.test
+++ b/mysql-test/t/kill.test
@@ -81,7 +81,9 @@ connection conn2;
connection conn1;
-- disable_result_log
-send select id from t1 where id in (select distinct id from t2);
+# This is a very long running query. If this test start failing, it may
+# be necessary to change to an even longer query.
+send select id from t1 where id in (select distinct a.id from t2 a, t2 b, t2 c, t2 d group by a.id, b.id, c.id, d.id having a.id between 10 and 20);
-- enable_result_log
connection conn2;
diff --git a/mysql-test/t/loaddata_autocom_ndb.test b/mysql-test/t/loaddata_autocom_ndb.test
index f4a6743aabe..a6a3aec2c4e 100644
--- a/mysql-test/t/loaddata_autocom_ndb.test
+++ b/mysql-test/t/loaddata_autocom_ndb.test
@@ -1,4 +1,5 @@
--source include/have_ndb.inc
+--source include/have_binlog_format_mixed_or_row.inc
let $engine_type=ndbcluster;
--source include/loaddata_autocom.inc
diff --git a/mysql-test/t/metadata.test b/mysql-test/t/metadata.test
index df4acec2021..65c062399b7 100644
--- a/mysql-test/t/metadata.test
+++ b/mysql-test/t/metadata.test
@@ -90,5 +90,26 @@ select a.* from (select 2147483648 as v_large) a;
select a.* from (select 214748364 as v_small) a;
--disable_metadata
+#
+# Bug #28898: table alias and database name of VIEW columns is empty in the
+# metadata of # SELECT statement where join is executed via temporary table.
+#
+
+CREATE TABLE t1 (c1 CHAR(1));
+CREATE TABLE t2 (c2 CHAR(1));
+CREATE VIEW v1 AS SELECT t1.c1 FROM t1;
+CREATE VIEW v2 AS SELECT t2.c2 FROM t2;
+INSERT INTO t1 VALUES ('1'), ('2'), ('3');
+INSERT INTO t2 VALUES ('1'), ('2'), ('3'), ('2');
+
+--enable_metadata
+SELECT v1.c1 FROM v1 JOIN t2 ON c1=c2 ORDER BY 1;
+SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2;
+SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2 GROUP BY v1.c1;
+SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2 GROUP BY v1.c1 ORDER BY v2.c2;
+--disable_metadata
+
+DROP VIEW v1,v2;
+DROP TABLE t1,t2;
--echo End of 5.0 tests
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index 9cd93f2c7dd..6f5ac70a34b 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -3,7 +3,8 @@
#
# Requires grants, so won't work with embedded server test
--- source include/not_embedded.inc
+source include/not_embedded.inc;
+source include/have_log_bin.inc;
--disable_warnings
drop table if exists t1,t2,t3;
@@ -570,3 +571,48 @@ delete t1.*,t2.* from t1,t2 where t1.i2=t2.id;
select * from t1 order by i1;
select * from t2 order by id;
drop table t1, t2;
+
+#
+# Bug#27716 multi-update did partially and has not binlogged
+#
+CREATE TABLE `t1` (
+ `a` int(11) NOT NULL auto_increment,
+ `b` int(11) default NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
+
+CREATE TABLE `t2` (
+ `a` int(11) NOT NULL auto_increment,
+ `b` int(11) default NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
+
+# as the test is about to see erroed queries in binlog
+set @@session.binlog_format= mixed;
+
+
+# A. testing multi_update::send_error() effective update
+insert into t1 values (1,1),(2,2);
+insert into t2 values (1,1),(4,4);
+reset master;
+error ER_DUP_ENTRY;
+UPDATE t2,t1 SET t2.a=t1.a+2;
+# check
+select * from t2 /* must be (3,1), (4,4) */;
+show master status /* there must be the UPDATE query event */;
+
+# B. testing multi_update::send_error() ineffective update
+# (as there is a policy described at mysql_update() still go to binlog)
+delete from t1;
+delete from t2;
+insert into t1 values (1,2),(3,4),(4,4);
+insert into t2 values (1,2),(3,4),(4,4);
+reset master;
+error ER_DUP_ENTRY;
+UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
+show master status /* there must be the UPDATE query event */;
+
+# cleanup bug#27716
+drop table t1, t2;
+
+--echo end of tests
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index 39a84304ebd..92f4b34da83 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -206,6 +206,19 @@ flush logs;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000010
+#
+# Bug#28293 missed '#' sign in the hex dump when the dump length
+# is divisible by 16.
+#
+
+CREATE TABLE t1 (c1 CHAR(10));
+# we need this for getting fixed timestamps inside of this test
+flush logs;
+INSERT INTO t1 VALUES ('0123456789');
+flush logs;
+DROP TABLE t1;
+--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000012 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g'
+
--echo End of 5.0 tests
#
@@ -213,7 +226,7 @@ flush logs;
#
flush logs;
--error 1
---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000012 >/dev/null 2>/dev/null
---exec $MYSQL_BINLOG --force-if-open $MYSQLTEST_VARDIR/log/master-bin.000012 >/dev/null 2>/dev/null
+--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000014 >/dev/null 2>/dev/null
+--exec $MYSQL_BINLOG --force-if-open $MYSQLTEST_VARDIR/log/master-bin.000014 >/dev/null 2>/dev/null
--echo End of 5.1 tests
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index c4a8847d19b..aa0e2f89382 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -837,6 +837,10 @@ while ($num)
}
--enable_abort_on_error
--enable_query_log
+
+# Test source $variable/<filename>
+--source $MYSQLTEST_VARDIR/tmp/sourced.inc
+
--remove_file $MYSQLTEST_VARDIR/tmp/sourced.inc
# ----------------------------------------------------------------------------
diff --git a/mysql-test/t/ndb_alter_table.test b/mysql-test/t/ndb_alter_table.test
index a7b52d54710..d85e4900337 100644
--- a/mysql-test/t/ndb_alter_table.test
+++ b/mysql-test/t/ndb_alter_table.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/have_multi_ndb.inc
-- source include/not_embedded.inc
diff --git a/mysql-test/t/ndb_alter_table2.test b/mysql-test/t/ndb_alter_table2.test
index afe6e44f698..654453cc4cf 100644
--- a/mysql-test/t/ndb_alter_table2.test
+++ b/mysql-test/t/ndb_alter_table2.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/have_multi_ndb.inc
-- source include/not_embedded.inc
diff --git a/mysql-test/t/ndb_alter_table3.test b/mysql-test/t/ndb_alter_table3.test
index a5fe613adcf..2f8f9ebcf89 100644
--- a/mysql-test/t/ndb_alter_table3.test
+++ b/mysql-test/t/ndb_alter_table3.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/have_multi_ndb.inc
-- source include/not_embedded.inc
diff --git a/mysql-test/t/ndb_autodiscover.test b/mysql-test/t/ndb_autodiscover.test
index 06d47693c10..6e70b8f5979 100644
--- a/mysql-test/t/ndb_autodiscover.test
+++ b/mysql-test/t/ndb_autodiscover.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_autodiscover2.test b/mysql-test/t/ndb_autodiscover2.test
index ebe14696cd2..360ce7195a8 100644
--- a/mysql-test/t/ndb_autodiscover2.test
+++ b/mysql-test/t/ndb_autodiscover2.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
#
diff --git a/mysql-test/t/ndb_autodiscover3.test b/mysql-test/t/ndb_autodiscover3.test
index d0b9d0983e9..36ee191c065 100644
--- a/mysql-test/t/ndb_autodiscover3.test
+++ b/mysql-test/t/ndb_autodiscover3.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/have_multi_ndb.inc
-- source include/ndb_default_cluster.inc
-- source include/not_embedded.inc
diff --git a/mysql-test/t/ndb_backup_print.test b/mysql-test/t/ndb_backup_print.test
index 1e516f03ae6..cf869fd56f5 100644
--- a/mysql-test/t/ndb_backup_print.test
+++ b/mysql-test/t/ndb_backup_print.test
@@ -64,3 +64,5 @@ insert into t1 values
#NO.2 test output of backup after some simple SQL operations
--exec $NDB_MGM --no-defaults -e "start backup" |sed -e 's/[0-9]//g' |sed -e 's/localhost//g' |sed -e 's/\.\.\.*//g'
+
+drop table t1;
diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test
index b9ccdf9fd0d..8ef231599fa 100644
--- a/mysql-test/t/ndb_basic.test
+++ b/mysql-test/t/ndb_basic.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_binlog_basic2.test b/mysql-test/t/ndb_binlog_basic2.test
deleted file mode 100644
index bcc6b503320..00000000000
--- a/mysql-test/t/ndb_binlog_basic2.test
+++ /dev/null
@@ -1,15 +0,0 @@
--- source include/have_ndb.inc
--- source include/have_log_bin.inc
-
---error ER_NDB_CANT_SWITCH_BINLOG_FORMAT
-set session binlog_format=row;
---error ER_NDB_CANT_SWITCH_BINLOG_FORMAT
-set session binlog_format=statement;
---error ER_NDB_CANT_SWITCH_BINLOG_FORMAT
-set global binlog_format=row;
---error ER_NDB_CANT_SWITCH_BINLOG_FORMAT
-set global binlog_format=statement;
---error ER_NDB_CANT_SWITCH_BINLOG_FORMAT
-set session binlog_format=default;
---error ER_NDB_CANT_SWITCH_BINLOG_FORMAT
-set global binlog_format=default;
diff --git a/mysql-test/t/ndb_binlog_log_bin.test b/mysql-test/t/ndb_binlog_log_bin.test
index b2dbaa797b6..63b84134824 100644
--- a/mysql-test/t/ndb_binlog_log_bin.test
+++ b/mysql-test/t/ndb_binlog_log_bin.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/have_multi_ndb.inc
-- source include/have_binlog_format_row.inc
diff --git a/mysql-test/t/ndb_binlog_multi.test b/mysql-test/t/ndb_binlog_multi.test
index c227c7fec93..4256b0bf993 100644
--- a/mysql-test/t/ndb_binlog_multi.test
+++ b/mysql-test/t/ndb_binlog_multi.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/have_multi_ndb.inc
-- source include/have_binlog_format_row.inc
diff --git a/mysql-test/t/ndb_bitfield.test b/mysql-test/t/ndb_bitfield.test
index de0ae23bfe6..c8454f38cca 100644
--- a/mysql-test/t/ndb_bitfield.test
+++ b/mysql-test/t/ndb_bitfield.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_blob.test b/mysql-test/t/ndb_blob.test
index b9a8c7e20ee..b565de74c26 100644
--- a/mysql-test/t/ndb_blob.test
+++ b/mysql-test/t/ndb_blob.test
@@ -1,4 +1,5 @@
--source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_blob_partition.test b/mysql-test/t/ndb_blob_partition.test
index 35df57b96ba..13ad2ecc7c3 100644
--- a/mysql-test/t/ndb_blob_partition.test
+++ b/mysql-test/t/ndb_blob_partition.test
@@ -1,4 +1,5 @@
--source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_query_log
diff --git a/mysql-test/t/ndb_cache.test b/mysql-test/t/ndb_cache.test
index 9c299b61c24..d8cb8b01e86 100644
--- a/mysql-test/t/ndb_cache.test
+++ b/mysql-test/t/ndb_cache.test
@@ -1,4 +1,5 @@
-- source include/have_query_cache.inc
+-- source include/have_binlog_format_row.inc
-- source include/have_ndb.inc
-- source include/not_embedded.inc
diff --git a/mysql-test/t/ndb_cache2.test b/mysql-test/t/ndb_cache2.test
index 352b01ef73f..27d39b09cf6 100644
--- a/mysql-test/t/ndb_cache2.test
+++ b/mysql-test/t/ndb_cache2.test
@@ -1,4 +1,5 @@
-- source include/have_query_cache.inc
+-- source include/have_binlog_format_row.inc
-- source include/have_ndb.inc
-- source include/not_embedded.inc
diff --git a/mysql-test/t/ndb_cache_multi.test b/mysql-test/t/ndb_cache_multi.test
index 404393c211e..a7095139285 100644
--- a/mysql-test/t/ndb_cache_multi.test
+++ b/mysql-test/t/ndb_cache_multi.test
@@ -1,4 +1,5 @@
-- source include/have_query_cache.inc
+-- source include/have_binlog_format_row.inc
-- source include/have_ndb.inc
-- source include/have_multi_ndb.inc
-- source include/not_embedded.inc
diff --git a/mysql-test/t/ndb_cache_multi2.test b/mysql-test/t/ndb_cache_multi2.test
index 2afcf0c18f7..40cc41f1c97 100644
--- a/mysql-test/t/ndb_cache_multi2.test
+++ b/mysql-test/t/ndb_cache_multi2.test
@@ -1,4 +1,5 @@
-- source include/have_query_cache.inc
+-- source include/have_binlog_format_row.inc
-- source include/have_ndb.inc
-- source include/have_multi_ndb.inc
-- source include/not_embedded.inc
diff --git a/mysql-test/t/ndb_charset.test b/mysql-test/t/ndb_charset.test
index 2d9f66564bc..b36b70be94c 100644
--- a/mysql-test/t/ndb_charset.test
+++ b/mysql-test/t/ndb_charset.test
@@ -1,4 +1,5 @@
--source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_condition_pushdown.test b/mysql-test/t/ndb_condition_pushdown.test
index ab56430ac1d..9df494aa3ab 100644
--- a/mysql-test/t/ndb_condition_pushdown.test
+++ b/mysql-test/t/ndb_condition_pushdown.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_config.test b/mysql-test/t/ndb_config.test
index f63c0087c1e..eb52bd249d6 100644
--- a/mysql-test/t/ndb_config.test
+++ b/mysql-test/t/ndb_config.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/ndb_default_cluster.inc
-- source include/not_embedded.inc
diff --git a/mysql-test/t/ndb_config2.test b/mysql-test/t/ndb_config2.test
index 170f1b2e5e7..20946b53552 100644
--- a/mysql-test/t/ndb_config2.test
+++ b/mysql-test/t/ndb_config2.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/ndb_default_cluster.inc
-- source include/not_embedded.inc
diff --git a/mysql-test/t/ndb_cursor.test b/mysql-test/t/ndb_cursor.test
index 406f8629cfe..1ef745a13f7 100644
--- a/mysql-test/t/ndb_cursor.test
+++ b/mysql-test/t/ndb_cursor.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_database.test b/mysql-test/t/ndb_database.test
index 8bfdf40de88..409ac33502a 100644
--- a/mysql-test/t/ndb_database.test
+++ b/mysql-test/t/ndb_database.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_dd_alter.test b/mysql-test/t/ndb_dd_alter.test
index 7635a8944da..ee58968247f 100644
--- a/mysql-test/t/ndb_dd_alter.test
+++ b/mysql-test/t/ndb_dd_alter.test
@@ -40,6 +40,7 @@
##############################################################
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/have_innodb.inc
-- source include/not_embedded.inc
diff --git a/mysql-test/t/ndb_dd_backuprestore.test b/mysql-test/t/ndb_dd_backuprestore.test
index 48db8ec3e0b..156ff88718e 100644
--- a/mysql-test/t/ndb_dd_backuprestore.test
+++ b/mysql-test/t/ndb_dd_backuprestore.test
@@ -5,6 +5,7 @@
########################################
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/ndb_default_cluster.inc
-- source include/not_embedded.inc
diff --git a/mysql-test/t/ndb_dd_basic.test b/mysql-test/t/ndb_dd_basic.test
index 3acf4669868..d20ffc6e4bd 100644
--- a/mysql-test/t/ndb_dd_basic.test
+++ b/mysql-test/t/ndb_dd_basic.test
@@ -13,6 +13,7 @@
#################################
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/t/ndb_dd_ddl.test b/mysql-test/t/ndb_dd_ddl.test
index aa692385b07..10229e4c0c2 100644
--- a/mysql-test/t/ndb_dd_ddl.test
+++ b/mysql-test/t/ndb_dd_ddl.test
@@ -27,6 +27,7 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/t/ndb_dd_disk2memory.test b/mysql-test/t/ndb_dd_disk2memory.test
index 5975f44e087..760a1377bdf 100644
--- a/mysql-test/t/ndb_dd_disk2memory.test
+++ b/mysql-test/t/ndb_dd_disk2memory.test
@@ -6,6 +6,7 @@
########################################
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
--disable_warnings
DROP TABLE IF EXISTS test.t1;
diff --git a/mysql-test/t/ndb_dd_dump.test b/mysql-test/t/ndb_dd_dump.test
index 38ceafb7d80..54128d075ca 100644
--- a/mysql-test/t/ndb_dd_dump.test
+++ b/mysql-test/t/ndb_dd_dump.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
--disable_warnings
DROP TABLE IF EXISTS t1, t2, t3;
diff --git a/mysql-test/t/ndb_dd_sql_features.test b/mysql-test/t/ndb_dd_sql_features.test
index f46cb217ab4..ae8f6a7b9e7 100644
--- a/mysql-test/t/ndb_dd_sql_features.test
+++ b/mysql-test/t/ndb_dd_sql_features.test
@@ -26,6 +26,7 @@
# gives a better idea of what the test is about
###########################################################
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
--disable_warnings
DROP TABLE IF EXISTS test.t1;
diff --git a/mysql-test/t/ndb_gis.test b/mysql-test/t/ndb_gis.test
index e14f462c32d..104fdf41734 100644
--- a/mysql-test/t/ndb_gis.test
+++ b/mysql-test/t/ndb_gis.test
@@ -1,4 +1,5 @@
--source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
SET storage_engine=ndbcluster;
--source include/gis_generic.inc
set engine_condition_pushdown = on;
diff --git a/mysql-test/t/ndb_index.test b/mysql-test/t/ndb_index.test
index 272f30e3e6f..fc284407973 100644
--- a/mysql-test/t/ndb_index.test
+++ b/mysql-test/t/ndb_index.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_index_ordered.test b/mysql-test/t/ndb_index_ordered.test
index 782f17ca5b2..95b64eeef21 100644
--- a/mysql-test/t/ndb_index_ordered.test
+++ b/mysql-test/t/ndb_index_ordered.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_index_unique.test b/mysql-test/t/ndb_index_unique.test
index 78757c3bcf7..ecd4077bb56 100644
--- a/mysql-test/t/ndb_index_unique.test
+++ b/mysql-test/t/ndb_index_unique.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_insert.test b/mysql-test/t/ndb_insert.test
index 5b74cc9202c..4b347e1a1ad 100644
--- a/mysql-test/t/ndb_insert.test
+++ b/mysql-test/t/ndb_insert.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_limit.test b/mysql-test/t/ndb_limit.test
index 01613606d66..b0d189ff5d9 100644
--- a/mysql-test/t/ndb_limit.test
+++ b/mysql-test/t/ndb_limit.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_loaddatalocal.test b/mysql-test/t/ndb_loaddatalocal.test
index 3eae3891f43..7453ae1bd64 100644
--- a/mysql-test/t/ndb_loaddatalocal.test
+++ b/mysql-test/t/ndb_loaddatalocal.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_lock.test b/mysql-test/t/ndb_lock.test
index b6cd1ca7eb4..e677cba8e59 100644
--- a/mysql-test/t/ndb_lock.test
+++ b/mysql-test/t/ndb_lock.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
connect (con1,localhost,root,,);
diff --git a/mysql-test/t/ndb_minmax.test b/mysql-test/t/ndb_minmax.test
index a3ac677cd2a..4d9f132194a 100644
--- a/mysql-test/t/ndb_minmax.test
+++ b/mysql-test/t/ndb_minmax.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_multi.test b/mysql-test/t/ndb_multi.test
index 3482db1d1b2..3e25227ae80 100644
--- a/mysql-test/t/ndb_multi.test
+++ b/mysql-test/t/ndb_multi.test
@@ -1,5 +1,6 @@
-- source include/have_ndb.inc
-- source include/have_multi_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_partition_error.test b/mysql-test/t/ndb_partition_error.test
index 9db2a6a6f6d..ce25dfc0fd5 100644
--- a/mysql-test/t/ndb_partition_error.test
+++ b/mysql-test/t/ndb_partition_error.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
#--disable_abort_on_error
#
# Simple test for the partition storage engine
diff --git a/mysql-test/t/ndb_partition_key.test b/mysql-test/t/ndb_partition_key.test
index 78e2c9d15c2..4760022d20f 100644
--- a/mysql-test/t/ndb_partition_key.test
+++ b/mysql-test/t/ndb_partition_key.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/t/ndb_partition_list.test b/mysql-test/t/ndb_partition_list.test
index ccfcdbc84f4..35c7104ff92 100644
--- a/mysql-test/t/ndb_partition_list.test
+++ b/mysql-test/t/ndb_partition_list.test
@@ -1,4 +1,5 @@
--source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
#
# Simple test for the partition storage engine
# Focuses on range partitioning tests
diff --git a/mysql-test/t/ndb_partition_range.test b/mysql-test/t/ndb_partition_range.test
index 7952ba502d2..e34cb92771c 100644
--- a/mysql-test/t/ndb_partition_range.test
+++ b/mysql-test/t/ndb_partition_range.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
#--disable_abort_on_error
#
# Simple test for the partition storage engine
diff --git a/mysql-test/t/ndb_read_multi_range.test b/mysql-test/t/ndb_read_multi_range.test
index b490eeb68a3..b4e5943269c 100644
--- a/mysql-test/t/ndb_read_multi_range.test
+++ b/mysql-test/t/ndb_read_multi_range.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_rename.test b/mysql-test/t/ndb_rename.test
index 7f9fd0e6984..1b2f6d72119 100644
--- a/mysql-test/t/ndb_rename.test
+++ b/mysql-test/t/ndb_rename.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_replace.test b/mysql-test/t/ndb_replace.test
index aa2072b98dd..cb5f1cc46cb 100644
--- a/mysql-test/t/ndb_replace.test
+++ b/mysql-test/t/ndb_replace.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
#
diff --git a/mysql-test/t/ndb_restore.test b/mysql-test/t/ndb_restore.test
index 7f0cafdfd77..2414e6b7268 100644
--- a/mysql-test/t/ndb_restore.test
+++ b/mysql-test/t/ndb_restore.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/ndb_default_cluster.inc
-- source include/not_embedded.inc
diff --git a/mysql-test/t/ndb_restore_partition.test b/mysql-test/t/ndb_restore_partition.test
index f11324492c2..0cddc38a876 100644
--- a/mysql-test/t/ndb_restore_partition.test
+++ b/mysql-test/t/ndb_restore_partition.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/ndb_default_cluster.inc
-- source include/not_embedded.inc
diff --git a/mysql-test/t/ndb_restore_print.test b/mysql-test/t/ndb_restore_print.test
index 6dbbfdf5933..d198623886b 100644
--- a/mysql-test/t/ndb_restore_print.test
+++ b/mysql-test/t/ndb_restore_print.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/ndb_default_cluster.inc
-- source include/not_embedded.inc
diff --git a/mysql-test/t/ndb_row_format.test b/mysql-test/t/ndb_row_format.test
index b1582cbe339..49d771e4017 100644
--- a/mysql-test/t/ndb_row_format.test
+++ b/mysql-test/t/ndb_row_format.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_single_user.test b/mysql-test/t/ndb_single_user.test
index 3c6656be9f9..5d2ee0a3a8d 100644
--- a/mysql-test/t/ndb_single_user.test
+++ b/mysql-test/t/ndb_single_user.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/have_multi_ndb.inc
-- source include/ndb_default_cluster.inc
-- source include/not_embedded.inc
diff --git a/mysql-test/t/ndb_sp.test b/mysql-test/t/ndb_sp.test
index b833869cad0..703cb116c52 100644
--- a/mysql-test/t/ndb_sp.test
+++ b/mysql-test/t/ndb_sp.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_subquery.test b/mysql-test/t/ndb_subquery.test
index 6282c31c922..c8aec569de9 100644
--- a/mysql-test/t/ndb_subquery.test
+++ b/mysql-test/t/ndb_subquery.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_temporary.test b/mysql-test/t/ndb_temporary.test
index 7f6902bf745..3a9e7c94398 100644
--- a/mysql-test/t/ndb_temporary.test
+++ b/mysql-test/t/ndb_temporary.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_transaction.test b/mysql-test/t/ndb_transaction.test
index d3ebadb1a78..dca1fde8fc7 100644
--- a/mysql-test/t/ndb_transaction.test
+++ b/mysql-test/t/ndb_transaction.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_trigger.test b/mysql-test/t/ndb_trigger.test
index 586fdc0ac97..00927f93d10 100644
--- a/mysql-test/t/ndb_trigger.test
+++ b/mysql-test/t/ndb_trigger.test
@@ -1,5 +1,6 @@
# Tests which involve triggers and NDB storage engine
--source include/have_ndb.inc
+--source include/have_binlog_format_row.inc
--source include/not_embedded.inc
#
diff --git a/mysql-test/t/ndb_truncate.test b/mysql-test/t/ndb_truncate.test
index a1ef4be0d48..a62fd43408d 100644
--- a/mysql-test/t/ndb_truncate.test
+++ b/mysql-test/t/ndb_truncate.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_types.test b/mysql-test/t/ndb_types.test
index ab18817132e..9b395c12bf8 100644
--- a/mysql-test/t/ndb_types.test
+++ b/mysql-test/t/ndb_types.test
@@ -1,4 +1,5 @@
--source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
--source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_update.test b/mysql-test/t/ndb_update.test
index 73a0ebc69cb..a864aa28dc3 100644
--- a/mysql-test/t/ndb_update.test
+++ b/mysql-test/t/ndb_update.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndb_view.test b/mysql-test/t/ndb_view.test
index 3b8fc330b40..4f2580ef15e 100644
--- a/mysql-test/t/ndb_view.test
+++ b/mysql-test/t/ndb_view.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/ndbapi.test b/mysql-test/t/ndbapi.test
index 3424513f8af..d58ed1c5ccd 100644
--- a/mysql-test/t/ndbapi.test
+++ b/mysql-test/t/ndbapi.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
-- source include/have_ndbapi_examples.inc
--disable_warnings
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index d2b9a5bcf83..1374c049431 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -1494,4 +1494,19 @@ ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
ALTER TABLE general_log ENGINE = CSV;
SET GLOBAL general_log = default;
+#
+# Bug #27084 partitioning by list seems failing when using case
+#
+CREATE TABLE `t1` ( `a` varchar(1)) ENGINE=MyISAM
+ PARTITION BY LIST (CASE a WHEN 'a' THEN 1
+ WHEN 'b' THEN 2
+ WHEN 'c' THEN 3
+ END) (
+ PARTITION a VALUES IN (1),
+ PARTITION b VALUES IN (2),
+ PARTITION c VALUES IN (3)
+);
+
+DROP TABLE t1;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/partition_hash.test b/mysql-test/t/partition_hash.test
index dc527cad2b7..ca7972cc01c 100644
--- a/mysql-test/t/partition_hash.test
+++ b/mysql-test/t/partition_hash.test
@@ -134,6 +134,7 @@ drop table t1;
--disable_warnings
CREATE TABLE t1 (s1 int) ENGINE=BLACKHOLE PARTITION BY HASH (s1);
--enable_warnings
+--error 0,ER_BINLOG_LOGGING_IMPOSSIBLE
INSERT INTO t1 VALUES (0);
DROP TABLE t1;
diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test
index 9905d73fc32..13773504fb0 100644
--- a/mysql-test/t/ps_1general.test
+++ b/mysql-test/t/ps_1general.test
@@ -414,6 +414,10 @@ prepare stmt1 from ' execute stmt2 ' ;
--error ER_UNSUPPORTED_PS
prepare stmt1 from ' deallocate prepare never_prepared ' ;
+## We don't support alter view as prepared statements
+--error ER_UNSUPPORTED_PS
+prepare stmt1 from 'alter view v1 as select 2';
+
## switch the database connection
--error ER_UNSUPPORTED_PS
prepare stmt4 from ' use test ' ;
diff --git a/mysql-test/t/ps_7ndb.test b/mysql-test/t/ps_7ndb.test
index e3f65ec2c4e..eb98a815d74 100644
--- a/mysql-test/t/ps_7ndb.test
+++ b/mysql-test/t/ps_7ndb.test
@@ -11,6 +11,7 @@
use test;
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
let $type= 'NDB' ;
-- source include/ps_create.inc
-- source include/ps_renew.inc
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index 821cdf2df38..14ccea0fdc8 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -93,7 +93,11 @@ show status like "Qcache_queries_in_cache";
select sql_cache * from t1 union select * from t1;
set query_cache_type=2;
select sql_cache * from t1 union select * from t1;
+
+# all sql_cache statements, except for the first select, are ignored.
select * from t1 union select sql_cache * from t1;
+select * from t1 where a IN (select sql_cache a from t1);
+select * from t1 where a IN (select a from t1 union select sql_cache a from t1);
show status like "Qcache_hits";
show status like "Qcache_queries_in_cache";
set query_cache_type=on;
@@ -106,6 +110,15 @@ show status like "Qcache_queries_in_cache";
# SELECT SQL_NO_CACHE
#
select sql_no_cache * from t1;
+# sql_no_cache can occur in any nested select to turn on cacheing for the whole
+# expression and it will always override a sql_cache statement.
+select * from t1 union select sql_no_cache * from t1;
+select * from t1 where a IN (select sql_no_cache a from t1);
+select * from t1 where a IN (select a from t1 union select sql_no_cache a from t1);
+select sql_cache sql_no_cache * from t1;
+select sql_cache * from t1 union select sql_no_cache * from t1;
+select sql_cache * from t1 where a IN (select sql_no_cache a from t1);
+select sql_cache * from t1 where a IN (select a from t1 union select sql_no_cache a from t1);
show status like "Qcache_queries_in_cache";
drop table t1;
#
@@ -1023,6 +1036,27 @@ drop table t1;
set GLOBAL query_cache_size= default;
+#
+# Bug #29053 SQL_CACHE in UNION causes non-deterministic functions to be cached
+#
+
+set GLOBAL query_cache_size=1000000;
+
+create table t1 (a char);
+insert into t1 values ('c');
+
+let $q1= `select RAND() from t1 union select sql_cache 1 from t1;`;
+let $q2= `select RAND() from t1 union select sql_cache 1 from t1;`;
+
+# disabling the logging of the query because the times are different each run.
+--disable_query_log
+eval select a from t1 where "$q1" = "$q2";
+--enable_query_log
+
+drop table t1;
+
+set GLOBAL query_cache_size= default;
+
# End of 5.0 tests
diff --git a/mysql-test/t/rpl_000015.test b/mysql-test/t/rpl_000015.test
index 9daa765084b..80db596244b 100644
--- a/mysql-test/t/rpl_000015.test
+++ b/mysql-test/t/rpl_000015.test
@@ -13,26 +13,18 @@ show master status;
save_master_pos;
connection slave;
reset slave;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
+source include/show_slave_status.inc;
change master to master_host='127.0.0.1';
# The following needs to be cleaned up when change master is fixed
---replace_result $DEFAULT_MASTER_PORT DEFAULT_MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
+source include/show_slave_status.inc;
--replace_result $MASTER_MYPORT MASTER_PORT
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$MASTER_MYPORT;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
+source include/show_slave_status.inc;
start slave;
sync_with_master;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
+source include/show_slave_status.inc;
connection master;
--disable_warnings
drop table if exists t1;
diff --git a/mysql-test/t/rpl_change_master.test b/mysql-test/t/rpl_change_master.test
index c031464c95e..7256fed656f 100644
--- a/mysql-test/t/rpl_change_master.test
+++ b/mysql-test/t/rpl_change_master.test
@@ -18,13 +18,13 @@ save_master_pos;
connection slave;
--real_sleep 3 # wait for I/O thread to have read updates
stop slave;
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 23 # 33 #
-show slave status;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
+query_vertical SHOW SLAVE STATUS;
change master to master_user='root';
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 23 # 33 #
-show slave status;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
+query_vertical SHOW SLAVE STATUS;
start slave;
sync_with_master;
select * from t1;
diff --git a/mysql-test/t/rpl_commit_after_flush.test b/mysql-test/t/rpl_commit_after_flush.test
index 7a924ddb11e..47df391d6be 100644
--- a/mysql-test/t/rpl_commit_after_flush.test
+++ b/mysql-test/t/rpl_commit_after_flush.test
@@ -7,5 +7,6 @@
########################################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
+-- source include/master-slave.inc
let $engine_type=innodb;
-- source extra/rpl_tests/rpl_commit_after_flush.test
diff --git a/mysql-test/t/rpl_delete_no_where.test b/mysql-test/t/rpl_delete_no_where.test
index 11adb2e6dd5..64a293b4058 100644
--- a/mysql-test/t/rpl_delete_no_where.test
+++ b/mysql-test/t/rpl_delete_no_where.test
@@ -2,5 +2,6 @@
# By JBM 2006-02-14 added to skip test when NDB #
##################################################
-- source include/not_ndb_default.inc
+-- source include/master-slave.inc
let $engine_type=myisam;
-- source extra/rpl_tests/rpl_delete_no_where.test
diff --git a/mysql-test/t/rpl_empty_master_crash.test b/mysql-test/t/rpl_empty_master_crash.test
index 707d1eca8c2..f8e7870ae3c 100644
--- a/mysql-test/t/rpl_empty_master_crash.test
+++ b/mysql-test/t/rpl_empty_master_crash.test
@@ -1,7 +1,6 @@
source include/master-slave.inc;
---replace_column 1 # 8 # 9 # 16 # 23 # 33 #
-show slave status;
+source include/show_slave_status.inc;
#
# Load table should not succeed on the master as this is not a slave
diff --git a/mysql-test/t/rpl_flushlog_loop.test b/mysql-test/t/rpl_flushlog_loop.test
index 471c45a1aa3..7d92ba9c2f4 100644
--- a/mysql-test/t/rpl_flushlog_loop.test
+++ b/mysql-test/t/rpl_flushlog_loop.test
@@ -45,6 +45,5 @@ sleep 5;
# Show status of slave
#
--replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 1 # 8 # 9 # 16 # 23 # 33 #
---vertical_results
-SHOW SLAVE STATUS;
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 # 34 # 35 #
+--query_vertical SHOW SLAVE STATUS
diff --git a/mysql-test/t/rpl_grant.test b/mysql-test/t/rpl_grant.test
new file mode 100644
index 00000000000..71e36342584
--- /dev/null
+++ b/mysql-test/t/rpl_grant.test
@@ -0,0 +1,42 @@
+# Tests of grants and users
+
+source include/master-slave.inc;
+source include/not_embedded.inc;
+
+--echo **** On Master ****
+connection master;
+
+CREATE USER dummy@localhost;
+CREATE USER dummy1@localhost, dummy2@localhost;
+
+SELECT user, host FROM mysql.user WHERE user != 'root'; # root host non-determ
+SELECT COUNT(*) FROM mysql.user;
+sync_slave_with_master;
+--echo **** On Slave ****
+SELECT user,host FROM mysql.user WHERE user != 'root'; # root host non-determ
+SELECT COUNT(*) FROM mysql.user;
+
+--echo **** On Master ****
+connection master;
+
+# No user exists
+error ER_CANNOT_USER;
+DROP USER nonexisting@localhost;
+
+# At least one user exists, but not all
+error ER_CANNOT_USER;
+DROP USER nonexisting@localhost, dummy@localhost;
+
+# All users exist
+DROP USER dummy1@localhost, dummy2@localhost;
+
+SELECT user, host FROM mysql.user WHERE user != 'root'; # root host non-determ
+SELECT COUNT(*) FROM mysql.user;
+sync_slave_with_master;
+--echo **** On Slave ****
+SELECT user,host FROM mysql.user WHERE user != 'root'; # root host non-determ
+SELECT COUNT(*) FROM mysql.user;
+
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 23 # 33 #
+query_vertical SHOW SLAVE STATUS;
diff --git a/mysql-test/t/rpl_innodb.test b/mysql-test/t/rpl_innodb.test
index b88276e2107..30d40e19614 100644
--- a/mysql-test/t/rpl_innodb.test
+++ b/mysql-test/t/rpl_innodb.test
@@ -44,5 +44,72 @@ connection master;
DROP TABLE t4;
--enable_query_log
sync_slave_with_master;
+connection master;
# End of 4.1 tests
+
+#
+# Bug #26418: Slave out of sync after CREATE/DROP TEMPORARY TABLE + ROLLBACK
+# on master
+#
+#Note Matthias: to be merged to rpl_ddl.test
+
+--source include/not_ndb_default.inc
+
+FLUSH LOGS;
+sync_slave_with_master;
+FLUSH LOGS;
+connection master;
+let $engine_type= "InnoDB";
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1;
+--enable_warnings
+
+CREATE DATABASE mysqltest1;
+CREATE TEMPORARY TABLE mysqltest1.tmp (f1 BIGINT);
+eval CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=$engine_type;
+SET AUTOCOMMIT = 0;
+
+sync_slave_with_master;
+--echo -------- switch to slave --------
+connection slave;
+SHOW CREATE TABLE mysqltest1.t1;
+
+--echo -------- switch to master --------
+connection master;
+INSERT INTO mysqltest1.t1 SET f1= 1;
+DROP TEMPORARY TABLE mysqltest1.tmp;
+ROLLBACK;
+--error ER_NO_SUCH_TABLE
+SHOW CREATE TABLE mysqltest1.tmp;
+# Must return no rows here
+SELECT COUNT(*) FROM mysqltest1.t1;
+
+INSERT INTO mysqltest1.t1 SET f1= 2;
+CREATE TEMPORARY TABLE mysqltest1.tmp2(a INT);
+ROLLBACK;
+SHOW CREATE TABLE mysqltest1.tmp2;
+# Must return no rows here
+SELECT COUNT(*) FROM mysqltest1.t1;
+
+sync_slave_with_master;
+--echo -------- switch to slave --------
+connection slave;
+--error ER_NO_SUCH_TABLE
+SHOW CREATE TABLE mysqltest1.tmp;
+--error ER_NO_SUCH_TABLE
+SHOW CREATE TABLE mysqltest1.tmp2;
+# has two rows here : as the default is MyISAM and
+# it can't be rolled back by the master's ROLLBACK.
+SELECT COUNT(*) FROM mysqltest1.t1;
+FLUSH LOGS;
+
+--echo -------- switch to master --------
+connection master;
+FLUSH LOGS;
+
+DROP DATABASE mysqltest1;
+-- source include/master-slave-end.inc
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/rpl_insert_ignore.test b/mysql-test/t/rpl_insert_ignore.test
index dc8994b82f3..2709430f85d 100644
--- a/mysql-test/t/rpl_insert_ignore.test
+++ b/mysql-test/t/rpl_insert_ignore.test
@@ -3,6 +3,7 @@
#####################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
+-- source include/master-slave.inc
let $engine_type=innodb;
let $engine_type2=myisam;
-- source extra/rpl_tests/rpl_insert_ignore.test
diff --git a/mysql-test/t/rpl_invoked_features-master.opt b/mysql-test/t/rpl_invoked_features-master.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_invoked_features-master.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_invoked_features-slave.opt b/mysql-test/t/rpl_invoked_features-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_invoked_features-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_invoked_features.test b/mysql-test/t/rpl_invoked_features.test
new file mode 100644
index 00000000000..e797e0552ef
--- /dev/null
+++ b/mysql-test/t/rpl_invoked_features.test
@@ -0,0 +1,282 @@
+#########################################
+# Author: Serge Kozlov skozlov@mysql.com
+# Date: 04/25/2007
+# Purpose: Testing Invocation and Invoked
+# Features for Replication.
+#########################################
+
+--source include/master-slave.inc
+--source include/have_innodb.inc
+
+
+#
+# Define variables used by test case
+#
+
+# Non-transactional engine
+--let $engine_type= myisam
+
+# Transactional engine
+--let $engine_type2= innodb
+
+
+#
+# Clean up
+#
+
+USE test;
+--disable_warnings
+DROP VIEW IF EXISTS v1,v11;
+DROP TABLE IF EXISTS t1,t2,t3,t11,t12,t13;
+DROP PROCEDURE IF EXISTS p1;
+DROP PROCEDURE IF EXISTS p11;
+DROP FUNCTION IF EXISTS f1;
+DROP FUNCTION IF EXISTS f2;
+DROP EVENT IF EXISTS e1;
+DROP EVENT IF EXISTS e11;
+--enable_warnings
+
+
+#
+# Prepare objects (tables etc)
+#
+
+# Create tables
+
+--echo
+eval CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, c VARCHAR(64)) ENGINE=$engine_type;
+--disable_warnings
+INSERT INTO t1 VALUES (1,1,'1');
+INSERT INTO t1 VALUES (2,2,UUID());
+eval CREATE TABLE t2 (a INT, b INT, c VARCHAR(64)) ENGINE=$engine_type;
+INSERT INTO t2 VALUES (1,1,'1');
+INSERT INTO t2 VALUES (2,2,UUID());
+--enable_warnings
+
+eval CREATE TABLE t11 (a INT NOT NULL PRIMARY KEY, b INT, c VARCHAR(64)) ENGINE=$engine_type2;
+--disable_warnings
+INSERT INTO t11 VALUES (1,1,'1');
+INSERT INTO t11 VALUES (2,2,UUID());
+eval CREATE TABLE t12 (a INT, b INT, c VARCHAR(64)) ENGINE=$engine_type2;
+INSERT INTO t12 VALUES (1,1,'1');
+INSERT INTO t12 VALUES (2,2,UUID());
+--enable_warnings
+
+# Create invoked features
+--echo
+# Create view for tables t1,t11
+CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE VIEW v11 AS SELECT * FROM t11;
+
+# Create triggers for t1,t11
+DELIMITER |;
+
+CREATE TRIGGER t1_tr1 BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+ INSERT INTO t2 VALUES (NEW.a, NEW.b, NEW.c);
+ INSERT INTO t3 VALUES (NEW.a, NEW.b, NEW.c);
+END|
+
+CREATE TRIGGER t1_tr2 BEFORE UPDATE ON t1 FOR EACH ROW
+BEGIN
+ UPDATE t2 SET c = '';
+ UPDATE t3 SET c = '';
+END|
+
+CREATE TRIGGER t11_tr1 BEFORE INSERT ON t11 FOR EACH ROW
+BEGIN
+ INSERT INTO t12 VALUES (NEW.a, NEW.b, NEW.c);
+ INSERT INTO t13 VALUES (NEW.a, NEW.b, NEW.c);
+END|
+
+CREATE TRIGGER t11_tr2 BEFORE UPDATE ON t11 FOR EACH ROW
+BEGIN
+ UPDATE t12 SET c = '';
+ UPDATE t13 SET c = '';
+END|
+
+# Create events which will run every 1 sec
+CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND ENABLE DO
+BEGIN
+ DECLARE c INT;
+ SELECT a INTO c FROM t1 WHERE a < 11 ORDER BY a DESC LIMIT 1;
+ IF c = 7 THEN
+ CALL p1(10, '');
+ END IF;
+END|
+
+CREATE EVENT e11 ON SCHEDULE EVERY 1 SECOND ENABLE DO
+BEGIN
+ DECLARE c INT;
+ SELECT a INTO c FROM t11 WHERE a < 11 ORDER BY a DESC LIMIT 1;
+ IF c = 7 THEN
+ CALL p11(10, '');
+ END IF;
+END|
+
+# Create functions and procedures used for events
+CREATE FUNCTION f1 (x INT) RETURNS VARCHAR(64)
+BEGIN
+ IF x > 5 THEN
+ RETURN UUID();
+ END IF;
+ RETURN '';
+END|
+
+CREATE FUNCTION f2 (x INT) RETURNS VARCHAR(64)
+BEGIN
+ RETURN f1(x);
+END|
+
+CREATE PROCEDURE p1 (IN x INT, IN y VARCHAR(64))
+BEGIN
+ INSERT INTO t1 VALUES (x,x,y);
+END|
+
+CREATE PROCEDURE p11 (IN x INT, IN y VARCHAR(64))
+BEGIN
+ INSERT INTO t11 VALUES (x,x,y);
+END|
+
+DELIMITER ;|
+
+
+#
+# Start test case
+#
+
+# Do some actions for non-transactional tables
+--echo
+--disable_warnings
+CREATE TABLE t3 SELECT * FROM v1;
+INSERT INTO t1 VALUES (3,3,'');
+UPDATE t1 SET c='2' WHERE a = 1;
+INSERT INTO t1 VALUES(4,4,f1(4));
+INSERT INTO t1 VALUES (100,100,'');
+CALL p1(5, UUID());
+INSERT INTO t1 VALUES (101,101,'');
+INSERT INTO t1 VALUES(6,6,f1(6));
+INSERT INTO t1 VALUES (102,102,'');
+INSERT INTO t1 VALUES(7,7,f2(7));
+INSERT INTO t1 VALUES (103,103,'');
+
+# Do some actions for transactional tables
+--echo
+CREATE TABLE t13 SELECT * FROM v11;
+INSERT INTO t11 VALUES (3,3,'');
+UPDATE t11 SET c='2' WHERE a = 1;
+INSERT INTO t11 VALUES(4,4,f1(4));
+INSERT INTO t11 VALUES (100,100,'');
+CALL p11(5, UUID());
+INSERT INTO t11 VALUES (101,101,'');
+INSERT INTO t11 VALUES(6,6,f1(6));
+INSERT INTO t11 VALUES (102,102,'');
+INSERT INTO t11 VALUES(7,7,f2(7));
+INSERT INTO t11 VALUES (103,103,'');
+--enable_warnings
+
+# Scheduler is on
+--echo
+SET GLOBAL EVENT_SCHEDULER = on;
+# Wait 2 sec while events will executed
+--sleep 2
+SET GLOBAL EVENT_SCHEDULER = off;
+
+# Check original objects
+--echo
+SHOW TABLES LIKE 't%';
+SELECT table_name FROM information_schema.views WHERE table_schema='test';
+SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test';
+SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test';
+SELECT event_name, status FROM information_schema.events WHERE event_schema='test';
+
+# Check original data
+--echo
+SELECT COUNT(*) FROM t1;
+SELECT a,b FROM t1 ORDER BY a;
+SELECT COUNT(*) FROM t2;
+SELECT a,b FROM t2 ORDER BY a;
+SELECT COUNT(*) FROM t3;
+SELECT a,b FROM t3 ORDER BY a;
+SELECT a,b FROM v1 ORDER BY a;
+SELECT COUNT(*) FROM t11;
+SELECT a,b FROM t11 ORDER BY a;
+SELECT COUNT(*) FROM t12;
+SELECT a,b FROM t12 ORDER BY a;
+SELECT COUNT(*) FROM t13;
+SELECT a,b FROM t13 ORDER BY a;
+SELECT a,b FROM v11 ORDER BY a;
+
+--sync_slave_with_master slave
+
+# Check replicated objects
+--echo
+SHOW TABLES LIKE 't%';
+SELECT table_name FROM information_schema.views WHERE table_schema='test';
+SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test';
+SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test';
+SELECT event_name, status FROM information_schema.events WHERE event_schema='test';
+
+# Check replicated data
+--echo
+SELECT COUNT(*) FROM t1;
+SELECT a,b FROM t1 ORDER BY a;
+SELECT COUNT(*) FROM t2;
+SELECT a,b FROM t2 ORDER BY a;
+SELECT COUNT(*) FROM t3;
+SELECT a,b FROM t3 ORDER BY a;
+SELECT a,b FROM v1 ORDER BY a;
+SELECT COUNT(*) FROM t11;
+SELECT a,b FROM t11 ORDER BY a;
+SELECT COUNT(*) FROM t12;
+SELECT a,b FROM t12 ORDER BY a;
+SELECT COUNT(*) FROM t13;
+SELECT a,b FROM t13 ORDER BY a;
+SELECT a,b FROM v11 ORDER BY a;
+
+# Remove UUID() before comparing
+
+--connection master
+--echo
+UPDATE t1 SET c='';
+UPDATE t2 SET c='';
+UPDATE t3 SET c='';
+UPDATE t11 SET c='';
+UPDATE t12 SET c='';
+UPDATE t13 SET c='';
+
+--sync_slave_with_master slave
+
+# Compare a data from master and slave
+--echo
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_slave.sql
+--diff_files $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_master.sql $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_slave.sql
+
+
+#
+# Clean up
+#
+
+# Remove dumps
+--echo
+--exec rm $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_master.sql
+--exec rm $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_slave.sql
+
+# Remove tables,views,procedures,functions
+--connection master
+--echo
+--disable_warnings
+DROP VIEW IF EXISTS v1,v11;
+DROP TABLE IF EXISTS t1,t2,t3,t11,t12,t13;
+DROP PROCEDURE IF EXISTS p1;
+DROP PROCEDURE IF EXISTS p11;
+DROP FUNCTION IF EXISTS f1;
+DROP FUNCTION IF EXISTS f2;
+DROP EVENT IF EXISTS e1;
+DROP EVENT IF EXISTS e11;
+--enable_warnings
+
+--sync_slave_with_master slave
+
+# End 5.1 test case
diff --git a/mysql-test/t/rpl_loaddata_fatal-slave.opt b/mysql-test/t/rpl_loaddata_fatal-slave.opt
new file mode 100644
index 00000000000..9c846c799f3
--- /dev/null
+++ b/mysql-test/t/rpl_loaddata_fatal-slave.opt
@@ -0,0 +1 @@
+--loose-debug=+d,LOAD_DATA_INFILE_has_fatal_error
diff --git a/mysql-test/t/rpl_loaddata_fatal.test b/mysql-test/t/rpl_loaddata_fatal.test
new file mode 100644
index 00000000000..dceee7a65af
--- /dev/null
+++ b/mysql-test/t/rpl_loaddata_fatal.test
@@ -0,0 +1,29 @@
+source include/have_binlog_format_mixed_or_statement.inc;
+source include/have_debug.inc;
+source include/master-slave.inc;
+
+# We do this little stunt to make sure that the slave has started
+# before we stop it again.
+connection master;
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (1,10);
+sync_slave_with_master;
+source include/show_slave_status.inc;
+
+# Now we feed it a load data infile, which should make it stop with a
+# fatal error.
+connection master;
+LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE t1;
+
+connection slave;
+wait_for_slave_to_stop;
+source include/show_slave_status.inc;
+
+connection slave;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
+START SLAVE;
+
+connection master;
+DROP TABLE t1;
+sync_slave_with_master;
+
diff --git a/mysql-test/t/rpl_log_pos.test b/mysql-test/t/rpl_log_pos.test
index b98d89c1dc3..e5ad6f39ed2 100644
--- a/mysql-test/t/rpl_log_pos.test
+++ b/mysql-test/t/rpl_log_pos.test
@@ -14,31 +14,22 @@ source include/master-slave.inc;
--replace_column 3 <Binlog_Ignore_DB>
show master status;
sync_slave_with_master;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-stop slave;
-change master to master_log_pos=75;
-start slave;
-sleep 5;
stop slave;
+--source include/wait_for_slave_to_stop.inc
change master to master_log_pos=75;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
+source include/show_slave_status.inc;
start slave;
-sleep 5;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
+let $slave_param= Slave_SQL_Running;
+let $slave_param_value= Yes;
+--source include/wait_for_slave_param.inc
+let $slave_param= Slave_IO_Running;
+let $slave_param_value= No;
+--source include/wait_for_slave_param.inc
stop slave;
-change master to master_log_pos=178;
-start slave;
-sleep 2;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 11 # 23 # 33 #
-show slave status;
+--source include/wait_for_slave_to_stop.inc
+
+source include/show_slave_status.inc;
connection master;
--replace_column 3 <Binlog_Ignore_DB>
show master status;
@@ -48,7 +39,6 @@ create table t1 (n int);
insert into t1 values (1),(2),(3);
save_master_pos;
connection slave;
-stop slave;
change master to master_log_pos=106;
start slave;
sync_with_master;
@@ -57,4 +47,4 @@ connection master;
drop table t1;
sync_slave_with_master;
-# End of 4.1 tests
+--echo End of 5.0 tests
diff --git a/mysql-test/t/rpl_multi_update2.test b/mysql-test/t/rpl_multi_update2.test
index 7401786501e..812a486ad69 100644
--- a/mysql-test/t/rpl_multi_update2.test
+++ b/mysql-test/t/rpl_multi_update2.test
@@ -5,5 +5,6 @@
# Default engine. #
#######################################################
--source include/not_ndb_default.inc
+--source include/master-slave.inc
let $engine_type=MyISAM;
--source extra/rpl_tests/rpl_multi_update2.test
diff --git a/mysql-test/t/rpl_multi_update3.test b/mysql-test/t/rpl_multi_update3.test
index 438a644729c..5da91c26b04 100644
--- a/mysql-test/t/rpl_multi_update3.test
+++ b/mysql-test/t/rpl_multi_update3.test
@@ -5,5 +5,6 @@
# Default engine. #
#######################################################
--source include/not_ndb_default.inc
+--source include/master-slave.inc
let $engine_type=MyISAM;
-- source extra/rpl_tests/rpl_multi_update3.test
diff --git a/mysql-test/t/rpl_ndb_2innodb.test b/mysql-test/t/rpl_ndb_2innodb.test
index e09d8b6685b..30e4e49eb7a 100644
--- a/mysql-test/t/rpl_ndb_2innodb.test
+++ b/mysql-test/t/rpl_ndb_2innodb.test
@@ -8,7 +8,7 @@
# test and to have control over the tests.
##############################################################
-- source include/have_ndb.inc
--- source include/master-slave.inc
+-- source include/ndb_master-slave.inc
connection slave;
-- source include/have_innodb.inc
connection master;
diff --git a/mysql-test/t/rpl_ndb_2myisam.test b/mysql-test/t/rpl_ndb_2myisam.test
index abbe419bc02..182d4c72d87 100644
--- a/mysql-test/t/rpl_ndb_2myisam.test
+++ b/mysql-test/t/rpl_ndb_2myisam.test
@@ -8,6 +8,6 @@
# test and to have control over the tests.
##############################################################
-- source include/have_ndb.inc
--- source include/master-slave.inc
+-- source include/ndb_master-slave.inc
SET storage_engine=ndb;
--source extra/rpl_tests/rpl_ndb_2multi_eng.test
diff --git a/mysql-test/t/rpl_ndb_UUID.test b/mysql-test/t/rpl_ndb_UUID.test
index c6fc218beed..7bae9a341a4 100644
--- a/mysql-test/t/rpl_ndb_UUID.test
+++ b/mysql-test/t/rpl_ndb_UUID.test
@@ -2,5 +2,7 @@
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
########################################################
--source include/have_ndb.inc
+--source include/have_binlog_format_row.inc
+--source include/ndb_master-slave.inc
let $engine_type=NDB;
--source extra/rpl_tests/rpl_row_UUID.test
diff --git a/mysql-test/t/rpl_ndb_auto_inc.test b/mysql-test/t/rpl_ndb_auto_inc.test
index 53bb7e764f1..5e0584e332a 100644
--- a/mysql-test/t/rpl_ndb_auto_inc.test
+++ b/mysql-test/t/rpl_ndb_auto_inc.test
@@ -7,8 +7,8 @@
# Change: Augmented test to use with cluster
#####################################
--source include/have_ndb.inc
---source include/master-slave.inc
--source include/have_binlog_format_mixed_or_row.inc
+--source include/ndb_master-slave.inc
--echo ***************** Test 1 ************************
--echo
diff --git a/mysql-test/t/rpl_ndb_bank.test b/mysql-test/t/rpl_ndb_bank.test
index c1448573f5b..c9b0d8bad9c 100644
--- a/mysql-test/t/rpl_ndb_bank.test
+++ b/mysql-test/t/rpl_ndb_bank.test
@@ -13,7 +13,7 @@
--source include/have_ndb.inc
--source include/have_ndb_extra.inc
--source include/have_binlog_format_row.inc
---source include/master-slave.inc
+--source include/ndb_master-slave.inc
# kill any trailing processes
--system killall lt-bankTransactionMaker lt-bankTimer lt-bankMakeGL || true
@@ -147,7 +147,7 @@ while ($1)
{
--sleep 2
--replace_result $MASTER_MYPORT MASTER_PORT
- --replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master>
+ --replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 34 <Last_IO_Errno> 35 <Last_IO_Error>
SHOW SLAVE STATUS;
STOP SLAVE;
--exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT_SLAVE ../storage/ndb/test/ndbapi/bank/bankValidateAllGLs >> $NDB_TOOLS_OUTPUT
diff --git a/mysql-test/t/rpl_ndb_basic.test b/mysql-test/t/rpl_ndb_basic.test
index e485b1d1bde..5bec4aee8c6 100644
--- a/mysql-test/t/rpl_ndb_basic.test
+++ b/mysql-test/t/rpl_ndb_basic.test
@@ -1,6 +1,6 @@
--source include/have_ndb.inc
--source include/have_binlog_format_row.inc
---source include/master-slave.inc
+--source include/ndb_master-slave.inc
@@ -197,7 +197,7 @@ UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1;
--connection slave
--echo **** On Slave ****
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 19 <Last_Errno> 20 <Last_Error> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master>
+--replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 19 <Last_Errno> 20 <Last_Error> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error> 37 <Last_SQL_Errno> 38 <Last_SQL_Error>
--query_vertical SHOW SLAVE STATUS;
# now set max retries high enough to succeed, and start slave again
diff --git a/mysql-test/t/rpl_ndb_blob.test b/mysql-test/t/rpl_ndb_blob.test
index 94af986b222..aa80ab8ede5 100644
--- a/mysql-test/t/rpl_ndb_blob.test
+++ b/mysql-test/t/rpl_ndb_blob.test
@@ -1,6 +1,6 @@
--source include/have_ndb.inc
--source include/have_binlog_format_row.inc
---source include/master-slave.inc
+--source include/ndb_master-slave.inc
#
# basic test of blob replication for NDB
diff --git a/mysql-test/t/rpl_ndb_blob2.test b/mysql-test/t/rpl_ndb_blob2.test
index 2e8f02eaf75..d94294eedcb 100644
--- a/mysql-test/t/rpl_ndb_blob2.test
+++ b/mysql-test/t/rpl_ndb_blob2.test
@@ -4,6 +4,8 @@
# code between engine tests #
#################################
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
+-- source include/ndb_master-slave.inc
let $engine_type=NDBCLUSTER;
-- source extra/rpl_tests/rpl_row_blob.test
diff --git a/mysql-test/t/rpl_ndb_charset.test b/mysql-test/t/rpl_ndb_charset.test
index eb412a0349a..4bac267443e 100644
--- a/mysql-test/t/rpl_ndb_charset.test
+++ b/mysql-test/t/rpl_ndb_charset.test
@@ -2,5 +2,7 @@
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
########################################################
--source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
+-- source include/ndb_master-slave.inc
let $engine_type=NDB;
-- source extra/rpl_tests/rpl_row_charset.test
diff --git a/mysql-test/t/rpl_ndb_circular.test b/mysql-test/t/rpl_ndb_circular.test
index 88b5808160b..34fcf968199 100644
--- a/mysql-test/t/rpl_ndb_circular.test
+++ b/mysql-test/t/rpl_ndb_circular.test
@@ -1,6 +1,6 @@
--source include/have_ndb.inc
--source include/have_binlog_format_row.inc
---source include/master-slave.inc
+--source include/ndb_master-slave.inc
# set up circular replication
diff --git a/mysql-test/t/rpl_ndb_circular_simplex.test b/mysql-test/t/rpl_ndb_circular_simplex.test
index 2ea60beaba2..633bbd75006 100644
--- a/mysql-test/t/rpl_ndb_circular_simplex.test
+++ b/mysql-test/t/rpl_ndb_circular_simplex.test
@@ -1,6 +1,6 @@
--source include/have_ndb.inc
--source include/have_binlog_format_row.inc
---source include/master-slave.inc
+--source include/ndb_master-slave.inc
connection master;
CREATE TABLE t1 (a int key, b int) ENGINE=NDB;
diff --git a/mysql-test/t/rpl_ndb_commit_afterflush.test b/mysql-test/t/rpl_ndb_commit_afterflush.test
index ce2a4d9506c..5bbd7f0414e 100644
--- a/mysql-test/t/rpl_ndb_commit_afterflush.test
+++ b/mysql-test/t/rpl_ndb_commit_afterflush.test
@@ -5,5 +5,7 @@
# By JBM 2004-02-15 #
#####################################
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
+-- source include/ndb_master-slave.inc
let $engine_type=NDB;
-- source extra/rpl_tests/rpl_commit_after_flush.test
diff --git a/mysql-test/t/rpl_ndb_dd_advance.test b/mysql-test/t/rpl_ndb_dd_advance.test
index 0a1ab37cdad..5e346d5fe3b 100644
--- a/mysql-test/t/rpl_ndb_dd_advance.test
+++ b/mysql-test/t/rpl_ndb_dd_advance.test
@@ -11,7 +11,7 @@
--source include/not_embedded.inc
--source include/big_test.inc
#--source include/have_ndb_extra.inc
---source include/master-slave.inc
+--source include/ndb_master-slave.inc
#### Test start cleanup section #####
--disable_warnings
diff --git a/mysql-test/t/rpl_ndb_dd_basic.test b/mysql-test/t/rpl_ndb_dd_basic.test
index 7387d39db87..ca583860b91 100644
--- a/mysql-test/t/rpl_ndb_dd_basic.test
+++ b/mysql-test/t/rpl_ndb_dd_basic.test
@@ -1,6 +1,6 @@
--source include/have_ndb.inc
--source include/have_binlog_format_row.inc
---source include/master-slave.inc
+--source include/ndb_master-slave.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/t/rpl_ndb_dd_partitions.test b/mysql-test/t/rpl_ndb_dd_partitions.test
index 9291f38e8db..fe6db98dd13 100644
--- a/mysql-test/t/rpl_ndb_dd_partitions.test
+++ b/mysql-test/t/rpl_ndb_dd_partitions.test
@@ -7,7 +7,7 @@
--source include/have_ndb.inc
--source include/have_binlog_format_row.inc
---source include/master-slave.inc
+--source include/ndb_master-slave.inc
--echo --- Doing pre test cleanup ---
diff --git a/mysql-test/t/rpl_ndb_ddl.test b/mysql-test/t/rpl_ndb_ddl.test
index 66db755de15..f2c32ac2cd5 100644
--- a/mysql-test/t/rpl_ndb_ddl.test
+++ b/mysql-test/t/rpl_ndb_ddl.test
@@ -23,9 +23,9 @@
# abort of the test case etc..
#
---source include/master-slave.inc
---source include/have_binlog_format_row.inc
--source include/have_ndb.inc
+--source include/have_binlog_format_row.inc
+--source include/ndb_master-slave.inc
let $engine_type= NDB;
let $temp_engine_type= MEMORY;
let $show_binlog = 0;
diff --git a/mysql-test/t/rpl_ndb_delete_nowhere.test b/mysql-test/t/rpl_ndb_delete_nowhere.test
index 92ceddf7f5c..49ba07b2fde 100644
--- a/mysql-test/t/rpl_ndb_delete_nowhere.test
+++ b/mysql-test/t/rpl_ndb_delete_nowhere.test
@@ -4,5 +4,6 @@
#########################################
--source include/have_ndb.inc
-- source include/have_binlog_format_row.inc
+-- source include/ndb_master-slave.inc
let $engine_type=NDB;
-- source extra/rpl_tests/rpl_delete_no_where.test
diff --git a/mysql-test/t/rpl_ndb_do_db.test b/mysql-test/t/rpl_ndb_do_db.test
index 9b65d43f244..3e450a1fe4b 100644
--- a/mysql-test/t/rpl_ndb_do_db.test
+++ b/mysql-test/t/rpl_ndb_do_db.test
@@ -7,7 +7,7 @@
--source include/have_ndb.inc
--source include/have_binlog_format_row.inc
---source include/master-slave.inc
+--source include/ndb_master-slave.inc
--disable_warnings
DROP DATABASE IF EXISTS replica;
diff --git a/mysql-test/t/rpl_ndb_do_table.test b/mysql-test/t/rpl_ndb_do_table.test
index 55a40d85172..6e36ab407a1 100644
--- a/mysql-test/t/rpl_ndb_do_table.test
+++ b/mysql-test/t/rpl_ndb_do_table.test
@@ -7,7 +7,7 @@
--source include/have_ndb.inc
--source include/have_binlog_format_row.inc
---source include/master-slave.inc
+--source include/ndb_master-slave.inc
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
diff --git a/mysql-test/t/rpl_ndb_extraCol.test b/mysql-test/t/rpl_ndb_extraCol.test
index cf0501c490a..292b8bbfa45 100644
--- a/mysql-test/t/rpl_ndb_extraCol.test
+++ b/mysql-test/t/rpl_ndb_extraCol.test
@@ -5,8 +5,8 @@
# Using NDB
###########################################
-- source include/have_binlog_format_row.inc
---source include/have_ndb.inc
--- source include/master-slave.inc
+-- source include/have_ndb.inc
+-- source include/ndb_master-slave.inc
let $engine_type = 'NDB';
-- source extra/rpl_tests/rpl_extraSlave_Col.test
diff --git a/mysql-test/t/rpl_ndb_func003.test b/mysql-test/t/rpl_ndb_func003.test
index a19de7d3d6b..f91c891f943 100644
--- a/mysql-test/t/rpl_ndb_func003.test
+++ b/mysql-test/t/rpl_ndb_func003.test
@@ -7,6 +7,8 @@
# reduce test case code #
###################################
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
+-- source include/ndb_master-slave.inc
let $engine_type=NDB;
-- source extra/rpl_tests/rpl_row_func003.test
-- source include/master-slave-end.inc
diff --git a/mysql-test/t/rpl_ndb_idempotent.test b/mysql-test/t/rpl_ndb_idempotent.test
index f2bfe745523..0bae33c5d40 100644
--- a/mysql-test/t/rpl_ndb_idempotent.test
+++ b/mysql-test/t/rpl_ndb_idempotent.test
@@ -1,6 +1,6 @@
--source include/have_ndb.inc
--source include/have_binlog_format_row.inc
---source include/master-slave.inc
+--source include/ndb_master-slave.inc
#
# Currently test only works with ndb since it retrieves "old"
@@ -43,7 +43,7 @@ SELECT * FROM t1 ORDER BY c3;
SELECT * FROM t1 ORDER BY c3;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master>
+--replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error>
SHOW SLAVE STATUS;
# stop slave and reset position to before the last changes
@@ -54,7 +54,7 @@ eval CHANGE MASTER TO
master_log_pos = $the_pos ;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master>
+--replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error>
SHOW SLAVE STATUS;
# start the slave again
@@ -107,7 +107,7 @@ COMMIT;
--connection slave
SELECT * FROM t1;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master>
+--replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 34 <Last_IO_Errno> 35 <Last_IO_Error>
SHOW SLAVE STATUS;
connection master;
diff --git a/mysql-test/t/rpl_ndb_innodb2ndb.test b/mysql-test/t/rpl_ndb_innodb2ndb.test
index 229ee11353b..8f67802c055 100644
--- a/mysql-test/t/rpl_ndb_innodb2ndb.test
+++ b/mysql-test/t/rpl_ndb_innodb2ndb.test
@@ -7,10 +7,8 @@
# to be able to use the same code for all these different
# test and to have control over the tests.
##############################################################
--- source include/have_innodb.inc
--- source include/master-slave.inc
-connection slave;
-- source include/have_ndb.inc
-connection master;
+-- source include/have_innodb.inc
+-- source include/ndb_master-slave.inc
SET storage_engine=innodb;
--source extra/rpl_tests/rpl_ndb_2multi_eng.test
diff --git a/mysql-test/t/rpl_ndb_innodb_trans.test b/mysql-test/t/rpl_ndb_innodb_trans.test
index 127c2464570..efba6050554 100644
--- a/mysql-test/t/rpl_ndb_innodb_trans.test
+++ b/mysql-test/t/rpl_ndb_innodb_trans.test
@@ -2,7 +2,8 @@
-- source include/have_ndb.inc
-- source include/have_innodb.inc
--- source include/master-slave.inc
+-- source include/have_binlog_format_row.inc
+-- source include/ndb_master-slave.inc
create table t1 (a int, unique(a)) engine=ndbcluster;
create table t2 (a int, unique(a)) engine=innodb;
diff --git a/mysql-test/t/rpl_ndb_insert_ignore.test b/mysql-test/t/rpl_ndb_insert_ignore.test
index 17acb5983f4..5137c81c0cd 100644
--- a/mysql-test/t/rpl_ndb_insert_ignore.test
+++ b/mysql-test/t/rpl_ndb_insert_ignore.test
@@ -3,6 +3,7 @@
#####################################
-- source include/have_ndb.inc
-- source include/have_binlog_format_row.inc
+-- source include/ndb_master-slave.inc
let $engine_type=NDB;
let $engine_type2=myisam;
-- source extra/rpl_tests/rpl_insert_ignore.test
diff --git a/mysql-test/t/rpl_ndb_load.test b/mysql-test/t/rpl_ndb_load.test
index 2ee540afd18..a695eee3221 100644
--- a/mysql-test/t/rpl_ndb_load.test
+++ b/mysql-test/t/rpl_ndb_load.test
@@ -7,7 +7,7 @@
--source include/have_ndb.inc
--source include/have_ndb_extra.inc
--source include/have_binlog_format_row.inc
---source include/master-slave.inc
+--source include/ndb_master-slave.inc
--disable_warnings
# reset master
diff --git a/mysql-test/t/rpl_ndb_log.test b/mysql-test/t/rpl_ndb_log.test
index e883d24b977..d32a05bf92a 100644
--- a/mysql-test/t/rpl_ndb_log.test
+++ b/mysql-test/t/rpl_ndb_log.test
@@ -7,6 +7,7 @@
###################################
-- source include/have_binlog_format_row.inc
-- source include/have_ndb.inc
+-- source include/ndb_master-slave.inc
let $engine_type=NDB;
-- source extra/rpl_tests/rpl_log.test
diff --git a/mysql-test/t/rpl_ndb_multi.test b/mysql-test/t/rpl_ndb_multi.test
index 196d0a5ed6f..ab92b65ba19 100644
--- a/mysql-test/t/rpl_ndb_multi.test
+++ b/mysql-test/t/rpl_ndb_multi.test
@@ -1,7 +1,6 @@
---source include/have_ndb.inc
--source include/have_multi_ndb.inc
--source include/have_binlog_format_row.inc
---source include/master-slave.inc
+--source include/ndb_master-slave.inc
# note: server2 is another "master" connected to the master cluster
diff --git a/mysql-test/t/rpl_ndb_multi_update2.test b/mysql-test/t/rpl_ndb_multi_update2.test
index df4f0eec39d..75f4b63aae2 100644
--- a/mysql-test/t/rpl_ndb_multi_update2.test
+++ b/mysql-test/t/rpl_ndb_multi_update2.test
@@ -7,6 +7,7 @@
# Run this only for row based replication, as replication of
# auto_increment values are not supported with NDB as storage engine
-- source include/have_binlog_format_row.inc
+-- source include/ndb_master-slave.inc
let $engine_type=NDB;
--source extra/rpl_tests/rpl_multi_update2.test
diff --git a/mysql-test/t/rpl_ndb_multi_update3.test b/mysql-test/t/rpl_ndb_multi_update3.test
index 008e2143987..fbf44d66408 100644
--- a/mysql-test/t/rpl_ndb_multi_update3.test
+++ b/mysql-test/t/rpl_ndb_multi_update3.test
@@ -4,5 +4,6 @@
############################################################
-- source include/have_ndb.inc
-- source include/have_binlog_format_row.inc
+-- source include/ndb_master-slave.inc
let $engine_type=NDB;
-- source extra/rpl_tests/rpl_multi_update3.test
diff --git a/mysql-test/t/rpl_ndb_myisam2ndb.test b/mysql-test/t/rpl_ndb_myisam2ndb.test
index 0c2df6441cb..2ed151b7a87 100644
--- a/mysql-test/t/rpl_ndb_myisam2ndb.test
+++ b/mysql-test/t/rpl_ndb_myisam2ndb.test
@@ -7,9 +7,6 @@
# to be able to use the same code for all these different
# test and to have control over the tests.
##############################################################
--- source include/master-slave.inc
-connection slave;
---source include/have_ndb.inc
-connection master;
+-- source include/ndb_master-slave.inc
SET storage_engine=myisam;
--source extra/rpl_tests/rpl_ndb_2multi_eng.test
diff --git a/mysql-test/t/rpl_ndb_relayrotate.test b/mysql-test/t/rpl_ndb_relayrotate.test
index c5ec0e1d21b..b0b9dd9e7da 100644
--- a/mysql-test/t/rpl_ndb_relayrotate.test
+++ b/mysql-test/t/rpl_ndb_relayrotate.test
@@ -4,5 +4,6 @@
############################################################
-- source include/have_ndb.inc
-- source include/have_ndb_extra.inc
+-- source include/ndb_master-slave.inc
let $engine_type=NDB;
-- source extra/rpl_tests/rpl_relayrotate.test
diff --git a/mysql-test/t/rpl_ndb_rep_ignore.test b/mysql-test/t/rpl_ndb_rep_ignore.test
index 47f5bce5527..f010d96b5ee 100644
--- a/mysql-test/t/rpl_ndb_rep_ignore.test
+++ b/mysql-test/t/rpl_ndb_rep_ignore.test
@@ -8,7 +8,7 @@
--source include/have_ndb.inc
--source include/have_binlog_format_row.inc
---source include/master-slave.inc
+--source include/ndb_master-slave.inc
--disable_warnings
DROP DATABASE IF EXISTS replica;
diff --git a/mysql-test/t/rpl_ndb_row_001.test b/mysql-test/t/rpl_ndb_row_001.test
index 1e2a4ec02df..4429ea177d3 100644
--- a/mysql-test/t/rpl_ndb_row_001.test
+++ b/mysql-test/t/rpl_ndb_row_001.test
@@ -2,5 +2,7 @@
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
########################################################
--source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
+-- source include/ndb_master-slave.inc
let $engine_type=NDB;
-- source extra/rpl_tests/rpl_row_001.test
diff --git a/mysql-test/t/rpl_ndb_sp003.test b/mysql-test/t/rpl_ndb_sp003.test
index 75ad9f0a488..1774a313851 100644
--- a/mysql-test/t/rpl_ndb_sp003.test
+++ b/mysql-test/t/rpl_ndb_sp003.test
@@ -5,5 +5,7 @@
# For different engines #
#################################
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
+-- source include/ndb_master-slave.inc
let $engine_type=NDBCLUSTER;
-- source extra/rpl_tests/rpl_row_sp003.test
diff --git a/mysql-test/t/rpl_ndb_sp006.test b/mysql-test/t/rpl_ndb_sp006.test
index 590facc3648..0003781f54e 100644
--- a/mysql-test/t/rpl_ndb_sp006.test
+++ b/mysql-test/t/rpl_ndb_sp006.test
@@ -5,5 +5,7 @@
# For different engines #
#################################
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
+-- source include/ndb_master-slave.inc
let $engine_type=NDBCLUSTER;
-- source extra/rpl_tests/rpl_row_sp006.test
diff --git a/mysql-test/t/rpl_ndb_stm_innodb.test b/mysql-test/t/rpl_ndb_stm_innodb.test
index b92fbbcfce6..d43fafa8406 100644
--- a/mysql-test/t/rpl_ndb_stm_innodb.test
+++ b/mysql-test/t/rpl_ndb_stm_innodb.test
@@ -1,7 +1,7 @@
--source include/have_ndb.inc
--source include/have_innodb.inc
--source include/have_binlog_format_mixed_or_statement.inc
---source include/master-slave.inc
+--source include/ndb_master-slave.inc
--connection master
create table t1 (a int key, b int) engine innodb;
@@ -12,6 +12,14 @@ create table t2 (a int key, b int) engine innodb;
alter table t1 engine ndb;
alter table t2 engine ndb;
+# We need MIXED mode on the slave in the event that there are
+# statements coming in from the master. In this case, NDB can only
+# handle row-based format, so it has to be possible to switch to
+# this.
+STOP SLAVE;
+SET GLOBAL BINLOG_FORMAT=MIXED;
+START SLAVE;
+
# check binlog position without begin
--connection master
insert into t1 values (1,2);
diff --git a/mysql-test/t/rpl_ndb_sync.test b/mysql-test/t/rpl_ndb_sync.test
index 14e2b36b588..6db75cf1e36 100644
--- a/mysql-test/t/rpl_ndb_sync.test
+++ b/mysql-test/t/rpl_ndb_sync.test
@@ -2,7 +2,7 @@
--source include/ndb_default_cluster.inc
--source include/not_embedded.inc
--source include/have_binlog_format_row.inc
---source include/master-slave.inc
+--source include/ndb_master-slave.inc
#
# Currently test only works with ndb since it retrieves "old"
@@ -72,8 +72,8 @@ START SLAVE;
--sync_slave_with_master
--connection slave
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master>
-SHOW SLAVE STATUS;
+--replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error>
+query_vertical SHOW SLAVE STATUS;
SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1;
diff --git a/mysql-test/t/rpl_ndb_trig004.test b/mysql-test/t/rpl_ndb_trig004.test
index 7439da563a6..f9674e43c50 100644
--- a/mysql-test/t/rpl_ndb_trig004.test
+++ b/mysql-test/t/rpl_ndb_trig004.test
@@ -9,7 +9,7 @@
# Includes
-- source include/have_binlog_format_row.inc
-- source include/have_ndb.inc
--- source include/master-slave.inc
+-- source include/ndb_master-slave.inc
let $engine_type=NDB;
-- source extra/rpl_tests/rpl_trig004.test
diff --git a/mysql-test/t/rpl_ndbapi_multi.test b/mysql-test/t/rpl_ndbapi_multi.test
index 62b83f0557a..c33d0d296ad 100644
--- a/mysql-test/t/rpl_ndbapi_multi.test
+++ b/mysql-test/t/rpl_ndbapi_multi.test
@@ -1,7 +1,7 @@
-- source include/have_ndb.inc
-- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-- source include/have_ndbapi_examples.inc
+-- source include/ndb_master-slave.inc
--exec echo Running ndbapi_simple_dual
--exec $NDB_EXAMPLES_DIR/ndbapi_simple_dual/ndbapi_simple_dual $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" $SLAVE_MYSOCK "localhost:$NDBCLUSTER_PORT_SLAVE" >> $NDB_EXAMPLES_OUTPUT
diff --git a/mysql-test/t/rpl_partition.test b/mysql-test/t/rpl_partition.test
new file mode 100644
index 00000000000..7f6e05db20e
--- /dev/null
+++ b/mysql-test/t/rpl_partition.test
@@ -0,0 +1,160 @@
+--source include/have_innodb.inc
+--source include/master-slave.inc
+
+--vertical_results
+
+let $engine_type= 'innodb';
+
+SET GLOBAL binlog_format = 'ROW';
+SET SESSION binlog_format = 'ROW';
+select @@global.binlog_format, @@session.binlog_format;
+
+--disable-warnings
+DROP TABLE IF EXISTS t1, t2, t3;
+DROP PROCEDURE IF EXISTS p1;
+DROP PROCEDURE IF EXISTS p2;
+DROP PROCEDURE IF EXISTS p3;
+--enable-warnings
+
+eval CREATE TABLE t1(id MEDIUMINT NOT NULL AUTO_INCREMENT,
+ dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
+ fkid MEDIUMINT, filler VARCHAR(255),
+ PRIMARY KEY(id)) ENGINE=$engine_type;
+
+eval CREATE TABLE t2(id MEDIUMINT NOT NULL AUTO_INCREMENT,
+ dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
+ fkid MEDIUMINT, filler VARCHAR(255),
+ PRIMARY KEY(id)) ENGINE=$engine_type
+ PARTITION BY KEY(id) partitions 5;
+
+eval CREATE TABLE t3(id MEDIUMINT NOT NULL AUTO_INCREMENT,
+ dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
+ fkid MEDIUMINT, filler VARCHAR(255),
+ PRIMARY KEY(id)) ENGINE=$engine_type
+ PARTITION BY RANGE(id)
+ SUBPARTITION BY hash(id) subpartitions 2
+ (PARTITION pa1 values less than (10),
+ PARTITION pa2 values less than (20),
+ PARTITION pa3 values less than (30),
+ PARTITION pa4 values less than (40),
+ PARTITION pa5 values less than (50),
+ PARTITION pa6 values less than (60),
+ PARTITION pa7 values less than (70),
+ PARTITION pa8 values less than (80),
+ PARTITION pa9 values less than (90),
+ PARTITION pa10 values less than (100),
+ PARTITION pa11 values less than MAXVALUE);
+
+######## Create SPs, Functions, Views and Triggers Section ##############
+
+delimiter |;
+CREATE PROCEDURE p1()
+BEGIN
+ DECLARE ins_count INT DEFAULT 1000;
+ DECLARE del_count INT;
+ DECLARE cur_user VARCHAR(255);
+ DECLARE local_uuid VARCHAR(255);
+ DECLARE local_time TIMESTAMP;
+
+ SET local_time= NOW();
+ SET cur_user= CURRENT_USER();
+ SET local_uuid= UUID();
+
+ WHILE ins_count > 0 DO
+ INSERT INTO t1 VALUES (NULL, NOW(), USER() , UUID(),
+ ins_count,'Going to test MBR for MySQL');
+ SET ins_count = ins_count - 1;
+ END WHILE;
+
+ SELECT MAX(id) FROM t1 INTO del_count;
+ WHILE del_count > 0 DO
+ DELETE FROM t1 WHERE id = del_count;
+ SET del_count = del_count - 2;
+ END WHILE;
+END|
+
+CREATE PROCEDURE p2()
+BEGIN
+ DECLARE ins_count INT DEFAULT 1000;
+ DECLARE del_count INT;
+ DECLARE cur_user VARCHAR(255);
+ DECLARE local_uuid VARCHAR(255);
+ DECLARE local_time TIMESTAMP;
+
+ SET local_time= NOW();
+ SET cur_user= CURRENT_USER();
+ SET local_uuid= UUID();
+
+ WHILE ins_count > 0 DO
+ INSERT INTO t2 VALUES (NULL, NOW(), USER() , UUID(),
+ ins_count,'Going to test MBR for MySQL');
+ SET ins_count = ins_count - 1;
+ END WHILE;
+
+ SELECT MAX(id) FROM t2 INTO del_count;
+ WHILE del_count > 0 DO
+ DELETE FROM t2 WHERE id = del_count;
+ SET del_count = del_count - 2;
+ END WHILE;
+END|
+
+CREATE PROCEDURE p3()
+BEGIN
+ DECLARE ins_count INT DEFAULT 1000;
+ DECLARE del_count INT;
+ DECLARE cur_user VARCHAR(255);
+ DECLARE local_uuid VARCHAR(255);
+ DECLARE local_time TIMESTAMP;
+
+ SET local_time= NOW();
+ SET cur_user = CURRENT_USER();
+ SET local_uuid=UUID();
+
+ WHILE ins_count > 0 DO
+ INSERT INTO t3 VALUES (NULL, NOW(), USER(), UUID(),
+ ins_count,'Going to test MBR for MySQL');
+ SET ins_count = ins_count - 1;
+ END WHILE;
+
+ SELECT MAX(id) FROM t3 INTO del_count;
+ WHILE del_count > 0 DO
+ DELETE FROM t3 WHERE id = del_count;
+ SET del_count = del_count - 2;
+ END WHILE;
+END|
+
+delimiter ;|
+
+############ Finish Setup Section ###################
+
+
+############ Test Section ###################
+
+CALL p1();
+SELECT count(*) as "Master regular" FROM t1;
+CALL p2();
+SELECT count(*) as "Master bykey" FROM t2;
+CALL p3();
+SELECT count(*) as "Master byrange" FROM t3;
+
+#--source include/master-slave-end.inc
+--sync_slave_with_master
+connection slave;
+show create table t3;
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
+show slave status;
+SELECT count(*) "Slave norm" FROM t1;
+SELECT count(*) "Slave bykey" FROM t2;
+SELECT count(*) "Slave byrange" FROM t3;
+
+connection master;
+DROP TABLE t1, t2, t3;
+DROP PROCEDURE IF EXISTS p1;
+DROP PROCEDURE IF EXISTS p2;
+DROP PROCEDURE IF EXISTS p3;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+# End of 5.1 tests
diff --git a/mysql-test/t/rpl_rbr_to_sbr.test b/mysql-test/t/rpl_rbr_to_sbr.test
index 4f72996671d..72ae6a99c44 100644
--- a/mysql-test/t/rpl_rbr_to_sbr.test
+++ b/mysql-test/t/rpl_rbr_to_sbr.test
@@ -21,7 +21,7 @@ SHOW BINLOG EVENTS;
sync_slave_with_master;
--echo **** On Slave ****
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 23 # 33 # 34 # 35 #
--query_vertical SHOW SLAVE STATUS
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
diff --git a/mysql-test/t/rpl_redirect.test b/mysql-test/t/rpl_redirect.test
index 078d1048794..1c6f31a030e 100644
--- a/mysql-test/t/rpl_redirect.test
+++ b/mysql-test/t/rpl_redirect.test
@@ -13,9 +13,7 @@ sync_with_master;
#discover slaves
connection master;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 16 # 23 # 33 #
-SHOW SLAVE STATUS;
+source include/show_slave_status.inc;
--replace_result $SLAVE_MYPORT SLAVE_PORT
SHOW SLAVE HOSTS;
rpl_probe;
diff --git a/mysql-test/t/rpl_relayrotate.test b/mysql-test/t/rpl_relayrotate.test
index 46d54aea1d2..ec3e6be4bea 100644
--- a/mysql-test/t/rpl_relayrotate.test
+++ b/mysql-test/t/rpl_relayrotate.test
@@ -6,5 +6,6 @@
#######################################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
+-- source include/master-slave.inc
let $engine_type=innodb;
-- source extra/rpl_tests/rpl_relayrotate.test
diff --git a/mysql-test/t/rpl_replicate_do.test b/mysql-test/t/rpl_replicate_do.test
index 600840a2828..90f00764691 100644
--- a/mysql-test/t/rpl_replicate_do.test
+++ b/mysql-test/t/rpl_replicate_do.test
@@ -32,8 +32,8 @@ connection slave;
sync_with_master;
# show slave status, just to see of it prints replicate-do-table
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 #
-show slave status;
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
+query_vertical SHOW SLAVE STATUS;
#
# BUG#12542
diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test
index 155f9f4b6e0..c04b9045daa 100644
--- a/mysql-test/t/rpl_rotate_logs.test
+++ b/mysql-test/t/rpl_rotate_logs.test
@@ -65,9 +65,7 @@ insert into temp_table values ("testing temporary tables");
create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard');
sync_slave_with_master;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 16 # 23 # 33 #
-show slave status;
+source include/show_slave_status.inc;
select * from t1;
connection master;
flush logs;
@@ -127,9 +125,7 @@ purge master logs before (@time_for_purge);
show binary logs;
insert into t2 values (65);
sync_slave_with_master;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 16 # 23 # 33 #
-show slave status;
+source include/show_slave_status.inc;
select * from t2;
#
@@ -159,9 +155,7 @@ connection slave;
sync_with_master;
select * from t4;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 16 # 23 # 33 #
-show slave status;
+source include/show_slave_status.inc;
# because of concurrent insert, the table may not be up to date
# if we do not lock
lock tables t3 read;
diff --git a/mysql-test/t/rpl_row_001.test b/mysql-test/t/rpl_row_001.test
index 639c55362a5..99eaebcdcaf 100644
--- a/mysql-test/t/rpl_row_001.test
+++ b/mysql-test/t/rpl_row_001.test
@@ -3,5 +3,7 @@
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
let $engine_type=MYISAM;
-- source extra/rpl_tests/rpl_row_001.test
diff --git a/mysql-test/t/rpl_row_UUID.test b/mysql-test/t/rpl_row_UUID.test
index 6ead7c2ee9b..b0ef96463d0 100644
--- a/mysql-test/t/rpl_row_UUID.test
+++ b/mysql-test/t/rpl_row_UUID.test
@@ -3,5 +3,7 @@
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
let $engine_type=myisam;
--source extra/rpl_tests/rpl_row_UUID.test
diff --git a/mysql-test/t/rpl_row_basic_11bugs.test b/mysql-test/t/rpl_row_basic_11bugs.test
index 0109edf4264..fb43664f121 100644
--- a/mysql-test/t/rpl_row_basic_11bugs.test
+++ b/mysql-test/t/rpl_row_basic_11bugs.test
@@ -184,3 +184,42 @@ SELECT k, HEX(a),HEX(b) FROM t2_innodb;
connection master;
DROP TABLE IF EXISTS t1_myisam, t1_innodb, t2_myisam, t2_innodb;
sync_slave_with_master;
+
+#
+# Bug#27716 multi-update did partially and has not binlogged
+#
+
+connection master;
+
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+CREATE TABLE `t1` (
+ `a` int(11) NOT NULL auto_increment,
+ `b` int(11) default NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
+
+CREATE TABLE `t2` (
+ `a` int(11) NOT NULL auto_increment,
+ `b` int(11) default NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
+
+# testing multi_update::send_error() effective update
+insert into t1 values (1,1),(2,2);
+insert into t2 values (1,1),(4,4);
+
+connection master;
+error ER_DUP_ENTRY;
+UPDATE t2,t1 SET t2.a=t1.a+2;
+select * from t2 /* must be (3,1), (4,4) */;
+sync_slave_with_master;
+
+connection slave;
+select * from t2 /* must be (3,1), (4,4) */;
+
+connection master;
+drop table t1,t2;
+
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_row_basic_2myisam.test b/mysql-test/t/rpl_row_basic_2myisam.test
index c2cef800ec8..c5648fa1d77 100644
--- a/mysql-test/t/rpl_row_basic_2myisam.test
+++ b/mysql-test/t/rpl_row_basic_2myisam.test
@@ -1,3 +1,6 @@
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
let $type= 'MYISAM' ;
let $extra_index= ;
-- source extra/rpl_tests/rpl_row_basic.test
diff --git a/mysql-test/t/rpl_row_basic_3innodb.test b/mysql-test/t/rpl_row_basic_3innodb.test
index 89effc4b3bb..3786a697e3f 100644
--- a/mysql-test/t/rpl_row_basic_3innodb.test
+++ b/mysql-test/t/rpl_row_basic_3innodb.test
@@ -1,4 +1,6 @@
-- source include/have_innodb.inc
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
let $type= 'INNODB' ;
let $extra_index= ;
diff --git a/mysql-test/t/rpl_row_basic_7ndb.test b/mysql-test/t/rpl_row_basic_7ndb.test
index 1ec2fb333ae..7cf039a1c21 100644
--- a/mysql-test/t/rpl_row_basic_7ndb.test
+++ b/mysql-test/t/rpl_row_basic_7ndb.test
@@ -1,4 +1,7 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
+-- source include/ndb_master-slave.inc
+
let $type= 'NDB' ;
let $extra_index= ;
-- source extra/rpl_tests/rpl_row_basic.test
diff --git a/mysql-test/t/rpl_row_blob_innodb.test b/mysql-test/t/rpl_row_blob_innodb.test
index 0bce657f9f9..6aa6c2a31b9 100644
--- a/mysql-test/t/rpl_row_blob_innodb.test
+++ b/mysql-test/t/rpl_row_blob_innodb.test
@@ -7,6 +7,8 @@
########################################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
let $engine_type=InnoDB;
-- source extra/rpl_tests/rpl_row_blob.test
diff --git a/mysql-test/t/rpl_row_blob_myisam.test b/mysql-test/t/rpl_row_blob_myisam.test
index a470c36f9f8..11f5336502a 100644
--- a/mysql-test/t/rpl_row_blob_myisam.test
+++ b/mysql-test/t/rpl_row_blob_myisam.test
@@ -6,6 +6,8 @@
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
let $engine_type=myisam;
-- source extra/rpl_tests/rpl_row_blob.test
diff --git a/mysql-test/t/rpl_row_charset.test b/mysql-test/t/rpl_row_charset.test
index 9737c52c70f..c83ccc586ba 100644
--- a/mysql-test/t/rpl_row_charset.test
+++ b/mysql-test/t/rpl_row_charset.test
@@ -3,5 +3,7 @@
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
let $engine_type=myisam;
-- source extra/rpl_tests/rpl_row_charset.test
diff --git a/mysql-test/t/rpl_row_func003.test b/mysql-test/t/rpl_row_func003.test
index abfadfe1a1a..30b24cf4174 100644
--- a/mysql-test/t/rpl_row_func003.test
+++ b/mysql-test/t/rpl_row_func003.test
@@ -7,5 +7,7 @@
########################################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
let $engine_type=INNODB;
-- source extra/rpl_tests/rpl_row_func003.test
diff --git a/mysql-test/t/rpl_row_inexist_tbl.test b/mysql-test/t/rpl_row_inexist_tbl.test
index 803c214b6c5..25a8c0e744e 100644
--- a/mysql-test/t/rpl_row_inexist_tbl.test
+++ b/mysql-test/t/rpl_row_inexist_tbl.test
@@ -25,10 +25,8 @@ connection slave;
# slave should have stopped because can't find table t1
--source include/wait_for_slave_sql_to_stop.inc
# see if we have a good error message:
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 23 # 33 #
---vertical_results
-show slave status;
+--replace_column 7 #
+source include/show_slave_status.inc;
# cleanup
connection master;
diff --git a/mysql-test/t/rpl_row_log.test b/mysql-test/t/rpl_row_log.test
index 3253ae9ecba..197f83c85af 100644
--- a/mysql-test/t/rpl_row_log.test
+++ b/mysql-test/t/rpl_row_log.test
@@ -11,6 +11,7 @@
########################################################
-- source include/not_ndb_default.inc
-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
let $engine_type=MyISAM;
-- source extra/rpl_tests/rpl_log.test
diff --git a/mysql-test/t/rpl_row_log_innodb.test b/mysql-test/t/rpl_row_log_innodb.test
index 5e5182e3519..16e775287b3 100644
--- a/mysql-test/t/rpl_row_log_innodb.test
+++ b/mysql-test/t/rpl_row_log_innodb.test
@@ -8,6 +8,7 @@
-- source include/not_ndb_default.inc
-- source include/have_binlog_format_row.inc
-- source include/have_innodb.inc
+-- source include/master-slave.inc
let $engine_type=InnoDB;
-- source extra/rpl_tests/rpl_log.test
diff --git a/mysql-test/t/rpl_row_sp003.test b/mysql-test/t/rpl_row_sp003.test
index 99b30253c8a..391ecd59b22 100644
--- a/mysql-test/t/rpl_row_sp003.test
+++ b/mysql-test/t/rpl_row_sp003.test
@@ -7,5 +7,7 @@
########################################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
let $engine_type=INNODB;
-- source extra/rpl_tests/rpl_row_sp003.test
diff --git a/mysql-test/t/rpl_row_sp006_InnoDB.test b/mysql-test/t/rpl_row_sp006_InnoDB.test
index f7e59440027..e5be4e6dc28 100644
--- a/mysql-test/t/rpl_row_sp006_InnoDB.test
+++ b/mysql-test/t/rpl_row_sp006_InnoDB.test
@@ -7,5 +7,7 @@
########################################################
-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
let $engine_type=InnoDB;
-- source extra/rpl_tests/rpl_row_sp006.test
diff --git a/mysql-test/t/rpl_row_until.test b/mysql-test/t/rpl_row_until.test
index f1d21e65a4c..9464e5cfadd 100644
--- a/mysql-test/t/rpl_row_until.test
+++ b/mysql-test/t/rpl_row_until.test
@@ -27,32 +27,23 @@ drop table t2;
# try to replicate all queries until drop of t1
connection slave;
start slave until master_log_file='master-bin.000001', master_log_pos=311;
-sleep 2;
-wait_for_slave_to_stop;
+--source include/wait_for_slave_sql_to_stop.inc
# here table should be still not deleted
select * from t1;
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 9 # 11 # 23 # 33 #
---query_vertical SHOW SLAVE STATUS;
+source include/show_slave_status.inc;
# this should fail right after start
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
+--source include/wait_for_slave_sql_to_stop.inc
# again this table should be still not deleted
select * from t1;
-sleep 2;
-wait_for_slave_to_stop;
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 9 # 11 # 23 # 33 #
---query_vertical SHOW SLAVE STATUS;
+source include/show_slave_status.inc;
# try replicate all up to and not including the second insert to t2;
start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728;
-sleep 2;
-wait_for_slave_to_stop;
+--source include/wait_for_slave_sql_to_stop.inc
select * from t2;
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 9 # 11 # 23 # 33 #
---query_vertical SHOW SLAVE STATUS;
+source include/show_slave_status.inc;
# clean up
start slave;
@@ -64,12 +55,10 @@ stop slave;
# this should stop immediately as we are already there
start slave until master_log_file='master-bin.000001', master_log_pos=740;
-sleep 2;
-wait_for_slave_to_stop;
+--source include/wait_for_slave_sql_to_stop.inc
# here the sql slave thread should be stopped
---replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
---replace_column 1 # 9 # 23 # 33 #
---query_vertical SHOW SLAVE STATUS;
+--replace_result bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
+source include/show_slave_status.inc;
#testing various error conditions
--error 1277
diff --git a/mysql-test/t/rpl_server_id1.test b/mysql-test/t/rpl_server_id1.test
index 71310750b60..2db1f6e364d 100644
--- a/mysql-test/t/rpl_server_id1.test
+++ b/mysql-test/t/rpl_server_id1.test
@@ -13,8 +13,8 @@ stop slave;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_port=$SLAVE_MYPORT;
--replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 16 # 18 #
-show slave status;
+--replace_column 16 # 18 # 35 # 36 #
+query_vertical show slave status;
start slave;
insert into t1 values (1);
# can't MASTER_POS_WAIT(), it does not work in this weird setup
diff --git a/mysql-test/t/rpl_server_id2.test b/mysql-test/t/rpl_server_id2.test
index 0f2eb560d18..7e67fb42b4f 100644
--- a/mysql-test/t/rpl_server_id2.test
+++ b/mysql-test/t/rpl_server_id2.test
@@ -10,8 +10,8 @@ stop slave;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_port=$SLAVE_MYPORT;
--replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 18 #
-show slave status;
+--replace_column 18 # 35 # 36 #
+query_vertical show slave status;
start slave;
insert into t1 values (1);
save_master_pos;
diff --git a/mysql-test/t/rpl_skip_error.test b/mysql-test/t/rpl_skip_error.test
index ff81e2f010e..b68b637b3b0 100644
--- a/mysql-test/t/rpl_skip_error.test
+++ b/mysql-test/t/rpl_skip_error.test
@@ -27,3 +27,25 @@ drop table t1;
sync_slave_with_master;
# End of 4.1 tests
+
+#
+# #28839 Errors in strict mode silently stop SQL thread if --slave-skip-errors exists
+#
+connection master;
+create table t1(a int primary key);
+insert into t1 values (1),(2);
+delete from t1 where @@server_id=1;
+set sql_mode=strict_trans_tables;
+select @@server_id;
+insert into t1 values (1),(2),(3);
+sync_slave_with_master;
+connection slave;
+select @@server_id;
+select * from t1;
+--replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_result $MASTER_MYPORT MASTER_PORT
+show slave status;
+connection master;
+drop table t1;
+sync_with_master;
+# End of 5.0 tests
diff --git a/mysql-test/t/rpl_slave_skip.test b/mysql-test/t/rpl_slave_skip.test
new file mode 100644
index 00000000000..b19d6a2730b
--- /dev/null
+++ b/mysql-test/t/rpl_slave_skip.test
@@ -0,0 +1,71 @@
+source include/master-slave.inc;
+
+--echo **** On Slave ****
+connection slave;
+STOP SLAVE;
+
+--echo **** On Master ****
+connection master;
+SET SESSION BINLOG_FORMAT=ROW;
+
+CREATE TABLE t1 (a INT, b INT);
+CREATE TABLE t2 (c INT, d INT);
+INSERT INTO t1 VALUES (1,1),(2,4),(3,9);
+INSERT INTO t2 VALUES (1,1),(2,8),(3,27);
+UPDATE t1,t2 SET b = d, d = b * 2 WHERE a = c;
+source include/show_binlog_events.inc;
+
+# These tables should be changed
+SELECT * FROM t1;
+SELECT * FROM t2;
+save_master_pos;
+
+--echo **** On Slave ****
+connection slave;
+
+# Stop when reaching the the first table map event.
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=484;
+wait_for_slave_to_stop;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 23 # 33 # 35 # 36 #
+query_vertical SHOW SLAVE STATUS;
+
+# Now we skip *one* table map event. If the execution starts right
+# after that table map event, *one* of the involved tables will be
+# changed.
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
+START SLAVE;
+sync_with_master;
+
+# These values should be what was inserted, not what was
+# updated. Since we are skipping the first table map of the group
+# representing the UPDATE statement above, we should skip the entire
+# group and not start executing at the first table map.
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+STOP SLAVE;
+RESET SLAVE;
+connection master;
+RESET MASTER;
+
+SET SESSION BINLOG_FORMAT=STATEMENT;
+SET @foo = 12;
+INSERT INTO t1 VALUES(@foo, 2*@foo);
+save_master_pos;
+source include/show_binlog_events.inc;
+
+connection slave;
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=106;
+wait_for_slave_to_stop;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
+START SLAVE;
+sync_with_master;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 23 # 33 # 35 # 36 #
+query_vertical SHOW SLAVE STATUS;
+
+--echo **** On Master ****
+connection master;
+DROP TABLE t1, t2;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_slave_status.test b/mysql-test/t/rpl_slave_status.test
index 32320a50656..d07cf13dcf4 100644
--- a/mysql-test/t/rpl_slave_status.test
+++ b/mysql-test/t/rpl_slave_status.test
@@ -42,7 +42,7 @@ start slave;
--replace_result $MASTER_MYPORT MASTER_MYPORT
# Column 1 is replaced, since the output can be either
# "Connecting to master" or "Waiting for master update"
---replace_column 1 # 7 # 8 # 9 # 22 # 23 #
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 35 # 36 #
--vertical_results
show slave status;
diff --git a/mysql-test/t/rpl_ssl.test b/mysql-test/t/rpl_ssl.test
index dd03d5533b0..4bc07ee0622 100644
--- a/mysql-test/t/rpl_ssl.test
+++ b/mysql-test/t/rpl_ssl.test
@@ -31,7 +31,7 @@ select * from t1;
# The slave is synced and waiting/reading from master
# SHOW SLAVE STATUS will show "Waiting for master to send event"
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
query_vertical show slave status;
# Stop the slave, as reported in bug#21871 it would hang
@@ -58,8 +58,9 @@ connection master;
# the sync has something to do
insert into t1 values (NULL);
sync_slave_with_master;
+--source include/wait_for_slave_to_start.inc
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
query_vertical show slave status;
connection master;
@@ -67,3 +68,4 @@ drop user replssl@localhost;
drop table t1;
sync_slave_with_master;
+--echo End of 5.0 tests
diff --git a/mysql-test/t/rpl_ssl1.test b/mysql-test/t/rpl_ssl1.test
index 6ca1484bb17..b660c3991dd 100644
--- a/mysql-test/t/rpl_ssl1.test
+++ b/mysql-test/t/rpl_ssl1.test
@@ -45,7 +45,7 @@ select * from t1;
#checking show slave status
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 #
+--replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 # 35 # 36 #
query_vertical show slave status;
#checking if replication works without ssl also performing clean up
@@ -59,7 +59,7 @@ save_master_pos;
connection slave;
sync_with_master;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 #
+--replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 # 35 # 36 #
query_vertical show slave status;
# End of 4.1 tests
@@ -89,7 +89,7 @@ select * from t1;
#checking show slave status
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 #
+--replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 # 35 # 36 #
query_vertical show slave status;
connection master;
diff --git a/mysql-test/t/rpl_stm_log.test b/mysql-test/t/rpl_stm_log.test
index 5a1e0facc83..2af9d7f85bc 100644
--- a/mysql-test/t/rpl_stm_log.test
+++ b/mysql-test/t/rpl_stm_log.test
@@ -1,5 +1,6 @@
# Requires statement logging
-- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/master-slave.inc
let $engine_type=MyISAM;
-- source extra/rpl_tests/rpl_log.test
diff --git a/mysql-test/t/rpl_stm_until.test b/mysql-test/t/rpl_stm_until.test
index f42965c0eb0..98e7e0e5eac 100644
--- a/mysql-test/t/rpl_stm_until.test
+++ b/mysql-test/t/rpl_stm_until.test
@@ -26,32 +26,23 @@ drop table t2;
# try to replicate all queries until drop of t1
connection slave;
start slave until master_log_file='master-bin.000001', master_log_pos=323;
-sleep 2;
-wait_for_slave_to_stop;
+--source include/wait_for_slave_sql_to_stop.inc
# here table should be still not deleted
select * from t1;
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 9 # 11 # 23 # 33 #
---query_vertical SHOW SLAVE STATUS
+source include/show_slave_status.inc;
# this should fail right after start
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
+--source include/wait_for_slave_sql_to_stop.inc
# again this table should be still not deleted
select * from t1;
-sleep 2;
-wait_for_slave_to_stop;
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 9 # 11 # 23 # 33 #
---query_vertical SHOW SLAVE STATUS
+source include/show_slave_status.inc;
# try replicate all up to and not including the second insert to t2;
start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=746;
-sleep 2;
-wait_for_slave_to_stop;
+--source include/wait_for_slave_sql_to_stop.inc
select * from t2;
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 9 # 11 # 23 # 33 #
---query_vertical SHOW SLAVE STATUS
+source include/show_slave_status.inc;
# clean up
start slave;
@@ -63,12 +54,10 @@ stop slave;
# this should stop immediately as we are already there
start slave until master_log_file='master-bin.000001', master_log_pos=776;
-sleep 2;
-wait_for_slave_to_stop;
+--source include/wait_for_slave_sql_to_stop.inc
# here the sql slave thread should be stopped
---replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
---replace_column 1 # 9 # 23 # 33 #
---query_vertical SHOW SLAVE STATUS
+--replace_result bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
+source include/show_slave_status.inc;
#testing various error conditions
--error 1277
diff --git a/mysql-test/t/rpl_truncate_7ndb.test b/mysql-test/t/rpl_truncate_7ndb.test
index 1d69eee5dd0..f8933b3744d 100644
--- a/mysql-test/t/rpl_truncate_7ndb.test
+++ b/mysql-test/t/rpl_truncate_7ndb.test
@@ -1,6 +1,6 @@
--source include/have_ndb.inc
---source include/master-slave.inc
+--source include/ndb_master-slave.inc
--source include/have_binlog_format_mixed_or_row.inc
--disable_query_log
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index af2c044ee10..341c9039390 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -22,6 +22,12 @@ flush privileges;
create table t1 (a int not null primary key, b int not null,c int not null, key(b,c));
insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4);
+
+--echo -- Here we enable metadata just to check that the collation of the
+--echo -- resultset is non-binary for string type. This should be changed
+--echo -- after Bug#29394 is implemented.
+
+--enable_metadata
check table t1 fast;
check table t1 fast;
check table t1 changed;
@@ -30,28 +36,58 @@ check table t1 changed;
check table t1 medium;
check table t1 extended;
show index from t1;
+--disable_metadata
--error ER_DUP_ENTRY
insert into t1 values (5,5,5);
+
+--echo -- Here we enable metadata just to check that the collation of the
+--echo -- resultset is non-binary for string type. This should be changed
+--echo -- after Bug#29394 is implemented.
+
+--enable_metadata
optimize table t1;
+--disable_metadata
optimize table t1;
drop table t1;
#show variables;
+
+--echo -- Here we enable metadata just to check that the collation of the
+--echo -- resultset is non-binary for string type. This should be changed
+--echo -- after Bug#29394 is implemented.
+
+--enable_metadata
show variables like "wait_timeout%";
show variables like "WAIT_timeout%";
show variables like "this_doesn't_exists%";
show table status from test like "this_doesn't_exists%";
show databases;
show databases like "test%";
+--disable_metadata
#
# Check of show index
#
create table t1 (f1 int not null, f2 int not null, f3 int not null, f4 int not null, primary key(f1,f2,f3,f4));
insert into t1 values (1,1,1,0),(1,1,2,0),(1,1,3,0),(1,2,1,0),(1,2,2,0),(1,2,3,0),(1,3,1,0),(1,3,2,0),(1,3,3,0),(1,1,1,1),(1,1,2,1),(1,1,3,1),(1,2,1,1),(1,2,2,1),(1,2,3,1),(1,3,1,1),(1,3,2,1),(1,3,3,1);
+
+--echo -- Here we enable metadata just to check that the collation of the
+--echo -- resultset is non-binary for string type. This should be changed
+--echo -- after Bug#29394 is implemented.
+
+--enable_metadata
analyze table t1;
+--disable_metadata
show index from t1;
+
+--echo -- Here we enable metadata just to check that the collation of the
+--echo -- resultset is non-binary for string type. This should be changed
+--echo -- after Bug#29394 is implemented.
+
+--enable_metadata
+
repair table t1;
+--disable_metadata
show index from t1;
drop table t1;
@@ -513,6 +549,217 @@ show status like 'slow_queries';
# (mysqld is started with --log-queries-not-using-indexes)
select 1 from information_schema.tables limit 1;
show status like 'slow_queries';
+#
+# BUG#10491: Server returns data as charset binary SHOW CREATE TABLE or SELECT
+# FROM I_S.
+#
+
+# Ensure that all needed objects are dropped.
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1;
+DROP TABLE IF EXISTS t1;
+DROP VIEW IF EXISTS v1;
+DROP PROCEDURE IF EXISTS p1;
+DROP FUNCTION IF EXISTS f1;
+--enable_warnings
+
+# Create objects.
+
+CREATE DATABASE mysqltest1;
+
+CREATE TABLE t1(c INT NOT NULL PRIMARY KEY);
+
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1;
+
+CREATE VIEW v1 AS SELECT 1;
+
+CREATE PROCEDURE p1() SELECT 1;
+
+CREATE FUNCTION f1() RETURNS INT RETURN 1;
+
+
+# Test.
+
+set names utf8;
+
+--echo -- Here we enable metadata just to check that the collation of the
+--echo -- resultset is non-binary for string type. This should be changed
+--echo -- after Bug#29394 is implemented.
+
+--enable_metadata
+
+--echo ----------------------------------------------------------------
+
+SHOW CHARACTER SET LIKE 'utf8';
+
+--echo ----------------------------------------------------------------
+
+SHOW COLLATION LIKE 'latin1_bin';
+
+--echo ----------------------------------------------------------------
+
+SHOW CREATE DATABASE mysqltest1;
+
+--echo ----------------------------------------------------------------
+
+SHOW DATABASES LIKE 'mysqltest1';
+
+--echo ----------------------------------------------------------------
+
+SHOW CREATE TABLE t1;
+
+--echo ----------------------------------------------------------------
+
+SHOW INDEX FROM t1;
+
+--echo ----------------------------------------------------------------
+
+SELECT
+ TABLE_CATALOG,
+ TABLE_SCHEMA,
+ TABLE_NAME,
+ TABLE_TYPE,
+ ENGINE,
+ ROW_FORMAT,
+ TABLE_COLLATION,
+ CREATE_OPTIONS,
+ TABLE_COMMENT
+FROM INFORMATION_SCHEMA.TABLES
+WHERE table_name = 't1';
+
+--echo ----------------------------------------------------------------
+
+SELECT
+ TABLE_CATALOG,
+ TABLE_SCHEMA,
+ TABLE_NAME,
+ COLUMN_NAME,
+ COLUMN_DEFAULT,
+ IS_NULLABLE,
+ DATA_TYPE,
+ CHARACTER_SET_NAME,
+ COLLATION_NAME,
+ COLUMN_TYPE,
+ COLUMN_KEY,
+ EXTRA,
+ PRIVILEGES,
+ COLUMN_COMMENT
+FROM INFORMATION_SCHEMA.COLUMNS
+WHERE table_name = 't1';
+
+--echo ----------------------------------------------------------------
+
+SHOW TABLES LIKE 't1';
+
+--echo ----------------------------------------------------------------
+
+SHOW COLUMNS FROM t1;
+
+--echo ----------------------------------------------------------------
+
+SHOW TRIGGERS LIKE 't1';
+
+--echo ----------------------------------------------------------------
+
+SELECT
+ TRIGGER_CATALOG,
+ TRIGGER_SCHEMA,
+ TRIGGER_NAME,
+ EVENT_MANIPULATION,
+ EVENT_OBJECT_CATALOG,
+ EVENT_OBJECT_SCHEMA,
+ EVENT_OBJECT_TABLE,
+ ACTION_CONDITION,
+ ACTION_STATEMENT,
+ ACTION_ORIENTATION,
+ ACTION_TIMING,
+ ACTION_REFERENCE_OLD_TABLE,
+ ACTION_REFERENCE_NEW_TABLE,
+ ACTION_REFERENCE_OLD_ROW,
+ ACTION_REFERENCE_NEW_ROW,
+ SQL_MODE,
+ DEFINER
+FROM INFORMATION_SCHEMA.TRIGGERS
+WHERE trigger_name = 't1_bi';
+
+--echo ----------------------------------------------------------------
+
+SHOW CREATE VIEW v1;
+
+--echo ----------------------------------------------------------------
+
+SELECT *
+FROM INFORMATION_SCHEMA.VIEWS
+WHERE table_name = 'v1';
+
+--echo ----------------------------------------------------------------
+
+SHOW CREATE PROCEDURE p1;
+
+--echo ----------------------------------------------------------------
+
+SELECT
+ SPECIFIC_NAME,
+ ROUTINE_CATALOG,
+ ROUTINE_SCHEMA,
+ ROUTINE_NAME,
+ ROUTINE_TYPE,
+ DTD_IDENTIFIER,
+ ROUTINE_BODY,
+ ROUTINE_DEFINITION,
+ EXTERNAL_NAME,
+ EXTERNAL_LANGUAGE,
+ PARAMETER_STYLE,
+ IS_DETERMINISTIC,
+ SQL_DATA_ACCESS,
+ SQL_PATH,
+ SECURITY_TYPE,
+ SQL_MODE,
+ ROUTINE_COMMENT,
+ DEFINER
+FROM INFORMATION_SCHEMA.ROUTINES
+WHERE routine_name = 'p1';
+
+--echo ----------------------------------------------------------------
+
+SHOW CREATE FUNCTION f1;
+
+--echo ----------------------------------------------------------------
+
+SELECT
+ SPECIFIC_NAME,
+ ROUTINE_CATALOG,
+ ROUTINE_SCHEMA,
+ ROUTINE_NAME,
+ ROUTINE_TYPE,
+ DTD_IDENTIFIER,
+ ROUTINE_BODY,
+ ROUTINE_DEFINITION,
+ EXTERNAL_NAME,
+ EXTERNAL_LANGUAGE,
+ PARAMETER_STYLE,
+ IS_DETERMINISTIC,
+ SQL_DATA_ACCESS,
+ SQL_PATH,
+ SECURITY_TYPE,
+ SQL_MODE,
+ ROUTINE_COMMENT,
+ DEFINER
+FROM INFORMATION_SCHEMA.ROUTINES
+WHERE routine_name = 'f1';
+
+--echo ----------------------------------------------------------------
+
+--disable_metadata
+
+# Cleanup.
+
+DROP DATABASE mysqltest1;
+DROP TABLE t1;
+DROP VIEW v1;
+DROP PROCEDURE p1;
+DROP FUNCTION f1;
--echo End of 5.0 tests.
@@ -599,4 +846,55 @@ set names latin1;
--error ER_NO_SUCH_TABLE,ER_FILE_NOT_FOUND
show columns from `#mysql50#????????`;
+#
+# SHOW CREATE TRIGGER test.
+#
+
+# Prepare.
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP PROCEDURE IF EXISTS p1;
+--enable_warnings
+
+CREATE TABLE t1(c1 INT);
+
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1;
+
+# Test.
+
+SHOW CREATE TRIGGER t1_bi;
+
+CREATE PROCEDURE p1() SHOW CREATE TRIGGER t1_bi;
+
+CALL p1();
+CALL p1();
+CALL p1();
+CALL p1();
+CALL p1();
+CALL p1();
+CALL p1();
+CALL p1();
+CALL p1();
+CALL p1();
+
+PREPARE stmt1 FROM 'SHOW CREATE TRIGGER t1_bi';
+
+EXECUTE stmt1;
+EXECUTE stmt1;
+EXECUTE stmt1;
+EXECUTE stmt1;
+EXECUTE stmt1;
+EXECUTE stmt1;
+EXECUTE stmt1;
+EXECUTE stmt1;
+EXECUTE stmt1;
+EXECUTE stmt1;
+
+# Cleanup.
+
+DROP TABLE t1;
+DROP PROCEDURE p1;
+DEALLOCATE PREPARE stmt1;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test
index df07091d2de..04a581ab45f 100644
--- a/mysql-test/t/sp-destruct.test
+++ b/mysql-test/t/sp-destruct.test
@@ -94,26 +94,33 @@ insert into mysql.proc
(
db, name, type, specific_name, language, sql_data_access, is_deterministic,
security_type, param_list, returns, body, definer, created, modified,
- sql_mode, comment
+ sql_mode, comment, character_set_client, collation_connection, db_collation,
+ body_utf8
)
values
(
'test', 'bug14233_1', 'FUNCTION', 'bug14233_1', 'SQL', 'READS_SQL_DATA', 'NO',
'DEFINER', '', 'int(10)',
'select count(*) from mysql.user',
- 'root@localhost', NOW() , '0000-00-00 00:00:00', '', ''
+ 'root@localhost', NOW() , '0000-00-00 00:00:00', '', '',
+ '', '', '',
+ 'select count(*) from mysql.user'
),
(
'test', 'bug14233_2', 'FUNCTION', 'bug14233_2', 'SQL', 'READS_SQL_DATA', 'NO',
'DEFINER', '', 'int(10)',
'begin declare x int; select count(*) into x from mysql.user; end',
- 'root@localhost', NOW() , '0000-00-00 00:00:00', '', ''
+ 'root@localhost', NOW() , '0000-00-00 00:00:00', '', '',
+ '', '', '',
+ 'begin declare x int; select count(*) into x from mysql.user; end'
),
(
'test', 'bug14233_3', 'PROCEDURE', 'bug14233_3', 'SQL', 'READS_SQL_DATA','NO',
'DEFINER', '', '',
'alksj wpsj sa ^#!@ ',
- 'root@localhost', NOW() , '0000-00-00 00:00:00', '', ''
+ 'root@localhost', NOW() , '0000-00-00 00:00:00', '', '',
+ '', '', '',
+ 'alksj wpsj sa ^#!@ '
);
--error ER_SP_PROC_TABLE_CORRUPT
diff --git a/mysql-test/t/sp-dynamic.test b/mysql-test/t/sp-dynamic.test
index 6546a5ab548..e6f4aae96ac 100644
--- a/mysql-test/t/sp-dynamic.test
+++ b/mysql-test/t/sp-dynamic.test
@@ -85,7 +85,7 @@ call p1()|
call p1()|
drop procedure p1|
#
-# D. Create/Drop a table (a DDL that issues a commit) in Dynamic SQL.
+# D. Create/Drop/Alter a table (a DDL that issues a commit) in Dynamic SQL.
# (should work ok).
#
create procedure p1()
@@ -96,6 +96,10 @@ begin
execute stmt;
insert into t1 (a) values (1);
select * from t1;
+ prepare stmt_alter from "alter table t1 add (b int)";
+ execute stmt_alter;
+ insert into t1 (a,b) values (2,1);
+ deallocate prepare stmt_alter;
deallocate prepare stmt;
deallocate prepare stmt_drop;
end|
@@ -239,6 +243,7 @@ drop procedure p1|
# K. Use of continue handlers with Dynamic SQL.
#
drop table if exists t1|
+drop table if exists t2|
create table t1 (id integer primary key auto_increment,
stmt_text char(35), status varchar(20))|
insert into t1 (stmt_text) values
@@ -249,7 +254,10 @@ insert into t1 (stmt_text) values
("help help"), ("show databases"), ("show tables"),
("show table status"), ("show open tables"), ("show storage engines"),
("insert into t1 (id) values (1)"), ("update t1 set status=''"),
- ("delete from t1"), ("truncate t1"), ("call p1()"), ("foo bar")|
+ ("delete from t1"), ("truncate t1"), ("call p1()"), ("foo bar"),
+ ("create view v1 as select 1"), ("alter view v1 as select 2"),
+ ("drop view v1"),("create table t2 (a int)"),("alter table t2 add (b int)"),
+ ("drop table t2")|
create procedure p1()
begin
declare v_stmt_text varchar(255);
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index 69b1f77aa35..ef9bed8b789 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -1087,12 +1087,12 @@ delimiter ;|
#
# BUG 12490 (Packets out of order if calling HELP CONTENTS from Stored Procedure)
#
---error 1314
+--error ER_SP_BADSTATEMENT
CREATE PROCEDURE BUG_12490() HELP CONTENTS;
---error 1314
+--error ER_SP_BADSTATEMENT
CREATE FUNCTION BUG_12490() RETURNS INT HELP CONTENTS;
CREATE TABLE t_bug_12490(a int);
---error 1314
+--error ER_SP_BADSTATEMENT
CREATE TRIGGER BUG_12490 BEFORE UPDATE ON t_bug_12490 FOR EACH ROW HELP CONTENTS;
DROP TABLE t_bug_12490;
@@ -1401,9 +1401,9 @@ CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create view v1 as sele
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
CREATE FUNCTION bug_13627_f() returns int BEGIN create view v1 as select 1; return 1; END |
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
+-- error ER_SP_BADSTATEMENT
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN alter view v1 as select 1; END |
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
+-- error ER_SP_BADSTATEMENT
CREATE FUNCTION bug_13627_f() returns int BEGIN alter view v1 as select 1; return 1; END |
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 29e759d7881..f5bad05a40a 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -6331,7 +6331,7 @@ set names utf8|
drop database if exists това_е_дълго_име_за_база_данни_нали|
--enable_warnings
create database това_е_дълго_име_за_база_данни_нали|
-INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','')|
+INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','', 'utf8', 'utf8_general_ci', 'utf8_general_ci', 'n/a')|
--error ER_SP_PROC_TABLE_CORRUPT
call това_е_дълго_име_за_база_данни_нали.това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго()|
drop database това_е_дълго_име_за_база_данни_нали|
diff --git a/mysql-test/t/strict_autoinc_5ndb.test b/mysql-test/t/strict_autoinc_5ndb.test
index 9e2090fddef..819d0068148 100644
--- a/mysql-test/t/strict_autoinc_5ndb.test
+++ b/mysql-test/t/strict_autoinc_5ndb.test
@@ -1,4 +1,5 @@
-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
#
# Bug#20573 Strict mode auto-increment
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index e88ded56914..4c046dfd3c6 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -2945,6 +2945,48 @@ SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.a ORDER BY t1.b LIMIT 1) AS d1 FROM t2;
DROP TABLE t1,t2;
+
+#
+# Bug #27333: subquery grouped for aggregate of outer query / no aggregate
+# of subquery
+#
+CREATE TABLE t1 (a INTEGER, b INTEGER);
+CREATE TABLE t2 (x INTEGER);
+INSERT INTO t1 VALUES (1,11), (2,22), (2,22);
+INSERT INTO t2 VALUES (1), (2);
+
+# wasn't failing, but should
+--error ER_SUBQUERY_NO_1_ROW
+SELECT a, COUNT(b), (SELECT COUNT(b) FROM t2) FROM t1 GROUP BY a;
+
+# fails as it should
+--error ER_SUBQUERY_NO_1_ROW
+SELECT a, COUNT(b), (SELECT COUNT(b)+0 FROM t2) FROM t1 GROUP BY a;
+
+SELECT (SELECT SUM(t1.a)/AVG(t2.x) FROM t2) FROM t1;
+DROP TABLE t1,t2;
+
+# second test case from 27333
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (1, 2), (1,3), (1,4), (2,1), (2,2);
+
+-- returns no rows, when it should
+SELECT a1.a, COUNT(*) FROM t1 a1 WHERE a1.a = 1
+AND EXISTS( SELECT a2.a FROM t1 a2 WHERE a2.a = a1.a)
+GROUP BY a1.a;
+DROP TABLE t1;
+
+#test cases from 29297
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+INSERT INTO t2 VALUES (1),(2);
+SELECT (SELECT SUM(t1.a) FROM t2 WHERE a=0) FROM t1;
+--error ER_SUBQUERY_NO_1_ROW
+SELECT (SELECT SUM(t1.a) FROM t2 WHERE a!=0) FROM t1;
+SELECT (SELECT SUM(t1.a) FROM t2 WHERE a=1) FROM t1;
+DROP TABLE t1,t2;
+
--echo End of 5.0 tests.
#
diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test
index 200fd063b99..1e5b53a2c6e 100644
--- a/mysql-test/t/type_enum.test
+++ b/mysql-test/t/type_enum.test
@@ -136,16 +136,6 @@ alter table t1 add f2 enum(0xFFFF);
show create table t1;
drop table t1;
---echo End of 4.1 tests
-
-#
-# Bug#28729: Field_enum wrongly reported an error while storing an empty string.
-#
-create table t1(f1 set('a','b'), index(f1));
-insert into t1 values(''),(''),('a'),('b');
-select * from t1 where f1='';
-drop table t1;
-
#
# Bug#24660 "enum" field type definition problem
#
@@ -166,4 +156,31 @@ drop table t1;
create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ','
 !"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\','yy\','zz'));
+#
+# Bug #29251: MySQL coerces special 0 enum values to normal '' value
+# when ALTERing the column
+#
+
+CREATE TABLE t1 (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ c1 ENUM('a', '', 'b')
+);
+INSERT INTO t1 (c1) VALUES (0), ('a'), (''), ('b');
+SELECT id, c1 + 0, c1 FROM t1;
+
+ALTER TABLE t1 CHANGE c1 c1 ENUM('a', '') NOT NULL;
+SELECT id, c1 + 0, c1 FROM t1;
+
+DROP TABLE t1;
+
+--echo End of 4.1 tests
+
+#
+# Bug#28729: Field_enum wrongly reported an error while storing an empty string.
+#
+create table t1(f1 set('a','b'), index(f1));
+insert into t1 values(''),(''),('a'),('b');
+select * from t1 where f1='';
+drop table t1;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/udf.test b/mysql-test/t/udf.test
index 7d870a86bc8..07a4a2d870b 100644
--- a/mysql-test/t/udf.test
+++ b/mysql-test/t/udf.test
@@ -340,4 +340,28 @@ drop function metaphon;
drop function myfunc_double;
drop function myfunc_int;
+#
+# Bug #28921: Queries containing UDF functions are cached
+#
+
+--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
+eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_LIB";
+create table t1 (a char);
+
+set GLOBAL query_cache_size=1355776;
+reset query cache;
+
+select metaphon('MySQL') from t1;
+show status like "Qcache_hits";
+show status like "Qcache_queries_in_cache";
+
+select metaphon('MySQL') from t1;
+show status like "Qcache_hits";
+show status like "Qcache_queries_in_cache";
+
+drop table t1;
+drop function metaphon;
+set GLOBAL query_cache_size=default;
+
+
--echo End of 5.0 tests.
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 03d7a52c640..ee807a1ae25 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -752,6 +752,11 @@ drop view v1;
#
# VIEWs with national characters
#
+
+SET @old_cs_client = @@character_set_client;
+SET @old_cs_results = @@character_set_results;
+SET @old_cs_connection = @@character_set_connection;
+
set names utf8;
create table tü (cü char);
create view vü as select cü from tü;
@@ -759,7 +764,10 @@ insert into vü values ('ü');
select * from vü;
drop view vü;
drop table tü;
-set names latin1;
+
+SET character_set_client = @old_cs_client;
+SET character_set_results = @old_cs_results;
+SET character_set_connection = @old_cs_connection;
#
# problem with used_tables() of outer reference resolved in VIEW
@@ -3316,6 +3324,30 @@ SELECT * FROM t1;
DROP VIEW v1,v2;
DROP TABLE t1,t2,t3,t4;
+#
+# Bug #29104: assertion abort for a query with a view column reference
+# in the GROUP BY list and a condition requiring the value
+# of another view column to be equal to a constant
+#
+
+CREATE TABLE t1 (a int, b int);
+INSERT INTO t1 VALUES (1,2), (2,2), (1,3), (1,2);
+
+CREATE VIEW v1 AS SELECT a, b+1 as b FROM t1;
+
+
+SELECT b, SUM(a) FROM v1 WHERE b=3 GROUP BY b;
+EXPLAIN SELECT b, SUM(a) FROM v1 WHERE b=3 GROUP BY b;
+
+SELECT a, SUM(b) FROM v1 WHERE b=3 GROUP BY a;
+EXPLAIN SELECT a, SUM(b) FROM v1 WHERE b=3 GROUP BY a;
+
+SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a;
+EXPLAIN SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a;
+
+DROP VIEW v1;
+DROP TABLE t1;
+
--echo End of 5.0 tests.
#