summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/Makefile.am65
-rw-r--r--mysql-test/extra/binlog_tests/binlog.test62
-rw-r--r--mysql-test/extra/binlog_tests/binlog_insert_delayed.test42
-rw-r--r--mysql-test/extra/binlog_tests/blackhole.test (renamed from mysql-test/t/blackhole.test)21
-rw-r--r--mysql-test/extra/binlog_tests/ctype_cp932.test (renamed from mysql-test/t/ctype_cp932.test)0
-rw-r--r--mysql-test/extra/binlog_tests/ctype_cp932_binlog.test (renamed from mysql-test/t/ctype_cp932_notembedded.test)6
-rw-r--r--mysql-test/extra/binlog_tests/ctype_ucs_binlog.test (renamed from mysql-test/t/ctype_ucs_binlog.test)3
-rw-r--r--mysql-test/extra/binlog_tests/drop_temp_table.test (renamed from mysql-test/t/drop_temp_table.test)1
-rw-r--r--mysql-test/extra/binlog_tests/innodb_stat.test49
-rw-r--r--mysql-test/extra/binlog_tests/insert_select-binlog.test (renamed from mysql-test/t/insert_select-binlog.test)6
-rw-r--r--mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test (renamed from mysql-test/t/mix_innodb_myisam_binlog.test)158
-rw-r--r--mysql-test/extra/rpl_tests/rpl_EE_err.test29
-rw-r--r--mysql-test/extra/rpl_tests/rpl_auto_increment.test150
-rw-r--r--mysql-test/extra/rpl_tests/rpl_commit_after_flush.test22
-rw-r--r--mysql-test/extra/rpl_tests/rpl_ddl.test507
-rw-r--r--mysql-test/extra/rpl_tests/rpl_deadlock.test (renamed from mysql-test/t/rpl_deadlock.test)21
-rw-r--r--mysql-test/extra/rpl_tests/rpl_delete_no_where.test19
-rw-r--r--mysql-test/extra/rpl_tests/rpl_failed_optimize.test24
-rw-r--r--mysql-test/extra/rpl_tests/rpl_flsh_tbls.test (renamed from mysql-test/t/rpl_flush_tables.test)17
-rw-r--r--mysql-test/extra/rpl_tests/rpl_foreign_key.test34
-rw-r--r--mysql-test/extra/rpl_tests/rpl_insert_id.test488
-rw-r--r--mysql-test/extra/rpl_tests/rpl_insert_id_pk.test88
-rw-r--r--mysql-test/extra/rpl_tests/rpl_insert_ignore.test71
-rw-r--r--mysql-test/extra/rpl_tests/rpl_loaddata.test159
-rw-r--r--mysql-test/extra/rpl_tests/rpl_log.test (renamed from mysql-test/t/rpl_log.test)52
-rw-r--r--mysql-test/extra/rpl_tests/rpl_max_relay_size.test (renamed from mysql-test/t/rpl_max_relay_size.test)17
-rw-r--r--mysql-test/extra/rpl_tests/rpl_multi_query.test (renamed from mysql-test/t/rpl_multi_query.test)10
-rw-r--r--mysql-test/extra/rpl_tests/rpl_multi_update.test30
-rw-r--r--mysql-test/extra/rpl_tests/rpl_multi_update2.test62
-rw-r--r--mysql-test/extra/rpl_tests/rpl_multi_update3.test222
-rw-r--r--mysql-test/extra/rpl_tests/rpl_ndb_2multi_eng.test346
-rw-r--r--mysql-test/extra/rpl_tests/rpl_partition.test262
-rw-r--r--mysql-test/extra/rpl_tests/rpl_relayrotate.test75
-rw-r--r--mysql-test/extra/rpl_tests/rpl_reset_slave.test (renamed from mysql-test/t/rpl_reset_slave.test)16
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_001.test84
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_UUID.test83
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_basic.test233
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_blob.test191
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_charset.test183
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test23
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_func003.test96
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_sp002.test239
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_sp003.test75
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_sp006.test91
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_sp007.test70
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_tabledefs.test240
-rw-r--r--mysql-test/extra/rpl_tests/rpl_stm_000001.test (renamed from mysql-test/t/rpl000001.test)5
-rw-r--r--mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test30
-rw-r--r--mysql-test/extra/rpl_tests/rpl_stm_charset.test (renamed from mysql-test/t/rpl_charset.test)10
-rw-r--r--mysql-test/extra/rpl_tests/rpl_sv_relay_space.test35
-rw-r--r--mysql-test/extra/rpl_tests/rpl_trig004.test53
-rw-r--r--mysql-test/extra/rpl_tests/rpl_truncate.test36
-rw-r--r--mysql-test/extra/rpl_tests/rpl_truncate_helper.test42
-rw-r--r--mysql-test/include/check-testcase.test4
-rw-r--r--mysql-test/include/concurrent.inc357
-rw-r--r--mysql-test/include/deadlock.inc147
-rw-r--r--mysql-test/include/gis_generic.inc35
-rw-r--r--mysql-test/include/handler.inc (renamed from mysql-test/t/handler.test)52
-rw-r--r--mysql-test/include/have_archive.inc4
-rw-r--r--mysql-test/include/have_bdb.inc4
-rw-r--r--mysql-test/include/have_binlog_format_mixed.inc4
-rw-r--r--mysql-test/include/have_binlog_format_mixed_or_row.inc5
-rw-r--r--mysql-test/include/have_binlog_format_mixed_or_statement.inc5
-rw-r--r--mysql-test/include/have_binlog_format_row.inc4
-rw-r--r--mysql-test/include/have_binlog_format_statement.inc4
-rw-r--r--mysql-test/include/have_blackhole.inc4
-rw-r--r--mysql-test/include/have_csv.inc4
-rw-r--r--mysql-test/include/have_exampledb.inc4
-rw-r--r--mysql-test/include/have_federated_db.inc4
-rw-r--r--mysql-test/include/have_innodb.inc4
-rw-r--r--mysql-test/include/have_multi_ndb.inc8
-rw-r--r--mysql-test/include/have_ndb.inc10
-rw-r--r--mysql-test/include/have_ndb_extra.inc2
-rw-r--r--mysql-test/include/have_ndbapi_examples.inc4
-rw-r--r--mysql-test/include/have_partition.inc4
-rw-r--r--mysql-test/include/have_row_based.inc4
-rw-r--r--mysql-test/include/index_merge1.inc (renamed from mysql-test/t/index_merge.test)132
-rw-r--r--mysql-test/include/index_merge2.inc345
-rw-r--r--mysql-test/include/index_merge_2sweeps.inc (renamed from mysql-test/t/index_merge_innodb2.test)35
-rw-r--r--mysql-test/include/index_merge_ror.inc (renamed from mysql-test/t/index_merge_ror.test)64
-rw-r--r--mysql-test/include/index_merge_ror_cpk.inc (renamed from mysql-test/t/index_merge_ror_cpk.test)79
-rw-r--r--mysql-test/include/loaddata_autocom.inc8
-rw-r--r--mysql-test/include/master-slave-end.inc6
-rw-r--r--mysql-test/include/master-slave-reset.inc22
-rw-r--r--mysql-test/include/master-slave.inc24
-rw-r--r--mysql-test/include/mix1.inc520
-rw-r--r--mysql-test/include/mix2.inc2699
-rw-r--r--mysql-test/include/ndb_backup.inc24
-rw-r--r--mysql-test/include/ndb_restore_master.inc8
-rw-r--r--mysql-test/include/ndb_restore_slave_eoption.inc11
-rw-r--r--mysql-test/include/ndb_setup_slave.inc27
-rw-r--r--mysql-test/include/not_ndb.inc7
-rw-r--r--mysql-test/include/not_ndb_default.inc4
-rw-r--r--mysql-test/include/not_row_based.inc4
-rw-r--r--mysql-test/include/not_valgrind.inc4
-rw-r--r--mysql-test/include/not_windows.inc2
-rwxr-xr-xmysql-test/include/parser_bug21114.inc59
-rw-r--r--mysql-test/include/partition_1.inc750
-rw-r--r--mysql-test/include/partition_10.inc73
-rw-r--r--mysql-test/include/partition_11.inc34
-rw-r--r--mysql-test/include/partition_12.inc65
-rw-r--r--mysql-test/include/partition_layout.inc13
-rw-r--r--mysql-test/include/query_cache.inc (renamed from mysql-test/t/innodb_cache.test)38
-rw-r--r--mysql-test/include/read_many_rows.inc61
-rw-r--r--mysql-test/include/rowid_order.inc (renamed from mysql-test/t/rowid_order_bdb.test)43
-rw-r--r--mysql-test/include/rpl_multi_engine.inc16
-rw-r--r--mysql-test/include/rpl_multi_engine3.inc61
-rw-r--r--mysql-test/include/rpl_stmt_seq2.inc201
-rw-r--r--mysql-test/include/safe_set_to_maybe_ro_var.inc23
-rw-r--r--mysql-test/include/show_binlog_events.inc5
-rw-r--r--mysql-test/include/system_db_struct.inc3
-rw-r--r--mysql-test/include/unsafe_binlog.inc265
-rw-r--r--mysql-test/include/wait_until_connected_again.inc20
-rw-r--r--mysql-test/include/wait_until_rows_count.inc52
-rw-r--r--mysql-test/include/windows.inc2
-rw-r--r--mysql-test/init_db.sql58
-rw-r--r--mysql-test/install_test_db.sh7
-rw-r--r--mysql-test/lib/init_db.sql91
-rw-r--r--mysql-test/my_create_tables.c673
-rw-r--r--mysql-test/my_manage.c887
-rw-r--r--mysql-test/my_manage.h137
-rw-r--r--mysql-test/mysql-test-run-shell.sh431
-rwxr-xr-xmysql-test/mysql-test-run.pl26
-rw-r--r--mysql-test/mysql_test_run_new.c1933
-rw-r--r--mysql-test/ndb/Makefile.am7
-rw-r--r--mysql-test/ndb/ndb_config_1_node.ini44
-rw-r--r--mysql-test/ndb/ndb_config_2_node.ini22
-rw-r--r--mysql-test/ndb/ndb_config_4_node.ini53
-rw-r--r--mysql-test/ndb/ndbcluster.sh110
-rw-r--r--mysql-test/r/alter_table.result182
-rw-r--r--mysql-test/r/analyse.result60
-rw-r--r--mysql-test/r/ansi.result14
-rw-r--r--mysql-test/r/archive.result1548
-rw-r--r--mysql-test/r/archive_bitfield.result191
-rw-r--r--mysql-test/r/archive_gis.result88
-rw-r--r--mysql-test/r/auto_increment.result42
-rw-r--r--mysql-test/r/backup.result41
-rw-r--r--mysql-test/r/bdb-alter-table-1.result11
-rw-r--r--mysql-test/r/bdb-alter-table-2.result6
-rw-r--r--mysql-test/r/bdb-crash.result39
-rw-r--r--mysql-test/r/bdb-deadlock.result31
-rw-r--r--mysql-test/r/bdb.result1965
-rw-r--r--mysql-test/r/bdb_cache.result99
-rw-r--r--mysql-test/r/bdb_gis.result458
-rw-r--r--mysql-test/r/bench_count_distinct.result4
-rw-r--r--mysql-test/r/bigint.result18
-rw-r--r--mysql-test/r/binary.result2
-rw-r--r--mysql-test/r/binlog_row_binlog.result282
-rw-r--r--mysql-test/r/binlog_row_blackhole.result143
-rw-r--r--[-rwxr-xr-x]mysql-test/r/binlog_row_ctype_cp932.result (renamed from mysql-test/r/ctype_cp932.result)0
-rw-r--r--mysql-test/r/binlog_row_ctype_ucs.result16
-rw-r--r--mysql-test/r/binlog_row_drop_tmp_tbl.result18
-rw-r--r--mysql-test/r/binlog_row_innodb_stat.result39
-rw-r--r--mysql-test/r/binlog_row_insert_select.result27
-rw-r--r--mysql-test/r/binlog_row_mix_innodb_myisam.result414
-rw-r--r--mysql-test/r/binlog_statement_insert_delayed.result29
-rw-r--r--mysql-test/r/binlog_stm_binlog.result (renamed from mysql-test/r/binlog.result)73
-rw-r--r--mysql-test/r/binlog_stm_blackhole.result (renamed from mysql-test/r/blackhole.result)22
-rwxr-xr-xmysql-test/r/binlog_stm_ctype_cp932.result11355
-rw-r--r--mysql-test/r/binlog_stm_ctype_ucs.result (renamed from mysql-test/r/ctype_ucs_binlog.result)6
-rw-r--r--mysql-test/r/binlog_stm_drop_tmp_tbl.result (renamed from mysql-test/r/drop_temp_table.result)0
-rw-r--r--mysql-test/r/binlog_stm_innodb_stat.result39
-rw-r--r--mysql-test/r/binlog_stm_insert_select.result (renamed from mysql-test/r/insert_select-binlog.result)11
-rw-r--r--mysql-test/r/binlog_stm_mix_innodb_myisam.result381
-rw-r--r--mysql-test/r/cache_innodb.result (renamed from mysql-test/r/innodb_cache.result)21
-rw-r--r--mysql-test/r/case.result52
-rw-r--r--mysql-test/r/cast.result34
-rw-r--r--mysql-test/r/compress.result8
-rw-r--r--mysql-test/r/concurrent_innodb.result607
-rw-r--r--mysql-test/r/connect.result12
-rw-r--r--mysql-test/r/constraints.result2
-rw-r--r--mysql-test/r/contributors.result5
-rw-r--r--mysql-test/r/crash_commit_before.result13
-rw-r--r--mysql-test/r/create.result157
-rw-r--r--mysql-test/r/create_not_windows.result23
-rw-r--r--mysql-test/r/create_select_tmp.result8
-rw-r--r--mysql-test/r/csv.result220
-rw-r--r--mysql-test/r/ctype_collate.result8
-rw-r--r--mysql-test/r/ctype_cp1250_ch.result1
-rw-r--r--mysql-test/r/ctype_cp932_binlog_row.result (renamed from mysql-test/r/ctype_cp932_notembedded.result)8
-rw-r--r--mysql-test/r/ctype_cp932_binlog_stm.result (renamed from mysql-test/r/ctype_cp932_binlog.result)20
-rw-r--r--mysql-test/r/ctype_create.result12
-rw-r--r--mysql-test/r/ctype_filename.result13
-rw-r--r--mysql-test/r/ctype_latin1.result14
-rw-r--r--mysql-test/r/ctype_latin1_de.result6
-rw-r--r--mysql-test/r/ctype_many.result18
-rw-r--r--mysql-test/r/ctype_mb.result16
-rw-r--r--mysql-test/r/ctype_recoding.result24
-rw-r--r--mysql-test/r/ctype_sjis.result2
-rw-r--r--mysql-test/r/ctype_tis620.result4
-rw-r--r--mysql-test/r/ctype_ucs.result16
-rw-r--r--mysql-test/r/ctype_ujis.result8
-rw-r--r--mysql-test/r/ctype_utf8.result124
-rw-r--r--mysql-test/r/date_formats.result13
-rw-r--r--mysql-test/r/deadlock_innodb.result (renamed from mysql-test/r/innodb-deadlock.result)28
-rw-r--r--mysql-test/r/default.result24
-rw-r--r--mysql-test/r/delayed.result2
-rw-r--r--mysql-test/r/distinct.result4
-rw-r--r--mysql-test/r/drop.result2
-rw-r--r--mysql-test/r/events.result397
-rw-r--r--mysql-test/r/events_bugs.result271
-rw-r--r--mysql-test/r/events_grant.result121
-rw-r--r--mysql-test/r/events_logs_tests.result96
-rw-r--r--mysql-test/r/events_microsec.result13
-rw-r--r--mysql-test/r/events_restart_phase0.result22
-rw-r--r--mysql-test/r/events_restart_phase1.result12
-rw-r--r--mysql-test/r/events_restart_phase2.result6
-rw-r--r--mysql-test/r/events_restart_phase3.result12
-rw-r--r--mysql-test/r/events_scheduling.result85
-rw-r--r--mysql-test/r/events_stress.result65
-rw-r--r--mysql-test/r/exampledb.result2
-rw-r--r--mysql-test/r/explain.result4
-rw-r--r--mysql-test/r/federated.result140
-rw-r--r--mysql-test/r/federated_transactions.result49
-rw-r--r--mysql-test/r/flush_block_commit.result4
-rw-r--r--mysql-test/r/flush_table.result31
-rw-r--r--mysql-test/r/fulltext.result35
-rw-r--r--mysql-test/r/fulltext2.result8
-rw-r--r--mysql-test/r/func_compress.result8
-rw-r--r--mysql-test/r/func_crypt.result4
-rw-r--r--mysql-test/r/func_default.result4
-rw-r--r--mysql-test/r/func_encrypt.result4
-rw-r--r--mysql-test/r/func_gconcat.result20
-rw-r--r--mysql-test/r/func_group.result27
-rw-r--r--mysql-test/r/func_group_innodb.result147
-rw-r--r--mysql-test/r/func_if.result8
-rw-r--r--mysql-test/r/func_in.result72
-rw-r--r--mysql-test/r/func_like.result16
-rw-r--r--mysql-test/r/func_math.result66
-rw-r--r--mysql-test/r/func_misc.result4
-rw-r--r--mysql-test/r/func_op.result8
-rw-r--r--mysql-test/r/func_regexp.result4
-rw-r--r--mysql-test/r/func_sapdb.result6
-rw-r--r--mysql-test/r/func_set.result4
-rw-r--r--mysql-test/r/func_str.result104
-rw-r--r--mysql-test/r/func_system.result16
-rw-r--r--mysql-test/r/func_test.result24
-rw-r--r--mysql-test/r/func_time.result117
-rw-r--r--mysql-test/r/gis-rtree.result8
-rw-r--r--mysql-test/r/gis.result50
-rw-r--r--mysql-test/r/grant.result32
-rw-r--r--mysql-test/r/grant2.result15
-rw-r--r--mysql-test/r/grant_cache.result16
-rw-r--r--mysql-test/r/greedy_optimizer.result16
-rw-r--r--mysql-test/r/group_by.result17
-rw-r--r--mysql-test/r/group_min_max.result80
-rw-r--r--mysql-test/r/group_min_max_innodb.result72
-rw-r--r--mysql-test/r/handler_innodb.result517
-rw-r--r--mysql-test/r/handler_myisam.result (renamed from mysql-test/r/handler.result)35
-rw-r--r--mysql-test/r/have_binlog_format_mixed.require (renamed from mysql-test/r/have_innodb.require)2
-rw-r--r--mysql-test/r/have_binlog_format_row.require (renamed from mysql-test/r/have_archive.require)2
-rw-r--r--mysql-test/r/have_binlog_format_statement.require2
-rw-r--r--mysql-test/r/have_blackhole.require2
-rw-r--r--mysql-test/r/have_csv.require2
-rw-r--r--mysql-test/r/have_exampledb.require2
-rw-r--r--mysql-test/r/have_federated_db.require2
-rw-r--r--mysql-test/r/have_ndb.require2
-rw-r--r--mysql-test/r/have_ndb_extra.require3
-rw-r--r--mysql-test/r/have_ndb_status_ok.require2
-rw-r--r--mysql-test/r/have_ndbapi_examples.require2
-rw-r--r--mysql-test/r/have_partition.require2
-rw-r--r--mysql-test/r/have_raid.require2
-rw-r--r--mysql-test/r/have_row_based.require2
-rw-r--r--mysql-test/r/having.result4
-rw-r--r--mysql-test/r/heap.result92
-rw-r--r--mysql-test/r/heap_btree.result2
-rw-r--r--mysql-test/r/heap_hash.result4
-rw-r--r--mysql-test/r/im_cmd_line.result47
-rw-r--r--mysql-test/r/im_daemon_life_cycle.result6
-rw-r--r--mysql-test/r/im_instance_conf.result225
-rw-r--r--mysql-test/r/im_life_cycle.result8
-rw-r--r--mysql-test/r/im_options.result153
-rw-r--r--mysql-test/r/im_options_set.result22
-rw-r--r--mysql-test/r/im_options_unset.result17
-rw-r--r--mysql-test/r/im_utils.result10
-rw-r--r--mysql-test/r/index_merge.result457
-rw-r--r--mysql-test/r/index_merge_bdb.result136
-rw-r--r--mysql-test/r/index_merge_innodb.result375
-rw-r--r--mysql-test/r/index_merge_innodb2.result136
-rw-r--r--mysql-test/r/index_merge_myisam.result1281
-rw-r--r--mysql-test/r/index_merge_ror.result196
-rw-r--r--mysql-test/r/index_merge_ror_cpk.result120
-rw-r--r--mysql-test/r/information_schema.result127
-rw-r--r--mysql-test/r/information_schema_db.result11
-rw-r--r--mysql-test/r/information_schema_inno.result31
-rw-r--r--mysql-test/r/information_schema_part.result142
-rw-r--r--mysql-test/r/innodb.result380
-rw-r--r--mysql-test/r/innodb_gis.result88
-rw-r--r--mysql-test/r/innodb_handler.result167
-rw-r--r--mysql-test/r/innodb_mysql.result273
-rw-r--r--mysql-test/r/innodb_unsafe_binlog.result48
-rw-r--r--mysql-test/r/insert.result135
-rw-r--r--mysql-test/r/insert_select.result8
-rw-r--r--mysql-test/r/insert_update.result12
-rw-r--r--mysql-test/r/join.result44
-rw-r--r--mysql-test/r/join_nested.result186
-rw-r--r--mysql-test/r/join_outer.result2
-rw-r--r--mysql-test/r/join_outer_innodb.result19
-rw-r--r--mysql-test/r/key.result98
-rw-r--r--mysql-test/r/key_diff.result2
-rw-r--r--mysql-test/r/keywords.result16
-rw-r--r--mysql-test/r/kill.result2
-rw-r--r--mysql-test/r/loaddata.result36
-rw-r--r--mysql-test/r/loaddata_autocom_innodb.result6
-rw-r--r--mysql-test/r/loaddata_autocom_ndb.result6
-rw-r--r--mysql-test/r/lock.result7
-rw-r--r--mysql-test/r/lock_multi.result23
-rw-r--r--mysql-test/r/log_state.result155
-rw-r--r--mysql-test/r/log_tables.result288
-rw-r--r--mysql-test/r/lowercase_table2.result4
-rw-r--r--mysql-test/r/lowercase_table_grant.result8
-rw-r--r--mysql-test/r/merge.result23
-rw-r--r--mysql-test/r/mix2_myisam.result2475
-rw-r--r--mysql-test/r/mix_innodb_myisam_binlog.result282
-rw-r--r--mysql-test/r/multi_update.result82
-rw-r--r--mysql-test/r/myisam-system.result13
-rw-r--r--mysql-test/r/myisam.result249
-rw-r--r--mysql-test/r/mysqlbinlog_base64.result89
-rw-r--r--mysql-test/r/mysqlcheck.result17
-rw-r--r--mysql-test/r/mysqldump-max.result48
-rw-r--r--mysql-test/r/mysqldump.result1153
-rw-r--r--mysql-test/r/mysqlshow.result22
-rw-r--r--mysql-test/r/mysqlslap.result143
-rw-r--r--mysql-test/r/ndb_alter_table.result84
-rw-r--r--mysql-test/r/ndb_alter_table2.result1
-rw-r--r--mysql-test/r/ndb_alter_table3.result35
-rw-r--r--mysql-test/r/ndb_autodiscover.result6
-rw-r--r--mysql-test/r/ndb_autodiscover2.result4
-rw-r--r--mysql-test/r/ndb_autodiscover3.result20
-rw-r--r--mysql-test/r/ndb_basic.result62
-rw-r--r--mysql-test/r/ndb_binlog_basic.result51
-rw-r--r--mysql-test/r/ndb_binlog_basic2.result12
-rw-r--r--mysql-test/r/ndb_binlog_ddl_multi.result194
-rw-r--r--mysql-test/r/ndb_binlog_discover.result12
-rw-r--r--mysql-test/r/ndb_binlog_ignore_db.result10
-rw-r--r--mysql-test/r/ndb_binlog_multi.result80
-rw-r--r--mysql-test/r/ndb_bitfield.result16
-rw-r--r--mysql-test/r/ndb_blob.result14
-rw-r--r--mysql-test/r/ndb_blob_partition.result104
-rw-r--r--mysql-test/r/ndb_cache_multi.result2
-rw-r--r--mysql-test/r/ndb_charset.result22
-rw-r--r--mysql-test/r/ndb_condition_pushdown.result76
-rw-r--r--mysql-test/r/ndb_config.result10
-rw-r--r--mysql-test/r/ndb_config2.result1
-rw-r--r--mysql-test/r/ndb_database.result14
-rw-r--r--mysql-test/r/ndb_dd_alter.result441
-rw-r--r--mysql-test/r/ndb_dd_backuprestore.result487
-rw-r--r--mysql-test/r/ndb_dd_basic.result475
-rw-r--r--mysql-test/r/ndb_dd_ddl.result235
-rw-r--r--mysql-test/r/ndb_dd_disk2memory.result505
-rw-r--r--mysql-test/r/ndb_dd_dump.result218
-rw-r--r--mysql-test/r/ndb_dd_sql_features.result599
-rw-r--r--mysql-test/r/ndb_gis.result176
-rw-r--r--mysql-test/r/ndb_index_ordered.result138
-rw-r--r--mysql-test/r/ndb_index_unique.result35
-rw-r--r--mysql-test/r/ndb_insert.result14
-rw-r--r--mysql-test/r/ndb_lock.result11
-rw-r--r--mysql-test/r/ndb_multi.result14
-rw-r--r--mysql-test/r/ndb_multi_row.result67
-rw-r--r--mysql-test/r/ndb_partition_error.result47
-rw-r--r--mysql-test/r/ndb_partition_key.result205
-rw-r--r--mysql-test/r/ndb_partition_list.result51
-rw-r--r--mysql-test/r/ndb_partition_range.result263
-rw-r--r--mysql-test/r/ndb_read_multi_range.result67
-rw-r--r--mysql-test/r/ndb_rename.result10
-rw-r--r--mysql-test/r/ndb_replace.result2
-rw-r--r--mysql-test/r/ndb_restore.result332
-rw-r--r--mysql-test/r/ndb_restore_compat.result104
-rw-r--r--mysql-test/r/ndb_restore_partition.result469
-rw-r--r--mysql-test/r/ndb_subquery.result16
-rw-r--r--mysql-test/r/ndb_temporary.result21
-rw-r--r--mysql-test/r/ndb_update.result2
-rw-r--r--mysql-test/r/ndb_view.result24
-rw-r--r--mysql-test/r/ndbapi.result22
-rw-r--r--mysql-test/r/negation_elimination.result4
-rw-r--r--mysql-test/r/not_embedded_server.result6
-rw-r--r--mysql-test/r/not_ndb.require (renamed from mysql-test/r/have_bdb.require)2
-rw-r--r--mysql-test/r/not_ndb_default.require2
-rw-r--r--mysql-test/r/not_partition.require2
-rw-r--r--mysql-test/r/not_partition.result48
-rw-r--r--mysql-test/r/not_row_based.require2
-rw-r--r--mysql-test/r/not_valgrind.require2
-rw-r--r--mysql-test/r/not_windows.require2
-rw-r--r--mysql-test/r/null.result124
-rw-r--r--mysql-test/r/null_key.result2
-rw-r--r--mysql-test/r/olap.result4
-rw-r--r--mysql-test/r/order_by.result8
-rw-r--r--mysql-test/r/parser.result388
-rw-r--r--mysql-test/r/parser_bug21114_innodb.result867
-rw-r--r--mysql-test/r/partition.result1131
-rw-r--r--mysql-test/r/partition_02myisam.result1725
-rw-r--r--mysql-test/r/partition_03ndb.result1361
-rw-r--r--mysql-test/r/partition_charset.result18
-rw-r--r--mysql-test/r/partition_error.result622
-rw-r--r--mysql-test/r/partition_grant.result25
-rw-r--r--mysql-test/r/partition_hash.result199
-rw-r--r--mysql-test/r/partition_innodb.result76
-rw-r--r--mysql-test/r/partition_list.result297
-rw-r--r--mysql-test/r/partition_mgm.result48
-rw-r--r--mysql-test/r/partition_mgm_err.result150
-rw-r--r--mysql-test/r/partition_mgm_err2.result2
-rw-r--r--mysql-test/r/partition_order.result785
-rw-r--r--mysql-test/r/partition_pruning.result897
-rw-r--r--mysql-test/r/partition_range.result787
-rw-r--r--mysql-test/r/ps.result909
-rw-r--r--mysql-test/r/ps_1general.result26
-rw-r--r--mysql-test/r/ps_2myisam.result476
-rw-r--r--mysql-test/r/ps_3innodb.result476
-rw-r--r--mysql-test/r/ps_4heap.result476
-rw-r--r--mysql-test/r/ps_5merge.result952
-rw-r--r--mysql-test/r/ps_6bdb.result3120
-rw-r--r--mysql-test/r/ps_7ndb.result162
-rw-r--r--mysql-test/r/ps_grant.result3
-rw-r--r--mysql-test/r/query_cache.result9
-rw-r--r--mysql-test/r/range.result16
-rw-r--r--mysql-test/r/read_many_rows_innodb.result (renamed from mysql-test/r/innodb-big.result)19
-rw-r--r--mysql-test/r/renamedb.result33
-rw-r--r--mysql-test/r/repair.result6
-rw-r--r--mysql-test/r/replace.result4
-rw-r--r--mysql-test/r/round.result32
-rw-r--r--mysql-test/r/row.result32
-rw-r--r--mysql-test/r/rowid_order_bdb.result186
-rw-r--r--mysql-test/r/rowid_order_innodb.result19
-rw-r--r--mysql-test/r/rpl000004.a.result2
-rw-r--r--mysql-test/r/rpl000004.b.result2
-rw-r--r--mysql-test/r/rpl000004.result28
-rw-r--r--mysql-test/r/rpl000006.result29
-rw-r--r--mysql-test/r/rpl000017.result6
-rw-r--r--mysql-test/r/rpl_000015.result (renamed from mysql-test/r/rpl000015.result)13
-rw-r--r--mysql-test/r/rpl_EE_err.result11
-rw-r--r--mysql-test/r/rpl_LD_INFILE.result117
-rw-r--r--mysql-test/r/rpl_alter_db.result8
-rw-r--r--mysql-test/r/rpl_auto_increment.result8
-rw-r--r--mysql-test/r/rpl_bit.result138
-rw-r--r--mysql-test/r/rpl_bit_npk.result169
-rw-r--r--mysql-test/r/rpl_change_master.result4
-rw-r--r--mysql-test/r/rpl_commit_after_flush.result2
-rw-r--r--mysql-test/r/rpl_create_database.result37
-rw-r--r--mysql-test/r/rpl_ddl.result44
-rw-r--r--mysql-test/r/rpl_deadlock_innodb.result (renamed from mysql-test/r/rpl_deadlock.result)30
-rw-r--r--mysql-test/r/rpl_delete_no_where.result15
-rw-r--r--mysql-test/r/rpl_do_grant.result52
-rw-r--r--mysql-test/r/rpl_drop_db.result4
-rw-r--r--mysql-test/r/rpl_drop_temp.result4
-rw-r--r--mysql-test/r/rpl_err_ignoredtable.result42
-rw-r--r--mysql-test/r/rpl_failed_optimize.result4
-rw-r--r--mysql-test/r/rpl_flush_log_loop.result17
-rw-r--r--mysql-test/r/rpl_flush_tables.result47
-rw-r--r--mysql-test/r/rpl_flushlog_loop.result53
-rw-r--r--mysql-test/r/rpl_foreign_key_innodb.result42
-rw-r--r--mysql-test/r/rpl_get_lock.result4
-rw-r--r--mysql-test/r/rpl_ignore_table_update.result (renamed from mysql-test/r/rpl000008.result)0
-rw-r--r--mysql-test/r/rpl_insert.result23
-rw-r--r--mysql-test/r/rpl_insert_id.result126
-rw-r--r--mysql-test/r/rpl_insert_id_pk.result76
-rw-r--r--mysql-test/r/rpl_load_from_master.result (renamed from mysql-test/r/rpl000009.result)27
-rw-r--r--mysql-test/r/rpl_load_table_from_master.result51
-rw-r--r--mysql-test/r/rpl_loaddata.result18
-rw-r--r--mysql-test/r/rpl_loaddata2.result153
-rw-r--r--mysql-test/r/rpl_loaddata_m.result39
-rw-r--r--mysql-test/r/rpl_loaddata_rule_m.result21
-rw-r--r--mysql-test/r/rpl_loaddata_s.result (renamed from mysql-test/r/rpl_loaddata_rule_s.result)8
-rw-r--r--mysql-test/r/rpl_loaddatalocal.result4
-rw-r--r--mysql-test/r/rpl_loadfile.result227
-rw-r--r--mysql-test/r/rpl_log.result120
-rw-r--r--mysql-test/r/rpl_log_pos.result22
-rw-r--r--mysql-test/r/rpl_master_pos_wait.result4
-rw-r--r--mysql-test/r/rpl_mixed_ddl_dml.result (renamed from mysql-test/r/rpl000002.result)10
-rw-r--r--mysql-test/r/rpl_multi_delete.result11
-rw-r--r--mysql-test/r/rpl_multi_delete2.result2
-rw-r--r--mysql-test/r/rpl_multi_engine.result366
-rw-r--r--mysql-test/r/rpl_multi_update.result12
-rw-r--r--mysql-test/r/rpl_multi_update3.result4
-rw-r--r--mysql-test/r/rpl_mystery22.result23
-rw-r--r--mysql-test/r/rpl_ndb_2innodb.result855
-rw-r--r--mysql-test/r/rpl_ndb_2myisam.result855
-rw-r--r--mysql-test/r/rpl_ndb_UUID.result40
-rw-r--r--mysql-test/r/rpl_ndb_auto_inc.result170
-rw-r--r--mysql-test/r/rpl_ndb_bank.result120
-rw-r--r--mysql-test/r/rpl_ndb_basic.result164
-rw-r--r--mysql-test/r/rpl_ndb_blob.result135
-rw-r--r--mysql-test/r/rpl_ndb_blob2.result156
-rw-r--r--mysql-test/r/rpl_ndb_charset.result201
-rw-r--r--mysql-test/r/rpl_ndb_commit_afterflush.result13
-rw-r--r--mysql-test/r/rpl_ndb_dd_advance.result417
-rw-r--r--mysql-test/r/rpl_ndb_dd_basic.result72
-rw-r--r--mysql-test/r/rpl_ndb_dd_partitions.result726
-rw-r--r--mysql-test/r/rpl_ndb_ddl.result1693
-rw-r--r--mysql-test/r/rpl_ndb_delete_nowhere.result15
-rw-r--r--mysql-test/r/rpl_ndb_func003.result29
-rw-r--r--mysql-test/r/rpl_ndb_idempotent.result73
-rw-r--r--mysql-test/r/rpl_ndb_insert_ignore.result70
-rw-r--r--mysql-test/r/rpl_ndb_load.result42
-rw-r--r--mysql-test/r/rpl_ndb_log.result150
-rw-r--r--mysql-test/r/rpl_ndb_multi.result55
-rw-r--r--mysql-test/r/rpl_ndb_multi_update2.result55
-rw-r--r--mysql-test/r/rpl_ndb_multi_update3.result197
-rw-r--r--mysql-test/r/rpl_ndb_relayrotate.result16
-rw-r--r--mysql-test/r/rpl_ndb_row_001.result55
-rw-r--r--mysql-test/r/rpl_ndb_sp003.result49
-rw-r--r--mysql-test/r/rpl_ndb_sp006.result46
-rw-r--r--mysql-test/r/rpl_ndb_sync.result96
-rw-r--r--mysql-test/r/rpl_ndb_trig004.result30
-rw-r--r--mysql-test/r/rpl_ndbapi_multi.result8
-rw-r--r--mysql-test/r/rpl_openssl.result4
-rw-r--r--mysql-test/r/rpl_ps.result6
-rw-r--r--mysql-test/r/rpl_rbr_to_sbr.result66
-rw-r--r--mysql-test/r/rpl_redirect.result9
-rw-r--r--mysql-test/r/rpl_relay_space_innodb.result (renamed from mysql-test/r/rpl000005.result)14
-rw-r--r--mysql-test/r/rpl_relay_space_myisam.result25
-rw-r--r--mysql-test/r/rpl_replicate_do.result4
-rw-r--r--mysql-test/r/rpl_replicate_ignore_db.result23
-rw-r--r--mysql-test/r/rpl_rewrt_db.result (renamed from mysql-test/r/rpl_rewrite_db.result)0
-rw-r--r--mysql-test/r/rpl_rotate_logs.result30
-rw-r--r--mysql-test/r/rpl_row_001.result55
-rw-r--r--mysql-test/r/rpl_row_4_bytes.result27
-rw-r--r--mysql-test/r/rpl_row_NOW.result28
-rw-r--r--mysql-test/r/rpl_row_USER.result36
-rw-r--r--mysql-test/r/rpl_row_UUID.result40
-rw-r--r--mysql-test/r/rpl_row_basic_11bugs.result122
-rw-r--r--mysql-test/r/rpl_row_basic_2myisam.result418
-rw-r--r--mysql-test/r/rpl_row_basic_3innodb.result418
-rw-r--r--mysql-test/r/rpl_row_basic_7ndb.result418
-rw-r--r--mysql-test/r/rpl_row_basic_8partition.result655
-rw-r--r--mysql-test/r/rpl_row_blob_innodb.result156
-rw-r--r--mysql-test/r/rpl_row_blob_myisam.result156
-rw-r--r--mysql-test/r/rpl_row_charset.result201
-rw-r--r--mysql-test/r/rpl_row_create_table.result214
-rw-r--r--mysql-test/r/rpl_row_delayed_ins.result29
-rw-r--r--mysql-test/r/rpl_row_drop.result56
-rw-r--r--mysql-test/r/rpl_row_err_ignoredtable.result (renamed from mysql-test/r/rpl_error_ignored_table.result)29
-rw-r--r--mysql-test/r/rpl_row_flsh_tbls.result33
-rw-r--r--mysql-test/r/rpl_row_func001.result30
-rw-r--r--mysql-test/r/rpl_row_func002.result25
-rw-r--r--mysql-test/r/rpl_row_func003.result29
-rw-r--r--mysql-test/r/rpl_row_inexist_tbl.result54
-rw-r--r--mysql-test/r/rpl_row_loaddata_m.result20
-rw-r--r--mysql-test/r/rpl_row_log.result118
-rw-r--r--mysql-test/r/rpl_row_log_innodb.result126
-rw-r--r--mysql-test/r/rpl_row_max_relay_size.result273
-rw-r--r--mysql-test/r/rpl_row_multi_query.result37
-rw-r--r--mysql-test/r/rpl_row_mysqlbinlog.result266
-rw-r--r--mysql-test/r/rpl_row_mystery22.result30
-rw-r--r--mysql-test/r/rpl_row_reset_slave.result32
-rw-r--r--mysql-test/r/rpl_row_sp001.result85
-rw-r--r--mysql-test/r/rpl_row_sp002_innodb.result239
-rw-r--r--mysql-test/r/rpl_row_sp003.result49
-rw-r--r--mysql-test/r/rpl_row_sp005.result100
-rw-r--r--mysql-test/r/rpl_row_sp006_InnoDB.result46
-rw-r--r--mysql-test/r/rpl_row_sp007_innodb.result50
-rw-r--r--mysql-test/r/rpl_row_sp008.result33
-rw-r--r--mysql-test/r/rpl_row_sp009.result77
-rw-r--r--mysql-test/r/rpl_row_sp010.result56
-rw-r--r--mysql-test/r/rpl_row_sp011.result69
-rw-r--r--mysql-test/r/rpl_row_sp012.result58
-rw-r--r--mysql-test/r/rpl_row_stop_middle.result26
-rw-r--r--mysql-test/r/rpl_row_stop_middle_update.result16
-rw-r--r--mysql-test/r/rpl_row_tabledefs_2myisam.result381
-rw-r--r--mysql-test/r/rpl_row_tabledefs_3innodb.result381
-rw-r--r--mysql-test/r/rpl_row_tabledefs_7ndb.result286
-rw-r--r--mysql-test/r/rpl_row_trig001.result30
-rw-r--r--mysql-test/r/rpl_row_trig002.result69
-rw-r--r--mysql-test/r/rpl_row_trig003.result83
-rw-r--r--mysql-test/r/rpl_row_trig004.result30
-rw-r--r--mysql-test/r/rpl_row_until.result62
-rw-r--r--mysql-test/r/rpl_row_view01.result100
-rw-r--r--mysql-test/r/rpl_server_id1.result2
-rw-r--r--mysql-test/r/rpl_server_id2.result2
-rw-r--r--mysql-test/r/rpl_skip_error.result2
-rw-r--r--mysql-test/r/rpl_slave_status.result1
-rw-r--r--mysql-test/r/rpl_sp.result2
-rw-r--r--mysql-test/r/rpl_sp004.result93
-rw-r--r--mysql-test/r/rpl_sp_effects.result83
-rw-r--r--mysql-test/r/rpl_sporadic_master.result2
-rw-r--r--mysql-test/r/rpl_stm_000001.result (renamed from mysql-test/r/rpl000001.result)0
-rw-r--r--mysql-test/r/rpl_stm_EE_err2.result (renamed from mysql-test/r/rpl_EE_error.result)7
-rw-r--r--mysql-test/r/rpl_stm_charset.result (renamed from mysql-test/r/rpl_charset.result)2
-rw-r--r--mysql-test/r/rpl_stm_flsh_tbls.result33
-rw-r--r--mysql-test/r/rpl_stm_log.result117
-rw-r--r--mysql-test/r/rpl_stm_max_relay_size.result (renamed from mysql-test/r/rpl_max_relay_size.result)36
-rw-r--r--mysql-test/r/rpl_stm_multi_query.result (renamed from mysql-test/r/rpl_multi_query.result)2
-rw-r--r--mysql-test/r/rpl_stm_mystery22.result31
-rw-r--r--mysql-test/r/rpl_stm_no_op.result (renamed from mysql-test/r/rpl_delete_all.result)39
-rw-r--r--mysql-test/r/rpl_stm_reset_slave.result (renamed from mysql-test/r/rpl_reset_slave.result)8
-rw-r--r--mysql-test/r/rpl_stm_until.result (renamed from mysql-test/r/rpl_until.result)30
-rw-r--r--mysql-test/r/rpl_switch_stm_row_mixed.result1005
-rw-r--r--mysql-test/r/rpl_temp_table.result (renamed from mysql-test/r/rpl000012.result)29
-rw-r--r--mysql-test/r/rpl_temporary.result28
-rw-r--r--mysql-test/r/rpl_timezone.result173
-rw-r--r--mysql-test/r/rpl_trigger.result3
-rw-r--r--mysql-test/r/rpl_truncate_2myisam.result202
-rw-r--r--mysql-test/r/rpl_truncate_3innodb.result214
-rw-r--r--mysql-test/r/rpl_truncate_7ndb.result91
-rw-r--r--mysql-test/r/rpl_truncate_7ndb_2.result91
-rw-r--r--mysql-test/r/rpl_user_variables.result96
-rw-r--r--mysql-test/r/rpl_variables.result2
-rw-r--r--mysql-test/r/rpl_view.result11
-rw-r--r--mysql-test/r/schema.result1
-rw-r--r--mysql-test/r/select.result38
-rw-r--r--mysql-test/r/show_check.result218
-rw-r--r--mysql-test/r/sp-dynamic.result4
-rw-r--r--mysql-test/r/sp-error.result24
-rw-r--r--mysql-test/r/sp-security.result11
-rw-r--r--mysql-test/r/sp-vars.result154
-rw-r--r--mysql-test/r/sp.result176
-rw-r--r--mysql-test/r/sp_notembedded.result11
-rw-r--r--mysql-test/r/sp_trans.result28
-rw-r--r--mysql-test/r/sql_mode.result102
-rw-r--r--mysql-test/r/ssl.result8
-rw-r--r--mysql-test/r/ssl_compress.result8
-rw-r--r--mysql-test/r/status.result73
-rw-r--r--mysql-test/r/strict.result388
-rw-r--r--mysql-test/r/strict_autoinc_1myisam.result6
-rw-r--r--mysql-test/r/strict_autoinc_2innodb.result6
-rw-r--r--mysql-test/r/strict_autoinc_3heap.result6
-rw-r--r--mysql-test/r/strict_autoinc_4bdb.result6
-rw-r--r--mysql-test/r/strict_autoinc_5ndb.result6
-rw-r--r--mysql-test/r/subselect.result396
-rw-r--r--mysql-test/r/symlink.result20
-rw-r--r--mysql-test/r/synchronization.result40
-rw-r--r--mysql-test/r/system_mysql_db.result297
-rw-r--r--mysql-test/r/temp_table.result17
-rw-r--r--mysql-test/r/timezone2.result28
-rw-r--r--mysql-test/r/timezone_grant.result2
-rw-r--r--mysql-test/r/trigger-compat.result3
-rw-r--r--mysql-test/r/trigger-grant.result70
-rw-r--r--mysql-test/r/trigger.result6
-rw-r--r--mysql-test/r/type_binary.result6
-rw-r--r--mysql-test/r/type_bit.result14
-rw-r--r--mysql-test/r/type_bit_innodb.result20
-rw-r--r--mysql-test/r/type_blob.result20
-rw-r--r--mysql-test/r/type_date.result2
-rw-r--r--mysql-test/r/type_datetime.result34
-rw-r--r--mysql-test/r/type_decimal.result118
-rw-r--r--mysql-test/r/type_enum.result14
-rw-r--r--mysql-test/r/type_float.result40
-rw-r--r--mysql-test/r/type_nchar.result14
-rw-r--r--mysql-test/r/type_newdecimal.result155
-rw-r--r--mysql-test/r/type_ranges.result44
-rw-r--r--mysql-test/r/type_set.result4
-rw-r--r--mysql-test/r/type_time.result6
-rw-r--r--mysql-test/r/type_timestamp.result68
-rw-r--r--mysql-test/r/type_uint.result4
-rw-r--r--mysql-test/r/type_varchar.result26
-rw-r--r--mysql-test/r/udf.result2
-rw-r--r--mysql-test/r/union.result150
-rw-r--r--mysql-test/r/unsafe_binlog_innodb.result123
-rw-r--r--mysql-test/r/upgrade.result59
-rw-r--r--mysql-test/r/user_var-binlog.result12
-rw-r--r--mysql-test/r/user_var.result4
-rw-r--r--mysql-test/r/varbinary.result4
-rw-r--r--mysql-test/r/variables.result191
-rw-r--r--mysql-test/r/view.result78
-rw-r--r--mysql-test/r/view_grant.result2
-rw-r--r--mysql-test/r/warnings.result32
-rw-r--r--mysql-test/r/windows.require2
-rw-r--r--mysql-test/r/xml.result738
-rw-r--r--mysql-test/std_data/cacert.pem17
-rw-r--r--mysql-test/std_data/client-cert.pem42
-rw-r--r--mysql-test/std_data/client-key.pem9
-rw-r--r--mysql-test/std_data/ndb_backup50/BACKUP-1-0.1.Databin0 -> 116228 bytes
-rw-r--r--mysql-test/std_data/ndb_backup50/BACKUP-1-0.2.Databin0 -> 113556 bytes
-rw-r--r--mysql-test/std_data/ndb_backup50/BACKUP-1.1.ctlbin0 -> 7936 bytes
-rw-r--r--mysql-test/std_data/ndb_backup50/BACKUP-1.1.logbin0 -> 7592 bytes
-rw-r--r--mysql-test/std_data/ndb_backup50/BACKUP-1.2.ctlbin0 -> 7936 bytes
-rw-r--r--mysql-test/std_data/ndb_backup50/BACKUP-1.2.logbin0 -> 7128 bytes
-rw-r--r--mysql-test/std_data/ndb_backup51/BACKUP-1-0.1.Databin0 -> 110596 bytes
-rw-r--r--mysql-test/std_data/ndb_backup51/BACKUP-1-0.2.Databin0 -> 103180 bytes
-rw-r--r--mysql-test/std_data/ndb_backup51/BACKUP-1.1.ctlbin0 -> 12320 bytes
-rw-r--r--mysql-test/std_data/ndb_backup51/BACKUP-1.1.logbin0 -> 7592 bytes
-rw-r--r--mysql-test/std_data/ndb_backup51/BACKUP-1.2.ctlbin0 -> 12320 bytes
-rw-r--r--mysql-test/std_data/ndb_backup51/BACKUP-1.2.logbin0 -> 6996 bytes
-rw-r--r--mysql-test/std_data/rpl_timezone2.dat2
-rw-r--r--mysql-test/std_data/server-cert.pem42
-rw-r--r--mysql-test/std_data/server-key.pem9
-rw-r--r--mysql-test/std_data/words2.dat50
-rw-r--r--mysql-test/t/alter_table.test118
-rw-r--r--mysql-test/t/archive.test210
-rw-r--r--mysql-test/t/archive_bitfield.test98
-rw-r--r--mysql-test/t/auto_increment.test22
-rw-r--r--mysql-test/t/backup.test21
-rw-r--r--mysql-test/t/bdb-alter-table-1.test18
-rw-r--r--mysql-test/t/bdb-alter-table-2-master.opt2
-rw-r--r--mysql-test/t/bdb-alter-table-2.test10
-rw-r--r--mysql-test/t/bdb-crash.test51
-rw-r--r--mysql-test/t/bdb-deadlock.test59
-rw-r--r--mysql-test/t/bdb-deadlock.tminus59
-rw-r--r--mysql-test/t/bdb.test1057
-rw-r--r--mysql-test/t/bdb_cache.test53
-rw-r--r--mysql-test/t/bdb_gis.test3
-rw-r--r--mysql-test/t/binlog.test49
-rw-r--r--mysql-test/t/binlog_row_binlog-master.opt (renamed from mysql-test/t/binlog-master.opt)0
-rw-r--r--mysql-test/t/binlog_row_binlog.test5
-rw-r--r--mysql-test/t/binlog_row_blackhole.test11
-rw-r--r--mysql-test/t/binlog_row_ctype_cp932.test5
-rw-r--r--mysql-test/t/binlog_row_ctype_ucs.test6
-rw-r--r--mysql-test/t/binlog_row_drop_tmp_tbl.test5
-rw-r--r--mysql-test/t/binlog_row_innodb_stat-master.opt1
-rw-r--r--mysql-test/t/binlog_row_innodb_stat.test5
-rw-r--r--mysql-test/t/binlog_row_insert_select.test10
-rw-r--r--mysql-test/t/binlog_row_mix_innodb_myisam-master.opt (renamed from mysql-test/t/mix_innodb_myisam_binlog-master.opt)0
-rw-r--r--mysql-test/t/binlog_row_mix_innodb_myisam.test31
-rw-r--r--mysql-test/t/binlog_statement_insert_delayed.test9
-rw-r--r--mysql-test/t/binlog_stm_binlog-master.opt1
-rw-r--r--mysql-test/t/binlog_stm_binlog.test18
-rw-r--r--mysql-test/t/binlog_stm_blackhole.test6
-rw-r--r--mysql-test/t/binlog_stm_ctype_cp932.test6
-rw-r--r--mysql-test/t/binlog_stm_ctype_ucs.test6
-rw-r--r--mysql-test/t/binlog_stm_drop_tmp_tbl.test5
-rw-r--r--mysql-test/t/binlog_stm_innodb_stat-master.opt1
-rw-r--r--mysql-test/t/binlog_stm_innodb_stat.test5
-rw-r--r--mysql-test/t/binlog_stm_insert_select.test5
-rw-r--r--mysql-test/t/binlog_stm_mix_innodb_myisam-master.opt1
-rw-r--r--mysql-test/t/binlog_stm_mix_innodb_myisam.test23
-rw-r--r--mysql-test/t/cache_innodb-master.opt (renamed from mysql-test/t/bdb_cache-master.opt)0
-rw-r--r--mysql-test/t/cache_innodb.test16
-rw-r--r--mysql-test/t/case.test2
-rw-r--r--mysql-test/t/cast.test2
-rw-r--r--mysql-test/t/concurrent_innodb-master.opt1
-rw-r--r--mysql-test/t/concurrent_innodb.test20
-rw-r--r--mysql-test/t/connect.test4
-rw-r--r--mysql-test/t/contributors.test1
-rw-r--r--mysql-test/t/crash_commit_before-master.opt2
-rw-r--r--mysql-test/t/crash_commit_before.test31
-rw-r--r--mysql-test/t/create.test44
-rw-r--r--mysql-test/t/create_not_windows.test21
-rw-r--r--mysql-test/t/create_select_tmp.test3
-rw-r--r--mysql-test/t/csv.test201
-rw-r--r--mysql-test/t/ctype_cp1250_ch.test3
-rw-r--r--mysql-test/t/ctype_cp932_binlog.test57
-rw-r--r--mysql-test/t/ctype_cp932_binlog_row.test5
-rw-r--r--mysql-test/t/ctype_cp932_binlog_stm.test29
-rw-r--r--mysql-test/t/ctype_filename.test21
-rw-r--r--mysql-test/t/ctype_latin1.test11
-rw-r--r--mysql-test/t/ctype_ujis.test4
-rw-r--r--mysql-test/t/ctype_utf8.test9
-rw-r--r--mysql-test/t/date_formats.test3
-rw-r--r--mysql-test/t/deadlock_innodb.test16
-rw-r--r--mysql-test/t/disabled.def29
-rw-r--r--mysql-test/t/events.test398
-rw-r--r--mysql-test/t/events_bugs.test299
-rw-r--r--mysql-test/t/events_grant.test108
-rw-r--r--mysql-test/t/events_logs_tests-master.opt1
-rw-r--r--mysql-test/t/events_logs_tests.test103
-rw-r--r--mysql-test/t/events_microsec.test21
-rw-r--r--mysql-test/t/events_restart_phase0.log22
-rw-r--r--mysql-test/t/events_restart_phase0.result22
-rw-r--r--mysql-test/t/events_restart_phase1.test19
-rw-r--r--mysql-test/t/events_restart_phase2-master.opt1
-rw-r--r--mysql-test/t/events_restart_phase2.test9
-rw-r--r--mysql-test/t/events_restart_phase3-master.opt1
-rw-r--r--mysql-test/t/events_restart_phase3.test14
-rw-r--r--mysql-test/t/events_scheduling.test65
-rw-r--r--mysql-test/t/events_stress.test136
-rw-r--r--mysql-test/t/exampledb.test4
-rw-r--r--mysql-test/t/federated.test94
-rw-r--r--mysql-test/t/federated_archive.test2
-rw-r--r--mysql-test/t/federated_bug_13118.test2
-rw-r--r--mysql-test/t/federated_transactions-slave.opt (renamed from mysql-test/t/rpl000001-slave.opt)0
-rw-r--r--mysql-test/t/federated_transactions.test40
-rw-r--r--mysql-test/t/flush_table.test55
-rw-r--r--mysql-test/t/fulltext.test12
-rw-r--r--mysql-test/t/fulltext2.test10
-rw-r--r--mysql-test/t/func_gconcat.test4
-rw-r--r--mysql-test/t/func_group.test21
-rw-r--r--mysql-test/t/func_group_innodb.test85
-rw-r--r--mysql-test/t/func_in.test24
-rw-r--r--mysql-test/t/func_like.test4
-rw-r--r--mysql-test/t/func_math.test5
-rw-r--r--mysql-test/t/func_system.test2
-rw-r--r--mysql-test/t/func_time.test39
-rw-r--r--mysql-test/t/grant2.test11
-rw-r--r--mysql-test/t/group_by.test12
-rw-r--r--mysql-test/t/group_min_max.test45
-rw-r--r--mysql-test/t/group_min_max_innodb.test95
-rw-r--r--mysql-test/t/handler_innodb.test20
-rw-r--r--mysql-test/t/handler_myisam.test21
-rw-r--r--mysql-test/t/having.test2
-rw-r--r--mysql-test/t/im_cmd_line.imtest68
-rw-r--r--mysql-test/t/im_daemon_life_cycle.imtest2
-rw-r--r--mysql-test/t/im_instance_conf-im.opt1
-rw-r--r--mysql-test/t/im_instance_conf.imtest244
-rw-r--r--mysql-test/t/im_options-im.opt1
-rw-r--r--mysql-test/t/im_options.imtest274
-rw-r--r--mysql-test/t/im_options_set.imtest116
-rw-r--r--mysql-test/t/im_options_unset.imtest124
-rw-r--r--mysql-test/t/index_merge_bdb.test52
-rw-r--r--mysql-test/t/index_merge_innodb.test322
-rw-r--r--mysql-test/t/index_merge_myisam.test21
-rw-r--r--mysql-test/t/information_schema.test34
-rw-r--r--mysql-test/t/information_schema_inno.test32
-rw-r--r--mysql-test/t/information_schema_part.test123
-rw-r--r--mysql-test/t/innodb-big.test46
-rw-r--r--mysql-test/t/innodb-deadlock.test117
-rw-r--r--mysql-test/t/innodb-master.opt2
-rw-r--r--mysql-test/t/innodb.test326
-rw-r--r--mysql-test/t/innodb_cache-master.opt1
-rw-r--r--mysql-test/t/innodb_handler.test96
-rw-r--r--mysql-test/t/innodb_mysql.test393
-rw-r--r--mysql-test/t/innodb_unsafe_binlog-master.opt1
-rw-r--r--mysql-test/t/innodb_unsafe_binlog.test67
-rw-r--r--mysql-test/t/insert.test35
-rw-r--r--mysql-test/t/join.test41
-rw-r--r--mysql-test/t/join_outer.test6
-rw-r--r--mysql-test/t/join_outer_innodb.test26
-rw-r--r--mysql-test/t/key.test58
-rw-r--r--mysql-test/t/keywords.test24
-rw-r--r--mysql-test/t/kill.test2
-rw-r--r--mysql-test/t/loaddata.test28
-rw-r--r--mysql-test/t/lock.test15
-rw-r--r--mysql-test/t/lock_multi.test88
-rw-r--r--mysql-test/t/log_state-master.opt1
-rw-r--r--mysql-test/t/log_state.test123
-rw-r--r--mysql-test/t/log_tables-master.opt1
-rw-r--r--mysql-test/t/log_tables.test404
-rw-r--r--mysql-test/t/merge.test4
-rw-r--r--mysql-test/t/mix2_myisam.test26
-rw-r--r--mysql-test/t/multi_update.test38
-rw-r--r--mysql-test/t/myisam-system.test21
-rw-r--r--mysql-test/t/myisam.test106
-rw-r--r--mysql-test/t/mysql_client_test-master.opt1
-rw-r--r--mysql-test/t/mysql_client_test.opt1
-rw-r--r--mysql-test/t/mysqlbinlog.test6
-rw-r--r--mysql-test/t/mysqlbinlog2.test19
-rw-r--r--mysql-test/t/mysqlbinlog_base64.test38
-rw-r--r--mysql-test/t/mysqlcheck.test11
-rw-r--r--mysql-test/t/mysqldump.test129
-rw-r--r--mysql-test/t/mysqlslap.test16
-rw-r--r--mysql-test/t/ndb_alter_table.test161
-rw-r--r--mysql-test/t/ndb_alter_table2.test4
-rw-r--r--mysql-test/t/ndb_alter_table3.test49
-rw-r--r--mysql-test/t/ndb_autodiscover.test4
-rw-r--r--mysql-test/t/ndb_autodiscover3.test27
-rw-r--r--mysql-test/t/ndb_basic.test37
-rw-r--r--mysql-test/t/ndb_binlog_basic.test72
-rw-r--r--mysql-test/t/ndb_binlog_basic2.test14
-rw-r--r--mysql-test/t/ndb_binlog_ddl_multi.test191
-rw-r--r--mysql-test/t/ndb_binlog_discover.test33
-rw-r--r--mysql-test/t/ndb_binlog_ignore_db-master.opt1
-rw-r--r--mysql-test/t/ndb_binlog_ignore_db.test15
-rw-r--r--mysql-test/t/ndb_binlog_multi.test83
-rw-r--r--mysql-test/t/ndb_bitfield.test2
-rw-r--r--mysql-test/t/ndb_blob.test7
-rw-r--r--mysql-test/t/ndb_blob_partition.test97
-rw-r--r--mysql-test/t/ndb_cache_multi.test7
-rw-r--r--mysql-test/t/ndb_charset.test10
-rw-r--r--mysql-test/t/ndb_condition_pushdown.test36
-rw-r--r--mysql-test/t/ndb_config2.test7
-rw-r--r--mysql-test/t/ndb_database.test28
-rw-r--r--mysql-test/t/ndb_dd_alter.test247
-rw-r--r--mysql-test/t/ndb_dd_backuprestore.test349
-rw-r--r--mysql-test/t/ndb_dd_basic.test406
-rw-r--r--mysql-test/t/ndb_dd_ddl.test354
-rw-r--r--mysql-test/t/ndb_dd_disk2memory.test292
-rw-r--r--mysql-test/t/ndb_dd_dump.test288
-rw-r--r--mysql-test/t/ndb_dd_sql_features.test551
-rw-r--r--mysql-test/t/ndb_index_ordered.test74
-rw-r--r--mysql-test/t/ndb_index_unique.test28
-rw-r--r--mysql-test/t/ndb_lock.test36
-rw-r--r--mysql-test/t/ndb_multi.test12
-rw-r--r--mysql-test/t/ndb_multi_row.test76
-rw-r--r--mysql-test/t/ndb_partition_error.test74
-rw-r--r--mysql-test/t/ndb_partition_key.test201
-rw-r--r--mysql-test/t/ndb_partition_list.test68
-rw-r--r--mysql-test/t/ndb_partition_range.test264
-rw-r--r--mysql-test/t/ndb_read_multi_range.test25
-rw-r--r--mysql-test/t/ndb_rename.test4
-rw-r--r--mysql-test/t/ndb_restore.test233
-rw-r--r--mysql-test/t/ndb_restore_compat.test43
-rw-r--r--mysql-test/t/ndb_restore_partition-master.opt1
-rw-r--r--mysql-test/t/ndb_restore_partition.test375
-rw-r--r--mysql-test/t/ndb_subquery.test4
-rw-r--r--mysql-test/t/ndb_temporary.test38
-rw-r--r--mysql-test/t/ndb_view.test29
-rw-r--r--mysql-test/t/ndbapi.test44
-rw-r--r--mysql-test/t/not_embedded_server.test9
-rw-r--r--mysql-test/t/not_partition.test62
-rw-r--r--mysql-test/t/parser.test510
-rw-r--r--mysql-test/t/parser_bug21114_innodb.test422
-rw-r--r--mysql-test/t/partition-master.opt1
-rw-r--r--mysql-test/t/partition.test1357
-rw-r--r--mysql-test/t/partition_02myisam.test25
-rw-r--r--mysql-test/t/partition_03ndb.test26
-rw-r--r--mysql-test/t/partition_charset.test21
-rw-r--r--mysql-test/t/partition_error.test797
-rw-r--r--mysql-test/t/partition_grant.test59
-rw-r--r--mysql-test/t/partition_hash.test153
-rw-r--r--mysql-test/t/partition_innodb.test78
-rw-r--r--mysql-test/t/partition_list.test182
-rw-r--r--mysql-test/t/partition_mgm.test53
-rw-r--r--mysql-test/t/partition_mgm_err.test213
-rw-r--r--mysql-test/t/partition_mgm_err2.test31
-rw-r--r--mysql-test/t/partition_order.test844
-rw-r--r--mysql-test/t/partition_pruning.test737
-rw-r--r--mysql-test/t/partition_range.test761
-rw-r--r--mysql-test/t/ps.test875
-rw-r--r--mysql-test/t/ps_1general.test35
-rw-r--r--mysql-test/t/ps_6bdb.test25
-rw-r--r--mysql-test/t/ps_grant.test3
-rw-r--r--mysql-test/t/query_cache.test11
-rw-r--r--mysql-test/t/raid.test224
-rw-r--r--mysql-test/t/range.test29
-rw-r--r--mysql-test/t/read_many_rows_innodb.test17
-rw-r--r--mysql-test/t/renamedb.test26
-rw-r--r--mysql-test/t/repair.test13
-rw-r--r--mysql-test/t/rowid_order_innodb.test110
-rw-r--r--mysql-test/t/rpl000004.test25
-rw-r--r--mysql-test/t/rpl000005.test24
-rw-r--r--mysql-test/t/rpl000006.test47
-rw-r--r--mysql-test/t/rpl000013-slave.opt1
-rw-r--r--mysql-test/t/rpl000013.test10
-rw-r--r--mysql-test/t/rpl000017.test6
-rwxr-xr-xmysql-test/t/rpl_000015-slave.sh (renamed from mysql-test/t/rpl000015-slave.sh)0
-rw-r--r--mysql-test/t/rpl_000015.slave-mi (renamed from mysql-test/t/rpl000015.slave-mi)0
-rw-r--r--mysql-test/t/rpl_000015.test (renamed from mysql-test/t/rpl000015.test)14
-rw-r--r--mysql-test/t/rpl_EE_err.test7
-rw-r--r--mysql-test/t/rpl_EE_error.test32
-rw-r--r--mysql-test/t/rpl_LD_INFILE.test38
-rw-r--r--mysql-test/t/rpl_alter_db.test10
-rw-r--r--mysql-test/t/rpl_auto_increment-slave.opt1
-rw-r--r--mysql-test/t/rpl_auto_increment.test154
-rw-r--r--mysql-test/t/rpl_bit.test94
-rw-r--r--mysql-test/t/rpl_bit_npk.test116
-rw-r--r--mysql-test/t/rpl_change_master.test4
-rw-r--r--mysql-test/t/rpl_commit_after_flush.test30
-rw-r--r--mysql-test/t/rpl_create_database.test9
-rw-r--r--mysql-test/t/rpl_ddl.test484
-rw-r--r--mysql-test/t/rpl_deadlock_innodb-slave.opt (renamed from mysql-test/t/rpl_deadlock-slave.opt)0
-rw-r--r--mysql-test/t/rpl_deadlock_innodb.test11
-rw-r--r--mysql-test/t/rpl_delete_all.test43
-rw-r--r--mysql-test/t/rpl_delete_no_where.test6
-rw-r--r--mysql-test/t/rpl_do_grant.test54
-rw-r--r--mysql-test/t/rpl_drop.test2
-rw-r--r--mysql-test/t/rpl_drop_db.test6
-rw-r--r--mysql-test/t/rpl_drop_temp.test14
-rw-r--r--mysql-test/t/rpl_empty_master_crash.test2
-rw-r--r--mysql-test/t/rpl_err_ignoredtable-slave.opt (renamed from mysql-test/t/rpl_error_ignored_table-slave.opt)0
-rw-r--r--mysql-test/t/rpl_err_ignoredtable.test (renamed from mysql-test/t/rpl_error_ignored_table.test)28
-rw-r--r--mysql-test/t/rpl_failed_optimize.test34
-rw-r--r--mysql-test/t/rpl_flushlog_loop-master.opt (renamed from mysql-test/t/rpl_flush_log_loop-master.opt)0
-rwxr-xr-xmysql-test/t/rpl_flushlog_loop-master.sh (renamed from mysql-test/t/rpl_flush_log_loop-master.sh)0
-rw-r--r--mysql-test/t/rpl_flushlog_loop-slave.opt (renamed from mysql-test/t/rpl_flush_log_loop-slave.opt)0
-rwxr-xr-xmysql-test/t/rpl_flushlog_loop-slave.sh (renamed from mysql-test/t/rpl_flush_log_loop-slave.sh)0
-rw-r--r--mysql-test/t/rpl_flushlog_loop.test (renamed from mysql-test/t/rpl_flush_log_loop.test)37
-rw-r--r--mysql-test/t/rpl_foreign_key_innodb-slave.opt1
-rw-r--r--mysql-test/t/rpl_foreign_key_innodb.test11
-rw-r--r--mysql-test/t/rpl_ignore_table.test2
-rw-r--r--mysql-test/t/rpl_ignore_table_update-slave.opt (renamed from mysql-test/t/rpl000008-slave.opt)0
-rw-r--r--mysql-test/t/rpl_ignore_table_update.test (renamed from mysql-test/t/rpl000008.test)0
-rw-r--r--mysql-test/t/rpl_insert.test44
-rw-r--r--mysql-test/t/rpl_insert_id.test393
-rw-r--r--mysql-test/t/rpl_insert_id_pk-slave.opt1
-rw-r--r--mysql-test/t/rpl_insert_id_pk.test11
-rw-r--r--mysql-test/t/rpl_insert_ignore.test79
-rw-r--r--mysql-test/t/rpl_load_from_master-slave.opt (renamed from mysql-test/t/rpl000009-slave.opt)0
-rw-r--r--mysql-test/t/rpl_load_from_master.test (renamed from mysql-test/t/rpl000009.test)30
-rw-r--r--mysql-test/t/rpl_load_table_from_master.test98
-rw-r--r--mysql-test/t/rpl_loaddata.test161
-rw-r--r--mysql-test/t/rpl_loaddata2.test14
-rw-r--r--mysql-test/t/rpl_loaddata_m-master.opt (renamed from mysql-test/t/rpl_loaddata_rule_m-master.opt)0
-rw-r--r--mysql-test/t/rpl_loaddata_m.test52
-rw-r--r--mysql-test/t/rpl_loaddata_rule_m.test33
-rw-r--r--mysql-test/t/rpl_loaddata_rule_s.test25
-rw-r--r--mysql-test/t/rpl_loaddata_s-slave.opt (renamed from mysql-test/t/rpl_loaddata_rule_s-slave.opt)0
-rw-r--r--mysql-test/t/rpl_loaddata_s.test30
-rw-r--r--mysql-test/t/rpl_loaddatalocal.test4
-rw-r--r--mysql-test/t/rpl_loadfile.test52
-rw-r--r--mysql-test/t/rpl_log_pos.test21
-rw-r--r--mysql-test/t/rpl_mixed_ddl_dml.test (renamed from mysql-test/t/rpl000002.test)5
-rw-r--r--mysql-test/t/rpl_multi_delete.test29
-rw-r--r--mysql-test/t/rpl_multi_delete2.test2
-rw-r--r--mysql-test/t/rpl_multi_engine-slave.opt1
-rw-r--r--mysql-test/t/rpl_multi_engine.test108
-rw-r--r--mysql-test/t/rpl_multi_update.test56
-rw-r--r--mysql-test/t/rpl_multi_update2.test71
-rw-r--r--mysql-test/t/rpl_multi_update3.test232
-rw-r--r--mysql-test/t/rpl_multi_update4.test7
-rw-r--r--mysql-test/t/rpl_mystery22.test40
-rw-r--r--mysql-test/t/rpl_ndb_2innodb-master.opt1
-rw-r--r--mysql-test/t/rpl_ndb_2innodb-slave.opt1
-rw-r--r--mysql-test/t/rpl_ndb_2innodb.test16
-rw-r--r--mysql-test/t/rpl_ndb_2myisam-master.opt1
-rw-r--r--mysql-test/t/rpl_ndb_2myisam-slave.opt1
-rw-r--r--mysql-test/t/rpl_ndb_2myisam.test13
-rw-r--r--mysql-test/t/rpl_ndb_UUID.test6
-rw-r--r--mysql-test/t/rpl_ndb_auto_inc.test118
-rw-r--r--mysql-test/t/rpl_ndb_bank.test181
-rw-r--r--mysql-test/t/rpl_ndb_basic.test187
-rw-r--r--mysql-test/t/rpl_ndb_blob.test142
-rw-r--r--mysql-test/t/rpl_ndb_blob2.test9
-rw-r--r--mysql-test/t/rpl_ndb_charset.test6
-rw-r--r--mysql-test/t/rpl_ndb_commit_afterflush.test9
-rw-r--r--mysql-test/t/rpl_ndb_dd_advance.test580
-rw-r--r--mysql-test/t/rpl_ndb_dd_basic.test85
-rw-r--r--mysql-test/t/rpl_ndb_dd_partitions.test310
-rw-r--r--mysql-test/t/rpl_ndb_ddl.test34
-rw-r--r--mysql-test/t/rpl_ndb_delete_nowhere.test8
-rw-r--r--mysql-test/t/rpl_ndb_func003.test12
-rw-r--r--mysql-test/t/rpl_ndb_idempotent.test117
-rw-r--r--mysql-test/t/rpl_ndb_innodb2ndb-master.opt1
-rw-r--r--mysql-test/t/rpl_ndb_innodb2ndb-slave.opt1
-rw-r--r--mysql-test/t/rpl_ndb_innodb2ndb.test16
-rw-r--r--mysql-test/t/rpl_ndb_insert_ignore.test8
-rw-r--r--mysql-test/t/rpl_ndb_load.test66
-rw-r--r--mysql-test/t/rpl_ndb_log-master.opt1
-rw-r--r--mysql-test/t/rpl_ndb_log.test12
-rw-r--r--mysql-test/t/rpl_ndb_multi.test71
-rw-r--r--mysql-test/t/rpl_ndb_multi_update2-slave.opt1
-rw-r--r--mysql-test/t/rpl_ndb_multi_update2.test12
-rw-r--r--mysql-test/t/rpl_ndb_multi_update3.test8
-rw-r--r--mysql-test/t/rpl_ndb_myisam2ndb-master.opt1
-rw-r--r--mysql-test/t/rpl_ndb_myisam2ndb-slave.opt1
-rw-r--r--mysql-test/t/rpl_ndb_myisam2ndb.test15
-rw-r--r--mysql-test/t/rpl_ndb_relayrotate-slave.opt3
-rw-r--r--mysql-test/t/rpl_ndb_relayrotate.test8
-rw-r--r--mysql-test/t/rpl_ndb_row_001.test6
-rw-r--r--mysql-test/t/rpl_ndb_sp003.test9
-rw-r--r--mysql-test/t/rpl_ndb_sp006.test9
-rw-r--r--mysql-test/t/rpl_ndb_sync.test104
-rw-r--r--mysql-test/t/rpl_ndb_trig004.test15
-rw-r--r--mysql-test/t/rpl_ndbapi_multi.test11
-rw-r--r--mysql-test/t/rpl_openssl.test4
-rw-r--r--mysql-test/t/rpl_optimize.test13
-rw-r--r--mysql-test/t/rpl_ps.test11
-rw-r--r--mysql-test/t/rpl_rbr_to_sbr.test48
-rw-r--r--mysql-test/t/rpl_redirect.test14
-rw-r--r--mysql-test/t/rpl_relay_space_innodb-master.opt1
-rw-r--r--mysql-test/t/rpl_relay_space_innodb-slave.opt1
-rw-r--r--mysql-test/t/rpl_relay_space_innodb.test22
-rw-r--r--mysql-test/t/rpl_relay_space_myisam.test21
-rw-r--r--mysql-test/t/rpl_relayrotate.test85
-rw-r--r--mysql-test/t/rpl_replicate_do.test5
-rw-r--r--mysql-test/t/rpl_replicate_ignore_db-slave.opt1
-rw-r--r--mysql-test/t/rpl_replicate_ignore_db.test30
-rw-r--r--mysql-test/t/rpl_rewrt_db-slave.opt (renamed from mysql-test/t/rpl_rewrite_db-slave.opt)0
-rw-r--r--mysql-test/t/rpl_rewrt_db.test (renamed from mysql-test/t/rpl_rewrite_db.test)5
-rw-r--r--mysql-test/t/rpl_rotate_logs.test9
-rw-r--r--mysql-test/t/rpl_row_001.test7
-rw-r--r--mysql-test/t/rpl_row_4_bytes-master.opt1
-rw-r--r--mysql-test/t/rpl_row_4_bytes.test33
-rw-r--r--mysql-test/t/rpl_row_NOW.test73
-rw-r--r--mysql-test/t/rpl_row_USER.test58
-rw-r--r--mysql-test/t/rpl_row_UUID.test7
-rw-r--r--mysql-test/t/rpl_row_basic_11bugs-master.opt1
-rw-r--r--mysql-test/t/rpl_row_basic_11bugs.test116
-rw-r--r--mysql-test/t/rpl_row_basic_2myisam.test3
-rw-r--r--mysql-test/t/rpl_row_basic_3innodb-slave.opt1
-rw-r--r--mysql-test/t/rpl_row_basic_3innodb.test6
-rw-r--r--mysql-test/t/rpl_row_basic_7ndb.test5
-rw-r--r--mysql-test/t/rpl_row_basic_8partition.test211
-rw-r--r--mysql-test/t/rpl_row_blob_innodb-slave.opt1
-rw-r--r--mysql-test/t/rpl_row_blob_innodb.test12
-rw-r--r--mysql-test/t/rpl_row_blob_myisam.test11
-rw-r--r--mysql-test/t/rpl_row_charset.test7
-rw-r--r--mysql-test/t/rpl_row_create_table.test120
-rw-r--r--mysql-test/t/rpl_row_delayed_ins.test7
-rw-r--r--mysql-test/t/rpl_row_drop.test48
-rw-r--r--mysql-test/t/rpl_row_err_daisychain-master.opt1
-rw-r--r--mysql-test/t/rpl_row_err_daisychain-slave.opt1
-rw-r--r--mysql-test/t/rpl_row_flsh_tbls.test17
-rw-r--r--mysql-test/t/rpl_row_func001.test57
-rw-r--r--mysql-test/t/rpl_row_func002.test103
-rw-r--r--mysql-test/t/rpl_row_func003-slave.opt1
-rw-r--r--mysql-test/t/rpl_row_func003.test11
-rw-r--r--mysql-test/t/rpl_row_inexist_tbl-slave.opt1
-rw-r--r--mysql-test/t/rpl_row_inexist_tbl.test35
-rw-r--r--mysql-test/t/rpl_row_log-master.opt1
-rw-r--r--mysql-test/t/rpl_row_log-slave.opt (renamed from mysql-test/t/rpl_log-slave.opt)0
-rw-r--r--mysql-test/t/rpl_row_log.test16
-rw-r--r--mysql-test/t/rpl_row_log_innodb-master.opt1
-rw-r--r--mysql-test/t/rpl_row_log_innodb-slave.opt1
-rw-r--r--mysql-test/t/rpl_row_log_innodb.test13
-rw-r--r--mysql-test/t/rpl_row_max_relay_size.test12
-rw-r--r--mysql-test/t/rpl_row_mysqlbinlog-master.opt1
-rw-r--r--mysql-test/t/rpl_row_mysqlbinlog.test319
-rw-r--r--mysql-test/t/rpl_row_mystery22.test45
-rw-r--r--mysql-test/t/rpl_row_reset_slave.test5
-rw-r--r--mysql-test/t/rpl_row_sp001.test146
-rw-r--r--mysql-test/t/rpl_row_sp002_innodb-master.opt1
-rw-r--r--mysql-test/t/rpl_row_sp002_innodb-slave.opt1
-rw-r--r--mysql-test/t/rpl_row_sp002_innodb.test11
-rw-r--r--mysql-test/t/rpl_row_sp003-master.opt1
-rw-r--r--mysql-test/t/rpl_row_sp003-slave.opt1
-rw-r--r--mysql-test/t/rpl_row_sp003.test11
-rw-r--r--mysql-test/t/rpl_row_sp005.test110
-rw-r--r--mysql-test/t/rpl_row_sp006_InnoDB-slave.opt1
-rw-r--r--mysql-test/t/rpl_row_sp006_InnoDB.test11
-rw-r--r--mysql-test/t/rpl_row_sp007_innodb-slave.opt1
-rw-r--r--mysql-test/t/rpl_row_sp007_innodb.test11
-rw-r--r--mysql-test/t/rpl_row_sp008.test56
-rw-r--r--mysql-test/t/rpl_row_sp009.test105
-rw-r--r--mysql-test/t/rpl_row_sp010.test80
-rw-r--r--mysql-test/t/rpl_row_sp011.test111
-rw-r--r--mysql-test/t/rpl_row_sp012.test74
-rw-r--r--mysql-test/t/rpl_row_stop_middle.test44
-rw-r--r--mysql-test/t/rpl_row_stop_middle_update-master.opt1
-rw-r--r--mysql-test/t/rpl_row_stop_middle_update-slave.opt1
-rw-r--r--mysql-test/t/rpl_row_stop_middle_update.test31
-rw-r--r--mysql-test/t/rpl_row_tabledefs_2myisam.test8
-rw-r--r--mysql-test/t/rpl_row_tabledefs_3innodb.test9
-rw-r--r--mysql-test/t/rpl_row_trig001.test100
-rw-r--r--mysql-test/t/rpl_row_trig002.test80
-rw-r--r--mysql-test/t/rpl_row_trig003.test152
-rw-r--r--mysql-test/t/rpl_row_trig004.test18
-rw-r--r--mysql-test/t/rpl_row_until.test87
-rw-r--r--mysql-test/t/rpl_row_view01.test88
-rw-r--r--mysql-test/t/rpl_server_id1.test2
-rw-r--r--mysql-test/t/rpl_skip_error.test14
-rw-r--r--mysql-test/t/rpl_slave_status.test25
-rw-r--r--mysql-test/t/rpl_sp.test13
-rw-r--r--mysql-test/t/rpl_sp004.test97
-rw-r--r--mysql-test/t/rpl_sp_effects.test46
-rw-r--r--mysql-test/t/rpl_sporadic_master.test5
-rw-r--r--mysql-test/t/rpl_stm_000001-slave.opt1
-rw-r--r--mysql-test/t/rpl_stm_000001.test2
-rw-r--r--mysql-test/t/rpl_stm_EE_err2.test8
-rw-r--r--mysql-test/t/rpl_stm_charset.test2
-rw-r--r--mysql-test/t/rpl_stm_flsh_tbls.test8
-rw-r--r--mysql-test/t/rpl_stm_log-master.opt (renamed from mysql-test/t/rpl_log-master.opt)0
-rw-r--r--mysql-test/t/rpl_stm_log-slave.opt1
-rw-r--r--mysql-test/t/rpl_stm_log.test8
-rw-r--r--mysql-test/t/rpl_stm_max_relay_size.test11
-rw-r--r--mysql-test/t/rpl_stm_multi_query.test12
-rw-r--r--mysql-test/t/rpl_stm_mystery22.test66
-rw-r--r--mysql-test/t/rpl_stm_no_op.test93
-rw-r--r--mysql-test/t/rpl_stm_reset_slave.test6
-rw-r--r--mysql-test/t/rpl_stm_until.test (renamed from mysql-test/t/rpl_until.test)11
-rw-r--r--mysql-test/t/rpl_switch_stm_row_mixed.test545
-rw-r--r--mysql-test/t/rpl_temp_table.test (renamed from mysql-test/t/rpl000012.test)36
-rw-r--r--mysql-test/t/rpl_temporary.test23
-rw-r--r--mysql-test/t/rpl_timezone.test77
-rw-r--r--mysql-test/t/rpl_trigger.test12
-rw-r--r--mysql-test/t/rpl_trunc_temp.test3
-rw-r--r--mysql-test/t/rpl_truncate_2myisam.test4
-rw-r--r--mysql-test/t/rpl_truncate_3innodb.test6
-rw-r--r--mysql-test/t/rpl_truncate_7ndb.test71
-rw-r--r--mysql-test/t/rpl_truncate_7ndb_2-master.opt1
-rw-r--r--mysql-test/t/rpl_truncate_7ndb_2.test6
-rw-r--r--mysql-test/t/rpl_user_variables.test29
-rw-r--r--mysql-test/t/rpl_variables.test4
-rw-r--r--mysql-test/t/rpl_view.test13
-rw-r--r--mysql-test/t/select.test39
-rw-r--r--mysql-test/t/show_check.test123
-rw-r--r--mysql-test/t/sp-destruct.test8
-rw-r--r--mysql-test/t/sp-error.test57
-rw-r--r--mysql-test/t/sp-security.test26
-rw-r--r--mysql-test/t/sp.test142
-rw-r--r--mysql-test/t/sp_notembedded.test4
-rw-r--r--mysql-test/t/sp_trans.test39
-rw-r--r--mysql-test/t/sql_mode.test24
-rw-r--r--mysql-test/t/status.test41
-rw-r--r--mysql-test/t/strict.test8
-rw-r--r--mysql-test/t/strict_autoinc_4bdb.test10
-rw-r--r--mysql-test/t/system_mysql_db.test4
-rw-r--r--mysql-test/t/system_mysql_db_fix.test15
-rw-r--r--mysql-test/t/temp_table.test13
-rw-r--r--mysql-test/t/timezone2.test10
-rw-r--r--mysql-test/t/trigger-compat.test3
-rw-r--r--mysql-test/t/trigger-grant.test154
-rw-r--r--mysql-test/t/trigger.test2
-rw-r--r--mysql-test/t/type_datetime.test2
-rw-r--r--mysql-test/t/type_newdecimal.test22
-rw-r--r--mysql-test/t/type_ranges.test2
-rw-r--r--mysql-test/t/type_timestamp.test8
-rw-r--r--mysql-test/t/union.test45
-rw-r--r--mysql-test/t/unsafe_binlog_innodb-master.opt1
-rw-r--r--mysql-test/t/unsafe_binlog_innodb.test16
-rw-r--r--mysql-test/t/upgrade.test49
-rw-r--r--mysql-test/t/user_var-binlog.test7
-rw-r--r--mysql-test/t/variables.test58
-rw-r--r--mysql-test/t/view.test42
-rw-r--r--mysql-test/t/view_grant.test6
-rw-r--r--mysql-test/t/wait_timeout.test6
-rw-r--r--mysql-test/t/warnings.test15
-rw-r--r--mysql-test/t/xml.test378
-rw-r--r--mysql-test/valgrind.supp143
-rw-r--r--mysql-test/valgrind.supp.orig189
1177 files changed, 101285 insertions, 23572 deletions
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index 471ac9641d2..f0bc1e9b20a 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -17,40 +17,36 @@
## Process this file with automake to create Makefile.in
-if HAVE_NDBCLUSTER_DB
SUBDIRS = ndb
DIST_SUBDIRS=ndb
-USE_NDBCLUSTER=\"--ndbcluster\"
-else
-# If one uses automake conditionals, automake will automatically
-# include all possible branches to DIST_SUBDIRS goal.
-# Reset DIST_SUBDIRS if we don't use NDB
-SUBDIRS=
-DIST_SUBDIRS=
-USE_NDBCLUSTER=\"\"
-endif
benchdir_root= $(prefix)
testdir = $(benchdir_root)/mysql-test
-EXTRA_SCRIPTS = mysql-test-run-shell.sh install_test_db.sh valgrind.supp $(PRESCRIPTS)
+EXTRA_SCRIPTS = mysql-test-run-shell.sh install_test_db.sh \
+ valgrind.supp $(PRESCRIPTS)
EXTRA_DIST = $(EXTRA_SCRIPTS)
-GENSCRIPTS = mysql-test-run-shell mysql-test-run install_test_db mtr
+GENSCRIPTS = mysql-test-run-shell install_test_db mtr mysql-test-run
PRESCRIPTS = mysql-test-run.pl
test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS)
-test_DATA = std_data/client-key.pem \
- std_data/client-cert.pem \
- std_data/cacert.pem \
- std_data/server-cert.pem \
+test_DATA = std_data/client-key.pem std_data/client-cert.pem \
+ std_data/cacert.pem std_data/server-cert.pem \
std_data/server-key.pem
-CLEANFILES = $(GENSCRIPTS) $(test_DATA)
+CLEANFILES = $(GENSCRIPTS)
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I..
-noinst_HEADERS = my_manage.h
dist-hook:
- mkdir -p $(distdir)/t $(distdir)/r $(distdir)/include \
- $(distdir)/std_data $(distdir)/lib
+ mkdir -p \
+ $(distdir)/t \
+ $(distdir)/extra/binlog_tests \
+ $(distdir)/extra/rpl_tests \
+ $(distdir)/r \
+ $(distdir)/include \
+ $(distdir)/std_data \
+ $(distdir)/std_data/ndb_backup50 \
+ $(distdir)/std_data/ndb_backup51 \
+ $(distdir)/lib
-$(INSTALL_DATA) $(srcdir)/t/*.def $(distdir)/t
$(INSTALL_DATA) $(srcdir)/t/*.test $(distdir)/t
-$(INSTALL_DATA) $(srcdir)/t/*.imtest $(distdir)/t
@@ -58,6 +54,10 @@ dist-hook:
-$(INSTALL_DATA) $(srcdir)/t/*.disabled $(distdir)/t
$(INSTALL_DATA) $(srcdir)/t/*.opt $(srcdir)/t/*.slave-mi $(distdir)/t
$(INSTALL_SCRIPT) $(srcdir)/t/*.sh $(distdir)/t
+ $(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.test $(distdir)/extra/binlog_tests
+ $(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.test $(distdir)/extra/rpl_tests
+ -$(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.opt $(distdir)/extra/binlog_tests
+ -$(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.opt $(distdir)/extra/rpl_tests
$(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include
$(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r
$(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(distdir)/std_data
@@ -66,15 +66,21 @@ dist-hook:
$(INSTALL_DATA) $(srcdir)/std_data/*.pem $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.frm $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data
+ $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(distdir)/std_data/ndb_backup50
+ $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(distdir)/std_data/ndb_backup51
$(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(distdir)/lib
$(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib
install-data-local:
$(mkinstalldirs) \
$(DESTDIR)$(testdir)/t \
+ $(DESTDIR)$(testdir)/extra/binlog_tests \
+ $(DESTDIR)$(testdir)/extra/rpl_tests \
$(DESTDIR)$(testdir)/r \
$(DESTDIR)$(testdir)/include \
$(DESTDIR)$(testdir)/std_data \
+ $(DESTDIR)$(testdir)/std_data/ndb_backup50 \
+ $(DESTDIR)$(testdir)/std_data/ndb_backup51 \
$(DESTDIR)$(testdir)/lib
$(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(testdir)
-$(INSTALL_DATA) $(srcdir)/t/*.def $(DESTDIR)$(testdir)/t
@@ -87,6 +93,10 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/t/*.slave-mi $(DESTDIR)$(testdir)/t
$(INSTALL_DATA) $(srcdir)/r/*.result $(DESTDIR)$(testdir)/r
$(INSTALL_DATA) $(srcdir)/r/*.require $(DESTDIR)$(testdir)/r
+ $(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.test $(DESTDIR)$(testdir)/extra/binlog_tests
+ $(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.test $(DESTDIR)$(testdir)/extra/rpl_tests
+ -$(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.opt $(DESTDIR)$(testdir)/extra/binlog_tests
+ -$(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.opt $(DESTDIR)$(testdir)/extra/rpl_tests
$(INSTALL_DATA) $(srcdir)/include/*.inc $(DESTDIR)$(testdir)/include
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.*001 $(DESTDIR)$(testdir)/std_data
@@ -96,23 +106,14 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.frm $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data
+ $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup50
+ $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup51
$(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(DESTDIR)$(testdir)/lib
$(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib
uninstall-local:
@RM@ -f -r $(DESTDIR)$(testdir)
-std_data/client-key.pem: $(top_srcdir)/SSL/$(@F)
- @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
-std_data/client-cert.pem: $(top_srcdir)/SSL/$(@F)
- @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
-std_data/cacert.pem: $(top_srcdir)/SSL/$(@F)
- @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
-std_data/server-cert.pem: $(top_srcdir)/SSL/$(@F)
- @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
-std_data/server-key.pem: $(top_srcdir)/SSL/$(@F)
- @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
-
# mtr - a shortcut for executing mysql-test-run.pl
mtr:
$(RM) -f mtr
@@ -143,7 +144,7 @@ SUFFIXES = .sh
-e 's!@''MYSQL_TCP_PORT''@!@MYSQL_TCP_PORT@!' \
-e 's!@''MYSQL_NO_DASH_VERSION''@!@MYSQL_NO_DASH_VERSION@!' \
-e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \
- -e 's!@''USE_NDBCLUSTER''@!$(USE_NDBCLUSTER)!g' \
+ -e 's!@''USE_NDBCLUSTER''@!@TEST_NDBCLUSTER@!g' \
$< > $@-t
@CHMOD@ +x $@-t
@MV@ $@-t $@
diff --git a/mysql-test/extra/binlog_tests/binlog.test b/mysql-test/extra/binlog_tests/binlog.test
new file mode 100644
index 00000000000..81c813e78d0
--- /dev/null
+++ b/mysql-test/extra/binlog_tests/binlog.test
@@ -0,0 +1,62 @@
+#
+# misc binlogging tests that do not require a slave running
+#
+
+-- source include/not_embedded.inc
+-- source include/have_innodb.inc
+-- source include/have_debug.inc
+
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+reset master;
+
+create table t1 (a int) engine=innodb;
+create table t2 (a int) engine=innodb;
+begin;
+insert t1 values (5);
+commit;
+begin;
+insert t2 values (5);
+commit;
+# first COMMIT must be Query_log_event, second - Xid_log_event
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
+show binlog events from 102;
+drop table t1,t2;
+
+#
+# binlog rotation after one big transaction
+#
+reset master;
+let $1=100;
+
+create table t1 (n int) engine=innodb;
+begin;
+--disable_query_log
+while ($1)
+{
+ eval insert into t1 values($1 + 4);
+ dec $1;
+}
+--enable_query_log
+commit;
+drop table t1;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
+show binlog events in 'master-bin.000001' from 102;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
+show binlog events in 'master-bin.000002' from 102;
+
+# Test of a too big SET INSERT_ID: see if the truncated value goes
+# into binlog (right), or the too big value (wrong); we look at the
+# binlog further down with SHOW BINLOG EVENTS.
+reset master;
+create table t1 (id tinyint auto_increment primary key);
+set insert_id=128;
+insert into t1 values(null);
+select * from t1;
+drop table t1;
+
+-- source extra/binlog_tests/binlog_insert_delayed.test
diff --git a/mysql-test/extra/binlog_tests/binlog_insert_delayed.test b/mysql-test/extra/binlog_tests/binlog_insert_delayed.test
new file mode 100644
index 00000000000..4da883b9e60
--- /dev/null
+++ b/mysql-test/extra/binlog_tests/binlog_insert_delayed.test
@@ -0,0 +1,42 @@
+# Test of binlogging of INSERT_ID with INSERT DELAYED
+create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
+# First, avoid BUG#20627:
+set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
+# Verify that only one INSERT_ID event is binlogged.
+# Note, that because of WL#3368 mixed mode binlog records RBR events for the delayed
+let $table=t1;
+let $rows_inserted=11; # total number of inserted rows in this test
+insert delayed into t1 values (207);
+let $count=1;
+
+# use this macro instead of sleeps.
+
+--source include/wait_until_rows_count.inc
+insert delayed into t1 values (null);
+inc $count;
+--source include/wait_until_rows_count.inc
+
+insert delayed into t1 values (300);
+inc $count;
+--source include/wait_until_rows_count.inc
+
+# moving binlog check affront of multi-rows queries which work is indeterministic (extra table_maps)
+# todo: better check is to substitute SHOW BINLOG with reading from binlog, probably bug#19459 is in
+# the way
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
+show binlog events from 102;
+
+insert delayed into t1 values (null),(null),(null),(null);
+inc $count; inc $count; inc $count; inc $count;
+--source include/wait_until_rows_count.inc
+
+insert delayed into t1 values (null),(null),(400),(null);
+inc $count; inc $count; inc $count; inc $count;
+--source include/wait_until_rows_count.inc
+
+#check this assertion about $count calculation
+--echo $count == $rows_inserted
+
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/blackhole.test b/mysql-test/extra/binlog_tests/blackhole.test
index e40b84eb5cd..cad4380a374 100644
--- a/mysql-test/t/blackhole.test
+++ b/mysql-test/extra/binlog_tests/blackhole.test
@@ -123,8 +123,29 @@ select * from t3;
let $VERSION=`select version()`;
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
show binlog events;
drop table t1,t2,t3;
# End of 4.1 tests
+# Test that a transaction which is rolled back does not go into binlog
+# and that a transaction which is committed does
+
+reset master;
+create table t1 (a int) engine=blackhole;
+set autocommit=0;
+start transaction;
+insert into t1 values(1);
+commit;
+start transaction;
+insert into t1 values(2);
+rollback;
+set autocommit=1;
+--replace_result $VERSION VERSION
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
+show binlog events;
+drop table if exists t1;
+
+# End of 5.0 tests
diff --git a/mysql-test/t/ctype_cp932.test b/mysql-test/extra/binlog_tests/ctype_cp932.test
index 688d06c4dde..688d06c4dde 100644
--- a/mysql-test/t/ctype_cp932.test
+++ b/mysql-test/extra/binlog_tests/ctype_cp932.test
diff --git a/mysql-test/t/ctype_cp932_notembedded.test b/mysql-test/extra/binlog_tests/ctype_cp932_binlog.test
index 52e7acc3f01..5e93d6e126e 100644
--- a/mysql-test/t/ctype_cp932_notembedded.test
+++ b/mysql-test/extra/binlog_tests/ctype_cp932_binlog.test
@@ -26,7 +26,11 @@ SET @var1= x'8300';
# code (and I have used it to test the fix) until there is some way to
# exercise this code from mysql-test-run.
EXECUTE stmt1 USING @var1;
-SHOW BINLOG EVENTS FROM 98;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS FROM 102;
SELECT HEX(f1) FROM t1;
DROP table t1;
# end test for bug#11338
+
+# End of 4.1 tests
diff --git a/mysql-test/t/ctype_ucs_binlog.test b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test
index 2467d34386c..afe594b8d36 100644
--- a/mysql-test/t/ctype_ucs_binlog.test
+++ b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test
@@ -9,7 +9,8 @@ create table t2 (c char(30)) charset=ucs2;
set @v=convert('abc' using ucs2);
reset master;
insert into t2 values (@v);
-show binlog events from 98;
+--replace_regex /table_id: [0-9]+/table_id: #/
+show binlog events from 102;
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
# absolutely need variables names to be quoted and strings to be
# escaped).
diff --git a/mysql-test/t/drop_temp_table.test b/mysql-test/extra/binlog_tests/drop_temp_table.test
index bc06de4096c..9c8647395bf 100644
--- a/mysql-test/t/drop_temp_table.test
+++ b/mysql-test/extra/binlog_tests/drop_temp_table.test
@@ -25,6 +25,7 @@ select get_lock("a",10);
let $VERSION=`select version()`;
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
show binlog events;
drop database `drop-temp+table-test`;
diff --git a/mysql-test/extra/binlog_tests/innodb_stat.test b/mysql-test/extra/binlog_tests/innodb_stat.test
new file mode 100644
index 00000000000..4638dfcd2f7
--- /dev/null
+++ b/mysql-test/extra/binlog_tests/innodb_stat.test
@@ -0,0 +1,49 @@
+# Embedded server doesn't support binlog
+-- source include/not_embedded.inc
+-- source include/have_innodb.inc
+
+#
+# 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";
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+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;
+
+# Test for testable InnoDB status variables. This test
+# uses previous ones(pages_created, rows_deleted, ...).
+show status like "Innodb_buffer_pool_pages_total";
+show status like "Innodb_page_size";
+show status like "Innodb_rows_deleted";
+show status like "Innodb_rows_inserted";
+show status like "Innodb_rows_updated";
+
diff --git a/mysql-test/t/insert_select-binlog.test b/mysql-test/extra/binlog_tests/insert_select-binlog.test
index d4041f86ab5..268e9280b32 100644
--- a/mysql-test/t/insert_select-binlog.test
+++ b/mysql-test/extra/binlog_tests/insert_select-binlog.test
@@ -1,6 +1,10 @@
# Embedded server doesn't support binlog
-- source include/not_embedded.inc
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
# Check if a partly-completed INSERT SELECT in a MyISAM table goes into the
# binlog
@@ -15,6 +19,7 @@ insert into t1 select * from t2;
# verify the binlog :
let $VERSION=`select version()`;
--replace_result $VERSION VERSION
+--replace_regex /table_id: [0-9]+/table_id: #/
show binlog events;
select * from t1;
drop table t1, t2;
@@ -29,6 +34,7 @@ create table t2(unique(a)) select a from t1;
# The above should produce an error, *and* not appear in the binlog
let $VERSION=`select version()`;
--replace_result $VERSION VERSION
+--replace_regex /table_id: [0-9]+/table_id: #/
show binlog events;
drop table t1;
diff --git a/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
index 66440f1236e..bdc49573ae5 100644
--- a/mysql-test/t/mix_innodb_myisam_binlog.test
+++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
@@ -9,6 +9,7 @@
-- source include/not_embedded.inc
-- source include/have_innodb.inc
+-- source include/have_debug.inc
--disable_warnings
drop table if exists t1, t2;
@@ -28,9 +29,9 @@ insert into t1 values(1);
insert into t2 select * from t1;
commit;
---replace_column 5 #
---replace_result "xid=15" "xid=8"
-show binlog events from 98;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
+show binlog events from 102;
delete from t1;
delete from t2;
@@ -42,8 +43,9 @@ insert into t2 select * from t1;
# should say some changes to non-transact1onal tables couldn't be rolled back
rollback;
---replace_column 5 #
-show binlog events from 98;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
+show binlog events from 102;
delete from t1;
delete from t2;
@@ -57,9 +59,9 @@ insert into t2 select * from t1;
rollback to savepoint my_savepoint;
commit;
---replace_column 5 #
---replace_result "xid=48" "xid=25"
-show binlog events from 98;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
+show binlog events from 102;
delete from t1;
delete from t2;
@@ -75,9 +77,9 @@ insert into t1 values(7);
commit;
select a from t1 order by a; # check that savepoints work :)
---replace_column 5 #
---replace_result "xid=70" "xid=37"
-show binlog events from 98;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
+show binlog events from 102;
# and when ROLLBACK is not explicit?
delete from t1;
@@ -97,8 +99,9 @@ connection con2;
# so SHOW BINLOG EVENTS may come before con1 does the loggin. To be sure that
# logging has been done, we use a user lock.
select get_lock("a",10);
---replace_column 5 #
-show binlog events from 98;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
+show binlog events from 102;
# and when not in a transact1on?
delete from t1;
@@ -108,9 +111,9 @@ reset master;
insert into t1 values(9);
insert into t2 select * from t1;
---replace_column 5 #
---replace_result "xid=119" "xid=60"
-show binlog events from 98;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
+show binlog events from 102;
# Check that when the query updat1ng the MyISAM table is the first in the
# transaction, we log it immediately.
@@ -121,15 +124,15 @@ reset master;
insert into t1 values(10); # first make t1 non-empty
begin;
insert into t2 select * from t1;
---replace_column 5 #
---replace_result "xid=133" "xid=66"
-show binlog events from 98;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
+show binlog events from 102;
insert into t1 values(11);
commit;
---replace_column 5 #
---replace_result "xid=133" "xid=66" "xid=136" "xid=68"
-show binlog events from 98;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
+show binlog events from 102;
# Check that things work like before this BEGIN/ROLLBACK code was added,
@@ -146,9 +149,9 @@ insert into t1 values(12);
insert into t2 select * from t1;
commit;
---replace_column 5 #
---replace_result "xid=155" "xid=78"
-show binlog events from 98;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
+show binlog events from 102;
delete from t1;
delete from t2;
@@ -159,8 +162,9 @@ insert into t1 values(13);
insert into t2 select * from t1;
rollback;
---replace_column 5 #
-show binlog events from 98;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
+show binlog events from 102;
delete from t1;
delete from t2;
@@ -174,9 +178,9 @@ insert into t2 select * from t1;
rollback to savepoint my_savepoint;
commit;
---replace_column 5 #
---replace_result "xid=187" "xid=94"
-show binlog events from 98;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
+show binlog events from 102;
delete from t1;
delete from t2;
@@ -192,9 +196,9 @@ insert into t1 values(18);
commit;
select a from t1 order by a; # check that savepoints work :)
---replace_column 5 #
---replace_result "xid=208" "xid=105"
-show binlog events from 98;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
+show binlog events from 102;
# Test for BUG#5714, where a MyISAM update in the transaction used to
# release row-level locks in InnoDB
@@ -205,7 +209,7 @@ connection con3;
delete from t1;
delete from t2;
--disable_warnings
-alter table t2 type=MyISAM;
+alter table t2 engine=MyISAM;
--enable_warnings
insert into t1 values (1);
begin;
@@ -230,8 +234,8 @@ select (@after-@before) >= 2;
drop table t1,t2;
commit;
-# test for BUG#7947 - DO RELEASE_LOCK() not written to binlog on rollback in the middle
-# of a transaction
+# test for BUG#7947 - DO RELEASE_LOCK() not written to binlog on rollback in
+# the middle of a transaction
connection con2;
begin;
@@ -253,14 +257,77 @@ insert into t2 values (3);
disconnect con2;
connection con3;
select get_lock("lock1",60);
---replace_column 5 #
---replace_result "xid=208" "xid=105" "xid=227" "xid=114" "xid=230" "xid=115" "xid=234" "xid=117" "xid=261" "xid=132"
-show binlog events from 98;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
+show binlog events from 102;
do release_lock("lock1");
drop table t0,t2;
# End of 4.1 tests
+#
+# Test behaviour of CREATE ... SELECT when mixing MyISAM and InnoDB tables
+#
+
+set autocommit=0;
+CREATE TABLE t1 (a int, b int) engine=myisam;
+reset master;
+INSERT INTO t1 values (1,1),(1,2);
+--error 1062
+CREATE TABLE t2 (primary key (a)) engine=innodb select * from t1;
+# This should give warning
+DROP TABLE if exists t2;
+INSERT INTO t1 values (3,3);
+--error 1062
+CREATE TEMPORARY TABLE t2 (primary key (a)) engine=innodb select * from t1;
+ROLLBACK;
+# This should give warning
+DROP TABLE IF EXISTS t2;
+
+CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb;
+INSERT INTO t1 VALUES (4,4);
+--error 1062
+CREATE TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
+SELECT * from t2;
+TRUNCATE table t2;
+INSERT INTO t1 VALUES (5,5);
+--error 1062
+INSERT INTO t2 select * from t1;
+SELECT * FROM t2;
+DROP TABLE t2;
+
+INSERT INTO t1 values (6,6);
+CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a)) engine=innodb ;
+INSERT INTO t1 values (7,7);
+ROLLBACK;
+INSERT INTO t1 values (8,8);
+--error 1062
+CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
+COMMIT;
+INSERT INTO t1 values (9,9);
+--error 1062
+CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
+ROLLBACK;
+SELECT * from t2;
+TRUNCATE table t2;
+INSERT INTO t1 values (10,10);
+--error 1062
+INSERT INTO t2 select * from t1;
+SELECT * from t1;
+INSERT INTO t2 values (100,100);
+--error 1062
+CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
+COMMIT;
+INSERT INTO t2 values (101,101);
+--error 1062
+CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
+ROLLBACK;
+SELECT * from t2;
+DROP TABLE t1,t2;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
+show binlog events from 102;
+
# Test for BUG#16559 (ROLLBACK should always have a zero error code in
# binlog). Has to be here and not earlier, as the SELECTs influence
# XIDs differently between normal and ps-protocol (and SHOW BINLOG
@@ -280,16 +347,3 @@ disconnect con3;
connection con4;
select get_lock("a",10); # wait for rollback to finish
-# we check that the error code of the "ROLLBACK" event is 0 and not
-# ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction
-# and does not make slave to stop)
---exec $MYSQL_BINLOG --start-position=547 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-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 */;%",
-@a not like "%#%error_code=%error_code=%";
-drop table t1, t2;
diff --git a/mysql-test/extra/rpl_tests/rpl_EE_err.test b/mysql-test/extra/rpl_tests/rpl_EE_err.test
new file mode 100644
index 00000000000..3dce12b3f4e
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_EE_err.test
@@ -0,0 +1,29 @@
+# The test is not relevant when testing replication of error codes for
+# statements that are not replicated. The test below could be changed
+# to rely on the replication of error codes for statements that are not
+# replicated row-based.
+#
+# See if an EE_ error in one event of the master's binlog stops replication
+# (it should not: in this configuration the EE_ error is probably not
+# critical). Example: you do a DROP TABLE on a table which has no MYI file
+# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and
+# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986).
+####################################
+# Change Author: JBM
+# Change Date: 2006-01-11
+# Change: Split test per lars review
+####################################
+#"REQUIREMENT: A master DROP TABLE on a table with non-existing MYI
+# file must be correctly replicated to the slave"
+####################################
+-- source include/master-slave.inc
+
+eval create table t1 (a int) engine=$engine_type;
+flush tables;
+system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
+drop table if exists t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/extra/rpl_tests/rpl_auto_increment.test b/mysql-test/extra/rpl_tests/rpl_auto_increment.test
new file mode 100644
index 00000000000..dbae317e8ab
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_auto_increment.test
@@ -0,0 +1,150 @@
+#
+# Test of auto_increment with offset
+#
+#####################################
+# By: JBM
+# Date: 2006-02-10
+# Change: NDB does not support auto inc
+# in this usage. Currently there is no
+# plan to implment. Skipping test when
+# NDB is default engine.
+#####################################
+-- source include/not_ndb_default.inc
+-- source include/master-slave.inc
+
+eval create table t1 (a int not null auto_increment,b int, primary key (a)) engine=$engine_type2 auto_increment=3;
+insert into t1 values (NULL,1),(NULL,2),(NULL,3);
+select * from t1;
+
+sync_slave_with_master;
+select * from t1;
+connection master;
+drop table t1;
+
+eval create table t1 (a int not null auto_increment,b int, primary key (a)) engine=$engine_type2;
+insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4);
+delete from t1 where b=4;
+insert into t1 values (NULL,5),(NULL,6);
+select * from t1;
+
+sync_slave_with_master;
+select * from t1;
+connection master;
+
+drop table t1;
+
+set @@session.auto_increment_increment=100, @@session.auto_increment_offset=10;
+show variables like "%auto_inc%";
+
+eval create table t1 (a int not null auto_increment, primary key (a)) engine=$engine_type2;
+# Insert with 2 insert statements to get better testing of logging
+insert into t1 values (NULL),(5),(NULL);
+insert into t1 values (250),(NULL);
+select * from t1;
+insert into t1 values (1000);
+set @@insert_id=400;
+insert into t1 values(NULL),(NULL);
+select * from t1;
+
+sync_slave_with_master;
+select * from t1;
+connection master;
+drop table t1;
+
+#
+# Same test with innodb (as the innodb code is a bit different)
+#
+eval create table t1 (a int not null auto_increment, primary key (a)) engine=$engine_type;
+# Insert with 2 insert statements to get better testing of logging
+insert into t1 values (NULL),(5),(NULL);
+insert into t1 values (250),(NULL);
+select * from t1;
+insert into t1 values (1000);
+set @@insert_id=400;
+insert into t1 values(NULL),(NULL);
+select * from t1;
+
+sync_slave_with_master;
+select * from t1;
+connection master;
+drop table t1;
+
+set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
+eval create table t1 (a int not null auto_increment, primary key (a)) engine=$engine_type2;
+# Insert with 2 insert statements to get better testing of logging
+insert into t1 values (NULL),(5),(NULL),(NULL);
+insert into t1 values (500),(NULL),(502),(NULL),(NULL);
+select * from t1;
+set @@insert_id=600;
+--error 1062
+insert into t1 values(600),(NULL),(NULL);
+set @@insert_id=600;
+insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL);
+select * from t1;
+
+sync_slave_with_master;
+select * from t1;
+connection master;
+drop table t1;
+
+#
+# Test that auto-increment works when slave has rows in the table
+#
+set @@session.auto_increment_increment=10, @@session.auto_increment_offset=1;
+
+eval create table t1 (a int not null auto_increment, primary key (a)) engine=$engine_type2;
+
+sync_slave_with_master;
+insert into t1 values(2),(12),(22),(32),(42);
+connection master;
+
+insert into t1 values (NULL),(NULL);
+insert into t1 values (3),(NULL),(NULL);
+select * from t1;
+
+sync_slave_with_master;
+select * from t1;
+
+# Test for BUG#20524 "auto_increment_* not observed when inserting
+# a too large value". When an autogenerated value was bigger than the
+# maximum possible value of the field, it was truncated to that max
+# possible value, without being "rounded down" to still honour
+# auto_increment_* variables.
+
+connection master;
+drop table t1;
+create table t1 (a tinyint not null auto_increment primary key) engine=myisam;
+insert into t1 values(103);
+set auto_increment_increment=11;
+set auto_increment_offset=4;
+insert into t1 values(null);
+insert into t1 values(null);
+--error 1062
+insert into t1 values(null);
+select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t1 order by a;
+
+# same but with a larger value
+create table t2 (a tinyint unsigned not null auto_increment primary key) engine=myisam;
+set auto_increment_increment=10;
+set auto_increment_offset=1;
+set insert_id=1000;
+insert into t2 values(null);
+select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t2 order by a;
+
+# An offset so big that even first value does not fit
+create table t3 like t1;
+set auto_increment_increment=1000;
+set auto_increment_offset=700;
+insert into t3 values(null);
+select * from t3 order by a;
+sync_slave_with_master;
+select * from t1 order by a;
+select * from t2 order by a;
+select * from t3 order by a;
+
+connection master;
+
+drop table t1,t2,t3;
+
+# End cleanup
+sync_slave_with_master;
diff --git a/mysql-test/extra/rpl_tests/rpl_commit_after_flush.test b/mysql-test/extra/rpl_tests/rpl_commit_after_flush.test
new file mode 100644
index 00000000000..d63d7e4b07d
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_commit_after_flush.test
@@ -0,0 +1,22 @@
+#################################
+# Test updated to use a wrapper #
+#################################
+
+-- source include/master-slave.inc
+
+eval CREATE TABLE t1 (a INT) ENGINE=$engine_type;
+
+begin;
+insert into t1 values(1);
+flush tables with read lock;
+commit;
+save_master_pos;
+connection slave;
+sync_with_master;
+# cleanup
+connection master;
+unlock tables;
+drop table t1;
+sync_slave_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/extra/rpl_tests/rpl_ddl.test b/mysql-test/extra/rpl_tests/rpl_ddl.test
new file mode 100644
index 00000000000..15794e5e035
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_ddl.test
@@ -0,0 +1,507 @@
+######################## rpl_ddl.test ########################
+# #
+# DDL statements (sometimes with implicit COMMIT) executed #
+# by the master and it's propagation into the slave #
+# #
+##############################################################
+
+#
+# NOTE, PLEASE BE CAREFUL, WHEN MODIFYING THE TESTS !!
+#
+# 1. !All! objects to be dropped, renamed, altered ... must be created
+# in AUTOCOMMIT= 1 mode before AUTOCOMMIT is set to 0 and the test
+# sequences start.
+#
+# 2. Never use a test object, which was direct or indirect affected by a
+# preceeding test sequence again.
+# Except table d1.t1 where ONLY DML is allowed.
+#
+# If one preceeding test sequence hits a (sometimes not good visible,
+# because the sql error code of the statement might be 0) bug
+# and these rules are ignored, a following test sequence might earn ugly
+# effects like failing 'sync_slave_with_master', crashes of the slave or
+# abort of the test case etc..
+#
+# 3. The assignment of the DDL command to be tested to $my_stmt can
+# be a bit difficult. "'" must be avoided, because the test
+# routine "include/rpl_stmt_seq.inc" performs a
+# eval SELECT CONCAT('######## ','$my_stmt',' ########') as "";
+#
+
+###############################################################
+# Some preparations
+###############################################################
+# The sync_slave_with_master is needed to make the xids deterministic.
+sync_slave_with_master;
+connection master;
+
+SET AUTOCOMMIT = 1;
+#
+# 1. DROP all objects, which probably already exist, but must be created here
+#
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+DROP DATABASE IF EXISTS mysqltest3;
+--enable_warnings
+#
+# 2. CREATE all objects needed
+# working database is mysqltest1
+# working (transactional!) is mysqltest1.t1
+#
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+eval CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=$engine_type;
+INSERT INTO mysqltest1.t1 SET f1= 0;
+eval CREATE TABLE mysqltest1.t2 (f1 BIGINT) ENGINE=$engine_type;
+eval CREATE TABLE mysqltest1.t3 (f1 BIGINT) ENGINE=$engine_type;
+eval CREATE TABLE mysqltest1.t4 (f1 BIGINT) ENGINE=$engine_type;
+eval CREATE TABLE mysqltest1.t5 (f1 BIGINT) ENGINE=$engine_type;
+eval CREATE TABLE mysqltest1.t6 (f1 BIGINT) ENGINE=$engine_type;
+CREATE INDEX my_idx6 ON mysqltest1.t6(f1);
+eval CREATE TABLE mysqltest1.t7 (f1 BIGINT) ENGINE=$engine_type;
+INSERT INTO mysqltest1.t7 SET f1= 0;
+eval CREATE TABLE mysqltest1.t8 (f1 BIGINT) ENGINE=$engine_type;
+eval CREATE TABLE mysqltest1.t9 (f1 BIGINT) ENGINE=$engine_type;
+eval CREATE TABLE mysqltest1.t10 (f1 BIGINT) ENGINE=$engine_type;
+eval CREATE TABLE mysqltest1.t11 (f1 BIGINT) ENGINE=$engine_type;
+eval CREATE TABLE mysqltest1.t12 (f1 BIGINT) ENGINE=$engine_type;
+eval CREATE TABLE mysqltest1.t13 (f1 BIGINT) ENGINE=$engine_type;
+eval CREATE TABLE mysqltest1.t14 (f1 BIGINT) ENGINE=$engine_type;
+eval CREATE TABLE mysqltest1.t15 (f1 BIGINT) ENGINE=$engine_type;
+eval CREATE TABLE mysqltest1.t16 (f1 BIGINT) ENGINE=$engine_type;
+eval CREATE TABLE mysqltest1.t17 (f1 BIGINT) ENGINE=$engine_type;
+eval CREATE TABLE mysqltest1.t18 (f1 BIGINT) ENGINE=$engine_type;
+eval CREATE TABLE mysqltest1.t19 (f1 BIGINT) ENGINE=$engine_type;
+CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT);
+
+#
+# 3. master sessions: never do AUTOCOMMIT
+# slave sessions: never do AUTOCOMMIT
+#
+SET AUTOCOMMIT = 0;
+use mysqltest1;
+sync_slave_with_master;
+connection slave;
+--disable_query_log
+SELECT '-------- switch to slave --------' as "";
+--enable_query_log
+SET AUTOCOMMIT = 0;
+use mysqltest1;
+connection master;
+--disable_query_log
+SELECT '-------- switch to master -------' as "";
+--enable_query_log
+
+
+# We don't want to abort the whole test if one statement sent
+# to the server gets an error, because the following test
+# sequences are nearly independend of the previous statements.
+--disable_abort_on_error
+
+###############################################################
+# Banal case: (explicit) COMMIT and ROLLBACK
+# Just for checking if the test sequence is usable
+###############################################################
+
+let $my_stmt= COMMIT;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+
+let $my_stmt= ROLLBACK;
+let $my_master_commit= false;
+let $my_slave_commit= false;
+--source include/rpl_stmt_seq.inc
+
+###############################################################
+# Cases with commands very similar to COMMIT
+###############################################################
+
+let $my_stmt= SET AUTOCOMMIT=1;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+SET AUTOCOMMIT=0;
+
+let $my_stmt= START TRANSACTION;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+
+let $my_stmt= BEGIN;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+
+###############################################################
+# Cases with (BASE) TABLES and (UPDATABLE) VIEWs
+###############################################################
+
+let $my_stmt= DROP TABLE mysqltest1.t2;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+SHOW TABLES LIKE 't2';
+connection slave;
+--disable_query_log
+SELECT '-------- switch to slave --------' as "";
+--enable_query_log
+SHOW TABLES LIKE 't2';
+connection master;
+--disable_query_log
+SELECT '-------- switch to master -------' as "";
+--enable_query_log
+
+# Note: Since this test is executed with a skip-innodb slave, the
+# slave incorrectly commits the insert. One can *not* have InnoDB on
+# master and MyISAM on slave and expect that a transactional rollback
+# after a CREATE TEMPORARY TABLE should work correctly on the slave.
+# For this to work properly the handler on the slave must be able to
+# handle transactions (e.g. InnoDB or NDB).
+let $my_stmt= DROP TEMPORARY TABLE mysqltest1.t23;
+let $my_master_commit= false;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+SHOW TABLES LIKE 't23';
+connection slave;
+--disable_query_log
+SELECT '-------- switch to slave --------' as "";
+--enable_query_log
+SHOW TABLES LIKE 't23';
+connection master;
+--disable_query_log
+SELECT '-------- switch to master -------' as "";
+--enable_query_log
+
+let $my_stmt= RENAME TABLE mysqltest1.t3 to mysqltest1.t20;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+SHOW TABLES LIKE 't20';
+connection slave;
+--disable_query_log
+SELECT '-------- switch to slave --------' as "";
+--enable_query_log
+SHOW TABLES LIKE 't20';
+connection master;
+--disable_query_log
+SELECT '-------- switch to master -------' as "";
+--enable_query_log
+
+let $my_stmt= ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+describe mysqltest1.t4;
+connection slave;
+--disable_query_log
+SELECT '-------- switch to slave --------' as "";
+--enable_query_log
+describe mysqltest1.t4;
+connection master;
+--disable_query_log
+SELECT '-------- switch to master -------' as "";
+--enable_query_log
+
+let $my_stmt= CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE=;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq2.inc
+
+# Note: Since this test is executed with a skip-innodb slave, the
+# slave incorrectly commits the insert. One can *not* have InnoDB on
+# master and MyISAM on slave and expect that a transactional rollback
+# after a CREATE TEMPORARY TABLE should work correctly on the slave.
+# For this to work properly the handler on the slave must be able to
+# handle transactions (e.g. InnoDB or NDB).
+let $engine='';
+let $eng_type='';
+
+let $my_stmt= CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT);
+let $my_master_commit= false;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+
+let $my_stmt= TRUNCATE TABLE mysqltest1.t7;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+SELECT * FROM mysqltest1.t7;
+--echo -------- switch to slave --------
+sync_slave_with_master;
+SELECT * FROM mysqltest1.t7;
+--echo -------- switch to master -------
+connection master;
+
+###############################################################
+# Cases with LOCK/UNLOCK
+###############################################################
+
+# MySQL insists in locking mysqltest1.t1, because rpl_stmt_seq performs an
+# INSERT into this table.
+let $my_stmt= LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+UNLOCK TABLES;
+
+# No prior locking
+let $my_stmt= UNLOCK TABLES;
+let $my_master_commit= false;
+let $my_slave_commit= false;
+--source include/rpl_stmt_seq.inc
+
+# With prior read locking
+# Note that this test generate an error since the rpl_stmt_seq.inc
+# tries to insert into t1.
+LOCK TABLES mysqltest1.t1 READ;
+let $my_stmt= UNLOCK TABLES;
+let $my_master_commit= false;
+let $my_slave_commit= false;
+--source include/rpl_stmt_seq.inc
+
+# With prior write locking
+LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ;
+let $my_stmt= UNLOCK TABLES;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+
+###############################################################
+# Cases with INDEXES
+###############################################################
+
+let $my_stmt= DROP INDEX my_idx6 ON mysqltest1.t6;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+SHOW INDEX FROM mysqltest1.t6;
+connection slave;
+--disable_query_log
+SELECT '-------- switch to slave --------' as "";
+--enable_query_log
+SHOW INDEX FROM mysqltest1.t6;
+connection master;
+--disable_query_log
+SELECT '-------- switch to master -------' as "";
+--enable_query_log
+
+let $my_stmt= CREATE INDEX my_idx5 ON mysqltest1.t5(f1);
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+SHOW INDEX FROM mysqltest1.t5;
+connection slave;
+--disable_query_log
+SELECT '-------- switch to slave --------' as "";
+--enable_query_log
+SHOW INDEX FROM mysqltest1.t5;
+connection master;
+--disable_query_log
+SELECT '-------- switch to master -------' as "";
+--enable_query_log
+
+###############################################################
+# Cases with DATABASE
+###############################################################
+
+let $my_stmt= DROP DATABASE mysqltest2;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+SHOW DATABASES LIKE "mysqltest2";
+connection slave;
+--disable_query_log
+SELECT '-------- switch to slave --------' as "";
+--enable_query_log
+SHOW DATABASES LIKE "mysqltest2";
+connection master;
+--disable_query_log
+SELECT '-------- switch to master -------' as "";
+--enable_query_log
+
+let $my_stmt= CREATE DATABASE mysqltest3;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+SHOW DATABASES LIKE "mysqltest3";
+connection slave;
+--disable_query_log
+SELECT '-------- switch to slave --------' as "";
+--enable_query_log
+SHOW DATABASES LIKE "mysqltest3";
+connection master;
+--disable_query_log
+SELECT '-------- switch to master -------' as "";
+--enable_query_log
+
+# End of 4.1 tests
+
+###############################################################
+# Cases with stored procedures
+###############################################################
+let $my_stmt= CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1";
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+--vertical_results
+--replace_column 5 # 6 #
+SHOW PROCEDURE STATUS LIKE 'p1';
+--disable_query_log
+SELECT '-------- switch to slave -------' as "";
+--enable_query_log
+connection slave;
+--replace_column 5 # 6 #
+SHOW PROCEDURE STATUS LIKE 'p1';
+connection master;
+--horizontal_results
+
+let $my_stmt= ALTER PROCEDURE p1 COMMENT "I have been altered";
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+--vertical_results
+--replace_column 5 # 6 #
+SHOW PROCEDURE STATUS LIKE 'p1';
+--disable_query_log
+SELECT '-------- switch to slave -------' as "";
+--enable_query_log
+connection slave;
+--replace_column 5 # 6 #
+SHOW PROCEDURE STATUS LIKE 'p1';
+connection master;
+--horizontal_results
+
+let $my_stmt= DROP PROCEDURE p1;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+--vertical_results
+SHOW PROCEDURE STATUS LIKE 'p1';
+--disable_query_log
+SELECT '-------- switch to slave -------' as "";
+--enable_query_log
+connection slave;
+SHOW PROCEDURE STATUS LIKE 'p1';
+connection master;
+--horizontal_results
+
+###############################################################
+# Cases with VIEWs
+###############################################################
+let $my_stmt= CREATE OR REPLACE VIEW v1 as select * from t1;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+SHOW CREATE VIEW v1;
+--disable_query_log
+SELECT '-------- switch to slave -------' as "";
+--enable_query_log
+connection slave;
+SHOW CREATE VIEW v1;
+connection master;
+
+let $my_stmt= ALTER VIEW v1 AS select f1 from t1;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+SHOW CREATE VIEW v1;
+--disable_query_log
+SELECT '-------- switch to slave -------' as "";
+--enable_query_log
+connection slave;
+SHOW CREATE VIEW v1;
+connection master;
+
+let $my_stmt= DROP VIEW IF EXISTS v1;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+--error 1146
+SHOW CREATE VIEW v1;
+--disable_query_log
+SELECT '-------- switch to slave -------' as "";
+--enable_query_log
+connection slave;
+--error 1146
+SHOW CREATE VIEW v1;
+connection master;
+
+###############################################################
+# Cases with TRIGGERs
+###############################################################
+let $my_stmt= CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+SHOW TRIGGERS;
+--disable_query_log
+SELECT '-------- switch to slave -------' as "";
+--enable_query_log
+connection slave;
+SHOW TRIGGERS;
+connection master;
+
+let $my_stmt= DROP TRIGGER trg1;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+SHOW TRIGGERS;
+--disable_query_log
+SELECT '-------- switch to slave -------' as "";
+--enable_query_log
+connection slave;
+SHOW TRIGGERS;
+connection master;
+
+###############################################################
+# Cases with USERs
+###############################################################
+let $my_stmt= CREATE USER user1@localhost;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+SELECT user FROM mysql.user WHERE user = 'user1';
+--disable_query_log
+SELECT '-------- switch to slave -------' as "";
+--enable_query_log
+connection slave;
+SELECT user FROM mysql.user WHERE user = 'user1';
+connection master;
+
+let $my_stmt= RENAME USER user1@localhost TO rename1@localhost;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+SELECT user FROM mysql.user WHERE user = 'rename1';
+--disable_query_log
+SELECT '-------- switch to slave -------' as "";
+--enable_query_log
+connection slave;
+SELECT user FROM mysql.user WHERE user = 'rename1';
+connection master;
+
+let $my_stmt= DROP USER rename1@localhost;
+let $my_master_commit= true;
+let $my_slave_commit= true;
+--source include/rpl_stmt_seq.inc
+SELECT user FROM mysql.user WHERE user = 'rename1';
+--disable_query_log
+SELECT '-------- switch to slave -------' as "";
+--enable_query_log
+connection slave;
+SELECT user FROM mysql.user WHERE user = 'rename1';
+connection master;
+
+###############################################################
+# Cleanup
+###############################################################
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+DROP DATABASE IF EXISTS mysqltest3;
+--enable_warnings
+
+-- source include/master-slave-end.inc
+
diff --git a/mysql-test/t/rpl_deadlock.test b/mysql-test/extra/rpl_tests/rpl_deadlock.test
index 1a48e4d417c..adf35a92dc6 100644
--- a/mysql-test/t/rpl_deadlock.test
+++ b/mysql-test/extra/rpl_tests/rpl_deadlock.test
@@ -10,14 +10,13 @@
# We don't 'show status like 'slave_retried_transactions'' because this
# is not repeatable (depends on sleeps).
-source include/have_innodb.inc;
-source include/master-slave.inc;
+-- source include/master-slave.inc
connection master;
-create table t1 (a int not null, key(a)) engine=innodb;
-create table t2 (a int not null, key(a)) engine=innodb;
-create table t3 (a int) engine=innodb;
-create table t4 (a int) engine=innodb;
+eval CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=$engine_type;
+eval CREATE TABLE t2 (a INT NOT NULL, KEY(a)) ENGINE=$engine_type;
+eval CREATE TABLE t3 (a INT) ENGINE=$engine_type;
+eval CREATE TABLE t4 (a INT) ENGINE=$engine_type;
show variables like 'slave_transaction_retries';
sync_slave_with_master;
@@ -65,7 +64,7 @@ sync_with_master;
select * from t1; # check that slave succeeded finally
select * from t2;
# check that no error is reported
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 #
--replace_result $MASTER_MYPORT MASTER_MYPORT
--vertical_results
show slave status;
@@ -74,7 +73,7 @@ show slave status;
# 2) Test lock wait timeout
stop slave;
-change master to master_log_pos=532; # the BEGIN log event
+change master to master_log_pos=536; # the BEGIN log event
begin;
select * from t2 for update; # hold lock
start slave;
@@ -84,7 +83,7 @@ sync_with_master;
select * from t1; # check that slave succeeded finally
select * from t2;
# check that no error is reported
---replace_column 1 # 8 # 9 # 11 # 23 # 33 #
+--replace_column 1 # 7 # 8 # 9 # 11 # 16 # 22 # 23 # 33 #
--replace_result $MASTER_MYPORT MASTER_MYPORT
--vertical_results
show slave status;
@@ -97,7 +96,7 @@ set global max_relay_log_size=0;
# This is really copy-paste of 2) of above
stop slave;
-change master to master_log_pos=532;
+change master to master_log_pos=536;
begin;
select * from t2 for update;
start slave;
@@ -106,7 +105,7 @@ commit;
sync_with_master;
select * from t1;
select * from t2;
---replace_column 1 # 8 # 9 # 11 # 23 # 33 #
+--replace_column 1 # 7 # 8 # 9 # 11 # 16 # 22 # 23 # 33 #
--replace_result $MASTER_MYPORT MASTER_MYPORT
--vertical_results
show slave status;
diff --git a/mysql-test/extra/rpl_tests/rpl_delete_no_where.test b/mysql-test/extra/rpl_tests/rpl_delete_no_where.test
new file mode 100644
index 00000000000..4db9e0fb63f
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_delete_no_where.test
@@ -0,0 +1,19 @@
+# Test to see if a DELETE which triggers a fast deletion of all rows
+# (not internally row-per-row but more like a TRUNCATE, MyISAM
+# supports that), is replicated (BUG#13576).
+
+-- source include/master-slave.inc
+
+eval create table t1 (a int, b int) engine=$engine_type;
+insert into t1 values(1,1);
+sync_slave_with_master;
+select * from t1;
+connection master;
+delete from t1;
+sync_slave_with_master;
+select * from t1;
+
+# cleanup
+connection master;
+drop table t1;
+sync_slave_with_master;
diff --git a/mysql-test/extra/rpl_tests/rpl_failed_optimize.test b/mysql-test/extra/rpl_tests/rpl_failed_optimize.test
new file mode 100644
index 00000000000..0c537ee188d
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_failed_optimize.test
@@ -0,0 +1,24 @@
+-- source include/master-slave.inc
+
+#
+# BUG#5551 "Failed OPTIMIZE TABLE is logged to binary log"
+# Replication should work when OPTIMIZE TABLE timeouts, and
+# when OPTIMIZE TABLE is executed on a non-existing table
+#
+
+eval CREATE TABLE t1 ( a int ) ENGINE=$engine_type;
+BEGIN;
+INSERT INTO t1 VALUES (1);
+
+connection master1;
+OPTIMIZE TABLE t1;
+
+OPTIMIZE TABLE non_existing;
+sync_slave_with_master;
+
+# End of 4.1 tests
+
+connection master;
+select * from t1;
+commit;
+drop table t1;
diff --git a/mysql-test/t/rpl_flush_tables.test b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test
index f7c8774286a..ee6b0ed1426 100644
--- a/mysql-test/t/rpl_flush_tables.test
+++ b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test
@@ -1,12 +1,11 @@
-#
+# depends on the binlog output
# Test of replicating FLUSH TABLES to make
# RENAME TABLE work with MERGE tables on the slave.
# Test of FLUSH NO_WRITE_TO_BINLOG by the way.
#
---source include/master-slave.inc
-# Skipped on Windows because it can't handle a table underlying an open
-# merge table getting renamed.
---source include/not_windows.inc
+
+
+-- source include/master-slave.inc
let $SERVER_VERSION=`select version()`;
@@ -24,7 +23,8 @@ flush no_write_to_binlog tables;
# Check that it's not in the binlog.
--replace_result $SERVER_VERSION SERVER_VERSION
--replace_column 2 # 5 #
-show binlog events;
+--replace_regex /table_id: [0-9]+/table_id: #/
+eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
# Check that the master is not confused.
select * from t3;
# This FLUSH should go into the binlog to not confuse the slave.
@@ -32,7 +32,8 @@ flush tables;
# Check that it's in the binlog.
--replace_result $SERVER_VERSION SERVER_VERSION
--replace_column 2 # 5 #
-show binlog events;
+--replace_regex /table_id: [0-9]+/table_id: #/
+eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
save_master_pos;
connection slave;
sync_with_master;
@@ -55,4 +56,4 @@ connection master;
drop table t3, t4, t5;
# End of 4.1 tests
-# Adding comment for force manual merge 5.0 -> wl1012. Delete me if needed.
+
diff --git a/mysql-test/extra/rpl_tests/rpl_foreign_key.test b/mysql-test/extra/rpl_tests/rpl_foreign_key.test
new file mode 100644
index 00000000000..0f4cd856db6
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_foreign_key.test
@@ -0,0 +1,34 @@
+# Check the replication of the FOREIGN_KEY_CHECKS variable.
+
+-- source include/master-slave.inc
+
+eval CREATE TABLE t1 (a INT AUTO_INCREMENT KEY) ENGINE=$engine_type;
+eval CREATE TABLE t2 (b INT AUTO_INCREMENT KEY, c INT, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE=$engine_type;
+
+SET FOREIGN_KEY_CHECKS=0;
+INSERT INTO t1 VALUES (10);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL);
+INSERT INTO t2 VALUES (5,0);
+INSERT INTO t2 VALUES (NULL,LAST_INSERT_ID());
+SET FOREIGN_KEY_CHECKS=1;
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY b;
+sync_slave_with_master;
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY b;
+
+connection master;
+SET TIMESTAMP=1000000000;
+CREATE TABLE t3 ( a INT UNIQUE );
+SET FOREIGN_KEY_CHECKS=0;
+# Had to add 1022 for run with ndb as ndb uses different
+# error and error code for 1062. Bug 16677
+--error 1022, 1062
+INSERT INTO t3 VALUES (1),(1);
+sync_slave_with_master;
+
+connection master;
+SET FOREIGN_KEY_CHECKS=0;
+DROP TABLE IF EXISTS t1,t2,t3;
+SET FOREIGN_KEY_CHECKS=1;
+sync_slave_with_master;
diff --git a/mysql-test/extra/rpl_tests/rpl_insert_id.test b/mysql-test/extra/rpl_tests/rpl_insert_id.test
new file mode 100644
index 00000000000..33194270d37
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_insert_id.test
@@ -0,0 +1,488 @@
+###########################################################
+# 2006-02-01: By JBM: Added 1022, ORDER BY
+###########################################################
+# See if queries that use both auto_increment and LAST_INSERT_ID()
+# are replicated well
+############################################################
+# REQUIREMENT
+# Auto increment should work for a table with an auto_increment
+# column and index but without primary key.
+##############################################################
+
+--echo #
+--echo # Setup
+--echo #
+
+use test;
+--disable_warnings
+drop table if exists t1, t2, t3;
+--enable_warnings
+
+--echo #
+--echo # See if queries that use both auto_increment and LAST_INSERT_ID()
+--echo # are replicated well
+--echo #
+--echo # We also check how the foreign_key_check variable is replicated
+--echo #
+
+-- source include/master-slave.inc
+#should work for both SBR and RBR
+
+connection master;
+create table t1(a int auto_increment, key(a));
+create table t2(b int auto_increment, c int, key(b));
+insert into t1 values (1),(2),(3);
+insert into t1 values (null);
+insert into t2 values (null,last_insert_id());
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from t1 ORDER BY a;
+select * from t2 ORDER BY b;
+connection master;
+#check if multi-line inserts,
+#which set last_insert_id to the first id inserted,
+#are replicated the same way
+drop table t1;
+drop table t2;
+--disable_warnings
+eval create table t1(a int auto_increment, key(a)) engine=$engine_type;
+eval create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=$engine_type;
+--enable_warnings
+SET FOREIGN_KEY_CHECKS=0;
+insert into t1 values (10);
+insert into t1 values (null),(null),(null);
+insert into t2 values (5,0);
+insert into t2 values (null,last_insert_id());
+SET FOREIGN_KEY_CHECKS=1;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from t1;
+select * from t2;
+connection master;
+
+--echo #
+--echo # check if INSERT SELECT in auto_increment is well replicated (bug #490)
+--echo #
+
+drop table t2;
+drop table t1;
+create table t1(a int auto_increment, key(a));
+create table t2(b int auto_increment, c int, key(b));
+insert into t1 values (10);
+insert into t1 values (null),(null),(null);
+insert into t2 values (5,0);
+insert into t2 (c) select * from t1 ORDER BY a;
+select * from t2 ORDER BY b;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from t1 ORDER BY a;
+select * from t2 ORDER BY b;
+connection master;
+drop table t1;
+drop table t2;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+--echo #
+--echo # Bug#8412: Error codes reported in binary log for CHARACTER SET,
+--echo # FOREIGN_KEY_CHECKS
+--echo #
+
+connection master;
+SET TIMESTAMP=1000000000;
+CREATE TABLE t1 ( a INT UNIQUE );
+SET FOREIGN_KEY_CHECKS=0;
+# Duplicate Key Errors
+--error 1022, 1062
+INSERT INTO t1 VALUES (1),(1);
+sync_slave_with_master;
+connection master;
+drop table t1;
+sync_slave_with_master;
+
+--echo #
+--echo # Bug#14553: NULL in WHERE resets LAST_INSERT_ID
+--echo #
+
+connection master;
+create table t1(a int auto_increment, key(a));
+create table t2(a int);
+insert into t1 (a) values (null);
+insert into t2 (a) select a from t1 where a is null;
+insert into t2 (a) select a from t1 where a is null;
+select * from t2;
+sync_slave_with_master;
+connection slave;
+select * from t2;
+connection master;
+drop table t1;
+drop table t2;
+
+--echo #
+--echo # End of 4.1 tests
+--echo #
+
+--echo #
+--echo # BUG#15728: LAST_INSERT_ID function inside a stored function returns 0
+--echo #
+--echo # The solution is not to reset last_insert_id on enter to sub-statement.
+--echo #
+
+connection master;
+--disable_warnings
+drop function if exists bug15728;
+drop function if exists bug15728_insert;
+drop table if exists t1, t2;
+--enable_warnings
+
+create table t1 (
+ id int not null auto_increment,
+ last_id int,
+ primary key (id)
+);
+create function bug15728() returns int(11)
+ return last_insert_id();
+
+insert into t1 (last_id) values (0);
+insert into t1 (last_id) values (last_insert_id());
+insert into t1 (last_id) values (bug15728());
+
+# Check that nested call replicates too.
+create table t2 (
+ id int not null auto_increment,
+ last_id int,
+ primary key (id)
+);
+delimiter |;
+create function bug15728_insert() returns int(11) modifies sql data
+begin
+ insert into t2 (last_id) values (bug15728());
+ return bug15728();
+end|
+create trigger t1_bi before insert on t1 for each row
+begin
+ declare res int;
+ select bug15728_insert() into res;
+ set NEW.last_id = res;
+end|
+delimiter ;|
+
+insert into t1 (last_id) values (0);
+
+drop trigger t1_bi;
+
+# Check that nested call doesn't affect outer context.
+select last_insert_id();
+select bug15728_insert();
+select last_insert_id();
+insert into t1 (last_id) values (bug15728());
+# This should be exactly one greater than in the previous call.
+select last_insert_id();
+
+# BUG#20339 - stored procedure using LAST_INSERT_ID() does not
+# replicate statement-based
+--disable_warnings
+drop procedure if exists foo;
+--enable_warnings
+delimiter |;
+create procedure foo()
+begin
+ declare res int;
+ insert into t2 (last_id) values (bug15728());
+ insert into t1 (last_id) values (bug15728());
+end|
+delimiter ;|
+call foo();
+
+select * from t1;
+select * from t2;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from t1;
+select * from t2;
+connection master;
+
+drop function bug15728;
+drop function bug15728_insert;
+drop table t1;
+drop procedure foo;
+
+# test of BUG#20188 REPLACE or ON DUPLICATE KEY UPDATE in
+# auto_increment breaks binlog
+
+create table t1 (n int primary key auto_increment not null,
+b int, unique(b));
+
+# First, test that we do not call restore_auto_increment() too early
+# in write_record():
+set sql_log_bin=0;
+insert into t1 values(null,100);
+replace into t1 values(null,50),(null,100),(null,150);
+select * from t1 order by n;
+truncate table t1;
+set sql_log_bin=1;
+
+insert into t1 values(null,100);
+select * from t1 order by n;
+sync_slave_with_master;
+# make slave's table autoinc counter bigger
+insert into t1 values(null,200),(null,300);
+delete from t1 where b <> 100;
+# check that slave's table content is identical to master
+select * from t1 order by n;
+# only the auto_inc counter differs.
+
+connection master;
+replace into t1 values(null,100),(null,350);
+select * from t1 order by n;
+sync_slave_with_master;
+select * from t1 order by n;
+
+# Same test as for REPLACE, but for ON DUPLICATE KEY UPDATE
+
+# We first check that if we update a row using a value larger than the
+# table's counter, the counter for next row is bigger than the
+# after-value of the updated row.
+connection master;
+insert into t1 values (NULL,400),(3,500),(NULL,600) on duplicate key UPDATE n=1000;
+select * from t1 order by n;
+sync_slave_with_master;
+select * from t1 order by n;
+
+# and now test for the bug:
+connection master;
+drop table t1;
+create table t1 (n int primary key auto_increment not null,
+b int, unique(b));
+insert into t1 values(null,100);
+select * from t1 order by n;
+sync_slave_with_master;
+insert into t1 values(null,200),(null,300);
+delete from t1 where b <> 100;
+select * from t1 order by n;
+
+connection master;
+insert into t1 values(null,100),(null,350) on duplicate key update n=2;
+select * from t1 order by n;
+sync_slave_with_master;
+select * from t1 order by n;
+
+connection master;
+drop table t1;
+sync_slave_with_master;
+
+
+#
+# BUG#20339: stored procedure using LAST_INSERT_ID() does not
+# replicate statement-based.
+#
+# There is another version of the test for bug#20339 above that is
+# actually originates in 5.1, and this is the version that is merged
+# from 5.0.
+#
+connection master;
+
+--disable_warnings
+DROP PROCEDURE IF EXISTS p1;
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+# Reset result of LAST_INSERT_ID().
+SELECT LAST_INSERT_ID(0);
+
+CREATE TABLE t1 (
+ id INT NOT NULL DEFAULT 0,
+ last_id INT,
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE t2 (
+ id INT NOT NULL AUTO_INCREMENT,
+ last_id INT,
+ PRIMARY KEY (id)
+);
+
+delimiter |;
+CREATE PROCEDURE p1()
+BEGIN
+ INSERT INTO t2 (last_id) VALUES (LAST_INSERT_ID());
+ INSERT INTO t1 (last_id) VALUES (LAST_INSERT_ID());
+END|
+delimiter ;|
+
+CALL p1();
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+sync_slave_with_master;
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+connection master;
+
+DROP PROCEDURE p1;
+DROP TABLE t1, t2;
+
+
+#
+# BUG#21726: Incorrect result with multiple invocations of
+# LAST_INSERT_ID
+#
+--disable_warnings
+DROP PROCEDURE IF EXISTS p1;
+DROP FUNCTION IF EXISTS f1;
+DROP FUNCTION IF EXISTS f2;
+DROP FUNCTION IF EXISTS f3;
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+CREATE TABLE t1 (
+ i INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ j INT DEFAULT 0
+);
+CREATE TABLE t2 (i INT);
+
+delimiter |;
+CREATE PROCEDURE p1()
+BEGIN
+ INSERT INTO t1 (i) VALUES (NULL);
+ INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
+ INSERT INTO t1 (i) VALUES (NULL), (NULL);
+ INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
+END |
+
+CREATE FUNCTION f1() RETURNS INT MODIFIES SQL DATA
+BEGIN
+ INSERT INTO t1 (i) VALUES (NULL);
+ INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
+ INSERT INTO t1 (i) VALUES (NULL), (NULL);
+ INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
+ RETURN 0;
+END |
+
+CREATE FUNCTION f2() RETURNS INT NOT DETERMINISTIC
+ RETURN LAST_INSERT_ID() |
+
+CREATE FUNCTION f3() RETURNS INT MODIFIES SQL DATA
+BEGIN
+ INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
+ RETURN 0;
+END |
+delimiter ;|
+
+INSERT INTO t1 VALUES (NULL, -1);
+CALL p1();
+SELECT f1();
+INSERT INTO t1 VALUES (NULL, f2()), (NULL, LAST_INSERT_ID()),
+ (NULL, LAST_INSERT_ID()), (NULL, f2()), (NULL, f2());
+INSERT INTO t1 VALUES (NULL, f2());
+INSERT INTO t1 VALUES (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID(5)),
+ (NULL, @@LAST_INSERT_ID);
+# Test replication of substitution "IS NULL" -> "= LAST_INSERT_ID".
+INSERT INTO t1 VALUES (NULL, 0), (NULL, LAST_INSERT_ID());
+UPDATE t1 SET j= -1 WHERE i IS NULL;
+
+# Test statement-based replication of function calls.
+INSERT INTO t1 (i) VALUES (NULL);
+
+connection master1;
+INSERT INTO t1 (i) VALUES (NULL);
+
+connection master;
+SELECT f3();
+
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+sync_slave_with_master;
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+connection master;
+DROP PROCEDURE p1;
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP FUNCTION f3;
+DROP TABLE t1, t2;
+
+
+sync_slave_with_master;
+
+--echo #
+--echo # End of 5.0 tests
+--echo #
+
+# Tests in this file are tightly bound together. Recreate t2.
+connection master;
+create table t2 (
+ id int not null auto_increment,
+ last_id int,
+ primary key (id)
+);
+
+
+# Test for BUG#20341 "stored function inserting into one
+# auto_increment puts bad data in slave"
+
+connection master;
+truncate table t2;
+create table t1 (id tinyint primary key); # no auto_increment
+
+delimiter |;
+create function insid() returns int
+begin
+ insert into t2 (last_id) values (0);
+ return 0;
+end|
+delimiter ;|
+set sql_log_bin=0;
+insert into t2 (id) values(1),(2),(3);
+delete from t2;
+set sql_log_bin=1;
+#inside SELECT, then inside INSERT
+select insid();
+set sql_log_bin=0;
+insert into t2 (id) values(5),(6),(7);
+delete from t2 where id>=5;
+set sql_log_bin=1;
+insert into t1 select insid();
+select * from t1;
+select * from t2;
+
+sync_slave_with_master;
+select * from t1;
+select * from t2;
+
+connection master;
+drop table t1;
+drop function insid;
+
+truncate table t2;
+create table t1 (n int primary key auto_increment not null,
+b int, unique(b));
+delimiter |;
+create procedure foo()
+begin
+ insert into t1 values(null,10);
+ insert ignore into t1 values(null,10);
+ insert ignore into t1 values(null,10);
+ insert into t2 values(null,3);
+end|
+delimiter ;|
+call foo();
+select * from t1;
+select * from t2;
+
+sync_slave_with_master;
+select * from t1;
+select * from t2;
+
+connection master;
+drop table t1, t2;
+drop procedure foo;
+sync_slave_with_master;
diff --git a/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test b/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test
new file mode 100644
index 00000000000..6feafc5a9a7
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test
@@ -0,0 +1,88 @@
+###########################################################
+# 2006-02-08: By JBM:
+###########################################################
+# See if queries that use both auto_increment and LAST_INSERT_ID()
+# are replicated well
+############################################################
+# REQUIREMENT
+# Auto increment should work for a table with auto_increment column
+# and primary key.
+##############################################################
+
+# We also check how the foreign_key_check variable is replicated
+
+-- source include/master-slave.inc
+#should work for both SBR and RBR
+
+connection master;
+create table t1(a int auto_increment, primary key(a));
+create table t2(b int auto_increment, c int, primary key(b));
+insert into t1 values (1),(2),(3);
+insert into t1 values (null);
+insert into t2 values (null,last_insert_id());
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from t1 ORDER BY a;
+select * from t2 ORDER BY b;
+connection master;
+#check if multi-line inserts,
+#which set last_insert_id to the first id inserted,
+#are replicated the same way
+drop table t1;
+drop table t2;
+--disable_warnings
+eval create table t1(a int auto_increment, key(a)) engine=$engine_type;
+eval create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=$engine_type;
+--enable_warnings
+SET FOREIGN_KEY_CHECKS=0;
+insert into t1 values (10);
+insert into t1 values (null),(null),(null);
+insert into t2 values (5,0);
+insert into t2 values (null,last_insert_id());
+SET FOREIGN_KEY_CHECKS=1;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from t1;
+select * from t2;
+connection master;
+
+# check if INSERT SELECT in auto_increment is well replicated (bug #490)
+
+drop table t2;
+drop table t1;
+create table t1(a int auto_increment, primary key(a));
+create table t2(b int auto_increment, c int, primary key(b));
+insert into t1 values (10);
+insert into t1 values (null),(null),(null);
+insert into t2 values (5,0);
+insert into t2 (c) select * from t1 ORDER BY a;
+select * from t2 ORDER BY b;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from t1 ORDER BY a;
+select * from t2 ORDER BY b;
+connection master;
+drop table t1;
+drop table t2;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+#
+# Bug#8412: Error codes reported in binary log for CHARACTER SET,
+# FOREIGN_KEY_CHECKS
+#
+connection master;
+SET TIMESTAMP=1000000000;
+CREATE TABLE t1 ( a INT UNIQUE );
+SET FOREIGN_KEY_CHECKS=0;
+# Duplicate Key Errors codes
+--error 1022, 1062
+INSERT INTO t1 VALUES (1),(1);
+sync_slave_with_master;
+connection master;
+drop table t1;
+# End of 4.1 tests
diff --git a/mysql-test/extra/rpl_tests/rpl_insert_ignore.test b/mysql-test/extra/rpl_tests/rpl_insert_ignore.test
new file mode 100644
index 00000000000..207b53b6fb4
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_insert_ignore.test
@@ -0,0 +1,71 @@
+# Testcase for BUG#6287 "Slave skips auto_increment values in Replication with InnoDB"
+# The bug was that if on master, INSERT IGNORE ignored some
+# rows, and the table was InnoDB with auto_inc column, then on slave
+# some rows received an auto_inc bigger than on master.
+# Slave needs to be started with --innodb to store table in InnoDB.
+# Same test for MyISAM (which had no bug).
+
+-- source include/master-slave.inc
+
+eval CREATE TABLE t1 (
+ a int unsigned not null auto_increment primary key,
+ b int unsigned,
+ unique (b)
+) ENGINE=$engine_type;
+
+eval CREATE TABLE t2 (
+ a int unsigned, # to force INSERT SELECT to have a certain order
+ b int unsigned
+) ENGINE=$engine_type;
+
+
+INSERT INTO t1 VALUES (NULL, 1);
+INSERT INTO t1 VALUES (NULL, 2);
+INSERT INTO t1 VALUES (NULL, 3);
+INSERT INTO t1 VALUES (NULL, 4);
+
+# An alternation of values which will conflict in t1 and will not.
+
+INSERT INTO t2 VALUES (1, 1);
+INSERT INTO t2 VALUES (2, 2);
+INSERT INTO t2 VALUES (3, 5);
+INSERT INTO t2 VALUES (4, 3);
+INSERT INTO t2 VALUES (5, 4);
+INSERT INTO t2 VALUES (6, 6);
+
+INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+
+# Compare results
+
+SELECT * FROM t1 ORDER BY a;
+
+sync_slave_with_master;
+SELECT * FROM t1 ORDER BY a;
+
+# Now do the same for MyISAM
+
+connection master;
+drop table t1;
+eval CREATE TABLE t1 (
+ a int unsigned not null auto_increment primary key,
+ b int unsigned,
+ unique (b)
+) ENGINE=$engine_type2;
+
+INSERT INTO t1 VALUES (1, 1);
+INSERT INTO t1 VALUES (2, 2);
+INSERT INTO t1 VALUES (3, 3);
+INSERT INTO t1 VALUES (4, 4);
+
+INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+
+SELECT * FROM t1 ORDER BY a;
+
+sync_slave_with_master;
+SELECT * FROM t1 ORDER BY a;
+
+connection master;
+drop table t1, t2;
+sync_slave_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/extra/rpl_tests/rpl_loaddata.test b/mysql-test/extra/rpl_tests/rpl_loaddata.test
new file mode 100644
index 00000000000..e58908ec7e9
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_loaddata.test
@@ -0,0 +1,159 @@
+# Requires statement logging
+-- source include/have_binlog_format_mixed_or_statement.inc
+
+# See if replication of a "LOAD DATA in an autoincrement column"
+# Honours autoincrement values
+# i.e. if the master and slave have the same sequence
+#
+# check replication of load data for temporary tables with additional
+# parameters
+#
+# check if duplicate entries trigger an error (they should unless IGNORE or
+# REPLACE was used on the master) (bug 571).
+#
+# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and
+# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986)
+
+-- source include/master-slave.inc
+
+connection slave;
+reset master;
+connection master;
+
+select last_insert_id();
+create table t1(a int not null auto_increment, b int, primary key(a) );
+load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+# verify that LAST_INSERT_ID() is set by LOAD DATA INFILE
+select last_insert_id();
+
+create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
+load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
+
+create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
+insert into t3 select * from t2;
+
+save_master_pos;
+connection slave;
+sync_with_master;
+
+select * from t1;
+select * from t3;
+# We want to be sure that LOAD DATA is in the slave's binlog.
+# But we can't simply read this binlog, because as the slave has not been
+# restarted for this test, the file_id is uncertain (would cause test
+# failures). So instead, we test if the binlog looks long enough to
+# contain LOAD DATA. Since 5.0.3 we assume that binlog of 1292 is ok.
+# If LOAD DATA was not logged, the binlog would be shorter.
+show master status;
+
+connection master;
+
+drop table t1;
+drop table t2;
+drop table t3;
+create table t1(a int, b int, unique(b));
+
+save_master_pos;
+connection slave;
+sync_with_master;
+
+# See if slave stops when there's a duplicate entry for key error in LOAD DATA
+
+insert into t1 values(1,10);
+
+connection master;
+load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+
+save_master_pos;
+connection slave;
+# The SQL slave thread should be stopped now.
+wait_for_slave_to_stop;
+
+# Skip the bad event and see if error is cleared in SHOW SLAVE STATUS by START
+# SLAVE, even though we are not executing any event (as sql_slave_skip_counter
+# takes us directly to the end of the relay log).
+
+set global sql_slave_skip_counter=1;
+start slave;
+sync_with_master;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
+show slave status;
+
+# Trigger error again to test CHANGE MASTER
+
+connection master;
+set sql_log_bin=0;
+delete from t1;
+set sql_log_bin=1;
+load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+save_master_pos;
+connection slave;
+# The SQL slave thread should be stopped now.
+# Exec_Master_Log_Pos should point to the start of Execute event
+# for last load data.
+wait_for_slave_to_stop;
+
+# CHANGE MASTER and see if error is cleared in SHOW SLAVE STATUS.
+stop slave;
+change master to master_user='test';
+change master to master_user='root';
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
+show slave status;
+
+# Trigger error again to test RESET SLAVE
+
+set global sql_slave_skip_counter=1;
+start slave;
+sync_with_master;
+connection master;
+set sql_log_bin=0;
+delete from t1;
+set sql_log_bin=1;
+load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+save_master_pos;
+connection slave;
+# The SQL slave thread should be stopped now.
+wait_for_slave_to_stop;
+
+# RESET SLAVE and see if error is cleared in SHOW SLAVE STATUS.
+stop slave;
+reset slave;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
+show slave status;
+
+# Finally, see if logging is done ok on master for a failing LOAD DATA INFILE
+
+connection master;
+reset master;
+eval create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
+unique(day)) engine=$engine_type; # no transactions
+--error 1062
+load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
+terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
+'\n##\n' starting by '>' ignore 1 lines;
+select * from t2;
+save_master_pos;
+connection slave;
+start slave;
+sync_with_master;
+select * from t2;
+
+# verify that if no error on slave, this is an error
+
+alter table t2 drop key day;
+connection master;
+delete from t2;
+--error 1062
+load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
+terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
+'\n##\n' starting by '>' ignore 1 lines;
+connection slave;
+wait_for_slave_to_stop;
+drop table t2;
+connection master;
+drop table t2;
+drop table t1;
+# End of 4.1 tests
diff --git a/mysql-test/t/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test
index 578a39efd6e..cc3a9b4ffb5 100644
--- a/mysql-test/t/rpl_log.test
+++ b/mysql-test/extra/rpl_tests/rpl_log.test
@@ -1,4 +1,5 @@
-source include/master-slave.inc;
+# Requires statement logging
+-- source include/master-slave.inc
# Clean up old slave's binlogs.
# The slave is started with --log-slave-updates
@@ -29,18 +30,25 @@ let $VERSION=`select version()`;
connection master;
reset master;
-create table t1(n int not null auto_increment primary key);
+eval create table t1(n int not null auto_increment primary key)ENGINE=$engine_type;
insert into t1 values (NULL);
drop table t1;
-create table t1 (word char(20) not null);
+eval create table t1 (word char(20) not null)ENGINE=$engine_type;
load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
select count(*) from t1;
-drop table t1;
--replace_result $VERSION VERSION
+--replace_column 2 # 5 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
show binlog events;
-show binlog events from 98 limit 1;
-show binlog events from 98 limit 2;
-show binlog events from 98 limit 2,1;
+--replace_column 2 # 5 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
+show binlog events from 102 limit 1;
+--replace_column 2 # 5 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
+show binlog events from 102 limit 2;
+--replace_column 2 # 5 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
+show binlog events from 102 limit 2,1;
flush logs;
# We need an extra update before doing save_master_pos.
@@ -59,8 +67,7 @@ flush logs;
# To make it predictable, we do a useless update now, but which has the
# interest of making the slave catch both rotate events.
-create table t5 (a int);
-drop table t5;
+eval create table t3 (a int)ENGINE=$engine_type;
# Sync slave and force it to start on another binary log
@@ -70,6 +77,8 @@ connection slave;
# to go into the relay log (the master always sends a fake one when replication
# starts).
start slave;
+let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%';
+--source include/wait_slave_status.inc
sync_with_master;
flush logs;
stop slave;
@@ -77,12 +86,15 @@ connection master;
# Create some entries for second log
-create table t1 (n int);
-insert into t1 values (1);
-drop table t1;
+eval create table t2 (n int)ENGINE=$engine_type;
+insert into t2 values (1);
--replace_result $VERSION VERSION
+--replace_column 2 # 5 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
show binlog events;
--replace_result $VERSION VERSION
+--replace_column 2 # 5 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
show binlog events in 'master-bin.000002';
show binary logs;
save_master_pos;
@@ -91,11 +103,15 @@ start slave;
sync_with_master;
show binary logs;
--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
+--replace_column 2 # 5 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
show binlog events in 'slave-bin.000001' from 4;
--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
+--replace_column 2 # 5 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
show binlog events in 'slave-bin.000002' from 4;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
# Need to recode the following
@@ -109,6 +125,12 @@ show slave status;
--error 1220
show binlog events in 'slave-bin.000005' from 4;
+# The table drops caused Cluster Replication wrapper to fail as event ID would never be the same.# Moving drops here.
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+
#
# Bug #6880: LAST_INSERT_ID() within a statement
#
@@ -119,9 +141,11 @@ reset master;
set insert_id=5;
insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
--replace_result $VERSION VERSION
+--replace_column 2 # 5 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
show binlog events;
select * from t1;
drop table t1;
# End of 4.1 tests
-# Adding comment for force manual merge 5.0 -> wl1012: Delete me
+
diff --git a/mysql-test/t/rpl_max_relay_size.test b/mysql-test/extra/rpl_tests/rpl_max_relay_size.test
index e5278ff5727..5b995374ba0 100644
--- a/mysql-test/t/rpl_max_relay_size.test
+++ b/mysql-test/extra/rpl_tests/rpl_max_relay_size.test
@@ -3,7 +3,9 @@
# for relay logs too).
# Test of manual relay log rotation with FLUSH LOGS.
-source include/master-slave.inc;
+# Requires statement logging
+-- source include/master-slave.inc
+
connection slave;
stop slave;
connection master;
@@ -39,7 +41,7 @@ select @@global.max_relay_log_size;
start slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
--vertical_results
show slave status;
@@ -54,7 +56,7 @@ select @@global.max_relay_log_size;
start slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
--vertical_results
show slave status;
@@ -69,7 +71,7 @@ select @@global.max_relay_log_size;
start slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
--vertical_results
show slave status;
@@ -83,7 +85,7 @@ reset slave;
# (to make sure it does not crash).
flush logs;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
--vertical_results
show slave status;
@@ -104,7 +106,7 @@ save_master_pos;
connection slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
--vertical_results
show slave status;
@@ -119,13 +121,14 @@ save_master_pos;
connection slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
--vertical_results
show slave status;
connection master;
# test that the absence of relay logs does not make a master crash
flush logs;
+-- replace_column 3 <Binlog_Ignore_DB>
show master status;
# Restore max_binlog_size
diff --git a/mysql-test/t/rpl_multi_query.test b/mysql-test/extra/rpl_tests/rpl_multi_query.test
index b4cd88f756e..30a83886a86 100644
--- a/mysql-test/t/rpl_multi_query.test
+++ b/mysql-test/extra/rpl_tests/rpl_multi_query.test
@@ -3,10 +3,10 @@
# CLIENT_MULTI_STATEMENTS) will be binlogged ONE-query-per-event (not
# one binlog event containing all queries)
+
# PS doesn't support multi-statements
--disable_ps_protocol
-
-source include/master-slave.inc;
+-- source include/master-slave.inc
--disable_warnings
drop database if exists mysqltest;
--enable_warnings
@@ -24,9 +24,7 @@ sync_slave_with_master;
select * from mysqltest.t1;
connection master;
--replace_column 2 # 5 #
-show binlog events from 98;
+--replace_regex /table_id: [0-9]+/table_id: #/
+show binlog events from 102;
drop database mysqltest;
sync_slave_with_master;
-
-# End of 4.1 tests
-#
diff --git a/mysql-test/extra/rpl_tests/rpl_multi_update.test b/mysql-test/extra/rpl_tests/rpl_multi_update.test
new file mode 100644
index 00000000000..121ae18daa8
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_multi_update.test
@@ -0,0 +1,30 @@
+source include/master-slave.inc;
+
+eval CREATE TABLE t1 (
+ a int unsigned not null auto_increment primary key,
+ b int unsigned
+) ENGINE=$engine_type;
+
+eval CREATE TABLE t2 (
+ a int unsigned not null auto_increment primary key,
+ b int unsigned
+) ENGINE=$engine_type;
+
+INSERT INTO t1 VALUES (NULL, 0);
+INSERT INTO t1 SELECT NULL, 0 FROM t1;
+
+INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
+
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+
+UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+# End of 4.1 tests
+
+connection master;
+drop table t1, t2;
+sync_slave_with_master;
diff --git a/mysql-test/extra/rpl_tests/rpl_multi_update2.test b/mysql-test/extra/rpl_tests/rpl_multi_update2.test
new file mode 100644
index 00000000000..0adf0053425
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_multi_update2.test
@@ -0,0 +1,62 @@
+# Let's verify that multi-update is not always skipped by slave if
+# some replicate-* rules exist.
+# (BUG#7011)
+
+source include/master-slave.inc;
+
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+eval CREATE TABLE t1 (
+ a int unsigned not null auto_increment primary key,
+ b int unsigned
+) ENGINE=$engine_type;
+
+eval CREATE TABLE t2 (
+ a int unsigned not null auto_increment primary key,
+ b int unsigned
+) ENGINE=$engine_type;
+
+INSERT INTO t1 VALUES (NULL, 0);
+INSERT INTO t1 SELECT NULL, 0 FROM t1;
+
+INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
+
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+
+UPDATE t1, t2 SET t1.b = (t2.b+4) WHERE t1.a = t2.a;
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+
+connection master;
+drop table t1,t2;
+sync_slave_with_master;
+
+#
+# BUG#13236 multi-update with subquery & --replicate-ignore-table
+#
+reset master;
+
+connection master;
+CREATE TABLE t1 ( a INT );
+INSERT INTO t1 VALUES (0);
+UPDATE t1, (SELECT 3 as b) AS x SET t1.a = x.b;
+select * from t1;
+sync_slave_with_master;
+
+connection slave;
+select * from t1;
+
+connection master;
+drop table t1;
+sync_slave_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/extra/rpl_tests/rpl_multi_update3.test b/mysql-test/extra/rpl_tests/rpl_multi_update3.test
new file mode 100644
index 00000000000..797e385e509
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_multi_update3.test
@@ -0,0 +1,222 @@
+-- source include/master-slave.inc
+
+##############################################################################
+#
+# Let's verify that multi-update with a subselect does not cause the slave to crash
+# (BUG#10442)
+#
+--disable_query_log
+SELECT '-------- Test for BUG#9361 --------' as "";
+--enable_query_log
+
+eval CREATE TABLE t1 (
+ a int unsigned not null auto_increment primary key,
+ b int unsigned
+) ENGINE=$engine_type;
+
+eval CREATE TABLE t2 (
+ a int unsigned not null auto_increment primary key,
+ b int unsigned
+) ENGINE=$engine_type;
+
+INSERT INTO t1 VALUES (NULL, 0);
+INSERT INTO t1 SELECT NULL, 0 FROM t1;
+
+INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
+
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+
+UPDATE t2, (SELECT a FROM t1 ORDER BY a) AS t SET t2.b = t.a+5 ;
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+
+sync_slave_with_master;
+connection slave;
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+
+connection master;
+drop table t1,t2;
+
+##############################################################################
+#
+# Test for BUG#9361:
+# Subselects should work inside multi-updates
+#
+--disable_query_log
+SELECT '-------- Test 1 for BUG#9361 --------' as "";
+--enable_query_log
+
+connection master;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+--enable_warnings
+
+CREATE TABLE t1 (
+ a1 char(30),
+ a2 int,
+ a3 int,
+ a4 char(30),
+ a5 char(30)
+);
+
+CREATE TABLE t2 (
+ b1 int,
+ b2 char(30)
+);
+
+# Insert one row per table
+INSERT INTO t1 VALUES ('Yes', 1, NULL, 'foo', 'bar');
+INSERT INTO t2 VALUES (1, 'baz');
+
+# This should update the row in t1
+UPDATE t1 a, t2
+ SET a.a1 = 'No'
+ WHERE a.a2 =
+ (SELECT b1
+ FROM t2
+ WHERE b2 = 'baz')
+ AND a.a3 IS NULL
+ AND a.a4 = 'foo'
+ AND a.a5 = 'bar';
+
+sync_slave_with_master;
+connection slave;
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+connection master;
+DROP TABLE t1, t2;
+
+##############################################################################
+#
+# Second test for BUG#9361
+#
+
+--disable_query_log
+SELECT '-------- Test 2 for BUG#9361 --------' as "";
+--enable_query_log
+
+connection master;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP TABLE IF EXISTS t3;
+--enable_warnings
+
+CREATE TABLE t1 (
+ i INT,
+ j INT,
+ x INT,
+ y INT,
+ z INT
+);
+
+CREATE TABLE t2 (
+ i INT,
+ k INT,
+ x INT,
+ y INT,
+ z INT
+);
+
+CREATE TABLE t3 (
+ j INT,
+ k INT,
+ x INT,
+ y INT,
+ z INT
+);
+
+INSERT INTO t1 VALUES ( 1, 2,13,14,15);
+INSERT INTO t2 VALUES ( 1, 3,23,24,25);
+INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
+
+UPDATE t1 AS a
+INNER JOIN t2 AS b
+ ON a.i = b.i
+INNER JOIN t3 AS c
+ ON a.j = c.j AND b.k = c.k
+SET a.x = b.x,
+ a.y = b.y,
+ a.z = (
+ SELECT sum(z)
+ FROM t3
+ WHERE y = 34
+ )
+WHERE b.x = 23;
+
+sync_slave_with_master;
+connection slave;
+
+SELECT * FROM t1;
+
+connection master;
+DROP TABLE t1, t2, t3;
+
+##############################################################################
+#
+# BUG#12618
+#
+# TEST: Replication of a statement containing a join in a multi-update.
+
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+
+CREATE TABLE t1 (
+ idp int(11) NOT NULL default '0',
+ idpro int(11) default NULL,
+ price decimal(19,4) default NULL,
+ PRIMARY KEY (idp)
+);
+
+CREATE TABLE t2 (
+ idpro int(11) NOT NULL default '0',
+ price decimal(19,4) default NULL,
+ nbprice int(11) default NULL,
+ PRIMARY KEY (idpro)
+);
+
+INSERT INTO t1 VALUES
+ (1,1,'3.0000'),
+ (2,2,'1.0000'),
+ (3,1,'1.0000'),
+ (4,1,'4.0000'),
+ (5,3,'2.0000'),
+ (6,2,'4.0000');
+
+INSERT INTO t2 VALUES
+ (1,'0.0000',0),
+ (2,'0.0000',0),
+ (3,'0.0000',0);
+
+# This update sets t2 to the minimal prices for each product
+update
+ t2
+ join
+ ( select idpro, min(price) as min_price, count(*) as nbr_price
+ from t1
+ where idpro>0 and price>0
+ group by idpro
+ ) as table_price
+on t2.idpro = table_price.idpro
+set t2.price = table_price.min_price,
+ t2.nbprice = table_price.nbr_price;
+
+select "-- MASTER AFTER JOIN --" as "";
+select * from t1;
+select * from t2;
+
+sync_slave_with_master;
+
+select "-- SLAVE AFTER JOIN --" as "";
+select * from t1;
+select * from t2;
+
+connection master;
+DROP TABLE t1, t2;
+# End of 4.1 tests
diff --git a/mysql-test/extra/rpl_tests/rpl_ndb_2multi_eng.test b/mysql-test/extra/rpl_tests/rpl_ndb_2multi_eng.test
new file mode 100644
index 00000000000..7f19245c0b9
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_ndb_2multi_eng.test
@@ -0,0 +1,346 @@
+#######################################
+# Author: JBM #
+# Date: 2006-02-23 #
+# Purpose: See if replication between #
+# NDB -> MyISAM and InnoDB works. #
+# and if #
+# MyISAM and InnoDB -> NDB works. #
+#######################################
+# By JBM #
+# Date 2006-02-28 #
+# Change: Implemented review comments #
+#######################################
+
+--echo --- Doing pre test cleanup ---
+
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_query_log
+
+--echo --- Start test 1 Basic testing ---
+--echo --- Create Table Section ---
+
+#################################################
+# Requirment: Create basic table, replicate #
+# basice operations such at insert, update #
+# delete between 2 different storage engines #
+# Alter table and ensure table is handled #
+# Correctly on the slave #
+#################################################
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+ bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE,PRIMARY KEY(id));
+
+--echo --- Show table on master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Show table on slave ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+# Okay lets see how it holds up to table changes
+--echo --- Check that simple Alter statements are replicated correctly --
+
+ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still same engine ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- End test 1 Basic testing ---
+--echo --- Do Cleanup --
+
+DROP TABLE IF EXISTS t1;
+
+#################################################################
+
+--echo --- Start test 2 partition RANGE testing --
+--echo --- Do setup --
+
+
+#################################################
+# Requirment: Create table that is partitioned #
+# by range on year i.e. year(t) and replicate #
+# basice operations such at insert, update #
+# delete between 2 different storage engines #
+# Alter table and ensure table is handled #
+# Correctly on the slave #
+#################################################
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+ bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE)
+ PARTITION BY RANGE (YEAR(t))
+ (PARTITION p0 VALUES LESS THAN (1901),
+ PARTITION p1 VALUES LESS THAN (1946),
+ PARTITION p2 VALUES LESS THAN (1966),
+ PARTITION p3 VALUES LESS THAN (1986),
+ PARTITION p4 VALUES LESS THAN (2005),
+ PARTITION p5 VALUES LESS THAN MAXVALUE);
+
+--echo --- Show table on master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Show table on slave --
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 ADD PRIMARY KEY(t,id);
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still same engine ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+--enable_query_log
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- End test 2 partition RANGE testing ---
+--echo --- Do Cleanup ---
+
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+--echo --- Start test 3 partition LIST testing ---
+--echo --- Do setup ---
+#################################################
+# Requirment: Create table that is partitioned #
+# by list on id i.e. (2,4). Pretend that we #
+# missed one and alter to add. Then replicate #
+# basice operations such at insert, update #
+# delete between 2 different storage engines #
+# Alter table and ensure table is handled #
+# Correctly on the slave #
+#################################################
+
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+ bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE)
+ PARTITION BY LIST(id)
+ (PARTITION p0 VALUES IN (2, 4),
+ PARTITION p1 VALUES IN (42, 142));
+
+--echo --- Test 3 Alter to add partition ---
+
+ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412));
+
+--echo --- Show table on master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Show table on slave ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 ADD PRIMARY KEY(id);
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still same engine ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- End test 3 partition LIST testing ---
+--echo --- Do Cleanup --
+
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+--echo --- Start test 4 partition HASH testing ---
+--echo --- Do setup ---
+#################################################
+# Requirment: Create table that is partitioned #
+# by hash on year i.e. YEAR(t). Then replicate #
+# basice operations such at insert, update #
+# delete between 2 different storage engines #
+# Alter table and ensure table is handled #
+# Correctly on the slave #
+#################################################
+
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+ bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE)
+ PARTITION BY HASH( YEAR(t) )
+ PARTITIONS 4;
+
+--echo --- show that tables have been created correctly ---
+
+SHOW CREATE TABLE t1;
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 ADD PRIMARY KEY(t,id);
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still same engine ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- End test 4 partition HASH testing ---
+--echo --- Do Cleanup --
+
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+--echo --- Start test 5 partition by key testing ---
+--echo --- Create Table Section ---
+
+#################################################
+# Requirment: Create table that is partitioned #
+# by key on id with 4 parts. Then replicate #
+# basice operations such at insert, update #
+# delete between 2 different storage engines #
+# Alter table and ensure table is handled #
+# Correctly on the slave #
+#################################################
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+ bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE,PRIMARY KEY(id))
+ PARTITION BY KEY()
+ PARTITIONS 4;
+
+--echo --- Show that tables on master are ndbcluster tables ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Show that tables on slave ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+# Okay lets see how it holds up to table changes
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still right type ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still same engine ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- End test 5 key partition testing ---
+--echo --- Do Cleanup ---
+
+DROP TABLE IF EXISTS t1;
+
+# End of 5.1 test case
diff --git a/mysql-test/extra/rpl_tests/rpl_partition.test b/mysql-test/extra/rpl_tests/rpl_partition.test
new file mode 100644
index 00000000000..8f2956bf1ef
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_partition.test
@@ -0,0 +1,262 @@
+############################################################
+# Author: MATZ #
+# Date: 2006-03-22 #
+# Purpose: See if replication of partition tables work #
+############################################################
+
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_query_log
+
+--echo --- Start test 2 partition RANGE testing --
+
+# Create table that is partitioned by range on year i.e. year(t) and
+# replicate basice operations such at insert, update delete between 2
+# different storage engines Alter table and ensure table is handled
+# Correctly on the slave
+# Note that the storage engine should not be explicit: the default
+# storage engine is used on master and slave.
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+ bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE)
+ PARTITION BY RANGE (YEAR(t))
+ (PARTITION p0 VALUES LESS THAN (1901),
+ PARTITION p1 VALUES LESS THAN (1946),
+ PARTITION p2 VALUES LESS THAN (1966),
+ PARTITION p3 VALUES LESS THAN (1986),
+ PARTITION p4 VALUES LESS THAN (2005),
+ PARTITION p5 VALUES LESS THAN MAXVALUE);
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave --
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+--enable_query_log
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- End test 2 partition RANGE testing ---
+
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+--echo --- Start test 3 partition LIST testing ---
+--echo --- Do setup ---
+#################################################
+# Requirment: Create table that is partitioned #
+# by list on id i.e. (2,4). Pretend that we #
+# missed one and alter to add. Then replicate #
+# basice operations such at insert, update #
+# delete between 2 different storage engines #
+# Alter table and ensure table is handled #
+# Correctly on the slave #
+#################################################
+
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+ bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE)
+ PARTITION BY LIST(id)
+ (PARTITION p0 VALUES IN (2, 4),
+ PARTITION p1 VALUES IN (42, 142));
+
+--echo --- Test 3 Alter to add partition ---
+
+ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412));
+
+--echo --- Show table on master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Show table on slave ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still same engine ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- End test 3 partition LIST testing ---
+--echo --- Do Cleanup --
+
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+--echo --- Start test 4 partition HASH testing ---
+--echo --- Do setup ---
+#################################################
+# Requirment: Create table that is partitioned #
+# by hash on year i.e. YEAR(t). Then replicate #
+# basice operations such at insert, update #
+# delete between 2 different storage engines #
+# Alter table and ensure table is handled #
+# Correctly on the slave #
+#################################################
+
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+ bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE)
+ PARTITION BY HASH( YEAR(t) )
+ PARTITIONS 4;
+
+--echo --- show that tables have been created correctly ---
+
+SHOW CREATE TABLE t1;
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still same engine ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- End test 4 partition HASH testing ---
+--echo --- Do Cleanup --
+
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+--echo --- Start test 5 partition by key testing ---
+--echo --- Create Table Section ---
+
+#################################################
+# Requirment: Create table that is partitioned #
+# by key on id with 4 parts. Then replicate #
+# basice operations such at insert, update #
+# delete between 2 different storage engines #
+# Alter table and ensure table is handled #
+# Correctly on the slave #
+#################################################
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+ bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE,PRIMARY KEY(id))
+ PARTITION BY KEY()
+ PARTITIONS 4;
+
+--echo --- Show that tables on master are ndbcluster tables ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Show that tables on slave ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+# Okay lets see how it holds up to table changes
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still right type ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still same engine ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- End test 5 key partition testing ---
+--echo --- Do Cleanup ---
+
+DROP TABLE IF EXISTS t1;
+
+# End of 5.1 test case
diff --git a/mysql-test/extra/rpl_tests/rpl_relayrotate.test b/mysql-test/extra/rpl_tests/rpl_relayrotate.test
new file mode 100644
index 00000000000..dc91f9e7fff
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_relayrotate.test
@@ -0,0 +1,75 @@
+# When the relay log gets rotated while the I/O thread
+# is reading a transaction, the transaction spans on two or more
+# relay logs. If STOP SLAVE occurs while the SQL thread is
+# executing a part of the transaction in the non-first relay logs,
+# we test if START SLAVE will resume in the beginning of the
+# transaction (i.e., step back to the first relay log)
+
+# The slave is started with max_binlog_size=16384 bytes,
+# to force many rotations (approximately 30 rotations)
+
+-- source include/master-slave.inc
+
+connection slave;
+stop slave;
+connection master;
+--disable_warnings
+eval create table t1 (a int) engine=$engine_type;
+--enable_warnings
+let $1=8000;
+disable_query_log;
+begin;
+while ($1)
+{
+# eval means expand $ expressions
+ eval insert into t1 values( $1 );
+ dec $1;
+}
+commit;
+# This will generate a 500kB master's binlog,
+# which corresponds to 30 slave's relay logs.
+enable_query_log;
+save_master_pos;
+connection slave;
+reset slave;
+start slave;
+# We wait 1 sec for the SQL thread to be somewhere in
+# the middle of the transaction, hopefully not in
+# the first relay log, and hopefully before the COMMIT.
+# Usually it stops when the SQL thread is around the 15th relay log.
+# We cannot use MASTER_POS_WAIT() as master's position
+# increases only when the slave executes the COMMIT.
+# Note that except when using Valgrind, 1 second is enough for the I/O slave
+# thread to fetch the whole master's binlog.
+sleep 1;
+stop slave;
+# We suppose the SQL thread stopped before COMMIT.
+# If so the transaction was rolled back
+# and the table is now empty.
+# Now restart
+start slave;
+# And see if the table contains '8000'
+# which proves that the transaction restarted at
+# the right place.
+# We must wait for the transaction to commit before
+# reading, with a sync_with_master.
+sync_with_master;
+select max(a) from t1;
+connection master;
+
+# The following DROP is a very important cleaning task:
+# imagine the next test is run with --skip-innodb: it will do
+# DROP TABLE IF EXISTS t1; but this will delete the frm and leave
+# some data in the InnoDB datafile (because at that time mysqld
+# does not know about InnoDB : --skip-innodb). So if later in the
+# test suite a test wants to create an InnoDB table called t1, it
+# will fail with
+# InnoDB: Error: table t1 already exists in InnoDB internal
+# InnoDB: data dictionary. Have you deleted the .frm file etc
+drop table t1;
+# wait until this drop is executed on slave
+save_master_pos;
+connection slave;
+sync_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/t/rpl_reset_slave.test b/mysql-test/extra/rpl_tests/rpl_reset_slave.test
index 00b1cf68294..374b2620a34 100644
--- a/mysql-test/t/rpl_reset_slave.test
+++ b/mysql-test/extra/rpl_tests/rpl_reset_slave.test
@@ -1,3 +1,6 @@
+# TBF - difference in row level logging
+# Temp tables are not replicated in rbr, but it is still good to hit rbr with everthing
+
# See SHOW SLAVE STATUS displays well after RESET SLAVE (it should display the
# --master-* options from mysqld, as this is what is going to be used next time
# slave threads will be started). In bug 985, it displayed old values (of before
@@ -5,30 +8,30 @@
# See if slave crashes when doing a CREATE TEMPORARY TABLE twice, separated by
# RESET SLAVE.
-source include/master-slave.inc;
+-- source include/master-slave.inc
connection master;
save_master_pos;
connection slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
stop slave;
change master to master_user='test';
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
reset slave;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
start slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
# test of crash with temp tables & RESET SLAVE
@@ -46,6 +49,3 @@ reset slave;
start slave;
sync_with_master;
show status like 'slave_open_temp_tables';
-
-# End of 4.1 tests
-#
diff --git a/mysql-test/extra/rpl_tests/rpl_row_001.test b/mysql-test/extra/rpl_tests/rpl_row_001.test
new file mode 100644
index 00000000000..9bdfae81093
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_row_001.test
@@ -0,0 +1,84 @@
+-- source include/master-slave.inc
+-- source include/have_binlog_format_row.inc
+
+CREATE TABLE t1 (word CHAR(20) NOT NULL);
+LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1;
+SELECT * FROM t1 ORDER BY word LIMIT 10;
+
+#
+# Test slave with wrong password
+#
+save_master_pos;
+connection slave;
+sync_with_master;
+STOP SLAVE;
+connection master;
+SET PASSWORD FOR root@"localhost" = PASSWORD('foo');
+connection slave;
+START SLAVE;
+connection master;
+#
+# Give slave time to do at last one failed connect retry
+# This one must be short so that the slave will not stop retrying
+real_sleep 2;
+SET PASSWORD FOR root@"localhost" = PASSWORD('');
+# Give slave time to connect (will retry every second)
+sleep 2;
+
+CREATE TABLE t3(n INT);
+INSERT INTO t3 VALUES(1),(2);
+sync_slave_with_master;
+SELECT * FROM t3 ORDER BY n;
+SELECT SUM(LENGTH(word)) FROM t1;
+connection master;
+DROP TABLE t1,t3;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+# Test if the slave SQL thread can be more than 16K behind the slave
+# I/O thread (> IO_SIZE)
+
+connection master;
+# we'll use table-level locking to delay slave SQL thread
+eval CREATE TABLE t1 (n INT) ENGINE=$engine_type;
+sync_slave_with_master;
+connection master;
+RESET MASTER;
+connection slave;
+STOP SLAVE;
+RESET SLAVE;
+
+connection master;
+let $1=5000;
+# Generate 16K of relay log
+disable_query_log;
+while ($1)
+{
+ eval INSERT INTO t1 VALUES($1);
+ dec $1;
+}
+enable_query_log;
+SELECT COUNT(*) FROM t1;
+save_master_pos;
+
+# Try to cause a large relay log lag on the slave by locking t1
+connection slave;
+LOCK TABLES t1 READ;
+START SLAVE;
+UNLOCK TABLES;
+sync_with_master;
+SELECT COUNT(*) FROM t1;
+
+connection master;
+DROP TABLE t1;
+CREATE TABLE t1 (n INT);
+INSERT INTO t1 VALUES(3456);
+sync_slave_with_master;
+SELECT n FROM t1;
+
+connection master;
+DROP TABLE t1;
+sync_slave_with_master;
diff --git a/mysql-test/extra/rpl_tests/rpl_row_UUID.test b/mysql-test/extra/rpl_tests/rpl_row_UUID.test
new file mode 100644
index 00000000000..962572d3aec
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_row_UUID.test
@@ -0,0 +1,83 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/18/2005 #
+#############################################################################
+# TEST: To test the UUID() in rbr #
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+# Begin clean up test section
+connection master;
+
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
+--enable_warnings
+
+# Section 1 test
+
+eval CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, vchar_column VARCHAR(100), PRIMARY KEY(a)) engine=$engine_type;
+INSERT INTO test.t1 VALUES(1,UUID(),UUID());
+delimiter |;
+create procedure test.p1()
+begin
+ INSERT INTO test.t1 VALUES(2,UUID(),UUID());
+ INSERT INTO test.t1 VALUES(3,UUID(),UUID());
+end|
+delimiter ;|
+
+CALL test.p1();
+
+# Now the same thing with a function
+
+delimiter |;
+create function test.fn1(x int)
+ returns int
+begin
+ insert into t1 values (4+x,UUID(),UUID());
+ insert into t1 values (5+x,UUID(),UUID());
+ return 0;
+end|
+
+delimiter ;|
+# test both in SELECT and in INSERT
+select fn1(0);
+create table t2 (a int);
+insert into t2 values(fn1(2));
+
+sync_slave_with_master;
+SHOW CREATE TABLE test.t1;
+
+# Dump the databases and so we can see if they match
+# Another method would be to use SELECT INTO OUTFILE on master,
+# then LOAD DATA INFILE in slave, and use a query to compare.
+# This would have the advantage that it would not assume
+# the system has a 'diff'
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_slave.sql
+
+connection master;
+# Let's cleanup
+
+DROP PROCEDURE test.p1;
+DROP FUNCTION test.fn1;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+
+# Let's compare. Note: If they match test will pass, if they do not match
+# the test will show that the diff statement failed and not reject file
+# will be created. You will need to go to the mysql-test dir and diff
+# the files your self to see what is not matching :-)
+
+--exec diff $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_master.sql $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_slave.sql;
+
+# Cleanup dump files.
+# Long-term "system rm" is not portable; we could live without
+# this cleanup as no other test will use these files and they'll
+# be removed at next testsuite run.
+
+# End of 5.0 test case
+-- source include/master-slave-end.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_row_basic.test b/mysql-test/extra/rpl_tests/rpl_row_basic.test
new file mode 100644
index 00000000000..ea2c4c1688c
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_row_basic.test
@@ -0,0 +1,233 @@
+--source include/have_row_based.inc
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+#
+# Basic tests of row-level logging
+#
+
+#
+# First we test tables with only an index.
+#
+
+eval CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)$extra_index_t1) ENGINE = $type ;
+SELECT * FROM t1;
+sync_slave_with_master;
+SELECT * FROM t1;
+
+# Testing insert
+connection master;
+INSERT INTO t1 VALUES ('A','B'), ('X','Y'), ('X','X');
+INSERT INTO t1 VALUES ('A','C'), ('X','Z'), ('A','A');
+SELECT * FROM t1 ORDER BY C1,C2;
+sync_slave_with_master;
+SELECT * FROM t1 ORDER BY C1,C2;
+
+# Testing delete
+# Observe that are several rows having the value for the index but only one
+# should be deleted.
+connection master;
+DELETE FROM t1 WHERE C1 = C2;
+SELECT * FROM t1 ORDER BY C1,C2;
+sync_slave_with_master;
+SELECT * FROM t1 ORDER BY C1,C2;
+
+#
+# Testing update.
+# Note that we have a condition on a column that is not part of the index for
+# the table. The right row should be updated nevertheless.
+#
+connection master;
+UPDATE t1 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t1 ORDER BY C1,C2;
+sync_slave_with_master;
+SELECT * FROM t1 ORDER BY C1,C2;
+
+# Testing update with a condition that does not match any rows, but
+# which has a match for the index.
+connection master;
+UPDATE t1 SET c2 = 'Q' WHERE c1 = 'A' AND c2 = 'N';
+SELECT * FROM t1 ORDER BY c1,c2;
+sync_slave_with_master;
+SELECT * FROM t1 ORDER BY c1,c2;
+
+#
+# Testing table with primary key
+#
+connection master;
+eval CREATE TABLE t2 (c1 INT, c12 char(1), c2 INT, PRIMARY KEY (c1)) ENGINE = $type ;
+INSERT INTO t2
+ VALUES (1,'A',2), (2,'A',4), (3,'A',9), (4,'A',15), (5,'A',25),
+ (6,'A',35), (7,'A',50), (8,'A',64), (9,'A',81);
+SELECT * FROM t2 ORDER BY c1,c2;
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+sync_slave_with_master;
+SELECT * FROM t2 ORDER BY c1,c2;
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+
+connection master;
+UPDATE t2 SET c2 = c1*c1 WHERE c2 != c1*c1;
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+sync_slave_with_master;
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+
+# Testing update with a condition that does not match any rows, but
+# which has a match for the primary key.
+connection master;
+UPDATE t2 SET c12 = 'Q' WHERE c1 = 1 AND c2 = 999;
+SELECT * FROM t2 ORDER BY c1,c2;
+sync_slave_with_master;
+SELECT * FROM t2 ORDER BY c1,c2;
+
+connection master;
+DELETE FROM t2 WHERE c1 % 4 = 0;
+SELECT * FROM t2 ORDER BY c1,c2;
+sync_slave_with_master;
+SELECT * FROM t2 ORDER BY c1,c2;
+
+connection master;
+UPDATE t2 SET c12='X';
+
+#
+# Testing table with a multi-column primary key.
+#
+connection master;
+eval CREATE TABLE t3 (C1 CHAR(1), C2 CHAR(1), pk1 INT, C3 CHAR(1), pk2 INT, PRIMARY KEY (pk1,pk2)) ENGINE = $type ;
+
+INSERT INTO t3 VALUES ('A','B',1,'B',1), ('X','Y',2,'B',1), ('X','X',3,'B',1);
+INSERT INTO t3 VALUES ('A','C',1,'B',2), ('X','Z',2,'B',2), ('A','A',3,'B',2);
+SELECT * FROM t3 ORDER BY C1,C2;
+sync_slave_with_master;
+SELECT * FROM t3 ORDER BY C1,C2;
+
+connection master;
+DELETE FROM t3 WHERE C1 = C2;
+SELECT * FROM t3 ORDER BY C1,C2;
+sync_slave_with_master;
+SELECT * FROM t3 ORDER BY C1,C2;
+
+connection master;
+UPDATE t3 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t3 ORDER BY C1,C2;
+sync_slave_with_master;
+SELECT * FROM t3 ORDER BY C1,C2;
+
+#
+# Testing table without index or primary key
+#
+connection master;
+eval CREATE TABLE t6 (C1 CHAR(1), C2 CHAR(1), C3 INT$extra_index_t6) ENGINE = $type;
+
+# Testing insert
+INSERT INTO t6 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
+INSERT INTO t6 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
+SELECT * FROM t6 ORDER BY C3;
+sync_slave_with_master;
+SELECT * FROM t6 ORDER BY C3;
+
+# Testing delete
+# Observe that are several rows having the value for the index but only one
+# should be deleted.
+connection master;
+DELETE FROM t6 WHERE C1 = C2;
+SELECT * FROM t6 ORDER BY C3;
+sync_slave_with_master;
+SELECT * FROM t6 ORDER BY C3;
+
+#
+# Testing update.
+# Note that we have a condition on a column that is not part of the index for
+# the table. The right row should be updated nevertheless.
+#
+connection master;
+UPDATE t6 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t6 ORDER BY C3;
+sync_slave_with_master;
+SELECT * FROM t6 ORDER BY C3;
+
+# now mixing the 3 tables without begin/commit
+connection master;
+eval CREATE TABLE t5 (C1 CHAR(1), C2 CHAR(1), C3 INT PRIMARY KEY) ENGINE = $type ;
+INSERT INTO t5 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
+INSERT INTO t5 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
+
+UPDATE t5,t2,t3 SET t5.C2='Q', t2.c12='R', t3.C3 ='S' WHERE t5.C1 = t2.c12 AND t5.C1 = t3.C1;
+SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2;
+sync_slave_with_master;
+SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2;
+
+#
+# Testing special column types
+#
+
+connection master;
+eval CREATE TABLE t4 (C1 CHAR(1) PRIMARY KEY, B1 BIT(1), B2 BIT(1) NOT NULL DEFAULT 0, C2 CHAR(1) NOT NULL DEFAULT 'A') ENGINE = $type ;
+
+INSERT INTO t4 SET C1 = 1;
+SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
+sync_slave_with_master;
+SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
+
+#
+# Testing conflicting operations
+#
+connection master;
+eval CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = $type ;
+sync_slave_with_master;
+--echo --- on slave: original values ---
+INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
+SELECT * FROM t7 ORDER BY C1;
+
+connection master;
+--echo --- on master: new values inserted ---
+INSERT INTO t7 VALUES (1,2), (2,4), (3,6);
+SELECT * FROM t7 ORDER BY C1;
+sync_slave_with_master;
+--echo --- on slave: old values should be overwritten by replicated values ---
+SELECT * FROM t7 ORDER BY C1;
+
+#
+# A more complicated test where the table has several keys and we are
+# causing a conflict for a key that is not "last".
+#
+connection master;
+--echo --- on master ---
+eval CREATE TABLE t8 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = $type ;
+
+# First we make sure that the constraints are correctly set.
+INSERT INTO t8 VALUES (99,99,99);
+--error 1062
+INSERT INTO t8 VALUES (99,22,33);
+--error 1062
+INSERT INTO t8 VALUES (11,99,33);
+--error 1062
+INSERT INTO t8 VALUES (11,22,99);
+SELECT * FROM t8 ORDER BY a;
+
+sync_slave_with_master;
+--echo --- on slave ---
+SELECT * FROM t8 ORDER BY a;
+INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9);
+SELECT * FROM t8 ORDER BY a;
+
+connection master;
+--echo --- on master ---
+# We insert a row that will cause conflict on the primary key but not
+# on the other keys.
+INSERT INTO t8 VALUES (2,4,8);
+sync_slave_with_master;
+--echo --- on slave ---
+SELECT * FROM t8 ORDER BY a;
+
+#
+# Test conflicting operations when changing in a table referenced by a
+# foreign key. We'll reuse the above table and just add a table that
+# references it.
+#
+
+#
+# cleanup
+#
+
+connection master;
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
diff --git a/mysql-test/extra/rpl_tests/rpl_row_blob.test b/mysql-test/extra/rpl_tests/rpl_row_blob.test
new file mode 100644
index 00000000000..75a2dc2cf9e
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_row_blob.test
@@ -0,0 +1,191 @@
+#################################################
+# Author: JBM
+# Date: 2006-01-06
+# Purpose: Test test that BLOBs are replicated
+# correctly.
+################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+# Pre test clean up section
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+--enable_warnings
+
+# Start test section
+--echo ***** Table Create Section ****
+--echo
+--disable_warnings
+--replace_result $engine_type #
+eval CREATE TABLE test.t1 (c1 int not null auto_increment,
+data LONGBLOB, PRIMARY KEY(c1))ENGINE=$engine_type;
+--enable_warnings
+--echo
+--echo **** Data Insert Section test.t1 *****
+--echo
+INSERT INTO test.t1 VALUES (NULL, NULL);
+INSERT INTO test.t1 VALUES (NULL, repeat('a',1*1024));
+INSERT INTO test.t1 VALUES (NULL, repeat('b',16*1024));
+--echo
+
+--echo **** Data Insert Validation Master Section test.t1 ****
+--echo
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
+save_master_pos;
+connection slave;
+sync_with_master;
+sleep 5;
+--echo
+--echo **** Data Insert Validation Slave Section test.t1 ****
+--echo
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
+connection master;
+--echo
+
+--echo **** Data Update Section test.t1 ****
+--echo
+UPDATE test.t1 set data=repeat('a',18*1024) where c1 = 1;
+UPDATE t1 set data=repeat('c',17*1024) where c1 = 2;
+--echo
+
+--echo **** Data Update Validation Master Section test.t1 ****
+--echo
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+# Sleep is needed for NDB to allow time for
+# Injector thread to populate the bin log.
+save_master_pos;
+connection slave;
+sync_with_master;
+sleep 5;
+--echo
+--echo **** Data Update Validation Slave Section test.t1 ****
+--echo
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+connection master;
+--echo
+--echo **** End Test Section test.t1 ****
+--echo
+
+--echo **** Create Table test.t2 ****
+--echo
+--disable_warnings
+--replace_result $engine_type #
+eval CREATE TABLE test.t2 (
+ c1 INT NOT NULL PRIMARY KEY,
+ c2 TEXT,
+ c3 INT,
+ c4 LONGBLOB,
+ KEY(c3))ENGINE=$engine_type;
+--enable_warnings
+--echo
+
+--echo *** Setup Values For test.t2 ***
+# x0 size 256 (current inline size)
+set @x0 = '01234567012345670123456701234567';
+set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
+
+# b1 length 2000+256 (blob part aligned)
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@x0);
+# d1 length 3000
+set @d1 = 'dd1';
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+
+# b2 length 20000
+set @b2 = 'b2';
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+
+# d2 length 30000
+set @d2 = 'dd2';
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+--echo
+
+--echo **** Data Insert Section test.t2 *****
+--echo
+INSERT INTO test.t2 VALUES(1,@b1,111,@d1);
+INSERT INTO test.t2 VALUES(2,@b2,222,@d2);
+--echo
+
+--echo **** Data Insert Validation Master Section test.t2 ****
+--echo
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+save_master_pos;
+connection slave;
+sync_with_master;
+sleep 5;
+--echo
+--echo **** Data Insert Validation Slave Section test.t2 ****
+--echo
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+connection master;
+--echo
+
+--echo **** Data Update Section test.t2 ****
+--echo
+UPDATE test.t2 SET c2=@b2, c4=@d2 WHERE c1=1;
+UPDATE test.t2 SET c2=@b1, c4=@d1 WHERE c1=2;
+--echo
+
+--echo **** Data Update Validation Master Section test.t2 ****
+--echo
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+# Sleep is needed for NDB to allow time for
+# Injector thread to populate the bin log.
+save_master_pos;
+connection slave;
+sync_with_master;
+sleep 5;
+--echo
+--echo **** Data Update Validation Slave Section test.t2 ****
+--echo
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+connection master;
+--echo
+
+# Post test clean up section
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_row_blob_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_row_blob_slave.sql
+
+--exec diff $MYSQLTEST_VARDIR/tmp/rpl_row_blob_master.sql $MYSQLTEST_VARDIR/tmp/rpl_row_blob_slave.sql
+
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+# ensure cleanup on slave as well:
+# ndb blob tables consist of several tables
+# if cluster is shutdown while not all tables are
+# properly dropped, the table becomes inconsistent
+# and wrecks later test cases
+--sync_slave_with_master
diff --git a/mysql-test/extra/rpl_tests/rpl_row_charset.test b/mysql-test/extra/rpl_tests/rpl_row_charset.test
new file mode 100644
index 00000000000..336a038db10
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_row_charset.test
@@ -0,0 +1,183 @@
+# Replication of character sets.
+# This test will fail if the server/client does not support enough charsets.
+
+# Requires statement logging
+-- source include/have_binlog_format_row.inc
+
+-- source include/master-slave.inc
+--disable_warnings
+set timestamp=1000000000;
+drop database if exists mysqltest2;
+drop database if exists mysqltest3;
+--enable_warnings
+
+create database mysqltest2 character set latin2;
+set @@character_set_server=latin5;
+create database mysqltest3;
+--disable_query_log
+select "--- --master--" as "";
+--enable_query_log
+show create database mysqltest2;
+show create database mysqltest3;
+sync_slave_with_master;
+--disable_query_log
+select "--- --slave--" as "";
+--enable_query_log
+show create database mysqltest2;
+show create database mysqltest3;
+
+connection master;
+set @@collation_server=armscii8_bin;
+drop database mysqltest3;
+create database mysqltest3;
+--disable_query_log
+select "--- --master--" as "";
+--enable_query_log
+show create database mysqltest3;
+sync_slave_with_master;
+--disable_query_log
+select "--- --slave--" as "";
+--enable_query_log
+show create database mysqltest3;
+
+connection master;
+use mysqltest2;
+create table t1 (a int auto_increment primary key, b varchar(100));
+set character_set_client=cp850, collation_connection=latin2_croatian_ci;
+insert into t1 (b) values(@@character_set_server);
+insert into t1 (b) values(@@collation_server);
+# character_set_database and collation_database are not tested as they
+# needn't be replicated (Bar said in Jan 2005).
+insert into t1 (b) values(@@character_set_client);
+# collation_client does not exist
+insert into t1 (b) values(@@character_set_connection);
+insert into t1 (b) values(@@collation_connection);
+--disable_query_log
+select "--- --master--" as "";
+--enable_query_log
+select * from t1 order by a;
+sync_slave_with_master;
+--disable_query_log
+select "--- --slave--" as "";
+--enable_query_log
+select * from mysqltest2.t1 order by a;
+
+select "--- --muller--" as "";
+connection master;
+set character_set_client=latin1, collation_connection=latin1_german1_ci;
+truncate table t1;
+insert into t1 (b) values(@@collation_connection);
+insert into t1 (b) values(LEAST("Mller","Muffler"));
+set collation_connection=latin1_german2_ci;
+insert into t1 (b) values(@@collation_connection);
+insert into t1 (b) values(LEAST("Mller","Muffler"));
+--disable_query_log
+select "--- --master--" as "";
+--enable_query_log
+select * from t1 order by a;
+sync_slave_with_master;
+--disable_query_log
+select "--- --slave--" as "";
+--enable_query_log
+select * from mysqltest2.t1 order by a;
+
+# Presently charset info is not logged with LOAD DATA but it will
+# change in Jan 2005 when Dmitri pushes his new LOAD DATA,
+# before 5.0.3 goes out. When done, LOAD DATA INFILE should be tested
+# here.
+
+# See if user var is prefixed with collation in binlog and replicated well.
+# Note: replication of user variables is broken as far as derivation is
+# concerned. That's because when we store a user variable in the binlog,
+# we lose its derivation. So later on the slave, it's impossible to
+# know if the collation was explicit or not, so we use DERIVATION_NONE,
+# which provokes error messages (like 'Illegal mix of collation') when
+# we replay the master's INSERT/etc statements.
+
+
+select "--- --INSERT--" as "";
+connection master;
+set @a= _cp850 'Mller' collate cp850_general_ci;
+truncate table t1;
+insert into t1 (b) values(collation(@a));
+--disable_query_log
+select "--- --master--" as "";
+--enable_query_log
+select * from t1 order by a;
+sync_slave_with_master;
+--disable_query_log
+select "--- --slave--" as "";
+--enable_query_log
+select * from mysqltest2.t1 order by a;
+
+connection master;
+drop database mysqltest2;
+drop database mysqltest3;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
+show binlog events from 102;
+sync_slave_with_master;
+
+# Check that we can change global.collation_server (since 5.0.3)
+
+select "--- --global--" as "";
+set global character_set_server=latin2;
+set global character_set_server=latin1; # back
+connection master;
+set global character_set_server=latin2;
+set global character_set_server=latin1; # back
+
+# Check that SET ONE_SHOT is really one shot
+
+select "--- --oneshot--" as "";
+set one_shot @@character_set_server=latin5;
+set @@max_join_size=1000;
+select @@character_set_server;
+select @@character_set_server;
+set @@character_set_server=latin5;
+select @@character_set_server;
+select @@character_set_server;
+
+# ONE_SHOT on not charset/collation stuff is not allowed
+-- error 1382
+set one_shot max_join_size=10;
+
+# Test of wrong character set numbers;
+error 1115;
+set character_set_client=9999999;
+error 1273;
+set collation_server=9999998;
+
+# This one was contributed by Sergey Petrunia (BUG#3943)
+
+select "--- --3943--" as "";
+use test;
+CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255));
+SET CHARACTER_SET_CLIENT=koi8r,
+ CHARACTER_SET_CONNECTION=cp1251,
+ CHARACTER_SET_RESULTS=koi8r;
+INSERT INTO t1 (c1, c2) VALUES (', ',', ');
+select hex(c1), hex(c2) from t1;
+sync_slave_with_master;
+select hex(c1), hex(c2) from t1;
+
+connection master;
+# Let's have a look at generated SETs.
+--replace_result $MYSQLTEST_VARDIR MYSQL_TEST_DIR/var
+#--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001
+drop table t1;
+sync_slave_with_master;
+
+#
+# BUG#6676: Derivation of variables must be correct on slave
+#
+select "--- --6676--" as "";
+connection master;
+eval create table `t1` (
+ `pk` varchar(10) not null default '',
+ primary key (`pk`)
+) engine=$engine_type default charset=latin1;
+set @p=_latin1 'test';
+update t1 set pk='test' where pk=@p;
+drop table t1;
+sync_slave_with_master;
diff --git a/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test b/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test
new file mode 100644
index 00000000000..2059717b225
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test
@@ -0,0 +1,23 @@
+# See if INSERT DELAYED gets replicated
+# Only in row-based, as we do SHOW BINLOG EVENTS
+
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+connection master;
+let $VERSION=`select version()`;
+eval create table t1(a int not null primary key) engine=$engine_type;
+insert delayed into t1 values (1),(2),(3);
+flush tables;
+SELECT * FROM t1 ORDER BY a;
+sync_slave_with_master;
+
+connection master;
+--replace_result $VERSION VERSION
+--replace_regex /table_id: [0-9]+/table_id: #/
+show binlog events;
+sync_slave_with_master;
+SELECT * FROM t1 ORDER BY a;
+connection master;
+drop table t1;
+sync_slave_with_master;
diff --git a/mysql-test/extra/rpl_tests/rpl_row_func003.test b/mysql-test/extra/rpl_tests/rpl_row_func003.test
new file mode 100644
index 00000000000..153a03da2e7
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_row_func003.test
@@ -0,0 +1,96 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/15/2005 #
+# Update: 08/29/2005 Comment out sleep. Only needed for debugging #
+#############################################################################
+# Note: Many lines are commented out in this test case. These were used for #
+# creating the test case and debugging and are being left for #
+# debugging, but they can not be used for the regular testing as the #
+# Time changes and is not deteministic, so instead we dump both the #
+# master and slave and diff the dumps. If the dumps differ then the #
+# test case will fail. To run during diff failuers, comment out the #
+# diff. #
+# Test: Tests MySQL stored function using RAND() and a flow control. The #
+# test inserts rows into a givin table with the function used in #
+# the insert statement. Depending on the RAND() value returned #
+# inside the function one set of text is returned. In addition, #
+# it uses a transaction to see the effect a rollback has on master #
+# Vs slave. #
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP FUNCTION IF EXISTS test.f1;
+DROP TABLE IF EXISTS test.t1;
+
+--enable_warnings
+
+
+eval CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, c CHAR(16),PRIMARY KEY(a))ENGINE=$engine_type;
+
+delimiter |;
+create function test.f1() RETURNS CHAR(16)
+BEGIN
+ DECLARE tmp CHAR(16);
+ DECLARE var_name FLOAT;
+ SET var_name = RAND();
+ IF var_name > .6
+ THEN SET tmp = 'Texas';
+ ELSE SET tmp = 'MySQL';
+ END IF;
+RETURN tmp;
+END|
+delimiter ;|
+
+INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1());
+sleep 6;
+INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1());
+sleep 6;
+
+#Select in this test are used for debugging
+#select * from test.t1;
+#connection slave;
+#select * from test.t1;
+
+connection master;
+SET AUTOCOMMIT=0;
+START TRANSACTION;
+INSERT INTO test.t1 VALUES (null,test.f1());
+ROLLBACK;
+SET AUTOCOMMIT=1;
+#select * from test.t1;
+#sleep 6;
+
+#connection slave;
+#select * from test.t1;
+
+#connection master;
+
+#used for debugging
+#show binlog events;
+
+# time to dump the databases and so we can see if they match
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/func003_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/func003_slave.sql
+
+# First lets cleanupi
+DROP FUNCTION test.f1;
+DROP TABLE test.t1;
+
+
+# the test will show that the diff statement failed and no reject file
+# will be created. You will need to go to the mysql-test dir and diff
+# the files yourself to see what is not matching :-) File are located
+# in $MYSQLTEST_VARDIR/tmp
+
+exec diff $MYSQLTEST_VARDIR/tmp/func003_master.sql $MYSQLTEST_VARDIR/tmp/func003_slave.sql;
+
+
+# End of 5.0 test case
diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp002.test b/mysql-test/extra/rpl_tests/rpl_row_sp002.test
new file mode 100644
index 00000000000..9d056626cf2
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_row_sp002.test
@@ -0,0 +1,239 @@
+#############################################################################
+# This test is being created to test out the non deterministic items with #
+# row based replication. #
+# Original Author: JBM #
+# Original Date: Aug/09/2005 #
+# Updated: Aug/29/2005 #
+#############################################################################
+# Test: Contains two stored procedures test one that insert data into tables#
+# and use the LAST_INSERTED_ID() on tables with FOREIGN KEY(a) #
+# REFERENCES ON DELETE CASCADE. This test also has a delete sp that #
+# should cause a delete cascade. #
+# The second test has a sp that will either insert rows or delete from#
+# the table depending on the CASE outcome. The test uses this SP in a#
+# transaction first rolling back and then commiting, #
+#############################################################################
+# Mod Date: 08/22/2005 #
+# TEST: Added test to include UPDATE CASCADE on table with FK per Trudy #
+#############################################################################
+
+
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP TABLE IF EXISTS test.t3;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+--enable_warnings
+# End of cleanup
+
+# Begin test section 1
+
+eval CREATE TABLE test.t1 (a INT AUTO_INCREMENT KEY, t CHAR(6)) ENGINE=$engine_type;
+eval CREATE TABLE test.t2 (a INT AUTO_INCREMENT KEY, f INT, FOREIGN KEY(a) REFERENCES test.t1(a) ON DELETE CASCADE) ENGINE=$engine_type;
+
+delimiter |;
+create procedure test.p1(IN i CHAR(6))
+begin
+ INSERT INTO test.t1 (t) VALUES (i);
+ INSERT INTO test.t2 VALUES (NULL,LAST_INSERT_ID());
+end|
+create procedure test.p2(IN i INT)
+begin
+ DELETE FROM test.t1 where a < i;
+end|
+delimiter ;|
+
+let $message=< -- test 1 call p1 -- >;
+--source include/show_msg.inc
+SET FOREIGN_KEY_CHECKS=1;
+call test.p1('texas');
+call test.p1('Live');
+call test.p1('next');
+call test.p1('to');
+call test.p1('OK');
+call test.p1('MySQL');
+
+let $message=< -- test 1 select master after p1 -- >;
+--source include/show_msg.inc
+
+SELECT * FROM test.t1;
+SELECT * FROM test.t2;
+
+let $message=< -- test 1 select slave after p1 -- >;
+--source include/show_msg.inc
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t1;
+SELECT * FROM test.t2;
+
+let $message=< -- test 1 call p2 & select master -- >;
+--source include/show_msg.inc
+connection master;
+call test.p2(4);
+SELECT * FROM test.t1;
+SELECT * FROM test.t2;
+
+let $message=< -- test 1 select slave after p2 -- >;
+--source include/show_msg.inc
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t1;
+SELECT * FROM test.t2;
+
+connection master;
+#show binlog events;
+let $message=< -- End test 1 Begin test 2 -- >;
+--source include/show_msg.inc
+# End test 1 Begin test 2
+
+--disable_warnings
+SET FOREIGN_KEY_CHECKS=0;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+--enable_warnings
+# End of cleanup
+
+eval CREATE TABLE test.t1 (a INT, t CHAR(6), PRIMARY KEY(a)) ENGINE=$engine_type;
+eval CREATE TABLE test.t2 (a INT, f INT, FOREIGN KEY(a) REFERENCES test.t1(a) ON UPDATE CASCADE, PRIMARY KEY(a)) ENGINE=$engine_type;
+
+delimiter |;
+CREATE PROCEDURE test.p1(IN nm INT, IN ch CHAR(6))
+BEGIN
+ INSERT INTO test.t1 (a,t) VALUES (nm, ch);
+ INSERT INTO test.t2 VALUES (nm, LAST_INSERT_ID());
+END|
+CREATE PROCEDURE test.p2(IN i INT)
+BEGIN
+ UPDATE test.t1 SET a = i*10 WHERE a = i;
+END|
+delimiter ;|
+SET FOREIGN_KEY_CHECKS=1;
+CALL test.p1(1,'texas');
+CALL test.p1(2,'Live');
+CALL test.p1(3,'next');
+CALL test.p1(4,'to');
+CALL test.p1(5,'OK');
+CALL test.p1(6,'MySQL');
+
+let $message=< -- test 2 select Master after p1 -- >;
+--source include/show_msg.inc
+SELECT * FROM test.t1;
+SELECT * FROM test.t2;
+
+let $message=< -- test 2 select Slave after p1 -- >;
+--source include/show_msg.inc
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t1;
+SELECT * FROM test.t2;
+
+let $message=< -- test 2 call p2 & select Master -- >;
+--source include/show_msg.inc
+connection master;
+CALL test.p2(2);
+CALL test.p2(4);
+CALL test.p2(6);
+SELECT * FROM test.t1;
+SELECT * FROM test.t2;
+
+let $message=< -- test 1 select Slave after p2 -- >;
+--source include/show_msg.inc
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t1;
+SELECT * FROM test.t2;
+
+connection master;
+#show binlog events;
+let $message=< -- End test 2 Begin test 3 -- >;
+--source include/show_msg.inc
+# End test 2 begin test 3
+
+eval CREATE TABLE test.t3 (a INT AUTO_INCREMENT KEY, t CHAR(6))ENGINE=$engine_type;
+
+delimiter |;
+CREATE PROCEDURE test.p3(IN n INT)
+begin
+CASE n
+WHEN 2 THEN
+ DELETE from test.t3;
+ELSE
+ INSERT INTO test.t3 VALUES (NULL,'NONE');
+END CASE;
+end|
+delimiter ;|
+
+SET AUTOCOMMIT=0;
+START TRANSACTION;
+
+-- disable_query_log
+-- disable_result_log
+let $n=50;
+while ($n)
+{
+ eval call test.p3($n);
+ dec $n;
+}
+-- enable_result_log
+-- enable_query_log
+
+ROLLBACK;
+select * from test.t3;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from test.t3;
+
+connection master;
+START TRANSACTION;
+
+-- disable_query_log
+-- disable_result_log
+let $n=50;
+while ($n>3)
+{
+ eval call test.p3($n);
+ dec $n;
+}
+-- enable_result_log
+-- enable_query_log
+
+COMMIT;
+select * from test.t3;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from test.t3;
+
+connection master;
+#show binlog events from 1626;
+
+
+# First lets cleanup
+SET AUTOCOMMIT=1;
+SET FOREIGN_KEY_CHECKS=0;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp003.test b/mysql-test/extra/rpl_tests/rpl_row_sp003.test
new file mode 100644
index 00000000000..0934e2d6f98
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_row_sp003.test
@@ -0,0 +1,75 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/13/2005 Created from Bug 12335 #
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+--enable_warnings
+# End of cleanup
+
+# Begin test section 1
+
+eval CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=$engine_type;
+
+delimiter |;
+CREATE PROCEDURE test.p1()
+BEGIN
+ INSERT INTO test.t1 VALUES (4);
+ SELECT get_lock("test", 100);
+ UPDATE test.t1 set a=a+4 WHERE a=4;
+END|
+CREATE PROCEDURE test.p2()
+BEGIN
+ UPDATE test.t1 SET a=a+1;
+END|
+delimiter ;|
+
+SELECT get_lock("test", 200);
+
+connection master1;
+send CALL test.p1();
+
+connection master;
+# To make sure tha the call on master1 arrived at the get_lock
+sleep 1;
+CALL test.p2();
+SELECT release_lock("test");
+SELECT * FROM test.t1;
+#show binlog events;
+# Added sleep for use with NDB to ensure that
+# the injector thread will populate log before
+# we switch to the slave.
+sleep 5;
+sync_slave_with_master;
+connection slave;
+SELECT * FROM test.t1;
+
+connection master;
+DROP TABLE IF EXISTS test.t1;
+eval CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=$engine_type;
+CALL test.p2();
+CALL test.p1();
+SELECT * FROM test.t1;
+
+sync_slave_with_master;
+connection slave;
+SELECT * FROM test.t1;
+connection master;
+#show binlog events from 719;
+
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp006.test b/mysql-test/extra/rpl_tests/rpl_row_sp006.test
new file mode 100644
index 00000000000..25073e54991
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_row_sp006.test
@@ -0,0 +1,91 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/15/2005 #
+# Updated: 08/29/2005 to remove sleeps #
+#############################################################################
+# Test: This test uses two SPs, one to populate a table, and another to use #
+# Cursors, CURRENT_DATE(), loop control, date math and logic control #
+# to populate a table with data from the first table. #
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+create database if not exists mysqltest1;
+DROP PROCEDURE IF EXISTS mysqltest1.p1;
+DROP PROCEDURE IF EXISTS mysqltest1.p2;
+DROP TABLE IF EXISTS mysqltest1.t2;
+DROP TABLE IF EXISTS mysqltest1.t1;
+--enable_warnings
+# End of cleanup
+
+# Begin test section 1
+eval CREATE TABLE IF NOT EXISTS mysqltest1.t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=$engine_type;
+eval CREATE TABLE IF NOT EXISTS mysqltest1.t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=$engine_type;
+
+delimiter |;
+CREATE PROCEDURE mysqltest1.p1()
+BEGIN
+ DECLARE done INT DEFAULT 0;
+ DECLARE spa CHAR(16);
+ DECLARE spb INT;
+ DECLARE cur1 CURSOR FOR SELECT name,
+ (YEAR(CURDATE())-YEAR(birth))-(RIGHT(CURDATE(),5)<RIGHT(birth,5))
+ FROM mysqltest1.t1;
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
+
+ OPEN cur1;
+
+ SET AUTOCOMMIT=0;
+ REPEAT
+ FETCH cur1 INTO spa, spb;
+ IF NOT done THEN
+ START TRANSACTION;
+ INSERT INTO mysqltest1.t2 VALUES (spa,spb);
+ COMMIT;
+ END IF;
+ UNTIL done END REPEAT;
+
+ SET AUTOCOMMIT=1;
+ CLOSE cur1;
+END|
+CREATE PROCEDURE mysqltest1.p2()
+BEGIN
+ INSERT INTO mysqltest1.t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
+END|
+delimiter ;|
+
+CALL mysqltest1.p2();
+sync_slave_with_master;
+
+connection master;
+CALL mysqltest1.p1();
+sync_slave_with_master;
+
+connection master;
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/sp006_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/sp006_slave.sql
+
+
+DROP PROCEDURE IF EXISTS mysqltest1.p1;
+DROP PROCEDURE IF EXISTS mysqltest1.p2;
+DROP TABLE IF EXISTS mysqltest1.t1;
+DROP TABLE IF EXISTS mysqltest1.t2;
+DROP DATABASE mysqltest1;
+
+# Lets compare. Note: If they match test will pass, if they do not match
+# the test will show that the diff statement failed and not reject file
+# will be created. You will need to go to the mysql-test dir and diff
+# the files your self to see what is not matching :-) Failed test
+# Dump files will be located in $MYSQLTEST_VARDIR/tmp.
+
+exec diff $MYSQLTEST_VARDIR/tmp/sp006_master.sql $MYSQLTEST_VARDIR/tmp/sp006_slave.sql;
+
+sync_slave_with_master;
+
+# End of 5.1 test case
diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp007.test b/mysql-test/extra/rpl_tests/rpl_row_sp007.test
new file mode 100644
index 00000000000..8f2b72e4d32
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_row_sp007.test
@@ -0,0 +1,70 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/15/2005 #
+# Updated: 08/29/2005 Remove sleeps #
+#############################################################################
+# TEST: SP that creates table, starts tranaction inserts. Save point, insert#
+# rollback to save point and then commits. #
+#############################################################################
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
+--enable_warnings
+# End of cleanup
+
+# Begin test section 1
+delimiter |;
+eval CREATE PROCEDURE test.p1(IN i INT)
+BEGIN
+ DECLARE CONTINUE HANDLER FOR sqlexception BEGIN END;
+ DROP TABLE IF EXISTS test.t1;
+ CREATE TABLE test.t1 (num INT,PRIMARY KEY(num))ENGINE=$engine_type;
+ START TRANSACTION;
+ INSERT INTO test.t1 VALUES(i);
+ savepoint t1_save;
+ INSERT INTO test.t1 VALUES (14);
+ ROLLBACK to savepoint t1_save;
+ COMMIT;
+END|
+delimiter ;|
+
+let $message=< ---- Master selects-- >;
+--source include/show_msg.inc
+CALL test.p1(12);
+SELECT * FROM test.t1;
+
+
+let $message=< ---- Slave selects-- >;
+--source include/show_msg.inc
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t1;
+
+let $message=< ---- Master selects-- >;
+--source include/show_msg.inc
+connection master;
+CALL test.p1(13);
+SELECT * FROM test.t1;
+
+let $message=< ---- Slave selects-- >;
+--source include/show_msg.inc
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t1;
+
+connection master;
+#show binlog events;
+
+
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
+
+# End of 5.0 test case
diff --git a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test
new file mode 100644
index 00000000000..54c14594cf4
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test
@@ -0,0 +1,240 @@
+# Test how replication of tables work when the definition on the
+# master and slave differs.
+
+# Consider making these part of the basic RBR tests.
+
+connection master;
+--disable_warnings
+--disable_query_log
+DROP TABLE IF EXISTS t1_int,t1_bit,t1_char,t1_nodef;
+DROP TABLE IF EXISTS t2,t3,t4,t5,t6,t9;
+--enable_query_log
+--enable_warnings
+sync_slave_with_master;
+STOP SLAVE;
+SET GLOBAL SQL_MODE='STRICT_ALL_TABLES';
+START SLAVE;
+
+connection master;
+eval CREATE TABLE t1_int (a INT PRIMARY KEY, b INT) ENGINE=$engine_type;
+eval CREATE TABLE t1_bit (a INT PRIMARY KEY, b INT) ENGINE=$engine_type;
+eval CREATE TABLE t1_char (a INT PRIMARY KEY, b INT) ENGINE=$engine_type;
+eval CREATE TABLE t1_nodef (a INT PRIMARY KEY, b INT) ENGINE=$engine_type;
+eval CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=$engine_type;
+eval CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=$engine_type;
+eval CREATE TABLE t4 (a INT) ENGINE=$engine_type;
+eval CREATE TABLE t5 (a INT, b INT, c INT) ENGINE=$engine_type;
+eval CREATE TABLE t6 (a INT, b INT, c INT) ENGINE=$engine_type;
+eval CREATE TABLE t7 (a INT NOT NULL) ENGINE=$engine_type;
+eval CREATE TABLE t8 (a INT NOT NULL) ENGINE=$engine_type;
+
+# Table used to detect that slave is running
+eval CREATE TABLE t9 (a INT) ENGINE=$engine_type;
+
+sync_slave_with_master;
+
+# On the slave, we add one INT column last in table 't1_int',
+ALTER TABLE t1_int ADD x INT DEFAULT 42;
+# ... and add BIT columns last in table 't1_bit' to ensure that we
+# have at least one extra null byte on the slave,
+ALTER TABLE t1_bit
+ ADD x BIT(3) DEFAULT b'011',
+ ADD y BIT(5) DEFAULT b'10101',
+ ADD z BIT(2) DEFAULT b'10';
+# ... and add one CHAR column last in table 't1_char',
+ALTER TABLE t1_char ADD x CHAR(20) DEFAULT 'Just a test';
+# ... and add one non-nullable INT column last in table 't1_text'
+# with no default,
+ALTER TABLE t1_nodef ADD x INT NOT NULL;
+# ... and remove the last column in t2
+ALTER TABLE t2 DROP b;
+# ... change the type of the single column in table 't4'
+ALTER TABLE t4 MODIFY a FLOAT;
+# ... change the type of the middle column of table 't5'
+ALTER TABLE t5 MODIFY b FLOAT;
+# ... change the type of the last column of table 't6'
+ALTER TABLE t6 MODIFY c FLOAT;
+
+# ... add one byte worth of null bytes to the table on the slave
+ALTER TABLE t7 ADD e1 INT, ADD e2 INT, ADD e3 INT, ADD e4 INT,
+ ADD e5 INT, ADD e6 INT, ADD e7 INT, ADD e8 INT;
+
+# ... add 8 columns that are nullable: t8 will not be entirely
+# nullable and have no null bits (just an X bit)
+ALTER TABLE t8 ADD e1 INT NOT NULL DEFAULT 0, ADD e2 INT NOT NULL DEFAULT 0,
+ ADD e3 INT NOT NULL DEFAULT 0, ADD e4 INT NOT NULL DEFAULT 0,
+ ADD e5 INT NOT NULL DEFAULT 0, ADD e6 INT NOT NULL DEFAULT 0,
+ ADD e7 INT NOT NULL DEFAULT 0, ADD e8 INT NOT NULL DEFAULT 0;
+
+# Insert some values for tables on slave side. These should not be
+# modified when the row from the master is applied.
+INSERT INTO t1_int VALUES (2, 4, 4711);
+INSERT INTO t1_char VALUES (2, 4, 'Foo is a bar');
+INSERT INTO t1_bit VALUES (2, 4, b'101', b'11100', b'01');
+
+--echo **** On Master ****
+connection master;
+INSERT INTO t1_int VALUES (1,2);
+INSERT INTO t1_int VALUES (2,5);
+INSERT INTO t1_bit VALUES (1,2);
+INSERT INTO t1_bit VALUES (2,5);
+INSERT INTO t1_char VALUES (1,2);
+INSERT INTO t1_char VALUES (2,5);
+SELECT * FROM t1_int;
+SELECT * FROM t1_bit;
+SELECT * FROM t1_char;
+--echo **** On Slave ****
+sync_slave_with_master;
+SELECT a,b,x FROM t1_int;
+SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
+SELECT a,b,x FROM t1_char;
+
+--echo **** On Master ****
+connection master;
+UPDATE t1_int SET b=2*b WHERE a=2;
+UPDATE t1_char SET b=2*b WHERE a=2;
+UPDATE t1_bit SET b=2*b WHERE a=2;
+SELECT * FROM t1_int;
+SELECT * FROM t1_bit;
+SELECT * FROM t1_char;
+--echo **** On Slave ****
+sync_slave_with_master;
+SELECT a,b,x FROM t1_int;
+SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
+SELECT a,b,x FROM t1_char;
+
+# Each of these inserts should generate an error and stop the slave
+
+connection master;
+INSERT INTO t9 VALUES (2);
+sync_slave_with_master;
+# Now slave is guaranteed to be running
+connection master;
+INSERT INTO t1_nodef VALUES (1,2);
+connection slave;
+wait_for_slave_to_stop;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+
+connection master;
+INSERT INTO t9 VALUES (2);
+sync_slave_with_master;
+# Now slave is guaranteed to be running
+connection master;
+INSERT INTO t2 VALUES (2,4);
+connection slave;
+wait_for_slave_to_stop;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+
+connection master;
+INSERT INTO t9 VALUES (4);
+sync_slave_with_master;
+# Now slave is guaranteed to be running
+connection master;
+INSERT INTO t4 VALUES (4);
+connection slave;
+wait_for_slave_to_stop;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+
+connection master;
+INSERT INTO t9 VALUES (5);
+sync_slave_with_master;
+# Now slave is guaranteed to be running
+connection master;
+INSERT INTO t5 VALUES (5,10,25);
+connection slave;
+wait_for_slave_to_stop;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+
+connection master;
+INSERT INTO t9 VALUES (6);
+sync_slave_with_master;
+# Now slave is guaranteed to be running
+connection master;
+INSERT INTO t6 VALUES (6,12,36);
+connection slave;
+wait_for_slave_to_stop;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+
+connection master;
+INSERT INTO t9 VALUES (6);
+sync_slave_with_master;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+
+# Testing some tables extra field that can be null and cannot be null
+# (but have default values)
+
+connection master;
+INSERT INTO t7 VALUES (1),(2),(3);
+INSERT INTO t8 VALUES (1),(2),(3);
+SELECT * FROM t7;
+SELECT * FROM t8;
+sync_slave_with_master;
+SELECT * FROM t7;
+SELECT * FROM t8;
+
+# We will now try to update and then delete a row on the master where
+# the extra field on the slave does not have a default value. This
+# update should not generate an error even though there is no default
+# for the extra column.
+
+--echo **** On Master ****
+connection master;
+TRUNCATE t1_nodef;
+SET SQL_LOG_BIN=0;
+INSERT INTO t1_nodef VALUES (1,2);
+INSERT INTO t1_nodef VALUES (2,4);
+SET SQL_LOG_BIN=1;
+sync_slave_with_master;
+
+--echo **** On Slave ****
+connection slave;
+INSERT INTO t1_nodef VALUES (1,2,3);
+INSERT INTO t1_nodef VALUES (2,4,6);
+
+--echo **** On Master ****
+connection master;
+UPDATE t1_nodef SET b=2*b WHERE a=1;
+SELECT * FROM t1_nodef;
+
+--echo **** On Slave ****
+sync_slave_with_master;
+SELECT * FROM t1_nodef;
+
+--echo **** On Master ****
+connection master;
+DELETE FROM t1_nodef WHERE a=2;
+SELECT * FROM t1_nodef;
+
+--echo **** On Slave ****
+sync_slave_with_master;
+SELECT * FROM t1_nodef;
+
+--echo **** Cleanup ****
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS t1_int,t1_bit,t1_char,t1_nodef;
+DROP TABLE IF EXISTS t2,t3,t4,t5,t6,t7,t8,t9;
+--enable_warnings
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl000001.test b/mysql-test/extra/rpl_tests/rpl_stm_000001.test
index 5b4b29addc4..8673ae31305 100644
--- a/mysql-test/t/rpl000001.test
+++ b/mysql-test/extra/rpl_tests/rpl_stm_000001.test
@@ -1,4 +1,5 @@
-source include/master-slave.inc;
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/master-slave.inc
create table t1 (word char(20) not null);
load data infile '../std_data_ln/words.dat' into table t1;
@@ -44,7 +45,7 @@ sync_with_master;
connection master;
# we'll use table-level locking to delay slave SQL thread
-create table t1 (n int) engine=myisam;
+eval create table t1 (n int) engine=$engine_type;
sync_slave_with_master;
connection master;
reset master;
diff --git a/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test b/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test
new file mode 100644
index 00000000000..6abd2ae844e
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test
@@ -0,0 +1,30 @@
+###################################
+# Author: JBM
+# Date: 2006-01-11
+# Purpose: Second test case from
+# rpl_EE_err.test split out
+# from orginal to make the
+# first work with both RBR and SBR
+###################################
+#REQUIREMENT: An INSERT with a faked duplicate entry error on
+#master should be replicated to slave and force the slave to stop
+#(since the slave can't cause a faked error to re-occur).
+###################################
+
+-- source include/master-slave.inc
+
+connection master;
+eval create table t1 (a int, unique(a)) engine=$engine_type;
+set sql_log_bin=0;
+insert into t1 values(2);
+set sql_log_bin=1;
+save_master_pos;
+--error 1062
+insert into t1 values(1),(2);
+drop table t1;
+save_master_pos;
+connection slave;
+wait_for_slave_to_stop;
+
+# End of 4.1 tests
+
diff --git a/mysql-test/t/rpl_charset.test b/mysql-test/extra/rpl_tests/rpl_stm_charset.test
index e916ae9ad6c..10b4310127f 100644
--- a/mysql-test/t/rpl_charset.test
+++ b/mysql-test/extra/rpl_tests/rpl_stm_charset.test
@@ -1,6 +1,9 @@
# Replication of character sets.
# This test will fail if the server/client does not support enough charsets.
+# Requires statement logging
+-- source include/have_binlog_format_mixed_or_statement.inc
+
source include/master-slave.inc;
--disable_warnings
set timestamp=1000000000;
@@ -107,7 +110,8 @@ connection master;
drop database mysqltest2;
drop database mysqltest3;
--replace_column 2 # 5 #
-show binlog events from 98;
+--replace_regex /table_id: [0-9]+/table_id: #/
+show binlog events from 102;
sync_slave_with_master;
# Check that we can change global.collation_server (since 5.0.3)
@@ -161,10 +165,10 @@ sync_slave_with_master;
# BUG#6676: Derivation of variables must be correct on slave
#
connection master;
-create table `t1` (
+eval create table `t1` (
`pk` varchar(10) not null default '',
primary key (`pk`)
-) engine=myisam default charset=latin1;
+) engine=$engine_type default charset=latin1;
set @p=_latin1 'test';
update t1 set pk='test' where pk=@p;
drop table t1;
diff --git a/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test b/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test
new file mode 100644
index 00000000000..3b6fe7a0ef4
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test
@@ -0,0 +1,35 @@
+####################
+# Change Author: JBM
+# Change Date: 2006-01-17
+# Change: Added order by in select
+####################
+# Change Date: 2006-02-02
+# Change: renamed to make bettre sense,
+# and wrapped per Engine test
+############################
+source include/master-slave.inc;
+
+#
+# Bug#7100 relay_log_space_max missing from SHOW VARIABLES
+#
+SHOW VARIABLES LIKE 'relay_log_space_limit';
+
+# Matz says: I have no idea what this is supposed to test, but it has
+# potential for generating different results with some storage engines
+# that process rows in an order not dependent on the insertion order.
+# For instance, I would assume that distributed storage engines (like
+# NDB) could process rows based on locality.
+
+eval CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=$engine_type;
+INSERT INTO t1 SET name='Andy', age=31;
+INSERT INTO t1 SET name='Jacob', age=2;
+INSERT INTO t1 SET name='Caleb', age=1;
+ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY;
+SELECT * FROM t1 ORDER BY id;
+sync_slave_with_master;
+SELECT * FROM t1 ORDER BY id;
+connection master;
+DROP TABLE t1;
+sync_slave_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/extra/rpl_tests/rpl_trig004.test b/mysql-test/extra/rpl_tests/rpl_trig004.test
new file mode 100644
index 00000000000..0206241eae9
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_trig004.test
@@ -0,0 +1,53 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/09/2005 #
+#############################################################################
+# TEST: Use after insert and before inset triggers and stored procdures to #
+# Update and insert data #
+#############################################################################
+# Change Auth: JBM #
+# Date: 2006-02-14 #
+# Change: Added error, sleep and comments (ndb) #
+####################################################
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+--error 0,1360
+DROP TRIGGER test.t1_bi_t2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+
+
+eval CREATE TABLE test.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d FLOAT, PRIMARY KEY(n))ENGINE=$engine_type;
+eval CREATE TABLE test.t2 (n MEDIUMINT NOT NULL, f FLOAT, PRIMARY KEY(n))ENGINE=$engine_type;
+
+
+delimiter //;
+CREATE TRIGGER test.t1_bi_t2 BEFORE INSERT ON test.t2 FOR EACH ROW INSERT INTO test.t1 VALUES (NULL, 1.234)//
+delimiter ;//
+
+INSERT INTO test.t2 VALUES (1, 0.0);
+# Expect duplicate error 1022 == ndb
+--error 1022,1062
+INSERT INTO test.t2 VALUES (1, 0.0);
+
+#show binlog events;
+select * from test.t1;
+select * from test.t2;
+# Have to sleep for a few seconds to allow
+# NDB injector thread to populate binlog
+sleep 10;
+sync_slave_with_master;
+connection slave;
+select * from test.t1;
+select * from test.t2;
+
+connection master;
+
+DROP TRIGGER test.t1_bi_t2;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+
+sync_slave_with_master;
+# End of 5.0 test case
diff --git a/mysql-test/extra/rpl_tests/rpl_truncate.test b/mysql-test/extra/rpl_tests/rpl_truncate.test
new file mode 100644
index 00000000000..37fd9fbc064
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_truncate.test
@@ -0,0 +1,36 @@
+#
+# Copyright 2006 MySQL. All rights reserved.
+#
+# Test to check for the different version of truncating a table.
+# The statements are "TRUNCATE tbl" and "DELETE FROM tbl". We check
+# the behaviour of each possible value for BINLOG_FORMAT.
+#
+# Author(s): Mats Kindahl
+
+--source include/have_row_based.inc
+--source include/master-slave.inc
+
+let $format = STATEMENT;
+let $stmt = TRUNCATE TABLE;
+--source extra/rpl_tests/rpl_truncate_helper.test
+
+let $format = MIXED;
+let $stmt = TRUNCATE TABLE;
+--source extra/rpl_tests/rpl_truncate_helper.test
+
+let $format = ROW;
+let $stmt = TRUNCATE TABLE;
+--source extra/rpl_tests/rpl_truncate_helper.test
+
+let $format = STATEMENT;
+let $stmt = DELETE FROM;
+--source extra/rpl_tests/rpl_truncate_helper.test
+
+let $format = MIXED;
+let $stmt = DELETE FROM;
+--source extra/rpl_tests/rpl_truncate_helper.test
+
+let $format = ROW;
+let $stmt = DELETE FROM;
+--source extra/rpl_tests/rpl_truncate_helper.test
+
diff --git a/mysql-test/extra/rpl_tests/rpl_truncate_helper.test b/mysql-test/extra/rpl_tests/rpl_truncate_helper.test
new file mode 100644
index 00000000000..7f1506c4010
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_truncate_helper.test
@@ -0,0 +1,42 @@
+
+--disable_query_log
+--disable_warnings
+connection slave;
+STOP SLAVE;
+connection master;
+DROP TABLE IF EXISTS t1;
+RESET MASTER;
+connection slave;
+DROP TABLE IF EXISTS t1;
+RESET SLAVE;
+START SLAVE;
+--enable_warnings
+--enable_query_log
+
+--echo **** On Master ****
+connection master;
+eval SET SESSION BINLOG_FORMAT=$format;
+eval SET GLOBAL BINLOG_FORMAT=$format;
+
+eval CREATE TABLE t1 (a INT, b LONG) ENGINE=$engine;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+--echo **** On Slave ****
+sync_slave_with_master;
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+--echo **** On Master ****
+connection master;
+eval $stmt t1;
+SELECT * FROM t1;
+--echo **** On Slave ****
+sync_slave_with_master;
+# Should be empty
+SELECT * FROM t1;
+--echo **** On Master ****
+connection master;
+DROP TABLE t1;
+let $SERVER_VERSION=`select version()`;
+--replace_result $SERVER_VERSION SERVER_VERSION
+--replace_regex /\/\* xid=[0-9]+ \*\//\/* xid= *\// /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS;
diff --git a/mysql-test/include/check-testcase.test b/mysql-test/include/check-testcase.test
index 30cb7391f30..5bdbf6cd072 100644
--- a/mysql-test/include/check-testcase.test
+++ b/mysql-test/include/check-testcase.test
@@ -21,13 +21,13 @@ show databases;
#
# Dump the "test" database, all it's tables and their data
#
---exec $MYSQL_DUMP --skip-comments test
+--exec $MYSQL_DUMP --skip-comments --skip-lock-tables test
#
# Dump the "mysql" database and it's tables
# Select data separately to add "order by"
#
---exec $MYSQL_DUMP --skip-comments --no-data mysql
+--exec $MYSQL_DUMP --skip-comments --skip-lock-tables --no-data mysql
use mysql;
select * from columns_priv;
select * from db order by host, db, user;
diff --git a/mysql-test/include/concurrent.inc b/mysql-test/include/concurrent.inc
new file mode 100644
index 00000000000..7eee50c52e6
--- /dev/null
+++ b/mysql-test/include/concurrent.inc
@@ -0,0 +1,357 @@
+# include/concurrent.inc
+#
+# Concurrent tests for transactional storage engines, mainly in UPDATE's
+# Bug#3300
+# Designed and tested by Sinisa Milivojevic, sinisa@mysql.com
+#
+# two non-interfering UPDATE's not changing result set
+#
+# The variable
+# $engine_type -- storage engine to be tested
+# has to be set before sourcing this script.
+#
+# Last update:
+# 2006-08-02 ML test refactored
+# old name was t/innodb_concurrent.test
+# main code went into include/concurrent.inc
+#
+
+connection default;
+eval SET SESSION STORAGE_ENGINE = $engine_type;
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1(eta int(11) not null, tipo int(11), c varchar(255));
+connect (thread1, localhost, mysqltest,,);
+connection thread1;
+eval SET SESSION STORAGE_ENGINE = $engine_type;
+insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
+insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
+insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
+insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
+insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
+insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
+insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
+insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
+insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
+select get_lock("hello",1);
+connect (thread2, localhost, mysqltest,,);
+connection thread2;
+begin;
+send update t1 set eta=1+get_lock("hello",1)*0 where tipo=11;
+sleep 1;
+connection thread1;
+begin;
+update t1 set eta=2 where tipo=22;
+select release_lock("hello");
+select * from t1;
+connection thread2;
+reap;
+select * from t1;
+send commit;
+connection thread1;
+select * from t1;
+commit;
+select * from t1;
+connection thread2;
+reap;
+select * from t1;
+connection thread1;
+select * from t1;
+connection default;
+drop table t1;
+
+#
+# two UPDATE's running and one changing result set
+#
+#connect (thread1, localhost, mysqltest,,);
+connection thread1;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255));
+insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
+insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
+insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
+insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
+insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
+insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
+insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
+insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
+insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
+select get_lock("hello",10);
+#connect (thread2, localhost, mysqltest,,);
+connection thread2;
+begin;
+send update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
+sleep 1;
+connection thread1;
+begin;
+update t1 set tipo=1 where tipo=2;
+select release_lock("hello");
+select * from t1;
+connection thread2;
+reap;
+select * from t1;
+send commit;
+connection thread1;
+select * from t1;
+commit;
+select * from t1;
+connection thread2;
+reap;
+select * from t1;
+connection thread1;
+select * from t1;
+connection default;
+drop table t1;
+
+
+#
+# One UPDATE and one INSERT .... Monty's test
+#
+
+#connect (thread1, localhost, mysqltest,,);
+connection thread1;
+create table t1 (a int not null, b int not null);
+insert into t1 values (1,1),(2,1),(3,1),(4,1);
+select get_lock("hello2",1000);
+#connect (thread2, localhost, mysqltest,,);
+connection thread2;
+begin;
+send update t1 set b=10+get_lock(concat("hello",a),1000)*0 where
+a=2;
+sleep 1;
+connection thread1;
+insert into t1 values (1,1);
+select release_lock("hello2");
+select * from t1;
+connection thread2;
+reap;
+select * from t1;
+send commit;
+connection thread1;
+sleep 1;
+connection thread2;
+reap;
+connection default;
+drop table t1;
+
+#
+# one UPDATE changing result set and SELECT ... FOR UPDATE
+#
+#connect (thread1, localhost, mysqltest,,);
+connection thread1;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255));
+insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
+insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
+insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
+insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
+insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
+insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
+insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
+insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
+insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
+select get_lock("hello",10);
+#connect (thread2, localhost, mysqltest,,);
+connection thread2;
+begin;
+send select * from t1 where tipo=2 FOR UPDATE;
+sleep 1;
+connection thread1;
+begin;
+select release_lock("hello");
+--error 1205
+update t1 set tipo=1+get_lock("hello",10)*0 where tipo=2;
+select * from t1;
+connection thread2;
+reap;
+select * from t1;
+send commit;
+connection thread1;
+commit;
+connection thread2;
+reap;
+select * from t1;
+connection thread1;
+select * from t1;
+connection default;
+drop table t1;
+
+#
+# one UPDATE not changing result set and SELECT ... FOR UPDATE
+#
+#connect (thread1, localhost, mysqltest,,);
+connection thread1;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255));
+insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
+insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
+insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
+insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
+insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
+insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
+insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
+insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
+insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
+select get_lock("hello",10);
+#connect (thread2, localhost, mysqltest,,);
+connection thread2;
+begin;
+send select * from t1 where tipo=2 FOR UPDATE;
+sleep 1;
+connection thread1;
+begin;
+select release_lock("hello");
+--error 1205
+update t1 set tipo=11+get_lock("hello",10)*0 where tipo=22;
+select * from t1;
+connection thread2;
+reap;
+select * from t1;
+send commit;
+connection thread1;
+commit;
+connection thread2;
+reap;
+select * from t1;
+connection thread1;
+select * from t1;
+connection default;
+drop table t1;
+
+#
+# two SELECT ... FOR UPDATE
+#
+#connect (thread1, localhost, mysqltest,,);
+connection thread1;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255));
+insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
+insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
+insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
+insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
+insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
+insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
+insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
+insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
+insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
+select get_lock("hello",10);
+#connect (thread2, localhost, mysqltest,,);
+connection thread2;
+begin;
+send select * from t1 where tipo=2 FOR UPDATE;
+sleep 1;
+connection thread1;
+begin;
+select release_lock("hello");
+--error 1205
+select * from t1 where tipo=1 FOR UPDATE;
+connection thread2;
+reap;
+select * from t1;
+send commit;
+connection thread1;
+commit;
+connection thread2;
+reap;
+select * from t1;
+connection thread1;
+select * from t1;
+connection default;
+drop table t1;
+
+
+#
+# one UPDATE changing result set and DELETE
+#
+#connect (thread1, localhost, mysqltest,,);
+connection thread1;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255));
+insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
+insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
+insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
+insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
+insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
+insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
+insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
+insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
+insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
+select get_lock("hello",10);
+#connect (thread2, localhost, mysqltest,,);
+connection thread2;
+begin;
+send delete from t1 where tipo=2;
+sleep 1;
+connection thread1;
+begin;
+select release_lock("hello");
+--error 1205
+update t1 set tipo=1+get_lock("hello",10)*0 where tipo=2;
+select * from t1;
+connection thread2;
+reap;
+select * from t1;
+send commit;
+connection thread1;
+commit;
+connection thread2;
+reap;
+select * from t1;
+connection thread1;
+select * from t1;
+connection default;
+drop table t1;
+
+
+#
+# one UPDATE not changing result set and DELETE
+#
+#connect (thread1, localhost, mysqltest,,);
+connection thread1;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255));
+insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
+insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
+insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
+insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
+insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
+insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
+insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
+insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
+insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
+select get_lock("hello",10);
+#connect (thread2, localhost, mysqltest,,);
+connection thread2;
+begin;
+send delete from t1 where tipo=2;
+sleep 1;
+connection thread1;
+begin;
+select release_lock("hello");
+update t1 set tipo=1+get_lock("hello",10)*0 where tipo=22;
+select * from t1;
+connection thread2;
+reap;
+select * from t1;
+send commit;
+connection thread1;
+commit;
+connection thread2;
+reap;
+select * from t1;
+connection thread1;
+select * from t1;
+connection default;
+sleep 1;
+drop table t1;
+disconnect thread1;
+disconnect thread2;
diff --git a/mysql-test/include/deadlock.inc b/mysql-test/include/deadlock.inc
new file mode 100644
index 00000000000..41c68f39320
--- /dev/null
+++ b/mysql-test/include/deadlock.inc
@@ -0,0 +1,147 @@
+# include/deadlock.inc
+#
+# The variable
+# $engine_type -- storage engine to be tested
+# has to be set before sourcing this script.
+#
+# Last update:
+# 2006-07-26 ML refactoring + print when connection is switched
+# old name was t/innodb-deadlock.test
+# main code went into include/deadlock.inc
+#
+
+--echo # Establish connection con1 (user=root)
+connect (con1,localhost,root,,);
+--echo # Establish connection con2 (user=root)
+connect (con2,localhost,root,,);
+
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+#
+# Testing of FOR UPDATE
+#
+
+--echo # Switch to connection con1
+connection con1;
+eval create table t1 (id integer, x integer) engine = $engine_type;
+insert into t1 values(0, 0);
+set autocommit=0;
+SELECT * from t1 where id = 0 FOR UPDATE;
+
+--echo # Switch to connection con2
+connection con2;
+set autocommit=0;
+
+# The following query should hang because con1 is locking the record
+--send
+update t1 set x=2 where id = 0;
+--sleep 2
+
+--echo # Switch to connection con1
+connection con1;
+update t1 set x=1 where id = 0;
+select * from t1;
+commit;
+
+--echo # Switch to connection con2
+connection con2;
+reap;
+commit;
+
+--echo # Switch to connection con1
+connection con1;
+select * from t1;
+commit;
+
+drop table t1;
+#
+# Testing of FOR UPDATE
+#
+
+--echo # Switch to connection con1
+connection con1;
+eval create table t1 (id integer, x integer) engine = $engine_type;
+eval create table t2 (b integer, a integer) engine = $engine_type;
+insert into t1 values(0, 0), (300, 300);
+insert into t2 values(0, 10), (1, 20), (2, 30);
+commit;
+set autocommit=0;
+select * from t2;
+update t2 set a=100 where b=(SELECT x from t1 where id = b FOR UPDATE);
+select * from t2;
+select * from t1;
+
+--echo # Switch to connection con2
+connection con2;
+set autocommit=0;
+
+# The following query should hang because con1 is locking the record
+--send
+update t1 set x=2 where id = 0;
+--sleep 2
+
+--echo # Switch to connection con1
+connection con1;
+update t1 set x=1 where id = 0;
+select * from t1;
+commit;
+
+--echo # Switch to connection con2
+connection con2;
+reap;
+commit;
+
+--echo # Switch to connection con1
+connection con1;
+select * from t1;
+commit;
+
+drop table t1, t2;
+eval create table t1 (id integer, x integer) engine = $engine_type;
+eval create table t2 (b integer, a integer) engine = $engine_type;
+insert into t1 values(0, 0), (300, 300);
+insert into t2 values(0, 0), (1, 20), (2, 30);
+commit;
+
+--echo # Switch to connection con1
+connection con1;
+select a,b from t2 UNION SELECT id, x from t1 FOR UPDATE;
+select * from t2;
+select * from t1;
+
+--echo # Switch to connection con2
+connection con2;
+
+# The following query should hang because con1 is locking the record
+update t2 set a=2 where b = 0;
+select * from t2;
+--send
+update t1 set x=2 where id = 0;
+--sleep 2
+
+--echo # Switch to connection con1
+connection con1;
+update t1 set x=1 where id = 0;
+select * from t1;
+commit;
+
+--echo # Switch to connection con2
+connection con2;
+reap;
+commit;
+
+--echo # Switch to connection con1
+connection con1;
+select * from t1;
+commit;
+
+# Cleanup
+--echo # Switch to connection default + disconnect con1 and con2
+connection default;
+disconnect con1;
+disconnect con2;
+drop table t1, t2;
+
+# End of 4.1 tests
diff --git a/mysql-test/include/gis_generic.inc b/mysql-test/include/gis_generic.inc
index e5e7283e0e6..3abc18283fa 100644
--- a/mysql-test/include/gis_generic.inc
+++ b/mysql-test/include/gis_generic.inc
@@ -8,14 +8,14 @@
DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
--enable_warnings
-CREATE TABLE gis_point (fid INTEGER, g POINT);
-CREATE TABLE gis_line (fid INTEGER, g LINESTRING);
-CREATE TABLE gis_polygon (fid INTEGER, g POLYGON);
-CREATE TABLE gis_multi_point (fid INTEGER, g MULTIPOINT);
-CREATE TABLE gis_multi_line (fid INTEGER, g MULTILINESTRING);
-CREATE TABLE gis_multi_polygon (fid INTEGER, g MULTIPOLYGON);
-CREATE TABLE gis_geometrycollection (fid INTEGER, g GEOMETRYCOLLECTION);
-CREATE TABLE gis_geometry (fid INTEGER, g GEOMETRY);
+CREATE TABLE gis_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POINT);
+CREATE TABLE gis_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g LINESTRING);
+CREATE TABLE gis_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POLYGON);
+CREATE TABLE gis_multi_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOINT);
+CREATE TABLE gis_multi_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTILINESTRING);
+CREATE TABLE gis_multi_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOLYGON);
+CREATE TABLE gis_geometrycollection (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRYCOLLECTION);
+CREATE TABLE gis_geometry (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRY);
SHOW CREATE TABLE gis_point;
SHOW FIELDS FROM gis_point;
@@ -141,6 +141,7 @@ DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gi
# Check that ALTER TABLE doesn't loose geometry type
#
CREATE TABLE t1 (
+ a INTEGER PRIMARY KEY AUTO_INCREMENT,
gp point,
ln linestring,
pg polygon,
@@ -156,24 +157,24 @@ ALTER TABLE t1 ADD fid INT;
SHOW FIELDS FROM t1;
DROP TABLE t1;
-create table t1 (a geometry not null);
-insert into t1 values (GeomFromText('Point(1 2)'));
+create table t1 (pk integer primary key auto_increment, a geometry not null);
+insert into t1 (a) values (GeomFromText('Point(1 2)'));
-- error 1416
-insert into t1 values ('Garbage');
+insert into t1 (a) values ('Garbage');
-- error 1416
-insert IGNORE into t1 values ('Garbage');
+insert IGNORE into t1 (a) values ('Garbage');
drop table t1;
-create table t1 (fl geometry);
+create table t1 (pk integer primary key auto_increment, fl geometry);
--error 1416
-insert into t1 values (1);
+insert into t1 (fl) values (1);
--error 1416
-insert into t1 values (1.11);
+insert into t1 (fl) values (1.11);
--error 1416
-insert into t1 values ("qwerty");
+insert into t1 (fl) values ("qwerty");
--error 1416
-insert into t1 values (pointfromtext('point(1,1)'));
+insert into t1 (fl) values (pointfromtext('point(1,1)'));
drop table t1;
diff --git a/mysql-test/t/handler.test b/mysql-test/include/handler.inc
index bf18b8da941..67fff16c577 100644
--- a/mysql-test/t/handler.test
+++ b/mysql-test/include/handler.inc
@@ -1,10 +1,25 @@
+# include/handler.inc
+#
+# The variables
+# $engine_type -- storage engine to be tested
+# $other_engine_type -- storage engine <> $engine_type
+# $other_handler_engine_type -- storage engine <> $engine_type, if possible
+# 1. $other_handler_engine_type must support handler
+# 2. $other_handler_engine_type must point to an all
+# time available storage engine
+# 2006-08 MySQL 5.1 MyISAM and MEMORY only
+# have to be set before sourcing this script.
-- source include/not_embedded.inc
#
# test of HANDLER ...
#
+# Last update:
+# 2006-07-31 ML test refactored (MySQL 5.1)
+# code of t/handler.test and t/innodb_handler.test united
+# main testing code put into include/handler.inc
+#
-# should work in embedded server after mysqltest is fixed
--- source include/not_embedded.inc
+eval SET SESSION STORAGE_ENGINE = $engine_type;
--disable_warnings
drop table if exists t1,t3,t4,t5;
@@ -74,6 +89,22 @@ handler t2 read next;
handler t2 read last;
handler t2 close;
+handler t1 open;
+handler t1 read a next; # this used to crash as a bug#5373
+handler t1 read a next;
+handler t1 close;
+
+handler t1 open;
+handler t1 read a prev; # this used to crash as a bug#5373
+handler t1 read a prev;
+handler t1 close;
+
+handler t1 open as t2;
+handler t2 read first;
+eval alter table t1 engine = $engine_type;
+--error 1109
+handler t2 read first;
+
#
# DROP TABLE / ALTER TABLE
#
@@ -84,7 +115,7 @@ insert into t1 values (17);
--error 1109
handler t2 read first;
handler t1 open as t2;
-alter table t1 engine=MyISAM;
+eval alter table t1 engine=$other_engine_type;
--error 1109
handler t2 read first;
drop table t1;
@@ -303,7 +334,7 @@ insert into t5 values ("t5");
handler t5 open as h5;
handler h5 read first limit 9;
# close first
-alter table t1 engine=MyISAM;
+eval alter table t1 engine=$other_handler_engine_type;
--error 1109
handler h1 read first limit 9;
handler h2 read first limit 9;
@@ -311,7 +342,7 @@ handler h3 read first limit 9;
handler h4 read first limit 9;
handler h5 read first limit 9;
# close last
-alter table t5 engine=MyISAM;
+eval alter table t5 engine=$other_handler_engine_type;
--error 1109
handler h1 read first limit 9;
handler h2 read first limit 9;
@@ -320,7 +351,7 @@ handler h4 read first limit 9;
--error 1109
handler h5 read first limit 9;
# close middle
-alter table t3 engine=MyISAM;
+eval alter table t3 engine=$other_handler_engine_type;
--error 1109
handler h1 read first limit 9;
handler h2 read first limit 9;
@@ -338,7 +369,7 @@ handler t1 open as h1_3;
handler h1_1 read first limit 9;
handler h1_2 read first limit 9;
handler h1_3 read first limit 9;
-alter table t1 engine=MyISAM;
+eval alter table t1 engine=$engine_type;
--error 1109
handler h1_1 read first limit 9;
--error 1109
@@ -379,6 +410,13 @@ reap;
connection default;
drop table t1;
+CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2));
+INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2);
+HANDLER t1 OPEN;
+HANDLER t1 READ `primary` = (1, 1000);
+HANDLER t1 READ `primary` PREV;
+DROP TABLE t1;
+
# End of 4.1 tests
#
diff --git a/mysql-test/include/have_archive.inc b/mysql-test/include/have_archive.inc
index 262f66076a8..9f0038db97a 100644
--- a/mysql-test/include/have_archive.inc
+++ b/mysql-test/include/have_archive.inc
@@ -1,4 +1,4 @@
---require r/have_archive.require
--disable_query_log
-show variables like "have_archive";
+--require r/true.require
+select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'archive';
--enable_query_log
diff --git a/mysql-test/include/have_bdb.inc b/mysql-test/include/have_bdb.inc
deleted file mode 100644
index 3f7377e7515..00000000000
--- a/mysql-test/include/have_bdb.inc
+++ /dev/null
@@ -1,4 +0,0 @@
--- require r/have_bdb.require
-disable_query_log;
-show variables like "have_bdb";
-enable_query_log;
diff --git a/mysql-test/include/have_binlog_format_mixed.inc b/mysql-test/include/have_binlog_format_mixed.inc
new file mode 100644
index 00000000000..fc5ca61c5a0
--- /dev/null
+++ b/mysql-test/include/have_binlog_format_mixed.inc
@@ -0,0 +1,4 @@
+-- require r/have_binlog_format_mixed.require
+disable_query_log;
+show variables like "binlog_format";
+enable_query_log;
diff --git a/mysql-test/include/have_binlog_format_mixed_or_row.inc b/mysql-test/include/have_binlog_format_mixed_or_row.inc
new file mode 100644
index 00000000000..c38b8f3d601
--- /dev/null
+++ b/mysql-test/include/have_binlog_format_mixed_or_row.inc
@@ -0,0 +1,5 @@
+--require r/have_binlog_format_row.require
+--disable_query_log
+--replace_result MIXED ROW
+show variables like "binlog_format";
+--enable_query_log
diff --git a/mysql-test/include/have_binlog_format_mixed_or_statement.inc b/mysql-test/include/have_binlog_format_mixed_or_statement.inc
new file mode 100644
index 00000000000..8ee6f2cc030
--- /dev/null
+++ b/mysql-test/include/have_binlog_format_mixed_or_statement.inc
@@ -0,0 +1,5 @@
+--require r/have_binlog_format_statement.require
+--disable_query_log
+--replace_result MIXED STATEMENT
+show variables like "binlog_format";
+--enable_query_log
diff --git a/mysql-test/include/have_binlog_format_row.inc b/mysql-test/include/have_binlog_format_row.inc
new file mode 100644
index 00000000000..2992b8e0f32
--- /dev/null
+++ b/mysql-test/include/have_binlog_format_row.inc
@@ -0,0 +1,4 @@
+-- require r/have_binlog_format_row.require
+disable_query_log;
+show variables like "binlog_format";
+enable_query_log;
diff --git a/mysql-test/include/have_binlog_format_statement.inc b/mysql-test/include/have_binlog_format_statement.inc
new file mode 100644
index 00000000000..c99297c10e5
--- /dev/null
+++ b/mysql-test/include/have_binlog_format_statement.inc
@@ -0,0 +1,4 @@
+-- require r/have_binlog_format_statement.require
+disable_query_log;
+show variables like "binlog_format";
+enable_query_log;
diff --git a/mysql-test/include/have_blackhole.inc b/mysql-test/include/have_blackhole.inc
index c2b6ea18830..e13cff52094 100644
--- a/mysql-test/include/have_blackhole.inc
+++ b/mysql-test/include/have_blackhole.inc
@@ -1,4 +1,4 @@
--- require r/have_blackhole.require
disable_query_log;
-show variables like "have_blackhole_engine";
+--require r/true.require
+select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'blackhole';
enable_query_log;
diff --git a/mysql-test/include/have_csv.inc b/mysql-test/include/have_csv.inc
index d28199831b8..3175fc16fe7 100644
--- a/mysql-test/include/have_csv.inc
+++ b/mysql-test/include/have_csv.inc
@@ -1,4 +1,4 @@
--- require r/have_csv.require
disable_query_log;
-show variables like "have_csv";
+--require r/true.require
+select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'csv';
enable_query_log;
diff --git a/mysql-test/include/have_exampledb.inc b/mysql-test/include/have_exampledb.inc
index 7ddd15c48b3..e3fd068b485 100644
--- a/mysql-test/include/have_exampledb.inc
+++ b/mysql-test/include/have_exampledb.inc
@@ -1,4 +1,4 @@
--- require r/have_exampledb.require
disable_query_log;
-show variables like "have_example_engine";
+--require r/true.require
+select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'example';
enable_query_log;
diff --git a/mysql-test/include/have_federated_db.inc b/mysql-test/include/have_federated_db.inc
index e4cf1366fda..abef5a64d30 100644
--- a/mysql-test/include/have_federated_db.inc
+++ b/mysql-test/include/have_federated_db.inc
@@ -1,4 +1,4 @@
--- require r/have_federated_db.require
disable_query_log;
-show variables like "have_federated_engine";
+--require r/true.require
+select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'federated';
enable_query_log;
diff --git a/mysql-test/include/have_innodb.inc b/mysql-test/include/have_innodb.inc
index 4f83d378cbc..be8850725e5 100644
--- a/mysql-test/include/have_innodb.inc
+++ b/mysql-test/include/have_innodb.inc
@@ -1,4 +1,4 @@
--- require r/have_innodb.require
disable_query_log;
-show variables like "have_innodb";
+--require r/true.require
+select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'innodb';
enable_query_log;
diff --git a/mysql-test/include/have_multi_ndb.inc b/mysql-test/include/have_multi_ndb.inc
index 45a551274f7..218a6852c41 100644
--- a/mysql-test/include/have_multi_ndb.inc
+++ b/mysql-test/include/have_multi_ndb.inc
@@ -9,8 +9,8 @@ disable_query_log;
drop table if exists t1, t2;
--enable_warnings
flush tables;
---require r/have_ndb.require
-show variables like "have_ndbcluster";
+--require r/true.require
+select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'ndbcluster';
enable_query_log;
# Check that server2 has NDB support
@@ -20,8 +20,8 @@ disable_query_log;
drop table if exists t1, t2;
--enable_warnings
flush tables;
---require r/have_ndb.require
-show variables like "have_ndbcluster";
+--require r/true.require
+select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'ndbcluster';
enable_query_log;
# Set the default connection to 'server1'
diff --git a/mysql-test/include/have_ndb.inc b/mysql-test/include/have_ndb.inc
index 721d79392b7..8cbeab07a4f 100644
--- a/mysql-test/include/have_ndb.inc
+++ b/mysql-test/include/have_ndb.inc
@@ -1,13 +1,7 @@
# Check that server is compiled and started with support for NDB
--- require r/have_ndb.require
disable_query_log;
-show variables like "have_ndbcluster";
-enable_query_log;
-
-# Check that NDB is installed and known to be working
--- require r/have_ndb_status_ok.require
-disable_query_log;
-eval select "$NDB_STATUS_OK" as ndb_status_ok;
+--require r/true.require
+select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'ndbcluster';
enable_query_log;
diff --git a/mysql-test/include/have_ndb_extra.inc b/mysql-test/include/have_ndb_extra.inc
new file mode 100644
index 00000000000..4837a7ad4ea
--- /dev/null
+++ b/mysql-test/include/have_ndb_extra.inc
@@ -0,0 +1,2 @@
+-- require r/have_ndb_extra.require
+eval select $NDB_EXTRA_TEST;
diff --git a/mysql-test/include/have_ndbapi_examples.inc b/mysql-test/include/have_ndbapi_examples.inc
new file mode 100644
index 00000000000..3ab1f063b61
--- /dev/null
+++ b/mysql-test/include/have_ndbapi_examples.inc
@@ -0,0 +1,4 @@
+--require r/have_ndbapi_examples.require
+disable_query_log;
+eval select LENGTH("$MY_NDB_EXAMPLES_BINARY") > 0 as "have_ndb_example";
+enable_query_log;
diff --git a/mysql-test/include/have_partition.inc b/mysql-test/include/have_partition.inc
new file mode 100644
index 00000000000..898b9c51773
--- /dev/null
+++ b/mysql-test/include/have_partition.inc
@@ -0,0 +1,4 @@
+-- require r/have_partition.require
+disable_query_log;
+show variables like "have_partitioning";
+enable_query_log;
diff --git a/mysql-test/include/have_row_based.inc b/mysql-test/include/have_row_based.inc
new file mode 100644
index 00000000000..23771fde5cc
--- /dev/null
+++ b/mysql-test/include/have_row_based.inc
@@ -0,0 +1,4 @@
+-- require r/have_row_based.require
+disable_query_log;
+show variables like "have_row_based_replication";
+enable_query_log;
diff --git a/mysql-test/t/index_merge.test b/mysql-test/include/index_merge1.inc
index 30eb0b40fca..a3a874a8ed2 100644
--- a/mysql-test/t/index_merge.test
+++ b/mysql-test/include/index_merge1.inc
@@ -1,6 +1,26 @@
+# include/index_merge1.inc
#
# Index merge tests
#
+# The variables
+# $engine_type -- storage engine to be tested
+# $merge_table_support -- 1 storage engine supports merge tables
+# -- 0 storage engine does not support merge tables
+# have to be set before sourcing this script.
+#
+# Note: The comments/expectations refer to MyISAM.
+# They might be not valid for other storage engines.
+#
+# Last update:
+# 2006-08-02 ML test refactored
+# old name was t/index_merge.test
+# main code went into include/index_merge1.inc
+#
+
+--echo #---------------- Index merge test 1 -------------------------------------------
+
+eval SET SESSION STORAGE_ENGINE = $engine_type;
+
--disable_warnings
drop table if exists t0, t1, t2, t3, t4;
--enable_warnings
@@ -8,7 +28,7 @@ drop table if exists t0, t1, t2, t3, t4;
# Create and fill a table with simple keys
create table t0
(
- key1 int not null,
+ key1 int not null,
INDEX i1(key1)
);
@@ -36,11 +56,11 @@ alter table t0 add key8 int not null, add index i8(key8);
update t0 set key2=key1,key3=key1,key4=key1,key5=key1,key6=key1,key7=key1,key8=1024-key1;
analyze table t0;
-# 1. One index
+# 1. One index
explain select * from t0 where key1 < 3 or key1 > 1020;
# 2. Simple cases
-explain
+explain
select * from t0 where key1 < 3 or key2 > 1020;
select * from t0 where key1 < 3 or key2 > 1020;
@@ -48,6 +68,7 @@ explain select * from t0 where key1 < 3 or key2 <4;
explain
select * from t0 where (key1 > 30 and key1<35) or (key2 >32 and key2 < 40);
+# Bug#21277: InnoDB, wrong result set, index_merge strategy, second index not evaluated
select * from t0 where (key1 > 30 and key1<35) or (key2 >32 and key2 < 40);
# 3. Check that index_merge doesn't break "ignore/force/use index"
@@ -60,8 +81,8 @@ explain select * from t0 force index (i1,i2) where (key1 > 1 or key2 > 2);
# 4. Check if conjuncts are grouped by keyuse
-explain
- select * from t0 where key1<3 or key2<3 or (key1>5 and key1<8) or
+explain
+ select * from t0 where key1<3 or key2<3 or (key1>5 and key1<8) or
(key1>10 and key1<12) or (key2>100 and key2<110);
# 5. Check index_merge with conjuncts that are always true/false
@@ -78,13 +99,13 @@ explain select * from t0 where key2=10 or key3=3 or key4 <=> null;
explain select * from t0 where key2=10 or key3=3 or key4 is null;
# some more complicated cases
-explain select key1 from t0 where (key1 <=> null) or (key2 < 5) or
+explain select key1 from t0 where (key1 <=> null) or (key2 < 5) or
(key3=10) or (key4 <=> null);
-explain select key1 from t0 where (key1 <=> null) or (key1 < 5) or
+explain select key1 from t0 where (key1 <=> null) or (key1 < 5) or
(key3=10) or (key4 <=> null);
# 6.Several ways to do index_merge, (ignored) index_merge vs. range
-explain select * from t0 where
+explain select * from t0 where
(key1 < 3 or key2 < 3) and (key3 < 4 or key4 < 4) and (key5 < 5 or key6 < 5);
explain
@@ -93,23 +114,23 @@ select * from t0 where (key1 < 3 or key2 < 6) and (key1 < 7 or key3 < 4);
select * from t0 where (key1 < 3 or key2 < 6) and (key1 < 7 or key3 < 4);
-explain select * from t0 where
+explain select * from t0 where
(key1 < 3 or key2 < 3) and (key3 < 4 or key4 < 4) and (key5 < 2 or key6 < 2);
-
+
# now index_merge is not used at all when "range" is possible
-explain select * from t0 where
+explain select * from t0 where
(key1 < 3 or key2 < 3) and (key3 < 100);
# this even can cause "all" scan:
explain select * from t0 where
(key1 < 3 or key2 < 3) and (key3 < 1000);
-
+
# 7. Complex cases
# tree_or(List<SEL_IMERGE>, range SEL_TREE).
-explain select * from t0 where
- ((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4))
- or
+explain select * from t0 where
+ ((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4))
+ or
key2 > 5;
explain select * from t0 where
@@ -121,18 +142,18 @@ select * from t0 where
((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4))
or
key1 < 7;
-
-# tree_or(List<SEL_IMERGE>, List<SEL_IMERGE>).
-explain select * from t0 where
- ((key1 < 4 or key2 < 4) and (key3 <5 or key5 < 4))
- or
+
+# tree_or(List<SEL_IMERGE>, List<SEL_IMERGE>).
+explain select * from t0 where
+ ((key1 < 4 or key2 < 4) and (key3 <5 or key5 < 4))
+ or
((key5 < 5 or key6 < 6) and (key7 <7 or key8 < 4));
explain select * from t0 where
((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
or
((key7 <7 or key8 < 4) and (key5 < 5 or key6 < 6));
-
+
explain select * from t0 where
((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
or
@@ -152,7 +173,7 @@ explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where
((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
or
((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6));
-
+
# 8. Verify that "order by" after index merge uses filesort
select * from t0 where key1 < 5 or key8 < 4 order by key1;
@@ -186,10 +207,8 @@ create table t4 (
key2_1 int not null,
key2_2 int not null,
key3 int not null,
-
index i1a (key1a, key1b),
index i1b (key1b, key1a),
-
index i2_1(key2, key2_1),
index i2_2(key2, key2_1)
);
@@ -197,8 +216,8 @@ create table t4 (
insert into t4 select key1,key1,key1 div 10, key1 % 10, key1 % 10, key1 from t0;
# the following will be handled by index_merge:
-select * from t4 where key1a = 3 or key1b = 4;
-explain select * from t4 where key1a = 3 or key1b = 4;
+select * from t4 where key1a = 3 or key1b = 4;
+explain select * from t4 where key1a = 3 or key1b = 4;
# and the following will not
explain select * from t4 where key2 = 1 and (key2_1 = 1 or key3 = 5);
@@ -213,27 +232,27 @@ create table t1 like t0;
insert into t1 select * from t0;
# index_merge on first table in join
-explain select * from t0 left join t1 on (t0.key1=t1.key1)
- where t0.key1=3 or t0.key2=4;
+explain select * from t0 left join t1 on (t0.key1=t1.key1)
+ where t0.key1=3 or t0.key2=4;
select * from t0 left join t1 on (t0.key1=t1.key1)
where t0.key1=3 or t0.key2=4;
-explain
+explain
select * from t0,t1 where (t0.key1=t1.key1) and ( t0.key1=3 or t0.key2=4);
# index_merge vs. ref
-explain
-select * from t0,t1 where (t0.key1=t1.key1) and
+explain
+select * from t0,t1 where (t0.key1=t1.key1) and
(t0.key1=3 or t0.key2=4) and t1.key1<200;
# index_merge vs. ref
-explain
-select * from t0,t1 where (t0.key1=t1.key1) and
+explain
+select * from t0,t1 where (t0.key1=t1.key1) and
(t0.key1=3 or t0.key2<4) and t1.key1=2;
# index_merge on second table in join
-explain select * from t0,t1 where t0.key1 = 5 and
+explain select * from t0,t1 where t0.key1 = 5 and
(t1.key1 = t0.key1 or t1.key8 = t0.key1);
# Fix for bug#1974
@@ -241,7 +260,7 @@ explain select * from t0,t1 where t0.key1 < 3 and
(t1.key1 = t0.key1 or t1.key8 = t0.key1);
# index_merge inside union
-explain select * from t1 where key1=3 or key2=4
+explain select * from t1 where key1=3 or key2=4
union select * from t1 where key1<4 or key3=5;
# index merge in subselect
@@ -256,21 +275,23 @@ alter table t3 add keyB int not null, add index iB(keyB);
alter table t3 add keyC int not null, add index iC(keyC);
update t3 set key9=key1,keyA=key1,keyB=key1,keyC=key1;
-explain select * from t3 where
+explain select * from t3 where
key1=1 or key2=2 or key3=3 or key4=4 or
key5=5 or key6=6 or key7=7 or key8=8 or
key9=9 or keyA=10 or keyB=11 or keyC=12;
-
+
select * from t3 where
key1=1 or key2=2 or key3=3 or key4=4 or
key5=5 or key6=6 or key7=7 or key8=8 or
- key9=9 or keyA=10 or keyB=11 or keyC=12;
+ key9=9 or keyA=10 or keyB=11 or keyC=12;
# Test for Bug#3183
explain select * from t0 where key1 < 3 or key2 < 4;
+# Bug#21277: InnoDB, wrong result set, index_merge strategy, second index not evaluated
select * from t0 where key1 < 3 or key2 < 4;
update t0 set key8=123 where key1 < 3 or key2 < 4;
+# Bug#21277: InnoDB, wrong result set, index_merge strategy, second index not evaluated
select * from t0 where key1 < 3 or key2 < 4;
delete from t0 where key1 < 3 or key2 < 4;
@@ -283,47 +304,47 @@ create table t4 (a int);
insert into t4 values (1),(4),(3);
set @save_join_buffer_size=@@join_buffer_size;
set join_buffer_size= 4000;
-explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
- from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
+explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
+ from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
where (A.key1 < 500000 or A.key2 < 3)
and (B.key1 < 500000 or B.key2 < 3);
-select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
- from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
+select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
+ from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
where (A.key1 < 500000 or A.key2 < 3)
and (B.key1 < 500000 or B.key2 < 3);
update t0 set key1=1;
-explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
- from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
+explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
+ from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
where (A.key1 = 1 or A.key2 = 1)
and (B.key1 = 1 or B.key2 = 1);
-select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
- from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
+select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
+ from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
where (A.key1 = 1 or A.key2 = 1)
and (B.key1 = 1 or B.key2 = 1);
alter table t0 add filler1 char(200), add filler2 char(200), add filler3 char(200);
update t0 set key2=1, key3=1, key4=1, key5=1,key6=1,key7=1 where key7 < 500;
-# The next query will not use index i7 in intersection if the OS doesn't
+# The next query will not use index i7 in intersection if the OS doesn't
# support file sizes > 2GB. (ha_myisam::ref_length depends on this and index
# scan cost estimates depend on ha_myisam::ref_length)
--replace_column 9 #
--replace_result "4,4,4,4,4,4,4" X "4,4,4,4,4,4" X "i6,i7" "i6,i7?" "i6" "i6,i7?"
-explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
- from t0 as A, t0 as B
+explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
+ from t0 as A, t0 as B
where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1)
and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1);
-select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
- from t0 as A, t0 as B
+select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
+ from t0 as A, t0 as B
where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1)
and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1);
set join_buffer_size= @save_join_buffer_size;
-# Test for BUG#4177 ends
+# Test for BUG#4177 ends
drop table t0, t1, t2, t3, t4;
@@ -357,13 +378,15 @@ explain select * from t1 WHERE cola = 'foo' AND colb = 'bar';
explain select * from t1 force index(cola,colb) WHERE cola = 'foo' AND colb = 'bar';
drop table t1;
+if ($merge_table_support)
+{
#
# BUG#17314: Index_merge/intersection not choosen by the optimizer for MERGE tables
#
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (
- a int, b int,
+ a int, b int,
filler1 char(200), filler2 char(200),
key(a),key(b)
);
@@ -371,7 +394,7 @@ insert into t1 select @v:= A.a, @v, 't1', 'filler2' from t0 A, t0 B, t0 C;
create table t2 like t1;
create table t3 (
- a int, b int,
+ a int, b int,
filler1 char(200), filler2 char(200),
key(a),key(b)
) engine=merge union=(t1,t2);
@@ -383,6 +406,7 @@ explain select * from t3 where a=1 and b=1;
drop table t3;
drop table t0, t1, t2;
+}
#
# BUG#20256 - LOCK WRITE - MyISAM
diff --git a/mysql-test/include/index_merge2.inc b/mysql-test/include/index_merge2.inc
new file mode 100644
index 00000000000..d65115eac0f
--- /dev/null
+++ b/mysql-test/include/index_merge2.inc
@@ -0,0 +1,345 @@
+# include/index_merge2.inc
+#
+# Index merge tests
+#
+# The variable
+# $engine_type -- storage engine to be tested
+# has to be set before sourcing this script.
+#
+# Note: The comments/expectations refer to InnoDB.
+# They might be not valid for other storage engines.
+#
+# Last update:
+# 2006-08-02 ML test refactored
+# old name was t/index_merge_innodb.test
+# main code went into include/index_merge2.inc
+#
+
+--echo #---------------- Index merge test 2 -------------------------------------------
+
+eval SET SESSION STORAGE_ENGINE = $engine_type;
+
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+create table t1
+(
+ key1 int not null,
+ key2 int not null,
+
+ INDEX i1(key1),
+ INDEX i2(key2)
+);
+
+--disable_query_log
+let $1=200;
+while ($1)
+{
+ eval insert into t1 values (200-$1, $1);
+ dec $1;
+}
+--enable_query_log
+
+# No primary key
+explain select * from t1 where key1 < 5 or key2 > 197;
+
+select * from t1 where key1 < 5 or key2 > 197;
+
+explain select * from t1 where key1 < 3 or key2 > 195;
+select * from t1 where key1 < 3 or key2 > 195;
+
+# Primary key as case-sensitive string with \0s.
+# also make primary key be longer then max. index length of MyISAM.
+alter table t1 add str1 char (255) not null,
+ add zeroval int not null default 0,
+ add str2 char (255) not null,
+ add str3 char (255) not null;
+
+update t1 set str1='aaa', str2='bbb', str3=concat(key2, '-', key1 div 2, '_' ,if(key1 mod 2 = 0, 'a', 'A'));
+
+alter table t1 add primary key (str1, zeroval, str2, str3);
+
+explain select * from t1 where key1 < 5 or key2 > 197;
+
+select * from t1 where key1 < 5 or key2 > 197;
+
+explain select * from t1 where key1 < 3 or key2 > 195;
+select * from t1 where key1 < 3 or key2 > 195;
+
+# Test for BUG#5401
+drop table t1;
+create table t1 (
+ pk integer not null auto_increment primary key,
+ key1 integer,
+ key2 integer not null,
+ filler char (200),
+ index (key1),
+ index (key2)
+);
+show warnings;
+--disable_query_log
+let $1=30;
+while ($1)
+{
+ eval insert into t1 (key1, key2, filler) values ($1/4, $1/8, 'filler-data');
+ dec $1;
+}
+--enable_query_log
+explain select pk from t1 where key1 = 1 and key2 = 1;
+select pk from t1 where key2 = 1 and key1 = 1;
+select pk from t1 ignore index(key1,key2) where key2 = 1 and key1 = 1;
+
+# More tests for BUG#5401.
+drop table t1;
+create table t1 (
+ pk int primary key auto_increment,
+ key1a int,
+ key2a int,
+ key1b int,
+ key2b int,
+ dummy1 int,
+ dummy2 int,
+ dummy3 int,
+ dummy4 int,
+ key3a int,
+ key3b int,
+ filler1 char (200),
+ index i1(key1a, key1b),
+ index i2(key2a, key2b),
+ index i3(key3a, key3b)
+);
+
+create table t2 (a int);
+insert into t2 values (0),(1),(2),(3),(4),(NULL);
+
+insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
+ select A.a, B.a, C.a, D.a, C.a, D.a from t2 A,t2 B,t2 C, t2 D;
+insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
+ select key1a, key1b, key2a, key2b, key3a, key3b from t1;
+insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
+ select key1a, key1b, key2a, key2b, key3a, key3b from t1;
+analyze table t1;
+select count(*) from t1;
+
+explain select count(*) from t1 where
+ key1a = 2 and key1b is null and key2a = 2 and key2b is null;
+
+select count(*) from t1 where
+ key1a = 2 and key1b is null and key2a = 2 and key2b is null;
+
+explain select count(*) from t1 where
+ key1a = 2 and key1b is null and key3a = 2 and key3b is null;
+
+select count(*) from t1 where
+ key1a = 2 and key1b is null and key3a = 2 and key3b is null;
+
+drop table t1,t2;
+
+# Test for BUG#8441
+create table t1 (
+ id1 int,
+ id2 date ,
+ index idx2 (id1,id2),
+ index idx1 (id2)
+);
+insert into t1 values(1,'20040101'), (2,'20040102');
+select * from t1 where id1 = 1 and id2= '20040101';
+drop table t1;
+
+# Test for BUG#12720
+--disable_warnings
+drop view if exists v1;
+--enable_warnings
+CREATE TABLE t1 (
+ `oid` int(11) unsigned NOT NULL auto_increment,
+ `fk_bbk_niederlassung` int(11) unsigned NOT NULL,
+ `fk_wochentag` int(11) unsigned NOT NULL,
+ `uhrzeit_von` time NOT NULL COMMENT 'HH:MM',
+ `uhrzeit_bis` time NOT NULL COMMENT 'HH:MM',
+ `geloescht` tinyint(4) NOT NULL,
+ `version` int(5) NOT NULL,
+ PRIMARY KEY (`oid`),
+ KEY `fk_bbk_niederlassung` (`fk_bbk_niederlassung`),
+ KEY `fk_wochentag` (`fk_wochentag`),
+ KEY `ix_version` (`version`)
+) DEFAULT CHARSET=latin1;
+
+insert into t1 values
+(1, 38, 1, '08:00:00', '13:00:00', 0, 1),
+(2, 38, 2, '08:00:00', '13:00:00', 0, 1),
+(3, 38, 3, '08:00:00', '13:00:00', 0, 1),
+(4, 38, 4, '08:00:00', '13:00:00', 0, 1),
+(5, 38, 5, '08:00:00', '13:00:00', 0, 1),
+(6, 38, 5, '08:00:00', '13:00:00', 1, 2),
+(7, 38, 3, '08:00:00', '13:00:00', 1, 2),
+(8, 38, 1, '08:00:00', '13:00:00', 1, 2),
+(9, 38, 2, '08:00:00', '13:00:00', 1, 2),
+(10, 38, 4, '08:00:00', '13:00:00', 1, 2),
+(11, 38, 1, '08:00:00', '13:00:00', 0, 3),
+(12, 38, 2, '08:00:00', '13:00:00', 0, 3),
+(13, 38, 3, '08:00:00', '13:00:00', 0, 3),
+(14, 38, 4, '08:00:00', '13:00:00', 0, 3),
+(15, 38, 5, '08:00:00', '13:00:00', 0, 3),
+(16, 38, 4, '08:00:00', '13:00:00', 0, 4),
+(17, 38, 5, '08:00:00', '13:00:00', 0, 4),
+(18, 38, 1, '08:00:00', '13:00:00', 0, 4),
+(19, 38, 2, '08:00:00', '13:00:00', 0, 4),
+(20, 38, 3, '08:00:00', '13:00:00', 0, 4),
+(21, 7, 1, '08:00:00', '13:00:00', 0, 1),
+(22, 7, 2, '08:00:00', '13:00:00', 0, 1),
+(23, 7, 3, '08:00:00', '13:00:00', 0, 1),
+(24, 7, 4, '08:00:00', '13:00:00', 0, 1),
+(25, 7, 5, '08:00:00', '13:00:00', 0, 1);
+
+create view v1 as
+select
+ zeit1.oid AS oid,
+ zeit1.fk_bbk_niederlassung AS fk_bbk_niederlassung,
+ zeit1.fk_wochentag AS fk_wochentag,
+ zeit1.uhrzeit_von AS uhrzeit_von,
+ zeit1.uhrzeit_bis AS uhrzeit_bis,
+ zeit1.geloescht AS geloescht,
+ zeit1.version AS version
+from
+ t1 zeit1
+where
+(zeit1.version =
+ (select max(zeit2.version) AS `max(version)`
+ from t1 zeit2
+ where
+ ((zeit1.fk_bbk_niederlassung = zeit2.fk_bbk_niederlassung) and
+ (zeit1.fk_wochentag = zeit2.fk_wochentag) and
+ (zeit1.uhrzeit_von = zeit2.uhrzeit_von) and
+ (zeit1.uhrzeit_bis = zeit2.uhrzeit_bis)
+ )
+ )
+)
+and (zeit1.geloescht = 0);
+
+select * from v1 where oid = 21;
+drop view v1;
+drop table t1;
+##
+CREATE TABLE t1(
+ t_cpac varchar(2) NOT NULL,
+ t_vers varchar(4) NOT NULL,
+ t_rele varchar(2) NOT NULL,
+ t_cust varchar(4) NOT NULL,
+ filler1 char(250) default NULL,
+ filler2 char(250) default NULL,
+ PRIMARY KEY (t_cpac,t_vers,t_rele,t_cust),
+ UNIQUE KEY IX_4 (t_cust,t_cpac,t_vers,t_rele),
+ KEY IX_5 (t_vers,t_rele,t_cust)
+);
+
+insert into t1 values
+('tm','2.5 ','a ',' ','',''), ('tm','2.5U','a ','stnd','',''),
+('da','3.3 ','b ',' ','',''), ('da','3.3U','b ','stnd','',''),
+('tl','7.6 ','a ',' ','',''), ('tt','7.6 ','a ',' ','',''),
+('bc','B61 ','a ',' ','',''), ('bp','B61 ','a ',' ','',''),
+('ca','B61 ','a ',' ','',''), ('ci','B61 ','a ',' ','',''),
+('cp','B61 ','a ',' ','',''), ('dm','B61 ','a ',' ','',''),
+('ec','B61 ','a ',' ','',''), ('ed','B61 ','a ',' ','',''),
+('fm','B61 ','a ',' ','',''), ('nt','B61 ','a ',' ','',''),
+('qm','B61 ','a ',' ','',''), ('tc','B61 ','a ',' ','',''),
+('td','B61 ','a ',' ','',''), ('tf','B61 ','a ',' ','',''),
+('tg','B61 ','a ',' ','',''), ('ti','B61 ','a ',' ','',''),
+('tp','B61 ','a ',' ','',''), ('ts','B61 ','a ',' ','',''),
+('wh','B61 ','a ',' ','',''), ('bc','B61U','a ','stnd','',''),
+('bp','B61U','a ','stnd','',''), ('ca','B61U','a ','stnd','',''),
+('ci','B61U','a ','stnd','',''), ('cp','B61U','a ','stnd','',''),
+('dm','B61U','a ','stnd','',''), ('ec','B61U','a ','stnd','',''),
+('fm','B61U','a ','stnd','',''), ('nt','B61U','a ','stnd','',''),
+('qm','B61U','a ','stnd','',''), ('tc','B61U','a ','stnd','',''),
+('td','B61U','a ','stnd','',''), ('tf','B61U','a ','stnd','',''),
+('tg','B61U','a ','stnd','',''), ('ti','B61U','a ','stnd','',''),
+('tp','B61U','a ','stnd','',''), ('ts','B61U','a ','stnd','',''),
+('wh','B61U','a ','stnd','','');
+show create table t1;
+
+select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6';
+select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6'
+ and t_rele='a' and t_cust = ' ';
+
+drop table t1;
+
+# BUG#19021: Crash in index_merge/ROR-intersection optimizer under
+# specific circumstances.
+create table t1 (
+ pk int(11) not null auto_increment,
+ a int(11) not null default '0',
+ b int(11) not null default '0',
+ c int(11) not null default '0',
+
+ filler1 datetime, filler2 varchar(15),
+ filler3 longtext,
+
+ kp1 varchar(4), kp2 varchar(7),
+ kp3 varchar(2), kp4 varchar(4),
+ kp5 varchar(7),
+ filler4 char(1),
+
+ primary key (pk),
+ key idx1(a,b,c),
+ key idx2(c),
+ key idx3(kp1,kp2,kp3,kp4,kp5)
+) default charset=latin1;
+--disable_query_log
+set @fill= uncompress(unhex(concat(
+'F91D0000789CDD993D6FDB301086F7FE0A6D4E0105B8E3F1335D5BA028DA0EEDE28E1D320408',
+'52A0713BF4D7571FB62C51A475924839080307B603E77DEE787C8FA41F9E9EEF7F1F8A87A7C3',
+'AFE280C5DF9F8F7FEE9F8B1B2CB114D6902E918455245DB91300FA16E42D5201FA4EE29DA05D',
+'B9FB3718A33718A3FA8C30AEFAFDE1F317D016AA67BA7A60FDE45BF5F8BA7B5BDE8812AA9F1A',
+'069DB03C9804346644F3A3A6A1338DB572756A3C4D1BCC804CABF912C654AE9BB855A2B85962',
+'3A479259CAE6A86C0411D01AE5483581EDCBD9A39C45252D532E533979EB9F82E971D979BDB4',
+'8531105670740AFBFD1E34AAB0029E4AD0A1D46A6D0946A21A16038A5CD965CD2D524673F712',
+'20C304477315CE18405EAF9BD0AFFEAC74FDA14F1FBF5BD34C769D73FBBEDF4750ADD4E5A99C',
+'5C8DC04934AFA275D483D536D174C11B12AF27F8F888B41B6FC9DBA569E1FD7BD72D698130B7',
+'91B23A98803512B3D31881E8DCDA2AC1754E3644C4BB3A8466750B911681274A39E35E8624B7',
+'444A42AC1213F354758E3CF1A4CDD5A688C767CF1B11ABC5867CB15D8A18E0B91E9EC275BB94',
+'58F33C2936F64690D55BC29E4A293D95A798D84217736CEAAA538CE1354269EE2162053FBC66',
+'496D90CB53323CB279D3A6AF651B4B22B9E430743D83BE48E995A09D4FC9871C22D8D189B945',
+'706911BCB8C3C774B9C08D2FC6ED853ADACA37A14A4CB2E027630E5B80ECACD939431B1CDF62',
+'7D71487536EA2C678F59685E91F4B6C144BCCB94C1EBA9FA6F5552DDCA4E4539BE326A2720CB',
+'45ED028EB3616AC93C46E775FEA9FA6DA7CFCEC6DEBA5FCD1F915EED4D983BDDB881528AD9AB',
+'43C1576F29AAB35BDFBC21D422F52B307D350589D45225A887AC46C8EDD72D99EC3ED2E1BCEF',
+'7AF26FC4C74097B6768A5EDAFA660CC64278F7E63F99AC954B')));
+prepare x from @fill;
+execute x;
+deallocate prepare x;
+--enable_query_log
+set @fill=NULL;
+SELECT COUNT(*) FROM t1 WHERE b = 0 AND a = 0 AND c = 13286427 AND
+ kp1='279' AND kp2='ELM0678' AND kp3='6' AND kp4='10' AND kp5 = 'R ';
+
+drop table t1;
+
+# BUG#21277: Index Merge/sort_union: wrong query results
+create table t1
+(
+ key1 int not null,
+ key2 int not null default 0,
+ key3 int not null default 0
+);
+
+insert into t1(key1) values (1),(2),(3),(4),(5),(6),(7),(8);
+
+let $1=7;
+set @d=8;
+while ($1)
+{
+ eval insert into t1 (key1) select key1+@d from t1;
+ eval set @d=@d*2;
+ dec $1;
+}
+
+alter table t1 add index i2(key2);
+alter table t1 add index i3(key3);
+update t1 set key2=key1,key3=key1;
+
+# to test the bug, the following must use "sort_union":
+explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
+select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
+drop table t1;
+
diff --git a/mysql-test/t/index_merge_innodb2.test b/mysql-test/include/index_merge_2sweeps.inc
index ec4ea672bc1..3ae7e5b3c09 100644
--- a/mysql-test/t/index_merge_innodb2.test
+++ b/mysql-test/include/index_merge_2sweeps.inc
@@ -1,7 +1,20 @@
+# include/index_merge_2sweeps.inc
#
# 2-sweeps read Index_merge test
#
--- source include/have_innodb.inc
+# The variable
+# $engine_type -- storage engine to be tested
+# has to be set before sourcing this script.
+#
+# Last update:
+# 2006-08-02 ML test refactored
+# old name was index_merge_innodb2.test
+# main code went into include/index_merge_2sweeps.inc
+#
+
+--echo #---------------- 2-sweeps read Index merge test 2 -------------------------------
+
+eval SET SESSION STORAGE_ENGINE = $engine_type;
--disable_warnings
drop table if exists t1;
@@ -10,12 +23,12 @@ drop table if exists t1;
create table t1 (
pk int primary key,
key1 int,
- key2 int,
+ key2 int,
filler char(200),
- filler2 char(200),
+ filler2 char(200),
index(key1),
index(key2)
-) engine=innodb;
+);
--disable_query_log
@@ -31,20 +44,20 @@ select * from t1 where (key1 >= 2 and key1 <= 10) or (pk >= 4 and pk <=8 );
set @maxv=1000;
-select * from t1 where
- (pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
+select * from t1 where
+ (pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
or key1=18 or key1=60;
-select * from t1 where
- (pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
+select * from t1 where
+ (pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
or key1 < 3 or key1 > @maxv-11;
-select * from t1 where
- (pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
+select * from t1 where
+ (pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
or
(key1 < 5) or (key1 > 10 and key1 < 15) or (key1 >= 50 and key1 < 55 ) or (key1 > @maxv-10);
-select * from t1 where
+select * from t1 where
(pk > 10 and pk < 15) or (pk >= 50 and pk < 55 )
or
(key1 < 5) or (key1 > @maxv-10);
diff --git a/mysql-test/t/index_merge_ror.test b/mysql-test/include/index_merge_ror.inc
index 48fe5526f11..b9f5c7b95da 100644
--- a/mysql-test/t/index_merge_ror.test
+++ b/mysql-test/include/index_merge_ror.inc
@@ -1,10 +1,27 @@
+# include/index_merge_ror.inc
#
-# ROR-index_merge tests.
+# ROR-index_merge tests.
#
+# The variable
+# $engine_type -- storage engine to be tested
+# has to be set before sourcing this script.
+#
+# Note: The comments/expectations refer to MyISAM.
+# They might be not valid for other storage engines.
+#
+# Last update:
+# 2006-08-02 ML test refactored
+# old name was t/index_merge_ror.test
+# main code went into include/index_merge_ror.inc
+#
+
+--echo #---------------- ROR-index_merge tests -----------------------
+
+eval SET SESSION STORAGE_ENGINE = $engine_type;
+
--disable_warnings
drop table if exists t0,t1,t2;
--enable_warnings
---disable_query_log
create table t1
(
/* Field names reflect value(rowid) distribution, st=STairs, swt= SaWTooth */
@@ -29,7 +46,7 @@ create table t1
filler4 char (200),
filler5 char (200),
filler6 char (200),
-
+
/* order of keys is important */
key sta_swt12a(st_a,swt1a,swt2a),
key sta_swt1a(st_a,swt1a),
@@ -47,21 +64,26 @@ create table t1
key(key4)
) ;
-# Fill table
+# Fill table
create table t0 as select * from t1;
+--disable_query_log
+--echo # Printing of many insert into t0 values (....) disabled.
let $cnt=1000;
while ($cnt)
{
eval insert into t0 values (1, 2, 3, 1, 2, 3, 0, 0, 0, 0, 'data1', 'data2', 'data3', 'data4', 'data5', 'data6');
dec $cnt;
}
+--enable_query_log
alter table t1 disable keys;
+--disable_query_log
+--echo # Printing of many insert into t1 select .... from t0 disabled.
let $1=4;
while ($1)
{
let $2=4;
- while ($2)
+ while ($2)
{
let $3=4;
while ($3)
@@ -74,6 +96,7 @@ while ($1)
dec $1;
}
+--echo # Printing of many insert into t1 (...) values (....) disabled.
# Row retrieval tests
# -1 is used for values 'out of any range we are using'
# insert enough rows for index intersection to be used for (key1,key2)
@@ -90,18 +113,17 @@ while ($cnt)
eval insert into t1 (key1, key2, key3, key4, filler1) values (-1, 100, -1, 100,'key2-key4');
dec $cnt;
}
-alter table t1 enable keys;
--enable_query_log
+alter table t1 enable keys;
select count(*) from t1;
-# One row results tests for cases where a single row matches all conditions
+# One row results tests for cases where a single row matches all conditions
explain select key1,key2 from t1 where key1=100 and key2=100;
select key1,key2 from t1 where key1=100 and key2=100;
-
explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
-# Several-rows results
+# Several-rows results
insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, -1, -1, 'key1-key2');
insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, 100, 100, 'key4-key3');
@@ -151,7 +173,7 @@ explain select key1,key2 from t1 where key1=100 and key2=100;
select key1,key2 from t1 where key1=100 and key2=100;
# ROR-union tests with various cases.
-# All scans returning duplicate rows:
+# All scans returning duplicate rows:
insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-1');
insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-2');
insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-3');
@@ -170,7 +192,7 @@ explain select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 a
select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200;
##
-## Optimizer tests
+## Optimizer tests
##
# Check that the shortest key is used for ROR-intersection, covering and non-covering.
@@ -180,9 +202,9 @@ explain select st_a,st_b from t1 where st_a=1 and st_b=1;
# Check if "ingore index" syntax works
explain select st_a from t1 ignore index (st_a) where st_a=1 and st_b=1;
-# Do many tests
+# Do many tests
# Check that keys that don't improve selectivity are skipped.
-#
+#
# Different value on 32 and 64 bit
--replace_result sta_swt12a sta_swt21a sta_swt12a, sta_swt12a,
@@ -192,25 +214,25 @@ explain select * from t1 where st_b=1 and swt1b=1 and swt2b=1;
explain select * from t1 where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
-explain select * from t1 ignore index (sta_swt21a, stb_swt1a_2b)
+explain select * from t1 ignore index (sta_swt21a, stb_swt1a_2b)
where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
-explain select * from t1 ignore index (sta_swt21a, sta_swt12a, stb_swt1a_2b)
+explain select * from t1 ignore index (sta_swt21a, sta_swt12a, stb_swt1a_2b)
where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
-explain select * from t1 ignore index (sta_swt21a, sta_swt12a, stb_swt1a_2b, stb_swt1b)
+explain select * from t1 ignore index (sta_swt21a, sta_swt12a, stb_swt1a_2b, stb_swt1b)
where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
-explain select * from t1
+explain select * from t1
where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1;
-explain select * from t1
+explain select * from t1
where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1;
-explain select st_a from t1
+explain select st_a from t1
where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1;
-explain select st_a from t1
+explain select st_a from t1
where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1;
drop table t0,t1;
@@ -241,7 +263,7 @@ insert into t2 select * from t2;
select count(a) from t2 where a='BBBBBBBB';
select count(a) from t2 where b='BBBBBBBB';
-# BUG#1:
+# BUG#1:
--replace_result a a_or_b b a_or_b
explain select count(a) from t2 where a='AAAAAAAA' and b='AAAAAAAA';
select count(a) from t2 where a='AAAAAAAA' and b='AAAAAAAA';
diff --git a/mysql-test/t/index_merge_ror_cpk.test b/mysql-test/include/index_merge_ror_cpk.inc
index 94abf395d0a..cfc2ed3885e 100644
--- a/mysql-test/t/index_merge_ror_cpk.test
+++ b/mysql-test/include/index_merge_ror_cpk.inc
@@ -1,7 +1,23 @@
+# include/index_merge_ror_cpk.inc
#
# Clustered PK ROR-index_merge tests
#
--- source include/have_innodb.inc
+# The variable
+# $engine_type -- storage engine to be tested
+# has to be set before sourcing this script.
+#
+# Note: The comments/expectations refer to InnoDB.
+# They might be not valid for other storage engines.
+#
+# Last update:
+# 2006-08-02 ML test refactored
+# old name was t/index_merge_ror_cpk.test
+# main code went into include/index_merge_ror_cpk.inc
+#
+
+--echo #---------------- Clustered PK ROR-index_merge tests -----------------------------
+
+eval SET SESSION STORAGE_ENGINE = $engine_type;
--disable_warnings
drop table if exists t1;
@@ -9,14 +25,14 @@ drop table if exists t1;
create table t1
(
- pk1 int not null,
+ pk1 int not null,
pk2 int not null,
-
+
key1 int not null,
key2 int not null,
- pktail1ok int not null,
- pktail2ok int not null,
+ pktail1ok int not null,
+ pktail2ok int not null,
pktail3bad int not null,
pktail4bad int not null,
pktail5bad int not null,
@@ -37,7 +53,7 @@ create table t1
key (pktail5bad, pk1, pk2, pk2copy),
primary key (pk1, pk2)
-) engine=innodb;
+);
--disable_query_log
set autocommit=0;
@@ -50,27 +66,28 @@ while ($1)
set autocommit=1;
--enable_query_log
-# Verify that range scan on CPK is ROR
-# (use index_intersection because it is impossible to check that for index union)
+# Verify that range scan on CPK is ROR
+# (use index_intersection because it is impossible to check that for index union)
explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
# CPK scan + 1 ROR range scan is a special case
select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
-# Verify that CPK fields are considered to be covered by index scans
+# Verify that CPK fields are considered to be covered by index scans
explain select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1;
select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1;
# Verify that CPK is always used for index intersection scans
# (this is because it is used as a filter, not for retrieval)
explain select * from t1 where badkey=1 and key1=10;
---replace_result 38 ROWS 37 ROWS
+--replace_column 9 ROWS
explain select * from t1 where pk1 < 7500 and key1 = 10;
-
+
# Verify that keys with 'tails' of PK members are ok.
explain select * from t1 where pktail1ok=1 and key1=10;
explain select * from t1 where pktail2ok=1 and key1=10;
-select ' The following is actually a deficiency, it uses sort_union currently:' as 'note:';
+# Note: The following is actually a deficiency, it uses sort_union currently.
+# This comment refers to InnoDB and is probably not valid for other engines.
explain select * from t1 where (pktail2ok=1 and pk1< 50000) or key1=10;
# The expected rows differs a bit from platform to platform
@@ -79,33 +96,33 @@ explain select * from t1 where pktail3bad=1 and key1=10;
explain select * from t1 where pktail4bad=1 and key1=10;
explain select * from t1 where pktail5bad=1 and key1=10;
-# Test for problem with innodb key values prefetch buffer:
+# Test for problem with innodb key values prefetch buffer:
explain select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10;
select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10;
drop table t1;
# Testcase for BUG#4984
create table t1
-(
- RUNID varchar(22),
- SUBMITNR varchar(5),
- ORDERNR char(1) ,
- PROGRAMM varchar(8),
- TESTID varchar(4),
- UCCHECK char(1),
- ETEXT varchar(80),
+(
+ RUNID varchar(22),
+ SUBMITNR varchar(5),
+ ORDERNR char(1),
+ PROGRAMM varchar(8),
+ TESTID varchar(4),
+ UCCHECK char(1),
+ ETEXT varchar(80),
ETEXT_TYPE char(1),
- INFO char(1),
- SEVERITY tinyint(3),
- TADIRFLAG char(1),
- PRIMARY KEY (RUNID,SUBMITNR,ORDERNR,PROGRAMM,TESTID,UCCHECK),
+ INFO char(1),
+ SEVERITY tinyint(3),
+ TADIRFLAG char(1),
+ PRIMARY KEY (RUNID,SUBMITNR,ORDERNR,PROGRAMM,TESTID,UCCHECK),
KEY `TVERM~KEY` (PROGRAMM,TESTID,UCCHECK)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-update t1 set `ETEXT` = '', `ETEXT_TYPE`='', `INFO`='', `SEVERITY`='', `TADIRFLAG`=''
-WHERE
- `RUNID`= '' AND `SUBMITNR`= '' AND `ORDERNR`='' AND `PROGRAMM`='' AND
- `TESTID`='' AND `UCCHECK`='';
+) DEFAULT CHARSET=latin1;
+
+update t1 set `ETEXT` = '', `ETEXT_TYPE`='', `INFO`='', `SEVERITY`='', `TADIRFLAG`=''
+WHERE
+ `RUNID`= '' AND `SUBMITNR`= '' AND `ORDERNR`='' AND `PROGRAMM`='' AND
+ `TESTID`='' AND `UCCHECK`='';
drop table t1;
diff --git a/mysql-test/include/loaddata_autocom.inc b/mysql-test/include/loaddata_autocom.inc
index e5071c73c49..cca56709331 100644
--- a/mysql-test/include/loaddata_autocom.inc
+++ b/mysql-test/include/loaddata_autocom.inc
@@ -7,14 +7,16 @@ eval SET SESSION STORAGE_ENGINE = $engine_type;
drop table if exists t1;
--enable_warnings
-create table t1 (a text, b text);
+# NDB does not support the create option 'Binlog of table with BLOB attribute and no PK'
+# So use a dummy PK here.
+create table t1 (id int unsigned not null auto_increment primary key, a text, b text);
start transaction;
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
+load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
commit;
select count(*) from t1;
truncate table t1;
start transaction;
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
+load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
rollback;
select count(*) from t1;
diff --git a/mysql-test/include/master-slave-end.inc b/mysql-test/include/master-slave-end.inc
new file mode 100644
index 00000000000..74e4c7b608a
--- /dev/null
+++ b/mysql-test/include/master-slave-end.inc
@@ -0,0 +1,6 @@
+--connection master
+--sync_slave_with_master
+--connection slave
+--disable_query_log
+STOP SLAVE;
+--enable_query_log
diff --git a/mysql-test/include/master-slave-reset.inc b/mysql-test/include/master-slave-reset.inc
new file mode 100644
index 00000000000..204c6c5f5f6
--- /dev/null
+++ b/mysql-test/include/master-slave-reset.inc
@@ -0,0 +1,22 @@
+connection slave;
+#we expect STOP SLAVE to produce a warning as the slave is stopped
+#(the server was started with skip-slave-start)
+--disable_warnings
+stop slave;
+--wait_for_slave_to_stop
+--enable_warnings
+connection master;
+--disable_warnings
+--disable_query_log
+use test;
+--enable_query_log
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+--enable_warnings
+reset master;
+connection slave;
+reset slave;
+# Clean up old test tables
+--disable_warnings
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+--enable_warnings
+start slave;
diff --git a/mysql-test/include/master-slave.inc b/mysql-test/include/master-slave.inc
index ea09f4e842b..fe1dacb433e 100644
--- a/mysql-test/include/master-slave.inc
+++ b/mysql-test/include/master-slave.inc
@@ -2,28 +2,8 @@ connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,);
-connection slave;
-#we expect STOP SLAVE to produce a warning as the slave is stopped
-#(the server was started with skip-slave-start)
---disable_warnings
-stop slave;
---enable_warnings
---require r/slave-stopped.result
-show status like 'Slave_running';
-connection master;
---disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
---enable_warnings
-reset master;
-connection slave;
-reset slave;
-# Clean up old test tables
---disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
---enable_warnings
-start slave;
---require r/slave-running.result
-show status like 'Slave_running';
+
+-- source include/master-slave-reset.inc
# Set the default connection to 'master'
connection master;
diff --git a/mysql-test/include/mix1.inc b/mysql-test/include/mix1.inc
new file mode 100644
index 00000000000..7fe369cfb1e
--- /dev/null
+++ b/mysql-test/include/mix1.inc
@@ -0,0 +1,520 @@
+# include/mix1.inc
+#
+# The variables
+# $engine_type -- storage engine to be tested
+# $other_engine_type -- storage engine <> $engine_type
+# $other_engine_type must point to an all
+# time available storage engine
+# 2006-08 MySQL 5.1 MyISAM and MEMORY only
+# $test_foreign_keys -- 0, skip foreign key tests
+# -- 1, do not skip foreign key tests
+# have to be set before sourcing this script.
+#
+# Note: The comments/expectations refer to InnoDB.
+# They might be not valid for other storage engines.
+#
+# Last update:
+# 2006-08-15 ML refactoring of t/innodb_mysql.test
+# - shift main code of t/innodb_mysql.test to include/mix1.inc
+# - replace hardcoded assignment of storage engine by
+# use of $engine_type and $other_engine_type variables
+# - remove redundant replay testcase of
+# Bug#12882 min/max inconsistent on empty table
+# - corrected analyze table t1; to analyze table t4;
+# Much older versions of this test show that the table
+# where just some indexes have been created must be used.
+#
+
+eval SET SESSION STORAGE_ENGINE = $engine_type;
+
+--disable_warnings
+drop table if exists t1,t2,t1m,t1i,t2m,t2i,t4;
+--enable_warnings
+
+
+# BUG#16798: Uninitialized row buffer reads in ref-or-null optimizer
+# (repeatable only w/innodb).
+create table t1 (
+ c_id int(11) not null default '0',
+ org_id int(11) default null,
+ unique key contacts$c_id (c_id),
+ key contacts$org_id (org_id)
+);
+insert into t1 values
+ (2,null),(120,null),(141,null),(218,7), (128,1),
+ (151,2),(234,2),(236,2),(243,2),(255,2),(259,2),(232,3),(235,3),(238,3),
+ (246,3),(253,3),(269,3),(285,3),(291,3),(293,3),(131,4),(230,4),(231,4);
+
+create table t2 (
+ slai_id int(11) not null default '0',
+ owner_tbl int(11) default null,
+ owner_id int(11) default null,
+ sla_id int(11) default null,
+ inc_web int(11) default null,
+ inc_email int(11) default null,
+ inc_chat int(11) default null,
+ inc_csr int(11) default null,
+ inc_total int(11) default null,
+ time_billed int(11) default null,
+ activedate timestamp null default null,
+ expiredate timestamp null default null,
+ state int(11) default null,
+ sla_set int(11) default null,
+ unique key t2$slai_id (slai_id),
+ key t2$owner_id (owner_id),
+ key t2$sla_id (sla_id)
+);
+insert into t2(slai_id, owner_tbl, owner_id, sla_id) values
+ (1,3,1,1), (3,3,10,2), (4,3,3,6), (5,3,2,5), (6,3,8,3), (7,3,9,7),
+ (8,3,6,8), (9,3,4,9), (10,3,5,10), (11,3,11,11), (12,3,7,12);
+
+flush tables;
+select si.slai_id
+from t1 c join t2 si on
+ ((si.owner_tbl = 3 and si.owner_id = c.org_id) or
+ ( si.owner_tbl = 2 and si.owner_id = c.c_id))
+where
+ c.c_id = 218 and expiredate is null;
+
+select * from t1 where org_id is null;
+select si.slai_id
+from t1 c join t2 si on
+ ((si.owner_tbl = 3 and si.owner_id = c.org_id) or
+ ( si.owner_tbl = 2 and si.owner_id = c.c_id))
+where
+ c.c_id = 218 and expiredate is null;
+
+drop table t1, t2;
+
+#
+# Bug#17212: results not sorted correctly by ORDER BY when using index
+# (repeatable only w/innodb because of index props)
+#
+CREATE TABLE t1 (a int, b int, KEY b (b));
+CREATE TABLE t2 (a int, b int, PRIMARY KEY (a,b));
+CREATE TABLE t3 (a int, b int, c int, PRIMARY KEY (a),
+ UNIQUE KEY b (b,c), KEY a (a,b,c));
+
+INSERT INTO t1 VALUES (1, 1);
+INSERT INTO t1 SELECT a + 1, b + 1 FROM t1;
+INSERT INTO t1 SELECT a + 2, b + 2 FROM t1;
+
+INSERT INTO t2 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(1,8);
+INSERT INTO t2 SELECT a + 1, b FROM t2;
+DELETE FROM t2 WHERE a = 1 AND b < 2;
+
+INSERT INTO t3 VALUES (1,1,1),(2,1,2);
+INSERT INTO t3 SELECT a + 2, a + 2, 3 FROM t3;
+INSERT INTO t3 SELECT a + 4, a + 4, 3 FROM t3;
+
+# demonstrate a problem when a must-use-sort table flag
+# (sort_by_table=1) is being neglected.
+SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE
+ t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2)
+ ORDER BY t1.b LIMIT 2;
+
+# demonstrate the problem described in the bug report
+SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE
+ t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2)
+ ORDER BY t1.b LIMIT 5;
+DROP TABLE t1, t2, t3;
+
+
+# BUG#21077 (The testcase is not deterministic so correct execution doesn't
+# prove anything) For proof one should track if sequence of ha_innodb::* func
+# calls is correct.
+CREATE TABLE `t1` (`id1` INT) ;
+INSERT INTO `t1` (`id1`) VALUES (1),(5),(2);
+
+CREATE TABLE `t2` (
+ `id1` INT,
+ `id2` INT NOT NULL,
+ `id3` INT,
+ `id4` INT NOT NULL,
+ UNIQUE (`id2`,`id4`),
+ KEY (`id1`)
+);
+
+INSERT INTO `t2`(`id1`,`id2`,`id3`,`id4`) VALUES
+(1,1,1,0),
+(1,1,2,1),
+(5,1,2,2),
+(6,1,2,3),
+(1,2,2,2),
+(1,2,1,1);
+
+SELECT `id1` FROM `t1` WHERE `id1` NOT IN (SELECT `id1` FROM `t2` WHERE `id2` = 1 AND `id3` = 2);
+DROP TABLE t1, t2;
+
+#
+# Bug #22728 - Handler_rollback value is growing
+#
+
+let $before= `show /*!50002 GLOBAL */ status like 'Handler_rollback'`;
+create table t1 (c1 int) engine=innodb;
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+connection con2;
+handler t1 open;
+handler t1 read first;
+disconnect con2;
+connection con1;
+let $after= `show /*!50002 GLOBAL */ status like 'Handler_rollback'`;
+# Compare the before and after value, it should be equal
+--disable_query_log
+eval select STRCMP("$before", "$after") as "Before and after comparison";
+--enable_query_log
+connection default;
+drop table t1;
+disconnect con1;
+
+--echo End of 4.1 tests
+
+
+#
+# Bug #12882 min/max inconsistent on empty table
+#
+
+--disable_warnings
+eval create table t1m (a int) engine = $other_engine_type;
+create table t1i (a int);
+eval create table t2m (a int) engine = $other_engine_type;
+create table t2i (a int);
+--enable_warnings
+insert into t2m values (5);
+insert into t2i values (5);
+
+# test with $engine_type
+select min(a) from t1i;
+select min(7) from t1i;
+select min(7) from DUAL;
+explain select min(7) from t2i join t1i;
+select min(7) from t2i join t1i;
+
+select max(a) from t1i;
+select max(7) from t1i;
+select max(7) from DUAL;
+explain select max(7) from t2i join t1i;
+select max(7) from t2i join t1i;
+
+select 1, min(a) from t1i where a=99;
+select 1, min(a) from t1i where 1=99;
+select 1, min(1) from t1i where a=99;
+select 1, min(1) from t1i where 1=99;
+
+select 1, max(a) from t1i where a=99;
+select 1, max(a) from t1i where 1=99;
+select 1, max(1) from t1i where a=99;
+select 1, max(1) from t1i where 1=99;
+
+# mixed $engine_type/$other_engine_type test
+explain select count(*), min(7), max(7) from t1m, t1i;
+select count(*), min(7), max(7) from t1m, t1i;
+
+explain select count(*), min(7), max(7) from t1m, t2i;
+select count(*), min(7), max(7) from t1m, t2i;
+
+explain select count(*), min(7), max(7) from t2m, t1i;
+select count(*), min(7), max(7) from t2m, t1i;
+
+drop table t1m, t1i, t2m, t2i;
+
+#
+# Bug #12882: primary key implcitly included in every innodb index
+# (was part of group_min_max.test)
+#
+
+eval create table t1 (
+ a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
+) ENGINE = $other_engine_type;
+
+insert into t1 (a1, a2, b, c, d) values
+('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
+('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
+('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
+('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
+('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
+('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
+('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
+('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
+('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
+('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
+('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
+('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
+('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
+('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
+('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
+('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'),
+('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
+('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
+('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
+('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
+('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
+('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
+('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
+('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
+('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
+('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
+('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
+('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
+('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
+('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
+('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
+('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4');
+--disable_warnings
+create table t4 (
+ pk_col int auto_increment primary key, a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
+);
+--enable_warnings
+insert into t4 (a1, a2, b, c, d, dummy) select * from t1;
+
+create index idx12672_0 on t4 (a1);
+create index idx12672_1 on t4 (a1,a2,b,c);
+create index idx12672_2 on t4 (a1,a2,b);
+analyze table t4;
+
+select distinct a1 from t4 where pk_col not in (1,2,3,4);
+
+drop table t1,t4;
+
+
+#
+# BUG#18819: DELETE IGNORE hangs on foreign key parent delete
+#
+# The bug itself does not relate to InnoDB, but we have to use foreign
+# keys to reproduce it.
+#
+--disable_warnings
+DROP TABLE IF EXISTS t2, t1;
+--enable_warnings
+
+CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE= InnoDB;
+CREATE TABLE t2 (
+ i INT NOT NULL,
+ FOREIGN KEY (i) REFERENCES t1 (i) ON DELETE NO ACTION
+) ENGINE= InnoDB;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+DELETE IGNORE FROM t1 WHERE i = 1;
+
+SELECT * FROM t1, t2;
+
+DROP TABLE t2, t1;
+
+
+--echo End of 4.1 tests.
+
+
+#
+# Bug #6142: a problem with the empty innodb table
+# (was part of group_min_max.test)
+#
+
+--disable_warnings
+create table t1 (
+ a varchar(30), b varchar(30), primary key(a), key(b)
+);
+--enable_warnings
+select distinct a from t1;
+drop table t1;
+
+#
+# Bug #9798: group by with rollup
+# (was part of group_min_max.test)
+#
+
+--disable_warnings
+create table t1(a int, key(a));
+--enable_warnings
+insert into t1 values(1);
+select a, count(a) from t1 group by a with rollup;
+drop table t1;
+
+#
+# Bug #13293 Wrongly used index results in endless loop.
+# (was part of group_min_max.test)
+#
+create table t1 (f1 int, f2 char(1), primary key(f1,f2));
+insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d");
+alter table t1 drop primary key, add primary key (f2, f1);
+explain select distinct f1 a, f1 b from t1;
+explain select distinct f1, f2 from t1;
+drop table t1;
+
+#
+# Test for bug #17164: ORed FALSE blocked conversion of outer join into join
+#
+
+CREATE TABLE t1 (id int(11) NOT NULL PRIMARY KEY, name varchar(20),
+ INDEX (name));
+CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11));
+# CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11),
+# FOREIGN KEY (fkey) REFERENCES t2(id));
+if ($test_foreign_keys)
+{
+ ALTER TABLE t2 ADD FOREIGN KEY (fkey) REFERENCES t2(id);
+}
+INSERT INTO t1 VALUES (1,'A1'),(2,'A2'),(3,'B');
+INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3);
+
+EXPLAIN
+SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
+ WHERE t1.name LIKE 'A%';
+
+EXPLAIN
+SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
+ WHERE t1.name LIKE 'A%' OR FALSE;
+
+DROP TABLE t1,t2;
+
+#
+# Bug#22781: SQL_BIG_RESULT fails to influence sort plan
+#
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c FLOAT, KEY b(b)) ENGINE = INNODB;
+
+INSERT INTO t1 VALUES ( 1 , 1 , 1);
+INSERT INTO t1 SELECT a + 1 , MOD(a + 1 , 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 2 , MOD(a + 2 , 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 4 , MOD(a + 4 , 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 8 , MOD(a + 8 , 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 16, MOD(a + 16, 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 32, MOD(a + 32, 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 64, MOD(a + 64, 20), 1 FROM t1;
+
+EXPLAIN SELECT b, SUM(c) FROM t1 GROUP BY b;
+EXPLAIN SELECT SQL_BIG_RESULT b, SUM(c) FROM t1 GROUP BY b;
+DROP TABLE t1;
+
+#
+# Test of behaviour with CREATE ... SELECT
+#
+
+CREATE TABLE t1 (a int, b int);
+insert into t1 values (1,1),(1,2);
+--error 1062
+CREATE TABLE t2 (primary key (a)) select * from t1;
+# This should give warning
+drop table if exists t2;
+--error 1062
+CREATE TEMPORARY TABLE t2 (primary key (a)) select * from t1;
+# This should give warning
+drop table if exists t2;
+CREATE TABLE t2 (a int, b int, primary key (a));
+BEGIN;
+INSERT INTO t2 values(100,100);
+--error 1062
+CREATE TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
+SELECT * from t2;
+ROLLBACK;
+SELECT * from t2;
+TRUNCATE table t2;
+--error 1062
+INSERT INTO t2 select * from t1;
+SELECT * from t2;
+drop table t2;
+
+CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a));
+BEGIN;
+INSERT INTO t2 values(100,100);
+--error 1062
+CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
+SELECT * from t2;
+COMMIT;
+BEGIN;
+INSERT INTO t2 values(101,101);
+--error 1062
+CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
+SELECT * from t2;
+ROLLBACK;
+SELECT * from t2;
+TRUNCATE table t2;
+--error 1062
+INSERT INTO t2 select * from t1;
+SELECT * from t2;
+drop table t1,t2;
+
+#
+# Bug#17530: Incorrect key truncation on table creation caused server crash.
+#
+create table t1(f1 varchar(800) binary not null, key(f1))
+ character set utf8 collate utf8_general_ci;
+insert into t1 values('aaa');
+drop table t1;
+
+
+#
+# Bug#22781: SQL_BIG_RESULT fails to influence sort plan
+#
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c FLOAT, KEY b(b)) ENGINE = INNODB;
+
+INSERT INTO t1 VALUES ( 1 , 1 , 1);
+INSERT INTO t1 SELECT a + 1 , MOD(a + 1 , 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 2 , MOD(a + 2 , 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 4 , MOD(a + 4 , 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 8 , MOD(a + 8 , 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 16, MOD(a + 16, 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 32, MOD(a + 32, 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 64, MOD(a + 64, 20), 1 FROM t1;
+
+EXPLAIN SELECT b, SUM(c) FROM t1 GROUP BY b;
+EXPLAIN SELECT SQL_BIG_RESULT b, SUM(c) FROM t1 GROUP BY b;
+DROP TABLE t1;
+
+--echo End of 5.0 tests
+
+
+# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
+# UPDATE": if the row is updated, it's like a regular UPDATE:
+# LAST_INSERT_ID() is not affected.
+CREATE TABLE `t2` (
+ `k` int(11) NOT NULL auto_increment,
+ `a` int(11) default NULL,
+ `c` int(11) default NULL,
+ PRIMARY KEY (`k`),
+ UNIQUE KEY `idx_1` (`a`)
+);
+insert into t2 ( a ) values ( 6 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1;
+insert into t2 ( a ) values ( 7 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1;
+select last_insert_id();
+select * from t2;
+insert into t2 ( a ) values ( 6 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1;
+select last_insert_id();
+# test again when last_insert_id() is 0 initially
+select last_insert_id(0);
+insert into t2 ( a ) values ( 6 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1;
+select last_insert_id();
+select * from t2;
+
+# Test of LAST_INSERT_ID() when autogenerated will fail:
+# last_insert_id() should not change
+insert ignore into t2 values (null,6,1),(10,8,1);
+select last_insert_id();
+# First and second autogenerated will fail, last_insert_id() should
+# point to third
+insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
+select last_insert_id();
+select * from t2;
+
+# Test of the workaround which enables people to know the id of the
+# updated row in INSERT ON DUPLICATE KEY UPDATE, by using
+# LAST_INSERT_ID(autoinc_col) in the UPDATE clause.
+
+insert into t2 ( a ) values ( 6 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1, k=last_insert_id(k);
+select last_insert_id();
+select * from t2;
+
+drop table t2;
+
+--echo End of 5.1 tests
diff --git a/mysql-test/include/mix2.inc b/mysql-test/include/mix2.inc
new file mode 100644
index 00000000000..d3980b17d91
--- /dev/null
+++ b/mysql-test/include/mix2.inc
@@ -0,0 +1,2699 @@
+################################################################################
+# #
+# include/mix2.inc #
+# #
+# This is a derivate of t/innodb.test and has to be maintained by MySQL #
+# guys only. #
+# #
+# Please, DO NOT create a toplevel testcase mix2_innodb.test, because #
+# innodb.test does already these tests. #
+# #
+# Variables which have to be set before calling this script: #
+# $engine_type -- Storage engine to be tested #
+# $other_engine_type -- storage engine <> $engine_type #
+# $other_engine_type1 -- storage engine <> $engine_type #
+# storage engine <> $other_engine_type, if possible #
+# $other_non_trans_engine_type -- storage engine <> $engine_type #
+# $other_non_trans_engine_type must be a non #
+# transactional storage engine #
+# $other_non_live_chks_engine_type #
+# -- storage engine <> $engine_type, if possible #
+# storage engine must not support live checksum #
+# $other_live_chks_engine_type #
+# -- storage engine <> $engine_type, if possible #
+# storage engine must support live checksum #
+# General Note: The $other_*_engine_type variables must point to all #
+# time available storage engines #
+# 2006-08 MySQL 5.1 MyISAM and MEMORY only #
+# $test_transactions -- 0, skip transactional tests #
+# -- 1, do not skip transactional tests #
+# $test_foreign_keys -- 0, skip foreign key tests #
+# -- 1, do not skip foreign key tests #
+# $fulltext_query_unsupported -- 0, execute fulltext_query tests #
+# -- 1, skip fulltext query tests #
+# $no_autoinc_update -- 0, skip tests where it is expected that an update #
+# does not update the internal auto-increment value#
+# -- 1, do not skip these tests #
+# $no_spatial_key -- 0, skip tests where it is expected that keys on #
+# spatial data type are not allowed #
+# -- 1, do not skip these tests #
+# #
+# The comments/expectations refer to InnoDB. #
+# They might be not valid for other storage engines. #
+# #
+# #
+# Last update: #
+# 2006-08-15 ML - introduce several $variables #
+# - correct some storage engine assignments #
+# - minor improvements like correct wrong table after analyze #
+# - let checksum testcase meet all table variants with/without #
+# live checksum feature exiting and/or enabled #
+# 2006-07-26 ML create script by using t/innodb.test and introduce $variables #
+# #
+################################################################################
+
+# Set the SESSION DEFAULT STORAGE ENGINE to a value <> storage engine
+# to be tested. This must not affect any CREATE TABLE statement, where
+# the storage engine is assigned explicitely,
+eval SET SESSION STORAGE_ENGINE = $other_engine_type;
+
+#
+# Small basic test with ignore
+#
+
+--disable_warnings
+drop table if exists t1,t2,t3,t4;
+drop database if exists mysqltest;
+--enable_warnings
+
+eval create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=$engine_type;
+
+insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
+select id, code, name from t1 order by id;
+
+update ignore t1 set id = 8, name = 'Sinisa' where id < 3;
+select id, code, name from t1 order by id;
+update ignore t1 set id = id + 10, name = 'Ralph' where id < 4;
+select id, code, name from t1 order by id;
+
+drop table t1;
+
+#
+# A bit bigger test
+# The 'replace_column' statements are needed because the cardinality calculated
+# by innodb is not always the same between runs
+#
+
+eval CREATE TABLE t1 (
+ id int(11) NOT NULL auto_increment,
+ parent_id int(11) DEFAULT '0' NOT NULL,
+ level tinyint(4) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (id),
+ KEY parent_id (parent_id),
+ KEY level (level)
+) engine=$engine_type;
+INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
+update t1 set parent_id=parent_id+100;
+select * from t1 where parent_id=102;
+update t1 set id=id+1000;
+-- error 1062,1022
+update t1 set id=1024 where id=1009;
+select * from t1;
+update ignore t1 set id=id+1; # This will change all rows
+select * from t1;
+update ignore t1 set id=1023 where id=1010;
+select * from t1 where parent_id=102;
+--replace_column 9 #
+explain select level from t1 where level=1;
+--replace_column 9 #
+explain select level,id from t1 where level=1;
+--replace_column 9 #
+explain select level,id,parent_id from t1 where level=1;
+select level,id from t1 where level=1;
+select level,id,parent_id from t1 where level=1;
+optimize table t1;
+--replace_column 7 #
+show keys from t1;
+drop table t1;
+
+#
+# Test replace
+#
+
+eval CREATE TABLE t1 (
+ gesuchnr int(11) DEFAULT '0' NOT NULL,
+ benutzer_id int(11) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (gesuchnr,benutzer_id)
+) engine=$engine_type;
+
+replace into t1 (gesuchnr,benutzer_id) values (2,1);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+select * from t1;
+drop table t1;
+
+#
+# test delete using hidden_primary_key
+#
+
+eval create table t1 (a int) engine=$engine_type;
+insert into t1 values (1), (2);
+optimize table t1;
+delete from t1 where a = 1;
+select * from t1;
+check table t1;
+drop table t1;
+
+eval create table t1 (a int,b varchar(20)) engine=$engine_type;
+insert into t1 values (1,""), (2,"testing");
+delete from t1 where a = 1;
+select * from t1;
+create index skr on t1 (a);
+insert into t1 values (3,""), (4,"testing");
+analyze table t1;
+--replace_column 7 #
+show keys from t1;
+drop table t1;
+
+
+# Test of reading on secondary key with may be null
+
+eval create table t1 (a int,b varchar(20),key(a)) engine=$engine_type;
+insert into t1 values (1,""), (2,"testing");
+select * from t1 where a = 1;
+drop table t1;
+
+if ($test_transactions)
+{
+#
+# Test rollback
+#
+
+eval create table t1 (n int not null primary key) engine=$engine_type;
+set autocommit=0;
+insert into t1 values (4);
+rollback;
+select n, "after rollback" from t1;
+insert into t1 values (4);
+commit;
+select n, "after commit" from t1;
+commit;
+insert into t1 values (5);
+-- error 1062
+insert into t1 values (4);
+commit;
+select n, "after commit" from t1;
+set autocommit=1;
+insert into t1 values (6);
+-- error 1062
+insert into t1 values (4);
+select n from t1;
+set autocommit=0;
+#
+# savepoints
+#
+begin;
+savepoint `my_savepoint`;
+insert into t1 values (7);
+savepoint `savept2`;
+insert into t1 values (3);
+select n from t1;
+savepoint savept3;
+rollback to savepoint savept2;
+--error 1305
+rollback to savepoint savept3;
+rollback to savepoint savept2;
+release savepoint `my_savepoint`;
+select n from t1;
+-- error 1305
+rollback to savepoint `my_savepoint`;
+--error 1305
+rollback to savepoint savept2;
+insert into t1 values (8);
+savepoint sv;
+commit;
+savepoint sv;
+set autocommit=1;
+# nop
+rollback;
+drop table t1;
+
+#
+# Test for commit and FLUSH TABLES WITH READ LOCK
+#
+
+eval create table t1 (n int not null primary key) engine=$engine_type;
+start transaction;
+insert into t1 values (4);
+flush tables with read lock;
+#
+# Current code can't handle a read lock in middle of transaction
+#--error 1223;
+commit;
+unlock tables;
+commit;
+select * from t1;
+drop table t1;
+
+#
+# Testing transactions
+#
+
+eval create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=$engine_type;
+begin;
+insert into t1 values(1,'hamdouni');
+select id as afterbegin_id,nom as afterbegin_nom from t1;
+rollback;
+select id as afterrollback_id,nom as afterrollback_nom from t1;
+set autocommit=0;
+insert into t1 values(2,'mysql');
+select id as afterautocommit0_id,nom as afterautocommit0_nom from t1;
+rollback;
+select id as afterrollback_id,nom as afterrollback_nom from t1;
+set autocommit=1;
+drop table t1;
+
+#
+# Simple not autocommit test
+#
+
+eval CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=$engine_type;
+insert into t1 values ('pippo', 12);
+-- error 1062
+insert into t1 values ('pippo', 12); # Gives error
+delete from t1;
+delete from t1 where id = 'pippo';
+select * from t1;
+
+insert into t1 values ('pippo', 12);
+set autocommit=0;
+delete from t1;
+rollback;
+select * from t1;
+delete from t1;
+commit;
+select * from t1;
+drop table t1;
+
+#
+# Test of active transactions
+#
+
+eval create table t1 (a integer) engine=$engine_type;
+start transaction;
+rename table t1 to t2;
+eval create table t1 (b integer) engine=$engine_type;
+insert into t1 values (1);
+rollback;
+drop table t1;
+rename table t2 to t1;
+drop table t1;
+set autocommit=1;
+
+#
+# The following simple tests failed at some point
+#
+
+eval CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=$engine_type;
+INSERT INTO t1 VALUES (1, 'Jochen');
+select * from t1;
+drop table t1;
+
+eval CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=$engine_type;
+set autocommit=0;
+INSERT INTO t1 SET _userid='marc@anyware.co.uk';
+COMMIT;
+SELECT * FROM t1;
+SELECT _userid FROM t1 WHERE _userid='marc@anyware.co.uk';
+drop table t1;
+set autocommit=1;
+
+}
+# End of transactional tests
+
+#
+# Test when reading on part of unique key
+#
+eval CREATE TABLE t1 (
+ user_id int(10) DEFAULT '0' NOT NULL,
+ name varchar(100),
+ phone varchar(100),
+ ref_email varchar(100) DEFAULT '' NOT NULL,
+ detail varchar(200),
+ PRIMARY KEY (user_id,ref_email)
+)engine=$engine_type;
+
+INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar');
+select * from t1 where user_id=10292;
+INSERT INTO t1 VALUES (10291,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10293,'shirish','2333604','shirish@yahoo.com','ddsds');
+select * from t1 where user_id=10292;
+select * from t1 where user_id>=10292;
+select * from t1 where user_id>10292;
+select * from t1 where user_id<10292;
+drop table t1;
+
+#
+# Test that keys are created in right order
+#
+
+eval CREATE TABLE t1 (a int not null, b int not null,c int not null,
+key(a),primary key(a,b), unique(c),key(a),unique(b)) ENGINE = $engine_type;
+--replace_column 7 #
+show index from t1;
+drop table t1;
+
+#
+# Test of ALTER TABLE and innodb tables
+#
+
+eval create table t1 (col1 int not null, col2 char(4) not null, primary key(col1)) ENGINE = $other_engine_type;
+eval alter table t1 engine=$engine_type;
+insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4');
+select * from t1;
+update t1 set col2='7' where col1='4';
+select * from t1;
+alter table t1 add co3 int not null;
+select * from t1;
+update t1 set col2='9' where col1='2';
+select * from t1;
+drop table t1;
+
+#
+# INSERT INTO innodb tables
+#
+
+eval create table t1 (a int not null , b int, primary key (a)) engine = $engine_type;
+eval create table t2 (a int not null , b int, primary key (a)) engine = $other_engine_type;
+insert into t1 VALUES (1,3) , (2,3), (3,3);
+select * from t1;
+insert into t2 select * from t1;
+select * from t2;
+delete from t1 where b = 3;
+select * from t1;
+insert into t1 select * from t2;
+select * from t1;
+select * from t2;
+drop table t1,t2;
+
+#
+# Search on unique key
+#
+
+eval CREATE TABLE t1 (
+ id int(11) NOT NULL auto_increment,
+ ggid varchar(32) binary DEFAULT '' NOT NULL,
+ email varchar(64) DEFAULT '' NOT NULL,
+ passwd varchar(32) binary DEFAULT '' NOT NULL,
+ PRIMARY KEY (id),
+ UNIQUE ggid (ggid)
+) ENGINE=$engine_type;
+
+insert into t1 (ggid,passwd) values ('test1','xxx');
+insert into t1 (ggid,passwd) values ('test2','yyy');
+-- error 1062
+insert into t1 (ggid,passwd) values ('test2','this will fail');
+-- error 1062
+insert into t1 (ggid,id) values ('this will fail',1);
+
+select * from t1 where ggid='test1';
+select * from t1 where passwd='xxx';
+select * from t1 where id=2;
+
+replace into t1 (ggid,id) values ('this will work',1);
+replace into t1 (ggid,passwd) values ('test2','this will work');
+-- error 1062
+update t1 set id=100,ggid='test2' where id=1;
+select * from t1;
+select * from t1 where id=1;
+select * from t1 where id=999;
+drop table t1;
+
+#
+# ORDER BY on not primary key
+#
+
+eval CREATE TABLE t1 (
+ user_name varchar(12),
+ password text,
+ subscribed char(1),
+ user_id int(11) DEFAULT '0' NOT NULL,
+ quota bigint(20),
+ weight double,
+ access_date date,
+ access_time time,
+ approved datetime,
+ dummy_primary_key int(11) NOT NULL auto_increment,
+ PRIMARY KEY (dummy_primary_key)
+) ENGINE=$engine_type;
+INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1);
+INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2);
+INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3);
+INSERT INTO t1 VALUES ('user_3','somepassword','Y',3,3,1.7320508075689,'2000-09-07','23:06:59','2000-09-07 23:06:59',4);
+INSERT INTO t1 VALUES ('user_4','somepassword','N',4,4,2,'2000-09-07','23:06:59','2000-09-07 23:06:59',5);
+select user_name, password , subscribed, user_id, quota, weight, access_date, access_time, approved, dummy_primary_key from t1 order by user_name;
+drop table t1;
+
+#
+# Testing of tables without primary keys
+#
+
+eval CREATE TABLE t1 (
+ id int(11) NOT NULL auto_increment,
+ parent_id int(11) DEFAULT '0' NOT NULL,
+ level tinyint(4) DEFAULT '0' NOT NULL,
+ KEY (id),
+ KEY parent_id (parent_id),
+ KEY level (level)
+) engine=$engine_type;
+INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1);
+INSERT INTO t1 values (179,5,2);
+update t1 set parent_id=parent_id+100;
+select * from t1 where parent_id=102;
+update t1 set id=id+1000;
+update t1 set id=1024 where id=1009;
+select * from t1;
+update ignore t1 set id=id+1; # This will change all rows
+select * from t1;
+update ignore t1 set id=1023 where id=1010;
+select * from t1 where parent_id=102;
+--replace_column 9 #
+explain select level from t1 where level=1;
+select level,id from t1 where level=1;
+select level,id,parent_id from t1 where level=1;
+select level,id from t1 where level=1 order by id;
+delete from t1 where level=1;
+select * from t1;
+drop table t1;
+
+#
+# Test of index only reads
+#
+eval CREATE TABLE t1 (
+ sca_code char(6) NOT NULL,
+ cat_code char(6) NOT NULL,
+ sca_desc varchar(50),
+ lan_code char(2) NOT NULL,
+ sca_pic varchar(100),
+ sca_sdesc varchar(50),
+ sca_sch_desc varchar(16),
+ PRIMARY KEY (sca_code, cat_code, lan_code),
+ INDEX sca_pic (sca_pic)
+) engine = $engine_type ;
+
+INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
+select count(*) from t1 where sca_code = 'PD';
+select count(*) from t1 where sca_code <= 'PD';
+select count(*) from t1 where sca_pic is null;
+alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
+select count(*) from t1 where sca_code='PD' and sca_pic is null;
+select count(*) from t1 where cat_code='E';
+
+alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
+select count(*) from t1 where sca_code='PD' and sca_pic is null;
+select count(*) from t1 where sca_pic >= 'n';
+select sca_pic from t1 where sca_pic is null;
+update t1 set sca_pic="test" where sca_pic is null;
+delete from t1 where sca_code='pd';
+drop table t1;
+
+#
+# Test of opening table twice and timestamps
+#
+set @a:=now();
+eval CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=$engine_type;
+insert into t1 (a) values(1),(2),(3);
+select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
+select a from t1 natural join t1 as t2 where b >= @a order by a;
+update t1 set a=5 where a=1;
+select a from t1;
+drop table t1;
+
+#
+# Test with variable length primary key
+#
+eval create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=$engine_type;
+insert into t1 values("hello",1),("world",2);
+select * from t1 order by b desc;
+optimize table t1;
+--replace_column 7 #
+show keys from t1;
+drop table t1;
+
+#
+# Test of create index with NULL columns
+#
+eval create table t1 (i int, j int ) ENGINE=$engine_type;
+insert into t1 values (1,2);
+select * from t1 where i=1 and j=2;
+create index ax1 on t1 (i,j);
+select * from t1 where i=1 and j=2;
+drop table t1;
+
+#
+# Test min-max optimization
+#
+
+eval CREATE TABLE t1 (
+ a int3 unsigned NOT NULL,
+ b int1 unsigned NOT NULL,
+ UNIQUE (a, b)
+) ENGINE = $engine_type;
+
+INSERT INTO t1 VALUES (1, 1);
+SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
+drop table t1;
+
+#
+# Test INSERT DELAYED
+#
+
+eval CREATE TABLE t1 (a int unsigned NOT NULL) engine=$engine_type;
+# Can't test this in 3.23
+# INSERT DELAYED INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+
+#
+# Crash when using many tables (Test case by Jeremy D Zawodny)
+#
+
+eval create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) engine = $engine_type;
+insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
+--replace_column 9 #
+explain select * from t1 where a > 0 and a < 50;
+drop table t1;
+
+#
+# Test lock tables
+#
+
+eval create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=$engine_type;
+insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
+LOCK TABLES t1 WRITE;
+--error 1062
+insert into t1 values (99,1,2,'D'),(1,1,2,'D');
+select id from t1;
+select id from t1;
+UNLOCK TABLES;
+DROP TABLE t1;
+
+eval create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=$engine_type;
+insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
+LOCK TABLES t1 WRITE;
+begin;
+--error 1062
+insert into t1 values (99,1,2,'D'),(1,1,2,'D');
+select id from t1;
+insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
+commit;
+select id,id3 from t1;
+UNLOCK TABLES;
+DROP TABLE t1;
+
+#
+# Test prefix key
+#
+eval create table t1 (a char(20), unique (a(5))) engine=$engine_type;
+drop table t1;
+eval create table t1 (a char(20), index (a(5))) engine=$engine_type;
+show create table t1;
+drop table t1;
+
+#
+# Test using temporary table and auto_increment
+#
+
+eval create temporary table t1 (a int not null auto_increment, primary key(a)) engine=$engine_type;
+insert into t1 values (NULL),(NULL),(NULL);
+delete from t1 where a=3;
+insert into t1 values (NULL);
+select * from t1;
+alter table t1 add b int;
+select * from t1;
+drop table t1;
+
+#Slashdot bug
+eval create table t1
+ (
+ id int auto_increment primary key,
+ name varchar(32) not null,
+ value text not null,
+ uid int not null,
+ unique key(name,uid)
+ ) engine=$engine_type;
+insert into t1 values (1,'one','one value',101),
+ (2,'two','two value',102),(3,'three','three value',103);
+set insert_id=5;
+replace into t1 (value,name,uid) values ('other value','two',102);
+delete from t1 where uid=102;
+set insert_id=5;
+replace into t1 (value,name,uid) values ('other value','two',102);
+set insert_id=6;
+replace into t1 (value,name,uid) values ('other value','two',102);
+select * from t1;
+drop table t1;
+
+#
+# Test DROP DATABASE
+#
+# ML: Test logics
+# Check that the creation of a table with engine = $engine_type does
+# in a certain database (already containing some tables using other
+# storage engines) not prevent the dropping of this database.
+
+create database mysqltest;
+eval create table mysqltest.t1 (a int not null) engine= $engine_type;
+insert into mysqltest.t1 values(1);
+eval create table mysqltest.t2 (a int not null) engine= $other_engine_type;
+insert into mysqltest.t2 values(1);
+eval create table mysqltest.t3 (a int not null) engine= $other_engine_type1;
+insert into mysqltest.t3 values(1);
+commit;
+drop database mysqltest;
+# Don't check error message
+--error 1049
+show tables from mysqltest;
+
+#
+# Test truncate table with and without auto_commit
+#
+
+set autocommit=0;
+eval create table t1 (a int not null) engine= $engine_type;
+insert into t1 values(1),(2);
+truncate table t1;
+commit;
+truncate table t1;
+truncate table t1;
+select * from t1;
+insert into t1 values(1),(2);
+delete from t1;
+select * from t1;
+commit;
+drop table t1;
+set autocommit=1;
+
+eval create table t1 (a int not null) engine= $engine_type;
+insert into t1 values(1),(2);
+truncate table t1;
+insert into t1 values(1),(2);
+select * from t1;
+truncate table t1;
+insert into t1 values(1),(2);
+delete from t1;
+select * from t1;
+drop table t1;
+
+#
+# Test of how ORDER BY works when doing it on the whole table
+#
+
+eval create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=$engine_type;
+insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
+--replace_column 9 #
+explain select * from t1 order by a;
+--replace_column 9 #
+explain select * from t1 order by b;
+--replace_column 9 #
+explain select * from t1 order by c;
+--replace_column 9 #
+explain select a from t1 order by a;
+--replace_column 9 #
+explain select b from t1 order by b;
+--replace_column 9 #
+explain select a,b from t1 order by b;
+--replace_column 9 #
+explain select a,b from t1;
+--replace_column 9 #
+explain select a,b,c from t1;
+drop table t1;
+
+#
+# Check describe
+#
+
+eval create table t1 (t int not null default 1, key (t)) engine=$engine_type;
+desc t1;
+drop table t1;
+
+#
+# Test of multi-table-delete
+#
+
+eval CREATE TABLE t1 (
+ number bigint(20) NOT NULL default '0',
+ cname char(15) NOT NULL default '',
+ carrier_id smallint(6) NOT NULL default '0',
+ privacy tinyint(4) NOT NULL default '0',
+ last_mod_date timestamp NOT NULL,
+ last_mod_id smallint(6) NOT NULL default '0',
+ last_app_date timestamp NOT NULL,
+ last_app_id smallint(6) default '-1',
+ version smallint(6) NOT NULL default '0',
+ assigned_scps int(11) default '0',
+ status tinyint(4) default '0'
+) ENGINE=$engine_type;
+INSERT INTO t1 VALUES (4077711111,'SeanWheeler',90,2,20020111112846,500,00000000000000,-1,2,3,1);
+INSERT INTO t1 VALUES (9197722223,'berry',90,3,20020111112809,500,20020102114532,501,4,10,0);
+INSERT INTO t1 VALUES (650,'San Francisco',0,0,20011227111336,342,00000000000000,-1,1,24,1);
+INSERT INTO t1 VALUES (302467,'Sue\'s Subshop',90,3,20020109113241,500,20020102115111,501,7,24,0);
+INSERT INTO t1 VALUES (6014911113,'SudzCarwash',520,1,20020102115234,500,20020102115259,501,33,32768,0);
+INSERT INTO t1 VALUES (333,'tubs',99,2,20020109113440,501,20020109113440,500,3,10,0);
+eval CREATE TABLE t2 (
+ number bigint(20) NOT NULL default '0',
+ cname char(15) NOT NULL default '',
+ carrier_id smallint(6) NOT NULL default '0',
+ privacy tinyint(4) NOT NULL default '0',
+ last_mod_date timestamp NOT NULL,
+ last_mod_id smallint(6) NOT NULL default '0',
+ last_app_date timestamp NOT NULL,
+ last_app_id smallint(6) default '-1',
+ version smallint(6) NOT NULL default '0',
+ assigned_scps int(11) default '0',
+ status tinyint(4) default '0'
+) ENGINE=$engine_type;
+INSERT INTO t2 VALUES (4077711111,'SeanWheeler',0,2,20020111112853,500,00000000000000,-1,2,3,1);
+INSERT INTO t2 VALUES (9197722223,'berry',90,3,20020111112818,500,20020102114532,501,4,10,0);
+INSERT INTO t2 VALUES (650,'San Francisco',90,0,20020109113158,342,00000000000000,-1,1,24,1);
+INSERT INTO t2 VALUES (333,'tubs',99,2,20020109113453,501,20020109113453,500,3,10,0);
+select * from t1;
+select * from t2;
+delete t1, t2 from t1 left join t2 on t1.number=t2.number where (t1.carrier_id=90 and t1.number=t2.number) or (t2.carrier_id=90 and t1.number=t2.number) or (t1.carrier_id=90 and t2.number is null);
+select * from t1;
+select * from t2;
+select * from t2;
+drop table t1,t2;
+
+#
+# A simple test with some isolation levels
+# TODO: Make this into a test using replication to really test how
+# this works.
+#
+
+eval create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=$engine_type;
+
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+SELECT @@tx_isolation,@@global.tx_isolation;
+insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David');
+select id, code, name from t1 order by id;
+COMMIT;
+
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+insert into t1 (code, name) values (2, 'Erik'), (3, 'Sasha');
+select id, code, name from t1 order by id;
+COMMIT;
+
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt');
+select id, code, name from t1 order by id;
+COMMIT;
+DROP TABLE t1;
+
+#
+# Test of multi-table-update
+#
+eval create table t1 (n int(10), d int(10)) engine=$engine_type;
+eval create table t2 (n int(10), d int(10)) engine=$engine_type;
+insert into t1 values(1,1),(1,2);
+insert into t2 values(1,10),(2,20);
+UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
+select * from t1;
+select * from t2;
+drop table t1,t2;
+
+#
+# Testing of IFNULL
+#
+eval create table t1 (a int, b int) engine=$engine_type;
+insert into t1 values(20,null);
+select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
+t2.b=t3.a;
+select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
+t2.b=t3.a order by 1;
+insert into t1 values(10,null);
+select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
+t2.b=t3.a order by 1;
+drop table t1;
+
+#
+# Test of read_through not existing const_table
+#
+
+eval create table t1 (a varchar(10) not null) engine = $other_engine_type;
+eval create table t2 (b varchar(10) not null unique) engine=$engine_type;
+select t1.a from t1,t2 where t1.a=t2.b;
+drop table t1,t2;
+eval create table t1 (a int not null, b int, primary key (a)) engine = $engine_type;
+eval create table t2 (a int not null, b int, primary key (a)) engine = $engine_type;
+insert into t1 values (10, 20);
+insert into t2 values (10, 20);
+update t1, t2 set t1.b = 150, t2.b = t1.b where t2.a = t1.a and t1.a = 10;
+drop table t1,t2;
+
+if ($test_foreign_keys)
+{
+#
+# Test of multi-table-delete with foreign key constraints
+#
+
+eval CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=$engine_type;
+eval CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE ) ENGINE=$engine_type;
+insert into t1 set id=1;
+insert into t2 set id=1, t1_id=1;
+delete t1,t2 from t1,t2 where t1.id=t2.t1_id;
+select * from t1;
+select * from t2;
+drop table t2,t1;
+eval CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) ENGINE=$engine_type;
+eval CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) ENGINE=$engine_type;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2 VALUES(1, 1);
+SELECT * from t1;
+UPDATE t1,t2 SET t1.id=t1.id+1, t2.t1_id=t1.id+1;
+SELECT * from t1;
+UPDATE t1,t2 SET t1.id=t1.id+1 where t1.id!=t2.id;
+SELECT * from t1;
+DROP TABLE t1,t2;
+}
+
+if ($test_transactions)
+{
+#
+# Test of range_optimizer
+#
+
+set autocommit=0;
+
+eval CREATE TABLE t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=$engine_type;
+
+eval CREATE TABLE t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=$engine_type;
+
+eval CREATE TABLE t3 (id1 CHAR(15) NOT NULL, id2 CHAR(15) NOT NULL, PRIMARY KEY(id1, id2)) ENGINE=$engine_type;
+
+INSERT INTO t3 VALUES("my-test-1", "my-test-2");
+COMMIT;
+
+INSERT INTO t1 VALUES("this-key", "will disappear");
+INSERT INTO t2 VALUES("this-key", "will also disappear");
+DELETE FROM t3 WHERE id1="my-test-1";
+
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+ROLLBACK;
+
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+SELECT * FROM t3 WHERE id1="my-test-1" LOCK IN SHARE MODE;
+COMMIT;
+set autocommit=1;
+DROP TABLE t1,t2,t3;
+}
+
+#
+# Check update with conflicting key
+#
+
+eval CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) engine=$engine_type;
+INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+# We need the a < 1000 test here to quard against the halloween problems
+UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000;
+SELECT * from t1;
+drop table t1;
+
+#
+# Test multi update with different join methods
+#
+
+eval CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=$engine_type;
+eval CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=$engine_type;
+INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
+INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+
+# Full join, without key
+update t1,t2 set t1.a=t1.a+100;
+select * from t1;
+
+# unique key
+update t1,t2 set t1.a=t1.a+100 where t1.a=101;
+select * from t1;
+
+# ref key
+update t1,t2 set t1.b=t1.b+10 where t1.b=2;
+select * from t1;
+
+# Range key (in t1)
+update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100;
+select * from t1;
+select * from t2;
+
+drop table t1,t2;
+eval CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=$other_non_trans_engine_type;
+eval CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=$engine_type;
+SET AUTOCOMMIT=0;
+INSERT INTO t1 ( B_ID ) VALUES ( 1 );
+INSERT INTO t2 ( NEXT_T ) VALUES ( 1 );
+ROLLBACK;
+SELECT * FROM t1;
+drop table t1,t2;
+eval create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) engine = $engine_type;
+insert into t1 values (1,0,4), (2,1,3), (3,2,1), (4,1,2);
+select distinct parent,child from t1 order by parent;
+drop table t1;
+
+#
+# Test that MySQL priorities clustered indexes
+#
+eval create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) engine=$engine_type;
+eval create table t2 (a int not null auto_increment primary key, b int) ENGINE = $other_engine_type;
+insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null);
+insert into t2 (a) select b from t1;
+insert into t1 (b) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+select count(*) from t1;
+--replace_column 9 #
+explain select * from t1 where c between 1 and 2500;
+update t1 set c=a;
+--replace_column 9 #
+explain select * from t1 where c between 1 and 2500;
+drop table t1,t2;
+
+#
+# Test of UPDATE ... ORDER BY
+#
+
+eval create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=$engine_type;
+
+insert into t1 (id) values (null),(null),(null),(null),(null);
+update t1 set fk=69 where fk is null order by id limit 1;
+SELECT * from t1;
+drop table t1;
+
+eval create table t1 (a int not null, b int not null, key (a)) engine=$engine_type;
+insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3);
+SET @tmp=0;
+update t1 set b=(@tmp:=@tmp+1) order by a;
+update t1 set b=99 where a=1 order by b asc limit 1;
+update t1 set b=100 where a=1 order by b desc limit 2;
+update t1 set a=a+10+b where a=1 order by b;
+select * from t1 order by a,b;
+drop table t1;
+
+#
+# Test of multi-table-updates (bug #1980).
+#
+
+eval create table t1 ( c char(8) not null ) engine=$engine_type;
+insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
+insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
+
+alter table t1 add b char(8) not null;
+alter table t1 add a char(8) not null;
+alter table t1 add primary key (a,b,c);
+update t1 set a=c, b=c;
+
+eval create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=$engine_type;
+insert into t2 select * from t1;
+
+delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
+drop table t1,t2;
+
+#
+# test autoincrement with TRUNCATE
+#
+
+SET AUTOCOMMIT=1;
+eval create table t1 (a integer auto_increment primary key) engine=$engine_type;
+insert into t1 (a) values (NULL),(NULL);
+truncate table t1;
+insert into t1 (a) values (NULL),(NULL);
+SELECT * from t1;
+drop table t1;
+
+
+if ($test_foreign_keys)
+{
+#
+# Test dictionary handling with spaceand quoting
+#
+
+eval CREATE TABLE t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) ENGINE=$engine_type;
+eval CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (`t1_id`) REFERENCES `t1`(`id 1`) ON DELETE CASCADE ) ENGINE=$engine_type;
+#show create table t2;
+drop table t2,t1;
+
+#
+# Test of multi updated and foreign keys
+#
+
+eval create table `t1` (`id` int( 11 ) not null ,primary key ( `id` )) engine = $engine_type;
+insert into `t1`values ( 1 ) ;
+eval create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) engine = $engine_type;
+insert into `t2`values ( 1 ) ;
+eval create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = $engine_type;
+insert into `t3`values ( 1 ) ;
+--error 1451
+delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
+--error 1451
+update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
+--error 1054
+update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
+drop table t3,t2,t1;
+
+#
+# test for recursion depth limit
+#
+eval create table t1(
+ id int primary key,
+ pid int,
+ index(pid),
+ foreign key(pid) references t1(id) on delete cascade) engine=$engine_type;
+insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),
+ (8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);
+-- error 1451
+delete from t1 where id=0;
+delete from t1 where id=15;
+delete from t1 where id=0;
+
+drop table t1;
+}
+# End of FOREIGN KEY tests
+
+#
+# Test timestamps
+#
+
+eval CREATE TABLE t1 (col1 int(1))ENGINE=$engine_type;
+eval CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx
+(stamp))ENGINE=$engine_type;
+insert into t1 values (1),(2),(3);
+# Note that timestamp 3 is wrong
+insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000);
+SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp <
+'20020204120000' GROUP BY col1;
+drop table t1,t2;
+
+#
+# Test by Francois MASUREL
+#
+
+eval CREATE TABLE t1 (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `id_object` int(10) unsigned default '0',
+ `id_version` int(10) unsigned NOT NULL default '1',
+ `label` varchar(100) NOT NULL default '',
+ `description` text,
+ PRIMARY KEY (`id`),
+ KEY `id_object` (`id_object`),
+ KEY `id_version` (`id_version`)
+) ENGINE=$engine_type;
+
+INSERT INTO t1 VALUES("6", "3382", "9", "Test", NULL), ("7", "102", "5", "Le Pekin (Test)", NULL),("584", "1794", "4", "Test de resto", NULL),("837", "1822", "6", "Test 3", NULL),("1119", "3524", "1", "Societe Test", NULL),("1122", "3525", "1", "Fournisseur Test", NULL);
+
+eval CREATE TABLE t2 (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `id_version` int(10) unsigned NOT NULL default '1',
+ PRIMARY KEY (`id`),
+ KEY `id_version` (`id_version`)
+) ENGINE=$engine_type;
+
+INSERT INTO t2 VALUES("3524", "1"),("3525", "1"),("1794", "4"),("102", "5"),("1822", "6"),("3382", "9");
+
+SELECT t2.id, t1.`label` FROM t2 INNER JOIN
+(SELECT t1.id_object as id_object FROM t1 WHERE t1.`label` LIKE '%test%') AS lbl
+ON (t2.id = lbl.id_object) INNER JOIN t1 ON (t2.id = t1.id_object);
+drop table t1,t2;
+
+# Live checksum feature available + enabled
+eval create table t1 (a int, b varchar(200), c text not null) checksum=1 engine=$other_live_chks_engine_type;
+# Live checksum feature available + disabled
+eval create table t2 (a int, b varchar(200), c text not null) checksum=0 engine=$other_live_chks_engine_type;
+#
+# Live checksum feature not available + enabled
+eval create table t3 (a int, b varchar(200), c varchar(200) not null) checksum=1 engine=$other_non_live_chks_engine_type;
+# Live checksum feature not available + disabled
+eval create table t4 (a int, b varchar(200), c varchar(200) not null) checksum=0 engine=$other_non_live_chks_engine_type;
+#
+# Live checksum feature probably available + enabled
+eval create table t5 (a int, b varchar(200), c text not null) checksum=1 engine=$engine_type;
+# Live checksum feature probably available + disabled
+eval create table t6 (a int, b varchar(200), c text not null) checksum=0 engine=$engine_type;
+#
+insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
+insert t2 select * from t1;
+insert t3 select * from t1;
+insert t4 select * from t1;
+insert t5 select * from t1;
+insert t6 select * from t1;
+checksum table t1, t2, t3, t4, t5, t6, t7 quick;
+checksum table t1, t2, t3, t4, t5, t6, t7;
+checksum table t1, t2, t3, t4, t5, t6, t7 extended;
+# #show table status;
+drop table t1,t2,t3, t4, t5, t6;
+
+#
+# Test problem with refering to different fields in same table in UNION
+# (Bug#2552: UNION returns NULL instead of expected value (innoDB only tables))
+#
+eval create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=$engine_type;
+insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
+select trim(name2) from t1 union all select trim(name) from t1 union all select trim(id) from t1;
+drop table t1;
+
+#
+# Bug#2160: Extra error message for CREATE TABLE LIKE with InnoDB
+#
+eval create table t1 (a int) engine=$engine_type;
+create table t2 like t1;
+show create table t2;
+drop table t1,t2;
+
+if ($test_foreign_keys)
+{
+#
+# Test of automaticly created foreign keys
+#
+
+eval create table t1 (id int(11) not null, id2 int(11) not null, unique (id,id2)) engine=$engine_type;
+eval create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) references t1 (id)) engine = $engine_type;
+show create table t1;
+show create table t2;
+create index id on t2 (id);
+show create table t2;
+create index id2 on t2 (id);
+show create table t2;
+drop index id2 on t2;
+--error 1025,1025
+drop index id on t2;
+show create table t2;
+drop table t2;
+
+eval create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id,id2) references t1 (id,id2)) engine = $engine_type;
+show create table t2;
+create unique index id on t2 (id,id2);
+show create table t2;
+drop table t2;
+
+# Check foreign key columns created in different order than key columns
+eval create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = $engine_type;
+show create table t2;
+drop table t2;
+
+eval create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = $engine_type;
+show create table t2;
+drop table t2;
+
+eval create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = $engine_type;
+show create table t2;
+drop table t2;
+
+eval create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id), primary key (id), index (id,id2)) engine = $engine_type;
+show create table t2;
+drop table t2;
+
+eval create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id)) engine= $engine_type;
+show create table t2;
+alter table t2 add index id_test (id), add index id_test2 (id,id2);
+show create table t2;
+drop table t2;
+
+# Test error handling
+
+# Clean up filename -- embedded server reports whole path without .frm,
+# regular server reports relative path with .frm (argh!)
+--replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ / t2.frm t2
+--error 1005
+eval create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = $engine_type;
+
+# bug#3749
+
+eval create table t2 (a int auto_increment primary key, b int, index(b), foreign key (b) references t1(id), unique(b)) engine=$engine_type;
+show create table t2;
+drop table t2;
+eval create table t2 (a int auto_increment primary key, b int, foreign key (b) references t1(id), foreign key (b) references t1(id), unique(b)) engine=$engine_type;
+show create table t2;
+drop table t2, t1;
+}
+# End of FOREIGN KEY tests
+
+
+#
+# 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";
+
+eval create table t1 (a int) engine=$engine_type;
+
+# 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
+eval create table t1 (c char(10), index (c,c)) engine=$engine_type;
+--error 1060
+eval create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=$engine_type;
+--error 1060
+eval create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=$engine_type;
+--error 1060
+eval create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=$engine_type;
+eval create table t1 (c1 char(10), c2 char(10)) engine=$engine_type;
+--error 1060
+alter table t1 add key (c1,c1);
+--error 1060
+alter table t1 add key (c2,c1,c1);
+--error 1060
+alter table t1 add key (c1,c2,c1);
+--error 1060
+alter table t1 add key (c1,c1,c2);
+drop table t1;
+
+#
+# Bug #4082: integer truncation
+#
+
+eval create table t1(a int(1) , b int(1)) engine=$engine_type;
+insert into t1 values ('1111', '3333');
+select distinct concat(a, b) from t1;
+drop table t1;
+
+if ($fulltext_query_unsupported)
+{
+#
+# BUG#7709 test case - Boolean fulltext query against unsupported
+# engines does not fail
+#
+
+eval CREATE TABLE t1 ( a char(10) ) ENGINE=$engine_type;
+--error 1214
+SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
+DROP TABLE t1;
+}
+
+if ($test_foreign_keys)
+{
+#
+# check null values #1
+#
+
+--disable_warnings
+eval CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=$engine_type DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES (1),(2),(3);
+eval CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a),
+ CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=$engine_type DEFAULT CHARSET=latin1;
+--enable_warnings
+INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);
+SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz;
+DROP TABLE t2;
+DROP TABLE t1;
+}
+
+#
+# Bug#11816 - Truncate table doesn't work with temporary innodb tables
+# This is not an innodb bug, but we test it using innodb.
+#
+eval create temporary table t1 (a int) engine=$engine_type;
+insert into t1 values (4711);
+truncate t1;
+insert into t1 values (42);
+select * from t1;
+drop table t1;
+# Show that it works with permanent tables too.
+eval create table t1 (a int) engine=$engine_type;
+insert into t1 values (4711);
+truncate t1;
+insert into t1 values (42);
+select * from t1;
+drop table t1;
+
+#
+# Bug #13025 Server crash during filesort
+#
+
+eval create table t1 (a int not null, b int not null, c blob not null, d int not null, e int, primary key (a,b,c(255),d)) engine=$engine_type;
+insert into t1 values (2,2,"b",2,2),(1,1,"a",1,1),(3,3,"ab",3,3);
+select * from t1 order by a,b,c,d;
+explain select * from t1 order by a,b,c,d;
+drop table t1;
+
+#
+# BUG#11039,#13218 Wrong key length in min()
+#
+
+eval create table t1 (a char(1), b char(1), key(a, b)) engine=$engine_type;
+insert into t1 values ('8', '6'), ('4', '7');
+select min(a) from t1;
+select min(b) from t1 where a='8';
+drop table t1;
+
+# End of 4.1 tests
+
+#
+# range optimizer problem
+#
+
+eval create table t1 (x bigint unsigned not null primary key) engine=$engine_type;
+insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
+select * from t1;
+select count(*) from t1 where x>0;
+select count(*) from t1 where x=0;
+select count(*) from t1 where x<0;
+select count(*) from t1 where x < -16;
+select count(*) from t1 where x = -16;
+explain select count(*) from t1 where x > -16;
+select count(*) from t1 where x > -16;
+select * from t1 where x > -16;
+select count(*) from t1 where x = 18446744073709551601;
+drop table t1;
+
+# Please do not remove the following skipped InnoDB specific tests.
+# They make the synchronization with innodb.test easier and give
+# an idea what to test on other storage engines.
+if (0)
+{
+
+# Test for testable InnoDB status variables. This test
+# uses previous ones(pages_created, rows_deleted, ...).
+show status like "Innodb_buffer_pool_pages_total";
+show status like "Innodb_page_size";
+show status like "Innodb_rows_deleted";
+show status like "Innodb_rows_inserted";
+show status like "Innodb_rows_updated";
+
+# Test for row locks InnoDB status variables.
+show status like "Innodb_row_lock_waits";
+show status like "Innodb_row_lock_current_waits";
+show status like "Innodb_row_lock_time";
+show status like "Innodb_row_lock_time_max";
+show status like "Innodb_row_lock_time_avg";
+
+# Test for innodb_sync_spin_loops variable
+show variables like "innodb_sync_spin_loops";
+set global innodb_sync_spin_loops=1000;
+show variables like "innodb_sync_spin_loops";
+set global innodb_sync_spin_loops=0;
+show variables like "innodb_sync_spin_loops";
+set global innodb_sync_spin_loops=20;
+show variables like "innodb_sync_spin_loops";
+
+# Test for innodb_thread_concurrency variable
+show variables like "innodb_thread_concurrency";
+set global innodb_thread_concurrency=1001;
+show variables like "innodb_thread_concurrency";
+set global innodb_thread_concurrency=0;
+show variables like "innodb_thread_concurrency";
+set global innodb_thread_concurrency=16;
+show variables like "innodb_thread_concurrency";
+
+# Test for innodb_concurrency_tickets variable
+show variables like "innodb_concurrency_tickets";
+set global innodb_concurrency_tickets=1000;
+show variables like "innodb_concurrency_tickets";
+set global innodb_concurrency_tickets=0;
+show variables like "innodb_concurrency_tickets";
+set global innodb_concurrency_tickets=500;
+show variables like "innodb_concurrency_tickets";
+
+# Test for innodb_thread_sleep_delay variable
+show variables like "innodb_thread_sleep_delay";
+set global innodb_thread_sleep_delay=100000;
+show variables like "innodb_thread_sleep_delay";
+set global innodb_thread_sleep_delay=0;
+show variables like "innodb_thread_sleep_delay";
+set global innodb_thread_sleep_delay=10000;
+show variables like "innodb_thread_sleep_delay";
+
+}
+
+
+#
+# Test varchar
+#
+
+let $default=`select @@storage_engine`;
+eval set storage_engine=$engine_type;
+source include/varchar.inc;
+
+#
+# Some errors/warnings on create
+#
+
+# Clean up filename -- embedded server reports whole path without .frm,
+# regular server reports relative path with .frm (argh!)
+--replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ / t1.frm t1
+create table t1 (v varchar(65530), key(v));
+drop table t1;
+create table t1 (v varchar(65536));
+show create table t1;
+drop table t1;
+create table t1 (v varchar(65530) character set utf8);
+show create table t1;
+drop table t1;
+
+eval set storage_engine=$default;
+
+# InnoDB specific varchar tests
+eval create table t1 (v varchar(16384)) engine=$engine_type;
+drop table t1;
+
+#
+# BUG#11039 Wrong key length in min()
+#
+
+eval create table t1 (a char(1), b char(1), key(a, b)) engine=$engine_type;
+insert into t1 values ('8', '6'), ('4', '7');
+select min(a) from t1;
+select min(b) from t1 where a='8';
+drop table t1;
+
+#
+# Bug #11080 & #11005 Multi-row REPLACE fails on a duplicate key error
+#
+
+eval CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)) ENGINE=$engine_type;
+insert into t1 (b) values (1);
+replace into t1 (b) values (2), (1), (3);
+select * from t1;
+truncate table t1;
+insert into t1 (b) values (1);
+replace into t1 (b) values (2);
+replace into t1 (b) values (1);
+replace into t1 (b) values (3);
+select * from t1;
+drop table t1;
+
+eval create table t1 (rowid int not null auto_increment, val int not null,primary
+key (rowid), unique(val)) engine=$engine_type;
+replace into t1 (val) values ('1'),('2');
+replace into t1 (val) values ('1'),('2');
+--error 1062
+insert into t1 (val) values ('1'),('2');
+select * from t1;
+drop table t1;
+
+if ($no_autoinc_update)
+{
+#
+# Test that update does not change internal auto-increment value
+#
+
+eval create table t1 (a int not null auto_increment primary key, val int) engine=$engine_type;
+insert into t1 (val) values (1);
+update t1 set a=2 where a=1;
+# We should get the following error because InnoDB does not update the counter
+--error 1062
+insert into t1 (val) values (1);
+select * from t1;
+drop table t1;
+}
+
+
+#
+# Bug#10465: DECIMAL, crash on DELETE (InnoDB only)
+#
+
+--disable_warnings
+eval CREATE TABLE t1 (GRADE DECIMAL(4) NOT NULL, PRIMARY KEY (GRADE)) ENGINE=$engine_type;
+--enable_warnings
+INSERT INTO t1 (GRADE) VALUES (151),(252),(343);
+SELECT GRADE FROM t1 WHERE GRADE > 160 AND GRADE < 300;
+SELECT GRADE FROM t1 WHERE GRADE= 151;
+DROP TABLE t1;
+
+#
+# Bug #12340 multitable delete deletes only one record
+#
+eval create table t1 (f1 varchar(10), f2 varchar(10), primary key (f1,f2)) engine=$engine_type;
+eval create table t2 (f3 varchar(10), f4 varchar(10), key (f4)) engine=$engine_type;
+insert into t2 values ('aa','cc');
+insert into t1 values ('aa','bb'),('aa','cc');
+delete t1 from t1,t2 where f1=f3 and f4='cc';
+select * from t1;
+drop table t1,t2;
+
+if ($test_foreign_keys)
+{
+#
+# Test that the slow TRUNCATE implementation resets autoincrement columns
+# (bug #11946)
+#
+
+eval CREATE TABLE t1 (
+id INTEGER NOT NULL AUTO_INCREMENT, PRIMARY KEY (id)
+) ENGINE=$engine_type;
+
+eval CREATE TABLE t2 (
+id INTEGER NOT NULL,
+FOREIGN KEY (id) REFERENCES t1 (id)
+) ENGINE=$engine_type;
+
+INSERT INTO t1 (id) VALUES (NULL);
+SELECT * FROM t1;
+TRUNCATE t1;
+INSERT INTO t1 (id) VALUES (NULL);
+SELECT * FROM t1;
+
+# continued from above; test that doing a slow TRUNCATE on a table with 0
+# rows resets autoincrement columns
+DELETE FROM t1;
+TRUNCATE t1;
+INSERT INTO t1 (id) VALUES (NULL);
+SELECT * FROM t1;
+DROP TABLE t2, t1;
+
+-- Test that foreign keys in temporary tables are not accepted (bug #12084)
+eval CREATE TABLE t1
+(
+ id INT PRIMARY KEY
+) ENGINE=$engine_type;
+
+--error 1005,1005
+eval CREATE TEMPORARY TABLE t2
+(
+ id INT NOT NULL PRIMARY KEY,
+ b INT,
+ FOREIGN KEY (b) REFERENCES test.t1(id)
+) ENGINE=$engine_type;
+DROP TABLE t1;
+}
+# End of FOREIGN KEY test
+
+# Please do not remove the following skipped InnoDB specific tests.
+# They make the synchronization with innodb.test easier and give
+# an idea what to test on other storage engines.
+if (0)
+{
+
+#
+# Test that index column max sizes are honored (bug #13315)
+#
+
+# prefix index
+eval create table t1 (col1 varchar(2000), index (col1(767)))
+ character set = latin1 engine = $engine_type;
+
+# normal indexes
+eval create table t2 (col1 char(255), index (col1))
+ character set = latin1 engine = $engine_type;
+eval create table t3 (col1 binary(255), index (col1))
+ character set = latin1 engine = $engine_type;
+eval create table t4 (col1 varchar(767), index (col1))
+ character set = latin1 engine = $engine_type;
+eval create table t5 (col1 varchar(767) primary key)
+ character set = latin1 engine = $engine_type;
+eval create table t6 (col1 varbinary(767) primary key)
+ character set = latin1 engine = $engine_type;
+eval create table t7 (col1 text, index(col1(767)))
+ character set = latin1 engine = $engine_type;
+eval create table t8 (col1 blob, index(col1(767)))
+ character set = latin1 engine = $engine_type;
+
+
+# multi-column indexes are allowed to be longer
+eval create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2))
+ character set = latin1 engine = $engine_type;
+
+show create table t9;
+
+drop table t1, t2, t3, t4, t5, t6, t7, t8, t9;
+
+# these should have their index length trimmed
+eval create table t1 (col1 varchar(768), index(col1))
+ character set = latin1 engine = $engine_type;
+eval create table t2 (col1 varbinary(768), index(col1))
+ character set = latin1 engine = $engine_type;
+eval create table t3 (col1 text, index(col1(768)))
+ character set = latin1 engine = $engine_type;
+eval create table t4 (col1 blob, index(col1(768)))
+ character set = latin1 engine = $engine_type;
+
+show create table t1;
+
+drop table t1, t2, t3, t4;
+
+}
+# End of skipped test
+
+# Please do not remove the following skipped InnoDB specific tests.
+# They make the synchronization with innodb.test easier and give
+# an idea what to test on other storage engines.
+if (0)
+{
+
+# these should be refused
+--error 1071
+eval create table t1 (col1 varchar(768) primary key)
+ character set = latin1 engine = $engine_type;
+--error 1071
+eval create table t2 (col1 varbinary(768) primary key)
+ character set = latin1 engine = $engine_type;
+--error 1071
+eval create table t3 (col1 text, primary key(col1(768)))
+ character set = latin1 engine = $engine_type;
+--error 1071
+eval create table t4 (col1 blob, primary key(col1(768)))
+ character set = latin1 engine = $engine_type;
+
+}
+
+if ($test_foreign_keys)
+{
+#
+# Test improved foreign key error messages (bug #3443)
+#
+
+eval CREATE TABLE t1
+(
+ id INT PRIMARY KEY
+) ENGINE=$engine_type;
+
+eval CREATE TABLE t2
+(
+ v INT,
+ CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id)
+) ENGINE=$engine_type;
+
+--error 1452
+INSERT INTO t2 VALUES(2);
+
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2 VALUES(1);
+
+--error 1451
+DELETE FROM t1 WHERE id = 1;
+
+--error 1217
+DROP TABLE t1;
+
+SET FOREIGN_KEY_CHECKS=0;
+DROP TABLE t1;
+SET FOREIGN_KEY_CHECKS=1;
+
+--error 1452
+INSERT INTO t2 VALUES(3);
+
+DROP TABLE t2;
+}
+# End of FOREIGN tests
+
+if ($test_transactions)
+{
+#
+# Test that checksum table uses a consistent read Bug #12669
+#
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+eval create table t1(a int not null) engine=$engine_type DEFAULT CHARSET=latin1;
+insert into t1 values (1),(2);
+set autocommit=0;
+checksum table t1;
+connection b;
+insert into t1 values(3);
+connection a;
+#
+# Here checksum should not see insert
+#
+checksum table t1;
+connection a;
+commit;
+checksum table t1;
+commit;
+drop table t1;
+#
+# autocommit = 1
+#
+connection a;
+eval create table t1(a int not null) engine=$engine_type DEFAULT CHARSET=latin1;
+insert into t1 values (1),(2);
+set autocommit=1;
+checksum table t1;
+connection b;
+set autocommit=1;
+insert into t1 values(3);
+connection a;
+#
+# Here checksum sees insert
+#
+checksum table t1;
+drop table t1;
+
+connection default;
+disconnect a;
+disconnect b;
+}
+
+#
+# BUG 14056 Column prefix index on UTF-8 primary key column causes: Can't find record..
+#
+
+eval create table t1 (
+ a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = $engine_type;
+eval create table t2 (
+ a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = $engine_type;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
+drop table t1;
+drop table t2;
+
+eval create table t1 (
+ a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = $engine_type;
+eval create table t2 (
+ a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = $engine_type;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
+drop table t1;
+drop table t2;
+
+eval create table t1 (
+ a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = $engine_type;
+eval create table t2 (
+ a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = $engine_type;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
+drop table t1;
+drop table t2;
+
+eval create table t1 (
+ a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = $engine_type;
+eval create table t2 (
+ a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = $engine_type;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
+drop table t1;
+drop table t2;
+commit;
+
+# tests for bugs #9802 and #13778
+
+if ($test_foreign_keys)
+{
+# test that FKs between invalid types are not accepted
+
+set foreign_key_checks=0;
+eval create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = $engine_type;
+--replace_result $MYSQLTEST_VARDIR . master-data/ ''
+-- error 1005
+eval create table t1(a char(10) primary key, b varchar(20)) engine = $engine_type;
+set foreign_key_checks=1;
+drop table t2;
+
+# test that FKs between different charsets are not accepted in CREATE even
+# when f_k_c is 0
+
+set foreign_key_checks=0;
+eval create table t1(a varchar(10) primary key) engine = $engine_type DEFAULT CHARSET=latin1;
+--replace_result $MYSQLTEST_VARDIR . master-data/ ''
+-- error 1005
+eval create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = $engine_type DEFAULT CHARSET=utf8;
+set foreign_key_checks=1;
+drop table t1;
+
+# test that invalid datatype conversions with ALTER are not allowed
+
+set foreign_key_checks=0;
+eval create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = $engine_type;
+eval create table t1(a varchar(10) primary key) engine = $engine_type;
+-- error 1025,1025
+alter table t1 modify column a int;
+set foreign_key_checks=1;
+drop table t2,t1;
+
+# test that charset conversions with ALTER are allowed when f_k_c is 0
+
+set foreign_key_checks=0;
+eval create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = $engine_type DEFAULT CHARSET=latin1;
+eval create table t1(a varchar(10) primary key) engine = $engine_type DEFAULT CHARSET=latin1;
+alter table t1 convert to character set utf8;
+set foreign_key_checks=1;
+drop table t2,t1;
+
+# test that RENAME does not allow invalid charsets when f_k_c is 0
+
+set foreign_key_checks=0;
+eval create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = $engine_type DEFAULT CHARSET=latin1;
+eval create table t3(a varchar(10) primary key) engine = $engine_type DEFAULT CHARSET=utf8;
+--replace_result $MYSQLTEST_VARDIR . master-data/ ''
+-- error 1025
+rename table t3 to t1;
+set foreign_key_checks=1;
+drop table t2,t3;
+
+# test that foreign key errors are reported correctly (Bug #15550)
+
+eval create table t1(a int primary key) row_format=redundant engine=$engine_type;
+eval create table t2(a int primary key,constraint foreign key(a)references t1(a)) row_format=compact engine=$engine_type;
+eval create table t3(a int primary key) row_format=compact engine=$engine_type;
+eval create table t4(a int primary key,constraint foreign key(a)references t3(a)) row_format=redundant engine=$engine_type;
+
+insert into t1 values(1);
+insert into t3 values(1);
+-- error 1452
+insert into t2 values(2);
+-- error 1452
+insert into t4 values(2);
+insert into t2 values(1);
+insert into t4 values(1);
+-- error 1451
+update t1 set a=2;
+-- error 1452
+update t2 set a=2;
+-- error 1451
+update t3 set a=2;
+-- error 1452
+update t4 set a=2;
+-- error 1451
+truncate t1;
+-- error 1451
+truncate t3;
+truncate t2;
+truncate t4;
+truncate t1;
+truncate t3;
+
+drop table t4,t3,t2,t1;
+}
+# End of FOREIGN KEY tests
+
+
+# Please do not remove the following skipped InnoDB specific tests.
+# They make the synchronization with innodb.test easier and give
+# an idea what to test on other storage engines.
+if (0)
+{
+
+#
+# Test that we can create a large (>1K) key
+#
+eval create table t1 (a varchar(255) character set utf8,
+ b varchar(255) character set utf8,
+ c varchar(255) character set utf8,
+ d varchar(255) character set utf8,
+ key (a,b,c,d)) engine=$engine_type;
+drop table t1;
+--error ER_TOO_LONG_KEY
+eval create table t1 (a varchar(255) character set utf8,
+ b varchar(255) character set utf8,
+ c varchar(255) character set utf8,
+ d varchar(255) character set utf8,
+ e varchar(255) character set utf8,
+ key (a,b,c,d,e)) engine=$engine_type;
+
+
+# test the padding of BINARY types and collations (Bug #14189)
+
+eval create table t1 (s1 varbinary(2),primary key (s1)) engine=$engine_type;
+eval create table t2 (s1 binary(2),primary key (s1)) engine=$engine_type;
+eval create table t3 (s1 varchar(2) binary,primary key (s1)) engine=$engine_type;
+eval create table t4 (s1 char(2) binary,primary key (s1)) engine=$engine_type;
+
+insert into t1 values (0x41),(0x4120),(0x4100);
+-- error 1062
+insert into t2 values (0x41),(0x4120),(0x4100);
+insert into t2 values (0x41),(0x4120);
+-- error 1062
+insert into t3 values (0x41),(0x4120),(0x4100);
+insert into t3 values (0x41),(0x4100);
+-- error 1062
+insert into t4 values (0x41),(0x4120),(0x4100);
+insert into t4 values (0x41),(0x4100);
+select hex(s1) from t1;
+select hex(s1) from t2;
+select hex(s1) from t3;
+select hex(s1) from t4;
+drop table t1,t2,t3,t4;
+}
+
+if (test_foreign_keys)
+{
+eval create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=$engine_type;
+eval create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=$engine_type;
+
+insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42);
+-- error 1452
+insert into t2 values(0x42);
+insert into t2 values(0x41);
+select hex(s1) from t2;
+update t1 set s1=0x123456 where a=2;
+select hex(s1) from t2;
+-- error 1451
+update t1 set s1=0x12 where a=1;
+-- error 1451
+update t1 set s1=0x12345678 where a=1;
+-- error 1451
+update t1 set s1=0x123457 where a=1;
+update t1 set s1=0x1220 where a=1;
+select hex(s1) from t2;
+update t1 set s1=0x1200 where a=1;
+select hex(s1) from t2;
+update t1 set s1=0x4200 where a=1;
+select hex(s1) from t2;
+-- error 1451
+delete from t1 where a=1;
+delete from t1 where a=2;
+update t2 set s1=0x4120;
+-- error 1451
+delete from t1;
+delete from t1 where a!=3;
+select a,hex(s1) from t1;
+select hex(s1) from t2;
+
+drop table t2,t1;
+
+eval create table t1 (a int primary key,s1 varchar(2) binary not null unique) engine=$engine_type;
+eval create table t2 (s1 char(2) binary not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=$engine_type;
+
+insert into t1 values(1,0x4100),(2,0x41);
+insert into t2 values(0x41);
+select hex(s1) from t2;
+update t1 set s1=0x1234 where a=1;
+select hex(s1) from t2;
+update t1 set s1=0x12 where a=2;
+select hex(s1) from t2;
+delete from t1 where a=1;
+-- error 1451
+delete from t1 where a=2;
+select a,hex(s1) from t1;
+select hex(s1) from t2;
+
+drop table t2,t1;
+}
+# End FOREIGN KEY tests
+
+#
+# Test cases for bug #15308 Problem of Order with Enum Column in Primary Key
+#
+eval CREATE TABLE t1 (
+ ind enum('0','1','2') NOT NULL default '0',
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=$engine_type DEFAULT CHARSET=utf8;
+eval CREATE TABLE t2 (
+ ind enum('0','1','2') NOT NULL default '0',
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=$engine_type DEFAULT CHARSET=ucs2;
+
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+drop table t1,t2;
+
+eval CREATE TABLE t1 (
+ ind set('0','1','2') NOT NULL default '0',
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=$engine_type DEFAULT CHARSET=utf8;
+eval CREATE TABLE t2 (
+ ind set('0','1','2') NOT NULL default '0',
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=$engine_type DEFAULT CHARSET=ucs2;
+
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+drop table t1,t2;
+
+eval CREATE TABLE t1 (
+ ind bit not null,
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=$engine_type DEFAULT CHARSET=utf8;
+eval CREATE TABLE t2 (
+ ind bit not null,
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=$engine_type DEFAULT CHARSET=ucs2;
+insert into t1 values(0,''),(1,'');
+insert into t2 values(0,''),(1,'');
+select hex(ind),hex(string1) from t1 order by string1;
+select hex(ind),hex(string1) from t2 order by string1;
+drop table t1,t2;
+
+# tests for bug #14056 Column prefix index on UTF-8 primary key column causes 'Can't find record..'
+
+eval create table t2 (
+ a int, b char(10), filler char(10), primary key(a, b(2))
+) character set utf8 engine = $engine_type;
+
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+eval create table t2 (
+ a int, b char(10), filler char(10), primary key(a, b(2))
+) character set ucs2 engine = $engine_type;
+
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+
+eval create table t1(a int not null, b char(110),primary key(a,b(100))) engine=$engine_type default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+update t1 set b = 'three' where a = 6;
+drop table t1;
+eval create table t1(a int not null, b text(110),primary key(a,b(100))) engine=$engine_type default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+update t1 set b = 'three' where a = 6;
+drop table t1;
+
+if ($test_foreign_keys)
+{
+# Ensure that <tablename>_ibfk_0 is not mistreated as a
+# generated foreign key identifier. (Bug #16387)
+
+eval CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=$engine_type;
+eval CREATE TABLE t2(a INT) ENGINE=$engine_type;
+ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a);
+ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1;
+ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a);
+ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0;
+SHOW CREATE TABLE t2;
+DROP TABLE t2,t1;
+}
+
+#
+# Test case for bug #16229: MySQL/InnoDB uses full explicit table locks in trigger processing
+#
+
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+eval create table t1(a int not null, b int, c int, d int, primary key(a)) engine=$engine_type;
+insert into t1(a) values (1),(2),(3);
+commit;
+connection b;
+set autocommit = 0;
+update t1 set b = 5 where a = 2;
+connection a;
+delimiter |;
+create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end |
+delimiter ;|
+set autocommit = 0;
+connection a;
+insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100),
+(11),(21),(31),(41),(51),(61),(71),(81),(91),(101),
+(12),(22),(32),(42),(52),(62),(72),(82),(92),(102),
+(13),(23),(33),(43),(53),(63),(73),(83),(93),(103),
+(14),(24),(34),(44),(54),(64),(74),(84),(94),(104);
+connection b;
+commit;
+connection a;
+commit;
+drop trigger t1t;
+drop table t1;
+disconnect a;
+disconnect b;
+#
+# Another trigger test
+#
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+eval create table t1(a int not null, b int, c int, d int, primary key(a)) engine=$engine_type;
+eval create table t2(a int not null, b int, c int, d int, primary key(a)) engine=$engine_type;
+eval create table t3(a int not null, b int, c int, d int, primary key(a)) engine=$engine_type;
+eval create table t4(a int not null, b int, c int, d int, primary key(a)) engine=$engine_type;
+eval create table t5(a int not null, b int, c int, d int, primary key(a)) engine=$engine_type;
+insert into t1(a) values (1),(2),(3);
+insert into t2(a) values (1),(2),(3);
+insert into t3(a) values (1),(2),(3);
+insert into t4(a) values (1),(2),(3);
+insert into t3(a) values (5),(7),(8);
+insert into t4(a) values (5),(7),(8);
+insert into t5(a) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12);
+
+delimiter |;
+create trigger t1t before insert on t1 for each row begin
+ INSERT INTO t2 SET a = NEW.a;
+end |
+
+create trigger t2t before insert on t2 for each row begin
+ DELETE FROM t3 WHERE a = NEW.a;
+end |
+
+create trigger t3t before delete on t3 for each row begin
+ UPDATE t4 SET b = b + 1 WHERE a = OLD.a;
+end |
+
+create trigger t4t before update on t4 for each row begin
+ UPDATE t5 SET b = b + 1 where a = NEW.a;
+end |
+delimiter ;|
+commit;
+set autocommit = 0;
+update t1 set b = b + 5 where a = 1;
+update t2 set b = b + 5 where a = 1;
+update t3 set b = b + 5 where a = 1;
+update t4 set b = b + 5 where a = 1;
+insert into t5(a) values(20);
+connection b;
+set autocommit = 0;
+insert into t1(a) values(7);
+insert into t2(a) values(8);
+delete from t2 where a = 3;
+update t4 set b = b + 1 where a = 3;
+commit;
+drop trigger t1t;
+drop trigger t2t;
+drop trigger t3t;
+drop trigger t4t;
+drop table t1, t2, t3, t4, t5;
+connection default;
+disconnect a;
+disconnect b;
+
+if ($test_foreign_keys)
+{
+#
+# Test that cascading updates leading to duplicate keys give the correct
+# error message (bug #9680)
+#
+
+eval CREATE TABLE t1 (
+ field1 varchar(8) NOT NULL DEFAULT '',
+ field2 varchar(8) NOT NULL DEFAULT '',
+ PRIMARY KEY (field1, field2)
+) ENGINE=$engine_type;
+
+eval CREATE TABLE t2 (
+ field1 varchar(8) NOT NULL DEFAULT '' PRIMARY KEY,
+ FOREIGN KEY (field1) REFERENCES t1 (field1)
+ ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=$engine_type;
+
+INSERT INTO t1 VALUES ('old', 'somevalu');
+INSERT INTO t1 VALUES ('other', 'anyvalue');
+
+INSERT INTO t2 VALUES ('old');
+INSERT INTO t2 VALUES ('other');
+
+--error ER_FOREIGN_DUPLICATE_KEY
+UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu';
+
+DROP TABLE t2;
+DROP TABLE t1;
+
+#
+# Bug#18477 - MySQL/InnoDB Ignoring Foreign Keys in ALTER TABLE
+#
+eval create table t1 (
+ c1 bigint not null,
+ c2 bigint not null,
+ primary key (c1),
+ unique key (c2)
+) engine=$engine_type;
+#
+eval create table t2 (
+ c1 bigint not null,
+ primary key (c1)
+) engine=$engine_type;
+#
+alter table t1 add constraint c2_fk foreign key (c2)
+ references t2(c1) on delete cascade;
+show create table t1;
+#
+alter table t1 drop foreign key c2_fk;
+show create table t1;
+#
+drop table t1, t2;
+}
+# End FOREIGN KEY test
+
+#
+# Bug #14360: problem with intervals
+#
+
+eval create table t1(a date) engine=$engine_type;
+eval create table t2(a date, key(a)) engine=$engine_type;
+insert into t1 values('2005-10-01');
+insert into t2 values('2005-10-01');
+select * from t1, t2
+ where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
+drop table t1, t2;
+
+eval create table t1 (id int not null, f_id int not null, f int not null,
+primary key(f_id, id)) engine=$engine_type;
+eval create table t2 (id int not null,s_id int not null,s varchar(200),
+primary key(id)) engine=$engine_type;
+INSERT INTO t1 VALUES (8, 1, 3);
+INSERT INTO t1 VALUES (1, 2, 1);
+INSERT INTO t2 VALUES (1, 0, '');
+INSERT INTO t2 VALUES (8, 1, '');
+commit;
+DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id)
+WHERE mm.id IS NULL;
+select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
+where mm.id is null lock in share mode;
+drop table t1,t2;
+
+#
+# Test case where X-locks on unused rows should be released in a
+# update (because READ COMMITTED isolation level)
+#
+
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+eval create table t1(a int not null, b int, primary key(a)) engine=$engine_type;
+insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
+commit;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+update t1 set b = 5 where b = 1;
+connection b;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+#
+# X-lock to record (7,3) should be released in a update
+#
+select * from t1 where a = 7 and b = 3 for update;
+connection a;
+commit;
+connection b;
+commit;
+drop table t1;
+connection default;
+disconnect a;
+disconnect b;
+
+if ($test_transactions)
+{
+#
+# Test case where no locks should be released (because we are not
+# using READ COMMITTED isolation level)
+#
+
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+eval create table t1(a int not null, b int, primary key(a)) engine=$engine_type;
+insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2);
+commit;
+set autocommit = 0;
+select * from t1 lock in share mode;
+update t1 set b = 5 where b = 1;
+connection b;
+set autocommit = 0;
+#
+# S-lock to records (2,2),(4,2), and (6,2) should not be released in a update
+#
+--error 1205
+select * from t1 where a = 2 and b = 2 for update;
+#
+# X-lock to record (1,1),(3,1),(5,1) should not be released in a update
+#
+--error 1205
+connection a;
+commit;
+connection b;
+commit;
+connection default;
+disconnect a;
+disconnect b;
+drop table t1;
+
+#
+# Consistent read should be used in following selects
+#
+# 1) INSERT INTO ... SELECT
+# 2) UPDATE ... = ( SELECT ...)
+# 3) CREATE ... SELECT
+
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+eval create table t1(a int not null, b int, primary key(a)) engine=$engine_type;
+insert into t1 values (1,2),(5,3),(4,2);
+eval create table t2(d int not null, e int, primary key(d)) engine=$engine_type;
+insert into t2 values (8,6),(12,1),(3,1);
+commit;
+set autocommit = 0;
+select * from t2 for update;
+connection b;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+insert into t1 select * from t2;
+update t1 set b = (select e from t2 where a = d);
+eval create table t3(d int not null, e int, primary key(d)) engine=$engine_type
+select * from t2;
+commit;
+connection a;
+commit;
+connection default;
+disconnect a;
+disconnect b;
+drop table t1, t2, t3;
+
+#
+# Consistent read should not be used if
+#
+# (a) isolation level is serializable OR
+# (b) select ... lock in share mode OR
+# (c) select ... for update
+#
+# in following queries:
+#
+# 1) INSERT INTO ... SELECT
+# 2) UPDATE ... = ( SELECT ...)
+# 3) CREATE ... SELECT
+
+connect (a,localhost,root,,);
+eval SET SESSION STORAGE_ENGINE = $engine_type;
+connect (b,localhost,root,,);
+eval SET SESSION STORAGE_ENGINE = $engine_type;
+connect (c,localhost,root,,);
+eval SET SESSION STORAGE_ENGINE = $engine_type;
+connect (d,localhost,root,,);
+eval SET SESSION STORAGE_ENGINE = $engine_type;
+connect (e,localhost,root,,);
+eval SET SESSION STORAGE_ENGINE = $engine_type;
+connect (f,localhost,root,,);
+eval SET SESSION STORAGE_ENGINE = $engine_type;
+connect (g,localhost,root,,);
+eval SET SESSION STORAGE_ENGINE = $engine_type;
+connect (h,localhost,root,,);
+eval SET SESSION STORAGE_ENGINE = $engine_type;
+connect (i,localhost,root,,);
+eval SET SESSION STORAGE_ENGINE = $engine_type;
+connect (j,localhost,root,,);
+eval SET SESSION STORAGE_ENGINE = $engine_type;
+connection a;
+create table t1(a int not null, b int, primary key(a));
+insert into t1 values (1,2),(5,3),(4,2);
+create table t2(a int not null, b int, primary key(a));
+insert into t2 values (8,6),(12,1),(3,1);
+create table t3(d int not null, b int, primary key(d));
+insert into t3 values (8,6),(12,1),(3,1);
+create table t5(a int not null, b int, primary key(a));
+insert into t5 values (1,2),(5,3),(4,2);
+create table t6(d int not null, e int, primary key(d));
+insert into t6 values (8,6),(12,1),(3,1);
+create table t8(a int not null, b int, primary key(a));
+insert into t8 values (1,2),(5,3),(4,2);
+create table t9(d int not null, e int, primary key(d));
+insert into t9 values (8,6),(12,1),(3,1);
+commit;
+set autocommit = 0;
+select * from t2 for update;
+connection b;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+--send
+insert into t1 select * from t2;
+connection c;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+--send
+update t3 set b = (select b from t2 where a = d);
+connection d;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+--send
+create table t4(a int not null, b int, primary key(a)) select * from t2;
+connection e;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+--send
+insert into t5 (select * from t2 lock in share mode);
+connection f;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+--send
+update t6 set e = (select b from t2 where a = d lock in share mode);
+connection g;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+--send
+create table t7(a int not null, b int, primary key(a)) select * from t2 lock in share mode;
+connection h;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+--send
+insert into t8 (select * from t2 for update);
+connection i;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+--send
+update t9 set e = (select b from t2 where a = d for update);
+connection j;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+--send
+create table t10(a int not null, b int, primary key(a)) select * from t2 for update;
+
+connection b;
+--error 1205
+reap;
+
+connection c;
+--error 1205
+reap;
+
+connection d;
+--error 1205
+reap;
+
+connection e;
+--error 1205
+reap;
+
+connection f;
+--error 1205
+reap;
+
+connection g;
+--error 1205
+reap;
+
+connection h;
+--error 1205
+reap;
+
+connection i;
+--error 1205
+reap;
+
+connection j;
+--error 1205
+reap;
+
+connection a;
+commit;
+
+connection default;
+disconnect a;
+disconnect b;
+disconnect c;
+disconnect d;
+disconnect e;
+disconnect f;
+disconnect g;
+disconnect h;
+disconnect i;
+disconnect j;
+drop table t1, t2, t3, t5, t6, t8, t9;
+}
+# End transactional tests
+
+if (test_foreign_keys)
+{
+# bug 18934, "InnoDB crashes when table uses column names like DB_ROW_ID"
+--error 1005
+eval CREATE TABLE t1 (DB_ROW_ID int) engine=$engine_type;
+
+#
+# Bug #17152: Wrong result with BINARY comparison on aliased column
+#
+
+eval CREATE TABLE t1 (
+ a BIGINT(20) NOT NULL,
+ PRIMARY KEY (a)
+ ) ENGINE=$engine_type DEFAULT CHARSET=UTF8;
+
+eval CREATE TABLE t2 (
+ a BIGINT(20) NOT NULL,
+ b VARCHAR(128) NOT NULL,
+ c TEXT NOT NULL,
+ PRIMARY KEY (a,b),
+ KEY idx_t2_b_c (b,c(200)),
+ CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a)
+ ON DELETE CASCADE
+ ) ENGINE=$engine_type DEFAULT CHARSET=UTF8;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1, 'bar', 'vbar');
+INSERT INTO t2 VALUES (1, 'BAR2', 'VBAR');
+INSERT INTO t2 VALUES (1, 'bar_bar', 'bibi');
+INSERT INTO t2 VALUES (1, 'customer_over', '1');
+
+SELECT * FROM t2 WHERE b = 'customer_over';
+SELECT * FROM t2 WHERE BINARY b = 'customer_over';
+SELECT DISTINCT p0.a FROM t2 p0 WHERE p0.b = 'customer_over';
+/* Bang: Empty result set, above was expected: */
+SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
+SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
+
+drop table t2, t1;
+}
+
+if ($no_spatial_key)
+{
+#
+# Bug #15680 (SPATIAL key in innodb)
+#
+--error ER_TABLE_CANT_HANDLE_SPKEYS
+eval create table t1 (g geometry not null, spatial gk(g)) engine=$engine_type;
+}
+
+#
+# Test optimize on table with open transaction
+#
+
+eval CREATE TABLE t1 ( a int ) ENGINE=$engine_type;
+BEGIN;
+INSERT INTO t1 VALUES (1);
+OPTIMIZE TABLE t1;
+DROP TABLE t1;
+
+#######################################################################
+# #
+# This is derivate of t/innodb.test and has to be maintained by #
+# MySQL guys only. #
+# #
+# Please synchronize this file from time to time with t/innodb.test. #
+# Please, DO NOT create a toplevel testcase innodb-mix2.test, because #
+# innodb.test does already these tests. #
+# #
+#######################################################################
diff --git a/mysql-test/include/ndb_backup.inc b/mysql-test/include/ndb_backup.inc
new file mode 100644
index 00000000000..f0a883d4e11
--- /dev/null
+++ b/mysql-test/include/ndb_backup.inc
@@ -0,0 +1,24 @@
+######################################################
+# By JBM 2006-02-16 So that the code is not repeated #
+# in test cases and can be reused. #
+######################################################
+--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT
+
+# there is no neat way to find the backupid, this is a hack to find it...
+
+--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat
+
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+
+DELETE FROM test.backup_info;
+
+LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+
+--replace_column 1 <the_backup_id>
+
+SELECT @the_backup_id:=backup_id FROM test.backup_info;
+
+let the_backup_id=`select @the_backup_id`;
+
+DROP TABLE test.backup_info;
+
diff --git a/mysql-test/include/ndb_restore_master.inc b/mysql-test/include/ndb_restore_master.inc
new file mode 100644
index 00000000000..b01a0b58ee9
--- /dev/null
+++ b/mysql-test/include/ndb_restore_master.inc
@@ -0,0 +1,8 @@
+######################################################
+# By JBM 2006-02-16 So that the code is not repeated #
+# in test cases and can be reused. #
+######################################################
+
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -p 8 -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
diff --git a/mysql-test/include/ndb_restore_slave_eoption.inc b/mysql-test/include/ndb_restore_slave_eoption.inc
new file mode 100644
index 00000000000..f1f6cf96881
--- /dev/null
+++ b/mysql-test/include/ndb_restore_slave_eoption.inc
@@ -0,0 +1,11 @@
+######################################################
+# By JBM 2006-03-08 So that the code is not repeated #
+# in test cases and can be reused. #
+######################################################
+
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 8 -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+
+
+
diff --git a/mysql-test/include/ndb_setup_slave.inc b/mysql-test/include/ndb_setup_slave.inc
new file mode 100644
index 00000000000..b1efeded90b
--- /dev/null
+++ b/mysql-test/include/ndb_setup_slave.inc
@@ -0,0 +1,27 @@
+#
+# now setup replication to continue from last epoch
+# 1. get apply_status epoch from slave
+# 2. get corresponding _next_ binlog postition from master
+# 3. change master on slave
+
+# 1.
+--connection slave
+--replace_column 1 <the_epoch>
+SELECT @the_epoch:=MAX(epoch) FROM cluster.apply_status;
+--let $the_epoch= `select @the_epoch`
+
+# 2.
+--connection master
+--replace_result $the_epoch <the_epoch>
+--replace_column 1 <the_pos>
+eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+ FROM cluster.binlog_index WHERE epoch > $the_epoch ORDER BY epoch ASC LIMIT 1;
+--let $the_pos= `SELECT @the_pos`
+--let $the_file= `SELECT @the_file`
+
+# 3.
+--connection slave
+--replace_result $the_pos <the_pos>
+eval CHANGE MASTER TO
+ master_log_file = '$the_file',
+ master_log_pos = $the_pos ;
diff --git a/mysql-test/include/not_ndb.inc b/mysql-test/include/not_ndb.inc
new file mode 100644
index 00000000000..965538c20a7
--- /dev/null
+++ b/mysql-test/include/not_ndb.inc
@@ -0,0 +1,7 @@
+-- require r/not_ndb.require
+disable_query_log;
+# so that both DISABLED and NO is output as NO
+-- replace_result DISABLED NO
+show variables like "have_ndbcluster";
+enable_query_log;
+
diff --git a/mysql-test/include/not_ndb_default.inc b/mysql-test/include/not_ndb_default.inc
new file mode 100644
index 00000000000..ca3c57a671a
--- /dev/null
+++ b/mysql-test/include/not_ndb_default.inc
@@ -0,0 +1,4 @@
+--require r/not_ndb_default.require
+disable_query_log;
+select convert(@@table_type using latin1) NOT IN ("ndbcluster","NDBCLUSTER") as "TRUE";
+enable_query_log;
diff --git a/mysql-test/include/not_row_based.inc b/mysql-test/include/not_row_based.inc
new file mode 100644
index 00000000000..22f40bdceb0
--- /dev/null
+++ b/mysql-test/include/not_row_based.inc
@@ -0,0 +1,4 @@
+-- require r/not_row_based.require
+disable_query_log;
+show variables like "have_row_based_replication";
+enable_query_log;
diff --git a/mysql-test/include/not_valgrind.inc b/mysql-test/include/not_valgrind.inc
new file mode 100644
index 00000000000..bdddaf534ca
--- /dev/null
+++ b/mysql-test/include/not_valgrind.inc
@@ -0,0 +1,4 @@
+--require r/not_valgrind.require
+--disable_query_log
+eval select $VALGRIND_TEST as using_valgrind;
+--enable_query_log
diff --git a/mysql-test/include/not_windows.inc b/mysql-test/include/not_windows.inc
index 54e9e0e817a..9240271077a 100644
--- a/mysql-test/include/not_windows.inc
+++ b/mysql-test/include/not_windows.inc
@@ -1,4 +1,4 @@
---require r/true.require
+--require r/not_windows.require
disable_query_log;
select convert(@@version_compile_os using latin1) NOT IN ("Win32","Win64","Windows") as "TRUE";
enable_query_log;
diff --git a/mysql-test/include/parser_bug21114.inc b/mysql-test/include/parser_bug21114.inc
new file mode 100755
index 00000000000..eb709d5cc03
--- /dev/null
+++ b/mysql-test/include/parser_bug21114.inc
@@ -0,0 +1,59 @@
+#
+# Bug#21114 (Foreign key creation fails to table with name format)
+#
+# Trying to trick the parser into thinking $FCT(...) is a function call,
+# which is not in the CREATE TABLE and FOREIGN KEY ... REFERENCES syntax
+#
+# Usage :
+#
+# let $engine_type=InnoDb;
+# let $verbose=1;
+# let $FCT= <value_1>;
+# -- source parser_stress_func.inc
+# let $FCT= <value_2>;
+# -- source parser_stress_func.inc
+# let $verbose=0;
+# let $FCT= <value_3>;
+# -- source parser_stress_func.inc
+# let $FCT= <value_4>;
+# -- source parser_stress_func.inc
+
+-- disable_warnings
+eval drop table if exists $FCT;
+drop table if exists bug21114_child;
+-- enable_warnings
+
+--disable_query_log
+--disable_result_log
+
+eval CREATE TABLE $FCT(
+ col1 int not null,
+ col2 int not null,
+ col3 varchar(10),
+ CONSTRAINT pk PRIMARY KEY (col1, col2)
+) ENGINE $engine_type;
+
+eval CREATE TABLE bug21114_child(
+ pk int not null,
+ fk_col1 int not null,
+ fk_col2 int not null,
+ fk_col3 int not null,
+ fk_col4 int not null,
+ CONSTRAINT fk_fct FOREIGN KEY (fk_col1, fk_col2)
+ REFERENCES $FCT(col1, col2),
+ CONSTRAINT fk_fct_space FOREIGN KEY (fk_col3, fk_col4)
+ REFERENCES $FCT (col1, col2)
+) ENGINE $engine_type;
+
+--enable_query_log
+--enable_result_log
+
+if ($verbose)
+{
+ eval SHOW CREATE TABLE $FCT;
+ SHOW CREATE TABLE bug21114_child;
+}
+
+DROP TABLE bug21114_child;
+eval DROP TABLE $FCT;
+
diff --git a/mysql-test/include/partition_1.inc b/mysql-test/include/partition_1.inc
new file mode 100644
index 00000000000..b0094db2efe
--- /dev/null
+++ b/mysql-test/include/partition_1.inc
@@ -0,0 +1,750 @@
+-- source include/have_partition.inc
+
+# include/partition_1.inc
+#
+# Partitionong tests
+#
+# Attention: The variable
+# $engine -- Storage engine to be tested.
+# must be set within the script sourcing this file.
+#
+--disable_abort_on_error
+SET AUTOCOMMIT= 1;
+
+##### Disabled testcases, because of open bugs #####
+--echo
+--echo #------------------------------------------------------------------------
+--echo # There are several testcases disabled because ouf the open bugs
+--echo # #15407 , #15408 , #15890 , #15961 , #13447 , #15966 , #15968, #16370
+--echo #------------------------------------------------------------------------
+# Bug#15407 Partitions: crash if subpartition
+let $fixed_bug15407= 0;
+# Bug#15408 Partitions: subpartition names are not unique
+let $fixed_bug15408= 0;
+# Bug#15890 Partitions: Strange interpretation of partition number
+let $fixed_bug15890= 0;
+# Bug#15961 Partitions: Creation of subpart. table without subpart. rule not rejected
+let $fixed_bug15961= 0;
+# Bug#13447 Partitions: crash with alter table
+let $fixed_bug13447= 0;
+# Bug#15966 Partitions: crash if session default engine <> engine used in create table
+let $fixed_bug15966= 0;
+# Bug#15968 Partitions: crash when INSERT with f1 = -1 into PARTITION BY HASH(f1)
+let $fixed_bug15968= 0;
+# Bug #16370 Partitions: subpartitions names not mentioned in SHOW CREATE TABLE output
+let $fixed_bug16370= 0;
+
+##### Option, for displaying files #####
+#
+# Attention: Displaying the directory content via "ls $MYSQLTEST_VARDIR/master-data/test/t*"
+# is probably not portable.
+# let $ls= 0; disables the execution of "ls ....."
+let $ls= 0;
+
+################################################################################
+# Partitioning syntax
+#
+# CREATE TABLE .... (column-list ..)
+# PARTITION BY
+# KEY '(' ( column-list ) ')'
+# | RANGE '(' ( expr ) ')'
+# | LIST '(' ( expr ) ')'
+# | HASH '(' ( expr ) ')'
+# [PARTITIONS num ]
+# [SUBPARTITION BY
+# KEY '(' ( column-list ) ')'
+# | HASH '(' ( expr ) ')'
+# [SUBPARTITIONS num ]
+# ]
+# [ '('
+# ( PARTITION logical-name
+# [ VALUES LESS THAN '(' ( expr | MAX_VALUE ) ')' ]
+# [ VALUES IN '(' (expr)+ ')' ]
+# [ TABLESPACE tablespace-name ]
+# [ [ STORAGE ] ENGINE [ '=' ] storage-engine-name ]
+# [ NODEGROUP nodegroup-id ]
+# [ '('
+# ( SUBPARTITION logical-name
+# [ TABLESPACE tablespace-name ]
+# [ STORAGE ENGINE = storage-engine-name ]
+# [ NODEGROUP nodegroup-id ]
+# )+
+# ')'
+# )+
+# ')'
+# ]
+################################################################################
+
+--echo
+--echo #------------------------------------------------------------------------
+--echo # 0. Setting of auxiliary variables + Creation of an auxiliary table
+--echo # needed in all testcases
+--echo #------------------------------------------------------------------------
+let $max_row= `SELECT @max_row`;
+let $max_row_div2= `SELECT @max_row DIV 2`;
+let $max_row_div3= `SELECT @max_row DIV 3`;
+let $max_row_div4= `SELECT @max_row DIV 4`;
+let $max_int_4= 2147483647;
+--disable_warnings
+DROP TABLE IF EXISTS t0_template;
+--enable_warnings
+CREATE TABLE t0_template ( f1 INTEGER, f2 char(20), PRIMARY KEY(f1))
+ENGINE = MEMORY;
+--echo # Logging of <max_row> INSERTs into t0_template suppressed
+--disable_query_log
+let $num= $max_row;
+while ($num)
+{
+ eval INSERT INTO t0_template SET f1 = $num, f2 = '---$num---';
+
+ dec $num;
+}
+--enable_query_log
+
+--echo
+--echo #------------------------------------------------------------------------
+--echo # 1. Some syntax checks
+--echo #------------------------------------------------------------------------
+--echo # 1.1 Subpartioned table without subpartitioning rule must be rejected
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+if ($fixed_bug15961)
+{
+# Bug#15961 Partitions: Creation of subpart. table without subpart. rule not rejected
+--error 9999
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+( PARTITION part1 VALUES LESS THAN (1000) (SUBPARTITION subpart11));
+}
+--echo # FIXME Implement testcases, where it is checked that all create and
+--echo # alter table statements
+--echo # - with missing mandatory parameters are rejected
+--echo # - with optional parameters are accepted
+--echo # - with wrong combinations of optional parameters are rejected
+--echo # - ............
+
+--echo
+--echo #------------------------------------------------------------------------
+--echo # 2. Checks where the engine is assigned on all supported (CREATE TABLE
+--echo # statement) positions + basic operations on the tables
+--echo # Storage engine mixups are currently (2005-12-23) not supported
+--echo #------------------------------------------------------------------------
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--echo # 2.1 non partitioned table (for comparison)
+eval CREATE TABLE t1 ( f1 INTEGER, f2 char(20)) ENGINE = $engine;
+# MLML Full size (as check of check routine)
+--source include/partition_10.inc
+DROP TABLE t1;
+#
+--echo # 2.2 Assignment of storage engine just after column list only
+eval CREATE TABLE t1 ( f1 INTEGER, f2 char(20)) ENGINE = $engine
+ PARTITION BY HASH(f1) PARTITIONS 2;
+--source include/partition_10.inc
+DROP TABLE t1;
+#
+--echo # 2.3 Assignment of storage engine just after partition or subpartition
+--echo # name only
+eval CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+ PARTITION BY HASH(f1)
+ ( PARTITION part1 STORAGE ENGINE = $engine,
+ PARTITION part2 STORAGE ENGINE = $engine
+ );
+--source include/partition_10.inc
+DROP TABLE t1;
+eval CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+ PARTITION BY RANGE(f1)
+ SUBPARTITION BY HASH(f1)
+ ( PARTITION part1 VALUES LESS THAN ($max_row_div2)
+ (SUBPARTITION subpart11 STORAGE ENGINE = $engine,
+ SUBPARTITION subpart12 STORAGE ENGINE = $engine),
+ PARTITION part2 VALUES LESS THAN ($max_int_4)
+ (SUBPARTITION subpart21 STORAGE ENGINE = $engine,
+ SUBPARTITION subpart22 STORAGE ENGINE = $engine)
+ );
+--source include/partition_10.inc
+DROP TABLE t1;
+#
+--echo # 2.4 Some but not all named partitions or subpartitions get a storage
+--echo # engine assigned
+eval CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+ PARTITION BY HASH(f1)
+ ( PARTITION part1 STORAGE ENGINE = $engine,
+ PARTITION part2
+ );
+--source include/partition_10.inc
+DROP TABLE t1;
+eval CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+ PARTITION BY HASH(f1)
+ ( PARTITION part1 ,
+ PARTITION part2 STORAGE ENGINE = $engine
+ );
+--source include/partition_10.inc
+DROP TABLE t1;
+eval CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+ PARTITION BY RANGE(f1)
+ SUBPARTITION BY HASH(f1)
+ ( PARTITION part1 VALUES LESS THAN ($max_row_div2)
+ (SUBPARTITION subpart11,
+ SUBPARTITION subpart12 STORAGE ENGINE = $engine),
+ PARTITION part2 VALUES LESS THAN ($max_int_4)
+ (SUBPARTITION subpart21 STORAGE ENGINE = $engine,
+ SUBPARTITION subpart22 STORAGE ENGINE = $engine)
+ );
+--source include/partition_10.inc
+DROP TABLE t1;
+eval CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+ PARTITION BY RANGE(f1)
+ SUBPARTITION BY HASH(f1)
+ ( PARTITION part1 VALUES LESS THAN ($max_row_div2)
+ (SUBPARTITION subpart11 STORAGE ENGINE = $engine,
+ SUBPARTITION subpart12 STORAGE ENGINE = $engine),
+ PARTITION part2 VALUES LESS THAN ($max_int_4)
+ (SUBPARTITION subpart21,
+ SUBPARTITION subpart22 )
+ );
+--source include/partition_10.inc
+DROP TABLE t1;
+#
+--echo # 2.5 Storage engine assignment after partition name + after name of
+--echo # subpartitions belonging to another partition
+eval CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+ PARTITION BY RANGE(f1)
+ SUBPARTITION BY HASH(f1)
+ ( PARTITION part1 VALUES LESS THAN ($max_row_div2) ENGINE = $engine
+ (SUBPARTITION subpart11,
+ SUBPARTITION subpart12),
+ PARTITION part2 VALUES LESS THAN ($max_int_4)
+ (SUBPARTITION subpart21 STORAGE ENGINE = $engine,
+ SUBPARTITION subpart22 STORAGE ENGINE = $engine)
+ );
+--source include/partition_10.inc
+DROP TABLE t1;
+eval CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+ PARTITION BY RANGE(f1)
+ SUBPARTITION BY HASH(f1)
+ ( PARTITION part1 VALUES LESS THAN ($max_row_div2)
+ (SUBPARTITION subpart11 STORAGE ENGINE = $engine,
+ SUBPARTITION subpart12 STORAGE ENGINE = $engine),
+ PARTITION part2 VALUES LESS THAN ($max_int_4) ENGINE = $engine
+ (SUBPARTITION subpart21,
+ SUBPARTITION subpart22)
+ );
+--source include/partition_10.inc
+DROP TABLE t1;
+#
+--echo # 2.6 Precedence of storage engine assignments
+--echo # 2.6.1 Storage engine assignment after column list + after partition
+--echo # or subpartition name
+eval CREATE TABLE t1 ( f1 INTEGER, f2 char(20)) ENGINE = $engine
+ PARTITION BY HASH(f1)
+ ( PARTITION part1 STORAGE ENGINE = $engine,
+ PARTITION part2 STORAGE ENGINE = $engine
+ );
+--source include/partition_10.inc
+DROP TABLE t1;
+eval CREATE TABLE t1 ( f1 INTEGER, f2 char(20)) ENGINE = $engine
+ PARTITION BY RANGE(f1)
+ SUBPARTITION BY HASH(f1)
+ ( PARTITION part1 VALUES LESS THAN ($max_row_div2)
+ (SUBPARTITION subpart11 STORAGE ENGINE = $engine,
+ SUBPARTITION subpart12 STORAGE ENGINE = $engine),
+ PARTITION part2 VALUES LESS THAN ($max_int_4)
+ (SUBPARTITION subpart21 STORAGE ENGINE = $engine,
+ SUBPARTITION subpart22 STORAGE ENGINE = $engine)
+ );
+--source include/partition_10.inc
+DROP TABLE t1;
+--echo # 2.6.2 Storage engine assignment after partition name + after
+--echo # subpartition name
+# in partition part + in sub partition part
+eval CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+ PARTITION BY RANGE(f1)
+ SUBPARTITION BY HASH(f1)
+ ( PARTITION part1 VALUES LESS THAN ($max_row_div2) STORAGE ENGINE = $engine
+ (SUBPARTITION subpart11 STORAGE ENGINE = $engine,
+ SUBPARTITION subpart12 STORAGE ENGINE = $engine),
+ PARTITION part2 VALUES LESS THAN ($max_int_4)
+ (SUBPARTITION subpart21 STORAGE ENGINE = $engine,
+ SUBPARTITION subpart22 STORAGE ENGINE = $engine)
+ );
+--source include/partition_10.inc
+DROP TABLE t1;
+
+--echo # 2.7 Session default engine differs from engine used within create table
+eval SET SESSION storage_engine=$engine_other;
+if ($fixed_bug15966)
+{
+# Bug#15966 Partitions: crash if session default engine <> engine used in create table
+eval CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) ( PARTITION part1 ENGINE = $engine);
+--source include/partition_10.inc
+DROP TABLE t1;
+# Bug#15966 Partitions: crash if session default engine <> engine used in create table
+eval CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+ PARTITION BY RANGE(f1)
+ SUBPARTITION BY HASH(f1)
+ ( PARTITION part1 VALUES LESS THAN (1000)
+ (SUBPARTITION subpart11 STORAGE ENGINE = $engine,
+ SUBPARTITION subpart12 STORAGE ENGINE = $engine));
+--source include/partition_10.inc
+DROP TABLE t1;
+}
+eval SET SESSION storage_engine=$engine;
+
+
+--echo
+--echo #------------------------------------------------------------------------
+--echo # 3. Check assigning the number of partitions and subpartitions
+--echo # with and without named partitions/subpartitions
+--echo #------------------------------------------------------------------------
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+--echo # 3.1 (positive) without partition/subpartition number assignment
+--echo # 3.1.1 no partition number, no named partitions
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1);
+--source include/partition_10.inc
+DROP TABLE t1;
+--echo # 3.1.2 no partition number, named partitions
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) (PARTITION part1, PARTITION part2);
+--source include/partition_10.inc
+DROP TABLE t1;
+# Attention: Several combinations are impossible
+# If subpartitioning exists
+# - partitioning algorithm must be RANGE or LIST
+# This implies the assignment of named partitions.
+# - subpartitioning algorithm must be HASH or KEY
+--echo # 3.1.3 variations on no partition/subpartition number, named partitions,
+--echo # different subpartitions are/are not named
+#
+# Partition name -- "properties"
+# part1 -- first/non last
+# part2 -- non first/non last
+# part3 -- non first/ last
+#
+# Testpattern:
+# named subpartitions in
+# Partition part1 part2 part3
+# N N N
+# N N Y
+# N Y N
+# N Y Y
+# Y N N
+# Y N Y
+# Y Y N
+# Y Y Y
+--disable_query_log
+let $part0= CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1);
+#
+eval SET @aux = '(PARTITION part1 VALUES LESS THAN ($max_row_div2),';
+let $part1_N= `SELECT @AUX`;
+eval SET @aux = '(PARTITION part1 VALUES LESS THAN ($max_row_div2)
+(SUBPARTITION subpart11 , SUBPARTITION subpart12 ),';
+let $part1_Y= `SELECT @AUX`;
+#
+eval SET @aux = 'PARTITION part2 VALUES LESS THAN ($max_row),';
+let $part2_N= `SELECT @AUX`;
+eval SET @aux = 'PARTITION part2 VALUES LESS THAN ($max_row)
+(SUBPARTITION subpart21 , SUBPARTITION subpart22 ),';
+let $part2_Y= `SELECT @AUX`;
+#
+eval SET @aux = 'PARTITION part3 VALUES LESS THAN ($max_int_4))';
+let $part3_N= `SELECT @AUX`;
+eval SET @aux = 'PARTITION part3 VALUES LESS THAN ($max_int_4)
+(SUBPARTITION subpart31 , SUBPARTITION subpart32 ))';
+let $part3_Y= `SELECT @AUX`;
+--enable_query_log
+
+eval $part0 $part1_N $part2_N $part3_N ;
+DROP TABLE t1;
+# Bug#15407 Partitions: crash if subpartition
+if ($fixed_bug15407)
+{
+eval $part0 $part1_N $part2_N $part3_Y ;
+--source include/partition_10.inc
+DROP TABLE t1;
+eval $part0 $part1_N $part2_Y $part3_N ;
+--source include/partition_10.inc
+DROP TABLE t1;
+eval $part0 $part1_N $part2_Y $part3_Y ;
+--source include/partition_10.inc
+DROP TABLE t1;
+eval $part0 $part1_Y $part2_N $part3_N ;
+--source include/partition_10.inc
+DROP TABLE t1;
+eval $part0 $part1_Y $part2_N $part3_Y ;
+--source include/partition_10.inc
+DROP TABLE t1;
+eval $part0 $part1_Y $part2_Y $part3_N ;
+--source include/partition_10.inc
+DROP TABLE t1;
+}
+eval $part0 $part1_Y $part2_Y $part3_Y ;
+--source include/partition_10.inc
+DROP TABLE t1;
+
+--echo # 3.2 partition/subpartition numbers good and bad values and notations
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+--echo # 3.2.1 partition/subpartition numbers INTEGER notation
+# ML: "positive/negative" is my private judgement. It need no to correspond
+# with the server response.
+# (positive) number = 2
+let $part_number= 2;
+--source include/partition_11.inc
+# (positive) special case number = 1
+let $part_number= 1;
+--source include/partition_11.inc
+# (negative) 0 is non sense
+let $part_number= 0;
+--source include/partition_11.inc
+# (negative) -1 is non sense
+let $part_number= -1;
+--source include/partition_11.inc
+# (negative) 1000000 is too huge
+let $part_number= 1000000;
+--source include/partition_11.inc
+
+if ($fixed_bug15890)
+{
+--echo # 3.2.2 partition/subpartition numbers DECIMAL notation
+# (positive) number = 2.0
+let $part_number= 2.0;
+--source include/partition_11.inc
+# (negative) -2.0 is non sense
+let $part_number= -2.0;
+--source include/partition_11.inc
+# (negative) case number = 0.0 is non sense
+let $part_number= 0.0;
+--source include/partition_11.inc
+# Bug#15890 Partitions: Strange interpretation of partition number
+# (negative) number = 1.5 is non sense
+let $part_number= 1.5;
+--source include/partition_11.inc
+# (negative) number is too huge
+let $part_number= 999999999999999999999999999999.999999999999999999999999999999;
+--source include/partition_11.inc
+# (negative) number is nearly zero
+let $part_number= 0.000000000000000000000000000001;
+--source include/partition_11.inc
+
+--echo # 3.2.3 partition/subpartition numbers FLOAT notation
+##### FLOAT notation
+# (positive) number = 2.0E+0
+let $part_number= 2.0E+0;
+--source include/partition_11.inc
+# Bug#15890 Partitions: Strange interpretation of partition number
+# (positive) number = 0.2E+1
+let $part_number= 0.2E+1;
+--source include/partition_11.inc
+# (negative) -2.0E+0 is non sense
+let $part_number= -2.0E+0;
+--source include/partition_11.inc
+# (negative) 0.15E+1 is non sense
+let $part_number= 0.15E+1;
+--source include/partition_11.inc
+# (negative) 0.0E+300 is zero
+let $part_number= 0.0E+300;
+--source include/partition_11.inc
+# Bug#15890 Partitions: Strange interpretation of partition number
+# (negative) 1E+300 is too huge
+let $part_number= 1E+300;
+--source include/partition_11.inc
+# (negative) 1E-300 is nearly zero
+let $part_number= 1E-300;
+--source include/partition_11.inc
+}
+
+--echo # 3.2.4 partition/subpartition numbers STRING notation
+##### STRING notation
+# (negative?) case number = '2'
+let $part_number= '2';
+--source include/partition_11.inc
+# (negative?) case number = '2.0'
+let $part_number= '2.0';
+--source include/partition_11.inc
+# (negative?) case number = '0.2E+1'
+let $part_number= '0.2E+1';
+--source include/partition_11.inc
+# (negative) Strings starts with digit, but 'A' follows
+let $part_number= '2A';
+--source include/partition_11.inc
+# (negative) Strings starts with 'A', but digit follows
+let $part_number= 'A2';
+--source include/partition_11.inc
+# (negative) empty string
+let $part_number= '';
+--source include/partition_11.inc
+# (negative) string without any digits
+let $part_number= 'GARBAGE';
+--source include/partition_11.inc
+
+--echo # 3.2.5 partition/subpartition numbers other notations
+# (negative) Strings starts with digit, but 'A' follows
+let $part_number= 2A;
+--source include/partition_11.inc
+# (negative) Strings starts with 'A', but digit follows
+let $part_number= A2;
+--source include/partition_11.inc
+# (negative) string without any digits
+let $part_number= GARBAGE;
+--source include/partition_11.inc
+
+# (negative?) double quotes
+let $part_number= "2";
+--source include/partition_11.inc
+# (negative) Strings starts with digit, but 'A' follows
+let $part_number= "2A";
+--source include/partition_11.inc
+# (negative) Strings starts with 'A', but digit follows
+let $part_number= "A2";
+--source include/partition_11.inc
+# (negative) string without any digits
+let $part_number= "GARBAGE";
+--source include/partition_11.inc
+
+--echo # 3.3 Mixups of assigned partition/subpartition numbers and names
+--echo # 3.3.1 (positive) number of partition/subpartition
+--echo # = number of named partition/subpartition
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS 2 ( PARTITION part1, PARTITION part2 ) ;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) PARTITIONS 2
+SUBPARTITION BY HASH(f1) SUBPARTITIONS 2
+( PARTITION part1 VALUES LESS THAN (1000)
+ (SUBPARTITION subpart11, SUBPARTITION subpart12),
+ PARTITION part2 VALUES LESS THAN (2147483647)
+ (SUBPARTITION subpart21, SUBPARTITION subpart22)
+);
+--source include/partition_layout.inc
+DROP TABLE t1;
+--echo # 3.3.2 (positive) number of partition/subpartition ,
+--echo # 0 (= no) named partition/subpartition
+--echo # already checked above
+--echo # 3.3.3 (negative) number of partitions/subpartitions
+--echo # > number of named partitions/subpartitions
+--error 1064
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS 2 ( PARTITION part1 ) ;
+# Wrong number of named subpartitions in first partition
+--error 1064
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1) SUBPARTITIONS 2
+( PARTITION part1 VALUES LESS THAN (1000)
+ (SUBPARTITION subpart11 ),
+ PARTITION part2 VALUES LESS THAN (2147483647)
+ (SUBPARTITION subpart21, SUBPARTITION subpart22)
+);
+# Wrong number of named subpartitions in non first/non last partition
+--error 1064
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1) SUBPARTITIONS 2
+( PARTITION part1 VALUES LESS THAN (1000)
+ (SUBPARTITION subpart11, SUBPARTITION subpart12),
+ PARTITION part2 VALUES LESS THAN (2000)
+ (SUBPARTITION subpart21 ),
+ PARTITION part3 VALUES LESS THAN (2147483647)
+ (SUBPARTITION subpart31, SUBPARTITION subpart32)
+);
+# Wrong number of named subpartitions in last partition
+--error 1064
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) PARTITIONS 2
+SUBPARTITION BY HASH(f1) SUBPARTITIONS 2
+( PARTITION part1 VALUES LESS THAN (1000)
+ (SUBPARTITION subpart11, SUBPARTITION subpart12),
+ PARTITION part2 VALUES LESS THAN (2147483647)
+ (SUBPARTITION subpart21 )
+);
+--echo # 3.3.4 (negative) number of partitions < number of named partitions
+--error 1064
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS 1 ( PARTITION part1, PARTITION part2 ) ;
+# Wrong number of named subpartitions in first partition
+--error 1064
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1) SUBPARTITIONS 1
+( PARTITION part1 VALUES LESS THAN (1000)
+ (SUBPARTITION subpart11, SUBPARTITION subpart12),
+ PARTITION part2 VALUES LESS THAN (2147483647)
+ (SUBPARTITION subpart21, SUBPARTITION subpart22)
+);
+# Wrong number of named subpartitions in non first/non last partition
+--error 1064
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1) SUBPARTITIONS 1
+( PARTITION part1 VALUES LESS THAN (1000)
+ (SUBPARTITION subpart11, SUBPARTITION subpart12),
+ PARTITION part2 VALUES LESS THAN (2000)
+ (SUBPARTITION subpart21 ),
+ PARTITION part3 VALUES LESS THAN (2147483647)
+ (SUBPARTITION subpart31, SUBPARTITION subpart32)
+);
+# Wrong number of named subpartitions in last partition
+--error 1064
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1) SUBPARTITIONS 1
+( PARTITION part1 VALUES LESS THAN (1000)
+ (SUBPARTITION subpart11, SUBPARTITION subpart12),
+ PARTITION part2 VALUES LESS THAN (2147483647)
+ (SUBPARTITION subpart21, SUBPARTITION subpart22)
+);
+
+
+--echo
+--echo #------------------------------------------------------------------------
+--echo # 4. Checks of logical partition/subpartition name
+--echo # file name clashes during CREATE TABLE
+--echo #------------------------------------------------------------------------
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--echo # 4.1 (negative) A partition name used more than once
+--error ER_SAME_NAME_PARTITION
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) (PARTITION part1, PARTITION part1);
+#
+if ($fixed_bug15408)
+{
+# Bug#15408 Partitions: subpartition names are not unique
+--error ER_SAME_NAME_PARTITION
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1)
+( PARTITION part1 VALUES LESS THAN (1000)
+ (SUBPARTITION subpart11, SUBPARTITION subpart11)
+);
+}
+--echo # FIXME Implement testcases with filename problems
+--echo # existing file of other table --- partition/subpartition file name
+--echo # partition/subpartition file name --- file of the same table
+
+--echo
+--echo #------------------------------------------------------------------------
+--echo # 5. Alter table experiments
+--echo #------------------------------------------------------------------------
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+--echo # 5.1 alter table add partition
+--echo # 5.1.1 (negative) add partition to non partitioned table
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20));
+--source include/partition_layout.inc
+# MyISAM gets ER_PARTITION_MGMT_ON_NONPARTITIONED and NDB 1005
+# The error code of NDB differs, because all NDB tables are partitioned even
+# if the CREATE TABLE does not contain a partitioning clause.
+--error ER_PARTITION_MGMT_ON_NONPARTITIONED,1005
+ALTER TABLE t1 ADD PARTITION (PARTITION part1);
+--source include/partition_layout.inc
+DROP TABLE t1;
+
+--echo # 5.1.2 Add one partition to a table with one partition
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1);
+--source include/partition_layout.inc
+eval INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND $max_row_div2 - 1;
+--disable_query_log
+eval SELECT $engine = 'NDB' INTO @aux;
+let $my_exit= `SELECT @aux`;
+if ($my_exit)
+{
+ exit;
+}
+--enable_query_log
+ALTER TABLE t1 ADD PARTITION (PARTITION part1);
+--source include/partition_12.inc
+DROP TABLE t1;
+
+--echo # 5.1.3 Several times add one partition to a table with some partitions
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) (PARTITION part1, PARTITION part3);
+--source include/partition_layout.inc
+eval INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND $max_row_div2 - 1;
+# Partition name before first existing partition name
+ALTER TABLE t1 ADD PARTITION (PARTITION part0);
+--source include/partition_12.inc
+DELETE FROM t1;
+eval INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND $max_row_div2 - 1;
+# Partition name between existing partition names
+ALTER TABLE t1 ADD PARTITION (PARTITION part2);
+--source include/partition_12.inc
+DELETE FROM t1;
+eval INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND $max_row_div2 - 1;
+if ($fixed_bug13447)
+{
+# Partition name after all existing partition names
+# Bug#13447 Partitions: crash with alter table
+ALTER TABLE t1 ADD PARTITION (PARTITION part4);
+}
+--source include/partition_12.inc
+DROP TABLE t1;
+
+--echo # 5.1.4 Add several partitions to a table with some partitions
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) (PARTITION part1, PARTITION part3);
+--source include/partition_layout.inc
+eval INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND $max_row_div2 - 1;
+if ($fixed_bug13447)
+{
+# Bug#13447 Partitions: crash with alter table
+ALTER TABLE t1 ADD PARTITION (PARTITION part0, PARTITION part2, PARTITION part4);
+}
+--source include/partition_12.inc
+DROP TABLE t1;
+
+--echo # 5.1.5 (negative) Add partitions to a table with some partitions
+--echo # clash on new and already existing partition names
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) (PARTITION part1, PARTITION part2, PARTITION part3);
+# Clash on first/non last partition name
+--error ER_SAME_NAME_PARTITION
+ALTER TABLE t1 ADD PARTITION (PARTITION part1);
+# Clash on non first/non last partition name
+--error ER_SAME_NAME_PARTITION
+ALTER TABLE t1 ADD PARTITION (PARTITION part2);
+# Clash on non first/last partition name
+--error ER_SAME_NAME_PARTITION
+ALTER TABLE t1 ADD PARTITION (PARTITION part3);
+# Clash on all partition names
+--error ER_SAME_NAME_PARTITION
+ALTER TABLE t1 ADD PARTITION (PARTITION part1, PARTITION part2, PARTITION part3);
+DROP TABLE t1;
+
+# FIXME Is there any way to add a subpartition to an already existing partition
+
+--echo # 5.2 alter table add subpartition
+--echo # 5.2.1 Add one subpartition to a table with subpartitioning rule and
+--echo # no explicit defined subpartitions
+eval CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1)
+(PARTITION part1 VALUES LESS THAN ($max_row_div2));
+if ($fixed_bug16370)
+{
+--source include/partition_layout.inc
+}
+eval INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND $max_row_div2 - 1;
+eval ALTER TABLE t1 ADD PARTITION (PARTITION part2 VALUES LESS THAN ($max_int_4)
+ (SUBPARTITION subpart21));
+if ($fixed_bug16370)
+{
+--source include/partition_12.inc
+}
+DROP TABLE t1;
+DROP TABLE if exists t0_template;
diff --git a/mysql-test/include/partition_10.inc b/mysql-test/include/partition_10.inc
new file mode 100644
index 00000000000..74b0fdf7f6a
--- /dev/null
+++ b/mysql-test/include/partition_10.inc
@@ -0,0 +1,73 @@
+# include/partition_10.inc
+#
+# Do some basic checks on a table.
+#
+# FIXME: Do not write the statements and results, if SQL return code = 0
+# and result set like expected. Write a message, that all is like
+# expected instead.
+#
+# All SELECTs are so written, that we get my_value = 1, when everything
+# is like expected.
+#
+
+--source include/partition_layout.inc
+
+####### Variations with multiple records
+# Select on empty table
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+# (mass) Insert of $max_row records
+eval INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND $max_row;
+# Select
+eval SELECT (COUNT(*) = $max_row) AND (MIN(f1) = 1) AND (MAX(f1) = $max_row)
+ AS my_value FROM t1;
+# DEBUG SELECT COUNT(*),MIN(f1),MAX(f1) FROM t1;
+# (mass) Update $max_row_div4 * 2 + 1 records
+eval UPDATE t1 SET f1 = f1 + $max_row
+WHERE f1 BETWEEN $max_row_div2 - $max_row_div4 AND $max_row_div2 + $max_row_div4;
+# Select
+eval SELECT (COUNT(*) = $max_row) AND (MIN(f1) = 1) AND (MAX(f1) = $max_row_div2 + $max_row_div4 + $max_row )
+ AS my_value FROM t1;
+# DEBUG SELECT COUNT(*),MIN(f1),MAX(f1) FROM t1;
+# (mass) Delete $max_row_div4 * 2 + 1 records
+eval DELETE FROM t1
+WHERE f1 BETWEEN $max_row_div2 - $max_row_div4 + $max_row AND $max_row_div2 + $max_row_div4 + $max_row;
+# Select
+eval SELECT (COUNT(*) = $max_row - $max_row_div4 - $max_row_div4 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = $max_row)
+ AS my_value FROM t1;
+# DEBUG SELECT COUNT(*),MIN(f1),MAX(f1) FROM t1;
+
+####### Variations with single records
+# Insert one record at beginning
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+# Select this record
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+# Insert one record at end
+eval INSERT INTO t1 SET f1 = $max_row + 1, f2 = '#######';
+# Select this record
+eval SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = $max_row + 1 AND f2 = '#######';
+# Update one record
+eval UPDATE t1 SET f1 = $max_row + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+# Select
+eval SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = $max_row + 2 AND f2 = 'ZZZZZZZ';
+if ($fixed_bug15968)
+{
+# Bug #15968: Partitions: crash when INSERT with f1 = -1 into PARTITION BY HASH(f1)
+eval UPDATE t1 SET f1 = 0 - 1, f2 = 'ZZZZZZZ'
+ WHERE f1 = $max_row + 1 AND f2 = '#######';
+# Select
+SELECT COUNT(*) AS my_value FROM t1 WHERE f1 = 0 - 1 AND f2 = 'ZZZZZZZ';
+}
+# Delete
+eval DELETE FROM t1 WHERE f1 = $max_row + 2 AND f2 = 'ZZZZZZZ';
+if ($fixed_bug15968)
+{
+DELETE FROM t1 WHERE f1 = 0 - 1 AND f2 = 'ZZZZZZZ';
+}
+# Select
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+
+# Truncate
+TRUNCATE t1;
+# Select on empty table
+SELECT COUNT(*) = 0 AS my_value FROM t1;
diff --git a/mysql-test/include/partition_11.inc b/mysql-test/include/partition_11.inc
new file mode 100644
index 00000000000..7ed4d882aa0
--- /dev/null
+++ b/mysql-test/include/partition_11.inc
@@ -0,0 +1,34 @@
+# include/partition_11.inc
+#
+# Try to create a table with the given partition number
+#
+
+eval CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS $part_number;
+--disable_query_log
+eval SET @my_errno= $mysql_errno ;
+let $run= `SELECT @my_errno = 0`;
+--enable_query_log
+#
+# If this operation was successfull, check + drop this table
+if ($run)
+{
+ --source include/partition_10.inc
+ eval DROP TABLE t1;
+}
+#### Try to create a table with the given subpartition number
+eval CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS $part_number
+(PARTITION part1 VALUES LESS THAN ($max_row_div2), PARTITION part2 VALUES LESS THAN ($max_int_4));
+--disable_query_log
+eval SET @my_errno= $mysql_errno ;
+let $run= `SELECT @my_errno = 0`;
+--enable_query_log
+#
+# If this operation was successfull, check + drop this table
+if ($run)
+{
+ --source include/partition_10.inc
+ eval DROP TABLE t1;
+}
diff --git a/mysql-test/include/partition_12.inc b/mysql-test/include/partition_12.inc
new file mode 100644
index 00000000000..2a5610b82e1
--- /dev/null
+++ b/mysql-test/include/partition_12.inc
@@ -0,0 +1,65 @@
+# include/partition_12.inc
+#
+# Do some basic things on a table, if the SQL command executed just before
+# sourcing this file was successful.
+#
+
+--source include/partition_layout.inc
+
+####### Variations with multiple records
+ # (mass) Insert max_row_div2 + 1 records
+ eval INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN $max_row_div2 AND $max_row;
+ # Select
+ eval SELECT (COUNT(*) = $max_row) AND (MIN(f1) = 1) AND (MAX(f1) = $max_row)
+ AS my_value FROM t1;
+ # DEBUG SELECT COUNT(*),MIN(f1),MAX(f1) FROM t1;
+ # (mass) Update $max_row_div4 * 2 + 1 records
+ eval UPDATE t1 SET f1 = f1 + $max_row
+ WHERE f1 BETWEEN $max_row_div2 - $max_row_div4 AND $max_row_div2 + $max_row_div4;
+ # Select
+ eval SELECT (COUNT(*) = $max_row) AND (MIN(f1) = 1) AND (MAX(f1) = $max_row_div2 + $max_row_div4 + $max_row )
+ AS my_value FROM t1;
+ # DEBUG SELECT COUNT(*),MIN(f1),MAX(f1) FROM t1;
+ # (mass) Delete $max_row_div4 * 2 + 1 records
+ eval DELETE FROM t1
+ WHERE f1 BETWEEN $max_row_div2 - $max_row_div4 + $max_row AND $max_row_div2 + $max_row_div4 + $max_row;
+ # Select
+ eval SELECT (COUNT(*) = $max_row - $max_row_div4 - $max_row_div4 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = $max_row)
+ AS my_value FROM t1;
+ # DEBUG SELECT COUNT(*),MIN(f1),MAX(f1) FROM t1;
+
+####### Variations with single records
+# Insert one record at beginning
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+# Select this record
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+# Insert one record at end
+eval INSERT INTO t1 SET f1 = $max_row + 1, f2 = '#######';
+# Select this record
+eval SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = $max_row + 1 AND f2 = '#######';
+# Update one record
+eval UPDATE t1 SET f1 = $max_row + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+# Select
+eval SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = $max_row + 2 AND f2 = 'ZZZZZZZ';
+if ($fixed_bug15968)
+{
+# Bug #15968: Partitions: crash when INSERT with f1 = -1 into PARTITION BY HASH(f1)
+eval UPDATE t1 SET f1 = 0 - 1, f2 = 'ZZZZZZZ'
+ WHERE f1 = $max_row + 1 AND f2 = '#######';
+# Select
+SELECT COUNT(*) AS my_value FROM t1 WHERE f1 = 0 - 1 AND f2 = 'ZZZZZZZ';
+}
+# Delete
+eval DELETE FROM t1 WHERE f1 = $max_row + 2 AND f2 = 'ZZZZZZZ';
+if ($fixed_bug15968)
+{
+DELETE FROM t1 WHERE f1 = 0 - 1 AND f2 = 'ZZZZZZZ';
+}
+# Select
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+
+# Truncate
+TRUNCATE t1;
+# Select on empty table
+SELECT COUNT(*) = 0 AS my_value FROM t1;
diff --git a/mysql-test/include/partition_layout.inc b/mysql-test/include/partition_layout.inc
new file mode 100644
index 00000000000..95f6cac37d7
--- /dev/null
+++ b/mysql-test/include/partition_layout.inc
@@ -0,0 +1,13 @@
+# include/partition_layout.inc
+#
+# Print partitioning related informations about the table t1
+#
+
+eval SHOW CREATE TABLE t1;
+
+# Optional (most probably issues with separators and case sensitivity)
+# listing of files belonging to the table t1
+if ($ls)
+{
+ --exec ls $MYSQLTEST_VARDIR/master-data/test/t1*
+}
diff --git a/mysql-test/t/innodb_cache.test b/mysql-test/include/query_cache.inc
index 8ed2853e4f7..3b63167a737 100644
--- a/mysql-test/t/innodb_cache.test
+++ b/mysql-test/include/query_cache.inc
@@ -1,5 +1,18 @@
--- source include/have_innodb.inc
--- source include/have_query_cache.inc
+# include/query_cache.inc
+#
+# The variables
+# $engine_type -- storage engine to be tested
+# $test_foreign_keys -- 0, skip foreign key tests
+# -- 1, do not skip foreign key tests
+# have to be set before sourcing this script.
+#
+# Last update:
+# 2006-08-02 ML test refactored
+# old name was innodb_cache.test
+# main code went into include/query_cache.inc
+#
+
+eval SET SESSION STORAGE_ENGINE = $engine_type;
# Initialise
--disable_warnings
@@ -11,7 +24,7 @@ drop table if exists t1,t2,t3;
#
flush status;
set autocommit=0;
-create table t1 (a int not null) engine=innodb;
+create table t1 (a int not null);
insert into t1 values (1),(2),(3);
select * from t1;
show status like "Qcache_queries_in_cache";
@@ -19,15 +32,15 @@ drop table t1;
commit;
set autocommit=1;
begin;
-create table t1 (a int not null) engine=innodb;
+create table t1 (a int not null);
insert into t1 values (1),(2),(3);
select * from t1;
show status like "Qcache_queries_in_cache";
drop table t1;
commit;
-create table t1 (a int not null) engine=innodb;
-create table t2 (a int not null) engine=innodb;
-create table t3 (a int not null) engine=innodb;
+create table t1 (a int not null);
+create table t2 (a int not null);
+create table t3 (a int not null);
insert into t1 values (1),(2);
insert into t2 values (1),(2);
insert into t3 values (1),(2);
@@ -54,20 +67,22 @@ commit;
show status like "Qcache_queries_in_cache";
drop table t3,t2,t1;
-CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) ENGINE=InnoDB;
+CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id));
select count(*) from t1;
insert into t1 (id) values (0);
select count(*) from t1;
drop table t1;
+if ($test_foreign_keys)
+{
#
# one statement roll back inside transation
#
let $save_query_cache_size=`select @@global.query_cache_size`;
set GLOBAL query_cache_size=1355776;
-CREATE TABLE t1 ( id int(10) NOT NULL auto_increment, a varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY a (a)) ENGINE=innodb;
-CREATE TABLE t2 ( id int(10) NOT NULL auto_increment, b varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY b (b)) ENGINE=innodb;
-CREATE TABLE t3 ( id int(10) NOT NULL auto_increment, t1_id int(10) NOT NULL default '0', t2_id int(10) NOT NULL default '0', state int(11) default NULL, PRIMARY KEY (id), UNIQUE KEY t1_id (t1_id,t2_id), KEY t2_id (t2_id,t1_id), CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`), CONSTRAINT `t3_ibfk_2` FOREIGN KEY (`t2_id`) REFERENCES `t2` (`id`)) ENGINE=innodb;
+CREATE TABLE t1 ( id int(10) NOT NULL auto_increment, a varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY a (a));
+CREATE TABLE t2 ( id int(10) NOT NULL auto_increment, b varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY b (b));
+CREATE TABLE t3 ( id int(10) NOT NULL auto_increment, t1_id int(10) NOT NULL default '0', t2_id int(10) NOT NULL default '0', state int(11) default NULL, PRIMARY KEY (id), UNIQUE KEY t1_id (t1_id,t2_id), KEY t2_id (t2_id,t1_id), CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`), CONSTRAINT `t3_ibfk_2` FOREIGN KEY (`t2_id`) REFERENCES `t2` (`id`));
INSERT INTO t1 VALUES (1,'me');
INSERT INTO t2 VALUES (1,'you');
INSERT INTO t3 VALUES (2,1,1,2);
@@ -83,5 +98,6 @@ drop table t3,t2,t1;
--disable_query_log
eval set GLOBAL query_cache_size=$save_query_cache_size;
--enable_query_log
+}
# End of 4.1 tests
diff --git a/mysql-test/include/read_many_rows.inc b/mysql-test/include/read_many_rows.inc
new file mode 100644
index 00000000000..e69f5a05cd6
--- /dev/null
+++ b/mysql-test/include/read_many_rows.inc
@@ -0,0 +1,61 @@
+# include/read_many_rows.inc
+#
+# Test how filesort and buffered-record-reads works
+# This test needs a lot of time.
+#
+# The variables
+# $engine_type -- storage engine to be tested
+# $other_engine_type -- storage engine <> $engine_type, if possible
+# 1. $other_engine_type must allow to store many rows
+# without using non standard server options
+# (does not need a t/read_many_rows_*-master.opt file)
+# 2. $other_engine_type must point to an all time
+# available storage engine
+# 2006-08 MySQL 5.1 MyISAM and MEMORY only
+# have to be set before sourcing this script.
+#
+# Last update:
+# 2006-08-03 ML test refactored (MySQL 5.1)
+# main code t/innodb-big.test --> include/read_many_rows.inc
+#
+
+eval SET SESSION STORAGE_ENGINE = $engine_type;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2, t3, t4;
+--enable_warnings
+
+eval CREATE TABLE t1 (id INTEGER) ENGINE=$other_engine_type;
+CREATE TABLE t2 (id INTEGER PRIMARY KEY);
+CREATE TABLE t3 (a CHAR(32) PRIMARY KEY,id INTEGER);
+eval CREATE TABLE t4 (a CHAR(32) PRIMARY KEY,id INTEGER) ENGINE=$other_engine_type;
+
+INSERT INTO t1 (id) VALUES (1);
+INSERT INTO t1 SELECT id+1 FROM t1;
+INSERT INTO t1 SELECT id+2 FROM t1;
+INSERT INTO t1 SELECT id+4 FROM t1;
+INSERT INTO t1 SELECT id+8 FROM t1;
+INSERT INTO t1 SELECT id+16 FROM t1;
+INSERT INTO t1 SELECT id+32 FROM t1;
+INSERT INTO t1 SELECT id+64 FROM t1;
+INSERT INTO t1 SELECT id+128 FROM t1;
+INSERT INTO t1 SELECT id+256 FROM t1;
+INSERT INTO t1 SELECT id+512 FROM t1;
+INSERT INTO t1 SELECT id+1024 FROM t1;
+INSERT INTO t1 SELECT id+2048 FROM t1;
+INSERT INTO t1 SELECT id+4096 FROM t1;
+INSERT INTO t1 SELECT id+8192 FROM t1;
+INSERT INTO t1 SELECT id+16384 FROM t1;
+INSERT INTO t1 SELECT id+32768 FROM t1;
+INSERT INTO t1 SELECT id+65536 FROM t1;
+INSERT INTO t1 SELECT id+131072 FROM t1;
+INSERT INTO t1 SELECT id+262144 FROM t1;
+INSERT INTO t1 SELECT id+524288 FROM t1;
+INSERT INTO t1 SELECT id+1048576 FROM t1;
+
+INSERT INTO t2 SELECT * FROM t1;
+INSERT INTO t3 SELECT CONCAT(id),id FROM t2 ORDER BY -id;
+INSERT INTO t4 SELECT * FROM t3 ORDER BY CONCAT(a);
+SELECT SUM(id) FROM t3;
+
+DROP TABLE t1,t2,t3,t4;
diff --git a/mysql-test/t/rowid_order_bdb.test b/mysql-test/include/rowid_order.inc
index ef133054c35..b05bad45cde 100644
--- a/mysql-test/t/rowid_order_bdb.test
+++ b/mysql-test/include/rowid_order.inc
@@ -1,22 +1,36 @@
+# include/rowid_order.inc
#
# Test for rowid ordering (and comparison) functions.
-# do index_merge select for tables with PK of various types.
+# do index_merge select for tables with PK of various types.
#
+# The variable
+# $engine_type -- storage engine to be tested
+# has to be set before sourcing this script.
+#
+# Note: The comments/expections refer to InnoDB.
+# They might be not valid for other storage engines.
+#
+# Last update:
+# 2006-08-02 ML test refactored
+# old name was t/rowid_order.test
+# main code went into include/rowid_order.inc
+#
+
+eval SET SESSION STORAGE_ENGINE = $engine_type;
+
--disable_warnings
drop table if exists t1, t2, t3,t4;
--enable_warnings
--- source include/have_bdb.inc
-
-# Signed number as rowid
-create table t1 (
+# Signed number as rowid
+create table t1 (
pk1 int not NULL,
key1 int(11),
key2 int(11),
PRIMARY KEY (pk1),
KEY key1 (key1),
KEY key2 (key2)
-) engine=bdb;
+);
insert into t1 values (-5, 1, 1),
(-100, 1, 1),
(3, 1, 1),
@@ -26,15 +40,15 @@ explain select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
drop table t1;
-# Unsigned numbers as rowids
-create table t1 (
+# Unsigned numbers as rowids
+create table t1 (
pk1 int unsigned not NULL,
key1 int(11),
key2 int(11),
PRIMARY KEY (pk1),
KEY key1 (key1),
KEY key2 (key2)
-) engine=bdb;
+);
insert into t1 values (0, 1, 1),
(0xFFFFFFFF, 1, 1),
(0xFFFFFFFE, 1, 1),
@@ -44,14 +58,14 @@ select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
drop table t1;
# Case-insensitive char(N)
-create table t1 (
+create table t1 (
pk1 char(4) not NULL,
key1 int(11),
key2 int(11),
PRIMARY KEY (pk1),
KEY key1 (key1),
KEY key2 (key2)
-) engine=bdb collate latin2_general_ci;
+) collate latin2_general_ci;
insert into t1 values ('a1', 1, 1),
('b2', 1, 1),
('A3', 1, 1),
@@ -69,8 +83,8 @@ create table t1 (
PRIMARY KEY (pk1,pk2,pk3),
KEY key1 (key1),
KEY key2 (key2)
-) engine=bdb;
-insert into t1 values
+);
+insert into t1 values
(1, 'u', 'u', 1, 1),
(1, 'u', char(0xEC), 1, 1),
(1, 'u', 'x', 1, 1);
@@ -96,7 +110,7 @@ create table t1 (
primary key(pk1, pk2),
KEY key1 (key1),
KEY key2 (key2)
-) engine=bdb;
+);
insert into t1 values ('','empt',2,2),
('a','a--a',2,2),
('bb','b--b',2,2),
@@ -105,4 +119,3 @@ insert into t1 values ('','empt',2,2),
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
drop table t1;
-
diff --git a/mysql-test/include/rpl_multi_engine.inc b/mysql-test/include/rpl_multi_engine.inc
new file mode 100644
index 00000000000..f2c837ef90b
--- /dev/null
+++ b/mysql-test/include/rpl_multi_engine.inc
@@ -0,0 +1,16 @@
+connection master;
+INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14");
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+sync_slave_with_master;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+connection master;
+UPDATE t1 SET b1 = 0, t="2005-09-09" WHERE b1 = 1;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+sync_slave_with_master;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+connection master;
+DELETE FROM mysqltest1.t1 WHERE id = 42;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+sync_slave_with_master;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+connection master;
diff --git a/mysql-test/include/rpl_multi_engine3.inc b/mysql-test/include/rpl_multi_engine3.inc
new file mode 100644
index 00000000000..e1a80df336c
--- /dev/null
+++ b/mysql-test/include/rpl_multi_engine3.inc
@@ -0,0 +1,61 @@
+#############################################################
+# Author: JBM
+# Date: 2006-02-23
+# Purpose: To reuse through out test and make maint easier
+#############################################################
+connection master;
+--echo "--- Insert into t1 --" as "";
+
+--disable_query_log
+INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ',
+ 'Must make it bug free for the customer',
+ 654321.4321,15.21,0,1965,"1905-11-14");
+INSERT INTO t1 VALUES(2,1,'Testing MySQL databases is a cool ',
+ 'Must make it bug free for the customer',
+ 654321.4321,15.21,0,1965,"1965-11-14");
+INSERT INTO t1 VALUES(4,1,'Testing MySQL databases is a cool ',
+ 'Must make it bug free for the customer',
+ 654321.4321,15.21,0,1965,"1985-11-14");
+INSERT INTO t1 VALUES(142,1,'Testing MySQL databases is a cool ',
+ 'Must make it bug free for the customer',
+ 654321.4321,15.21,0,1965,"1995-11-14");
+INSERT INTO t1 VALUES(412,1,'Testing MySQL databases is a cool ',
+ 'Must make it bug free for the customer',
+ 654321.4321,15.21,0,1965,"2005-11-14");
+--enable_query_log
+
+--echo --- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+
+sync_slave_with_master;
+--echo --- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+
+connection master;
+
+--echo --- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+
+--echo --- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+
+# Must give injector thread a little time to get update
+# into the binlog other wise we will miss the update.
+
+sync_slave_with_master;
+--echo --- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+
+connection master;
+--echo --- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+
+--echo --- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+
+sync_slave_with_master;
+--echo --- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+
+connection master;
+DELETE FROM t1;
diff --git a/mysql-test/include/rpl_stmt_seq2.inc b/mysql-test/include/rpl_stmt_seq2.inc
new file mode 100644
index 00000000000..7671a6a857c
--- /dev/null
+++ b/mysql-test/include/rpl_stmt_seq2.inc
@@ -0,0 +1,201 @@
+# include/rpl_stmt_seq.inc
+#
+# Please be very careful when editing this routine, because the handling of
+# the $variables is extreme sensitive.
+#
+
+###############################################################
+# Debug options : To debug this test script
+###############################################################
+let $show_binlog= 0;
+let $manipulate= 1;
+
+######## The typical test sequence
+# 1. INSERT without commit
+# check table content of master and slave
+# 2. EXECUTE the statement
+# check table content of master and slave
+# 3. ROLLBACK
+# check table content of master and slave
+# 4. flush the logs
+
+let $VERSION=`select version()`;
+
+--disable_query_log
+# SELECT '######## new test sequence ########' as "";
+eval SELECT CONCAT('######## ','$my_stmt',' $engine_type',' ########') as "";
+--enable_query_log
+
+
+###############################################################
+# Predict the number of the current log
+###############################################################
+# Disable the logging of the log number computation.
+--disable_query_log
+# $_log_num_n should contain the number of the current binlog in numeric style.
+# If this routine is called for the first time, $_log_num will not initialized
+# and contain the value '' instead of '1'. So we will correct it here.
+#
+eval set @aux= IF('$_log_num_n' = '', '1', '$_log_num_n');
+let $_log_num_n= `SELECT @aux`;
+eval set @aux= LPAD('$_log_num_n',6,'0');
+# SELECT @aux AS "@aux is";
+#
+# $_log_num_s should contain the number of the current binlog in string style.
+let $_log_num_s= `select @aux`;
+# eval SELECT '$log_num' ;
+--enable_query_log
+
+###############################################################
+# INSERT
+###############################################################
+connection master;
+--disable_query_log
+SELECT '-------- switch to master -------' as "";
+--enable_query_log
+# Maybe it would be smarter to use a table with autoincrement column.
+let $MAX= `SELECT MAX(f1) FROM t1` ;
+eval INSERT INTO t1 SET f1= $MAX + 1;
+# results before DDL(to be tested)
+SELECT MAX(f1) FROM t1;
+if ($show_binlog)
+{
+--replace_result $VERSION VERSION
+--replace_column 2 # 5 #
+eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
+}
+sync_slave_with_master;
+
+connection slave;
+--disable_query_log
+SELECT '-------- switch to slave --------' as "";
+--enable_query_log
+# results before DDL(to be tested)
+SELECT MAX(f1) FROM t1;
+if ($show_binlog)
+{
+--replace_result $VERSION VERSION
+--replace_column 2 # 5 #
+eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
+}
+
+###############################################################
+# command to be tested
+###############################################################
+connection master;
+--disable_query_log
+SELECT '-------- switch to master -------' as "";
+--enable_query_log
+eval $my_stmt $engine_type;
+# Devaluate $my_stmt, to detect script bugs
+let $my_stmt= ERROR: YOU FORGOT TO FILL IN THE STATEMENT;
+# results after DDL(to be tested)
+SELECT MAX(f1) FROM t1;
+if ($show_binlog)
+{
+--replace_result $VERSION VERSION
+--replace_column 2 # 5 #
+eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
+}
+sync_slave_with_master;
+
+connection slave;
+--disable_query_log
+SELECT '-------- switch to slave --------' as "";
+--enable_query_log
+# results after DDL(to be tested)
+SELECT MAX(f1) FROM t1;
+if ($show_binlog)
+{
+--replace_result $VERSION VERSION
+--replace_column 2 # 5 #
+eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
+}
+
+###############################################################
+# ROLLBACK
+###############################################################
+connection master;
+--disable_query_log
+SELECT '-------- switch to master -------' as "";
+--enable_query_log
+ROLLBACK;
+# results after final ROLLBACK
+SELECT MAX(f1) FROM t1;
+# Try to detect if the DDL command caused that the INSERT is committed
+# $MAX holds the highest/last value just before the insert of MAX + 1
+--disable_query_log
+eval SELECT CONCAT(CONCAT('TEST-INFO: MASTER: The INSERT is ',
+ IF(MAX(f1) = $MAX + 1, 'committed', 'not committed')),
+ IF((MAX(f1) = $MAX + 1) XOR NOT $my_master_commit,
+ ' (Succeeded)',
+ ' (Failed)')) AS ""
+ FROM mysqltest1.t1;
+--enable_query_log
+if ($show_binlog)
+{
+--replace_result $VERSION VERSION
+--replace_column 2 # 5 #
+eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
+}
+sync_slave_with_master;
+
+connection slave;
+--disable_query_log
+SELECT '-------- switch to slave --------' as "";
+--enable_query_log
+# results after final ROLLBACK
+SELECT MAX(f1) FROM t1;
+--disable_query_log
+eval SELECT CONCAT(CONCAT('TEST-INFO: SLAVE: The INSERT is ',
+ IF(MAX(f1) = $MAX + 1, 'committed', 'not committed')),
+ IF((MAX(f1) = $MAX + 1) XOR NOT $my_slave_commit,
+ ' (Succeeded)',
+ ' (Failed)')) AS ""
+ FROM mysqltest1.t1;
+--enable_query_log
+if ($show_binlog)
+{
+--replace_result $VERSION VERSION
+--replace_column 2 # 5 #
+eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
+}
+
+###############################################################
+# Manipulate binlog
+###############################################################
+if ($manipulate)
+{
+#### Manipulate the binary logs,
+# so that the output of SHOW BINLOG EVENTS IN <current log>
+# contains only commands of the current test sequence.
+# - flush the master and the slave log
+# ---> both start to write into new logs with incremented number
+# - increment $_log_num_n
+connection master;
+--disable_query_log
+SELECT '-------- switch to master -------' as "";
+--enable_query_log
+flush logs;
+# sleep 1;
+# eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
+sync_slave_with_master;
+
+connection slave;
+--disable_query_log
+SELECT '-------- switch to slave --------' as "";
+--enable_query_log
+# the final content of the binary log
+flush logs;
+# The next sleep is urgent needed.
+# Without this sleep the slaves crashes often, when the SHOW BINLOG
+# is executed. :-(
+# sleep 1;
+# eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
+inc $_log_num_n;
+}
+
+connection master;
+--disable_query_log
+SELECT '-------- switch to master -------' as "";
+--enable_query_log
diff --git a/mysql-test/include/safe_set_to_maybe_ro_var.inc b/mysql-test/include/safe_set_to_maybe_ro_var.inc
new file mode 100644
index 00000000000..add7f2091b3
--- /dev/null
+++ b/mysql-test/include/safe_set_to_maybe_ro_var.inc
@@ -0,0 +1,23 @@
+# to mask out the error - never abort neither log in result file - in setting
+# to read-only variable.
+# It is assumed that the new value is equal to one the var was set to.
+# Such situation happens particularily with binlog_format that becomes read-only
+# with ndb default storage.
+#
+# when generate results always watch the file to find what is expected,
+# the SET query may fail
+
+# script accepts $maybe_ro_var the var name and $val4var the value
+
+### USAGE:
+### let $maybe_ro_var= ...
+### let $val4var= ...
+### include/safe_set_to_maybe_ro_var.inc
+
+--disable_result_log
+--disable_abort_on_error
+eval SET $maybe_ro_var = $val4var;
+--enable_abort_on_error
+--enable_result_log
+
+eval SELECT $maybe_ro_var;
diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc
new file mode 100644
index 00000000000..ae848d10687
--- /dev/null
+++ b/mysql-test/include/show_binlog_events.inc
@@ -0,0 +1,5 @@
+--let $binlog_start=102
+--replace_result $binlog_start <binlog_start>
+--replace_column 2 # 4 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
+--eval show binlog events from $binlog_start
diff --git a/mysql-test/include/system_db_struct.inc b/mysql-test/include/system_db_struct.inc
index c66590b2fd8..4c80161bb85 100644
--- a/mysql-test/include/system_db_struct.inc
+++ b/mysql-test/include/system_db_struct.inc
@@ -12,3 +12,6 @@ show create table tables_priv;
show create table columns_priv;
show create table procs_priv;
show create table proc;
+show create table event;
+show create table general_log;
+show create table slow_log;
diff --git a/mysql-test/include/unsafe_binlog.inc b/mysql-test/include/unsafe_binlog.inc
new file mode 100644
index 00000000000..6fbbdcb6d6c
--- /dev/null
+++ b/mysql-test/include/unsafe_binlog.inc
@@ -0,0 +1,265 @@
+# include/unsafe_binlog.inc
+#
+# The variable
+# $engine_type -- storage engine to be tested
+# has to be set before sourcing this script.
+#
+# Notes:
+# 1. This test uses at least in case of InnoDB options
+# innodb_locks_unsafe_for_binlog = true
+# innodb_lock_timeout = 5
+# 2. The comments/expectations refer to InnoDB.
+# They might be not valid for other storage engines.
+#
+# Last update:
+# 2006-08-02 ML test refactored
+# old name was innodb_unsafe_binlog.test
+# main code went into include/unsafe_binlog.inc
+#
+
+#
+# Test cases for bug#15650
+# DELETE with LEFT JOIN crashes server with innodb_locks_unsafe_for_binlog
+#
+
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+eval create table t1 (id int not null, f_id int not null, f int not null,
+primary key(f_id, id)) engine = $engine_type;
+eval create table t2 (id int not null,s_id int not null,s varchar(200),
+primary key(id)) engine = $engine_type;
+INSERT INTO t1 VALUES (8, 1, 3);
+INSERT INTO t1 VALUES (1, 2, 1);
+INSERT INTO t2 VALUES (1, 0, '');
+INSERT INTO t2 VALUES (8, 1, '');
+commit;
+DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id)
+WHERE mm.id IS NULL;
+select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
+where mm.id is null lock in share mode;
+drop table t1,t2;
+
+#
+# Test case for unlock row bug where unlock releases all locks granted for
+# a row. Only the latest lock should be released.
+#
+
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+eval create table t1(a int not null, b int, primary key(a)) engine = $engine_type;
+insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
+commit;
+set autocommit = 0;
+select * from t1 lock in share mode;
+update t1 set b = 5 where b = 1;
+connection b;
+set autocommit = 0;
+#
+# S-lock to records (2,2),(4,2), and (6,2) should not be released in a update
+#
+--error 1205
+select * from t1 where a = 2 and b = 2 for update;
+connection a;
+commit;
+connection b;
+commit;
+drop table t1;
+connection default;
+disconnect a;
+disconnect b;
+
+#
+# unlock row test
+#
+
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+eval create table t1(a int not null, b int, primary key(a)) engine = $engine_type;
+insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
+commit;
+set autocommit = 0;
+update t1 set b = 5 where b = 1;
+connection b;
+set autocommit = 0;
+#
+# X-lock to record (7,3) should be released in a update
+#
+select * from t1 where a = 7 and b = 3 for update;
+commit;
+connection a;
+commit;
+drop table t1;
+connection default;
+disconnect a;
+disconnect b;
+
+
+#
+# Consistent read should be used in following selects
+#
+# 1) INSERT INTO ... SELECT
+# 2) UPDATE ... = ( SELECT ...)
+# 3) CREATE ... SELECT
+
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+eval create table t1(a int not null, b int, primary key(a)) engine = $engine_type;
+insert into t1 values (1,2),(5,3),(4,2);
+eval create table t2(d int not null, e int, primary key(d)) engine = $engine_type;
+insert into t2 values (8,6),(12,1),(3,1);
+commit;
+set autocommit = 0;
+select * from t2 for update;
+connection b;
+set autocommit = 0;
+insert into t1 select * from t2;
+update t1 set b = (select e from t2 where a = d);
+eval create table t3(d int not null, e int, primary key(d)) engine = $engine_type
+select * from t2;
+commit;
+connection a;
+commit;
+connection default;
+disconnect a;
+disconnect b;
+drop table t1, t2, t3;
+
+#
+# Consistent read should not be used if
+#
+# (a) isolation level is serializable OR
+# (b) select ... lock in share mode OR
+# (c) select ... for update
+#
+# in following queries:
+#
+# 1) INSERT INTO ... SELECT
+# 2) UPDATE ... = ( SELECT ...)
+# 3) CREATE ... SELECT
+
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connect (c,localhost,root,,);
+connect (d,localhost,root,,);
+eval SET SESSION STORAGE_ENGINE = $engine_type;
+connect (e,localhost,root,,);
+connect (f,localhost,root,,);
+connect (g,localhost,root,,);
+eval SET SESSION STORAGE_ENGINE = $engine_type;
+connect (h,localhost,root,,);
+connect (i,localhost,root,,);
+connect (j,localhost,root,,);
+eval SET SESSION STORAGE_ENGINE = $engine_type;
+connection a;
+eval create table t1(a int not null, b int, primary key(a)) engine = $engine_type;
+insert into t1 values (1,2),(5,3),(4,2);
+eval create table t2(a int not null, b int, primary key(a)) engine = $engine_type;
+insert into t2 values (8,6),(12,1),(3,1);
+eval create table t3(d int not null, b int, primary key(d)) engine = $engine_type;
+insert into t3 values (8,6),(12,1),(3,1);
+eval create table t5(a int not null, b int, primary key(a)) engine = $engine_type;
+insert into t5 values (1,2),(5,3),(4,2);
+eval create table t6(d int not null, e int, primary key(d)) engine = $engine_type;
+insert into t6 values (8,6),(12,1),(3,1);
+eval create table t8(a int not null, b int, primary key(a)) engine = $engine_type;
+insert into t8 values (1,2),(5,3),(4,2);
+eval create table t9(d int not null, e int, primary key(d)) engine = $engine_type;
+insert into t9 values (8,6),(12,1),(3,1);
+commit;
+set autocommit = 0;
+select * from t2 for update;
+connection b;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+--send
+insert into t1 select * from t2;
+connection c;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+--send
+update t3 set b = (select b from t2 where a = d);
+connection d;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+--send
+create table t4(a int not null, b int, primary key(a)) select * from t2;
+connection e;
+set autocommit = 0;
+--send
+insert into t5 (select * from t2 lock in share mode);
+connection f;
+set autocommit = 0;
+--send
+update t6 set e = (select b from t2 where a = d lock in share mode);
+connection g;
+set autocommit = 0;
+--send
+create table t7(a int not null, b int, primary key(a)) select * from t2 lock in share mode;
+connection h;
+set autocommit = 0;
+--send
+insert into t8 (select * from t2 for update);
+connection i;
+set autocommit = 0;
+--send
+update t9 set e = (select b from t2 where a = d for update);
+connection j;
+set autocommit = 0;
+--send
+create table t10(a int not null, b int, primary key(a)) select * from t2 for update;
+
+connection b;
+--error 1205
+reap;
+
+connection c;
+--error 1205
+reap;
+
+connection d;
+--error 1205
+reap;
+
+connection e;
+--error 1205
+reap;
+
+connection f;
+--error 1205
+reap;
+
+connection g;
+--error 1205
+reap;
+
+connection h;
+--error 1205
+reap;
+
+connection i;
+--error 1205
+reap;
+
+connection j;
+--error 1205
+reap;
+
+connection a;
+commit;
+
+connection default;
+disconnect a;
+disconnect b;
+disconnect c;
+disconnect d;
+disconnect e;
+disconnect f;
+disconnect g;
+disconnect h;
+disconnect i;
+disconnect j;
+drop table t1, t2, t3, t5, t6, t8, t9;
diff --git a/mysql-test/include/wait_until_connected_again.inc b/mysql-test/include/wait_until_connected_again.inc
new file mode 100644
index 00000000000..dc96f646cb3
--- /dev/null
+++ b/mysql-test/include/wait_until_connected_again.inc
@@ -0,0 +1,20 @@
+#
+# Include this script to wait until the connection to the
+# server has been restored or timeout occurs
+--disable_result_log
+--disable_query_log
+let $counter= 500;
+while ($mysql_errno)
+{
+ --error 0,2002,2006
+ show status;
+
+ dec $counter;
+ if (!$counter)
+ {
+ --die Server failed to restart
+ }
+ --sleep 0.1
+}
+--enable_query_log
+--enable_result_log
diff --git a/mysql-test/include/wait_until_rows_count.inc b/mysql-test/include/wait_until_rows_count.inc
new file mode 100644
index 00000000000..cf2a21d335a
--- /dev/null
+++ b/mysql-test/include/wait_until_rows_count.inc
@@ -0,0 +1,52 @@
+# include/wait_until_rows_count.inc
+# inspired by wait_for_slave_status by Matthias Leich
+#
+# SUMMARY
+#
+# Waits until SELECT count(*)-$count from $table returns zero
+#
+# USAGE
+#
+# Set vars like
+# let $count=11;
+# let $table=t1;
+# # invoke the macro
+# --include wait_until_rows_count.inc
+#
+# EXAMPLE
+# extra/binlog/binlog_insert_delayed.test
+#
+#
+# TODO: generalize up to wait_[until|while] with arbitrary select or even query and
+# a condition to wait or get awakened
+# It's impossible to implement such a "most" general macro without
+# extending mysqltest. Just no way to pass a query as an argument and
+# evaluate it here, like eval "$quuery". One is bound
+# to specify it inside of the macro
+
+--disable_query_log
+
+let $wait_counter= 300; # max wait in 0.1 seconds
+while ($wait_counter)
+{
+ eval select count(*)-$count from $table into @rez;
+ let $rez=`select @rez`;
+ let $success=`SELECT @rez = 0`;
+ let $no_success=1;
+ if ($success)
+ {
+ let $wait_counter= 1; # droppping counter to leave loop
+ let $no_success=0;
+ }
+ if ($no_success)
+ {
+ --sleep 0.1
+ }
+ dec $wait_counter;
+}
+
+--enable_query_log
+if ($no_success)
+{
+ --die Timeout in wait_until_rows_count.inc, required table never had a prescribed number of rows.
+}
diff --git a/mysql-test/include/windows.inc b/mysql-test/include/windows.inc
index 05ec7b0e021..3d64efbafc7 100644
--- a/mysql-test/include/windows.inc
+++ b/mysql-test/include/windows.inc
@@ -1,4 +1,4 @@
---require r/true.require
+--require r/windows.require
disable_query_log;
select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") as "TRUE";
enable_query_log;
diff --git a/mysql-test/init_db.sql b/mysql-test/init_db.sql
deleted file mode 100644
index 63483af00d6..00000000000
--- a/mysql-test/init_db.sql
+++ /dev/null
@@ -1,58 +0,0 @@
-CREATE DATABASE mysql;
-CREATE DATABASE test;
-
-USE mysql;
-
-
-CREATE TABLE db (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,References_priv enum('N','Y') DEFAULT 'N' NOT NULL,Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,PRIMARY KEY Host (Host,Db,User),KEY User (User)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
-
-INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
-INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
-
-
-CREATE TABLE host (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,References_priv enum('N','Y') DEFAULT 'N' NOT NULL,Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,PRIMARY KEY Host (Host,Db)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges';
-
-CREATE TABLE user (Host char(60) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Password char(41) binary DEFAULT '' NOT NULL,Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,File_priv enum('N','Y') DEFAULT 'N' NOT NULL,Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,References_priv enum('N','Y') DEFAULT 'N' NOT NULL,Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL,Super_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL,Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL,Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL,ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL,ssl_cipher BLOB NOT NULL,x509_issuer BLOB NOT NULL,x509_subject BLOB NOT NULL,max_questions int(11) unsigned DEFAULT 0 NOT NULL,max_updates int(11) unsigned DEFAULT 0 NOT NULL,max_connections int(11) unsigned DEFAULT 0 NOT NULL,PRIMARY KEY Host (Host,User)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
-
-INSERT INTO user VALUES ('%','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
-INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
-INSERT INTO user VALUES ('%','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0);
-
-CREATE TABLE func (name char(64) binary DEFAULT '' NOT NULL,ret tinyint(1) DEFAULT '0' NOT NULL,dl char(128) DEFAULT '' NOT NULL,type enum ('function','aggregate') NOT NULL,PRIMARY KEY (name)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions';
-
-CREATE TABLE tables_priv (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Table_name char(64) binary DEFAULT '' NOT NULL,Grantor char(77) DEFAULT '' NOT NULL,Timestamp timestamp(14),Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL,Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,PRIMARY KEY (Host,Db,User,Table_name),KEY Grantor (Grantor)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
-
-CREATE TABLE columns_priv (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Table_name char(64) binary DEFAULT '' NOT NULL,Column_name char(64) binary DEFAULT '' NOT NULL,Timestamp timestamp(14),Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,PRIMARY KEY (Host,Db,User,Table_name,Column_name)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
-
-CREATE TABLE help_topic (help_topic_id int unsigned not null,name varchar(64) not null,help_category_id smallint unsigned not null,description text not null,example text not null,url varchar(128) not null,primary key (help_topic_id),unique index (name)) engine=MyISAM CHARACTER SET utf8 comment='help topics';
-
-CREATE TABLE help_category (help_category_id smallint unsigned not null,name varchar(64) not null,parent_category_id smallint unsigned null,url varchar(128) not null,primary key (help_category_id),unique index (name)) engine=MyISAM CHARACTER SET utf8 comment='help categories';
-
-CREATE TABLE help_keyword (help_keyword_id int unsigned not null,name varchar(64) not null,primary key (help_keyword_id),unique index (name)) engine=MyISAM CHARACTER SET utf8 comment='help keywords';
-
-CREATE TABLE help_relation (help_topic_id int unsigned not null references help_topic,help_keyword_id int unsigned not null references help_keyword,primary key (help_keyword_id, help_topic_id)) engine=MyISAM CHARACTER SET utf8 comment='keyword-topic relation';
-
-CREATE TABLE time_zone_name (Name char(64) NOT NULL,Time_zone_id int unsigned NOT NULL,PRIMARY KEY Name (Name)) engine=MyISAM CHARACTER SET utf8 comment='Time zone names';
-
-INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES ('MET', 1), ('UTC', 2), ('Universal', 2), ('Europe/Moscow',3), ('leap/Europe/Moscow',4), ('Japan', 5);
-
-
-CREATE TABLE time_zone (Time_zone_id int unsigned NOT NULL auto_increment,Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL,PRIMARY KEY TzId (Time_zone_id)) engine=MyISAM CHARACTER SET utf8 comment='Time zones';
-
-INSERT INTO time_zone (Time_zone_id, Use_leap_seconds) VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y'), (5,'N');
-
-
-CREATE TABLE time_zone_transition (Time_zone_id int unsigned NOT NULL,Transition_time bigint signed NOT NULL,Transition_type_id int unsigned NOT NULL,PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions';
-
-INSERT INTO time_zone_transition (Time_zone_id, Transition_time, Transition_type_id) VALUES (1, -1693706400, 0) ,(1, -1680483600, 1),(1, -1663455600, 2) ,(1, -1650150000, 3),(1, -1632006000, 2) ,(1, -1618700400, 3),(1, -938905200, 2) ,(1, -857257200, 3),(1, -844556400, 2) ,(1, -828226800, 3),(1, -812502000, 2) ,(1, -796777200, 3),(1, 228877200, 2) ,(1, 243997200, 3),(1, 260326800, 2) ,(1, 276051600, 3),(1, 291776400, 2) ,(1, 307501200, 3),(1, 323830800, 2) ,(1, 338950800, 3),(1, 354675600, 2) ,(1, 370400400, 3),(1, 386125200, 2) ,(1, 401850000, 3),(1, 417574800, 2) ,(1, 433299600, 3),(1, 449024400, 2) ,(1, 465354000, 3),(1, 481078800, 2) ,(1, 496803600, 3),(1, 512528400, 2) ,(1, 528253200, 3),(1, 543978000, 2) ,(1, 559702800, 3),(1, 575427600, 2) ,(1, 591152400, 3),(1, 606877200, 2) ,(1, 622602000, 3),(1, 638326800, 2) ,(1, 654656400, 3),(1, 670381200, 2) ,(1, 686106000, 3),(1, 701830800, 2) ,(1, 717555600, 3),(1, 733280400, 2) ,(1, 749005200, 3),(1, 764730000, 2) ,(1, 780454800, 3),(1, 796179600, 2) ,(1, 811904400, 3),(1, 828234000, 2) ,(1, 846378000, 3),(1, 859683600, 2) ,(1, 877827600, 3),(1, 891133200, 2) ,(1, 909277200, 3),(1, 922582800, 2) ,(1, 941331600, 3),(1, 954032400, 2) ,(1, 972781200, 3),(1, 985482000, 2) ,(1, 1004230800, 3),(1, 1017536400, 2) ,(1, 1035680400, 3),(1, 1048986000, 2) ,(1, 1067130000, 3),(1, 1080435600, 2) ,(1, 1099184400, 3),(1, 1111885200, 2) ,(1, 1130634000, 3),(1, 1143334800, 2) ,(1, 1162083600, 3),(1, 1174784400, 2) ,(1, 1193533200, 3),(1, 1206838800, 2) ,(1, 1224982800, 3),(1, 1238288400, 2) ,(1, 1256432400, 3),(1, 1269738000, 2) ,(1, 1288486800, 3),(1, 1301187600, 2) ,(1, 1319936400, 3),(1, 1332637200, 2) ,(1, 1351386000, 3),(1, 1364691600, 2) ,(1, 1382835600, 3),(1, 1396141200, 2) ,(1, 1414285200, 3),(1, 1427590800, 2) ,(1, 1445734800, 3),(1, 1459040400, 2) ,(1, 1477789200, 3),(1, 1490490000, 2) ,(1, 1509238800, 3),(1, 1521939600, 2) ,(1, 1540688400, 3),(1, 1553994000, 2) ,(1, 1572138000, 3),(1, 1585443600, 2) ,(1, 1603587600, 3),(1, 1616893200, 2) ,(1, 1635642000, 3),(1, 1648342800, 2) ,(1, 1667091600, 3),(1, 1679792400, 2) ,(1, 1698541200, 3),(1, 1711846800, 2) ,(1, 1729990800, 3),(1, 1743296400, 2) ,(1, 1761440400, 3),(1, 1774746000, 2) ,(1, 1792890000, 3),(1, 1806195600, 2) ,(1, 1824944400, 3),(1, 1837645200, 2) ,(1, 1856394000, 3),(1, 1869094800, 2) ,(1, 1887843600, 3),(1, 1901149200, 2) ,(1, 1919293200, 3),(1, 1932598800, 2) ,(1, 1950742800, 3),(1, 1964048400, 2) ,(1, 1982797200, 3),(1, 1995498000, 2) ,(1, 2014246800, 3),(1, 2026947600, 2) ,(1, 2045696400, 3),(1, 2058397200, 2) ,(1, 2077146000, 3),(1, 2090451600, 2) ,(1, 2108595600, 3),(1, 2121901200, 2) ,(1, 2140045200, 3),(3, -1688265000, 2) ,(3, -1656819048, 1),(3, -1641353448, 2) ,(3, -1627965048, 3),(3, -1618716648, 1) ,(3, -1596429048, 3),(3, -1593829848, 5) ,(3, -1589860800, 4),(3, -1542427200, 5) ,(3, -1539493200, 6),(3, -1525323600, 5) ,(3, -1522728000, 4),(3, -1491188400, 7) ,(3, -1247536800, 4),(3, 354920400, 5) ,(3, 370728000, 4),(3, 386456400, 5) ,(3, 402264000, 4),(3, 417992400, 5) ,(3, 433800000, 4),(3, 449614800, 5) ,(3, 465346800, 8),(3, 481071600, 9) ,(3, 496796400, 8),(3, 512521200, 9) ,(3, 528246000, 8),(3, 543970800, 9) ,(3, 559695600, 8),(3, 575420400, 9) ,(3, 591145200, 8),(3, 606870000, 9) ,(3, 622594800, 8),(3, 638319600, 9) ,(3, 654649200, 8),(3, 670374000, 10) ,(3, 686102400, 11),(3, 695779200, 8) ,(3, 701812800, 5),(3, 717534000, 4) ,(3, 733273200, 9),(3, 748998000, 8) ,(3, 764722800, 9),(3, 780447600, 8) ,(3, 796172400, 9),(3, 811897200, 8) ,(3, 828226800, 9),(3, 846370800, 8) ,(3, 859676400, 9),(3, 877820400, 8) ,(3, 891126000, 9),(3, 909270000, 8) ,(3, 922575600, 9),(3, 941324400, 8) ,(3, 954025200, 9),(3, 972774000, 8) ,(3, 985474800, 9),(3, 1004223600, 8) ,(3, 1017529200, 9),(3, 1035673200, 8) ,(3, 1048978800, 9),(3, 1067122800, 8) ,(3, 1080428400, 9),(3, 1099177200, 8) ,(3, 1111878000, 9),(3, 1130626800, 8) ,(3, 1143327600, 9),(3, 1162076400, 8) ,(3, 1174777200, 9),(3, 1193526000, 8) ,(3, 1206831600, 9),(3, 1224975600, 8) ,(3, 1238281200, 9),(3, 1256425200, 8) ,(3, 1269730800, 9),(3, 1288479600, 8) ,(3, 1301180400, 9),(3, 1319929200, 8) ,(3, 1332630000, 9),(3, 1351378800, 8) ,(3, 1364684400, 9),(3, 1382828400, 8) ,(3, 1396134000, 9),(3, 1414278000, 8) ,(3, 1427583600, 9),(3, 1445727600, 8) ,(3, 1459033200, 9),(3, 1477782000, 8) ,(3, 1490482800, 9),(3, 1509231600, 8) ,(3, 1521932400, 9),(3, 1540681200, 8) ,(3, 1553986800, 9),(3, 1572130800, 8) ,(3, 1585436400, 9),(3, 1603580400, 8) ,(3, 1616886000, 9),(3, 1635634800, 8) ,(3, 1648335600, 9),(3, 1667084400, 8) ,(3, 1679785200, 9),(3, 1698534000, 8) ,(3, 1711839600, 9),(3, 1729983600, 8) ,(3, 1743289200, 9),(3, 1761433200, 8) ,(3, 1774738800, 9),(3, 1792882800, 8) ,(3, 1806188400, 9),(3, 1824937200, 8) ,(3, 1837638000, 9),(3, 1856386800, 8) ,(3, 1869087600, 9),(3, 1887836400, 8) ,(3, 1901142000, 9),(3, 1919286000, 8) ,(3, 1932591600, 9),(3, 1950735600, 8) ,(3, 1964041200, 9),(3, 1982790000, 8) ,(3, 1995490800, 9),(3, 2014239600, 8) ,(3, 2026940400, 9),(3, 2045689200, 8) ,(3, 2058390000, 9),(3, 2077138800, 8) ,(3, 2090444400, 9),(3, 2108588400, 8) ,(3, 2121894000, 9),(3, 2140038000, 8),(4, -1688265000, 2) ,(4, -1656819048, 1),(4, -1641353448, 2) ,(4, -1627965048, 3),(4, -1618716648, 1) ,(4, -1596429048, 3),(4, -1593829848, 5) ,(4, -1589860800, 4),(4, -1542427200, 5) ,(4, -1539493200, 6),(4, -1525323600, 5) ,(4, -1522728000, 4),(4, -1491188400, 7) ,(4, -1247536800, 4),(4, 354920409, 5) ,(4, 370728010, 4),(4, 386456410, 5) ,(4, 402264011, 4),(4, 417992411, 5) ,(4, 433800012, 4),(4, 449614812, 5) ,(4, 465346812, 8),(4, 481071612, 9) ,(4, 496796413, 8),(4, 512521213, 9) ,(4, 528246013, 8),(4, 543970813, 9) ,(4, 559695613, 8),(4, 575420414, 9) ,(4, 591145214, 8),(4, 606870014, 9) ,(4, 622594814, 8),(4, 638319615, 9) ,(4, 654649215, 8),(4, 670374016, 10) ,(4, 686102416, 11),(4, 695779216, 8) ,(4, 701812816, 5),(4, 717534017, 4) ,(4, 733273217, 9),(4, 748998018, 8) ,(4, 764722818, 9),(4, 780447619, 8) ,(4, 796172419, 9),(4, 811897219, 8) ,(4, 828226820, 9),(4, 846370820, 8) ,(4, 859676420, 9),(4, 877820421, 8) ,(4, 891126021, 9),(4, 909270021, 8) ,(4, 922575622, 9),(4, 941324422, 8) ,(4, 954025222, 9),(4, 972774022, 8) ,(4, 985474822, 9),(4, 1004223622, 8) ,(4, 1017529222, 9),(4, 1035673222, 8) ,(4, 1048978822, 9),(4, 1067122822, 8) ,(4, 1080428422, 9),(4, 1099177222, 8) ,(4, 1111878022, 9),(4, 1130626822, 8) ,(4, 1143327622, 9),(4, 1162076422, 8) ,(4, 1174777222, 9),(4, 1193526022, 8) ,(4, 1206831622, 9),(4, 1224975622, 8) ,(4, 1238281222, 9),(4, 1256425222, 8) ,(4, 1269730822, 9),(4, 1288479622, 8) ,(4, 1301180422, 9),(4, 1319929222, 8) ,(4, 1332630022, 9),(4, 1351378822, 8) ,(4, 1364684422, 9),(4, 1382828422, 8) ,(4, 1396134022, 9),(4, 1414278022, 8) ,(4, 1427583622, 9),(4, 1445727622, 8) ,(4, 1459033222, 9),(4, 1477782022, 8) ,(4, 1490482822, 9),(4, 1509231622, 8) ,(4, 1521932422, 9),(4, 1540681222, 8) ,(4, 1553986822, 9),(4, 1572130822, 8) ,(4, 1585436422, 9),(4, 1603580422, 8) ,(4, 1616886022, 9),(4, 1635634822, 8) ,(4, 1648335622, 9),(4, 1667084422, 8) ,(4, 1679785222, 9),(4, 1698534022, 8) ,(4, 1711839622, 9),(4, 1729983622, 8) ,(4, 1743289222, 9),(4, 1761433222, 8) ,(4, 1774738822, 9),(4, 1792882822, 8) ,(4, 1806188422, 9),(4, 1824937222, 8) ,(4, 1837638022, 9),(4, 1856386822, 8) ,(4, 1869087622, 9),(4, 1887836422, 8) ,(4, 1901142022, 9),(4, 1919286022, 8) ,(4, 1932591622, 9),(4, 1950735622, 8) ,(4, 1964041222, 9),(4, 1982790022, 8) ,(4, 1995490822, 9),(4, 2014239622, 8) ,(4, 2026940422, 9),(4, 2045689222, 8) ,(4, 2058390022, 9),(4, 2077138822, 8) ,(4, 2090444422, 9),(4, 2108588422, 8) ,(4, 2121894022, 9),(4, 2140038022, 8);
-
-
-CREATE TABLE time_zone_transition_type (Time_zone_id int unsigned NOT NULL,Transition_type_id int unsigned NOT NULL,Offset int signed DEFAULT 0 NOT NULL,Is_DST tinyint unsigned DEFAULT 0 NOT NULL,Abbreviation char(8) DEFAULT '' NOT NULL,PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types';
-
-INSERT INTO time_zone_transition_type (Time_zone_id,Transition_type_id, Offset, Is_DST, Abbreviation) VALUES (1, 0, 7200, 1, 'MEST') ,(1, 1, 3600, 0, 'MET') ,(1, 2, 7200, 1, 'MEST') ,(1, 3, 3600, 0, 'MET') ,(2, 0, 0, 0, 'UTC') ,(3, 0, 9000, 0, 'MMT') ,(3, 1, 12648, 1, 'MST') ,(3, 2, 9048, 0, 'MMT') ,(3, 3, 16248, 1, 'MDST') ,(3, 4, 10800, 0, 'MSK') ,(3, 5, 14400, 1, 'MSD') ,(3, 6, 18000, 1, 'MSD') ,(3, 7, 7200, 0, 'EET') ,(3, 8, 10800, 0, 'MSK') ,(3, 9, 14400, 1, 'MSD') ,(3, 10, 10800, 1, 'EEST') ,(3, 11, 7200, 0, 'EET') ,(4, 0, 9000, 0, 'MMT') ,(4, 1, 12648, 1, 'MST') ,(4, 2, 9048, 0, 'MMT') ,(4, 3, 16248, 1, 'MDST') ,(4, 4, 10800, 0, 'MSK') ,(4, 5, 14400, 1, 'MSD') ,(4, 6, 18000, 1, 'MSD') ,(4, 7, 7200, 0, 'EET') ,(4, 8, 10800, 0, 'MSK') ,(4, 9, 14400, 1, 'MSD') ,(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET') ,(5, 0, 32400, 0, 'CJT') ,(5, 1, 32400, 0, 'JST');
-
-CREATE TABLE time_zone_leap_second (Transition_time bigint signed NOT NULL,Correction int signed NOT NULL,PRIMARY KEY TranTime (Transition_time)) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones';
-
-INSERT INTO time_zone_leap_second (Transition_time, Correction) VALUES (78796800, 1) ,(94694401, 2) ,(126230402, 3) ,(157766403, 4) ,(189302404, 5) ,(220924805, 6) ,(252460806, 7) ,(283996807, 8) ,(315532808, 9) ,(362793609, 10) ,(394329610, 11) ,(425865611, 12) ,(489024012, 13) ,(567993613, 14) ,(631152014, 15) ,(662688015, 16) ,(709948816, 17) ,(741484817, 18) ,(773020818, 19) ,(820454419, 20) ,(867715220, 21) ,(915148821, 22);
-
-
diff --git a/mysql-test/install_test_db.sh b/mysql-test/install_test_db.sh
index 4554b92857e..d7c19438836 100644
--- a/mysql-test/install_test_db.sh
+++ b/mysql-test/install_test_db.sh
@@ -34,7 +34,6 @@ if [ x$1 = x"-slave" ]
then
shift 1
data=var/slave-data
- ldata=$fix_bin/var/slave-data
else
if [ x$1 = x"-1" ]
then
@@ -42,8 +41,8 @@ else
else
data=var/master-data
fi
- ldata=$fix_bin/$data
fi
+ldata=$fix_bin/$data
mdata=$data/mysql
EXTRA_ARG=""
@@ -81,9 +80,7 @@ basedir=.
EXTRA_ARG="--language=../sql/share/english/ --character-sets-dir=../sql/share/charsets/"
fi
-mysqld_boot=" $execdir/mysqld --no-defaults --bootstrap --skip-grant-tables \
- --basedir=$basedir --datadir=$ldata --skip-innodb --skip-ndbcluster --skip-bdb \
- $EXTRA_ARG"
+mysqld_boot=" $execdir/mysqld --no-defaults --bootstrap --skip-grant-tables --basedir=$basedir --datadir=$ldata --skip-innodb --skip-ndbcluster --tmpdir=. $EXTRA_ARG"
echo "running $mysqld_boot"
if $scriptdir/mysql_create_system_tables test $mdata $hostname | $mysqld_boot
diff --git a/mysql-test/lib/init_db.sql b/mysql-test/lib/init_db.sql
index fd7b035e038..a5736ed4b9b 100644
--- a/mysql-test/lib/init_db.sql
+++ b/mysql-test/lib/init_db.sql
@@ -22,6 +22,8 @@ CREATE TABLE db (
Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
PRIMARY KEY Host (Host,Db,User),
KEY User (User)
) engine=MyISAM
@@ -29,8 +31,8 @@ CHARACTER SET utf8 COLLATE utf8_bin
comment='Database privileges';
-INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N');
-INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N');
+INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y');
+INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y');
CREATE TABLE host (
@@ -53,6 +55,7 @@ CREATE TABLE host (
Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
PRIMARY KEY Host (Host,Db)
) engine=MyISAM
CHARACTER SET utf8 COLLATE utf8_bin
@@ -89,6 +92,8 @@ CREATE TABLE user (
Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
+ Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
ssl_cipher BLOB NOT NULL,
x509_issuer BLOB NOT NULL,
@@ -103,9 +108,9 @@ CHARACTER SET utf8 COLLATE utf8_bin
comment='Users and global privileges';
-INSERT INTO user VALUES ('localhost' ,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
-INSERT INTO user VALUES ('@HOSTNAME@%' ,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
-REPLACE INTO user VALUES ('127.0.0.1' ,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
+INSERT INTO user VALUES ('localhost' ,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
+INSERT INTO user VALUES ('@HOSTNAME@%' ,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
+REPLACE INTO user VALUES ('127.0.0.1' ,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
INSERT INTO user (host,user) VALUES ('localhost','');
INSERT INTO user (host,user) VALUES ('@HOSTNAME@%','');
@@ -121,6 +126,15 @@ CHARACTER SET utf8 COLLATE utf8_bin
comment='User defined functions';
+CREATE TABLE plugin (
+ name char(64) binary DEFAULT '' NOT NULL,
+ dl char(128) DEFAULT '' NOT NULL,
+ PRIMARY KEY (name)
+) engine=MyISAM
+CHARACTER SET utf8 COLLATE utf8_bin
+comment='MySQL plugins';
+
+
CREATE TABLE tables_priv (
Host char(60) binary DEFAULT '' NOT NULL,
Db char(64) binary DEFAULT '' NOT NULL,
@@ -128,7 +142,7 @@ CREATE TABLE tables_priv (
Table_name char(64) binary DEFAULT '' NOT NULL,
Grantor char(77) DEFAULT '' NOT NULL,
Timestamp timestamp(14),
- Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
+ Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
PRIMARY KEY (Host,Db,User,Table_name),KEY Grantor (Grantor)
) engine=MyISAM
@@ -557,3 +571,68 @@ CREATE TABLE proc (
comment char(64) collate utf8_bin DEFAULT '' NOT NULL,
PRIMARY KEY (db,name,type)
) character set utf8 comment='Stored Procedures';
+
+
+CREATE PROCEDURE create_log_tables() BEGIN DECLARE is_csv_enabled int DEFAULT 0; SELECT @@have_csv = 'YES' INTO is_csv_enabled; IF (is_csv_enabled) THEN CREATE TABLE general_log (event_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT, thread_id INTEGER, server_id INTEGER, command_type VARCHAR(64), argument MEDIUMTEXT) engine=CSV CHARACTER SET utf8 comment='General log'; CREATE TABLE slow_log (start_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, query_time TIME NOT NULL, lock_time TIME NOT NULL, rows_sent INTEGER NOT NULL, rows_examined INTEGER NOT NULL, db VARCHAR(512), last_insert_id INTEGER, insert_id INTEGER, server_id INTEGER, sql_text MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment='Slow log'; END IF; END;
+CALL create_log_tables();
+DROP PROCEDURE create_log_tables;
+
+CREATE TABLE event (
+ db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '',
+ name char(64) CHARACTER SET utf8 NOT NULL default '',
+ body longblob NOT NULL,
+ definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '',
+ execute_at DATETIME default NULL,
+ interval_value int(11) default NULL,
+ interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK',
+ 'SECOND','MICROSECOND', 'YEAR_MONTH','DAY_HOUR',
+ 'DAY_MINUTE','DAY_SECOND',
+ 'HOUR_MINUTE','HOUR_SECOND',
+ 'MINUTE_SECOND','DAY_MICROSECOND',
+ 'HOUR_MICROSECOND','MINUTE_MICROSECOND',
+ 'SECOND_MICROSECOND') default NULL,
+ created TIMESTAMP NOT NULL,
+ modified TIMESTAMP NOT NULL,
+ last_executed DATETIME default NULL,
+ starts DATETIME default NULL,
+ ends DATETIME default NULL,
+ status ENUM('ENABLED','DISABLED') NOT NULL default 'ENABLED',
+ on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP',
+ sql_mode set(
+ 'REAL_AS_FLOAT',
+ 'PIPES_AS_CONCAT',
+ 'ANSI_QUOTES',
+ 'IGNORE_SPACE',
+ 'NOT_USED',
+ 'ONLY_FULL_GROUP_BY',
+ 'NO_UNSIGNED_SUBTRACTION',
+ 'NO_DIR_IN_CREATE',
+ 'POSTGRESQL',
+ 'ORACLE',
+ 'MSSQL',
+ 'DB2',
+ 'MAXDB',
+ 'NO_KEY_OPTIONS',
+ 'NO_TABLE_OPTIONS',
+ 'NO_FIELD_OPTIONS',
+ 'MYSQL323',
+ 'MYSQL40',
+ 'ANSI',
+ 'NO_AUTO_VALUE_ON_ZERO',
+ 'NO_BACKSLASH_ESCAPES',
+ 'STRICT_TRANS_TABLES',
+ 'STRICT_ALL_TABLES',
+ 'NO_ZERO_IN_DATE',
+ 'NO_ZERO_DATE',
+ 'INVALID_DATES',
+ 'ERROR_FOR_DIVISION_BY_ZERO',
+ 'TRADITIONAL',
+ 'NO_AUTO_CREATE_USER',
+ 'HIGH_NOT_PRECEDENCE'
+ ) DEFAULT '' NOT NULL,
+ comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '',
+ PRIMARY KEY (db, name)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
+
+CREATE DATABASE IF NOT EXISTS cluster;
+CREATE TABLE IF NOT EXISTS cluster.binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM;
diff --git a/mysql-test/my_create_tables.c b/mysql-test/my_create_tables.c
deleted file mode 100644
index 06a6fabf022..00000000000
--- a/mysql-test/my_create_tables.c
+++ /dev/null
@@ -1,673 +0,0 @@
-#include <stdio.h>
-#include <errno.h>
-#ifndef __WIN__
-#include <dirent.h>
-#endif
-#include <string.h>
-#ifdef __NETWARE__
-#include <screen.h>
-#include <proc.h>
-#else
-#include <sys/types.h>
-#ifndef __WIN__
-#include <sys/wait.h>
-#include <unistd.h>
-#else
-#include <direct.h>
-#include <stdlib.h>
-#include <stdio.h>
-#endif
-#endif
-#include <ctype.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <assert.h>
-#include "my_manage.h"
-
-/*
- Synopsis:
- This function testes a exist file
-
-Arguments:
- mdata: path to data
- file_name: name of file
-Output:
- A zero value indicates that file is exist.
-*/
-bool test_sys_file(const char *mdata,const char *file_name)
-{
- struct stat file;
- char path_file_name[PATH_MAX];
- snprintf(path_file_name, PATH_MAX, "%s/%s", mdata, file_name);
- return(stat(path_file_name,&file));
-}
-
-/*
- Synopsis:
- This function creates a file with sql requstes for creating
- system data files.
-
-Arguments:
- mdata: path to data
- output_file: file name for output file
- test: to create system files with test data
-Output:
- A zero value indicates a success.
-*/
-bool create_system_files(const char *mdata,const char *output_file, bool test)
-{
- FILE *out;
-
- out = fopen(output_file, "w+");
-
- if (!out)
- return 1;
-
- if (test_sys_file(mdata,"mysql"))
- {
- fprintf(out,"CREATE DATABASE mysql;\n");
- }
-
- if (test && test_sys_file(mdata,"test"))
- {
- fprintf(out,"CREATE DATABASE test;\n");
- }
-
- fprintf(out,"USE mysql;\n");
-
- if (test_sys_file(mdata,"mysql/db.frm"))
- {
- fprintf(out,
- "CREATE TABLE db ("
- "Host char(60) binary DEFAULT '' NOT NULL,"
- "Db char(64) binary DEFAULT '' NOT NULL,"
- "User char(16) binary DEFAULT '' NOT NULL,"
- "Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "PRIMARY KEY Host (Host,Db,User),"
- "KEY User (User))"
- "engine=MyISAM "
- "CHARACTER SET utf8 COLLATE utf8_bin "
- "comment='Database privileges';\n");
-
- if (test)
- {
- fprintf(out,"INSERT INTO db VALUES ('%%','test','','Y','Y','Y','Y'"
- ",'Y','Y','N','Y','Y','Y','Y','Y');\n");
- fprintf(out,"INSERT INTO db VALUES ('%%','test\\_%%','','Y','Y','Y'"
- ",'Y','Y','Y','N','Y','Y','Y','Y','Y');\n");
- }
- }
-
- if (test_sys_file(mdata,"mysql/host.frm"))
- {
- fprintf(out,
- "CREATE TABLE host ("
- "Host char(60) binary DEFAULT '' NOT NULL,"
- "Db char(64) binary DEFAULT '' NOT NULL,"
- "Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "PRIMARY KEY Host (Host,Db))"
- "engine=MyISAM "
- "CHARACTER SET utf8 COLLATE utf8_bin "
- "comment='Host privileges; Merged with database privileges';\n");
- }
-
-
- if (test_sys_file(mdata,"mysql/user.frm"))
- {
-#ifdef __WIN__
- WSADATA wsa_data;
-#endif
- char hostname[FN_REFLEN];
-
-#ifdef __WIN__
- if (WSAStartup(MAKEWORD( 2, 2 ),&wsa_data))
- return 1;
-#endif
- if (gethostname(hostname, FN_REFLEN))
- return 1;
-#ifdef __WIN__
- WSACleanup( );
-#endif
-
- if (strchr(hostname, '.') == NULL)
- strcat(hostname, "%");
-
- fprintf(out,
- "CREATE TABLE user ("
- "Host char(60) binary DEFAULT '' NOT NULL,"
- "User char(16) binary DEFAULT '' NOT NULL,"
- "Password char(41) binary DEFAULT '' NOT NULL,"
- "Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "File_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Super_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- "ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL,"
- "ssl_cipher BLOB NOT NULL,"
- "x509_issuer BLOB NOT NULL,"
- "x509_subject BLOB NOT NULL,"
- "max_questions int(11) unsigned DEFAULT 0 NOT NULL,"
- "max_updates int(11) unsigned DEFAULT 0 NOT NULL,"
- "max_connections int(11) unsigned DEFAULT 0 NOT NULL,"
- "PRIMARY KEY Host (Host,User)"
- ") engine=MyISAM "
- "CHARACTER SET utf8 COLLATE utf8_bin "
- "comment='Users and global privileges';\n");
-
-
- if (test)
- {
- fprintf(out,
- "INSERT INTO user VALUES ('localhost','root',''"
- ",'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'"
- ",'Y','Y','Y','Y','Y','','','','',0,0,0);\n");
- fprintf(out,
- "INSERT INTO user VALUES ('%s','root','','Y','Y',"
- "'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y',"
- "'Y','Y','Y','Y','','','','',0,0,0);\n",hostname);
- fprintf(out,
- "REPLACE INTO user VALUES ('127.0.0.1','root','',"
- "'Y','Y','Y','Y','Y','Y',"
- "'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'"
- ",'Y','','','','',0,0,0);\n");
- fprintf(out,"INSERT INTO user (host,user) values ('localhost','');\n");
- fprintf(out,"INSERT INTO user (host,user) values ('%s','');\n",hostname);
- }
- else
- {
- fprintf(out,
- "INSERT INTO user VALUES ('localhost','root','',"
- "'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y',"
- "'Y','Y','Y','Y','','','','',0,0,0);\n");
-#ifndef __WIN__
- fprintf(out,
- "INSERT INTO user VALUES ('%s','root','','Y','Y',"
- "'Y','Y','Y','Y','Y','Y'"
- "'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','',''"
- ",'','',0,0,0);\n",hostname);
- fprintf(out,"INSERT INTO user (host,user) values ('%s','');\n",hostname);
- fprintf(out,"INSERT INTO user (host,user) values ('localhost','');\n");
-#else
- fprintf(out,
- "INSERT INTO user VALUES ('localhost','','','Y','Y','Y'"
- ",'Y','Y','Y','Y','Y','Y'"
- ",'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','',"
- "'','',0,0,0);\n");
-#endif
- }
- }
-
-
- if (test_sys_file(mdata,"mysql/func.frm"))
- {
- fprintf(out,
- "CREATE TABLE func ("
- "name char(64) binary DEFAULT '' NOT NULL,"
- "ret tinyint(1) DEFAULT '0' NOT NULL,"
- "dl char(128) DEFAULT '' NOT NULL,"
- "type enum ('function','aggregate') NOT NULL,"
- "PRIMARY KEY (name)"
- ") engine=MyISAM "
- "CHARACTER SET utf8 COLLATE utf8_bin "
- "comment='User defined functions';\n");
- }
-
- if (test_sys_file(mdata,"mysql/tables_priv.frm"))
- {
- fprintf(out,
- "CREATE TABLE tables_priv ("
- "Host char(60) binary DEFAULT '' NOT NULL,"
- "Db char(64) binary DEFAULT '' NOT NULL,"
- "User char(16) binary DEFAULT '' NOT NULL,"
- "Table_name char(64) binary DEFAULT '' NOT NULL,"
- "Grantor char(77) DEFAULT '' NOT NULL,"
- "Timestamp timestamp(14),"
- "Table_priv set('Select','Insert','Update','Delete',"
- "'Create','Drop','Grant','References','Index','Alter')"
- " DEFAULT '' NOT NULL,"
- "Column_priv set('Select','Insert','Update','References')"
- " DEFAULT '' NOT NULL,"
- "PRIMARY KEY (Host,Db,User,Table_name),"
- "KEY Grantor (Grantor)"
- ") engine=MyISAM "
- "CHARACTER SET utf8 COLLATE utf8_bin "
- "comment='Table privileges';\n");
- }
-
- if (test_sys_file(mdata,"mysql/columns_priv.frm"))
- {
- fprintf(out,
- "CREATE TABLE columns_priv ("
- "Host char(60) binary DEFAULT '' NOT NULL,"
- "Db char(64) binary DEFAULT '' NOT NULL,"
- "User char(16) binary DEFAULT '' NOT NULL,"
- "Table_name char(64) binary DEFAULT '' NOT NULL,"
- "Column_name char(64) binary DEFAULT '' NOT NULL,"
- "Timestamp timestamp(14),"
- "Column_priv set('Select','Insert','Update','References')"
- " DEFAULT '' NOT NULL,"
- "PRIMARY KEY (Host,Db,User,Table_name,Column_name)"
- ") engine=MyISAM "
- "CHARACTER SET utf8 COLLATE utf8_bin "
- "comment='Column privileges';\n");
- }
-
- if (test_sys_file(mdata,"mysql/help_topic.frm"))
- {
- fprintf(out,
- "CREATE TABLE help_topic ("
- "help_topic_id int unsigned not null,"
- "name varchar(64) not null,"
- "help_category_id smallint unsigned not null,"
- "description text not null,"
- "example text not null,"
- "url varchar(128) not null,"
- "primary key (help_topic_id),"
- "unique index (name)"
- ") engine=MyISAM "
- "CHARACTER SET utf8 "
- "comment='help topics';\n");
- }
-
- if (test_sys_file(mdata,"mysql/help_category.frm"))
- {
- fprintf(out,
- "CREATE TABLE help_category ("
- "help_category_id smallint unsigned not null,"
- "name varchar(64) not null,"
- "parent_category_id smallint unsigned null,"
- "url varchar(128) not null,"
- "primary key (help_category_id),"
- "unique index (name)"
- ") engine=MyISAM "
- "CHARACTER SET utf8 "
- "comment='help categories';\n");
- }
-
- if (test_sys_file(mdata,"mysql/help_keyword.frm"))
- {
- fprintf(out,
- "CREATE TABLE help_keyword ("
- "help_keyword_id int unsigned not null,"
- "name varchar(64) not null,"
- "primary key (help_keyword_id),"
- "unique index (name)"
- ") engine=MyISAM "
- "CHARACTER SET utf8 "
- "comment='help keywords';\n");
- }
-
- if (test_sys_file(mdata,"mysql/help_relation.frm"))
- {
- fprintf(out,
- "CREATE TABLE help_relation ("
- "help_topic_id int unsigned not null references help_topic,"
- "help_keyword_id int unsigned not null references help_keyword,"
- "primary key (help_keyword_id, help_topic_id)"
- ") engine=MyISAM "
- "CHARACTER SET utf8 "
- "comment='keyword-topic relation';\n");
- }
-
- if (test_sys_file(mdata,"mysql/time_zone_name.frm"))
- {
- fprintf(out,
- "CREATE TABLE time_zone_name ("
- "Name char(64) NOT NULL,"
- "Time_zone_id int unsigned NOT NULL,"
- "PRIMARY KEY Name (Name)"
- ") engine=MyISAM CHARACTER SET utf8 "
- "comment='Time zone names';\n");
-
- if (test)
- {
- fprintf(out,
- "INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES"
- "('MET', 1), ('UTC', 2), ('Universal', 2), "
- "('Europe/Moscow',3), ('leap/Europe/Moscow',4),"
- "('Japan', 5);\n");
-
- }
- }
-
-
- if (test_sys_file(mdata,"mysql/time_zone.frm"))
- {
- fprintf(out,
- "CREATE TABLE time_zone ("
- "Time_zone_id int unsigned NOT NULL auto_increment,"
- "Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL,"
- "PRIMARY KEY TzId (Time_zone_id)"
- ") engine=MyISAM CHARACTER SET utf8 "
- "comment='Time zones';\n");
-
- if (test)
- {
- fprintf(out,"INSERT INTO time_zone (Time_zone_id, Use_leap_seconds)"
- "VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y'), (5,'N');\n");
- }
- }
-
- if (test_sys_file(mdata,"mysql/time_zone_transition.frm"))
- {
- fprintf(out,
- "CREATE TABLE time_zone_transition ("
- "Time_zone_id int unsigned NOT NULL,"
- "Transition_time bigint signed NOT NULL,"
- "Transition_type_id int unsigned NOT NULL,"
- "PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)"
- ") engine=MyISAM CHARACTER SET utf8 "
- "comment='Time zone transitions';\n");
-
- if (test)
- {
- fprintf(out,
- "INSERT INTO time_zone_transition"
- "(Time_zone_id, Transition_time, Transition_type_id)"
- "VALUES"
- " (1, -1693706400, 0) ,(1, -1680483600, 1)"
- ",(1, -1663455600, 2) ,(1, -1650150000, 3)"
- ",(1, -1632006000, 2) ,(1, -1618700400, 3)"
- ",(1, -938905200, 2) ,(1, -857257200, 3)"
- ",(1, -844556400, 2) ,(1, -828226800, 3)"
- ",(1, -812502000, 2) ,(1, -796777200, 3)"
- ",(1, 228877200, 2) ,(1, 243997200, 3)"
- ",(1, 260326800, 2) ,(1, 276051600, 3)"
- ",(1, 291776400, 2) ,(1, 307501200, 3)"
- ",(1, 323830800, 2) ,(1, 338950800, 3)"
- ",(1, 354675600, 2) ,(1, 370400400, 3)"
- ",(1, 386125200, 2) ,(1, 401850000, 3)"
- ",(1, 417574800, 2) ,(1, 433299600, 3)"
- ",(1, 449024400, 2) ,(1, 465354000, 3)"
- ",(1, 481078800, 2) ,(1, 496803600, 3)"
- ",(1, 512528400, 2) ,(1, 528253200, 3)"
- ",(1, 543978000, 2) ,(1, 559702800, 3)"
- ",(1, 575427600, 2) ,(1, 591152400, 3)"
- ",(1, 606877200, 2) ,(1, 622602000, 3)"
- ",(1, 638326800, 2) ,(1, 654656400, 3)"
- ",(1, 670381200, 2) ,(1, 686106000, 3)"
- ",(1, 701830800, 2) ,(1, 717555600, 3)"
- ",(1, 733280400, 2) ,(1, 749005200, 3)"
- ",(1, 764730000, 2) ,(1, 780454800, 3)"
- ",(1, 796179600, 2) ,(1, 811904400, 3)"
- ",(1, 828234000, 2) ,(1, 846378000, 3)"
- ",(1, 859683600, 2) ,(1, 877827600, 3)"
- ",(1, 891133200, 2) ,(1, 909277200, 3)"
- ",(1, 922582800, 2) ,(1, 941331600, 3)"
- ",(1, 954032400, 2) ,(1, 972781200, 3)"
- ",(1, 985482000, 2) ,(1, 1004230800, 3)"
- ",(1, 1017536400, 2) ,(1, 1035680400, 3)"
- ",(1, 1048986000, 2) ,(1, 1067130000, 3)"
- ",(1, 1080435600, 2) ,(1, 1099184400, 3)"
- ",(1, 1111885200, 2) ,(1, 1130634000, 3)"
- ",(1, 1143334800, 2) ,(1, 1162083600, 3)"
- ",(1, 1174784400, 2) ,(1, 1193533200, 3)"
- ",(1, 1206838800, 2) ,(1, 1224982800, 3)"
- ",(1, 1238288400, 2) ,(1, 1256432400, 3)"
- ",(1, 1269738000, 2) ,(1, 1288486800, 3)"
- ",(1, 1301187600, 2) ,(1, 1319936400, 3)"
- ",(1, 1332637200, 2) ,(1, 1351386000, 3)"
- ",(1, 1364691600, 2) ,(1, 1382835600, 3)"
- ",(1, 1396141200, 2) ,(1, 1414285200, 3)"
- ",(1, 1427590800, 2) ,(1, 1445734800, 3)"
- ",(1, 1459040400, 2) ,(1, 1477789200, 3)"
- ",(1, 1490490000, 2) ,(1, 1509238800, 3)"
- ",(1, 1521939600, 2) ,(1, 1540688400, 3)"
- ",(1, 1553994000, 2) ,(1, 1572138000, 3)"
- ",(1, 1585443600, 2) ,(1, 1603587600, 3)"
- ",(1, 1616893200, 2) ,(1, 1635642000, 3)"
- ",(1, 1648342800, 2) ,(1, 1667091600, 3)"
- ",(1, 1679792400, 2) ,(1, 1698541200, 3)"
- ",(1, 1711846800, 2) ,(1, 1729990800, 3)"
- ",(1, 1743296400, 2) ,(1, 1761440400, 3)"
- ",(1, 1774746000, 2) ,(1, 1792890000, 3)"
- ",(1, 1806195600, 2) ,(1, 1824944400, 3)"
- ",(1, 1837645200, 2) ,(1, 1856394000, 3)"
- ",(1, 1869094800, 2) ,(1, 1887843600, 3)"
- ",(1, 1901149200, 2) ,(1, 1919293200, 3)"
- ",(1, 1932598800, 2) ,(1, 1950742800, 3)"
- ",(1, 1964048400, 2) ,(1, 1982797200, 3)"
- ",(1, 1995498000, 2) ,(1, 2014246800, 3)"
- ",(1, 2026947600, 2) ,(1, 2045696400, 3)"
- ",(1, 2058397200, 2) ,(1, 2077146000, 3)"
- ",(1, 2090451600, 2) ,(1, 2108595600, 3)"
- ",(1, 2121901200, 2) ,(1, 2140045200, 3)"
- ",(3, -1688265000, 2) ,(3, -1656819048, 1)"
- ",(3, -1641353448, 2) ,(3, -1627965048, 3)"
- ",(3, -1618716648, 1) ,(3, -1596429048, 3)"
- ",(3, -1593829848, 5) ,(3, -1589860800, 4)"
- ",(3, -1542427200, 5) ,(3, -1539493200, 6)"
- ",(3, -1525323600, 5) ,(3, -1522728000, 4)"
- ",(3, -1491188400, 7) ,(3, -1247536800, 4)"
- ",(3, 354920400, 5) ,(3, 370728000, 4)"
- ",(3, 386456400, 5) ,(3, 402264000, 4)"
- ",(3, 417992400, 5) ,(3, 433800000, 4)"
- ",(3, 449614800, 5) ,(3, 465346800, 8)"
- ",(3, 481071600, 9) ,(3, 496796400, 8)"
- ",(3, 512521200, 9) ,(3, 528246000, 8)"
- ",(3, 543970800, 9) ,(3, 559695600, 8)"
- ",(3, 575420400, 9) ,(3, 591145200, 8)"
- ",(3, 606870000, 9) ,(3, 622594800, 8)"
- ",(3, 638319600, 9) ,(3, 654649200, 8)"
- ",(3, 670374000, 10) ,(3, 686102400, 11)"
- ",(3, 695779200, 8) ,(3, 701812800, 5)"
- ",(3, 717534000, 4) ,(3, 733273200, 9)"
- ",(3, 748998000, 8) ,(3, 764722800, 9)"
- ",(3, 780447600, 8) ,(3, 796172400, 9)"
- ",(3, 811897200, 8) ,(3, 828226800, 9)"
- ",(3, 846370800, 8) ,(3, 859676400, 9)"
- ",(3, 877820400, 8) ,(3, 891126000, 9)"
- ",(3, 909270000, 8) ,(3, 922575600, 9)"
- ",(3, 941324400, 8) ,(3, 954025200, 9)"
- ",(3, 972774000, 8) ,(3, 985474800, 9)"
- ",(3, 1004223600, 8) ,(3, 1017529200, 9)"
- ",(3, 1035673200, 8) ,(3, 1048978800, 9)"
- ",(3, 1067122800, 8) ,(3, 1080428400, 9)"
- ",(3, 1099177200, 8) ,(3, 1111878000, 9)"
- ",(3, 1130626800, 8) ,(3, 1143327600, 9)"
- ",(3, 1162076400, 8) ,(3, 1174777200, 9)"
- ",(3, 1193526000, 8) ,(3, 1206831600, 9)"
- ",(3, 1224975600, 8) ,(3, 1238281200, 9)"
- ",(3, 1256425200, 8) ,(3, 1269730800, 9)"
- ",(3, 1288479600, 8) ,(3, 1301180400, 9)"
- ",(3, 1319929200, 8) ,(3, 1332630000, 9)"
- ",(3, 1351378800, 8) ,(3, 1364684400, 9)"
- ",(3, 1382828400, 8) ,(3, 1396134000, 9)"
- ",(3, 1414278000, 8) ,(3, 1427583600, 9)"
- ",(3, 1445727600, 8) ,(3, 1459033200, 9)"
- ",(3, 1477782000, 8) ,(3, 1490482800, 9)"
- ",(3, 1509231600, 8) ,(3, 1521932400, 9)"
- ",(3, 1540681200, 8) ,(3, 1553986800, 9)"
- ",(3, 1572130800, 8) ,(3, 1585436400, 9)"
- ",(3, 1603580400, 8) ,(3, 1616886000, 9)"
- ",(3, 1635634800, 8) ,(3, 1648335600, 9)"
- ",(3, 1667084400, 8) ,(3, 1679785200, 9)"
- ",(3, 1698534000, 8) ,(3, 1711839600, 9)"
- ",(3, 1729983600, 8) ,(3, 1743289200, 9)"
- ",(3, 1761433200, 8) ,(3, 1774738800, 9)"
- ",(3, 1792882800, 8) ,(3, 1806188400, 9)"
- ",(3, 1824937200, 8) ,(3, 1837638000, 9)"
- ",(3, 1856386800, 8) ,(3, 1869087600, 9)"
- ",(3, 1887836400, 8) ,(3, 1901142000, 9)"
- ",(3, 1919286000, 8) ,(3, 1932591600, 9)"
- ",(3, 1950735600, 8) ,(3, 1964041200, 9)"
- ",(3, 1982790000, 8) ,(3, 1995490800, 9)"
- ",(3, 2014239600, 8) ,(3, 2026940400, 9)"
- ",(3, 2045689200, 8) ,(3, 2058390000, 9)"
- ",(3, 2077138800, 8) ,(3, 2090444400, 9)"
- ",(3, 2108588400, 8) ,(3, 2121894000, 9)"
- ",(3, 2140038000, 8)"
- ",(4, -1688265000, 2) ,(4, -1656819048, 1)"
- ",(4, -1641353448, 2) ,(4, -1627965048, 3)"
- ",(4, -1618716648, 1) ,(4, -1596429048, 3)"
- ",(4, -1593829848, 5) ,(4, -1589860800, 4)"
- ",(4, -1542427200, 5) ,(4, -1539493200, 6)"
- ",(4, -1525323600, 5) ,(4, -1522728000, 4)"
- ",(4, -1491188400, 7) ,(4, -1247536800, 4)"
- ",(4, 354920409, 5) ,(4, 370728010, 4)"
- ",(4, 386456410, 5) ,(4, 402264011, 4)"
- ",(4, 417992411, 5) ,(4, 433800012, 4)"
- ",(4, 449614812, 5) ,(4, 465346812, 8)"
- ",(4, 481071612, 9) ,(4, 496796413, 8)"
- ",(4, 512521213, 9) ,(4, 528246013, 8)"
- ",(4, 543970813, 9) ,(4, 559695613, 8)"
- ",(4, 575420414, 9) ,(4, 591145214, 8)"
- ",(4, 606870014, 9) ,(4, 622594814, 8)"
- ",(4, 638319615, 9) ,(4, 654649215, 8)"
- ",(4, 670374016, 10) ,(4, 686102416, 11)"
- ",(4, 695779216, 8) ,(4, 701812816, 5)"
- ",(4, 717534017, 4) ,(4, 733273217, 9)"
- ",(4, 748998018, 8) ,(4, 764722818, 9)"
- ",(4, 780447619, 8) ,(4, 796172419, 9)"
- ",(4, 811897219, 8) ,(4, 828226820, 9)"
- ",(4, 846370820, 8) ,(4, 859676420, 9)"
- ",(4, 877820421, 8) ,(4, 891126021, 9)"
- ",(4, 909270021, 8) ,(4, 922575622, 9)"
- ",(4, 941324422, 8) ,(4, 954025222, 9)"
- ",(4, 972774022, 8) ,(4, 985474822, 9)"
- ",(4, 1004223622, 8) ,(4, 1017529222, 9)"
- ",(4, 1035673222, 8) ,(4, 1048978822, 9)"
- ",(4, 1067122822, 8) ,(4, 1080428422, 9)"
- ",(4, 1099177222, 8) ,(4, 1111878022, 9)"
- ",(4, 1130626822, 8) ,(4, 1143327622, 9)"
- ",(4, 1162076422, 8) ,(4, 1174777222, 9)"
- ",(4, 1193526022, 8) ,(4, 1206831622, 9)"
- ",(4, 1224975622, 8) ,(4, 1238281222, 9)"
- ",(4, 1256425222, 8) ,(4, 1269730822, 9)"
- ",(4, 1288479622, 8) ,(4, 1301180422, 9)"
- ",(4, 1319929222, 8) ,(4, 1332630022, 9)"
- ",(4, 1351378822, 8) ,(4, 1364684422, 9)"
- ",(4, 1382828422, 8) ,(4, 1396134022, 9)"
- ",(4, 1414278022, 8) ,(4, 1427583622, 9)"
- ",(4, 1445727622, 8) ,(4, 1459033222, 9)"
- ",(4, 1477782022, 8) ,(4, 1490482822, 9)"
- ",(4, 1509231622, 8) ,(4, 1521932422, 9)"
- ",(4, 1540681222, 8) ,(4, 1553986822, 9)"
- ",(4, 1572130822, 8) ,(4, 1585436422, 9)"
- ",(4, 1603580422, 8) ,(4, 1616886022, 9)"
- ",(4, 1635634822, 8) ,(4, 1648335622, 9)"
- ",(4, 1667084422, 8) ,(4, 1679785222, 9)"
- ",(4, 1698534022, 8) ,(4, 1711839622, 9)"
- ",(4, 1729983622, 8) ,(4, 1743289222, 9)"
- ",(4, 1761433222, 8) ,(4, 1774738822, 9)"
- ",(4, 1792882822, 8) ,(4, 1806188422, 9)"
- ",(4, 1824937222, 8) ,(4, 1837638022, 9)"
- ",(4, 1856386822, 8) ,(4, 1869087622, 9)"
- ",(4, 1887836422, 8) ,(4, 1901142022, 9)"
- ",(4, 1919286022, 8) ,(4, 1932591622, 9)"
- ",(4, 1950735622, 8) ,(4, 1964041222, 9)"
- ",(4, 1982790022, 8) ,(4, 1995490822, 9)"
- ",(4, 2014239622, 8) ,(4, 2026940422, 9)"
- ",(4, 2045689222, 8) ,(4, 2058390022, 9)"
- ",(4, 2077138822, 8) ,(4, 2090444422, 9)"
- ",(4, 2108588422, 8) ,(4, 2121894022, 9)"
- ",(4, 2140038022, 8), (5, -1009875600, 1);\n");
-
-
- }
- }
-
- if (test_sys_file(mdata,"mysql/time_zone_transition_type.frm"))
- {
- fprintf(out,
- "CREATE TABLE time_zone_transition_type ("
- "Time_zone_id int unsigned NOT NULL,"
- "Transition_type_id int unsigned NOT NULL,"
- "Offset int signed DEFAULT 0 NOT NULL,"
- "Is_DST tinyint unsigned DEFAULT 0 NOT NULL,"
- "Abbreviation char(8) DEFAULT '' NOT NULL,"
- "PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)"
- ") engine=MyISAM CHARACTER SET utf8 "
- "comment='Time zone transition types';\n");
-
- if (test)
- {
- fprintf(out,
- "INSERT INTO time_zone_transition_type (Time_zone_id,"
- "Transition_type_id, Offset, Is_DST, Abbreviation) VALUES"
- "(1, 0, 7200, 1, 'MEST') ,(1, 1, 3600, 0, 'MET')"
- ",(1, 2, 7200, 1, 'MEST') ,(1, 3, 3600, 0, 'MET')"
- ",(2, 0, 0, 0, 'UTC')"
- ",(3, 0, 9000, 0, 'MMT') ,(3, 1, 12648, 1, 'MST')"
- ",(3, 2, 9048, 0, 'MMT') ,(3, 3, 16248, 1, 'MDST')"
- ",(3, 4, 10800, 0, 'MSK') ,(3, 5, 14400, 1, 'MSD')"
- ",(3, 6, 18000, 1, 'MSD') ,(3, 7, 7200, 0, 'EET')"
- ",(3, 8, 10800, 0, 'MSK') ,(3, 9, 14400, 1, 'MSD')"
- ",(3, 10, 10800, 1, 'EEST') ,(3, 11, 7200, 0, 'EET')"
- ",(4, 0, 9000, 0, 'MMT') ,(4, 1, 12648, 1, 'MST')"
- ",(4, 2, 9048, 0, 'MMT') ,(4, 3, 16248, 1, 'MDST')"
- ",(4, 4, 10800, 0, 'MSK') ,(4, 5, 14400, 1, 'MSD')"
- ",(4, 6, 18000, 1, 'MSD') ,(4, 7, 7200, 0, 'EET')"
- ",(4, 8, 10800, 0, 'MSK') ,(4, 9, 14400, 1, 'MSD')"
- ",(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET')"
- ",(5, 0, 32400, 0, 'CJT') ,(5, 1, 32400, 0, 'JST');\n");
-
- }
- }
-
- if (test_sys_file(mdata,"mysql/time_zone_leap_second.frm"))
- {
- fprintf(out,
- "CREATE TABLE time_zone_leap_second ("
- "Transition_time bigint signed NOT NULL,"
- "Correction int signed NOT NULL,"
- "PRIMARY KEY TranTime (Transition_time)"
- ") engine=MyISAM CHARACTER SET utf8 "
- "comment='Leap seconds information for time zones';\n");
-
- if (test)
- {
- fprintf(out,
- "INSERT INTO time_zone_leap_second "
- "(Transition_time, Correction) VALUES "
- "(78796800, 1) ,(94694401, 2) ,(126230402, 3)"
- ",(157766403, 4) ,(189302404, 5) ,(220924805, 6)"
- ",(252460806, 7) ,(283996807, 8) ,(315532808, 9)"
- ",(362793609, 10) ,(394329610, 11) ,(425865611, 12)"
- ",(489024012, 13) ,(567993613, 14) ,(631152014, 15)"
- ",(662688015, 16) ,(709948816, 17) ,(741484817, 18)"
- ",(773020818, 19) ,(820454419, 20) ,(867715220, 21)"
- ",(915148821, 22);\n");
- }
- }
-
- return fclose(out);
-}
diff --git a/mysql-test/my_manage.c b/mysql-test/my_manage.c
deleted file mode 100644
index e5d1be42f95..00000000000
--- a/mysql-test/my_manage.c
+++ /dev/null
@@ -1,887 +0,0 @@
-/*
- Copyright (c) 2003 Novell, Inc. All Rights Reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#include <stdio.h>
-#include <errno.h>
-#ifndef __WIN__
-#include <dirent.h>
-#endif
-#include <string.h>
-#ifdef __NETWARE__
-#include <screen.h>
-#include <proc.h>
-#else
-#include <sys/types.h>
-#ifndef __WIN__
-#include <sys/wait.h>
-#include <unistd.h>
-#include <signal.h>
-#include <fnmatch.h> /* FIXME HAVE_FNMATCH_H or something */
-#else
-#include <direct.h>
-#include <stdlib.h>
-#include <stdio.h>
-#endif
-#endif
-#include <ctype.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <assert.h>
-
-#include "my_manage.h"
-
-#ifndef __NETWARE__
-#define ASSERT assert
-extern char **environ;
-#endif
-
-
-
-/******************************************************************************
-
- macros
-
-******************************************************************************/
-
-/******************************************************************************
-
- global variables
-
-******************************************************************************/
-
-/******************************************************************************
-
- functions
-
-******************************************************************************/
-
-/******************************************************************************
-
- init_args()
-
- Init an argument list.
-
-******************************************************************************/
-
-void init_args(arg_list_t *al)
-{
- ASSERT(al != NULL);
-
- al->argc= 0;
- al->size= ARG_BUF;
- al->argv= malloc(al->size * sizeof(char *));
- ASSERT(al->argv != NULL);
-
- return;
-}
-
-/******************************************************************************
-
- add_arg()
-
- Add an argument to a list.
-
-******************************************************************************/
-
-void add_arg(arg_list_t *al, const char *format, ...)
-{
- va_list ap;
- char temp[FN_REFLEN];
-
- ASSERT(al != NULL);
-
- /* increase size */
- if (al->argc >= (int)al->size)
- {
- al->size+= ARG_BUF;
- al->argv= realloc(al->argv, al->size * sizeof(char *));
- ASSERT(al->argv != NULL);
- }
-
- if (format)
- {
- va_start(ap, format);
- vsprintf(temp, format, ap);
- va_end(ap);
-
- al->argv[al->argc]= malloc(strlen(temp)+1);
- ASSERT(al->argv[al->argc] != NULL);
- strcpy(al->argv[al->argc], temp);
-
- ++(al->argc);
- }
- else
- {
- al->argv[al->argc]= NULL;
- }
-
- return;
-}
-
-/******************************************************************************
-
- free_args()
-
- Free an argument list.
-
-******************************************************************************/
-
-void free_args(arg_list_t *al)
-{
- int i;
-
- ASSERT(al != NULL);
-
- for (i= 0; i < al->argc; i++)
- {
- ASSERT(al->argv[i] != NULL);
- free(al->argv[i]);
- al->argv[i]= NULL;
- }
-
- free(al->argv);
- al->argc= 0;
- al->argv= NULL;
-
- return;
-}
-
-/******************************************************************************
-
- sleep_until_file_deleted()
-
- Sleep until the given file is no longer found.
-
-******************************************************************************/
-
-#ifndef __WIN__
-int sleep_until_file_deleted(char *pid_file)
-#else
-int sleep_until_file_deleted(HANDLE pid_file)
-#endif
-{
- int err= 0; /* Initiate to supress warning */
-#ifndef __WIN__
- struct stat buf;
- int i;
-
- for (i= 0; (i < TRY_MAX) && (err= !stat(pid_file, &buf)); i++) sleep(1);
-
- if (err != 0) err= errno;
-#else
- err= (WaitForSingleObject(pid_file, TRY_MAX*1000) == WAIT_TIMEOUT);
-#endif
- return err;
-}
-
-/******************************************************************************
-
- sleep_until_file_exists()
-
- Sleep until the given file exists.
-
-******************************************************************************/
-
-#ifndef __WIN__
-int sleep_until_file_exists(char *pid_file)
-#else
-int sleep_until_file_exists(HANDLE pid_file)
-#endif
-{
- int err= 0; /* Initiate to supress warning */
-#ifndef __WIN__
- struct stat buf;
- int i;
-
- for (i= 0; (i < TRY_MAX) && (err= stat(pid_file, &buf)); i++) sleep(1);
-
- if (err != 0) err= errno;
-#else
- err= (WaitForSingleObject(pid_file, TRY_MAX*1000) == WAIT_TIMEOUT);
-#endif
- return err;
-}
-
-/******************************************************************************
-
- wait_for_server_start()
-
- Wait for the server on the given port to start.
-
-******************************************************************************/
-
-int wait_for_server_start(char *bin_dir __attribute__((unused)),
- char *mysqladmin_file,
- char *user, char *password, int port,char *tmp_dir)
-{
- arg_list_t al;
- int err= 0;
- char trash[FN_REFLEN];
-
- /* mysqladmin file */
- snprintf(trash, FN_REFLEN, "%s/trash.out",tmp_dir);
-
- /* args */
- init_args(&al);
- add_arg(&al, "%s", mysqladmin_file);
- add_arg(&al, "--no-defaults");
- add_arg(&al, "--port=%u", port);
- add_arg(&al, "--user=%s", user);
- add_arg(&al, "--password=%s", password);
- add_arg(&al, "--silent");
- add_arg(&al, "--host=localhost");
-
-#ifndef __NETWARE__
- add_arg(&al, "--connect_timeout=10");
- add_arg(&al, "-w");
- add_arg(&al, "--protocol=tcp");
-#endif
- add_arg(&al, "ping");
-
- /*
- NetWare does not support the connect timeout in the TCP/IP stack
- -- we will try the ping multiple times
- */
-#ifndef __WIN__
- {
- int i;
- for (i= 0;
- (i < TRY_MAX) && (err= spawn(mysqladmin_file, &al, TRUE, NULL,
- trash, NULL, NULL));
- i++)
- sleep(1);
- }
-#else
- err= spawn(mysqladmin_file, &al, TRUE, NULL,trash, NULL, NULL);
-#endif
-
- /* free args */
- free_args(&al);
-
- return err;
-}
-
-/******************************************************************************
-
- spawn()
-
- Spawn the given path with the given arguments.
-
-******************************************************************************/
-
-#ifdef __NETWARE__
-int spawn(char *path, arg_list_t *al, int join, char *input,
- char *output, char *error, char *pid_file)
-{
- pid_t pid;
- int result= 0;
- wiring_t wiring= { FD_UNUSED, FD_UNUSED, FD_UNUSED };
- unsigned long flags= PROC_CURRENT_SPACE | PROC_INHERIT_CWD;
-
- /* open wiring */
- if (input)
- wiring.infd= open(input, O_RDONLY);
-
- if (output)
- wiring.outfd= open(output, O_WRONLY | O_CREAT | O_TRUNC);
-
- if (error)
- wiring.errfd= open(error, O_WRONLY | O_CREAT | O_TRUNC);
-
- /* procve requires a NULL */
- add_arg(al, NULL);
-
- /* go */
- pid= procve(path, flags, NULL, &wiring, NULL, NULL, 0,
- NULL, (const char **)al->argv);
-
- /* close wiring */
- if (wiring.infd != -1)
- close(wiring.infd);
-
- if (wiring.outfd != -1)
- close(wiring.outfd);
-
- if (wiring.errfd != -1)
- close(wiring.errfd);
-
- return result;
-}
-#elif __WIN__
-
-int spawn(char *path, arg_list_t *al, int join, char *input,
- char *output, char *error, HANDLE *pid)
-{
- bool result;
- int i;
- STARTUPINFO startup_info;
- PROCESS_INFORMATION process_information;
- DWORD exit_code;
- char win_args[1024]= "";
-
- /* Skip the first parameter */
- for (i= 1; i < al->argc; i++)
- {
- ASSERT(al->argv[i] != NULL);
- strcat(win_args,al->argv[i]);
- strcat(win_args," ");
- }
-
- memset(&startup_info,0,sizeof(STARTUPINFO));
- startup_info.cb= sizeof(STARTUPINFO);
-
- if (input)
- freopen(input, "rb", stdin);
-
- if (output)
- freopen(output, "wb", stdout);
-
- if (error)
- freopen(error, "wb", stderr);
-
- result= CreateProcess(
- path,
- (LPSTR)&win_args,
- NULL,
- NULL,
- TRUE,
- 0,
- NULL,
- NULL,
- &startup_info,
- &process_information
- );
-
- if (result && process_information.hProcess)
- {
- if (join)
- {
- if (WaitForSingleObject(process_information.hProcess, mysqld_timeout)
- == WAIT_TIMEOUT)
- {
- exit_code= -1;
- }
- else
- {
- GetExitCodeProcess(process_information.hProcess, &exit_code);
- }
- CloseHandle(process_information.hProcess);
- }
- else
- {
- exit_code= 0;
- }
- if (pid != NULL)
- *pid= process_information.hProcess;
- }
- else
- {
- exit_code= -1;
- }
- if (input)
- freopen("CONIN$","rb",stdin);
- if (output)
- freopen("CONOUT$","wb",stdout);
- if (error)
- freopen("CONOUT$","wb",stderr);
-
- return exit_code;
-}
-#else
-int spawn(char *path, arg_list_t *al, int join, char *input,
- char *output, char *error, char *pid_file __attribute__((unused)))
-{
- pid_t pid;
- int res_exec= 0;
- int result= 0;
-
- pid= fork();
-
- if (pid == -1)
- {
- fprintf(stderr, "fork was't created\n");
- /* We can't create the fork...exit with error */
- return EXIT_FAILURE;
- }
-
- if (pid > 0)
- {
- /* The parent process is waiting for child process if join is not zero */
- if (join)
- {
- waitpid(pid, &result, 0);
- if (WIFEXITED(result) != 0)
- {
- result= WEXITSTATUS(result);
- }
- else
- {
- result= EXIT_FAILURE;
- }
- }
- }
- else
- {
-
- /* Child process */
- add_arg(al, NULL);
-
- /* Reassign streams */
- if (input)
- freopen(input, "r", stdin);
-
- if (output)
- freopen(output, "w", stdout);
-
- if (error)
- freopen(error, "w", stderr);
-
- /* Spawn the process */
- if ((res_exec= execve(path, al->argv, environ)) < 0)
- exit(EXIT_FAILURE);
-
- /* Restore streams */
- if (input)
- freopen("/dev/tty", "r", stdin);
-
- if (output)
- freopen("/dev/tty", "w", stdout);
-
- if (error)
- freopen("/dev/tty", "w", stderr);
-
- exit(0);
- }
-
- return result;
-}
-#endif
-/******************************************************************************
-
- stop_server()
-
- Stop the server with the given port and pid file.
-
-******************************************************************************/
-
-int stop_server(char *bin_dir __attribute__((unused)), char *mysqladmin_file,
- char *user, char *password, int port,
-#ifndef __WIN__
- char *pid_file,
-#else
- HANDLE pid_file,
-#endif
- char *tmp_dir)
-{
- arg_list_t al;
- int err= 0;
- char trash[FN_REFLEN];
-
- snprintf(trash, FN_REFLEN, "%s/trash.out",tmp_dir);
-
- /* args */
- init_args(&al);
- add_arg(&al, "%s", mysqladmin_file);
- add_arg(&al, "--no-defaults");
- add_arg(&al, "--port=%u", port);
- add_arg(&al, "--user=%s", user);
- add_arg(&al, "--password=%s", password);
- add_arg(&al, "-O");
- add_arg(&al, "shutdown_timeout=20");
-#ifndef __NETWARE__
- add_arg(&al, "--protocol=tcp");
-#endif
- add_arg(&al, "shutdown");
-
- /* spawn */
- if ((err= spawn(mysqladmin_file, &al, TRUE, NULL,
- trash, NULL, NULL)) == 0)
- {
- sleep_until_file_deleted(pid_file);
- }
- else
- {
-#ifndef __WIN__
- pid_t pid= get_server_pid(pid_file);
-
- /* shutdown failed - kill server */
- kill_server(pid);
-
- sleep(TRY_MAX);
-
- /* remove pid file if possible */
- err= remove(pid_file);
-#else
- TerminateProcess(pid_file,err);
-#endif
- }
-
- /* free args */
- free_args(&al);
-
- return err;
-}
-
-/******************************************************************************
-
- get_server_pid()
-
- Get the VM id with the given pid file.
-
-******************************************************************************/
-
-#ifndef __WIN__
-pid_t get_server_pid(char *pid_file)
-{
- char buf[FN_REFLEN];
- int fd, err;
- char *p;
- pid_t id= 0;
-
- /* discover id */
- fd= open(pid_file, O_RDONLY);
-
- err= read(fd, buf, FN_REFLEN);
-
- close(fd);
-
- if (err > 0)
- {
- /* terminate string */
- if ((p= strchr(buf, '\n')) != NULL)
- {
- *p= '\0';
-
- /* check for a '\r' */
- if ((p= strchr(buf, '\r')) != NULL)
- {
- *p= '\0';
- }
- }
- else
- {
- buf[err]= '\0';
- }
-
- id= strtol(buf, NULL, 0);
- }
-
- return id;
-}
-
-/******************************************************************************
-
- kill_server()
-
- Force a kill of the server with the given pid.
-
-******************************************************************************/
-
-void kill_server(pid_t pid)
-{
- if (pid > 0)
- {
-#if !defined(__NETWARE__)
- /* Send SIGTERM to pid */
- kill(pid, SIGTERM);
-#else /* __NETWARE__ */
- /* destroy vm */
- NXVmDestroy(pid);
-#endif
- }
-}
-#endif
-/******************************************************************************
-
- del_tree()
-
- Delete the directory and subdirectories.
-
-******************************************************************************/
-
-void del_tree(char *dir)
-{
-#ifndef __WIN__
- DIR *parent= opendir(dir);
- struct dirent *entry;
- char temp[FN_REFLEN];
-
- if (parent == NULL)
- {
- return;
- }
-
- while ((entry= readdir(parent)) != NULL)
- {
- /* create long name */
- snprintf(temp, FN_REFLEN, "%s/%s", dir, entry->d_name);
-
- if (entry->d_name[0] == '.')
- {
- /* Skip */
- }
- else
- {
-/* FIXME missing test in acinclude.m4 */
-#ifndef STRUCT_DIRENT_HAS_D_TYPE
- struct stat st;
-
- if (lstat(entry->d_name, &st) == -1)
- {
- /* FIXME error */
- return;
- }
- if (S_ISDIR(st.st_mode))
-#else
- if (S_ISDIR(entry->d_type))
-#endif
- {
- /* delete subdirectory */
- del_tree(temp);
- }
- else
- {
- /* remove file */
- remove(temp);
- }
- }
- }
- /* remove directory */
- rmdir(dir);
-#else
- struct _finddata_t parent;
-#if defined(_MSC_VER) && _MSC_VER > 1200
- intptr_t handle;
-#else
- long handle;
-#endif /* _MSC_VER && _MSC_VER > 1200 */
- char temp[FN_REFLEN];
- char mask[FN_REFLEN];
-
- snprintf(mask,FN_REFLEN,"%s/*.*",dir);
-
- if ((handle=_findfirst(mask,&parent)) == -1L)
- {
- return;
- }
-
- do
- {
- /* create long name */
- snprintf(temp, FN_REFLEN, "%s/%s", dir, parent.name);
- if (parent.name[0] == '.')
- {
- /* Skip */
- }
- else
- if (parent.attrib & _A_SUBDIR)
- {
- /* delete subdirectory */
- del_tree(temp);
- }
- else
- {
- /* remove file */
- remove(temp);
- }
- } while (_findnext(handle,&parent) == 0);
-
- _findclose(handle);
-
- /* remove directory */
- _rmdir(dir);
-#endif
-}
-
-/******************************************************************************
-
- removef()
-
-******************************************************************************/
-
-int removef(const char *format, ...)
-{
-#ifdef __NETWARE__
- va_list ap;
- char path[FN_REFLEN];
-
- va_start(ap, format);
-
- vsnprintf(path, FN_REFLEN, format, ap);
-
- va_end(ap);
- return remove(path);
-
-#elif __WIN__
- {
- va_list ap;
- char path[FN_REFLEN];
- struct _finddata_t parent;
-#if defined(_MSC_VER) && _MSC_VER > 1200
- intptr_t handle;
-#else
- long handle;
-#endif /* _MSC_VER && _MSC_VER > 1200 */
- char temp[FN_REFLEN];
- char *p;
-
- va_start(ap, format);
-
- vsnprintf(path, FN_REFLEN, format, ap);
-
- va_end(ap);
-
- p= path + strlen(path);
- while (*p != '\\' && *p != '/' && p > path) p--;
-
- if ((handle=_findfirst(path,&parent)) == -1L)
- {
- /* if there is not files....it's ok */
- return 0;
- }
-
- *p= '\0';
-
- do
- {
- if (! (parent.attrib & _A_SUBDIR))
- {
- snprintf(temp, FN_REFLEN, "%s/%s", path, parent.name);
- remove(temp);
- }
- }while (_findnext(handle,&parent) == 0);
-
- _findclose(handle);
- }
-#else
- DIR *parent;
- struct dirent *entry;
- char temp[FN_REFLEN];
- va_list ap;
- char path[FN_REFLEN];
- char *p;
- /* Get path with mask */
- va_start(ap, format);
-
- vsnprintf(path, FN_REFLEN, format, ap);
-
- va_end(ap);
-
- p= path + strlen(path);
- while (*p != '\\' && *p != '/' && p > path) p--;
- *p= '\0';
- p++;
-
- parent= opendir(path);
-
- if (parent == NULL)
- {
- return 1; /* Error, directory missing */
- }
-
- while ((entry= readdir(parent)) != NULL)
- {
- /* entry is not directory and entry matches with mask */
-#ifndef STRUCT_DIRENT_HAS_D_TYPE
- struct stat st;
-
- /* create long name */
- snprintf(temp, FN_REFLEN, "%s/%s", path, entry->d_name);
-
- if (lstat(temp, &st) == -1)
- {
- return 1; /* Error couldn't lstat file */
- }
-
- if (!S_ISDIR(st.st_mode) && !fnmatch(p, entry->d_name,0))
-#else
- if (!S_ISDIR(entry->d_type) && !fnmatch(p, entry->d_name,0))
-#endif
- {
- /* create long name */
- snprintf(temp, FN_REFLEN, "%s/%s", path, entry->d_name);
- /* Delete only files */
- remove(temp);
- }
- }
-#endif
- return 0;
-}
-
-/******************************************************************************
-
- get_basedir()
-
-******************************************************************************/
-
-void get_basedir(char *argv0, char *basedir)
-{
- char temp[FN_REFLEN];
- char *p;
- int position;
-
- ASSERT(argv0 != NULL);
- ASSERT(basedir != NULL);
-
- strcpy(temp, strlwr(argv0));
- while ((p= strchr(temp, '\\')) != NULL) *p= '/';
-
- if ((position= strinstr(temp, "/bin/")) != 0)
- {
- p= temp + position;
- *p= '\0';
- strcpy(basedir, temp);
- }
-}
-
-uint strinstr(reg1 const char *str,reg4 const char *search)
-{
- reg2 my_string i,j;
- my_string start= (my_string) str;
-
- skipp:
- while (*str != '\0')
- {
- if (*str++ == *search)
- {
- i=(my_string) str;
- j= (my_string) search+1;
- while (*j)
- if (*i++ != *j++) goto skipp;
- return ((uint) (str - start));
- }
- }
- return (0);
-}
-
-/******************************************************************************
-
- remove_empty_file()
-
-******************************************************************************/
-
-void remove_empty_file(const char *file_name)
-{
- struct stat file;
-
- if (!stat(file_name,&file))
- {
- if (!file.st_size)
- remove(file_name);
- }
-}
diff --git a/mysql-test/my_manage.h b/mysql-test/my_manage.h
deleted file mode 100644
index 5df77b01af8..00000000000
--- a/mysql-test/my_manage.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- Copyright (c) 2002 Novell, Inc. All Rights Reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifndef _MY_MANAGE
-#define _MY_MANAGE
-
-/******************************************************************************
-
- includes
-
-******************************************************************************/
-
-#include <stdlib.h>
-#ifndef __WIN__
-#include <unistd.h>
-#endif
-#ifndef __NETWARE__
-#include <string.h>
-#include <my_global.h>
-#include <m_string.h>
-
-#ifndef __WIN__
-#define strnicmp strncasecmp
-#define strlwr(STRARG) (STRARG)
-#else
-int my_vsnprintf_(char *to, size_t n, const char* value, ...);
-#endif
-#endif
-
-/******************************************************************************
-
- macros
-
-******************************************************************************/
-
-#define ARG_BUF 10
-#define TRY_MAX 5
-
-#ifdef __WIN__
-#define PATH_MAX _MAX_PATH
-#define NAME_MAX _MAX_FNAME
-#define kill(A,B) TerminateProcess((HANDLE)A,0)
-#define NOT_NEED_PID 0
-#define MASTER_PID 1
-#define SLAVE_PID 2
-#define mysqld_timeout 60000
-
-int pid_mode;
-bool run_server;
-bool skip_first_param;
-
-#define snprintf _snprintf
-#define vsnprintf _vsnprintf
-#endif
-
-
-/******************************************************************************
-
- structures
-
-******************************************************************************/
-
-typedef struct
-{
-
- int argc;
- char **argv;
-
- size_t size;
-
-} arg_list_t;
-
-#ifdef __WIN__
-typedef int pid_t;
-#endif
-/******************************************************************************
-
- global variables
-
-******************************************************************************/
-
-/******************************************************************************
-
- prototypes
-
-******************************************************************************/
-
-void init_args(arg_list_t *);
-void add_arg(arg_list_t *, const char *, ...);
-void free_args(arg_list_t *);
-
-#ifndef __WIN__
-int sleep_until_file_exists(char *);
-int sleep_until_file_deleted(char *);
-#else
-int sleep_until_file_exists(HANDLE);
-int sleep_until_file_deleted(HANDLE);
-#endif
-int wait_for_server_start(char *, char *, char *, char *, int,char *);
-
-#ifndef __WIN__
-int spawn(char *, arg_list_t *, int, char *, char *, char *, char *);
-#else
-int spawn(char *, arg_list_t *, int , char *, char *, char *, HANDLE *);
-#endif
-
-#ifndef __WIN__
-int stop_server(char *, char *, char *, char *, int, char *,char *);
-pid_t get_server_pid(char *);
-void kill_server(pid_t pid);
-#else
-int stop_server(char *, char *, char *, char *, int, HANDLE,char *);
-#endif
-void del_tree(char *);
-int removef(const char *, ...);
-
-void get_basedir(char *, char *);
-void remove_empty_file(const char *file_name);
-
-bool create_system_files(const char *mdata,const char *output_file, bool test);
-
-#endif /* _MY_MANAGE */
diff --git a/mysql-test/mysql-test-run-shell.sh b/mysql-test/mysql-test-run-shell.sh
index 9e19a8cad7e..99c844b2f78 100644
--- a/mysql-test/mysql-test-run-shell.sh
+++ b/mysql-test/mysql-test-run-shell.sh
@@ -7,6 +7,12 @@
# List of failed cases (--force) backported from 4.1 by Joerg
# :-)
+#echo "##################################################";
+#echo "This script is deprecated and will soon be removed";
+#echo "Use mysql-test-run.pl instead";
+#echo "##################################################";
+#echo
+
#++
# Access Definitions
#--
@@ -221,8 +227,8 @@ MY_LOG_DIR="$MYSQL_TEST_DIR/var/log"
#
# Set LD_LIBRARY_PATH if we are using shared libraries
#
-LD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$BASEDIR/zlib/.libs:$LD_LIBRARY_PATH"
-DYLD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$BASEDIR/zlib/.libs:$DYLD_LIBRARY_PATH"
+LD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$BASEDIR/libmysql_r/.libs:$BASEDIR/zlib/.libs:$LD_LIBRARY_PATH"
+DYLD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$BASEDIR/libmysql_r/.libs:$BASEDIR/zlib/.libs:$DYLD_LIBRARY_PATH"
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH
#
@@ -234,14 +240,14 @@ export UMASK UMASK_DIR
MASTER_RUNNING=0
MASTER1_RUNNING=0
+MASTER_MYHOST=127.0.0.1
MASTER_MYPORT=9306
SLAVE_RUNNING=0
+SLAVE_MYHOST=127.0.0.1
SLAVE_MYPORT=9308 # leave room for 2 masters for cluster tests
-MYSQL_MANAGER_PORT=9305 # needs to be out of the way of slaves
-NDBCLUSTER_PORT=9350
-MYSQL_MANAGER_PW_FILE=$MYSQL_TEST_DIR/var/tmp/manager.pwd
MYSQL_MANAGER_LOG=$MYSQL_TEST_DIR/var/log/manager.log
-MYSQL_MANAGER_USER=root
+NDBCLUSTER_PORT=9350
+NDBCLUSTER_PORT_SLAVE=9358
#
# To make it easier for different devs to work on the same host,
@@ -255,15 +261,15 @@ MYSQL_MANAGER_USER=root
#
if [ -n "$MTR_BUILD_THREAD" ] ; then
MASTER_MYPORT=`expr $MTR_BUILD_THREAD '*' 10 + 10000`
- MYSQL_MANAGER_PORT=`expr $MASTER_MYPORT + 2`
SLAVE_MYPORT=`expr $MASTER_MYPORT + 3`
NDBCLUSTER_PORT=`expr $MASTER_MYPORT + 6`
+ NDBCLUSTER_PORT_SLAVE=`expr $MASTER_MYPORT + 7`
- echo "Using MTR_BUILD_THREAD = $MTR_BUILD_THREAD"
- echo "Using MASTER_MYPORT = $MASTER_MYPORT"
- echo "Using MYSQL_MANAGER_PORT = $MYSQL_MANAGER_PORT"
- echo "Using SLAVE_MYPORT = $SLAVE_MYPORT"
- echo "Using NDBCLUSTER_PORT = $NDBCLUSTER_PORT"
+ echo "Using MTR_BUILD_THREAD = $MTR_BUILD_THREAD"
+ echo "Using MASTER_MYPORT = $MASTER_MYPORT"
+ echo "Using SLAVE_MYPORT = $SLAVE_MYPORT"
+ echo "Using NDBCLUSTER_PORT = $NDBCLUSTER_PORT"
+ echo "Using NDBCLUSTER_PORT_SLAVE = $NDBCLUSTER_PORT_SLAVE"
fi
NO_SLAVE=0
@@ -274,12 +280,19 @@ EXTRA_MASTER_OPT=""
EXTRA_MYSQL_TEST_OPT=""
EXTRA_MYSQLCHECK_OPT=""
EXTRA_MYSQLDUMP_OPT=""
+EXTRA_MYSQLSLAP_OPT=""
EXTRA_MYSQLSHOW_OPT=""
EXTRA_MYSQLBINLOG_OPT=""
USE_RUNNING_SERVER=0
USE_NDBCLUSTER=@USE_NDBCLUSTER@
+USE_NDBCLUSTER_SLAVE=@USE_NDBCLUSTER@
+USE_NDBCLUSTER_ALL=0
USE_NDBCLUSTER_ONLY=0
USE_RUNNING_NDBCLUSTER=""
+USE_RUNNING_NDBCLUSTER_SLAVE=""
+NDB_EXTRA_TEST=0
+NDB_VERBOSE=0
+NDBCLUSTER_EXTRA_OPTS=""
USE_PURIFY=""
PURIFY_LOGS=""
DO_GCOV=""
@@ -305,6 +318,8 @@ TEST_MODE=""
NDB_MGM_EXTRA_OPTS=
NDB_MGMD_EXTRA_OPTS=
NDBD_EXTRA_OPTS=
+MASTER_MYSQLDBINLOG=1
+SLAVE_MYSQLDBINLOG=1
DO_STRESS=""
STRESS_SUITE="main"
@@ -326,6 +341,7 @@ while test $# -gt 0; do
USE_MANAGER=0 NO_SLAVE=1
USE_RUNNING_SERVER=0
USE_NDBCLUSTER=""
+ USE_NDBCLUSTER_SLAVE=""
TEST_MODE="$TEST_MODE embedded" ;;
--purify)
USE_PURIFY=1
@@ -335,7 +351,6 @@ while test $# -gt 0; do
--user=*) DBUSER=`$ECHO "$1" | $SED -e "s;--user=;;"` ;;
--force) FORCE=1 ;;
--timer) USE_TIMER=1 ;;
- --verbose-manager) MANAGER_QUIET_OPT="" ;;
--old-master) MASTER_40_ARGS="";;
--master-binary=*)
MASTER_MYSQLD=`$ECHO "$1" | $SED -e "s;--master-binary=;;"` ;;
@@ -345,6 +360,12 @@ while test $# -gt 0; do
--extern) USE_RUNNING_SERVER=1 ;;
--with-ndbcluster)
USE_NDBCLUSTER="--ndbcluster" ;;
+ --with-ndbcluster-slave)
+ USE_NDBCLUSTER_SLAVE="--ndbcluster" ;;
+ --with-ndbcluster-all)
+ USE_NDBCLUSTER="--ndbcluster"
+ USE_NDBCLUSTER_SLAVE="--ndbcluster"
+ USE_NDBCLUSTER_ALL=1 ;;
--with-ndbcluster-only)
USE_NDBCLUSTER="--ndbcluster"
USE_NDBCLUSTER_SLAVE="--ndbcluster"
@@ -352,6 +373,15 @@ while test $# -gt 0; do
--ndb-connectstring=*)
USE_NDBCLUSTER="--ndbcluster" ;
USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndb-connectstring=;;"` ;;
+ --ndb-connectstring-slave=*)
+ USE_NDBCLUSTER_SLAVE="--ndbcluster" ;
+ USE_RUNNING_NDBCLUSTER_SLAVE=`$ECHO "$1" | $SED -e "s;--ndb-connectstring-slave=;;"` ;;
+ --ndb-extra-test)
+ NDBCLUSTER_EXTRA_OPTS=" "
+ NDB_EXTRA_TEST=1 ;
+ ;;
+ --ndb-verbose)
+ NDB_VERBOSE=2 ;;
--ndb_mgm-extra-opts=*)
NDB_MGM_EXTRA_OPTS=`$ECHO "$1" | $SED -e "s;--ndb_mgm-extra-opts=;;"` ;;
--ndb_mgmd-extra-opts=*)
@@ -366,8 +396,9 @@ while test $# -gt 0; do
LOCAL_MASTER=1 ;;
--master_port=*) MASTER_MYPORT=`$ECHO "$1" | $SED -e "s;--master_port=;;"` ;;
--slave_port=*) SLAVE_MYPORT=`$ECHO "$1" | $SED -e "s;--slave_port=;;"` ;;
- --manager-port=*) MYSQL_MANAGER_PORT=`$ECHO "$1" | $SED -e "s;--manager_port=;;"` ;;
--ndbcluster_port=*) NDBCLUSTER_PORT=`$ECHO "$1" | $SED -e "s;--ndbcluster_port=;;"` ;;
+ --ndbcluster-port=*) NDBCLUSTER_PORT=`$ECHO "$1" | $SED -e "s;--ndbcluster-port=;;"` ;;
+ --ndbcluster-port-slave=*) NDBCLUSTER_PORT_SLAVE=`$ECHO "$1" | $SED -e "s;--ndbcluster-port-slave=;;"` ;;
--with-openssl)
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT \
--ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem \
@@ -380,11 +411,6 @@ while test $# -gt 0; do
MYSQL_TEST_SSL_OPTS="--ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem \
--ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem \
--ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem" ;;
- --no-manager | --skip-manager) USE_MANAGER=0 ;;
- --manager)
- USE_MANAGER=1
- USE_RUNNING_SERVER=0
- ;;
--start-and-exit)
START_AND_EXIT=1
;;
@@ -510,8 +536,8 @@ while test $# -gt 0; do
--valgrind | --valgrind-all)
find_valgrind;
VALGRIND=$FIND_VALGRIND
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc --skip-bdb"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc --skip-bdb"
+ EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc"
+ EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc"
SLEEP_TIME_AFTER_RESTART=10
SLEEP_TIME_FOR_DELETE=60
USE_RUNNING_SERVER=0
@@ -524,6 +550,10 @@ while test $# -gt 0; do
TMP=`$ECHO "$1" | $SED -e "s;--valgrind-options=;;"`
VALGRIND="$VALGRIND $TMP"
;;
+ --skip-ndbcluster-slave | --skip-ndb-slave)
+ USE_NDBCLUSTER_SLAVE=""
+ EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-ndbcluster"
+ ;;
--valgrind-mysqltest | --valgrind-mysqltest-all)
find_valgrind;
VALGRIND_MYSQLTEST=$FIND_VALGRIND
@@ -534,9 +564,12 @@ while test $# -gt 0; do
;;
--skip-ndbcluster | --skip-ndb)
USE_NDBCLUSTER=""
+ USE_NDBCLUSTER_SLAVE=""
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-ndbcluster"
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-ndbcluster"
;;
+ --skip-master-binlog) MASTER_MYSQLDBINLOG=0 ;;
+ --skip-slave-binlog) SLAVE_MYSQLDBINLOG=0 ;;
--skip-*)
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT $1"
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT $1"
@@ -555,6 +588,8 @@ while test $# -gt 0; do
--debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqlcheck.trace"
EXTRA_MYSQLDUMP_OPT="$EXTRA_MYSQLDUMP_OPT \
--debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqldump.trace"
+ EXTRA_MYSQLSLAP_OPT="$EXTRA_MYSQLSLAP_OPT \
+ --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqlslap.trace"
EXTRA_MYSQLSHOW_OPT="$EXTRA_MYSQLSHOW_OPT \
--debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqlshow.trace"
EXTRA_MYSQLBINLOG_OPT="$EXTRA_MYSQLBINLOG_OPT \
@@ -593,7 +628,6 @@ fi
#--
MYRUN_DIR=$MYSQL_TEST_DIR/var/run
-MANAGER_PID_FILE="$MYRUN_DIR/manager.pid"
MASTER_MYDDIR="$MYSQL_TEST_DIR/var/master-data"
MASTER_MYSOCK="$MYSQL_TMP_DIR/master.sock"
@@ -611,9 +645,13 @@ SLAVE_MYERR="$MYSQL_TEST_DIR/var/log/slave.err"
CURRENT_TEST="$MYSQL_TEST_DIR/var/log/current_test"
SMALL_SERVER="--key_buffer_size=1M --sort_buffer=256K --max_heap_table_size=1M"
-export MASTER_MYPORT SLAVE_MYPORT MYSQL_TCP_PORT MASTER_MYSOCK MASTER_MYSOCK1
+export MASTER_MYHOST MASTER_MYPORT SLAVE_MYHOST SLAVE_MYPORT MYSQL_TCP_PORT MASTER_MYSOCK MASTER_MYSOCK1
NDBCLUSTER_OPTS="--port=$NDBCLUSTER_PORT --data-dir=$MYSQL_TEST_DIR/var --ndb_mgm-extra-opts=$NDB_MGM_EXTRA_OPTS --ndb_mgmd-extra-opts=$NDB_MGMD_EXTRA_OPTS --ndbd-extra-opts=$NDBD_EXTRA_OPTS"
+NDBCLUSTER_OPTS_SLAVE="--port=$NDBCLUSTER_PORT_SLAVE --data-dir=$MYSQL_TEST_DIR/var"
+if [ -n "$USE_NDBCLUSTER_SLAVE" ] ; then
+ USE_NDBCLUSTER_SLAVE="$USE_NDBCLUSTER_SLAVE --ndb-connectstring=localhost:$NDBCLUSTER_PORT_SLAVE --ndb-extra-logging"
+fi
NDB_BACKUP_DIR=$MYSQL_TEST_DIR/var/ndbcluster-$NDBCLUSTER_PORT
NDB_TOOLS_OUTPUT=$MYSQL_TEST_DIR/var/log/ndb_tools.log
@@ -677,6 +715,11 @@ if [ x$SOURCE_DIST = x1 ] ; then
else
MYSQL_DUMP="$BASEDIR/client/mysqldump"
fi
+ if [ -f "$BASEDIR/client/.libs/mysqlslap" ] ; then
+ MYSQL_SLAP="$BASEDIR/client/.libs/mysqlslap"
+ else
+ MYSQL_SLAP="$BASEDIR/client/mysqlslap"
+ fi
if [ -f "$BASEDIR/client/.libs/mysqlimport" ] ; then
MYSQL_IMPORT="$BASEDIR/client/.libs/mysqlimport"
else
@@ -700,16 +743,13 @@ if [ x$SOURCE_DIST = x1 ] ; then
MYSQLADMIN="$CLIENT_BINDIR/mysqladmin"
WAIT_PID="$BASEDIR/extra/mysql_waitpid"
MYSQL_MY_PRINT_DEFAULTS="$BASEDIR/extra/my_print_defaults"
- MYSQL_MANAGER_CLIENT="$CLIENT_BINDIR/mysqltestmanagerc"
- MYSQL_MANAGER="$BASEDIR/tools/mysqltestmanager"
- MYSQL_MANAGER_PWGEN="$CLIENT_BINDIR/mysqltestmanager-pwgen"
MYSQL="$CLIENT_BINDIR/mysql"
LANGUAGE="$BASEDIR/sql/share/english/"
CHARSETSDIR="$BASEDIR/sql/share/charsets"
INSTALL_DB="./install_test_db"
MYSQL_FIX_SYSTEM_TABLES="$BASEDIR/scripts/mysql_fix_privilege_tables"
- NDB_TOOLS_DIR="$BASEDIR/ndb/tools"
- NDB_MGM="$BASEDIR/ndb/src/mgmclient/ndb_mgm"
+ NDB_TOOLS_DIR="$BASEDIR/storage/ndb/tools"
+ NDB_MGM="$BASEDIR/storage/ndb/src/mgmclient/ndb_mgm"
if [ -n "$USE_PURIFY" ] ; then
PSUP="$MYSQL_TEST_DIR/suppress.purify"
@@ -756,16 +796,13 @@ else
fi
MYSQL_TEST="$CLIENT_BINDIR/mysqltest"
MYSQL_CHECK="$CLIENT_BINDIR/mysqlcheck"
- MYSQL_DUMP="$CLIENT_BINDIR/mysqldump"
+ MYSQL_SLAP="$CLIENT_BINDIR/mysqlslap"
MYSQL_SHOW="$CLIENT_BINDIR/mysqlshow"
MYSQL_IMPORT="$CLIENT_BINDIR/mysqlimport"
MYSQL_BINLOG="$CLIENT_BINDIR/mysqlbinlog"
MYSQLADMIN="$CLIENT_BINDIR/mysqladmin"
WAIT_PID="$CLIENT_BINDIR/mysql_waitpid"
MYSQL_MY_PRINT_DEFAULTS="$CLIENT_BINDIR/my_print_defaults"
- MYSQL_MANAGER="$CLIENT_BINDIR/mysqltestmanager"
- MYSQL_MANAGER_CLIENT="$CLIENT_BINDIR/mysqltestmanagerc"
- MYSQL_MANAGER_PWGEN="$CLIENT_BINDIR/mysqltestmanager-pwgen"
MYSQL="$CLIENT_BINDIR/mysql"
INSTALL_DB="./install_test_db --bin"
MYSQL_FIX_SYSTEM_TABLES="$CLIENT_BINDIR/mysql_fix_privilege_tables"
@@ -795,6 +832,13 @@ else
MYSQL_TEST="$CLIENT_BINDIR/mysqltest"
MYSQL_CLIENT_TEST="$CLIENT_BINDIR/mysql_client_test"
fi
+ if [ -f "$BASEDIR/client/.libs/mysqldump" ] ; then
+ MYSQL_DUMP="$BASEDIR/client/.libs/mysqldump"
+ elif [ -f "$BASEDIR/client/mysqldump" ] ; then
+ MYSQL_DUMP="$BASEDIR/client/mysqldump"
+ else
+ MYSQL_DUMP="$BASEDIR/bin/mysqldump"
+ fi
fi
if [ -z "$MASTER_MYSQLD" ]
@@ -840,13 +884,16 @@ MYSQL_DUMP_DIR="$MYSQL_DUMP"
export MYSQL_DUMP_DIR
MYSQL_CHECK="$MYSQL_CHECK --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLCHECK_OPT"
MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
+MYSQL_SLAP="$MYSQL_SLAP -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLSLAP_OPT"
+MYSQL_DUMP_SLAVE="$MYSQL_DUMP_DIR --no-defaults -uroot --socket=$SLAVE_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_SHOW="$MYSQL_SHOW -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLSHOW_OPT"
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR --character-sets-dir=$CHARSETSDIR $EXTRA_MYSQLBINLOG_OPT"
MYSQL_IMPORT="$MYSQL_IMPORT -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
MYSQL="$MYSQL --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
-export MYSQL MYSQL_CHECK MYSQL_DUMP MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES MYSQL_IMPORT
+export MYSQL MYSQL_CHECK MYSQL_DUMP MYSQL_DUMP_SLAVE MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES MYSQL_IMPORT
export CLIENT_BINDIR MYSQL_CLIENT_TEST CHARSETSDIR MYSQL_MY_PRINT_DEFAULTS
+export MYSQL_SLAP
export NDB_TOOLS_DIR
export NDB_MGM
export NDB_BACKUP_DIR
@@ -854,6 +901,9 @@ export NDB_TOOLS_OUTPUT
export PURIFYOPTIONS
NDB_STATUS_OK=1
export NDB_STATUS_OK
+NDB_SLAVE_STATUS_OK=1
+export NDB_SLAVE_STATUS_OK
+export NDB_EXTRA_TEST NDBCLUSTER_PORT NDBCLUSTER_PORT_SLAVE
MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \
--user=$DBUSER --password=$DBPASSWD --silent -v --skip-safemalloc \
@@ -985,6 +1035,10 @@ disable_test() {
report_current_test () {
tname=$1
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
+ eval "master1_running=\$MASTER1_RUNNING"
+ if [ x$master1_running = x1 ] ; then
+ echo "CURRENT_TEST: $tname" >> $MASTER_MYERR"1"
+ fi
if [ -n "$PURIFY_LOGS" ] ; then
for log in $PURIFY_LOGS
do
@@ -1019,13 +1073,13 @@ report_stats () {
#
$RM -f $MY_LOG_DIR/warnings $MY_LOG_DIR/warnings.tmp
# Remove some non fatal warnings from the log files
- $SED -e 's!Warning: Table:.* on delete!!g' -e 's!Warning: Setting lower_case_table_names=2!!g' -e 's!Warning: One can only use the --user.*root!!g' \
+ $SED -e 's!Warning: Table:.* on delete!!g' -e 's!Warning: Setting lower_case_table_names=2!!g' -e 's!Warning: One can only use the --user.*root!!g' -e 's|InnoDB: Warning: we did not need to do crash recovery||g' \
$MY_LOG_DIR/*.err \
| $SED -e 's!Warning: Table:.* on rename!!g' \
> $MY_LOG_DIR/warnings.tmp
# Find errors
- for i in "^Warning:" "^Error:" "^==.* at 0x" "InnoDB: Warning"
+ for i in "^Warning:" "^Error:" "^==.* at 0x" "InnoDB: Warning" "missing DBUG_RETURN" "mysqld: Warning" "Attempting backtrace" "Assertion .* failed"
do
if $GREP "$i" $MY_LOG_DIR/warnings.tmp >> $MY_LOG_DIR/warnings
then
@@ -1067,7 +1121,10 @@ mysql_install_db () {
if [ ! -z "$USE_NDBCLUSTER" ]
then
$ECHO "Installing Master Databases 1"
- $INSTALL_DB -1
+# $INSTALL_DB -1
+ $RM -rf var/master-data1
+ mkdir var/master-data1
+ cp -r var/master-data/* var/master-data1
if [ $? != 0 ]; then
error "Could not install master test DBs 1"
exit 1
@@ -1075,7 +1132,9 @@ mysql_install_db () {
fi
$ECHO "Installing Slave Databases"
$RM -rf $SLAVE_MYDDIR $MY_LOG_DIR/*
- $INSTALL_DB -slave
+# $INSTALL_DB -slave
+ mkdir var/slave-data
+ cp -r var/master-data/* var/slave-data
if [ $? != 0 ]; then
error "Could not install slave test DBs"
exit 1
@@ -1137,118 +1196,58 @@ abort_if_failed()
fi
}
-start_manager()
-{
- if [ $USE_MANAGER = 0 ] ; then
- echo "Manager disabled, skipping manager start."
- $RM -f $MYSQL_MANAGER_LOG
- return
- fi
- $ECHO "Starting MySQL Manager"
- if [ -f "$MANAGER_PID_FILE" ] ; then
- kill `cat $MANAGER_PID_FILE`
- sleep 1
- if [ -f "$MANAGER_PID_FILE" ] ; then
- kill -9 `cat $MANAGER_PID_FILE`
- sleep 1
- fi
- fi
-
- $RM -f $MANAGER_PID_FILE
- MYSQL_MANAGER_PW=`$MYSQL_MANAGER_PWGEN -u $MYSQL_MANAGER_USER \
- -o $MYSQL_MANAGER_PW_FILE`
- $MYSQL_MANAGER --log=$MYSQL_MANAGER_LOG --port=$MYSQL_MANAGER_PORT \
- --password-file=$MYSQL_MANAGER_PW_FILE --pid-file=$MANAGER_PID_FILE
- abort_if_failed "Could not start MySQL manager"
- mysqltest_manager_args="--manager-host=localhost \
- --manager-user=$MYSQL_MANAGER_USER \
- --manager-password=$MYSQL_MANAGER_PW \
- --manager-port=$MYSQL_MANAGER_PORT \
- --manager-wait-timeout=$START_WAIT_TIMEOUT"
- MYSQL_TEST="$MYSQL_TEST $mysqltest_manager_args"
- MYSQL_TEST_ARGS="$MYSQL_TEST_ARGS $mysqltest_manager_args"
- while [ ! -f $MANAGER_PID_FILE ] ; do
- sleep 1
- done
- echo "Manager started"
-}
-
-stop_manager()
-{
- if [ $USE_MANAGER = 0 ] ; then
- return
- fi
- $MYSQL_MANAGER_CLIENT $MANAGER_QUIET_OPT -u$MYSQL_MANAGER_USER \
- -p$MYSQL_MANAGER_PW -P $MYSQL_MANAGER_PORT <<EOF
-shutdown
-EOF
- echo "Manager terminated"
-
-}
-
-manager_launch()
+launch_in_background()
{
- ident=$1
shift
- if [ $USE_MANAGER = 0 ] ; then
- echo $@ | /bin/sh >> $CUR_MYERR 2>&1 &
- sleep 2 #hack
- return
- fi
- $MYSQL_MANAGER_CLIENT $MANAGER_QUIET_OPT --user=$MYSQL_MANAGER_USER \
- --password=$MYSQL_MANAGER_PW --port=$MYSQL_MANAGER_PORT <<EOF
-def_exec $ident "$@"
-set_exec_stdout $ident $CUR_MYERR
-set_exec_stderr $ident $CUR_MYERR
-set_exec_con $ident root localhost $CUR_MYSOCK
-start_exec $ident $START_WAIT_TIMEOUT
-EOF
- abort_if_failed "Could not execute manager command"
+ echo $@ | /bin/sh >> $CUR_MYERR 2>&1 &
+ sleep 2 #hack
+ return
}
-manager_term()
+shutdown_mysqld()
{
pid=$1
ident=$2
- if [ $USE_MANAGER = 0 ] ; then
- # Shutdown time must be high as slave may be in reconnect
- $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=5 --shutdown_timeout=70 shutdown >> $MYSQL_MANAGER_LOG 2>&1
- res=$?
- # Some systems require an extra connect
- $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=1 ping >> $MYSQL_MANAGER_LOG 2>&1
- if test $res = 0
- then
- wait_for_pid $pid
- fi
- return $res
+ # Shutdown time must be high as slave may be in reconnect
+ $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=5 --shutdown_timeout=70 shutdown >> $MYSQL_MANAGER_LOG 2>&1
+ res=$?
+ # Some systems require an extra connect
+ $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=1 ping >> $MYSQL_MANAGER_LOG 2>&1
+ if test $res = 0
+ then
+ wait_for_pid $pid
fi
- $MYSQL_MANAGER_CLIENT $MANAGER_QUIET_OPT --user=$MYSQL_MANAGER_USER \
- --password=$MYSQL_MANAGER_PW --port=$MYSQL_MANAGER_PORT <<EOF
-stop_exec $ident $STOP_WAIT_TIMEOUT
-EOF
- abort_if_failed "Could not execute manager command"
+ return $res
}
start_ndbcluster()
{
- if [ ! -z "$USE_NDBCLUSTER" ]
+ if [ ! -n "$USE_NDBCLUSTER" ] ;
+ then
+ USING_NDBCLUSTER=0
+ USE_NDBCLUSTER_OPT=
+ fi
+
+ if [ x$USING_NDBCLUSTER = x1 -a -z "$USE_NDBCLUSTER_OPT" ]
then
rm -f $NDB_TOOLS_OUTPUT
if [ -z "$USE_RUNNING_NDBCLUSTER" ]
then
- echo "Starting ndbcluster"
- if [ "$DO_BENCH" = 1 ]
+ if [ "$DO_BENCH" != 1 -a -z "$NDBCLUSTER_EXTRA_OPTS" ]
then
- NDBCLUSTER_EXTRA_OPTS=""
- else
NDBCLUSTER_EXTRA_OPTS="--small"
fi
- ./ndb/ndbcluster $NDBCLUSTER_OPTS --character-sets-dir=$CHARSETSDIR $NDBCLUSTER_EXTRA_OPTS --initial || NDB_STATUS_OK=0
+ OPTS="$NDBCLUSTER_OPTS $NDBCLUSTER_EXTRA_OPTS --character-sets-dir=$CHARSETSDIR --verbose=$NDB_VERBOSE --initial --relative-config-data-dir --core"
+ if [ "x$NDB_VERBOSE" != "x0" ] ; then
+ echo "Starting master ndbcluster " $OPTS
+ fi
+ ./ndb/ndbcluster $OPTS || NDB_STATUS_OK=0
if [ x$NDB_STATUS_OK != x1 ] ; then
if [ x$FORCE != x1 ] ; then
exit 1
fi
- USE_NDBCLUSTER=
+ USING_NDBCLUSTER=0
+ USE_NDBCLUSTER_OPT=
return
fi
@@ -1257,19 +1256,30 @@ start_ndbcluster()
NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER"
echo "Using ndbcluster at $NDB_CONNECTSTRING"
fi
- USE_NDBCLUSTER="$USE_NDBCLUSTER --ndb-connectstring=\"$NDB_CONNECTSTRING\""
+ USE_NDBCLUSTER_OPT="$USE_NDBCLUSTER --ndb-connectstring=\"$NDB_CONNECTSTRING\" --ndb-extra-logging"
export NDB_CONNECTSTRING
fi
}
+rm_ndbcluster_tables()
+{
+ $RM -f $1/cluster/apply_status*
+ $RM -f $1/cluster/schema*
+}
+
stop_ndbcluster()
{
- if [ ! -z "$USE_NDBCLUSTER" ]
+ if [ -n "$USE_NDBCLUSTER_OPT" ]
then
+ USE_NDBCLUSTER_OPT=
if [ -z "$USE_RUNNING_NDBCLUSTER" ]
then
# Kill any running ndbcluster stuff
+ $ECHO "Stopping master cluster"
./ndb/ndbcluster $NDBCLUSTER_OPTS --stop
+ # remove ndb table the hard way as not to upset later tests
+ rm_ndbcluster_tables $MASTER_MYDDIR
+ rm_ndbcluster_tables $MASTER_MYDDIR"1"
fi
fi
}
@@ -1314,9 +1324,13 @@ start_master()
then
CURR_MASTER_MYSQLD_TRACE="$EXTRA_MASTER_MYSQLD_TRACE$1"
fi
+ if [ x$MASTER_MYSQLDBINLOG = x1 ]
+ then
+ MASTER_MYSQLD_BINLOG_OPT="--log-bin=$MYSQL_TEST_DIR/var/log/master-bin$1"
+ fi
if [ -z "$DO_BENCH" -a -z "$DO_STRESS" ]
then
- master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin$1 \
+ master_args="--no-defaults \
--server-id=$id \
--basedir=$MY_BASEDIR \
--port=$this_master_myport \
@@ -1324,7 +1338,7 @@ start_master()
--local-infile \
--exit-info=256 \
--core \
- $USE_NDBCLUSTER \
+ $USE_NDBCLUSTER_OPT \
--datadir=$MASTER_MYDDIR$1 \
--pid-file=$MASTER_MYPID$1 \
--socket=$MASTER_MYSOCK$1 \
@@ -1338,10 +1352,11 @@ start_master()
--log-bin-trust-function-creators \
$MASTER_40_ARGS \
$SMALL_SERVER \
- $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT \
+ $MASTER_MYSQLD_BINLOG_OPT \
+ $EXTRA_MASTER_MYSQLD_OPT $EXTRA_MASTER_OPT \
$NOT_FIRST_MASTER_EXTRA_OPTS $CURR_MASTER_MYSQLD_TRACE"
else
- master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin$1 \
+ master_args="--no-defaults \
--server-id=$id --rpl-recovery-rank=1 \
--basedir=$MY_BASEDIR --init-rpl-role=master \
--port=$this_master_myport \
@@ -1353,14 +1368,15 @@ start_master()
--character-sets-dir=$CHARSETSDIR \
--default-character-set=$CHARACTER_SET \
--core \
- $USE_NDBCLUSTER \
+ $USE_NDBCLUSTER_OPT \
--tmpdir=$MYSQL_TMP_DIR \
--language=$LANGUAGE \
--innodb_data_file_path=ibdata1:128M:autoextend \
--log-bin-trust-function-creators \
$MASTER_40_ARGS \
$SMALL_SERVER \
- $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT \
+ $MASTER_MYSQLD_BINLOG_OPT \
+ $EXTRA_MASTER_MYSQLD_OPT $EXTRA_MASTER_OPT \
$NOT_FIRST_MASTER_EXTRA_OPTS"
fi
@@ -1382,7 +1398,7 @@ start_master()
if [ x$DO_DDD = x1 ]
then
$ECHO "set args $master_args" > $GDB_MASTER_INIT$1
- manager_launch master ddd -display $DISPLAY --debugger \
+ launch_in_background master ddd -display $DISPLAY --debugger \
"gdb -x $GDB_MASTER_INIT$1" $MASTER_MYSQLD
elif [ x$DO_GDB = x1 ]
then
@@ -1403,11 +1419,11 @@ end
r
EOF
fi ) > $GDB_MASTER_INIT$1
- manager_launch master $XTERM -display $DISPLAY \
+ launch_in_background master $XTERM -display $DISPLAY \
-title "Master" -e gdb -x $GDB_MASTER_INIT$1 $MASTER_MYSQLD
fi
else
- manager_launch master $MASTER_MYSQLD $master_args
+ launch_in_background master $MASTER_MYSQLD $master_args
fi
sleep_until_file_created $MASTER_MYPID$1 $wait_for_master
wait_for_master=$SLEEP_TIME_FOR_SECOND_MASTER
@@ -1419,6 +1435,7 @@ start_slave()
[ x$SKIP_SLAVE = x1 ] && return
eval "this_slave_running=\$SLAVE$1_RUNNING"
[ x$this_slave_running = 1 ] && return
+
# When testing fail-safe replication, we will have more than one slave
# in this case, we start secondary slaves with an argument
slave_ident="slave$1"
@@ -1442,6 +1459,38 @@ start_slave()
slave_pid=$SLAVE_MYPID
slave_sock="$SLAVE_MYSOCK"
fi
+
+ #
+ if [ x$USING_NDBCLUSTER = x1 -a -n "$USE_NDBCLUSTER_SLAVE" ] ; then
+ if [ $slave_server_id -eq 2 ] ; then
+ savedir=`pwd`
+ cd $MYSQL_TEST_DIR
+ if [ "$DO_BENCH" != 1 -a -z "$NDBCLUSTER_EXTRA_OPTS" ]
+ then
+ NDBCLUSTER_EXTRA_OPTS="--small"
+ fi
+
+ OPTS="$NDBCLUSTER_OPTS_SLAVE --initial $NDBCLUSTER_EXTRA_OPTS --ndbd-nodes=1 --verbose=$NDB_VERBOSE --relative-config-data-dir --core"
+ if [ "x$NDB_VERBOSE" != "x0" ] ; then
+ echo "Starting slave ndbcluster " $OPTS
+ fi
+ ./ndb/ndbcluster $OPTS \
+ || NDB_SLAVE_STATUS_OK=0
+ # > /dev/null 2>&1 || NDB_SLAVE_STATUS_OK=0
+ cd $savedir
+ if [ x$NDB_SLAVE_STATUS_OK != x1 ] ; then
+ if [ x$FORCE != x1 ] ; then
+ exit 1
+ fi
+ USE_NDBCLUSTER_SLAVE_OPT=
+ USE_NDBCLUSTER_SLAVE=
+ fi
+ USE_NDBCLUSTER_SLAVE_OPT=$USE_NDBCLUSTER_SLAVE
+ fi
+ else
+ USE_NDBCLUSTER_SLAVE_OPT=
+ fi
+
# Remove stale binary logs and old master.info files
# except for too tests which need them
if [ "$tname" != "rpl_crash_binlog_ib_1b" ] && [ "$tname" != "rpl_crash_binlog_ib_2b" ] && [ "$tname" != "rpl_crash_binlog_ib_3b" ]
@@ -1467,12 +1516,16 @@ start_slave()
master_info=$SLAVE_MASTER_INFO
fi
+ if [ x$SLAVE_MYSQLDBINLOG = x1 ]
+ then
+ SLAVE_MYSQLD_BINLOG_OPT="--log-bin=$MYSQL_TEST_DIR/var/log/$slave_ident-bin --log-slave-updates"
+ fi
+
$RM -f $slave_datadir/log.*
slave_args="--no-defaults $master_info \
--exit-info=256 \
- --log-bin=$MYSQL_TEST_DIR/var/log/$slave_ident-bin \
+ $SLAVE_MYSQLDBINLOG_OPT \
--relay-log=$MYSQL_TEST_DIR/var/log/$slave_ident-relay-bin \
- --log-slave-updates \
--log=$slave_log \
--basedir=$MY_BASEDIR \
--datadir=$slave_datadir \
@@ -1493,14 +1546,16 @@ start_slave()
-O slave_net_timeout=10 \
--log-bin-trust-function-creators \
$SMALL_SERVER \
- $EXTRA_SLAVE_OPT $EXTRA_SLAVE_MYSQLD_OPT"
+ $SLAVE_MYSQLD_BINLOG_OPT \
+ $EXTRA_SLAVE_MYSQLD_OPT $EXTRA_SLAVE_OPT \
+ $USE_NDBCLUSTER_SLAVE_OPT"
CUR_MYERR=$slave_err
CUR_MYSOCK=$slave_sock
if [ x$DO_DDD = x1 ]
then
$ECHO "set args $slave_args" > $GDB_SLAVE_INIT
- manager_launch $slave_ident ddd -display $DISPLAY --debugger \
+ launch_in_background $slave_ident ddd -display $DISPLAY --debugger \
"gdb -x $GDB_SLAVE_INIT" $SLAVE_MYSQLD
elif [ x$DO_GDB = x1 ]
then
@@ -1521,11 +1576,11 @@ end
r
EOF
fi ) > $GDB_SLAVE_INIT
- manager_launch $slave_ident $XTERM -display $DISPLAY -title "Slave" -e \
+ launch_in_background $slave_ident $XTERM -display $DISPLAY -title "Slave" -e \
gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD
fi
else
- manager_launch $slave_ident $SLAVE_MYSQLD $slave_args
+ launch_in_background $slave_ident $SLAVE_MYSQLD $slave_args
fi
eval "SLAVE$1_RUNNING=1"
sleep_until_file_created $slave_pid $wait_for_slave
@@ -1541,7 +1596,6 @@ mysql_start ()
# start_master
# start_slave
cd $MYSQL_TEST_DIR
- start_ndbcluster
return 1
}
@@ -1558,7 +1612,7 @@ stop_slave ()
if [ x$this_slave_running = x1 ]
then
pid=`$CAT $slave_pid`
- manager_term $pid $slave_ident
+ shutdown_mysqld $pid $slave_ident
if [ $? != 0 ] && [ -f $slave_pid ]
then # try harder!
$ECHO "slave not cooperating with mysqladmin, will try manual kill"
@@ -1575,6 +1629,14 @@ stop_slave ()
sleep $SLEEP_TIME_AFTER_RESTART
fi
eval "SLAVE$1_RUNNING=0"
+ if [ -n "$USE_NDBCLUSTER_SLAVE_OPT" ] ; then
+ savedir=`pwd`
+ cd $MYSQL_TEST_DIR
+ $ECHO "Stopping slave cluster"
+ ./ndb/ndbcluster $NDBCLUSTER_OPTS_SLAVE --stop
+ rm_ndbcluster_tables $SLAVE_MYDDIR
+ cd $savedir
+ fi
fi
}
@@ -1597,7 +1659,7 @@ stop_master ()
# MASTER_RUNNING=0 to get cleanup when calling start_master().
if [ x$USE_EMBEDDED_SERVER != x1 ] ; then
pid=`$CAT $MASTER_MYPID$1`
- manager_term $pid master $1
+ shutdown_mysqld $pid master $1
if [ $? != 0 ] && [ -f $MASTER_MYPID$1 ]
then # try harder!
$ECHO "master not cooperating with mysqladmin, will try manual kill"
@@ -1664,6 +1726,9 @@ run_testcase ()
echo $tname > $CURRENT_TEST
SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0 \& \( $tname : federated \) = 0`
NDBCLUSTER_TEST=`$EXPR \( $tname : '.*ndb.*' \) != 0`
+ if [ "x$USE_NDBCLUSTER_ALL" = "x1" ] ; then
+ NDBCLUSTER_TEST=1
+ fi
if [ "x$USE_NDBCLUSTER_ONLY" = "x1" -a "x$NDBCLUSTER_TEST" != "x1" ] ; then
skip_test $tname
return
@@ -1760,9 +1825,20 @@ run_testcase ()
esac
stop_master
stop_master 1
+
+ # only stop the cluster if this test will not use cluster
+ if [ x$NDBCLUSTER_TEST != x1 ] ;
+ then
+ stop_ndbcluster
+ fi
+
report_current_test $tname
+ USING_NDBCLUSTER=$NDBCLUSTER_TEST
+ # start_ndbcluster knows if cluster is already started
+ start_ndbcluster
start_master
- if [ -n "$USE_NDBCLUSTER" -a -z "$DO_BENCH" -a -z "$DO_STRESS" ] ; then
+ if [ x$USING_NDBCLUSTER = x1 -a -z "$DO_BENCH" -a -z "$DO_STRESS" ] ; then
+ echo "CURRENT_TEST: $tname" >> $MASTER_MYERR"1"
start_master 1
fi
TZ=$MY_TZ; export TZ
@@ -1771,14 +1847,26 @@ run_testcase ()
# or there is no master running (FIXME strange.....)
# or there is a master init script
if [ ! -z "$EXTRA_MASTER_OPT" ] || [ x$MASTER_RUNNING != x1 ] || \
- [ -f $master_init_script ]
+ [ -f $master_init_script ] || \
+ [ -n "$USE_NDBCLUSTER" -a x$NDBCLUSTER_TEST != x$USING_NDBCLUSTER ]
then
EXTRA_MASTER_OPT=""
stop_master
stop_master 1
+
+ # only stop the cluster if this test will not use cluster
+ if [ x$NDBCLUSTER_TEST != x1 ] ;
+ then
+ stop_ndbcluster
+ fi
+
report_current_test $tname
+ USING_NDBCLUSTER=$NDBCLUSTER_TEST
+ # start_ndbcluster knows if cluster is already started
+ start_ndbcluster
start_master
- if [ -n "$USE_NDBCLUSTER" -a -z "$DO_BENCH" -a -z "$DO_STRESS" ] ; then
+ if [ x$USING_NDBCLUSTER = x1 -a -z "$DO_BENCH" -a -z "$DO_STRESS" ] ; then
+ echo "CURRENT_TEST: $tname" >> $MASTER_MYERR"1"
start_master 1
fi
else
@@ -1812,6 +1900,18 @@ run_testcase ()
fi
fi
+ USING_NDBCLUSTER=$NDBCLUSTER_TEST
+ if [ -n "$USE_NDBCLUSTER_SLAVE_OPT" ] ; then
+ if [ x$USING_NDBCLUSTER != x1 ] ; then
+ do_slave_restart=1
+ fi
+ else
+ if [ x$USING_NDBCLUSTER = x1 ] ; then
+ do_slave_restart=1
+ fi
+ fi
+
+
if [ x$do_slave_restart = x1 ] ; then
stop_slave
echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR
@@ -1888,7 +1988,6 @@ run_testcase ()
[ -z "$DO_DDD" ] && [ -z "$USE_EMBEDDED_SERVER" ]
then
mysql_stop
- stop_manager
fi
exit 1
fi
@@ -2047,10 +2146,10 @@ then
$MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
$MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK1 -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
$MYSQLADMIN --no-defaults --socket=$SLAVE_MYSOCK -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
- $MYSQLADMIN --no-defaults --host=$hostname --port=$MASTER_MYPORT -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
- $MYSQLADMIN --no-defaults --host=$hostname --port=`expr $MASTER_MYPORT+1` -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
- $MYSQLADMIN --no-defaults --host=$hostname --port=$SLAVE_MYPORT -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
- $MYSQLADMIN --no-defaults --host=$hostname --port=`expr $SLAVE_MYPORT + 1` -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
+ $MYSQLADMIN --no-defaults --host=$hostname --port=$MASTER_MYPORT --protocol=tcp -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
+ $MYSQLADMIN --no-defaults --host=$hostname --protocol=tcp --port=`expr $MASTER_MYPORT+1` -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
+ $MYSQLADMIN --no-defaults --host=$hostname --protocol=tcp --port=$SLAVE_MYPORT -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
+ $MYSQLADMIN --no-defaults --host=$hostname --protocol=tcp --port=`expr $SLAVE_MYPORT + 1` -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
sleep_until_file_deleted 0 $MASTER_MYPID
sleep_until_file_deleted 0 $MASTER_MYPID"1"
sleep_until_file_deleted 0 $SLAVE_MYPID
@@ -2058,22 +2157,13 @@ then
rm $MASTER_MYPID $MASTER_MYPID"1" $SLAVE_MYPID
fi
- # Kill any running managers
- if [ -f "$MANAGER_PID_FILE" ]
- then
- kill `cat $MANAGER_PID_FILE`
- sleep 1
- if [ -f "$MANAGER_PID_FILE" ]
- then
- kill -9 `cat $MANAGER_PID_FILE`
- sleep 1
- fi
- fi
-
+ # just to force stopping anything from previous runs
+ USE_NDBCLUSTER_OPT=$USE_NDBCLUSTER
stop_ndbcluster
# Remove files that can cause problems
$RM -rf $MYSQL_TEST_DIR/var/ndbcluster
+ $RM -rf $MYSQL_TEST_DIR/var/tmp/snapshot*
$RM -f $MYSQL_TEST_DIR/var/run/* $MYSQL_TEST_DIR/var/tmp/*
# Remove old berkeley db log files that can confuse the server
@@ -2087,10 +2177,10 @@ then
if [ -n "$1" -a `expr "X$*" : '.*ndb'` -eq 0 ]
then
- USE_NDBCLUSTER=""
+ USING_NDBCLUSTER=0
+ USE_NDBCLUSTER_OPT=
fi
- start_manager
mysql_start
$ECHO "Loading Standard Test Databases"
mysql_loadstd
@@ -2113,7 +2203,7 @@ then
EXTRA_BENCH_ARGS="--small-test --small-tables"
fi
- if [ ! -z "$USE_NDBCLUSTER" ]
+ if [ x$USING_NDBCLUSTER = x1 ]
then
EXTRA_BENCH_ARGS="--create-options=TYPE=ndb $EXTRA_BENCH_ARGS"
fi
@@ -2134,7 +2224,6 @@ then
fi
cd $savedir
mysql_stop
- stop_manager
exit
fi
@@ -2156,7 +2245,6 @@ then
if [ $USE_RUNNING_SERVER -eq 0 ] ; then
mysql_stop
- stop_manager
fi
exit
@@ -2203,7 +2291,6 @@ if [ -z "$DO_GDB" ] && [ $USE_RUNNING_SERVER -eq 0 ] && [ -z "$DO_DDD" ]
then
mysql_stop
fi
-stop_manager
report_stats
$ECHO
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 11492207a3e..48c263989d7 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -1878,7 +1878,7 @@ sub environment_setup () {
# ----------------------------------------------------
# We are nice and report a bit about our settings
# ----------------------------------------------------
- if (!$opt_extern)
+ if (!$opt_extern && $opt_verbose)
{
print "Using MTR_BUILD_THREAD = $ENV{MTR_BUILD_THREAD}\n";
print "Using MASTER_MYPORT = $ENV{MASTER_MYPORT}\n";
@@ -2596,6 +2596,11 @@ sub initialize_servers () {
}
check_running_as_root();
}
+ else
+ {
+ # We have to create the 'var' and related directories
+ cleanup_stale_files();
+ }
}
sub mysql_install_db () {
@@ -2962,15 +2967,18 @@ sub do_before_run_mysqltest($)
unlink("$result_dir/$tname.log");
unlink("$result_dir/$tname.warnings");
- mtr_tonewfile($path_current_test_log,"$tname\n"); # Always tell where we are
+ if (!$opt_extern)
+ {
+ mtr_tonewfile($path_current_test_log,"$tname\n"); # Always tell where we are
- # output current test to ndbcluster log file to enable diagnostics
- mtr_tofile($path_ndb_testrun_log,"CURRENT TEST $tname\n");
+ # output current test to ndbcluster log file to enable diagnostics
+ mtr_tofile($path_ndb_testrun_log,"CURRENT TEST $tname\n");
- mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n");
- if ( $master->[1]->{'pid'} )
- {
- mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n");
+ mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n");
+ if ( $master->[1]->{'pid'} )
+ {
+ mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n");
+ }
}
if ( $mysql_version_id < 50000 )
@@ -3992,7 +4000,6 @@ sub run_testcase_stop_servers($$$) {
if ( $do_restart || $do_slave_restart )
{
-
delete $slave->[0]->{'running_slave_options'}; # Forget history
# Start shutdown of all started slaves
@@ -4487,7 +4494,6 @@ sub run_mysqltest ($) {
}
return $res;
-
}
diff --git a/mysql-test/mysql_test_run_new.c b/mysql-test/mysql_test_run_new.c
deleted file mode 100644
index 79db71fa274..00000000000
--- a/mysql-test/mysql_test_run_new.c
+++ /dev/null
@@ -1,1933 +0,0 @@
-/*
- Copyright (c) 2002, 2003 Novell, Inc. All Rights Reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#ifndef __WIN__
-#include <dirent.h>
-#endif
-#include <string.h>
-#ifdef __NETWARE__
-#include <screen.h>
-#include <nks/vm.h>
-#endif
-#include <ctype.h>
-#include <sys/stat.h>
-#ifndef __WIN__
-#include <unistd.h>
-#endif
-#include <fcntl.h>
-#ifdef __NETWARE__
-#include <sys/mode.h>
-#endif
-#ifdef __WIN__
-#include <windows.h>
-#include <shlwapi.h>
-#include <direct.h>
-#endif
-
-#include "my_manage.h"
-
-/******************************************************************************
-
- macros
-
-******************************************************************************/
-
-#define HEADER "TEST RESULT \n"
-#define DASH "-------------------------------------------------------\n"
-
-#define NW_TEST_SUFFIX ".nw-test"
-#define NW_RESULT_SUFFIX ".nw-result"
-#define TEST_SUFFIX ".test"
-#define RESULT_SUFFIX ".result"
-#define REJECT_SUFFIX ".reject"
-#define OUT_SUFFIX ".out"
-#define ERR_SUFFIX ".err"
-
-const char *TEST_PASS= "[ pass ]";
-const char *TEST_SKIP= "[ skip ]";
-const char *TEST_FAIL= "[ fail ]";
-const char *TEST_BAD= "[ bad ]";
-const char *TEST_IGNORE= "[ignore]";
-
-/******************************************************************************
-
- global variables
-
-******************************************************************************/
-
-#ifdef __NETWARE__
-static char base_dir[FN_REFLEN]= "sys:/mysql";
-#else
-static char base_dir[FN_REFLEN]= "..";
-#endif
-static char db[FN_LEN]= "test";
-static char user[FN_LEN]= "root";
-static char password[FN_LEN]= "";
-
-int master_port= 9306;
-int slave_port= 9307;
-
-#if !defined(__NETWARE__) && !defined(__WIN__)
-static char master_socket[FN_REFLEN]= "./var/tmp/master.sock";
-static char slave_socket[FN_REFLEN]= "./var/tmp/slave.sock";
-#endif
-
-#define MAX_COUNT_TESTES 1024
-
-#ifdef __WIN__
-# define sting_compare_func _stricmp
-#else
-# ifdef HAVE_STRCASECMP
-# define sting_compare_func strcasecmp
-# else
-# define sting_compare_func strcmp
-# endif
-#endif
-
-/* comma delimited list of tests to skip or empty string */
-#ifndef __WIN__
-static char skip_test[FN_REFLEN]= " lowercase_table3 , system_mysql_db_fix ";
-#else
-/*
- The most ignore testes contain the calls of system command
-
- lowercase_table3 is disabled by Gerg
- system_mysql_db_fix is disabled by Gerg
- sp contains a command system
- rpl_EE_error contains a command system
- rpl_loaddatalocal contains a command system
- ndb_autodiscover contains a command system
- rpl_rotate_logs contains a command system
- repair contains a command system
- rpl_trunc_binlog contains a command system
- mysqldump contains a command system
- rpl000001 makes non-exit loop...temporary skiped
-*/
-static char skip_test[FN_REFLEN]=
-" lowercase_table3 ,"
-" system_mysql_db_fix ,"
-" sp ,"
-" rpl_EE_error ,"
-" rpl_loaddatalocal ,"
-" ndb_autodiscover ,"
-" rpl_rotate_logs ,"
-" repair ,"
-" rpl_trunc_binlog ,"
-" mysqldump ,"
-" rpl000001 ,"
-
-" derived ,"
-" group_by ,"
-" select ,"
-" rpl000015 ,"
-" subselect ";
-#endif
-static char ignore_test[FN_REFLEN]= "";
-
-static char bin_dir[FN_REFLEN];
-static char mysql_test_dir[FN_REFLEN];
-static char test_dir[FN_REFLEN];
-static char mysql_tmp_dir[FN_REFLEN];
-static char result_dir[FN_REFLEN];
-static char master_dir[FN_REFLEN];
-static char slave_dir[FN_REFLEN];
-static char slave1_dir[FN_REFLEN];
-static char slave2_dir[FN_REFLEN];
-static char lang_dir[FN_REFLEN];
-static char char_dir[FN_REFLEN];
-
-static char mysqladmin_file[FN_REFLEN];
-static char mysqld_file[FN_REFLEN];
-static char mysqltest_file[FN_REFLEN];
-#ifndef __WIN__
-static char master_pid[FN_REFLEN];
-static char slave_pid[FN_REFLEN];
-static char sh_file[FN_REFLEN]= "/bin/sh";
-#else
-static HANDLE master_pid;
-static HANDLE slave_pid;
-#endif
-
-static char master_opt[FN_REFLEN]= "";
-static char slave_opt[FN_REFLEN]= "";
-
-static char slave_master_info[FN_REFLEN]= "";
-
-static char master_init_script[FN_REFLEN]= "";
-static char slave_init_script[FN_REFLEN]= "";
-
-/* OpenSSL */
-static char ca_cert[FN_REFLEN];
-static char server_cert[FN_REFLEN];
-static char server_key[FN_REFLEN];
-static char client_cert[FN_REFLEN];
-static char client_key[FN_REFLEN];
-
-int total_skip= 0;
-int total_pass= 0;
-int total_fail= 0;
-int total_test= 0;
-
-int total_ignore= 0;
-
-int use_openssl= FALSE;
-int master_running= FALSE;
-int slave_running= FALSE;
-int skip_slave= TRUE;
-int single_test= TRUE;
-
-int restarts= 0;
-
-FILE *log_fd= NULL;
-
-static char argument[FN_REFLEN];
-
-/******************************************************************************
-
- functions
-
-******************************************************************************/
-
-/******************************************************************************
-
- prototypes
-
-******************************************************************************/
-
-void report_stats();
-void install_db(char *);
-void mysql_install_db();
-void start_master();
-void start_slave();
-void mysql_start();
-void stop_slave();
-void stop_master();
-void mysql_stop();
-void mysql_restart();
-int read_option(char *, char *);
-void run_test(char *);
-void setup(char *);
-void vlog(const char *, va_list);
-void mlog(const char *, ...);
-void log_info(const char *, ...);
-void log_error(const char *, ...);
-void log_errno(const char *, ...);
-void die(const char *);
-char *str_tok(char* dest, char *string, const char *delim);
-#ifndef __WIN__
-void run_init_script(const char *script_name);
-#endif
-/******************************************************************************
-
- report_stats()
-
- Report the gathered statistics.
-
-******************************************************************************/
-
-void report_stats()
-{
- if (total_fail == 0)
- {
- mlog("\nAll %d test(s) were successful.\n", total_test);
- }
- else
- {
- double percent= ((double)total_pass / total_test) * 100;
-
- mlog("\nFailed %u/%u test(s), %.02f%% successful.\n",
- total_fail, total_test, percent);
- mlog("\nThe .out and .err files in %s may give you some\n", result_dir);
- mlog("hint of what when wrong.\n");
- mlog("\nIf you want to report this error, please first read "
- "the documentation\n");
- mlog("at: http://www.mysql.com/doc/M/y/MySQL_test_suite.html\n");
- }
-}
-
-/******************************************************************************
-
- install_db()
-
- Install the a database.
-
-******************************************************************************/
-
-void install_db(char *datadir)
-{
- arg_list_t al;
- int err;
- char input[FN_REFLEN];
- char output[FN_REFLEN];
- char error[FN_REFLEN];
-
- /* input file */
-#ifdef __NETWARE__
- snprintf(input, FN_REFLEN, "%s/bin/init_db.sql", base_dir);
-#else
- snprintf(input, FN_REFLEN, "%s/mysql-test/init_db.sql", base_dir);
-#endif
- snprintf(output, FN_REFLEN, "%s/install.out", datadir);
- snprintf(error, FN_REFLEN, "%s/install.err", datadir);
-
- if (create_system_files(datadir,input, TRUE))
- die("Unable to create init_db.sql.");
- /* args */
- init_args(&al);
- add_arg(&al, mysqld_file);
- add_arg(&al, "--no-defaults");
- add_arg(&al, "--bootstrap");
- add_arg(&al, "--skip-grant-tables");
- add_arg(&al, "--basedir=%s", base_dir);
- add_arg(&al, "--datadir=%s", datadir);
- add_arg(&al, "--skip-innodb");
- add_arg(&al, "--skip-ndbcluster");
- add_arg(&al, "--skip-bdb");
-#ifndef __NETWARE__
- add_arg(&al, "--character-sets-dir=%s", char_dir);
- add_arg(&al, "--language=%s", lang_dir);
-#endif
-// added
- add_arg(&al, "--default-character-set=latin1");
- add_arg(&al, "--innodb_data_file_path=ibdata1:50M");
-
- /* spawn */
- if ((err= spawn(mysqld_file, &al, TRUE, input, output, error, NULL)) != 0)
- {
- die("Unable to create database.");
- }
-
- /* free args */
- free_args(&al);
-}
-
-/******************************************************************************
-
- mysql_install_db()
-
- Install the test databases.
-
-******************************************************************************/
-
-void mysql_install_db()
-{
- char temp[FN_REFLEN];
-
- /* var directory */
- snprintf(temp, FN_REFLEN, "%s/var", mysql_test_dir);
-
- /* create var directory */
-#ifndef __WIN__
- mkdir(temp, S_IRWXU);
- /* create subdirectories */
- mlog("Creating test-suite folders...\n");
- snprintf(temp, FN_REFLEN, "%s/var/run", mysql_test_dir);
- mkdir(temp, S_IRWXU);
- snprintf(temp, FN_REFLEN, "%s/var/tmp", mysql_test_dir);
- mkdir(temp, S_IRWXU);
- snprintf(temp, FN_REFLEN, "%s/var/master-data", mysql_test_dir);
- mkdir(temp, S_IRWXU);
- snprintf(temp, FN_REFLEN, "%s/var/master-data/mysql", mysql_test_dir);
- mkdir(temp, S_IRWXU);
- snprintf(temp, FN_REFLEN, "%s/var/master-data/test", mysql_test_dir);
- mkdir(temp, S_IRWXU);
-
- snprintf(temp, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
- mkdir(temp, S_IRWXU);
- snprintf(temp, FN_REFLEN, "%s/var/slave-data/mysql", mysql_test_dir);
- mkdir(temp, S_IRWXU);
- snprintf(temp, FN_REFLEN, "%s/var/slave-data/test", mysql_test_dir);
- mkdir(temp, S_IRWXU);
-
- snprintf(temp, FN_REFLEN, "%s/var/slave1-data", mysql_test_dir);
- mkdir(temp, S_IRWXU);
- snprintf(temp, FN_REFLEN, "%s/var/slave1-data/mysql", mysql_test_dir);
- mkdir(temp, S_IRWXU);
- snprintf(temp, FN_REFLEN, "%s/var/slave1-data/test", mysql_test_dir);
- mkdir(temp, S_IRWXU);
-
- snprintf(temp, FN_REFLEN, "%s/var/slave2-data", mysql_test_dir);
- mkdir(temp, S_IRWXU);
- snprintf(temp, FN_REFLEN, "%s/var/slave2-data/mysql", mysql_test_dir);
- mkdir(temp, S_IRWXU);
- snprintf(temp, FN_REFLEN, "%s/var/slave2-data/test", mysql_test_dir);
- mkdir(temp, S_IRWXU);
-#else
- mkdir(temp);
- /* create subdirectories */
- mlog("Creating test-suite folders...\n");
- snprintf(temp, FN_REFLEN, "%s/var/run", mysql_test_dir);
- mkdir(temp);
- snprintf(temp, FN_REFLEN, "%s/var/tmp", mysql_test_dir);
- mkdir(temp);
- snprintf(temp, FN_REFLEN, "%s/var/master-data", mysql_test_dir);
- mkdir(temp);
- snprintf(temp, FN_REFLEN, "%s/var/master-data/mysql", mysql_test_dir);
- mkdir(temp);
- snprintf(temp, FN_REFLEN, "%s/var/master-data/test", mysql_test_dir);
- mkdir(temp);
- snprintf(temp, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
- mkdir(temp);
- snprintf(temp, FN_REFLEN, "%s/var/slave-data/mysql", mysql_test_dir);
- mkdir(temp);
- snprintf(temp, FN_REFLEN, "%s/var/slave-data/test", mysql_test_dir);
- mkdir(temp);
-#endif
-
- /* install databases */
- mlog("Creating test databases for master... \n");
- install_db(master_dir);
- mlog("Creating test databases for slave... \n");
- install_db(slave_dir);
- install_db(slave1_dir);
- install_db(slave2_dir);
-}
-
-/******************************************************************************
-
- start_master()
-
- Start the master server.
-
-******************************************************************************/
-
-void start_master()
-{
- arg_list_t al;
- int err;
- char master_out[FN_REFLEN];
- char master_err[FN_REFLEN];
- char temp2[FN_REFLEN];
-
- /* remove old berkeley db log files that can confuse the server */
- removef("%s/log.*", master_dir);
-
- /* remove stale binary logs */
- removef("%s/var/log/*-bin.*", mysql_test_dir);
-
- /* remove stale binary logs */
- removef("%s/var/log/*.index", mysql_test_dir);
-
- /* remove master.info file */
- removef("%s/master.info", master_dir);
-
- /* remove relay files */
- removef("%s/var/log/*relay*", mysql_test_dir);
-
- /* remove relay-log.info file */
- removef("%s/relay-log.info", master_dir);
-
- /* init script */
- if (master_init_script[0] != 0)
- {
-#ifdef __NETWARE__
- /* TODO: use the scripts */
- if (strinstr(master_init_script, "repair_part2-master.sh") != 0)
- {
- FILE *fp;
-
- /* create an empty index file */
- snprintf(temp, FN_REFLEN, "%s/test/t1.MYI", master_dir);
- fp= fopen(temp, "wb+");
-
- fputs("1", fp);
-
- fclose(fp);
- }
-#elif !defined(__WIN__)
- run_init_script(master_init_script);
-#endif
- }
-
- /* redirection files */
- snprintf(master_out, FN_REFLEN, "%s/var/run/master%u.out",
- mysql_test_dir, restarts);
- snprintf(master_err, FN_REFLEN, "%s/var/run/master%u.err",
- mysql_test_dir, restarts);
-#ifndef __WIN__
- snprintf(temp2,FN_REFLEN,"%s/var",mysql_test_dir);
- mkdir(temp2,S_IRWXU);
- snprintf(temp2,FN_REFLEN,"%s/var/log",mysql_test_dir);
- mkdir(temp2,S_IRWXU);
-#else
- snprintf(temp2,FN_REFLEN,"%s/var",mysql_test_dir);
- mkdir(temp2);
- snprintf(temp2,FN_REFLEN,"%s/var/log",mysql_test_dir);
- mkdir(temp2);
-#endif
- /* args */
- init_args(&al);
- add_arg(&al, "%s", mysqld_file);
- add_arg(&al, "--no-defaults");
- add_arg(&al, "--log-bin=%s/var/log/master-bin",mysql_test_dir);
- add_arg(&al, "--server-id=1");
- add_arg(&al, "--basedir=%s", base_dir);
- add_arg(&al, "--port=%u", master_port);
-#if !defined(__NETWARE__) && !defined(__WIN__)
- add_arg(&al, "--socket=%s",master_socket);
-#endif
- add_arg(&al, "--local-infile");
- add_arg(&al, "--core");
- add_arg(&al, "--log-bin-trust-function-creators");
- add_arg(&al, "--datadir=%s", master_dir);
-#ifndef __WIN__
- add_arg(&al, "--pid-file=%s", master_pid);
-#endif
- add_arg(&al, "--character-sets-dir=%s", char_dir);
- add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
- add_arg(&al, "--language=%s", lang_dir);
-
- add_arg(&al, "--rpl-recovery-rank=1");
- add_arg(&al, "--init-rpl-role=master");
- add_arg(&al, "--default-character-set=latin1");
-// add_arg(&al, "--innodb_data_file_path=ibdata1:50M");
-#ifdef DEBUG /* only for debug builds */
- add_arg(&al, "--debug");
-#endif
-
- if (use_openssl)
- {
- add_arg(&al, "--ssl-ca=%s", ca_cert);
- add_arg(&al, "--ssl-cert=%s", server_cert);
- add_arg(&al, "--ssl-key=%s", server_key);
- }
-
- /* $MASTER_40_ARGS */
- add_arg(&al, "--rpl-recovery-rank=1");
- add_arg(&al, "--init-rpl-role=master");
-
- /* $SMALL_SERVER */
- add_arg(&al, "-O");
- add_arg(&al, "key_buffer_size=1M");
- add_arg(&al, "-O");
- add_arg(&al, "sort_buffer=256K");
- add_arg(&al, "-O");
- add_arg(&al, "max_heap_table_size=1M");
-
- /* $EXTRA_MASTER_OPT */
- if (master_opt[0] != 0)
- {
- char *p;
-
- p= (char *)str_tok(argument, master_opt, " \t");
- if (!strstr(master_opt, "timezone"))
- {
- while (p)
- {
- add_arg(&al, "%s", p);
- p= (char *)str_tok(argument, NULL, " \t");
- }
- }
- }
-
- /* remove the pid file if it exists */
-#ifndef __WIN__
- remove(master_pid);
-#endif
-
- /* spawn */
-#ifdef __WIN__
- if ((err= spawn(mysqld_file, &al, FALSE, NULL,
- master_out, master_err, &master_pid)) == 0)
-#else
- if ((err= spawn(mysqld_file, &al, FALSE, NULL,
- master_out, master_err, master_pid)) == 0)
-#endif
- {
- sleep_until_file_exists(master_pid);
-
- if ((err= wait_for_server_start(bin_dir, mysqladmin_file, user, password,
- master_port, mysql_tmp_dir)) == 0)
- {
- master_running= TRUE;
- }
- else
- {
- log_error("The master server went down early.");
- }
- }
- else
- {
- log_error("Unable to start master server.");
- }
-
- /* free_args */
- free_args(&al);
-}
-
-/******************************************************************************
-
- start_slave()
-
- Start the slave server.
-
-******************************************************************************/
-
-void start_slave()
-{
- arg_list_t al;
- int err;
- char slave_out[FN_REFLEN];
- char slave_err[FN_REFLEN];
-
- /* skip? */
- if (skip_slave) return;
-
- /* remove stale binary logs */
- removef("%s/*-bin.*", slave_dir);
-
- /* remove stale binary logs */
- removef("%s/*.index", slave_dir);
-
- /* remove master.info file */
- removef("%s/master.info", slave_dir);
-
- /* remove relay files */
- removef("%s/var/log/*relay*", mysql_test_dir);
-
- /* remove relay-log.info file */
- removef("%s/relay-log.info", slave_dir);
-
- /* init script */
- if (slave_init_script[0] != 0)
- {
-#ifdef __NETWARE__
- /* TODO: use the scripts */
- if (strinstr(slave_init_script, "rpl000016-slave.sh") != 0)
- {
- /* create empty master.info file */
- snprintf(temp, FN_REFLEN, "%s/master.info", slave_dir);
- close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO));
- }
- else if (strinstr(slave_init_script, "rpl000017-slave.sh") != 0)
- {
- FILE *fp;
-
- /* create a master.info file */
- snprintf(temp, FN_REFLEN, "%s/master.info", slave_dir);
- fp= fopen(temp, "wb+");
-
- fputs("master-bin.000001\n", fp);
- fputs("4\n", fp);
- fputs("127.0.0.1\n", fp);
- fputs("replicate\n", fp);
- fputs("aaaaaaaaaaaaaaab\n", fp);
- fputs("9306\n", fp);
- fputs("1\n", fp);
- fputs("0\n", fp);
-
- fclose(fp);
- }
- else if (strinstr(slave_init_script, "rpl_rotate_logs-slave.sh") != 0)
- {
- /* create empty master.info file */
- snprintf(temp, FN_REFLEN, "%s/master.info", slave_dir);
- close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO));
- }
-#elif !defined(__WIN__)
- run_init_script(slave_init_script);
-#endif
- }
-
- /* redirection files */
- snprintf(slave_out, FN_REFLEN, "%s/var/run/slave%u.out",
- mysql_test_dir, restarts);
- snprintf(slave_err, FN_REFLEN, "%s/var/run/slave%u.err",
- mysql_test_dir, restarts);
-
- /* args */
- init_args(&al);
- add_arg(&al, "%s", mysqld_file);
- add_arg(&al, "--no-defaults");
- add_arg(&al, "--log-bin=slave-bin");
- add_arg(&al, "--relay_log=slave-relay-bin");
- add_arg(&al, "--basedir=%s", base_dir);
-#if !defined(__NETWARE__) && !defined(__WIN__)
- add_arg(&al, "--socket=%s",slave_socket);
-#endif
- add_arg(&al, "--port=%u", slave_port);
- add_arg(&al, "--datadir=%s", slave_dir);
-#ifndef __WIN__
- add_arg(&al, "--pid-file=%s", slave_pid);
-#endif
- add_arg(&al, "--character-sets-dir=%s", char_dir);
- add_arg(&al, "--core");
- add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
- add_arg(&al, "--language=%s", lang_dir);
-
- add_arg(&al, "--exit-info=256");
- add_arg(&al, "--log-slave-updates");
- add_arg(&al, "--init-rpl-role=slave");
- add_arg(&al, "--skip-innodb");
- add_arg(&al, "--skip-slave-start");
- add_arg(&al, "--slave-load-tmpdir=../../var/tmp");
-
- add_arg(&al, "--report-user=%s", user);
- add_arg(&al, "--report-host=127.0.0.1");
- add_arg(&al, "--report-port=%u", slave_port);
-
- add_arg(&al, "--master-retry-count=10");
- add_arg(&al, "-O");
- add_arg(&al, "slave_net_timeout=10");
- add_arg(&al, "--log-slave-updates");
- add_arg(&al, "--log=%s/var/log/slave.log", mysql_test_dir);
- add_arg(&al, "--default-character-set=latin1");
- add_arg(&al, "--skip-ndbcluster");
-
-#ifdef DEBUG /* only for debug builds */
- add_arg(&al, "--debug");
-#endif
-
- if (use_openssl)
- {
- add_arg(&al, "--ssl-ca=%s", ca_cert);
- add_arg(&al, "--ssl-cert=%s", server_cert);
- add_arg(&al, "--ssl-key=%s", server_key);
- }
-
- /* slave master info */
- if (slave_master_info[0] != 0)
- {
- char *p;
-
- p= (char *)str_tok(argument, slave_master_info, " \t");
-
- while (p)
- {
- add_arg(&al, "%s", p);
- p= (char *)str_tok(argument, NULL, " \t");
- }
- }
- else
- {
- add_arg(&al, "--master-user=%s", user);
- add_arg(&al, "--master-password=%s", password);
- add_arg(&al, "--master-host=127.0.0.1");
- add_arg(&al, "--master-port=%u", master_port);
- add_arg(&al, "--master-connect-retry=1");
- add_arg(&al, "--server-id=2");
- add_arg(&al, "--rpl-recovery-rank=2");
- }
-
- /* small server */
- add_arg(&al, "-O");
- add_arg(&al, "key_buffer_size=1M");
- add_arg(&al, "-O");
- add_arg(&al, "sort_buffer=256K");
- add_arg(&al, "-O");
- add_arg(&al, "max_heap_table_size=1M");
-
-
- /* opt args */
- if (slave_opt[0] != 0)
- {
- char *p;
-
- p= (char *)str_tok(argument, slave_opt, " \t");
-
- while (p)
- {
- add_arg(&al, "%s", p);
- p= (char *)str_tok(argument, NULL, " \t");
- }
- }
-
- /* remove the pid file if it exists */
-#ifndef __WIN__
- remove(slave_pid);
-#endif
- /* spawn */
-#ifdef __WIN__
- if ((err= spawn(mysqld_file, &al, FALSE, NULL,
- slave_out, slave_err, &slave_pid)) == 0)
-#else
- if ((err= spawn(mysqld_file, &al, FALSE, NULL,
- slave_out, slave_err, slave_pid)) == 0)
-#endif
- {
- sleep_until_file_exists(slave_pid);
-
- if ((err= wait_for_server_start(bin_dir, mysqladmin_file, user, password,
- slave_port, mysql_tmp_dir)) == 0)
- {
- slave_running= TRUE;
- }
- else
- {
- log_error("The slave server went down early.");
- }
- }
- else
- {
- log_error("Unable to start slave server.");
- }
-
- /* free args */
- free_args(&al);
-}
-
-/******************************************************************************
-
- mysql_start()
-
- Start the mysql servers.
-
-******************************************************************************/
-
-void mysql_start()
-{
-
-
- printf("loading master...\r");
- start_master();
-
- printf("loading slave...\r");
- start_slave();
-
- /* activate the test screen */
-#ifdef __NETWARE__
- ActivateScreen(getscreenhandle());
-#endif
-}
-
-/******************************************************************************
-
- stop_slave()
-
- Stop the slave server.
-
-******************************************************************************/
-
-void stop_slave()
-{
- int err;
-
- /* running? */
- if (!slave_running) return;
-
- /* stop */
- if ((err= stop_server(bin_dir, mysqladmin_file, user, password,
- slave_port, slave_pid, mysql_tmp_dir)) == 0)
- {
- slave_running= FALSE;
- }
- else
- {
- log_error("Unable to stop slave server.");
- }
-}
-
-/******************************************************************************
-
- stop_master()
-
- Stop the master server.
-
-******************************************************************************/
-
-void stop_master()
-{
- int err;
-
- /* running? */
- if (!master_running) return;
-
- if ((err= stop_server(bin_dir, mysqladmin_file, user, password,
- master_port, master_pid, mysql_tmp_dir)) == 0)
- {
- master_running= FALSE;
- }
- else
- {
- log_error("Unable to stop master server.");
- }
-}
-
-/******************************************************************************
-
- mysql_stop()
-
- Stop the mysql servers.
-
-******************************************************************************/
-
-void mysql_stop()
-{
-
- stop_master();
-
- stop_slave();
-
- /* activate the test screen */
-#ifdef __NETWARE__
- ActivateScreen(getscreenhandle());
-#endif
-}
-
-/******************************************************************************
-
- mysql_restart()
-
- Restart the mysql servers.
-
-******************************************************************************/
-
-void mysql_restart()
-{
-/* log_info("Restarting the MySQL server(s): %u", ++restarts); */
-
- mysql_stop();
-
- mlog(DASH);
- sleep(1);
-
- mysql_start();
-}
-
-/******************************************************************************
-
- read_option()
-
- Read the option file.
-
-******************************************************************************/
-
-int read_option(char *opt_file, char *opt)
-{
- int fd, err;
- char *p;
- char buf[FN_REFLEN];
-
- /* copy current option */
- strncpy(buf, opt, FN_REFLEN);
-
- /* open options file */
- fd= open(opt_file, O_RDONLY);
- err= read(fd, opt, FN_REFLEN);
- close(fd);
-
- if (err > 0)
- {
- /* terminate string */
- if ((p= strchr(opt, '\n')) != NULL)
- {
- *p= 0;
-
- /* check for a '\r' */
- if ((p= strchr(opt, '\r')) != NULL)
- {
- *p= 0;
- }
- }
- else
- {
- opt[err]= 0;
- }
-
- /* check for $MYSQL_TEST_DIR */
- if ((p= strstr(opt, "$MYSQL_TEST_DIR")) != NULL)
- {
- char temp[FN_REFLEN];
-
- *p= 0;
-
- strcpy(temp, p + strlen("$MYSQL_TEST_DIR"));
- strcat(opt, mysql_test_dir);
- strcat(opt, temp);
- }
- /* Check for double backslash and replace it with single bakslash */
- if ((p= strstr(opt, "\\\\")) != NULL)
- {
- /* bmove is guranteed to work byte by byte */
- bmove(p, p+1, strlen(p)+1);
- }
- }
- else
- {
- /* clear option */
- *opt= 0;
- }
-
- /* compare current option with previous */
- return strcmp(opt, buf);
-}
-
-/******************************************************************************
-
- run_test()
-
- Run the given test case.
-
-******************************************************************************/
-
-void run_test(char *test)
-{
- char temp[FN_REFLEN];
- const char *rstr;
- int skip= FALSE, ignore=FALSE;
- int restart= FALSE;
- int flag= FALSE;
- struct stat info;
-
- /* skip tests in the skip list */
- snprintf(temp, FN_REFLEN, " %s ", test);
- skip= (strinstr(skip_test, temp) != 0);
- if (skip == FALSE)
- ignore= (strinstr(ignore_test, temp) != 0);
-
- snprintf(master_init_script, FN_REFLEN, "%s/%s-master.sh", test_dir, test);
- snprintf(slave_init_script, FN_REFLEN, "%s/%s-slave.sh", test_dir, test);
-#ifdef __WIN__
- if (! stat(master_init_script, &info))
- skip= TRUE;
- if (!stat(slave_init_script, &info))
- skip= TRUE;
-#endif
- if (ignore)
- {
- /* show test */
- mlog("%-46s ", test);
-
- /* ignore */
- rstr= TEST_IGNORE;
- ++total_ignore;
- }
- else if (!skip) /* skip test? */
- {
- char test_file[FN_REFLEN];
- char master_opt_file[FN_REFLEN];
- char slave_opt_file[FN_REFLEN];
- char slave_master_info_file[FN_REFLEN];
- char result_file[FN_REFLEN];
- char reject_file[FN_REFLEN];
- char out_file[FN_REFLEN];
- char err_file[FN_REFLEN];
- int err;
- arg_list_t al;
- /* skip slave? */
- flag= skip_slave;
- skip_slave= (strncmp(test, "rpl", 3) != 0);
- if (flag != skip_slave) restart= TRUE;
-
- /* create files */
- snprintf(master_opt_file, FN_REFLEN, "%s/%s-master.opt", test_dir, test);
- snprintf(slave_opt_file, FN_REFLEN, "%s/%s-slave.opt", test_dir, test);
- snprintf(slave_master_info_file, FN_REFLEN, "%s/%s.slave-mi",
- test_dir, test);
- snprintf(reject_file, FN_REFLEN, "%s/%s%s",
- result_dir, test, REJECT_SUFFIX);
- snprintf(out_file, FN_REFLEN, "%s/%s%s", result_dir, test, OUT_SUFFIX);
- snprintf(err_file, FN_REFLEN, "%s/%s%s", result_dir, test, ERR_SUFFIX);
-
- /* netware specific files */
- snprintf(test_file, FN_REFLEN, "%s/%s%s", test_dir, test, NW_TEST_SUFFIX);
- if (stat(test_file, &info))
- {
- snprintf(test_file, FN_REFLEN, "%s/%s%s", test_dir, test, TEST_SUFFIX);
- if (access(test_file,0))
- {
- printf("Invalid test name %s, %s file not found\n",test,test_file);
- return;
- }
- }
-
- snprintf(result_file, FN_REFLEN, "%s/%s%s",
- result_dir, test, NW_RESULT_SUFFIX);
- if (stat(result_file, &info))
- {
- snprintf(result_file, FN_REFLEN, "%s/%s%s",
- result_dir, test, RESULT_SUFFIX);
- }
-
- /* init scripts */
- if (stat(master_init_script, &info))
- master_init_script[0]= 0;
- else
- restart= TRUE;
-
- if (stat(slave_init_script, &info))
- slave_init_script[0]= 0;
- else
- restart= TRUE;
-
- /* read options */
- if (read_option(master_opt_file, master_opt)) restart= TRUE;
- if (read_option(slave_opt_file, slave_opt)) restart= TRUE;
- if (read_option(slave_master_info_file, slave_master_info)) restart= TRUE;
-
- /* cleanup previous run */
- remove(reject_file);
- remove(out_file);
- remove(err_file);
-
- /* start or restart? */
- if (!master_running) mysql_start();
- else if (restart) mysql_restart();
-
- /* show test */
- mlog("%-46s ", test);
-
- /* args */
- init_args(&al);
- add_arg(&al, "%s", mysqltest_file);
- add_arg(&al, "--no-defaults");
- add_arg(&al, "--port=%u", master_port);
-#if !defined(__NETWARE__) && !defined(__WIN__)
- add_arg(&al, "--socket=%s", master_socket);
- add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
-#endif
- add_arg(&al, "--database=%s", db);
- add_arg(&al, "--user=%s", user);
- add_arg(&al, "--password=%s", password);
- add_arg(&al, "--silent");
- add_arg(&al, "--basedir=%s/", mysql_test_dir);
- add_arg(&al, "--host=127.0.0.1");
- add_arg(&al, "--skip-safemalloc");
- add_arg(&al, "-v");
- add_arg(&al, "-R");
- add_arg(&al, "%s", result_file);
-
-
- if (use_openssl)
- {
- add_arg(&al, "--ssl-ca=%s", ca_cert);
- add_arg(&al, "--ssl-cert=%s", client_cert);
- add_arg(&al, "--ssl-key=%s", client_key);
- }
-
- /* spawn */
- err= spawn(mysqltest_file, &al, TRUE, test_file, out_file, err_file, NULL);
- /* free args */
- free_args(&al);
-
- remove_empty_file(out_file);
- remove_empty_file(err_file);
-
- if (err == 0)
- {
- /* pass */
- rstr= TEST_PASS;
- ++total_pass;
-
- /* increment total */
- ++total_test;
- }
- else if (err == 2)
- {
- /* skip */
- rstr= TEST_SKIP;
- ++total_skip;
- }
- else if (err == 1)
- {
- /* fail */
- rstr= TEST_FAIL;
- ++total_fail;
-
- /* increment total */
- ++total_test;
- }
- else
- {
- rstr= TEST_BAD;
- }
- }
- else /* early skips */
- {
- /* show test */
- mlog("%-46s ", test);
-
- /* skip */
- rstr= TEST_SKIP;
- ++total_skip;
- }
-
- /* result */
- mlog("%-14s\n", rstr);
-}
-
-/******************************************************************************
-
- vlog()
-
- Log the message.
-
-******************************************************************************/
-
-void vlog(const char *format, va_list ap)
-{
- vfprintf(stdout, format, ap);
- fflush(stdout);
-
- if (log_fd)
- {
- vfprintf(log_fd, format, ap);
- fflush(log_fd);
- }
-}
-
-/******************************************************************************
-
- log()
-
- Log the message.
-
-******************************************************************************/
-
-void mlog(const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
-
- vlog(format, ap);
-
- va_end(ap);
-}
-
-/******************************************************************************
-
- log_info()
-
- Log the given information.
-
-******************************************************************************/
-
-void log_info(const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
-
- mlog("-- INFO : ");
- vlog(format, ap);
- mlog("\n");
-
- va_end(ap);
-}
-
-/******************************************************************************
-
- log_error()
-
- Log the given error.
-
-******************************************************************************/
-
-void log_error(const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
-
- mlog("-- ERROR: ");
- vlog(format, ap);
- mlog("\n");
-
- va_end(ap);
-}
-
-/******************************************************************************
-
- log_errno()
-
- Log the given error and errno.
-
-******************************************************************************/
-
-void log_errno(const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
-
- mlog("-- ERROR: (%003u) ", errno);
- vlog(format, ap);
- mlog("\n");
-
- va_end(ap);
-}
-
-/******************************************************************************
-
- die()
-
- Exit the application.
-
-******************************************************************************/
-
-void die(const char *msg)
-{
- log_error(msg);
-#ifdef __NETWARE__
- pressanykey();
-#endif
- exit(-1);
-}
-
-/******************************************************************************
-
- setup()
-
- Setup the mysql test enviornment.
-
-******************************************************************************/
-
-void setup(char *file __attribute__((unused)))
-{
- char temp[FN_REFLEN];
-#if defined(__WIN__) || defined(__NETWARE__)
- char file_path[FN_REFLEN*2];
-#endif
- char *p;
- int position;
-
- /* set the timezone for the timestamp test */
-#ifdef __WIN__
- _putenv( "TZ=GMT-3" );
-#else
- putenv((char *)"TZ=GMT-3");
-#endif
- /* find base dir */
-#ifdef __NETWARE__
- strcpy(temp, strlwr(file));
- while ((p= strchr(temp, '\\')) != NULL) *p= '/';
-#else
- getcwd(temp, FN_REFLEN);
- position= strlen(temp);
- temp[position]= '/';
- temp[position+1]= 0;
-#ifdef __WIN__
- while ((p= strchr(temp, '\\')) != NULL) *p= '/';
-#endif
-#endif
-
- if ((position= strinstr(temp, "/mysql-test/")) != 0)
- {
- p= temp + position - 1;
- *p= 0;
- strcpy(base_dir, temp);
- }
-
- log_info("Currect directory: %s",base_dir);
-
-#ifdef __NETWARE__
- /* setup paths */
- snprintf(bin_dir, FN_REFLEN, "%s/bin", base_dir);
- snprintf(mysql_test_dir, FN_REFLEN, "%s/mysql-test", base_dir);
- snprintf(test_dir, FN_REFLEN, "%s/t", mysql_test_dir);
- snprintf(mysql_tmp_dir, FN_REFLEN, "%s/var/tmp", mysql_test_dir);
- snprintf(result_dir, FN_REFLEN, "%s/r", mysql_test_dir);
- snprintf(master_dir, FN_REFLEN, "%s/var/master-data", mysql_test_dir);
- snprintf(slave_dir, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
- snprintf(lang_dir, FN_REFLEN, "%s/share/english", base_dir);
- snprintf(char_dir, FN_REFLEN, "%s/share/charsets", base_dir);
-
-#ifdef HAVE_OPENSSL
- use_openssl= TRUE;
-#endif /* HAVE_OPENSSL */
-
- /* OpenSSL paths */
- snprintf(ca_cert, FN_REFLEN, "%s/std_data/cacert.pem", mysql_test_dir);
- snprintf(server_cert, FN_REFLEN, "%s/std_data/server-cert.pem", mysql_test_dir);
- snprintf(server_key, FN_REFLEN, "%s/std_data/server-key.pem", mysql_test_dir);
- snprintf(client_cert, FN_REFLEN, "%s/std_data/client-cert.pem", mysql_test_dir);
- snprintf(client_key, FN_REFLEN, "%s/std_data/client-key.pem", mysql_test_dir);
-
- /* setup files */
- snprintf(mysqld_file, FN_REFLEN, "%s/mysqld", bin_dir);
- snprintf(mysqltest_file, FN_REFLEN, "%s/mysqltest", bin_dir);
- snprintf(mysqladmin_file, FN_REFLEN, "%s/mysqladmin", bin_dir);
- snprintf(master_pid, FN_REFLEN, "%s/var/run/master.pid", mysql_test_dir);
- snprintf(slave_pid, FN_REFLEN, "%s/var/run/slave.pid", mysql_test_dir);
-#elif __WIN__
- /* setup paths */
-#ifdef _DEBUG
- snprintf(bin_dir, FN_REFLEN, "%s/client_debug", base_dir);
-#else
- snprintf(bin_dir, FN_REFLEN, "%s/client_release", base_dir);
-#endif
- snprintf(mysql_test_dir, FN_REFLEN, "%s/mysql-test", base_dir);
- snprintf(test_dir, FN_REFLEN, "%s/t", mysql_test_dir);
- snprintf(mysql_tmp_dir, FN_REFLEN, "%s/var/tmp", mysql_test_dir);
- snprintf(result_dir, FN_REFLEN, "%s/r", mysql_test_dir);
- snprintf(master_dir, FN_REFLEN, "%s/var/master-data", mysql_test_dir);
- snprintf(slave_dir, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
- snprintf(lang_dir, FN_REFLEN, "%s/share/english", base_dir);
- snprintf(char_dir, FN_REFLEN, "%s/share/charsets", base_dir);
-
-#ifdef HAVE_OPENSSL
- use_openssl= TRUE;
-#endif /* HAVE_OPENSSL */
-
- /* OpenSSL paths */
- snprintf(ca_cert, FN_REFLEN, "%s/std_data/cacert.pem", mysql_test_dir);
- snprintf(server_cert, FN_REFLEN, "%s/std_data/server-cert.pem", mysql_test_dir);
- snprintf(server_key, FN_REFLEN, "%s/std_data/server-key.pem", mysql_test_dir);
- snprintf(client_cert, FN_REFLEN, "%s/std_data/client-cert.pem", mysql_test_dir);
- snprintf(client_key, FN_REFLEN, "%s/std_data/client-key.pem", mysql_test_dir);
-
- /* setup files */
-#ifdef _DEBUG
- snprintf(mysqld_file, FN_REFLEN, "%s/mysqld-debug.exe", bin_dir);
-#else
- snprintf(mysqld_file, FN_REFLEN, "%s/mysqld.exe", bin_dir);
-#endif
- snprintf(mysqltest_file, FN_REFLEN, "%s/mysqltest.exe", bin_dir);
- snprintf(mysqladmin_file, FN_REFLEN, "%s/mysqladmin.exe", bin_dir);
-#else
- /* setup paths */
- snprintf(bin_dir, FN_REFLEN, "%s/client", base_dir);
- snprintf(mysql_test_dir, FN_REFLEN, "%s/mysql-test", base_dir);
- snprintf(test_dir, FN_REFLEN, "%s/t", mysql_test_dir);
- snprintf(mysql_tmp_dir, FN_REFLEN, "%s/var/tmp", mysql_test_dir);
- snprintf(result_dir, FN_REFLEN, "%s/r", mysql_test_dir);
- snprintf(master_dir, FN_REFLEN, "%s/var/master-data", mysql_test_dir);
- snprintf(slave_dir, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
- snprintf(slave1_dir, FN_REFLEN, "%s/var/slave1-data", mysql_test_dir);
- snprintf(slave2_dir, FN_REFLEN, "%s/var/slave2-data", mysql_test_dir);
- snprintf(lang_dir, FN_REFLEN, "%s/sql/share/english", base_dir);
- snprintf(char_dir, FN_REFLEN, "%s/sql/share/charsets", base_dir);
-
-#ifdef HAVE_OPENSSL
- use_openssl= TRUE;
-#endif /* HAVE_OPENSSL */
-
- /* OpenSSL paths */
- snprintf(ca_cert, FN_REFLEN, "%s/std_data/cacert.pem", mysql_test_dir);
- snprintf(server_cert, FN_REFLEN, "%s/std_data/server-cert.pem", mysql_test_dir);
- snprintf(server_key, FN_REFLEN, "%s/std_data/server-key.pem", mysql_test_dir);
- snprintf(client_cert, FN_REFLEN, "%s/std_data/client-cert.pem", mysql_test_dir);
- snprintf(client_key, FN_REFLEN, "%s/std_data/client-key.pem", mysql_test_dir);
-
- /* setup files */
- snprintf(mysqld_file, FN_REFLEN, "%s/sql/mysqld", base_dir);
- snprintf(mysqltest_file, FN_REFLEN, "%s/mysqltest", bin_dir);
- snprintf(mysqladmin_file, FN_REFLEN, "%s/mysqladmin", bin_dir);
- snprintf(master_pid, FN_REFLEN, "%s/var/run/master.pid", mysql_test_dir);
- snprintf(slave_pid, FN_REFLEN, "%s/var/run/slave.pid", mysql_test_dir);
-
- snprintf(master_socket,FN_REFLEN, "%s/var/tmp/master.sock", mysql_test_dir);
- snprintf(slave_socket,FN_REFLEN, "%s/var/tmp/slave.sock", mysql_test_dir);
-
-#endif
- /* create log file */
- snprintf(temp, FN_REFLEN, "%s/mysql-test-run.log", mysql_test_dir);
- if ((log_fd= fopen(temp, "w+")) == NULL)
- {
- log_errno("Unable to create log file.");
- }
-
- /* prepare skip test list */
- while ((p= strchr(skip_test, ',')) != NULL) *p= ' ';
- strcpy(temp, strlwr(skip_test));
- snprintf(skip_test, FN_REFLEN, " %s ", temp);
-
- /* environment */
-#ifdef __NETWARE__
- setenv("MYSQL_TEST_DIR", mysql_test_dir, 1);
- snprintf(file_path, FN_REFLEN*2,
- "%s/client/mysqldump --no-defaults -u root --port=%u",
- bin_dir, master_port);
- setenv("MYSQL_DUMP", file_path, 1);
- snprintf(file_path, FN_REFLEN*2,
- "%s/client/mysqlbinlog --no-defaults --local-load=%s",
- bin_dir, mysql_tmp_dir);
- setenv("MYSQL_BINLOG", file_path, 1);
-#elif __WIN__
- snprintf(file_path,FN_REFLEN,"MYSQL_TEST_DIR=%s",mysql_test_dir);
- _putenv(file_path);
- snprintf(file_path, FN_REFLEN*2,
- "MYSQL_DUMP=%s/mysqldump.exe --no-defaults -uroot --port=%u",
- bin_dir, master_port);
- _putenv(file_path);
- snprintf(file_path, FN_REFLEN*2,
- "MYSQL_BINLOG=%s/mysqlbinlog.exe --no-defaults --local-load=%s",
- bin_dir, mysql_tmp_dir);
- _putenv(file_path);
-
- snprintf(file_path, FN_REFLEN*2,
- "TESTS_BINDIR=%s/tests", base_dir);
- _putenv(file_path);
-
- snprintf(file_path, FN_REFLEN*2,
- "CHARSETSDIR=%s/sql/share/charsets", base_dir);
- _putenv(file_path);
-
- snprintf(file_path, FN_REFLEN*2,
- "MYSQL=%s/mysql --port=%u ",
- bin_dir, master_port);
- _putenv(file_path);
-
- snprintf(file_path, FN_REFLEN*2,
- "MYSQL_FIX_SYSTEM_TABLES=%s/scripts/mysql_fix_privilege_tables --no-defaults "
- "--host=localhost --port=%u "
- "--basedir=%s --bindir=%s --verbose",
- base_dir,master_port, base_dir, bin_dir);
- _putenv(file_path);
-
- snprintf(file_path, FN_REFLEN*2,
- "NDB_TOOLS_DIR=%s/ndb/tools", base_dir);
- _putenv(file_path);
-
- snprintf(file_path, FN_REFLEN*2,
- "CLIENT_BINDIR=%s", bin_dir);
- _putenv(file_path);
-
- snprintf(file_path, FN_REFLEN*2,
- "MYSQL_CLIENT_TEST=%s/tests/mysql_client_test --no-defaults --testcase "
- "--user=root --port=%u --silent",
- base_dir, master_port);
- _putenv(file_path);
-
-#else
- {
- static char env_MYSQL_TEST_DIR[FN_REFLEN*2];
- static char env_MYSQL_DUMP[FN_REFLEN*2];
- static char env_MYSQL_BINLOG[FN_REFLEN*2];
- static char env_MASTER_MYSOCK[FN_REFLEN*2];
- static char env_TESTS_BINDIR[FN_REFLEN*2];
- static char env_CHARSETSDIR[FN_REFLEN*2];
- static char env_MYSQL[FN_REFLEN*2];
- static char env_MYSQL_FIX_SYSTEM_TABLES[FN_REFLEN*2];
- static char env_CLIENT_BINDIR[FN_REFLEN*2];
- static char env_MYSQL_CLIENT_TEST[FN_REFLEN*2];
- static char env_NDB_TOOLS_DIR[FN_REFLEN*2];
- static char env_NDB_MGM[FN_REFLEN*2];
- static char env_NDB_BACKUP_DIR[FN_REFLEN*2];
- static char env_NDB_TOOLS_OUTPUT[FN_REFLEN*2];
-
- snprintf(env_MYSQL_TEST_DIR,FN_REFLEN*2,
- "MYSQL_TEST_DIR=%s",mysql_test_dir);
- putenv(env_MYSQL_TEST_DIR);
-
- snprintf(env_MYSQL_DUMP, FN_REFLEN*2,"MYSQL_DUMP=%s/mysqldump --no-defaults "
- "-uroot --port=%u --socket=%s ",
- bin_dir, master_port, master_socket);
- putenv(env_MYSQL_DUMP);
-
- snprintf(env_MYSQL_BINLOG, FN_REFLEN*2,
- "MYSQL_BINLOG=%s/mysqlbinlog --no-defaults --local-load=%s -uroot ",
- bin_dir, mysql_tmp_dir);
- putenv(env_MYSQL_BINLOG);
-
- snprintf(env_MASTER_MYSOCK, FN_REFLEN*2,
- "MASTER_MYSOCK=%s", master_socket);
- putenv(env_MASTER_MYSOCK);
-
- snprintf(env_TESTS_BINDIR, FN_REFLEN*2,
- "TESTS_BINDIR=%s/tests", base_dir);
- putenv(env_TESTS_BINDIR);
-
- snprintf(env_CHARSETSDIR, FN_REFLEN*2,
- "CHARSETSDIR=%s/sql/share/charsets", base_dir);
- putenv(env_CHARSETSDIR);
-
- snprintf(env_MYSQL, FN_REFLEN*2,
- "MYSQL=%s/mysql --port=%u --socket=%s -uroot ",
- bin_dir, master_port, master_socket);
- putenv(env_MYSQL);
-
- snprintf(env_MYSQL_FIX_SYSTEM_TABLES, FN_REFLEN*2,
- "MYSQL_FIX_SYSTEM_TABLES=%s/scripts/mysql_fix_privilege_tables --no-defaults "
- "--host=localhost --port=%u --socket=%s "
- "--basedir=%s --bindir=%s --verbose -uroot ",
- base_dir,master_port, master_socket, base_dir, bin_dir);
- putenv(env_MYSQL_FIX_SYSTEM_TABLES);
-
-
- snprintf(env_CLIENT_BINDIR, FN_REFLEN*2,
- "CLIENT_BINDIR=%s", bin_dir);
- putenv(env_CLIENT_BINDIR);
-
- snprintf(env_MYSQL_CLIENT_TEST, FN_REFLEN*2,
- "MYSQL_CLIENT_TEST=%s/tests/mysql_client_test --no-defaults --testcase "
- "--user=root --socket=%s --port=%u --silent",
- base_dir, master_socket, master_port);
- putenv(env_MYSQL_CLIENT_TEST);
-
- // NDB
-
- snprintf(env_NDB_TOOLS_DIR, FN_REFLEN*2,
- "NDB_TOOLS_DIR=%s/ndb/tools", base_dir);
- putenv(env_NDB_TOOLS_DIR);
-
- snprintf(env_NDB_MGM, FN_REFLEN*2,
- "NDB_MGM=%s/ndb/src/mgmclient/ndb_mgm", base_dir);
- putenv(env_NDB_MGM);
-
- //NDBCLUSTER_PORT=9350
- snprintf(env_NDB_BACKUP_DIR, FN_REFLEN*2,
- "NDB_BACKUP_DIR=%s/var/ndbcluster-%i", mysql_test_dir, 9350);
- putenv(env_NDB_BACKUP_DIR);
-
- snprintf(env_NDB_TOOLS_OUTPUT, FN_REFLEN*2,
- "NDB_TOOLS_OUTPUT=%s/var/log/ndb_tools.log", mysql_test_dir);
- putenv(env_NDB_TOOLS_OUTPUT);
-
- putenv((char *)"NDB_STATUS_OK=1");
-
-// NDB_MGM="$BASEDIR/ndb/src/mgmclient/ndb_mgm"
-// NDB_BACKUP_DIR=$MYSQL_TEST_DIR/var/ndbcluster-$NDBCLUSTER_PORT
-// NDB_TOOLS_OUTPUT=$MYSQL_TEST_DIR/var/log/ndb_tools.log
- }
-
-#endif
-
-#ifndef __WIN__
- putenv((char *)"MASTER_MYPORT=9306");
- putenv((char *)"SLAVE_MYPORT=9307");
- putenv((char *)"MYSQL_TCP_PORT=3306");
-
-#else
- _putenv("MASTER_MYPORT=9306");
- _putenv("SLAVE_MYPORT=9307");
- _putenv("MYSQL_TCP_PORT=3306");
-#endif
-
-}
-
-/*
- Compare names of testes for right order
-*/
-int compare( const void *arg1, const void *arg2 )
-{
- return sting_compare_func( * ( char** ) arg1, * ( char** ) arg2 );
-}
-
-
-
-/******************************************************************************
-
- main()
-
-******************************************************************************/
-
-int main(int argc, char **argv)
-{
- int is_ignore_list= 0;
- char **names= 0;
- char **testes= 0;
- int name_index;
- int index;
- char var_dir[FN_REFLEN];
- /* setup */
- setup(argv[0]);
-
- /* delete all file in var */
- snprintf(var_dir,FN_REFLEN,"%s/var",mysql_test_dir);
- del_tree(var_dir);
-
- /*
- The --ignore option is comma saperated list of test cases to skip and
- should be very first command line option to the test suite.
-
- The usage is now:
- mysql_test_run --ignore=test1,test2 test3 test4
- where test1 and test2 are test cases to ignore
- and test3 and test4 are test cases to run.
- */
- if (argc >= 2 && !strnicmp(argv[1], "--ignore=", sizeof("--ignore=")-1))
- {
- char *temp, *token;
- temp= strdup(strchr(argv[1],'=') + 1);
- for (token=str_tok(argument, temp, ","); token != NULL;
- token=str_tok(argument, NULL, ","))
- {
- if (strlen(ignore_test) + strlen(token) + 2 <= FN_REFLEN-1)
- sprintf(ignore_test+strlen(ignore_test), " %s ", token);
- else
- {
- free(temp);
- die("ignore list too long.");
- }
- }
- free(temp);
- is_ignore_list= 1;
- }
- /* header */
-#ifndef __WIN__
- mlog("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE);
-#else
- mlog("MySQL Server ---, for %s (%s)\n\n", SYSTEM_TYPE, MACHINE_TYPE);
-#endif
-
- mlog("Initializing Tests...\n");
-
- /* install test databases */
- mysql_install_db();
-
- mlog("Starting Tests...\n");
-
- mlog("\n");
- mlog(HEADER);
- mlog(DASH);
-
- if ( argc > 1 + is_ignore_list )
- {
- int i;
-
- /* single test */
- single_test= TRUE;
-
- for (i= 1 + is_ignore_list; i < argc; i++)
- {
- /* run given test */
- run_test(argv[i]);
- }
- }
- else
- {
- /* run all tests */
- testes= malloc(MAX_COUNT_TESTES*sizeof(void*));
- if (!testes)
- die("can not allcate memory for sorting");
- names= testes;
- name_index= 0;
-#ifndef __WIN__
- struct dirent *entry;
- DIR *parent;
- char test[FN_LEN];
- int position;
-
- /* FIXME are we sure the list is sorted if using readdir()? */
- if ((parent= opendir(test_dir)) == NULL) /* Not thread safe */
- die("Unable to open tests directory.");
- else
- {
- while ((entry= readdir(parent)) != NULL) /* Not thread safe */
- {
- strcpy(test, strlwr(entry->d_name));
- /* find the test suffix */
- if ((position= strinstr(test, TEST_SUFFIX)) != 0)
- {
- if (name_index < MAX_COUNT_TESTES)
- {
- /* null terminate at the suffix */
- *(test + position - 1)= '\0';
- /* insert test */
- *names= malloc(FN_REFLEN);
- strcpy(*names,test);
- names++;
- name_index++;
- }
- else
- die("can not sort files, array is overloaded");
- }
- }
- closedir(parent);
- }
-#else
- {
- struct _finddata_t dir;
- int* handle;
- char test[FN_LEN];
- char mask[FN_REFLEN];
- int position;
-
- /* single test */
- single_test= FALSE;
-
- snprintf(mask,FN_REFLEN,"%s/*.test",test_dir);
-
- if ((handle=_findfirst(mask,&dir)) == -1L)
- {
- die("Unable to open tests directory.");
- }
-
-
- do
- {
- if (!(dir.attrib & _A_SUBDIR))
- {
- strcpy(test, strlwr(dir.name));
-
- /* find the test suffix */
- if ((position= strinstr(test, TEST_SUFFIX)) != 0)
- {
- if (name_index < MAX_COUNT_TESTES)
- {
- /* null terminate at the suffix */
- *(test + position - 1)= '\0';
- /* insert test */
- *names= malloc(FN_REFLEN);
- strcpy(*names,test);
- names++;
- name_index++;
- }
- else
- die("can not sort files, array is overloaded");
- }
- }
- }while (_findnext(handle,&dir) == 0);
-
- _findclose(handle);
- }
-#endif
- qsort( (void *)testes, name_index, sizeof( char * ), compare );
-
- for (index= 0; index < name_index; index++)
- {
- run_test(testes[index]);
- free(testes[index]);
- }
-
- free(testes);
- }
-
- /* stop server */
- mysql_stop();
-
- mlog(DASH);
- mlog("\n");
-
- mlog("Ending Tests...\n");
-
- /* report stats */
- report_stats();
-
- /* close log */
- if (log_fd) fclose(log_fd);
-
- /* keep results up */
-#ifdef __NETWARE__
- pressanykey();
-#endif
- return 0;
-}
-
-
-/*
- Synopsis:
- This function breaks the string into a sequence of tokens. The difference
- between this function and strtok is that it respects the quoted string i.e.
- it skips any delimiter character within the quoted part of the string.
- It return tokens by eliminating quote character. It modifies the input string
- passed. It will work with whitespace delimeter but may not work properly with
- other delimeter. If the delimeter will contain any quote character, then
- function will not tokenize and will return null string.
- e.g. if input string is
- --init-slave="set global max_connections=500" --skip-external-locking
- then the output will two string i.e.
- --init-slave=set global max_connections=500
- --skip-external-locking
-
-Arguments:
- string: input string
- delim: set of delimiter character
-Output:
- return the null terminated token of NULL.
-*/
-char *str_tok(char* dest, char *string, const char *delim)
-{
- char *token;
- char *ptr_end_token= NULL;
- char *ptr_quote= NULL;
- char *ptr_token= NULL;
- int count_quotes= 0;
-
- *dest = '\0';
- if (strchr(delim,'\'') || strchr(delim,'\"'))
- return NULL;
-
- token= (char*)strtok(string, delim);
- if (token)
- {
- /* double quote is found */
- if (strchr(token,'\"'))
- {
- do
- {
- if (count_quotes & 1)
- {
- if (*dest == '\0')
- sprintf(dest,"%s", ptr_token);
- else
- sprintf(dest,"%s %s", dest, ptr_token);
- ptr_token= (char*)strtok(NULL, delim);
- if (!ptr_token)
- break;
- }
- else
- {
- ptr_token= token;
- }
- if (ptr_quote = strchr(ptr_token,'\"'))
- {
- ptr_end_token= ptr_token + strlen(ptr_token);
- do
- {
-#ifndef __WIN__
- bmove(ptr_quote, ptr_quote+1, ptr_end_token - ptr_quote);
-#endif
- count_quotes++;
- } while (ptr_quote != NULL && (ptr_quote = strchr(ptr_quote+1,'\"')));
- }
- /* there are unpair quotes we have to search next quote*/
- } while (count_quotes & 1);
- if (ptr_token != NULL)
- {
- if (*dest == '\0')
- sprintf(dest,"%s", ptr_token);
- else
- sprintf(dest,"%s %s",dest,ptr_token);
- }
- }
- else
- {
- sprintf(dest,"%s",token);
- }
- }
- return token ? dest : NULL;
-}
-
-#ifndef __WIN__
-/*
- Synopsis:
- This function run scripts files on Linux and Netware
-
-Arguments:
- script_name: name of script file
-
-Output:
- nothing
-*/
-
-void run_init_script(const char *script_name)
-{
- arg_list_t al;
- int err;
-
- /* args */
- init_args(&al);
- add_arg(&al, sh_file);
- add_arg(&al, script_name);
-
- /* spawn */
- if ((err= spawn(sh_file, &al, TRUE, NULL, NULL, NULL, NULL)) != 0)
- {
- die("Unable to run script.");
- }
-
- /* free args */
- free_args(&al);
-}
-#endif
diff --git a/mysql-test/ndb/Makefile.am b/mysql-test/ndb/Makefile.am
index 178e40fb19a..4ddf61cf5cc 100644
--- a/mysql-test/ndb/Makefile.am
+++ b/mysql-test/ndb/Makefile.am
@@ -2,12 +2,11 @@
benchdir_root= $(prefix)
testdir = $(benchdir_root)/mysql-test/ndb
+EXTRA_DIST = ndbcluster.sh
+CLEANFILES = ndbcluster
+dist_test_DATA = ndb_config_2_node.ini ndb_config_1_node.ini
test_SCRIPTS = ndbcluster
-noinst_HEADERS = ndbcluster.sh
-
-dist_test_DATA = ndb_config_2_node.ini
-
SUFFIXES = .sh
.sh:
diff --git a/mysql-test/ndb/ndb_config_1_node.ini b/mysql-test/ndb/ndb_config_1_node.ini
new file mode 100644
index 00000000000..39e758493c8
--- /dev/null
+++ b/mysql-test/ndb/ndb_config_1_node.ini
@@ -0,0 +1,44 @@
+[ndbd default]
+NoOfReplicas= 1
+MaxNoOfConcurrentTransactions= 64
+MaxNoOfConcurrentOperations= CHOOSE_MaxNoOfConcurrentOperations
+DataMemory= CHOOSE_DataMemory
+IndexMemory= CHOOSE_IndexMemory
+Diskless= CHOOSE_Diskless
+TimeBetweenWatchDogCheck= 30000
+DataDir= CHOOSE_FILESYSTEM
+MaxNoOfOrderedIndexes= CHOOSE_MaxNoOfOrderedIndexes
+MaxNoOfAttributes= CHOOSE_MaxNoOfAttributes
+TimeBetweenGlobalCheckpoints= 500
+NoOfFragmentLogFiles= 3
+DiskPageBufferMemory= CHOOSE_DiskPageBufferMemory
+
+#
+# Increase deadlock-timeout to cater for slow test-machines
+# (possibly running several tests in parallell)
+#
+#TransactionDeadlockDetectionTimeout= 7500
+
+[ndbd]
+HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress
+
+[ndb_mgmd]
+HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress
+DataDir= CHOOSE_FILESYSTEM #
+PortNumber= CHOOSE_PORT_MGM
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
diff --git a/mysql-test/ndb/ndb_config_2_node.ini b/mysql-test/ndb/ndb_config_2_node.ini
index a6a56376f33..99f31150d8c 100644
--- a/mysql-test/ndb/ndb_config_2_node.ini
+++ b/mysql-test/ndb/ndb_config_2_node.ini
@@ -1,5 +1,6 @@
[ndbd default]
NoOfReplicas= 2
+MaxNoOfConcurrentTransactions= 64
MaxNoOfConcurrentOperations= CHOOSE_MaxNoOfConcurrentOperations
DataMemory= CHOOSE_DataMemory
IndexMemory= CHOOSE_IndexMemory
@@ -7,6 +8,19 @@ Diskless= CHOOSE_Diskless
TimeBetweenWatchDogCheck= 30000
DataDir= CHOOSE_FILESYSTEM
MaxNoOfOrderedIndexes= CHOOSE_MaxNoOfOrderedIndexes
+MaxNoOfAttributes= CHOOSE_MaxNoOfAttributes
+TimeBetweenGlobalCheckpoints= 500
+NoOfFragmentLogFiles= 3
+DiskPageBufferMemory= CHOOSE_DiskPageBufferMemory
+# the following parametes just function as a small regression
+# test that the parameter exists
+InitialNoOfOpenFiles= 27
+
+#
+# Increase deadlock-timeout to cater for slow test-machines
+# (possibly running several tests in parallell)
+#
+#TransactionDeadlockDetectionTimeout= 7500
[ndbd]
HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress
@@ -26,3 +40,11 @@ PortNumber= CHOOSE_PORT_MGM
[mysqld]
[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
diff --git a/mysql-test/ndb/ndb_config_4_node.ini b/mysql-test/ndb/ndb_config_4_node.ini
new file mode 100644
index 00000000000..94d58bd8efc
--- /dev/null
+++ b/mysql-test/ndb/ndb_config_4_node.ini
@@ -0,0 +1,53 @@
+[ndbd default]
+NoOfReplicas= 2
+MaxNoOfConcurrentTransactions= 64
+MaxNoOfConcurrentOperations= CHOOSE_MaxNoOfConcurrentOperations
+DataMemory= CHOOSE_DataMemory
+IndexMemory= CHOOSE_IndexMemory
+Diskless= CHOOSE_Diskless
+TimeBetweenWatchDogCheck= 30000
+DataDir= CHOOSE_FILESYSTEM
+MaxNoOfOrderedIndexes= CHOOSE_MaxNoOfOrderedIndexes
+MaxNoOfAttributes= CHOOSE_MaxNoOfAttributes
+TimeBetweenGlobalCheckpoints= 500
+NoOfFragmentLogFiles= 3
+DiskPageBufferMemory= CHOOSE_DiskPageBufferMemory
+
+#
+# Increase deadlock-timeout to cater for slow test-machines
+# (possibly running several tests in parallell)
+#
+#TransactionDeadlockDetectionTimeout= 7500
+
+[ndbd]
+HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress
+
+[ndbd]
+HostName= CHOOSE_HOSTNAME_2 # hostname is a valid network adress
+
+[ndbd]
+HostName= CHOOSE_HOSTNAME_3 # hostname is a valid network adress
+
+[ndbd]
+HostName= CHOOSE_HOSTNAME_4 # hostname is a valid network adress
+
+[ndb_mgmd]
+HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress
+DataDir= CHOOSE_FILESYSTEM #
+PortNumber= CHOOSE_PORT_MGM
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh
index 3710da71e10..74f21fdef92 100644
--- a/mysql-test/ndb/ndbcluster.sh
+++ b/mysql-test/ndb/ndbcluster.sh
@@ -18,7 +18,7 @@ cd $CWD
# Are we using a source or a binary distribution?
if [ -d ../sql ] ; then
SOURCE_DIST=1
- ndbtop=$BASEDIR/ndb
+ ndbtop=$BASEDIR/storage/ndb
exec_ndb=$ndbtop/src/kernel/ndbd
exec_mgmtsrvr=$ndbtop/src/mgmsrv/ndb_mgmd
exec_waiter=$ndbtop/tools/ndb_waiter
@@ -51,12 +51,18 @@ stop_ndb=
initial_ndb=
status_ndb=
ndb_diskless=0
+ndbd_nodes=2
+relative_config_data_dir=
+opt_core=
ndb_no_ord=512
+ndb_no_attr=2048
ndb_con_op=105000
ndb_dmem=80M
ndb_imem=24M
+ndb_pbmem=32M
+VERBOSE=100
NDB_MGM_EXTRA_OPTS=
NDB_MGMD_EXTRA_OPTS=
NDBD_EXTRA_OPTS=
@@ -77,14 +83,18 @@ while test $# -gt 0; do
--debug*)
flags_ndb="$flags_ndb $1"
;;
+ --ndbd-nodes=*)
+ ndbd_nodes=`echo "$1" | sed -e "s;--ndbd-nodes=;;"`
+ ;;
--status)
status_ndb=1
;;
--small)
- ndb_no_ord=128
- ndb_con_op=10000
- ndb_dmem=40M
- ndb_imem=12M
+ ndb_no_ord=32
+ ndb_con_op=5000
+ ndb_dmem=20M
+ ndb_imem=1M
+ ndb_pbmem=4M
;;
--diskless)
ndb_diskless=1
@@ -92,6 +102,9 @@ while test $# -gt 0; do
--data-dir=*)
fsdir=`echo "$1" | sed -e "s;--data-dir=;;"`
;;
+ --relative-config-data-dir)
+ relative_config_data_dir=1
+ ;;
--port=*)
port=`echo "$1" | sed -e "s;--port=;;"`
;;
@@ -110,6 +123,12 @@ while test $# -gt 0; do
--character-sets-dir=*)
CHARSETSDIR=`echo "$1" | sed -e "s;--character-sets-dir=;;"`
;;
+ --core)
+ opt_core="--core"
+ ;;
+ --verbose=*)
+ VERBOSE=`echo "$1" | sed -e "s;--verbose=;;"`
+ ;;
-- ) shift; break ;;
--* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
* ) break ;;
@@ -118,9 +137,10 @@ while test $# -gt 0; do
done
fs_ndb="$fsdir/ndbcluster-$port"
+config_ini=ndb/ndb_config_${ndbd_nodes}_node.ini
NDB_HOME=
-if [ ! -x "$fsdir" ]; then
+if [ ! -d "$fsdir" ]; then
echo "$fsdir missing"
exit 1
fi
@@ -136,11 +156,15 @@ if [ ! -x "$exec_waiter" ]; then
echo "$exec_waiter missing"
exit 1
fi
+if [ ! -f "$config_ini" ]; then
+ echo "$config_ini missing, unsupported number of nodes"
+ exit 1
+fi
-exec_mgmtclient="$exec_mgmtclient --no-defaults $NDB_MGM_EXTRA_OPTS"
-exec_mgmtsrvr="$exec_mgmtsrvr --no-defaults $NDB_MGMD_EXTRA_OPTS"
-exec_ndb="$exec_ndb --no-defaults $NDBD_EXTRA_OPTS --character-sets-dir=$CHARSETSDIR"
-exec_waiter="$exec_waiter --no-defaults"
+exec_mgmtclient="$exec_mgmtclient --no-defaults $opt_core $NDB_MGM_EXTRA_OPTS"
+exec_mgmtsrvr="$exec_mgmtsrvr --no-defaults $opt_core $NDB_MGMD_EXTRA_OPTS"
+exec_ndb="$exec_ndb --no-defaults $opt_core $NDBD_EXTRA_OPTS --character-sets-dir=$CHARSETSDIR"
+exec_waiter="$exec_waiter --no-defaults $opt_core"
ndb_host="localhost"
ndb_mgmd_port=$port
@@ -184,18 +208,25 @@ fi
# Start management server as deamon
# Edit file system path and ports in config file
+if [ $relative_config_data_dir ] ; then
+ config_fs_ndb="."
+else
+ config_fs_ndb=$fs_ndb
+fi
if [ $initial_ndb ] ; then
- rm -f $fs_ndb/ndb_* 2>&1 | cat > /dev/null
+ rm -rf $fs_ndb/ndb_* 2>&1 | cat > /dev/null
sed \
+ -e s,"CHOOSE_MaxNoOfAttributes","$ndb_no_attr",g \
-e s,"CHOOSE_MaxNoOfOrderedIndexes","$ndb_no_ord",g \
-e s,"CHOOSE_MaxNoOfConcurrentOperations","$ndb_con_op",g \
-e s,"CHOOSE_DataMemory","$ndb_dmem",g \
-e s,"CHOOSE_IndexMemory","$ndb_imem",g \
-e s,"CHOOSE_Diskless","$ndb_diskless",g \
-e s,"CHOOSE_HOSTNAME_".*,"$ndb_host",g \
- -e s,"CHOOSE_FILESYSTEM","$fs_ndb",g \
+ -e s,"CHOOSE_FILESYSTEM","$config_fs_ndb",g \
-e s,"CHOOSE_PORT_MGM","$ndb_mgmd_port",g \
- < ndb/ndb_config_2_node.ini \
+ -e s,"CHOOSE_DiskPageBufferMemory","$ndb_pbmem",g \
+ < "$config_ini" \
> "$fs_ndb/config.ini"
fi
@@ -206,7 +237,7 @@ if ( cd "$fs_ndb" ; $exec_mgmtsrvr -f config.ini ) ; then :; else
echo "Unable to start $exec_mgmtsrvr from `pwd`"
exit 1
fi
-if sleep_until_file_created $fs_ndb/ndb_3.pid 120
+if sleep_until_file_created $fs_ndb/ndb_`expr $ndbd_nodes + 1`.pid 120
then :; else
exit 1
fi
@@ -214,38 +245,43 @@ cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
# Start database node
-echo "Starting ndbd"
-( cd "$fs_ndb" ; $exec_ndb $flags_ndb & )
-if sleep_until_file_created $fs_ndb/ndb_1.pid 120
-then :; else
- stop_default_ndbcluster
- exit 1
-fi
-cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
-
-# Start database node
-
-echo "Starting ndbd"
-( cd "$fs_ndb" ; $exec_ndb $flags_ndb & )
-if sleep_until_file_created $fs_ndb/ndb_2.pid 120
-then :; else
- stop_default_ndbcluster
- exit 1
-fi
-cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
+id=1
+while [ $id -le $ndbd_nodes ]
+do
+ if [ `expr $VERBOSE \> 1` = 1 ] ; then
+ echo "Starting ndbd $id($ndbd_nodes)"
+ fi
+ ( cd "$fs_ndb" ; $exec_ndb $flags_ndb & )
+ if sleep_until_file_created $fs_ndb/ndb_${id}.pid 120
+ then :; else
+ stop_default_ndbcluster
+ exit 1
+ fi
+ cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
+ id=`expr $id + 1`
+done
# test if Ndb Cluster starts properly
-echo "Waiting for NDB data nodes to start..."
-if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK" > /dev/null 2>&1; then :; else
- echo "Ndbcluster startup failed"
+if [ `expr $VERBOSE \> 1` = 1 ] ; then
+ echo "Waiting for NDB data nodes to start..."
+fi
+if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK" > /dev/null 2>&1 ; then :; else
+ if [ `expr $VERBOSE \> 0` = 1 ] ; then
+ echo "Ndbcluster startup failed"
+ fi
stop_default_ndbcluster
exit 1
fi
+if [ `expr $VERBOSE \> 1` = 1 ] ; then
+ echo "Ok"
+fi
cat `find "$fs_ndb" -name 'ndb_*.pid'` > $fs_ndb/$pidfile
-status_ndbcluster
+if [ `expr $VERBOSE \> 2` = 1 ] ; then
+ status_ndbcluster
+fi
}
status_ndbcluster() {
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index 5c50b3cd79d..d3657d84678 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -373,10 +373,10 @@ t1 0 PRIMARY 2 User A 0 NULL NULL BTREE
t1 1 Host 1 Host A NULL NULL NULL BTREE disabled
DROP TABLE t1;
create table t1 (a int);
-alter table t1 rename to `t1\\`;
-ERROR 42000: Incorrect table name 't1\\'
-rename table t1 to `t1\\`;
-ERROR 42000: Incorrect table name 't1\\'
+alter table t1 rename to ``;
+ERROR 42000: Incorrect table name ''
+rename table t1 to ``;
+ERROR 42000: Incorrect table name ''
drop table t1;
drop table if exists t1, t2;
Warnings:
@@ -390,7 +390,7 @@ show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` varchar(10) NOT NULL,
- PRIMARY KEY (`a`)
+ PRIMARY KEY (`a`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`)
flush tables;
alter table t1 modify a varchar(10) not null;
@@ -398,7 +398,7 @@ show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` varchar(10) NOT NULL,
- PRIMARY KEY (`a`)
+ PRIMARY KEY (`a`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`)
drop table if exists t1, t2;
create table t1 (a int, b int, c int, d int, e int, f int, g int, h int,i int, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM;
@@ -468,25 +468,25 @@ delete from t1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(10) character set koi8r default NULL
+ `a` char(10) CHARACTER SET koi8r DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 DEFAULT CHARACTER SET latin1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(10) character set koi8r default NULL
+ `a` char(10) CHARACTER SET koi8r DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 CONVERT TO CHARACTER SET latin1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(10) default NULL
+ `a` char(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 DEFAULT CHARACTER SET cp1251;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(10) character set latin1 default NULL
+ `a` char(10) CHARACTER SET latin1 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp1251
drop table t1;
create table t1 (myblob longblob,mytext longtext)
@@ -495,14 +495,14 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`myblob` longblob,
- `mytext` longtext collate latin1_general_cs
+ `mytext` longtext COLLATE latin1_general_cs
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs
alter table t1 character set latin2;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`myblob` longblob,
- `mytext` longtext character set latin1 collate latin1_general_cs
+ `mytext` longtext CHARACTER SET latin1 COLLATE latin1_general_cs
) ENGINE=MyISAM DEFAULT CHARSET=latin2
drop table t1;
CREATE TABLE t1 (a int PRIMARY KEY, b INT UNIQUE);
@@ -511,7 +511,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
- `b` int(11) default NULL,
+ `b` int(11) DEFAULT NULL,
UNIQUE KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t1 DROP PRIMARY KEY;
@@ -562,7 +562,163 @@ desc t1;
Field Type Null Key Default Extra
mycol int(10) NO 0
drop table t1;
+create table t1 (v varchar(32));
+insert into t1 values ('def'),('abc'),('hij'),('3r4f');
+select * from t1;
+v
+def
+abc
+hij
+3r4f
+alter table t1 change v v2 varchar(32);
+select * from t1;
+v2
+def
+abc
+hij
+3r4f
+alter table t1 change v2 v varchar(64);
+select * from t1;
+v
+def
+abc
+hij
+3r4f
+update t1 set v = 'lmn' where v = 'hij';
+select * from t1;
+v
+def
+abc
+lmn
+3r4f
+alter table t1 add i int auto_increment not null primary key first;
+select * from t1;
+i v
+1 def
+2 abc
+3 lmn
+4 3r4f
+update t1 set i=5 where i=3;
+select * from t1;
+i v
+1 def
+2 abc
+5 lmn
+4 3r4f
+alter table t1 change i i bigint;
+select * from t1;
+i v
+1 def
+2 abc
+5 lmn
+4 3r4f
+alter table t1 add unique key (i, v);
+select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn');
+i v
+4 3r4f
+drop table t1;
create table t1 (t varchar(255) default null, key t (t(80)))
engine=myisam default charset=latin1;
alter table t1 change t t text;
drop table t1;
+CREATE TABLE t1 (s CHAR(8) BINARY);
+INSERT INTO t1 VALUES ('test');
+SELECT LENGTH(s) FROM t1;
+LENGTH(s)
+4
+ALTER TABLE t1 MODIFY s CHAR(10) BINARY;
+SELECT LENGTH(s) FROM t1;
+LENGTH(s)
+4
+DROP TABLE t1;
+CREATE TABLE t1 (s BINARY(8));
+INSERT INTO t1 VALUES ('test');
+SELECT LENGTH(s) FROM t1;
+LENGTH(s)
+8
+SELECT HEX(s) FROM t1;
+HEX(s)
+7465737400000000
+ALTER TABLE t1 MODIFY s BINARY(10);
+SELECT HEX(s) FROM t1;
+HEX(s)
+74657374000000000000
+SELECT LENGTH(s) FROM t1;
+LENGTH(s)
+10
+DROP TABLE t1;
+CREATE TABLE t1 (v VARCHAR(3), b INT);
+INSERT INTO t1 VALUES ('abc', 5);
+SELECT * FROM t1;
+v b
+abc 5
+ALTER TABLE t1 MODIFY COLUMN v VARCHAR(4);
+SELECT * FROM t1;
+v b
+abc 5
+DROP TABLE t1;
+DROP TABLE IF EXISTS `t+1`, `t+2`;
+CREATE TABLE `t+1` (c1 INT);
+ALTER TABLE `t+1` RENAME `t+2`;
+CREATE TABLE `t+1` (c1 INT);
+ALTER TABLE `t+1` RENAME `t+2`;
+ERROR 42S01: Table 't+2' already exists
+DROP TABLE `t+1`, `t+2`;
+CREATE TEMPORARY TABLE `tt+1` (c1 INT);
+ALTER TABLE `tt+1` RENAME `tt+2`;
+CREATE TEMPORARY TABLE `tt+1` (c1 INT);
+ALTER TABLE `tt+1` RENAME `tt+2`;
+ERROR 42S01: Table 'tt+2' already exists
+SHOW CREATE TABLE `tt+1`;
+Table Create Table
+tt+1 CREATE TEMPORARY TABLE `tt+1` (
+ `c1` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW CREATE TABLE `tt+2`;
+Table Create Table
+tt+2 CREATE TEMPORARY TABLE `tt+2` (
+ `c1` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE `tt+1`, `tt+2`;
+CREATE TABLE `#sql1` (c1 INT);
+CREATE TABLE `@0023sql2` (c1 INT);
+SHOW TABLES;
+Tables_in_test
+#sql1
+@0023sql2
+RENAME TABLE `#sql1` TO `@0023sql1`;
+RENAME TABLE `@0023sql2` TO `#sql2`;
+SHOW TABLES;
+Tables_in_test
+#sql2
+@0023sql1
+ALTER TABLE `@0023sql1` RENAME `#sql-1`;
+ALTER TABLE `#sql2` RENAME `@0023sql-2`;
+SHOW TABLES;
+Tables_in_test
+#sql-1
+@0023sql-2
+INSERT INTO `#sql-1` VALUES (1);
+INSERT INTO `@0023sql-2` VALUES (2);
+DROP TABLE `#sql-1`, `@0023sql-2`;
+CREATE TEMPORARY TABLE `#sql1` (c1 INT);
+CREATE TEMPORARY TABLE `@0023sql2` (c1 INT);
+SHOW TABLES;
+Tables_in_test
+ALTER TABLE `#sql1` RENAME `@0023sql1`;
+ALTER TABLE `@0023sql2` RENAME `#sql2`;
+SHOW TABLES;
+Tables_in_test
+INSERT INTO `#sql2` VALUES (1);
+INSERT INTO `@0023sql1` VALUES (2);
+SHOW CREATE TABLE `#sql2`;
+Table Create Table
+#sql2 CREATE TEMPORARY TABLE `#sql2` (
+ `c1` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW CREATE TABLE `@0023sql1`;
+Table Create Table
+@0023sql1 CREATE TEMPORARY TABLE `@0023sql1` (
+ `c1` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE `#sql2`, `@0023sql1`;
diff --git a/mysql-test/r/analyse.result b/mysql-test/r/analyse.result
index 0ecc462fb70..b1ed1ea2bed 100644
--- a/mysql-test/r/analyse.result
+++ b/mysql-test/r/analyse.result
@@ -36,16 +36,16 @@ create table t2 select * from t1 where 0=1 procedure analyse();
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `Field_name` varbinary(255) NOT NULL default '',
- `Min_value` varbinary(255) default NULL,
- `Max_value` varbinary(255) default NULL,
- `Min_length` int(11) NOT NULL default '0',
- `Max_length` int(11) NOT NULL default '0',
- `Empties_or_zeros` int(11) NOT NULL default '0',
- `Nulls` int(11) NOT NULL default '0',
- `Avg_value_or_avg_length` varbinary(255) NOT NULL default '',
- `Std` varbinary(255) default NULL,
- `Optimal_fieldtype` varbinary(64) NOT NULL default ''
+ `Field_name` varbinary(255) NOT NULL DEFAULT '',
+ `Min_value` varbinary(255) DEFAULT NULL,
+ `Max_value` varbinary(255) DEFAULT NULL,
+ `Min_length` int(11) NOT NULL DEFAULT '0',
+ `Max_length` int(11) NOT NULL DEFAULT '0',
+ `Empties_or_zeros` int(11) NOT NULL DEFAULT '0',
+ `Nulls` int(11) NOT NULL DEFAULT '0',
+ `Avg_value_or_avg_length` varbinary(255) NOT NULL DEFAULT '',
+ `Std` varbinary(255) DEFAULT NULL,
+ `Optimal_fieldtype` varbinary(64) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t1 where 0=1 procedure analyse();
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
@@ -55,16 +55,16 @@ create table t2 select * from t1 where 0=1 procedure analyse();
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `Field_name` varbinary(255) NOT NULL default '',
- `Min_value` varbinary(255) default NULL,
- `Max_value` varbinary(255) default NULL,
- `Min_length` int(11) NOT NULL default '0',
- `Max_length` int(11) NOT NULL default '0',
- `Empties_or_zeros` int(11) NOT NULL default '0',
- `Nulls` int(11) NOT NULL default '0',
- `Avg_value_or_avg_length` varbinary(255) NOT NULL default '',
- `Std` varbinary(255) default NULL,
- `Optimal_fieldtype` varbinary(64) NOT NULL default ''
+ `Field_name` varbinary(255) NOT NULL DEFAULT '',
+ `Min_value` varbinary(255) DEFAULT NULL,
+ `Max_value` varbinary(255) DEFAULT NULL,
+ `Min_length` int(11) NOT NULL DEFAULT '0',
+ `Max_length` int(11) NOT NULL DEFAULT '0',
+ `Empties_or_zeros` int(11) NOT NULL DEFAULT '0',
+ `Nulls` int(11) NOT NULL DEFAULT '0',
+ `Avg_value_or_avg_length` varbinary(255) NOT NULL DEFAULT '',
+ `Std` varbinary(255) DEFAULT NULL,
+ `Optimal_fieldtype` varbinary(64) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t2;
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
@@ -78,16 +78,16 @@ create table t2 select * from t1 where 0=1 procedure analyse();
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `Field_name` varbinary(255) NOT NULL default '',
- `Min_value` varbinary(255) default NULL,
- `Max_value` varbinary(255) default NULL,
- `Min_length` int(11) NOT NULL default '0',
- `Max_length` int(11) NOT NULL default '0',
- `Empties_or_zeros` int(11) NOT NULL default '0',
- `Nulls` int(11) NOT NULL default '0',
- `Avg_value_or_avg_length` varbinary(255) NOT NULL default '',
- `Std` varbinary(255) default NULL,
- `Optimal_fieldtype` varbinary(64) NOT NULL default ''
+ `Field_name` varbinary(255) NOT NULL DEFAULT '',
+ `Min_value` varbinary(255) DEFAULT NULL,
+ `Max_value` varbinary(255) DEFAULT NULL,
+ `Min_length` int(11) NOT NULL DEFAULT '0',
+ `Max_length` int(11) NOT NULL DEFAULT '0',
+ `Empties_or_zeros` int(11) NOT NULL DEFAULT '0',
+ `Nulls` int(11) NOT NULL DEFAULT '0',
+ `Avg_value_or_avg_length` varbinary(255) NOT NULL DEFAULT '',
+ `Std` varbinary(255) DEFAULT NULL,
+ `Optimal_fieldtype` varbinary(64) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t2;
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
diff --git a/mysql-test/r/ansi.result b/mysql-test/r/ansi.result
index cc4b6b5fa65..527748e00d5 100644
--- a/mysql-test/r/ansi.result
+++ b/mysql-test/r/ansi.result
@@ -21,28 +21,28 @@ CREATE TABLE t1 (i int auto_increment NOT NULL, PRIMARY KEY (i));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(11) NOT NULL auto_increment,
- PRIMARY KEY (`i`)
+ `i` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`i`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SET @@SQL_MODE="MYSQL323";
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(11) NOT NULL auto_increment,
- PRIMARY KEY (`i`)
+ `i` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`i`)
) TYPE=MyISAM
SET @@SQL_MODE="MYSQL40";
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(11) NOT NULL auto_increment,
- PRIMARY KEY (`i`)
+ `i` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`i`)
) TYPE=MyISAM
SET @@SQL_MODE="NO_FIELD_OPTIONS";
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) NOT NULL,
- PRIMARY KEY (`i`)
+ PRIMARY KEY (`i`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result
index 3be1cdcf15a..1dfec8ff713 100644
--- a/mysql-test/r/archive.result
+++ b/mysql-test/r/archive.result
@@ -1,16 +1,16 @@
-drop table if exists t1,t2;
+drop table if exists t1,t2,t3;
CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
) ENGINE=archive;
INSERT INTO t1 VALUES (9410,9412);
-select period from t1;
+select period FROM t1;
period
9410
-select * from t1;
+select * FROM t1;
Period Varor_period
9410 9412
-select t1.* from t1;
+select t1.* FROM t1;
Period Varor_period
9410 9412
CREATE TABLE t2 (
@@ -22,13 +22,13 @@ fld4 char(35) DEFAULT '' NOT NULL,
fld5 char(35) DEFAULT '' NOT NULL,
fld6 char(4) DEFAULT '' NOT NULL
) ENGINE=archive;
-select t2.fld3 from t2 where companynr = 58 and fld3 like "%imaginable%";
+select t2.fld3 FROM t2 where companynr = 58 and fld3 like "%imaginable%";
fld3
imaginable
-select fld3 from t2 where fld3 like "%cultivation" ;
+select fld3 FROM t2 where fld3 like "%cultivation" ;
fld3
cultivation
-select t2.fld3,companynr from t2 where companynr = 57+1 order by fld3;
+select t2.fld3,companynr FROM t2 where companynr = 57+1 order by fld3;
fld3 companynr
concoct 58
druggists 58
@@ -53,7 +53,7 @@ synergy 58
thanking 58
tying 58
unlocks 58
-select fld3,companynr from t2 where companynr = 58 order by fld3;
+select fld3,companynr FROM t2 where companynr = 58 order by fld3;
fld3 companynr
concoct 58
druggists 58
@@ -78,7 +78,7 @@ synergy 58
thanking 58
tying 58
unlocks 58
-select fld3 from t2 order by fld3 desc limit 10;
+select fld3 FROM t2 order by fld3 desc limit 10;
fld3
youthfulness
yelped
@@ -90,49 +90,49 @@ Winsett
Willy
willed
wildcats
-select fld3 from t2 order by fld3 desc limit 5;
+select fld3 FROM t2 order by fld3 desc limit 5;
fld3
youthfulness
yelped
Wotan
workers
Witt
-select fld3 from t2 order by fld3 desc limit 5,5;
+select fld3 FROM t2 order by fld3 desc limit 5,5;
fld3
witchcraft
Winsett
Willy
willed
wildcats
-select t2.fld3 from t2 where fld3 = 'honeysuckle';
+select t2.fld3 FROM t2 where fld3 = 'honeysuckle';
fld3
honeysuckle
-select t2.fld3 from t2 where fld3 LIKE 'honeysuckl_';
+select t2.fld3 FROM t2 where fld3 LIKE 'honeysuckl_';
fld3
honeysuckle
-select t2.fld3 from t2 where fld3 LIKE 'hon_ysuckl_';
+select t2.fld3 FROM t2 where fld3 LIKE 'hon_ysuckl_';
fld3
honeysuckle
-select t2.fld3 from t2 where fld3 LIKE 'honeysuckle%';
+select t2.fld3 FROM t2 where fld3 LIKE 'honeysuckle%';
fld3
honeysuckle
-select t2.fld3 from t2 where fld3 LIKE 'h%le';
+select t2.fld3 FROM t2 where fld3 LIKE 'h%le';
fld3
honeysuckle
-select t2.fld3 from t2 where fld3 LIKE 'honeysuckle_';
+select t2.fld3 FROM t2 where fld3 LIKE 'honeysuckle_';
fld3
-select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%';
+select t2.fld3 FROM t2 where fld3 LIKE 'don_t_find_me_please%';
fld3
-select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
+select t2.fld3 FROM t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
fld3
honeysuckle
honoring
-select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
+select fld1,fld3 FROM t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
fld1 fld3
148504 Colombo
068305 Colombo
000000 nondecreasing
-select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%';
+select fld1,fld3 FROM t2 where companynr = 37 and fld3 like 'f%';
fld1 fld3
012001 flanking
013602 foldout
@@ -165,37 +165,37 @@ fld1 fld3
232102 forgivably
238007 filial
238008 fixedly
-select fld3 from t2 where fld3 like "L%" and fld3 = "ok";
+select fld3 FROM t2 where fld3 like "L%" and fld3 = "ok";
fld3
-select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly");
+select fld3 FROM t2 where (fld3 like "C%" and fld3 = "Chantilly");
fld3
Chantilly
-select fld1,fld3 from t2 where fld1 like "25050%";
+select fld1,fld3 FROM t2 where fld1 like "25050%";
fld1 fld3
250501 poisoning
250502 Iraqis
250503 heaving
250504 population
250505 bomb
-select fld1,fld3 from t2 where fld1 like "25050_";
+select fld1,fld3 FROM t2 where fld1 like "25050_";
fld1 fld3
250501 poisoning
250502 Iraqis
250503 heaving
250504 population
250505 bomb
-create table t3 engine=archive select * from t2;
-select * from t3 where fld3='bonfire';
+create table t3 engine=archive select * FROM t2;
+select * FROM t3 where fld3='bonfire';
auto fld1 companynr fld3 fld4 fld5 fld6
1191 068504 00 bonfire corresponds positively
-select count(*) from t3;
+select count(*) FROM t3;
count(*)
1199
rename table t3 to t4;
-select * from t4 where fld3='bonfire';
+select * FROM t4 where fld3='bonfire';
auto fld1 companynr fld3 fld4 fld5 fld6
1191 068504 00 bonfire corresponds positively
-select count(*) from t4;
+select count(*) FROM t4;
count(*)
1199
INSERT INTO t2 VALUES (1,000001,00,'Omaha','teethe','neat','');
@@ -11121,18 +11121,1235 @@ auto fld1 companynr fld3 fld4 fld5 fld6
3 011402 37 Romans scholastics jarring
4 011403 37 intercepted audiology tinily
INSERT DELAYED INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily','');
+FLUSH TABLE t2;
+SELECT * FROM t2;
+auto fld1 companynr fld3 fld4 fld5 fld6
+1 000001 00 Omaha teethe neat
+2 011401 37 breaking dreaded Steinberg W
+3 011402 37 Romans scholastics jarring
+4 011403 37 intercepted audiology tinily
+5 011501 37 bewilderingly wallet balled
+6 011701 37 astound parters persist W
+7 011702 37 admonishing eschew attainments
+8 011703 37 sumac quitter fanatic
+9 012001 37 flanking neat measures FAS
+10 012003 37 combed Steinberg rightfulness
+11 012004 37 subjective jarring capably
+12 012005 37 scatterbrain tinily impulsive
+13 012301 37 Eulerian balled starlet
+14 012302 36 dubbed persist terminators
+15 012303 37 Kane attainments untying
+16 012304 37 overlay fanatic announces FAS
+17 012305 37 perturb measures featherweight FAS
+18 012306 37 goblins rightfulness pessimist FAS
+19 012501 37 annihilates capably daughter
+20 012602 37 Wotan impulsive decliner FAS
+21 012603 37 snatching starlet lawgiver
+22 012604 37 concludes terminators stated
+23 012605 37 laterally untying readable
+24 012606 37 yelped announces attrition
+25 012701 37 grazing featherweight cascade FAS
+26 012702 37 Baird pessimist motors FAS
+27 012703 37 celery daughter interrogate
+28 012704 37 misunderstander decliner pests W
+29 013601 37 handgun lawgiver stairway
+30 013602 37 foldout stated dopers FAS
+31 013603 37 mystic readable testicle W
+32 013604 37 succumbed attrition Parsifal W
+33 013605 37 Nabisco cascade leavings
+34 013606 37 fingerings motors postulation W
+35 013607 37 aging interrogate squeaking
+36 013608 37 afield pests contrasted
+37 013609 37 ammonium stairway leftover
+38 013610 37 boat dopers whiteners
+39 013801 37 intelligibility testicle erases W
+40 013802 37 Augustine Parsifal Punjab W
+41 013803 37 teethe leavings Merritt
+42 013804 37 dreaded postulation Quixotism
+43 013901 37 scholastics squeaking sweetish FAS
+44 016001 37 audiology contrasted dogging FAS
+45 016201 37 wallet leftover scornfully FAS
+46 016202 37 parters whiteners bellow
+47 016301 37 eschew erases bills
+48 016302 37 quitter Punjab cupboard FAS
+49 016303 37 neat Merritt sureties FAS
+50 016304 37 Steinberg Quixotism puddings
+51 018001 37 jarring sweetish tapestry
+52 018002 37 tinily dogging fetters
+53 018003 37 balled scornfully bivalves
+54 018004 37 persist bellow incurring
+55 018005 37 attainments bills Adolph
+56 018007 37 fanatic cupboard pithed
+57 018008 37 measures sureties emergency
+58 018009 37 rightfulness puddings Miles
+59 018010 37 capably tapestry trimmings
+60 018012 37 impulsive fetters tragedies W
+61 018013 37 starlet bivalves skulking W
+62 018014 37 terminators incurring flint
+63 018015 37 untying Adolph flopping W
+64 018016 37 announces pithed relaxing FAS
+65 018017 37 featherweight emergency offload FAS
+66 018018 37 pessimist Miles suites W
+67 018019 37 daughter trimmings lists FAS
+68 018020 37 decliner tragedies animized FAS
+69 018021 37 lawgiver skulking multilayer W
+70 018022 37 stated flint standardizes FAS
+71 018023 37 readable flopping Judas
+72 018024 37 attrition relaxing vacuuming W
+73 018025 37 cascade offload dentally W
+74 018026 37 motors suites humanness W
+75 018027 37 interrogate lists inch W
+76 018028 37 pests animized Weissmuller W
+77 018029 37 stairway multilayer irresponsibly W
+78 018030 37 dopers standardizes luckily FAS
+79 018032 37 testicle Judas culled W
+80 018033 37 Parsifal vacuuming medical FAS
+81 018034 37 leavings dentally bloodbath FAS
+82 018035 37 postulation humanness subschema W
+83 018036 37 squeaking inch animals W
+84 018037 37 contrasted Weissmuller Micronesia
+85 018038 37 leftover irresponsibly repetitions
+86 018039 37 whiteners luckily Antares
+87 018040 37 erases culled ventilate W
+88 018041 37 Punjab medical pityingly
+89 018042 37 Merritt bloodbath interdependent
+90 018043 37 Quixotism subschema Graves FAS
+91 018044 37 sweetish animals neonatal
+92 018045 37 dogging Micronesia scribbled FAS
+93 018046 37 scornfully repetitions chafe W
+94 018048 37 bellow Antares honoring
+95 018049 37 bills ventilate realtor
+96 018050 37 cupboard pityingly elite
+97 018051 37 sureties interdependent funereal
+98 018052 37 puddings Graves abrogating
+99 018053 50 tapestry neonatal sorters
+100 018054 37 fetters scribbled Conley
+101 018055 37 bivalves chafe lectured
+102 018056 37 incurring honoring Abraham
+103 018057 37 Adolph realtor Hawaii W
+104 018058 37 pithed elite cage
+105 018059 36 emergency funereal hushes
+106 018060 37 Miles abrogating Simla
+107 018061 37 trimmings sorters reporters
+108 018101 37 tragedies Conley Dutchman FAS
+109 018102 37 skulking lectured descendants FAS
+110 018103 37 flint Abraham groupings FAS
+111 018104 37 flopping Hawaii dissociate
+112 018201 37 relaxing cage coexist W
+113 018202 37 offload hushes Beebe
+114 018402 37 suites Simla Taoism
+115 018403 37 lists reporters Connally
+116 018404 37 animized Dutchman fetched FAS
+117 018405 37 multilayer descendants checkpoints FAS
+118 018406 37 standardizes groupings rusting
+119 018409 37 Judas dissociate galling
+120 018601 37 vacuuming coexist obliterates
+121 018602 37 dentally Beebe traitor
+122 018603 37 humanness Taoism resumes FAS
+123 018801 37 inch Connally analyzable FAS
+124 018802 37 Weissmuller fetched terminator FAS
+125 018803 37 irresponsibly checkpoints gritty FAS
+126 018804 37 luckily rusting firearm W
+127 018805 37 culled galling minima
+128 018806 37 medical obliterates Selfridge
+129 018807 37 bloodbath traitor disable
+130 018808 37 subschema resumes witchcraft W
+131 018809 37 animals analyzable betroth W
+132 018810 37 Micronesia terminator Manhattanize
+133 018811 37 repetitions gritty imprint
+134 018812 37 Antares firearm peeked
+135 019101 37 ventilate minima swelling
+136 019102 37 pityingly Selfridge interrelationships W
+137 019103 37 interdependent disable riser
+138 019201 37 Graves witchcraft Gandhian W
+139 030501 37 neonatal betroth peacock A
+140 030502 50 scribbled Manhattanize bee A
+141 030503 37 chafe imprint kanji
+142 030504 37 honoring peeked dental
+143 031901 37 realtor swelling scarf FAS
+144 036001 37 elite interrelationships chasm A
+145 036002 37 funereal riser insolence A
+146 036004 37 abrogating Gandhian syndicate
+147 036005 37 sorters peacock alike
+148 038001 37 Conley bee imperial A
+149 038002 37 lectured kanji convulsion A
+150 038003 37 Abraham dental railway A
+151 038004 37 Hawaii scarf validate A
+152 038005 37 cage chasm normalizes A
+153 038006 37 hushes insolence comprehensive
+154 038007 37 Simla syndicate chewing
+155 038008 37 reporters alike denizen
+156 038009 37 Dutchman imperial schemer
+157 038010 37 descendants convulsion chronicle
+158 038011 37 groupings railway Kline
+159 038012 37 dissociate validate Anatole
+160 038013 37 coexist normalizes partridges
+161 038014 37 Beebe comprehensive brunch
+162 038015 37 Taoism chewing recruited
+163 038016 37 Connally denizen dimensions W
+164 038017 37 fetched schemer Chicana W
+165 038018 37 checkpoints chronicle announced
+166 038101 37 rusting Kline praised FAS
+167 038102 37 galling Anatole employing
+168 038103 37 obliterates partridges linear
+169 038104 37 traitor brunch quagmire
+170 038201 37 resumes recruited western A
+171 038202 37 analyzable dimensions relishing
+172 038203 37 terminator Chicana serving A
+173 038204 37 gritty announced scheduling
+174 038205 37 firearm praised lore
+175 038206 37 minima employing eventful
+176 038208 37 Selfridge linear arteriole A
+177 042801 37 disable quagmire disentangle
+178 042802 37 witchcraft western cured A
+179 046101 37 betroth relishing Fenton W
+180 048001 37 Manhattanize serving avoidable A
+181 048002 37 imprint scheduling drains A
+182 048003 37 peeked lore detectably FAS
+183 048004 37 swelling eventful husky
+184 048005 37 interrelationships arteriole impelling
+185 048006 37 riser disentangle undoes
+186 048007 37 Gandhian cured evened
+187 048008 37 peacock Fenton squeezes
+188 048101 37 bee avoidable destroyer FAS
+189 048102 37 kanji drains rudeness
+190 048201 37 dental detectably beaner FAS
+191 048202 37 scarf husky boorish
+192 048203 37 chasm impelling Everhart
+193 048204 37 insolence undoes encompass A
+194 048205 37 syndicate evened mushrooms
+195 048301 37 alike squeezes Alison A
+196 048302 37 imperial destroyer externally FAS
+197 048303 37 convulsion rudeness pellagra
+198 048304 37 railway beaner cult
+199 048305 37 validate boorish creek A
+200 048401 37 normalizes Everhart Huffman
+201 048402 37 comprehensive encompass Majorca FAS
+202 048403 37 chewing mushrooms governing A
+203 048404 37 denizen Alison gadfly FAS
+204 048405 37 schemer externally reassigned FAS
+205 048406 37 chronicle pellagra intentness W
+206 048407 37 Kline cult craziness
+207 048408 37 Anatole creek psychic
+208 048409 37 partridges Huffman squabbled
+209 048410 37 brunch Majorca burlesque
+210 048411 37 recruited governing capped
+211 048412 37 dimensions gadfly extracted A
+212 048413 37 Chicana reassigned DiMaggio
+213 048601 37 announced intentness exclamation FAS
+214 048602 37 praised craziness subdirectory
+215 048603 37 employing psychic fangs
+216 048604 37 linear squabbled buyer A
+217 048801 37 quagmire burlesque pithing A
+218 050901 37 western capped transistorizing A
+219 051201 37 relishing extracted nonbiodegradable
+220 056002 37 serving DiMaggio dislocate
+221 056003 37 scheduling exclamation monochromatic FAS
+222 056004 37 lore subdirectory batting
+223 056102 37 eventful fangs postcondition A
+224 056203 37 arteriole buyer catalog FAS
+225 056204 37 disentangle pithing Remus
+226 058003 37 cured transistorizing devices A
+227 058004 37 Fenton nonbiodegradable bike A
+228 058005 37 avoidable dislocate qualify
+229 058006 37 drains monochromatic detained
+230 058007 37 detectably batting commended
+231 058101 37 husky postcondition civilize
+232 058102 37 impelling catalog Elmhurst
+233 058103 37 undoes Remus anesthetizing
+234 058105 37 evened devices deaf
+235 058111 37 squeezes bike Brigham
+236 058112 37 destroyer qualify title
+237 058113 37 rudeness detained coarse
+238 058114 37 beaner commended combinations
+239 058115 37 boorish civilize grayness
+240 058116 37 Everhart Elmhurst innumerable FAS
+241 058117 37 encompass anesthetizing Caroline A
+242 058118 37 mushrooms deaf fatty FAS
+243 058119 37 Alison Brigham eastbound
+244 058120 37 externally title inexperienced
+245 058121 37 pellagra coarse hoarder A
+246 058122 37 cult combinations scotch W
+247 058123 37 creek grayness passport A
+248 058124 37 Huffman innumerable strategic FAS
+249 058125 37 Majorca Caroline gated
+250 058126 37 governing fatty flog
+251 058127 37 gadfly eastbound Pipestone
+252 058128 37 reassigned inexperienced Dar
+253 058201 37 intentness hoarder Corcoran
+254 058202 37 craziness scotch flyers A
+255 058303 37 psychic passport competitions W
+256 058304 37 squabbled strategic suppliers FAS
+257 058602 37 burlesque gated skips
+258 058603 37 capped flog institutes
+259 058604 37 extracted Pipestone troop A
+260 058605 37 DiMaggio Dar connective W
+261 058606 37 exclamation Corcoran denies
+262 058607 37 subdirectory flyers polka
+263 060401 36 fangs competitions observations FAS
+264 061701 36 buyer suppliers askers
+265 066201 36 pithing skips homeless FAS
+266 066501 36 transistorizing institutes Anna
+267 068001 36 nonbiodegradable troop subdirectories W
+268 068002 36 dislocate connective decaying FAS
+269 068005 36 monochromatic denies outwitting W
+270 068006 36 batting polka Harpy W
+271 068007 36 postcondition observations crazed
+272 068008 36 catalog askers suffocate
+273 068009 36 Remus homeless provers FAS
+274 068010 36 devices Anna technically
+275 068011 36 bike subdirectories Franklinizations
+276 068202 36 qualify decaying considered
+277 068302 36 detained outwitting tinnily
+278 068303 36 commended Harpy uninterruptedly
+279 068401 36 civilize crazed whistled A
+280 068501 36 Elmhurst suffocate automate
+281 068502 36 anesthetizing provers gutting W
+282 068503 36 deaf technically surreptitious
+283 068602 36 Brigham Franklinizations Choctaw
+284 068603 36 title considered cooks
+285 068701 36 coarse tinnily millivolt FAS
+286 068702 36 combinations uninterruptedly counterpoise
+287 068703 36 grayness whistled Gothicism
+288 076001 36 innumerable automate feminine
+289 076002 36 Caroline gutting metaphysically W
+290 076101 36 fatty surreptitious sanding A
+291 076102 36 eastbound Choctaw contributorily
+292 076103 36 inexperienced cooks receivers FAS
+293 076302 36 hoarder millivolt adjourn
+294 076303 36 scotch counterpoise straggled A
+295 076304 36 passport Gothicism druggists
+296 076305 36 strategic feminine thanking FAS
+297 076306 36 gated metaphysically ostrich
+298 076307 36 flog sanding hopelessness FAS
+299 076402 36 Pipestone contributorily Eurydice
+300 076501 36 Dar receivers excitation W
+301 076502 36 Corcoran adjourn presumes FAS
+302 076701 36 flyers straggled imaginable FAS
+303 078001 36 competitions druggists concoct W
+304 078002 36 suppliers thanking peering W
+305 078003 36 skips ostrich Phelps FAS
+306 078004 36 institutes hopelessness ferociousness FAS
+307 078005 36 troop Eurydice sentences
+308 078006 36 connective excitation unlocks
+309 078007 36 denies presumes engrossing W
+310 078008 36 polka imaginable Ruth
+311 078101 36 observations concoct tying
+312 078103 36 askers peering exclaimers
+313 078104 36 homeless Phelps synergy
+314 078105 36 Anna ferociousness Huey W
+315 082101 36 subdirectories sentences merging
+316 083401 36 decaying unlocks judges A
+317 084001 36 outwitting engrossing Shylock W
+318 084002 36 Harpy Ruth Miltonism
+319 086001 36 crazed tying hen W
+320 086102 36 suffocate exclaimers honeybee FAS
+321 086201 36 provers synergy towers
+322 088001 36 technically Huey dilutes W
+323 088002 36 Franklinizations merging numerals FAS
+324 088003 36 considered judges democracy FAS
+325 088004 36 tinnily Shylock Ibero-
+326 088101 36 uninterruptedly Miltonism invalids
+327 088102 36 whistled hen behavior
+328 088103 36 automate honeybee accruing
+329 088104 36 gutting towers relics A
+330 088105 36 surreptitious dilutes rackets
+331 088106 36 Choctaw numerals Fischbein W
+332 088201 36 cooks democracy phony W
+333 088203 36 millivolt Ibero- cross FAS
+334 088204 36 counterpoise invalids cleanup
+335 088302 37 Gothicism behavior conspirator
+336 088303 37 feminine accruing label FAS
+337 088305 37 metaphysically relics university
+338 088402 37 sanding rackets cleansed FAS
+339 088501 36 contributorily Fischbein ballgown
+340 088502 36 receivers phony starlet
+341 088503 36 adjourn cross aqueous
+342 098001 58 straggled cleanup portrayal A
+343 098002 58 druggists conspirator despising W
+344 098003 58 thanking label distort W
+345 098004 58 ostrich university palmed
+346 098005 58 hopelessness cleansed faced
+347 098006 58 Eurydice ballgown silverware
+348 141903 29 excitation starlet assessor
+349 098008 58 presumes aqueous spiders
+350 098009 58 imaginable portrayal artificially
+351 098010 58 concoct despising reminiscence
+352 098011 58 peering distort Mexican
+353 098012 58 Phelps palmed obnoxious
+354 098013 58 ferociousness faced fragile
+355 098014 58 sentences silverware apprehensible
+356 098015 58 unlocks assessor births
+357 098016 58 engrossing spiders garages
+358 098017 58 Ruth artificially panty
+359 098018 58 tying reminiscence anteater
+360 098019 58 exclaimers Mexican displacement A
+361 098020 58 synergy obnoxious drovers A
+362 098021 58 Huey fragile patenting A
+363 098022 58 merging apprehensible far A
+364 098023 58 judges births shrieks
+365 098024 58 Shylock garages aligning W
+366 098025 37 Miltonism panty pragmatism
+367 106001 36 hen anteater fevers W
+368 108001 36 honeybee displacement reexamines A
+369 108002 36 towers drovers occupancies
+370 108003 36 dilutes patenting sweats FAS
+371 108004 36 numerals far modulators
+372 108005 36 democracy shrieks demand W
+373 108007 36 Ibero- aligning Madeira
+374 108008 36 invalids pragmatism Viennese W
+375 108009 36 behavior fevers chillier W
+376 108010 36 accruing reexamines wildcats FAS
+377 108011 36 relics occupancies gentle
+378 108012 36 rackets sweats Angles W
+379 108101 36 Fischbein modulators accuracies
+380 108102 36 phony demand toggle
+381 108103 36 cross Madeira Mendelssohn W
+382 108111 50 cleanup Viennese behaviorally
+383 108105 36 conspirator chillier Rochford
+384 108106 36 label wildcats mirror W
+385 108107 36 university gentle Modula
+386 108108 50 cleansed Angles clobbering
+387 108109 36 ballgown accuracies chronography
+388 108110 36 starlet toggle Eskimoizeds
+389 108201 36 aqueous Mendelssohn British W
+390 108202 36 portrayal behaviorally pitfalls
+391 108203 36 despising Rochford verify W
+392 108204 36 distort mirror scatter FAS
+393 108205 36 palmed Modula Aztecan
+394 108301 36 faced clobbering acuity W
+395 108302 36 silverware chronography sinking W
+396 112101 36 assessor Eskimoizeds beasts FAS
+397 112102 36 spiders British Witt W
+398 113701 36 artificially pitfalls physicists FAS
+399 116001 36 reminiscence verify folksong A
+400 116201 36 Mexican scatter strokes FAS
+401 116301 36 obnoxious Aztecan crowder
+402 116302 36 fragile acuity merry
+403 116601 36 apprehensible sinking cadenced
+404 116602 36 births beasts alimony A
+405 116603 36 garages Witt principled A
+406 116701 36 panty physicists golfing
+407 116702 36 anteater folksong undiscovered
+408 118001 36 displacement strokes irritates
+409 118002 36 drovers crowder patriots A
+410 118003 36 patenting merry rooms FAS
+411 118004 36 far cadenced towering W
+412 118005 36 shrieks alimony displease
+413 118006 36 aligning principled photosensitive
+414 118007 36 pragmatism golfing inking
+415 118008 36 fevers undiscovered gainers
+416 118101 36 reexamines irritates leaning A
+417 118102 36 occupancies patriots hydrant A
+418 118103 36 sweats rooms preserve
+419 118202 36 modulators towering blinded A
+420 118203 36 demand displease interactions A
+421 118204 36 Madeira photosensitive Barry
+422 118302 36 Viennese inking whiteness A
+423 118304 36 chillier gainers pastimes W
+424 118305 36 wildcats leaning Edenization
+425 118306 36 gentle hydrant Muscat
+426 118307 36 Angles preserve assassinated
+427 123101 36 accuracies blinded labeled
+428 123102 36 toggle interactions glacial A
+429 123301 36 Mendelssohn Barry implied W
+430 126001 36 behaviorally whiteness bibliographies W
+431 126002 36 Rochford pastimes Buchanan
+432 126003 36 mirror Edenization forgivably FAS
+433 126101 36 Modula Muscat innuendo A
+434 126301 36 clobbering assassinated den FAS
+435 126302 36 chronography labeled submarines W
+436 126402 36 Eskimoizeds glacial mouthful A
+437 126601 36 British implied expiring
+438 126602 36 pitfalls bibliographies unfulfilled FAS
+439 126702 36 verify Buchanan precession
+440 128001 36 scatter forgivably nullified
+441 128002 36 Aztecan innuendo affects
+442 128003 36 acuity den Cynthia
+443 128004 36 sinking submarines Chablis A
+444 128005 36 beasts mouthful betterments FAS
+445 128007 36 Witt expiring advertising
+446 128008 36 physicists unfulfilled rubies A
+447 128009 36 folksong precession southwest FAS
+448 128010 36 strokes nullified superstitious A
+449 128011 36 crowder affects tabernacle W
+450 128012 36 merry Cynthia silk A
+451 128013 36 cadenced Chablis handsomest A
+452 128014 36 alimony betterments Persian A
+453 128015 36 principled advertising analog W
+454 128016 36 golfing rubies complex W
+455 128017 36 undiscovered southwest Taoist
+456 128018 36 irritates superstitious suspend
+457 128019 36 patriots tabernacle relegated
+458 128020 36 rooms silk awesome W
+459 128021 36 towering handsomest Bruxelles
+460 128022 36 displease Persian imprecisely A
+461 128023 36 photosensitive analog televise
+462 128101 36 inking complex braking
+463 128102 36 gainers Taoist true FAS
+464 128103 36 leaning suspend disappointing FAS
+465 128104 36 hydrant relegated navally W
+466 128106 36 preserve awesome circus
+467 128107 36 blinded Bruxelles beetles
+468 128108 36 interactions imprecisely trumps
+469 128202 36 Barry televise fourscore W
+470 128203 36 whiteness braking Blackfoots
+471 128301 36 pastimes true Grady
+472 128302 36 Edenization disappointing quiets FAS
+473 128303 36 Muscat navally floundered FAS
+474 128304 36 assassinated circus profundity W
+475 128305 36 labeled beetles Garrisonian W
+476 128307 36 glacial trumps Strauss
+477 128401 36 implied fourscore cemented FAS
+478 128502 36 bibliographies Blackfoots contrition A
+479 128503 36 Buchanan Grady mutations
+480 128504 36 forgivably quiets exhibits W
+481 128505 36 innuendo floundered tits
+482 128601 36 den profundity mate A
+483 128603 36 submarines Garrisonian arches
+484 128604 36 mouthful Strauss Moll
+485 128702 36 expiring cemented ropers
+486 128703 36 unfulfilled contrition bombast
+487 128704 36 precession mutations difficultly A
+488 138001 36 nullified exhibits adsorption
+489 138002 36 affects tits definiteness FAS
+490 138003 36 Cynthia mate cultivation A
+491 138004 36 Chablis arches heals A
+492 138005 36 betterments Moll Heusen W
+493 138006 36 advertising ropers target FAS
+494 138007 36 rubies bombast cited A
+495 138008 36 southwest difficultly congresswoman W
+496 138009 36 superstitious adsorption Katherine
+497 138102 36 tabernacle definiteness titter A
+498 138103 36 silk cultivation aspire A
+499 138104 36 handsomest heals Mardis
+500 138105 36 Persian Heusen Nadia W
+501 138201 36 analog target estimating FAS
+502 138302 36 complex cited stuck A
+503 138303 36 Taoist congresswoman fifteenth A
+504 138304 36 suspend Katherine Colombo
+505 138401 29 relegated titter survey A
+506 140102 29 awesome aspire staffing
+507 140103 29 Bruxelles Mardis obtain
+508 140104 29 imprecisely Nadia loaded
+509 140105 29 televise estimating slaughtered
+510 140201 29 braking stuck lights A
+511 140701 29 true fifteenth circumference
+512 141501 29 disappointing Colombo dull A
+513 141502 29 navally survey weekly A
+514 141901 29 circus staffing wetness
+515 141902 29 beetles obtain visualized
+516 142101 29 trumps loaded Tannenbaum
+517 142102 29 fourscore slaughtered moribund
+518 142103 29 Blackfoots lights demultiplex
+519 142701 29 Grady circumference lockings
+520 143001 29 quiets dull thugs FAS
+521 143501 29 floundered weekly unnerves
+522 143502 29 profundity wetness abut
+523 148001 29 Garrisonian visualized Chippewa A
+524 148002 29 Strauss Tannenbaum stratifications A
+525 148003 29 cemented moribund signaled
+526 148004 29 contrition demultiplex Italianizes A
+527 148005 29 mutations lockings algorithmic A
+528 148006 29 exhibits thugs paranoid FAS
+529 148007 29 tits unnerves camping A
+530 148009 29 mate abut signifying A
+531 148010 29 arches Chippewa Patrice W
+532 148011 29 Moll stratifications search A
+533 148012 29 ropers signaled Angeles A
+534 148013 29 bombast Italianizes semblance
+535 148023 36 difficultly algorithmic taxed
+536 148015 29 adsorption paranoid Beatrice
+537 148016 29 definiteness camping retrace
+538 148017 29 cultivation signifying lockout
+539 148018 29 heals Patrice grammatic
+540 148019 29 Heusen search helmsman
+541 148020 29 target Angeles uniform W
+542 148021 29 cited semblance hamming
+543 148022 29 congresswoman taxed disobedience
+544 148101 29 Katherine Beatrice captivated A
+545 148102 29 titter retrace transferals A
+546 148201 29 aspire lockout cartographer A
+547 148401 29 Mardis grammatic aims FAS
+548 148402 29 Nadia helmsman Pakistani
+549 148501 29 estimating uniform burglarized FAS
+550 148502 29 stuck hamming saucepans A
+551 148503 29 fifteenth disobedience lacerating A
+552 148504 29 Colombo captivated corny
+553 148601 29 survey transferals megabytes FAS
+554 148602 29 staffing cartographer chancellor
+555 150701 29 obtain aims bulk A
+556 152101 29 loaded Pakistani commits A
+557 152102 29 slaughtered burglarized meson W
+558 155202 36 lights saucepans deputies
+559 155203 29 circumference lacerating northeaster A
+560 155204 29 dull corny dipole
+561 155205 29 weekly megabytes machining 0
+562 156001 29 wetness chancellor therefore
+563 156002 29 visualized bulk Telefunken
+564 156102 29 Tannenbaum commits salvaging
+565 156301 29 moribund meson Corinthianizes A
+566 156302 29 demultiplex deputies restlessly A
+567 156303 29 lockings northeaster bromides
+568 156304 29 thugs dipole generalized A
+569 156305 29 unnerves machining mishaps
+570 156306 29 abut therefore quelling
+571 156501 29 Chippewa Telefunken spiritual A
+572 158001 29 stratifications salvaging beguiles FAS
+573 158002 29 signaled Corinthianizes Trobriand FAS
+574 158101 29 Italianizes restlessly fleeing A
+575 158102 29 algorithmic bromides Armour A
+576 158103 29 paranoid generalized chin A
+577 158201 29 camping mishaps provers A
+578 158202 29 signifying quelling aeronautic A
+579 158203 29 Patrice spiritual voltage W
+580 158204 29 search beguiles sash
+581 158301 29 Angeles Trobriand anaerobic A
+582 158302 29 semblance fleeing simultaneous A
+583 158303 29 taxed Armour accumulating A
+584 158304 29 Beatrice chin Medusan A
+585 158305 29 retrace provers shouted A
+586 158306 29 lockout aeronautic freakish
+587 158501 29 grammatic voltage index FAS
+588 160301 29 helmsman sash commercially
+589 166101 50 uniform anaerobic mistiness A
+590 166102 50 hamming simultaneous endpoint
+591 168001 29 disobedience accumulating straight A
+592 168002 29 captivated Medusan flurried
+593 168003 29 transferals shouted denotative A
+594 168101 29 cartographer freakish coming FAS
+595 168102 29 aims index commencements FAS
+596 168103 29 Pakistani commercially gentleman
+597 168104 29 burglarized mistiness gifted
+598 168202 29 saucepans endpoint Shanghais
+599 168301 29 lacerating straight sportswriting A
+600 168502 29 corny flurried sloping A
+601 168503 29 megabytes denotative navies
+602 168601 29 chancellor coming leaflet A
+603 173001 40 bulk commencements shooter
+604 173701 40 commits gentleman Joplin FAS
+605 173702 40 meson gifted babies
+606 176001 40 deputies Shanghais subdivision FAS
+607 176101 40 northeaster sportswriting burstiness W
+608 176201 40 dipole sloping belted FAS
+609 176401 40 machining navies assails FAS
+610 176501 40 therefore leaflet admiring W
+611 176601 40 Telefunken shooter swaying 0
+612 176602 40 salvaging Joplin Goldstine FAS
+613 176603 40 Corinthianizes babies fitting
+614 178001 40 restlessly subdivision Norwalk W
+615 178002 40 bromides burstiness weakening W
+616 178003 40 generalized belted analogy FAS
+617 178004 40 mishaps assails deludes
+618 178005 40 quelling admiring cokes
+619 178006 40 spiritual swaying Clayton
+620 178007 40 beguiles Goldstine exhausts
+621 178008 40 Trobriand fitting causality
+622 178101 40 fleeing Norwalk sating FAS
+623 178102 40 Armour weakening icon
+624 178103 40 chin analogy throttles
+625 178201 40 provers deludes communicants FAS
+626 178202 40 aeronautic cokes dehydrate FAS
+627 178301 40 voltage Clayton priceless FAS
+628 178302 40 sash exhausts publicly
+629 178401 40 anaerobic causality incidentals FAS
+630 178402 40 simultaneous sating commonplace
+631 178403 40 accumulating icon mumbles
+632 178404 40 Medusan throttles furthermore W
+633 178501 40 shouted communicants cautioned W
+634 186002 37 freakish dehydrate parametrized A
+635 186102 37 index priceless registration A
+636 186201 40 commercially publicly sadly FAS
+637 186202 40 mistiness incidentals positioning
+638 186203 40 endpoint commonplace babysitting
+639 186302 37 straight mumbles eternal A
+640 188007 37 flurried furthermore hoarder
+641 188008 37 denotative cautioned congregates
+642 188009 37 coming parametrized rains
+643 188010 37 commencements registration workers W
+644 188011 37 gentleman sadly sags A
+645 188012 37 gifted positioning unplug W
+646 188013 37 Shanghais babysitting garage A
+647 188014 37 sportswriting eternal boulder A
+648 188015 37 sloping hoarder hollowly A
+649 188016 37 navies congregates specifics
+650 188017 37 leaflet rains Teresa
+651 188102 37 shooter workers Winsett
+652 188103 37 Joplin sags convenient A
+653 188202 37 babies unplug buckboards FAS
+654 188301 40 subdivision garage amenities
+655 188302 40 burstiness boulder resplendent FAS
+656 188303 40 belted hollowly priding FAS
+657 188401 37 assails specifics configurations
+658 188402 37 admiring Teresa untidiness A
+659 188503 37 swaying Winsett Brice W
+660 188504 37 Goldstine convenient sews FAS
+661 188505 37 fitting buckboards participated
+662 190701 37 Norwalk amenities Simon FAS
+663 190703 50 weakening resplendent certificates
+664 191701 37 analogy priding Fitzpatrick
+665 191702 37 deludes configurations Evanston A
+666 191703 37 cokes untidiness misted
+667 196001 37 Clayton Brice textures A
+668 196002 37 exhausts sews save
+669 196003 37 causality participated count
+670 196101 37 sating Simon rightful A
+671 196103 37 icon certificates chaperone
+672 196104 37 throttles Fitzpatrick Lizzy A
+673 196201 37 communicants Evanston clenched A
+674 196202 37 dehydrate misted effortlessly
+675 196203 37 priceless textures accessed
+676 198001 37 publicly save beaters A
+677 198003 37 incidentals count Hornblower FAS
+678 198004 37 commonplace rightful vests A
+679 198005 37 mumbles chaperone indulgences FAS
+680 198006 37 furthermore Lizzy infallibly A
+681 198007 37 cautioned clenched unwilling FAS
+682 198008 37 parametrized effortlessly excrete FAS
+683 198009 37 registration accessed spools A
+684 198010 37 sadly beaters crunches FAS
+685 198011 37 positioning Hornblower overestimating FAS
+686 198012 37 babysitting vests ineffective
+687 198013 37 eternal indulgences humiliation A
+688 198014 37 hoarder infallibly sophomore
+689 198015 37 congregates unwilling star
+690 198017 37 rains excrete rifles
+691 198018 37 workers spools dialysis
+692 198019 37 sags crunches arriving
+693 198020 37 unplug overestimating indulge
+694 198021 37 garage ineffective clockers
+695 198022 37 boulder humiliation languages
+696 198023 50 hollowly sophomore Antarctica A
+697 198024 37 specifics star percentage
+698 198101 37 Teresa rifles ceiling A
+699 198103 37 Winsett dialysis specification
+700 198105 37 convenient arriving regimented A
+701 198106 37 buckboards indulge ciphers
+702 198201 37 amenities clockers pictures A
+703 198204 37 resplendent languages serpents A
+704 198301 53 priding Antarctica allot A
+705 198302 53 configurations percentage realized A
+706 198303 53 untidiness ceiling mayoral A
+707 198304 53 Brice specification opaquely A
+708 198401 37 sews regimented hostess FAS
+709 198402 37 participated ciphers fiftieth
+710 198403 37 Simon pictures incorrectly
+711 202101 37 certificates serpents decomposition FAS
+712 202301 37 Fitzpatrick allot stranglings
+713 202302 37 Evanston realized mixture FAS
+714 202303 37 misted mayoral electroencephalography FAS
+715 202304 37 textures opaquely similarities FAS
+716 202305 37 save hostess charges W
+717 202601 37 count fiftieth freest FAS
+718 202602 37 rightful incorrectly Greenberg FAS
+719 202605 37 chaperone decomposition tinting
+720 202606 37 Lizzy stranglings expelled W
+721 202607 37 clenched mixture warm
+722 202901 37 effortlessly electroencephalography smoothed
+723 202902 37 accessed similarities deductions FAS
+724 202903 37 beaters charges Romano W
+725 202904 37 Hornblower freest bitterroot
+726 202907 37 vests Greenberg corset
+727 202908 37 indulgences tinting securing
+728 203101 37 infallibly expelled environing FAS
+729 203103 37 unwilling warm cute
+730 203104 37 excrete smoothed Crays
+731 203105 37 spools deductions heiress FAS
+732 203401 37 crunches Romano inform FAS
+733 203402 37 overestimating bitterroot avenge
+734 203404 37 ineffective corset universals
+735 203901 37 humiliation securing Kinsey W
+736 203902 37 sophomore environing ravines FAS
+737 203903 37 star cute bestseller
+738 203906 37 rifles Crays equilibrium
+739 203907 37 dialysis heiress extents 0
+740 203908 37 arriving inform relatively
+741 203909 37 indulge avenge pressure FAS
+742 206101 37 clockers universals critiques FAS
+743 206201 37 languages Kinsey befouled
+744 206202 37 Antarctica ravines rightfully FAS
+745 206203 37 percentage bestseller mechanizing FAS
+746 206206 37 ceiling equilibrium Latinizes
+747 206207 37 specification extents timesharing
+748 206208 37 regimented relatively Aden
+749 208001 37 ciphers pressure embassies
+750 208002 37 pictures critiques males FAS
+751 208003 37 serpents befouled shapelessly FAS
+752 208004 37 allot rightfully genres FAS
+753 208008 37 realized mechanizing mastering
+754 208009 37 mayoral Latinizes Newtonian
+755 208010 37 opaquely timesharing finishers FAS
+756 208011 37 hostess Aden abates
+757 208101 37 fiftieth embassies teem
+758 208102 37 incorrectly males kiting FAS
+759 208103 37 decomposition shapelessly stodgy FAS
+760 208104 37 stranglings genres scalps FAS
+761 208105 37 mixture mastering feed FAS
+762 208110 37 electroencephalography Newtonian guitars
+763 208111 37 similarities finishers airships
+764 208112 37 charges abates store
+765 208113 37 freest teem denounces
+766 208201 37 Greenberg kiting Pyle FAS
+767 208203 37 tinting stodgy Saxony
+768 208301 37 expelled scalps serializations FAS
+769 208302 37 warm feed Peruvian FAS
+770 208305 37 smoothed guitars taxonomically FAS
+771 208401 37 deductions airships kingdom A
+772 208402 37 Romano store stint A
+773 208403 37 bitterroot denounces Sault A
+774 208404 37 corset Pyle faithful
+775 208501 37 securing Saxony Ganymede FAS
+776 208502 37 environing serializations tidiness FAS
+777 208503 37 cute Peruvian gainful FAS
+778 208504 37 Crays taxonomically contrary FAS
+779 208505 37 heiress kingdom Tipperary FAS
+780 210101 37 inform stint tropics W
+781 210102 37 avenge Sault theorizers
+782 210103 37 universals faithful renew 0
+783 210104 37 Kinsey Ganymede already
+784 210105 37 ravines tidiness terminal
+785 210106 37 bestseller gainful Hegelian
+786 210107 37 equilibrium contrary hypothesizer
+787 210401 37 extents Tipperary warningly FAS
+788 213201 37 relatively tropics journalizing FAS
+789 213203 37 pressure theorizers nested
+790 213204 37 critiques renew Lars
+791 213205 37 befouled already saplings
+792 213206 37 rightfully terminal foothill
+793 213207 37 mechanizing Hegelian labeled
+794 216101 37 Latinizes hypothesizer imperiously FAS
+795 216103 37 timesharing warningly reporters FAS
+796 218001 37 Aden journalizing furnishings FAS
+797 218002 37 embassies nested precipitable FAS
+798 218003 37 males Lars discounts FAS
+799 218004 37 shapelessly saplings excises FAS
+800 143503 50 genres foothill Stalin
+801 218006 37 mastering labeled despot FAS
+802 218007 37 Newtonian imperiously ripeness FAS
+803 218008 37 finishers reporters Arabia
+804 218009 37 abates furnishings unruly
+805 218010 37 teem precipitable mournfulness
+806 218011 37 kiting discounts boom FAS
+807 218020 37 stodgy excises slaughter A
+808 218021 50 scalps Stalin Sabine
+809 218022 37 feed despot handy FAS
+810 218023 37 guitars ripeness rural
+811 218024 37 airships Arabia organizer
+812 218101 37 store unruly shipyard FAS
+813 218102 37 denounces mournfulness civics FAS
+814 218103 37 Pyle boom inaccuracy FAS
+815 218201 37 Saxony slaughter rules FAS
+816 218202 37 serializations Sabine juveniles FAS
+817 218203 37 Peruvian handy comprised W
+818 218204 37 taxonomically rural investigations
+819 218205 37 kingdom organizer stabilizes A
+820 218301 37 stint shipyard seminaries FAS
+821 218302 37 Sault civics Hunter A
+822 218401 37 faithful inaccuracy sporty FAS
+823 218402 37 Ganymede rules test FAS
+824 218403 37 tidiness juveniles weasels
+825 218404 37 gainful comprised CERN
+826 218407 37 contrary investigations tempering
+827 218408 37 Tipperary stabilizes afore FAS
+828 218409 37 tropics seminaries Galatean
+829 218410 37 theorizers Hunter techniques W
+830 226001 37 renew sporty error
+831 226002 37 already test veranda
+832 226003 37 terminal weasels severely
+833 226004 37 Hegelian CERN Cassites FAS
+834 226005 37 hypothesizer tempering forthcoming
+835 226006 37 warningly afore guides
+836 226007 37 journalizing Galatean vanish FAS
+837 226008 37 nested techniques lied A
+838 226203 37 Lars error sawtooth FAS
+839 226204 37 saplings veranda fated FAS
+840 226205 37 foothill severely gradually
+841 226206 37 labeled Cassites widens
+842 226207 37 imperiously forthcoming preclude
+843 226208 37 reporters guides Jobrel
+844 226209 37 furnishings vanish hooker
+845 226210 37 precipitable lied rainstorm
+846 226211 37 discounts sawtooth disconnects
+847 228001 37 excises fated cruelty
+848 228004 37 Stalin gradually exponentials A
+849 228005 37 despot widens affective A
+850 228006 37 ripeness preclude arteries
+851 228007 37 Arabia Jobrel Crosby FAS
+852 228008 37 unruly hooker acquaint
+853 228009 37 mournfulness rainstorm evenhandedly
+854 228101 37 boom disconnects percentage
+855 228108 37 slaughter cruelty disobedience
+856 228109 37 Sabine exponentials humility
+857 228110 37 handy affective gleaning A
+858 228111 37 rural arteries petted A
+859 228112 37 organizer Crosby bloater A
+860 228113 37 shipyard acquaint minion A
+861 228114 37 civics evenhandedly marginal A
+862 228115 37 inaccuracy percentage apiary A
+863 228116 37 rules disobedience measures
+864 228117 37 juveniles humility precaution
+865 228118 37 comprised gleaning repelled
+866 228119 37 investigations petted primary FAS
+867 228120 37 stabilizes bloater coverings
+868 228121 37 seminaries minion Artemia A
+869 228122 37 Hunter marginal navigate
+870 228201 37 sporty apiary spatial
+871 228206 37 test measures Gurkha
+872 228207 37 weasels precaution meanwhile A
+873 228208 37 CERN repelled Melinda A
+874 228209 37 tempering primary Butterfield
+875 228210 37 afore coverings Aldrich A
+876 228211 37 Galatean Artemia previewing A
+877 228212 37 techniques navigate glut A
+878 228213 37 error spatial unaffected
+879 228214 37 veranda Gurkha inmate
+880 228301 37 severely meanwhile mineral
+881 228305 37 Cassites Melinda impending A
+882 228306 37 forthcoming Butterfield meditation A
+883 228307 37 guides Aldrich ideas
+884 228308 37 vanish previewing miniaturizes W
+885 228309 37 lied glut lewdly
+886 228310 37 sawtooth unaffected title
+887 228311 37 fated inmate youthfulness
+888 228312 37 gradually mineral creak FAS
+889 228313 37 widens impending Chippewa
+890 228314 37 preclude meditation clamored
+891 228401 65 Jobrel ideas freezes
+892 228402 65 hooker miniaturizes forgivably FAS
+893 228403 65 rainstorm lewdly reduce FAS
+894 228404 65 disconnects title McGovern W
+895 228405 65 cruelty youthfulness Nazis W
+896 228406 65 exponentials creak epistle W
+897 228407 65 affective Chippewa socializes W
+898 228408 65 arteries clamored conceptions
+899 228409 65 Crosby freezes Kevin
+900 228410 65 acquaint forgivably uncovering
+901 230301 37 evenhandedly reduce chews FAS
+902 230302 37 percentage McGovern appendixes FAS
+903 230303 37 disobedience Nazis raining
+904 018062 37 humility epistle infest
+905 230501 37 gleaning socializes compartment
+906 230502 37 petted conceptions minting
+907 230503 37 bloater Kevin ducks
+908 230504 37 minion uncovering roped A
+909 230505 37 marginal chews waltz
+910 230506 37 apiary appendixes Lillian
+911 230507 37 measures raining repressions A
+912 230508 37 precaution infest chillingly
+913 230509 37 repelled compartment noncritical
+914 230901 37 primary minting lithograph
+915 230902 37 coverings ducks spongers
+916 230903 37 Artemia roped parenthood
+917 230904 37 navigate waltz posed
+918 230905 37 spatial Lillian instruments
+919 230906 37 Gurkha repressions filial
+920 230907 37 meanwhile chillingly fixedly
+921 230908 37 Melinda noncritical relives
+922 230909 37 Butterfield lithograph Pandora
+923 230910 37 Aldrich spongers watering A
+924 230911 37 previewing parenthood ungrateful
+925 230912 37 glut posed secures
+926 230913 37 unaffected instruments chastisers
+927 230914 37 inmate filial icon
+928 231304 37 mineral fixedly reuniting A
+929 231305 37 impending relives imagining A
+930 231306 37 meditation Pandora abiding A
+931 231307 37 ideas watering omnisciently
+932 231308 37 miniaturizes ungrateful Britannic
+933 231309 37 lewdly secures scholastics A
+934 231310 37 title chastisers mechanics A
+935 231311 37 youthfulness icon humidly A
+936 231312 37 creak reuniting masterpiece
+937 231313 37 Chippewa imagining however
+938 231314 37 clamored abiding Mendelian
+939 231315 37 freezes omnisciently jarred
+940 232102 37 forgivably Britannic scolds
+941 232103 37 reduce scholastics infatuate
+942 232104 37 McGovern mechanics willed A
+943 232105 37 Nazis humidly joyfully
+944 232106 37 epistle masterpiece Microsoft
+945 232107 37 socializes however fibrosities
+946 232108 37 conceptions Mendelian Baltimorean
+947 232601 37 Kevin jarred equestrian
+948 232602 37 uncovering scolds Goodrich
+949 232603 37 chews infatuate apish A
+950 232605 37 appendixes willed Adlerian
+5950 1232605 37 appendixes willed Adlerian
+5951 1232606 37 appendixes willed Adlerian
+5952 1232607 37 appendixes willed Adlerian
+5953 1232608 37 appendixes willed Adlerian
+5954 1232609 37 appendixes willed Adlerian
+951 232606 37 raining joyfully Tropez
+952 232607 37 infest Microsoft nouns
+953 232608 37 compartment fibrosities distracting
+954 232609 37 minting Baltimorean mutton
+955 236104 37 ducks equestrian bridgeable A
+956 236105 37 roped Goodrich stickers A
+957 236106 37 waltz apish transcontinental A
+958 236107 37 Lillian Adlerian amateurish
+959 236108 37 repressions Tropez Gandhian
+960 236109 37 chillingly nouns stratified
+961 236110 37 noncritical distracting chamberlains
+962 236111 37 lithograph mutton creditably
+963 236112 37 spongers bridgeable philosophic
+964 236113 37 parenthood stickers ores
+965 238005 37 posed transcontinental Carleton
+966 238006 37 instruments amateurish tape A
+967 238007 37 filial Gandhian afloat A
+968 238008 37 fixedly stratified goodness A
+969 238009 37 relives chamberlains welcoming
+970 238010 37 Pandora creditably Pinsky FAS
+971 238011 37 watering philosophic halting
+972 238012 37 ungrateful ores bibliography
+973 238013 37 secures Carleton decoding
+974 240401 41 chastisers tape variance A
+975 240402 41 icon afloat allowed A
+976 240901 41 reuniting goodness dire A
+977 240902 41 imagining welcoming dub A
+978 241801 41 abiding Pinsky poisoning
+979 242101 41 omnisciently halting Iraqis A
+980 242102 41 Britannic bibliography heaving
+981 242201 41 scholastics decoding population A
+982 242202 41 mechanics variance bomb A
+983 242501 41 humidly allowed Majorca A
+984 242502 41 masterpiece dire Gershwins
+985 246201 41 however dub explorers
+986 246202 41 Mendelian poisoning libretto A
+987 246203 41 jarred Iraqis occurred
+988 246204 41 scolds heaving Lagos
+989 246205 41 infatuate population rats
+990 246301 41 willed bomb bankruptcies A
+991 246302 41 joyfully Majorca crying
+992 248001 41 Microsoft Gershwins unexpected
+993 248002 41 fibrosities explorers accessed A
+994 248003 41 Baltimorean libretto colorful A
+995 248004 41 equestrian occurred versatility A
+996 248005 41 Goodrich Lagos cosy
+997 248006 41 apish rats Darius A
+998 248007 41 Adlerian bankruptcies mastering A
+999 248008 41 Tropez crying Asiaticizations A
+1000 248009 41 nouns unexpected offerers A
+1001 248010 41 distracting accessed uncles A
+1002 248011 41 mutton colorful sleepwalk
+1003 248012 41 bridgeable versatility Ernestine
+1004 248013 41 stickers cosy checksumming
+1005 248014 41 transcontinental Darius stopped
+1006 248015 41 amateurish mastering sicker
+1007 248016 41 Gandhian Asiaticizations Italianization
+1008 248017 41 stratified offerers alphabetic
+1009 248018 41 chamberlains uncles pharmaceutic
+1010 248019 41 creditably sleepwalk creator
+1011 248020 41 philosophic Ernestine chess
+1012 248021 41 ores checksumming charcoal
+1013 248101 41 Carleton stopped Epiphany A
+1014 248102 41 tape sicker bulldozes A
+1015 248201 41 afloat Italianization Pygmalion A
+1016 248202 41 goodness alphabetic caressing A
+1017 248203 41 welcoming pharmaceutic Palestine A
+1018 248204 41 Pinsky creator regimented A
+1019 248205 41 halting chess scars A
+1020 248206 41 bibliography charcoal realest A
+1021 248207 41 decoding Epiphany diffusing A
+1022 248208 41 variance bulldozes clubroom A
+1023 248209 41 allowed Pygmalion Blythe A
+1024 248210 41 dire caressing ahead
+1025 248211 50 dub Palestine reviver
+1026 250501 34 poisoning regimented retransmitting A
+1027 250502 34 Iraqis scars landslide
+1028 250503 34 heaving realest Eiffel
+1029 250504 34 population diffusing absentee
+1030 250505 34 bomb clubroom aye
+1031 250601 34 Majorca Blythe forked A
+1032 250602 34 Gershwins ahead Peruvianizes
+1033 250603 34 explorers reviver clerked
+1034 250604 34 libretto retransmitting tutor
+1035 250605 34 occurred landslide boulevard
+1036 251001 34 Lagos Eiffel shuttered
+1037 251002 34 rats absentee quotes A
+1038 251003 34 bankruptcies aye Caltech
+1039 251004 34 crying forked Mossberg
+1040 251005 34 unexpected Peruvianizes kept
+1041 251301 34 accessed clerked roundly
+1042 251302 34 colorful tutor features A
+1043 251303 34 versatility boulevard imaginable A
+1044 251304 34 cosy shuttered controller
+1045 251305 34 Darius quotes racial
+1046 251401 34 mastering Caltech uprisings A
+1047 251402 34 Asiaticizations Mossberg narrowed A
+1048 251403 34 offerers kept cannot A
+1049 251404 34 uncles roundly vest
+1050 251405 34 sleepwalk features famine
+1051 251406 34 Ernestine imaginable sugars
+1052 251801 34 checksumming controller exterminated A
+1053 251802 34 stopped racial belays
+1054 252101 34 sicker uprisings Hodges A
+1055 252102 34 Italianization narrowed translatable
+1056 252301 34 alphabetic cannot duality A
+1057 252302 34 pharmaceutic vest recording A
+1058 252303 34 creator famine rouses A
+1059 252304 34 chess sugars poison
+1060 252305 34 charcoal exterminated attitude
+1061 252306 34 Epiphany belays dusted
+1062 252307 34 bulldozes Hodges encompasses
+1063 252308 34 Pygmalion translatable presentation
+1064 252309 34 caressing duality Kantian
+1065 256001 34 Palestine recording imprecision A
+1066 256002 34 regimented rouses saving
+1067 256003 34 scars poison maternal
+1068 256004 34 realest attitude hewed
+1069 256005 34 diffusing dusted kerosene
+1070 258001 34 clubroom encompasses Cubans
+1071 258002 34 Blythe presentation photographers
+1072 258003 34 ahead Kantian nymph A
+1073 258004 34 reviver imprecision bedlam A
+1074 258005 34 retransmitting saving north A
+1075 258006 34 landslide maternal Schoenberg A
+1076 258007 34 Eiffel hewed botany A
+1077 258008 34 absentee kerosene curs
+1078 258009 34 aye Cubans solidification
+1079 258010 34 forked photographers inheritresses
+1080 258011 34 Peruvianizes nymph stiller
+1081 258101 68 clerked bedlam t1 A
+1082 258102 68 tutor north suite A
+1083 258103 34 boulevard Schoenberg ransomer
+1084 258104 68 shuttered botany Willy
+1085 258105 68 quotes curs Rena A
+1086 258106 68 Caltech solidification Seattle A
+1087 258107 68 Mossberg inheritresses relaxes A
+1088 258108 68 kept stiller exclaim
+1089 258109 68 roundly t1 implicated A
+1090 258110 68 features suite distinguish
+1091 258111 68 imaginable ransomer assayed
+1092 258112 68 controller Willy homeowner
+1093 258113 68 racial Rena and
+1094 258201 34 uprisings Seattle stealth
+1095 258202 34 narrowed relaxes coinciding A
+1096 258203 34 cannot exclaim founder A
+1097 258204 34 vest implicated environing
+1098 258205 34 famine distinguish jewelry
+1099 258301 34 sugars assayed lemons A
+1100 258401 34 exterminated homeowner brokenness A
+1101 258402 34 belays and bedpost A
+1102 258403 34 Hodges stealth assurers A
+1103 258404 34 translatable coinciding annoyers
+1104 258405 34 duality founder affixed
+1105 258406 34 recording environing warbling
+1106 258407 34 rouses jewelry seriously
+1107 228123 37 poison lemons boasted
+1108 250606 34 attitude brokenness Chantilly
+1109 208405 37 dusted bedpost Iranizes
+1110 212101 37 encompasses assurers violinist
+1111 218206 37 presentation annoyers extramarital
+1112 150401 37 Kantian affixed spates
+1113 248212 41 imprecision warbling cloakroom
+1114 128026 00 saving seriously gazer
+1115 128024 00 maternal boasted hand
+1116 128027 00 hewed Chantilly tucked
+1117 128025 00 kerosene Iranizes gems
+1118 128109 00 Cubans violinist clinker
+1119 128705 00 photographers extramarital refiner
+1120 126303 00 nymph spates callus
+1121 128308 00 bedlam cloakroom leopards
+1122 128204 00 north gazer comfortingly
+1123 128205 00 Schoenberg hand generically
+1124 128206 00 botany tucked getters
+1125 128207 00 curs gems sexually
+1126 118205 00 solidification clinker spear
+1127 116801 00 inheritresses refiner serums
+1128 116803 00 stiller callus Italianization
+1129 116804 00 t1 leopards attendants
+1130 116802 00 suite comfortingly spies
+1131 128605 00 ransomer generically Anthony
+1132 118308 00 Willy getters planar
+1133 113702 00 Rena sexually cupped
+1134 113703 00 Seattle spear cleanser
+1135 112103 00 relaxes serums commuters
+1136 118009 00 exclaim Italianization honeysuckle
+5136 1118009 00 exclaim Italianization honeysuckle
+1137 138011 00 implicated attendants orphanage
+1138 138010 00 distinguish spies skies
+1139 138012 00 assayed Anthony crushers
+1140 068304 00 homeowner planar Puritan
+1141 078009 00 and cupped squeezer
+1142 108013 00 stealth cleanser bruises
+1143 084004 00 coinciding commuters bonfire
+1144 083402 00 founder honeysuckle Colombo
+1145 084003 00 environing orphanage nondecreasing
+1146 088504 00 jewelry skies innocents
+1147 088005 00 lemons crushers masked
+1148 088007 00 brokenness Puritan file
+1149 088006 00 bedpost squeezer brush
+1150 148025 00 assurers bruises mutilate
+1151 148024 00 annoyers bonfire mommy
+1152 138305 00 affixed Colombo bulkheads
+1153 138306 00 warbling nondecreasing undeclared
+1154 152701 00 seriously innocents displacements
+1155 148505 00 boasted masked nieces
+1156 158003 00 Chantilly file coeducation
+1157 156201 00 Iranizes brush brassy
+1158 156202 00 violinist mutilate authenticator
+1159 158307 00 extramarital mommy Washoe
+1160 158402 00 spates bulkheads penny
+1161 158401 00 cloakroom undeclared Flagler
+1162 068013 00 gazer displacements stoned
+1163 068012 00 hand nieces cranes
+1164 068203 00 tucked coeducation masterful
+1165 088205 00 gems brassy biracial
+1166 068704 00 clinker authenticator steamships
+1167 068604 00 refiner Washoe windmills
+1168 158502 00 callus penny exploit
+1169 123103 00 leopards Flagler riverfront
+1170 148026 00 comfortingly stoned sisterly
+1171 123302 00 generically cranes sharpshoot
+1172 076503 00 getters masterful mittens
+1173 126304 00 sexually biracial interdependency
+1174 068306 00 spear steamships policy
+1175 143504 00 serums windmills unleashing
+1176 160201 00 Italianization exploit pretenders
+1177 148028 00 attendants riverfront overstatements
+1178 148027 00 spies sisterly birthed
+1179 143505 00 Anthony sharpshoot opportunism
+1180 108014 00 planar mittens showroom
+1181 076104 00 cupped interdependency compromisingly
+1182 078106 00 cleanser policy Medicare
+1183 126102 00 commuters unleashing corresponds
+1184 128029 00 honeysuckle pretenders hardware
+1185 128028 00 orphanage overstatements implant
+1186 018410 00 skies birthed Alicia
+1187 128110 00 crushers opportunism requesting
+1188 148506 00 Puritan showroom produced
+1189 123303 00 squeezer compromisingly criticizes
+1190 123304 00 bruises Medicare backer
+1191 068504 00 bonfire corresponds positively
+1192 068305 00 Colombo hardware colicky
+1193 000000 00 nondecreasing implant thrillingly
+1 000001 00 Omaha teethe neat
+2 011401 37 breaking dreaded Steinberg W
+3 011402 37 Romans scholastics jarring
+4 011403 37 intercepted audiology tinily
+2 011401 37 breaking dreaded Steinberg W
+3 011402 37 Romans scholastics jarring
+4 011403 37 intercepted audiology tinily
+1 000001 00 Omaha teethe neat
+2 011401 37 breaking dreaded Steinberg W
+3 011402 37 Romans scholastics jarring
+4 011403 37 intercepted audiology tinily
+2 011401 37 breaking dreaded Steinberg W
+3 011402 37 Romans scholastics jarring
+4 011403 37 intercepted audiology tinily
+4 011403 37 intercepted audiology tinily
ALTER TABLE t2 DROP COLUMN fld6;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `auto` int(11) default NULL,
- `fld1` int(6) unsigned zerofill NOT NULL default '000000',
- `companynr` tinyint(2) unsigned zerofill NOT NULL default '00',
- `fld3` char(30) NOT NULL default '',
- `fld4` char(35) NOT NULL default '',
- `fld5` char(35) NOT NULL default ''
+ `auto` int(11) DEFAULT NULL,
+ `fld1` int(6) unsigned zerofill NOT NULL DEFAULT '000000',
+ `companynr` tinyint(2) unsigned zerofill NOT NULL DEFAULT '00',
+ `fld3` char(30) NOT NULL DEFAULT '',
+ `fld4` char(35) NOT NULL DEFAULT '',
+ `fld5` char(35) NOT NULL DEFAULT ''
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
-SELECT * from t2;
+SELECT * FROM t2;
auto fld1 companynr fld3 fld4 fld5
1 000001 00 Omaha teethe neat
2 011401 37 breaking dreaded Steinberg
@@ -12348,4 +13565,259 @@ auto fld1 companynr fld3 fld4 fld5
3 011402 37 Romans scholastics jarring
4 011403 37 intercepted audiology tinily
4 011403 37 intercepted audiology tinily
-drop table t1, t2, t4;
+CREATE TABLE `t5` (
+`a` int(11) NOT NULL auto_increment,
+b char(12),
+PRIMARY KEY (`a`)
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (32, "foo");
+INSERT INTO t5 VALUES (23, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (3, "foo");
+ERROR 23000: Can't write; duplicate key in table 't5'
+INSERT INTO t5 VALUES (NULL, "foo");
+SELECT * FROM t5;
+a b
+1 foo
+2 foo
+3 foo
+4 foo
+5 foo
+32 foo
+23 foo
+33 foo
+34 foo
+35 foo
+SELECT * FROM t5 WHERE a=3;
+a b
+3 foo
+DROP TABLE t5;
+CREATE TABLE `t5` (
+`a` int(11) NOT NULL auto_increment,
+b char(12),
+KEY (`a`)
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 AUTO_INCREMENT=5;
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (32, "foo");
+INSERT INTO t5 VALUES (23, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (3, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+SELECT * FROM t5;
+a b
+5 foo
+6 foo
+7 foo
+8 foo
+9 foo
+32 foo
+23 foo
+33 foo
+34 foo
+3 foo
+35 foo
+OPTIMIZE TABLE t5;
+Table Op Msg_type Msg_text
+test.t5 optimize status OK
+SELECT * FROM t5;
+a b
+5 foo
+6 foo
+7 foo
+8 foo
+9 foo
+32 foo
+23 foo
+33 foo
+34 foo
+3 foo
+35 foo
+SELECT * FROM t5 WHERE a=32;
+a b
+32 foo
+SELECT * FROM t5 WHERE a=3;
+a b
+3 foo
+DROP TABLE t5;
+CREATE TABLE `t5` (
+`a` int(11) NOT NULL auto_increment,
+b blob(12),
+KEY (`a`)
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (NULL, "We the people");
+INSERT INTO t5 VALUES (NULL, "in order to form a more pefect union");
+INSERT INTO t5 VALUES (NULL, "establish justice");
+INSERT INTO t5 VALUES (NULL, "foo grok ");
+INSERT INTO t5 VALUES (32, "ensure domestic tranquility");
+INSERT INTO t5 VALUES (23, "provide for the common defense");
+INSERT INTO t5 VALUES (NULL, "fo fooo");
+INSERT INTO t5 VALUES (NULL, "foo just naother bit of text");
+INSERT INTO t5 VALUES (3, "foo this is mine to think about");
+INSERT INTO t5 VALUES (NULL, "promote the general welfare");
+SELECT * FROM t5;
+a b
+1 foo
+2 We the people
+3 in order to form a more pefect union
+4 establish justice
+5 foo grok
+32 ensure domestic tranquility
+23 provide for the common defense
+33 fo fooo
+34 foo just naother bit of text
+3 foo this is mine to think about
+35 promote the general welfare
+SELECT b FROM t5;
+b
+foo
+We the people
+in order to form a more pefect union
+establish justice
+foo grok
+ensure domestic tranquility
+provide for the common defense
+fo fooo
+foo just naother bit of text
+foo this is mine to think about
+promote the general welfare
+SELECT b FROM t5 WHERE a =3;
+b
+in order to form a more pefect union
+foo this is mine to think about
+SELECT b FROM t5 WHERE a IN (32, 23, 5);
+b
+foo grok
+ensure domestic tranquility
+provide for the common defense
+DROP TABLE t5;
+CREATE TABLE `t5` (
+`a` int(11) NOT NULL auto_increment,
+b blob(12),
+c blob(12),
+KEY (`a`)
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
+INSERT INTO t5 VALUES (NULL, "foo", "grok this!");
+INSERT INTO t5 VALUES (NULL, "We the people", NULL);
+INSERT INTO t5 VALUES (NULL, "in order to form a more peefect union", "secure the blessing of liberty");
+INSERT INTO t5 VALUES (NULL, "establish justice", "to ourselves and");
+INSERT INTO t5 VALUES (32, "ensure domestic tranquility", NULL);
+INSERT INTO t5 VALUES (23, "provide for the common defense", "posterity");
+INSERT INTO t5 VALUES (NULL, "promote the general welfare", "do ordain");
+SELECT * FROM t5;
+a b c
+1 foo grok this!
+2 We the people NULL
+3 in order to form a more peefect union secure the blessing of liberty
+4 establish justice to ourselves and
+32 ensure domestic tranquility NULL
+23 provide for the common defense posterity
+33 promote the general welfare do ordain
+SELECT b FROM t5;
+b
+foo
+We the people
+in order to form a more peefect union
+establish justice
+ensure domestic tranquility
+provide for the common defense
+promote the general welfare
+SELECT b FROM t5 WHERE a =3;
+b
+in order to form a more peefect union
+SELECT b FROM t5 WHERE a IN (32, 23, 5);
+b
+ensure domestic tranquility
+provide for the common defense
+SELECT c FROM t5;
+c
+grok this!
+NULL
+secure the blessing of liberty
+to ourselves and
+NULL
+posterity
+do ordain
+SELECT c FROM t5 WHERE a =3;
+c
+secure the blessing of liberty
+SELECT c FROM t5 WHERE a IN (32, 23, 5);
+c
+NULL
+posterity
+drop table t1;
+create table t1 (v varchar(32));
+insert into t1 values ('def'),('abc'),('hij'),('3r4f');
+select * from t1;
+v
+def
+abc
+hij
+3r4f
+alter table t1 change v v2 varchar(32);
+select * from t1;
+v2
+def
+abc
+hij
+3r4f
+alter table t1 change v2 v varchar(64);
+select * from t1;
+v
+def
+abc
+hij
+3r4f
+update t1 set v = 'lmn' where v = 'hij';
+select * from t1;
+v
+def
+abc
+lmn
+3r4f
+alter table t1 add i int auto_increment not null primary key first;
+select * from t1;
+i v
+1 def
+2 abc
+3 lmn
+4 3r4f
+update t1 set i=5 where i=3;
+select * from t1;
+i v
+1 def
+2 abc
+5 lmn
+4 3r4f
+alter table t1 change i i bigint;
+select * from t1;
+i v
+1 def
+2 abc
+5 lmn
+4 3r4f
+alter table t1 add unique key (i, v);
+select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn');
+i v
+4 3r4f
+alter table t1 data directory="$MYSQLTEST_VARDIR/tmp";
+Warnings:
+Warning 0 DATA DIRECTORY option ignored
+select * from t1;
+i v
+1 def
+2 abc
+4 3r4f
+5 lmn
+drop table t1, t2, t4, t5;
diff --git a/mysql-test/r/archive_bitfield.result b/mysql-test/r/archive_bitfield.result
new file mode 100644
index 00000000000..7e3b82a5caf
--- /dev/null
+++ b/mysql-test/r/archive_bitfield.result
@@ -0,0 +1,191 @@
+drop table if exists t1;
+create table t1 (
+pk1 int not null auto_increment primary key,
+b bit(64)
+) engine=archive;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `pk1` int(11) NOT NULL AUTO_INCREMENT,
+ `b` bit(64) DEFAULT NULL,
+ PRIMARY KEY (`pk1`)
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
+insert into t1 values
+(NULL,b'1111111111111111111111111111111111111111111111111111111111111111'),
+(NULL,b'1000000000000000000000000000000000000000000000000000000000000000'),
+(NULL,b'0000000000000000000000000000000000000000000000000000000000000001'),
+(NULL,b'1010101010101010101010101010101010101010101010101010101010101010'),
+(NULL,b'0101010101010101010101010101010101010101010101010101010101010101');
+select hex(b) from t1 order by pk1;
+hex(b)
+FFFFFFFFFFFFFFFF
+8000000000000000
+1
+AAAAAAAAAAAAAAAA
+5555555555555555
+drop table t1;
+create table t1 (
+pk1 int not null auto_increment primary key,
+b bit(9)
+) engine=archive;
+insert into t1 values
+(NULL,b'000000000'),
+(NULL,b'000000001'),
+(NULL,b'000000010'),
+(NULL,b'000000011'),
+(NULL,b'000000100');
+select hex(b) from t1 order by pk1;
+hex(b)
+0
+1
+2
+3
+4
+drop table t1;
+create table t1 (a bit(7), b bit(9)) engine = archive;
+insert into t1 values
+(94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),
+(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),
+(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),
+(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),
+(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),
+(44, 307), (68, 454), (57, 135);
+select a+0 from t1 order by a;
+a+0
+0
+4
+5
+9
+23
+24
+28
+29
+30
+31
+34
+44
+49
+56
+57
+59
+60
+61
+68
+68
+75
+77
+78
+79
+87
+88
+94
+94
+104
+106
+108
+111
+116
+118
+119
+122
+123
+127
+select b+0 from t1 order by b;
+b+0
+36
+42
+46
+67
+83
+118
+123
+133
+135
+152
+177
+178
+188
+202
+206
+245
+280
+307
+343
+345
+349
+351
+363
+368
+368
+379
+380
+390
+398
+399
+403
+411
+411
+438
+446
+454
+468
+499
+drop table t1;
+create table t1 (
+dummyKey INTEGER NOT NULL AUTO_INCREMENT,
+a001 TINYINT,
+a010 TINYINT,
+a012 TINYINT,
+a015 TINYINT,
+a016 TINYINT,
+a017 TINYINT,
+a019 TINYINT,
+a029 TINYINT,
+a030 TINYINT,
+a031 TINYINT,
+a032 TINYINT,
+a042 TINYINT,
+a043 TINYINT,
+a044 TINYINT,
+a3001 TINYINT,
+a3002 TINYINT,
+a3003 TINYINT,
+a3004 TINYINT,
+a3005 TINYINT,
+a3021 TINYINT,
+a3022 TINYINT,
+a BIT(6),
+b BIT(6),
+c BIT(6),
+d TINYINT,
+e TINYINT,
+f TINYINT,
+g TINYINT,
+h TINYINT,
+i TINYINT,
+j TINYINT,
+k TINYINT,
+l TINYINT,
+m TINYINT,
+n TINYINT,
+o TINYINT,
+a034 TINYINT,
+PRIMARY KEY USING HASH (dummyKey) ) engine=archive;
+INSERT INTO `t1` VALUES
+(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000001',b'111111',b'111110',4,5,5,5,5,5,5,5,5,5,3,2,1),
+(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000010',b'000000',b'111101',4,5,5,5,5,5,5,5,5,5,3,2,1),
+(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000100',b'001111',b'111011',4,5,5,5,5,5,5,5,5,5,3,2,1),
+(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'001000',b'110000',b'110111',4,5,5,5,5,5,5,5,5,5,3,2,1),
+(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'010000',b'100001',b'101111',4,5,5,5,5,5,5,5,5,5,3,2,1),
+(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'100000',b'010010',b'011111',4,5,5,5,5,5,5,5,5,5,3,2,1),
+(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'001100',b'111111',4,5,5,5,5,5,5,5,5,5,3,2,1),
+(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO `t1` VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x01,0x3F,0x3E,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO `t1` VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x02,0x00,0x3D,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO `t1` VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x04,0x0F,0x3B,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO `t1` VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x08,0x30,0x37,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO `t1` VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x10,0x21,0x2F,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO `t1` VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x20,0x12,0x1F,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO `t1` VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x00,0x0C,0x3F,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO `t1` VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x3F,0x00,0x00,4,5,5,5,5,5,5,5,5,5,3,2,1);
+drop table t1;
diff --git a/mysql-test/r/archive_gis.result b/mysql-test/r/archive_gis.result
index 25a77bc9c75..9ab8a5e758b 100644
--- a/mysql-test/r/archive_gis.result
+++ b/mysql-test/r/archive_gis.result
@@ -1,50 +1,51 @@
SET storage_engine=archive;
DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
-CREATE TABLE gis_point (fid INTEGER, g POINT);
-CREATE TABLE gis_line (fid INTEGER, g LINESTRING);
-CREATE TABLE gis_polygon (fid INTEGER, g POLYGON);
-CREATE TABLE gis_multi_point (fid INTEGER, g MULTIPOINT);
-CREATE TABLE gis_multi_line (fid INTEGER, g MULTILINESTRING);
-CREATE TABLE gis_multi_polygon (fid INTEGER, g MULTIPOLYGON);
-CREATE TABLE gis_geometrycollection (fid INTEGER, g GEOMETRYCOLLECTION);
-CREATE TABLE gis_geometry (fid INTEGER, g GEOMETRY);
+CREATE TABLE gis_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POINT);
+CREATE TABLE gis_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g LINESTRING);
+CREATE TABLE gis_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POLYGON);
+CREATE TABLE gis_multi_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOINT);
+CREATE TABLE gis_multi_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTILINESTRING);
+CREATE TABLE gis_multi_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOLYGON);
+CREATE TABLE gis_geometrycollection (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRYCOLLECTION);
+CREATE TABLE gis_geometry (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRY);
SHOW CREATE TABLE gis_point;
Table Create Table
gis_point CREATE TABLE `gis_point` (
- `fid` int(11) default NULL,
- `g` point default NULL
+ `fid` int(11) NOT NULL AUTO_INCREMENT,
+ `g` point DEFAULT NULL,
+ PRIMARY KEY (`fid`)
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
SHOW FIELDS FROM gis_point;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g point YES NULL
SHOW FIELDS FROM gis_line;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g linestring YES NULL
SHOW FIELDS FROM gis_polygon;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g polygon YES NULL
SHOW FIELDS FROM gis_multi_point;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g multipoint YES NULL
SHOW FIELDS FROM gis_multi_line;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g multilinestring YES NULL
SHOW FIELDS FROM gis_multi_polygon;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g multipolygon YES NULL
SHOW FIELDS FROM gis_geometrycollection;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g geometrycollection YES NULL
SHOW FIELDS FROM gis_geometry;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g geometry YES NULL
INSERT INTO gis_point VALUES
(101, PointFromText('POINT(10 10)')),
@@ -232,8 +233,8 @@ fid AsText(Envelope(g))
120 POLYGON((0 0,10 0,10 10,0 10,0 0))
121 POLYGON((3 6,44 6,44 9,3 9,3 6))
explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21 100.00
Warnings:
Note 1003 select dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,astext(envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry`
SELECT fid, X(g) FROM gis_point ORDER by fid;
@@ -249,8 +250,8 @@ fid Y(g)
103 20
104 20
explain extended select X(g),Y(g) FROM gis_point;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_point ALL NULL NULL NULL NULL 4
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 100.00
Warnings:
Note 1003 select x(`test`.`gis_point`.`g`) AS `X(g)`,y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point`
SELECT fid, AsText(StartPoint(g)) FROM gis_line ORDER by fid;
@@ -284,8 +285,8 @@ fid IsClosed(g)
106 1
107 0
explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_line ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,astext(endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,glength(`test`.`gis_line`.`g`) AS `GLength(g)`,numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,astext(pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line`
SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid;
@@ -314,8 +315,8 @@ fid AsText(InteriorRingN(g, 1))
109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
110 NULL
explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM gis_polygon;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select astext(centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,area(`test`.`gis_polygon`.`g`) AS `Area(g)`,astext(exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,astext(interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon`
SELECT fid, IsClosed(g) FROM gis_multi_line ORDER by fid;
@@ -353,8 +354,8 @@ fid NumGeometries(g)
120 2
121 2
explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point`
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point ORDER by fid;
@@ -381,8 +382,8 @@ fid AsText(GeometryN(g, 1))
120 POINT(0 0)
121 POINT(44 6)
explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,astext(geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point`
SELECT g1.fid as first, g2.fid as second,
@@ -400,13 +401,14 @@ Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE g1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
-1 SIMPLE g2 ALL NULL NULL NULL NULL 2
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE g1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
+1 SIMPLE g2 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,overlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,disjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,intersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
CREATE TABLE t1 (
+a INTEGER PRIMARY KEY AUTO_INCREMENT,
gp point,
ln linestring,
pg polygon,
@@ -418,6 +420,7 @@ gm geometry
);
SHOW FIELDS FROM t1;
Field Type Null Key Default Extra
+a int(11) NO PRI NULL auto_increment
gp point YES NULL
ln linestring YES NULL
pg polygon YES NULL
@@ -429,6 +432,7 @@ gm geometry YES NULL
ALTER TABLE t1 ADD fid INT;
SHOW FIELDS FROM t1;
Field Type Null Key Default Extra
+a int(11) NO PRI NULL auto_increment
gp point YES NULL
ln linestring YES NULL
pg polygon YES NULL
@@ -439,20 +443,20 @@ gc geometrycollection YES NULL
gm geometry YES NULL
fid int(11) YES NULL
DROP TABLE t1;
-create table t1 (a geometry not null);
-insert into t1 values (GeomFromText('Point(1 2)'));
-insert into t1 values ('Garbage');
+create table t1 (pk integer primary key auto_increment, a geometry not null);
+insert into t1 (a) values (GeomFromText('Point(1 2)'));
+insert into t1 (a) values ('Garbage');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-insert IGNORE into t1 values ('Garbage');
+insert IGNORE into t1 (a) values ('Garbage');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
-create table t1 (fl geometry);
-insert into t1 values (1);
+create table t1 (pk integer primary key auto_increment, fl geometry);
+insert into t1 (fl) values (1);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-insert into t1 values (1.11);
+insert into t1 (fl) values (1.11);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-insert into t1 values ("qwerty");
+insert into t1 (fl) values ("qwerty");
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-insert into t1 values (pointfromtext('point(1,1)'));
+insert into t1 (fl) values (pointfromtext('point(1,1)'));
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result
index d0058118e4c..54c2df34a7f 100644
--- a/mysql-test/r/auto_increment.result
+++ b/mysql-test/r/auto_increment.result
@@ -140,20 +140,20 @@ select last_insert_id();
last_insert_id()
255
explain extended select last_insert_id();
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select last_insert_id() AS `last_insert_id()`
insert into t1 set i = 254;
-ERROR 23000: Duplicate entry '254' for key 1
+ERROR 23000: Duplicate entry '254' for key 'PRIMARY'
select last_insert_id();
last_insert_id()
255
insert into t1 set i = null;
-ERROR 23000: Duplicate entry '255' for key 1
+ERROR 23000: Duplicate entry '255' for key 'PRIMARY'
select last_insert_id();
last_insert_id()
-0
+255
drop table t1;
create table t1 (i tinyint unsigned not null auto_increment, key (i));
insert into t1 set i = 254;
@@ -163,7 +163,7 @@ last_insert_id()
255
insert into t1 set i = null;
Warnings:
-Warning 1264 Out of range value adjusted for column 'i' at row 1
+Warning 1264 Out of range value for column 'i' at row 1
select last_insert_id();
last_insert_id()
255
@@ -178,10 +178,10 @@ select last_insert_id();
last_insert_id()
2
insert into t1 values (NULL, 10);
-ERROR 23000: Duplicate entry '10' for key 2
+ERROR 23000: Duplicate entry '10' for key 'b'
select last_insert_id();
last_insert_id()
-0
+2
drop table t1;
create table t1(a int auto_increment,b int null,primary key(a));
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
@@ -232,7 +232,7 @@ a b
delete from t1 where a=0;
update t1 set a=NULL where b=6;
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 4
+Warning 1048 Column 'a' cannot be null
update t1 set a=300 where b=7;
SET SQL_MODE='';
insert into t1(a,b)values(NULL,8);
@@ -274,7 +274,7 @@ a b
delete from t1 where a=0;
update t1 set a=NULL where b=13;
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 9
+Warning 1048 Column 'a' cannot be null
update t1 set a=500 where b=14;
select * from t1 order by b;
a b
@@ -372,9 +372,9 @@ MySQL 1002
SHOW CREATE TABLE `t1`;
Table Create Table
t1 CREATE TABLE `t1` (
- `t1_name` varchar(255) default NULL,
- `t1_id` int(10) unsigned NOT NULL auto_increment,
- PRIMARY KEY (`t1_id`),
+ `t1_name` varchar(255) DEFAULT NULL,
+ `t1_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`t1_id`),
KEY `t1_name` (`t1_name`)
) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1
DROP TABLE `t1`;
@@ -425,7 +425,7 @@ key (rowid), unique(val));
replace into t1 (val) values ('1'),('2');
replace into t1 (val) values ('1'),('2');
insert into t1 (val) values ('1'),('2');
-ERROR 23000: Duplicate entry '1' for key 2
+ERROR 23000: Duplicate entry '1' for key 'val'
select * from t1;
rowid val
3 1
@@ -440,3 +440,17 @@ a val
2 1
3 1
drop table t1;
+CREATE TABLE t1 (t1 INT(10) PRIMARY KEY, t2 INT(10));
+INSERT INTO t1 VALUES(0, 0);
+INSERT INTO t1 VALUES(1, 1);
+ALTER TABLE t1 CHANGE t1 t1 INT(10) auto_increment;
+ERROR 23000: ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '1' for key 'PRIMARY'
+DROP TABLE t1;
+create table t1 (a int primary key auto_increment, b int, c int, d timestamp default current_timestamp, unique(b),unique(c));
+insert into t1 values(null,1,1,now());
+insert into t1 values(null,0,0,null);
+replace into t1 values(null,1,0,null);
+select last_insert_id();
+last_insert_id()
+3
+drop table t1;
diff --git a/mysql-test/r/backup.result b/mysql-test/r/backup.result
index 29702e583cc..b299940e332 100644
--- a/mysql-test/r/backup.result
+++ b/mysql-test/r/backup.result
@@ -1,25 +1,31 @@
set SQL_LOG_BIN=0;
-drop table if exists t1, t2, t3;
+drop table if exists t1, t2, t3, t4;
create table t4(n int);
backup table t4 to '../bogus';
Table Op Msg_type Msg_text
test.t4 backup error Failed copying .frm file (errno: X)
test.t4 backup status Operation failed
Warnings:
+Warning 1541 The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
Error 1 Can't create/write to file 'MYSQLTEST_VARDIR/bogus/t4.frm' (Errcode: X)
backup table t4 to '../tmp';
Table Op Msg_type Msg_text
test.t4 backup status OK
+Warnings:
+Warning 1541 The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
backup table t4 to '../tmp';
Table Op Msg_type Msg_text
test.t4 backup error Failed copying .frm file (errno: X)
test.t4 backup status Operation failed
Warnings:
+Warning 1541 The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
Error 1 Can't create/write to file 'MYSQLTEST_VARDIR/tmp/t4.frm' (Errcode: X)
drop table t4;
restore table t4 from '../tmp';
Table Op Msg_type Msg_text
test.t4 restore status OK
+Warnings:
+Warning 1541 The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
select count(*) from t4;
count(*)
0
@@ -28,15 +34,20 @@ insert into t1 values (23),(45),(67);
backup table t1 to '../tmp';
Table Op Msg_type Msg_text
test.t1 backup status OK
+Warnings:
+Warning 1541 The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
drop table t1;
restore table t1 from '../bogus';
Table Op Msg_type Msg_text
t1 restore error Failed copying .frm file
Warnings:
+Warning 1541 The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
Error 29 File 'MYSQLTEST_VARDIR/bogus/t1.frm' not found (Errcode: X)
restore table t1 from '../tmp';
Table Op Msg_type Msg_text
test.t1 restore status OK
+Warnings:
+Warning 1541 The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
select n from t1;
n
23
@@ -50,12 +61,16 @@ backup table t2,t3 to '../tmp';
Table Op Msg_type Msg_text
test.t2 backup status OK
test.t3 backup status OK
+Warnings:
+Warning 1541 The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
drop table t1,t2,t3;
restore table t1,t2,t3 from '../tmp';
Table Op Msg_type Msg_text
test.t1 restore status OK
test.t2 restore status OK
test.t3 restore status OK
+Warnings:
+Warning 1541 The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
select n from t1;
n
23
@@ -75,10 +90,34 @@ drop table t1,t2,t3,t4;
restore table t1 from '../tmp';
Table Op Msg_type Msg_text
test.t1 restore status OK
+Warnings:
+Warning 1541 The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
rename table t1 to t5;
lock tables t5 write;
backup table t5 to '../tmp';
unlock tables;
Table Op Msg_type Msg_text
test.t5 backup status OK
+Warnings:
+Warning 1541 The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
drop table t5;
+DROP TABLE IF EXISTS `t+1`;
+CREATE TABLE `t+1` (c1 INT);
+INSERT INTO `t+1` VALUES (1), (2), (3);
+BACKUP TABLE `t+1` TO '../tmp';
+Table Op Msg_type Msg_text
+test.t+1 backup status OK
+Warnings:
+Warning 1541 The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
+DROP TABLE `t+1`;
+RESTORE TABLE `t+1` FROM '../tmp';
+Table Op Msg_type Msg_text
+test.t+1 restore status OK
+Warnings:
+Warning 1541 The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
+SELECT * FROM `t+1`;
+c1
+1
+2
+3
+DROP TABLE `t+1`;
diff --git a/mysql-test/r/bdb-alter-table-1.result b/mysql-test/r/bdb-alter-table-1.result
deleted file mode 100644
index 0401002f1f3..00000000000
--- a/mysql-test/r/bdb-alter-table-1.result
+++ /dev/null
@@ -1,11 +0,0 @@
-drop table if exists t1;
-create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) engine=BDB;
-insert into t1 values(1, 't1',4,9);
-insert into t1 values(2, 'metatable',1,9);
-insert into t1 values(3, 'metaindex',1,9 );
-select * from t1;
-objid tablename oid test
-1 t1 4 9
-2 metatable 1 9
-3 metaindex 1 9
-alter table t1 drop column test;
diff --git a/mysql-test/r/bdb-alter-table-2.result b/mysql-test/r/bdb-alter-table-2.result
deleted file mode 100644
index c23b5ba0031..00000000000
--- a/mysql-test/r/bdb-alter-table-2.result
+++ /dev/null
@@ -1,6 +0,0 @@
-select * from t1;
-objid tablename oid
-1 t1 4
-2 metatable 1
-3 metaindex 1
-drop table t1;
diff --git a/mysql-test/r/bdb-crash.result b/mysql-test/r/bdb-crash.result
deleted file mode 100644
index 778890e85e3..00000000000
--- a/mysql-test/r/bdb-crash.result
+++ /dev/null
@@ -1,39 +0,0 @@
-drop table if exists t1;
-CREATE TABLE t1 (
-ChargeID int(10) unsigned NOT NULL auto_increment,
-ServiceID int(10) unsigned DEFAULT '0' NOT NULL,
-ChargeDate date DEFAULT '0000-00-00' NOT NULL,
-ChargeAmount decimal(20,2) DEFAULT '0.00' NOT NULL,
-FedTaxes decimal(20,2) DEFAULT '0.00' NOT NULL,
-ProvTaxes decimal(20,2) DEFAULT '0.00' NOT NULL,
-ChargeStatus enum('New','Auth','Unauth','Sale','Denied','Refund')
-DEFAULT 'New' NOT NULL,
-ChargeAuthorizationMessage text,
-ChargeComment text,
-ChargeTimeStamp varchar(20),
-PRIMARY KEY (ChargeID),
-KEY ServiceID (ServiceID),
-KEY ChargeDate (ChargeDate)
-) engine=BDB;
-BEGIN;
-INSERT INTO t1
-VALUES(NULL,1,'2001-03-01',1,1,1,'New',NULL,NULL,'now');
-COMMIT;
-BEGIN;
-UPDATE t1 SET ChargeAuthorizationMessage = 'blablabla' WHERE
-ChargeID = 1;
-COMMIT;
-INSERT INTO t1
-VALUES(NULL,1,'2001-03-01',1,1,1,'New',NULL,NULL,'now');
-select * from t1;
-ChargeID ServiceID ChargeDate ChargeAmount FedTaxes ProvTaxes ChargeStatus ChargeAuthorizationMessage ChargeComment ChargeTimeStamp
-1 1 2001-03-01 1.00 1.00 1.00 New blablabla NULL now
-2 1 2001-03-01 1.00 1.00 1.00 New NULL NULL now
-drop table t1;
-create table t1 (a int) engine=bdb;
-set autocommit=0;
-insert into t1 values(1);
-analyze table t1;
-Table Op Msg_type Msg_text
-test.t1 analyze status Operation need committed state
-drop table t1;
diff --git a/mysql-test/r/bdb-deadlock.result b/mysql-test/r/bdb-deadlock.result
deleted file mode 100644
index 9394c90ff00..00000000000
--- a/mysql-test/r/bdb-deadlock.result
+++ /dev/null
@@ -1,31 +0,0 @@
-drop table if exists t1,t2;
-create table t1 (id integer, x integer) engine=BDB;
-create table t2 (id integer, x integer) engine=BDB;
-insert into t1 values(0, 0);
-insert into t2 values(0, 0);
-set autocommit=0;
-update t1 set x = 1 where id = 0;
-set autocommit=0;
-update t2 set x = 1 where id = 0;
-select x from t1 where id = 0;
-select x from t2 where id = 0;
-ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
-commit;
-x
-1
-commit;
-select * from t1;
-id x
-0 1
-select * from t2;
-id x
-0 1
-commit;
-select * from t1;
-id x
-0 1
-select * from t2;
-id x
-0 1
-commit;
-drop table t1,t2;
diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result
deleted file mode 100644
index c5b3b1f86e7..00000000000
--- a/mysql-test/r/bdb.result
+++ /dev/null
@@ -1,1965 +0,0 @@
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8;
-create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=bdb;
-insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
-select id, code, name from t1 order by id;
-id code name
-1 1 Tim
-2 1 Monty
-3 2 David
-4 2 Erik
-5 3 Sasha
-6 3 Jeremy
-7 4 Matt
-update ignore t1 set id = 8, name = 'Sinisa' where id < 3;
-select id, code, name from t1 order by id;
-id code name
-2 1 Monty
-3 2 David
-4 2 Erik
-5 3 Sasha
-6 3 Jeremy
-7 4 Matt
-8 1 Sinisa
-update ignore t1 set id = id + 10, name = 'Ralph' where id < 4;
-select id, code, name from t1 order by id;
-id code name
-3 2 David
-4 2 Erik
-5 3 Sasha
-6 3 Jeremy
-7 4 Matt
-8 1 Sinisa
-12 1 Ralph
-drop table t1;
-CREATE TABLE t1 (
-id int(11) NOT NULL auto_increment,
-parent_id int(11) DEFAULT '0' NOT NULL,
-level tinyint(4) DEFAULT '0' NOT NULL,
-PRIMARY KEY (id),
-KEY parent_id (parent_id),
-KEY level (level)
-) engine=bdb;
-INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
-update t1 set parent_id=parent_id+100;
-select * from t1 where parent_id=102;
-id parent_id level
-8 102 2
-9 102 2
-15 102 2
-update t1 set id=id+1000;
-update t1 set id=1024 where id=1009;
-ERROR 23000: Duplicate entry '1024' for key 1
-select * from t1;
-id parent_id level
-1001 100 0
-1002 101 1
-1003 101 1
-1004 101 1
-1005 101 1
-1006 101 1
-1007 101 1
-1008 102 2
-1009 102 2
-1015 102 2
-1016 103 2
-1017 103 2
-1018 103 2
-1019 103 2
-1020 103 2
-1021 104 2
-1022 104 2
-1024 104 2
-1025 105 2
-1026 105 2
-1027 105 2
-1028 105 2
-1029 105 2
-1030 105 2
-1031 106 2
-1032 106 2
-1033 106 2
-1034 106 2
-1035 106 2
-1036 107 2
-1037 107 2
-1038 107 2
-1040 107 2
-1157 100 0
-1179 105 2
-1183 104 2
-1193 105 2
-1202 107 2
-1203 107 2
-update ignore t1 set id=id+1;
-select * from t1;
-id parent_id level
-1001 100 0
-1002 101 1
-1003 101 1
-1004 101 1
-1005 101 1
-1006 101 1
-1007 101 1
-1008 102 2
-1010 102 2
-1015 102 2
-1016 103 2
-1017 103 2
-1018 103 2
-1019 103 2
-1020 103 2
-1021 104 2
-1023 104 2
-1024 104 2
-1025 105 2
-1026 105 2
-1027 105 2
-1028 105 2
-1029 105 2
-1030 105 2
-1031 106 2
-1032 106 2
-1033 106 2
-1034 106 2
-1035 106 2
-1036 107 2
-1037 107 2
-1039 107 2
-1041 107 2
-1158 100 0
-1180 105 2
-1184 104 2
-1194 105 2
-1202 107 2
-1204 107 2
-update ignore t1 set id=1023 where id=1010;
-select * from t1 where parent_id=102 order by parent_id,id;
-id parent_id level
-1008 102 2
-1010 102 2
-1015 102 2
-explain select level from t1 where level=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref level level 1 const X Using index
-explain select level,id from t1 where level=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref level level 1 const X Using index
-explain select level,id,parent_id from t1 where level=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref level level 1 const X
-select level,id from t1 where level=1;
-level id
-1 1002
-1 1003
-1 1004
-1 1005
-1 1006
-1 1007
-select level,id,parent_id from t1 where level=1;
-level id parent_id
-1 1002 101
-1 1003 101
-1 1004 101
-1 1005 101
-1 1006 101
-1 1007 101
-optimize table t1;
-Table Op Msg_type Msg_text
-test.t1 optimize status OK
-show keys from t1;
-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
-t1 0 PRIMARY 1 id A 39 NULL NULL BTREE
-t1 1 parent_id 1 parent_id A 9 NULL NULL BTREE
-t1 1 level 1 level A 3 NULL NULL BTREE
-drop table t1;
-CREATE TABLE t1 (
-gesuchnr int(11) DEFAULT '0' NOT NULL,
-benutzer_id int(11) DEFAULT '0' NOT NULL,
-PRIMARY KEY (gesuchnr,benutzer_id)
-) engine=BDB;
-replace into t1 (gesuchnr,benutzer_id) values (2,1);
-replace into t1 (gesuchnr,benutzer_id) values (1,1);
-replace into t1 (gesuchnr,benutzer_id) values (1,1);
-select * from t1;
-gesuchnr benutzer_id
-1 1
-2 1
-drop table t1;
-create table t1 (id int not null primary key, x int not null, key (x)) engine=bdb;
-insert into t1 (id, x) values (1, 1);
-replace into t1 (id, x) values (1, 2);
-select * from t1;
-id x
-1 2
-drop table t1;
-create table t1 (a int) engine=bdb;
-insert into t1 values (1), (2);
-optimize table t1;
-Table Op Msg_type Msg_text
-test.t1 optimize status OK
-delete from t1 where a = 1;
-select * from t1;
-a
-2
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check note The storage engine for the table doesn't support check
-drop table t1;
-create table t1 (a int,b varchar(20)) engine=bdb;
-insert into t1 values (1,""), (2,"testing");
-delete from t1 where a = 1;
-select * from t1;
-a b
-2 testing
-create index skr on t1 (a);
-insert into t1 values (3,""), (4,"testing");
-analyze table t1;
-Table Op Msg_type Msg_text
-test.t1 analyze status OK
-show keys from t1;
-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
-t1 1 skr 1 a A 3 NULL NULL YES BTREE
-drop table t1;
-create table t1 (a int,b varchar(20),key(a)) engine=bdb;
-insert into t1 values (1,""), (2,"testing");
-select * from t1 where a = 1;
-a b
-1
-drop table t1;
-create table t1 (a char(10) not null, b int not null auto_increment, primary key(a,b)) engine=BDB;
-insert into t1 values ("a",1),("b",2),("a",2),("c",1);
-insert into t1 values ("a",NULL),("b",NULL),("c",NULL),("e",NULL);
-insert into t1 (a) values ("a"),("b"),("c"),("d");
-insert into t1 (a) values ('k'),('d');
-insert into t1 (a) values ("a");
-insert into t1 values ("d",last_insert_id());
-select * from t1;
-a b
-a 1
-a 2
-a 3
-a 4
-a 5
-b 2
-b 3
-b 4
-c 1
-c 2
-c 3
-d 1
-d 2
-d 5
-e 1
-k 1
-flush tables;
-select count(*) from t1;
-count(*)
-16
-drop table t1;
-create table t1 (n int not null primary key) engine=bdb;
-set autocommit=0;
-insert into t1 values (4);
-rollback;
-select n, "after rollback" from t1;
-n after rollback
-insert into t1 values (4);
-commit;
-select n, "after commit" from t1;
-n after commit
-4 after commit
-commit;
-insert into t1 values (5);
-insert into t1 values (4);
-ERROR 23000: Duplicate entry '4' for key 1
-commit;
-select n, "after commit" from t1;
-n after commit
-4 after commit
-5 after commit
-set autocommit=1;
-insert into t1 values (6);
-insert into t1 values (4);
-ERROR 23000: Duplicate entry '4' for key 1
-select n from t1;
-n
-4
-5
-6
-rollback;
-drop table t1;
-create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=BDB;
-begin;
-insert into t1 values(1,'hamdouni');
-select id as afterbegin_id,nom as afterbegin_nom from t1;
-afterbegin_id afterbegin_nom
-1 hamdouni
-rollback;
-select id as afterrollback_id,nom as afterrollback_nom from t1;
-afterrollback_id afterrollback_nom
-set autocommit=0;
-insert into t1 values(2,'mysql');
-select id as afterautocommit0_id,nom as afterautocommit0_nom from t1;
-afterautocommit0_id afterautocommit0_nom
-2 mysql
-rollback;
-select id as afterrollback_id,nom as afterrollback_nom from t1;
-afterrollback_id afterrollback_nom
-set autocommit=1;
-drop table t1;
-CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=bdb;
-insert into t1 values ('pippo', 12);
-insert into t1 values ('pippo', 12);
-ERROR 23000: Duplicate entry 'pippo' for key 1
-delete from t1;
-delete from t1 where id = 'pippo';
-select * from t1;
-id val
-insert into t1 values ('pippo', 12);
-set autocommit=0;
-delete from t1;
-rollback;
-select * from t1;
-id val
-pippo 12
-delete from t1;
-commit;
-select * from t1;
-id val
-drop table t1;
-set autocommit=1;
-CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=BDB;
-INSERT INTO t1 VALUES (1, 'Jochen');
-select * from t1;
-ID NAME
-1 Jochen
-drop table t1;
-CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=BDB;
-set autocommit=0;
-INSERT INTO t1 SET _userid='marc@anyware.co.uk';
-COMMIT;
-SELECT * FROM t1;
-_userid
-marc@anyware.co.uk
-SELECT _userid FROM t1 WHERE _userid='marc@anyware.co.uk';
-_userid
-marc@anyware.co.uk
-drop table t1;
-set autocommit=1;
-CREATE TABLE t1 (
-user_id int(10) DEFAULT '0' NOT NULL,
-name varchar(100),
-phone varchar(100),
-ref_email varchar(100) DEFAULT '' NOT NULL,
-detail varchar(200),
-PRIMARY KEY (user_id,ref_email)
-)engine=bdb;
-INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar');
-select * from t1 where user_id=10292;
-user_id name phone ref_email detail
-10292 sanjeev 29153373 sansh777@hotmail.com xxx
-10292 shirish 2333604 shirish@yahoo.com ddsds
-10292 sonali 323232 sonali@bolly.com filmstar
-INSERT INTO t1 VALUES (10291,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10293,'shirish','2333604','shirish@yahoo.com','ddsds');
-select * from t1 where user_id=10292;
-user_id name phone ref_email detail
-10292 sanjeev 29153373 sansh777@hotmail.com xxx
-10292 shirish 2333604 shirish@yahoo.com ddsds
-10292 sonali 323232 sonali@bolly.com filmstar
-select * from t1 where user_id>=10292;
-user_id name phone ref_email detail
-10292 sanjeev 29153373 sansh777@hotmail.com xxx
-10292 shirish 2333604 shirish@yahoo.com ddsds
-10292 sonali 323232 sonali@bolly.com filmstar
-10293 shirish 2333604 shirish@yahoo.com ddsds
-select * from t1 where user_id>10292;
-user_id name phone ref_email detail
-10293 shirish 2333604 shirish@yahoo.com ddsds
-select * from t1 where user_id<10292;
-user_id name phone ref_email detail
-10291 sanjeev 29153373 sansh777@hotmail.com xxx
-drop table t1;
-CREATE TABLE t1 (a int not null, b int not null,c int not null,
-key(a),primary key(a,b), unique(c),key(a),unique(b));
-show index from t1;
-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
-t1 0 PRIMARY 1 a A NULL NULL NULL BTREE
-t1 0 PRIMARY 2 b A 0 NULL NULL BTREE
-t1 0 c 1 c A 0 NULL NULL BTREE
-t1 0 b 1 b A 0 NULL NULL BTREE
-t1 1 a 1 a A NULL NULL NULL BTREE
-t1 1 a_2 1 a A NULL NULL NULL BTREE
-drop table t1;
-create table t1 (col1 int not null, col2 char(4) not null, primary key(col1));
-alter table t1 engine=BDB;
-insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4');
-select * from t1;
-col1 col2
-1 1
-2 3
-3 4
-4 4
-5 2
-update t1 set col2='7' where col1='4';
-select * from t1;
-col1 col2
-1 1
-2 3
-3 4
-4 7
-5 2
-alter table t1 add co3 int not null;
-select * from t1;
-col1 col2 co3
-1 1 0
-2 3 0
-3 4 0
-4 7 0
-5 2 0
-update t1 set col2='9' where col1='2';
-select * from t1;
-col1 col2 co3
-1 1 0
-2 9 0
-3 4 0
-4 7 0
-5 2 0
-drop table t1;
-create table t1 (a int not null , b int, primary key (a)) engine = BDB;
-create table t2 (a int not null , b int, primary key (a)) engine = myisam;
-insert into t1 VALUES (1,3) , (2,3), (3,3);
-select * from t1;
-a b
-1 3
-2 3
-3 3
-insert into t2 select * from t1;
-select * from t2;
-a b
-1 3
-2 3
-3 3
-delete from t1 where b = 3;
-select * from t1;
-a b
-insert into t1 select * from t2;
-select * from t1;
-a b
-1 3
-2 3
-3 3
-select * from t2;
-a b
-1 3
-2 3
-3 3
-drop table t1,t2;
-CREATE TABLE t1 (
-id int(11) NOT NULL auto_increment,
-ggid varchar(32) binary DEFAULT '' NOT NULL,
-email varchar(64) DEFAULT '' NOT NULL,
-passwd varchar(32) binary DEFAULT '' NOT NULL,
-PRIMARY KEY (id),
-UNIQUE ggid (ggid)
-) ENGINE=BDB;
-insert into t1 (ggid,passwd) values ('test1','xxx');
-insert into t1 (ggid,passwd) values ('test2','yyy');
-insert into t1 (ggid,passwd) values ('test2','this will fail');
-ERROR 23000: Duplicate entry 'test2' for key 2
-insert into t1 (ggid,id) values ('this will fail',1);
-ERROR 23000: Duplicate entry '1' for key 1
-select * from t1 where ggid='test1';
-id ggid email passwd
-1 test1 xxx
-select * from t1 where passwd='xxx';
-id ggid email passwd
-1 test1 xxx
-select * from t1 where id=2;
-id ggid email passwd
-2 test2 yyy
-replace into t1 (ggid,id) values ('this will work',1);
-replace into t1 (ggid,passwd) values ('test2','this will work');
-update t1 set id=100,ggid='test2' where id=1;
-ERROR 23000: Duplicate entry 'test2' for key 2
-select * from t1;
-id ggid email passwd
-1 this will work
-3 test2 this will work
-select * from t1 where id=1;
-id ggid email passwd
-1 this will work
-select * from t1 where id=999;
-id ggid email passwd
-drop table t1;
-CREATE TABLE t1 (
-user_name varchar(12),
-password text,
-subscribed char(1),
-user_id int(11) DEFAULT '0' NOT NULL,
-quota bigint(20),
-weight double,
-access_date date,
-access_time time,
-approved datetime,
-dummy_primary_key int(11) NOT NULL auto_increment,
-PRIMARY KEY (dummy_primary_key)
-) ENGINE=BDB;
-INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1);
-INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2);
-INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3);
-INSERT INTO t1 VALUES ('user_3','somepassword','Y',3,3,1.7320508075689,'2000-09-07','23:06:59','2000-09-07 23:06:59',4);
-INSERT INTO t1 VALUES ('user_4','somepassword','N',4,4,2,'2000-09-07','23:06:59','2000-09-07 23:06:59',5);
-select user_name, password , subscribed, user_id, quota, weight, access_date, access_time, approved, dummy_primary_key from t1 order by user_name;
-user_name password subscribed user_id quota weight access_date access_time approved dummy_primary_key
-user_0 somepassword N 0 0 0 2000-09-07 23:06:59 2000-09-07 23:06:59 1
-user_1 somepassword Y 1 1 1 2000-09-07 23:06:59 2000-09-07 23:06:59 2
-user_2 somepassword N 2 2 1.4142135623731 2000-09-07 23:06:59 2000-09-07 23:06:59 3
-user_3 somepassword Y 3 3 1.7320508075689 2000-09-07 23:06:59 2000-09-07 23:06:59 4
-user_4 somepassword N 4 4 2 2000-09-07 23:06:59 2000-09-07 23:06:59 5
-drop table t1;
-CREATE TABLE t1 (
-id int(11) NOT NULL auto_increment,
-parent_id int(11) DEFAULT '0' NOT NULL,
-level tinyint(4) DEFAULT '0' NOT NULL,
-KEY (id),
-KEY parent_id (parent_id),
-KEY level (level)
-) engine=bdb;
-INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1);
-INSERT INTO t1 values (179,5,2);
-update t1 set parent_id=parent_id+100;
-select * from t1 where parent_id=102;
-id parent_id level
-8 102 2
-9 102 2
-15 102 2
-update t1 set id=id+1000;
-update t1 set id=1024 where id=1009;
-select * from t1;
-id parent_id level
-1001 100 0
-1003 101 1
-1004 101 1
-1008 102 2
-1024 102 2
-1017 103 2
-1022 104 2
-1024 104 2
-1028 105 2
-1029 105 2
-1030 105 2
-1031 106 2
-1032 106 2
-1033 106 2
-1203 107 2
-1202 107 2
-1020 103 2
-1157 100 0
-1193 105 2
-1040 107 2
-1002 101 1
-1015 102 2
-1006 101 1
-1034 106 2
-1035 106 2
-1016 103 2
-1007 101 1
-1036 107 2
-1018 103 2
-1026 105 2
-1027 105 2
-1183 104 2
-1038 107 2
-1025 105 2
-1037 107 2
-1021 104 2
-1019 103 2
-1005 101 1
-1179 105 2
-update ignore t1 set id=id+1;
-select * from t1;
-id parent_id level
-1002 100 0
-1004 101 1
-1005 101 1
-1009 102 2
-1025 102 2
-1018 103 2
-1023 104 2
-1025 104 2
-1029 105 2
-1030 105 2
-1031 105 2
-1032 106 2
-1033 106 2
-1034 106 2
-1204 107 2
-1203 107 2
-1021 103 2
-1158 100 0
-1194 105 2
-1041 107 2
-1003 101 1
-1016 102 2
-1007 101 1
-1035 106 2
-1036 106 2
-1017 103 2
-1008 101 1
-1037 107 2
-1019 103 2
-1027 105 2
-1028 105 2
-1184 104 2
-1039 107 2
-1026 105 2
-1038 107 2
-1022 104 2
-1020 103 2
-1006 101 1
-1180 105 2
-update ignore t1 set id=1023 where id=1010;
-select * from t1 where parent_id=102;
-id parent_id level
-1009 102 2
-1025 102 2
-1016 102 2
-explain select level from t1 where level=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref level level 1 const X Using index
-select level,id from t1 where level=1;
-level id
-1 1004
-1 1005
-1 1003
-1 1007
-1 1008
-1 1006
-select level,id,parent_id from t1 where level=1;
-level id parent_id
-1 1004 101
-1 1005 101
-1 1003 101
-1 1007 101
-1 1008 101
-1 1006 101
-select level,id from t1 where level=1 order by id;
-level id
-1 1003
-1 1004
-1 1005
-1 1006
-1 1007
-1 1008
-delete from t1 where level=1;
-select * from t1;
-id parent_id level
-1002 100 0
-1009 102 2
-1025 102 2
-1018 103 2
-1023 104 2
-1025 104 2
-1029 105 2
-1030 105 2
-1031 105 2
-1032 106 2
-1033 106 2
-1034 106 2
-1204 107 2
-1203 107 2
-1021 103 2
-1158 100 0
-1194 105 2
-1041 107 2
-1016 102 2
-1035 106 2
-1036 106 2
-1017 103 2
-1037 107 2
-1019 103 2
-1027 105 2
-1028 105 2
-1184 104 2
-1039 107 2
-1026 105 2
-1038 107 2
-1022 104 2
-1020 103 2
-1180 105 2
-drop table t1;
-CREATE TABLE t1 (
-sca_code char(6) NOT NULL,
-cat_code char(6) NOT NULL,
-sca_desc varchar(50),
-lan_code char(2) NOT NULL,
-sca_pic varchar(100),
-sca_sdesc varchar(50),
-sca_sch_desc varchar(16),
-PRIMARY KEY (sca_code, cat_code, lan_code),
-INDEX sca_pic (sca_pic)
-) engine = bdb ;
-INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
-select count(*) from t1 where sca_code = 'PD';
-count(*)
-1
-select count(*) from t1 where sca_code <= 'PD';
-count(*)
-1
-select count(*) from t1 where sca_pic is null;
-count(*)
-2
-alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
-select count(*) from t1 where sca_code='PD' and sca_pic is null;
-count(*)
-1
-select count(*) from t1 where cat_code='E';
-count(*)
-0
-alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
-select count(*) from t1 where sca_code='PD' and sca_pic is null;
-count(*)
-1
-select count(*) from t1 where sca_pic >= 'n';
-count(*)
-1
-select sca_pic from t1 where sca_pic is null;
-sca_pic
-NULL
-NULL
-update t1 set sca_pic="test" where sca_pic is null;
-delete from t1 where sca_code='pd';
-drop table t1;
-set @a:=now();
-CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=bdb;
-insert into t1 (a) values(1),(2),(3);
-select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
-a
-1
-2
-3
-select a from t1 natural join t1 as t2 where b >= @a order by a;
-a
-1
-2
-3
-update t1 set a=5 where a=1;
-select a from t1;
-a
-2
-3
-5
-drop table t1;
-flush logs;
-create table t1 (b blob, i int, key (b(100)), key (i), key (i, b(20))) engine=bdb;
-insert into t1 values ('this is a blob', 1), (null, -1), (null, null),("",1),("",2),("",3);
-select b from t1 where b = 'this is a blob';
-b
-this is a blob
-select * from t1 where b like 't%';
-b i
-this is a blob 1
-select b, i from t1 where b is not null;
-b i
-this is a blob 1
- 1
- 2
- 3
-select * from t1 where b is null and i > 0;
-b i
-select * from t1 where i is NULL;
-b i
-NULL NULL
-update t1 set b='updated' where i=1;
-select * from t1;
-b i
-updated 1
-NULL -1
-NULL NULL
-updated 1
- 2
- 3
-drop table t1;
-create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=bdb;
-insert into t1 values("hello",1),("world",2);
-select * from t1 order by b desc;
-a b
-world 2
-hello 1
-optimize table t1;
-Table Op Msg_type Msg_text
-test.t1 optimize status OK
-show keys from t1;
-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
-t1 0 PRIMARY 1 a A 2 NULL NULL BTREE
-drop table t1;
-create table t1 (i int, j int )ENGINE=BDB;
-insert into t1 values (1,2);
-select * from t1 where i=1 and j=2;
-i j
-1 2
-create index ax1 on t1 (i,j);
-select * from t1 where i=1 and j=2;
-i j
-1 2
-drop table t1;
-create table t1
-(
-branch_id int auto_increment primary key,
-branch_name varchar(255) not null,
-branch_active int not null default 1,
-unique branch_name(branch_name),
-index branch_active(branch_active)
-) engine=bdb;
-create table t2
-(
-target_id int auto_increment primary key,
-target_name varchar(255) not null,
-target_active int not null default 1,
-unique target_name(target_name),
-index target_active(target_active)
-) engine=bdb;
-create table t3
-(
-platform_id int auto_increment primary key,
-platform_name varchar(255) not null,
-platform_active int not null default 1,
-unique platform_name(platform_name),
-index platform_active(platform_active)
-) engine=bdb;
-create table t4
-(
-product_id int auto_increment primary key,
-product_name varchar(255) not null,
-version_file varchar(255) not null,
-product_active int not null default 1,
-unique product_name(product_name),
-index product_active(product_active)
-) engine=bdb;
-create table t5
-(
-product_file_id int auto_increment primary key,
-product_id int not null,
-file_name varchar(255) not null,
-/* cvs module used to find the file version */
-module_name varchar(255) not null,
-/* flag whether the file is still included in the product */
-file_included int not null default 1,
-unique product_file(product_id,file_name),
-index file_included(file_included)
-) engine=bdb;
-create table t6
-(
-file_platform_id int auto_increment primary key,
-product_file_id int not null,
-platform_id int not null,
-branch_id int not null,
-/* filename in the build system */
-build_filename varchar(255) not null,
-/* default filename in the build archive */
-archive_filename varchar(255) not null,
-unique file_platform(product_file_id,platform_id,branch_id)
-) engine=bdb;
-create table t8
-(
-archive_id int auto_increment primary key,
-branch_id int not null,
-target_id int not null,
-platform_id int not null,
-product_id int not null,
-status_id int not null default 1,
-unique archive(branch_id,target_id,platform_id,product_id),
-index status_id(status_id)
-) engine=bdb;
-create table t7
-(
-build_id int auto_increment primary key,
-branch_id int not null,
-target_id int not null,
-build_number int not null,
-build_date date not null,
-/* build system tag, e.g. 'rmanight-022301-1779' */
-build_tag varchar(255) not null,
-/* path relative to the build archive root, e.g. 'current' */
-build_path text not null,
-unique build(branch_id,target_id,build_number)
-) engine=bdb;
-insert into t1 (branch_name)
-values ('RealMedia');
-insert into t1 (branch_name)
-values ('RP8REV');
-insert into t1 (branch_name)
-values ('SERVER_8_0_GOLD');
-insert into t2 (target_name)
-values ('rmanight');
-insert into t2 (target_name)
-values ('playerall');
-insert into t2 (target_name)
-values ('servproxyall');
-insert into t3 (platform_name)
-values ('linux-2.0-libc6-i386');
-insert into t3 (platform_name)
-values ('win32-i386');
-insert into t4 (product_name, version_file)
-values ('realserver', 'servinst');
-insert into t4 (product_name, version_file)
-values ('realproxy', 'prxyinst');
-insert into t4 (product_name, version_file)
-values ('realplayer', 'playinst');
-insert into t4 (product_name, version_file)
-values ('plusplayer', 'plusinst');
-create temporary table tmp1
-select branch_id, target_id, platform_id, product_id
-from t1, t2, t3, t4 ;
-create temporary table tmp2
-select tmp1.branch_id, tmp1.target_id, tmp1.platform_id, tmp1.product_id
-from tmp1 left join t8
-using (branch_id,target_id,platform_id,product_id)
-where t8.archive_id is null ;
-insert into t8
-(branch_id, target_id, platform_id, product_id, status_id)
-select branch_id, target_id, platform_id, product_id, 1
-from tmp2 ;
-drop table tmp1 ;
-drop table tmp2 ;
-insert into t5 (product_id, file_name, module_name)
-values (1, 'servinst', 'server');
-insert into t5 (product_id, file_name, module_name)
-values (2, 'prxyinst', 'server');
-insert into t5 (product_id, file_name, module_name)
-values (3, 'playinst', 'rpapp');
-insert into t5 (product_id, file_name, module_name)
-values (4, 'plusinst', 'rpapp');
-insert into t6
-(product_file_id,platform_id,branch_id,build_filename,archive_filename)
-values (1, 2, 3, 'servinst.exe', 'win32-servinst.exe');
-insert into t6
-(product_file_id,platform_id,branch_id,build_filename,archive_filename)
-values (1, 1, 3, 'v80_linux-2.0-libc6-i386_servinst.bin', 'linux2-servinst.exe');
-insert into t6
-(product_file_id,platform_id,branch_id,build_filename,archive_filename)
-values (3, 2, 2, 'playinst.exe', 'win32-playinst.exe');
-insert into t6
-(product_file_id,platform_id,branch_id,build_filename,archive_filename)
-values (4, 2, 2, 'playinst.exe', 'win32-playinst.exe');
-insert into t7
-(branch_id,target_id,build_number,build_tag,build_date,build_path)
-values (2, 2, 1071, 'playerall-022101-1071', '2001-02-21', 'current');
-insert into t7
-(branch_id,target_id,build_number,build_tag,build_date,build_path)
-values (2, 2, 1072, 'playerall-022201-1072', '2001-02-22', 'current');
-insert into t7
-(branch_id,target_id,build_number,build_tag,build_date,build_path)
-values (3, 3, 388, 'servproxyall-022201-388', '2001-02-22', 'current');
-insert into t7
-(branch_id,target_id,build_number,build_tag,build_date,build_path)
-values (3, 3, 389, 'servproxyall-022301-389', '2001-02-23', 'current');
-insert into t7
-(branch_id,target_id,build_number,build_tag,build_date,build_path)
-values (4, 4, 100, 'foo target-010101-100', '2001-01-01', 'current');
-update t8
-set status_id=2
-where branch_id=2 and target_id=2 and platform_id=2 and product_id=1;
-select t7.build_path
-from
-t1,
-t7,
-t2,
-t3,
-t4,
-t5,
-t6
-where
-t7.branch_id = t1.branch_id and
-t7.target_id = t2.target_id and
-t5.product_id = t4.product_id and
-t6.product_file_id = t5.product_file_id and
-t6.platform_id = t3.platform_id and
-t6.branch_id = t6.branch_id and
-t7.build_id = 1 and
-t4.product_id = 3 and
-t5.file_name = 'playinst' and
-t3.platform_id = 2;
-build_path
-current
-drop table t1, t2, t3, t4, t5, t6, t7, t8;
-CREATE TABLE t1 (
-a tinytext NOT NULL,
-b tinyint(3) unsigned NOT NULL default '0',
-PRIMARY KEY (a(32),b)
-) ENGINE=BDB;
-INSERT INTO t1 VALUES ('a',1),('a',2);
-SELECT * FROM t1 WHERE a='a' AND b=2;
-a b
-a 2
-SELECT * FROM t1 WHERE a='a' AND b in (2);
-a b
-a 2
-SELECT * FROM t1 WHERE a='a' AND b in (1,2);
-a b
-a 1
-a 2
-drop table t1;
-CREATE TABLE t1 (
-a int3 unsigned NOT NULL,
-b int1 unsigned NOT NULL,
-UNIQUE (a, b)
-) ENGINE = BDB;
-INSERT INTO t1 VALUES (1, 1);
-SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
-MIN(B) MAX(b)
-1 1
-drop table t1;
-create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb;
-insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
-LOCK TABLES t1 WRITE;
-insert into t1 values (99,1,2,'D'),(1,1,2,'D');
-ERROR 23000: Duplicate entry '1-1' for key 1
-select id from t1;
-id
-0
-1
-2
-select id from t1;
-id
-0
-1
-2
-UNLOCK TABLES;
-DROP TABLE t1;
-create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb;
-insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
-LOCK TABLES t1 WRITE;
-begin;
-insert into t1 values (99,1,2,'D'),(1,1,2,'D');
-ERROR 23000: Duplicate entry '1-1' for key 1
-select id from t1;
-id
-0
-1
-2
-insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
-commit;
-select id,id3 from t1;
-id id3
-0 0
-1 1
-2 2
-100 2
-UNLOCK TABLES;
-DROP TABLE t1;
-CREATE TABLE t1 (SYAIN_NO char(5) NOT NULL default '', KINMU_DATE char(6) NOT NULL default '', PRIMARY KEY (SYAIN_NO,KINMU_DATE)) ENGINE=BerkeleyDB;
-CREATE TABLE t2 ( SYAIN_NO char(5) NOT NULL default '',STR_DATE char(8) NOT NULL default '',PRIMARY KEY (SYAIN_NO,STR_DATE) ) ENGINE=BerkeleyDB;
-select T1.KINMU_DATE from t1 T1 ,t2 T2 where T1.SYAIN_NO = '12345' and T1.KINMU_DATE = '200106' and T2.SYAIN_NO = T1.SYAIN_NO;
-KINMU_DATE
-select T1.KINMU_DATE from t1 T1 ,t2 T2 where T1.SYAIN_NO = '12345' and T1.KINMU_DATE = '200106' and T2.SYAIN_NO = T1.SYAIN_NO;
-KINMU_DATE
-DROP TABLE t1,t2;
-create table t1 (a int(11) not null, b int(11) not null, unique (a,b)) engine=bdb;
-insert into t1 values (1,1), (1,2);
-select * from t1 where a = 1;
-a b
-1 1
-1 2
-select t1.*, t2.* from t1, t1 t2 where t1.a = t2.a and t2.a = 1;
-a b a b
-1 1 1 1
-1 1 1 2
-1 2 1 1
-1 2 1 2
-select * from t1 where a = 1;
-a b
-1 1
-1 2
-drop table t1;
-create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb;
-insert into t1 values (0,0,0,'ABCDEFGHIJ');
-create table t2 (id int NOT NULL,primary key (id)) engine=bdb;
-LOCK TABLES t1 WRITE, t2 WRITE;
-insert into t2 values(1);
-SELECT t1.* FROM t1 WHERE id IN (1);
-id id2 id3 dummy1
-SELECT t1.* FROM t2 left outer join t1 on (t1.id=t2.id);
-id id2 id3 dummy1
-NULL NULL NULL NULL
-delete from t1 where id3 >= 0 and id3 <= 0;
-drop table t1,t2;
-CREATE TABLE t1 (i varchar(48) NOT NULL default '', p varchar(255) default NULL,s varchar(48) NOT NULL default '', PRIMARY KEY (i), UNIQUE(p,s)) ENGINE=BDB;
-INSERT INTO t1 VALUES ('00000000-e6c4ddeaa6-003b8-83458387','programs/xxxxxxxx.wmv','00000000-e6c4ddeb32-003bc-83458387');
-SELECT * FROM t1 WHERE p='programs/xxxxxxxx.wmv';
-i p s
-00000000-e6c4ddeaa6-003b8-83458387 programs/xxxxxxxx.wmv 00000000-e6c4ddeb32-003bc-83458387
-drop table t1;
-CREATE TABLE t1 ( STR_DATE varchar(8) NOT NULL default '',INFO_NOTE varchar(200) default NULL,PRIMARY KEY (STR_DATE) ) ENGINE=BerkeleyDB;
-select INFO_NOTE from t1 where STR_DATE = '20010610';
-INFO_NOTE
-select INFO_NOTE from t1 where STR_DATE < '20010610';
-INFO_NOTE
-select INFO_NOTE from t1 where STR_DATE > '20010610';
-INFO_NOTE
-drop table t1;
-create table t1 (a int not null, b int, primary key (a)) engine =bdb;
-create table t2 (a int not null, b int, primary key (a)) engine =bdb;
-insert into t1 values (2, 3),(1, 7),(10, 7);
-insert into t2 values (2, 3),(1, 7),(10, 7);
-select * from t1;
-a b
-1 7
-2 3
-10 7
-select * from t2;
-a b
-1 7
-2 3
-10 7
-delete t1, t2 from t1, t2 where t1.a = t2.a;
-select * from t1;
-a b
-select * from t2;
-a b
-select * from t2;
-a b
-drop table t1,t2;
-create table t1 (x int not null, index(x)) engine=bdb;
-insert into t1 values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
-select * from t1 where x <= 10 and x >= 7;
-x
-7
-8
-9
-10
-select * from t1 where x <= 10 and x >= 7 order by x;
-x
-7
-8
-9
-10
-select * from t1 where x <= 10 and x >= 7 order by x desc;
-x
-10
-9
-8
-7
-select * from t1 where x <= 8 and x >= 5 order by x desc;
-x
-8
-7
-6
-5
-select * from t1 where x < 8 and x > 5 order by x desc;
-x
-7
-6
-drop table t1;
-create table t1 ( c char(8) not null ) engine=bdb;
-insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
-insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
-alter table t1 add b char(8) not null;
-alter table t1 add a char(8) not null;
-alter table t1 add primary key (a,b,c);
-update t1 set a=c, b=c;
-create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=bdb;
-insert into t2 select * from t1;
-delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
-drop table t1,t2;
-create table t1 (a char(10), key(a), b int not null, key(b)) engine=bdb;
-insert into t1 values ('a',1),('A',2);
-explain select a from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 2
-select a from t1;
-a
-a
-A
-explain select b from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL b 4 NULL 2 Using index
-select b from t1;
-b
-1
-2
-alter table t1 modify a char(10) binary;
-explain select a from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL a 11 NULL 2 Using index
-select a from t1;
-a
-A
-a
-drop table t1;
-create table t1(
-pk1 text not null, pk2 text not null, pk3 char(4),
-key1 int, key2 int,
-primary key(pk1(4), pk2(4), pk3), key(key1), key(key2)
-) engine=bdb;
-insert into t1 values (concat('aaa-', repeat('A', 4000)),
-concat('eee-', repeat('e', 4000)), 'a++a', 1, 1);
-insert into t1 values (concat('bbb-', repeat('B', 4000)),
-concat('ggg-', repeat('G', 4000)), 'b++b', 1, 1);
-select substring(pk1, 1, 4), substring(pk1, 4001),
-substring(pk2, 1, 4), substring(pk2, 4001), pk3, key1, key2
-from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
-substring(pk1, 1, 4) substring(pk1, 4001) substring(pk2, 1, 4) substring(pk2, 4001) pk3 key1 key2
-aaa- AAAA eee- eeee a++a 1 1
-bbb- BBBB ggg- GGGG b++b 1 1
-drop table t1;
-create table t1 (
-pk1 varchar(8) not null default '',
-pk2 varchar(4) not null default '',
-key1 int(11) default null,
-key2 int(11) default null,
-primary key (pk1,pk2),
-key key1 (key1),
-key key2 (key2)) engine=bdb;
-insert into t1 values ('','empt',2,2), ('a','a--a',2,2),
-('bb','b--b',2,2), ('ccc','c--c',2,2), ('dddd','d--d',2,2);
-select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
-pk1 pk2 key1 key2
- empt 2 2
-a a--a 2 2
-bb b--b 2 2
-ccc c--c 2 2
-dddd d--d 2 2
-drop table t1;
-set autocommit=0;
-create table t1(b varchar(30)) engine=bdb;
-insert into t1 values ('one');
-commit;
-select b FROM t1 outer_table where
-exists (select 'two' from t1 where 'two' = outer_table.b);
-b
-drop table t1;
-set autocommit=1;
-create table t1(a int primary key, b varchar(30)) engine=bdb;
-insert into t1 values (1,'one'), (2,'two'), (3,'three'), (4,'four');
-create table t2 like t1;
-insert t2 select * from t1;
-select a from t1 where a in (select a from t2);
-a
-1
-2
-3
-4
-delete from t2;
-insert into t2 (a, b)
-select a, b from t1 where (a, b) in (select a, b from t1);
-select * from t2;
-a b
-1 one
-2 two
-3 three
-4 four
-drop table t1, t2;
-create table t1 (a int, b varchar(30), primary key(a)) engine = bdb;
-insert into t1 values (1,'one');
-commit;
-truncate t1;
-select * from t1;
-a b
-drop table t1;
-SET NAMES utf8;
-create table t1 (a varchar(255) character set utf8) engine=bdb;
-set @a:= convert(repeat(_latin1 0xFF, 255) using utf8);
-insert into t1 values (@a);
-select a, length(a), char_length(a) from t1;
-a length(a) char_length(a)
-ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ 510 255
-drop table t1;
-SET NAMES latin1;
-CREATE TABLE t1 (
-id int unsigned NOT NULL auto_increment,
-list_id smallint unsigned NOT NULL,
-term TEXT NOT NULL,
-PRIMARY KEY(id),
-INDEX(list_id, term(4))
-) ENGINE=BDB CHARSET=utf8;
-INSERT INTO t1 SET list_id = 1, term = "letterc";
-INSERT INTO t1 SET list_id = 1, term = "letterb";
-INSERT INTO t1 SET list_id = 1, term = "lettera";
-INSERT INTO t1 SET list_id = 1, term = "letterd";
-SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterc");
-id
-1
-SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterb");
-id
-2
-SELECT id FROM t1 WHERE (list_id = 1) AND (term = "lettera");
-id
-3
-SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd");
-id
-4
-DROP TABLE t1;
-create table t1 (a int, key(a)) engine=bdb;
-create table t2 (b int, key(b)) engine=bdb;
-insert into t1 values (1),(1),(2),(3),(4);
-insert into t2 values (1),(5),(6),(7);
-delete from t1 where (a in (select b from t2));
-select count(*) from t1;
-count(*)
-3
-insert into t1 set a=(select b from t2);
-ERROR 21000: Subquery returns more than 1 row
-select count(*) from t1;
-count(*)
-3
-update t1 set a = a + 1 where (a in (select b from t2));
-select count(*) from t1;
-count(*)
-3
-drop table t1, t2;
-End of 4.1 tests
-create temporary table t1 (a int, primary key(a)) engine=bdb;
-select * from t1;
-a
-alter table t1 add b int;
-select * from t1;
-a b
-drop table t1;
-set storage_engine=bdb;
-drop table if exists t1,t2,t3;
---- Testing varchar ---
---- Testing varchar ---
-create table t1 (v varchar(10), c char(10), t text);
-insert into t1 values('+ ', '+ ', '+ ');
-set @a=repeat(' ',20);
-insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
-Warnings:
-Note 1265 Data truncated for column 'v' at row 1
-select concat('*',v,'*',c,'*',t,'*') from t1;
-concat('*',v,'*',c,'*',t,'*')
-*+ *+*+ *
-*+ *+*+ *
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL,
- `t` text
-) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1
-create table t2 like t1;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL,
- `t` text
-) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1
-create table t3 select * from t1;
-show create table t3;
-Table Create Table
-t3 CREATE TABLE `t3` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL,
- `t` text
-) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1
-alter table t1 modify c varchar(10);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` varchar(10) default NULL,
- `c` varchar(10) default NULL,
- `t` text
-) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1
-alter table t1 modify v char(10);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` char(10) default NULL,
- `c` varchar(10) default NULL,
- `t` text
-) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1
-alter table t1 modify t varchar(10);
-Warnings:
-Note 1265 Data truncated for column 't' at row 2
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` char(10) default NULL,
- `c` varchar(10) default NULL,
- `t` varchar(10) default NULL
-) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1
-select concat('*',v,'*',c,'*',t,'*') from t1;
-concat('*',v,'*',c,'*',t,'*')
-*+*+*+ *
-*+*+*+ *
-drop table t1,t2,t3;
-create table t1 (v varchar(10), c char(10), t text, key(v), key(c), key(t(10)));
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL,
- `t` text,
- KEY `v` (`v`),
- KEY `c` (`c`),
- KEY `t` (`t`(10))
-) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1
-select count(*) from t1;
-count(*)
-270
-insert into t1 values(concat('a',char(1)),concat('a',char(1)),concat('a',char(1)));
-select count(*) from t1 where v='a';
-count(*)
-10
-select count(*) from t1 where c='a';
-count(*)
-10
-select count(*) from t1 where t='a';
-count(*)
-10
-select count(*) from t1 where v='a ';
-count(*)
-10
-select count(*) from t1 where c='a ';
-count(*)
-10
-select count(*) from t1 where t='a ';
-count(*)
-10
-select count(*) from t1 where v between 'a' and 'a ';
-count(*)
-10
-select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
-count(*)
-10
-select count(*) from t1 where v like 'a%';
-count(*)
-11
-select count(*) from t1 where c like 'a%';
-count(*)
-11
-select count(*) from t1 where t like 'a%';
-count(*)
-11
-select count(*) from t1 where v like 'a %';
-count(*)
-9
-explain select count(*) from t1 where v='a ';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 13 const # Using where
-explain select count(*) from t1 where c='a ';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref c c 11 const # Using where
-explain select count(*) from t1 where t='a ';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range t t 13 NULL # Using where
-explain select count(*) from t1 where v like 'a%';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 13 NULL # Using where
-explain select count(*) from t1 where v between 'a' and 'a ';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 13 const # Using where
-explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 13 const # Using where
-alter table t1 add unique(v);
-ERROR 23000: Duplicate entry '{ ' for key 1
-alter table t1 add key(v);
-select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
-qq
-*a*a*a*
-*a *a*a *
-*a *a*a *
-*a *a*a *
-*a *a*a *
-*a *a*a *
-*a *a*a *
-*a *a*a *
-*a *a*a *
-*a *a*a *
-explain select * from t1 where v='a';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v,v_2 # 13 const # Using where
-select v,count(*) from t1 group by v limit 10;
-v count(*)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select v,count(t) from t1 group by v limit 10;
-v count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select v,count(c) from t1 group by v limit 10;
-v count(c)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select sql_big_result v,count(t) from t1 group by v limit 10;
-v count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select sql_big_result v,count(c) from t1 group by v limit 10;
-v count(c)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select c,count(*) from t1 group by c limit 10;
-c count(*)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select c,count(t) from t1 group by c limit 10;
-c count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select sql_big_result c,count(t) from t1 group by c limit 10;
-c count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select t,count(*) from t1 group by t limit 10;
-t count(*)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select t,count(t) from t1 group by t limit 10;
-t count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select sql_big_result t,count(t) from t1 group by t limit 10;
-t count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-alter table t1 modify v varchar(300), drop key v, drop key v_2, add key v (v);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` varchar(300) default NULL,
- `c` char(10) default NULL,
- `t` text,
- KEY `c` (`c`),
- KEY `t` (`t`(10)),
- KEY `v` (`v`)
-) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1
-select count(*) from t1 where v='a';
-count(*)
-10
-select count(*) from t1 where v='a ';
-count(*)
-10
-select count(*) from t1 where v between 'a' and 'a ';
-count(*)
-10
-select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
-count(*)
-10
-select count(*) from t1 where v like 'a%';
-count(*)
-11
-select count(*) from t1 where v like 'a %';
-count(*)
-9
-explain select count(*) from t1 where v='a ';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 303 const # Using where
-explain select count(*) from t1 where v like 'a%';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 303 NULL # Using where
-explain select count(*) from t1 where v between 'a' and 'a ';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 303 const # Using where
-explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 303 const # Using where
-explain select * from t1 where v='a';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 303 const # Using where
-select v,count(*) from t1 group by v limit 10;
-v count(*)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select v,count(t) from t1 group by v limit 10;
-v count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select sql_big_result v,count(t) from t1 group by v limit 10;
-v count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-alter table t1 drop key v, add key v (v(30));
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` varchar(300) default NULL,
- `c` char(10) default NULL,
- `t` text,
- KEY `c` (`c`),
- KEY `t` (`t`(10)),
- KEY `v` (`v`(30))
-) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1
-select count(*) from t1 where v='a';
-count(*)
-10
-select count(*) from t1 where v='a ';
-count(*)
-10
-select count(*) from t1 where v between 'a' and 'a ';
-count(*)
-10
-select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
-count(*)
-10
-select count(*) from t1 where v like 'a%';
-count(*)
-11
-select count(*) from t1 where v like 'a %';
-count(*)
-9
-explain select count(*) from t1 where v='a ';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 33 const # Using where
-explain select count(*) from t1 where v like 'a%';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 33 NULL # Using where
-explain select count(*) from t1 where v between 'a' and 'a ';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 33 const # Using where
-explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 33 const # Using where
-explain select * from t1 where v='a';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 33 const # Using where
-select v,count(*) from t1 group by v limit 10;
-v count(*)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select v,count(t) from t1 group by v limit 10;
-v count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select sql_big_result v,count(t) from t1 group by v limit 10;
-v count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-alter table t1 modify v varchar(600), drop key v, add key v (v);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` varchar(600) default NULL,
- `c` char(10) default NULL,
- `t` text,
- KEY `c` (`c`),
- KEY `t` (`t`(10)),
- KEY `v` (`v`)
-) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1
-select v,count(*) from t1 group by v limit 10;
-v count(*)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select v,count(t) from t1 group by v limit 10;
-v count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select sql_big_result v,count(t) from t1 group by v limit 10;
-v count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-drop table t1;
-create table t1 (a char(10), unique (a));
-insert into t1 values ('a ');
-insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a' for key 1
-alter table t1 modify a varchar(10);
-insert into t1 values ('a '),('a '),('a '),('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
-insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
-insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
-insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
-update t1 set a='a ' where a like 'a%';
-select concat(a,'.') from t1;
-concat(a,'.')
-a .
-update t1 set a='abc ' where a like 'a ';
-select concat(a,'.') from t1;
-concat(a,'.')
-a .
-update t1 set a='a ' where a like 'a %';
-select concat(a,'.') from t1;
-concat(a,'.')
-a .
-update t1 set a='a ' where a like 'a ';
-select concat(a,'.') from t1;
-concat(a,'.')
-a .
-drop table t1;
-create table t1 (v varchar(10), c char(10), t text, key(v(5)), key(c(5)), key(t(5)));
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL,
- `t` text,
- KEY `v` (`v`(5)),
- KEY `c` (`c`(5)),
- KEY `t` (`t`(5))
-) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1
-drop table t1;
-create table t1 (v char(10) character set utf8);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` char(10) character set utf8 default NULL
-) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1
-drop table t1;
-create table t1 (v varchar(10), c char(10)) row_format=fixed;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL
-) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED
-insert into t1 values('a','a'),('a ','a ');
-select concat('*',v,'*',c,'*') from t1;
-concat('*',v,'*',c,'*')
-*a*a*
-*a *a*
-drop table t1;
-create table t1 (v varchar(65530), key(v(10)));
-insert into t1 values(repeat('a',65530));
-select length(v) from t1 where v=repeat('a',65530);
-length(v)
-65530
-drop table t1;
-create table t1(a int, b varchar(12), key ba(b, a));
-insert into t1 values (1, 'A'), (20, NULL);
-explain select * from t1 where a=20 and b is null;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref ba ba 20 const,const 1 Using where
-select * from t1 where a=20 and b is null;
-a b
-20 NULL
-drop table t1;
-create table t1 (v varchar(65530), key(v));
-Warnings:
-Warning 1071 Specified key was too long; max key length is MAX_KEY_LENGTH bytes
-drop table if exists t1;
-create table t1 (v varchar(65536));
-Warnings:
-Note 1246 Converting column 'v' from VARCHAR to TEXT
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` mediumtext
-) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1
-drop table t1;
-create table t1 (v varchar(65530) character set utf8);
-Warnings:
-Note 1246 Converting column 'v' from VARCHAR to TEXT
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` mediumtext character set utf8
-) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1
-drop table t1;
-set storage_engine=MyISAM;
-create table t1 (a varchar(255) character set utf8,
-b varchar(255) character set utf8,
-c varchar(255) character set utf8,
-d varchar(255) character set utf8,
-key (a,b,c,d)) engine=bdb;
-drop table t1;
-create table t1 (a varchar(255) character set utf8,
-b varchar(255) character set utf8,
-c varchar(255) character set utf8,
-d varchar(255) character set utf8,
-e varchar(255) character set utf8,
-key (a,b,c,d,e)) engine=bdb;
-ERROR 42000: Specified key was too long; max key length is 3072 bytes
-set autocommit=0;
-create table t1 (a int) engine=bdb;
-commit;
-alter table t1 add primary key(a);
-drop table t1;
-set autocommit=1;
-reset master;
-create table bug16206 (a int);
-insert into bug16206 values(1);
-start transaction;
-insert into bug16206 values(2);
-commit;
-show binlog events;
-Log_name Pos Event_type Server_id End_log_pos Info
-f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4
-f n Query 1 n use `test`; create table bug16206 (a int)
-f n Query 1 n use `test`; insert into bug16206 values(1)
-f n Query 1 n use `test`; insert into bug16206 values(2)
-drop table bug16206;
-reset master;
-create table bug16206 (a int) engine= bdb;
-insert into bug16206 values(0);
-insert into bug16206 values(1);
-start transaction;
-insert into bug16206 values(2);
-commit;
-insert into bug16206 values(3);
-show binlog events;
-Log_name Pos Event_type Server_id End_log_pos Info
-f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4
-f n Query 1 n use `test`; create table bug16206 (a int) engine= bdb
-f n Query 1 n use `test`; insert into bug16206 values(0)
-f n Query 1 n use `test`; insert into bug16206 values(1)
-f n Query 1 n use `test`; BEGIN
-f n Query 1 n use `test`; insert into bug16206 values(2)
-f n Query 1 n use `test`; COMMIT
-f n Query 1 n use `test`; insert into bug16206 values(3)
-drop table bug16206;
-set autocommit=0;
-End of 5.0 tests
diff --git a/mysql-test/r/bdb_cache.result b/mysql-test/r/bdb_cache.result
deleted file mode 100644
index 6506ce0412a..00000000000
--- a/mysql-test/r/bdb_cache.result
+++ /dev/null
@@ -1,99 +0,0 @@
-drop table if exists t1, t2, t3;
-flush status;
-set autocommit=0;
-create table t1 (a int not null) engine=bdb;
-insert into t1 values (1),(2),(3);
-select * from t1;
-a
-1
-2
-3
-show status like "Qcache_queries_in_cache";
-Variable_name Value
-Qcache_queries_in_cache 0
-drop table t1;
-set autocommit=1;
-create table t1 (a int not null) engine=bdb;
-begin;
-insert into t1 values (1),(2),(3);
-select * from t1;
-a
-1
-2
-3
-show status like "Qcache_queries_in_cache";
-Variable_name Value
-Qcache_queries_in_cache 0
-drop table t1;
-create table t1 (a int not null) engine=bdb;
-create table t2 (a int not null) engine=bdb;
-create table t3 (a int not null) engine=bdb;
-insert into t1 values (1),(2);
-insert into t2 values (1),(2);
-insert into t3 values (1),(2);
-select * from t1;
-a
-1
-2
-select * from t2;
-a
-1
-2
-select * from t3;
-a
-1
-2
-show status like "Qcache_queries_in_cache";
-Variable_name Value
-Qcache_queries_in_cache 3
-show status like "Qcache_hits";
-Variable_name Value
-Qcache_hits 0
-begin;
-select * from t1;
-a
-1
-2
-select * from t2;
-a
-1
-2
-select * from t3;
-a
-1
-2
-show status like "Qcache_queries_in_cache";
-Variable_name Value
-Qcache_queries_in_cache 3
-show status like "Qcache_hits";
-Variable_name Value
-Qcache_hits 0
-insert into t1 values (3);
-insert into t2 values (3);
-insert into t1 values (4);
-select * from t1;
-a
-1
-2
-3
-4
-select * from t2;
-a
-1
-2
-3
-select * from t3;
-a
-1
-2
-show status like "Qcache_queries_in_cache";
-Variable_name Value
-Qcache_queries_in_cache 3
-show status like "Qcache_hits";
-Variable_name Value
-Qcache_hits 0
-commit;
-show status like "Qcache_queries_in_cache";
-Variable_name Value
-Qcache_queries_in_cache 1
-drop table if exists t1, t2, t3;
diff --git a/mysql-test/r/bdb_gis.result b/mysql-test/r/bdb_gis.result
deleted file mode 100644
index c0e1682e485..00000000000
--- a/mysql-test/r/bdb_gis.result
+++ /dev/null
@@ -1,458 +0,0 @@
-SET storage_engine=bdb;
-DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
-CREATE TABLE gis_point (fid INTEGER, g POINT);
-CREATE TABLE gis_line (fid INTEGER, g LINESTRING);
-CREATE TABLE gis_polygon (fid INTEGER, g POLYGON);
-CREATE TABLE gis_multi_point (fid INTEGER, g MULTIPOINT);
-CREATE TABLE gis_multi_line (fid INTEGER, g MULTILINESTRING);
-CREATE TABLE gis_multi_polygon (fid INTEGER, g MULTIPOLYGON);
-CREATE TABLE gis_geometrycollection (fid INTEGER, g GEOMETRYCOLLECTION);
-CREATE TABLE gis_geometry (fid INTEGER, g GEOMETRY);
-SHOW CREATE TABLE gis_point;
-Table Create Table
-gis_point CREATE TABLE `gis_point` (
- `fid` int(11) default NULL,
- `g` point default NULL
-) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1
-SHOW FIELDS FROM gis_point;
-Field Type Null Key Default Extra
-fid int(11) YES NULL
-g point YES NULL
-SHOW FIELDS FROM gis_line;
-Field Type Null Key Default Extra
-fid int(11) YES NULL
-g linestring YES NULL
-SHOW FIELDS FROM gis_polygon;
-Field Type Null Key Default Extra
-fid int(11) YES NULL
-g polygon YES NULL
-SHOW FIELDS FROM gis_multi_point;
-Field Type Null Key Default Extra
-fid int(11) YES NULL
-g multipoint YES NULL
-SHOW FIELDS FROM gis_multi_line;
-Field Type Null Key Default Extra
-fid int(11) YES NULL
-g multilinestring YES NULL
-SHOW FIELDS FROM gis_multi_polygon;
-Field Type Null Key Default Extra
-fid int(11) YES NULL
-g multipolygon YES NULL
-SHOW FIELDS FROM gis_geometrycollection;
-Field Type Null Key Default Extra
-fid int(11) YES NULL
-g geometrycollection YES NULL
-SHOW FIELDS FROM gis_geometry;
-Field Type Null Key Default Extra
-fid int(11) YES NULL
-g geometry YES NULL
-INSERT INTO gis_point VALUES
-(101, PointFromText('POINT(10 10)')),
-(102, PointFromText('POINT(20 10)')),
-(103, PointFromText('POINT(20 20)')),
-(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
-INSERT INTO gis_line VALUES
-(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
-(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
-(107, LineStringFromWKB(LineString(Point(10, 10), Point(40, 10))));
-INSERT INTO gis_polygon VALUES
-(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
-(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
-(110, PolyFromWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))));
-INSERT INTO gis_multi_point VALUES
-(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
-(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
-(113, MPointFromWKB(MultiPoint(Point(3, 6), Point(4, 10))));
-INSERT INTO gis_multi_line VALUES
-(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
-(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
-(116, MLineFromWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))));
-INSERT INTO gis_multi_polygon VALUES
-(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
-(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
-(119, MPolyFromWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))));
-INSERT INTO gis_geometrycollection VALUES
-(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
-(121, GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))));
-INSERT into gis_geometry SELECT * FROM gis_point;
-INSERT into gis_geometry SELECT * FROM gis_line;
-INSERT into gis_geometry SELECT * FROM gis_polygon;
-INSERT into gis_geometry SELECT * FROM gis_multi_point;
-INSERT into gis_geometry SELECT * FROM gis_multi_line;
-INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
-INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
-SELECT fid, AsText(g) FROM gis_point ORDER by fid;
-fid AsText(g)
-101 POINT(10 10)
-102 POINT(20 10)
-103 POINT(20 20)
-104 POINT(10 20)
-SELECT fid, AsText(g) FROM gis_line ORDER by fid;
-fid AsText(g)
-105 LINESTRING(0 0,0 10,10 0)
-106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
-107 LINESTRING(10 10,40 10)
-SELECT fid, AsText(g) FROM gis_polygon ORDER by fid;
-fid AsText(g)
-108 POLYGON((10 10,20 10,20 20,10 20,10 10))
-109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
-110 POLYGON((0 0,30 0,30 30,0 0))
-SELECT fid, AsText(g) FROM gis_multi_point ORDER by fid;
-fid AsText(g)
-111 MULTIPOINT(0 0,10 10,10 20,20 20)
-112 MULTIPOINT(1 1,11 11,11 21,21 21)
-113 MULTIPOINT(3 6,4 10)
-SELECT fid, AsText(g) FROM gis_multi_line ORDER by fid;
-fid AsText(g)
-114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
-115 MULTILINESTRING((10 48,10 21,10 0))
-116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
-SELECT fid, AsText(g) FROM gis_multi_polygon ORDER by fid;
-fid AsText(g)
-117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
-118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
-119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
-SELECT fid, AsText(g) FROM gis_geometrycollection ORDER by fid;
-fid AsText(g)
-120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
-121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
-SELECT fid, AsText(g) FROM gis_geometry ORDER by fid;
-fid AsText(g)
-101 POINT(10 10)
-102 POINT(20 10)
-103 POINT(20 20)
-104 POINT(10 20)
-105 LINESTRING(0 0,0 10,10 0)
-106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
-107 LINESTRING(10 10,40 10)
-108 POLYGON((10 10,20 10,20 20,10 20,10 10))
-109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
-110 POLYGON((0 0,30 0,30 30,0 0))
-111 MULTIPOINT(0 0,10 10,10 20,20 20)
-112 MULTIPOINT(1 1,11 11,11 21,21 21)
-113 MULTIPOINT(3 6,4 10)
-114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
-115 MULTILINESTRING((10 48,10 21,10 0))
-116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
-117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
-118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
-119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
-120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
-121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
-SELECT fid, Dimension(g) FROM gis_geometry ORDER by fid;
-fid Dimension(g)
-101 0
-102 0
-103 0
-104 0
-105 1
-106 1
-107 1
-108 2
-109 2
-110 2
-111 0
-112 0
-113 0
-114 1
-115 1
-116 1
-117 2
-118 2
-119 2
-120 1
-121 1
-SELECT fid, GeometryType(g) FROM gis_geometry ORDER by fid;
-fid GeometryType(g)
-101 POINT
-102 POINT
-103 POINT
-104 POINT
-105 LINESTRING
-106 LINESTRING
-107 LINESTRING
-108 POLYGON
-109 POLYGON
-110 POLYGON
-111 MULTIPOINT
-112 MULTIPOINT
-113 MULTIPOINT
-114 MULTILINESTRING
-115 MULTILINESTRING
-116 MULTILINESTRING
-117 MULTIPOLYGON
-118 MULTIPOLYGON
-119 MULTIPOLYGON
-120 GEOMETRYCOLLECTION
-121 GEOMETRYCOLLECTION
-SELECT fid, IsEmpty(g) FROM gis_geometry ORDER by fid;
-fid IsEmpty(g)
-101 0
-102 0
-103 0
-104 0
-105 0
-106 0
-107 0
-108 0
-109 0
-110 0
-111 0
-112 0
-113 0
-114 0
-115 0
-116 0
-117 0
-118 0
-119 0
-120 0
-121 0
-SELECT fid, AsText(Envelope(g)) FROM gis_geometry ORDER by fid;
-fid AsText(Envelope(g))
-101 POLYGON((10 10,10 10,10 10,10 10,10 10))
-102 POLYGON((20 10,20 10,20 10,20 10,20 10))
-103 POLYGON((20 20,20 20,20 20,20 20,20 20))
-104 POLYGON((10 20,10 20,10 20,10 20,10 20))
-105 POLYGON((0 0,10 0,10 10,0 10,0 0))
-106 POLYGON((10 10,20 10,20 20,10 20,10 10))
-107 POLYGON((10 10,40 10,40 10,10 10,10 10))
-108 POLYGON((10 10,20 10,20 20,10 20,10 10))
-109 POLYGON((0 0,50 0,50 50,0 50,0 0))
-110 POLYGON((0 0,30 0,30 30,0 30,0 0))
-111 POLYGON((0 0,20 0,20 20,0 20,0 0))
-112 POLYGON((1 1,21 1,21 21,1 21,1 1))
-113 POLYGON((3 6,4 6,4 10,3 10,3 6))
-114 POLYGON((10 0,16 0,16 48,10 48,10 0))
-115 POLYGON((10 0,10 0,10 48,10 48,10 0))
-116 POLYGON((1 2,21 2,21 8,1 8,1 2))
-117 POLYGON((28 0,84 0,84 42,28 42,28 0))
-118 POLYGON((28 0,84 0,84 42,28 42,28 0))
-119 POLYGON((0 0,3 0,3 3,0 3,0 0))
-120 POLYGON((0 0,10 0,10 10,0 10,0 0))
-121 POLYGON((3 6,44 6,44 9,3 9,3 6))
-explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21
-Warnings:
-Note 1003 select dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,astext(envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry`
-SELECT fid, X(g) FROM gis_point ORDER by fid;
-fid X(g)
-101 10
-102 20
-103 20
-104 10
-SELECT fid, Y(g) FROM gis_point ORDER by fid;
-fid Y(g)
-101 10
-102 10
-103 20
-104 20
-explain extended select X(g),Y(g) FROM gis_point;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_point ALL NULL NULL NULL NULL 4
-Warnings:
-Note 1003 select x(`test`.`gis_point`.`g`) AS `X(g)`,y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point`
-SELECT fid, AsText(StartPoint(g)) FROM gis_line ORDER by fid;
-fid AsText(StartPoint(g))
-105 POINT(0 0)
-106 POINT(10 10)
-107 POINT(10 10)
-SELECT fid, AsText(EndPoint(g)) FROM gis_line ORDER by fid;
-fid AsText(EndPoint(g))
-105 POINT(10 0)
-106 POINT(10 10)
-107 POINT(40 10)
-SELECT fid, GLength(g) FROM gis_line ORDER by fid;
-fid GLength(g)
-105 24.142135623731
-106 40
-107 30
-SELECT fid, NumPoints(g) FROM gis_line ORDER by fid;
-fid NumPoints(g)
-105 3
-106 5
-107 2
-SELECT fid, AsText(PointN(g, 2)) FROM gis_line ORDER by fid;
-fid AsText(PointN(g, 2))
-105 POINT(0 10)
-106 POINT(20 10)
-107 POINT(40 10)
-SELECT fid, IsClosed(g) FROM gis_line ORDER by fid;
-fid IsClosed(g)
-105 0
-106 1
-107 0
-explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_line ALL NULL NULL NULL NULL 3
-Warnings:
-Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,astext(endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,glength(`test`.`gis_line`.`g`) AS `GLength(g)`,numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,astext(pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line`
-SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid;
-fid AsText(Centroid(g))
-108 POINT(15 15)
-109 POINT(25.416666666667 25.416666666667)
-110 POINT(20 10)
-SELECT fid, Area(g) FROM gis_polygon ORDER by fid;
-fid Area(g)
-108 100
-109 2400
-110 450
-SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon ORDER by fid;
-fid AsText(ExteriorRing(g))
-108 LINESTRING(10 10,20 10,20 20,10 20,10 10)
-109 LINESTRING(0 0,50 0,50 50,0 50,0 0)
-110 LINESTRING(0 0,30 0,30 30,0 0)
-SELECT fid, NumInteriorRings(g) FROM gis_polygon ORDER by fid;
-fid NumInteriorRings(g)
-108 0
-109 1
-110 0
-SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon ORDER by fid;
-fid AsText(InteriorRingN(g, 1))
-108 NULL
-109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
-110 NULL
-explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM gis_polygon;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3
-Warnings:
-Note 1003 select astext(centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,area(`test`.`gis_polygon`.`g`) AS `Area(g)`,astext(exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,astext(interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon`
-SELECT fid, IsClosed(g) FROM gis_multi_line ORDER by fid;
-fid IsClosed(g)
-114 0
-115 0
-116 0
-SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon ORDER by fid;
-fid AsText(Centroid(g))
-117 POINT(55.588527753042 17.426536064114)
-118 POINT(55.588527753042 17.426536064114)
-119 POINT(2 2)
-SELECT fid, Area(g) FROM gis_multi_polygon ORDER by fid;
-fid Area(g)
-117 1684.5
-118 1684.5
-119 4.5
-SELECT fid, NumGeometries(g) from gis_multi_point ORDER by fid;
-fid NumGeometries(g)
-111 4
-112 4
-113 2
-SELECT fid, NumGeometries(g) from gis_multi_line ORDER by fid;
-fid NumGeometries(g)
-114 2
-115 1
-116 2
-SELECT fid, NumGeometries(g) from gis_multi_polygon ORDER by fid;
-fid NumGeometries(g)
-117 2
-118 2
-119 1
-SELECT fid, NumGeometries(g) from gis_geometrycollection ORDER by fid;
-fid NumGeometries(g)
-120 2
-121 2
-explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3
-Warnings:
-Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point`
-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point ORDER by fid;
-fid AsText(GeometryN(g, 2))
-111 POINT(10 10)
-112 POINT(11 11)
-113 POINT(4 10)
-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line ORDER by fid;
-fid AsText(GeometryN(g, 2))
-114 LINESTRING(16 0,16 23,16 48)
-115 NULL
-116 LINESTRING(2 5,5 8,21 7)
-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon ORDER by fid;
-fid AsText(GeometryN(g, 2))
-117 POLYGON((59 18,67 18,67 13,59 13,59 18))
-118 POLYGON((59 18,67 18,67 13,59 13,59 18))
-119 NULL
-SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection ORDER by fid;
-fid AsText(GeometryN(g, 2))
-120 LINESTRING(0 0,10 10)
-121 LINESTRING(3 6,7 9)
-SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection ORDER by fid;
-fid AsText(GeometryN(g, 1))
-120 POINT(0 0)
-121 POINT(44 6)
-explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3
-Warnings:
-Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,astext(geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point`
-SELECT g1.fid as first, g2.fid as second,
-Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
-Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
-Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
-FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
-first second w c o e d t i r
-120 120 1 1 0 1 0 0 1 0
-120 121 0 0 0 0 0 0 1 0
-121 120 0 0 1 0 0 0 1 0
-121 121 1 1 0 1 0 0 1 0
-explain extended SELECT g1.fid as first, g2.fid as second,
-Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
-Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
-Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
-FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE g1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
-1 SIMPLE g2 ALL NULL NULL NULL NULL 2
-Warnings:
-Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,overlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,disjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,intersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`
-DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
-CREATE TABLE t1 (
-gp point,
-ln linestring,
-pg polygon,
-mp multipoint,
-mln multilinestring,
-mpg multipolygon,
-gc geometrycollection,
-gm geometry
-);
-SHOW FIELDS FROM t1;
-Field Type Null Key Default Extra
-gp point YES NULL
-ln linestring YES NULL
-pg polygon YES NULL
-mp multipoint YES NULL
-mln multilinestring YES NULL
-mpg multipolygon YES NULL
-gc geometrycollection YES NULL
-gm geometry YES NULL
-ALTER TABLE t1 ADD fid INT;
-SHOW FIELDS FROM t1;
-Field Type Null Key Default Extra
-gp point YES NULL
-ln linestring YES NULL
-pg polygon YES NULL
-mp multipoint YES NULL
-mln multilinestring YES NULL
-mpg multipolygon YES NULL
-gc geometrycollection YES NULL
-gm geometry YES NULL
-fid int(11) YES NULL
-DROP TABLE t1;
-create table t1 (a geometry not null);
-insert into t1 values (GeomFromText('Point(1 2)'));
-insert into t1 values ('Garbage');
-ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-insert IGNORE into t1 values ('Garbage');
-ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-drop table t1;
-create table t1 (fl geometry);
-insert into t1 values (1);
-ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-insert into t1 values (1.11);
-ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-insert into t1 values ("qwerty");
-ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-insert into t1 values (pointfromtext('point(1,1)'));
-ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-drop table t1;
diff --git a/mysql-test/r/bench_count_distinct.result b/mysql-test/r/bench_count_distinct.result
index 62312870f59..79e12afd237 100644
--- a/mysql-test/r/bench_count_distinct.result
+++ b/mysql-test/r/bench_count_distinct.result
@@ -4,8 +4,8 @@ select count(distinct n) from t1;
count(distinct n)
100
explain extended select count(distinct n) from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL n 4 NULL 200 Using index
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 index NULL n 4 NULL 200 100.00 Using index
Warnings:
Note 1003 select count(distinct `test`.`t1`.`n`) AS `count(distinct n)` from `test`.`t1`
drop table t1;
diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result
index edc18319603..c27ce18cfd3 100644
--- a/mysql-test/r/bigint.result
+++ b/mysql-test/r/bigint.result
@@ -47,7 +47,7 @@ drop table t1;
create table t1 ( a int not null default 1, big bigint );
insert into t1 (big) values (-1),(12345678901234567),(9223372036854775807),(18446744073709551615);
Warnings:
-Warning 1264 Out of range value adjusted for column 'big' at row 4
+Warning 1264 Out of range value for column 'big' at row 4
select * from t1;
a big
1 -1
@@ -62,7 +62,7 @@ min(big) max(big) max(big)-1
-1 9223372036854775807 9223372036854775806
alter table t1 modify big bigint unsigned not null;
Warnings:
-Warning 1264 Out of range value adjusted for column 'big' at row 1
+Warning 1264 Out of range value for column 'big' at row 1
select min(big),max(big),max(big)-1 from t1;
min(big) max(big) max(big)-1
0 9223372036854775807 9223372036854775806
@@ -92,7 +92,7 @@ min(big) max(big) max(big)-1
0 18446744073709551615 18446744073709551614
alter table t1 modify big bigint not null;
Warnings:
-Warning 1264 Out of range value adjusted for column 'big' at row 5
+Warning 1264 Out of range value for column 'big' at row 5
select * from t1;
a big
1 0
@@ -174,14 +174,14 @@ create table t1 select 1 as 'a';
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL default '0'
+ `a` int(1) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 select 9223372036854775809 as 'a';
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bigint(19) unsigned NOT NULL default '0'
+ `a` bigint(19) unsigned NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t1;
a
@@ -204,10 +204,10 @@ drop table t1;
create table t1 ( quantity decimal(2) unsigned);
insert into t1 values (500), (-500), (~0), (-1);
Warnings:
-Warning 1264 Out of range value adjusted for column 'quantity' at row 1
-Warning 1264 Out of range value adjusted for column 'quantity' at row 2
-Warning 1264 Out of range value adjusted for column 'quantity' at row 3
-Warning 1264 Out of range value adjusted for column 'quantity' at row 4
+Warning 1264 Out of range value for column 'quantity' at row 1
+Warning 1264 Out of range value for column 'quantity' at row 2
+Warning 1264 Out of range value for column 'quantity' at row 3
+Warning 1264 Out of range value for column 'quantity' at row 4
select * from t1;
quantity
99
diff --git a/mysql-test/r/binary.result b/mysql-test/r/binary.result
index c5673d1c00d..ccafa43c7ab 100644
--- a/mysql-test/r/binary.result
+++ b/mysql-test/r/binary.result
@@ -138,7 +138,7 @@ create table t1 (a binary);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` binary(1) default NULL
+ `a` binary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (col1 binary(4));
diff --git a/mysql-test/r/binlog_row_binlog.result b/mysql-test/r/binlog_row_binlog.result
new file mode 100644
index 00000000000..7cbfa525798
--- /dev/null
+++ b/mysql-test/r/binlog_row_binlog.result
@@ -0,0 +1,282 @@
+drop table if exists t1, t2;
+reset master;
+create table t1 (a int) engine=innodb;
+create table t2 (a int) engine=innodb;
+begin;
+insert t1 values (5);
+commit;
+begin;
+insert t2 values (5);
+commit;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=innodb
+master-bin.000001 # Query 1 # use `test`; create table t2 (a int) engine=innodb
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (test.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+drop table t1,t2;
+reset master;
+create table t1 (n int) engine=innodb;
+begin;
+commit;
+drop table t1;
+show binlog events in 'master-bin.000001' from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; create table t1 (n int) engine=innodb
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
+show binlog events in 'master-bin.000002' from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Query 1 # use `test`; drop table t1
+reset master;
+create table t1 (id tinyint auto_increment primary key);
+set insert_id=128;
+insert into t1 values(null);
+Warnings:
+Warning 1264 Out of range value for column 'id' at row 1
+select * from t1;
+id
+127
+drop table t1;
+create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
+set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
+insert delayed into t1 values (207);
+insert delayed into t1 values (null);
+insert delayed into t1 values (300);
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; create table t1 (id tinyint auto_increment primary key)
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `test`; drop table t1
+master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+insert delayed into t1 values (null),(null),(null),(null);
+insert delayed into t1 values (null),(null),(400),(null);
+11 == 11
+select * from t1;
+a
+207
+208
+300
+301
+302
+303
+304
+305
+306
+400
+401
+drop table t1;
diff --git a/mysql-test/r/binlog_row_blackhole.result b/mysql-test/r/binlog_row_blackhole.result
new file mode 100644
index 00000000000..a02aea4ea49
--- /dev/null
+++ b/mysql-test/r/binlog_row_blackhole.result
@@ -0,0 +1,143 @@
+drop table if exists t1,t2;
+CREATE TABLE t1 (
+Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
+Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
+) ENGINE=blackhole;
+INSERT INTO t1 VALUES (9410,9412);
+select period from t1;
+period
+select * from t1;
+Period Varor_period
+select t1.* from t1;
+Period Varor_period
+CREATE TABLE t2 (
+auto int NOT NULL auto_increment,
+fld1 int(6) unsigned zerofill DEFAULT '000000' NOT NULL,
+companynr tinyint(2) unsigned zerofill DEFAULT '00' NOT NULL,
+fld3 char(30) DEFAULT '' NOT NULL,
+fld4 char(35) DEFAULT '' NOT NULL,
+fld5 char(35) DEFAULT '' NOT NULL,
+fld6 char(4) DEFAULT '' NOT NULL,
+primary key (auto)
+) ENGINE=blackhole;
+INSERT INTO t2 VALUES (1192,068305,00,'Colombo','hardware','colicky','');
+INSERT INTO t2 VALUES (1193,000000,00,'nondecreasing','implant','thrillingly','');
+select t2.fld3 from t2 where companynr = 58 and fld3 like "%imaginable%";
+fld3
+select fld3 from t2 where fld3 like "%cultivation" ;
+fld3
+select t2.fld3,companynr from t2 where companynr = 57+1 order by fld3;
+fld3 companynr
+select fld3,companynr from t2 where companynr = 58 order by fld3;
+fld3 companynr
+select fld3 from t2 order by fld3 desc limit 10;
+fld3
+select fld3 from t2 order by fld3 desc limit 5;
+fld3
+select fld3 from t2 order by fld3 desc limit 5,5;
+fld3
+select t2.fld3 from t2 where fld3 = 'honeysuckle';
+fld3
+select t2.fld3 from t2 where fld3 LIKE 'honeysuckl_';
+fld3
+select t2.fld3 from t2 where fld3 LIKE 'hon_ysuckl_';
+fld3
+select t2.fld3 from t2 where fld3 LIKE 'honeysuckle%';
+fld3
+select t2.fld3 from t2 where fld3 LIKE 'h%le';
+fld3
+select t2.fld3 from t2 where fld3 LIKE 'honeysuckle_';
+fld3
+select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%';
+fld3
+select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
+fld3
+select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
+fld1 fld3
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b));
+INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
+('Full-text indexes', 'are called collections'),
+('Only MyISAM tables','support collections'),
+('Function MATCH ... AGAINST()','is used to do a search'),
+('Full-text search in MySQL', 'implements vector space model');
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a NULL NULL NULL NULL YES FULLTEXT
+t1 1 a 2 b NULL NULL NULL NULL YES FULLTEXT
+select * from t1 where MATCH(a,b) AGAINST ("collections");
+a b
+Only MyISAM tables support collections
+Full-text indexes are called collections
+explain extended select * from t1 where MATCH(a,b) AGAINST ("collections");
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 fulltext a a 0 1 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against (_latin1'collections'))
+select * from t1 where MATCH(a,b) AGAINST ("indexes");
+a b
+Full-text indexes are called collections
+select * from t1 where MATCH(a,b) AGAINST ("indexes collections");
+a b
+Full-text indexes are called collections
+Only MyISAM tables support collections
+select * from t1 where MATCH(a,b) AGAINST ("only");
+a b
+reset master;
+drop table t1,t2;
+create table t1 (a int) engine=blackhole;
+delete from t1 where a=10;
+update t1 set a=11 where a=15;
+insert into t1 values(1);
+insert ignore into t1 values(1);
+replace into t1 values(100);
+create table t2 (a varchar(200)) engine=blackhole;
+load data infile '../std_data_ln/words.dat' into table t2;
+alter table t1 add b int;
+alter table t1 drop b;
+create table t3 like t1;
+insert into t1 select * from t3;
+replace into t1 select * from t3;
+select * from t1;
+a
+select * from t2;
+a
+select * from t3;
+a
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000001 # Query 1 # use `test`; drop table t1,t2
+master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=blackhole
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `test`; create table t2 (a varchar(200)) engine=blackhole
+master-bin.000001 # Table_map 1 # table_id: # (test.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `test`; alter table t1 add b int
+master-bin.000001 # Query 1 # use `test`; alter table t1 drop b
+master-bin.000001 # Query 1 # use `test`; create table t3 like t1
+drop table t1,t2,t3;
+reset master;
+create table t1 (a int) engine=blackhole;
+set autocommit=0;
+start transaction;
+insert into t1 values(1);
+commit;
+start transaction;
+insert into t1 values(2);
+rollback;
+set autocommit=1;
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=blackhole
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `test`; COMMIT
+drop table if exists t1;
diff --git a/mysql-test/r/ctype_cp932.result b/mysql-test/r/binlog_row_ctype_cp932.result
index ed57b87c1ba..ed57b87c1ba 100755..100644
--- a/mysql-test/r/ctype_cp932.result
+++ b/mysql-test/r/binlog_row_ctype_cp932.result
diff --git a/mysql-test/r/binlog_row_ctype_ucs.result b/mysql-test/r/binlog_row_ctype_ucs.result
new file mode 100644
index 00000000000..5feb17cde13
--- /dev/null
+++ b/mysql-test/r/binlog_row_ctype_ucs.result
@@ -0,0 +1,16 @@
+SET TIMESTAMP=10000;
+create table t2 (c char(30)) charset=ucs2;
+set @v=convert('abc' using ucs2);
+reset master;
+insert into t2 values (@v);
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 102 Table_map 1 141 table_id: # (test.t2)
+master-bin.000001 141 Write_rows 1 231 table_id: # flags: STMT_END_F
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+ROLLBACK;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+drop table t2;
diff --git a/mysql-test/r/binlog_row_drop_tmp_tbl.result b/mysql-test/r/binlog_row_drop_tmp_tbl.result
new file mode 100644
index 00000000000..2b09fe069e3
--- /dev/null
+++ b/mysql-test/r/binlog_row_drop_tmp_tbl.result
@@ -0,0 +1,18 @@
+drop database if exists `drop-temp+table-test`;
+reset master;
+create database `drop-temp+table-test`;
+use `drop-temp+table-test`;
+create temporary table shortn1 (a int);
+create temporary table `table:name` (a int);
+create temporary table shortn2 (a int);
+select get_lock("a",10);
+get_lock("a",10)
+1
+select get_lock("a",10);
+get_lock("a",10)
+1
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000001 # Query 1 # create database `drop-temp+table-test`
+drop database `drop-temp+table-test`;
diff --git a/mysql-test/r/binlog_row_innodb_stat.result b/mysql-test/r/binlog_row_innodb_stat.result
new file mode 100644
index 00000000000..e6813ee2719
--- /dev/null
+++ b/mysql-test/r/binlog_row_innodb_stat.result
@@ -0,0 +1,39 @@
+show status like "binlog_cache_use";
+Variable_name Value
+Binlog_cache_use 0
+show status like "binlog_cache_disk_use";
+Variable_name Value
+Binlog_cache_disk_use 0
+drop table if exists t1;
+create table t1 (a int) engine=innodb;
+show status like "binlog_cache_use";
+Variable_name Value
+Binlog_cache_use 1
+show status like "binlog_cache_disk_use";
+Variable_name Value
+Binlog_cache_disk_use 1
+begin;
+delete from t1;
+commit;
+show status like "binlog_cache_use";
+Variable_name Value
+Binlog_cache_use 2
+show status like "binlog_cache_disk_use";
+Variable_name Value
+Binlog_cache_disk_use 1
+drop table t1;
+show status like "Innodb_buffer_pool_pages_total";
+Variable_name Value
+Innodb_buffer_pool_pages_total 512
+show status like "Innodb_page_size";
+Variable_name Value
+Innodb_page_size 16384
+show status like "Innodb_rows_deleted";
+Variable_name Value
+Innodb_rows_deleted 2000
+show status like "Innodb_rows_inserted";
+Variable_name Value
+Innodb_rows_inserted 2000
+show status like "Innodb_rows_updated";
+Variable_name Value
+Innodb_rows_updated 0
diff --git a/mysql-test/r/binlog_row_insert_select.result b/mysql-test/r/binlog_row_insert_select.result
new file mode 100644
index 00000000000..14cef6709b6
--- /dev/null
+++ b/mysql-test/r/binlog_row_insert_select.result
@@ -0,0 +1,27 @@
+drop table if exists t1,t2;
+create table t1(a int, unique(a));
+insert into t1 values(2);
+create table t2(a int);
+insert into t2 values(1),(2);
+reset master;
+insert into t1 select * from t2;
+ERROR 23000: Duplicate entry '2' for key 'a'
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4
+master-bin.000001 102 Table_map 1 141 table_id: # (test.t1)
+master-bin.000001 141 Write_rows 1 175 table_id: # flags: STMT_END_F
+select * from t1;
+a
+1
+2
+drop table t1, t2;
+create table t1(a int);
+insert into t1 values(1),(1);
+reset master;
+create table t2(unique(a)) select a from t1;
+ERROR 23000: Duplicate entry '1' for key 'a'
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4
+drop table t1;
diff --git a/mysql-test/r/binlog_row_mix_innodb_myisam.result b/mysql-test/r/binlog_row_mix_innodb_myisam.result
new file mode 100644
index 00000000000..e063d7371a9
--- /dev/null
+++ b/mysql-test/r/binlog_row_mix_innodb_myisam.result
@@ -0,0 +1,414 @@
+drop table if exists t1, t2;
+create table t1 (a int) engine=innodb;
+create table t2 (a int) engine=myisam;
+reset master;
+begin;
+insert into t1 values(1);
+insert into t2 select * from t1;
+commit;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+delete from t1;
+delete from t2;
+reset master;
+begin;
+insert into t1 values(2);
+insert into t2 select * from t1;
+rollback;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `test`; ROLLBACK
+delete from t1;
+delete from t2;
+reset master;
+begin;
+insert into t1 values(3);
+savepoint my_savepoint;
+insert into t1 values(4);
+insert into t2 select * from t1;
+rollback to savepoint my_savepoint;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+commit;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `test`; savepoint my_savepoint
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `test`; rollback to savepoint my_savepoint
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+delete from t1;
+delete from t2;
+reset master;
+begin;
+insert into t1 values(5);
+savepoint my_savepoint;
+insert into t1 values(6);
+insert into t2 select * from t1;
+rollback to savepoint my_savepoint;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+insert into t1 values(7);
+commit;
+select a from t1 order by a;
+a
+5
+7
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `test`; savepoint my_savepoint
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `test`; rollback to savepoint my_savepoint
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+delete from t1;
+delete from t2;
+reset master;
+select get_lock("a",10);
+get_lock("a",10)
+1
+begin;
+insert into t1 values(8);
+insert into t2 select * from t1;
+select get_lock("a",10);
+get_lock("a",10)
+1
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `test`; ROLLBACK
+delete from t1;
+delete from t2;
+reset master;
+insert into t1 values(9);
+insert into t2 select * from t1;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+master-bin.000001 # Table_map 1 # table_id: # (test.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+delete from t1;
+delete from t2;
+reset master;
+insert into t1 values(10);
+begin;
+insert into t2 select * from t1;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+master-bin.000001 # Table_map 1 # table_id: # (test.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+insert into t1 values(11);
+commit;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+master-bin.000001 # Table_map 1 # table_id: # (test.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+alter table t2 engine=INNODB;
+delete from t1;
+delete from t2;
+reset master;
+begin;
+insert into t1 values(12);
+insert into t2 select * from t1;
+commit;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+delete from t1;
+delete from t2;
+reset master;
+begin;
+insert into t1 values(13);
+insert into t2 select * from t1;
+rollback;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+delete from t1;
+delete from t2;
+reset master;
+begin;
+insert into t1 values(14);
+savepoint my_savepoint;
+insert into t1 values(15);
+insert into t2 select * from t1;
+rollback to savepoint my_savepoint;
+commit;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+delete from t1;
+delete from t2;
+reset master;
+begin;
+insert into t1 values(16);
+savepoint my_savepoint;
+insert into t1 values(17);
+insert into t2 select * from t1;
+rollback to savepoint my_savepoint;
+insert into t1 values(18);
+commit;
+select a from t1 order by a;
+a
+16
+18
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+delete from t1;
+delete from t2;
+alter table t2 engine=MyISAM;
+insert into t1 values (1);
+begin;
+select * from t1 for update;
+a
+1
+select (@before:=unix_timestamp())*0;
+(@before:=unix_timestamp())*0
+0
+begin;
+select * from t1 for update;
+insert into t2 values (20);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+select (@after:=unix_timestamp())*0;
+(@after:=unix_timestamp())*0
+0
+select (@after-@before) >= 2;
+(@after-@before) >= 2
+1
+drop table t1,t2;
+commit;
+begin;
+create temporary table ti (a int) engine=innodb;
+rollback;
+insert into ti values(1);
+set autocommit=0;
+create temporary table t1 (a int) engine=myisam;
+commit;
+insert t1 values (1);
+rollback;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+create table t0 (n int);
+insert t0 select * from t1;
+set autocommit=1;
+insert into t0 select GET_LOCK("lock1",null);
+set autocommit=0;
+create table t2 (n int) engine=innodb;
+insert into t2 values (3);
+select get_lock("lock1",60);
+get_lock("lock1",60)
+1
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+master-bin.000001 # Query 1 # use `test`; alter table t2 engine=MyISAM
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+master-bin.000001 # Table_map 1 # table_id: # (test.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `test`; drop table t1,t2
+master-bin.000001 # Query 1 # use `test`; create table t0 (n int)
+master-bin.000001 # Table_map 1 # table_id: # (test.t0)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t0)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `test`; create table t2 (n int) engine=innodb
+do release_lock("lock1");
+drop table t0,t2;
+set autocommit=0;
+CREATE TABLE t1 (a int, b int) engine=myisam;
+reset master;
+INSERT INTO t1 values (1,1),(1,2);
+CREATE TABLE t2 (primary key (a)) engine=innodb select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+DROP TABLE if exists t2;
+Warnings:
+Note 1051 Unknown table 't2'
+INSERT INTO t1 values (3,3);
+CREATE TEMPORARY TABLE t2 (primary key (a)) engine=innodb select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+DROP TABLE IF EXISTS t2;
+Warnings:
+Note 1051 Unknown table 't2'
+CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb;
+INSERT INTO t1 VALUES (4,4);
+CREATE TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT * from t2;
+a b
+TRUNCATE table t2;
+INSERT INTO t1 VALUES (5,5);
+INSERT INTO t2 select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT * FROM t2;
+a b
+DROP TABLE t2;
+INSERT INTO t1 values (6,6);
+CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a)) engine=innodb ;
+INSERT INTO t1 values (7,7);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+INSERT INTO t1 values (8,8);
+CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+COMMIT;
+INSERT INTO t1 values (9,9);
+CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+SELECT * from t2;
+a b
+TRUNCATE table t2;
+INSERT INTO t1 values (10,10);
+INSERT INTO t2 select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT * from t1;
+a b
+1 1
+1 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+10 10
+INSERT INTO t2 values (100,100);
+CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+COMMIT;
+INSERT INTO t2 values (101,101);
+CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+ROLLBACK;
+SELECT * from t2;
+a b
+100 100
+DROP TABLE t1,t2;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `test`; DROP TABLE if exists t2
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS t2
+master-bin.000001 # Query 1 # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `test`; TRUNCATE table t2
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (test.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+master-bin.000001 # Query 1 # use `test`; DROP TABLE t2
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `test`; TRUNCATE table t2
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `test`; DROP TABLE `t1` /* generated by server */
+reset master;
+create table t1 (a int) engine=innodb;
+create table t2 (a int) engine=myisam;
+select get_lock("a",10);
+get_lock("a",10)
+1
+begin;
+insert into t1 values(8);
+insert into t2 select * from t1;
+select get_lock("a",10);
+get_lock("a",10)
+1
+select
+(@a:=load_file("MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
+is not null;
+(@a:=load_file("MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
+is not null
+1
+select
+@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%",
+@a not like "%#%error_code=%error_code=%";
+@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%"
+1 1
+drop table t1, t2;
diff --git a/mysql-test/r/binlog_statement_insert_delayed.result b/mysql-test/r/binlog_statement_insert_delayed.result
new file mode 100644
index 00000000000..7a1b9a7ec9b
--- /dev/null
+++ b/mysql-test/r/binlog_statement_insert_delayed.result
@@ -0,0 +1,29 @@
+create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
+set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
+insert delayed into t1 values (207);
+insert delayed into t1 values (null);
+insert delayed into t1 values (300);
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
+master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (207)
+master-bin.000001 # Intvar 1 # INSERT_ID=208
+master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (null)
+master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (300)
+insert delayed into t1 values (null),(null),(null),(null);
+insert delayed into t1 values (null),(null),(400),(null);
+11 == 11
+select * from t1;
+a
+207
+208
+300
+301
+302
+303
+304
+305
+306
+400
+401
+drop table t1;
diff --git a/mysql-test/r/binlog.result b/mysql-test/r/binlog_stm_binlog.result
index 25930c31735..eed2df28d1f 100644
--- a/mysql-test/r/binlog.result
+++ b/mysql-test/r/binlog_stm_binlog.result
@@ -1,6 +1,18 @@
+create table t1 (a int, b int) engine=innodb;
+begin;
+insert into t1 values (1,2);
+commit;
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: #, Binlog ver: #
+master-bin.000001 102 Query 1 209 use `test`; create table t1 (a int, b int) engine=innodb
+master-bin.000001 209 Query 1 277 use `test`; BEGIN
+master-bin.000001 277 Query 1 90 use `test`; insert into t1 values (1,2)
+master-bin.000001 367 Xid 1 394 COMMIT /* XID */
+drop table t1;
drop table if exists t1, t2;
reset master;
-create table t1 (a int) engine=bdb;
+create table t1 (a int) engine=innodb;
create table t2 (a int) engine=innodb;
begin;
insert t1 values (5);
@@ -8,23 +20,23 @@ commit;
begin;
insert t2 values (5);
commit;
-show binlog events from 98;
+show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=bdb
+master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=innodb
master-bin.000001 # Query 1 # use `test`; create table t2 (a int) engine=innodb
master-bin.000001 # Query 1 # use `test`; BEGIN
master-bin.000001 # Query 1 # use `test`; insert t1 values (5)
-master-bin.000001 # Query 1 # use `test`; COMMIT
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
master-bin.000001 # Query 1 # use `test`; BEGIN
master-bin.000001 # Query 1 # use `test`; insert t2 values (5)
-master-bin.000001 # Xid 1 # COMMIT /* xid=12 */
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
drop table t1,t2;
reset master;
create table t1 (n int) engine=innodb;
begin;
commit;
drop table t1;
-show binlog events in 'master-bin.000001' from 98;
+show binlog events in 'master-bin.000001' from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1 (n int) engine=innodb
master-bin.000001 # Query 1 # use `test`; BEGIN
@@ -128,8 +140,53 @@ master-bin.000001 # Query 1 # use `test`; insert into t1 values(4 + 4)
master-bin.000001 # Query 1 # use `test`; insert into t1 values(3 + 4)
master-bin.000001 # Query 1 # use `test`; insert into t1 values(2 + 4)
master-bin.000001 # Query 1 # use `test`; insert into t1 values(1 + 4)
-master-bin.000001 # Xid 1 # COMMIT /* xid=19 */
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
-show binlog events in 'master-bin.000002' from 98;
+show binlog events in 'master-bin.000002' from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 # Query 1 # use `test`; drop table t1
+reset master;
+create table t1 (id tinyint auto_increment primary key);
+set insert_id=128;
+insert into t1 values(null);
+Warnings:
+Warning 1264 Out of range value for column 'id' at row 1
+select * from t1;
+id
+127
+drop table t1;
+create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
+set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
+insert delayed into t1 values (207);
+insert delayed into t1 values (null);
+insert delayed into t1 values (300);
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; create table t1 (id tinyint auto_increment primary key)
+master-bin.000001 # Intvar 1 # INSERT_ID=127
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(null)
+master-bin.000001 # Query 1 # use `test`; drop table t1
+master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+insert delayed into t1 values (null),(null),(null),(null);
+insert delayed into t1 values (null),(null),(400),(null);
+11 == 11
+select * from t1;
+a
+207
+208
+300
+301
+302
+303
+304
+305
+306
+400
+401
+drop table t1;
diff --git a/mysql-test/r/blackhole.result b/mysql-test/r/binlog_stm_blackhole.result
index 140d7e73d48..309f45aed49 100644
--- a/mysql-test/r/blackhole.result
+++ b/mysql-test/r/binlog_stm_blackhole.result
@@ -70,8 +70,8 @@ a b
Only MyISAM tables support collections
Full-text indexes are called collections
explain extended select * from t1 where MATCH(a,b) AGAINST ("collections");
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 fulltext a a 0 1 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 fulltext a a 0 1 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against (_latin1'collections'))
select * from t1 where MATCH(a,b) AGAINST ("indexes");
@@ -123,3 +123,21 @@ master-bin.000001 # Query 1 # use `test`; create table t3 like t1
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t3
master-bin.000001 # Query 1 # use `test`; replace into t1 select * from t3
drop table t1,t2,t3;
+reset master;
+create table t1 (a int) engine=blackhole;
+set autocommit=0;
+start transaction;
+insert into t1 values(1);
+commit;
+start transaction;
+insert into t1 values(2);
+rollback;
+set autocommit=1;
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=blackhole
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(1)
+master-bin.000001 # Query 1 # use `test`; COMMIT
+drop table if exists t1;
diff --git a/mysql-test/r/binlog_stm_ctype_cp932.result b/mysql-test/r/binlog_stm_ctype_cp932.result
new file mode 100755
index 00000000000..ed57b87c1ba
--- /dev/null
+++ b/mysql-test/r/binlog_stm_ctype_cp932.result
@@ -0,0 +1,11355 @@
+drop table if exists t1;
+drop table if exists t2;
+drop table if exists t3;
+drop table if exists t4;
+set names cp932;
+set character_set_database = cp932;
+CREATE TABLE t1(c1 CHAR(1)) DEFAULT CHARACTER SET = cp932;
+INSERT INTO t1 VALUES
+(0x05),(0x7E),(0x815C),(0x815F),(0x8160),(0x8161),(0x817C),(0x8191),(0x8192),(0x81CA);
+INSERT INTO t1 VALUES
+(0x8740),(0x8741),(0x8742),(0x8743),(0x8744),(0x8745),(0x8746),(0x8747),
+(0x8748),(0x8749),(0x874A),(0x874B),(0x874C),(0x874D),(0x874E),(0x874F),
+(0x8750),(0x8751),(0x8752),(0x8753),(0x8754),(0x8755),(0x8756),(0x8757),
+(0x8758),(0x8759),(0x875A),(0x875B),(0x875C),(0x875D),(0x875F),
+(0x8760),(0x8761),(0x8762),(0x8763),(0x8764),(0x8765),(0x8766),(0x8767),
+(0x8768),(0x8769),(0x876A),(0x876B),(0x876C),(0x876D),(0x876E),(0x876F),
+(0x8770),(0x8771),(0x8772),(0x8773),(0x8774),(0x8775),(0x877E),
+(0x8780),(0x8781),(0x8782),(0x8783),(0x8784),(0x8785),(0x8786),(0x8787),
+(0x8788),(0x8789),(0x878A),(0x878B),(0x878C),(0x878D),(0x878E),(0x878F),
+(0x8790),(0x8791),(0x8792),(0x8793),(0x8794),(0x8795),(0x8796),(0x8797),
+(0x8798),(0x8799),(0x879A),(0x879B),(0x879C);
+INSERT INTO t1 VALUES
+(0xED40),(0xED41),(0xED42),(0xED43),(0xED44),(0xED45),(0xED46),(0xED47),
+(0xED48),(0xED49),(0xED4A),(0xED4B),(0xED4C),(0xED4D),(0xED4E),(0xED4F),
+(0xED50),(0xED51),(0xED52),(0xED53),(0xED54),(0xED55),(0xED56),(0xED57),
+(0xED58),(0xED59),(0xED5A),(0xED5B),(0xED5C),(0xED5D),(0xED5E),(0xED5F),
+(0xED60),(0xED61),(0xED62),(0xED63),(0xED64),(0xED65),(0xED66),(0xED67),
+(0xED68),(0xED69),(0xED6A),(0xED6B),(0xED6C),(0xED6D),(0xED6E),(0xED6F),
+(0xED70),(0xED71),(0xED72),(0xED73),(0xED74),(0xED75),(0xED76),(0xED77),
+(0xED78),(0xED79),(0xED7A),(0xED7B),(0xED7C),(0xED7D),(0xED7E),
+(0xED80),(0xED81),(0xED82),(0xED83),(0xED84),(0xED85),(0xED86),(0xED87),
+(0xED88),(0xED89),(0xED8A),(0xED8B),(0xED8C),(0xED8D),(0xED8E),(0xED8F),
+(0xED90),(0xED91),(0xED92),(0xED93),(0xED94),(0xED95),(0xED96),(0xED97),
+(0xED98),(0xED99),(0xED9A),(0xED9B),(0xED9C),(0xED9D),(0xED9E),(0xED9F),
+(0xEDA0),(0xEDA1),(0xEDA2),(0xEDA3),(0xEDA4),(0xEDA5),(0xEDA6),(0xEDA7),
+(0xEDA8),(0xEDA9),(0xEDAA),(0xEDAB),(0xEDAC),(0xEDAD),(0xEDAE),(0xEDAF),
+(0xEDB0),(0xEDB1),(0xEDB2),(0xEDB3),(0xEDB4),(0xEDB5),(0xEDB6),(0xEDB7),
+(0xEDB8),(0xEDB9),(0xEDBA),(0xEDBB),(0xEDBC),(0xEDBD),(0xEDBE),(0xEDBF),
+(0xEDC0),(0xEDC1),(0xEDC2),(0xEDC3),(0xEDC4),(0xEDC5),(0xEDC6),(0xEDC7),
+(0xEDC8),(0xEDC9),(0xEDCA),(0xEDCB),(0xEDCC),(0xEDCD),(0xEDCE),(0xEDCF),
+(0xEDD0),(0xEDD1),(0xEDD2),(0xEDD3),(0xEDD4),(0xEDD5),(0xEDD6),(0xEDD7),
+(0xEDD8),(0xEDD9),(0xEDDA),(0xEDDB),(0xEDDC),(0xEDDD),(0xEDDE),(0xEDDF),
+(0xEDE0),(0xEDE1),(0xEDE2),(0xEDE3),(0xEDE4),(0xEDE5),(0xEDE6),(0xEDE7),
+(0xEDE8),(0xEDE9),(0xEDEA),(0xEDEB),(0xEDEC),(0xEDED),(0xEDEE),(0xEDEF),
+(0xEDF0),(0xEDF1),(0xEDF2),(0xEDF3),(0xEDF4),(0xEDF5),(0xEDF6),(0xEDF7),
+(0xEDF8),(0xEDF9),(0xEDFA),(0xEDFB),(0xEDFC),
+(0xEE40),(0xEE41),(0xEE42),(0xEE43),(0xEE44),(0xEE45),(0xEE46),(0xEE47),
+(0xEE48),(0xEE49),(0xEE4A),(0xEE4B),(0xEE4C),(0xEE4D),(0xEE4E),(0xEE4F),
+(0xEE50),(0xEE51),(0xEE52),(0xEE53),(0xEE54),(0xEE55),(0xEE56),(0xEE57),
+(0xEE58),(0xEE59),(0xEE5A),(0xEE5B),(0xEE5C),(0xEE5D),(0xEE5E),(0xEE5F),
+(0xEE60),(0xEE61),(0xEE62),(0xEE63),(0xEE64),(0xEE65),(0xEE66),(0xEE67),
+(0xEE68),(0xEE69),(0xEE6A),(0xEE6B),(0xEE6C),(0xEE6D),(0xEE6E),(0xEE6F),
+(0xEE70),(0xEE71),(0xEE72),(0xEE73),(0xEE74),(0xEE75),(0xEE76),(0xEE77),
+(0xEE78),(0xEE79),(0xEE7A),(0xEE7B),(0xEE7C),(0xEE7D),(0xEE7E),
+(0xEE80),(0xEE81),(0xEE82),(0xEE83),(0xEE84),(0xEE85),(0xEE86),(0xEE87),
+(0xEE88),(0xEE89),(0xEE8A),(0xEE8B),(0xEE8C),(0xEE8D),(0xEE8E),(0xEE8F),
+(0xEE90),(0xEE91),(0xEE92),(0xEE93),(0xEE94),(0xEE95),(0xEE96),(0xEE97),
+(0xEE98),(0xEE99),(0xEE9A),(0xEE9B),(0xEE9C),(0xEE9D),(0xEE9E),(0xEE9F),
+(0xEEA0),(0xEEA1),(0xEEA2),(0xEEA3),(0xEEA4),(0xEEA5),(0xEEA6),(0xEEA7),
+(0xEEA8),(0xEEA9),(0xEEAA),(0xEEAB),(0xEEAC),(0xEEAD),(0xEEAE),(0xEEAF),
+(0xEEB0),(0xEEB1),(0xEEB2),(0xEEB3),(0xEEB4),(0xEEB5),(0xEEB6),(0xEEB7),
+(0xEEB8),(0xEEB9),(0xEEBA),(0xEEBB),(0xEEBC),(0xEEBD),(0xEEBE),(0xEEBF),
+(0xEEC0),(0xEEC1),(0xEEC2),(0xEEC3),(0xEEC4),(0xEEC5),(0xEEC6),(0xEEC7),
+(0xEEC8),(0xEEC9),(0xEECA),(0xEECB),(0xEECC),(0xEECD),(0xEECE),(0xEECF),
+(0xEED0),(0xEED1),(0xEED2),(0xEED3),(0xEED4),(0xEED5),(0xEED6),(0xEED7),
+(0xEED8),(0xEED9),(0xEEDA),(0xEEDB),(0xEEDC),(0xEEDD),(0xEEDE),(0xEEDF),
+(0xEEE0),(0xEEE1),(0xEEE2),(0xEEE3),(0xEEE4),(0xEEE5),(0xEEE6),(0xEEE7),
+(0xEEE8),(0xEEE9),(0xEEEA),(0xEEEB),(0xEEEC),(0xEEEF),
+(0xEEF0),(0xEEF1),(0xEEF2),(0xEEF3),(0xEEF4),(0xEEF5),(0xEEF6),(0xEEF7),
+(0xEEF8),(0xEEF9),(0xEEFA),(0xEEFB),(0xEEFC);
+INSERT INTO t1 VALUES
+(0xFA40),(0xFA41),(0xFA42),(0xFA43),(0xFA44),(0xFA45),(0xFA46),(0xFA47),
+(0xFA48),(0xFA49),(0xFA4A),(0xFA4B),(0xFA4C),(0xFA4D),(0xFA4E),(0xFA4F),
+(0xFA50),(0xFA51),(0xFA52),(0xFA53),(0xFA54),(0xFA55),(0xFA56),(0xFA57),
+(0xFA58),(0xFA59),(0xFA5A),(0xFA5B),(0xFA5C),(0xFA5D),(0xFA5E),(0xFA5F),
+(0xFA60),(0xFA61),(0xFA62),(0xFA63),(0xFA64),(0xFA65),(0xFA66),(0xFA67),
+(0xFA68),(0xFA69),(0xFA6A),(0xFA6B),(0xFA6C),(0xFA6D),(0xFA6E),(0xFA6F),
+(0xFA70),(0xFA71),(0xFA72),(0xFA73),(0xFA74),(0xFA75),(0xFA76),(0xFA77),
+(0xFA78),(0xFA79),(0xFA7A),(0xFA7B),(0xFA7C),(0xFA7D),(0xFA7E),
+(0xFA80),(0xFA81),(0xFA82),(0xFA83),(0xFA84),(0xFA85),(0xFA86),(0xFA87),
+(0xFA88),(0xFA89),(0xFA8A),(0xFA8B),(0xFA8C),(0xFA8D),(0xFA8E),(0xFA8F),
+(0xFA90),(0xFA91),(0xFA92),(0xFA93),(0xFA94),(0xFA95),(0xFA96),(0xFA97),
+(0xFA98),(0xFA99),(0xFA9A),(0xFA9B),(0xFA9C),(0xFA9D),(0xFA9E),(0xFA9F),
+(0xFAA0),(0xFAA1),(0xFAA2),(0xFAA3),(0xFAA4),(0xFAA5),(0xFAA6),(0xFAA7),
+(0xFAA8),(0xFAA9),(0xFAAA),(0xFAAB),(0xFAAC),(0xFAAD),(0xFAAE),(0xFAAF),
+(0xFAB0),(0xFAB1),(0xFAB2),(0xFAB3),(0xFAB4),(0xFAB5),(0xFAB6),(0xFAB7),
+(0xFAB8),(0xFAB9),(0xFABA),(0xFABB),(0xFABC),(0xFABD),(0xFABE),(0xFABF),
+(0xFAC0),(0xFAC1),(0xFAC2),(0xFAC3),(0xFAC4),(0xFAC5),(0xFAC6),(0xFAC7),
+(0xFAC8),(0xFAC9),(0xFACA),(0xFACB),(0xFACC),(0xFACD),(0xFACE),(0xFACF),
+(0xFAD0),(0xFAD1),(0xFAD2),(0xFAD3),(0xFAD4),(0xFAD5),(0xFAD6),(0xFAD7),
+(0xFAD8),(0xFAD9),(0xFADA),(0xFADB),(0xFADC),(0xFADD),(0xFADE),(0xFADF),
+(0xFAE0),(0xFAE1),(0xFAE2),(0xFAE3),(0xFAE4),(0xFAE5),(0xFAE6),(0xFAE7),
+(0xFAE8),(0xFAE9),(0xFAEA),(0xFAEB),(0xFAEC),(0xFAED),(0xFAEE),(0xFAEF),
+(0xFAF0),(0xFAF1),(0xFAF2),(0xFAF3),(0xFAF4),(0xFAF5),(0xFAF6),(0xFAF7),
+(0xFAF8),(0xFAF9),(0xFAFA),(0xFAFB),(0xFAFC),
+(0xFB40),(0xFB41),(0xFB42),(0xFB43),(0xFB44),(0xFB45),(0xFB46),(0xFB47),
+(0xFB48),(0xFB49),(0xFB4A),(0xFB4B),(0xFB4C),(0xFB4D),(0xFB4E),(0xFB4F),
+(0xFB50),(0xFB51),(0xFB52),(0xFB53),(0xFB54),(0xFB55),(0xFB56),(0xFB57),
+(0xFB58),(0xFB59),(0xFB5A),(0xFB5B),(0xFB5C),(0xFB5D),(0xFB5E),(0xFB5F),
+(0xFB60),(0xFB61),(0xFB62),(0xFB63),(0xFB64),(0xFB65),(0xFB66),(0xFB67),
+(0xFB68),(0xFB69),(0xFB6A),(0xFB6B),(0xFB6C),(0xFB6D),(0xFB6E),(0xFB6F),
+(0xFB70),(0xFB71),(0xFB72),(0xFB73),(0xFB74),(0xFB75),(0xFB76),(0xFB77),
+(0xFB78),(0xFB79),(0xFB7A),(0xFB7B),(0xFB7C),(0xFB7D),(0xFB7E),
+(0xFB80),(0xFB81),(0xFB82),(0xFB83),(0xFB84),(0xFB85),(0xFB86),(0xFB87),
+(0xFB88),(0xFB89),(0xFB8A),(0xFB8B),(0xFB8C),(0xFB8D),(0xFB8E),(0xFB8F),
+(0xFB90),(0xFB91),(0xFB92),(0xFB93),(0xFB94),(0xFB95),(0xFB96),(0xFB97),
+(0xFB98),(0xFB99),(0xFB9A),(0xFB9B),(0xFB9C),(0xFB9D),(0xFB9E),(0xFB9F),
+(0xFBA0),(0xFBA1),(0xFBA2),(0xFBA3),(0xFBA4),(0xFBA5),(0xFBA6),(0xFBA7),
+(0xFBA8),(0xFBA9),(0xFBAA),(0xFBAB),(0xFBAC),(0xFBAD),(0xFBAE),(0xFBAF),
+(0xFBB0),(0xFBB1),(0xFBB2),(0xFBB3),(0xFBB4),(0xFBB5),(0xFBB6),(0xFBB7),
+(0xFBB8),(0xFBB9),(0xFBBA),(0xFBBB),(0xFBBC),(0xFBBD),(0xFBBE),(0xFBBF),
+(0xFBC0),(0xFBC1),(0xFBC2),(0xFBC3),(0xFBC4),(0xFBC5),(0xFBC6),(0xFBC7),
+(0xFBC8),(0xFBC9),(0xFBCA),(0xFBCB),(0xFBCC),(0xFBCD),(0xFBCE),(0xFBCF),
+(0xFBD0),(0xFBD1),(0xFBD2),(0xFBD3),(0xFBD4),(0xFBD5),(0xFBD6),(0xFBD7),
+(0xFBD8),(0xFBD9),(0xFBDA),(0xFBDB),(0xFBDC),(0xFBDD),(0xFBDE),(0xFBDF),
+(0xFBE0),(0xFBE1),(0xFBE2),(0xFBE3),(0xFBE4),(0xFBE5),(0xFBE6),(0xFBE7),
+(0xFBE8),(0xFBE9),(0xFBEA),(0xFBEB),(0xFBEC),(0xFBED),(0xFBEE),(0xFBEF),
+(0xFBF0),(0xFBF1),(0xFBF2),(0xFBF3),(0xFBF4),(0xFBF5),(0xFBF6),(0xFBF7),
+(0xFBF8),(0xFBF9),(0xFBFA),(0xFBFB),(0xFBFC),
+(0xFC40),(0xFC41),(0xFC42),(0xFC43),(0xFC44),(0xFC45),(0xFC46),(0xFC47),
+(0xFC48),(0xFC49),(0xFC4A),(0xFC4B);
+INSERT INTO t1 VALUES
+(0xF040),(0xF041),(0xF042),(0xF043),(0xF044),(0xF045),(0xF046),(0xF047),
+(0xF048),(0xF049),(0xF04A),(0xF04B),(0xF04C),(0xF04D),(0xF04E),(0xF04F),
+(0xF050),(0xF051),(0xF052),(0xF053),(0xF054),(0xF055),(0xF056),(0xF057),
+(0xF058),(0xF059),(0xF05A),(0xF05B),(0xF05C),(0xF05D),(0xF05E),(0xF05F),
+(0xF060),(0xF061),(0xF062),(0xF063),(0xF064),(0xF065),(0xF066),(0xF067),
+(0xF068),(0xF069),(0xF06A),(0xF06B),(0xF06C),(0xF06D),(0xF06E),(0xF06F),
+(0xF070),(0xF071),(0xF072),(0xF073),(0xF074),(0xF075),(0xF076),(0xF077),
+(0xF078),(0xF079),(0xF07A),(0xF07B),(0xF07C),(0xF07D),(0xF07E),
+(0xF080),(0xF081),(0xF082),(0xF083),(0xF084),(0xF085),(0xF086),(0xF087),
+(0xF088),(0xF089),(0xF08A),(0xF08B),(0xF08C),(0xF08D),(0xF08E),(0xF08F),
+(0xF090),(0xF091),(0xF092),(0xF093),(0xF094),(0xF095),(0xF096),(0xF097),
+(0xF098),(0xF099),(0xF09A),(0xF09B),(0xF09C),(0xF09D),(0xF09E),(0xF09F),
+(0xF0A0),(0xF0A1),(0xF0A2),(0xF0A3),(0xF0A4),(0xF0A5),(0xF0A6),(0xF0A7),
+(0xF0A8),(0xF0A9),(0xF0AA),(0xF0AB),(0xF0AC),(0xF0AD),(0xF0AE),(0xF0AF),
+(0xF0B0),(0xF0B1),(0xF0B2),(0xF0B3),(0xF0B4),(0xF0B5),(0xF0B6),(0xF0B7),
+(0xF0B8),(0xF0B9),(0xF0BA),(0xF0BB),(0xF0BC),(0xF0BD),(0xF0BE),(0xF0BF),
+(0xF0C0),(0xF0C1),(0xF0C2),(0xF0C3),(0xF0C4),(0xF0C5),(0xF0C6),(0xF0C7),
+(0xF0C8),(0xF0C9),(0xF0CA),(0xF0CB),(0xF0CC),(0xF0CD),(0xF0CE),(0xF0CF),
+(0xF0D0),(0xF0D1),(0xF0D2),(0xF0D3),(0xF0D4),(0xF0D5),(0xF0D6),(0xF0D7),
+(0xF0D8),(0xF0D9),(0xF0DA),(0xF0DB),(0xF0DC),(0xF0DD),(0xF0DE),(0xF0DF),
+(0xF0E0),(0xF0E1),(0xF0E2),(0xF0E3),(0xF0E4),(0xF0E5),(0xF0E6),(0xF0E7),
+(0xF0E8),(0xF0E9),(0xF0EA),(0xF0EB),(0xF0EC),(0xF0ED),(0xF0EE),(0xF0EF),
+(0xF0F0),(0xF0F1),(0xF0F2),(0xF0F3),(0xF0F4),(0xF0F5),(0xF0F6),(0xF0F7),
+(0xF0F8),(0xF0F9),(0xF0FA),(0xF0FB),(0xF0FC),
+(0xF140),(0xF141),(0xF142),(0xF143),(0xF144),(0xF145),(0xF146),(0xF147),
+(0xF148),(0xF149),(0xF14A),(0xF14B),(0xF14C),(0xF14D),(0xF14E),(0xF14F),
+(0xF150),(0xF151),(0xF152),(0xF153),(0xF154),(0xF155),(0xF156),(0xF157),
+(0xF158),(0xF159),(0xF15A),(0xF15B),(0xF15C),(0xF15D),(0xF15E),(0xF15F),
+(0xF160),(0xF161),(0xF162),(0xF163),(0xF164),(0xF165),(0xF166),(0xF167),
+(0xF168),(0xF169),(0xF16A),(0xF16B),(0xF16C),(0xF16D),(0xF16E),(0xF16F),
+(0xF170),(0xF171),(0xF172),(0xF173),(0xF174),(0xF175),(0xF176),(0xF177),
+(0xF178),(0xF179),(0xF17A),(0xF17B),(0xF17C),(0xF17D),(0xF17E),
+(0xF180),(0xF181),(0xF182),(0xF183),(0xF184),(0xF185),(0xF186),(0xF187),
+(0xF188),(0xF189),(0xF18A),(0xF18B),(0xF18C),(0xF18D),(0xF18E),(0xF18F),
+(0xF190),(0xF191),(0xF192),(0xF193),(0xF194),(0xF195),(0xF196),(0xF197),
+(0xF198),(0xF199),(0xF19A),(0xF19B),(0xF19C),(0xF19D),(0xF19E),(0xF19F),
+(0xF1A0),(0xF1A1),(0xF1A2),(0xF1A3),(0xF1A4),(0xF1A5),(0xF1A6),(0xF1A7),
+(0xF1A8),(0xF1A9),(0xF1AA),(0xF1AB),(0xF1AC),(0xF1AD),(0xF1AE),(0xF1AF),
+(0xF1B0),(0xF1B1),(0xF1B2),(0xF1B3),(0xF1B4),(0xF1B5),(0xF1B6),(0xF1B7),
+(0xF1B8),(0xF1B9),(0xF1BA),(0xF1BB),(0xF1BC),(0xF1BD),(0xF1BE),(0xF1BF),
+(0xF1C0),(0xF1C1),(0xF1C2),(0xF1C3),(0xF1C4),(0xF1C5),(0xF1C6),(0xF1C7),
+(0xF1C8),(0xF1C9),(0xF1CA),(0xF1CB),(0xF1CC),(0xF1CD),(0xF1CE),(0xF1CF),
+(0xF1D0),(0xF1D1),(0xF1D2),(0xF1D3),(0xF1D4),(0xF1D5),(0xF1D6),(0xF1D7),
+(0xF1D8),(0xF1D9),(0xF1DA),(0xF1DB),(0xF1DC),(0xF1DD),(0xF1DE),(0xF1DF),
+(0xF1E0),(0xF1E1),(0xF1E2),(0xF1E3),(0xF1E4),(0xF1E5),(0xF1E6),(0xF1E7),
+(0xF1E8),(0xF1E9),(0xF1EA),(0xF1EB),(0xF1EC),(0xF1ED),(0xF1EE),(0xF1EF),
+(0xF1F0),(0xF1F1),(0xF1F2),(0xF1F3),(0xF1F4),(0xF1F5),(0xF1F6),(0xF1F7),
+(0xF1F8),(0xF1F9),(0xF1FA),(0xF1FB),(0xF1FC),
+(0xF240),(0xF241),(0xF242),(0xF243),(0xF244),(0xF245),(0xF246),(0xF247),
+(0xF248),(0xF249),(0xF24A),(0xF24B),(0xF24C),(0xF24D),(0xF24E),(0xF24F),
+(0xF250),(0xF251),(0xF252),(0xF253),(0xF254),(0xF255),(0xF256),(0xF257),
+(0xF258),(0xF259),(0xF25A),(0xF25B),(0xF25C),(0xF25D),(0xF25E),(0xF25F),
+(0xF260),(0xF261),(0xF262),(0xF263),(0xF264),(0xF265),(0xF266),(0xF267),
+(0xF268),(0xF269),(0xF26A),(0xF26B),(0xF26C),(0xF26D),(0xF26E),(0xF26F),
+(0xF270),(0xF271),(0xF272),(0xF273),(0xF274),(0xF275),(0xF276),(0xF277),
+(0xF278),(0xF279),(0xF27A),(0xF27B),(0xF27C),(0xF27D),(0xF27E),
+(0xF280),(0xF281),(0xF282),(0xF283),(0xF284),(0xF285),(0xF286),(0xF287),
+(0xF288),(0xF289),(0xF28A),(0xF28B),(0xF28C),(0xF28D),(0xF28E),(0xF28F),
+(0xF290),(0xF291),(0xF292),(0xF293),(0xF294),(0xF295),(0xF296),(0xF297),
+(0xF298),(0xF299),(0xF29A),(0xF29B),(0xF29C),(0xF29D),(0xF29E),(0xF29F),
+(0xF2A0),(0xF2A1),(0xF2A2),(0xF2A3),(0xF2A4),(0xF2A5),(0xF2A6),(0xF2A7),
+(0xF2A8),(0xF2A9),(0xF2AA),(0xF2AB),(0xF2AC),(0xF2AD),(0xF2AE),(0xF2AF),
+(0xF2B0),(0xF2B1),(0xF2B2),(0xF2B3),(0xF2B4),(0xF2B5),(0xF2B6),(0xF2B7),
+(0xF2B8),(0xF2B9),(0xF2BA),(0xF2BB),(0xF2BC),(0xF2BD),(0xF2BE),(0xF2BF),
+(0xF2C0),(0xF2C1),(0xF2C2),(0xF2C3),(0xF2C4),(0xF2C5),(0xF2C6),(0xF2C7),
+(0xF2C8),(0xF2C9),(0xF2CA),(0xF2CB),(0xF2CC),(0xF2CD),(0xF2CE),(0xF2CF),
+(0xF2D0),(0xF2D1),(0xF2D2),(0xF2D3),(0xF2D4),(0xF2D5),(0xF2D6),(0xF2D7),
+(0xF2D8),(0xF2D9),(0xF2DA),(0xF2DB),(0xF2DC),(0xF2DD),(0xF2DE),(0xF2DF),
+(0xF2E0),(0xF2E1),(0xF2E2),(0xF2E3),(0xF2E4),(0xF2E5),(0xF2E6),(0xF2E7),
+(0xF2E8),(0xF2E9),(0xF2EA),(0xF2EB),(0xF2EC),(0xF2ED),(0xF2EE),(0xF2EF),
+(0xF2F0),(0xF2F1),(0xF2F2),(0xF2F3),(0xF2F4),(0xF2F5),(0xF2F6),(0xF2F7),
+(0xF2F8),(0xF2F9),(0xF2FA),(0xF2FB),(0xF2FC),
+(0xF340),(0xF341),(0xF342),(0xF343),(0xF344),(0xF345),(0xF346),(0xF347),
+(0xF348),(0xF349),(0xF34A),(0xF34B),(0xF34C),(0xF34D),(0xF34E),(0xF34F),
+(0xF350),(0xF351),(0xF352),(0xF353),(0xF354),(0xF355),(0xF356),(0xF357),
+(0xF358),(0xF359),(0xF35A),(0xF35B),(0xF35C),(0xF35D),(0xF35E),(0xF35F),
+(0xF360),(0xF361),(0xF362),(0xF363),(0xF364),(0xF365),(0xF366),(0xF367),
+(0xF368),(0xF369),(0xF36A),(0xF36B),(0xF36C),(0xF36D),(0xF36E),(0xF36F),
+(0xF370),(0xF371),(0xF372),(0xF373),(0xF374),(0xF375),(0xF376),(0xF377),
+(0xF378),(0xF379),(0xF37A),(0xF37B),(0xF37C),(0xF37D),(0xF37E),
+(0xF380),(0xF381),(0xF382),(0xF383),(0xF384),(0xF385),(0xF386),(0xF387),
+(0xF388),(0xF389),(0xF38A),(0xF38B),(0xF38C),(0xF38D),(0xF38E),(0xF38F),
+(0xF390),(0xF391),(0xF392),(0xF393),(0xF394),(0xF395),(0xF396),(0xF397),
+(0xF398),(0xF399),(0xF39A),(0xF39B),(0xF39C),(0xF39D),(0xF39E),(0xF39F),
+(0xF3A0),(0xF3A1),(0xF3A2),(0xF3A3),(0xF3A4),(0xF3A5),(0xF3A6),(0xF3A7),
+(0xF3A8),(0xF3A9),(0xF3AA),(0xF3AB),(0xF3AC),(0xF3AD),(0xF3AE),(0xF3AF),
+(0xF3B0),(0xF3B1),(0xF3B2),(0xF3B3),(0xF3B4),(0xF3B5),(0xF3B6),(0xF3B7),
+(0xF3B8),(0xF3B9),(0xF3BA),(0xF3BB),(0xF3BC),(0xF3BD),(0xF3BE),(0xF3BF),
+(0xF3C0),(0xF3C1),(0xF3C2),(0xF3C3),(0xF3C4),(0xF3C5),(0xF3C6),(0xF3C7),
+(0xF3C8),(0xF3C9),(0xF3CA),(0xF3CB),(0xF3CC),(0xF3CD),(0xF3CE),(0xF3CF),
+(0xF3D0),(0xF3D1),(0xF3D2),(0xF3D3),(0xF3D4),(0xF3D5),(0xF3D6),(0xF3D7),
+(0xF3D8),(0xF3D9),(0xF3DA),(0xF3DB),(0xF3DC),(0xF3DD),(0xF3DE),(0xF3DF),
+(0xF3E0),(0xF3E1),(0xF3E2),(0xF3E3),(0xF3E4),(0xF3E5),(0xF3E6),(0xF3E7),
+(0xF3E8),(0xF3E9),(0xF3EA),(0xF3EB),(0xF3EC),(0xF3ED),(0xF3EE),(0xF3EF),
+(0xF3F0),(0xF3F1),(0xF3F2),(0xF3F3),(0xF3F4),(0xF3F5),(0xF3F6),(0xF3F7),
+(0xF3F8),(0xF3F9),(0xF3FA),(0xF3FB),(0xF3FC),
+(0xF440),(0xF441),(0xF442),(0xF443),(0xF444),(0xF445),(0xF446),(0xF447),
+(0xF448),(0xF449),(0xF44A),(0xF44B),(0xF44C),(0xF44D),(0xF44E),(0xF44F),
+(0xF450),(0xF451),(0xF452),(0xF453),(0xF454),(0xF455),(0xF456),(0xF457),
+(0xF458),(0xF459),(0xF45A),(0xF45B),(0xF45C),(0xF45D),(0xF45E),(0xF45F),
+(0xF460),(0xF461),(0xF462),(0xF463),(0xF464),(0xF465),(0xF466),(0xF467),
+(0xF468),(0xF469),(0xF46A),(0xF46B),(0xF46C),(0xF46D),(0xF46E),(0xF46F),
+(0xF470),(0xF471),(0xF472),(0xF473),(0xF474),(0xF475),(0xF476),(0xF477),
+(0xF478),(0xF479),(0xF47A),(0xF47B),(0xF47C),(0xF47D),(0xF47E),
+(0xF480),(0xF481),(0xF482),(0xF483),(0xF484),(0xF485),(0xF486),(0xF487),
+(0xF488),(0xF489),(0xF48A),(0xF48B),(0xF48C),(0xF48D),(0xF48E),(0xF48F),
+(0xF490),(0xF491),(0xF492),(0xF493),(0xF494),(0xF495),(0xF496),(0xF497),
+(0xF498),(0xF499),(0xF49A),(0xF49B),(0xF49C),(0xF49D),(0xF49E),(0xF49F),
+(0xF4A0),(0xF4A1),(0xF4A2),(0xF4A3),(0xF4A4),(0xF4A5),(0xF4A6),(0xF4A7),
+(0xF4A8),(0xF4A9),(0xF4AA),(0xF4AB),(0xF4AC),(0xF4AD),(0xF4AE),(0xF4AF),
+(0xF4B0),(0xF4B1),(0xF4B2),(0xF4B3),(0xF4B4),(0xF4B5),(0xF4B6),(0xF4B7),
+(0xF4B8),(0xF4B9),(0xF4BA),(0xF4BB),(0xF4BC),(0xF4BD),(0xF4BE),(0xF4BF),
+(0xF4C0),(0xF4C1),(0xF4C2),(0xF4C3),(0xF4C4),(0xF4C5),(0xF4C6),(0xF4C7),
+(0xF4C8),(0xF4C9),(0xF4CA),(0xF4CB),(0xF4CC),(0xF4CD),(0xF4CE),(0xF4CF),
+(0xF4D0),(0xF4D1),(0xF4D2),(0xF4D3),(0xF4D4),(0xF4D5),(0xF4D6),(0xF4D7),
+(0xF4D8),(0xF4D9),(0xF4DA),(0xF4DB),(0xF4DC),(0xF4DD),(0xF4DE),(0xF4DF),
+(0xF4E0),(0xF4E1),(0xF4E2),(0xF4E3),(0xF4E4),(0xF4E5),(0xF4E6),(0xF4E7),
+(0xF4E8),(0xF4E9),(0xF4EA),(0xF4EB),(0xF4EC),(0xF4ED),(0xF4EE),(0xF4EF),
+(0xF4F0),(0xF4F1),(0xF4F2),(0xF4F3),(0xF4F4),(0xF4F5),(0xF4F6),(0xF4F7),
+(0xF4F8),(0xF4F9),(0xF4FA),(0xF4FB),(0xF4FC),
+(0xF540),(0xF541),(0xF542),(0xF543),(0xF544),(0xF545),(0xF546),(0xF547),
+(0xF548),(0xF549),(0xF54A),(0xF54B),(0xF54C),(0xF54D),(0xF54E),(0xF54F),
+(0xF550),(0xF551),(0xF552),(0xF553),(0xF554),(0xF555),(0xF556),(0xF557),
+(0xF558),(0xF559),(0xF55A),(0xF55B),(0xF55C),(0xF55D),(0xF55E),(0xF55F),
+(0xF560),(0xF561),(0xF562),(0xF563),(0xF564),(0xF565),(0xF566),(0xF567),
+(0xF568),(0xF569),(0xF56A),(0xF56B),(0xF56C),(0xF56D),(0xF56E),(0xF56F),
+(0xF570),(0xF571),(0xF572),(0xF573),(0xF574),(0xF575),(0xF576),(0xF577),
+(0xF578),(0xF579),(0xF57A),(0xF57B),(0xF57C),(0xF57D),(0xF57E),
+(0xF580),(0xF581),(0xF582),(0xF583),(0xF584),(0xF585),(0xF586),(0xF587),
+(0xF588),(0xF589),(0xF58A),(0xF58B),(0xF58C),(0xF58D),(0xF58E),(0xF58F),
+(0xF590),(0xF591),(0xF592),(0xF593),(0xF594),(0xF595),(0xF596),(0xF597),
+(0xF598),(0xF599),(0xF59A),(0xF59B),(0xF59C),(0xF59D),(0xF59E),(0xF59F),
+(0xF5A0),(0xF5A1),(0xF5A2),(0xF5A3),(0xF5A4),(0xF5A5),(0xF5A6),(0xF5A7),
+(0xF5A8),(0xF5A9),(0xF5AA),(0xF5AB),(0xF5AC),(0xF5AD),(0xF5AE),(0xF5AF),
+(0xF5B0),(0xF5B1),(0xF5B2),(0xF5B3),(0xF5B4),(0xF5B5),(0xF5B6),(0xF5B7),
+(0xF5B8),(0xF5B9),(0xF5BA),(0xF5BB),(0xF5BC),(0xF5BD),(0xF5BE),(0xF5BF),
+(0xF5C0),(0xF5C1),(0xF5C2),(0xF5C3),(0xF5C4),(0xF5C5),(0xF5C6),(0xF5C7),
+(0xF5C8),(0xF5C9),(0xF5CA),(0xF5CB),(0xF5CC),(0xF5CD),(0xF5CE),(0xF5CF),
+(0xF5D0),(0xF5D1),(0xF5D2),(0xF5D3),(0xF5D4),(0xF5D5),(0xF5D6),(0xF5D7),
+(0xF5D8),(0xF5D9),(0xF5DA),(0xF5DB),(0xF5DC),(0xF5DD),(0xF5DE),(0xF5DF),
+(0xF5E0),(0xF5E1),(0xF5E2),(0xF5E3),(0xF5E4),(0xF5E5),(0xF5E6),(0xF5E7),
+(0xF5E8),(0xF5E9),(0xF5EA),(0xF5EB),(0xF5EC),(0xF5ED),(0xF5EE),(0xF5EF),
+(0xF5F0),(0xF5F1),(0xF5F2),(0xF5F3),(0xF5F4),(0xF5F5),(0xF5F6),(0xF5F7),
+(0xF5F8),(0xF5F9),(0xF5FA),(0xF5FB),(0xF5FC),
+(0xF640),(0xF641),(0xF642),(0xF643),(0xF644),(0xF645),(0xF646),(0xF647),
+(0xF648),(0xF649),(0xF64A),(0xF64B),(0xF64C),(0xF64D),(0xF64E),(0xF64F),
+(0xF650),(0xF651),(0xF652),(0xF653),(0xF654),(0xF655),(0xF656),(0xF657),
+(0xF658),(0xF659),(0xF65A),(0xF65B),(0xF65C),(0xF65D),(0xF65E),(0xF65F),
+(0xF660),(0xF661),(0xF662),(0xF663),(0xF664),(0xF665),(0xF666),(0xF667),
+(0xF668),(0xF669),(0xF66A),(0xF66B),(0xF66C),(0xF66D),(0xF66E),(0xF66F),
+(0xF670),(0xF671),(0xF672),(0xF673),(0xF674),(0xF675),(0xF676),(0xF677),
+(0xF678),(0xF679),(0xF67A),(0xF67B),(0xF67C),(0xF67D),(0xF67E),
+(0xF680),(0xF681),(0xF682),(0xF683),(0xF684),(0xF685),(0xF686),(0xF687),
+(0xF688),(0xF689),(0xF68A),(0xF68B),(0xF68C),(0xF68D),(0xF68E),(0xF68F),
+(0xF690),(0xF691),(0xF692),(0xF693),(0xF694),(0xF695),(0xF696),(0xF697),
+(0xF698),(0xF699),(0xF69A),(0xF69B),(0xF69C),(0xF69D),(0xF69E),(0xF69F),
+(0xF6A0),(0xF6A1),(0xF6A2),(0xF6A3),(0xF6A4),(0xF6A5),(0xF6A6),(0xF6A7),
+(0xF6A8),(0xF6A9),(0xF6AA),(0xF6AB),(0xF6AC),(0xF6AD),(0xF6AE),(0xF6AF),
+(0xF6B0),(0xF6B1),(0xF6B2),(0xF6B3),(0xF6B4),(0xF6B5),(0xF6B6),(0xF6B7),
+(0xF6B8),(0xF6B9),(0xF6BA),(0xF6BB),(0xF6BC),(0xF6BD),(0xF6BE),(0xF6BF),
+(0xF6C0),(0xF6C1),(0xF6C2),(0xF6C3),(0xF6C4),(0xF6C5),(0xF6C6),(0xF6C7),
+(0xF6C8),(0xF6C9),(0xF6CA),(0xF6CB),(0xF6CC),(0xF6CD),(0xF6CE),(0xF6CF),
+(0xF6D0),(0xF6D1),(0xF6D2),(0xF6D3),(0xF6D4),(0xF6D5),(0xF6D6),(0xF6D7),
+(0xF6D8),(0xF6D9),(0xF6DA),(0xF6DB),(0xF6DC),(0xF6DD),(0xF6DE),(0xF6DF),
+(0xF6E0),(0xF6E1),(0xF6E2),(0xF6E3),(0xF6E4),(0xF6E5),(0xF6E6),(0xF6E7),
+(0xF6E8),(0xF6E9),(0xF6EA),(0xF6EB),(0xF6EC),(0xF6ED),(0xF6EE),(0xF6EF),
+(0xF6F0),(0xF6F1),(0xF6F2),(0xF6F3),(0xF6F4),(0xF6F5),(0xF6F6),(0xF6F7),
+(0xF6F8),(0xF6F9),(0xF6FA),(0xF6FB),(0xF6FC),
+(0xF740),(0xF741),(0xF742),(0xF743),(0xF744),(0xF745),(0xF746),(0xF747),
+(0xF748),(0xF749),(0xF74A),(0xF74B),(0xF74C),(0xF74D),(0xF74E),(0xF74F),
+(0xF750),(0xF751),(0xF752),(0xF753),(0xF754),(0xF755),(0xF756),(0xF757),
+(0xF758),(0xF759),(0xF75A),(0xF75B),(0xF75C),(0xF75D),(0xF75E),(0xF75F),
+(0xF760),(0xF761),(0xF762),(0xF763),(0xF764),(0xF765),(0xF766),(0xF767),
+(0xF768),(0xF769),(0xF76A),(0xF76B),(0xF76C),(0xF76D),(0xF76E),(0xF76F),
+(0xF770),(0xF771),(0xF772),(0xF773),(0xF774),(0xF775),(0xF776),(0xF777),
+(0xF778),(0xF779),(0xF77A),(0xF77B),(0xF77C),(0xF77D),(0xF77E),
+(0xF780),(0xF781),(0xF782),(0xF783),(0xF784),(0xF785),(0xF786),(0xF787),
+(0xF788),(0xF789),(0xF78A),(0xF78B),(0xF78C),(0xF78D),(0xF78E),(0xF78F),
+(0xF790),(0xF791),(0xF792),(0xF793),(0xF794),(0xF795),(0xF796),(0xF797),
+(0xF798),(0xF799),(0xF79A),(0xF79B),(0xF79C),(0xF79D),(0xF79E),(0xF79F),
+(0xF7A0),(0xF7A1),(0xF7A2),(0xF7A3),(0xF7A4),(0xF7A5),(0xF7A6),(0xF7A7),
+(0xF7A8),(0xF7A9),(0xF7AA),(0xF7AB),(0xF7AC),(0xF7AD),(0xF7AE),(0xF7AF),
+(0xF7B0),(0xF7B1),(0xF7B2),(0xF7B3),(0xF7B4),(0xF7B5),(0xF7B6),(0xF7B7),
+(0xF7B8),(0xF7B9),(0xF7BA),(0xF7BB),(0xF7BC),(0xF7BD),(0xF7BE),(0xF7BF),
+(0xF7C0),(0xF7C1),(0xF7C2),(0xF7C3),(0xF7C4),(0xF7C5),(0xF7C6),(0xF7C7),
+(0xF7C8),(0xF7C9),(0xF7CA),(0xF7CB),(0xF7CC),(0xF7CD),(0xF7CE),(0xF7CF),
+(0xF7D0),(0xF7D1),(0xF7D2),(0xF7D3),(0xF7D4),(0xF7D5),(0xF7D6),(0xF7D7),
+(0xF7D8),(0xF7D9),(0xF7DA),(0xF7DB),(0xF7DC),(0xF7DD),(0xF7DE),(0xF7DF),
+(0xF7E0),(0xF7E1),(0xF7E2),(0xF7E3),(0xF7E4),(0xF7E5),(0xF7E6),(0xF7E7),
+(0xF7E8),(0xF7E9),(0xF7EA),(0xF7EB),(0xF7EC),(0xF7ED),(0xF7EE),(0xF7EF),
+(0xF7F0),(0xF7F1),(0xF7F2),(0xF7F3),(0xF7F4),(0xF7F5),(0xF7F6),(0xF7F7),
+(0xF7F8),(0xF7F9),(0xF7FA),(0xF7FB),(0xF7FC),
+(0xF840),(0xF841),(0xF842),(0xF843),(0xF844),(0xF845),(0xF846),(0xF847),
+(0xF848),(0xF849),(0xF84A),(0xF84B),(0xF84C),(0xF84D),(0xF84E),(0xF84F),
+(0xF850),(0xF851),(0xF852),(0xF853),(0xF854),(0xF855),(0xF856),(0xF857),
+(0xF858),(0xF859),(0xF85A),(0xF85B),(0xF85C),(0xF85D),(0xF85E),(0xF85F),
+(0xF860),(0xF861),(0xF862),(0xF863),(0xF864),(0xF865),(0xF866),(0xF867),
+(0xF868),(0xF869),(0xF86A),(0xF86B),(0xF86C),(0xF86D),(0xF86E),(0xF86F),
+(0xF870),(0xF871),(0xF872),(0xF873),(0xF874),(0xF875),(0xF876),(0xF877),
+(0xF878),(0xF879),(0xF87A),(0xF87B),(0xF87C),(0xF87D),(0xF87E),
+(0xF880),(0xF881),(0xF882),(0xF883),(0xF884),(0xF885),(0xF886),(0xF887),
+(0xF888),(0xF889),(0xF88A),(0xF88B),(0xF88C),(0xF88D),(0xF88E),(0xF88F),
+(0xF890),(0xF891),(0xF892),(0xF893),(0xF894),(0xF895),(0xF896),(0xF897),
+(0xF898),(0xF899),(0xF89A),(0xF89B),(0xF89C),(0xF89D),(0xF89E),(0xF89F),
+(0xF8A0),(0xF8A1),(0xF8A2),(0xF8A3),(0xF8A4),(0xF8A5),(0xF8A6),(0xF8A7),
+(0xF8A8),(0xF8A9),(0xF8AA),(0xF8AB),(0xF8AC),(0xF8AD),(0xF8AE),(0xF8AF),
+(0xF8B0),(0xF8B1),(0xF8B2),(0xF8B3),(0xF8B4),(0xF8B5),(0xF8B6),(0xF8B7),
+(0xF8B8),(0xF8B9),(0xF8BA),(0xF8BB),(0xF8BC),(0xF8BD),(0xF8BE),(0xF8BF),
+(0xF8C0),(0xF8C1),(0xF8C2),(0xF8C3),(0xF8C4),(0xF8C5),(0xF8C6),(0xF8C7),
+(0xF8C8),(0xF8C9),(0xF8CA),(0xF8CB),(0xF8CC),(0xF8CD),(0xF8CE),(0xF8CF),
+(0xF8D0),(0xF8D1),(0xF8D2),(0xF8D3),(0xF8D4),(0xF8D5),(0xF8D6),(0xF8D7),
+(0xF8D8),(0xF8D9),(0xF8DA),(0xF8DB),(0xF8DC),(0xF8DD),(0xF8DE),(0xF8DF),
+(0xF8E0),(0xF8E1),(0xF8E2),(0xF8E3),(0xF8E4),(0xF8E5),(0xF8E6),(0xF8E7),
+(0xF8E8),(0xF8E9),(0xF8EA),(0xF8EB),(0xF8EC),(0xF8ED),(0xF8EE),(0xF8EF),
+(0xF8F0),(0xF8F1),(0xF8F2),(0xF8F3),(0xF8F4),(0xF8F5),(0xF8F6),(0xF8F7),
+(0xF8F8),(0xF8F9),(0xF8FA),(0xF8FB),(0xF8FC),
+(0xF940),(0xF941),(0xF942),(0xF943),(0xF944),(0xF945),(0xF946),(0xF947),
+(0xF948),(0xF949),(0xF94A),(0xF94B),(0xF94C),(0xF94D),(0xF94E),(0xF94F),
+(0xF950),(0xF951),(0xF952),(0xF953),(0xF954),(0xF955),(0xF956),(0xF957),
+(0xF958),(0xF959),(0xF95A),(0xF95B),(0xF95C),(0xF95D),(0xF95E),(0xF95F),
+(0xF960),(0xF961),(0xF962),(0xF963),(0xF964),(0xF965),(0xF966),(0xF967),
+(0xF968),(0xF969),(0xF96A),(0xF96B),(0xF96C),(0xF96D),(0xF96E),(0xF96F),
+(0xF970),(0xF971),(0xF972),(0xF973),(0xF974),(0xF975),(0xF976),(0xF977),
+(0xF978),(0xF979),(0xF97A),(0xF97B),(0xF97C),(0xF97D),(0xF97E),
+(0xF980),(0xF981),(0xF982),(0xF983),(0xF984),(0xF985),(0xF986),(0xF987),
+(0xF988),(0xF989),(0xF98A),(0xF98B),(0xF98C),(0xF98D),(0xF98E),(0xF98F),
+(0xF990),(0xF991),(0xF992),(0xF993),(0xF994),(0xF995),(0xF996),(0xF997),
+(0xF998),(0xF999),(0xF99A),(0xF99B),(0xF99C),(0xF99D),(0xF99E),(0xF99F),
+(0xF9A0),(0xF9A1),(0xF9A2),(0xF9A3),(0xF9A4),(0xF9A5),(0xF9A6),(0xF9A7),
+(0xF9A8),(0xF9A9),(0xF9AA),(0xF9AB),(0xF9AC),(0xF9AD),(0xF9AE),(0xF9AF),
+(0xF9B0),(0xF9B1),(0xF9B2),(0xF9B3),(0xF9B4),(0xF9B5),(0xF9B6),(0xF9B7),
+(0xF9B8),(0xF9B9),(0xF9BA),(0xF9BB),(0xF9BC),(0xF9BD),(0xF9BE),(0xF9BF),
+(0xF9C0),(0xF9C1),(0xF9C2),(0xF9C3),(0xF9C4),(0xF9C5),(0xF9C6),(0xF9C7),
+(0xF9C8),(0xF9C9),(0xF9CA),(0xF9CB),(0xF9CC),(0xF9CD),(0xF9CE),(0xF9CF),
+(0xF9D0),(0xF9D1),(0xF9D2),(0xF9D3),(0xF9D4),(0xF9D5),(0xF9D6),(0xF9D7),
+(0xF9D8),(0xF9D9),(0xF9DA),(0xF9DB),(0xF9DC),(0xF9DD),(0xF9DE),(0xF9DF),
+(0xF9E0),(0xF9E1),(0xF9E2),(0xF9E3),(0xF9E4),(0xF9E5),(0xF9E6),(0xF9E7),
+(0xF9E8),(0xF9E9),(0xF9EA),(0xF9EB),(0xF9EC),(0xF9ED),(0xF9EE),(0xF9EF),
+(0xF9F0),(0xF9F1),(0xF9F2),(0xF9F3),(0xF9F4),(0xF9F5),(0xF9F6),(0xF9F7),
+(0xF9F8),(0xF9F9),(0xF9FA),(0xF9FB),(0xF9FC);
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+05
+7E
+815C
+815F
+8160
+8161
+817C
+8191
+8192
+81CA
+8740
+8741
+8742
+8743
+8744
+8745
+8746
+8747
+8748
+8749
+874A
+874B
+874C
+874D
+874E
+874F
+8750
+8751
+8752
+8753
+8754
+8755
+8756
+8757
+8758
+8759
+875A
+875B
+875C
+875D
+875F
+8760
+8761
+8762
+8763
+8764
+8765
+8766
+8767
+8768
+8769
+876A
+876B
+876C
+876D
+876E
+876F
+8770
+8771
+8772
+8773
+8774
+8775
+877E
+8780
+8781
+8782
+8783
+8784
+8785
+8786
+8787
+8788
+8789
+878A
+878B
+878C
+878D
+878E
+878F
+8790
+8791
+8792
+8793
+8794
+8795
+8796
+8797
+8798
+8799
+879A
+879B
+879C
+ED40
+ED41
+ED42
+ED43
+ED44
+ED45
+ED46
+ED47
+ED48
+ED49
+ED4A
+ED4B
+ED4C
+ED4D
+ED4E
+ED4F
+ED50
+ED51
+ED52
+ED53
+ED54
+ED55
+ED56
+ED57
+ED58
+ED59
+ED5A
+ED5B
+ED5C
+ED5D
+ED5E
+ED5F
+ED60
+ED61
+ED62
+ED63
+ED64
+ED65
+ED66
+ED67
+ED68
+ED69
+ED6A
+ED6B
+ED6C
+ED6D
+ED6E
+ED6F
+ED70
+ED71
+ED72
+ED73
+ED74
+ED75
+ED76
+ED77
+ED78
+ED79
+ED7A
+ED7B
+ED7C
+ED7D
+ED7E
+ED80
+ED81
+ED82
+ED83
+ED84
+ED85
+ED86
+ED87
+ED88
+ED89
+ED8A
+ED8B
+ED8C
+ED8D
+ED8E
+ED8F
+ED90
+ED91
+ED92
+ED93
+ED94
+ED95
+ED96
+ED97
+ED98
+ED99
+ED9A
+ED9B
+ED9C
+ED9D
+ED9E
+ED9F
+EDA0
+EDA1
+EDA2
+EDA3
+EDA4
+EDA5
+EDA6
+EDA7
+EDA8
+EDA9
+EDAA
+EDAB
+EDAC
+EDAD
+EDAE
+EDAF
+EDB0
+EDB1
+EDB2
+EDB3
+EDB4
+EDB5
+EDB6
+EDB7
+EDB8
+EDB9
+EDBA
+EDBB
+EDBC
+EDBD
+EDBE
+EDBF
+EDC0
+EDC1
+EDC2
+EDC3
+EDC4
+EDC5
+EDC6
+EDC7
+EDC8
+EDC9
+EDCA
+EDCB
+EDCC
+EDCD
+EDCE
+EDCF
+EDD0
+EDD1
+EDD2
+EDD3
+EDD4
+EDD5
+EDD6
+EDD7
+EDD8
+EDD9
+EDDA
+EDDB
+EDDC
+EDDD
+EDDE
+EDDF
+EDE0
+EDE1
+EDE2
+EDE3
+EDE4
+EDE5
+EDE6
+EDE7
+EDE8
+EDE9
+EDEA
+EDEB
+EDEC
+EDED
+EDEE
+EDEF
+EDF0
+EDF1
+EDF2
+EDF3
+EDF4
+EDF5
+EDF6
+EDF7
+EDF8
+EDF9
+EDFA
+EDFB
+EDFC
+EE40
+EE41
+EE42
+EE43
+EE44
+EE45
+EE46
+EE47
+EE48
+EE49
+EE4A
+EE4B
+EE4C
+EE4D
+EE4E
+EE4F
+EE50
+EE51
+EE52
+EE53
+EE54
+EE55
+EE56
+EE57
+EE58
+EE59
+EE5A
+EE5B
+EE5C
+EE5D
+EE5E
+EE5F
+EE60
+EE61
+EE62
+EE63
+EE64
+EE65
+EE66
+EE67
+EE68
+EE69
+EE6A
+EE6B
+EE6C
+EE6D
+EE6E
+EE6F
+EE70
+EE71
+EE72
+EE73
+EE74
+EE75
+EE76
+EE77
+EE78
+EE79
+EE7A
+EE7B
+EE7C
+EE7D
+EE7E
+EE80
+EE81
+EE82
+EE83
+EE84
+EE85
+EE86
+EE87
+EE88
+EE89
+EE8A
+EE8B
+EE8C
+EE8D
+EE8E
+EE8F
+EE90
+EE91
+EE92
+EE93
+EE94
+EE95
+EE96
+EE97
+EE98
+EE99
+EE9A
+EE9B
+EE9C
+EE9D
+EE9E
+EE9F
+EEA0
+EEA1
+EEA2
+EEA3
+EEA4
+EEA5
+EEA6
+EEA7
+EEA8
+EEA9
+EEAA
+EEAB
+EEAC
+EEAD
+EEAE
+EEAF
+EEB0
+EEB1
+EEB2
+EEB3
+EEB4
+EEB5
+EEB6
+EEB7
+EEB8
+EEB9
+EEBA
+EEBB
+EEBC
+EEBD
+EEBE
+EEBF
+EEC0
+EEC1
+EEC2
+EEC3
+EEC4
+EEC5
+EEC6
+EEC7
+EEC8
+EEC9
+EECA
+EECB
+EECC
+EECD
+EECE
+EECF
+EED0
+EED1
+EED2
+EED3
+EED4
+EED5
+EED6
+EED7
+EED8
+EED9
+EEDA
+EEDB
+EEDC
+EEDD
+EEDE
+EEDF
+EEE0
+EEE1
+EEE2
+EEE3
+EEE4
+EEE5
+EEE6
+EEE7
+EEE8
+EEE9
+EEEA
+EEEB
+EEEC
+EEEF
+EEF0
+EEF1
+EEF2
+EEF3
+EEF4
+EEF5
+EEF6
+EEF7
+EEF8
+EEF9
+EEFA
+EEFB
+EEFC
+FA40
+FA41
+FA42
+FA43
+FA44
+FA45
+FA46
+FA47
+FA48
+FA49
+FA4A
+FA4B
+FA4C
+FA4D
+FA4E
+FA4F
+FA50
+FA51
+FA52
+FA53
+FA54
+FA55
+FA56
+FA57
+FA58
+FA59
+FA5A
+FA5B
+FA5C
+FA5D
+FA5E
+FA5F
+FA60
+FA61
+FA62
+FA63
+FA64
+FA65
+FA66
+FA67
+FA68
+FA69
+FA6A
+FA6B
+FA6C
+FA6D
+FA6E
+FA6F
+FA70
+FA71
+FA72
+FA73
+FA74
+FA75
+FA76
+FA77
+FA78
+FA79
+FA7A
+FA7B
+FA7C
+FA7D
+FA7E
+FA80
+FA81
+FA82
+FA83
+FA84
+FA85
+FA86
+FA87
+FA88
+FA89
+FA8A
+FA8B
+FA8C
+FA8D
+FA8E
+FA8F
+FA90
+FA91
+FA92
+FA93
+FA94
+FA95
+FA96
+FA97
+FA98
+FA99
+FA9A
+FA9B
+FA9C
+FA9D
+FA9E
+FA9F
+FAA0
+FAA1
+FAA2
+FAA3
+FAA4
+FAA5
+FAA6
+FAA7
+FAA8
+FAA9
+FAAA
+FAAB
+FAAC
+FAAD
+FAAE
+FAAF
+FAB0
+FAB1
+FAB2
+FAB3
+FAB4
+FAB5
+FAB6
+FAB7
+FAB8
+FAB9
+FABA
+FABB
+FABC
+FABD
+FABE
+FABF
+FAC0
+FAC1
+FAC2
+FAC3
+FAC4
+FAC5
+FAC6
+FAC7
+FAC8
+FAC9
+FACA
+FACB
+FACC
+FACD
+FACE
+FACF
+FAD0
+FAD1
+FAD2
+FAD3
+FAD4
+FAD5
+FAD6
+FAD7
+FAD8
+FAD9
+FADA
+FADB
+FADC
+FADD
+FADE
+FADF
+FAE0
+FAE1
+FAE2
+FAE3
+FAE4
+FAE5
+FAE6
+FAE7
+FAE8
+FAE9
+FAEA
+FAEB
+FAEC
+FAED
+FAEE
+FAEF
+FAF0
+FAF1
+FAF2
+FAF3
+FAF4
+FAF5
+FAF6
+FAF7
+FAF8
+FAF9
+FAFA
+FAFB
+FAFC
+FB40
+FB41
+FB42
+FB43
+FB44
+FB45
+FB46
+FB47
+FB48
+FB49
+FB4A
+FB4B
+FB4C
+FB4D
+FB4E
+FB4F
+FB50
+FB51
+FB52
+FB53
+FB54
+FB55
+FB56
+FB57
+FB58
+FB59
+FB5A
+FB5B
+FB5C
+FB5D
+FB5E
+FB5F
+FB60
+FB61
+FB62
+FB63
+FB64
+FB65
+FB66
+FB67
+FB68
+FB69
+FB6A
+FB6B
+FB6C
+FB6D
+FB6E
+FB6F
+FB70
+FB71
+FB72
+FB73
+FB74
+FB75
+FB76
+FB77
+FB78
+FB79
+FB7A
+FB7B
+FB7C
+FB7D
+FB7E
+FB80
+FB81
+FB82
+FB83
+FB84
+FB85
+FB86
+FB87
+FB88
+FB89
+FB8A
+FB8B
+FB8C
+FB8D
+FB8E
+FB8F
+FB90
+FB91
+FB92
+FB93
+FB94
+FB95
+FB96
+FB97
+FB98
+FB99
+FB9A
+FB9B
+FB9C
+FB9D
+FB9E
+FB9F
+FBA0
+FBA1
+FBA2
+FBA3
+FBA4
+FBA5
+FBA6
+FBA7
+FBA8
+FBA9
+FBAA
+FBAB
+FBAC
+FBAD
+FBAE
+FBAF
+FBB0
+FBB1
+FBB2
+FBB3
+FBB4
+FBB5
+FBB6
+FBB7
+FBB8
+FBB9
+FBBA
+FBBB
+FBBC
+FBBD
+FBBE
+FBBF
+FBC0
+FBC1
+FBC2
+FBC3
+FBC4
+FBC5
+FBC6
+FBC7
+FBC8
+FBC9
+FBCA
+FBCB
+FBCC
+FBCD
+FBCE
+FBCF
+FBD0
+FBD1
+FBD2
+FBD3
+FBD4
+FBD5
+FBD6
+FBD7
+FBD8
+FBD9
+FBDA
+FBDB
+FBDC
+FBDD
+FBDE
+FBDF
+FBE0
+FBE1
+FBE2
+FBE3
+FBE4
+FBE5
+FBE6
+FBE7
+FBE8
+FBE9
+FBEA
+FBEB
+FBEC
+FBED
+FBEE
+FBEF
+FBF0
+FBF1
+FBF2
+FBF3
+FBF4
+FBF5
+FBF6
+FBF7
+FBF8
+FBF9
+FBFA
+FBFB
+FBFC
+FC40
+FC41
+FC42
+FC43
+FC44
+FC45
+FC46
+FC47
+FC48
+FC49
+FC4A
+FC4B
+F040
+F041
+F042
+F043
+F044
+F045
+F046
+F047
+F048
+F049
+F04A
+F04B
+F04C
+F04D
+F04E
+F04F
+F050
+F051
+F052
+F053
+F054
+F055
+F056
+F057
+F058
+F059
+F05A
+F05B
+F05C
+F05D
+F05E
+F05F
+F060
+F061
+F062
+F063
+F064
+F065
+F066
+F067
+F068
+F069
+F06A
+F06B
+F06C
+F06D
+F06E
+F06F
+F070
+F071
+F072
+F073
+F074
+F075
+F076
+F077
+F078
+F079
+F07A
+F07B
+F07C
+F07D
+F07E
+F080
+F081
+F082
+F083
+F084
+F085
+F086
+F087
+F088
+F089
+F08A
+F08B
+F08C
+F08D
+F08E
+F08F
+F090
+F091
+F092
+F093
+F094
+F095
+F096
+F097
+F098
+F099
+F09A
+F09B
+F09C
+F09D
+F09E
+F09F
+F0A0
+F0A1
+F0A2
+F0A3
+F0A4
+F0A5
+F0A6
+F0A7
+F0A8
+F0A9
+F0AA
+F0AB
+F0AC
+F0AD
+F0AE
+F0AF
+F0B0
+F0B1
+F0B2
+F0B3
+F0B4
+F0B5
+F0B6
+F0B7
+F0B8
+F0B9
+F0BA
+F0BB
+F0BC
+F0BD
+F0BE
+F0BF
+F0C0
+F0C1
+F0C2
+F0C3
+F0C4
+F0C5
+F0C6
+F0C7
+F0C8
+F0C9
+F0CA
+F0CB
+F0CC
+F0CD
+F0CE
+F0CF
+F0D0
+F0D1
+F0D2
+F0D3
+F0D4
+F0D5
+F0D6
+F0D7
+F0D8
+F0D9
+F0DA
+F0DB
+F0DC
+F0DD
+F0DE
+F0DF
+F0E0
+F0E1
+F0E2
+F0E3
+F0E4
+F0E5
+F0E6
+F0E7
+F0E8
+F0E9
+F0EA
+F0EB
+F0EC
+F0ED
+F0EE
+F0EF
+F0F0
+F0F1
+F0F2
+F0F3
+F0F4
+F0F5
+F0F6
+F0F7
+F0F8
+F0F9
+F0FA
+F0FB
+F0FC
+F140
+F141
+F142
+F143
+F144
+F145
+F146
+F147
+F148
+F149
+F14A
+F14B
+F14C
+F14D
+F14E
+F14F
+F150
+F151
+F152
+F153
+F154
+F155
+F156
+F157
+F158
+F159
+F15A
+F15B
+F15C
+F15D
+F15E
+F15F
+F160
+F161
+F162
+F163
+F164
+F165
+F166
+F167
+F168
+F169
+F16A
+F16B
+F16C
+F16D
+F16E
+F16F
+F170
+F171
+F172
+F173
+F174
+F175
+F176
+F177
+F178
+F179
+F17A
+F17B
+F17C
+F17D
+F17E
+F180
+F181
+F182
+F183
+F184
+F185
+F186
+F187
+F188
+F189
+F18A
+F18B
+F18C
+F18D
+F18E
+F18F
+F190
+F191
+F192
+F193
+F194
+F195
+F196
+F197
+F198
+F199
+F19A
+F19B
+F19C
+F19D
+F19E
+F19F
+F1A0
+F1A1
+F1A2
+F1A3
+F1A4
+F1A5
+F1A6
+F1A7
+F1A8
+F1A9
+F1AA
+F1AB
+F1AC
+F1AD
+F1AE
+F1AF
+F1B0
+F1B1
+F1B2
+F1B3
+F1B4
+F1B5
+F1B6
+F1B7
+F1B8
+F1B9
+F1BA
+F1BB
+F1BC
+F1BD
+F1BE
+F1BF
+F1C0
+F1C1
+F1C2
+F1C3
+F1C4
+F1C5
+F1C6
+F1C7
+F1C8
+F1C9
+F1CA
+F1CB
+F1CC
+F1CD
+F1CE
+F1CF
+F1D0
+F1D1
+F1D2
+F1D3
+F1D4
+F1D5
+F1D6
+F1D7
+F1D8
+F1D9
+F1DA
+F1DB
+F1DC
+F1DD
+F1DE
+F1DF
+F1E0
+F1E1
+F1E2
+F1E3
+F1E4
+F1E5
+F1E6
+F1E7
+F1E8
+F1E9
+F1EA
+F1EB
+F1EC
+F1ED
+F1EE
+F1EF
+F1F0
+F1F1
+F1F2
+F1F3
+F1F4
+F1F5
+F1F6
+F1F7
+F1F8
+F1F9
+F1FA
+F1FB
+F1FC
+F240
+F241
+F242
+F243
+F244
+F245
+F246
+F247
+F248
+F249
+F24A
+F24B
+F24C
+F24D
+F24E
+F24F
+F250
+F251
+F252
+F253
+F254
+F255
+F256
+F257
+F258
+F259
+F25A
+F25B
+F25C
+F25D
+F25E
+F25F
+F260
+F261
+F262
+F263
+F264
+F265
+F266
+F267
+F268
+F269
+F26A
+F26B
+F26C
+F26D
+F26E
+F26F
+F270
+F271
+F272
+F273
+F274
+F275
+F276
+F277
+F278
+F279
+F27A
+F27B
+F27C
+F27D
+F27E
+F280
+F281
+F282
+F283
+F284
+F285
+F286
+F287
+F288
+F289
+F28A
+F28B
+F28C
+F28D
+F28E
+F28F
+F290
+F291
+F292
+F293
+F294
+F295
+F296
+F297
+F298
+F299
+F29A
+F29B
+F29C
+F29D
+F29E
+F29F
+F2A0
+F2A1
+F2A2
+F2A3
+F2A4
+F2A5
+F2A6
+F2A7
+F2A8
+F2A9
+F2AA
+F2AB
+F2AC
+F2AD
+F2AE
+F2AF
+F2B0
+F2B1
+F2B2
+F2B3
+F2B4
+F2B5
+F2B6
+F2B7
+F2B8
+F2B9
+F2BA
+F2BB
+F2BC
+F2BD
+F2BE
+F2BF
+F2C0
+F2C1
+F2C2
+F2C3
+F2C4
+F2C5
+F2C6
+F2C7
+F2C8
+F2C9
+F2CA
+F2CB
+F2CC
+F2CD
+F2CE
+F2CF
+F2D0
+F2D1
+F2D2
+F2D3
+F2D4
+F2D5
+F2D6
+F2D7
+F2D8
+F2D9
+F2DA
+F2DB
+F2DC
+F2DD
+F2DE
+F2DF
+F2E0
+F2E1
+F2E2
+F2E3
+F2E4
+F2E5
+F2E6
+F2E7
+F2E8
+F2E9
+F2EA
+F2EB
+F2EC
+F2ED
+F2EE
+F2EF
+F2F0
+F2F1
+F2F2
+F2F3
+F2F4
+F2F5
+F2F6
+F2F7
+F2F8
+F2F9
+F2FA
+F2FB
+F2FC
+F340
+F341
+F342
+F343
+F344
+F345
+F346
+F347
+F348
+F349
+F34A
+F34B
+F34C
+F34D
+F34E
+F34F
+F350
+F351
+F352
+F353
+F354
+F355
+F356
+F357
+F358
+F359
+F35A
+F35B
+F35C
+F35D
+F35E
+F35F
+F360
+F361
+F362
+F363
+F364
+F365
+F366
+F367
+F368
+F369
+F36A
+F36B
+F36C
+F36D
+F36E
+F36F
+F370
+F371
+F372
+F373
+F374
+F375
+F376
+F377
+F378
+F379
+F37A
+F37B
+F37C
+F37D
+F37E
+F380
+F381
+F382
+F383
+F384
+F385
+F386
+F387
+F388
+F389
+F38A
+F38B
+F38C
+F38D
+F38E
+F38F
+F390
+F391
+F392
+F393
+F394
+F395
+F396
+F397
+F398
+F399
+F39A
+F39B
+F39C
+F39D
+F39E
+F39F
+F3A0
+F3A1
+F3A2
+F3A3
+F3A4
+F3A5
+F3A6
+F3A7
+F3A8
+F3A9
+F3AA
+F3AB
+F3AC
+F3AD
+F3AE
+F3AF
+F3B0
+F3B1
+F3B2
+F3B3
+F3B4
+F3B5
+F3B6
+F3B7
+F3B8
+F3B9
+F3BA
+F3BB
+F3BC
+F3BD
+F3BE
+F3BF
+F3C0
+F3C1
+F3C2
+F3C3
+F3C4
+F3C5
+F3C6
+F3C7
+F3C8
+F3C9
+F3CA
+F3CB
+F3CC
+F3CD
+F3CE
+F3CF
+F3D0
+F3D1
+F3D2
+F3D3
+F3D4
+F3D5
+F3D6
+F3D7
+F3D8
+F3D9
+F3DA
+F3DB
+F3DC
+F3DD
+F3DE
+F3DF
+F3E0
+F3E1
+F3E2
+F3E3
+F3E4
+F3E5
+F3E6
+F3E7
+F3E8
+F3E9
+F3EA
+F3EB
+F3EC
+F3ED
+F3EE
+F3EF
+F3F0
+F3F1
+F3F2
+F3F3
+F3F4
+F3F5
+F3F6
+F3F7
+F3F8
+F3F9
+F3FA
+F3FB
+F3FC
+F440
+F441
+F442
+F443
+F444
+F445
+F446
+F447
+F448
+F449
+F44A
+F44B
+F44C
+F44D
+F44E
+F44F
+F450
+F451
+F452
+F453
+F454
+F455
+F456
+F457
+F458
+F459
+F45A
+F45B
+F45C
+F45D
+F45E
+F45F
+F460
+F461
+F462
+F463
+F464
+F465
+F466
+F467
+F468
+F469
+F46A
+F46B
+F46C
+F46D
+F46E
+F46F
+F470
+F471
+F472
+F473
+F474
+F475
+F476
+F477
+F478
+F479
+F47A
+F47B
+F47C
+F47D
+F47E
+F480
+F481
+F482
+F483
+F484
+F485
+F486
+F487
+F488
+F489
+F48A
+F48B
+F48C
+F48D
+F48E
+F48F
+F490
+F491
+F492
+F493
+F494
+F495
+F496
+F497
+F498
+F499
+F49A
+F49B
+F49C
+F49D
+F49E
+F49F
+F4A0
+F4A1
+F4A2
+F4A3
+F4A4
+F4A5
+F4A6
+F4A7
+F4A8
+F4A9
+F4AA
+F4AB
+F4AC
+F4AD
+F4AE
+F4AF
+F4B0
+F4B1
+F4B2
+F4B3
+F4B4
+F4B5
+F4B6
+F4B7
+F4B8
+F4B9
+F4BA
+F4BB
+F4BC
+F4BD
+F4BE
+F4BF
+F4C0
+F4C1
+F4C2
+F4C3
+F4C4
+F4C5
+F4C6
+F4C7
+F4C8
+F4C9
+F4CA
+F4CB
+F4CC
+F4CD
+F4CE
+F4CF
+F4D0
+F4D1
+F4D2
+F4D3
+F4D4
+F4D5
+F4D6
+F4D7
+F4D8
+F4D9
+F4DA
+F4DB
+F4DC
+F4DD
+F4DE
+F4DF
+F4E0
+F4E1
+F4E2
+F4E3
+F4E4
+F4E5
+F4E6
+F4E7
+F4E8
+F4E9
+F4EA
+F4EB
+F4EC
+F4ED
+F4EE
+F4EF
+F4F0
+F4F1
+F4F2
+F4F3
+F4F4
+F4F5
+F4F6
+F4F7
+F4F8
+F4F9
+F4FA
+F4FB
+F4FC
+F540
+F541
+F542
+F543
+F544
+F545
+F546
+F547
+F548
+F549
+F54A
+F54B
+F54C
+F54D
+F54E
+F54F
+F550
+F551
+F552
+F553
+F554
+F555
+F556
+F557
+F558
+F559
+F55A
+F55B
+F55C
+F55D
+F55E
+F55F
+F560
+F561
+F562
+F563
+F564
+F565
+F566
+F567
+F568
+F569
+F56A
+F56B
+F56C
+F56D
+F56E
+F56F
+F570
+F571
+F572
+F573
+F574
+F575
+F576
+F577
+F578
+F579
+F57A
+F57B
+F57C
+F57D
+F57E
+F580
+F581
+F582
+F583
+F584
+F585
+F586
+F587
+F588
+F589
+F58A
+F58B
+F58C
+F58D
+F58E
+F58F
+F590
+F591
+F592
+F593
+F594
+F595
+F596
+F597
+F598
+F599
+F59A
+F59B
+F59C
+F59D
+F59E
+F59F
+F5A0
+F5A1
+F5A2
+F5A3
+F5A4
+F5A5
+F5A6
+F5A7
+F5A8
+F5A9
+F5AA
+F5AB
+F5AC
+F5AD
+F5AE
+F5AF
+F5B0
+F5B1
+F5B2
+F5B3
+F5B4
+F5B5
+F5B6
+F5B7
+F5B8
+F5B9
+F5BA
+F5BB
+F5BC
+F5BD
+F5BE
+F5BF
+F5C0
+F5C1
+F5C2
+F5C3
+F5C4
+F5C5
+F5C6
+F5C7
+F5C8
+F5C9
+F5CA
+F5CB
+F5CC
+F5CD
+F5CE
+F5CF
+F5D0
+F5D1
+F5D2
+F5D3
+F5D4
+F5D5
+F5D6
+F5D7
+F5D8
+F5D9
+F5DA
+F5DB
+F5DC
+F5DD
+F5DE
+F5DF
+F5E0
+F5E1
+F5E2
+F5E3
+F5E4
+F5E5
+F5E6
+F5E7
+F5E8
+F5E9
+F5EA
+F5EB
+F5EC
+F5ED
+F5EE
+F5EF
+F5F0
+F5F1
+F5F2
+F5F3
+F5F4
+F5F5
+F5F6
+F5F7
+F5F8
+F5F9
+F5FA
+F5FB
+F5FC
+F640
+F641
+F642
+F643
+F644
+F645
+F646
+F647
+F648
+F649
+F64A
+F64B
+F64C
+F64D
+F64E
+F64F
+F650
+F651
+F652
+F653
+F654
+F655
+F656
+F657
+F658
+F659
+F65A
+F65B
+F65C
+F65D
+F65E
+F65F
+F660
+F661
+F662
+F663
+F664
+F665
+F666
+F667
+F668
+F669
+F66A
+F66B
+F66C
+F66D
+F66E
+F66F
+F670
+F671
+F672
+F673
+F674
+F675
+F676
+F677
+F678
+F679
+F67A
+F67B
+F67C
+F67D
+F67E
+F680
+F681
+F682
+F683
+F684
+F685
+F686
+F687
+F688
+F689
+F68A
+F68B
+F68C
+F68D
+F68E
+F68F
+F690
+F691
+F692
+F693
+F694
+F695
+F696
+F697
+F698
+F699
+F69A
+F69B
+F69C
+F69D
+F69E
+F69F
+F6A0
+F6A1
+F6A2
+F6A3
+F6A4
+F6A5
+F6A6
+F6A7
+F6A8
+F6A9
+F6AA
+F6AB
+F6AC
+F6AD
+F6AE
+F6AF
+F6B0
+F6B1
+F6B2
+F6B3
+F6B4
+F6B5
+F6B6
+F6B7
+F6B8
+F6B9
+F6BA
+F6BB
+F6BC
+F6BD
+F6BE
+F6BF
+F6C0
+F6C1
+F6C2
+F6C3
+F6C4
+F6C5
+F6C6
+F6C7
+F6C8
+F6C9
+F6CA
+F6CB
+F6CC
+F6CD
+F6CE
+F6CF
+F6D0
+F6D1
+F6D2
+F6D3
+F6D4
+F6D5
+F6D6
+F6D7
+F6D8
+F6D9
+F6DA
+F6DB
+F6DC
+F6DD
+F6DE
+F6DF
+F6E0
+F6E1
+F6E2
+F6E3
+F6E4
+F6E5
+F6E6
+F6E7
+F6E8
+F6E9
+F6EA
+F6EB
+F6EC
+F6ED
+F6EE
+F6EF
+F6F0
+F6F1
+F6F2
+F6F3
+F6F4
+F6F5
+F6F6
+F6F7
+F6F8
+F6F9
+F6FA
+F6FB
+F6FC
+F740
+F741
+F742
+F743
+F744
+F745
+F746
+F747
+F748
+F749
+F74A
+F74B
+F74C
+F74D
+F74E
+F74F
+F750
+F751
+F752
+F753
+F754
+F755
+F756
+F757
+F758
+F759
+F75A
+F75B
+F75C
+F75D
+F75E
+F75F
+F760
+F761
+F762
+F763
+F764
+F765
+F766
+F767
+F768
+F769
+F76A
+F76B
+F76C
+F76D
+F76E
+F76F
+F770
+F771
+F772
+F773
+F774
+F775
+F776
+F777
+F778
+F779
+F77A
+F77B
+F77C
+F77D
+F77E
+F780
+F781
+F782
+F783
+F784
+F785
+F786
+F787
+F788
+F789
+F78A
+F78B
+F78C
+F78D
+F78E
+F78F
+F790
+F791
+F792
+F793
+F794
+F795
+F796
+F797
+F798
+F799
+F79A
+F79B
+F79C
+F79D
+F79E
+F79F
+F7A0
+F7A1
+F7A2
+F7A3
+F7A4
+F7A5
+F7A6
+F7A7
+F7A8
+F7A9
+F7AA
+F7AB
+F7AC
+F7AD
+F7AE
+F7AF
+F7B0
+F7B1
+F7B2
+F7B3
+F7B4
+F7B5
+F7B6
+F7B7
+F7B8
+F7B9
+F7BA
+F7BB
+F7BC
+F7BD
+F7BE
+F7BF
+F7C0
+F7C1
+F7C2
+F7C3
+F7C4
+F7C5
+F7C6
+F7C7
+F7C8
+F7C9
+F7CA
+F7CB
+F7CC
+F7CD
+F7CE
+F7CF
+F7D0
+F7D1
+F7D2
+F7D3
+F7D4
+F7D5
+F7D6
+F7D7
+F7D8
+F7D9
+F7DA
+F7DB
+F7DC
+F7DD
+F7DE
+F7DF
+F7E0
+F7E1
+F7E2
+F7E3
+F7E4
+F7E5
+F7E6
+F7E7
+F7E8
+F7E9
+F7EA
+F7EB
+F7EC
+F7ED
+F7EE
+F7EF
+F7F0
+F7F1
+F7F2
+F7F3
+F7F4
+F7F5
+F7F6
+F7F7
+F7F8
+F7F9
+F7FA
+F7FB
+F7FC
+F840
+F841
+F842
+F843
+F844
+F845
+F846
+F847
+F848
+F849
+F84A
+F84B
+F84C
+F84D
+F84E
+F84F
+F850
+F851
+F852
+F853
+F854
+F855
+F856
+F857
+F858
+F859
+F85A
+F85B
+F85C
+F85D
+F85E
+F85F
+F860
+F861
+F862
+F863
+F864
+F865
+F866
+F867
+F868
+F869
+F86A
+F86B
+F86C
+F86D
+F86E
+F86F
+F870
+F871
+F872
+F873
+F874
+F875
+F876
+F877
+F878
+F879
+F87A
+F87B
+F87C
+F87D
+F87E
+F880
+F881
+F882
+F883
+F884
+F885
+F886
+F887
+F888
+F889
+F88A
+F88B
+F88C
+F88D
+F88E
+F88F
+F890
+F891
+F892
+F893
+F894
+F895
+F896
+F897
+F898
+F899
+F89A
+F89B
+F89C
+F89D
+F89E
+F89F
+F8A0
+F8A1
+F8A2
+F8A3
+F8A4
+F8A5
+F8A6
+F8A7
+F8A8
+F8A9
+F8AA
+F8AB
+F8AC
+F8AD
+F8AE
+F8AF
+F8B0
+F8B1
+F8B2
+F8B3
+F8B4
+F8B5
+F8B6
+F8B7
+F8B8
+F8B9
+F8BA
+F8BB
+F8BC
+F8BD
+F8BE
+F8BF
+F8C0
+F8C1
+F8C2
+F8C3
+F8C4
+F8C5
+F8C6
+F8C7
+F8C8
+F8C9
+F8CA
+F8CB
+F8CC
+F8CD
+F8CE
+F8CF
+F8D0
+F8D1
+F8D2
+F8D3
+F8D4
+F8D5
+F8D6
+F8D7
+F8D8
+F8D9
+F8DA
+F8DB
+F8DC
+F8DD
+F8DE
+F8DF
+F8E0
+F8E1
+F8E2
+F8E3
+F8E4
+F8E5
+F8E6
+F8E7
+F8E8
+F8E9
+F8EA
+F8EB
+F8EC
+F8ED
+F8EE
+F8EF
+F8F0
+F8F1
+F8F2
+F8F3
+F8F4
+F8F5
+F8F6
+F8F7
+F8F8
+F8F9
+F8FA
+F8FB
+F8FC
+F940
+F941
+F942
+F943
+F944
+F945
+F946
+F947
+F948
+F949
+F94A
+F94B
+F94C
+F94D
+F94E
+F94F
+F950
+F951
+F952
+F953
+F954
+F955
+F956
+F957
+F958
+F959
+F95A
+F95B
+F95C
+F95D
+F95E
+F95F
+F960
+F961
+F962
+F963
+F964
+F965
+F966
+F967
+F968
+F969
+F96A
+F96B
+F96C
+F96D
+F96E
+F96F
+F970
+F971
+F972
+F973
+F974
+F975
+F976
+F977
+F978
+F979
+F97A
+F97B
+F97C
+F97D
+F97E
+F980
+F981
+F982
+F983
+F984
+F985
+F986
+F987
+F988
+F989
+F98A
+F98B
+F98C
+F98D
+F98E
+F98F
+F990
+F991
+F992
+F993
+F994
+F995
+F996
+F997
+F998
+F999
+F99A
+F99B
+F99C
+F99D
+F99E
+F99F
+F9A0
+F9A1
+F9A2
+F9A3
+F9A4
+F9A5
+F9A6
+F9A7
+F9A8
+F9A9
+F9AA
+F9AB
+F9AC
+F9AD
+F9AE
+F9AF
+F9B0
+F9B1
+F9B2
+F9B3
+F9B4
+F9B5
+F9B6
+F9B7
+F9B8
+F9B9
+F9BA
+F9BB
+F9BC
+F9BD
+F9BE
+F9BF
+F9C0
+F9C1
+F9C2
+F9C3
+F9C4
+F9C5
+F9C6
+F9C7
+F9C8
+F9C9
+F9CA
+F9CB
+F9CC
+F9CD
+F9CE
+F9CF
+F9D0
+F9D1
+F9D2
+F9D3
+F9D4
+F9D5
+F9D6
+F9D7
+F9D8
+F9D9
+F9DA
+F9DB
+F9DC
+F9DD
+F9DE
+F9DF
+F9E0
+F9E1
+F9E2
+F9E3
+F9E4
+F9E5
+F9E6
+F9E7
+F9E8
+F9E9
+F9EA
+F9EB
+F9EC
+F9ED
+F9EE
+F9EF
+F9F0
+F9F1
+F9F2
+F9F3
+F9F4
+F9F5
+F9F6
+F9F7
+F9F8
+F9F9
+F9FA
+F9FB
+F9FC
+CREATE TABLE t2 SELECT CONVERT(c1 USING ucs2) AS c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+0005
+007E
+2015
+FF3C
+FF5E
+2225
+FF0D
+FFE0
+FFE1
+FFE2
+2460
+2461
+2462
+2463
+2464
+2465
+2466
+2467
+2468
+2469
+246A
+246B
+246C
+246D
+246E
+246F
+2470
+2471
+2472
+2473
+2160
+2161
+2162
+2163
+2164
+2165
+2166
+2167
+2168
+2169
+3349
+3314
+3322
+334D
+3318
+3327
+3303
+3336
+3351
+3357
+330D
+3326
+3323
+332B
+334A
+333B
+339C
+339D
+339E
+338E
+338F
+33C4
+33A1
+337B
+301D
+301F
+2116
+33CD
+2121
+32A4
+32A5
+32A6
+32A7
+32A8
+3231
+3232
+3239
+337E
+337D
+337C
+2252
+2261
+222B
+222E
+2211
+221A
+22A5
+2220
+221F
+22BF
+2235
+2229
+222A
+7E8A
+891C
+9348
+9288
+84DC
+4FC9
+70BB
+6631
+68C8
+92F9
+66FB
+5F45
+4E28
+4EE1
+4EFC
+4F00
+4F03
+4F39
+4F56
+4F92
+4F8A
+4F9A
+4F94
+4FCD
+5040
+5022
+4FFF
+501E
+5046
+5070
+5042
+5094
+50F4
+50D8
+514A
+5164
+519D
+51BE
+51EC
+5215
+529C
+52A6
+52C0
+52DB
+5300
+5307
+5324
+5372
+5393
+53B2
+53DD
+FA0E
+549C
+548A
+54A9
+54FF
+5586
+5759
+5765
+57AC
+57C8
+57C7
+FA0F
+FA10
+589E
+58B2
+590B
+5953
+595B
+595D
+5963
+59A4
+59BA
+5B56
+5BC0
+752F
+5BD8
+5BEC
+5C1E
+5CA6
+5CBA
+5CF5
+5D27
+5D53
+FA11
+5D42
+5D6D
+5DB8
+5DB9
+5DD0
+5F21
+5F34
+5F67
+5FB7
+5FDE
+605D
+6085
+608A
+60DE
+60D5
+6120
+60F2
+6111
+6137
+6130
+6198
+6213
+62A6
+63F5
+6460
+649D
+64CE
+654E
+6600
+6615
+663B
+6609
+662E
+661E
+6624
+6665
+6657
+6659
+FA12
+6673
+6699
+66A0
+66B2
+66BF
+66FA
+670E
+F929
+6766
+67BB
+6852
+67C0
+6801
+6844
+68CF
+FA13
+6968
+FA14
+6998
+69E2
+6A30
+6A6B
+6A46
+6A73
+6A7E
+6AE2
+6AE4
+6BD6
+6C3F
+6C5C
+6C86
+6C6F
+6CDA
+6D04
+6D87
+6D6F
+6D96
+6DAC
+6DCF
+6DF8
+6DF2
+6DFC
+6E39
+6E5C
+6E27
+6E3C
+6EBF
+6F88
+6FB5
+6FF5
+7005
+7007
+7028
+7085
+70AB
+710F
+7104
+715C
+7146
+7147
+FA15
+71C1
+71FE
+72B1
+72BE
+7324
+FA16
+7377
+73BD
+73C9
+73D6
+73E3
+73D2
+7407
+73F5
+7426
+742A
+7429
+742E
+7462
+7489
+749F
+7501
+756F
+7682
+769C
+769E
+769B
+76A6
+FA17
+7746
+52AF
+7821
+784E
+7864
+787A
+7930
+FA18
+FA19
+FA1A
+7994
+FA1B
+799B
+7AD1
+7AE7
+FA1C
+7AEB
+7B9E
+FA1D
+7D48
+7D5C
+7DB7
+7DA0
+7DD6
+7E52
+7F47
+7FA1
+FA1E
+8301
+8362
+837F
+83C7
+83F6
+8448
+84B4
+8553
+8559
+856B
+FA1F
+85B0
+FA20
+FA21
+8807
+88F5
+8A12
+8A37
+8A79
+8AA7
+8ABE
+8ADF
+FA22
+8AF6
+8B53
+8B7F
+8CF0
+8CF4
+8D12
+8D76
+FA23
+8ECF
+FA24
+FA25
+9067
+90DE
+FA26
+9115
+9127
+91DA
+91D7
+91DE
+91ED
+91EE
+91E4
+91E5
+9206
+9210
+920A
+923A
+9240
+923C
+924E
+9259
+9251
+9239
+9267
+92A7
+9277
+9278
+92E7
+92D7
+92D9
+92D0
+FA27
+92D5
+92E0
+92D3
+9325
+9321
+92FB
+FA28
+931E
+92FF
+931D
+9302
+9370
+9357
+93A4
+93C6
+93DE
+93F8
+9431
+9445
+9448
+9592
+F9DC
+FA29
+969D
+96AF
+9733
+973B
+9743
+974D
+974F
+9751
+9755
+9857
+9865
+FA2A
+FA2B
+9927
+FA2C
+999E
+9A4E
+9AD9
+9ADC
+9B75
+9B72
+9B8F
+9BB1
+9BBB
+9C00
+9D70
+9D6B
+FA2D
+9E19
+9ED1
+2170
+2171
+2172
+2173
+2174
+2175
+2176
+2177
+2178
+2179
+FFE2
+FFE4
+FF07
+FF02
+2170
+2171
+2172
+2173
+2174
+2175
+2176
+2177
+2178
+2179
+2160
+2161
+2162
+2163
+2164
+2165
+2166
+2167
+2168
+2169
+FFE2
+FFE4
+FF07
+FF02
+3231
+2116
+2121
+2235
+7E8A
+891C
+9348
+9288
+84DC
+4FC9
+70BB
+6631
+68C8
+92F9
+66FB
+5F45
+4E28
+4EE1
+4EFC
+4F00
+4F03
+4F39
+4F56
+4F92
+4F8A
+4F9A
+4F94
+4FCD
+5040
+5022
+4FFF
+501E
+5046
+5070
+5042
+5094
+50F4
+50D8
+514A
+5164
+519D
+51BE
+51EC
+5215
+529C
+52A6
+52C0
+52DB
+5300
+5307
+5324
+5372
+5393
+53B2
+53DD
+FA0E
+549C
+548A
+54A9
+54FF
+5586
+5759
+5765
+57AC
+57C8
+57C7
+FA0F
+FA10
+589E
+58B2
+590B
+5953
+595B
+595D
+5963
+59A4
+59BA
+5B56
+5BC0
+752F
+5BD8
+5BEC
+5C1E
+5CA6
+5CBA
+5CF5
+5D27
+5D53
+FA11
+5D42
+5D6D
+5DB8
+5DB9
+5DD0
+5F21
+5F34
+5F67
+5FB7
+5FDE
+605D
+6085
+608A
+60DE
+60D5
+6120
+60F2
+6111
+6137
+6130
+6198
+6213
+62A6
+63F5
+6460
+649D
+64CE
+654E
+6600
+6615
+663B
+6609
+662E
+661E
+6624
+6665
+6657
+6659
+FA12
+6673
+6699
+66A0
+66B2
+66BF
+66FA
+670E
+F929
+6766
+67BB
+6852
+67C0
+6801
+6844
+68CF
+FA13
+6968
+FA14
+6998
+69E2
+6A30
+6A6B
+6A46
+6A73
+6A7E
+6AE2
+6AE4
+6BD6
+6C3F
+6C5C
+6C86
+6C6F
+6CDA
+6D04
+6D87
+6D6F
+6D96
+6DAC
+6DCF
+6DF8
+6DF2
+6DFC
+6E39
+6E5C
+6E27
+6E3C
+6EBF
+6F88
+6FB5
+6FF5
+7005
+7007
+7028
+7085
+70AB
+710F
+7104
+715C
+7146
+7147
+FA15
+71C1
+71FE
+72B1
+72BE
+7324
+FA16
+7377
+73BD
+73C9
+73D6
+73E3
+73D2
+7407
+73F5
+7426
+742A
+7429
+742E
+7462
+7489
+749F
+7501
+756F
+7682
+769C
+769E
+769B
+76A6
+FA17
+7746
+52AF
+7821
+784E
+7864
+787A
+7930
+FA18
+FA19
+FA1A
+7994
+FA1B
+799B
+7AD1
+7AE7
+FA1C
+7AEB
+7B9E
+FA1D
+7D48
+7D5C
+7DB7
+7DA0
+7DD6
+7E52
+7F47
+7FA1
+FA1E
+8301
+8362
+837F
+83C7
+83F6
+8448
+84B4
+8553
+8559
+856B
+FA1F
+85B0
+FA20
+FA21
+8807
+88F5
+8A12
+8A37
+8A79
+8AA7
+8ABE
+8ADF
+FA22
+8AF6
+8B53
+8B7F
+8CF0
+8CF4
+8D12
+8D76
+FA23
+8ECF
+FA24
+FA25
+9067
+90DE
+FA26
+9115
+9127
+91DA
+91D7
+91DE
+91ED
+91EE
+91E4
+91E5
+9206
+9210
+920A
+923A
+9240
+923C
+924E
+9259
+9251
+9239
+9267
+92A7
+9277
+9278
+92E7
+92D7
+92D9
+92D0
+FA27
+92D5
+92E0
+92D3
+9325
+9321
+92FB
+FA28
+931E
+92FF
+931D
+9302
+9370
+9357
+93A4
+93C6
+93DE
+93F8
+9431
+9445
+9448
+9592
+F9DC
+FA29
+969D
+96AF
+9733
+973B
+9743
+974D
+974F
+9751
+9755
+9857
+9865
+FA2A
+FA2B
+9927
+FA2C
+999E
+9A4E
+9AD9
+9ADC
+9B75
+9B72
+9B8F
+9BB1
+9BBB
+9C00
+9D70
+9D6B
+FA2D
+9E19
+9ED1
+E000
+E001
+E002
+E003
+E004
+E005
+E006
+E007
+E008
+E009
+E00A
+E00B
+E00C
+E00D
+E00E
+E00F
+E010
+E011
+E012
+E013
+E014
+E015
+E016
+E017
+E018
+E019
+E01A
+E01B
+E01C
+E01D
+E01E
+E01F
+E020
+E021
+E022
+E023
+E024
+E025
+E026
+E027
+E028
+E029
+E02A
+E02B
+E02C
+E02D
+E02E
+E02F
+E030
+E031
+E032
+E033
+E034
+E035
+E036
+E037
+E038
+E039
+E03A
+E03B
+E03C
+E03D
+E03E
+E03F
+E040
+E041
+E042
+E043
+E044
+E045
+E046
+E047
+E048
+E049
+E04A
+E04B
+E04C
+E04D
+E04E
+E04F
+E050
+E051
+E052
+E053
+E054
+E055
+E056
+E057
+E058
+E059
+E05A
+E05B
+E05C
+E05D
+E05E
+E05F
+E060
+E061
+E062
+E063
+E064
+E065
+E066
+E067
+E068
+E069
+E06A
+E06B
+E06C
+E06D
+E06E
+E06F
+E070
+E071
+E072
+E073
+E074
+E075
+E076
+E077
+E078
+E079
+E07A
+E07B
+E07C
+E07D
+E07E
+E07F
+E080
+E081
+E082
+E083
+E084
+E085
+E086
+E087
+E088
+E089
+E08A
+E08B
+E08C
+E08D
+E08E
+E08F
+E090
+E091
+E092
+E093
+E094
+E095
+E096
+E097
+E098
+E099
+E09A
+E09B
+E09C
+E09D
+E09E
+E09F
+E0A0
+E0A1
+E0A2
+E0A3
+E0A4
+E0A5
+E0A6
+E0A7
+E0A8
+E0A9
+E0AA
+E0AB
+E0AC
+E0AD
+E0AE
+E0AF
+E0B0
+E0B1
+E0B2
+E0B3
+E0B4
+E0B5
+E0B6
+E0B7
+E0B8
+E0B9
+E0BA
+E0BB
+E0BC
+E0BD
+E0BE
+E0BF
+E0C0
+E0C1
+E0C2
+E0C3
+E0C4
+E0C5
+E0C6
+E0C7
+E0C8
+E0C9
+E0CA
+E0CB
+E0CC
+E0CD
+E0CE
+E0CF
+E0D0
+E0D1
+E0D2
+E0D3
+E0D4
+E0D5
+E0D6
+E0D7
+E0D8
+E0D9
+E0DA
+E0DB
+E0DC
+E0DD
+E0DE
+E0DF
+E0E0
+E0E1
+E0E2
+E0E3
+E0E4
+E0E5
+E0E6
+E0E7
+E0E8
+E0E9
+E0EA
+E0EB
+E0EC
+E0ED
+E0EE
+E0EF
+E0F0
+E0F1
+E0F2
+E0F3
+E0F4
+E0F5
+E0F6
+E0F7
+E0F8
+E0F9
+E0FA
+E0FB
+E0FC
+E0FD
+E0FE
+E0FF
+E100
+E101
+E102
+E103
+E104
+E105
+E106
+E107
+E108
+E109
+E10A
+E10B
+E10C
+E10D
+E10E
+E10F
+E110
+E111
+E112
+E113
+E114
+E115
+E116
+E117
+E118
+E119
+E11A
+E11B
+E11C
+E11D
+E11E
+E11F
+E120
+E121
+E122
+E123
+E124
+E125
+E126
+E127
+E128
+E129
+E12A
+E12B
+E12C
+E12D
+E12E
+E12F
+E130
+E131
+E132
+E133
+E134
+E135
+E136
+E137
+E138
+E139
+E13A
+E13B
+E13C
+E13D
+E13E
+E13F
+E140
+E141
+E142
+E143
+E144
+E145
+E146
+E147
+E148
+E149
+E14A
+E14B
+E14C
+E14D
+E14E
+E14F
+E150
+E151
+E152
+E153
+E154
+E155
+E156
+E157
+E158
+E159
+E15A
+E15B
+E15C
+E15D
+E15E
+E15F
+E160
+E161
+E162
+E163
+E164
+E165
+E166
+E167
+E168
+E169
+E16A
+E16B
+E16C
+E16D
+E16E
+E16F
+E170
+E171
+E172
+E173
+E174
+E175
+E176
+E177
+E178
+E179
+E17A
+E17B
+E17C
+E17D
+E17E
+E17F
+E180
+E181
+E182
+E183
+E184
+E185
+E186
+E187
+E188
+E189
+E18A
+E18B
+E18C
+E18D
+E18E
+E18F
+E190
+E191
+E192
+E193
+E194
+E195
+E196
+E197
+E198
+E199
+E19A
+E19B
+E19C
+E19D
+E19E
+E19F
+E1A0
+E1A1
+E1A2
+E1A3
+E1A4
+E1A5
+E1A6
+E1A7
+E1A8
+E1A9
+E1AA
+E1AB
+E1AC
+E1AD
+E1AE
+E1AF
+E1B0
+E1B1
+E1B2
+E1B3
+E1B4
+E1B5
+E1B6
+E1B7
+E1B8
+E1B9
+E1BA
+E1BB
+E1BC
+E1BD
+E1BE
+E1BF
+E1C0
+E1C1
+E1C2
+E1C3
+E1C4
+E1C5
+E1C6
+E1C7
+E1C8
+E1C9
+E1CA
+E1CB
+E1CC
+E1CD
+E1CE
+E1CF
+E1D0
+E1D1
+E1D2
+E1D3
+E1D4
+E1D5
+E1D6
+E1D7
+E1D8
+E1D9
+E1DA
+E1DB
+E1DC
+E1DD
+E1DE
+E1DF
+E1E0
+E1E1
+E1E2
+E1E3
+E1E4
+E1E5
+E1E6
+E1E7
+E1E8
+E1E9
+E1EA
+E1EB
+E1EC
+E1ED
+E1EE
+E1EF
+E1F0
+E1F1
+E1F2
+E1F3
+E1F4
+E1F5
+E1F6
+E1F7
+E1F8
+E1F9
+E1FA
+E1FB
+E1FC
+E1FD
+E1FE
+E1FF
+E200
+E201
+E202
+E203
+E204
+E205
+E206
+E207
+E208
+E209
+E20A
+E20B
+E20C
+E20D
+E20E
+E20F
+E210
+E211
+E212
+E213
+E214
+E215
+E216
+E217
+E218
+E219
+E21A
+E21B
+E21C
+E21D
+E21E
+E21F
+E220
+E221
+E222
+E223
+E224
+E225
+E226
+E227
+E228
+E229
+E22A
+E22B
+E22C
+E22D
+E22E
+E22F
+E230
+E231
+E232
+E233
+E234
+E235
+E236
+E237
+E238
+E239
+E23A
+E23B
+E23C
+E23D
+E23E
+E23F
+E240
+E241
+E242
+E243
+E244
+E245
+E246
+E247
+E248
+E249
+E24A
+E24B
+E24C
+E24D
+E24E
+E24F
+E250
+E251
+E252
+E253
+E254
+E255
+E256
+E257
+E258
+E259
+E25A
+E25B
+E25C
+E25D
+E25E
+E25F
+E260
+E261
+E262
+E263
+E264
+E265
+E266
+E267
+E268
+E269
+E26A
+E26B
+E26C
+E26D
+E26E
+E26F
+E270
+E271
+E272
+E273
+E274
+E275
+E276
+E277
+E278
+E279
+E27A
+E27B
+E27C
+E27D
+E27E
+E27F
+E280
+E281
+E282
+E283
+E284
+E285
+E286
+E287
+E288
+E289
+E28A
+E28B
+E28C
+E28D
+E28E
+E28F
+E290
+E291
+E292
+E293
+E294
+E295
+E296
+E297
+E298
+E299
+E29A
+E29B
+E29C
+E29D
+E29E
+E29F
+E2A0
+E2A1
+E2A2
+E2A3
+E2A4
+E2A5
+E2A6
+E2A7
+E2A8
+E2A9
+E2AA
+E2AB
+E2AC
+E2AD
+E2AE
+E2AF
+E2B0
+E2B1
+E2B2
+E2B3
+E2B4
+E2B5
+E2B6
+E2B7
+E2B8
+E2B9
+E2BA
+E2BB
+E2BC
+E2BD
+E2BE
+E2BF
+E2C0
+E2C1
+E2C2
+E2C3
+E2C4
+E2C5
+E2C6
+E2C7
+E2C8
+E2C9
+E2CA
+E2CB
+E2CC
+E2CD
+E2CE
+E2CF
+E2D0
+E2D1
+E2D2
+E2D3
+E2D4
+E2D5
+E2D6
+E2D7
+E2D8
+E2D9
+E2DA
+E2DB
+E2DC
+E2DD
+E2DE
+E2DF
+E2E0
+E2E1
+E2E2
+E2E3
+E2E4
+E2E5
+E2E6
+E2E7
+E2E8
+E2E9
+E2EA
+E2EB
+E2EC
+E2ED
+E2EE
+E2EF
+E2F0
+E2F1
+E2F2
+E2F3
+E2F4
+E2F5
+E2F6
+E2F7
+E2F8
+E2F9
+E2FA
+E2FB
+E2FC
+E2FD
+E2FE
+E2FF
+E300
+E301
+E302
+E303
+E304
+E305
+E306
+E307
+E308
+E309
+E30A
+E30B
+E30C
+E30D
+E30E
+E30F
+E310
+E311
+E312
+E313
+E314
+E315
+E316
+E317
+E318
+E319
+E31A
+E31B
+E31C
+E31D
+E31E
+E31F
+E320
+E321
+E322
+E323
+E324
+E325
+E326
+E327
+E328
+E329
+E32A
+E32B
+E32C
+E32D
+E32E
+E32F
+E330
+E331
+E332
+E333
+E334
+E335
+E336
+E337
+E338
+E339
+E33A
+E33B
+E33C
+E33D
+E33E
+E33F
+E340
+E341
+E342
+E343
+E344
+E345
+E346
+E347
+E348
+E349
+E34A
+E34B
+E34C
+E34D
+E34E
+E34F
+E350
+E351
+E352
+E353
+E354
+E355
+E356
+E357
+E358
+E359
+E35A
+E35B
+E35C
+E35D
+E35E
+E35F
+E360
+E361
+E362
+E363
+E364
+E365
+E366
+E367
+E368
+E369
+E36A
+E36B
+E36C
+E36D
+E36E
+E36F
+E370
+E371
+E372
+E373
+E374
+E375
+E376
+E377
+E378
+E379
+E37A
+E37B
+E37C
+E37D
+E37E
+E37F
+E380
+E381
+E382
+E383
+E384
+E385
+E386
+E387
+E388
+E389
+E38A
+E38B
+E38C
+E38D
+E38E
+E38F
+E390
+E391
+E392
+E393
+E394
+E395
+E396
+E397
+E398
+E399
+E39A
+E39B
+E39C
+E39D
+E39E
+E39F
+E3A0
+E3A1
+E3A2
+E3A3
+E3A4
+E3A5
+E3A6
+E3A7
+E3A8
+E3A9
+E3AA
+E3AB
+E3AC
+E3AD
+E3AE
+E3AF
+E3B0
+E3B1
+E3B2
+E3B3
+E3B4
+E3B5
+E3B6
+E3B7
+E3B8
+E3B9
+E3BA
+E3BB
+E3BC
+E3BD
+E3BE
+E3BF
+E3C0
+E3C1
+E3C2
+E3C3
+E3C4
+E3C5
+E3C6
+E3C7
+E3C8
+E3C9
+E3CA
+E3CB
+E3CC
+E3CD
+E3CE
+E3CF
+E3D0
+E3D1
+E3D2
+E3D3
+E3D4
+E3D5
+E3D6
+E3D7
+E3D8
+E3D9
+E3DA
+E3DB
+E3DC
+E3DD
+E3DE
+E3DF
+E3E0
+E3E1
+E3E2
+E3E3
+E3E4
+E3E5
+E3E6
+E3E7
+E3E8
+E3E9
+E3EA
+E3EB
+E3EC
+E3ED
+E3EE
+E3EF
+E3F0
+E3F1
+E3F2
+E3F3
+E3F4
+E3F5
+E3F6
+E3F7
+E3F8
+E3F9
+E3FA
+E3FB
+E3FC
+E3FD
+E3FE
+E3FF
+E400
+E401
+E402
+E403
+E404
+E405
+E406
+E407
+E408
+E409
+E40A
+E40B
+E40C
+E40D
+E40E
+E40F
+E410
+E411
+E412
+E413
+E414
+E415
+E416
+E417
+E418
+E419
+E41A
+E41B
+E41C
+E41D
+E41E
+E41F
+E420
+E421
+E422
+E423
+E424
+E425
+E426
+E427
+E428
+E429
+E42A
+E42B
+E42C
+E42D
+E42E
+E42F
+E430
+E431
+E432
+E433
+E434
+E435
+E436
+E437
+E438
+E439
+E43A
+E43B
+E43C
+E43D
+E43E
+E43F
+E440
+E441
+E442
+E443
+E444
+E445
+E446
+E447
+E448
+E449
+E44A
+E44B
+E44C
+E44D
+E44E
+E44F
+E450
+E451
+E452
+E453
+E454
+E455
+E456
+E457
+E458
+E459
+E45A
+E45B
+E45C
+E45D
+E45E
+E45F
+E460
+E461
+E462
+E463
+E464
+E465
+E466
+E467
+E468
+E469
+E46A
+E46B
+E46C
+E46D
+E46E
+E46F
+E470
+E471
+E472
+E473
+E474
+E475
+E476
+E477
+E478
+E479
+E47A
+E47B
+E47C
+E47D
+E47E
+E47F
+E480
+E481
+E482
+E483
+E484
+E485
+E486
+E487
+E488
+E489
+E48A
+E48B
+E48C
+E48D
+E48E
+E48F
+E490
+E491
+E492
+E493
+E494
+E495
+E496
+E497
+E498
+E499
+E49A
+E49B
+E49C
+E49D
+E49E
+E49F
+E4A0
+E4A1
+E4A2
+E4A3
+E4A4
+E4A5
+E4A6
+E4A7
+E4A8
+E4A9
+E4AA
+E4AB
+E4AC
+E4AD
+E4AE
+E4AF
+E4B0
+E4B1
+E4B2
+E4B3
+E4B4
+E4B5
+E4B6
+E4B7
+E4B8
+E4B9
+E4BA
+E4BB
+E4BC
+E4BD
+E4BE
+E4BF
+E4C0
+E4C1
+E4C2
+E4C3
+E4C4
+E4C5
+E4C6
+E4C7
+E4C8
+E4C9
+E4CA
+E4CB
+E4CC
+E4CD
+E4CE
+E4CF
+E4D0
+E4D1
+E4D2
+E4D3
+E4D4
+E4D5
+E4D6
+E4D7
+E4D8
+E4D9
+E4DA
+E4DB
+E4DC
+E4DD
+E4DE
+E4DF
+E4E0
+E4E1
+E4E2
+E4E3
+E4E4
+E4E5
+E4E6
+E4E7
+E4E8
+E4E9
+E4EA
+E4EB
+E4EC
+E4ED
+E4EE
+E4EF
+E4F0
+E4F1
+E4F2
+E4F3
+E4F4
+E4F5
+E4F6
+E4F7
+E4F8
+E4F9
+E4FA
+E4FB
+E4FC
+E4FD
+E4FE
+E4FF
+E500
+E501
+E502
+E503
+E504
+E505
+E506
+E507
+E508
+E509
+E50A
+E50B
+E50C
+E50D
+E50E
+E50F
+E510
+E511
+E512
+E513
+E514
+E515
+E516
+E517
+E518
+E519
+E51A
+E51B
+E51C
+E51D
+E51E
+E51F
+E520
+E521
+E522
+E523
+E524
+E525
+E526
+E527
+E528
+E529
+E52A
+E52B
+E52C
+E52D
+E52E
+E52F
+E530
+E531
+E532
+E533
+E534
+E535
+E536
+E537
+E538
+E539
+E53A
+E53B
+E53C
+E53D
+E53E
+E53F
+E540
+E541
+E542
+E543
+E544
+E545
+E546
+E547
+E548
+E549
+E54A
+E54B
+E54C
+E54D
+E54E
+E54F
+E550
+E551
+E552
+E553
+E554
+E555
+E556
+E557
+E558
+E559
+E55A
+E55B
+E55C
+E55D
+E55E
+E55F
+E560
+E561
+E562
+E563
+E564
+E565
+E566
+E567
+E568
+E569
+E56A
+E56B
+E56C
+E56D
+E56E
+E56F
+E570
+E571
+E572
+E573
+E574
+E575
+E576
+E577
+E578
+E579
+E57A
+E57B
+E57C
+E57D
+E57E
+E57F
+E580
+E581
+E582
+E583
+E584
+E585
+E586
+E587
+E588
+E589
+E58A
+E58B
+E58C
+E58D
+E58E
+E58F
+E590
+E591
+E592
+E593
+E594
+E595
+E596
+E597
+E598
+E599
+E59A
+E59B
+E59C
+E59D
+E59E
+E59F
+E5A0
+E5A1
+E5A2
+E5A3
+E5A4
+E5A5
+E5A6
+E5A7
+E5A8
+E5A9
+E5AA
+E5AB
+E5AC
+E5AD
+E5AE
+E5AF
+E5B0
+E5B1
+E5B2
+E5B3
+E5B4
+E5B5
+E5B6
+E5B7
+E5B8
+E5B9
+E5BA
+E5BB
+E5BC
+E5BD
+E5BE
+E5BF
+E5C0
+E5C1
+E5C2
+E5C3
+E5C4
+E5C5
+E5C6
+E5C7
+E5C8
+E5C9
+E5CA
+E5CB
+E5CC
+E5CD
+E5CE
+E5CF
+E5D0
+E5D1
+E5D2
+E5D3
+E5D4
+E5D5
+E5D6
+E5D7
+E5D8
+E5D9
+E5DA
+E5DB
+E5DC
+E5DD
+E5DE
+E5DF
+E5E0
+E5E1
+E5E2
+E5E3
+E5E4
+E5E5
+E5E6
+E5E7
+E5E8
+E5E9
+E5EA
+E5EB
+E5EC
+E5ED
+E5EE
+E5EF
+E5F0
+E5F1
+E5F2
+E5F3
+E5F4
+E5F5
+E5F6
+E5F7
+E5F8
+E5F9
+E5FA
+E5FB
+E5FC
+E5FD
+E5FE
+E5FF
+E600
+E601
+E602
+E603
+E604
+E605
+E606
+E607
+E608
+E609
+E60A
+E60B
+E60C
+E60D
+E60E
+E60F
+E610
+E611
+E612
+E613
+E614
+E615
+E616
+E617
+E618
+E619
+E61A
+E61B
+E61C
+E61D
+E61E
+E61F
+E620
+E621
+E622
+E623
+E624
+E625
+E626
+E627
+E628
+E629
+E62A
+E62B
+E62C
+E62D
+E62E
+E62F
+E630
+E631
+E632
+E633
+E634
+E635
+E636
+E637
+E638
+E639
+E63A
+E63B
+E63C
+E63D
+E63E
+E63F
+E640
+E641
+E642
+E643
+E644
+E645
+E646
+E647
+E648
+E649
+E64A
+E64B
+E64C
+E64D
+E64E
+E64F
+E650
+E651
+E652
+E653
+E654
+E655
+E656
+E657
+E658
+E659
+E65A
+E65B
+E65C
+E65D
+E65E
+E65F
+E660
+E661
+E662
+E663
+E664
+E665
+E666
+E667
+E668
+E669
+E66A
+E66B
+E66C
+E66D
+E66E
+E66F
+E670
+E671
+E672
+E673
+E674
+E675
+E676
+E677
+E678
+E679
+E67A
+E67B
+E67C
+E67D
+E67E
+E67F
+E680
+E681
+E682
+E683
+E684
+E685
+E686
+E687
+E688
+E689
+E68A
+E68B
+E68C
+E68D
+E68E
+E68F
+E690
+E691
+E692
+E693
+E694
+E695
+E696
+E697
+E698
+E699
+E69A
+E69B
+E69C
+E69D
+E69E
+E69F
+E6A0
+E6A1
+E6A2
+E6A3
+E6A4
+E6A5
+E6A6
+E6A7
+E6A8
+E6A9
+E6AA
+E6AB
+E6AC
+E6AD
+E6AE
+E6AF
+E6B0
+E6B1
+E6B2
+E6B3
+E6B4
+E6B5
+E6B6
+E6B7
+E6B8
+E6B9
+E6BA
+E6BB
+E6BC
+E6BD
+E6BE
+E6BF
+E6C0
+E6C1
+E6C2
+E6C3
+E6C4
+E6C5
+E6C6
+E6C7
+E6C8
+E6C9
+E6CA
+E6CB
+E6CC
+E6CD
+E6CE
+E6CF
+E6D0
+E6D1
+E6D2
+E6D3
+E6D4
+E6D5
+E6D6
+E6D7
+E6D8
+E6D9
+E6DA
+E6DB
+E6DC
+E6DD
+E6DE
+E6DF
+E6E0
+E6E1
+E6E2
+E6E3
+E6E4
+E6E5
+E6E6
+E6E7
+E6E8
+E6E9
+E6EA
+E6EB
+E6EC
+E6ED
+E6EE
+E6EF
+E6F0
+E6F1
+E6F2
+E6F3
+E6F4
+E6F5
+E6F6
+E6F7
+E6F8
+E6F9
+E6FA
+E6FB
+E6FC
+E6FD
+E6FE
+E6FF
+E700
+E701
+E702
+E703
+E704
+E705
+E706
+E707
+E708
+E709
+E70A
+E70B
+E70C
+E70D
+E70E
+E70F
+E710
+E711
+E712
+E713
+E714
+E715
+E716
+E717
+E718
+E719
+E71A
+E71B
+E71C
+E71D
+E71E
+E71F
+E720
+E721
+E722
+E723
+E724
+E725
+E726
+E727
+E728
+E729
+E72A
+E72B
+E72C
+E72D
+E72E
+E72F
+E730
+E731
+E732
+E733
+E734
+E735
+E736
+E737
+E738
+E739
+E73A
+E73B
+E73C
+E73D
+E73E
+E73F
+E740
+E741
+E742
+E743
+E744
+E745
+E746
+E747
+E748
+E749
+E74A
+E74B
+E74C
+E74D
+E74E
+E74F
+E750
+E751
+E752
+E753
+E754
+E755
+E756
+E757
+CREATE TABLE t3 SELECT CONVERT(c1 USING cp932) AS c1 FROM t2;
+SELECT HEX(c1) FROM t3;
+HEX(c1)
+05
+7E
+815C
+815F
+8160
+8161
+817C
+8191
+8192
+81CA
+8740
+8741
+8742
+8743
+8744
+8745
+8746
+8747
+8748
+8749
+874A
+874B
+874C
+874D
+874E
+874F
+8750
+8751
+8752
+8753
+8754
+8755
+8756
+8757
+8758
+8759
+875A
+875B
+875C
+875D
+875F
+8760
+8761
+8762
+8763
+8764
+8765
+8766
+8767
+8768
+8769
+876A
+876B
+876C
+876D
+876E
+876F
+8770
+8771
+8772
+8773
+8774
+8775
+877E
+8780
+8781
+8782
+8783
+8784
+8785
+8786
+8787
+8788
+8789
+878A
+878B
+878C
+878D
+878E
+878F
+81E0
+81DF
+81E7
+8793
+8794
+81E3
+81DB
+81DA
+8798
+8799
+81E6
+81BF
+81BE
+FA5C
+FA5D
+FA5E
+FA5F
+FA60
+FA61
+FA62
+FA63
+FA64
+FA65
+FA66
+FA67
+FA68
+FA69
+FA6A
+FA6B
+FA6C
+FA6D
+FA6E
+FA6F
+FA70
+FA71
+FA72
+FA73
+FA74
+FA75
+FA76
+FA77
+FA78
+FA79
+FA7A
+FA7B
+FA7C
+FA7D
+FA7E
+FA80
+FA81
+FA82
+FA83
+FA84
+FA85
+FA86
+FA87
+FA88
+FA89
+FA8A
+FA8B
+FA8C
+FA8D
+FA8E
+FA8F
+FA90
+FA91
+FA92
+FA93
+FA94
+FA95
+FA96
+FA97
+FA98
+FA99
+FA9A
+FA9B
+FA9C
+FA9D
+FA9E
+FA9F
+FAA0
+FAA1
+FAA2
+FAA3
+FAA4
+FAA5
+FAA6
+FAA7
+FAA8
+FAA9
+FAAA
+FAAB
+FAAC
+FAAD
+FAAE
+FAAF
+FAB0
+FAB1
+FAB2
+FAB3
+FAB4
+FAB5
+FAB6
+FAB7
+FAB8
+FAB9
+FABA
+FABB
+FABC
+FABD
+FABE
+FABF
+FAC0
+FAC1
+FAC2
+FAC3
+FAC4
+FAC5
+FAC6
+FAC7
+FAC8
+FAC9
+FACA
+FACB
+FACC
+FACD
+FACE
+FACF
+FAD0
+FAD1
+FAD2
+FAD3
+FAD4
+FAD5
+FAD6
+FAD7
+FAD8
+FAD9
+FADA
+FADB
+FADC
+FADD
+FADE
+FADF
+FAE0
+FAE1
+FAE2
+FAE3
+FAE4
+FAE5
+FAE6
+FAE7
+FAE8
+FAE9
+FAEA
+FAEB
+FAEC
+FAED
+FAEE
+FAEF
+FAF0
+FAF1
+FAF2
+FAF3
+FAF4
+FAF5
+FAF6
+FAF7
+FAF8
+FAF9
+FAFA
+FAFB
+FAFC
+FB40
+FB41
+FB42
+FB43
+FB44
+FB45
+FB46
+FB47
+FB48
+FB49
+FB4A
+FB4B
+FB4C
+FB4D
+FB4E
+FB4F
+FB50
+FB51
+FB52
+FB53
+FB54
+FB55
+FB56
+FB57
+FB58
+FB59
+FB5A
+FB5B
+FB5C
+FB5D
+FB5E
+FB5F
+FB60
+FB61
+FB62
+FB63
+FB64
+FB65
+FB66
+FB67
+FB68
+FB69
+FB6A
+FB6B
+FB6C
+FB6D
+FB6E
+FB6F
+FB70
+FB71
+FB72
+FB73
+FB74
+FB75
+FB76
+FB77
+FB78
+FB79
+FB7A
+FB7B
+FB7C
+FB7D
+FB7E
+FB80
+FB81
+FB82
+FB83
+FB84
+FB85
+FB86
+FB87
+FB88
+FB89
+FB8A
+FB8B
+FB8C
+FB8D
+FB8E
+FB8F
+FB90
+FB91
+FB92
+FB93
+FB94
+FB95
+FB96
+FB97
+FB98
+FB99
+FB9A
+FB9B
+FB9C
+FB9D
+FB9E
+FB9F
+FBA0
+FBA1
+FBA2
+FBA3
+FBA4
+FBA5
+FBA6
+FBA7
+FBA8
+FBA9
+FBAA
+FBAB
+FBAC
+FBAD
+FBAE
+FBAF
+FBB0
+FBB1
+FBB2
+FBB3
+FBB4
+FBB5
+FBB6
+FBB7
+FBB8
+FBB9
+FBBA
+FBBB
+FBBC
+FBBD
+FBBE
+FBBF
+FBC0
+FBC1
+FBC2
+FBC3
+FBC4
+FBC5
+FBC6
+FBC7
+FBC8
+FBC9
+FBCA
+FBCB
+FBCC
+FBCD
+FBCE
+FBCF
+FBD0
+FBD1
+FBD2
+FBD3
+FBD4
+FBD5
+FBD6
+FBD7
+FBD8
+FBD9
+FBDA
+FBDB
+FBDC
+FBDD
+FBDE
+FBDF
+FBE0
+FBE1
+FBE2
+FBE3
+FBE4
+FBE5
+FBE6
+FBE7
+FBE8
+FBE9
+FBEA
+FBEB
+FBEC
+FBED
+FBEE
+FBEF
+FBF0
+FBF1
+FBF2
+FBF3
+FBF4
+FBF5
+FBF6
+FBF7
+FBF8
+FBF9
+FBFA
+FBFB
+FBFC
+FC40
+FC41
+FC42
+FC43
+FC44
+FC45
+FC46
+FC47
+FC48
+FC49
+FC4A
+FC4B
+FA40
+FA41
+FA42
+FA43
+FA44
+FA45
+FA46
+FA47
+FA48
+FA49
+81CA
+FA55
+FA56
+FA57
+FA40
+FA41
+FA42
+FA43
+FA44
+FA45
+FA46
+FA47
+FA48
+FA49
+8754
+8755
+8756
+8757
+8758
+8759
+875A
+875B
+875C
+875D
+81CA
+FA55
+FA56
+FA57
+878A
+8782
+8784
+81E6
+FA5C
+FA5D
+FA5E
+FA5F
+FA60
+FA61
+FA62
+FA63
+FA64
+FA65
+FA66
+FA67
+FA68
+FA69
+FA6A
+FA6B
+FA6C
+FA6D
+FA6E
+FA6F
+FA70
+FA71
+FA72
+FA73
+FA74
+FA75
+FA76
+FA77
+FA78
+FA79
+FA7A
+FA7B
+FA7C
+FA7D
+FA7E
+FA80
+FA81
+FA82
+FA83
+FA84
+FA85
+FA86
+FA87
+FA88
+FA89
+FA8A
+FA8B
+FA8C
+FA8D
+FA8E
+FA8F
+FA90
+FA91
+FA92
+FA93
+FA94
+FA95
+FA96
+FA97
+FA98
+FA99
+FA9A
+FA9B
+FA9C
+FA9D
+FA9E
+FA9F
+FAA0
+FAA1
+FAA2
+FAA3
+FAA4
+FAA5
+FAA6
+FAA7
+FAA8
+FAA9
+FAAA
+FAAB
+FAAC
+FAAD
+FAAE
+FAAF
+FAB0
+FAB1
+FAB2
+FAB3
+FAB4
+FAB5
+FAB6
+FAB7
+FAB8
+FAB9
+FABA
+FABB
+FABC
+FABD
+FABE
+FABF
+FAC0
+FAC1
+FAC2
+FAC3
+FAC4
+FAC5
+FAC6
+FAC7
+FAC8
+FAC9
+FACA
+FACB
+FACC
+FACD
+FACE
+FACF
+FAD0
+FAD1
+FAD2
+FAD3
+FAD4
+FAD5
+FAD6
+FAD7
+FAD8
+FAD9
+FADA
+FADB
+FADC
+FADD
+FADE
+FADF
+FAE0
+FAE1
+FAE2
+FAE3
+FAE4
+FAE5
+FAE6
+FAE7
+FAE8
+FAE9
+FAEA
+FAEB
+FAEC
+FAED
+FAEE
+FAEF
+FAF0
+FAF1
+FAF2
+FAF3
+FAF4
+FAF5
+FAF6
+FAF7
+FAF8
+FAF9
+FAFA
+FAFB
+FAFC
+FB40
+FB41
+FB42
+FB43
+FB44
+FB45
+FB46
+FB47
+FB48
+FB49
+FB4A
+FB4B
+FB4C
+FB4D
+FB4E
+FB4F
+FB50
+FB51
+FB52
+FB53
+FB54
+FB55
+FB56
+FB57
+FB58
+FB59
+FB5A
+FB5B
+FB5C
+FB5D
+FB5E
+FB5F
+FB60
+FB61
+FB62
+FB63
+FB64
+FB65
+FB66
+FB67
+FB68
+FB69
+FB6A
+FB6B
+FB6C
+FB6D
+FB6E
+FB6F
+FB70
+FB71
+FB72
+FB73
+FB74
+FB75
+FB76
+FB77
+FB78
+FB79
+FB7A
+FB7B
+FB7C
+FB7D
+FB7E
+FB80
+FB81
+FB82
+FB83
+FB84
+FB85
+FB86
+FB87
+FB88
+FB89
+FB8A
+FB8B
+FB8C
+FB8D
+FB8E
+FB8F
+FB90
+FB91
+FB92
+FB93
+FB94
+FB95
+FB96
+FB97
+FB98
+FB99
+FB9A
+FB9B
+FB9C
+FB9D
+FB9E
+FB9F
+FBA0
+FBA1
+FBA2
+FBA3
+FBA4
+FBA5
+FBA6
+FBA7
+FBA8
+FBA9
+FBAA
+FBAB
+FBAC
+FBAD
+FBAE
+FBAF
+FBB0
+FBB1
+FBB2
+FBB3
+FBB4
+FBB5
+FBB6
+FBB7
+FBB8
+FBB9
+FBBA
+FBBB
+FBBC
+FBBD
+FBBE
+FBBF
+FBC0
+FBC1
+FBC2
+FBC3
+FBC4
+FBC5
+FBC6
+FBC7
+FBC8
+FBC9
+FBCA
+FBCB
+FBCC
+FBCD
+FBCE
+FBCF
+FBD0
+FBD1
+FBD2
+FBD3
+FBD4
+FBD5
+FBD6
+FBD7
+FBD8
+FBD9
+FBDA
+FBDB
+FBDC
+FBDD
+FBDE
+FBDF
+FBE0
+FBE1
+FBE2
+FBE3
+FBE4
+FBE5
+FBE6
+FBE7
+FBE8
+FBE9
+FBEA
+FBEB
+FBEC
+FBED
+FBEE
+FBEF
+FBF0
+FBF1
+FBF2
+FBF3
+FBF4
+FBF5
+FBF6
+FBF7
+FBF8
+FBF9
+FBFA
+FBFB
+FBFC
+FC40
+FC41
+FC42
+FC43
+FC44
+FC45
+FC46
+FC47
+FC48
+FC49
+FC4A
+FC4B
+F040
+F041
+F042
+F043
+F044
+F045
+F046
+F047
+F048
+F049
+F04A
+F04B
+F04C
+F04D
+F04E
+F04F
+F050
+F051
+F052
+F053
+F054
+F055
+F056
+F057
+F058
+F059
+F05A
+F05B
+F05C
+F05D
+F05E
+F05F
+F060
+F061
+F062
+F063
+F064
+F065
+F066
+F067
+F068
+F069
+F06A
+F06B
+F06C
+F06D
+F06E
+F06F
+F070
+F071
+F072
+F073
+F074
+F075
+F076
+F077
+F078
+F079
+F07A
+F07B
+F07C
+F07D
+F07E
+F080
+F081
+F082
+F083
+F084
+F085
+F086
+F087
+F088
+F089
+F08A
+F08B
+F08C
+F08D
+F08E
+F08F
+F090
+F091
+F092
+F093
+F094
+F095
+F096
+F097
+F098
+F099
+F09A
+F09B
+F09C
+F09D
+F09E
+F09F
+F0A0
+F0A1
+F0A2
+F0A3
+F0A4
+F0A5
+F0A6
+F0A7
+F0A8
+F0A9
+F0AA
+F0AB
+F0AC
+F0AD
+F0AE
+F0AF
+F0B0
+F0B1
+F0B2
+F0B3
+F0B4
+F0B5
+F0B6
+F0B7
+F0B8
+F0B9
+F0BA
+F0BB
+F0BC
+F0BD
+F0BE
+F0BF
+F0C0
+F0C1
+F0C2
+F0C3
+F0C4
+F0C5
+F0C6
+F0C7
+F0C8
+F0C9
+F0CA
+F0CB
+F0CC
+F0CD
+F0CE
+F0CF
+F0D0
+F0D1
+F0D2
+F0D3
+F0D4
+F0D5
+F0D6
+F0D7
+F0D8
+F0D9
+F0DA
+F0DB
+F0DC
+F0DD
+F0DE
+F0DF
+F0E0
+F0E1
+F0E2
+F0E3
+F0E4
+F0E5
+F0E6
+F0E7
+F0E8
+F0E9
+F0EA
+F0EB
+F0EC
+F0ED
+F0EE
+F0EF
+F0F0
+F0F1
+F0F2
+F0F3
+F0F4
+F0F5
+F0F6
+F0F7
+F0F8
+F0F9
+F0FA
+F0FB
+F0FC
+F140
+F141
+F142
+F143
+F144
+F145
+F146
+F147
+F148
+F149
+F14A
+F14B
+F14C
+F14D
+F14E
+F14F
+F150
+F151
+F152
+F153
+F154
+F155
+F156
+F157
+F158
+F159
+F15A
+F15B
+F15C
+F15D
+F15E
+F15F
+F160
+F161
+F162
+F163
+F164
+F165
+F166
+F167
+F168
+F169
+F16A
+F16B
+F16C
+F16D
+F16E
+F16F
+F170
+F171
+F172
+F173
+F174
+F175
+F176
+F177
+F178
+F179
+F17A
+F17B
+F17C
+F17D
+F17E
+F180
+F181
+F182
+F183
+F184
+F185
+F186
+F187
+F188
+F189
+F18A
+F18B
+F18C
+F18D
+F18E
+F18F
+F190
+F191
+F192
+F193
+F194
+F195
+F196
+F197
+F198
+F199
+F19A
+F19B
+F19C
+F19D
+F19E
+F19F
+F1A0
+F1A1
+F1A2
+F1A3
+F1A4
+F1A5
+F1A6
+F1A7
+F1A8
+F1A9
+F1AA
+F1AB
+F1AC
+F1AD
+F1AE
+F1AF
+F1B0
+F1B1
+F1B2
+F1B3
+F1B4
+F1B5
+F1B6
+F1B7
+F1B8
+F1B9
+F1BA
+F1BB
+F1BC
+F1BD
+F1BE
+F1BF
+F1C0
+F1C1
+F1C2
+F1C3
+F1C4
+F1C5
+F1C6
+F1C7
+F1C8
+F1C9
+F1CA
+F1CB
+F1CC
+F1CD
+F1CE
+F1CF
+F1D0
+F1D1
+F1D2
+F1D3
+F1D4
+F1D5
+F1D6
+F1D7
+F1D8
+F1D9
+F1DA
+F1DB
+F1DC
+F1DD
+F1DE
+F1DF
+F1E0
+F1E1
+F1E2
+F1E3
+F1E4
+F1E5
+F1E6
+F1E7
+F1E8
+F1E9
+F1EA
+F1EB
+F1EC
+F1ED
+F1EE
+F1EF
+F1F0
+F1F1
+F1F2
+F1F3
+F1F4
+F1F5
+F1F6
+F1F7
+F1F8
+F1F9
+F1FA
+F1FB
+F1FC
+F240
+F241
+F242
+F243
+F244
+F245
+F246
+F247
+F248
+F249
+F24A
+F24B
+F24C
+F24D
+F24E
+F24F
+F250
+F251
+F252
+F253
+F254
+F255
+F256
+F257
+F258
+F259
+F25A
+F25B
+F25C
+F25D
+F25E
+F25F
+F260
+F261
+F262
+F263
+F264
+F265
+F266
+F267
+F268
+F269
+F26A
+F26B
+F26C
+F26D
+F26E
+F26F
+F270
+F271
+F272
+F273
+F274
+F275
+F276
+F277
+F278
+F279
+F27A
+F27B
+F27C
+F27D
+F27E
+F280
+F281
+F282
+F283
+F284
+F285
+F286
+F287
+F288
+F289
+F28A
+F28B
+F28C
+F28D
+F28E
+F28F
+F290
+F291
+F292
+F293
+F294
+F295
+F296
+F297
+F298
+F299
+F29A
+F29B
+F29C
+F29D
+F29E
+F29F
+F2A0
+F2A1
+F2A2
+F2A3
+F2A4
+F2A5
+F2A6
+F2A7
+F2A8
+F2A9
+F2AA
+F2AB
+F2AC
+F2AD
+F2AE
+F2AF
+F2B0
+F2B1
+F2B2
+F2B3
+F2B4
+F2B5
+F2B6
+F2B7
+F2B8
+F2B9
+F2BA
+F2BB
+F2BC
+F2BD
+F2BE
+F2BF
+F2C0
+F2C1
+F2C2
+F2C3
+F2C4
+F2C5
+F2C6
+F2C7
+F2C8
+F2C9
+F2CA
+F2CB
+F2CC
+F2CD
+F2CE
+F2CF
+F2D0
+F2D1
+F2D2
+F2D3
+F2D4
+F2D5
+F2D6
+F2D7
+F2D8
+F2D9
+F2DA
+F2DB
+F2DC
+F2DD
+F2DE
+F2DF
+F2E0
+F2E1
+F2E2
+F2E3
+F2E4
+F2E5
+F2E6
+F2E7
+F2E8
+F2E9
+F2EA
+F2EB
+F2EC
+F2ED
+F2EE
+F2EF
+F2F0
+F2F1
+F2F2
+F2F3
+F2F4
+F2F5
+F2F6
+F2F7
+F2F8
+F2F9
+F2FA
+F2FB
+F2FC
+F340
+F341
+F342
+F343
+F344
+F345
+F346
+F347
+F348
+F349
+F34A
+F34B
+F34C
+F34D
+F34E
+F34F
+F350
+F351
+F352
+F353
+F354
+F355
+F356
+F357
+F358
+F359
+F35A
+F35B
+F35C
+F35D
+F35E
+F35F
+F360
+F361
+F362
+F363
+F364
+F365
+F366
+F367
+F368
+F369
+F36A
+F36B
+F36C
+F36D
+F36E
+F36F
+F370
+F371
+F372
+F373
+F374
+F375
+F376
+F377
+F378
+F379
+F37A
+F37B
+F37C
+F37D
+F37E
+F380
+F381
+F382
+F383
+F384
+F385
+F386
+F387
+F388
+F389
+F38A
+F38B
+F38C
+F38D
+F38E
+F38F
+F390
+F391
+F392
+F393
+F394
+F395
+F396
+F397
+F398
+F399
+F39A
+F39B
+F39C
+F39D
+F39E
+F39F
+F3A0
+F3A1
+F3A2
+F3A3
+F3A4
+F3A5
+F3A6
+F3A7
+F3A8
+F3A9
+F3AA
+F3AB
+F3AC
+F3AD
+F3AE
+F3AF
+F3B0
+F3B1
+F3B2
+F3B3
+F3B4
+F3B5
+F3B6
+F3B7
+F3B8
+F3B9
+F3BA
+F3BB
+F3BC
+F3BD
+F3BE
+F3BF
+F3C0
+F3C1
+F3C2
+F3C3
+F3C4
+F3C5
+F3C6
+F3C7
+F3C8
+F3C9
+F3CA
+F3CB
+F3CC
+F3CD
+F3CE
+F3CF
+F3D0
+F3D1
+F3D2
+F3D3
+F3D4
+F3D5
+F3D6
+F3D7
+F3D8
+F3D9
+F3DA
+F3DB
+F3DC
+F3DD
+F3DE
+F3DF
+F3E0
+F3E1
+F3E2
+F3E3
+F3E4
+F3E5
+F3E6
+F3E7
+F3E8
+F3E9
+F3EA
+F3EB
+F3EC
+F3ED
+F3EE
+F3EF
+F3F0
+F3F1
+F3F2
+F3F3
+F3F4
+F3F5
+F3F6
+F3F7
+F3F8
+F3F9
+F3FA
+F3FB
+F3FC
+F440
+F441
+F442
+F443
+F444
+F445
+F446
+F447
+F448
+F449
+F44A
+F44B
+F44C
+F44D
+F44E
+F44F
+F450
+F451
+F452
+F453
+F454
+F455
+F456
+F457
+F458
+F459
+F45A
+F45B
+F45C
+F45D
+F45E
+F45F
+F460
+F461
+F462
+F463
+F464
+F465
+F466
+F467
+F468
+F469
+F46A
+F46B
+F46C
+F46D
+F46E
+F46F
+F470
+F471
+F472
+F473
+F474
+F475
+F476
+F477
+F478
+F479
+F47A
+F47B
+F47C
+F47D
+F47E
+F480
+F481
+F482
+F483
+F484
+F485
+F486
+F487
+F488
+F489
+F48A
+F48B
+F48C
+F48D
+F48E
+F48F
+F490
+F491
+F492
+F493
+F494
+F495
+F496
+F497
+F498
+F499
+F49A
+F49B
+F49C
+F49D
+F49E
+F49F
+F4A0
+F4A1
+F4A2
+F4A3
+F4A4
+F4A5
+F4A6
+F4A7
+F4A8
+F4A9
+F4AA
+F4AB
+F4AC
+F4AD
+F4AE
+F4AF
+F4B0
+F4B1
+F4B2
+F4B3
+F4B4
+F4B5
+F4B6
+F4B7
+F4B8
+F4B9
+F4BA
+F4BB
+F4BC
+F4BD
+F4BE
+F4BF
+F4C0
+F4C1
+F4C2
+F4C3
+F4C4
+F4C5
+F4C6
+F4C7
+F4C8
+F4C9
+F4CA
+F4CB
+F4CC
+F4CD
+F4CE
+F4CF
+F4D0
+F4D1
+F4D2
+F4D3
+F4D4
+F4D5
+F4D6
+F4D7
+F4D8
+F4D9
+F4DA
+F4DB
+F4DC
+F4DD
+F4DE
+F4DF
+F4E0
+F4E1
+F4E2
+F4E3
+F4E4
+F4E5
+F4E6
+F4E7
+F4E8
+F4E9
+F4EA
+F4EB
+F4EC
+F4ED
+F4EE
+F4EF
+F4F0
+F4F1
+F4F2
+F4F3
+F4F4
+F4F5
+F4F6
+F4F7
+F4F8
+F4F9
+F4FA
+F4FB
+F4FC
+F540
+F541
+F542
+F543
+F544
+F545
+F546
+F547
+F548
+F549
+F54A
+F54B
+F54C
+F54D
+F54E
+F54F
+F550
+F551
+F552
+F553
+F554
+F555
+F556
+F557
+F558
+F559
+F55A
+F55B
+F55C
+F55D
+F55E
+F55F
+F560
+F561
+F562
+F563
+F564
+F565
+F566
+F567
+F568
+F569
+F56A
+F56B
+F56C
+F56D
+F56E
+F56F
+F570
+F571
+F572
+F573
+F574
+F575
+F576
+F577
+F578
+F579
+F57A
+F57B
+F57C
+F57D
+F57E
+F580
+F581
+F582
+F583
+F584
+F585
+F586
+F587
+F588
+F589
+F58A
+F58B
+F58C
+F58D
+F58E
+F58F
+F590
+F591
+F592
+F593
+F594
+F595
+F596
+F597
+F598
+F599
+F59A
+F59B
+F59C
+F59D
+F59E
+F59F
+F5A0
+F5A1
+F5A2
+F5A3
+F5A4
+F5A5
+F5A6
+F5A7
+F5A8
+F5A9
+F5AA
+F5AB
+F5AC
+F5AD
+F5AE
+F5AF
+F5B0
+F5B1
+F5B2
+F5B3
+F5B4
+F5B5
+F5B6
+F5B7
+F5B8
+F5B9
+F5BA
+F5BB
+F5BC
+F5BD
+F5BE
+F5BF
+F5C0
+F5C1
+F5C2
+F5C3
+F5C4
+F5C5
+F5C6
+F5C7
+F5C8
+F5C9
+F5CA
+F5CB
+F5CC
+F5CD
+F5CE
+F5CF
+F5D0
+F5D1
+F5D2
+F5D3
+F5D4
+F5D5
+F5D6
+F5D7
+F5D8
+F5D9
+F5DA
+F5DB
+F5DC
+F5DD
+F5DE
+F5DF
+F5E0
+F5E1
+F5E2
+F5E3
+F5E4
+F5E5
+F5E6
+F5E7
+F5E8
+F5E9
+F5EA
+F5EB
+F5EC
+F5ED
+F5EE
+F5EF
+F5F0
+F5F1
+F5F2
+F5F3
+F5F4
+F5F5
+F5F6
+F5F7
+F5F8
+F5F9
+F5FA
+F5FB
+F5FC
+F640
+F641
+F642
+F643
+F644
+F645
+F646
+F647
+F648
+F649
+F64A
+F64B
+F64C
+F64D
+F64E
+F64F
+F650
+F651
+F652
+F653
+F654
+F655
+F656
+F657
+F658
+F659
+F65A
+F65B
+F65C
+F65D
+F65E
+F65F
+F660
+F661
+F662
+F663
+F664
+F665
+F666
+F667
+F668
+F669
+F66A
+F66B
+F66C
+F66D
+F66E
+F66F
+F670
+F671
+F672
+F673
+F674
+F675
+F676
+F677
+F678
+F679
+F67A
+F67B
+F67C
+F67D
+F67E
+F680
+F681
+F682
+F683
+F684
+F685
+F686
+F687
+F688
+F689
+F68A
+F68B
+F68C
+F68D
+F68E
+F68F
+F690
+F691
+F692
+F693
+F694
+F695
+F696
+F697
+F698
+F699
+F69A
+F69B
+F69C
+F69D
+F69E
+F69F
+F6A0
+F6A1
+F6A2
+F6A3
+F6A4
+F6A5
+F6A6
+F6A7
+F6A8
+F6A9
+F6AA
+F6AB
+F6AC
+F6AD
+F6AE
+F6AF
+F6B0
+F6B1
+F6B2
+F6B3
+F6B4
+F6B5
+F6B6
+F6B7
+F6B8
+F6B9
+F6BA
+F6BB
+F6BC
+F6BD
+F6BE
+F6BF
+F6C0
+F6C1
+F6C2
+F6C3
+F6C4
+F6C5
+F6C6
+F6C7
+F6C8
+F6C9
+F6CA
+F6CB
+F6CC
+F6CD
+F6CE
+F6CF
+F6D0
+F6D1
+F6D2
+F6D3
+F6D4
+F6D5
+F6D6
+F6D7
+F6D8
+F6D9
+F6DA
+F6DB
+F6DC
+F6DD
+F6DE
+F6DF
+F6E0
+F6E1
+F6E2
+F6E3
+F6E4
+F6E5
+F6E6
+F6E7
+F6E8
+F6E9
+F6EA
+F6EB
+F6EC
+F6ED
+F6EE
+F6EF
+F6F0
+F6F1
+F6F2
+F6F3
+F6F4
+F6F5
+F6F6
+F6F7
+F6F8
+F6F9
+F6FA
+F6FB
+F6FC
+F740
+F741
+F742
+F743
+F744
+F745
+F746
+F747
+F748
+F749
+F74A
+F74B
+F74C
+F74D
+F74E
+F74F
+F750
+F751
+F752
+F753
+F754
+F755
+F756
+F757
+F758
+F759
+F75A
+F75B
+F75C
+F75D
+F75E
+F75F
+F760
+F761
+F762
+F763
+F764
+F765
+F766
+F767
+F768
+F769
+F76A
+F76B
+F76C
+F76D
+F76E
+F76F
+F770
+F771
+F772
+F773
+F774
+F775
+F776
+F777
+F778
+F779
+F77A
+F77B
+F77C
+F77D
+F77E
+F780
+F781
+F782
+F783
+F784
+F785
+F786
+F787
+F788
+F789
+F78A
+F78B
+F78C
+F78D
+F78E
+F78F
+F790
+F791
+F792
+F793
+F794
+F795
+F796
+F797
+F798
+F799
+F79A
+F79B
+F79C
+F79D
+F79E
+F79F
+F7A0
+F7A1
+F7A2
+F7A3
+F7A4
+F7A5
+F7A6
+F7A7
+F7A8
+F7A9
+F7AA
+F7AB
+F7AC
+F7AD
+F7AE
+F7AF
+F7B0
+F7B1
+F7B2
+F7B3
+F7B4
+F7B5
+F7B6
+F7B7
+F7B8
+F7B9
+F7BA
+F7BB
+F7BC
+F7BD
+F7BE
+F7BF
+F7C0
+F7C1
+F7C2
+F7C3
+F7C4
+F7C5
+F7C6
+F7C7
+F7C8
+F7C9
+F7CA
+F7CB
+F7CC
+F7CD
+F7CE
+F7CF
+F7D0
+F7D1
+F7D2
+F7D3
+F7D4
+F7D5
+F7D6
+F7D7
+F7D8
+F7D9
+F7DA
+F7DB
+F7DC
+F7DD
+F7DE
+F7DF
+F7E0
+F7E1
+F7E2
+F7E3
+F7E4
+F7E5
+F7E6
+F7E7
+F7E8
+F7E9
+F7EA
+F7EB
+F7EC
+F7ED
+F7EE
+F7EF
+F7F0
+F7F1
+F7F2
+F7F3
+F7F4
+F7F5
+F7F6
+F7F7
+F7F8
+F7F9
+F7FA
+F7FB
+F7FC
+F840
+F841
+F842
+F843
+F844
+F845
+F846
+F847
+F848
+F849
+F84A
+F84B
+F84C
+F84D
+F84E
+F84F
+F850
+F851
+F852
+F853
+F854
+F855
+F856
+F857
+F858
+F859
+F85A
+F85B
+F85C
+F85D
+F85E
+F85F
+F860
+F861
+F862
+F863
+F864
+F865
+F866
+F867
+F868
+F869
+F86A
+F86B
+F86C
+F86D
+F86E
+F86F
+F870
+F871
+F872
+F873
+F874
+F875
+F876
+F877
+F878
+F879
+F87A
+F87B
+F87C
+F87D
+F87E
+F880
+F881
+F882
+F883
+F884
+F885
+F886
+F887
+F888
+F889
+F88A
+F88B
+F88C
+F88D
+F88E
+F88F
+F890
+F891
+F892
+F893
+F894
+F895
+F896
+F897
+F898
+F899
+F89A
+F89B
+F89C
+F89D
+F89E
+F89F
+F8A0
+F8A1
+F8A2
+F8A3
+F8A4
+F8A5
+F8A6
+F8A7
+F8A8
+F8A9
+F8AA
+F8AB
+F8AC
+F8AD
+F8AE
+F8AF
+F8B0
+F8B1
+F8B2
+F8B3
+F8B4
+F8B5
+F8B6
+F8B7
+F8B8
+F8B9
+F8BA
+F8BB
+F8BC
+F8BD
+F8BE
+F8BF
+F8C0
+F8C1
+F8C2
+F8C3
+F8C4
+F8C5
+F8C6
+F8C7
+F8C8
+F8C9
+F8CA
+F8CB
+F8CC
+F8CD
+F8CE
+F8CF
+F8D0
+F8D1
+F8D2
+F8D3
+F8D4
+F8D5
+F8D6
+F8D7
+F8D8
+F8D9
+F8DA
+F8DB
+F8DC
+F8DD
+F8DE
+F8DF
+F8E0
+F8E1
+F8E2
+F8E3
+F8E4
+F8E5
+F8E6
+F8E7
+F8E8
+F8E9
+F8EA
+F8EB
+F8EC
+F8ED
+F8EE
+F8EF
+F8F0
+F8F1
+F8F2
+F8F3
+F8F4
+F8F5
+F8F6
+F8F7
+F8F8
+F8F9
+F8FA
+F8FB
+F8FC
+F940
+F941
+F942
+F943
+F944
+F945
+F946
+F947
+F948
+F949
+F94A
+F94B
+F94C
+F94D
+F94E
+F94F
+F950
+F951
+F952
+F953
+F954
+F955
+F956
+F957
+F958
+F959
+F95A
+F95B
+F95C
+F95D
+F95E
+F95F
+F960
+F961
+F962
+F963
+F964
+F965
+F966
+F967
+F968
+F969
+F96A
+F96B
+F96C
+F96D
+F96E
+F96F
+F970
+F971
+F972
+F973
+F974
+F975
+F976
+F977
+F978
+F979
+F97A
+F97B
+F97C
+F97D
+F97E
+F980
+F981
+F982
+F983
+F984
+F985
+F986
+F987
+F988
+F989
+F98A
+F98B
+F98C
+F98D
+F98E
+F98F
+F990
+F991
+F992
+F993
+F994
+F995
+F996
+F997
+F998
+F999
+F99A
+F99B
+F99C
+F99D
+F99E
+F99F
+F9A0
+F9A1
+F9A2
+F9A3
+F9A4
+F9A5
+F9A6
+F9A7
+F9A8
+F9A9
+F9AA
+F9AB
+F9AC
+F9AD
+F9AE
+F9AF
+F9B0
+F9B1
+F9B2
+F9B3
+F9B4
+F9B5
+F9B6
+F9B7
+F9B8
+F9B9
+F9BA
+F9BB
+F9BC
+F9BD
+F9BE
+F9BF
+F9C0
+F9C1
+F9C2
+F9C3
+F9C4
+F9C5
+F9C6
+F9C7
+F9C8
+F9C9
+F9CA
+F9CB
+F9CC
+F9CD
+F9CE
+F9CF
+F9D0
+F9D1
+F9D2
+F9D3
+F9D4
+F9D5
+F9D6
+F9D7
+F9D8
+F9D9
+F9DA
+F9DB
+F9DC
+F9DD
+F9DE
+F9DF
+F9E0
+F9E1
+F9E2
+F9E3
+F9E4
+F9E5
+F9E6
+F9E7
+F9E8
+F9E9
+F9EA
+F9EB
+F9EC
+F9ED
+F9EE
+F9EF
+F9F0
+F9F1
+F9F2
+F9F3
+F9F4
+F9F5
+F9F6
+F9F7
+F9F8
+F9F9
+F9FA
+F9FB
+F9FC
+CREATE TABLE t4 SELECT CONVERT(c1 USING eucjpms) AS c1 FROM t1;
+SELECT HEX(c1) FROM t4;
+HEX(c1)
+05
+7E
+A1BD
+A1C0
+A1C1
+A1C2
+A1DD
+A1F1
+A1F2
+A2CC
+ADA1
+ADA2
+ADA3
+ADA4
+ADA5
+ADA6
+ADA7
+ADA8
+ADA9
+ADAA
+ADAB
+ADAC
+ADAD
+ADAE
+ADAF
+ADB0
+ADB1
+ADB2
+ADB3
+ADB4
+ADB5
+ADB6
+ADB7
+ADB8
+ADB9
+ADBA
+ADBB
+ADBC
+ADBD
+ADBE
+ADC0
+ADC1
+ADC2
+ADC3
+ADC4
+ADC5
+ADC6
+ADC7
+ADC8
+ADC9
+ADCA
+ADCB
+ADCC
+ADCD
+ADCE
+ADCF
+ADD0
+ADD1
+ADD2
+ADD3
+ADD4
+ADD5
+ADD6
+ADDF
+ADE0
+ADE1
+ADE2
+ADE3
+ADE4
+ADE5
+ADE6
+ADE7
+ADE8
+ADE9
+ADEA
+ADEB
+ADEC
+ADED
+ADEE
+ADEF
+A2E2
+A2E1
+A2E9
+ADF3
+ADF4
+A2E5
+A2DD
+A2DC
+ADF8
+ADF9
+A2E8
+A2C1
+A2C0
+8FD4E3
+8FDCDF
+8FE4E9
+8FE3F8
+8FD9A1
+8FB1BB
+8FF4AE
+8FC2AD
+8FC3FC
+8FE4D0
+8FC2BF
+8FBCF4
+8FB0A9
+8FB0C8
+8FF4AF
+8FB0D2
+8FB0D4
+8FB0E3
+8FB0EE
+8FB1A7
+8FB1A3
+8FB1AC
+8FB1A9
+8FB1BE
+8FB1DF
+8FB1D8
+8FB1C8
+8FB1D7
+8FB1E3
+8FB1F4
+8FB1E1
+8FB2A3
+8FF4B0
+8FB2BB
+8FB2E6
+8FB2ED
+8FB2F5
+8FB2FC
+8FF4B1
+8FB3B5
+8FB3D8
+8FB3DB
+8FB3E5
+8FB3EE
+8FB3FB
+8FF4B2
+8FF4B3
+8FB4C0
+8FB4C7
+8FB4D0
+8FB4DE
+8FF4B4
+8FB5AA
+8FF4B5
+8FB5AF
+8FB5C4
+8FB5E8
+8FF4B6
+8FB7C2
+8FB7E4
+8FB7E8
+8FB7E7
+8FF4B7
+8FF4B8
+8FF4B9
+8FB8CE
+8FB8E1
+8FB8F5
+8FB8F7
+8FB8F8
+8FB8FC
+8FB9AF
+8FB9B7
+8FBABE
+8FBADB
+8FCDAA
+8FBAE1
+8FF4BA
+8FBAEB
+8FBBB3
+8FBBB8
+8FF4BB
+8FBBCA
+8FF4BC
+8FF4BD
+8FBBD0
+8FBBDE
+8FBBF4
+8FBBF5
+8FBBF9
+8FBCE4
+8FBCED
+8FBCFE
+8FF4BE
+8FBDC2
+8FBDE7
+8FF4BF
+8FBDF0
+8FBEB0
+8FBEAC
+8FF4C0
+8FBEB3
+8FBEBD
+8FBECD
+8FBEC9
+8FBEE4
+8FBFA8
+8FBFC9
+8FC0C4
+8FC0E4
+8FC0F4
+8FC1A6
+8FF4C1
+8FC1F5
+8FC1FC
+8FF4C2
+8FC1F8
+8FC2AB
+8FC2A1
+8FC2A5
+8FF4C3
+8FC2B8
+8FC2BA
+8FF4C4
+8FC2C4
+8FC2D2
+8FC2D7
+8FC2DB
+8FC2DE
+8FC2ED
+8FC2F0
+8FF4C5
+8FC3A1
+8FC3B5
+8FC3C9
+8FC3B9
+8FF4C6
+8FC3D8
+8FC3FE
+8FF4C7
+8FC4CC
+8FF4C8
+8FC4D9
+8FC4EA
+8FC4FD
+8FF4C9
+8FC5A7
+8FC5B5
+8FC5B6
+8FF4CA
+8FC5D5
+8FC6B8
+8FC6D7
+8FC6E0
+8FC6EA
+8FC6E3
+8FC7A1
+8FC7AB
+8FC7C7
+8FC7C3
+8FC7CB
+8FC7CF
+8FC7D9
+8FF4CB
+8FF4CC
+8FC7E6
+8FC7EE
+8FC7FC
+8FC7EB
+8FC7F0
+8FC8B1
+8FC8E5
+8FC8F8
+8FC9A6
+8FC9AB
+8FC9AD
+8FF4CD
+8FC9CA
+8FC9D3
+8FC9E9
+8FC9E3
+8FC9FC
+8FC9F4
+8FC9F5
+8FF4CE
+8FCAB3
+8FCABD
+8FCAEF
+8FCAF1
+8FCBAE
+8FF4CF
+8FCBCA
+8FCBE6
+8FCBEA
+8FCBF0
+8FCBF4
+8FCBEE
+8FCCA5
+8FCBF9
+8FCCAB
+8FCCAE
+8FCCAD
+8FCCB2
+8FCCC2
+8FCCD0
+8FCCD9
+8FF4D0
+8FCDBB
+8FF4D1
+8FCEBB
+8FF4D2
+8FCEBA
+8FCEC3
+8FF4D3
+8FCEF2
+8FB3DD
+8FCFD5
+8FCFE2
+8FCFE9
+8FCFED
+8FF4D4
+8FF4D5
+8FF4D6
+8FF4D7
+8FD0E5
+8FF4D8
+8FD0E9
+8FD1E8
+8FF4D9
+8FF4DA
+8FD1EC
+8FD2BB
+8FF4DB
+8FD3E1
+8FD3E8
+8FD4A7
+8FF4DC
+8FF4DD
+8FD4D4
+8FD4F2
+8FD5AE
+8FF4DE
+8FD7DE
+8FF4DF
+8FD8A2
+8FD8B7
+8FD8C1
+8FD8D1
+8FD8F4
+8FD9C6
+8FD9C8
+8FD9D1
+8FF4E0
+8FF4E1
+8FF4E2
+8FF4E3
+8FF4E4
+8FDCD3
+8FDDC8
+8FDDD4
+8FDDEA
+8FDDFA
+8FDEA4
+8FDEB0
+8FF4E5
+8FDEB5
+8FDECB
+8FF4E6
+8FDFB9
+8FF4E7
+8FDFC3
+8FF4E8
+8FF4E9
+8FE0D9
+8FF4EA
+8FF4EB
+8FE1E2
+8FF4EC
+8FF4ED
+8FF4EE
+8FE2C7
+8FE3A8
+8FE3A6
+8FE3A9
+8FE3AF
+8FE3B0
+8FE3AA
+8FE3AB
+8FE3BC
+8FE3C1
+8FE3BF
+8FE3D5
+8FE3D8
+8FE3D6
+8FE3DF
+8FE3E3
+8FE3E1
+8FE3D4
+8FE3E9
+8FE4A6
+8FE3F1
+8FE3F2
+8FE4CB
+8FE4C1
+8FE4C3
+8FE4BE
+8FF4EF
+8FE4C0
+8FE4C7
+8FE4BF
+8FE4E0
+8FE4DE
+8FE4D1
+8FF4F0
+8FE4DC
+8FE4D2
+8FE4DB
+8FE4D4
+8FE4FA
+8FE4EF
+8FE5B3
+8FE5BF
+8FE5C9
+8FE5D0
+8FE5E2
+8FE5EA
+8FE5EB
+8FF4F1
+8FF4F2
+8FF4F3
+8FE6E8
+8FE6EF
+8FE7AC
+8FF4F4
+8FE7AE
+8FF4F5
+8FE7B1
+8FF4F6
+8FE7B2
+8FE8B1
+8FE8B6
+8FF4F7
+8FF4F8
+8FE8DD
+8FF4F9
+8FF4FA
+8FE9D1
+8FF4FB
+8FE9ED
+8FEACD
+8FF4FC
+8FEADB
+8FEAE6
+8FEAEA
+8FEBA5
+8FEBFB
+8FEBFA
+8FF4FD
+8FECD6
+8FF4FE
+8FF3F3
+8FF3F4
+8FF3F5
+8FF3F6
+8FF3F7
+8FF3F8
+8FF3F9
+8FF3FA
+8FF3FB
+8FF3FC
+A2CC
+8FA2C3
+8FF4A9
+8FF4AA
+8FF3F3
+8FF3F4
+8FF3F5
+8FF3F6
+8FF3F7
+8FF3F8
+8FF3F9
+8FF3FA
+8FF3FB
+8FF3FC
+ADB5
+ADB6
+ADB7
+ADB8
+ADB9
+ADBA
+ADBB
+ADBC
+ADBD
+ADBE
+A2CC
+8FA2C3
+8FF4A9
+8FF4AA
+ADEA
+ADE2
+ADE4
+A2E8
+8FD4E3
+8FDCDF
+8FE4E9
+8FE3F8
+8FD9A1
+8FB1BB
+8FF4AE
+8FC2AD
+8FC3FC
+8FE4D0
+8FC2BF
+8FBCF4
+8FB0A9
+8FB0C8
+8FF4AF
+8FB0D2
+8FB0D4
+8FB0E3
+8FB0EE
+8FB1A7
+8FB1A3
+8FB1AC
+8FB1A9
+8FB1BE
+8FB1DF
+8FB1D8
+8FB1C8
+8FB1D7
+8FB1E3
+8FB1F4
+8FB1E1
+8FB2A3
+8FF4B0
+8FB2BB
+8FB2E6
+8FB2ED
+8FB2F5
+8FB2FC
+8FF4B1
+8FB3B5
+8FB3D8
+8FB3DB
+8FB3E5
+8FB3EE
+8FB3FB
+8FF4B2
+8FF4B3
+8FB4C0
+8FB4C7
+8FB4D0
+8FB4DE
+8FF4B4
+8FB5AA
+8FF4B5
+8FB5AF
+8FB5C4
+8FB5E8
+8FF4B6
+8FB7C2
+8FB7E4
+8FB7E8
+8FB7E7
+8FF4B7
+8FF4B8
+8FF4B9
+8FB8CE
+8FB8E1
+8FB8F5
+8FB8F7
+8FB8F8
+8FB8FC
+8FB9AF
+8FB9B7
+8FBABE
+8FBADB
+8FCDAA
+8FBAE1
+8FF4BA
+8FBAEB
+8FBBB3
+8FBBB8
+8FF4BB
+8FBBCA
+8FF4BC
+8FF4BD
+8FBBD0
+8FBBDE
+8FBBF4
+8FBBF5
+8FBBF9
+8FBCE4
+8FBCED
+8FBCFE
+8FF4BE
+8FBDC2
+8FBDE7
+8FF4BF
+8FBDF0
+8FBEB0
+8FBEAC
+8FF4C0
+8FBEB3
+8FBEBD
+8FBECD
+8FBEC9
+8FBEE4
+8FBFA8
+8FBFC9
+8FC0C4
+8FC0E4
+8FC0F4
+8FC1A6
+8FF4C1
+8FC1F5
+8FC1FC
+8FF4C2
+8FC1F8
+8FC2AB
+8FC2A1
+8FC2A5
+8FF4C3
+8FC2B8
+8FC2BA
+8FF4C4
+8FC2C4
+8FC2D2
+8FC2D7
+8FC2DB
+8FC2DE
+8FC2ED
+8FC2F0
+8FF4C5
+8FC3A1
+8FC3B5
+8FC3C9
+8FC3B9
+8FF4C6
+8FC3D8
+8FC3FE
+8FF4C7
+8FC4CC
+8FF4C8
+8FC4D9
+8FC4EA
+8FC4FD
+8FF4C9
+8FC5A7
+8FC5B5
+8FC5B6
+8FF4CA
+8FC5D5
+8FC6B8
+8FC6D7
+8FC6E0
+8FC6EA
+8FC6E3
+8FC7A1
+8FC7AB
+8FC7C7
+8FC7C3
+8FC7CB
+8FC7CF
+8FC7D9
+8FF4CB
+8FF4CC
+8FC7E6
+8FC7EE
+8FC7FC
+8FC7EB
+8FC7F0
+8FC8B1
+8FC8E5
+8FC8F8
+8FC9A6
+8FC9AB
+8FC9AD
+8FF4CD
+8FC9CA
+8FC9D3
+8FC9E9
+8FC9E3
+8FC9FC
+8FC9F4
+8FC9F5
+8FF4CE
+8FCAB3
+8FCABD
+8FCAEF
+8FCAF1
+8FCBAE
+8FF4CF
+8FCBCA
+8FCBE6
+8FCBEA
+8FCBF0
+8FCBF4
+8FCBEE
+8FCCA5
+8FCBF9
+8FCCAB
+8FCCAE
+8FCCAD
+8FCCB2
+8FCCC2
+8FCCD0
+8FCCD9
+8FF4D0
+8FCDBB
+8FF4D1
+8FCEBB
+8FF4D2
+8FCEBA
+8FCEC3
+8FF4D3
+8FCEF2
+8FB3DD
+8FCFD5
+8FCFE2
+8FCFE9
+8FCFED
+8FF4D4
+8FF4D5
+8FF4D6
+8FF4D7
+8FD0E5
+8FF4D8
+8FD0E9
+8FD1E8
+8FF4D9
+8FF4DA
+8FD1EC
+8FD2BB
+8FF4DB
+8FD3E1
+8FD3E8
+8FD4A7
+8FF4DC
+8FF4DD
+8FD4D4
+8FD4F2
+8FD5AE
+8FF4DE
+8FD7DE
+8FF4DF
+8FD8A2
+8FD8B7
+8FD8C1
+8FD8D1
+8FD8F4
+8FD9C6
+8FD9C8
+8FD9D1
+8FF4E0
+8FF4E1
+8FF4E2
+8FF4E3
+8FF4E4
+8FDCD3
+8FDDC8
+8FDDD4
+8FDDEA
+8FDDFA
+8FDEA4
+8FDEB0
+8FF4E5
+8FDEB5
+8FDECB
+8FF4E6
+8FDFB9
+8FF4E7
+8FDFC3
+8FF4E8
+8FF4E9
+8FE0D9
+8FF4EA
+8FF4EB
+8FE1E2
+8FF4EC
+8FF4ED
+8FF4EE
+8FE2C7
+8FE3A8
+8FE3A6
+8FE3A9
+8FE3AF
+8FE3B0
+8FE3AA
+8FE3AB
+8FE3BC
+8FE3C1
+8FE3BF
+8FE3D5
+8FE3D8
+8FE3D6
+8FE3DF
+8FE3E3
+8FE3E1
+8FE3D4
+8FE3E9
+8FE4A6
+8FE3F1
+8FE3F2
+8FE4CB
+8FE4C1
+8FE4C3
+8FE4BE
+8FF4EF
+8FE4C0
+8FE4C7
+8FE4BF
+8FE4E0
+8FE4DE
+8FE4D1
+8FF4F0
+8FE4DC
+8FE4D2
+8FE4DB
+8FE4D4
+8FE4FA
+8FE4EF
+8FE5B3
+8FE5BF
+8FE5C9
+8FE5D0
+8FE5E2
+8FE5EA
+8FE5EB
+8FF4F1
+8FF4F2
+8FF4F3
+8FE6E8
+8FE6EF
+8FE7AC
+8FF4F4
+8FE7AE
+8FF4F5
+8FE7B1
+8FF4F6
+8FE7B2
+8FE8B1
+8FE8B6
+8FF4F7
+8FF4F8
+8FE8DD
+8FF4F9
+8FF4FA
+8FE9D1
+8FF4FB
+8FE9ED
+8FEACD
+8FF4FC
+8FEADB
+8FEAE6
+8FEAEA
+8FEBA5
+8FEBFB
+8FEBFA
+8FF4FD
+8FECD6
+8FF4FE
+F5A1
+F5A2
+F5A3
+F5A4
+F5A5
+F5A6
+F5A7
+F5A8
+F5A9
+F5AA
+F5AB
+F5AC
+F5AD
+F5AE
+F5AF
+F5B0
+F5B1
+F5B2
+F5B3
+F5B4
+F5B5
+F5B6
+F5B7
+F5B8
+F5B9
+F5BA
+F5BB
+F5BC
+F5BD
+F5BE
+F5BF
+F5C0
+F5C1
+F5C2
+F5C3
+F5C4
+F5C5
+F5C6
+F5C7
+F5C8
+F5C9
+F5CA
+F5CB
+F5CC
+F5CD
+F5CE
+F5CF
+F5D0
+F5D1
+F5D2
+F5D3
+F5D4
+F5D5
+F5D6
+F5D7
+F5D8
+F5D9
+F5DA
+F5DB
+F5DC
+F5DD
+F5DE
+F5DF
+F5E0
+F5E1
+F5E2
+F5E3
+F5E4
+F5E5
+F5E6
+F5E7
+F5E8
+F5E9
+F5EA
+F5EB
+F5EC
+F5ED
+F5EE
+F5EF
+F5F0
+F5F1
+F5F2
+F5F3
+F5F4
+F5F5
+F5F6
+F5F7
+F5F8
+F5F9
+F5FA
+F5FB
+F5FC
+F5FD
+F5FE
+F6A1
+F6A2
+F6A3
+F6A4
+F6A5
+F6A6
+F6A7
+F6A8
+F6A9
+F6AA
+F6AB
+F6AC
+F6AD
+F6AE
+F6AF
+F6B0
+F6B1
+F6B2
+F6B3
+F6B4
+F6B5
+F6B6
+F6B7
+F6B8
+F6B9
+F6BA
+F6BB
+F6BC
+F6BD
+F6BE
+F6BF
+F6C0
+F6C1
+F6C2
+F6C3
+F6C4
+F6C5
+F6C6
+F6C7
+F6C8
+F6C9
+F6CA
+F6CB
+F6CC
+F6CD
+F6CE
+F6CF
+F6D0
+F6D1
+F6D2
+F6D3
+F6D4
+F6D5
+F6D6
+F6D7
+F6D8
+F6D9
+F6DA
+F6DB
+F6DC
+F6DD
+F6DE
+F6DF
+F6E0
+F6E1
+F6E2
+F6E3
+F6E4
+F6E5
+F6E6
+F6E7
+F6E8
+F6E9
+F6EA
+F6EB
+F6EC
+F6ED
+F6EE
+F6EF
+F6F0
+F6F1
+F6F2
+F6F3
+F6F4
+F6F5
+F6F6
+F6F7
+F6F8
+F6F9
+F6FA
+F6FB
+F6FC
+F6FD
+F6FE
+F7A1
+F7A2
+F7A3
+F7A4
+F7A5
+F7A6
+F7A7
+F7A8
+F7A9
+F7AA
+F7AB
+F7AC
+F7AD
+F7AE
+F7AF
+F7B0
+F7B1
+F7B2
+F7B3
+F7B4
+F7B5
+F7B6
+F7B7
+F7B8
+F7B9
+F7BA
+F7BB
+F7BC
+F7BD
+F7BE
+F7BF
+F7C0
+F7C1
+F7C2
+F7C3
+F7C4
+F7C5
+F7C6
+F7C7
+F7C8
+F7C9
+F7CA
+F7CB
+F7CC
+F7CD
+F7CE
+F7CF
+F7D0
+F7D1
+F7D2
+F7D3
+F7D4
+F7D5
+F7D6
+F7D7
+F7D8
+F7D9
+F7DA
+F7DB
+F7DC
+F7DD
+F7DE
+F7DF
+F7E0
+F7E1
+F7E2
+F7E3
+F7E4
+F7E5
+F7E6
+F7E7
+F7E8
+F7E9
+F7EA
+F7EB
+F7EC
+F7ED
+F7EE
+F7EF
+F7F0
+F7F1
+F7F2
+F7F3
+F7F4
+F7F5
+F7F6
+F7F7
+F7F8
+F7F9
+F7FA
+F7FB
+F7FC
+F7FD
+F7FE
+F8A1
+F8A2
+F8A3
+F8A4
+F8A5
+F8A6
+F8A7
+F8A8
+F8A9
+F8AA
+F8AB
+F8AC
+F8AD
+F8AE
+F8AF
+F8B0
+F8B1
+F8B2
+F8B3
+F8B4
+F8B5
+F8B6
+F8B7
+F8B8
+F8B9
+F8BA
+F8BB
+F8BC
+F8BD
+F8BE
+F8BF
+F8C0
+F8C1
+F8C2
+F8C3
+F8C4
+F8C5
+F8C6
+F8C7
+F8C8
+F8C9
+F8CA
+F8CB
+F8CC
+F8CD
+F8CE
+F8CF
+F8D0
+F8D1
+F8D2
+F8D3
+F8D4
+F8D5
+F8D6
+F8D7
+F8D8
+F8D9
+F8DA
+F8DB
+F8DC
+F8DD
+F8DE
+F8DF
+F8E0
+F8E1
+F8E2
+F8E3
+F8E4
+F8E5
+F8E6
+F8E7
+F8E8
+F8E9
+F8EA
+F8EB
+F8EC
+F8ED
+F8EE
+F8EF
+F8F0
+F8F1
+F8F2
+F8F3
+F8F4
+F8F5
+F8F6
+F8F7
+F8F8
+F8F9
+F8FA
+F8FB
+F8FC
+F8FD
+F8FE
+F9A1
+F9A2
+F9A3
+F9A4
+F9A5
+F9A6
+F9A7
+F9A8
+F9A9
+F9AA
+F9AB
+F9AC
+F9AD
+F9AE
+F9AF
+F9B0
+F9B1
+F9B2
+F9B3
+F9B4
+F9B5
+F9B6
+F9B7
+F9B8
+F9B9
+F9BA
+F9BB
+F9BC
+F9BD
+F9BE
+F9BF
+F9C0
+F9C1
+F9C2
+F9C3
+F9C4
+F9C5
+F9C6
+F9C7
+F9C8
+F9C9
+F9CA
+F9CB
+F9CC
+F9CD
+F9CE
+F9CF
+F9D0
+F9D1
+F9D2
+F9D3
+F9D4
+F9D5
+F9D6
+F9D7
+F9D8
+F9D9
+F9DA
+F9DB
+F9DC
+F9DD
+F9DE
+F9DF
+F9E0
+F9E1
+F9E2
+F9E3
+F9E4
+F9E5
+F9E6
+F9E7
+F9E8
+F9E9
+F9EA
+F9EB
+F9EC
+F9ED
+F9EE
+F9EF
+F9F0
+F9F1
+F9F2
+F9F3
+F9F4
+F9F5
+F9F6
+F9F7
+F9F8
+F9F9
+F9FA
+F9FB
+F9FC
+F9FD
+F9FE
+FAA1
+FAA2
+FAA3
+FAA4
+FAA5
+FAA6
+FAA7
+FAA8
+FAA9
+FAAA
+FAAB
+FAAC
+FAAD
+FAAE
+FAAF
+FAB0
+FAB1
+FAB2
+FAB3
+FAB4
+FAB5
+FAB6
+FAB7
+FAB8
+FAB9
+FABA
+FABB
+FABC
+FABD
+FABE
+FABF
+FAC0
+FAC1
+FAC2
+FAC3
+FAC4
+FAC5
+FAC6
+FAC7
+FAC8
+FAC9
+FACA
+FACB
+FACC
+FACD
+FACE
+FACF
+FAD0
+FAD1
+FAD2
+FAD3
+FAD4
+FAD5
+FAD6
+FAD7
+FAD8
+FAD9
+FADA
+FADB
+FADC
+FADD
+FADE
+FADF
+FAE0
+FAE1
+FAE2
+FAE3
+FAE4
+FAE5
+FAE6
+FAE7
+FAE8
+FAE9
+FAEA
+FAEB
+FAEC
+FAED
+FAEE
+FAEF
+FAF0
+FAF1
+FAF2
+FAF3
+FAF4
+FAF5
+FAF6
+FAF7
+FAF8
+FAF9
+FAFA
+FAFB
+FAFC
+FAFD
+FAFE
+FBA1
+FBA2
+FBA3
+FBA4
+FBA5
+FBA6
+FBA7
+FBA8
+FBA9
+FBAA
+FBAB
+FBAC
+FBAD
+FBAE
+FBAF
+FBB0
+FBB1
+FBB2
+FBB3
+FBB4
+FBB5
+FBB6
+FBB7
+FBB8
+FBB9
+FBBA
+FBBB
+FBBC
+FBBD
+FBBE
+FBBF
+FBC0
+FBC1
+FBC2
+FBC3
+FBC4
+FBC5
+FBC6
+FBC7
+FBC8
+FBC9
+FBCA
+FBCB
+FBCC
+FBCD
+FBCE
+FBCF
+FBD0
+FBD1
+FBD2
+FBD3
+FBD4
+FBD5
+FBD6
+FBD7
+FBD8
+FBD9
+FBDA
+FBDB
+FBDC
+FBDD
+FBDE
+FBDF
+FBE0
+FBE1
+FBE2
+FBE3
+FBE4
+FBE5
+FBE6
+FBE7
+FBE8
+FBE9
+FBEA
+FBEB
+FBEC
+FBED
+FBEE
+FBEF
+FBF0
+FBF1
+FBF2
+FBF3
+FBF4
+FBF5
+FBF6
+FBF7
+FBF8
+FBF9
+FBFA
+FBFB
+FBFC
+FBFD
+FBFE
+FCA1
+FCA2
+FCA3
+FCA4
+FCA5
+FCA6
+FCA7
+FCA8
+FCA9
+FCAA
+FCAB
+FCAC
+FCAD
+FCAE
+FCAF
+FCB0
+FCB1
+FCB2
+FCB3
+FCB4
+FCB5
+FCB6
+FCB7
+FCB8
+FCB9
+FCBA
+FCBB
+FCBC
+FCBD
+FCBE
+FCBF
+FCC0
+FCC1
+FCC2
+FCC3
+FCC4
+FCC5
+FCC6
+FCC7
+FCC8
+FCC9
+FCCA
+FCCB
+FCCC
+FCCD
+FCCE
+FCCF
+FCD0
+FCD1
+FCD2
+FCD3
+FCD4
+FCD5
+FCD6
+FCD7
+FCD8
+FCD9
+FCDA
+FCDB
+FCDC
+FCDD
+FCDE
+FCDF
+FCE0
+FCE1
+FCE2
+FCE3
+FCE4
+FCE5
+FCE6
+FCE7
+FCE8
+FCE9
+FCEA
+FCEB
+FCEC
+FCED
+FCEE
+FCEF
+FCF0
+FCF1
+FCF2
+FCF3
+FCF4
+FCF5
+FCF6
+FCF7
+FCF8
+FCF9
+FCFA
+FCFB
+FCFC
+FCFD
+FCFE
+FDA1
+FDA2
+FDA3
+FDA4
+FDA5
+FDA6
+FDA7
+FDA8
+FDA9
+FDAA
+FDAB
+FDAC
+FDAD
+FDAE
+FDAF
+FDB0
+FDB1
+FDB2
+FDB3
+FDB4
+FDB5
+FDB6
+FDB7
+FDB8
+FDB9
+FDBA
+FDBB
+FDBC
+FDBD
+FDBE
+FDBF
+FDC0
+FDC1
+FDC2
+FDC3
+FDC4
+FDC5
+FDC6
+FDC7
+FDC8
+FDC9
+FDCA
+FDCB
+FDCC
+FDCD
+FDCE
+FDCF
+FDD0
+FDD1
+FDD2
+FDD3
+FDD4
+FDD5
+FDD6
+FDD7
+FDD8
+FDD9
+FDDA
+FDDB
+FDDC
+FDDD
+FDDE
+FDDF
+FDE0
+FDE1
+FDE2
+FDE3
+FDE4
+FDE5
+FDE6
+FDE7
+FDE8
+FDE9
+FDEA
+FDEB
+FDEC
+FDED
+FDEE
+FDEF
+FDF0
+FDF1
+FDF2
+FDF3
+FDF4
+FDF5
+FDF6
+FDF7
+FDF8
+FDF9
+FDFA
+FDFB
+FDFC
+FDFD
+FDFE
+FEA1
+FEA2
+FEA3
+FEA4
+FEA5
+FEA6
+FEA7
+FEA8
+FEA9
+FEAA
+FEAB
+FEAC
+FEAD
+FEAE
+FEAF
+FEB0
+FEB1
+FEB2
+FEB3
+FEB4
+FEB5
+FEB6
+FEB7
+FEB8
+FEB9
+FEBA
+FEBB
+FEBC
+FEBD
+FEBE
+FEBF
+FEC0
+FEC1
+FEC2
+FEC3
+FEC4
+FEC5
+FEC6
+FEC7
+FEC8
+FEC9
+FECA
+FECB
+FECC
+FECD
+FECE
+FECF
+FED0
+FED1
+FED2
+FED3
+FED4
+FED5
+FED6
+FED7
+FED8
+FED9
+FEDA
+FEDB
+FEDC
+FEDD
+FEDE
+FEDF
+FEE0
+FEE1
+FEE2
+FEE3
+FEE4
+FEE5
+FEE6
+FEE7
+FEE8
+FEE9
+FEEA
+FEEB
+FEEC
+FEED
+FEEE
+FEEF
+FEF0
+FEF1
+FEF2
+FEF3
+FEF4
+FEF5
+FEF6
+FEF7
+FEF8
+FEF9
+FEFA
+FEFB
+FEFC
+FEFD
+FEFE
+8FF5A1
+8FF5A2
+8FF5A3
+8FF5A4
+8FF5A5
+8FF5A6
+8FF5A7
+8FF5A8
+8FF5A9
+8FF5AA
+8FF5AB
+8FF5AC
+8FF5AD
+8FF5AE
+8FF5AF
+8FF5B0
+8FF5B1
+8FF5B2
+8FF5B3
+8FF5B4
+8FF5B5
+8FF5B6
+8FF5B7
+8FF5B8
+8FF5B9
+8FF5BA
+8FF5BB
+8FF5BC
+8FF5BD
+8FF5BE
+8FF5BF
+8FF5C0
+8FF5C1
+8FF5C2
+8FF5C3
+8FF5C4
+8FF5C5
+8FF5C6
+8FF5C7
+8FF5C8
+8FF5C9
+8FF5CA
+8FF5CB
+8FF5CC
+8FF5CD
+8FF5CE
+8FF5CF
+8FF5D0
+8FF5D1
+8FF5D2
+8FF5D3
+8FF5D4
+8FF5D5
+8FF5D6
+8FF5D7
+8FF5D8
+8FF5D9
+8FF5DA
+8FF5DB
+8FF5DC
+8FF5DD
+8FF5DE
+8FF5DF
+8FF5E0
+8FF5E1
+8FF5E2
+8FF5E3
+8FF5E4
+8FF5E5
+8FF5E6
+8FF5E7
+8FF5E8
+8FF5E9
+8FF5EA
+8FF5EB
+8FF5EC
+8FF5ED
+8FF5EE
+8FF5EF
+8FF5F0
+8FF5F1
+8FF5F2
+8FF5F3
+8FF5F4
+8FF5F5
+8FF5F6
+8FF5F7
+8FF5F8
+8FF5F9
+8FF5FA
+8FF5FB
+8FF5FC
+8FF5FD
+8FF5FE
+8FF6A1
+8FF6A2
+8FF6A3
+8FF6A4
+8FF6A5
+8FF6A6
+8FF6A7
+8FF6A8
+8FF6A9
+8FF6AA
+8FF6AB
+8FF6AC
+8FF6AD
+8FF6AE
+8FF6AF
+8FF6B0
+8FF6B1
+8FF6B2
+8FF6B3
+8FF6B4
+8FF6B5
+8FF6B6
+8FF6B7
+8FF6B8
+8FF6B9
+8FF6BA
+8FF6BB
+8FF6BC
+8FF6BD
+8FF6BE
+8FF6BF
+8FF6C0
+8FF6C1
+8FF6C2
+8FF6C3
+8FF6C4
+8FF6C5
+8FF6C6
+8FF6C7
+8FF6C8
+8FF6C9
+8FF6CA
+8FF6CB
+8FF6CC
+8FF6CD
+8FF6CE
+8FF6CF
+8FF6D0
+8FF6D1
+8FF6D2
+8FF6D3
+8FF6D4
+8FF6D5
+8FF6D6
+8FF6D7
+8FF6D8
+8FF6D9
+8FF6DA
+8FF6DB
+8FF6DC
+8FF6DD
+8FF6DE
+8FF6DF
+8FF6E0
+8FF6E1
+8FF6E2
+8FF6E3
+8FF6E4
+8FF6E5
+8FF6E6
+8FF6E7
+8FF6E8
+8FF6E9
+8FF6EA
+8FF6EB
+8FF6EC
+8FF6ED
+8FF6EE
+8FF6EF
+8FF6F0
+8FF6F1
+8FF6F2
+8FF6F3
+8FF6F4
+8FF6F5
+8FF6F6
+8FF6F7
+8FF6F8
+8FF6F9
+8FF6FA
+8FF6FB
+8FF6FC
+8FF6FD
+8FF6FE
+8FF7A1
+8FF7A2
+8FF7A3
+8FF7A4
+8FF7A5
+8FF7A6
+8FF7A7
+8FF7A8
+8FF7A9
+8FF7AA
+8FF7AB
+8FF7AC
+8FF7AD
+8FF7AE
+8FF7AF
+8FF7B0
+8FF7B1
+8FF7B2
+8FF7B3
+8FF7B4
+8FF7B5
+8FF7B6
+8FF7B7
+8FF7B8
+8FF7B9
+8FF7BA
+8FF7BB
+8FF7BC
+8FF7BD
+8FF7BE
+8FF7BF
+8FF7C0
+8FF7C1
+8FF7C2
+8FF7C3
+8FF7C4
+8FF7C5
+8FF7C6
+8FF7C7
+8FF7C8
+8FF7C9
+8FF7CA
+8FF7CB
+8FF7CC
+8FF7CD
+8FF7CE
+8FF7CF
+8FF7D0
+8FF7D1
+8FF7D2
+8FF7D3
+8FF7D4
+8FF7D5
+8FF7D6
+8FF7D7
+8FF7D8
+8FF7D9
+8FF7DA
+8FF7DB
+8FF7DC
+8FF7DD
+8FF7DE
+8FF7DF
+8FF7E0
+8FF7E1
+8FF7E2
+8FF7E3
+8FF7E4
+8FF7E5
+8FF7E6
+8FF7E7
+8FF7E8
+8FF7E9
+8FF7EA
+8FF7EB
+8FF7EC
+8FF7ED
+8FF7EE
+8FF7EF
+8FF7F0
+8FF7F1
+8FF7F2
+8FF7F3
+8FF7F4
+8FF7F5
+8FF7F6
+8FF7F7
+8FF7F8
+8FF7F9
+8FF7FA
+8FF7FB
+8FF7FC
+8FF7FD
+8FF7FE
+8FF8A1
+8FF8A2
+8FF8A3
+8FF8A4
+8FF8A5
+8FF8A6
+8FF8A7
+8FF8A8
+8FF8A9
+8FF8AA
+8FF8AB
+8FF8AC
+8FF8AD
+8FF8AE
+8FF8AF
+8FF8B0
+8FF8B1
+8FF8B2
+8FF8B3
+8FF8B4
+8FF8B5
+8FF8B6
+8FF8B7
+8FF8B8
+8FF8B9
+8FF8BA
+8FF8BB
+8FF8BC
+8FF8BD
+8FF8BE
+8FF8BF
+8FF8C0
+8FF8C1
+8FF8C2
+8FF8C3
+8FF8C4
+8FF8C5
+8FF8C6
+8FF8C7
+8FF8C8
+8FF8C9
+8FF8CA
+8FF8CB
+8FF8CC
+8FF8CD
+8FF8CE
+8FF8CF
+8FF8D0
+8FF8D1
+8FF8D2
+8FF8D3
+8FF8D4
+8FF8D5
+8FF8D6
+8FF8D7
+8FF8D8
+8FF8D9
+8FF8DA
+8FF8DB
+8FF8DC
+8FF8DD
+8FF8DE
+8FF8DF
+8FF8E0
+8FF8E1
+8FF8E2
+8FF8E3
+8FF8E4
+8FF8E5
+8FF8E6
+8FF8E7
+8FF8E8
+8FF8E9
+8FF8EA
+8FF8EB
+8FF8EC
+8FF8ED
+8FF8EE
+8FF8EF
+8FF8F0
+8FF8F1
+8FF8F2
+8FF8F3
+8FF8F4
+8FF8F5
+8FF8F6
+8FF8F7
+8FF8F8
+8FF8F9
+8FF8FA
+8FF8FB
+8FF8FC
+8FF8FD
+8FF8FE
+8FF9A1
+8FF9A2
+8FF9A3
+8FF9A4
+8FF9A5
+8FF9A6
+8FF9A7
+8FF9A8
+8FF9A9
+8FF9AA
+8FF9AB
+8FF9AC
+8FF9AD
+8FF9AE
+8FF9AF
+8FF9B0
+8FF9B1
+8FF9B2
+8FF9B3
+8FF9B4
+8FF9B5
+8FF9B6
+8FF9B7
+8FF9B8
+8FF9B9
+8FF9BA
+8FF9BB
+8FF9BC
+8FF9BD
+8FF9BE
+8FF9BF
+8FF9C0
+8FF9C1
+8FF9C2
+8FF9C3
+8FF9C4
+8FF9C5
+8FF9C6
+8FF9C7
+8FF9C8
+8FF9C9
+8FF9CA
+8FF9CB
+8FF9CC
+8FF9CD
+8FF9CE
+8FF9CF
+8FF9D0
+8FF9D1
+8FF9D2
+8FF9D3
+8FF9D4
+8FF9D5
+8FF9D6
+8FF9D7
+8FF9D8
+8FF9D9
+8FF9DA
+8FF9DB
+8FF9DC
+8FF9DD
+8FF9DE
+8FF9DF
+8FF9E0
+8FF9E1
+8FF9E2
+8FF9E3
+8FF9E4
+8FF9E5
+8FF9E6
+8FF9E7
+8FF9E8
+8FF9E9
+8FF9EA
+8FF9EB
+8FF9EC
+8FF9ED
+8FF9EE
+8FF9EF
+8FF9F0
+8FF9F1
+8FF9F2
+8FF9F3
+8FF9F4
+8FF9F5
+8FF9F6
+8FF9F7
+8FF9F8
+8FF9F9
+8FF9FA
+8FF9FB
+8FF9FC
+8FF9FD
+8FF9FE
+8FFAA1
+8FFAA2
+8FFAA3
+8FFAA4
+8FFAA5
+8FFAA6
+8FFAA7
+8FFAA8
+8FFAA9
+8FFAAA
+8FFAAB
+8FFAAC
+8FFAAD
+8FFAAE
+8FFAAF
+8FFAB0
+8FFAB1
+8FFAB2
+8FFAB3
+8FFAB4
+8FFAB5
+8FFAB6
+8FFAB7
+8FFAB8
+8FFAB9
+8FFABA
+8FFABB
+8FFABC
+8FFABD
+8FFABE
+8FFABF
+8FFAC0
+8FFAC1
+8FFAC2
+8FFAC3
+8FFAC4
+8FFAC5
+8FFAC6
+8FFAC7
+8FFAC8
+8FFAC9
+8FFACA
+8FFACB
+8FFACC
+8FFACD
+8FFACE
+8FFACF
+8FFAD0
+8FFAD1
+8FFAD2
+8FFAD3
+8FFAD4
+8FFAD5
+8FFAD6
+8FFAD7
+8FFAD8
+8FFAD9
+8FFADA
+8FFADB
+8FFADC
+8FFADD
+8FFADE
+8FFADF
+8FFAE0
+8FFAE1
+8FFAE2
+8FFAE3
+8FFAE4
+8FFAE5
+8FFAE6
+8FFAE7
+8FFAE8
+8FFAE9
+8FFAEA
+8FFAEB
+8FFAEC
+8FFAED
+8FFAEE
+8FFAEF
+8FFAF0
+8FFAF1
+8FFAF2
+8FFAF3
+8FFAF4
+8FFAF5
+8FFAF6
+8FFAF7
+8FFAF8
+8FFAF9
+8FFAFA
+8FFAFB
+8FFAFC
+8FFAFD
+8FFAFE
+8FFBA1
+8FFBA2
+8FFBA3
+8FFBA4
+8FFBA5
+8FFBA6
+8FFBA7
+8FFBA8
+8FFBA9
+8FFBAA
+8FFBAB
+8FFBAC
+8FFBAD
+8FFBAE
+8FFBAF
+8FFBB0
+8FFBB1
+8FFBB2
+8FFBB3
+8FFBB4
+8FFBB5
+8FFBB6
+8FFBB7
+8FFBB8
+8FFBB9
+8FFBBA
+8FFBBB
+8FFBBC
+8FFBBD
+8FFBBE
+8FFBBF
+8FFBC0
+8FFBC1
+8FFBC2
+8FFBC3
+8FFBC4
+8FFBC5
+8FFBC6
+8FFBC7
+8FFBC8
+8FFBC9
+8FFBCA
+8FFBCB
+8FFBCC
+8FFBCD
+8FFBCE
+8FFBCF
+8FFBD0
+8FFBD1
+8FFBD2
+8FFBD3
+8FFBD4
+8FFBD5
+8FFBD6
+8FFBD7
+8FFBD8
+8FFBD9
+8FFBDA
+8FFBDB
+8FFBDC
+8FFBDD
+8FFBDE
+8FFBDF
+8FFBE0
+8FFBE1
+8FFBE2
+8FFBE3
+8FFBE4
+8FFBE5
+8FFBE6
+8FFBE7
+8FFBE8
+8FFBE9
+8FFBEA
+8FFBEB
+8FFBEC
+8FFBED
+8FFBEE
+8FFBEF
+8FFBF0
+8FFBF1
+8FFBF2
+8FFBF3
+8FFBF4
+8FFBF5
+8FFBF6
+8FFBF7
+8FFBF8
+8FFBF9
+8FFBFA
+8FFBFB
+8FFBFC
+8FFBFD
+8FFBFE
+8FFCA1
+8FFCA2
+8FFCA3
+8FFCA4
+8FFCA5
+8FFCA6
+8FFCA7
+8FFCA8
+8FFCA9
+8FFCAA
+8FFCAB
+8FFCAC
+8FFCAD
+8FFCAE
+8FFCAF
+8FFCB0
+8FFCB1
+8FFCB2
+8FFCB3
+8FFCB4
+8FFCB5
+8FFCB6
+8FFCB7
+8FFCB8
+8FFCB9
+8FFCBA
+8FFCBB
+8FFCBC
+8FFCBD
+8FFCBE
+8FFCBF
+8FFCC0
+8FFCC1
+8FFCC2
+8FFCC3
+8FFCC4
+8FFCC5
+8FFCC6
+8FFCC7
+8FFCC8
+8FFCC9
+8FFCCA
+8FFCCB
+8FFCCC
+8FFCCD
+8FFCCE
+8FFCCF
+8FFCD0
+8FFCD1
+8FFCD2
+8FFCD3
+8FFCD4
+8FFCD5
+8FFCD6
+8FFCD7
+8FFCD8
+8FFCD9
+8FFCDA
+8FFCDB
+8FFCDC
+8FFCDD
+8FFCDE
+8FFCDF
+8FFCE0
+8FFCE1
+8FFCE2
+8FFCE3
+8FFCE4
+8FFCE5
+8FFCE6
+8FFCE7
+8FFCE8
+8FFCE9
+8FFCEA
+8FFCEB
+8FFCEC
+8FFCED
+8FFCEE
+8FFCEF
+8FFCF0
+8FFCF1
+8FFCF2
+8FFCF3
+8FFCF4
+8FFCF5
+8FFCF6
+8FFCF7
+8FFCF8
+8FFCF9
+8FFCFA
+8FFCFB
+8FFCFC
+8FFCFD
+8FFCFE
+8FFDA1
+8FFDA2
+8FFDA3
+8FFDA4
+8FFDA5
+8FFDA6
+8FFDA7
+8FFDA8
+8FFDA9
+8FFDAA
+8FFDAB
+8FFDAC
+8FFDAD
+8FFDAE
+8FFDAF
+8FFDB0
+8FFDB1
+8FFDB2
+8FFDB3
+8FFDB4
+8FFDB5
+8FFDB6
+8FFDB7
+8FFDB8
+8FFDB9
+8FFDBA
+8FFDBB
+8FFDBC
+8FFDBD
+8FFDBE
+8FFDBF
+8FFDC0
+8FFDC1
+8FFDC2
+8FFDC3
+8FFDC4
+8FFDC5
+8FFDC6
+8FFDC7
+8FFDC8
+8FFDC9
+8FFDCA
+8FFDCB
+8FFDCC
+8FFDCD
+8FFDCE
+8FFDCF
+8FFDD0
+8FFDD1
+8FFDD2
+8FFDD3
+8FFDD4
+8FFDD5
+8FFDD6
+8FFDD7
+8FFDD8
+8FFDD9
+8FFDDA
+8FFDDB
+8FFDDC
+8FFDDD
+8FFDDE
+8FFDDF
+8FFDE0
+8FFDE1
+8FFDE2
+8FFDE3
+8FFDE4
+8FFDE5
+8FFDE6
+8FFDE7
+8FFDE8
+8FFDE9
+8FFDEA
+8FFDEB
+8FFDEC
+8FFDED
+8FFDEE
+8FFDEF
+8FFDF0
+8FFDF1
+8FFDF2
+8FFDF3
+8FFDF4
+8FFDF5
+8FFDF6
+8FFDF7
+8FFDF8
+8FFDF9
+8FFDFA
+8FFDFB
+8FFDFC
+8FFDFD
+8FFDFE
+8FFEA1
+8FFEA2
+8FFEA3
+8FFEA4
+8FFEA5
+8FFEA6
+8FFEA7
+8FFEA8
+8FFEA9
+8FFEAA
+8FFEAB
+8FFEAC
+8FFEAD
+8FFEAE
+8FFEAF
+8FFEB0
+8FFEB1
+8FFEB2
+8FFEB3
+8FFEB4
+8FFEB5
+8FFEB6
+8FFEB7
+8FFEB8
+8FFEB9
+8FFEBA
+8FFEBB
+8FFEBC
+8FFEBD
+8FFEBE
+8FFEBF
+8FFEC0
+8FFEC1
+8FFEC2
+8FFEC3
+8FFEC4
+8FFEC5
+8FFEC6
+8FFEC7
+8FFEC8
+8FFEC9
+8FFECA
+8FFECB
+8FFECC
+8FFECD
+8FFECE
+8FFECF
+8FFED0
+8FFED1
+8FFED2
+8FFED3
+8FFED4
+8FFED5
+8FFED6
+8FFED7
+8FFED8
+8FFED9
+8FFEDA
+8FFEDB
+8FFEDC
+8FFEDD
+8FFEDE
+8FFEDF
+8FFEE0
+8FFEE1
+8FFEE2
+8FFEE3
+8FFEE4
+8FFEE5
+8FFEE6
+8FFEE7
+8FFEE8
+8FFEE9
+8FFEEA
+8FFEEB
+8FFEEC
+8FFEED
+8FFEEE
+8FFEEF
+8FFEF0
+8FFEF1
+8FFEF2
+8FFEF3
+8FFEF4
+8FFEF5
+8FFEF6
+8FFEF7
+8FFEF8
+8FFEF9
+8FFEFA
+8FFEFB
+8FFEFC
+8FFEFD
+8FFEFE
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+SET collation_connection='cp932_japanese_ci';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+cp932_japanese_ci 6109
+cp932_japanese_ci 61
+cp932_japanese_ci 6120
+drop table t1;
+SET collation_connection='cp932_bin';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+cp932_bin 6109
+cp932_bin 61
+cp932_bin 6120
+drop table t1;
+create table t1 (col1 varchar(1)) character set cp932;
+insert into t1 values ('a');
+insert into t1 values ('ab');
+Warnings:
+Warning 1265 Data truncated for column 'col1' at row 1
+select * from t1;
+col1
+a
+a
+insert into t1 values ('abc');
+Warnings:
+Warning 1265 Data truncated for column 'col1' at row 1
+select * from t1;
+col1
+a
+a
+a
+drop table t1;
diff --git a/mysql-test/r/ctype_ucs_binlog.result b/mysql-test/r/binlog_stm_ctype_ucs.result
index 88912f98252..61ca21d4058 100644
--- a/mysql-test/r/ctype_ucs_binlog.result
+++ b/mysql-test/r/binlog_stm_ctype_ucs.result
@@ -3,10 +3,10 @@ create table t2 (c char(30)) charset=ucs2;
set @v=convert('abc' using ucs2);
reset master;
insert into t2 values (@v);
-show binlog events from 98;
+show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 User var 1 138 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
-master-bin.000001 138 Query 1 227 use `test`; insert into t2 values (@v)
+master-bin.000001 102 User var 1 142 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
+master-bin.000001 142 Query 1 231 use `test`; insert into t2 values (@v)
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
ROLLBACK;
diff --git a/mysql-test/r/drop_temp_table.result b/mysql-test/r/binlog_stm_drop_tmp_tbl.result
index 96481341bd6..96481341bd6 100644
--- a/mysql-test/r/drop_temp_table.result
+++ b/mysql-test/r/binlog_stm_drop_tmp_tbl.result
diff --git a/mysql-test/r/binlog_stm_innodb_stat.result b/mysql-test/r/binlog_stm_innodb_stat.result
new file mode 100644
index 00000000000..e6813ee2719
--- /dev/null
+++ b/mysql-test/r/binlog_stm_innodb_stat.result
@@ -0,0 +1,39 @@
+show status like "binlog_cache_use";
+Variable_name Value
+Binlog_cache_use 0
+show status like "binlog_cache_disk_use";
+Variable_name Value
+Binlog_cache_disk_use 0
+drop table if exists t1;
+create table t1 (a int) engine=innodb;
+show status like "binlog_cache_use";
+Variable_name Value
+Binlog_cache_use 1
+show status like "binlog_cache_disk_use";
+Variable_name Value
+Binlog_cache_disk_use 1
+begin;
+delete from t1;
+commit;
+show status like "binlog_cache_use";
+Variable_name Value
+Binlog_cache_use 2
+show status like "binlog_cache_disk_use";
+Variable_name Value
+Binlog_cache_disk_use 1
+drop table t1;
+show status like "Innodb_buffer_pool_pages_total";
+Variable_name Value
+Innodb_buffer_pool_pages_total 512
+show status like "Innodb_page_size";
+Variable_name Value
+Innodb_page_size 16384
+show status like "Innodb_rows_deleted";
+Variable_name Value
+Innodb_rows_deleted 2000
+show status like "Innodb_rows_inserted";
+Variable_name Value
+Innodb_rows_inserted 2000
+show status like "Innodb_rows_updated";
+Variable_name Value
+Innodb_rows_updated 0
diff --git a/mysql-test/r/insert_select-binlog.result b/mysql-test/r/binlog_stm_insert_select.result
index 76f460b1de2..646a76b254d 100644
--- a/mysql-test/r/insert_select-binlog.result
+++ b/mysql-test/r/binlog_stm_insert_select.result
@@ -1,14 +1,15 @@
+drop table if exists t1,t2;
create table t1(a int, unique(a));
insert into t1 values(2);
create table t2(a int);
insert into t2 values(1),(2);
reset master;
insert into t1 select * from t2;
-ERROR 23000: Duplicate entry '2' for key 1
+ERROR 23000: Duplicate entry '2' for key 'a'
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 98 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 98 Query 1 192 use `test`; insert into t1 select * from t2
+master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 196 use `test`; insert into t1 select * from t2
select * from t1;
a
1
@@ -18,8 +19,8 @@ create table t1(a int);
insert into t1 values(1),(1);
reset master;
create table t2(unique(a)) select a from t1;
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'a'
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 98 Server ver: VERSION, Binlog ver: 4
+master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4
drop table t1;
diff --git a/mysql-test/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/r/binlog_stm_mix_innodb_myisam.result
new file mode 100644
index 00000000000..8ab6840d441
--- /dev/null
+++ b/mysql-test/r/binlog_stm_mix_innodb_myisam.result
@@ -0,0 +1,381 @@
+drop table if exists t1, t2;
+create table t1 (a int) engine=innodb;
+create table t2 (a int) engine=myisam;
+reset master;
+begin;
+insert into t1 values(1);
+insert into t2 select * from t1;
+commit;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(1)
+master-bin.000001 # Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+delete from t1;
+delete from t2;
+reset master;
+begin;
+insert into t1 values(2);
+insert into t2 select * from t1;
+rollback;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(2)
+master-bin.000001 # Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 # Query 1 # use `test`; ROLLBACK
+delete from t1;
+delete from t2;
+reset master;
+begin;
+insert into t1 values(3);
+savepoint my_savepoint;
+insert into t1 values(4);
+insert into t2 select * from t1;
+rollback to savepoint my_savepoint;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+commit;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(3)
+master-bin.000001 # Query 1 # use `test`; savepoint my_savepoint
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(4)
+master-bin.000001 # Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 # Query 1 # use `test`; rollback to savepoint my_savepoint
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+delete from t1;
+delete from t2;
+reset master;
+begin;
+insert into t1 values(5);
+savepoint my_savepoint;
+insert into t1 values(6);
+insert into t2 select * from t1;
+rollback to savepoint my_savepoint;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+insert into t1 values(7);
+commit;
+select a from t1 order by a;
+a
+5
+7
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(5)
+master-bin.000001 # Query 1 # use `test`; savepoint my_savepoint
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(6)
+master-bin.000001 # Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 # Query 1 # use `test`; rollback to savepoint my_savepoint
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(7)
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+delete from t1;
+delete from t2;
+reset master;
+select get_lock("a",10);
+get_lock("a",10)
+1
+begin;
+insert into t1 values(8);
+insert into t2 select * from t1;
+select get_lock("a",10);
+get_lock("a",10)
+1
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(8)
+master-bin.000001 # Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 # Query 1 # use `test`; ROLLBACK
+delete from t1;
+delete from t2;
+reset master;
+insert into t1 values(9);
+insert into t2 select * from t1;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(9)
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+master-bin.000001 # Query 1 # use `test`; insert into t2 select * from t1
+delete from t1;
+delete from t2;
+reset master;
+insert into t1 values(10);
+begin;
+insert into t2 select * from t1;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(10)
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+master-bin.000001 # Query 1 # use `test`; insert into t2 select * from t1
+insert into t1 values(11);
+commit;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(10)
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+master-bin.000001 # Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(11)
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+alter table t2 engine=INNODB;
+delete from t1;
+delete from t2;
+reset master;
+begin;
+insert into t1 values(12);
+insert into t2 select * from t1;
+commit;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(12)
+master-bin.000001 # Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+delete from t1;
+delete from t2;
+reset master;
+begin;
+insert into t1 values(13);
+insert into t2 select * from t1;
+rollback;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+delete from t1;
+delete from t2;
+reset master;
+begin;
+insert into t1 values(14);
+savepoint my_savepoint;
+insert into t1 values(15);
+insert into t2 select * from t1;
+rollback to savepoint my_savepoint;
+commit;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(14)
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+delete from t1;
+delete from t2;
+reset master;
+begin;
+insert into t1 values(16);
+savepoint my_savepoint;
+insert into t1 values(17);
+insert into t2 select * from t1;
+rollback to savepoint my_savepoint;
+insert into t1 values(18);
+commit;
+select a from t1 order by a;
+a
+16
+18
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(16)
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(18)
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+delete from t1;
+delete from t2;
+alter table t2 engine=MyISAM;
+insert into t1 values (1);
+begin;
+select * from t1 for update;
+a
+1
+select (@before:=unix_timestamp())*0;
+(@before:=unix_timestamp())*0
+0
+begin;
+select * from t1 for update;
+insert into t2 values (20);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+select (@after:=unix_timestamp())*0;
+(@after:=unix_timestamp())*0
+0
+select (@after-@before) >= 2;
+(@after-@before) >= 2
+1
+drop table t1,t2;
+commit;
+begin;
+create temporary table ti (a int) engine=innodb;
+rollback;
+insert into ti values(1);
+set autocommit=0;
+create temporary table t1 (a int) engine=myisam;
+commit;
+insert t1 values (1);
+rollback;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+create table t0 (n int);
+insert t0 select * from t1;
+set autocommit=1;
+insert into t0 select GET_LOCK("lock1",null);
+set autocommit=0;
+create table t2 (n int) engine=innodb;
+insert into t2 values (3);
+select get_lock("lock1",60);
+get_lock("lock1",60)
+1
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(16)
+master-bin.000001 # Query 1 # use `test`; insert into t1 values(18)
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+master-bin.000001 # Query 1 # use `test`; delete from t1
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+master-bin.000001 # Query 1 # use `test`; delete from t2
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+master-bin.000001 # Query 1 # use `test`; alter table t2 engine=MyISAM
+master-bin.000001 # Query 1 # use `test`; insert into t1 values (1)
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+master-bin.000001 # Query 1 # use `test`; insert into t2 values (20)
+master-bin.000001 # Query 1 # use `test`; drop table t1,t2
+master-bin.000001 # Query 1 # use `test`; create temporary table ti (a int) engine=innodb
+master-bin.000001 # Query 1 # use `test`; insert into ti values(1)
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+master-bin.000001 # Query 1 # use `test`; create temporary table t1 (a int) engine=myisam
+master-bin.000001 # Query 1 # use `test`; insert t1 values (1)
+master-bin.000001 # Query 1 # use `test`; create table t0 (n int)
+master-bin.000001 # Query 1 # use `test`; insert t0 select * from t1
+master-bin.000001 # Query 1 # use `test`; insert into t0 select GET_LOCK("lock1",null)
+master-bin.000001 # Query 1 # use `test`; create table t2 (n int) engine=innodb
+master-bin.000001 # Query 1 # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti`
+do release_lock("lock1");
+drop table t0,t2;
+set autocommit=0;
+CREATE TABLE t1 (a int, b int) engine=myisam;
+reset master;
+INSERT INTO t1 values (1,1),(1,2);
+CREATE TABLE t2 (primary key (a)) engine=innodb select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+DROP TABLE if exists t2;
+Warnings:
+Note 1051 Unknown table 't2'
+INSERT INTO t1 values (3,3);
+CREATE TEMPORARY TABLE t2 (primary key (a)) engine=innodb select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+DROP TABLE IF EXISTS t2;
+Warnings:
+Note 1051 Unknown table 't2'
+CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb;
+INSERT INTO t1 VALUES (4,4);
+CREATE TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT * from t2;
+a b
+TRUNCATE table t2;
+INSERT INTO t1 VALUES (5,5);
+INSERT INTO t2 select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT * FROM t2;
+a b
+DROP TABLE t2;
+INSERT INTO t1 values (6,6);
+CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a)) engine=innodb ;
+INSERT INTO t1 values (7,7);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+INSERT INTO t1 values (8,8);
+CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+COMMIT;
+INSERT INTO t1 values (9,9);
+CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+SELECT * from t2;
+a b
+TRUNCATE table t2;
+INSERT INTO t1 values (10,10);
+INSERT INTO t2 select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT * from t1;
+a b
+1 1
+1 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+10 10
+INSERT INTO t2 values (100,100);
+CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+COMMIT;
+INSERT INTO t2 values (101,101);
+CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+ROLLBACK;
+SELECT * from t2;
+a b
+100 100
+DROP TABLE t1,t2;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 values (1,1),(1,2)
+master-bin.000001 # Query 1 # use `test`; DROP TABLE if exists t2
+master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 values (3,3)
+master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS t2
+master-bin.000001 # Query 1 # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb
+master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (4,4)
+master-bin.000001 # Query 1 # use `test`; TRUNCATE table t2
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (5,5)
+master-bin.000001 # Query 1 # use `test`; DROP TABLE t2
+master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 values (6,6)
+master-bin.000001 # Query 1 # use `test`; CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a)) engine=innodb
+master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 values (7,7)
+master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 values (8,8)
+master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 values (9,9)
+master-bin.000001 # Query 1 # use `test`; TRUNCATE table t2
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 values (10,10)
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Query 1 # use `test`; INSERT INTO t2 values (100,100)
+master-bin.000001 # Xid 1 # COMMIT /* xid= */
+master-bin.000001 # Query 1 # use `test`; DROP TABLE t1,t2
+reset master;
+create table t1 (a int) engine=innodb;
+create table t2 (a int) engine=myisam;
+select get_lock("a",10);
+get_lock("a",10)
+1
+begin;
+insert into t1 values(8);
+insert into t2 select * from t1;
+select get_lock("a",10);
+get_lock("a",10)
+1
+select
+(@a:=load_file("MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
+is not null;
+(@a:=load_file("MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
+is not null
+1
+select
+@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%",
+@a not like "%#%error_code=%error_code=%";
+@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%"
+1 1
+drop table t1, t2;
diff --git a/mysql-test/r/innodb_cache.result b/mysql-test/r/cache_innodb.result
index 5e8611655a2..7f9b3e279a9 100644
--- a/mysql-test/r/innodb_cache.result
+++ b/mysql-test/r/cache_innodb.result
@@ -1,7 +1,8 @@
+SET SESSION STORAGE_ENGINE = InnoDB;
drop table if exists t1,t2,t3;
flush status;
set autocommit=0;
-create table t1 (a int not null) engine=innodb;
+create table t1 (a int not null);
insert into t1 values (1),(2),(3);
select * from t1;
a
@@ -15,7 +16,7 @@ drop table t1;
commit;
set autocommit=1;
begin;
-create table t1 (a int not null) engine=innodb;
+create table t1 (a int not null);
insert into t1 values (1),(2),(3);
select * from t1;
a
@@ -27,9 +28,9 @@ Variable_name Value
Qcache_queries_in_cache 1
drop table t1;
commit;
-create table t1 (a int not null) engine=innodb;
-create table t2 (a int not null) engine=innodb;
-create table t3 (a int not null) engine=innodb;
+create table t1 (a int not null);
+create table t2 (a int not null);
+create table t3 (a int not null);
insert into t1 values (1),(2);
insert into t2 values (1),(2);
insert into t3 values (1),(2);
@@ -99,7 +100,7 @@ show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
drop table t3,t2,t1;
-CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) ENGINE=InnoDB;
+CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id));
select count(*) from t1;
count(*)
0
@@ -109,9 +110,9 @@ count(*)
1
drop table t1;
set GLOBAL query_cache_size=1355776;
-CREATE TABLE t1 ( id int(10) NOT NULL auto_increment, a varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY a (a)) ENGINE=innodb;
-CREATE TABLE t2 ( id int(10) NOT NULL auto_increment, b varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY b (b)) ENGINE=innodb;
-CREATE TABLE t3 ( id int(10) NOT NULL auto_increment, t1_id int(10) NOT NULL default '0', t2_id int(10) NOT NULL default '0', state int(11) default NULL, PRIMARY KEY (id), UNIQUE KEY t1_id (t1_id,t2_id), KEY t2_id (t2_id,t1_id), CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`), CONSTRAINT `t3_ibfk_2` FOREIGN KEY (`t2_id`) REFERENCES `t2` (`id`)) ENGINE=innodb;
+CREATE TABLE t1 ( id int(10) NOT NULL auto_increment, a varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY a (a));
+CREATE TABLE t2 ( id int(10) NOT NULL auto_increment, b varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY b (b));
+CREATE TABLE t3 ( id int(10) NOT NULL auto_increment, t1_id int(10) NOT NULL default '0', t2_id int(10) NOT NULL default '0', state int(11) default NULL, PRIMARY KEY (id), UNIQUE KEY t1_id (t1_id,t2_id), KEY t2_id (t2_id,t1_id), CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`), CONSTRAINT `t3_ibfk_2` FOREIGN KEY (`t2_id`) REFERENCES `t2` (`id`));
INSERT INTO t1 VALUES (1,'me');
INSERT INTO t2 VALUES (1,'you');
INSERT INTO t3 VALUES (2,1,1,2);
@@ -121,7 +122,7 @@ id a
begin;
insert into t3 VALUES ( NULL, 1, 1, 2 );
insert into t3 VALUES ( NULL, 1, 1, 2 );
-ERROR 23000: Duplicate entry '1-1' for key 2
+ERROR 23000: Duplicate entry '1-1' for key 't1_id'
commit;
select t1.* from t1, t2, t3 where t3.state & 1 = 0 and t3.t1_id = t1.id and t3.t2_id = t2.id and t1.id = 1 order by t1.a asc;
id a
diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result
index cf358e6a404..9ee64ee6dbd 100644
--- a/mysql-test/r/case.result
+++ b/mysql-test/r/case.result
@@ -1,4 +1,4 @@
-drop table if exists t1;
+drop table if exists t1,t2;
select CASE "b" when "a" then 1 when "b" then 2 END;
CASE "b" when "a" then 1 when "b" then 2 END
2
@@ -24,8 +24,8 @@ select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END;
CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END
one
explain extended select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select (case 1 when 1 then _latin1'one' when 2 then _latin1'two' else _latin1'more' end) AS `CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END`
select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END;
@@ -63,8 +63,8 @@ fcase count(*)
2 1
3 1
explain extended select case a when 1 then 2 when 2 then 3 else 0 end as fcase, count(*) from t1 group by fcase;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort
Warnings:
Note 1003 select (case `test`.`t1`.`a` when 1 then 2 when 2 then 3 else 0 end) AS `fcase`,count(0) AS `count(*)` from `test`.`t1` group by (case `test`.`t1`.`a` when 1 then 2 when 2 then 3 else 0 end)
select case a when 1 then "one" when 2 then "two" else "nothing" end as fcase, count(*) from t1 group by fcase;
@@ -99,18 +99,18 @@ CASE WHEN 1 THEN 0.1e1 else '1' END AS c12
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) character set latin1 collate latin1_danish_ci NOT NULL default '',
- `c2` varchar(1) character set latin1 collate latin1_danish_ci NOT NULL default '',
- `c3` varbinary(1) NOT NULL default '',
- `c4` varbinary(1) NOT NULL default '',
- `c5` varbinary(4) NOT NULL default '',
- `c6` varbinary(4) NOT NULL default '',
- `c7` decimal(2,1) NOT NULL default '0.0',
- `c8` decimal(2,1) NOT NULL default '0.0',
- `c9` decimal(2,1) default NULL,
- `c10` double NOT NULL default '0',
- `c11` double NOT NULL default '0',
- `c12` varbinary(5) NOT NULL default ''
+ `c1` varchar(1) CHARACTER SET latin1 COLLATE latin1_danish_ci NOT NULL DEFAULT '',
+ `c2` varchar(1) CHARACTER SET latin1 COLLATE latin1_danish_ci NOT NULL DEFAULT '',
+ `c3` varbinary(1) NOT NULL DEFAULT '',
+ `c4` varbinary(1) NOT NULL DEFAULT '',
+ `c5` varbinary(4) NOT NULL DEFAULT '',
+ `c6` varbinary(4) NOT NULL DEFAULT '',
+ `c7` decimal(2,1) NOT NULL DEFAULT '0.0',
+ `c8` decimal(2,1) NOT NULL DEFAULT '0.0',
+ `c9` decimal(2,1) DEFAULT NULL,
+ `c10` double NOT NULL DEFAULT '0',
+ `c11` double NOT NULL DEFAULT '0',
+ `c12` varbinary(5) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
SELECT CASE
@@ -144,20 +144,20 @@ explain extended SELECT
COALESCE(1), COALESCE(1.0),COALESCE('a'),
COALESCE(1,1.0), COALESCE(1,'1'),COALESCE(1.1,'1'),
COALESCE('a' COLLATE latin1_bin,'b');
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select coalesce(1) AS `COALESCE(1)`,coalesce(1.0) AS `COALESCE(1.0)`,coalesce(_latin1'a') AS `COALESCE('a')`,coalesce(1,1.0) AS `COALESCE(1,1.0)`,coalesce(1,_latin1'1') AS `COALESCE(1,'1')`,coalesce(1.1,_latin1'1') AS `COALESCE(1.1,'1')`,coalesce((_latin1'a' collate latin1_bin),_latin1'b') AS `COALESCE('a' COLLATE latin1_bin,'b')`
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `COALESCE(1)` int(1) NOT NULL default '0',
- `COALESCE(1.0)` decimal(2,1) NOT NULL default '0.0',
- `COALESCE('a')` varchar(1) NOT NULL default '',
- `COALESCE(1,1.0)` decimal(2,1) NOT NULL default '0.0',
- `COALESCE(1,'1')` varbinary(1) NOT NULL default '',
- `COALESCE(1.1,'1')` varbinary(4) NOT NULL default '',
- `COALESCE('a' COLLATE latin1_bin,'b')` varchar(1) character set latin1 collate latin1_bin NOT NULL default ''
+ `COALESCE(1)` int(1) NOT NULL DEFAULT '0',
+ `COALESCE(1.0)` decimal(2,1) NOT NULL DEFAULT '0.0',
+ `COALESCE('a')` varchar(1) NOT NULL DEFAULT '',
+ `COALESCE(1,1.0)` decimal(2,1) NOT NULL DEFAULT '0.0',
+ `COALESCE(1,'1')` varbinary(1) NOT NULL DEFAULT '',
+ `COALESCE(1.1,'1')` varbinary(4) NOT NULL DEFAULT '',
+ `COALESCE('a' COLLATE latin1_bin,'b')` varchar(1) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
SELECT 'case+union+test'
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index a07ca21652b..c95c950e7e0 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -19,8 +19,8 @@ select ~5, cast(~5 as signed);
~5 cast(~5 as signed)
18446744073709551610 -6
explain extended select ~5, cast(~5 as signed);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select ~(5) AS `~5`,cast(~(5) as signed) AS `cast(~5 as signed)`
select cast(5 as unsigned) -6.0;
@@ -103,7 +103,7 @@ Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
select 10.0+cast('a' as decimal);
10.0+cast('a' as decimal)
-10.00
+10.0
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'a'
select 10E+0+'a';
@@ -157,7 +157,7 @@ create table t1 select cast(_koi8r'' as char character set cp1251) as t;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `t` varchar(4) character set cp1251 NOT NULL default ''
+ `t` varchar(4) CHARACTER SET cp1251 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select
@@ -191,11 +191,11 @@ ab a ab a 6100
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(2) NOT NULL default '',
- `c2` varbinary(2) NOT NULL default '',
- `c3` varbinary(2) NOT NULL default '',
- `c4` varbinary(2) NOT NULL default '',
- `c5` varbinary(2) NOT NULL default ''
+ `c1` varbinary(2) NOT NULL DEFAULT '',
+ `c2` varbinary(2) NOT NULL DEFAULT '',
+ `c3` varbinary(2) NOT NULL DEFAULT '',
+ `c4` varbinary(2) NOT NULL DEFAULT '',
+ `c5` varbinary(2) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select
@@ -224,11 +224,11 @@ c1 c2 c3 c4 c5
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) character set utf8 NOT NULL default '',
- `c2` varchar(2) character set utf8 NOT NULL default '',
- `c3` varchar(2) character set utf8 NOT NULL default '',
- `c4` varchar(2) character set utf8 NOT NULL default '',
- `c5` varchar(2) character set utf8 NOT NULL default ''
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `c2` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `c3` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `c4` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `c5` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a binary(4), b char(4) character set koi8r);
@@ -368,7 +368,9 @@ create table t1(s1 time);
insert into t1 values ('11:11:11');
select cast(s1 as decimal(7,2)) from t1;
cast(s1 as decimal(7,2))
-111111.00
+99999.99
+Warnings:
+Error 1264 Out of range value for column 'cast(s1 as decimal(7,2))' at row 1
drop table t1;
CREATE TABLE t1 (v varchar(10), tt tinytext, t text,
mt mediumtext, lt longtext);
@@ -376,7 +378,7 @@ INSERT INTO t1 VALUES ('1.01', '2.02', '3.03', '4.04', '5.05');
SELECT CAST(v AS DECIMAL), CAST(tt AS DECIMAL), CAST(t AS DECIMAL),
CAST(mt AS DECIMAL), CAST(lt AS DECIMAL) from t1;
CAST(v AS DECIMAL) CAST(tt AS DECIMAL) CAST(t AS DECIMAL) CAST(mt AS DECIMAL) CAST(lt AS DECIMAL)
-1.01 2.02 3.03 4.04 5.05
+1 2 3 4 5
DROP TABLE t1;
select cast(NULL as decimal(6)) as t1;
t1
diff --git a/mysql-test/r/compress.result b/mysql-test/r/compress.result
index cce66fd84ef..0aebc817146 100644
--- a/mysql-test/r/compress.result
+++ b/mysql-test/r/compress.result
@@ -145,9 +145,9 @@ explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 ignore index (fld3,not_used);
-ERROR HY000: Key 'not_used' doesn't exist in table 't2'
+ERROR 42000: Key 'not_used' doesn't exist in table 't2'
explain select fld3 from t2 use index (not_used);
-ERROR HY000: Key 'not_used' doesn't exist in table 't2'
+ERROR 42000: Key 'not_used' doesn't exist in table 't2'
select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
fld3
honeysuckle
@@ -1505,8 +1505,8 @@ select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1)
count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
70 absentee vest 17788966 254128.0857 3272.5940 10709871.3069
explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>"";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where
Warnings:
Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> _latin1''))
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
diff --git a/mysql-test/r/concurrent_innodb.result b/mysql-test/r/concurrent_innodb.result
new file mode 100644
index 00000000000..27e2cde077c
--- /dev/null
+++ b/mysql-test/r/concurrent_innodb.result
@@ -0,0 +1,607 @@
+SET SESSION STORAGE_ENGINE = InnoDB;
+drop table if exists t1;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255));
+SET SESSION STORAGE_ENGINE = InnoDB;
+insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
+insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
+insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
+insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
+insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
+insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
+insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
+insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
+insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
+select get_lock("hello",1);
+get_lock("hello",1)
+1
+begin;
+ update t1 set eta=1+get_lock("hello",1)*0 where tipo=11;
+begin;
+update t1 set eta=2 where tipo=22;
+select release_lock("hello");
+release_lock("hello")
+1
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+ commit;
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+commit;
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+drop table t1;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255));
+insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
+insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
+insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
+insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
+insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
+insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
+insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
+insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
+insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
+select get_lock("hello",10);
+get_lock("hello",10)
+0
+begin;
+ update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
+begin;
+update t1 set tipo=1 where tipo=2;
+select release_lock("hello");
+release_lock("hello")
+0
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 1 ddddddddddddddddddddddddddddddddddddddddddd
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 1 fffffffffffffffffffffffffffffffffffffffffff
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 1 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+1 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+1 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+1 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+ commit;
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 1 ddddddddddddddddddddddddddddddddddddddddddd
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 1 fffffffffffffffffffffffffffffffffffffffffff
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 1 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+commit;
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 1 ddddddddddddddddddddddddddddddddddddddddddd
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 1 fffffffffffffffffffffffffffffffffffffffffff
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 1 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+1 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 1 ddddddddddddddddddddddddddddddddddddddddddd
+1 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 1 fffffffffffffffffffffffffffffffffffffffffff
+1 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 1 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+1 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 1 ddddddddddddddddddddddddddddddddddddddddddd
+1 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 1 fffffffffffffffffffffffffffffffffffffffffff
+1 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 1 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+drop table t1;
+create table t1 (a int not null, b int not null);
+insert into t1 values (1,1),(2,1),(3,1),(4,1);
+select get_lock("hello2",1000);
+get_lock("hello2",1000)
+1
+begin;
+ update t1 set b=10+get_lock(concat("hello",a),1000)*0 where
+a=2;
+insert into t1 values (1,1);
+select release_lock("hello2");
+release_lock("hello2")
+1
+select * from t1;
+a b
+1 1
+2 1
+3 1
+4 1
+1 1
+select * from t1;
+a b
+1 1
+2 10
+3 1
+4 1
+1 1
+ commit;
+drop table t1;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255));
+insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
+insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
+insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
+insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
+insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
+insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
+insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
+insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
+insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
+select get_lock("hello",10);
+get_lock("hello",10)
+1
+begin;
+ select * from t1 where tipo=2 FOR UPDATE;
+begin;
+select release_lock("hello");
+release_lock("hello")
+1
+update t1 set tipo=1+get_lock("hello",10)*0 where tipo=2;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+eta tipo c
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+ commit;
+commit;
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+drop table t1;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255));
+insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
+insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
+insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
+insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
+insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
+insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
+insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
+insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
+insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
+select get_lock("hello",10);
+get_lock("hello",10)
+1
+begin;
+ select * from t1 where tipo=2 FOR UPDATE;
+begin;
+select release_lock("hello");
+release_lock("hello")
+1
+update t1 set tipo=11+get_lock("hello",10)*0 where tipo=22;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+eta tipo c
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+ commit;
+commit;
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+drop table t1;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255));
+insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
+insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
+insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
+insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
+insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
+insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
+insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
+insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
+insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
+select get_lock("hello",10);
+get_lock("hello",10)
+1
+begin;
+ select * from t1 where tipo=2 FOR UPDATE;
+begin;
+select release_lock("hello");
+release_lock("hello")
+1
+select * from t1 where tipo=1 FOR UPDATE;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+eta tipo c
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+ commit;
+commit;
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+drop table t1;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255));
+insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
+insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
+insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
+insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
+insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
+insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
+insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
+insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
+insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
+select get_lock("hello",10);
+get_lock("hello",10)
+1
+begin;
+ delete from t1 where tipo=2;
+begin;
+select release_lock("hello");
+release_lock("hello")
+1
+update t1 set tipo=1+get_lock("hello",10)*0 where tipo=2;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+ commit;
+commit;
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+drop table t1;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255));
+insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
+insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
+insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
+insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
+insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
+insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
+insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
+insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
+insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
+select get_lock("hello",10);
+get_lock("hello",10)
+1
+begin;
+ delete from t1 where tipo=2;
+begin;
+select release_lock("hello");
+release_lock("hello")
+1
+update t1 set tipo=1+get_lock("hello",10)*0 where tipo=22;
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+20 2 ddddddddddddddddddddddddddddddddddddddddddd
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+40 2 fffffffffffffffffffffffffffffffffffffffffff
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 1 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+ commit;
+commit;
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 1 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+select * from t1;
+eta tipo c
+7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+10 1 ccccccccccccccccccccccccccccccccccccccccccc
+30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
+50 1 ggggggggggggggggggggggggggggggggggggggggggg
+70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+80 1 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
+90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
+drop table t1;
diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result
index 4f49f77d46c..862260346f5 100644
--- a/mysql-test/r/connect.result
+++ b/mysql-test/r/connect.result
@@ -3,14 +3,18 @@ show tables;
Tables_in_mysql
columns_priv
db
+event
func
+general_log
help_category
help_keyword
help_relation
help_topic
host
+plugin
proc
procs_priv
+slow_log
tables_priv
time_zone
time_zone_leap_second
@@ -30,14 +34,18 @@ show tables;
Tables_in_mysql
columns_priv
db
+event
func
+general_log
help_category
help_keyword
help_relation
help_topic
host
+plugin
proc
procs_priv
+slow_log
tables_priv
time_zone
time_zone_leap_second
@@ -65,14 +73,18 @@ show tables;
Tables_in_mysql
columns_priv
db
+event
func
+general_log
help_category
help_keyword
help_relation
help_topic
host
+plugin
proc
procs_priv
+slow_log
tables_priv
time_zone
time_zone_leap_second
diff --git a/mysql-test/r/constraints.result b/mysql-test/r/constraints.result
index d4d525c8991..116efe429d5 100644
--- a/mysql-test/r/constraints.result
+++ b/mysql-test/r/constraints.result
@@ -21,7 +21,7 @@ alter table t1 add constraint constraint_2 unique key_2(a);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) default NULL,
+ `a` int(11) DEFAULT NULL,
UNIQUE KEY `constraint_1` (`a`),
UNIQUE KEY `key_1` (`a`),
UNIQUE KEY `key_2` (`a`)
diff --git a/mysql-test/r/contributors.result b/mysql-test/r/contributors.result
new file mode 100644
index 00000000000..5739c2244c3
--- /dev/null
+++ b/mysql-test/r/contributors.result
@@ -0,0 +1,5 @@
+SHOW CONTRIBUTORS;
+Name Location Comment
+Ronald Bradford Brisbane, Australia EFF contribution for UC2006 Auction
+Sheeri Kritzer Boston, Mass. USA EFF contribution for UC2006 Auction
+Mark Shuttleworth London, UK. EFF contribution for UC2006 Auction
diff --git a/mysql-test/r/crash_commit_before.result b/mysql-test/r/crash_commit_before.result
new file mode 100644
index 00000000000..8eba584c539
--- /dev/null
+++ b/mysql-test/r/crash_commit_before.result
@@ -0,0 +1,13 @@
+CREATE TABLE t1(a int) engine=innodb;
+START TRANSACTION;
+insert into t1 values(9);
+SET SESSION debug="d,crash_commit_before";
+COMMIT;
+ERROR HY000: Lost connection to MySQL server during query
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+a
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 1dcbc693597..5bc28e9eee5 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -13,7 +13,7 @@ Warnings:
Note 1050 Table 't1' already exists
insert into t1 values (""),(null);
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'b' at row 2
+Warning 1048 Column 'b' cannot be null
select * from t1;
b
@@ -41,7 +41,14 @@ ERROR 42000: Incorrect table definition; there can be only one auto column and i
create table not_existing_database.test (a int);
ERROR 42000: Unknown database 'not_existing_database'
create table `a/a` (a int);
-ERROR 42000: Incorrect table name 'a/a'
+show create table `a/a`;
+Table Create Table
+a/a CREATE TABLE `a/a` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create table t1 like `a/a`;
+drop table `a/a`;
+drop table `t1`;
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int);
ERROR 42000: Incorrect table name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
create table a (`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` int);
@@ -155,7 +162,7 @@ Note 1051 Unknown table 't2'
CREATE TABLE t1 (a int not null);
INSERT INTO t1 values (1),(2),(1);
CREATE TABLE t2 (primary key(a)) SELECT * FROM t1;
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
SELECT * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist
DROP TABLE t1;
@@ -167,8 +174,8 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
- `b` int(11) default NULL,
- PRIMARY KEY (`a`),
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`),
KEY `b` (`b`),
KEY `b_2` (`b`),
KEY `b_3` (`b`),
@@ -259,6 +266,7 @@ select * from t1;
0 1 2
0 0 1
drop table t1;
+flush status;
create table t1 (a int not null, b int, primary key (a));
insert into t1 values (1,1);
create table if not exists t1 select 2;
@@ -273,7 +281,14 @@ create table if not exists t1 select 3 as 'a',4 as 'b';
Warnings:
Note 1050 Table 't1' already exists
create table if not exists t1 select 3 as 'a',3 as 'b';
-ERROR 23000: Duplicate entry '3' for key 1
+ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
+show warnings;
+Level Code Message
+Note 1050 Table 't1' already exists
+Error 1062 Duplicate entry '3' for key 'PRIMARY'
+show status like "Opened_tables";
+Variable_name Value
+Opened_tables 2
select * from t1;
a b
1 1
@@ -304,7 +319,7 @@ show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`id` int(11) NOT NULL,
- `name` char(20) default NULL
+ `name` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t3;
id name
@@ -327,7 +342,7 @@ show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`id` int(11) NOT NULL,
- `name` char(20) default NULL
+ `name` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t3;
id name
@@ -339,14 +354,14 @@ show create table t3;
Table Create Table
t3 CREATE TEMPORARY TABLE `t3` (
`id` int(11) NOT NULL,
- `name` char(20) default NULL
+ `name` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
create table t2 like t3;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL,
- `name` char(20) default NULL
+ `name` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t2;
id name
@@ -359,8 +374,6 @@ create table t3 like non_existing_table;
ERROR 42S02: Unknown table 'non_existing_table'
create temporary table t3 like t1;
ERROR 42S01: Table 't3' already exists
-create table t3 like `a/a`;
-ERROR 42000: Incorrect table name 'a/a'
drop table t1, t2, t3;
drop table t3;
drop database mysqltest;
@@ -442,21 +455,21 @@ create table t2 select ifnull(a,a), ifnull(b,b), ifnull(c,c), ifnull(d,d), ifnul
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `ifnull(a,a)` tinyint(4) default NULL,
- `ifnull(b,b)` smallint(6) default NULL,
- `ifnull(c,c)` mediumint(8) default NULL,
- `ifnull(d,d)` int(11) default NULL,
- `ifnull(e,e)` bigint(20) default NULL,
- `ifnull(f,f)` float(24,2) default NULL,
- `ifnull(g,g)` double(53,3) default NULL,
- `ifnull(h,h)` decimal(5,4) default NULL,
- `ifnull(i,i)` year(4) default NULL,
- `ifnull(j,j)` date default NULL,
- `ifnull(k,k)` timestamp NOT NULL default '0000-00-00 00:00:00',
- `ifnull(l,l)` datetime default NULL,
- `ifnull(m,m)` varchar(1) default NULL,
- `ifnull(n,n)` varchar(3) default NULL,
- `ifnull(o,o)` varchar(10) default NULL
+ `ifnull(a,a)` tinyint(4) DEFAULT NULL,
+ `ifnull(b,b)` smallint(6) DEFAULT NULL,
+ `ifnull(c,c)` mediumint(8) DEFAULT NULL,
+ `ifnull(d,d)` int(11) DEFAULT NULL,
+ `ifnull(e,e)` bigint(20) DEFAULT NULL,
+ `ifnull(f,f)` float(24,2) DEFAULT NULL,
+ `ifnull(g,g)` double(53,3) DEFAULT NULL,
+ `ifnull(h,h)` decimal(5,4) DEFAULT NULL,
+ `ifnull(i,i)` year(4) DEFAULT NULL,
+ `ifnull(j,j)` date DEFAULT NULL,
+ `ifnull(k,k)` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `ifnull(l,l)` datetime DEFAULT NULL,
+ `ifnull(m,m)` varchar(1) DEFAULT NULL,
+ `ifnull(n,n)` varchar(3) DEFAULT NULL,
+ `ifnull(o,o)` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1,t2;
create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14');
@@ -521,14 +534,14 @@ create table t1 (`primary` int, index(`primary`));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `primary` int(11) default NULL,
+ `primary` int(11) DEFAULT NULL,
KEY `primary_2` (`primary`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
create table t2 (`PRIMARY` int, index(`PRIMARY`));
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `PRIMARY` int(11) default NULL,
+ `PRIMARY` int(11) DEFAULT NULL,
KEY `PRIMARY_2` (`PRIMARY`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
create table t3 (a int);
@@ -541,7 +554,7 @@ alter table t4 add index(`primary`);
show create table t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `primary` int(11) default NULL,
+ `primary` int(11) DEFAULT NULL,
KEY `primary_2` (`primary`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
create table t5 (`PRIMARY` int);
@@ -549,7 +562,7 @@ alter table t5 add index(`PRIMARY`);
show create table t5;
Table Create Table
t5 CREATE TABLE `t5` (
- `PRIMARY` int(11) default NULL,
+ `PRIMARY` int(11) DEFAULT NULL,
KEY `PRIMARY_2` (`PRIMARY`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2, t3, t4, t5;
@@ -637,8 +650,8 @@ primary key (a)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(112) character set utf8 collate utf8_bin NOT NULL,
- PRIMARY KEY (`a`)
+ `a` varchar(112) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t2 (
@@ -652,9 +665,9 @@ b int not null, primary key (a)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(12) character set utf8 collate utf8_bin NOT NULL,
+ `a` varchar(12) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`b` int(11) NOT NULL,
- PRIMARY KEY (`a`)
+ PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (
@@ -667,9 +680,9 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`b` int(11) NOT NULL,
- `a` varchar(12) character set utf8 collate utf8_bin NOT NULL,
- `c` int(1) NOT NULL default '0',
- PRIMARY KEY (`a`)
+ `a` varchar(12) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `c` int(1) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (
@@ -679,10 +692,10 @@ b int null, primary key (a)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `b` int(11) default NULL,
- `a` varchar(12) character set utf8 collate utf8_bin NOT NULL,
- `c` int(1) NOT NULL default '0',
- PRIMARY KEY (`a`)
+ `b` int(11) DEFAULT NULL,
+ `a` varchar(12) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `c` int(1) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (
@@ -692,9 +705,9 @@ b int not null, primary key (a)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(12) character set utf8 collate utf8_bin NOT NULL,
+ `a` varchar(12) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`b` int(11) NOT NULL,
- PRIMARY KEY (`a`)
+ PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (
@@ -704,9 +717,9 @@ b int not null, primary key (a)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(12) character set utf8 collate utf8_bin NOT NULL default '',
+ `a` varchar(12) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`b` int(11) NOT NULL,
- PRIMARY KEY (`a`)
+ PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (
@@ -740,10 +753,10 @@ select a1,a2 from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` int(11) default '3',
- `b` int(11) default '3',
- `a1` int(11) default NULL,
- `a2` int(11) default NULL
+ `a` int(11) DEFAULT '3',
+ `b` int(11) DEFAULT '3',
+ `a1` int(11) DEFAULT NULL,
+ `a2` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1(a set("a,b","c,d") not null);
@@ -752,20 +765,58 @@ create table t1 (i int) engine=myisam max_rows=100000000000;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(11) default NULL
+ `i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=4294967295
alter table t1 max_rows=100;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(11) default NULL
+ `i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=100
alter table t1 max_rows=100000000000;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(11) default NULL
+ `i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=4294967295
drop table t1;
create table t1 (upgrade int);
drop table t1;
+CREATE TABLE t1 (a int, b int);
+insert into t1 values (1,1),(1,2);
+CREATE TABLE t2 (primary key (a)) select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+drop table if exists t2;
+Warnings:
+Note 1051 Unknown table 't2'
+CREATE TEMPORARY TABLE t2 (primary key (a)) select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+drop table if exists t2;
+Warnings:
+Note 1051 Unknown table 't2'
+CREATE TABLE t2 (a int, b int, primary key (a));
+CREATE TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT * from t2;
+a b
+1 1
+TRUNCATE table t2;
+INSERT INTO t2 select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT * from t2;
+a b
+1 1
+drop table t2;
+CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a));
+CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT * from t2;
+a b
+1 1
+TRUNCATE table t2;
+INSERT INTO t2 select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT * from t2;
+a b
+1 1
+drop table t1,t2;
diff --git a/mysql-test/r/create_not_windows.result b/mysql-test/r/create_not_windows.result
index b975c98c2b1..abe76fd3fbe 100644
--- a/mysql-test/r/create_not_windows.result
+++ b/mysql-test/r/create_not_windows.result
@@ -7,8 +7,25 @@ primary key (_id)
show create table `about:text`;
Table Create Table
about:text CREATE TABLE `about:text` (
- `_id` int(11) NOT NULL auto_increment,
- `about:text` varchar(255) NOT NULL default '',
- PRIMARY KEY (`_id`)
+ `_id` int(11) NOT NULL AUTO_INCREMENT,
+ `about:text` varchar(255) NOT NULL DEFAULT '',
+ PRIMARY KEY (`_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table `about:text`;
+use test;
+drop table if exists t1;
+create table t1(a int) engine=myisam;
+insert into t1 values(1);
+"We get an error because the table is in the definition cache"
+create table t1(a int, b int);
+ERROR 42S01: Table 't1' already exists
+"Flush the cache and recreate the table anew to be able to drop it"
+flush tables;
+show open tables like "t%";
+Database Table In_use Name_locked
+create table t1(a int, b int, c int);
+"Try to select from the table. This should not crash the server"
+select count(a) from t1;
+count(a)
+0
+drop table t1;
diff --git a/mysql-test/r/create_select_tmp.result b/mysql-test/r/create_select_tmp.result
index 668547bcff9..f499e539baf 100644
--- a/mysql-test/r/create_select_tmp.result
+++ b/mysql-test/r/create_select_tmp.result
@@ -2,19 +2,19 @@ drop table if exists t1, t2;
CREATE TABLE t1 ( a int );
INSERT INTO t1 VALUES (1),(2),(1);
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist
drop table t1;
diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result
index 8ec79e9d7a9..32ca47e20d2 100644
--- a/mysql-test/r/csv.result
+++ b/mysql-test/r/csv.result
@@ -4943,10 +4943,10 @@ val
UPDATE bug13894 SET val=6 WHERE val=10;
SELECT * FROM bug13894;
val
-5
-11
6
6
+5
+11
DROP TABLE bug13894;
DROP TABLE IF EXISTS bug14672;
CREATE TABLE bug14672 (c1 integer) engine = CSV;
@@ -4975,6 +4975,146 @@ c1
4
5
DROP TABLE bug14672;
+CREATE TABLE test_concurrent_insert ( val integer ) ENGINE = CSV;
+LOCK TABLES test_concurrent_insert READ LOCAL;
+INSERT INTO test_concurrent_insert VALUES (1);
+SELECT * FROM test_concurrent_insert;
+val
+1
+SELECT * FROM test_concurrent_insert;
+val
+UNLOCK TABLES;
+LOCK TABLES test_concurrent_insert WRITE;
+INSERT INTO test_concurrent_insert VALUES (2);
+SELECT * FROM test_concurrent_insert;
+val
+1
+2
+UNLOCK TABLES;
+DROP TABLE test_concurrent_insert;
+CREATE TABLE test_repair_table ( val integer ) ENGINE = CSV;
+CHECK TABLE test_repair_table;
+Table Op Msg_type Msg_text
+test.test_repair_table check status OK
+REPAIR TABLE test_repair_table;
+Table Op Msg_type Msg_text
+test.test_repair_table repair status OK
+DROP TABLE test_repair_table;
+CREATE TABLE test_repair_table2 ( val integer ) ENGINE = CSV;
+SELECT * from test_repair_table2;
+val
+Warnings:
+Error 1194 Table 'test_repair_table2' is marked as crashed and should be repaired
+SELECT * from test_repair_table2;
+val
+test_repair_table2.CSM
+CHECK TABLE test_repair_table2;
+Table Op Msg_type Msg_text
+test.test_repair_table2 check status OK
+DROP TABLE test_repair_table2;
+CREATE TABLE test_repair_table3 ( val integer ) ENGINE = CSV;
+CHECK TABLE test_repair_table3;
+Table Op Msg_type Msg_text
+test.test_repair_table3 check error Corrupt
+REPAIR TABLE test_repair_table3;
+Table Op Msg_type Msg_text
+test.test_repair_table3 repair status OK
+SELECT * FROM test_repair_table3;
+val
+1
+4
+DROP TABLE test_repair_table3;
+CREATE TABLE test_repair_table4 (
+num int not null,
+magic_no int(4) unsigned zerofill DEFAULT '0000' NOT NULL,
+company_name char(30) DEFAULT '' NOT NULL,
+founded char(4) DEFAULT '' NOT NULL
+) ENGINE = CSV;
+SELECT * FROM test_repair_table4;
+num magic_no company_name founded
+Warnings:
+Error 1194 Table 'test_repair_table4' is marked as crashed and should be repaired
+SELECT * FROM test_repair_table4;
+num magic_no company_name founded
+CHECK TABLE test_repair_table4;
+Table Op Msg_type Msg_text
+test.test_repair_table4 check status OK
+INSERT INTO test_repair_table4 VALUES (2,101,'SAP','1972');
+INSERT INTO test_repair_table4 VALUES (1,101,'Microsoft','1978');
+INSERT INTO test_repair_table4 VALUES (2,101,'MySQL','1995');
+SELECT * FROM test_repair_table4;
+num magic_no company_name founded
+2 0101 SAP 1972
+1 0101 Microsoft 1978
+2 0101 MySQL 1995
+CHECK TABLE test_repair_table4;
+Table Op Msg_type Msg_text
+test.test_repair_table4 check status OK
+REPAIR TABLE test_repair_table4;
+Table Op Msg_type Msg_text
+test.test_repair_table4 repair status OK
+SELECT * FROM test_repair_table4;
+num magic_no company_name founded
+2 0101 SAP 1972
+1 0101 Microsoft 1978
+2 0101 MySQL 1995
+CHECK TABLE test_repair_table4;
+Table Op Msg_type Msg_text
+test.test_repair_table4 check status OK
+REPAIR TABLE test_repair_table4;
+Table Op Msg_type Msg_text
+test.test_repair_table4 repair status OK
+SELECT * FROM test_repair_table4;
+num magic_no company_name founded
+2 0101 SAP 1972
+1 0101 Microsoft 1978
+2 0101 MySQL 1995
+DROP TABLE test_repair_table4;
+CREATE TABLE test_repair_table5 (
+num int not null,
+magic_no int(4) unsigned zerofill DEFAULT '0000' NOT NULL,
+company_name char(30) DEFAULT '' NOT NULL,
+founded char(4) DEFAULT '' NOT NULL
+) ENGINE = CSV;
+CHECK TABLE test_repair_table5;
+Table Op Msg_type Msg_text
+test.test_repair_table5 check error Corrupt
+REPAIR TABLE test_repair_table5;
+Table Op Msg_type Msg_text
+test.test_repair_table5 repair status OK
+SELECT * FROM test_repair_table5;
+num magic_no company_name founded
+INSERT INTO test_repair_table5 VALUES (1, 102, "CORRECT", 1876);
+SELECT * FROM test_repair_table5;
+num magic_no company_name founded
+1 0102 CORRECT 1876
+FLUSH TABLES;
+CHECK TABLE test_repair_table5;
+Table Op Msg_type Msg_text
+test.test_repair_table5 check error Corrupt
+REPAIR TABLE test_repair_table5;
+Table Op Msg_type Msg_text
+test.test_repair_table5 repair status OK
+SELECT * FROM test_repair_table5;
+num magic_no company_name founded
+1 0102 CORRECT 1876
+INSERT INTO test_repair_table5 VALUES (1, 102, "CORRECT2", 1876);
+SELECT * FROM test_repair_table5;
+num magic_no company_name founded
+1 0102 CORRECT 1876
+1 0102 CORRECT2 1876
+FLUSH TABLES;
+CHECK TABLE test_repair_table5;
+Table Op Msg_type Msg_text
+test.test_repair_table5 check error Corrupt
+REPAIR TABLE test_repair_table5;
+Table Op Msg_type Msg_text
+test.test_repair_table5 repair status OK
+SELECT * FROM test_repair_table5;
+num magic_no company_name founded
+1 0102 CORRECT 1876
+1 0102 CORRECT2 1876
+DROP TABLE test_repair_table5;
create table t1 (a int) engine=csv;
insert t1 values (1);
delete from t1;
@@ -4999,13 +5139,87 @@ insert t1 values (1),(2),(3),(4),(5);
truncate table t1;
affected rows: 0
drop table t1;
+create table t1 (v varchar(32));
+insert into t1 values ('def'),('abc'),('hij'),('3r4f');
+select * from t1;
+v
+def
+abc
+hij
+3r4f
+alter table t1 change v v2 varchar(32);
+select * from t1;
+v2
+def
+abc
+hij
+3r4f
+alter table t1 change v2 v varchar(64);
+select * from t1;
+v
+def
+abc
+hij
+3r4f
+update t1 set v = 'lmn' where v = 'hij';
+select * from t1;
+v
+def
+abc
+lmn
+3r4f
+alter table t1 add i int auto_increment not null primary key first;
+select * from t1;
+i v
+1 def
+2 abc
+3 lmn
+4 3r4f
+update t1 set i=5 where i=3;
+select * from t1;
+i v
+1 def
+2 abc
+5 lmn
+4 3r4f
+alter table t1 change i i bigint;
+select * from t1;
+i v
+1 def
+2 abc
+5 lmn
+4 3r4f
+alter table t1 add unique key (i, v);
+select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn');
+i v
+4 3r4f
+drop table t1;
create table bug15205 (val int(11) default null) engine=csv;
create table bug15205_2 (val int(11) default null) engine=csv;
select * from bug15205;
-ERROR HY000: Got error 1 from storage engine
+ERROR HY000: Can't get stat of './test/bug15205.CSV' (Errcode: 2)
select * from bug15205_2;
val
select * from bug15205;
val
drop table bug15205;
drop table bug15205_2;
+create table bug22080_1 (id int,string varchar(64)) Engine=CSV;
+create table bug22080_2 (id int,string varchar(64)) Engine=CSV;
+create table bug22080_3 (id int,string varchar(64)) Engine=CSV;
+insert into bug22080_1 values(1,'string');
+insert into bug22080_1 values(2,'string');
+insert into bug22080_1 values(3,'string');
+"1","string"
+2","string"
+"3","string"
+check table bug22080_2;
+Table Op Msg_type Msg_text
+test.bug22080_2 check error Corrupt
+"1","string"
+"2",string"
+"3","string"
+check table bug22080_3;
+Table Op Msg_type Msg_text
+test.bug22080_3 check error Corrupt
+drop tables bug22080_1,bug22080_2,bug22080_3;
diff --git a/mysql-test/r/ctype_collate.result b/mysql-test/r/ctype_collate.result
index 66266d40fb3..c5d433cd080 100644
--- a/mysql-test/r/ctype_collate.result
+++ b/mysql-test/r/ctype_collate.result
@@ -494,7 +494,7 @@ latin1_f CHAR(32) CHARACTER SET latin1 COLLATE latin1_bin;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `latin1_f` char(32) character set latin1 collate latin1_bin default NULL
+ `latin1_f` char(32) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW FIELDS FROM t1;
Field Type Null Key Default Extra
@@ -503,7 +503,7 @@ ALTER TABLE t1 CHARACTER SET latin1 COLLATE latin1_bin;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `latin1_f` char(32) collate latin1_bin default NULL
+ `latin1_f` char(32) COLLATE latin1_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin
SHOW FIELDS FROM t1;
Field Type Null Key Default Extra
@@ -516,8 +516,8 @@ SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A'
latin1 latin1_swedish_ci 4 1
explain extended SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select charset(_latin1'a') AS `charset('a')`,collation(_latin1'a') AS `collation('a')`,coercibility(_latin1'a') AS `coercibility('a')`,(_latin1'a' = _latin1'A') AS `'a'='A'`
SET CHARACTER SET koi8r;
diff --git a/mysql-test/r/ctype_cp1250_ch.result b/mysql-test/r/ctype_cp1250_ch.result
index b55849e4e12..007d6103b8a 100644
--- a/mysql-test/r/ctype_cp1250_ch.result
+++ b/mysql-test/r/ctype_cp1250_ch.result
@@ -1,3 +1,4 @@
+drop table if exists t1;
SHOW COLLATION LIKE 'cp1250_czech_cs';
Collation Charset Id Default Compiled Sortlen
cp1250_czech_cs cp1250 34 Yes 2
diff --git a/mysql-test/r/ctype_cp932_notembedded.result b/mysql-test/r/ctype_cp932_binlog_row.result
index d04fce7738c..f1a64241fbb 100644
--- a/mysql-test/r/ctype_cp932_notembedded.result
+++ b/mysql-test/r/ctype_cp932_binlog_row.result
@@ -6,11 +6,11 @@ CREATE TABLE t1(f1 blob);
PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)';
SET @var1= x'8300';
EXECUTE stmt1 USING @var1;
-SHOW BINLOG EVENTS FROM 98;
+SHOW BINLOG EVENTS FROM 102;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 185 use `test`; CREATE TABLE t1(f1 blob)
-master-bin.000001 185 User var 1 224 @`var1`=_binary 0x8300 COLLATE binary
-master-bin.000001 224 Query 1 317 use `test`; INSERT INTO t1 VALUES(@'var1')
+master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(f1 blob)
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
SELECT HEX(f1) FROM t1;
HEX(f1)
8300
diff --git a/mysql-test/r/ctype_cp932_binlog.result b/mysql-test/r/ctype_cp932_binlog_stm.result
index 6d742f3d464..d354a8b99f7 100644
--- a/mysql-test/r/ctype_cp932_binlog.result
+++ b/mysql-test/r/ctype_cp932_binlog_stm.result
@@ -6,11 +6,11 @@ CREATE TABLE t1(f1 blob);
PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)';
SET @var1= x'8300';
EXECUTE stmt1 USING @var1;
-SHOW BINLOG EVENTS FROM 98;
+SHOW BINLOG EVENTS FROM 102;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 185 use `test`; CREATE TABLE t1(f1 blob)
-master-bin.000001 185 User var 1 224 @`var1`=_binary 0x8300 COLLATE binary
-master-bin.000001 224 Query 1 317 use `test`; INSERT INTO t1 VALUES(@'var1')
+master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(f1 blob)
+master-bin.000001 # User var 1 # @`var1`=_binary 0x8300 COLLATE binary
+master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES(@'var1')
SELECT HEX(f1) FROM t1;
HEX(f1)
8300
@@ -30,17 +30,17 @@ HEX(s1) HEX(s2) d
466F6F2773206120426172 ED40ED41ED42 47.93
DROP PROCEDURE bug18293|
DROP TABLE t4|
-SHOW BINLOG EVENTS FROM 393|
+SHOW BINLOG EVENTS FROM 397|
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 393 Query 1 556 use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
+master-bin.000001 397 Query 1 560 use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
s2 CHAR(50) CHARACTER SET cp932,
d DECIMAL(10,2))
-master-bin.000001 556 Query 1 801 use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE bug18293 (IN ins1 CHAR(50),
+master-bin.000001 560 Query 1 805 use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE bug18293 (IN ins1 CHAR(50),
IN ins2 CHAR(50) CHARACTER SET cp932,
IN ind DECIMAL(10,2))
BEGIN
INSERT INTO t4 VALUES (ins1, ins2, ind);
END
-master-bin.000001 801 Query 1 1006 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1'Foo\'s a Bar'), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93))
-master-bin.000001 1006 Query 1 1092 use `test`; DROP PROCEDURE bug18293
-master-bin.000001 1092 Query 1 1168 use `test`; DROP TABLE t4
+master-bin.000001 805 Query 1 1010 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1'Foo\'s a Bar'), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93))
+master-bin.000001 1010 Query 1 1096 use `test`; DROP PROCEDURE bug18293
+master-bin.000001 1096 Query 1 1172 use `test`; DROP TABLE t4
diff --git a/mysql-test/r/ctype_create.result b/mysql-test/r/ctype_create.result
index 63bae33c6e1..8a81991ea78 100644
--- a/mysql-test/r/ctype_create.result
+++ b/mysql-test/r/ctype_create.result
@@ -12,7 +12,7 @@ CREATE TABLE mysqltest2.t1 (a char(10));
SHOW CREATE TABLE mysqltest2.t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(10) default NULL
+ `a` char(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin5
DROP TABLE mysqltest2.t1;
ALTER DATABASE mysqltest2 DEFAULT CHARACTER SET latin7;
@@ -20,7 +20,7 @@ CREATE TABLE mysqltest2.t1 (a char(10));
SHOW CREATE TABLE mysqltest2.t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(10) default NULL
+ `a` char(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin7
DROP DATABASE mysqltest2;
CREATE DATABASE mysqltest2 CHARACTER SET latin2;
@@ -28,7 +28,7 @@ CREATE TABLE mysqltest2.t1 (a char(10));
SHOW CREATE TABLE mysqltest2.t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(10) default NULL
+ `a` char(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin2
DROP DATABASE mysqltest2;
USE mysqltest1;
@@ -36,14 +36,14 @@ CREATE TABLE t1 (a char(10));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(10) default NULL
+ `a` char(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp1251
DROP TABLE t1;
CREATE TABLE t1 (a char(10)) DEFAULT CHARACTER SET latin1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(10) default NULL
+ `a` char(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (a char(10))
@@ -51,7 +51,7 @@ DEFAULT CHARACTER SET latin1 COLLATE latin1_german1_ci;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(10) collate latin1_german1_ci default NULL
+ `a` char(10) COLLATE latin1_german1_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci
DROP TABLE t1;
create table t1 (a char) character set latin1 character set latin2;
diff --git a/mysql-test/r/ctype_filename.result b/mysql-test/r/ctype_filename.result
new file mode 100644
index 00000000000..acc32c7dedf
--- /dev/null
+++ b/mysql-test/r/ctype_filename.result
@@ -0,0 +1,13 @@
+drop table if exists con, aux, nul, lpt1, com1, `clock$`;
+create table con (a int);
+drop table con;
+create table aux (a int);
+drop table aux;
+create table nul (a int);
+drop table nul;
+create table lpt1 (a int);
+drop table lpt1;
+create table com1 (a int);
+drop table com1;
+create table `clock$` (a int);
+drop table `clock$`;
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
index f8e07e1eb6f..32871563b64 100644
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@ -391,3 +391,17 @@ ABC ߲~ @ abc
SELECT convert(@str collate latin1_swedish_ci using utf8);
convert(@str collate latin1_swedish_ci using utf8)
ABC ߲~ @ abc
+SET NAMES latin1;
+DROP TABLE IF EXISTS `abcdef`;
+CREATE TABLE `abcdef` (i int);
+INSERT INTO `abcdef` VALUES (1);
+INSERT INTO abcdef VALUES (2);
+SELECT * FROM `abcdef`;
+i
+1
+2
+SELECT * FROM abcdef;
+i
+1
+2
+DROP TABLE `abcdef`;
diff --git a/mysql-test/r/ctype_latin1_de.result b/mysql-test/r/ctype_latin1_de.result
index f60dc175cd6..5733877237d 100644
--- a/mysql-test/r/ctype_latin1_de.result
+++ b/mysql-test/r/ctype_latin1_de.result
@@ -224,8 +224,8 @@ create table t1 (word varchar(255) not null, word2 varchar(255) not null default
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `word` varchar(255) collate latin1_german2_ci NOT NULL,
- `word2` varchar(255) collate latin1_german2_ci NOT NULL default '',
+ `word` varchar(255) COLLATE latin1_german2_ci NOT NULL,
+ `word2` varchar(255) COLLATE latin1_german2_ci NOT NULL DEFAULT '',
KEY `word` (`word`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci
insert into t1 (word) values ('ss'),(0xDF),(0xE4),('ae');
@@ -299,7 +299,7 @@ s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `s1` char(5) collate latin1_german2_ci default NULL
+ `s1` char(5) COLLATE latin1_german2_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci
INSERT INTO t1 VALUES ('');
INSERT INTO t1 VALUES ('ue');
diff --git a/mysql-test/r/ctype_many.result b/mysql-test/r/ctype_many.result
index 125a3fc4286..89e05bf4484 100644
--- a/mysql-test/r/ctype_many.result
+++ b/mysql-test/r/ctype_many.result
@@ -7,22 +7,22 @@ koi8_ru_f CHAR(32) CHARACTER SET koi8r NOT NULL default ''
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `comment` char(32) character set latin1 NOT NULL,
- `koi8_ru_f` char(32) character set koi8r NOT NULL default ''
+ `comment` char(32) CHARACTER SET latin1 NOT NULL,
+ `koi8_ru_f` char(32) CHARACTER SET koi8r NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin5
ALTER TABLE t1 CHANGE comment comment CHAR(32) CHARACTER SET latin2 NOT NULL;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `comment` char(32) character set latin2 NOT NULL,
- `koi8_ru_f` char(32) character set koi8r NOT NULL default ''
+ `comment` char(32) CHARACTER SET latin2 NOT NULL,
+ `koi8_ru_f` char(32) CHARACTER SET koi8r NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin5
ALTER TABLE t1 ADD latin5_f CHAR(32) NOT NULL;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `comment` char(32) character set latin2 NOT NULL,
- `koi8_ru_f` char(32) character set koi8r NOT NULL default '',
+ `comment` char(32) CHARACTER SET latin2 NOT NULL,
+ `koi8_ru_f` char(32) CHARACTER SET koi8r NOT NULL DEFAULT '',
`latin5_f` char(32) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin5
ALTER TABLE t1 DEFAULT CHARSET=latin2;
@@ -31,8 +31,8 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`comment` char(32) NOT NULL,
- `koi8_ru_f` char(32) character set koi8r NOT NULL default '',
- `latin5_f` char(32) character set latin5 NOT NULL,
+ `koi8_ru_f` char(32) CHARACTER SET koi8r NOT NULL DEFAULT '',
+ `latin5_f` char(32) CHARACTER SET latin5 NOT NULL,
`latin2_f` char(32) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin2
ALTER TABLE t1 DROP latin2_f, DROP latin5_f;
@@ -40,7 +40,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`comment` char(32) NOT NULL,
- `koi8_ru_f` char(32) character set koi8r NOT NULL default ''
+ `koi8_ru_f` char(32) CHARACTER SET koi8r NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin2
INSERT INTO t1 (koi8_ru_f,comment) VALUES ('a','LAT SMALL A');
INSERT INTO t1 (koi8_ru_f,comment) VALUES ('b','LAT SMALL B');
diff --git a/mysql-test/r/ctype_mb.result b/mysql-test/r/ctype_mb.result
index f6e14e1a78f..aa5b4ae8189 100644
--- a/mysql-test/r/ctype_mb.result
+++ b/mysql-test/r/ctype_mb.result
@@ -3,17 +3,17 @@ CREATE TABLE t1 SELECT _utf8'test' as c1, _utf8'тест' as c2;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) character set utf8 NOT NULL default '',
- `c2` varchar(4) character set utf8 NOT NULL default ''
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `c2` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DELETE FROM t1;
ALTER TABLE t1 ADD c3 CHAR(4) CHARACTER SET utf8;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) character set utf8 NOT NULL default '',
- `c2` varchar(4) character set utf8 NOT NULL default '',
- `c3` char(4) character set utf8 default NULL
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `c2` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `c3` char(4) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('aaaabbbbccccdddd','aaaabbbbccccdddd','aaaabbbbccccdddd');
Warnings:
@@ -28,7 +28,7 @@ CREATE TABLE t1 (a CHAR(4) CHARACTER SET utf8, KEY key_a(a(3)));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(4) character set utf8 default NULL,
+ `a` char(4) CHARACTER SET utf8 DEFAULT NULL,
KEY `key_a` (`a`(3))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW KEYS FROM t1;
@@ -38,7 +38,7 @@ ALTER TABLE t1 CHANGE a a CHAR(4);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(4) default NULL,
+ `a` char(4) DEFAULT NULL,
KEY `key_a` (`a`(3))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW KEYS FROM t1;
@@ -48,7 +48,7 @@ ALTER TABLE t1 CHANGE a a CHAR(4) CHARACTER SET utf8;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(4) character set utf8 default NULL,
+ `a` char(4) CHARACTER SET utf8 DEFAULT NULL,
KEY `key_a` (`a`(3))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW KEYS FROM t1;
diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result
index 4e145346081..d0087b03c17 100644
--- a/mysql-test/r/ctype_recoding.result
+++ b/mysql-test/r/ctype_recoding.result
@@ -6,7 +6,7 @@ CREATE TABLE t2 (a CHAR(10) CHARACTER SET utf8);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(10) character set cp1251 default NULL
+ `a` char(10) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT a FROM t1;
a
@@ -30,7 +30,7 @@ CREATE TABLE t2 (a TEXT CHARACTER SET utf8);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` text character set cp1251
+ `a` text CHARACTER SET cp1251
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(a) FROM t1;
HEX(a)
@@ -50,7 +50,7 @@ Tables_in_test
SHOW CREATE TABLE ;
Table Create Table
CREATE TABLE `` (
- `` char(32) character set koi8r NOT NULL COMMENT ' '
+ `` char(32) CHARACTER SET koi8r NOT NULL COMMENT ' '
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT=' '
SHOW FIELDS FROM ;
Field Type Null Key Default Extra
@@ -62,7 +62,7 @@ Tables_in_test
SHOW CREATE TABLE ;
Table Create Table
CREATE TABLE `` (
- `` char(32) character set koi8r NOT NULL COMMENT ' '
+ `` char(32) CHARACTER SET koi8r NOT NULL COMMENT ' '
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT=' '
SHOW FIELDS FROM ;
Field Type Null Key Default Extra
@@ -74,7 +74,7 @@ Tables_in_test
SHOW CREATE TABLE таблица;
Table Create Table
таблица CREATE TABLE `таблица` (
- `поле` char(32) character set koi8r NOT NULL COMMENT 'комментарий поля'
+ `поле` char(32) CHARACTER SET koi8r NOT NULL COMMENT 'комментарий поля'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='комментарий таблицы'
SHOW FIELDS FROM таблица;
Field Type Null Key Default Extra
@@ -117,13 +117,13 @@ CREATE TABLE `тест` (`тест` int);
SHOW CREATE TABLE `тест`;
Table Create Table
тест CREATE TABLE `тест` (
- `тест` int(11) default NULL
+ `тест` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SET NAMES utf8;
SHOW CREATE TABLE `тест`;
Table Create Table
тест CREATE TABLE `тест` (
- `тест` int(11) default NULL
+ `тест` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE `тест`;
SET NAMES binary;
@@ -141,8 +141,8 @@ CREATE TABLE t1 (`` CHAR(128) DEFAULT '', `1` ENUM('1','2') DEFAULT '2');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `` char(128) default '',
- `1` enum('1','2') default '2'
+ `` char(128) DEFAULT '',
+ `1` enum('1','2') DEFAULT '2'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW COLUMNS FROM t1;
Field Type Null Key Default Extra
@@ -152,8 +152,8 @@ SET NAMES binary;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `ä` char(128) default 'ä',
- `ä1` enum('ä1','ä2') default 'ä2'
+ `ä` char(128) DEFAULT 'ä',
+ `ä1` enum('ä1','ä2') DEFAULT 'ä2'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW COLUMNS FROM t1;
Field Type Null Key Default Extra
@@ -253,7 +253,7 @@ create table t1(a char character set cp1251 default _koi8r 0xFF);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(1) character set cp1251 default ''
+ `a` char(1) CHARACTER SET cp1251 DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1(a char character set latin1 default _cp1251 0xFF);
diff --git a/mysql-test/r/ctype_sjis.result b/mysql-test/r/ctype_sjis.result
index dab5991b505..1c9d540d574 100644
--- a/mysql-test/r/ctype_sjis.result
+++ b/mysql-test/r/ctype_sjis.result
@@ -51,7 +51,7 @@ create table t1(c enum(0x9353,0x9373) character set sjis);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c` enum('S','s') character set sjis default NULL
+ `c` enum('S','s') CHARACTER SET sjis DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (0x9353);
insert into t1 values (0x9373);
diff --git a/mysql-test/r/ctype_tis620.result b/mysql-test/r/ctype_tis620.result
index dae694cf3d5..5699c044d70 100644
--- a/mysql-test/r/ctype_tis620.result
+++ b/mysql-test/r/ctype_tis620.result
@@ -120,9 +120,9 @@ PRIMARY KEY (recid)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `recid` int(11) NOT NULL auto_increment,
+ `recid` int(11) NOT NULL AUTO_INCREMENT,
`dyninfo` text,
- PRIMARY KEY (`recid`)
+ PRIMARY KEY (`recid`)
) ENGINE=MyISAM DEFAULT CHARSET=tis620
INSERT INTO t1 VALUES (1,'color=\"STB,NPG\"\r\nengine=\"J30A13\"\r\nframe=\"MRHCG1640YP4\"\r\ngrade=\"V6\"\r\nmodel=\"ACCORD\"\r\nmodelcode=\"CG164YEN\"\r\ntype=\"VT6\"\r\n');
INSERT INTO t1 VALUES (2,'color=\"HTM,NPG,DEG,RGS\"\r\nengine=\"F23A5YP1\"\r\nframe=\"MRHCF8640YP3\"\r\ngrade=\"EXi AT\"\r\nmodel=\"ACCORD\"\r\nmodelcode=\"CF864YE\"\r\ntype=\"EXA\"\r\n');
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 76fcbbeb9f8..4f08b97492f 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -74,8 +74,8 @@ RPAD(_ucs2 X'0420',10,_ucs2 X'0421') r;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `l` varchar(10) character set ucs2 NOT NULL default '',
- `r` varchar(10) character set ucs2 NOT NULL default ''
+ `l` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '',
+ `r` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
create table t2(f1 Char(30));
@@ -523,7 +523,7 @@ create table t1 (a enum('x','y','z') character set ucs2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` enum('x','y','z') character set ucs2 default NULL
+ `a` enum('x','y','z') CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ('x');
insert into t1 values ('y');
@@ -537,7 +537,7 @@ alter table t1 change a a enum('x','y','z','d','e','','','') character set uc
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` enum('x','y','z','d','e','','','') character set ucs2 default NULL
+ `a` enum('x','y','z','d','e','','','') CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ('D');
insert into t1 values ('E ');
@@ -559,7 +559,7 @@ create table t1 (a set ('x','y','z','','','') character set ucs2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` set('x','y','z','','','') character set ucs2 default NULL
+ `a` set('x','y','z','','','') CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ('x');
insert into t1 values ('y');
@@ -671,7 +671,7 @@ DROP TABLE t1;
CREATE TABLE t1 (Field1 int(10) unsigned default '0');
INSERT INTO t1 VALUES ('-1');
Warnings:
-Warning 1264 Out of range value adjusted for column 'Field1' at row 1
+Warning 1264 Out of range value for column 'Field1' at row 1
DROP TABLE t1;
SET NAMES latin1;
SELECT CONVERT(103, CHAR(50) UNICODE);
@@ -762,7 +762,7 @@ NOT NULL default 'passive'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `status` enum('active','passive') character set latin1 collate latin1_general_ci NOT NULL default 'passive'
+ `status` enum('active','passive') CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'passive'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t1 ADD a int NOT NULL AFTER status;
CREATE TABLE t2 (
@@ -772,7 +772,7 @@ NOT NULL default 'passive'
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `status` enum('active','passive') character set ucs2 collate ucs2_turkish_ci NOT NULL default 'passive'
+ `status` enum('active','passive') CHARACTER SET ucs2 COLLATE ucs2_turkish_ci NOT NULL DEFAULT 'passive'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t2 ADD a int NOT NULL AFTER status;
DROP TABLE t1,t2;
diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result
index 091d96c56d3..d95b8cf9efb 100644
--- a/mysql-test/r/ctype_ujis.result
+++ b/mysql-test/r/ctype_ujis.result
@@ -118,8 +118,8 @@ b enum('','') default NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(1) NOT NULL default '',
- `b` enum('','') default NULL
+ `a` char(1) NOT NULL DEFAULT '',
+ `b` enum('','') DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=ujis
SHOW COLUMNS FROM t1;
Field Type Null Key Default Extra
@@ -132,7 +132,7 @@ a INTEGER NOT NULL,
b VARCHAR(50) NOT NULL DEFAULT '',
PRIMARY KEY (a),
KEY b (b(10))
-) TYPE=InnoDB CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
+) ENGINE=InnoDB CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl');
@@ -152,7 +152,7 @@ a INTEGER NOT NULL,
b VARCHAR(50) NOT NULL DEFAULT '',
PRIMARY KEY (a),
KEY b (b(10))
-) TYPE=MyISAM CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
+) ENGINE=MyISAM CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl');
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index 00fd5a0c9aa..4ae19fc8f7c 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -124,7 +124,7 @@ create table t1 select date_format("2004-01-19 10:10:10", "%Y-%m-%d");
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `date_format("2004-01-19 10:10:10", "%Y-%m-%d")` varbinary(10) default NULL
+ `date_format("2004-01-19 10:10:10", "%Y-%m-%d")` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t1;
date_format("2004-01-19 10:10:10", "%Y-%m-%d")
@@ -275,7 +275,7 @@ create table t1 (a enum('aaaa','проба') character set utf8);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` enum('aaaa','проба') character set utf8 default NULL
+ `a` enum('aaaa','проба') CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ('проба');
select * from t1;
@@ -285,7 +285,7 @@ create table t2 select ifnull(a,a) from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `ifnull(a,a)` varchar(5) character set utf8 default NULL
+ `ifnull(a,a)` varchar(5) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t2;
ifnull(a,a)
@@ -296,9 +296,9 @@ create table t1 (c varchar(30) character set utf8, unique(c(10)));
insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
insert into t1 values ('aaaaaaaaaa');
insert into t1 values ('aaaaaaaaaaa');
-ERROR 23000: Duplicate entry 'aaaaaaaaaaa' for key 1
+ERROR 23000: Duplicate entry 'aaaaaaaaaaa' for key 'c'
insert into t1 values ('aaaaaaaaaaaa');
-ERROR 23000: Duplicate entry 'aaaaaaaaaaaa' for key 1
+ERROR 23000: Duplicate entry 'aaaaaaaaaaaa' for key 'c'
insert into t1 values (repeat('b',20));
select c c1 from t1 where c='1';
c1
@@ -329,9 +329,9 @@ create table t1 (c varchar(30) character set utf8, unique(c(10))) engine=innodb;
insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
insert into t1 values ('aaaaaaaaaa');
insert into t1 values ('aaaaaaaaaaa');
-ERROR 23000: Duplicate entry 'aaaaaaaaaaa' for key 1
+ERROR 23000: Duplicate entry 'aaaaaaaaaaa' for key 'c'
insert into t1 values ('aaaaaaaaaaaa');
-ERROR 23000: Duplicate entry 'aaaaaaaaaaaa' for key 1
+ERROR 23000: Duplicate entry 'aaaaaaaaaaaa' for key 'c'
insert into t1 values (repeat('b',20));
select c c1 from t1 where c='1';
c1
@@ -363,46 +363,46 @@ insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
insert into t1 values ('a');
insert into t1 values ('aa');
insert into t1 values ('aaa');
-ERROR 23000: Duplicate entry 'aaa' for key 1
+ERROR 23000: Duplicate entry 'aaa' for key 'c'
insert into t1 values ('b');
insert into t1 values ('bb');
insert into t1 values ('bbb');
-ERROR 23000: Duplicate entry 'bbb' for key 1
+ERROR 23000: Duplicate entry 'bbb' for key 'c'
insert into t1 values ('а');
insert into t1 values ('аа');
insert into t1 values ('ааа');
-ERROR 23000: Duplicate entry 'ааа' for key 1
+ERROR 23000: Duplicate entry 'ааа' for key 'c'
insert into t1 values ('б');
insert into t1 values ('бб');
insert into t1 values ('ббб');
-ERROR 23000: Duplicate entry 'ббб' for key 1
+ERROR 23000: Duplicate entry 'ббб' for key 'c'
insert into t1 values ('ꪪ');
insert into t1 values ('ꪪꪪ');
insert into t1 values ('ꪪꪪꪪ');
-ERROR 23000: Duplicate entry 'ꪪꪪ' for key 1
+ERROR 23000: Duplicate entry 'ꪪꪪ' for key 'c'
drop table t1;
create table t1 (c char(3) character set utf8, unique (c(2))) engine=innodb;
insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
insert into t1 values ('a');
insert into t1 values ('aa');
insert into t1 values ('aaa');
-ERROR 23000: Duplicate entry 'aaa' for key 1
+ERROR 23000: Duplicate entry 'aaa' for key 'c'
insert into t1 values ('b');
insert into t1 values ('bb');
insert into t1 values ('bbb');
-ERROR 23000: Duplicate entry 'bbb' for key 1
+ERROR 23000: Duplicate entry 'bbb' for key 'c'
insert into t1 values ('а');
insert into t1 values ('аа');
insert into t1 values ('ааа');
-ERROR 23000: Duplicate entry 'ааа' for key 1
+ERROR 23000: Duplicate entry 'ааа' for key 'c'
insert into t1 values ('б');
insert into t1 values ('бб');
insert into t1 values ('ббб');
-ERROR 23000: Duplicate entry 'ббб' for key 1
+ERROR 23000: Duplicate entry 'ббб' for key 'c'
insert into t1 values ('ꪪ');
insert into t1 values ('ꪪꪪ');
insert into t1 values ('ꪪꪪꪪ');
-ERROR 23000: Duplicate entry 'ꪪꪪ' for key 1
+ERROR 23000: Duplicate entry 'ꪪꪪ' for key 'c'
drop table t1;
create table t1 (
c char(10) character set utf8,
@@ -411,19 +411,19 @@ unique key a using hash (c(1))
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c` char(10) character set utf8 default NULL,
- UNIQUE KEY `a` USING HASH (`c`(1))
+ `c` char(10) CHARACTER SET utf8 DEFAULT NULL,
+ UNIQUE KEY `a` (`c`(1)) USING HASH
) ENGINE=MEMORY DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
-ERROR 23000: Duplicate entry 'aa' for key 1
+ERROR 23000: Duplicate entry 'aa' for key 'a'
insert into t1 values ('aaa');
-ERROR 23000: Duplicate entry 'aaa' for key 1
+ERROR 23000: Duplicate entry 'aaa' for key 'a'
insert into t1 values ('б');
insert into t1 values ('бб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
insert into t1 values ('ббб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
select c as c_all from t1 order by c;
c_all
a
@@ -447,19 +447,19 @@ unique key a using btree (c(1))
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c` char(10) character set utf8 default NULL,
- UNIQUE KEY `a` USING BTREE (`c`(1))
+ `c` char(10) CHARACTER SET utf8 DEFAULT NULL,
+ UNIQUE KEY `a` (`c`(1)) USING BTREE
) ENGINE=MEMORY DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
-ERROR 23000: Duplicate entry 'aa' for key 1
+ERROR 23000: Duplicate entry 'aa' for key 'a'
insert into t1 values ('aaa');
-ERROR 23000: Duplicate entry 'aaa' for key 1
+ERROR 23000: Duplicate entry 'aaa' for key 'a'
insert into t1 values ('б');
insert into t1 values ('бб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
insert into t1 values ('ббб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
select c as c_all from t1 order by c;
c_all
a
@@ -479,17 +479,17 @@ drop table t1;
create table t1 (
c char(10) character set utf8,
unique key a (c(1))
-) engine=bdb;
+) engine=innodb;
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
-ERROR 23000: Duplicate entry 'aa' for key 1
+ERROR 23000: Duplicate entry 'aa' for key 'a'
insert into t1 values ('aaa');
-ERROR 23000: Duplicate entry 'aaa' for key 1
+ERROR 23000: Duplicate entry 'aaa' for key 'a'
insert into t1 values ('б');
insert into t1 values ('бб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
insert into t1 values ('ббб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
select c as c_all from t1 order by c;
c_all
a
@@ -510,9 +510,9 @@ create table t1 (c varchar(30) character set utf8 collate utf8_bin, unique(c(10)
insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
insert into t1 values ('aaaaaaaaaa');
insert into t1 values ('aaaaaaaaaaa');
-ERROR 23000: Duplicate entry 'aaaaaaaaaaa' for key 1
+ERROR 23000: Duplicate entry 'aaaaaaaaaaa' for key 'c'
insert into t1 values ('aaaaaaaaaaaa');
-ERROR 23000: Duplicate entry 'aaaaaaaaaaaa' for key 1
+ERROR 23000: Duplicate entry 'aaaaaaaaaaaa' for key 'c'
insert into t1 values (repeat('b',20));
select c c1 from t1 where c='1';
c1
@@ -544,23 +544,23 @@ insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
insert into t1 values ('a');
insert into t1 values ('aa');
insert into t1 values ('aaa');
-ERROR 23000: Duplicate entry 'aaa' for key 1
+ERROR 23000: Duplicate entry 'aaa' for key 'c'
insert into t1 values ('b');
insert into t1 values ('bb');
insert into t1 values ('bbb');
-ERROR 23000: Duplicate entry 'bbb' for key 1
+ERROR 23000: Duplicate entry 'bbb' for key 'c'
insert into t1 values ('а');
insert into t1 values ('аа');
insert into t1 values ('ааа');
-ERROR 23000: Duplicate entry 'ааа' for key 1
+ERROR 23000: Duplicate entry 'ааа' for key 'c'
insert into t1 values ('б');
insert into t1 values ('бб');
insert into t1 values ('ббб');
-ERROR 23000: Duplicate entry 'ббб' for key 1
+ERROR 23000: Duplicate entry 'ббб' for key 'c'
insert into t1 values ('ꪪ');
insert into t1 values ('ꪪꪪ');
insert into t1 values ('ꪪꪪꪪ');
-ERROR 23000: Duplicate entry 'ꪪꪪ' for key 1
+ERROR 23000: Duplicate entry 'ꪪꪪ' for key 'c'
drop table t1;
create table t1 (
c char(10) character set utf8 collate utf8_bin,
@@ -569,19 +569,19 @@ unique key a using hash (c(1))
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c` char(10) character set utf8 collate utf8_bin default NULL,
- UNIQUE KEY `a` USING HASH (`c`(1))
+ `c` char(10) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+ UNIQUE KEY `a` (`c`(1)) USING HASH
) ENGINE=MEMORY DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
-ERROR 23000: Duplicate entry 'aa' for key 1
+ERROR 23000: Duplicate entry 'aa' for key 'a'
insert into t1 values ('aaa');
-ERROR 23000: Duplicate entry 'aaa' for key 1
+ERROR 23000: Duplicate entry 'aaa' for key 'a'
insert into t1 values ('б');
insert into t1 values ('бб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
insert into t1 values ('ббб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
select c as c_all from t1 order by c;
c_all
a
@@ -605,19 +605,19 @@ unique key a using btree (c(1))
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c` char(10) character set utf8 collate utf8_bin default NULL,
- UNIQUE KEY `a` USING BTREE (`c`(1))
+ `c` char(10) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+ UNIQUE KEY `a` (`c`(1)) USING BTREE
) ENGINE=MEMORY DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
-ERROR 23000: Duplicate entry 'aa' for key 1
+ERROR 23000: Duplicate entry 'aa' for key 'a'
insert into t1 values ('aaa');
-ERROR 23000: Duplicate entry 'aaa' for key 1
+ERROR 23000: Duplicate entry 'aaa' for key 'a'
insert into t1 values ('б');
insert into t1 values ('бб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
insert into t1 values ('ббб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
select c as c_all from t1 order by c;
c_all
a
@@ -637,17 +637,17 @@ drop table t1;
create table t1 (
c char(10) character set utf8 collate utf8_bin,
unique key a (c(1))
-) engine=bdb;
+) engine=innodb;
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
-ERROR 23000: Duplicate entry 'aa' for key 1
+ERROR 23000: Duplicate entry 'aa' for key 'a'
insert into t1 values ('aaa');
-ERROR 23000: Duplicate entry 'aaa' for key 1
+ERROR 23000: Duplicate entry 'aaa' for key 'a'
insert into t1 values ('б');
insert into t1 values ('бб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
insert into t1 values ('ббб');
-ERROR 23000: Duplicate entry 'б' for key 1
+ERROR 23000: Duplicate entry 'б' for key 'a'
select c as c_all from t1 order by c;
c_all
a
@@ -707,7 +707,7 @@ drop table t1;
create table t1 (
str varchar(255) character set utf8 not null,
key str (str(2))
-) engine=bdb;
+) engine=innodb;
INSERT INTO t1 VALUES ('str');
INSERT INTO t1 VALUES ('str2');
select * from t1 where str='str';
@@ -796,7 +796,7 @@ insert into t1 values(1,'foo'),(2,'foobar');
select * from t1 where b like 'foob%';
a b
2 foobar
-alter table t1 engine=bdb;
+alter table t1 engine=innodb;
select * from t1 where b like 'foob%';
a b
2 foobar
@@ -809,8 +809,8 @@ create table t2 select concat(a,_utf8'') as a, concat(b,_utf8'')as b from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` varchar(5) character set utf8 NOT NULL default '',
- `b` varchar(15) character set utf8 NOT NULL default ''
+ `a` varchar(5) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `b` varchar(15) CHARACTER SET utf8 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2;
drop table t1;
diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result
index bbe3aee1fb0..017631bf8d1 100644
--- a/mysql-test/r/date_formats.result
+++ b/mysql-test/r/date_formats.result
@@ -1,12 +1,14 @@
drop table if exists t1;
SHOW GLOBAL VARIABLES LIKE "%_format%";
Variable_name Value
+binlog_format <format>
date_format %d.%m.%Y
datetime_format %Y-%m-%d %H:%i:%s
default_week_format 0
time_format %H.%i.%s
SHOW SESSION VARIABLES LIKE "%_format%";
Variable_name Value
+binlog_format <format>
date_format %d.%m.%Y
datetime_format %Y-%m-%d %H:%i:%s
default_week_format 0
@@ -30,6 +32,7 @@ set datetime_format= '%h:%i:%s %p %Y-%m-%d';
set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
SHOW SESSION VARIABLES LIKE "%format";
Variable_name Value
+binlog_format <format>
date_format %m-%d-%Y
datetime_format %h:%i:%s.%f %p %Y-%m-%d
default_week_format 0
@@ -401,14 +404,14 @@ date format str_to_date
2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12
03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 0003-01-02 22:11:12
Warnings:
-Warning 1292 Truncated incorrect datetime value: '10:20:10AM'
+Warning 1292 Incorrect datetime value: '10:20:10AM'
select date,format,concat(str_to_date(date, format),'') as con from t1;
date format con
10:20:10AM %h:%i:%s 0000-00-00 10:20:10
2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12
03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 0003-01-02 22:11:12
Warnings:
-Warning 1292 Truncated incorrect datetime value: '10:20:10AM'
+Warning 1292 Incorrect datetime value: '10:20:10AM'
drop table t1;
select get_format(DATE, 'USA') as a;
a
@@ -431,8 +434,8 @@ NULL
Warnings:
Error 1411 Incorrect datetime value: '15-01-2001 12:59:59' for function str_to_time
explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"),cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME), maketime(23,11,12),microsecond("1997-12-31 23:59:59.000001");
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select makedate(1997,1) AS `makedate(1997,1)`,addtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'1 1.1.1.000002') AS `addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,subtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'1 1.1.1.000002') AS `subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,timediff(_latin1'01.01.97 11:59:59.000001 PM',_latin1'31.12.95 11:59:59.000002 PM') AS `timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM")`,cast(str_to_date(_latin1'15-01-2001 12:59:59',_latin1'%d-%m-%Y %H:%i:%S') as time) AS `cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME)`,maketime(23,11,12) AS `maketime(23,11,12)`,microsecond(_latin1'1997-12-31 23:59:59.000001') AS `microsecond("1997-12-31 23:59:59.000001")`
create table t1 (d date);
@@ -570,5 +573,5 @@ SELECT DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896);
DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896)
NULL
Warnings:
-Warning 1292 Truncated incorrect datetime value: '%Y-%m-%d %H:%i:%s'
+Warning 1292 Incorrect datetime value: '%Y-%m-%d %H:%i:%s'
"End of 4.1 tests"
diff --git a/mysql-test/r/innodb-deadlock.result b/mysql-test/r/deadlock_innodb.result
index 2ca82101fb4..a0686d1c844 100644
--- a/mysql-test/r/innodb-deadlock.result
+++ b/mysql-test/r/deadlock_innodb.result
@@ -1,25 +1,33 @@
+# Establish connection con1 (user=root)
+# Establish connection con2 (user=root)
drop table if exists t1,t2;
-create table t1 (id integer, x integer) engine=INNODB;
+# Switch to connection con1
+create table t1 (id integer, x integer) engine = InnoDB;
insert into t1 values(0, 0);
set autocommit=0;
SELECT * from t1 where id = 0 FOR UPDATE;
id x
0 0
+# Switch to connection con2
set autocommit=0;
update t1 set x=2 where id = 0;
+# Switch to connection con1
update t1 set x=1 where id = 0;
select * from t1;
id x
0 1
commit;
+# Switch to connection con2
commit;
+# Switch to connection con1
select * from t1;
id x
0 2
commit;
drop table t1;
-create table t1 (id integer, x integer) engine=INNODB;
-create table t2 (b integer, a integer) engine=INNODB;
+# Switch to connection con1
+create table t1 (id integer, x integer) engine = InnoDB;
+create table t2 (b integer, a integer) engine = InnoDB;
insert into t1 values(0, 0), (300, 300);
insert into t2 values(0, 10), (1, 20), (2, 30);
commit;
@@ -39,26 +47,31 @@ select * from t1;
id x
0 0
300 300
+# Switch to connection con2
set autocommit=0;
update t1 set x=2 where id = 0;
+# Switch to connection con1
update t1 set x=1 where id = 0;
select * from t1;
id x
0 1
300 300
commit;
+# Switch to connection con2
commit;
+# Switch to connection con1
select * from t1;
id x
0 2
300 300
commit;
drop table t1, t2;
-create table t1 (id integer, x integer) engine=INNODB;
-create table t2 (b integer, a integer) engine=INNODB;
+create table t1 (id integer, x integer) engine = InnoDB;
+create table t2 (b integer, a integer) engine = InnoDB;
insert into t1 values(0, 0), (300, 300);
insert into t2 values(0, 0), (1, 20), (2, 30);
commit;
+# Switch to connection con1
select a,b from t2 UNION SELECT id, x from t1 FOR UPDATE;
a b
0 0
@@ -74,6 +87,7 @@ select * from t1;
id x
0 0
300 300
+# Switch to connection con2
update t2 set a=2 where b = 0;
select * from t2;
b a
@@ -81,16 +95,20 @@ b a
1 20
2 30
update t1 set x=2 where id = 0;
+# Switch to connection con1
update t1 set x=1 where id = 0;
select * from t1;
id x
0 1
300 300
commit;
+# Switch to connection con2
commit;
+# Switch to connection con1
select * from t1;
id x
0 2
300 300
commit;
+# Switch to connection default + disconnect con1 and con2
drop table t1, t2;
diff --git a/mysql-test/r/default.result b/mysql-test/r/default.result
index e2aa3b4a3cc..9bef2e2fdbf 100644
--- a/mysql-test/r/default.result
+++ b/mysql-test/r/default.result
@@ -67,9 +67,9 @@ ENGINE=MyISAM DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` varchar(30) collate latin1_bin NOT NULL default ' ',
- `b` varchar(1) collate latin1_bin NOT NULL default ' ',
- `c` varchar(4) collate latin1_bin NOT NULL default '0000',
+ `a` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
+ `b` varchar(1) COLLATE latin1_bin NOT NULL DEFAULT ' ',
+ `c` varchar(4) COLLATE latin1_bin NOT NULL DEFAULT '0000',
`d` tinyblob,
`e` tinyblob,
`f` tinyblob,
@@ -83,17 +83,17 @@ t2 CREATE TABLE `t2` (
`n` tinyblob,
`o` tinyblob,
`p` tinyblob,
- `q` varchar(30) collate latin1_bin NOT NULL default ' ',
- `r` varchar(30) collate latin1_bin NOT NULL default ' ',
+ `q` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
+ `r` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
`s` tinyblob,
- `t` varchar(4) collate latin1_bin NOT NULL default ' ',
- `u` varchar(1) collate latin1_bin NOT NULL default ' ',
- `v` varchar(30) collate latin1_bin NOT NULL default ' ',
- `w` varchar(30) collate latin1_bin NOT NULL default ' ',
+ `t` varchar(4) COLLATE latin1_bin NOT NULL DEFAULT ' ',
+ `u` varchar(1) COLLATE latin1_bin NOT NULL DEFAULT ' ',
+ `v` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
+ `w` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
`x` tinyblob,
- `y` varchar(5) collate latin1_bin NOT NULL default ' ',
- `z` varchar(20) collate latin1_bin NOT NULL default ' ',
- `a1` varchar(30) collate latin1_bin NOT NULL default ' ',
+ `y` varchar(5) COLLATE latin1_bin NOT NULL DEFAULT ' ',
+ `z` varchar(20) COLLATE latin1_bin NOT NULL DEFAULT ' ',
+ `a1` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
`b1` tinyblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin
INSERT into t2 (b) values ('1');
diff --git a/mysql-test/r/delayed.result b/mysql-test/r/delayed.result
index 6295fceec2b..a514ffcddd2 100644
--- a/mysql-test/r/delayed.result
+++ b/mysql-test/r/delayed.result
@@ -144,7 +144,7 @@ INSERT INTO t1 VALUES( 49, 71), (NULL, 72), (NULL, 73);
INSERT INTO t1 VALUES(NULL, 81), (NULL, 82), (NULL, 83);
SET insert_id= 114;
INSERT INTO t1 VALUES(NULL, 91);
-ERROR 23000: Duplicate entry '114' for key 1
+ERROR 23000: Duplicate entry '114' for key 'PRIMARY'
INSERT INTO t1 VALUES (NULL, 92), (NULL, 93);
SELECT * FROM t1;
c1 c2
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index 86ab2141e2d..72c040cb25f 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -175,7 +175,7 @@ explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 4 Using temporary
1 SIMPLE t3 ref a a 5 test.t1.b 2 Using where; Using index
-1 SIMPLE t2 index a a 4 NULL 4 Using where; Using index; Distinct
+1 SIMPLE t2 index a a 4 NULL 5 Using where; Using index; Distinct
SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
a
1
@@ -212,7 +212,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index
explain SELECT distinct a from t3 order by a desc limit 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 index NULL a 5 NULL 10 Using index
+1 SIMPLE t3 index NULL a 5 NULL 204 Using index
explain SELECT distinct a,b from t3 order by a+1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 204 Using temporary; Using filesort
diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result
index ff11905aa34..24f1b654733 100644
--- a/mysql-test/r/drop.result
+++ b/mysql-test/r/drop.result
@@ -47,6 +47,7 @@ create database mysqltest;
show databases;
Database
information_schema
+cluster
mysql
mysqltest
test
@@ -58,6 +59,7 @@ drop database mysqltest;
show databases;
Database
information_schema
+cluster
mysql
test
drop database mysqltest;
diff --git a/mysql-test/r/events.result b/mysql-test/r/events.result
new file mode 100644
index 00000000000..abf6879fc3c
--- /dev/null
+++ b/mysql-test/r/events.result
@@ -0,0 +1,397 @@
+create database if not exists events_test;
+use events_test;
+CREATE USER pauline@localhost;
+CREATE DATABASE db_x;
+GRANT EVENT ON db_x.* TO pauline@localhost;
+USE db_x;
+CREATE TABLE x_table(a int);
+CREATE EVENT e_x1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE db_x;
+CREATE EVENT e_x2 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE x_table;
+SHOW DATABASES LIKE 'db_x';
+Database (db_x)
+db_x
+SET GLOBAL event_scheduler=1;
+SHOW DATABASES LIKE 'db_x';
+Database (db_x)
+db_x
+SHOW TABLES FROM db_x;
+Tables_in_db_x
+x_table
+SET GLOBAL event_scheduler=off;
+DROP EVENT e_x1;
+DROP EVENT e_x2;
+DROP DATABASE db_x;
+DROP USER pauline@localhost;
+USE events_test;
+SET GLOBAL event_scheduler=off;
+drop event if exists event1;
+Warnings:
+Note 1305 Event event1 does not exist
+create event event1 on schedule every 15 minute starts now() ends date_add(now(), interval 5 hour) DO begin end;
+alter event event1 rename to event2 enable;
+alter event event2 disable;
+alter event event2 enable;
+alter event event2 on completion not preserve;
+alter event event2 on schedule every 1 year on completion preserve rename to event3 comment "new comment" do begin select 1; end__
+alter event event3 rename to event2;
+drop event event2;
+create event event2 on schedule every 2 second starts now() ends date_add(now(), interval 5 hour) comment "some" DO begin end;
+drop event event2;
+CREATE EVENT event_starts_test ON SCHEDULE EVERY 10 SECOND COMMENT "" DO SELECT 1;
+SELECT interval_field, interval_value, body FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
+interval_field interval_value body
+SECOND 10 SELECT 1
+SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
+execute_at IS NULL starts IS NULL ends IS NULL comment
+1 0 1
+ALTER EVENT event_starts_test ON SCHEDULE AT '2020-02-02 20:00:02';
+SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
+execute_at IS NULL starts IS NULL ends IS NULL comment
+0 1 1
+ALTER EVENT event_starts_test COMMENT "non-empty comment";
+SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
+execute_at IS NULL starts IS NULL ends IS NULL comment
+0 1 1 non-empty comment
+ALTER EVENT event_starts_test COMMENT "";
+SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
+execute_at IS NULL starts IS NULL ends IS NULL comment
+0 1 1
+DROP EVENT event_starts_test;
+CREATE EVENT event_starts_test ON SCHEDULE EVERY 20 SECOND STARTS '2020-02-02 20:00:02' ENDS '2022-02-02 20:00:02' DO SELECT 2;
+SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
+execute_at IS NULL starts IS NULL ends IS NULL comment
+1 0 0
+ALTER EVENT event_starts_test COMMENT "non-empty comment";
+SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
+execute_at IS NULL starts IS NULL ends IS NULL comment
+1 0 0 non-empty comment
+ALTER EVENT event_starts_test COMMENT "";
+SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
+execute_at IS NULL starts IS NULL ends IS NULL comment
+1 0 0
+DROP EVENT event_starts_test;
+create table test_nested(a int);
+create event e_43 on schedule every 1 second do set @a = 5;
+alter event e_43 do alter event e_43 do set @a = 4;
+ERROR HY000: Recursivity of EVENT DDL statements is forbidden when body is present
+alter event e_43 do
+begin
+alter event e_43 on schedule every 5 minute;
+insert into test_nested values(1);
+end|
+set global event_scheduler = on;
+select db, name, body, status, interval_field, interval_value from mysql.event;
+db name body status interval_field interval_value
+events_test e_43 begin
+alter event e_43 on schedule every 5 minute;
+insert into test_nested values(1);
+end ENABLED MINUTE 5
+drop event e_43;
+drop table test_nested;
+"Let's check whether we can use non-qualified names"
+create table non_qualif(a int);
+create event non_qualif_ev on schedule every 10 minute do insert into non_qualif values (800219);
+select * from non_qualif;
+a
+800219
+drop event non_qualif_ev;
+drop table non_qualif;
+alter event non_existant rename to non_existant_too;
+ERROR HY000: Unknown event 'non_existant'
+set global event_scheduler = off;
+create event existant on schedule at now() + interval 1 year do select 12;
+alter event non_existant rename to existant;
+ERROR HY000: Event 'existant' already exists
+alter event existant rename to events_test.existant;
+ERROR HY000: Same old and new event name
+drop event existant;
+create table t_event3 (a int, b float);
+drop event if exists event3;
+Warnings:
+Note 1305 Event event3 does not exist
+create event event3 on schedule every 50 + 10 minute starts date_add("20100101", interval 5 minute) ends date_add("20151010", interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
+select count(*) from t_event3;
+count(*)
+0
+drop event event3;
+drop table t_event3;
+set names utf8;
+CREATE EVENT root6 ON SCHEDULE EVERY '10:20' MINUTE_SECOND ON COMPLETION PRESERVE ENABLE COMMENT 'some comment' DO select 1;
+SHOW CREATE EVENT root6;
+Event sql_mode Create Event
+root6 CREATE EVENT `root6` ON SCHEDULE EVERY '10:20' MINUTE_SECOND ON COMPLETION PRESERVE ENABLE COMMENT 'some comment' DO select 1
+create event root7 on schedule every 2 year do select 1;
+SHOW CREATE EVENT root7;
+Event sql_mode Create Event
+root7 CREATE EVENT `root7` ON SCHEDULE EVERY 2 YEAR ON COMPLETION NOT PRESERVE ENABLE DO select 1
+create event root8 on schedule every '2:5' year_month do select 1;
+SHOW CREATE EVENT root8;
+Event sql_mode Create Event
+root8 CREATE EVENT `root8` ON SCHEDULE EVERY '2-5' YEAR_MONTH ON COMPLETION NOT PRESERVE ENABLE DO select 1
+create event root8_1 on schedule every '2:15' year_month do select 1;
+SHOW CREATE EVENT root8_1;
+Event sql_mode Create Event
+root8_1 CREATE EVENT `root8_1` ON SCHEDULE EVERY '3-3' YEAR_MONTH ON COMPLETION NOT PRESERVE ENABLE DO select 1
+create event root9 on schedule every 2 week ON COMPLETION PRESERVE DISABLE COMMENT 'коментар на кирилица' do select 1;
+SHOW CREATE EVENT root9;
+Event sql_mode Create Event
+root9 CREATE EVENT `root9` ON SCHEDULE EVERY 2 WEEK ON COMPLETION PRESERVE DISABLE COMMENT 'коментар на кирилица' DO select 1
+create event root10 on schedule every '20:5' day_hour do select 1;
+SHOW CREATE EVENT root10;
+Event sql_mode Create Event
+root10 CREATE EVENT `root10` ON SCHEDULE EVERY '20 5' DAY_HOUR ON COMPLETION NOT PRESERVE ENABLE DO select 1
+create event root11 on schedule every '20:25' day_hour do select 1;
+SHOW CREATE EVENT root11;
+Event sql_mode Create Event
+root11 CREATE EVENT `root11` ON SCHEDULE EVERY '21 1' DAY_HOUR ON COMPLETION NOT PRESERVE ENABLE DO select 1
+create event root12 on schedule every '20:25' hour_minute do select 1;
+SHOW CREATE EVENT root12;
+Event sql_mode Create Event
+root12 CREATE EVENT `root12` ON SCHEDULE EVERY '20:25' HOUR_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1
+create event root13 on schedule every '25:25' hour_minute do select 1;
+SHOW CREATE EVENT root13;
+Event sql_mode Create Event
+root13 CREATE EVENT `root13` ON SCHEDULE EVERY '25:25' HOUR_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1
+create event root13_1 on schedule every '11:65' hour_minute do select 1;
+SHOW CREATE EVENT root13_1;
+Event sql_mode Create Event
+root13_1 CREATE EVENT `root13_1` ON SCHEDULE EVERY '12:5' HOUR_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1
+create event root14 on schedule every '35:35' minute_second do select 1;
+SHOW CREATE EVENT root14;
+Event sql_mode Create Event
+root14 CREATE EVENT `root14` ON SCHEDULE EVERY '35:35' MINUTE_SECOND ON COMPLETION NOT PRESERVE ENABLE DO select 1
+create event root15 on schedule every '35:66' minute_second do select 1;
+SHOW CREATE EVENT root15;
+Event sql_mode Create Event
+root15 CREATE EVENT `root15` ON SCHEDULE EVERY '36:6' MINUTE_SECOND ON COMPLETION NOT PRESERVE ENABLE DO select 1
+create event root16 on schedule every '35:56' day_minute do select 1;
+SHOW CREATE EVENT root16;
+Event sql_mode Create Event
+root16 CREATE EVENT `root16` ON SCHEDULE EVERY '1 11:56' DAY_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1
+create event root17 on schedule every '35:12:45' day_minute do select 1;
+SHOW CREATE EVENT root17;
+Event sql_mode Create Event
+root17 CREATE EVENT `root17` ON SCHEDULE EVERY '35 12:45' DAY_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1
+create event root17_1 on schedule every '35:25:65' day_minute do select 1;
+SHOW CREATE EVENT root17_1;
+Event sql_mode Create Event
+root17_1 CREATE EVENT `root17_1` ON SCHEDULE EVERY '36 2:5' DAY_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1
+create event root18 on schedule every '35:12:45' hour_second do select 1;
+SHOW CREATE EVENT root18;
+Event sql_mode Create Event
+root18 CREATE EVENT `root18` ON SCHEDULE EVERY '35:12:45' HOUR_SECOND ON COMPLETION NOT PRESERVE ENABLE DO select 1
+create event root19 on schedule every '15:59:85' hour_second do select 1;
+SHOW CREATE EVENT root19;
+Event sql_mode Create Event
+root19 CREATE EVENT `root19` ON SCHEDULE EVERY '16:0:25' HOUR_SECOND ON COMPLETION NOT PRESERVE ENABLE DO select 1
+create event root20 on schedule every '50:20:12:45' day_second do select 1;
+SHOW CREATE EVENT root20;
+Event sql_mode Create Event
+root20 CREATE EVENT `root20` ON SCHEDULE EVERY '50 20:12:45' DAY_SECOND ON COMPLETION NOT PRESERVE ENABLE DO select 1
+set names cp1251;
+create event 21 on schedule every '50:23:59:95' day_second COMMENT ' 1251 ' do select 1;
+SHOW CREATE EVENT 21;
+Event sql_mode Create Event
+21 CREATE EVENT `21` ON SCHEDULE EVERY '51 0:0:35' DAY_SECOND ON COMPLETION NOT PRESERVE ENABLE COMMENT ' 1251 ' DO select 1
+insert into mysql.event (db, name, body, definer, interval_value, interval_field) values (database(), "root22", "select 1", user(), 100, "SECOND_MICROSECOND");
+show create event root22;
+ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
+SHOW EVENTS;
+ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
+drop event root22;
+create event root23 on schedule every -100 year do select 1;
+ERROR HY000: INTERVAL is either not positive or too big
+create event root23 on schedule every 222222222222222222222 year do select 1;
+ERROR HY000: INTERVAL is either not positive or too big
+drop event root6;
+drop event root7;
+drop event root8;
+drop event root8_1;
+drop event root9;
+drop event root10;
+drop event root11;
+drop event root12;
+drop event root13;
+drop event root13_1;
+drop event root14;
+drop event root15;
+drop event root16;
+drop event root17;
+drop event root17_1;
+drop event root18;
+drop event root19;
+drop event root20;
+drop event 21;
+set names latin1;
+CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing";
+SHOW EVENTS;
+Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED
+ALTER TABLE mysql.event ADD dummy INT FIRST;
+SHOW EVENTS;
+ERROR HY000: Column count of mysql.event is wrong. Expected 16, found 17. Table probably corrupted
+ALTER TABLE mysql.event DROP dummy, ADD dummy2 VARCHAR(64) FIRST;
+SHOW EVENTS;
+ERROR HY000: Column count of mysql.event is wrong. Expected 16, found 17. Table probably corrupted
+ALTER TABLE mysql.event DROP dummy2;
+SHOW EVENTS;
+Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED
+CREATE TABLE event_like LIKE mysql.event;
+INSERT INTO event_like SELECT * FROM mysql.event;
+ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default '';
+SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
+ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log.
+ALTER TABLE mysql.event MODIFY db char(20) character set utf8 collate utf8_bin default '';
+SHOW CREATE TABLE mysql.event;
+Table Create Table
+event CREATE TABLE `event` (
+ `db` char(20) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+ `name` char(64) NOT NULL DEFAULT '',
+ `body` longblob NOT NULL,
+ `definer` char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+ `execute_at` datetime DEFAULT NULL,
+ `interval_value` int(11) DEFAULT NULL,
+ `interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') DEFAULT NULL,
+ `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `last_executed` datetime DEFAULT NULL,
+ `starts` datetime DEFAULT NULL,
+ `ends` datetime DEFAULT NULL,
+ `status` enum('ENABLED','DISABLED') NOT NULL DEFAULT 'ENABLED',
+ `on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP',
+ `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE') NOT NULL DEFAULT '',
+ `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+ PRIMARY KEY (`db`,`name`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events'
+SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
+ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log.
+ALTER TABLE mysql.event MODIFY db char(64) character set utf8 collate utf8_bin default '';
+"This should work"
+SHOW EVENTS;
+Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED
+ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default '';
+SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
+ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log.
+ALTER TABLE mysql.event MODIFY db varchar(64) character set utf8 collate utf8_bin default '';
+SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
+ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log.
+ALTER TABLE mysql.event DROP comment, DROP starts;
+SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
+ERROR HY000: Column count of mysql.event is wrong. Expected 16, found 14. Table probably corrupted
+DROP TABLE mysql.event;
+CREATE TABLE mysql.event like event_like;
+INSERT INTO mysql.event SELECT * FROM event_like;
+DROP TABLE event_like;
+SHOW EVENTS;
+Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED
+DROP EVENT intact_check;
+create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5;
+select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
+db name body definer convert_tz(execute_at, 'UTC', 'SYSTEM') on_completion
+events_test e_26 set @a = 5 root@localhost 2017-01-01 00:00:00 DROP
+drop event e_26;
+create event e_26 on schedule at NULL disable do set @a = 5;
+ERROR HY000: Incorrect AT value: 'NULL'
+create event e_26 on schedule at 'definitely not a datetime' disable do set @a = 5;
+ERROR HY000: Incorrect AT value: 'definitely not a datetime'
+set names utf8;
+create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1;
+drop event задачка;
+set event_scheduler=off;
+ERROR HY000: Variable 'event_scheduler' is a GLOBAL variable and should be set with SET GLOBAL
+set global event_scheduler=3;
+ERROR 42000: Variable 'event_scheduler' can't be set to the value of '3'
+set global event_scheduler=disabled;
+ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'disabled'
+"DISABLE the scheduler. Testing that it does not work when the variable is 0"
+set global event_scheduler=off;
+select definer, name, db from mysql.event;
+definer name db
+select get_lock("test_lock1", 20);
+get_lock("test_lock1", 20)
+1
+create event закачка on schedule every 10 hour do select get_lock("test_lock1", 20);
+"Should return 1 row"
+select definer, name, db from mysql.event;
+definer name db
+root@localhost закачка events_test
+"Should be only 1 process"
+select /*1*/ user, host, db, command, state, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
+user host db command state info
+select release_lock("test_lock1");
+release_lock("test_lock1")
+1
+drop event закачка;
+"Should have 0 events"
+select count(*) from mysql.event;
+count(*)
+0
+"ENABLE the scheduler and get a lock"
+set global event_scheduler=on;
+select get_lock("test_lock2", 20);
+get_lock("test_lock2", 20)
+1
+"Create an event which tries to acquire a mutex. The event locks on the mutex"
+create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
+"Let some time pass to the event starts"
+"Should have only 2 processes: the scheduler and the locked event"
+select /*2*/ user, host, db, command, state, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
+user host db command state info
+event_scheduler localhost NULL Daemon Waiting for next activation NULL
+root localhost events_test Connect User lock select get_lock("test_lock2", 20)
+"Release the mutex, the event worker should finish."
+"Release the mutex, the event worker should finish."
+select release_lock("test_lock2");
+release_lock("test_lock2")
+1
+drop event закачка;
+set global event_scheduler=1;
+select get_lock("test_lock2_1", 20);
+get_lock("test_lock2_1", 20)
+1
+create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
+"Should have only 3 processes: the scheduler, our conn and the locked event"
+select /*3*/ user, host, db, command, state, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
+user host db command state info
+event_scheduler localhost NULL Daemon Waiting for next activation NULL
+root localhost events_test Connect User lock select get_lock("test_lock2_1", 20)
+set global event_scheduler=off;
+"Should have only our process now:"
+select /*4*/ user, host, db, command, state, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
+user host db command state info
+root localhost events_test Connect User lock select get_lock("test_lock2_1", 20)
+drop event закачка21;
+create table t_16 (s1 int);
+create trigger t_16_bi before insert on t_16 for each row create event e_16 on schedule every 1 second do set @a=5;
+ERROR HY000: Recursivity of EVENT DDL statements is forbidden when body is present
+drop table t_16;
+create event white_space
+on schedule every 10 hour
+disable
+do
+select 1;
+select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
+event_schema event_name definer event_definition
+events_test white_space root@localhost select 1
+drop event white_space;
+create event white_space on schedule every 10 hour disable do
+select 2;
+select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
+event_schema event_name definer event_definition
+events_test white_space root@localhost select 2
+drop event white_space;
+create event white_space on schedule every 10 hour disable do select 3;
+select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
+event_schema event_name definer event_definition
+events_test white_space root@localhost select 3
+drop event white_space;
+create event e1 on schedule every 1 year do set @a = 5;
+create table t1 (s1 int);
+create trigger t1_ai after insert on t1 for each row show create event e1;
+ERROR 0A000: Not allowed to return a result set from a trigger
+drop table t1;
+drop event e1;
+drop database events_test;
diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result
new file mode 100644
index 00000000000..363033e487a
--- /dev/null
+++ b/mysql-test/r/events_bugs.result
@@ -0,0 +1,271 @@
+create database if not exists events_test;
+use events_test;
+CREATE EVENT lower_case ON SCHEDULE EVERY 1 MINUTE DO SELECT 1;
+CREATE EVENT Lower_case ON SCHEDULE EVERY 2 MINUTE DO SELECT 2;
+ERROR HY000: Event 'Lower_case' already exists
+DROP EVENT Lower_case;
+SET NAMES cp1251;
+CREATE EVENT __1251 ON SCHEDULE EVERY 1 YEAR DO SELECT 100;
+CREATE EVENT __1251 ON SCHEDULE EVERY 2 YEAR DO SELECT 200;
+ERROR HY000: Event 'ДоЛеН_регистър_1251' already exists
+DROP EVENT __1251;
+SET NAMES utf8;
+CREATE EVENT долен_регистър_утф8 ON SCHEDULE EVERY 3 YEAR DO SELECT 300;
+CREATE EVENT ДОЛЕН_регистър_утф8 ON SCHEDULE EVERY 4 YEAR DO SELECT 400;
+ERROR HY000: Event 'ДОЛЕН_регистър_утф8' already exists
+DROP EVENT ДОЛЕН_регистър_утф8;
+SET NAMES latin1;
+set @a=3;
+CREATE PROCEDURE p_16 () CREATE EVENT e_16 ON SCHEDULE EVERY @a SECOND DO SET @a=5;
+ERROR HY000: Recursivity of EVENT DDL statements is forbidden when body is present
+create event e_55 on schedule at 99990101000000 do drop table t;
+ERROR HY000: Incorrect AT value: '99990101000000'
+create event e_55 on schedule every 10 hour starts 99990101000000 do drop table t;
+ERROR HY000: Incorrect STARTS value: '99990101000000'
+create event e_55 on schedule every 10 minute ends 99990101000000 do drop table t;
+ERROR HY000: ENDS is either invalid or before STARTS
+create event e_55 on schedule at 10000101000000 do drop table t;
+ERROR HY000: Activation (AT) time is in the past
+create event e_55 on schedule at 20000101000000 do drop table t;
+ERROR HY000: Activation (AT) time is in the past
+create event e_55 on schedule at 20200101000000 starts 10000101000000 do drop table t;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'starts 10000101000000 do drop table t' at line 1
+create event e_55 on schedule at 20200101000000 ends 10000101000000 do drop table t;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ends 10000101000000 do drop table t' at line 1
+create event e_55 on schedule at 20200101000000 starts 10000101000000 ends 10000101000000 do drop table t;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'starts 10000101000000 ends 10000101000000 do drop table t' at line 1
+create event e_55 on schedule every 10 hour starts 10000101000000 do drop table t;
+ERROR HY000: Incorrect STARTS value: '10000101000000'
+set global event_scheduler=off;
+delete from mysql.event;
+set global event_scheduler= on;
+set @old_sql_mode:=@@sql_mode;
+set sql_mode=ansi;
+select get_lock('test_bug16407', 60);
+get_lock('test_bug16407', 60)
+1
+create event e_16407 on schedule every 60 second do
+begin
+select get_lock('test_bug16407', 60);
+drop table "hashed_num";
+end|
+"Now if everything is fine the event has compiled and is locked
+select /*1*/ user, host, db, info from information_schema.processlist where command!='Daemon' and (info is null or info not like '%processlist%') order by info;
+user host db info
+root localhost events_test select get_lock('test_bug16407', 60)
+select release_lock('test_bug16407');
+release_lock('test_bug16407')
+1
+set global event_scheduler= off;
+select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
+event_schema event_name sql_mode
+events_test e_16407 REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI
+"Let's check whether we change the sql_mode on ALTER EVENT"
+set sql_mode='traditional';
+alter event e_16407 do select 1;
+select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
+event_schema event_name sql_mode
+events_test e_16407 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+drop event e_16407;
+set sql_mode="ansi";
+select get_lock('ee_16407_2', 60);
+get_lock('ee_16407_2', 60)
+1
+set global event_scheduler= 1;
+"Another sql_mode test"
+set sql_mode="traditional";
+create table events_smode_test(ev_name char(10), a date) engine=myisam;
+"This should never insert something"
+create event ee_16407_2 on schedule every 60 second do
+begin
+select get_lock('ee_16407_2', 60) /*ee_16407_2*/;
+select release_lock('ee_16407_2');
+insert into events_test.events_smode_test values('ee_16407_2','1980-19-02');
+end|
+insert into events_smode_test values ('test','1980-19-02')|
+ERROR 22007: Incorrect date value: '1980-19-02' for column 'a' at row 1
+"This is ok"
+create event ee_16407_3 on schedule every 60 second do
+begin
+select get_lock('ee_16407_2', 60) /*ee_16407_3*/;
+select release_lock('ee_16407_2');
+insert into events_test.events_smode_test values ('ee_16407_3','1980-02-19');
+insert into events_test.events_smode_test values ('ee_16407_3','1980-02-29');
+end|
+set sql_mode=""|
+"This will insert rows but they will be truncated"
+create event ee_16407_4 on schedule every 60 second do
+begin
+select get_lock('ee_16407_2', 60) /*ee_16407_4*/;
+select release_lock('ee_16407_2');
+insert into events_test.events_smode_test values ('ee_16407_4','10-11-1956');
+end|
+select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
+event_schema event_name sql_mode
+events_test ee_16407_2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+events_test ee_16407_3 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+events_test ee_16407_4
+select /*2*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
+user host db info
+event_scheduler localhost NULL NULL
+root localhost events_test select get_lock('ee_16407_2', 60)
+root localhost events_test select get_lock('ee_16407_2', 60)
+root localhost events_test select get_lock('ee_16407_2', 60)
+select release_lock('ee_16407_2');
+release_lock('ee_16407_2')
+1
+select /*3*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
+user host db info
+event_scheduler localhost NULL NULL
+set global event_scheduler= off;
+select * from events_smode_test order by ev_name, a;
+ev_name a
+ee_16407_3 1980-02-19
+ee_16407_3 1980-02-29
+ee_16407_4 0000-00-00
+"OK, last check before we drop them"
+select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
+event_schema event_name sql_mode
+events_test ee_16407_2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+events_test ee_16407_3 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+events_test ee_16407_4
+drop event ee_16407_2;
+drop event ee_16407_3;
+drop event ee_16407_4;
+"And now one last test regarding sql_mode and call of SP from an event"
+delete from events_smode_test;
+set sql_mode='ansi';
+select get_lock('ee_16407_5', 60);
+get_lock('ee_16407_5', 60)
+1
+set global event_scheduler= on;
+set sql_mode='traditional';
+create procedure ee_16407_5_pendant() begin insert into events_test.events_smode_test values('ee_16407_5','2001-02-29'); end|
+create procedure ee_16407_6_pendant() begin insert into events_test.events_smode_test values('ee_16407_6','2004-02-29'); end|
+create event ee_16407_5 on schedule every 60 second do
+begin
+select get_lock('ee_16407_5', 60) /*ee_16407_5*/;
+select release_lock('ee_16407_5');
+call events_test.ee_16407_5_pendant();
+end|
+create event ee_16407_6 on schedule every 60 second do
+begin
+select get_lock('ee_16407_5', 60) /*ee_16407_6*/;
+select release_lock('ee_16407_5');
+call events_test.ee_16407_6_pendant();
+end|
+"Should have 2 locked processes"
+select /*4*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
+user host db info
+event_scheduler localhost NULL NULL
+root localhost events_test select get_lock('ee_16407_5', 60)
+root localhost events_test select get_lock('ee_16407_5', 60)
+select release_lock('ee_16407_5');
+release_lock('ee_16407_5')
+1
+"Should have 0 processes locked"
+select /*5*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
+user host db info
+event_scheduler localhost NULL NULL
+select * from events_smode_test order by ev_name, a;
+ev_name a
+ee_16407_6 2004-02-29
+"And here we check one more time before we drop the events"
+select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
+event_schema event_name sql_mode
+events_test ee_16407_5 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+events_test ee_16407_6 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+drop event ee_16407_5;
+drop event ee_16407_6;
+drop procedure ee_16407_5_pendant;
+drop procedure ee_16407_6_pendant;
+set global event_scheduler= off;
+drop table events_smode_test;
+set sql_mode=@old_sql_mode;
+set global event_scheduler=off;
+delete from mysql.user where User like 'mysqltest_%';
+delete from mysql.db where User like 'mysqltest_%';
+flush privileges;
+drop database if exists mysqltest_db1;
+create user mysqltest_user1@localhost;
+create database mysqltest_db1;
+grant event on events_test.* to mysqltest_user1@localhost;
+create event mysqltest_user1 on schedule every 10 second do select 42;
+alter event mysqltest_user1 rename to mysqltest_db1.mysqltest_user1;
+ERROR 42000: Access denied for user 'mysqltest_user1'@'localhost' to database 'mysqltest_db1'
+"Let's test now rename when there is no select DB"
+select database();
+database()
+NULL
+alter event events_test.mysqltest_user1 rename to mysqltest_user1;
+ERROR 3D000: No database selected
+select event_schema, event_name, definer, event_type, status from information_schema.events;
+event_schema event_name definer event_type status
+events_test mysqltest_user1 mysqltest_user1@localhost RECURRING ENABLED
+drop event events_test.mysqltest_user1;
+drop user mysqltest_user1@localhost;
+drop database mysqltest_db1;
+create event e_53 on schedule at (select s1 from ttx) do drop table t;
+ERROR 42000: This version of MySQL doesn't yet support 'Usage of subqueries or stored function calls as part of this statement'
+create event e_53 on schedule every (select s1 from ttx) second do drop table t;
+ERROR 42000: This version of MySQL doesn't yet support 'Usage of subqueries or stored function calls as part of this statement'
+create event e_53 on schedule every 5 second starts (select s1 from ttx) do drop table t;
+ERROR 42000: This version of MySQL doesn't yet support 'Usage of subqueries or stored function calls as part of this statement'
+create event e_53 on schedule every 5 second ends (select s1 from ttx) do drop table t;
+ERROR 42000: This version of MySQL doesn't yet support 'Usage of subqueries or stored function calls as part of this statement'
+drop event if exists e_16;
+drop procedure if exists p_16;
+create event e_16 on schedule every 1 second do set @a=5;
+create procedure p_16 () alter event e_16 on schedule every @a second;
+set @a = null;
+call p_16();
+ERROR HY000: Incorrect INTERVAL value: 'NULL'
+call p_16();
+ERROR HY000: Incorrect INTERVAL value: 'NULL'
+set @a= 6;
+call p_16();
+drop procedure p_16;
+drop event e_16;
+drop function if exists f22830;
+drop event if exists e22830;
+drop event if exists e22830_1;
+drop event if exists e22830_2;
+drop event if exists e22830_3;
+drop event if exists e22830_4;
+drop table if exists t1;
+drop table if exists t2;
+create table t1 (a int);
+insert into t1 values (2);
+create table t2 (a char(20));
+insert into t2 values ("e22830_1");
+create function f22830 () returns int return 5;
+create event e22830 on schedule every f22830() second do select 123;
+ERROR 42000: This version of MySQL doesn't yet support 'Usage of subqueries or stored function calls as part of this statement'
+create event e22830_1 on schedule every 1 hour do alter event e22830_1 on schedule every (select 8 from dual) hour;
+create event e22830_2 on schedule every 1 hour do alter event e22830_2 on schedule every (select 8 from t1) hour;
+create event e22830_3 on schedule every 1 hour do alter event e22830_3 on schedule every f22830() hour;
+create event e22830_4 on schedule every 1 hour do alter event e22830_4 on schedule every (select f22830() from dual) hour;
+select event_name, event_definition, interval_value, interval_field from information_schema.events order by event_name;
+event_name event_definition interval_value interval_field
+e22830_1 alter event e22830_1 on schedule every (select 8 from dual) hour 1 HOUR
+e22830_2 alter event e22830_2 on schedule every (select 8 from t1) hour 1 HOUR
+e22830_3 alter event e22830_3 on schedule every f22830() hour 1 HOUR
+e22830_4 alter event e22830_4 on schedule every (select f22830() from dual) hour 1 HOUR
+set global event_scheduler=on;
+set global event_scheduler=off;
+select event_name, event_definition, interval_value, interval_field from information_schema.events order by event_name;
+event_name event_definition interval_value interval_field
+e22830_1 alter event e22830_1 on schedule every (select 8 from dual) hour 8 HOUR
+e22830_2 alter event e22830_2 on schedule every (select 8 from t1) hour 1 HOUR
+e22830_3 alter event e22830_3 on schedule every f22830() hour 1 HOUR
+e22830_4 alter event e22830_4 on schedule every (select f22830() from dual) hour 1 HOUR
+drop function f22830;
+drop event (select a from t2);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(select a from t2)' at line 1
+drop event e22830_1;
+drop event e22830_2;
+drop event e22830_3;
+drop event e22830_4;
+drop table t1;
+drop table t2;
+drop database events_test;
diff --git a/mysql-test/r/events_grant.result b/mysql-test/r/events_grant.result
new file mode 100644
index 00000000000..a28c30a9345
--- /dev/null
+++ b/mysql-test/r/events_grant.result
@@ -0,0 +1,121 @@
+CREATE DATABASE IF NOT EXISTS events_test;
+use events_test;
+CREATE EVENT one_event ON SCHEDULE EVERY 10 SECOND DO SELECT 123;
+SHOW EVENTS;
+Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+events_test one_event root@localhost RECURRING NULL 10 SECOND # # ENABLED
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+NULL events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
+CREATE DATABASE events_test2;
+CREATE USER ev_test@localhost;
+GRANT ALL ON events_test.* to ev_test@localhost;
+GRANT ALL ON events_test2.* to ev_test@localhost;
+REVOKE EVENT ON events_test2.* FROM ev_test@localhost;
+select "NEW CONNECTION";
+NEW CONNECTION
+NEW CONNECTION
+SELECT USER(), DATABASE();
+USER() DATABASE()
+ev_test@localhost events_test2
+SHOW GRANTS;
+Grants for ev_test@localhost
+GRANT USAGE ON *.* TO 'ev_test'@'localhost'
+GRANT ALL PRIVILEGES ON `events_test`.* TO 'ev_test'@'localhost'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, TRIGGER ON `events_test2`.* TO 'ev_test'@'localhost'
+"Here comes an error:";
+SHOW EVENTS;
+ERROR 42000: Access denied for user 'ev_test'@'localhost' to database 'events_test2'
+USE events_test;
+"We should see one event";
+SHOW EVENTS;
+Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+events_test one_event root@localhost RECURRING NULL 10 SECOND # # ENABLED
+SELECT CONCAT("Let's create some new events from the name of ", USER());
+CONCAT("Let's create some new events from the name of ", USER())
+Let's create some new events from the name of ev_test@localhost
+CREATE EVENT one_event ON SCHEDULE EVERY 20 SECOND DO SELECT 123;
+ERROR HY000: Event 'one_event' already exists
+CREATE EVENT two_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION NOT PRESERVE COMMENT "two event" DO SELECT 123;
+CREATE EVENT three_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION PRESERVE COMMENT "three event" DO SELECT 123;
+"Now we should see 3 events:";
+SHOW EVENTS;
+Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+events_test one_event root@localhost RECURRING NULL 10 SECOND # # ENABLED
+events_test three_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
+events_test two_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
+"This should show us only 2 events:";
+SHOW EVENTS LIKE 't%event';
+Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+events_test three_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
+events_test two_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
+"This should show us no events:";
+SHOW EVENTS FROM test LIKE '%';
+Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+GRANT EVENT ON events_test2.* TO ev_test@localhost;
+USE events_test2;
+CREATE EVENT four_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
+USE events_test;
+"We should see 4 events : one_event, two_event, three_event & four_event"
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+NULL events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
+NULL events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
+NULL events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
+NULL events_test2 four_event ev_test@localhost SQL SELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE
+DROP DATABASE events_test2;
+"We should see 3 events : one_event, two_event, three_event"
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+NULL events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
+NULL events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
+NULL events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
+CREATE DATABASE events_test2;
+USE events_test2;
+CREATE EVENT five_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
+"Should see 4 events - one, two, three & five"
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+NULL events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
+NULL events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
+NULL events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
+NULL events_test2 five_event root@localhost SQL SELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE
+REVOKE EVENT ON events_test2.* FROM ev_test@localhost;
+USE test;
+"Should see 3 events - one, two & three"
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+NULL events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
+NULL events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
+NULL events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
+"Let's test ALTER EVENT which changes the definer"
+USE events_test;
+ALTER EVENT one_event ON SCHEDULE EVERY 10 SECOND;
+"The definer should be ev_test@localhost"
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+NULL events_test one_event ev_test@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
+USE events_test;
+ALTER EVENT one_event COMMENT "comment";
+"The definer should be root@localhost"
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+NULL events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE comment
+ALTER EVENT one_event DO SELECT 12;
+"The definer should be ev_test@localhost"
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+NULL events_test one_event ev_test@localhost SQL SELECT 12 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE comment
+"make the definer again root@localhost"
+ALTER EVENT one_event COMMENT "new comment";
+"test DROP by another user"
+DROP EVENT one_event;
+"One event should not be there"
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+NULL events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
+NULL events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
+NULL events_test2 five_event root@localhost SQL SELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE
+DROP USER ev_test@localhost;
+DROP DATABASE events_test2;
+DROP DATABASE events_test;
diff --git a/mysql-test/r/events_logs_tests.result b/mysql-test/r/events_logs_tests.result
new file mode 100644
index 00000000000..335ca848387
--- /dev/null
+++ b/mysql-test/r/events_logs_tests.result
@@ -0,0 +1,96 @@
+CREATE DATABASE IF NOT EXISTS events_test;
+USE events_test;
+"We use procedure here because its statements won't be logged into the general log"
+"If we had used normal select that are logged in different ways depending on whether"
+"the test suite is run in normal mode or with --ps-protocol"
+CREATE procedure select_general_log()
+BEGIN
+SELECT user_host, argument FROM mysql.general_log WHERE argument LIKE '%alabala%';
+END|
+"Check General Query Log"
+CALL select_general_log();
+user_host argument
+USER_HOST CREATE procedure select_general_log()
+BEGIN
+SELECT user_host, argument FROM mysql.general_log WHERE argument LIKE '%alabala%';
+END
+SET GLOBAL event_scheduler=on;
+TRUNCATE mysql.general_log;
+CREATE EVENT log_general ON SCHEDULE EVERY 1 MINUTE DO SELECT 'alabala', SLEEP(1) FROM DUAL;
+"Wait the scheduler to start"
+"Should see 2 rows - the 'SELECT' is in the middle. The other two are selects from general_log"
+CALL select_general_log();
+user_host argument
+USER_HOST CREATE EVENT log_general ON SCHEDULE EVERY 1 MINUTE DO SELECT 'alabala', SLEEP(1) FROM DUAL
+USER_HOST SELECT 'alabala', SLEEP(1) FROM DUAL
+DROP PROCEDURE select_general_log;
+DROP EVENT log_general;
+SET GLOBAL event_scheduler=off;
+"Check slow query log"
+"Save the values"
+SET @old_global_long_query_time:=(select get_value());
+SET @old_session_long_query_time:=@@long_query_time;
+SHOW VARIABLES LIKE 'log_slow_queries';
+Variable_name Value
+log_slow_queries ON
+DROP FUNCTION get_value;
+"Make it quite long"
+SET SESSION long_query_time=300;
+TRUNCATE mysql.slow_log;
+SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
+user_host query_time db sql_text
+"Set new values"
+SET GLOBAL long_query_time=4;
+SET SESSION long_query_time=1;
+"Check that logging is working"
+SELECT SLEEP(2);
+SLEEP(2)
+0
+SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
+user_host query_time db sql_text
+USER_HOST SLEEPVAL events_test SELECT SLEEP(2)
+SET SESSION long_query_time=300;
+"Make it quite long"
+TRUNCATE mysql.slow_log;
+CREATE TABLE slow_event_test (slo_val tinyint, val tinyint);
+SET SESSION long_query_time=1;
+"This won't go to the slow log"
+SELECT * FROM slow_event_test;
+slo_val val
+SET SESSION long_query_time=1;
+SET GLOBAL event_scheduler=on;
+CREATE EVENT long_event ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(1.5);
+"Sleep some more time than the actual event run will take"
+SHOW VARIABLES LIKE 'event_scheduler';
+Variable_name Value
+event_scheduler ON
+"Check our table. Should see 1 row"
+SELECT * FROM slow_event_test;
+slo_val val
+4 0
+"Check slow log. Should not see anything because 1.5 is under the threshold of 300 for GLOBAL, though over SESSION which is 2"
+SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
+user_host query_time db sql_text
+"This should go to the slow log"
+DROP EVENT long_event;
+SET SESSION long_query_time=10;
+SET GLOBAL long_query_time=1;
+CREATE EVENT long_event2 ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(2);
+"Sleep some more time than the actual event run will take"
+"Check our table. Should see 2 rows"
+SELECT * FROM slow_event_test;
+slo_val val
+4 0
+1 0
+"Check slow log. Should see 1 row because 4 is over the threshold of 3 for GLOBAL, though under SESSION which is 10"
+SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
+user_host query_time db sql_text
+USER_HOST SLEEPVAL events_test INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(2)
+DROP EVENT long_event2;
+"Make it quite long"
+SET SESSION long_query_time=300;
+TRUNCATE mysql.slow_log;
+DROP TABLE slow_event_test;
+SET GLOBAL long_query_time =@old_global_long_query_time;
+SET SESSION long_query_time =@old_session_long_query_time;
+DROP DATABASE events_test;
diff --git a/mysql-test/r/events_microsec.result b/mysql-test/r/events_microsec.result
new file mode 100644
index 00000000000..b96bd551511
--- /dev/null
+++ b/mysql-test/r/events_microsec.result
@@ -0,0 +1,13 @@
+create database if not exists events_test;
+use events_test;
+CREATE EVENT micro_test ON SCHEDULE EVERY 100 MICROSECOND DO SELECT 1;
+ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
+CREATE EVENT micro_test ON SCHEDULE EVERY 100 DAY_MICROSECOND DO SELECT 1;
+ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
+CREATE EVENT micro_test ON SCHEDULE EVERY 100 HOUR_MICROSECOND DO SELECT 1;
+ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
+CREATE EVENT micro_test ON SCHEDULE EVERY 100 MINUTE_MICROSECOND DO SELECT 1;
+ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
+CREATE EVENT micro_test ON SCHEDULE EVERY 100 SECOND_MICROSECOND DO SELECT 1;
+ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
+drop database events_test;
diff --git a/mysql-test/r/events_restart_phase0.result b/mysql-test/r/events_restart_phase0.result
new file mode 100644
index 00000000000..218b804a302
--- /dev/null
+++ b/mysql-test/r/events_restart_phase0.result
@@ -0,0 +1,22 @@
+SHOW VARIABLES LIKE 'event%';
+Variable_name Value
+event_scheduler DISABLED
+SELECT @@global.event_scheduler;
+@@global.event_scheduler
+DISABLED
+SET GLOBAL event_scheduler=on;
+ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
+SET GLOBAL event_scheduler=off;
+ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
+SET GLOBAL event_scheduler=0;
+ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
+SET GLOBAL event_scheduler=1;
+ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
+SET GLOBAL event_scheduler=2;
+ERROR 42000: Variable 'event_scheduler' can't be set to the value of '2'
+SET GLOBAL event_scheduler=SUSPEND;
+ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'SUSPEND'
+SET GLOBAL event_scheduler=SUSPENDED;
+ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'SUSPENDED'
+SET GLOBAL event_scheduler=disabled;
+ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'disabled'
diff --git a/mysql-test/r/events_restart_phase1.result b/mysql-test/r/events_restart_phase1.result
new file mode 100644
index 00000000000..a7a46fa0ab1
--- /dev/null
+++ b/mysql-test/r/events_restart_phase1.result
@@ -0,0 +1,12 @@
+create database if not exists mysqltest_events_test;
+use mysqltest_events_test;
+set global event_scheduler=off;
+create table execution_log(name char(10));
+create event abc1 on schedule every 1 second do insert into execution_log value('abc1');
+create event abc2 on schedule every 1 second do insert into execution_log value('abc2');
+create event abc3 on schedule every 1 second do insert into execution_log value('abc3');
+select name from execution_log;
+name
+insert into mysql.event values ('db1','bad','select 42','root@localhost',NULL,1000,'MICROSECOND','2006-05-05 17:39:11','2006-05-05 17:39:20','2016-05-05 15:39:24','2016-05-05 15:39:11',NULL,'ENABLED','DROP','','comment1');
+insert into mysql.event values ('db1','bad2','sect','root@localhost',NULL,1000,'SECOND','2006-05-05 17:39:11','2006-05-05 17:39:20','2016-05-05 15:39:24','2016-05-05 15:39:11',NULL,'ENABLED','DROP','','comment2');
+"Now we restart the server"
diff --git a/mysql-test/r/events_restart_phase2.result b/mysql-test/r/events_restart_phase2.result
new file mode 100644
index 00000000000..703cb92324f
--- /dev/null
+++ b/mysql-test/r/events_restart_phase2.result
@@ -0,0 +1,6 @@
+use mysqltest_events_test;
+"Should get 0 rows because the queue aborted run
+select distinct name from execution_log order by name;
+name
+delete from mysql.event where name like 'bad%';
+"Now restart the server again"
diff --git a/mysql-test/r/events_restart_phase3.result b/mysql-test/r/events_restart_phase3.result
new file mode 100644
index 00000000000..e653d6a7c23
--- /dev/null
+++ b/mysql-test/r/events_restart_phase3.result
@@ -0,0 +1,12 @@
+use mysqltest_events_test;
+"Should get 3 rows : abc1, abc2, abc3
+select distinct name from execution_log order by name;
+name
+abc1
+abc2
+abc3
+drop event abc1;
+drop event abc2;
+drop event abc3;
+drop table execution_log;
+drop database mysqltest_events_test;
diff --git a/mysql-test/r/events_scheduling.result b/mysql-test/r/events_scheduling.result
new file mode 100644
index 00000000000..180c2e4883d
--- /dev/null
+++ b/mysql-test/r/events_scheduling.result
@@ -0,0 +1,85 @@
+CREATE DATABASE IF NOT EXISTS events_test;
+USE events_test;
+SET GLOBAL event_scheduler=OFF;
+SHOW VARIABLES LIKE 'event_scheduler';
+Variable_name Value
+event_scheduler OFF
+SET GLOBAL event_scheduler=1;
+SHOW VARIABLES LIKE 'event_scheduler';
+Variable_name Value
+event_scheduler ON
+SET GLOBAL event_scheduler=0;
+SHOW VARIABLES LIKE 'event_scheduler';
+Variable_name Value
+event_scheduler OFF
+SET GLOBAL event_scheduler=ON;
+SHOW VARIABLES LIKE 'event_scheduler';
+Variable_name Value
+event_scheduler ON
+SET GLOBAL event_scheduler=DISABLED;
+ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'DISABLED'
+SHOW VARIABLES LIKE 'event_scheduler';
+Variable_name Value
+event_scheduler ON
+SET GLOBAL event_scheduler=-1;
+ERROR 42000: Variable 'event_scheduler' can't be set to the value of '-1'
+SHOW VARIABLES LIKE 'event_scheduler';
+Variable_name Value
+event_scheduler ON
+SET GLOBAL event_scheduler=2;
+ERROR 42000: Variable 'event_scheduler' can't be set to the value of '2'
+SHOW VARIABLES LIKE 'event_scheduler';
+Variable_name Value
+event_scheduler ON
+SET GLOBAL event_scheduler=5;
+ERROR 42000: Variable 'event_scheduler' can't be set to the value of '5'
+SHOW VARIABLES LIKE 'event_scheduler';
+Variable_name Value
+event_scheduler ON
+CREATE TABLE table_1(a int);
+CREATE TABLE table_2(a int);
+CREATE TABLE table_3(a int);
+CREATE TABLE table_4(a int);
+CREATE TABLE T19170(s1 TIMESTAMP);
+SET GLOBAL event_scheduler=ON;
+CREATE EVENT two_sec ON SCHEDULE EVERY 2 SECOND DO INSERT INTO table_1 VALUES(1);
+CREATE EVENT start_n_end
+ON SCHEDULE EVERY 1 SECOND
+ENDS NOW() + INTERVAL 6 SECOND
+ON COMPLETION PRESERVE
+DO INSERT INTO table_2 VALUES(1);
+CREATE EVENT only_one_time ON SCHEDULE EVERY 2 SECOND ENDS NOW() + INTERVAL 1 SECOND DO INSERT INTO table_3 VALUES(1);
+CREATE EVENT two_time ON SCHEDULE EVERY 1 SECOND ENDS NOW() + INTERVAL 1 SECOND ON COMPLETION PRESERVE DO INSERT INTO table_4 VALUES(1);
+SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1;
+IF(SUM(a) >= 4, 'OK', 'ERROR')
+OK
+SELECT IF(SUM(a) >= 5, 'OK', 'ERROR') FROM table_2;
+IF(SUM(a) >= 5, 'OK', 'ERROR')
+OK
+SELECT IF(SUM(a) > 0, 'OK', 'ERROR') FROM table_3;
+IF(SUM(a) > 0, 'OK', 'ERROR')
+OK
+SELECT IF(SUM(a) > 0, 'OK', 'ERROR') FROM table_4;
+IF(SUM(a) > 0, 'OK', 'ERROR')
+OK
+DROP EVENT two_sec;
+SELECT IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL;
+IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR')
+OK
+SELECT IF(LAST_EXECUTED-ENDS < 3, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL;
+IF(LAST_EXECUTED-ENDS < 3, 'OK', 'ERROR')
+OK
+DROP EVENT start_n_end;
+"Already dropped because ended. Therefore an error."
+DROP EVENT only_one_time;
+ERROR HY000: Unknown event 'only_one_time'
+"Should be preserved"
+SELECT EVENT_NAME, STATUS FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_NAME;
+EVENT_NAME STATUS
+two_time DISABLED
+DROP EVENT two_time;
+DROP TABLE table_1;
+DROP TABLE table_2;
+DROP TABLE table_3;
+DROP TABLE table_4;
+DROP DATABASE events_test;
diff --git a/mysql-test/r/events_stress.result b/mysql-test/r/events_stress.result
new file mode 100644
index 00000000000..17eb32b36b7
--- /dev/null
+++ b/mysql-test/r/events_stress.result
@@ -0,0 +1,65 @@
+CREATE DATABASE IF NOT EXISTS events_test;
+CREATE DATABASE events_conn1_test2;
+CREATE TABLE events_test.fill_it1(test_name varchar(20), occur datetime);
+CREATE TABLE events_test.fill_it2(test_name varchar(20), occur datetime);
+CREATE TABLE events_test.fill_it3(test_name varchar(20), occur datetime);
+CREATE USER event_user2@localhost;
+CREATE DATABASE events_conn2_db;
+GRANT ALL ON *.* TO event_user2@localhost;
+CREATE USER event_user3@localhost;
+CREATE DATABASE events_conn3_db;
+GRANT ALL ON *.* TO event_user3@localhost;
+"In the second connection we create some events which won't be dropped till the end"
+"In the second connection we create some events which won't be dropped till the end"
+USE events_conn1_test2;
+CREATE EVENT ev_drop1 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1;
+CREATE EVENT ev_drop2 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1;
+CREATE EVENT ev_drop3 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1;
+USE events_test;
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS;
+COUNT(*)
+103
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
+COUNT(*)
+3
+DROP DATABASE events_conn1_test2;
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
+COUNT(*)
+0
+"Now testing stability - dropping db -> events while they are running"
+CREATE DATABASE events_conn1_test2;
+USE events_conn1_test2;
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
+COUNT(*)
+50
+SET GLOBAL event_scheduler=on;
+DROP DATABASE events_conn1_test2;
+SET GLOBAL event_scheduler=off;
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
+COUNT(*)
+0
+CREATE DATABASE events_conn1_test3;
+USE events_conn1_test3;
+SET GLOBAL event_scheduler=on;
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test3';
+COUNT(*)
+50
+CREATE DATABASE events_conn1_test4;
+USE events_conn1_test4;
+CREATE DATABASE events_conn1_test2;
+USE events_conn1_test2;
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
+COUNT(*)
+50
+DROP DATABASE events_conn2_db;
+DROP DATABASE events_conn3_db;
+DROP DATABASE events_conn1_test2;
+DROP DATABASE events_conn1_test3;
+SET GLOBAL event_scheduler=off;
+DROP DATABASE events_conn1_test4;
+SET GLOBAL event_scheduler=on;
+USE events_test;
+DROP TABLE fill_it1;
+DROP TABLE fill_it2;
+DROP TABLE fill_it3;
+DROP DATABASE events_test;
diff --git a/mysql-test/r/exampledb.result b/mysql-test/r/exampledb.result
index 9bfb77c1c0b..6eea24e2e1f 100644
--- a/mysql-test/r/exampledb.result
+++ b/mysql-test/r/exampledb.result
@@ -1,3 +1,5 @@
+drop database if exists events_test;
+drop database if exists events_test2;
drop table if exists t1;
CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result
index 3bd7b2ccc15..e0d9f5131b4 100644
--- a/mysql-test/r/explain.result
+++ b/mysql-test/r/explain.result
@@ -24,9 +24,9 @@ explain select * from t1 use key (str,str) where str="foo";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const str str 11 const 1
explain select * from t1 use key (str,str,foo) where str="foo";
-ERROR HY000: Key 'foo' doesn't exist in table 't1'
+ERROR 42000: Key 'foo' doesn't exist in table 't1'
explain select * from t1 ignore key (str,str,foo) where str="foo";
-ERROR HY000: Key 'foo' doesn't exist in table 't1'
+ERROR 42000: Key 'foo' doesn't exist in table 't1'
drop table t1;
explain select 1;
id select_type table type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result
index 2b44fc8bd7e..312b2b8a81a 100644
--- a/mysql-test/r/federated.result
+++ b/mysql-test/r/federated.result
@@ -78,11 +78,11 @@ SHOW CREATE TABLE federated.t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(20) NOT NULL,
- `name` varchar(32) NOT NULL default ''
+ `name` varchar(32) NOT NULL DEFAULT ''
) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'
INSERT INTO federated.t2 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t2 (id, name) VALUES (2, 'fee');
-SELECT * FROM federated.t2;
+SELECT * FROM federated.t2 ORDER BY id, name;
id name
1 foo
2 fee
@@ -107,7 +107,7 @@ ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1%';
INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');
-SELECT * FROM federated.t1;
+SELECT * FROM federated.t1 ORDER BY id,name;
id name
1 foo
2 fee
@@ -121,7 +121,7 @@ ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1%';
INSERT INTO federated.`t1%` (id, name) VALUES (1, 'foo');
INSERT INTO federated.`t1%` (id, name) VALUES (2, 'fee');
-SELECT * FROM federated.`t1%`;
+SELECT * FROM federated.`t1%` ORDER BY id, name;
id name
1 foo
2 fee
@@ -1607,6 +1607,72 @@ fld_cid fld_name fld_parentid fld_delt
5 Torkel 0 0
DROP TABLE federated.t1;
DROP TABLE federated.bug_17377_table;
+DROP TABLE IF EXISTS federated.test;
+CREATE TABLE federated.test (
+`id` int(11) NOT NULL,
+`val1` varchar(255) NOT NULL,
+`val2` varchar(255) NOT NULL,
+PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+DROP TABLE IF EXISTS federated.test_local;
+DROP TABLE IF EXISTS federated.test_remote;
+CREATE TABLE federated.test_local (
+`id` int(11) NOT NULL,
+`val1` varchar(255) NOT NULL,
+`val2` varchar(255) NOT NULL,
+PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO federated.test_local VALUES (1, 'foo', 'bar'),
+(2, 'bar', 'foo');
+CREATE TABLE federated.test_remote (
+`id` int(11) NOT NULL,
+`val1` varchar(255) NOT NULL,
+`val2` varchar(255) NOT NULL,
+PRIMARY KEY (`id`)
+) ENGINE=FEDERATED DEFAULT CHARSET=latin1
+CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/test';
+insert into federated.test_remote select * from federated.test_local;
+select * from federated.test_remote;
+id val1 val2
+1 foo bar
+2 bar foo
+delete from federated.test_remote where id in (1,2);
+insert into federated.test_remote select * from federated.test_local;
+select * from federated.test_remote;
+id val1 val2
+2 bar foo
+1 foo bar
+DROP TABLE federated.test_local;
+DROP TABLE federated.test_remote;
+DROP TABLE federated.test;
+drop table if exists federated.t1;
+create table federated.t1 (a int, b int, c int);
+drop table if exists federated.t1;
+drop table if exists federated.t2;
+create table federated.t1 (a int, b int, c int) engine=federated connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
+create trigger federated.t1_bi before insert on federated.t1 for each row set new.c= new.a * new.b;
+create table federated.t2 (a int, b int);
+insert into federated.t2 values (13, 17), (19, 23);
+insert into federated.t1 (a, b) values (1, 2), (3, 5), (7, 11);
+select * from federated.t1 order by a;
+a b c
+1 2 2
+3 5 15
+7 11 77
+delete from federated.t1;
+insert into federated.t1 (a, b) select * from federated.t2;
+select * from federated.t1 order by a;
+a b c
+13 17 221
+19 23 437
+delete from federated.t1;
+load data infile '../std_data_ln/loaddata5.dat' into table federated.t1 fields terminated by '' enclosed by '' ignore 1 lines (a, b);
+select * from federated.t1 order by a;
+a b c
+3 4 12
+5 6 30
+drop tables federated.t1, federated.t2;
+drop table federated.t1;
create table federated.t1 (i1 int, i2 int, i3 int);
create table federated.t2 (id int, c1 varchar(20), c2 varchar(20));
create table federated.t1 (i1 int, i2 int, i3 int) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
@@ -1693,72 +1759,6 @@ id c1 c2
9 abc ppc
drop table federated.t1, federated.t2;
drop table federated.t1, federated.t2;
-DROP TABLE IF EXISTS federated.test;
-CREATE TABLE federated.test (
-`id` int(11) NOT NULL,
-`val1` varchar(255) NOT NULL,
-`val2` varchar(255) NOT NULL,
-PRIMARY KEY (`id`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-DROP TABLE IF EXISTS federated.test_local;
-DROP TABLE IF EXISTS federated.test_remote;
-CREATE TABLE federated.test_local (
-`id` int(11) NOT NULL,
-`val1` varchar(255) NOT NULL,
-`val2` varchar(255) NOT NULL,
-PRIMARY KEY (`id`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-INSERT INTO federated.test_local VALUES (1, 'foo', 'bar'),
-(2, 'bar', 'foo');
-CREATE TABLE federated.test_remote (
-`id` int(11) NOT NULL,
-`val1` varchar(255) NOT NULL,
-`val2` varchar(255) NOT NULL,
-PRIMARY KEY (`id`)
-) ENGINE=FEDERATED DEFAULT CHARSET=latin1
-CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/test';
-insert into federated.test_remote select * from federated.test_local;
-select * from federated.test_remote;
-id val1 val2
-1 foo bar
-2 bar foo
-delete from federated.test_remote where id in (1,2);
-insert into federated.test_remote select * from federated.test_local;
-select * from federated.test_remote;
-id val1 val2
-2 bar foo
-1 foo bar
-DROP TABLE federated.test_local;
-DROP TABLE federated.test_remote;
-DROP TABLE federated.test;
-drop table if exists federated.t1;
-create table federated.t1 (a int, b int, c int);
-drop table if exists federated.t1;
-drop table if exists federated.t2;
-create table federated.t1 (a int, b int, c int) engine=federated connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
-create trigger federated.t1_bi before insert on federated.t1 for each row set new.c= new.a * new.b;
-create table federated.t2 (a int, b int);
-insert into federated.t2 values (13, 17), (19, 23);
-insert into federated.t1 (a, b) values (1, 2), (3, 5), (7, 11);
-select * from federated.t1;
-a b c
-1 2 2
-3 5 15
-7 11 77
-delete from federated.t1;
-insert into federated.t1 (a, b) select * from federated.t2;
-select * from federated.t1;
-a b c
-13 17 221
-19 23 437
-delete from federated.t1;
-load data infile '../std_data_ln/loaddata5.dat' into table federated.t1 fields terminated by '' enclosed by '' ignore 1 lines (a, b);
-select * from federated.t1;
-a b c
-3 4 12
-5 6 30
-drop tables federated.t1, federated.t2;
-drop table federated.t1;
create table t1 (id int not null auto_increment primary key, val int);
create table t1
(id int not null auto_increment primary key, val int) engine=federated
diff --git a/mysql-test/r/federated_transactions.result b/mysql-test/r/federated_transactions.result
new file mode 100644
index 00000000000..40644e3535e
--- /dev/null
+++ b/mysql-test/r/federated_transactions.result
@@ -0,0 +1,49 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+DROP DATABASE IF EXISTS federated;
+CREATE DATABASE federated;
+DROP DATABASE IF EXISTS federated;
+CREATE DATABASE federated;
+DROP TABLE IF EXISTS federated.t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE federated.t1 (
+`id` int(20) NOT NULL,
+`name` varchar(32) NOT NULL default ''
+ )
+DEFAULT CHARSET=latin1 ENGINE=innodb;
+DROP TABLE IF EXISTS federated.t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE federated.t1 (
+`id` int(20) NOT NULL,
+`name` varchar(32) NOT NULL default ''
+ )
+ENGINE="FEDERATED" DEFAULT CHARSET=latin1
+CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
+set autocommit=0;
+INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
+INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');
+COMMIT;
+INSERT INTO federated.t1 (id, name) VALUES (3, 'fie');
+INSERT INTO federated.t1 (id, name) VALUES (4, 'fum');
+ROLLBACK;
+set autocommit=1;
+INSERT INTO federated.t1 (id, name) VALUES (5, 'foe');
+INSERT INTO federated.t1 (id, name) VALUES (6, 'fig');
+SELECT * FROM federated.t1;
+id name
+1 foo
+2 fee
+5 foe
+6 fig
+DELETE FROM federated.t1;
+DROP TABLE IF EXISTS federated.t1;
+DROP DATABASE IF EXISTS federated;
+DROP TABLE IF EXISTS federated.t1;
+DROP DATABASE IF EXISTS federated;
diff --git a/mysql-test/r/flush_block_commit.result b/mysql-test/r/flush_block_commit.result
index 9e9085d2fc8..56f8acab896 100644
--- a/mysql-test/r/flush_block_commit.result
+++ b/mysql-test/r/flush_block_commit.result
@@ -44,11 +44,11 @@ insert t1 values (1);
flush tables with read lock;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 98
+master-bin.000001 102
commit;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 98
+master-bin.000001 102
unlock tables;
drop table t1;
set autocommit=1;
diff --git a/mysql-test/r/flush_table.result b/mysql-test/r/flush_table.result
index db54d2e53ef..8821bade6b4 100644
--- a/mysql-test/r/flush_table.result
+++ b/mysql-test/r/flush_table.result
@@ -6,6 +6,37 @@ flush table t1;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
+unlock tables;
+lock table t1 read;
+lock table t1 read;
+flush table t1;
+select * from t1;
+a
+1
+unlock tables;
+select * from t1;
+a
+1
+unlock tables;
+lock table t1 write;
+lock table t1 read;
+flush table t1;
+select * from t1;
+a
+1
+unlock tables;
+unlock tables;
+lock table t1 read;
+lock table t1 write;
+flush table t1;
+select * from t1;
+a
+1
+unlock tables;
+unlock tables;
+select * from t1;
+a
+1
drop table t1;
create table t1(table_id char(20) primary key);
create table t2(table_id char(20) primary key);
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index 85894d5cb0e..457155b4299 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -14,8 +14,8 @@ a b
Only MyISAM tables support collections
Full-text indexes are called collections
explain extended select * from t1 where MATCH(a,b) AGAINST ("collections");
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 fulltext a a 0 1 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 fulltext a a 0 1 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against (_latin1'collections'))
select * from t1 where MATCH(a,b) AGAINST ("indexes");
@@ -41,6 +41,15 @@ a b
Full-text indexes are called collections
Only MyISAM tables support collections
MySQL has now support for full-text search
+select * from t1 where MATCH(a,b) AGAINST ("indexes" IN NATURAL LANGUAGE MODE);
+a b
+Full-text indexes are called collections
+select * from t1 where MATCH(a,b) AGAINST ("indexes" IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
+a b
+Full-text indexes are called collections
+Only MyISAM tables support collections
+select * from t1 where MATCH(a,b) AGAINST ("indexes" IN BOOLEAN MODE WITH QUERY EXPANSION);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WITH QUERY EXPANSION)' at line 1
explain select * from t1 where MATCH(a,b) AGAINST ("collections");
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 fulltext a a 0 1 Using where
@@ -75,8 +84,8 @@ select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE
a b
MySQL has now support for full-text search
explain extended select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 fulltext a a 0 1 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 fulltext a a 0 1 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against (_latin1'support -collections' in boolean mode))
select * from t1 where MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE);
@@ -182,13 +191,13 @@ create table t1 (a varchar(200) not null, fulltext (a));
insert t1 values ("aaa10 bbb20"), ("aaa20 bbb15"), ("aaa30 bbb10");
select * from t1 where match a against ("+aaa* +bbb*" in boolean mode);
a
-aaa10 bbb20
-aaa20 bbb15
aaa30 bbb10
+aaa20 bbb15
+aaa10 bbb20
select * from t1 where match a against ("+aaa* +bbb1*" in boolean mode);
a
-aaa20 bbb15
aaa30 bbb10
+aaa20 bbb15
select * from t1 where match a against ("+aaa* +ccc*" in boolean mode);
a
select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode);
@@ -196,12 +205,12 @@ a
aaa10 bbb20
select * from t1 where match a against ("+(+aaa* +bbb1*)" in boolean mode);
a
-aaa20 bbb15
aaa30 bbb10
+aaa20 bbb15
select * from t1 where match a against ("(+aaa* +bbb1*)" in boolean mode);
a
-aaa20 bbb15
aaa30 bbb10
+aaa20 bbb15
drop table t1;
CREATE TABLE t1 (
id int(11),
@@ -239,7 +248,7 @@ t2 1 tix 1 inhalt NULL NULL NULL NULL YES FULLTEXT
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `ticket` int(11) default NULL,
+ `ticket` int(11) DEFAULT NULL,
`inhalt` text,
KEY `tig` (`ticket`),
FULLTEXT KEY `tix` (`inhalt`)
@@ -436,12 +445,16 @@ testword''
SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE);
a
testword''
+INSERT INTO t1 VALUES('test\'s');
+SELECT a FROM t1 WHERE MATCH a AGAINST('test' IN BOOLEAN MODE);
+a
+test's
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10000), FULLTEXT(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10000) default NULL,
+ `a` varchar(10000) DEFAULT NULL,
FULLTEXT KEY `a` (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
diff --git a/mysql-test/r/fulltext2.result b/mysql-test/r/fulltext2.result
index f6a4b20bc22..7e3e25370d3 100644
--- a/mysql-test/r/fulltext2.result
+++ b/mysql-test/r/fulltext2.result
@@ -241,3 +241,11 @@ select * from t1 where match a against('ab c' in boolean mode);
a
drop table t1;
set names latin1;
+SET NAMES utf8;
+CREATE TABLE t1(a VARCHAR(255), FULLTEXT(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES('„MySQL“');
+SELECT a FROM t1 WHERE MATCH a AGAINST('“MySQL„' IN BOOLEAN MODE);
+a
+„MySQL“
+DROP TABLE t1;
+SET NAMES latin1;
diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result
index 4a3454cf658..715f319198c 100644
--- a/mysql-test/r/func_compress.result
+++ b/mysql-test/r/func_compress.result
@@ -8,16 +8,16 @@ select uncompress(compress(@test_compress_string));
uncompress(compress(@test_compress_string))
string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
explain extended select uncompress(compress(@test_compress_string));
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select uncompress(compress((@test_compress_string))) AS `uncompress(compress(@test_compress_string))`
select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)
1
explain extended select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select (uncompressed_length(compress((@test_compress_string))) = length((@test_compress_string))) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)`
select uncompressed_length(compress(@test_compress_string));
diff --git a/mysql-test/r/func_crypt.result b/mysql-test/r/func_crypt.result
index afdec0f4d06..32377c9ba63 100644
--- a/mysql-test/r/func_crypt.result
+++ b/mysql-test/r/func_crypt.result
@@ -88,8 +88,8 @@ select old_password(' i d k f a ');
old_password(' i d k f a ')
5c078dc54ca0fcca
explain extended select password('idkfa '), old_password('idkfa');
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select password(_latin1'idkfa ') AS `password('idkfa ')`,old_password(_latin1'idkfa') AS `old_password('idkfa')`
select encrypt('1234','_.');
diff --git a/mysql-test/r/func_default.result b/mysql-test/r/func_default.result
index 5742ddd102b..7f1e53b00e0 100644
--- a/mysql-test/r/func_default.result
+++ b/mysql-test/r/func_default.result
@@ -5,8 +5,8 @@ select default(str), default(strnull), default(intg), default(rel) from t1;
default(str) default(strnull) default(intg) default(rel)
def NULL 10 3.14
explain extended select default(str), default(strnull), default(intg), default(rel) from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 1
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
Note 1003 select default(`test`.`t1`.`str`) AS `default(str)`,default(`test`.`t1`.`strnull`) AS `default(strnull)`,default(`test`.`t1`.`intg`) AS `default(intg)`,default(`test`.`t1`.`rel`) AS `default(rel)` from `test`.`t1`
select * from t1 where str <> default(str);
diff --git a/mysql-test/r/func_encrypt.result b/mysql-test/r/func_encrypt.result
index 3eb8ec4354c..dc2b5498b2a 100644
--- a/mysql-test/r/func_encrypt.result
+++ b/mysql-test/r/func_encrypt.result
@@ -179,7 +179,7 @@ NULL
Warnings:
Error 1108 Incorrect parameters to procedure 'des_decrypt'
explain extended select des_decrypt(des_encrypt("hello",4),'password2'), des_decrypt(des_encrypt("hello","hidden"));
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select des_decrypt(des_encrypt(_latin1'hello',4),_latin1'password2') AS `des_decrypt(des_encrypt("hello",4),'password2')`,des_decrypt(des_encrypt(_latin1'hello',_latin1'hidden')) AS `des_decrypt(des_encrypt("hello","hidden"))`
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index 5dbbd891427..619c8dafeae 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -15,8 +15,8 @@ grp group_concat(c)
2 b,c
3 E,C,D,d,d,D
explain extended select grp,group_concat(c) from t1 group by grp;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 9 100.00 Using filesort
Warnings:
Note 1003 select `test`.`t1`.`grp` AS `grp`,group_concat(`test`.`t1`.`c` separator ',') AS `group_concat(c)` from `test`.`t1` group by `test`.`t1`.`grp`
select grp,group_concat(a,c) from t1 group by grp;
@@ -85,8 +85,8 @@ grp group_concat(distinct c order by c desc)
2 c,b
3 E,D,C
explain extended select grp,group_concat(distinct c order by c desc) from t1 group by grp;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 9 100.00 Using filesort
Warnings:
Note 1003 select `test`.`t1`.`grp` AS `grp`,group_concat(distinct `test`.`t1`.`c` order by `test`.`t1`.`c` DESC separator ',') AS `group_concat(distinct c order by c desc)` from `test`.`t1` group by `test`.`t1`.`grp`
select grp,group_concat(c order by c separator ",") from t1 group by grp;
@@ -105,8 +105,8 @@ grp group_concat(distinct c order by c separator ",")
2 b,c
3 C,D,E
explain extended select grp,group_concat(distinct c order by c separator ",") from t1 group by grp;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 9 100.00 Using filesort
Warnings:
Note 1003 select `test`.`t1`.`grp` AS `grp`,group_concat(distinct `test`.`t1`.`c` order by `test`.`t1`.`c` ASC separator ',') AS `group_concat(distinct c order by c separator ",")` from `test`.`t1` group by `test`.`t1`.`grp`
select grp,group_concat(distinct c order by c desc separator ",") from t1 group by grp;
@@ -304,6 +304,12 @@ a grp
1 2
2 4,3
3 5
+select group_concat(c order by (select concat(5-t1.c,group_concat(c order by a)) from t2 where t2.a=t1.a)) as grp from t1;
+grp
+5,4,3,2
+select group_concat(c order by (select concat(t1.c,group_concat(c)) from t2 where a=t1.a)) as grp from t1;
+grp
+2,3,4,5
select a,c,(select group_concat(c order by a) from t2 where a=t1.a) as grp from t1 order by grp;
a c grp
3 5 3,3
@@ -453,7 +459,7 @@ create table t2 select group_concat(a) as a from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` varchar(400) character set cp1250 default NULL
+ `a` varchar(400) CHARACTER SET cp1250 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select collation(group_concat(a,_koi8r'test')) from t1;
collation(group_concat(a,_koi8r'test'))
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index c6117053a60..40ca0a38db2 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -287,8 +287,8 @@ a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b) bit_xor(b)
2 1 1 1.00000 0.00000 1 1 1 1 1
3 1 1 1.00000 0.00000 1 1 1 1 1
explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using filesort
Warnings:
Note 1003 select sql_big_result `test`.`t1`.`a` AS `a`,count(`test`.`t1`.`b`) AS `count(b)`,sum(`test`.`t1`.`b`) AS `sum(b)`,avg(`test`.`t1`.`b`) AS `avg(b)`,std(`test`.`t1`.`b`) AS `std(b)`,min(`test`.`t1`.`b`) AS `min(b)`,max(`test`.`t1`.`b`) AS `max(b)`,bit_and(`test`.`t1`.`b`) AS `bit_and(b)`,bit_or(`test`.`t1`.`b`) AS `bit_or(b)`,bit_xor(`test`.`t1`.`b`) AS `bit_xor(b)` from `test`.`t1` group by `test`.`t1`.`a`
drop table t1;
@@ -653,15 +653,6 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range k2 k2 4 NULL 6 Using where; Using index
1 SIMPLE t1 index NULL PRIMARY 3 NULL 15 Using index
drop table t1, t2;
-create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
-insert into t1 values (1, 3);
-select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ;
-count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ
-1
-select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ;
-Case When Count(*) < MAX_REQ Then 1 Else 0 End
-1
-drop table t1;
create table t1 (a char(10));
insert into t1 values ('a'),('b'),('c');
select coercibility(max(a)) from t1;
@@ -677,21 +668,21 @@ latin2 2 latin2 2
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(1) character set latin2 default NULL
+ `a` char(1) CHARACTER SET latin2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
create table t2 select max(a),min(a) from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `max(a)` char(1) character set latin2 default NULL,
- `min(a)` char(1) character set latin2 default NULL
+ `max(a)` char(1) CHARACTER SET latin2 DEFAULT NULL,
+ `min(a)` char(1) CHARACTER SET latin2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2;
create table t2 select concat(a) from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `concat(a)` varchar(1) character set latin2 default NULL
+ `concat(a)` varchar(1) CHARACTER SET latin2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2,t1;
create table t1 (a int);
@@ -780,7 +771,7 @@ create table t2 select MAX(b) from t1 group by a;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `MAX(b)` datetime default NULL
+ `MAX(b)` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1(f1 datetime);
@@ -1019,13 +1010,13 @@ create table t1 select variance(0);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `variance(0)` double(8,4) default NULL
+ `variance(0)` double(8,4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 select stddev(0);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `stddev(0)` double(8,4) default NULL
+ `stddev(0)` double(8,4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
diff --git a/mysql-test/r/func_group_innodb.result b/mysql-test/r/func_group_innodb.result
new file mode 100644
index 00000000000..230f2a7633f
--- /dev/null
+++ b/mysql-test/r/func_group_innodb.result
@@ -0,0 +1,147 @@
+create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
+insert into t1 values (1, 3);
+select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ;
+count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ
+1
+select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ;
+Case When Count(*) < MAX_REQ Then 1 Else 0 End
+1
+drop table t1;
+create table t1m (a int) engine=myisam;
+create table t1i (a int) engine=innodb;
+create table t2m (a int) engine=myisam;
+create table t2i (a int) engine=innodb;
+insert into t2m values (5);
+insert into t2i values (5);
+select min(a) from t1m;
+min(a)
+NULL
+select min(7) from t1m;
+min(7)
+NULL
+select min(7) from DUAL;
+min(7)
+7
+explain select min(7) from t2m join t1m;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select min(7) from t2m join t1m;
+min(7)
+NULL
+select max(a) from t1m;
+max(a)
+NULL
+select max(7) from t1m;
+max(7)
+NULL
+select max(7) from DUAL;
+max(7)
+7
+explain select max(7) from t2m join t1m;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select max(7) from t2m join t1m;
+max(7)
+NULL
+select 1, min(a) from t1m where a=99;
+1 min(a)
+1 NULL
+select 1, min(a) from t1m where 1=99;
+1 min(a)
+1 NULL
+select 1, min(1) from t1m where a=99;
+1 min(1)
+1 NULL
+select 1, min(1) from t1m where 1=99;
+1 min(1)
+1 NULL
+select 1, max(a) from t1m where a=99;
+1 max(a)
+1 NULL
+select 1, max(a) from t1m where 1=99;
+1 max(a)
+1 NULL
+select 1, max(1) from t1m where a=99;
+1 max(1)
+1 NULL
+select 1, max(1) from t1m where 1=99;
+1 max(1)
+1 NULL
+select min(a) from t1i;
+min(a)
+NULL
+select min(7) from t1i;
+min(7)
+NULL
+select min(7) from DUAL;
+min(7)
+7
+explain select min(7) from t2i join t1i;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2i ALL NULL NULL NULL NULL 1
+1 SIMPLE t1i ALL NULL NULL NULL NULL 1
+select min(7) from t2i join t1i;
+min(7)
+NULL
+select max(a) from t1i;
+max(a)
+NULL
+select max(7) from t1i;
+max(7)
+NULL
+select max(7) from DUAL;
+max(7)
+7
+explain select max(7) from t2i join t1i;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2i ALL NULL NULL NULL NULL 1
+1 SIMPLE t1i ALL NULL NULL NULL NULL 1
+select max(7) from t2i join t1i;
+max(7)
+NULL
+select 1, min(a) from t1i where a=99;
+1 min(a)
+1 NULL
+select 1, min(a) from t1i where 1=99;
+1 min(a)
+1 NULL
+select 1, min(1) from t1i where a=99;
+1 min(1)
+1 NULL
+select 1, min(1) from t1i where 1=99;
+1 min(1)
+1 NULL
+select 1, max(a) from t1i where a=99;
+1 max(a)
+1 NULL
+select 1, max(a) from t1i where 1=99;
+1 max(a)
+1 NULL
+select 1, max(1) from t1i where a=99;
+1 max(1)
+1 NULL
+select 1, max(1) from t1i where 1=99;
+1 max(1)
+1 NULL
+explain select count(*), min(7), max(7) from t1m, t1i;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1i ALL NULL NULL NULL NULL 1
+select count(*), min(7), max(7) from t1m, t1i;
+count(*) min(7) max(7)
+0 NULL NULL
+explain select count(*), min(7), max(7) from t1m, t2i;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t2i ALL NULL NULL NULL NULL 1
+select count(*), min(7), max(7) from t1m, t2i;
+count(*) min(7) max(7)
+0 NULL NULL
+explain select count(*), min(7), max(7) from t2m, t1i;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2m system NULL NULL NULL NULL 1
+1 SIMPLE t1i ALL NULL NULL NULL NULL 1
+select count(*), min(7), max(7) from t2m, t1i;
+count(*) min(7) max(7)
+0 NULL NULL
+drop table t1m, t1i, t2m, t2i;
diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result
index eef380c8f52..81675d46c82 100644
--- a/mysql-test/r/func_if.result
+++ b/mysql-test/r/func_if.result
@@ -40,8 +40,8 @@ a
aa
aaa
explain extended select if(u=1,st,binary st) s from t1 where st like "%a%" order by s;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using filesort
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 7 100.00 Using where; Using filesort
Warnings:
Note 1003 select if((`test`.`t1`.`u` = 1),`test`.`t1`.`st`,cast(`test`.`t1`.`st` as char charset binary)) AS `s` from `test`.`t1` where (`test`.`t1`.`st` like _latin1'%a%') order by if((`test`.`t1`.`u` = 1),`test`.`t1`.`st`,cast(`test`.`t1`.`st` as char charset binary))
select nullif(u, 1) from t1;
@@ -54,8 +54,8 @@ NULL
0
0
explain extended select nullif(u, 1) from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 7
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 7 100.00
Warnings:
Note 1003 select nullif(`test`.`t1`.`u`,1) AS `nullif(u, 1)` from `test`.`t1`
drop table t1;
diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result
index e38e2624e19..b88e5a66f96 100644
--- a/mysql-test/r/func_in.result
+++ b/mysql-test/r/func_in.result
@@ -143,8 +143,8 @@ select * from t1 where 'a' in (a,b,c collate latin1_bin);
a b c
a c c
explain extended select * from t1 where 'a' in (a,b,c collate latin1_bin);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (_latin1'a' in (`test`.`t1`.`a`,`test`.`t1`.`b`,(`test`.`t1`.`c` collate latin1_bin)))
drop table t1;
@@ -343,3 +343,71 @@ some_id
1
2
drop table t1;
+create table t1(f1 char(1));
+insert into t1 values ('a'),('b'),('1');
+select f1 from t1 where f1 in ('a',1);
+f1
+a
+1
+select f1, case f1 when 'a' then '+' when 1 then '-' end from t1;
+f1 case f1 when 'a' then '+' when 1 then '-' end
+a +
+b NULL
+1 -
+create index t1f1_idx on t1(f1);
+select f1 from t1 where f1 in ('a',1);
+f1
+1
+a
+explain select f1 from t1 where f1 in ('a',1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL t1f1_idx 2 NULL 3 Using where; Using index
+select f1 from t1 where f1 in ('a','b');
+f1
+a
+b
+explain select f1 from t1 where f1 in ('a','b');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index t1f1_idx t1f1_idx 2 NULL 3 Using where; Using index
+select f1 from t1 where f1 in (2,1);
+f1
+1
+explain select f1 from t1 where f1 in (2,1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index t1f1_idx t1f1_idx 2 NULL 3 Using where; Using index
+create table t2(f2 int, index t2f2(f2));
+insert into t2 values(0),(1),(2);
+select f2 from t2 where f2 in ('a',2);
+f2
+0
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+explain select f2 from t2 where f2 in ('a',2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL t2f2 5 NULL 3 Using where; Using index
+select f2 from t2 where f2 in ('a','b');
+f2
+0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+explain select f2 from t2 where f2 in ('a','b');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index t2f2 t2f2 5 NULL 3 Using where; Using index
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+select f2 from t2 where f2 in (1,'b');
+f2
+0
+1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+explain select f2 from t2 where f2 in (1,'b');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL t2f2 5 NULL 3 Using where; Using index
+drop table t1, t2;
diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result
index 7e6fedb9403..5de5962efeb 100644
--- a/mysql-test/r/func_like.result
+++ b/mysql-test/r/func_like.result
@@ -1,12 +1,16 @@
drop table if exists t1;
create table t1 (a varchar(10), key(a));
insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
-explain select * from t1 where a like 'abc%';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index a a 13 NULL 5 Using where; Using index
-explain select * from t1 where a like concat('abc','%');
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index a a 13 NULL 5 Using where; Using index
+explain extended select * from t1 where a like 'abc%';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 index a a 13 NULL 5 20.00 Using where; Using index
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` like _latin1'abc%')
+explain extended select * from t1 where a like concat('abc','%');
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 index a a 13 NULL 5 20.00 Using where; Using index
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` like concat(_latin1'abc',_latin1'%'))
select * from t1 where a like "abc%";
a
abc
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index fc9bfb3b612..9a2c55b802d 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -3,32 +3,32 @@ select floor(5.5),floor(-5.5);
floor(5.5) floor(-5.5)
5 -6
explain extended select floor(5.5),floor(-5.5);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select floor(5.5) AS `floor(5.5)`,floor(-(5.5)) AS `floor(-5.5)`
select ceiling(5.5),ceiling(-5.5);
ceiling(5.5) ceiling(-5.5)
6 -5
explain extended select ceiling(5.5),ceiling(-5.5);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select ceiling(5.5) AS `ceiling(5.5)`,ceiling(-(5.5)) AS `ceiling(-5.5)`
select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
truncate(52.64,1) truncate(52.64,2) truncate(52.64,-1) truncate(52.64,-2) truncate(-52.64,1) truncate(-52.64,-1)
52.6 52.64 50 0 -52.6 -50
explain extended select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select truncate(52.64,1) AS `truncate(52.64,1)`,truncate(52.64,2) AS `truncate(52.64,2)`,truncate(52.64,-(1)) AS `truncate(52.64,-1)`,truncate(52.64,-(2)) AS `truncate(52.64,-2)`,truncate(-(52.64),1) AS `truncate(-52.64,1)`,truncate(-(52.64),-(1)) AS `truncate(-52.64,-1)`
select round(5.5),round(-5.5);
round(5.5) round(-5.5)
6 -6
explain extended select round(5.5),round(-5.5);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select round(5.5,0) AS `round(5.5)`,round(-(5.5),0) AS `round(-5.5)`
select round(5.64,1),round(5.64,2),round(5.64,-1),round(5.64,-2);
@@ -38,48 +38,48 @@ select abs(-10), sign(-5), sign(5), sign(0);
abs(-10) sign(-5) sign(5) sign(0)
10 -1 1 0
explain extended select abs(-10), sign(-5), sign(5), sign(0);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select abs(-(10)) AS `abs(-10)`,sign(-(5)) AS `sign(-5)`,sign(5) AS `sign(5)`,sign(0) AS `sign(0)`
select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
log(exp(10)) exp(log(sqrt(10))*2) log(-1) log(NULL) log(1,1) log(3,9) log(-1,2) log(NULL,2)
10 10 NULL NULL NULL 2 NULL NULL
explain extended select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select log(exp(10)) AS `log(exp(10))`,exp((log(sqrt(10)) * 2)) AS `exp(log(sqrt(10))*2)`,log(-(1)) AS `log(-1)`,log(NULL) AS `log(NULL)`,log(1,1) AS `log(1,1)`,log(3,9) AS `log(3,9)`,log(-(1),2) AS `log(-1,2)`,log(NULL,2) AS `log(NULL,2)`
select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
ln(exp(10)) exp(ln(sqrt(10))*2) ln(-1) ln(0) ln(NULL)
10 10 NULL NULL NULL
explain extended select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select ln(exp(10)) AS `ln(exp(10))`,exp((ln(sqrt(10)) * 2)) AS `exp(ln(sqrt(10))*2)`,ln(-(1)) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)`
select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
log2(8) log2(15) log2(-2) log2(0) log2(NULL)
3 3.9068905956085 NULL NULL NULL
explain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select log2(8) AS `log2(8)`,log2(15) AS `log2(15)`,log2(-(2)) AS `log2(-2)`,log2(0) AS `log2(0)`,log2(NULL) AS `log2(NULL)`
select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
log10(100) log10(18) log10(-4) log10(0) log10(NULL)
2 1.2552725051033 NULL NULL NULL
explain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select log10(100) AS `log10(100)`,log10(18) AS `log10(18)`,log10(-(4)) AS `log10(-4)`,log10(0) AS `log10(0)`,log10(NULL) AS `log10(NULL)`
select pow(10,log10(10)),power(2,4);
pow(10,log10(10)) power(2,4)
10 16
explain extended select pow(10,log10(10)),power(2,4);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select pow(10,log10(10)) AS `pow(10,log10(10))`,pow(2,4) AS `power(2,4)`
set @@rand_seed1=10000000,@@rand_seed2=1000000;
@@ -87,21 +87,33 @@ select rand(999999),rand();
rand(999999) rand()
0.014231365187309 0.028870999839968
explain extended select rand(999999),rand();
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select rand(999999) AS `rand(999999)`,rand() AS `rand()`
select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6);
pi() format(sin(pi()/2),6) format(cos(pi()/2),6) format(abs(tan(pi())),6) format(cot(1),6) format(asin(1),6) format(acos(0),6) format(atan(1),6)
3.141593 1.000000 0.000000 0.000000 0.642093 1.570796 1.570796 0.785398
explain extended select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select pi() AS `pi()`,format(sin((pi() / 2)),6) AS `format(sin(pi()/2),6)`,format(cos((pi() / 2)),6) AS `format(cos(pi()/2),6)`,format(abs(tan(pi())),6) AS `format(abs(tan(pi())),6)`,format((1 / tan(1)),6) AS `format(cot(1),6)`,format(asin(1),6) AS `format(asin(1),6)`,format(acos(0),6) AS `format(acos(0),6)`,format(atan(1),6) AS `format(atan(1),6)`
select degrees(pi()),radians(360);
degrees(pi()) radians(360)
180 6.2831853071796
+select format(atan(-2, 2), 6);
+format(atan(-2, 2), 6)
+-0.785398
+select format(atan(pi(), 0), 6);
+format(atan(pi(), 0), 6)
+1.570796
+select format(atan2(-2, 2), 6);
+format(atan2(-2, 2), 6)
+-0.785398
+select format(atan2(pi(), 0), 6);
+format(atan2(pi(), 0), 6)
+1.570796
SELECT ACOS(1.0);
ACOS(1.0)
0
@@ -124,8 +136,8 @@ select format(4.55, 1), format(4.551, 1);
format(4.55, 1) format(4.551, 1)
4.6 4.6
explain extended select degrees(pi()),radians(360);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)`
select rand(rand);
@@ -156,7 +168,7 @@ create table t1 select round(1, 6);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `round(1, 6)` decimal(7,6) NOT NULL default '0.000000'
+ `round(1, 6)` decimal(7,6) NOT NULL DEFAULT '0.000000'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t1;
round(1, 6)
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index c1ac3e191d3..3ebf071a5bb 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -95,8 +95,8 @@ create table t1 as select uuid(), length(uuid());
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `uuid()` varchar(36) character set utf8 NOT NULL default '',
- `length(uuid())` int(10) NOT NULL default '0'
+ `uuid()` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `length(uuid())` int(10) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a timestamp default '2005-05-05 01:01:01',
diff --git a/mysql-test/r/func_op.result b/mysql-test/r/func_op.result
index 24685d07f3d..636163e6b29 100644
--- a/mysql-test/r/func_op.result
+++ b/mysql-test/r/func_op.result
@@ -2,16 +2,16 @@ select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
1+1 1-1 1+1*2 8/5 8%5 mod(8,5) mod(8,5)|0 -(1+1)*-2
2 0 3 1.6000 3 3 3 4
explain extended select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select (1 + 1) AS `1+1`,(1 - 1) AS `1-1`,(1 + (1 * 2)) AS `1+1*2`,(8 / 5) AS `8/5`,(8 % 5) AS `8%5`,(8 % 5) AS `mod(8,5)`,((8 % 5) | 0) AS `mod(8,5)|0`,(-((1 + 1)) * -(2)) AS `-(1+1)*-2`
select 1 | (1+1),5 & 3,bit_count(7) ;
1 | (1+1) 5 & 3 bit_count(7)
3 1 3
explain extended select 1 | (1+1),5 & 3,bit_count(7) ;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select (1 | (1 + 1)) AS `1 | (1+1)`,(5 & 3) AS `5 & 3`,bit_count(7) AS `bit_count(7)`
select 1 << 32,1 << 63, 1 << 64, 4 >> 2, 4 >> 63, 1<< 63 >> 60;
diff --git a/mysql-test/r/func_regexp.result b/mysql-test/r/func_regexp.result
index 787463c6aa3..803f606d3dd 100644
--- a/mysql-test/r/func_regexp.result
+++ b/mysql-test/r/func_regexp.result
@@ -37,8 +37,8 @@ select * from t1 where xxx regexp('is a test of some long text to');
xxx
this is a test of some long text to see what happens
explain extended select * from t1 where xxx regexp('is a test of some long text to');
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 1
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
Note 1003 select `test`.`t1`.`xxx` AS `xxx` from `test`.`t1` where (`test`.`t1`.`xxx` regexp _latin1'is a test of some long text to')
select * from t1 where xxx regexp('is a test of some long text to ');
diff --git a/mysql-test/r/func_sapdb.result b/mysql-test/r/func_sapdb.result
index 18908c2c46e..29ceb6ecaa4 100644
--- a/mysql-test/r/func_sapdb.result
+++ b/mysql-test/r/func_sapdb.result
@@ -68,7 +68,7 @@ select datediff("1997-11-31 23:59:59.000001","1997-12-31");
datediff("1997-11-31 23:59:59.000001","1997-12-31")
NULL
Warnings:
-Warning 1292 Truncated incorrect datetime value: '1997-11-31 23:59:59.000001'
+Warning 1292 Incorrect datetime value: '1997-11-31 23:59:59.000001'
select datediff("1997-11-30 23:59:59.000001",null);
datediff("1997-11-30 23:59:59.000001",null)
NULL
@@ -141,7 +141,7 @@ select timestamp("2001-13-01", "01:01:01.000001");
timestamp("2001-13-01", "01:01:01.000001")
NULL
Warnings:
-Warning 1292 Truncated incorrect datetime value: '2001-13-01'
+Warning 1292 Incorrect datetime value: '2001-13-01'
select timestamp("2001-12-01", "25:01:01");
timestamp("2001-12-01", "25:01:01")
2001-12-02 01:01:01
@@ -161,7 +161,7 @@ select date("1997-13-31 23:59:59.000001");
date("1997-13-31 23:59:59.000001")
NULL
Warnings:
-Warning 1292 Truncated incorrect datetime value: '1997-13-31 23:59:59.000001'
+Warning 1292 Incorrect datetime value: '1997-13-31 23:59:59.000001'
select time("1997-12-31 23:59:59.000001");
time("1997-12-31 23:59:59.000001")
23:59:59.000001
diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result
index aa71cee0752..5f6ddb020f2 100644
--- a/mysql-test/r/func_set.result
+++ b/mysql-test/r/func_set.result
@@ -2,8 +2,8 @@ select interval(55,10,20,30,40,50,60,70,80,90,100),interval(3,1,1+1,1+1+1+1),fie
interval(55,10,20,30,40,50,60,70,80,90,100) interval(3,1,1+1,1+1+1+1) field("IBM","NCA","ICL","SUN","IBM","DIGITAL") field("A","B","C") elt(2,"ONE","TWO","THREE") interval(0,1,2,3,4) elt(1,1,2,3)|0 elt(1,1.1,1.2,1.3)+0
5 2 4 0 TWO 0 1 1.1
explain extended select INTERVAL(55,10,20,30,40,50,60,70,80,90,100),interval(3,1,1+1,1+1+1+1),field("IBM","NCA","ICL","SUN","IBM","DIGITAL"),field("A","B","C"),elt(2,"ONE","TWO","THREE"),interval(0,1,2,3,4),elt(1,1,2,3)|0,elt(1,1.1,1.2,1.3)+0;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select interval((55,10,20,30,40,50,60,70,80,90,100)) AS `INTERVAL(55,10,20,30,40,50,60,70,80,90,100)`,interval((3,1,(1 + 1),(((1 + 1) + 1) + 1))) AS `interval(3,1,1+1,1+1+1+1)`,field(_latin1'IBM',_latin1'NCA',_latin1'ICL',_latin1'SUN',_latin1'IBM',_latin1'DIGITAL') AS `field("IBM","NCA","ICL","SUN","IBM","DIGITAL")`,field(_latin1'A',_latin1'B',_latin1'C') AS `field("A","B","C")`,elt(2,_latin1'ONE',_latin1'TWO',_latin1'THREE') AS `elt(2,"ONE","TWO","THREE")`,interval((0,1,2,3,4)) AS `interval(0,1,2,3,4)`,(elt(1,1,2,3) | 0) AS `elt(1,1,2,3)|0`,(elt(1,1.1,1.2,1.3) + 0) AS `elt(1,1.1,1.2,1.3)+0`
SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56);
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index e5342eec54f..733cb5ca5f0 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -722,37 +722,37 @@ Warning 1265 Data truncated for column 'format(130,10)' at row 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `bin(130)` varchar(64) NOT NULL default '',
- `oct(130)` varchar(64) NOT NULL default '',
- `conv(130,16,10)` varchar(64) NOT NULL default '',
- `hex(130)` varchar(6) NOT NULL default '',
- `char(130)` varbinary(1) NOT NULL default '',
- `format(130,10)` varchar(4) NOT NULL default '',
- `left(_latin2'a',1)` varchar(1) character set latin2 NOT NULL default '',
- `right(_latin2'a',1)` varchar(1) character set latin2 NOT NULL default '',
- `lcase(_latin2'a')` varchar(1) character set latin2 NOT NULL default '',
- `ucase(_latin2'a')` varchar(1) character set latin2 NOT NULL default '',
- `substring(_latin2'a',1,1)` varchar(1) character set latin2 NOT NULL default '',
- `concat(_latin2'a',_latin2'b')` varchar(2) character set latin2 NOT NULL default '',
- `lpad(_latin2'a',4,_latin2'b')` varchar(4) character set latin2 NOT NULL default '',
- `rpad(_latin2'a',4,_latin2'b')` varchar(4) character set latin2 NOT NULL default '',
- `concat_ws(_latin2'a',_latin2'b')` varchar(1) character set latin2 NOT NULL default '',
- `make_set(255,_latin2'a',_latin2'b',_latin2'c')` varchar(5) character set latin2 NOT NULL default '',
- `export_set(255,_latin2'y',_latin2'n',_latin2' ')` varchar(127) character set latin2 NOT NULL default '',
- `trim(_latin2' a ')` varchar(3) character set latin2 NOT NULL default '',
- `ltrim(_latin2' a ')` varchar(3) character set latin2 NOT NULL default '',
- `rtrim(_latin2' a ')` varchar(3) character set latin2 NOT NULL default '',
- `trim(LEADING _latin2' ' FROM _latin2' a ')` varchar(3) character set latin2 NOT NULL default '',
- `trim(TRAILING _latin2' ' FROM _latin2' a ')` varchar(3) character set latin2 NOT NULL default '',
- `trim(BOTH _latin2' ' FROM _latin2' a ')` varchar(3) character set latin2 NOT NULL default '',
- `repeat(_latin2'a',10)` varchar(10) character set latin2 NOT NULL default '',
- `reverse(_latin2'ab')` varchar(2) character set latin2 NOT NULL default '',
- `quote(_latin2'ab')` varchar(6) character set latin2 NOT NULL default '',
- `soundex(_latin2'ab')` varchar(4) character set latin2 NOT NULL default '',
- `substring(_latin2'ab',1)` varchar(2) character set latin2 NOT NULL default '',
- `insert(_latin2'abcd',2,3,_latin2'ef')` varchar(6) character set latin2 NOT NULL default '',
- `replace(_latin2'abcd',_latin2'b',_latin2'B')` varchar(4) character set latin2 NOT NULL default '',
- `encode('abcd','ab')` varbinary(4) NOT NULL default ''
+ `bin(130)` varchar(64) NOT NULL DEFAULT '',
+ `oct(130)` varchar(64) NOT NULL DEFAULT '',
+ `conv(130,16,10)` varchar(64) NOT NULL DEFAULT '',
+ `hex(130)` varchar(6) NOT NULL DEFAULT '',
+ `char(130)` varbinary(1) NOT NULL DEFAULT '',
+ `format(130,10)` varchar(4) NOT NULL DEFAULT '',
+ `left(_latin2'a',1)` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `right(_latin2'a',1)` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `lcase(_latin2'a')` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `ucase(_latin2'a')` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `substring(_latin2'a',1,1)` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `concat(_latin2'a',_latin2'b')` varchar(2) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `lpad(_latin2'a',4,_latin2'b')` varchar(4) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `rpad(_latin2'a',4,_latin2'b')` varchar(4) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `concat_ws(_latin2'a',_latin2'b')` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `make_set(255,_latin2'a',_latin2'b',_latin2'c')` varchar(5) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `export_set(255,_latin2'y',_latin2'n',_latin2' ')` varchar(127) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `trim(_latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `ltrim(_latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `rtrim(_latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `trim(LEADING _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `trim(TRAILING _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `trim(BOTH _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `repeat(_latin2'a',10)` varchar(10) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `reverse(_latin2'ab')` varchar(2) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `quote(_latin2'ab')` varchar(6) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `soundex(_latin2'ab')` varchar(4) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `substring(_latin2'ab',1)` varchar(2) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `insert(_latin2'abcd',2,3,_latin2'ef')` varchar(6) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `replace(_latin2'abcd',_latin2'b',_latin2'B')` varchar(4) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `encode('abcd','ab')` varbinary(4) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a char character set latin2);
@@ -814,8 +814,8 @@ select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2),substring_index("1abcd
substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2) substring_index("1abcd;2abcd;3abcd;4abcd", ';', -2)
1abcd;2abcd 3abcd;4abcd
explain extended select md5('hello'), sha('abc'), sha1('abc'), soundex(''), 'mood' sounds like 'mud', aes_decrypt(aes_encrypt('abc','1'),'1'),concat('*',space(5),'*'), reverse('abc'), rpad('a',4,'1'), lpad('a',4,'1'), concat_ws(',','',NULL,'a'),make_set(255,_latin2'a',_latin2'b',_latin2'c'),elt(2,1),locate("a","b",2),format(130,10),char(0),conv(130,16,10),hex(130),binary 'HE', export_set(255,_latin2'y',_latin2'n',_latin2' '),FIELD('b' COLLATE latin1_bin,'A','B'),FIND_IN_SET(_latin1'B',_latin1'a,b,c,d'),collation(conv(130,16,10)), coercibility(conv(130,16,10)),length('\n\t\r\b\0\_\%\\'),bit_length('\n\t\r\b\0\_\%\\'),bit_length('\n\t\r\b\0\_\%\\'),concat('monty',' was here ','again'),length('hello'),char(ascii('h')),ord('h'),quote(1/0),crc32("123"),replace('aaaa','a','b'),insert('txs',2,1,'hi'),left(_latin2'a',1),right(_latin2'a',1),lcase(_latin2'a'),ucase(_latin2'a'),SUBSTR('abcdefg',3,2),substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2),trim(_latin2' a '),ltrim(_latin2' a '),rtrim(_latin2' a '), decode(encode(repeat("a",100000),"monty"),"monty");
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,cast(_latin1'HE' as char charset binary) AS `binary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate latin1_bin),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substring_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")`
SELECT lpad(12345, 5, "#");
@@ -840,16 +840,16 @@ drop table t1, t2;
create table t1 (c1 INT, c2 INT UNSIGNED);
insert into t1 values ('21474836461','21474836461');
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
insert into t1 values ('-21474836461','-21474836461');
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
show warnings;
Level Code Message
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
select * from t1;
c1 c2
2147483647 4294967295
@@ -1059,28 +1059,28 @@ DROP TABLE t1;
CREATE TABLE t1 (s varchar(10));
INSERT INTO t1 VALUES ('yadda'), ('yaddy');
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(s) > 'ab';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(`test`.`t1`.`s`) > _latin1'ab')
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM('y' FROM s) > 'ab';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(both _latin1'y' from `test`.`t1`.`s`) > _latin1'ab')
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(LEADING 'y' FROM s) > 'ab';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(leading _latin1'y' from `test`.`t1`.`s`) > _latin1'ab')
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(TRAILING 'y' FROM s) > 'ab';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(trailing _latin1'y' from `test`.`t1`.`s`) > _latin1'ab')
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(BOTH 'y' FROM s) > 'ab';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(both _latin1'y' from `test`.`t1`.`s`) > _latin1'ab')
DROP TABLE t1;
@@ -1142,9 +1142,9 @@ A12 a12
EXPLAIN EXTENDED
SELECT * FROM t1 INNER JOIN t2 ON code=id
WHERE id='a12' AND (LENGTH(code)=5 OR code < 'a00');
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 const PRIMARY PRIMARY 12 const 1 Using index
-1 SIMPLE t1 ref code code 13 const 3 Using where; Using index
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 const PRIMARY PRIMARY 12 const 1 100.00 Using index
+1 SIMPLE t1 ref code code 13 const 3 100.00 Using where; Using index
Warnings:
Note 1003 select `test`.`t1`.`code` AS `code`,`test`.`t2`.`id` AS `id` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`code` = _latin1'a12') and (length(`test`.`t1`.`code`) = 5))
DROP TABLE t1,t2;
diff --git a/mysql-test/r/func_system.result b/mysql-test/r/func_system.result
index 00bef09715d..fa05021eb47 100644
--- a/mysql-test/r/func_system.result
+++ b/mysql-test/r/func_system.result
@@ -38,17 +38,17 @@ select charset(version());
charset(version())
utf8
explain extended select database(), user();
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select database() AS `database()`,user() AS `user()`
-create table t1 (version char(40)) select database(), user(), version() as 'version';
+create table t1 (version char(60)) select database(), user(), version() as 'version';
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `database()` varchar(34) character set utf8 default NULL,
- `user()` varchar(77) character set utf8 NOT NULL default '',
- `version` char(40) default NULL
+ `database()` varchar(34) CHARACTER SET utf8 DEFAULT NULL,
+ `user()` varchar(77) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `version` char(60) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select charset(charset(_utf8'a')), charset(collation(_utf8'a'));
@@ -61,8 +61,8 @@ create table t1 select charset(_utf8'a'), collation(_utf8'a');
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `charset(_utf8'a')` varchar(64) character set utf8 NOT NULL default '',
- `collation(_utf8'a')` varchar(64) character set utf8 NOT NULL default ''
+ `charset(_utf8'a')` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `collation(_utf8'a')` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select TRUE,FALSE,NULL;
diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result
index 43832bdbccc..9a5cc666ca8 100644
--- a/mysql-test/r/func_test.result
+++ b/mysql-test/r/func_test.result
@@ -45,8 +45,8 @@ select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
3 ^ 11 1 ^ 1 1 ^ 0 1 ^ NULL NULL ^ 1
8 0 1 NULL NULL
explain extended select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select (3 ^ 11) AS `3 ^ 11`,(1 ^ 1) AS `1 ^ 1`,(1 ^ 0) AS `1 ^ 0`,(1 ^ NULL) AS `1 ^ NULL`,(NULL ^ 1) AS `NULL ^ 1`
select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
@@ -59,16 +59,16 @@ select 10 % 7, 10 mod 7, 10 div 3;
10 % 7 10 mod 7 10 div 3
3 3 3
explain extended select 10 % 7, 10 mod 7, 10 div 3;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select (10 % 7) AS `10 % 7`,(10 % 7) AS `10 mod 7`,(10 DIV 3) AS `10 div 3`
select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
(1 << 64)-1 ((1 << 64)-1) DIV 1 ((1 << 64)-1) DIV 2
18446744073709551615 18446744073709551615 9223372036854775807
explain extended select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select ((1 << 64) - 1) AS `(1 << 64)-1`,(((1 << 64) - 1) DIV 1) AS `((1 << 64)-1) DIV 1`,(((1 << 64) - 1) DIV 2) AS `((1 << 64)-1) DIV 2`
create table t1 (a int);
@@ -76,16 +76,16 @@ insert t1 values (1);
select * from t1 where 1 xor 1;
a
explain extended select * from t1 where 1 xor 1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1`
select - a from t1;
- a
-1
explain extended select - a from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 1
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
Note 1003 select -(`test`.`t1`.`a`) AS `- a` from `test`.`t1`
drop table t1;
@@ -105,8 +105,8 @@ select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci;
_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci
1
explain extended select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select (_koi8r'a' = (_koi8r'A' collate koi8r_general_ci)) AS `_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci`
select _koi8r'a' = _koi8r'A' COLLATE koi8r_bin;
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index e8fd7a4e4c9..d7f65e84462 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -312,7 +312,7 @@ select date_sub("0000-00-00 00:00:00",INTERVAL 1 SECOND);
date_sub("0000-00-00 00:00:00",INTERVAL 1 SECOND)
NULL
Warnings:
-Warning 1292 Truncated incorrect datetime value: '0000-00-00 00:00:00'
+Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
select date_add('1998-01-30',Interval 1 month);
date_add('1998-01-30',Interval 1 month)
1998-02-28
@@ -473,12 +473,12 @@ SELECT month(updated) from t1;
month(updated)
NULL
Warnings:
-Warning 1292 Truncated incorrect datetime value: ''
+Warning 1292 Incorrect datetime value: ''
SELECT year(updated) from t1;
year(updated)
NULL
Warnings:
-Warning 1292 Truncated incorrect datetime value: ''
+Warning 1292 Incorrect datetime value: ''
drop table t1;
create table t1 (d date, dt datetime, t timestamp, c char(10));
insert into t1 values ("0000-00-00", "0000-00-00", "0000-00-00", "0000-00-00");
@@ -486,8 +486,8 @@ select dayofyear("0000-00-00"),dayofyear(d),dayofyear(dt),dayofyear(t),dayofyear
dayofyear("0000-00-00") dayofyear(d) dayofyear(dt) dayofyear(t) dayofyear(c)
NULL NULL NULL NULL NULL
Warnings:
-Warning 1292 Truncated incorrect datetime value: '0000-00-00'
-Warning 1292 Truncated incorrect datetime value: '0000-00-00'
+Warning 1292 Incorrect datetime value: '0000-00-00'
+Warning 1292 Incorrect datetime value: '0000-00-00'
select dayofmonth("0000-00-00"),dayofmonth(d),dayofmonth(dt),dayofmonth(t),dayofmonth(c) from t1;
dayofmonth("0000-00-00") dayofmonth(d) dayofmonth(dt) dayofmonth(t) dayofmonth(c)
0 0 0 0 0
@@ -501,8 +501,8 @@ select week("0000-00-00"),week(d),week(dt),week(t),week(c) from t1;
week("0000-00-00") week(d) week(dt) week(t) week(c)
NULL NULL NULL NULL NULL
Warnings:
-Warning 1292 Truncated incorrect datetime value: '0000-00-00'
-Warning 1292 Truncated incorrect datetime value: '0000-00-00'
+Warning 1292 Incorrect datetime value: '0000-00-00'
+Warning 1292 Incorrect datetime value: '0000-00-00'
select year("0000-00-00"),year(d),year(dt),year(t),year(c) from t1;
year("0000-00-00") year(d) year(dt) year(t) year(c)
0 0 0 0 0
@@ -510,14 +510,14 @@ select yearweek("0000-00-00"),yearweek(d),yearweek(dt),yearweek(t),yearweek(c) f
yearweek("0000-00-00") yearweek(d) yearweek(dt) yearweek(t) yearweek(c)
NULL NULL NULL NULL NULL
Warnings:
-Warning 1292 Truncated incorrect datetime value: '0000-00-00'
-Warning 1292 Truncated incorrect datetime value: '0000-00-00'
+Warning 1292 Incorrect datetime value: '0000-00-00'
+Warning 1292 Incorrect datetime value: '0000-00-00'
select to_days("0000-00-00"),to_days(d),to_days(dt),to_days(t),to_days(c) from t1;
to_days("0000-00-00") to_days(d) to_days(dt) to_days(t) to_days(c)
NULL NULL NULL NULL NULL
Warnings:
-Warning 1292 Truncated incorrect datetime value: '0000-00-00'
-Warning 1292 Truncated incorrect datetime value: '0000-00-00'
+Warning 1292 Incorrect datetime value: '0000-00-00'
+Warning 1292 Incorrect datetime value: '0000-00-00'
select extract(MONTH FROM "0000-00-00"),extract(MONTH FROM d),extract(MONTH FROM dt),extract(MONTH FROM t),extract(MONTH FROM c) from t1;
extract(MONTH FROM "0000-00-00") extract(MONTH FROM d) extract(MONTH FROM dt) extract(MONTH FROM t) extract(MONTH FROM c)
0 0 0 0 0
@@ -781,7 +781,7 @@ select date_add(time,INTERVAL 1 SECOND) from t1;
date_add(time,INTERVAL 1 SECOND)
NULL
Warnings:
-Warning 1264 Out of range value adjusted for column 'time' at row 1
+Warning 1264 Out of range value for column 'time' at row 1
drop table t1;
select last_day('2000-02-05') as f1, last_day('2002-12-31') as f2,
last_day('2003-03-32') as f3, last_day('2003-04-01') as f4,
@@ -790,7 +790,7 @@ last_day('2001-02-12');
f1 f2 f3 f4 f5 last_day(NULL) last_day('2001-02-12')
2000-02-29 2002-12-31 NULL 2003-04-30 2001-01-31 NULL 2001-02-28
Warnings:
-Warning 1292 Truncated incorrect datetime value: '2003-03-32'
+Warning 1292 Incorrect datetime value: '2003-03-32'
create table t1 select last_day('2000-02-05') as a,
from_days(to_days("960101")) as b;
describe t1;
@@ -836,8 +836,8 @@ select strcmp(concat(utc_date(),' ',utc_time()),utc_timestamp())=0;
strcmp(concat(utc_date(),' ',utc_time()),utc_timestamp())=0
1
explain extended select period_add("9602",-12),period_diff(199505,"9404"),from_days(to_days("960101")),dayofmonth("1997-01-02"), month("1997-01-02"), monthname("1972-03-04"),dayofyear("0000-00-00"),HOUR("1997-03-03 23:03:22"),MINUTE("23:03:22"),SECOND(230322),QUARTER(980303),WEEK("1998-03-03"),yearweek("2000-01-01",1),week(19950101,1),year("98-02-03"),weekday(curdate())-weekday(now()),dayname("1962-03-03"),unix_timestamp(),sec_to_time(time_to_sec("0:30:47")/6.21),curtime(),utc_time(),curdate(),utc_date(),utc_timestamp(),date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w"),from_unixtime(unix_timestamp("1994-03-02 10:11:12")),"1997-12-31 23:59:59" + INTERVAL 1 SECOND,"1998-01-01 00:00:00" - INTERVAL 1 SECOND,INTERVAL 1 DAY + "1997-12-31", extract(YEAR FROM "1999-01-02 10:11:12"),date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select period_add(_latin1'9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,_latin1'9404') AS `period_diff(199505,"9404")`,from_days(to_days(_latin1'960101')) AS `from_days(to_days("960101"))`,dayofmonth(_latin1'1997-01-02') AS `dayofmonth("1997-01-02")`,month(_latin1'1997-01-02') AS `month("1997-01-02")`,monthname(_latin1'1972-03-04') AS `monthname("1972-03-04")`,dayofyear(_latin1'0000-00-00') AS `dayofyear("0000-00-00")`,hour(_latin1'1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute(_latin1'23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week(_latin1'1998-03-03',0) AS `WEEK("1998-03-03")`,yearweek(_latin1'2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year(_latin1'98-02-03') AS `year("98-02-03")`,(weekday(curdate()) - weekday(now())) AS `weekday(curdate())-weekday(now())`,dayname(_latin1'1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec(_latin1'0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format(_latin1'1997-01-02 03:04:05',_latin1'%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp(_latin1'1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,(_latin1'1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,(_latin1'1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from _latin1'1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)`
SET @TMP=NOW();
@@ -853,17 +853,17 @@ select last_day('2005-00-00');
last_day('2005-00-00')
NULL
Warnings:
-Warning 1292 Truncated incorrect datetime value: '2005-00-00'
+Warning 1292 Incorrect datetime value: '2005-00-00'
select last_day('2005-00-01');
last_day('2005-00-01')
NULL
Warnings:
-Warning 1292 Truncated incorrect datetime value: '2005-00-01'
+Warning 1292 Incorrect datetime value: '2005-00-01'
select last_day('2005-01-00');
last_day('2005-01-00')
NULL
Warnings:
-Warning 1292 Truncated incorrect datetime value: '2005-01-00'
+Warning 1292 Incorrect datetime value: '2005-01-00'
select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
monthname(str_to_date(null, '%m')) monthname(str_to_date(null, '%m')) monthname(str_to_date(1, '%m')) monthname(str_to_date(0, '%m'))
@@ -908,8 +908,8 @@ f1
select f1 from t1 where cast("2006-1-1" as date) between f1 and cast('zzz' as date);
f1
Warnings:
-Warning 1292 Truncated incorrect datetime value: 'zzz'
-Warning 1292 Truncated incorrect datetime value: 'zzz'
+Warning 1292 Incorrect datetime value: 'zzz'
+Warning 1292 Incorrect datetime value: 'zzz'
select f1 from t1 where makedate(2006,1) between date(f1) and date(f3);
f1
2006-01-01
@@ -922,10 +922,10 @@ sec_to_time(1) + 0, from_unixtime(1) + 0;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `now() - now()` double(23,6) NOT NULL default '0.000000',
- `curtime() - curtime()` double(23,6) NOT NULL default '0.000000',
- `sec_to_time(1) + 0` double(23,6) default NULL,
- `from_unixtime(1) + 0` double(23,6) default NULL
+ `now() - now()` double(23,6) NOT NULL DEFAULT '0.000000',
+ `curtime() - curtime()` double(23,6) NOT NULL DEFAULT '0.000000',
+ `sec_to_time(1) + 0` double(23,6) DEFAULT NULL,
+ `from_unixtime(1) + 0` double(23,6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
SELECT SEC_TO_TIME(3300000);
@@ -1005,7 +1005,7 @@ CREATE TABLE t1(f1 TIME);
INSERT INTO t1 VALUES('916:00:00 a');
Warnings:
Warning 1265 Data truncated for column 'f1' at row 1
-Warning 1264 Out of range value adjusted for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 1
SELECT * FROM t1;
f1
838:59:59
@@ -1050,30 +1050,16 @@ H
End of 4.1 tests
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select timestampdiff(WEEK,_latin1'2001-02-01',_latin1'2001-05-01') AS `a1`,timestampdiff(SECOND_FRAC,_latin1'2001-02-01 12:59:59.120000',_latin1'2001-05-01 12:58:58.119999') AS `a2`
-select last_day('2005-00-00');
-last_day('2005-00-00')
-NULL
-Warnings:
-Warning 1292 Truncated incorrect datetime value: '2005-00-00'
-select last_day('2005-00-01');
-last_day('2005-00-01')
-NULL
-Warnings:
-Warning 1292 Truncated incorrect datetime value: '2005-00-01'
-select last_day('2005-01-00');
-last_day('2005-01-00')
-NULL
-Warnings:
-Warning 1292 Truncated incorrect datetime value: '2005-01-00'
select time_format('100:00:00', '%H %k %h %I %l');
time_format('100:00:00', '%H %k %h %I %l')
100 100 04 04 4
create table t1 (a timestamp default '2005-05-05 01:01:01',
b timestamp default '2005-05-05 01:01:01');
+drop function if exists t_slow_sysdate;
create function t_slow_sysdate() returns timestamp
begin
do sleep(2);
@@ -1189,15 +1175,38 @@ id day id day
3 2005-07-01 3 2005-07-15
DROP TABLE t1,t2;
set time_zone= @@global.time_zone;
-SET NAMES latin1;
-SET character_set_results = NULL;
-SHOW VARIABLES LIKE 'character_set_results';
-Variable_name Value
-character_set_results
-CREATE TABLE testBug8868 (field1 DATE, field2 VARCHAR(32) CHARACTER SET BINARY);
-INSERT INTO testBug8868 VALUES ('2006-09-04', 'abcd');
-SELECT DATE_FORMAT(field1,'%b-%e %l:%i%p') as fmtddate, field2 FROM testBug8868;
-fmtddate field2
-Sep-4 12:00AM abcd
-DROP TABLE testBug8868;
-SET NAMES DEFAULT;
+End of 5.0 tests
+select date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND);
+date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND)
+NULL
+select date_sub("0199-01-01 00:00:01",INTERVAL 2 SECOND);
+date_sub("0199-01-01 00:00:01",INTERVAL 2 SECOND)
+NULL
+select date_add("0199-12-31 23:59:59",INTERVAL 2 SECOND);
+date_add("0199-12-31 23:59:59",INTERVAL 2 SECOND)
+NULL
+select date_sub("0200-01-01 00:00:01",INTERVAL 2 SECOND);
+date_sub("0200-01-01 00:00:01",INTERVAL 2 SECOND)
+0199-12-31 23:59:59
+select date_sub("0200-01-01 00:00:01",INTERVAL 1 SECOND);
+date_sub("0200-01-01 00:00:01",INTERVAL 1 SECOND)
+0200-01-01 00:00:00
+select date_sub("0200-01-01 00:00:01",INTERVAL 2 SECOND);
+date_sub("0200-01-01 00:00:01",INTERVAL 2 SECOND)
+0199-12-31 23:59:59
+select date_add("2001-01-01 23:59:59",INTERVAL -2000 YEAR);
+date_add("2001-01-01 23:59:59",INTERVAL -2000 YEAR)
+0001-01-01 23:59:59
+select date_sub("50-01-01 00:00:01",INTERVAL 2 SECOND);
+date_sub("50-01-01 00:00:01",INTERVAL 2 SECOND)
+2049-12-31 23:59:59
+select date_sub("90-01-01 00:00:01",INTERVAL 2 SECOND);
+date_sub("90-01-01 00:00:01",INTERVAL 2 SECOND)
+1989-12-31 23:59:59
+select date_sub("0069-01-01 00:00:01",INTERVAL 2 SECOND);
+date_sub("0069-01-01 00:00:01",INTERVAL 2 SECOND)
+NULL
+select date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND);
+date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND)
+NULL
+End of 5.1 tests
diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result
index e017a31f24b..dbd6783fe76 100644
--- a/mysql-test/r/gis-rtree.result
+++ b/mysql-test/r/gis-rtree.result
@@ -7,9 +7,9 @@ SPATIAL KEY(g)
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `fid` int(11) NOT NULL auto_increment,
+ `fid` int(11) NOT NULL AUTO_INCREMENT,
`g` geometry NOT NULL,
- PRIMARY KEY (`fid`),
+ PRIMARY KEY (`fid`),
SPATIAL KEY `g` (`g`(32))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(150 150, 150 150)'));
@@ -290,9 +290,9 @@ ALTER TABLE t2 ADD SPATIAL KEY(g);
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `fid` int(11) NOT NULL auto_increment,
+ `fid` int(11) NOT NULL AUTO_INCREMENT,
`g` geometry NOT NULL,
- PRIMARY KEY (`fid`),
+ PRIMARY KEY (`fid`),
SPATIAL KEY `g` (`g`(32))
) ENGINE=MyISAM AUTO_INCREMENT=101 DEFAULT CHARSET=latin1
SELECT count(*) FROM t2;
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index 46aecde2cc5..6a90ad27625 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -225,8 +225,8 @@ fid AsText(Envelope(g))
120 POLYGON((0 0,10 0,10 10,0 10,0 0))
121 POLYGON((3 6,44 6,44 9,3 9,3 6))
explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21 100.00
Warnings:
Note 1003 select dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,astext(envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry`
SELECT fid, X(g) FROM gis_point;
@@ -242,8 +242,8 @@ fid Y(g)
103 20
104 20
explain extended select X(g),Y(g) FROM gis_point;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_point ALL NULL NULL NULL NULL 4
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 100.00
Warnings:
Note 1003 select x(`test`.`gis_point`.`g`) AS `X(g)`,y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point`
SELECT fid, AsText(StartPoint(g)) FROM gis_line;
@@ -277,8 +277,8 @@ fid IsClosed(g)
106 1
107 0
explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_line ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,astext(endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,glength(`test`.`gis_line`.`g`) AS `GLength(g)`,numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,astext(pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line`
SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
@@ -307,8 +307,8 @@ fid AsText(InteriorRingN(g, 1))
109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
110 NULL
explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM gis_polygon;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select astext(centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,area(`test`.`gis_polygon`.`g`) AS `Area(g)`,astext(exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,astext(interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon`
SELECT fid, IsClosed(g) FROM gis_multi_line;
@@ -346,8 +346,8 @@ fid NumGeometries(g)
120 2
121 2
explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point`
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
@@ -374,8 +374,8 @@ fid AsText(GeometryN(g, 1))
120 POINT(0 0)
121 POINT(44 6)
explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,astext(geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point`
SELECT g1.fid as first, g2.fid as second,
@@ -393,9 +393,9 @@ Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE g1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
-1 SIMPLE g2 ALL NULL NULL NULL NULL 2
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE g1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
+1 SIMPLE g2 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,overlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,disjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,intersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
@@ -436,26 +436,26 @@ SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))
POINT(1 4)
explain extended SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))`
explain extended SELECT AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))));
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))))`
SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
SRID(GeomFromText('LineString(1 1,2 2)',101))
101
explain extended SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select srid(geometryfromtext(_latin1'LineString(1 1,2 2)',101)) AS `SRID(GeomFromText('LineString(1 1,2 2)',101))`
explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6));
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select issimple(multipoint(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,issimple(point(3,6)) AS `issimple(Point(3, 6))`
create table t1 (a geometry not null);
@@ -578,7 +578,7 @@ create table t1 select GeomFromWKB(POINT(1,3));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `GeomFromWKB(POINT(1,3))` geometry NOT NULL default ''
+ `GeomFromWKB(POINT(1,3))` geometry NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo`
@@ -703,7 +703,7 @@ def test t1 t1 g g 255 4294967295 0 Y 144 0 63
g
select asbinary(g) from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def asbinary(g) 252 8192 0 Y 128 0 63
+def asbinary(g) 252 16777216 0 Y 128 0 63
asbinary(g)
drop table t1;
create table t1 select GeomFromText('point(1 1)');
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 2f417a41652..5dbbfbd9ab8 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -11,8 +11,8 @@ GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
grant delete on mysqltest.* to mysqltest_1@localhost;
select * from mysql.user where user="mysqltest_1";
-Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections
-localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED EDH-RSA-DES-CBC3-SHA 0 0 0 0
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections
+localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED EDH-RSA-DES-CBC3-SHA 0 0 0 0
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
@@ -42,15 +42,15 @@ delete from mysql.user where user='mysqltest_1';
flush privileges;
grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 10;
select * from mysql.user where user="mysqltest_1";
-Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections
-localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N 10 0 0 0
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections
+localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 10 0 0 0
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10
grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 20 max_connections_per_hour 30;
select * from mysql.user where user="mysqltest_1";
-Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections
-localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N 10 20 30 0
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections
+localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 10 20 30 0
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 MAX_UPDATES_PER_HOUR 20 MAX_CONNECTIONS_PER_HOUR 30
@@ -85,7 +85,7 @@ revoke LOCK TABLES, ALTER on mysqltest.* from mysqltest_1@localhost;
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
-GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, CREATE TEMPORARY TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, CREATE TEMPORARY TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
delete from mysql.user where user='mysqltest_1';
flush privileges;
@@ -463,6 +463,7 @@ Create view Tables To create new views
Create user Server Admin To create new users
Delete Tables To delete existing rows
Drop Databases,Tables To drop databases, tables, and views
+Event Server Admin To create, alter, drop and execute events
Execute Functions,Procedures To execute stored routines
File File access on server To read and write files on the server
Grant option Databases,Tables,Functions,Procedures To give to other users those privileges you possess
@@ -479,6 +480,7 @@ Show databases Server Admin To see all databases with SHOW DATABASES
Show view Tables To see views with SHOW CREATE VIEW
Shutdown Server Admin To shut down the server
Super Server Admin To use KILL thread, SET GLOBAL, CHANGE MASTER, etc.
+Trigger Tables To use triggers
Update Tables To update existing rows
Usage Server Admin No privileges - allow connect only
create database mysqltest;
@@ -505,8 +507,8 @@ SELECT TABLE_SCHEMA, TABLE_NAME, GROUP_CONCAT(PRIVILEGE_TYPE ORDER BY
PRIVILEGE_TYPE SEPARATOR ', ') AS PRIVILEGES FROM TABLE_PRIVILEGES WHERE GRANTEE
= '\'dummy\'@\'localhost\'' GROUP BY TABLE_SCHEMA, TABLE_NAME;
TABLE_SCHEMA TABLE_NAME PRIVILEGES
-mysqltest dummytable ALTER, CREATE, CREATE VIEW, DELETE, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, UPDATE
-mysqltest dummyview ALTER, CREATE, CREATE VIEW, DELETE, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, UPDATE
+mysqltest dummytable ALTER, CREATE, CREATE VIEW, DELETE, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
+mysqltest dummyview ALTER, CREATE, CREATE VIEW, DELETE, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
FLUSH PRIVILEGES;
SHOW GRANTS FOR dummy@localhost;
Grants for dummy@localhost
@@ -517,8 +519,8 @@ SELECT TABLE_SCHEMA, TABLE_NAME, GROUP_CONCAT(PRIVILEGE_TYPE ORDER BY
PRIVILEGE_TYPE SEPARATOR ', ') AS PRIVILEGES FROM TABLE_PRIVILEGES WHERE GRANTEE
= '\'dummy\'@\'localhost\'' GROUP BY TABLE_SCHEMA, TABLE_NAME;
TABLE_SCHEMA TABLE_NAME PRIVILEGES
-mysqltest dummytable ALTER, CREATE, CREATE VIEW, DELETE, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, UPDATE
-mysqltest dummyview ALTER, CREATE, CREATE VIEW, DELETE, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, UPDATE
+mysqltest dummytable ALTER, CREATE, CREATE VIEW, DELETE, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
+mysqltest dummyview ALTER, CREATE, CREATE VIEW, DELETE, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
SHOW FIELDS FROM mysql.tables_priv;
Field Type Null Key Default Extra
Host char(60) NO PRI
@@ -527,7 +529,7 @@ User char(16) NO PRI
Table_name char(64) NO PRI
Grantor char(77) NO MUL
Timestamp timestamp NO CURRENT_TIMESTAMP
-Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view') NO
+Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') NO
Column_priv set('Select','Insert','Update','References') NO
use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM dummy@localhost;
@@ -609,7 +611,7 @@ flush privileges;
use test;
set @user123="non-existent";
select * from mysql.db where user=@user123;
-Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv
+Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv Event_priv Trigger_priv
set names koi8r;
create database ;
grant select on .* to root@localhost;
@@ -909,7 +911,7 @@ ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table '
SHOW CREATE TABLE mysqltest2.t_nn;
Table Create Table
t_nn CREATE TABLE `t_nn` (
- `c1` int(11) default NULL
+ `c1` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE VIEW mysqltest2.t_nn;
ERROR HY000: 'mysqltest2.t_nn' is not VIEW
@@ -928,7 +930,7 @@ v_nn CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER
SHOW CREATE TABLE mysqltest2.t_nn;
Table Create Table
t_nn CREATE TABLE `t_nn` (
- `c1` int(11) default NULL
+ `c1` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE VIEW mysqltest2.t_nn;
ERROR HY000: 'mysqltest2.t_nn' is not VIEW
diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result
index ff9b7bc6f1f..4b089c1d5e9 100644
--- a/mysql-test/r/grant2.result
+++ b/mysql-test/r/grant2.result
@@ -348,15 +348,14 @@ create database TESTDB;
create table t2(a int);
create temporary table t1 as select * from mysql.user;
delete from mysql.user where host='localhost';
-INSERT INTO mysql.user VALUES
-('%','mysqltest_1',password('password'),'N','N','N','N','N','N',
-'N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N',
-'','','','',0,0,0,0);
-INSERT INTO mysql.db VALUES
-('%','TESTDB','mysqltest_1','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','N','Y','Y','Y','
-Y','N');
+INSERT INTO mysql.user (host, user, password) VALUES
+('%','mysqltest_1',password('password'));
Warnings:
-Warning 1265 Data truncated for column 'Alter_routine_priv' at row 1
+Warning 1364 Field 'ssl_cipher' doesn't have a default value
+Warning 1364 Field 'x509_issuer' doesn't have a default value
+Warning 1364 Field 'x509_subject' doesn't have a default value
+INSERT INTO mysql.db (host, db, user, select_priv) VALUES
+('%','TESTDB','mysqltest_1','Y');
FLUSH PRIVILEGES;
create database TEStdb;
Got one of the listed errors
diff --git a/mysql-test/r/grant_cache.result b/mysql-test/r/grant_cache.result
index 925a5918c1b..2c6840d77d0 100644
--- a/mysql-test/r/grant_cache.result
+++ b/mysql-test/r/grant_cache.result
@@ -60,7 +60,7 @@ Variable_name Value
Qcache_hits 0
show status like "Qcache_not_cached";
Variable_name Value
-Qcache_not_cached 5
+Qcache_not_cached 0
select "user1";
user1
user1
@@ -72,7 +72,7 @@ Variable_name Value
Qcache_hits 0
show status like "Qcache_not_cached";
Variable_name Value
-Qcache_not_cached 9
+Qcache_not_cached 1
select * from t1;
a b c
1 1 1
@@ -85,7 +85,7 @@ Variable_name Value
Qcache_hits 1
show status like "Qcache_not_cached";
Variable_name Value
-Qcache_not_cached 12
+Qcache_not_cached 1
select a from t1 ;
a
1
@@ -98,7 +98,7 @@ Variable_name Value
Qcache_hits 2
show status like "Qcache_not_cached";
Variable_name Value
-Qcache_not_cached 15
+Qcache_not_cached 1
select c from t1;
c
1
@@ -111,7 +111,7 @@ Variable_name Value
Qcache_hits 3
show status like "Qcache_not_cached";
Variable_name Value
-Qcache_not_cached 18
+Qcache_not_cached 1
show grants for current_user();
Grants for @localhost
GRANT USAGE ON *.* TO ''@'localhost'
@@ -144,7 +144,7 @@ Variable_name Value
Qcache_hits 7
show status like "Qcache_not_cached";
Variable_name Value
-Qcache_not_cached 22
+Qcache_not_cached 2
select "user3";
user3
user3
@@ -168,7 +168,7 @@ Variable_name Value
Qcache_hits 7
show status like "Qcache_not_cached";
Variable_name Value
-Qcache_not_cached 30
+Qcache_not_cached 7
select "user4";
user4
user4
@@ -198,7 +198,7 @@ Variable_name Value
Qcache_hits 8
show status like "Qcache_not_cached";
Variable_name Value
-Qcache_not_cached 34
+Qcache_not_cached 8
set names binary;
delete from mysql.user where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
delete from mysql.db where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
diff --git a/mysql-test/r/greedy_optimizer.result b/mysql-test/r/greedy_optimizer.result
index 1da49fbedb0..b02ff04780b 100644
--- a/mysql-test/r/greedy_optimizer.result
+++ b/mysql-test/r/greedy_optimizer.result
@@ -233,7 +233,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 274.418727
+Last_query_cost 289.418727
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
@@ -245,7 +245,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 274.418727
+Last_query_cost 289.418727
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
@@ -257,7 +257,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 274.418727
+Last_query_cost 289.418727
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
@@ -269,7 +269,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 274.418727
+Last_query_cost 289.418727
set optimizer_search_depth=1;
select @@optimizer_search_depth;
@@optimizer_search_depth
@@ -385,7 +385,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 274.418727
+Last_query_cost 289.418727
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
@@ -397,7 +397,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 274.418727
+Last_query_cost 289.418727
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
@@ -409,7 +409,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 274.418727
+Last_query_cost 289.418727
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
@@ -421,7 +421,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 274.418727
+Last_query_cost 289.418727
set optimizer_prune_level=1;
select @@optimizer_prune_level;
@@optimizer_prune_level
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 7d1e8832069..663ef6cced4 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -285,8 +285,8 @@ spid count(*)
2 2
1 1
explain extended select sql_big_result spid,sum(userid) from t1 group by spid desc;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using filesort
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using filesort
Warnings:
Note 1003 select sql_big_result `test`.`t1`.`spID` AS `spid`,sum(`test`.`t1`.`userID`) AS `sum(userid)` from `test`.`t1` group by `test`.`t1`.`spID` desc
explain select sql_big_result spid,sum(userid) from t1 group by spid desc order by null;
@@ -537,11 +537,11 @@ a b
explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
-1 SIMPLE t2 ALL a NULL NULL NULL 3 Using where
+1 SIMPLE t2 ALL a NULL NULL NULL 4 Using where
explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b ORDER BY NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary
-1 SIMPLE t2 ALL a NULL NULL NULL 3 Using where
+1 SIMPLE t2 ALL a NULL NULL NULL 4 Using where
drop table t1,t2;
create table t1 (a int, b int);
insert into t1 values (1, 4),(10, 40),(1, 4),(10, 43),(1, 4),(10, 41),(1, 4),(10, 43),(1, 4);
@@ -933,3 +933,12 @@ b sum(1)
18 6
19 6
DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT, KEY(a));
+INSERT INTO t1 VALUES (1, 1), (2, 2), (3,3), (4,4);
+EXPLAIN SELECT a, SUM(b) FROM t1 GROUP BY a LIMIT 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL a 5 NULL 4
+EXPLAIN SELECT a, SUM(b) FROM t1 IGNORE INDEX (a) GROUP BY a LIMIT 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort
+DROP TABLE t1;
diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result
index 0304919baf6..5485db73fbb 100644
--- a/mysql-test/r/group_min_max.result
+++ b/mysql-test/r/group_min_max.result
@@ -1558,9 +1558,11 @@ id select_type table type possible_keys key key_len ref rows Extra
explain select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
-explain select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index
+explain extended select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 50.78 Using where; Using index
+Warnings:
+Note 1003 select distinct `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`c` = _latin1'i121') and (`test`.`t1`.`b` = _latin1'a') and (`test`.`t1`.`a2` >= _latin1'b'))
explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 14 Using where; Using index for group-by
@@ -1573,9 +1575,11 @@ id select_type table type possible_keys key key_len ref rows Extra
explain select distinct a1,a2,b from t2 where (a2 >= 'b') and (b = 'a');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by
-explain select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
+explain extended select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 50.61 Using where; Using index
+Warnings:
+Note 1003 select distinct `test`.`t2`.`a1` AS `a1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` = _latin1'i121') and (`test`.`t2`.`b` = _latin1'a') and (`test`.`t2`.`a2` >= _latin1'b'))
explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by
@@ -1800,15 +1804,19 @@ id select_type table type possible_keys key key_len ref rows Extra
explain select count(distinct a1,a2,b,c) from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index
-explain select count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 Using where; Using index
+explain extended select count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 75.00 Using where; Using index
+Warnings:
+Note 1003 select count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`) AS `count(distinct a1,a2,b)` from `test`.`t1` where ((`test`.`t1`.`b` = _latin1'c') and (`test`.`t1`.`a1` > _latin1'a') and (`test`.`t1`.`a2` > _latin1'a'))
explain select count(distinct b) from t1 where (a2 >= 'b') and (b = 'a');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using where; Using index
-explain select ord(a1) + count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a');
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 Using where; Using index
+explain extended select ord(a1) + count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a');
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 75.00 Using where; Using index
+Warnings:
+Note 1003 select (ord(`test`.`t1`.`a1`) + count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`)) AS `ord(a1) + count(distinct a1,a2,b)` from `test`.`t1` where ((`test`.`t1`.`a1` > _latin1'a') and (`test`.`t1`.`a2` > _latin1'a'))
select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a');
count(distinct a1,a2,b)
4
@@ -1911,24 +1919,32 @@ id select_type table type possible_keys key key_len ref rows Extra
explain select a1,a2,b,d from t1 group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 128 Using temporary; Using filesort
-explain select a1,a2,min(b),max(b) from t1
+explain extended select a1,a2,min(b),max(b) from t1
where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a111') group by a1,a2;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 76 Using where; Using index
-explain select a1,a2,b,min(c),max(c) from t1
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 76 85.53 Using where; Using index
+Warnings:
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,min(`test`.`t1`.`b`) AS `min(b)`,max(`test`.`t1`.`b`) AS `max(b)` from `test`.`t1` where (((`test`.`t1`.`a1` = _latin1'b') or (`test`.`t1`.`a1` = _latin1'd') or (`test`.`t1`.`a1` = _latin1'a') or (`test`.`t1`.`a1` = _latin1'c')) and (`test`.`t1`.`a2` > _latin1'a') and (`test`.`t1`.`c` > _latin1'a111')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`
+explain extended select a1,a2,b,min(c),max(c) from t1
where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 Using where; Using temporary; Using filesort
-explain select a1,a2,b,c from t1
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 50.78 Using where; Using temporary; Using filesort
+Warnings:
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,min(`test`.`t1`.`c`) AS `min(c)`,max(`test`.`t1`.`c`) AS `max(c)` from `test`.`t1` where (((`test`.`t1`.`a1` = _latin1'b') or (`test`.`t1`.`a1` = _latin1'd') or (`test`.`t1`.`a1` = _latin1'a') or (`test`.`t1`.`a1` = _latin1'c')) and (`test`.`t1`.`a2` > _latin1'a') and (`test`.`t1`.`d` > _latin1'xy2')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
+explain extended select a1,a2,b,c from t1
where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b,c;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 Using where; Using temporary; Using filesort
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 50.78 Using where; Using temporary; Using filesort
+Warnings:
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (((`test`.`t1`.`a1` = _latin1'b') or (`test`.`t1`.`a1` = _latin1'd') or (`test`.`t1`.`a1` = _latin1'a') or (`test`.`t1`.`a1` = _latin1'c')) and (`test`.`t1`.`a2` > _latin1'a') and (`test`.`t1`.`d` > _latin1'xy2')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`,`test`.`t1`.`c`
explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') or (b < 'b') group by a1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
-explain select a1,a2,b from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a111') group by a1,a2,b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 76 Using where; Using index
+explain extended select a1,a2,b from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a111') group by a1,a2,b;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 76 85.53 Using where; Using index
+Warnings:
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (((`test`.`t1`.`a1` = _latin1'b') or (`test`.`t1`.`a1` = _latin1'd') or (`test`.`t1`.`a1` = _latin1'a') or (`test`.`t1`.`a1` = _latin1'c')) and (`test`.`t1`.`a2` > _latin1'a') and (`test`.`t1`.`c` > _latin1'a111')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
explain select a1,a2,min(b),c from t2 where (a2 = 'a') and (c = 'a111') group by a1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
@@ -1948,12 +1964,16 @@ id select_type table type possible_keys key key_len ref rows Extra
explain select a1,a2,count(a2) from t1 group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 Using index
-explain select a1,a2,count(a2) from t1 where (a1 > 'a') group by a1,a2,b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 128 Using where; Using index
-explain select sum(ord(a1)) from t1 where (a1 > 'a') group by a1,a2,b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 128 Using where; Using index
+explain extended select a1,a2,count(a2) from t1 where (a1 > 'a') group by a1,a2,b;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 128 75.00 Using where; Using index
+Warnings:
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,count(`test`.`t1`.`a2`) AS `count(a2)` from `test`.`t1` where (`test`.`t1`.`a1` > _latin1'a') group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
+explain extended select sum(ord(a1)) from t1 where (a1 > 'a') group by a1,a2,b;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 128 75.00 Using where; Using index
+Warnings:
+Note 1003 select sum(ord(`test`.`t1`.`a1`)) AS `sum(ord(a1))` from `test`.`t1` where (`test`.`t1`.`a1` > _latin1'a') group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
explain select distinct(a1) from t1 where ord(a2) = 98;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index
diff --git a/mysql-test/r/group_min_max_innodb.result b/mysql-test/r/group_min_max_innodb.result
new file mode 100644
index 00000000000..ae4b9d4d5dd
--- /dev/null
+++ b/mysql-test/r/group_min_max_innodb.result
@@ -0,0 +1,72 @@
+create table t4 (
+pk_col int auto_increment primary key, a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
+) engine=innodb;
+insert into t4 (a1, a2, b, c, d) values
+('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
+('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
+('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
+('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
+('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
+('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
+('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
+('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
+('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
+('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
+('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
+('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
+('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
+('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
+('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
+('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'),
+('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
+('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
+('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
+('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
+('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
+('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
+('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
+('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
+('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
+('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
+('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
+('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
+('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
+('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
+('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
+('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4');
+create index idx12672_0 on t4 (a1);
+create index idx12672_1 on t4 (a1,a2,b,c);
+create index idx12672_2 on t4 (a1,a2,b);
+analyze table t4;
+Table Op Msg_type Msg_text
+test.t4 analyze status OK
+select distinct a1 from t4 where pk_col not in (1,2,3,4);
+a1
+a
+b
+c
+d
+drop table t4;
+create table t1 (
+a varchar(30), b varchar(30), primary key(a), key(b)
+) engine=innodb;
+select distinct a from t1;
+a
+drop table t1;
+create table t1(a int, key(a)) engine=innodb;
+insert into t1 values(1);
+select a, count(a) from t1 group by a with rollup;
+a count(a)
+1 1
+NULL 1
+drop table t1;
+create table t1 (f1 int, f2 char(1), primary key(f1,f2)) engine=innodb;
+insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d");
+alter table t1 drop primary key, add primary key (f2, f1);
+explain select distinct f1 a, f1 b from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index; Using temporary
+explain select distinct f1, f2 from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range NULL PRIMARY 5 NULL 3 Using index for group-by; Using temporary
+drop table t1;
diff --git a/mysql-test/r/handler_innodb.result b/mysql-test/r/handler_innodb.result
new file mode 100644
index 00000000000..1bd50612a3f
--- /dev/null
+++ b/mysql-test/r/handler_innodb.result
@@ -0,0 +1,517 @@
+SET SESSION STORAGE_ENGINE = InnoDB;
+drop table if exists t1,t3,t4,t5;
+create table t1 (a int, b char(10), key a(a), key b(a,b));
+insert into t1 values
+(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"),
+(14,"aaa"),(15,"bbb"),(16,"ccc"),(16,"xxx"),
+(20,"ggg"),(21,"hhh"),(22,"iii");
+handler t1 open as t2;
+handler t2 read a=(SELECT 1);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT 1)' at line 1
+handler t2 read a first;
+a b
+14 aaa
+handler t2 read a next;
+a b
+15 bbb
+handler t2 read a next;
+a b
+16 ccc
+handler t2 read a prev;
+a b
+15 bbb
+handler t2 read a last;
+a b
+22 iii
+handler t2 read a prev;
+a b
+21 hhh
+handler t2 read a prev;
+a b
+20 ggg
+handler t2 read a first;
+a b
+14 aaa
+handler t2 read a prev;
+a b
+handler t2 read a last;
+a b
+22 iii
+handler t2 read a prev;
+a b
+21 hhh
+handler t2 read a next;
+a b
+22 iii
+handler t2 read a next;
+a b
+handler t2 read a=(15);
+a b
+15 bbb
+handler t2 read a=(16);
+a b
+16 ccc
+handler t2 read a=(19,"fff");
+ERROR 42000: Too many key parts specified; max 1 parts allowed
+handler t2 read b=(19,"fff");
+a b
+19 fff
+handler t2 read b=(19,"yyy");
+a b
+19 yyy
+handler t2 read b=(19);
+a b
+19 fff
+handler t1 read a last;
+ERROR 42S02: Unknown table 't1' in HANDLER
+handler t2 read a=(11);
+a b
+handler t2 read a>=(11);
+a b
+14 aaa
+handler t2 read a=(18);
+a b
+18 eee
+handler t2 read a>=(18);
+a b
+18 eee
+handler t2 read a>(18);
+a b
+19 fff
+handler t2 read a<=(18);
+a b
+18 eee
+handler t2 read a<(18);
+a b
+17 ddd
+handler t2 read a first limit 5;
+a b
+14 aaa
+15 bbb
+16 ccc
+16 xxx
+17 ddd
+handler t2 read a next limit 3;
+a b
+18 eee
+19 fff
+19 yyy
+handler t2 read a prev limit 10;
+a b
+19 fff
+18 eee
+17 ddd
+16 xxx
+16 ccc
+15 bbb
+14 aaa
+handler t2 read a>=(16) limit 4;
+a b
+16 ccc
+16 xxx
+17 ddd
+18 eee
+handler t2 read a>=(16) limit 2,2;
+a b
+17 ddd
+18 eee
+handler t2 read a last limit 3;
+a b
+22 iii
+21 hhh
+20 ggg
+handler t2 read a=(19);
+a b
+19 fff
+handler t2 read a=(19) where b="yyy";
+a b
+19 yyy
+handler t2 read first;
+a b
+17 ddd
+handler t2 read next;
+a b
+18 eee
+handler t2 read next;
+a b
+19 fff
+handler t2 read last;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+handler t2 close;
+handler t1 open;
+handler t1 read a next;
+a b
+14 aaa
+handler t1 read a next;
+a b
+15 bbb
+handler t1 close;
+handler t1 open;
+handler t1 read a prev;
+a b
+22 iii
+handler t1 read a prev;
+a b
+21 hhh
+handler t1 close;
+handler t1 open as t2;
+handler t2 read first;
+a b
+17 ddd
+alter table t1 engine = InnoDB;
+handler t2 read first;
+ERROR 42S02: Unknown table 't2' in HANDLER
+handler t1 open as t2;
+drop table t1;
+create table t1 (a int);
+insert into t1 values (17);
+handler t2 read first;
+ERROR 42S02: Unknown table 't2' in HANDLER
+handler t1 open as t2;
+alter table t1 engine=MEMORY;
+handler t2 read first;
+ERROR 42S02: Unknown table 't2' in HANDLER
+drop table t1;
+create table t1 (a int);
+insert into t1 values (1),(2),(3),(4),(5),(6);
+delete from t1 limit 2;
+handler t1 open;
+handler t1 read first;
+a
+3
+handler t1 read first limit 1,1;
+a
+4
+handler t1 read first limit 2,2;
+a
+5
+6
+delete from t1 limit 3;
+handler t1 read first;
+a
+6
+drop table t1;
+create table t1(a int, index(a));
+insert into t1 values (1), (2), (3);
+handler t1 open;
+handler t1 read a=(W);
+ERROR 42S22: Unknown column 'W' in 'field list'
+handler t1 read a=(a);
+ERROR HY000: Incorrect arguments to HANDLER ... READ
+drop table t1;
+create table t1 (a char(5));
+insert into t1 values ("Ok");
+handler t1 open as t;
+handler t read first;
+a
+Ok
+use mysql;
+handler t read first;
+a
+Ok
+handler t close;
+handler test.t1 open as t;
+handler t read first;
+a
+Ok
+handler t close;
+use test;
+drop table t1;
+create table t1 ( a int, b int, INDEX a (a) );
+insert into t1 values (1,2), (2,1);
+handler t1 open;
+handler t1 read a=(1) where b=2;
+a b
+1 2
+handler t1 read a=(1) where b=3;
+a b
+handler t1 read a=(1) where b=1;
+a b
+handler t1 close;
+drop table t1;
+drop database if exists test_test;
+create database test_test;
+use test_test;
+create table t1(table_id char(20) primary key);
+insert into t1 values ('test_test.t1');
+insert into t1 values ('');
+handler t1 open;
+handler t1 read first limit 9;
+table_id
+
+test_test.t1
+create table t2(table_id char(20) primary key);
+insert into t2 values ('test_test.t2');
+insert into t2 values ('');
+handler t2 open;
+handler t2 read first limit 9;
+table_id
+
+test_test.t2
+use test;
+drop table if exists t1;
+create table t1(table_id char(20) primary key);
+insert into t1 values ('test.t1');
+insert into t1 values ('');
+handler t1 open;
+ERROR 42000: Not unique table/alias: 't1'
+use test;
+handler test.t1 read first limit 9;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1
+handler test_test.t1 read first limit 9;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1
+handler t1 read first limit 9;
+table_id
+
+test_test.t1
+handler test_test.t2 read first limit 9;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1
+handler t2 read first limit 9;
+table_id
+
+test_test.t2
+handler test_test.t1 close;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1
+handler t1 close;
+drop table test_test.t1;
+handler test_test.t2 close;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1
+handler t2 close;
+drop table test_test.t2;
+drop database test_test;
+use test;
+handler test.t1 close;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1
+handler t1 close;
+ERROR 42S02: Unknown table 't1' in HANDLER
+drop table test.t1;
+drop database if exists test_test;
+drop table if exists t1;
+drop table if exists t2;
+drop table if exists t3;
+create database test_test;
+use test_test;
+create table t1 (c1 char(20));
+insert into t1 values ('test_test.t1');
+create table t3 (c1 char(20));
+insert into t3 values ('test_test.t3');
+handler t1 open;
+handler t1 read first limit 9;
+c1
+test_test.t1
+handler t1 open h1;
+handler h1 read first limit 9;
+c1
+test_test.t1
+use test;
+create table t1 (c1 char(20));
+create table t2 (c1 char(20));
+create table t3 (c1 char(20));
+insert into t1 values ('t1');
+insert into t2 values ('t2');
+insert into t3 values ('t3');
+handler t1 open;
+ERROR 42000: Not unique table/alias: 't1'
+handler t2 open t1;
+ERROR 42000: Not unique table/alias: 't1'
+handler t3 open t1;
+ERROR 42000: Not unique table/alias: 't1'
+handler t1 read first limit 9;
+c1
+test_test.t1
+handler test.t1 close;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1
+handler test.t1 open h1;
+ERROR 42000: Not unique table/alias: 'h1'
+handler test_test.t1 open h1;
+ERROR 42000: Not unique table/alias: 'h1'
+handler test_test.t3 open h3;
+handler test.t1 open h2;
+handler t1 read first limit 9;
+c1
+test_test.t1
+handler h1 read first limit 9;
+c1
+test_test.t1
+handler h2 read first limit 9;
+c1
+t1
+handler h3 read first limit 9;
+c1
+test_test.t3
+handler h2 read first limit 9;
+c1
+t1
+handler test.h1 close;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1
+handler t1 close;
+handler h1 close;
+handler h2 close;
+handler t1 read first limit 9;
+ERROR 42S02: Unknown table 't1' in HANDLER
+handler h1 read first limit 9;
+ERROR 42S02: Unknown table 'h1' in HANDLER
+handler h2 read first limit 9;
+ERROR 42S02: Unknown table 'h2' in HANDLER
+handler h3 read first limit 9;
+c1
+test_test.t3
+handler h3 read first limit 9;
+c1
+test_test.t3
+use test_test;
+handler h3 read first limit 9;
+c1
+test_test.t3
+handler test.h3 read first limit 9;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1
+handler h3 close;
+use test;
+drop table t3;
+drop table t2;
+drop table t1;
+drop database test_test;
+create table t1 (c1 char(20));
+insert into t1 values ("t1");
+handler t1 open as h1;
+handler h1 read first limit 9;
+c1
+t1
+create table t2 (c1 char(20));
+insert into t2 values ("t2");
+handler t2 open as h2;
+handler h2 read first limit 9;
+c1
+t2
+create table t3 (c1 char(20));
+insert into t3 values ("t3");
+handler t3 open as h3;
+handler h3 read first limit 9;
+c1
+t3
+create table t4 (c1 char(20));
+insert into t4 values ("t4");
+handler t4 open as h4;
+handler h4 read first limit 9;
+c1
+t4
+create table t5 (c1 char(20));
+insert into t5 values ("t5");
+handler t5 open as h5;
+handler h5 read first limit 9;
+c1
+t5
+alter table t1 engine=MyISAM;
+handler h1 read first limit 9;
+ERROR 42S02: Unknown table 'h1' in HANDLER
+handler h2 read first limit 9;
+c1
+t2
+handler h3 read first limit 9;
+c1
+t3
+handler h4 read first limit 9;
+c1
+t4
+handler h5 read first limit 9;
+c1
+t5
+alter table t5 engine=MyISAM;
+handler h1 read first limit 9;
+ERROR 42S02: Unknown table 'h1' in HANDLER
+handler h2 read first limit 9;
+c1
+t2
+handler h3 read first limit 9;
+c1
+t3
+handler h4 read first limit 9;
+c1
+t4
+handler h5 read first limit 9;
+ERROR 42S02: Unknown table 'h5' in HANDLER
+alter table t3 engine=MyISAM;
+handler h1 read first limit 9;
+ERROR 42S02: Unknown table 'h1' in HANDLER
+handler h2 read first limit 9;
+c1
+t2
+handler h3 read first limit 9;
+ERROR 42S02: Unknown table 'h3' in HANDLER
+handler h4 read first limit 9;
+c1
+t4
+handler h5 read first limit 9;
+ERROR 42S02: Unknown table 'h5' in HANDLER
+handler h2 close;
+handler h4 close;
+handler t1 open as h1_1;
+handler t1 open as h1_2;
+handler t1 open as h1_3;
+handler h1_1 read first limit 9;
+c1
+t1
+handler h1_2 read first limit 9;
+c1
+t1
+handler h1_3 read first limit 9;
+c1
+t1
+alter table t1 engine=InnoDB;
+handler h1_1 read first limit 9;
+ERROR 42S02: Unknown table 'h1_1' in HANDLER
+handler h1_2 read first limit 9;
+ERROR 42S02: Unknown table 'h1_2' in HANDLER
+handler h1_3 read first limit 9;
+ERROR 42S02: Unknown table 'h1_3' in HANDLER
+drop table t1;
+drop table t2;
+drop table t3;
+drop table t4;
+drop table t5;
+create table t1 (c1 int);
+insert into t1 values (1);
+handler t1 open;
+handler t1 read first;
+c1
+1
+send the below to another connection, do not wait for the result
+optimize table t1;
+proceed with the normal connection
+handler t1 read next;
+c1
+1
+handler t1 close;
+read the result from the other connection
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+proceed with the normal connection
+drop table t1;
+CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2));
+INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2);
+HANDLER t1 OPEN;
+HANDLER t1 READ `primary` = (1, 1000);
+no1 no2
+HANDLER t1 READ `primary` PREV;
+no1 no2
+1 275
+DROP TABLE t1;
+create table t1 (c1 int);
+insert into t1 values (14397);
+flush tables with read lock;
+drop table t1;
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+send the below to another connection, do not wait for the result
+drop table t1;
+proceed with the normal connection
+select * from t1;
+c1
+14397
+unlock tables;
+read the result from the other connection
+proceed with the normal connection
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 't1'
diff --git a/mysql-test/r/handler.result b/mysql-test/r/handler_myisam.result
index 85cf47b5806..beb1a40c318 100644
--- a/mysql-test/r/handler.result
+++ b/mysql-test/r/handler_myisam.result
@@ -1,3 +1,4 @@
+SET SESSION STORAGE_ENGINE = MyISAM;
drop table if exists t1,t3,t4,t5;
create table t1 (a int, b char(10), key a(a), key b(a,b));
insert into t1 values
@@ -137,6 +138,29 @@ a b
handler t2 read last;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
handler t2 close;
+handler t1 open;
+handler t1 read a next;
+a b
+14 aaa
+handler t1 read a next;
+a b
+15 bbb
+handler t1 close;
+handler t1 open;
+handler t1 read a prev;
+a b
+22 iii
+handler t1 read a prev;
+a b
+21 hhh
+handler t1 close;
+handler t1 open as t2;
+handler t2 read first;
+a b
+17 ddd
+alter table t1 engine = MyISAM;
+handler t2 read first;
+ERROR 42S02: Unknown table 't2' in HANDLER
handler t1 open as t2;
drop table t1;
create table t1 (a int);
@@ -144,7 +168,7 @@ insert into t1 values (17);
handler t2 read first;
ERROR 42S02: Unknown table 't2' in HANDLER
handler t1 open as t2;
-alter table t1 engine=MyISAM;
+alter table t1 engine=MEMORY;
handler t2 read first;
ERROR 42S02: Unknown table 't2' in HANDLER
drop table t1;
@@ -463,6 +487,15 @@ Table Op Msg_type Msg_text
test.t1 optimize status OK
proceed with the normal connection
drop table t1;
+CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2));
+INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2);
+HANDLER t1 OPEN;
+HANDLER t1 READ `primary` = (1, 1000);
+no1 no2
+HANDLER t1 READ `primary` PREV;
+no1 no2
+1 275
+DROP TABLE t1;
create table t1 (c1 int);
insert into t1 values (14397);
flush tables with read lock;
diff --git a/mysql-test/r/have_innodb.require b/mysql-test/r/have_binlog_format_mixed.require
index 48a764a6c58..4b752cbb314 100644
--- a/mysql-test/r/have_innodb.require
+++ b/mysql-test/r/have_binlog_format_mixed.require
@@ -1,2 +1,2 @@
Variable_name Value
-have_innodb YES
+binlog_format MIXED
diff --git a/mysql-test/r/have_archive.require b/mysql-test/r/have_binlog_format_row.require
index c4b4ba24fcd..09ad32dbb9a 100644
--- a/mysql-test/r/have_archive.require
+++ b/mysql-test/r/have_binlog_format_row.require
@@ -1,2 +1,2 @@
Variable_name Value
-have_archive YES
+binlog_format ROW
diff --git a/mysql-test/r/have_binlog_format_statement.require b/mysql-test/r/have_binlog_format_statement.require
new file mode 100644
index 00000000000..81e2e31cd6c
--- /dev/null
+++ b/mysql-test/r/have_binlog_format_statement.require
@@ -0,0 +1,2 @@
+Variable_name Value
+binlog_format STATEMENT
diff --git a/mysql-test/r/have_blackhole.require b/mysql-test/r/have_blackhole.require
deleted file mode 100644
index 15029a460f6..00000000000
--- a/mysql-test/r/have_blackhole.require
+++ /dev/null
@@ -1,2 +0,0 @@
-Variable_name Value
-have_blackhole_engine YES
diff --git a/mysql-test/r/have_csv.require b/mysql-test/r/have_csv.require
deleted file mode 100644
index cc2fb28289c..00000000000
--- a/mysql-test/r/have_csv.require
+++ /dev/null
@@ -1,2 +0,0 @@
-Variable_name Value
-have_csv YES
diff --git a/mysql-test/r/have_exampledb.require b/mysql-test/r/have_exampledb.require
deleted file mode 100644
index 29d0cf8b1a6..00000000000
--- a/mysql-test/r/have_exampledb.require
+++ /dev/null
@@ -1,2 +0,0 @@
-Variable_name Value
-have_example_engine YES
diff --git a/mysql-test/r/have_federated_db.require b/mysql-test/r/have_federated_db.require
deleted file mode 100644
index f4c521a8f35..00000000000
--- a/mysql-test/r/have_federated_db.require
+++ /dev/null
@@ -1,2 +0,0 @@
-Variable_name Value
-have_federated_engine YES
diff --git a/mysql-test/r/have_ndb.require b/mysql-test/r/have_ndb.require
deleted file mode 100644
index f0402b72c6a..00000000000
--- a/mysql-test/r/have_ndb.require
+++ /dev/null
@@ -1,2 +0,0 @@
-Variable_name Value
-have_ndbcluster YES
diff --git a/mysql-test/r/have_ndb_extra.require b/mysql-test/r/have_ndb_extra.require
new file mode 100644
index 00000000000..8f7c125196a
--- /dev/null
+++ b/mysql-test/r/have_ndb_extra.require
@@ -0,0 +1,3 @@
+select 1;
+1
+1
diff --git a/mysql-test/r/have_ndb_status_ok.require b/mysql-test/r/have_ndb_status_ok.require
deleted file mode 100644
index 8a82871234b..00000000000
--- a/mysql-test/r/have_ndb_status_ok.require
+++ /dev/null
@@ -1,2 +0,0 @@
-ndb_status_ok
-YES
diff --git a/mysql-test/r/have_ndbapi_examples.require b/mysql-test/r/have_ndbapi_examples.require
new file mode 100644
index 00000000000..924d2d51708
--- /dev/null
+++ b/mysql-test/r/have_ndbapi_examples.require
@@ -0,0 +1,2 @@
+have_ndb_example
+1
diff --git a/mysql-test/r/have_partition.require b/mysql-test/r/have_partition.require
new file mode 100644
index 00000000000..324c04eed6f
--- /dev/null
+++ b/mysql-test/r/have_partition.require
@@ -0,0 +1,2 @@
+Variable_name Value
+have_partitioning YES
diff --git a/mysql-test/r/have_raid.require b/mysql-test/r/have_raid.require
deleted file mode 100644
index 8390f4dbb85..00000000000
--- a/mysql-test/r/have_raid.require
+++ /dev/null
@@ -1,2 +0,0 @@
-Variable_name Value
-have_raid YES
diff --git a/mysql-test/r/have_row_based.require b/mysql-test/r/have_row_based.require
new file mode 100644
index 00000000000..c71451a95c3
--- /dev/null
+++ b/mysql-test/r/have_row_based.require
@@ -0,0 +1,2 @@
+Variable_name Value
+have_row_based_replication YES
diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result
index 68b13b5fc0a..721d17c97a4 100644
--- a/mysql-test/r/having.result
+++ b/mysql-test/r/having.result
@@ -9,8 +9,8 @@ select count(a) as b from t1 where a=0 having b >=0;
b
0
explain extended select count(a) as b from t1 where a=0 having b >=0;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Note 1003 select count(`test`.`t1`.`a`) AS `b` from `test`.`t1` where 0 having (`b` >= 0)
drop table t1;
diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result
index 906c431b834..29bdfcbef7a 100644
--- a/mysql-test/r/heap.result
+++ b/mysql-test/r/heap.result
@@ -166,7 +166,7 @@ alter table t1 add column new_col char(1) not null, add key (btn,new_col), drop
update t1 set new_col=left(btn,1);
explain select * from t1 where btn="a";
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL btn NULL NULL NULL 11 Using where
+1 SIMPLE t1 ALL btn NULL NULL NULL 14 Using where
explain select * from t1 where btn="a" and new_col="a";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref btn btn 11 const,const 2 Using where
@@ -195,7 +195,7 @@ SELECT * FROM t1 WHERE b<=>NULL;
a b
99 NULL
INSERT INTO t1 VALUES (1,3);
-ERROR 23000: Duplicate entry '3' for key 1
+ERROR 23000: Duplicate entry '3' for key 'b'
DROP TABLE t1;
CREATE TABLE t1 (
a int default NULL,
@@ -263,41 +263,41 @@ concat('*',v,'*',c,'*',t,'*')
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL,
- `t` varchar(50) default NULL
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
+ `t` varchar(50) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
create table t2 like t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL,
- `t` varchar(50) default NULL
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
+ `t` varchar(50) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
create table t3 select * from t1;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL,
- `t` varchar(50) default NULL
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
+ `t` varchar(50) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
alter table t1 modify c varchar(10);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(10) default NULL,
- `c` varchar(10) default NULL,
- `t` varchar(50) default NULL
+ `v` varchar(10) DEFAULT NULL,
+ `c` varchar(10) DEFAULT NULL,
+ `t` varchar(50) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
alter table t1 modify v char(10);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` char(10) default NULL,
- `c` varchar(10) default NULL,
- `t` varchar(50) default NULL
+ `v` char(10) DEFAULT NULL,
+ `c` varchar(10) DEFAULT NULL,
+ `t` varchar(50) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
alter table t1 modify t varchar(10);
Warnings:
@@ -305,9 +305,9 @@ Warning 1265 Data truncated for column 't' at row 2
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` char(10) default NULL,
- `c` varchar(10) default NULL,
- `t` varchar(10) default NULL
+ `v` char(10) DEFAULT NULL,
+ `c` varchar(10) DEFAULT NULL,
+ `t` varchar(10) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
select concat('*',v,'*',c,'*',t,'*') from t1;
concat('*',v,'*',c,'*',t,'*')
@@ -318,9 +318,9 @@ create table t1 (v varchar(10), c char(10), t varchar(50), key(v), key(c), key(t
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL,
- `t` varchar(50) default NULL,
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
+ `t` varchar(50) DEFAULT NULL,
KEY `v` (`v`),
KEY `c` (`c`),
KEY `t` (`t`(10))
@@ -384,7 +384,7 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a '
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const 10 Using where
alter table t1 add unique(v);
-ERROR 23000: Duplicate entry '{ ' for key 1
+ERROR 23000: Duplicate entry '{ ' for key 'v_2'
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a' order by length(concat('*',v,'*',c,'*',t,'*'));
qq
*a*a*a*
@@ -536,16 +536,16 @@ drop table t1;
create table t1 (a char(10), unique (a));
insert into t1 values ('a');
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a' for key 1
+ERROR 23000: Duplicate entry 'a' for key 'a'
alter table t1 modify a varchar(10);
insert into t1 values ('a '),('a '),('a '),('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
update t1 set a='a ' where a like 'a ';
update t1 set a='a ' where a like 'a ';
drop table t1;
@@ -553,12 +553,12 @@ create table t1 (v varchar(10), c char(10), t varchar(50), key using btree (v),
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL,
- `t` varchar(50) default NULL,
- KEY `v` USING BTREE (`v`),
- KEY `c` USING BTREE (`c`),
- KEY `t` USING BTREE (`t`(10))
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
+ `t` varchar(50) DEFAULT NULL,
+ KEY `v` (`v`) USING BTREE,
+ KEY `c` (`c`) USING BTREE,
+ KEY `t` (`t`(10)) USING BTREE
) ENGINE=MEMORY DEFAULT CHARSET=latin1
select count(*) from t1;
count(*)
@@ -607,7 +607,7 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a '
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const # Using where
alter table t1 add unique(v);
-ERROR 23000: Duplicate entry '{ ' for key 1
+ERROR 23000: Duplicate entry '{ ' for key 'v_2'
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a' order by length(concat('*',v,'*',c,'*',t,'*'));
qq
*a*a*a*
@@ -627,16 +627,16 @@ drop table t1;
create table t1 (a char(10), unique using btree (a)) engine=heap;
insert into t1 values ('a');
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a' for key 1
+ERROR 23000: Duplicate entry 'a' for key 'a'
alter table t1 modify a varchar(10);
insert into t1 values ('a '),('a '),('a '),('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
update t1 set a='a ' where a like 'a ';
update t1 set a='a ' where a like 'a ';
drop table t1;
@@ -644,9 +644,9 @@ create table t1 (v varchar(10), c char(10), t varchar(50), key(v(5)), key(c(5)),
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL,
- `t` varchar(50) default NULL,
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
+ `t` varchar(50) DEFAULT NULL,
KEY `v` (`v`(5)),
KEY `c` (`c`(5)),
KEY `t` (`t`(5))
@@ -656,7 +656,7 @@ create table t1 (v varchar(65530), key(v(10)));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(65530) default NULL,
+ `v` varchar(65530) DEFAULT NULL,
KEY `v` (`v`(10))
) ENGINE=MEMORY DEFAULT CHARSET=latin1
insert into t1 values(repeat('a',65530));
@@ -699,7 +699,7 @@ ERROR 42000: Incorrect table definition; there can be only one auto column and i
create table t1 (c char(255), primary key(c(90)));
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
-ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 1
+ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 'PRIMARY'
drop table t1;
CREATE TABLE t1 (a int, key(a)) engine=heap;
insert into t1 values (0);
diff --git a/mysql-test/r/heap_btree.result b/mysql-test/r/heap_btree.result
index 5b9c7f2244f..fd789a39d88 100644
--- a/mysql-test/r/heap_btree.result
+++ b/mysql-test/r/heap_btree.result
@@ -224,7 +224,7 @@ SELECT * FROM t1 WHERE b<=>NULL;
a b
99 NULL
INSERT INTO t1 VALUES (1,3);
-ERROR 23000: Duplicate entry '3' for key 1
+ERROR 23000: Duplicate entry '3' for key 'b'
DROP TABLE t1;
CREATE TABLE t1 (a int, b int, c int, key using BTREE (a, b, c)) engine=heap;
INSERT INTO t1 VALUES (1, NULL, NULL), (1, 1, NULL), (1, NULL, 1);
diff --git a/mysql-test/r/heap_hash.result b/mysql-test/r/heap_hash.result
index 80abcebbfea..41f00fd2ad8 100644
--- a/mysql-test/r/heap_hash.result
+++ b/mysql-test/r/heap_hash.result
@@ -166,7 +166,7 @@ alter table t1 add column new_col char(1) not null, add key using HASH (btn,new_
update t1 set new_col=left(btn,1);
explain select * from t1 where btn="a";
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL btn NULL NULL NULL 11 Using where
+1 SIMPLE t1 ALL btn NULL NULL NULL 14 Using where
explain select * from t1 where btn="a" and new_col="a";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref btn btn 11 const,const 2 Using where
@@ -195,7 +195,7 @@ SELECT * FROM t1 WHERE b<=>NULL;
a b
99 NULL
INSERT INTO t1 VALUES (1,3);
-ERROR 23000: Duplicate entry '3' for key 1
+ERROR 23000: Duplicate entry '3' for key 'b'
DROP TABLE t1;
CREATE TABLE t1 (a int not null, primary key using HASH (a)) engine=heap;
INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
diff --git a/mysql-test/r/im_cmd_line.result b/mysql-test/r/im_cmd_line.result
new file mode 100644
index 00000000000..a4c21c36415
--- /dev/null
+++ b/mysql-test/r/im_cmd_line.result
@@ -0,0 +1,47 @@
+SHOW VARIABLES LIKE 'server_id';
+Variable_name Value
+server_id 1
+SHOW INSTANCES;
+instance_name state
+mysqld1 starting
+mysqld2 offline
+--> Listing users...
+im_admin
+
+==> Adding user 'testuser'...
+
+--> IM password file:
+testuser:*0D3CED9BEC10A777AEC23CCC353A8C08A633045E
+im_admin:*598D51AD2DFF7792045D6DF3DDF9AA1AF737B295
+--> EOF
+
+--> Printing out line for 'testuser'...
+testuser:*0D3CED9BEC10A777AEC23CCC353A8C08A633045E
+
+--> Listing users...
+im_admin
+testuser
+
+==> Changing the password of 'testuser'...
+
+--> IM password file:
+im_admin:*598D51AD2DFF7792045D6DF3DDF9AA1AF737B295
+testuser:*39C549BDECFBA8AFC3CE6B948C9359A0ECE08DE2
+--> EOF
+
+--> Printing out line for 'testuser'...
+testuser:*39C549BDECFBA8AFC3CE6B948C9359A0ECE08DE2
+
+--> Listing users...
+testuser
+im_admin
+
+==> Dropping user 'testuser'...
+
+--> IM password file:
+im_admin:*598D51AD2DFF7792045D6DF3DDF9AA1AF737B295
+--> EOF
+
+--> Listing users...
+im_admin
+
diff --git a/mysql-test/r/im_daemon_life_cycle.result b/mysql-test/r/im_daemon_life_cycle.result
index b842a5f3bf9..397f4d5d503 100644
--- a/mysql-test/r/im_daemon_life_cycle.result
+++ b/mysql-test/r/im_daemon_life_cycle.result
@@ -2,7 +2,7 @@ SHOW VARIABLES LIKE 'server_id';
Variable_name Value
server_id 1
SHOW INSTANCES;
-instance_name status
+instance_name state
mysqld1 online
mysqld2 offline
Killing the process...
@@ -20,7 +20,7 @@ Sleeping...
Success: the process was restarted.
Success: server is ready to accept connection on socket.
SHOW INSTANCE STATUS mysqld1;
-instance_name status version
-mysqld1 online VERSION
+instance_name state version_number version mysqld_compatible
+mysqld1 online VERSION_NUMBER VERSION no
STOP INSTANCE mysqld2;
Success: the process has been stopped.
diff --git a/mysql-test/r/im_instance_conf.result b/mysql-test/r/im_instance_conf.result
new file mode 100644
index 00000000000..597a1be428e
--- /dev/null
+++ b/mysql-test/r/im_instance_conf.result
@@ -0,0 +1,225 @@
+SHOW VARIABLES LIKE 'server_id';
+Variable_name Value
+server_id 1
+SHOW INSTANCES;
+instance_name state
+mysqld1 online
+mysqld2 offline
+--------------------------------------------------------------------
+server_id = 1
+server_id = 2
+--------------------------------------------------------------------
+CREATE INSTANCE mysqld3
+server_id = 3,
+socket = "$MYSQL_TMP_DIR/mysqld_3.sock";
+SHOW INSTANCES;
+instance_name state
+mysqld3 offline
+mysqld2 offline
+mysqld1 online
+--------------------------------------------------------------------
+server_id = 1
+server_id = 2
+server_id=3
+--------------------------------------------------------------------
+CREATE INSTANCE mysqld1;
+ERROR HY000: Instance already exists
+CREATE INSTANCE mysqld2;
+ERROR HY000: Instance already exists
+CREATE INSTANCE mysqld3;
+ERROR HY000: Instance already exists
+--------------------------------------------------------------------
+nonguarded
+--------------------------------------------------------------------
+CREATE INSTANCE mysqld4
+nonguarded,
+server_id = 4,
+socket = "$MYSQL_TMP_DIR/mysqld_4.sock";
+SHOW INSTANCES;
+instance_name state
+mysqld3 offline
+mysqld4 offline
+mysqld1 online
+mysqld2 offline
+--------------------------------------------------------------------
+nonguarded
+nonguarded
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+CREATE INSTANCE mysqld5
+test-A = 000,
+test-B = test,
+server_id = 5,
+socket = "$MYSQL_TMP_DIR/mysqld_5.sock";
+SHOW INSTANCES;
+instance_name state
+mysqld1 online
+mysqld4 offline
+mysqld5 offline
+mysqld2 offline
+mysqld3 offline
+--------------------------------------------------------------------
+test-A=000
+--------------------------------------------------------------------
+test-B=test
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+CREATE INSTANCE mysqld6
+test-C1 = 10 ,
+test-C2 = 02 ,
+server_id = 6,
+socket = "$MYSQL_TMP_DIR/mysqld_6.sock";
+SHOW INSTANCES;
+instance_name state
+mysqld1 online
+mysqld2 offline
+mysqld5 offline
+mysqld6 offline
+mysqld3 offline
+mysqld4 offline
+--------------------------------------------------------------------
+test-C1=10
+--------------------------------------------------------------------
+test-C2=02
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+CREATE INSTANCE mysqld7 test-D = test-D-value ;
+ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
+SHOW INSTANCES;
+instance_name state
+mysqld1 online
+mysqld2 offline
+mysqld5 offline
+mysqld6 offline
+mysqld3 offline
+mysqld4 offline
+CREATE INSTANCE mysqld8 test-E 0 ;
+ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
+SHOW INSTANCES;
+instance_name state
+mysqld1 online
+mysqld2 offline
+mysqld5 offline
+mysqld6 offline
+mysqld3 offline
+mysqld4 offline
+CREATE INSTANCE mysqld8 test-F = ;
+ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
+SHOW INSTANCES;
+instance_name state
+mysqld1 online
+mysqld2 offline
+mysqld5 offline
+mysqld6 offline
+mysqld3 offline
+mysqld4 offline
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+CREATE INSTANCE mysqld9
+test-1=" hello world ",
+test-2=' ',
+server_id = 9,
+socket = "$MYSQL_TMP_DIR/mysqld_9.sock";
+SHOW INSTANCES;
+instance_name state
+mysqld1 online
+mysqld2 offline
+mysqld5 offline
+mysqld6 offline
+mysqld3 offline
+mysqld4 offline
+mysqld9 offline
+CREATE INSTANCE mysqld10
+test-3='\b\babc\sdef',
+server_id = 10,
+socket = "$MYSQL_TMP_DIR/mysqld_10.sock";
+SHOW INSTANCES;
+instance_name state
+mysqld1 online
+mysqld9 offline
+mysqld5 offline
+mysqld6 offline
+mysqld3 offline
+mysqld4 offline
+mysqld10 offline
+mysqld2 offline
+CREATE INSTANCE mysqld11
+test-4='abc\tdef',
+test-5='abc\ndef',
+server_id = 11,
+socket = "$MYSQL_TMP_DIR/mysqld_11.sock";
+SHOW INSTANCES;
+instance_name state
+mysqld1 online
+mysqld11 offline
+mysqld5 offline
+mysqld6 offline
+mysqld3 offline
+mysqld4 offline
+mysqld10 offline
+mysqld2 offline
+mysqld9 offline
+CREATE INSTANCE mysqld12
+test-6="abc\rdef",
+test-7="abc\\def",
+server_id = 12,
+socket = "$MYSQL_TMP_DIR/mysqld_12.sock";
+SHOW INSTANCES;
+instance_name state
+mysqld1 online
+mysqld9 offline
+mysqld5 offline
+mysqld6 offline
+mysqld3 offline
+mysqld4 offline
+mysqld10 offline
+mysqld2 offline
+mysqld12 offline
+mysqld11 offline
+CREATE INSTANCE mysqld13 test-bad=' \ ';
+ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
+SHOW INSTANCES;
+instance_name state
+mysqld1 online
+mysqld9 offline
+mysqld5 offline
+mysqld6 offline
+mysqld3 offline
+mysqld4 offline
+mysqld10 offline
+mysqld2 offline
+mysqld12 offline
+mysqld11 offline
+--------------------------------------------------------------------
+test-1= hello world
+--------------------------------------------------------------------
+test-2=
+--------------------------------------------------------------------
+test-3=abc def
+--------------------------------------------------------------------
+test-4=abc def
+--------------------------------------------------------------------
+test-5=abc
+--------------------------------------------------------------------
+test-6=abc def
+--------------------------------------------------------------------
+test-7=abc\def
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+CREATE INSTANCE qqq1;
+ERROR HY000: Malformed instance name.
diff --git a/mysql-test/r/im_life_cycle.result b/mysql-test/r/im_life_cycle.result
index 69f6bb5a490..c403411c399 100644
--- a/mysql-test/r/im_life_cycle.result
+++ b/mysql-test/r/im_life_cycle.result
@@ -2,7 +2,7 @@ SHOW VARIABLES LIKE 'server_id';
Variable_name Value
server_id 1
SHOW INSTANCES;
-instance_name status
+instance_name state
mysqld1 online
mysqld2 offline
@@ -25,7 +25,7 @@ Success: the process has been stopped.
-- 1.1.4.
--------------------------------------------------------------------
START INSTANCE mysqld3;
-ERROR HY000: Bad instance name. Check that the instance with such a name exists
+ERROR HY000: Unknown instance name
START INSTANCE mysqld1;
ERROR HY000: The instance is already started
@@ -33,7 +33,7 @@ ERROR HY000: The instance is already started
-- 1.1.5.
--------------------------------------------------------------------
STOP INSTANCE mysqld3;
-ERROR HY000: Bad instance name. Check that the instance with such a name exists
+ERROR HY000: Unknown instance name
--------------------------------------------------------------------
-- 1.1.6.
@@ -42,7 +42,7 @@ Killing the process...
Sleeping...
Success: the process was restarted.
SHOW INSTANCES;
-instance_name status
+instance_name state
mysqld1 online
mysqld2 offline
diff --git a/mysql-test/r/im_options.result b/mysql-test/r/im_options.result
new file mode 100644
index 00000000000..f35f226f665
--- /dev/null
+++ b/mysql-test/r/im_options.result
@@ -0,0 +1,153 @@
+--------------------------------------------------------------------
+server_id = 1
+server_id = 2
+--------------------------------------------------------------------
+SHOW VARIABLES LIKE 'server_id';
+Variable_name Value
+server_id 1
+SHOW INSTANCES;
+instance_name state
+mysqld1 starting
+mysqld2 offline
+UNSET mysqld1.server_id;
+ERROR HY000: The instance is active. Stop the instance first
+SET mysqld1.server_id = 11;
+ERROR HY000: The instance is active. Stop the instance first
+CREATE INSTANCE mysqld3
+datadir = '/',
+server_id = 3,
+socket = "$MYSQL_TMP_DIR/mysqld_3.sock";
+START INSTANCE mysqld3;
+UNSET mysqld3.server_id;
+ERROR HY000: The instance is active. Stop the instance first
+SET mysqld3.server_id = 11;
+ERROR HY000: The instance is active. Stop the instance first
+STOP INSTANCE mysqld3;
+SHOW INSTANCE STATUS mysqld3;
+instance_name state version_number version mysqld_compatible
+mysqld3 offline VERSION_NUMBER VERSION no
+UNSET mysqld2.server_id;
+UNSET mysqld2.server_id;
+SHOW INSTANCE OPTIONS mysqld2;
+option_name value
+instance_name option_value
+socket option_value
+pid-file option_value
+port option_value
+datadir option_value
+log option_value
+log-error option_value
+log-slow-queries option_value
+language option_value
+character-sets-dir option_value
+basedir option_value
+skip-stack-trace option_value
+skip-innodb option_value
+skip-ndbcluster option_value
+nonguarded option_value
+log-output option_value
+SET mysqld2.server_id = 2;
+SET mysqld2.server_id = 2;
+SHOW INSTANCE OPTIONS mysqld2;
+option_name value
+instance_name option_value
+socket option_value
+pid-file option_value
+port option_value
+datadir option_value
+log option_value
+log-error option_value
+log-slow-queries option_value
+language option_value
+character-sets-dir option_value
+basedir option_value
+skip-stack-trace option_value
+skip-innodb option_value
+skip-ndbcluster option_value
+nonguarded option_value
+log-output option_value
+server_id option_value
+UNSET mysqld2.server_id = 11;
+ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
+SET mysqld2.aaa, mysqld3.bbb, mysqld2.ccc = 0010, mysqld3.ddd = 0020;
+--------------------------------------------------------------------
+aaa
+--------------------------------------------------------------------
+bbb
+--------------------------------------------------------------------
+ccc=0010
+--------------------------------------------------------------------
+ddd=0020
+--------------------------------------------------------------------
+UNSET mysqld2.aaa, mysqld3.bbb, mysqld2.ccc, mysqld3.ddd;
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+SET mysqld2.aaa, mysqld3.bbb, mysqld.ccc = 0010;
+ERROR HY000: Bad instance name. Check that the instance with such a name exists
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+SET mysqld2.aaa, mysqld3.bbb, mysqld1.ccc = 0010;
+ERROR HY000: The instance is active. Stop the instance first
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+UNSET mysqld2.server_id, mysqld3.server_id, mysqld.ccc;
+ERROR HY000: Bad instance name. Check that the instance with such a name exists
+--------------------------------------------------------------------
+server_id = 1
+server_id=2
+server_id=3
+--------------------------------------------------------------------
+UNSET mysqld2.server_id, mysqld3.server_id, mysqld1.ccc;
+ERROR HY000: The instance is active. Stop the instance first
+--------------------------------------------------------------------
+server_id = 1
+server_id=2
+server_id=3
+--------------------------------------------------------------------
+DROP INSTANCE mysqld3;
+SET mysqld2.server_id=222;
+SET mysqld2.server_id = 222;
+SET mysqld2.server_id = 222 ;
+SET mysqld2 . server_id = 222 ;
+SET mysqld2 . server_id = 222 , mysqld2 . aaa , mysqld2 . bbb ;
+--------------------------------------------------------------------
+server_id = 1
+server_id=222
+--------------------------------------------------------------------
+aaa
+--------------------------------------------------------------------
+bbb
+--------------------------------------------------------------------
+UNSET mysqld2 . aaa , mysqld2 . bbb ;
+--------------------------------------------------------------------
+server_id = 1
+server_id=222
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+server_id = 1
+server_id=222
+--------------------------------------------------------------------
+SHOW VARIABLES LIKE 'server_id';
+Variable_name Value
+server_id 1
+SHOW INSTANCES;
+instance_name state
+mysqld1 online
+mysqld2 offline
+FLUSH INSTANCES;
+ERROR HY000: At least one instance is active. Stop all instances first
+STOP INSTANCE mysqld1;
+SHOW INSTANCES;
+instance_name state
+mysqld1 offline
+mysqld2 offline
+FLUSH INSTANCES;
diff --git a/mysql-test/r/im_options_set.result b/mysql-test/r/im_options_set.result
deleted file mode 100644
index f7b7e8eaef7..00000000000
--- a/mysql-test/r/im_options_set.result
+++ /dev/null
@@ -1,22 +0,0 @@
-SHOW VARIABLES LIKE 'server_id';
-Variable_name Value
-server_id 1
-SHOW INSTANCES;
-instance_name status
-mysqld1 online
-mysqld2 offline
-SET mysqld1.server_id = 11;
-server_id =11
-server_id = 2
-SHOW VARIABLES LIKE 'server_id';
-Variable_name Value
-server_id 1
-SET mysqld2.server_id = 12;
-server_id =11
-server_id =12
-FLUSH INSTANCES;
-server_id =11
-server_id =12
-SHOW VARIABLES LIKE 'server_id';
-Variable_name Value
-server_id 1
diff --git a/mysql-test/r/im_options_unset.result b/mysql-test/r/im_options_unset.result
deleted file mode 100644
index 2ab775e611a..00000000000
--- a/mysql-test/r/im_options_unset.result
+++ /dev/null
@@ -1,17 +0,0 @@
-SHOW VARIABLES LIKE 'server_id';
-Variable_name Value
-server_id 1
-SHOW INSTANCES;
-instance_name status
-mysqld1 online
-mysqld2 offline
-UNSET mysqld1.server_id;
-server_id = 2
-SHOW VARIABLES LIKE 'server_id';
-Variable_name Value
-server_id 1
-UNSET mysqld2.server_id;
-FLUSH INSTANCES;
-SHOW VARIABLES LIKE 'server_id';
-Variable_name Value
-server_id 1
diff --git a/mysql-test/r/im_utils.result b/mysql-test/r/im_utils.result
index 626f24b4635..6e40c9bb1c0 100644
--- a/mysql-test/r/im_utils.result
+++ b/mysql-test/r/im_utils.result
@@ -2,13 +2,12 @@ SHOW VARIABLES LIKE 'server_id';
Variable_name Value
server_id 1
SHOW INSTANCES;
-instance_name status
+instance_name state
mysqld1 online
mysqld2 offline
SHOW INSTANCE OPTIONS mysqld1;
option_name value
instance_name VALUE
-mysqld-path VALUE
socket VALUE
pid-file VALUE
port VALUE
@@ -23,12 +22,10 @@ server_id VALUE
skip-stack-trace VALUE
skip-innodb VALUE
skip-ndbcluster VALUE
-skip-bdb VALUE
+log-output VALUE
SHOW INSTANCE OPTIONS mysqld2;
option_name value
instance_name VALUE
-mysqld-path VALUE
-nonguarded VALUE
socket VALUE
pid-file VALUE
port VALUE
@@ -43,7 +40,8 @@ server_id VALUE
skip-stack-trace VALUE
skip-innodb VALUE
skip-ndbcluster VALUE
-skip-bdb VALUE
+nonguarded VALUE
+log-output VALUE
START INSTANCE mysqld2;
Success: the process has been started.
STOP INSTANCE mysqld2;
diff --git a/mysql-test/r/index_merge.result b/mysql-test/r/index_merge.result
deleted file mode 100644
index 3f3360e2da0..00000000000
--- a/mysql-test/r/index_merge.result
+++ /dev/null
@@ -1,457 +0,0 @@
-drop table if exists t0, t1, t2, t3, t4;
-create table t0
-(
-key1 int not null,
-INDEX i1(key1)
-);
-alter table t0 add key2 int not null, add index i2(key2);
-alter table t0 add key3 int not null, add index i3(key3);
-alter table t0 add key4 int not null, add index i4(key4);
-alter table t0 add key5 int not null, add index i5(key5);
-alter table t0 add key6 int not null, add index i6(key6);
-alter table t0 add key7 int not null, add index i7(key7);
-alter table t0 add key8 int not null, add index i8(key8);
-update t0 set key2=key1,key3=key1,key4=key1,key5=key1,key6=key1,key7=key1,key8=1024-key1;
-analyze table t0;
-Table Op Msg_type Msg_text
-test.t0 analyze status OK
-explain select * from t0 where key1 < 3 or key1 > 1020;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 range i1 i1 4 NULL 78 Using where
-explain
-select * from t0 where key1 < 3 or key2 > 1020;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 45 Using sort_union(i1,i2); Using where
-select * from t0 where key1 < 3 or key2 > 1020;
-key1 key2 key3 key4 key5 key6 key7 key8
-1 1 1 1 1 1 1 1023
-2 2 2 2 2 2 2 1022
-1021 1021 1021 1021 1021 1021 1021 3
-1022 1022 1022 1022 1022 1022 1022 2
-1023 1023 1023 1023 1023 1023 1023 1
-1024 1024 1024 1024 1024 1024 1024 0
-explain select * from t0 where key1 < 3 or key2 <4;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 7 Using sort_union(i1,i2); Using where
-explain
-select * from t0 where (key1 > 30 and key1<35) or (key2 >32 and key2 < 40);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 11 Using sort_union(i1,i2); Using where
-select * from t0 where (key1 > 30 and key1<35) or (key2 >32 and key2 < 40);
-key1 key2 key3 key4 key5 key6 key7 key8
-31 31 31 31 31 31 31 993
-32 32 32 32 32 32 32 992
-33 33 33 33 33 33 33 991
-34 34 34 34 34 34 34 990
-35 35 35 35 35 35 35 989
-36 36 36 36 36 36 36 988
-37 37 37 37 37 37 37 987
-38 38 38 38 38 38 38 986
-39 39 39 39 39 39 39 985
-explain select * from t0 ignore index (i2) where key1 < 3 or key2 <4;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 ALL i1 NULL NULL NULL 1024 Using where
-explain select * from t0 where (key1 < 3 or key2 <4) and key3 = 50;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 ref i1,i2,i3 i3 4 const 1 Using where
-explain select * from t0 use index (i1,i2) where (key1 < 3 or key2 <4) and key3 = 50;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 7 Using sort_union(i1,i2); Using where
-explain select * from t0 where (key1 > 1 or key2 > 2);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 ALL i1,i2 NULL NULL NULL 1024 Using where
-explain select * from t0 force index (i1,i2) where (key1 > 1 or key2 > 2);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 1024 Using sort_union(i1,i2); Using where
-explain
-select * from t0 where key1<3 or key2<3 or (key1>5 and key1<8) or
-(key1>10 and key1<12) or (key2>100 and key2<110);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 17 Using sort_union(i1,i2); Using where
-explain select * from t0 where key2 = 45 or key1 <=> null;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 range i1,i2 i2 4 NULL 1 Using where
-explain select * from t0 where key2 = 45 or key1 is not null;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 ALL i1,i2 NULL NULL NULL 1024 Using where
-explain select * from t0 where key2 = 45 or key1 is null;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 ref i2 i2 4 const 1
-explain select * from t0 where key2=10 or key3=3 or key4 <=> null;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i2,i3,i4 i2,i3 4,4 NULL 2 Using union(i2,i3); Using where
-explain select * from t0 where key2=10 or key3=3 or key4 is null;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i2,i3 i2,i3 4,4 NULL 2 Using union(i2,i3); Using where
-explain select key1 from t0 where (key1 <=> null) or (key2 < 5) or
-(key3=10) or (key4 <=> null);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i1,i2,i3,i4 i2,i3 4,4 NULL 6 Using sort_union(i2,i3); Using where
-explain select key1 from t0 where (key1 <=> null) or (key1 < 5) or
-(key3=10) or (key4 <=> null);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i1,i3,i4 i1,i3 4,4 NULL 6 Using sort_union(i1,i3); Using where
-explain select * from t0 where
-(key1 < 3 or key2 < 3) and (key3 < 4 or key4 < 4) and (key5 < 5 or key6 < 5);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i1,i2,i3,i4,i5,i6 i1,i2 4,4 NULL 6 Using sort_union(i1,i2); Using where
-explain
-select * from t0 where (key1 < 3 or key2 < 6) and (key1 < 7 or key3 < 4);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i1,i2,i3 i1,i2 4,4 NULL 9 Using sort_union(i1,i2); Using where
-select * from t0 where (key1 < 3 or key2 < 6) and (key1 < 7 or key3 < 4);
-key1 key2 key3 key4 key5 key6 key7 key8
-1 1 1 1 1 1 1 1023
-2 2 2 2 2 2 2 1022
-3 3 3 3 3 3 3 1021
-4 4 4 4 4 4 4 1020
-5 5 5 5 5 5 5 1019
-explain select * from t0 where
-(key1 < 3 or key2 < 3) and (key3 < 4 or key4 < 4) and (key5 < 2 or key6 < 2);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i1,i2,i3,i4,i5,i6 i1,i2 4,4 NULL 6 Using sort_union(i1,i2); Using where
-explain select * from t0 where
-(key1 < 3 or key2 < 3) and (key3 < 100);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 range i1,i2,i3 i3 4 NULL 95 Using where
-explain select * from t0 where
-(key1 < 3 or key2 < 3) and (key3 < 1000);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 ALL i1,i2,i3 NULL NULL NULL 1024 Using where
-explain select * from t0 where
-((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4))
-or
-key2 > 5;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 ALL i1,i2,i3 NULL NULL NULL 1024 Using where
-explain select * from t0 where
-((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4))
-or
-key1 < 7;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i1,i2,i3 i1,i2 4,4 NULL 10 Using sort_union(i1,i2); Using where
-select * from t0 where
-((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4))
-or
-key1 < 7;
-key1 key2 key3 key4 key5 key6 key7 key8
-1 1 1 1 1 1 1 1023
-2 2 2 2 2 2 2 1022
-3 3 3 3 3 3 3 1021
-4 4 4 4 4 4 4 1020
-5 5 5 5 5 5 5 1019
-6 6 6 6 6 6 6 1018
-explain select * from t0 where
-((key1 < 4 or key2 < 4) and (key3 <5 or key5 < 4))
-or
-((key5 < 5 or key6 < 6) and (key7 <7 or key8 < 4));
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i1,i2,i3,i5,i6,i7,i8 i1,i2,i5,i6 4,4,4,4 NULL 19 Using sort_union(i1,i2,i5,i6); Using where
-explain select * from t0 where
-((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
-or
-((key7 <7 or key8 < 4) and (key5 < 5 or key6 < 6));
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i1,i2,i3,i5,i6,i7,i8 i3,i5,i7,i8 4,4,4,4 NULL 20 Using sort_union(i3,i5,i7,i8); Using where
-explain select * from t0 where
-((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
-or
-((key3 <7 or key5 < 2) and (key5 < 5 or key6 < 6));
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i1,i2,i3,i5,i6 i3,i5 4,4 NULL 11 Using sort_union(i3,i5); Using where
-explain select * from t0 where
-((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
-or
-(((key3 <7 and key7 < 6) or key5 < 2) and (key5 < 5 or key6 < 6));
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i1,i2,i3,i5,i6,i7 i3,i5 4,4 NULL 11 Using sort_union(i3,i5); Using where
-explain select * from t0 where
-((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
-or
-((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6));
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 ALL i1,i2,i3,i5,i6 NULL NULL NULL 1024 Using where
-explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where
-((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
-or
-((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6));
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i1,i2,i3,i5,i6 i3,i5 0,4 NULL 1024 Using sort_union(i3,i5); Using where
-select * from t0 where key1 < 5 or key8 < 4 order by key1;
-key1 key2 key3 key4 key5 key6 key7 key8
-1 1 1 1 1 1 1 1023
-2 2 2 2 2 2 2 1022
-3 3 3 3 3 3 3 1021
-4 4 4 4 4 4 4 1020
-1021 1021 1021 1021 1021 1021 1021 3
-1022 1022 1022 1022 1022 1022 1022 2
-1023 1023 1023 1023 1023 1023 1023 1
-1024 1024 1024 1024 1024 1024 1024 0
-explain
-select * from t0 where key1 < 5 or key8 < 4 order by key1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i1,i8 i1,i8 4,4 NULL 9 Using sort_union(i1,i8); Using where; Using filesort
-create table t2 like t0;
-insert into t2 select * from t0;
-alter table t2 add index i1_3(key1, key3);
-alter table t2 add index i2_3(key2, key3);
-alter table t2 drop index i1;
-alter table t2 drop index i2;
-alter table t2 add index i321(key3, key2, key1);
-explain select key3 from t2 where key1 = 100 or key2 = 100;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 index_merge i1_3,i2_3 i1_3,i2_3 4,4 NULL 2 Using sort_union(i1_3,i2_3); Using where
-explain select key3 from t2 where key1 <100 or key2 < 100;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 index i1_3,i2_3 i321 12 NULL 1024 Using where; Using index
-explain select key7 from t2 where key1 <100 or key2 < 100;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL i1_3,i2_3 NULL NULL NULL 1024 Using where
-create table t4 (
-key1a int not null,
-key1b int not null,
-key2 int not null,
-key2_1 int not null,
-key2_2 int not null,
-key3 int not null,
-index i1a (key1a, key1b),
-index i1b (key1b, key1a),
-index i2_1(key2, key2_1),
-index i2_2(key2, key2_1)
-);
-insert into t4 select key1,key1,key1 div 10, key1 % 10, key1 % 10, key1 from t0;
-select * from t4 where key1a = 3 or key1b = 4;
-key1a key1b key2 key2_1 key2_2 key3
-3 3 0 3 3 3
-4 4 0 4 4 4
-explain select * from t4 where key1a = 3 or key1b = 4;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t4 index_merge i1a,i1b i1a,i1b 4,4 NULL 2 Using sort_union(i1a,i1b); Using where
-explain select * from t4 where key2 = 1 and (key2_1 = 1 or key3 = 5);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t4 ref i2_1,i2_2 i2_1 4 const 10 Using where
-explain select * from t4 where key2 = 1 and (key2_1 = 1 or key2_2 = 5);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t4 ref i2_1,i2_2 i2_1 4 const 10 Using where
-explain select * from t4 where key2_1 = 1 or key2_2 = 5;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t4 ALL NULL NULL NULL NULL 1024 Using where
-create table t1 like t0;
-insert into t1 select * from t0;
-explain select * from t0 left join t1 on (t0.key1=t1.key1)
-where t0.key1=3 or t0.key2=4;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
-1 SIMPLE t1 ref i1 i1 4 test.t0.key1 1
-select * from t0 left join t1 on (t0.key1=t1.key1)
-where t0.key1=3 or t0.key2=4;
-key1 key2 key3 key4 key5 key6 key7 key8 key1 key2 key3 key4 key5 key6 key7 key8
-3 3 3 3 3 3 3 1021 3 3 3 3 3 3 3 1021
-4 4 4 4 4 4 4 1020 4 4 4 4 4 4 4 1020
-explain
-select * from t0,t1 where (t0.key1=t1.key1) and ( t0.key1=3 or t0.key2=4);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
-1 SIMPLE t1 ref i1 i1 4 test.t0.key1 1
-explain
-select * from t0,t1 where (t0.key1=t1.key1) and
-(t0.key1=3 or t0.key2=4) and t1.key1<200;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 ALL i1,i2 NULL NULL NULL 1024 Using where
-1 SIMPLE t1 ref i1 i1 4 test.t0.key1 1
-explain
-select * from t0,t1 where (t0.key1=t1.key1) and
-(t0.key1=3 or t0.key2<4) and t1.key1=2;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 ref i1,i2 i1 4 const 1 Using where
-1 SIMPLE t1 ref i1 i1 4 const 1
-explain select * from t0,t1 where t0.key1 = 5 and
-(t1.key1 = t0.key1 or t1.key8 = t0.key1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 ref i1 i1 4 const 1
-1 SIMPLE t1 index_merge i1,i8 i1,i8 4,4 NULL 2 Using union(i1,i8); Using where
-explain select * from t0,t1 where t0.key1 < 3 and
-(t1.key1 = t0.key1 or t1.key8 = t0.key1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 range i1 i1 4 NULL 3 Using where
-1 SIMPLE t1 ALL i1,i8 NULL NULL NULL 1024 Range checked for each record (index map: 0x81)
-explain select * from t1 where key1=3 or key2=4
-union select * from t1 where key1<4 or key3=5;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
-2 UNION t1 index_merge i1,i3 i1,i3 4,4 NULL 5 Using sort_union(i1,i3); Using where
-NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
-explain select * from (select * from t1 where key1 = 3 or key2 =3) as Z where key8 >5;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived2> system NULL NULL NULL NULL 1
-2 DERIVED t1 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
-create table t3 like t0;
-insert into t3 select * from t0;
-alter table t3 add key9 int not null, add index i9(key9);
-alter table t3 add keyA int not null, add index iA(keyA);
-alter table t3 add keyB int not null, add index iB(keyB);
-alter table t3 add keyC int not null, add index iC(keyC);
-update t3 set key9=key1,keyA=key1,keyB=key1,keyC=key1;
-explain select * from t3 where
-key1=1 or key2=2 or key3=3 or key4=4 or
-key5=5 or key6=6 or key7=7 or key8=8 or
-key9=9 or keyA=10 or keyB=11 or keyC=12;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 index_merge i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC 4,4,4,4,4,4,4,4,4,4,4,4 NULL 12 Using union(i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC); Using where
-select * from t3 where
-key1=1 or key2=2 or key3=3 or key4=4 or
-key5=5 or key6=6 or key7=7 or key8=8 or
-key9=9 or keyA=10 or keyB=11 or keyC=12;
-key1 key2 key3 key4 key5 key6 key7 key8 key9 keyA keyB keyC
-1 1 1 1 1 1 1 1023 1 1 1 1
-2 2 2 2 2 2 2 1022 2 2 2 2
-3 3 3 3 3 3 3 1021 3 3 3 3
-4 4 4 4 4 4 4 1020 4 4 4 4
-5 5 5 5 5 5 5 1019 5 5 5 5
-6 6 6 6 6 6 6 1018 6 6 6 6
-7 7 7 7 7 7 7 1017 7 7 7 7
-9 9 9 9 9 9 9 1015 9 9 9 9
-10 10 10 10 10 10 10 1014 10 10 10 10
-11 11 11 11 11 11 11 1013 11 11 11 11
-12 12 12 12 12 12 12 1012 12 12 12 12
-1016 1016 1016 1016 1016 1016 1016 8 1016 1016 1016 1016
-explain select * from t0 where key1 < 3 or key2 < 4;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 7 Using sort_union(i1,i2); Using where
-select * from t0 where key1 < 3 or key2 < 4;
-key1 key2 key3 key4 key5 key6 key7 key8
-1 1 1 1 1 1 1 1023
-2 2 2 2 2 2 2 1022
-3 3 3 3 3 3 3 1021
-update t0 set key8=123 where key1 < 3 or key2 < 4;
-select * from t0 where key1 < 3 or key2 < 4;
-key1 key2 key3 key4 key5 key6 key7 key8
-1 1 1 1 1 1 1 123
-2 2 2 2 2 2 2 123
-3 3 3 3 3 3 3 123
-delete from t0 where key1 < 3 or key2 < 4;
-select * from t0 where key1 < 3 or key2 < 4;
-key1 key2 key3 key4 key5 key6 key7 key8
-select count(*) from t0;
-count(*)
-1021
-drop table t4;
-create table t4 (a int);
-insert into t4 values (1),(4),(3);
-set @save_join_buffer_size=@@join_buffer_size;
-set join_buffer_size= 4000;
-explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
-from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
-where (A.key1 < 500000 or A.key2 < 3)
-and (B.key1 < 500000 or B.key2 < 3);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE A index_merge i1,i2 i1,i2 4,4 NULL 1013 Using sort_union(i1,i2); Using where
-1 SIMPLE B index_merge i1,i2 i1,i2 4,4 NULL 1013 Using sort_union(i1,i2); Using where
-select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
-from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
-where (A.key1 < 500000 or A.key2 < 3)
-and (B.key1 < 500000 or B.key2 < 3);
-max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
-10240
-update t0 set key1=1;
-explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
-from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
-where (A.key1 = 1 or A.key2 = 1)
-and (B.key1 = 1 or B.key2 = 1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE A index_merge i1,i2 i1,i2 4,4 NULL 1020 Using union(i1,i2); Using where
-1 SIMPLE B index_merge i1,i2 i1,i2 4,4 NULL 1020 Using union(i1,i2); Using where
-select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
-from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
-where (A.key1 = 1 or A.key2 = 1)
-and (B.key1 = 1 or B.key2 = 1);
-max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
-8194
-alter table t0 add filler1 char(200), add filler2 char(200), add filler3 char(200);
-update t0 set key2=1, key3=1, key4=1, key5=1,key6=1,key7=1 where key7 < 500;
-explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
-from t0 as A, t0 as B
-where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1)
-and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE A index_merge i1,i2,i3,i4,i5,i6,i7?,i8 i2,i3,i4,i5,i6,i7?,i8 X NULL # Using union(intersect(i2,i3,i4,i5,i6,i7?),i8); Using where
-1 SIMPLE B index_merge i1,i2,i3,i4,i5,i6,i7?,i8 i2,i3,i4,i5,i6,i7?,i8 X NULL # Using union(intersect(i2,i3,i4,i5,i6,i7?),i8); Using where
-select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
-from t0 as A, t0 as B
-where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1)
-and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1);
-max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
-8186
-set join_buffer_size= @save_join_buffer_size;
-drop table t0, t1, t2, t3, t4;
-CREATE TABLE t1 (
-cola char(3) not null, colb char(3) not null, filler char(200),
-key(cola), key(colb)
-);
-INSERT INTO t1 VALUES ('foo','bar', 'ZZ'),('fuz','baz', 'ZZ');
-OPTIMIZE TABLE t1;
-Table Op Msg_type Msg_text
-test.t1 optimize status OK
-select count(*) from t1;
-count(*)
-8704
-explain select * from t1 WHERE cola = 'foo' AND colb = 'bar';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge cola,colb cola,colb 3,3 NULL 24 Using intersect(cola,colb); Using where
-explain select * from t1 force index(cola,colb) WHERE cola = 'foo' AND colb = 'bar';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge cola,colb cola,colb 3,3 NULL 24 Using intersect(cola,colb); Using where
-drop table t1;
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1 (
-a int, b int,
-filler1 char(200), filler2 char(200),
-key(a),key(b)
-);
-insert into t1 select @v:= A.a, @v, 't1', 'filler2' from t0 A, t0 B, t0 C;
-create table t2 like t1;
-create table t3 (
-a int, b int,
-filler1 char(200), filler2 char(200),
-key(a),key(b)
-) engine=merge union=(t1,t2);
-explain select * from t1 where a=1 and b=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge a,b a,b 5,5 NULL # Using intersect(a,b); Using where
-explain select * from t3 where a=1 and b=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 index_merge a,b a,b 5,5 NULL # Using intersect(a,b); Using where
-drop table t3;
-drop table t0, t1, t2;
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES(1);
-CREATE TABLE t2(a INT, b INT, dummy CHAR(16) DEFAULT '', KEY(a), KEY(b));
-INSERT INTO t2(a,b) VALUES
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(1,2);
-LOCK TABLES t1 WRITE, t2 WRITE;
-INSERT INTO t2(a,b) VALUES(1,2);
-SELECT t2.a FROM t1,t2 WHERE t2.b=2 AND t2.a=1;
-a
-1
-1
-UNLOCK TABLES;
-DROP TABLE t1, t2;
diff --git a/mysql-test/r/index_merge_bdb.result b/mysql-test/r/index_merge_bdb.result
deleted file mode 100644
index 3113bf95d3a..00000000000
--- a/mysql-test/r/index_merge_bdb.result
+++ /dev/null
@@ -1,136 +0,0 @@
-drop table if exists t1;
-create table t1 (
-pk int primary key,
-key1 int,
-key2 int,
-filler char(200),
-filler2 char(200),
-index(key1),
-index(key2)
-) engine=bdb;
-select * from t1 where (key1 >= 2 and key1 <= 10) or (pk >= 4 and pk <=8 );
-pk key1 key2 filler filler2
-2 2 2 filler-data filler-data-2
-3 3 3 filler-data filler-data-2
-9 9 9 filler-data filler-data-2
-10 10 10 filler-data filler-data-2
-4 4 4 filler-data filler-data-2
-5 5 5 filler-data filler-data-2
-6 6 6 filler-data filler-data-2
-7 7 7 filler-data filler-data-2
-8 8 8 filler-data filler-data-2
-set @maxv=1000;
-select * from t1 where
-(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
-or key1=18 or key1=60;
-pk key1 key2 filler filler2
-18 18 18 filler-data filler-data-2
-60 60 60 filler-data filler-data-2
-1 1 1 filler-data filler-data-2
-2 2 2 filler-data filler-data-2
-3 3 3 filler-data filler-data-2
-4 4 4 filler-data filler-data-2
-11 11 11 filler-data filler-data-2
-12 12 12 filler-data filler-data-2
-13 13 13 filler-data filler-data-2
-14 14 14 filler-data filler-data-2
-50 50 50 filler-data filler-data-2
-51 51 51 filler-data filler-data-2
-52 52 52 filler-data filler-data-2
-53 53 53 filler-data filler-data-2
-54 54 54 filler-data filler-data-2
-991 991 991 filler-data filler-data-2
-992 992 992 filler-data filler-data-2
-993 993 993 filler-data filler-data-2
-994 994 994 filler-data filler-data-2
-995 995 995 filler-data filler-data-2
-996 996 996 filler-data filler-data-2
-997 997 997 filler-data filler-data-2
-998 998 998 filler-data filler-data-2
-999 999 999 filler-data filler-data-2
-1000 1000 1000 filler-data filler-data-2
-select * from t1 where
-(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
-or key1 < 3 or key1 > @maxv-11;
-pk key1 key2 filler filler2
-990 990 990 filler-data filler-data-2
-1 1 1 filler-data filler-data-2
-2 2 2 filler-data filler-data-2
-3 3 3 filler-data filler-data-2
-4 4 4 filler-data filler-data-2
-11 11 11 filler-data filler-data-2
-12 12 12 filler-data filler-data-2
-13 13 13 filler-data filler-data-2
-14 14 14 filler-data filler-data-2
-50 50 50 filler-data filler-data-2
-51 51 51 filler-data filler-data-2
-52 52 52 filler-data filler-data-2
-53 53 53 filler-data filler-data-2
-54 54 54 filler-data filler-data-2
-991 991 991 filler-data filler-data-2
-992 992 992 filler-data filler-data-2
-993 993 993 filler-data filler-data-2
-994 994 994 filler-data filler-data-2
-995 995 995 filler-data filler-data-2
-996 996 996 filler-data filler-data-2
-997 997 997 filler-data filler-data-2
-998 998 998 filler-data filler-data-2
-999 999 999 filler-data filler-data-2
-1000 1000 1000 filler-data filler-data-2
-select * from t1 where
-(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
-or
-(key1 < 5) or (key1 > 10 and key1 < 15) or (key1 >= 50 and key1 < 55 ) or (key1 > @maxv-10);
-pk key1 key2 filler filler2
-1 1 1 filler-data filler-data-2
-2 2 2 filler-data filler-data-2
-3 3 3 filler-data filler-data-2
-4 4 4 filler-data filler-data-2
-11 11 11 filler-data filler-data-2
-12 12 12 filler-data filler-data-2
-13 13 13 filler-data filler-data-2
-14 14 14 filler-data filler-data-2
-50 50 50 filler-data filler-data-2
-51 51 51 filler-data filler-data-2
-52 52 52 filler-data filler-data-2
-53 53 53 filler-data filler-data-2
-54 54 54 filler-data filler-data-2
-991 991 991 filler-data filler-data-2
-992 992 992 filler-data filler-data-2
-993 993 993 filler-data filler-data-2
-994 994 994 filler-data filler-data-2
-995 995 995 filler-data filler-data-2
-996 996 996 filler-data filler-data-2
-997 997 997 filler-data filler-data-2
-998 998 998 filler-data filler-data-2
-999 999 999 filler-data filler-data-2
-1000 1000 1000 filler-data filler-data-2
-select * from t1 where
-(pk > 10 and pk < 15) or (pk >= 50 and pk < 55 )
-or
-(key1 < 5) or (key1 > @maxv-10);
-pk key1 key2 filler filler2
-1 1 1 filler-data filler-data-2
-2 2 2 filler-data filler-data-2
-3 3 3 filler-data filler-data-2
-4 4 4 filler-data filler-data-2
-991 991 991 filler-data filler-data-2
-992 992 992 filler-data filler-data-2
-993 993 993 filler-data filler-data-2
-994 994 994 filler-data filler-data-2
-995 995 995 filler-data filler-data-2
-996 996 996 filler-data filler-data-2
-997 997 997 filler-data filler-data-2
-998 998 998 filler-data filler-data-2
-999 999 999 filler-data filler-data-2
-1000 1000 1000 filler-data filler-data-2
-11 11 11 filler-data filler-data-2
-12 12 12 filler-data filler-data-2
-13 13 13 filler-data filler-data-2
-14 14 14 filler-data filler-data-2
-50 50 50 filler-data filler-data-2
-51 51 51 filler-data filler-data-2
-52 52 52 filler-data filler-data-2
-53 53 53 filler-data filler-data-2
-54 54 54 filler-data filler-data-2
-drop table t1;
diff --git a/mysql-test/r/index_merge_innodb.result b/mysql-test/r/index_merge_innodb.result
index c0c850ee310..588de70e6e5 100644
--- a/mysql-test/r/index_merge_innodb.result
+++ b/mysql-test/r/index_merge_innodb.result
@@ -1,11 +1,13 @@
+#---------------- Index merge test 2 -------------------------------------------
+SET SESSION STORAGE_ENGINE = InnoDB;
drop table if exists t1,t2;
create table t1
(
-key1 int not null,
-key2 int not null,
+key1 int not null,
+key2 int not null,
INDEX i1(key1),
INDEX i2(key2)
-) engine=innodb;
+);
explain select * from t1 where key1 < 5 or key2 > 197;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where
@@ -26,7 +28,7 @@ key1 key2
2 198
3 197
4 196
-alter table t1 add str1 char (255) not null,
+alter table t1 add str1 char (255) not null,
add zeroval int not null default 0,
add str2 char (255) not null,
add str3 char (255) not null;
@@ -60,7 +62,7 @@ key2 integer not null,
filler char (200),
index (key1),
index (key2)
-) engine=innodb;
+);
show warnings;
Level Code Message
explain select pk from t1 where key1 = 1 and key2 = 1;
@@ -91,14 +93,14 @@ filler1 char (200),
index i1(key1a, key1b),
index i2(key2a, key2b),
index i3(key3a, key3b)
-) engine=innodb;
+);
create table t2 (a int);
insert into t2 values (0),(1),(2),(3),(4),(NULL);
-insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
+insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
select A.a, B.a, C.a, D.a, C.a, D.a from t2 A,t2 B,t2 C, t2 D;
-insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
+insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
select key1a, key1b, key2a, key2b, key3a, key3b from t1;
-insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
+insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
select key1a, key1b, key2a, key2b, key3a, key3b from t1;
analyze table t1;
Table Op Msg_type Msg_text
@@ -106,19 +108,19 @@ test.t1 analyze status OK
select count(*) from t1;
count(*)
5184
-explain select count(*) from t1 where
+explain select count(*) from t1 where
key1a = 2 and key1b is null and key2a = 2 and key2b is null;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge i1,i2 i1,i2 10,10 NULL 3 Using intersect(i1,i2); Using where; Using index
-select count(*) from t1 where
+1 SIMPLE t1 index_merge i1,i2 i1,i2 10,10 NULL 4 Using intersect(i1,i2); Using where; Using index
+select count(*) from t1 where
key1a = 2 and key1b is null and key2a = 2 and key2b is null;
count(*)
4
-explain select count(*) from t1 where
+explain select count(*) from t1 where
key1a = 2 and key1b is null and key3a = 2 and key3b is null;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge i1,i3 i1,i3 10,10 NULL 3 Using intersect(i1,i3); Using where; Using index
-select count(*) from t1 where
+1 SIMPLE t1 index_merge i1,i3 i1,i3 10,10 NULL 4 Using intersect(i1,i3); Using where; Using index
+select count(*) from t1 where
key1a = 2 and key1b is null and key3a = 2 and key3b is null;
count(*)
4
@@ -127,8 +129,8 @@ create table t1 (
id1 int,
id2 date ,
index idx2 (id1,id2),
-index idx1 (id2)
-) engine = innodb;
+index idx1 (id2)
+);
insert into t1 values(1,'20040101'), (2,'20040102');
select * from t1 where id1 = 1 and id2= '20040101';
id1 id2
@@ -147,8 +149,8 @@ PRIMARY KEY (`oid`),
KEY `fk_bbk_niederlassung` (`fk_bbk_niederlassung`),
KEY `fk_wochentag` (`fk_wochentag`),
KEY `ix_version` (`version`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-insert into t1 values
+) DEFAULT CHARSET=latin1;
+insert into t1 values
(1, 38, 1, '08:00:00', '13:00:00', 0, 1),
(2, 38, 2, '08:00:00', '13:00:00', 0, 1),
(3, 38, 3, '08:00:00', '13:00:00', 0, 1),
@@ -174,25 +176,25 @@ insert into t1 values
(23, 7, 3, '08:00:00', '13:00:00', 0, 1),
(24, 7, 4, '08:00:00', '13:00:00', 0, 1),
(25, 7, 5, '08:00:00', '13:00:00', 0, 1);
-create view v1 as
-select
-zeit1.oid AS oid,
+create view v1 as
+select
+zeit1.oid AS oid,
zeit1.fk_bbk_niederlassung AS fk_bbk_niederlassung,
zeit1.fk_wochentag AS fk_wochentag,
-zeit1.uhrzeit_von AS uhrzeit_von,
-zeit1.uhrzeit_bis AS uhrzeit_bis,
+zeit1.uhrzeit_von AS uhrzeit_von,
+zeit1.uhrzeit_bis AS uhrzeit_bis,
zeit1.geloescht AS geloescht,
zeit1.version AS version
-from
+from
t1 zeit1
-where
-(zeit1.version =
+where
+(zeit1.version =
(select max(zeit2.version) AS `max(version)`
- from t1 zeit2
-where
-((zeit1.fk_bbk_niederlassung = zeit2.fk_bbk_niederlassung) and
-(zeit1.fk_wochentag = zeit2.fk_wochentag) and
-(zeit1.uhrzeit_von = zeit2.uhrzeit_von) and
+ from t1 zeit2
+where
+((zeit1.fk_bbk_niederlassung = zeit2.fk_bbk_niederlassung) and
+(zeit1.fk_wochentag = zeit2.fk_wochentag) and
+(zeit1.uhrzeit_von = zeit2.uhrzeit_von) and
(zeit1.uhrzeit_bis = zeit2.uhrzeit_bis)
)
)
@@ -213,7 +215,7 @@ filler2 char(250) default NULL,
PRIMARY KEY (t_cpac,t_vers,t_rele,t_cust),
UNIQUE KEY IX_4 (t_cust,t_cpac,t_vers,t_rele),
KEY IX_5 (t_vers,t_rele,t_cust)
-) ENGINE=InnoDB;
+);
insert into t1 values
('tm','2.5 ','a ',' ','',''), ('tm','2.5U','a ','stnd','',''),
('da','3.3 ','b ',' ','',''), ('da','3.3U','b ','stnd','',''),
@@ -244,9 +246,9 @@ t1 CREATE TABLE `t1` (
`t_vers` varchar(4) NOT NULL,
`t_rele` varchar(2) NOT NULL,
`t_cust` varchar(4) NOT NULL,
- `filler1` char(250) default NULL,
- `filler2` char(250) default NULL,
- PRIMARY KEY (`t_cpac`,`t_vers`,`t_rele`,`t_cust`),
+ `filler1` char(250) DEFAULT NULL,
+ `filler2` char(250) DEFAULT NULL,
+ PRIMARY KEY (`t_cpac`,`t_vers`,`t_rele`,`t_cust`),
UNIQUE KEY `IX_4` (`t_cust`,`t_cpac`,`t_vers`,`t_rele`),
KEY `IX_5` (`t_vers`,`t_rele`,`t_cust`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
@@ -275,10 +277,307 @@ primary key (pk),
key idx1(a,b,c),
key idx2(c),
key idx3(kp1,kp2,kp3,kp4,kp5)
-) engine=innodb default charset=latin1;
+) default charset=latin1;
set @fill=NULL;
-SELECT COUNT(*) FROM t1 WHERE b = 0 AND a = 0 AND c = 13286427 AND
+SELECT COUNT(*) FROM t1 WHERE b = 0 AND a = 0 AND c = 13286427 AND
kp1='279' AND kp2='ELM0678' AND kp3='6' AND kp4='10' AND kp5 = 'R ';
COUNT(*)
1
drop table t1;
+create table t1
+(
+key1 int not null,
+key2 int not null default 0,
+key3 int not null default 0
+);
+insert into t1(key1) values (1),(2),(3),(4),(5),(6),(7),(8);
+set @d=8;
+insert into t1 (key1) select key1+@d from t1;
+set @d=@d*2;
+insert into t1 (key1) select key1+@d from t1;
+set @d=@d*2;
+insert into t1 (key1) select key1+@d from t1;
+set @d=@d*2;
+insert into t1 (key1) select key1+@d from t1;
+set @d=@d*2;
+insert into t1 (key1) select key1+@d from t1;
+set @d=@d*2;
+insert into t1 (key1) select key1+@d from t1;
+set @d=@d*2;
+insert into t1 (key1) select key1+@d from t1;
+set @d=@d*2;
+alter table t1 add index i2(key2);
+alter table t1 add index i3(key3);
+update t1 set key2=key1,key3=key1;
+explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge i2,i3 i3,i2 4,4 NULL 9 Using sort_union(i3,i2); Using where
+select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
+key1 key2 key3
+31 31 31
+32 32 32
+33 33 33
+34 34 34
+35 35 35
+36 36 36
+37 37 37
+38 38 38
+39 39 39
+drop table t1;
+#---------------- 2-sweeps read Index merge test 2 -------------------------------
+SET SESSION STORAGE_ENGINE = InnoDB;
+drop table if exists t1;
+create table t1 (
+pk int primary key,
+key1 int,
+key2 int,
+filler char(200),
+filler2 char(200),
+index(key1),
+index(key2)
+);
+select * from t1 where (key1 >= 2 and key1 <= 10) or (pk >= 4 and pk <=8 );
+pk key1 key2 filler filler2
+2 2 2 filler-data filler-data-2
+3 3 3 filler-data filler-data-2
+9 9 9 filler-data filler-data-2
+10 10 10 filler-data filler-data-2
+4 4 4 filler-data filler-data-2
+5 5 5 filler-data filler-data-2
+6 6 6 filler-data filler-data-2
+7 7 7 filler-data filler-data-2
+8 8 8 filler-data filler-data-2
+set @maxv=1000;
+select * from t1 where
+(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
+or key1=18 or key1=60;
+pk key1 key2 filler filler2
+18 18 18 filler-data filler-data-2
+60 60 60 filler-data filler-data-2
+1 1 1 filler-data filler-data-2
+2 2 2 filler-data filler-data-2
+3 3 3 filler-data filler-data-2
+4 4 4 filler-data filler-data-2
+11 11 11 filler-data filler-data-2
+12 12 12 filler-data filler-data-2
+13 13 13 filler-data filler-data-2
+14 14 14 filler-data filler-data-2
+50 50 50 filler-data filler-data-2
+51 51 51 filler-data filler-data-2
+52 52 52 filler-data filler-data-2
+53 53 53 filler-data filler-data-2
+54 54 54 filler-data filler-data-2
+991 991 991 filler-data filler-data-2
+992 992 992 filler-data filler-data-2
+993 993 993 filler-data filler-data-2
+994 994 994 filler-data filler-data-2
+995 995 995 filler-data filler-data-2
+996 996 996 filler-data filler-data-2
+997 997 997 filler-data filler-data-2
+998 998 998 filler-data filler-data-2
+999 999 999 filler-data filler-data-2
+1000 1000 1000 filler-data filler-data-2
+select * from t1 where
+(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
+or key1 < 3 or key1 > @maxv-11;
+pk key1 key2 filler filler2
+990 990 990 filler-data filler-data-2
+1 1 1 filler-data filler-data-2
+2 2 2 filler-data filler-data-2
+3 3 3 filler-data filler-data-2
+4 4 4 filler-data filler-data-2
+11 11 11 filler-data filler-data-2
+12 12 12 filler-data filler-data-2
+13 13 13 filler-data filler-data-2
+14 14 14 filler-data filler-data-2
+50 50 50 filler-data filler-data-2
+51 51 51 filler-data filler-data-2
+52 52 52 filler-data filler-data-2
+53 53 53 filler-data filler-data-2
+54 54 54 filler-data filler-data-2
+991 991 991 filler-data filler-data-2
+992 992 992 filler-data filler-data-2
+993 993 993 filler-data filler-data-2
+994 994 994 filler-data filler-data-2
+995 995 995 filler-data filler-data-2
+996 996 996 filler-data filler-data-2
+997 997 997 filler-data filler-data-2
+998 998 998 filler-data filler-data-2
+999 999 999 filler-data filler-data-2
+1000 1000 1000 filler-data filler-data-2
+select * from t1 where
+(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
+or
+(key1 < 5) or (key1 > 10 and key1 < 15) or (key1 >= 50 and key1 < 55 ) or (key1 > @maxv-10);
+pk key1 key2 filler filler2
+1 1 1 filler-data filler-data-2
+2 2 2 filler-data filler-data-2
+3 3 3 filler-data filler-data-2
+4 4 4 filler-data filler-data-2
+11 11 11 filler-data filler-data-2
+12 12 12 filler-data filler-data-2
+13 13 13 filler-data filler-data-2
+14 14 14 filler-data filler-data-2
+50 50 50 filler-data filler-data-2
+51 51 51 filler-data filler-data-2
+52 52 52 filler-data filler-data-2
+53 53 53 filler-data filler-data-2
+54 54 54 filler-data filler-data-2
+991 991 991 filler-data filler-data-2
+992 992 992 filler-data filler-data-2
+993 993 993 filler-data filler-data-2
+994 994 994 filler-data filler-data-2
+995 995 995 filler-data filler-data-2
+996 996 996 filler-data filler-data-2
+997 997 997 filler-data filler-data-2
+998 998 998 filler-data filler-data-2
+999 999 999 filler-data filler-data-2
+1000 1000 1000 filler-data filler-data-2
+select * from t1 where
+(pk > 10 and pk < 15) or (pk >= 50 and pk < 55 )
+or
+(key1 < 5) or (key1 > @maxv-10);
+pk key1 key2 filler filler2
+1 1 1 filler-data filler-data-2
+2 2 2 filler-data filler-data-2
+3 3 3 filler-data filler-data-2
+4 4 4 filler-data filler-data-2
+991 991 991 filler-data filler-data-2
+992 992 992 filler-data filler-data-2
+993 993 993 filler-data filler-data-2
+994 994 994 filler-data filler-data-2
+995 995 995 filler-data filler-data-2
+996 996 996 filler-data filler-data-2
+997 997 997 filler-data filler-data-2
+998 998 998 filler-data filler-data-2
+999 999 999 filler-data filler-data-2
+1000 1000 1000 filler-data filler-data-2
+11 11 11 filler-data filler-data-2
+12 12 12 filler-data filler-data-2
+13 13 13 filler-data filler-data-2
+14 14 14 filler-data filler-data-2
+50 50 50 filler-data filler-data-2
+51 51 51 filler-data filler-data-2
+52 52 52 filler-data filler-data-2
+53 53 53 filler-data filler-data-2
+54 54 54 filler-data filler-data-2
+drop table t1;
+#---------------- Clustered PK ROR-index_merge tests -----------------------------
+SET SESSION STORAGE_ENGINE = InnoDB;
+drop table if exists t1;
+create table t1
+(
+pk1 int not null,
+pk2 int not null,
+key1 int not null,
+key2 int not null,
+pktail1ok int not null,
+pktail2ok int not null,
+pktail3bad int not null,
+pktail4bad int not null,
+pktail5bad int not null,
+pk2copy int not null,
+badkey int not null,
+filler1 char (200),
+filler2 char (200),
+key (key1),
+key (key2),
+/* keys with tails from CPK members */
+key (pktail1ok, pk1),
+key (pktail2ok, pk1, pk2),
+key (pktail3bad, pk2, pk1),
+key (pktail4bad, pk1, pk2copy),
+key (pktail5bad, pk1, pk2, pk2copy),
+primary key (pk1, pk2)
+);
+explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range PRIMARY,key1 PRIMARY 8 NULL 9 Using where
+select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
+pk1 pk2 key1 key2 pktail1ok pktail2ok pktail3bad pktail4bad pktail5bad pk2copy badkey filler1 filler2
+1 10 0 0 0 0 0 0 0 10 0 filler-data-10 filler2
+1 11 0 0 0 0 0 0 0 11 0 filler-data-11 filler2
+1 12 0 0 0 0 0 0 0 12 0 filler-data-12 filler2
+1 13 0 0 0 0 0 0 0 13 0 filler-data-13 filler2
+1 14 0 0 0 0 0 0 0 14 0 filler-data-14 filler2
+1 15 0 0 0 0 0 0 0 15 0 filler-data-15 filler2
+1 16 0 0 0 0 0 0 0 16 0 filler-data-16 filler2
+1 17 0 0 0 0 0 0 0 17 0 filler-data-17 filler2
+1 18 0 0 0 0 0 0 0 18 0 filler-data-18 filler2
+1 19 0 0 0 0 0 0 0 19 0 filler-data-19 filler2
+explain select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge key1,key2 key1,key2 4,4 NULL 1 Using intersect(key1,key2); Using where; Using index
+select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1;
+pk1 pk2
+95 50
+95 51
+95 52
+95 53
+95 54
+95 55
+95 56
+95 57
+95 58
+95 59
+explain select * from t1 where badkey=1 and key1=10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref key1 key1 4 const 100 Using where
+explain select * from t1 where pk1 < 7500 and key1 = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge PRIMARY,key1 key1,PRIMARY 4,4 NULL ROWS Using intersect(key1,PRIMARY); Using where
+explain select * from t1 where pktail1ok=1 and key1=10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge key1,pktail1ok key1,pktail1ok 4,4 NULL 1 Using intersect(key1,pktail1ok); Using where
+explain select * from t1 where pktail2ok=1 and key1=10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge key1,pktail2ok key1,pktail2ok 4,4 NULL 1 Using intersect(key1,pktail2ok); Using where
+explain select * from t1 where (pktail2ok=1 and pk1< 50000) or key1=10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge PRIMARY,key1,pktail2ok pktail2ok,key1 8,4 NULL 199 Using sort_union(pktail2ok,key1); Using where
+explain select * from t1 where pktail3bad=1 and key1=10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref key1,pktail3bad key1 4 const 100 Using where
+explain select * from t1 where pktail4bad=1 and key1=10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref key1,pktail4bad key1 4 const 100 Using where
+explain select * from t1 where pktail5bad=1 and key1=10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref key1,pktail5bad key1 4 const 100 Using where
+explain select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge key1,key2 key1,key2 4,4 NULL 1 Using intersect(key1,key2); Using where; Using index
+select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10;
+pk1 pk2 key1 key2
+95 50 10 10
+95 51 10 10
+95 52 10 10
+95 53 10 10
+95 54 10 10
+95 55 10 10
+95 56 10 10
+95 57 10 10
+95 58 10 10
+95 59 10 10
+drop table t1;
+create table t1
+(
+RUNID varchar(22),
+SUBMITNR varchar(5),
+ORDERNR char(1),
+PROGRAMM varchar(8),
+TESTID varchar(4),
+UCCHECK char(1),
+ETEXT varchar(80),
+ETEXT_TYPE char(1),
+INFO char(1),
+SEVERITY tinyint(3),
+TADIRFLAG char(1),
+PRIMARY KEY (RUNID,SUBMITNR,ORDERNR,PROGRAMM,TESTID,UCCHECK),
+KEY `TVERM~KEY` (PROGRAMM,TESTID,UCCHECK)
+) DEFAULT CHARSET=latin1;
+update t1 set `ETEXT` = '', `ETEXT_TYPE`='', `INFO`='', `SEVERITY`='', `TADIRFLAG`=''
+WHERE
+`RUNID`= '' AND `SUBMITNR`= '' AND `ORDERNR`='' AND `PROGRAMM`='' AND
+`TESTID`='' AND `UCCHECK`='';
+drop table t1;
diff --git a/mysql-test/r/index_merge_innodb2.result b/mysql-test/r/index_merge_innodb2.result
deleted file mode 100644
index 91dd989fe90..00000000000
--- a/mysql-test/r/index_merge_innodb2.result
+++ /dev/null
@@ -1,136 +0,0 @@
-drop table if exists t1;
-create table t1 (
-pk int primary key,
-key1 int,
-key2 int,
-filler char(200),
-filler2 char(200),
-index(key1),
-index(key2)
-) engine=innodb;
-select * from t1 where (key1 >= 2 and key1 <= 10) or (pk >= 4 and pk <=8 );
-pk key1 key2 filler filler2
-2 2 2 filler-data filler-data-2
-3 3 3 filler-data filler-data-2
-9 9 9 filler-data filler-data-2
-10 10 10 filler-data filler-data-2
-4 4 4 filler-data filler-data-2
-5 5 5 filler-data filler-data-2
-6 6 6 filler-data filler-data-2
-7 7 7 filler-data filler-data-2
-8 8 8 filler-data filler-data-2
-set @maxv=1000;
-select * from t1 where
-(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
-or key1=18 or key1=60;
-pk key1 key2 filler filler2
-18 18 18 filler-data filler-data-2
-60 60 60 filler-data filler-data-2
-1 1 1 filler-data filler-data-2
-2 2 2 filler-data filler-data-2
-3 3 3 filler-data filler-data-2
-4 4 4 filler-data filler-data-2
-11 11 11 filler-data filler-data-2
-12 12 12 filler-data filler-data-2
-13 13 13 filler-data filler-data-2
-14 14 14 filler-data filler-data-2
-50 50 50 filler-data filler-data-2
-51 51 51 filler-data filler-data-2
-52 52 52 filler-data filler-data-2
-53 53 53 filler-data filler-data-2
-54 54 54 filler-data filler-data-2
-991 991 991 filler-data filler-data-2
-992 992 992 filler-data filler-data-2
-993 993 993 filler-data filler-data-2
-994 994 994 filler-data filler-data-2
-995 995 995 filler-data filler-data-2
-996 996 996 filler-data filler-data-2
-997 997 997 filler-data filler-data-2
-998 998 998 filler-data filler-data-2
-999 999 999 filler-data filler-data-2
-1000 1000 1000 filler-data filler-data-2
-select * from t1 where
-(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
-or key1 < 3 or key1 > @maxv-11;
-pk key1 key2 filler filler2
-990 990 990 filler-data filler-data-2
-1 1 1 filler-data filler-data-2
-2 2 2 filler-data filler-data-2
-3 3 3 filler-data filler-data-2
-4 4 4 filler-data filler-data-2
-11 11 11 filler-data filler-data-2
-12 12 12 filler-data filler-data-2
-13 13 13 filler-data filler-data-2
-14 14 14 filler-data filler-data-2
-50 50 50 filler-data filler-data-2
-51 51 51 filler-data filler-data-2
-52 52 52 filler-data filler-data-2
-53 53 53 filler-data filler-data-2
-54 54 54 filler-data filler-data-2
-991 991 991 filler-data filler-data-2
-992 992 992 filler-data filler-data-2
-993 993 993 filler-data filler-data-2
-994 994 994 filler-data filler-data-2
-995 995 995 filler-data filler-data-2
-996 996 996 filler-data filler-data-2
-997 997 997 filler-data filler-data-2
-998 998 998 filler-data filler-data-2
-999 999 999 filler-data filler-data-2
-1000 1000 1000 filler-data filler-data-2
-select * from t1 where
-(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
-or
-(key1 < 5) or (key1 > 10 and key1 < 15) or (key1 >= 50 and key1 < 55 ) or (key1 > @maxv-10);
-pk key1 key2 filler filler2
-1 1 1 filler-data filler-data-2
-2 2 2 filler-data filler-data-2
-3 3 3 filler-data filler-data-2
-4 4 4 filler-data filler-data-2
-11 11 11 filler-data filler-data-2
-12 12 12 filler-data filler-data-2
-13 13 13 filler-data filler-data-2
-14 14 14 filler-data filler-data-2
-50 50 50 filler-data filler-data-2
-51 51 51 filler-data filler-data-2
-52 52 52 filler-data filler-data-2
-53 53 53 filler-data filler-data-2
-54 54 54 filler-data filler-data-2
-991 991 991 filler-data filler-data-2
-992 992 992 filler-data filler-data-2
-993 993 993 filler-data filler-data-2
-994 994 994 filler-data filler-data-2
-995 995 995 filler-data filler-data-2
-996 996 996 filler-data filler-data-2
-997 997 997 filler-data filler-data-2
-998 998 998 filler-data filler-data-2
-999 999 999 filler-data filler-data-2
-1000 1000 1000 filler-data filler-data-2
-select * from t1 where
-(pk > 10 and pk < 15) or (pk >= 50 and pk < 55 )
-or
-(key1 < 5) or (key1 > @maxv-10);
-pk key1 key2 filler filler2
-1 1 1 filler-data filler-data-2
-2 2 2 filler-data filler-data-2
-3 3 3 filler-data filler-data-2
-4 4 4 filler-data filler-data-2
-991 991 991 filler-data filler-data-2
-992 992 992 filler-data filler-data-2
-993 993 993 filler-data filler-data-2
-994 994 994 filler-data filler-data-2
-995 995 995 filler-data filler-data-2
-996 996 996 filler-data filler-data-2
-997 997 997 filler-data filler-data-2
-998 998 998 filler-data filler-data-2
-999 999 999 filler-data filler-data-2
-1000 1000 1000 filler-data filler-data-2
-11 11 11 filler-data filler-data-2
-12 12 12 filler-data filler-data-2
-13 13 13 filler-data filler-data-2
-14 14 14 filler-data filler-data-2
-50 50 50 filler-data filler-data-2
-51 51 51 filler-data filler-data-2
-52 52 52 filler-data filler-data-2
-53 53 53 filler-data filler-data-2
-54 54 54 filler-data filler-data-2
-drop table t1;
diff --git a/mysql-test/r/index_merge_myisam.result b/mysql-test/r/index_merge_myisam.result
new file mode 100644
index 00000000000..1c60e53a335
--- /dev/null
+++ b/mysql-test/r/index_merge_myisam.result
@@ -0,0 +1,1281 @@
+#---------------- Index merge test 1 -------------------------------------------
+SET SESSION STORAGE_ENGINE = MyISAM;
+drop table if exists t0, t1, t2, t3, t4;
+create table t0
+(
+key1 int not null,
+INDEX i1(key1)
+);
+alter table t0 add key2 int not null, add index i2(key2);
+alter table t0 add key3 int not null, add index i3(key3);
+alter table t0 add key4 int not null, add index i4(key4);
+alter table t0 add key5 int not null, add index i5(key5);
+alter table t0 add key6 int not null, add index i6(key6);
+alter table t0 add key7 int not null, add index i7(key7);
+alter table t0 add key8 int not null, add index i8(key8);
+update t0 set key2=key1,key3=key1,key4=key1,key5=key1,key6=key1,key7=key1,key8=1024-key1;
+analyze table t0;
+Table Op Msg_type Msg_text
+test.t0 analyze status OK
+explain select * from t0 where key1 < 3 or key1 > 1020;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 range i1 i1 4 NULL 78 Using where
+explain
+select * from t0 where key1 < 3 or key2 > 1020;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 45 Using sort_union(i1,i2); Using where
+select * from t0 where key1 < 3 or key2 > 1020;
+key1 key2 key3 key4 key5 key6 key7 key8
+1 1 1 1 1 1 1 1023
+2 2 2 2 2 2 2 1022
+1021 1021 1021 1021 1021 1021 1021 3
+1022 1022 1022 1022 1022 1022 1022 2
+1023 1023 1023 1023 1023 1023 1023 1
+1024 1024 1024 1024 1024 1024 1024 0
+explain select * from t0 where key1 < 3 or key2 <4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 7 Using sort_union(i1,i2); Using where
+explain
+select * from t0 where (key1 > 30 and key1<35) or (key2 >32 and key2 < 40);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 11 Using sort_union(i1,i2); Using where
+select * from t0 where (key1 > 30 and key1<35) or (key2 >32 and key2 < 40);
+key1 key2 key3 key4 key5 key6 key7 key8
+31 31 31 31 31 31 31 993
+32 32 32 32 32 32 32 992
+33 33 33 33 33 33 33 991
+34 34 34 34 34 34 34 990
+35 35 35 35 35 35 35 989
+36 36 36 36 36 36 36 988
+37 37 37 37 37 37 37 987
+38 38 38 38 38 38 38 986
+39 39 39 39 39 39 39 985
+explain select * from t0 ignore index (i2) where key1 < 3 or key2 <4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL i1 NULL NULL NULL 1024 Using where
+explain select * from t0 where (key1 < 3 or key2 <4) and key3 = 50;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ref i1,i2,i3 i3 4 const 1 Using where
+explain select * from t0 use index (i1,i2) where (key1 < 3 or key2 <4) and key3 = 50;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 7 Using sort_union(i1,i2); Using where
+explain select * from t0 where (key1 > 1 or key2 > 2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL i1,i2 NULL NULL NULL 1024 Using where
+explain select * from t0 force index (i1,i2) where (key1 > 1 or key2 > 2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 1024 Using sort_union(i1,i2); Using where
+explain
+select * from t0 where key1<3 or key2<3 or (key1>5 and key1<8) or
+(key1>10 and key1<12) or (key2>100 and key2<110);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 17 Using sort_union(i1,i2); Using where
+explain select * from t0 where key2 = 45 or key1 <=> null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 range i1,i2 i2 4 NULL 1 Using where
+explain select * from t0 where key2 = 45 or key1 is not null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL i1,i2 NULL NULL NULL 1024 Using where
+explain select * from t0 where key2 = 45 or key1 is null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ref i2 i2 4 const 1
+explain select * from t0 where key2=10 or key3=3 or key4 <=> null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i2,i3,i4 i2,i3 4,4 NULL 2 Using union(i2,i3); Using where
+explain select * from t0 where key2=10 or key3=3 or key4 is null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i2,i3 i2,i3 4,4 NULL 2 Using union(i2,i3); Using where
+explain select key1 from t0 where (key1 <=> null) or (key2 < 5) or
+(key3=10) or (key4 <=> null);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i1,i2,i3,i4 i2,i3 4,4 NULL 6 Using sort_union(i2,i3); Using where
+explain select key1 from t0 where (key1 <=> null) or (key1 < 5) or
+(key3=10) or (key4 <=> null);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i1,i3,i4 i1,i3 4,4 NULL 6 Using sort_union(i1,i3); Using where
+explain select * from t0 where
+(key1 < 3 or key2 < 3) and (key3 < 4 or key4 < 4) and (key5 < 5 or key6 < 5);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i1,i2,i3,i4,i5,i6 i1,i2 4,4 NULL 6 Using sort_union(i1,i2); Using where
+explain
+select * from t0 where (key1 < 3 or key2 < 6) and (key1 < 7 or key3 < 4);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i1,i2,i3 i1,i2 4,4 NULL 9 Using sort_union(i1,i2); Using where
+select * from t0 where (key1 < 3 or key2 < 6) and (key1 < 7 or key3 < 4);
+key1 key2 key3 key4 key5 key6 key7 key8
+1 1 1 1 1 1 1 1023
+2 2 2 2 2 2 2 1022
+3 3 3 3 3 3 3 1021
+4 4 4 4 4 4 4 1020
+5 5 5 5 5 5 5 1019
+explain select * from t0 where
+(key1 < 3 or key2 < 3) and (key3 < 4 or key4 < 4) and (key5 < 2 or key6 < 2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i1,i2,i3,i4,i5,i6 i1,i2 4,4 NULL 6 Using sort_union(i1,i2); Using where
+explain select * from t0 where
+(key1 < 3 or key2 < 3) and (key3 < 100);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 range i1,i2,i3 i3 4 NULL 95 Using where
+explain select * from t0 where
+(key1 < 3 or key2 < 3) and (key3 < 1000);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL i1,i2,i3 NULL NULL NULL 1024 Using where
+explain select * from t0 where
+((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4))
+or
+key2 > 5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL i1,i2,i3 NULL NULL NULL 1024 Using where
+explain select * from t0 where
+((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4))
+or
+key1 < 7;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i1,i2,i3 i1,i2 4,4 NULL 10 Using sort_union(i1,i2); Using where
+select * from t0 where
+((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4))
+or
+key1 < 7;
+key1 key2 key3 key4 key5 key6 key7 key8
+1 1 1 1 1 1 1 1023
+2 2 2 2 2 2 2 1022
+3 3 3 3 3 3 3 1021
+4 4 4 4 4 4 4 1020
+5 5 5 5 5 5 5 1019
+6 6 6 6 6 6 6 1018
+explain select * from t0 where
+((key1 < 4 or key2 < 4) and (key3 <5 or key5 < 4))
+or
+((key5 < 5 or key6 < 6) and (key7 <7 or key8 < 4));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i1,i2,i3,i5,i6,i7,i8 i1,i2,i5,i6 4,4,4,4 NULL 19 Using sort_union(i1,i2,i5,i6); Using where
+explain select * from t0 where
+((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
+or
+((key7 <7 or key8 < 4) and (key5 < 5 or key6 < 6));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i1,i2,i3,i5,i6,i7,i8 i3,i5,i7,i8 4,4,4,4 NULL 20 Using sort_union(i3,i5,i7,i8); Using where
+explain select * from t0 where
+((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
+or
+((key3 <7 or key5 < 2) and (key5 < 5 or key6 < 6));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i1,i2,i3,i5,i6 i3,i5 4,4 NULL 11 Using sort_union(i3,i5); Using where
+explain select * from t0 where
+((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
+or
+(((key3 <7 and key7 < 6) or key5 < 2) and (key5 < 5 or key6 < 6));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i1,i2,i3,i5,i6,i7 i3,i5 4,4 NULL 11 Using sort_union(i3,i5); Using where
+explain select * from t0 where
+((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
+or
+((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL i1,i2,i3,i5,i6 NULL NULL NULL 1024 Using where
+explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where
+((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
+or
+((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i1,i2,i3,i5,i6 i3,i5 0,4 NULL 1024 Using sort_union(i3,i5); Using where
+select * from t0 where key1 < 5 or key8 < 4 order by key1;
+key1 key2 key3 key4 key5 key6 key7 key8
+1 1 1 1 1 1 1 1023
+2 2 2 2 2 2 2 1022
+3 3 3 3 3 3 3 1021
+4 4 4 4 4 4 4 1020
+1021 1021 1021 1021 1021 1021 1021 3
+1022 1022 1022 1022 1022 1022 1022 2
+1023 1023 1023 1023 1023 1023 1023 1
+1024 1024 1024 1024 1024 1024 1024 0
+explain
+select * from t0 where key1 < 5 or key8 < 4 order by key1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i1,i8 i1,i8 4,4 NULL 9 Using sort_union(i1,i8); Using where; Using filesort
+create table t2 like t0;
+insert into t2 select * from t0;
+alter table t2 add index i1_3(key1, key3);
+alter table t2 add index i2_3(key2, key3);
+alter table t2 drop index i1;
+alter table t2 drop index i2;
+alter table t2 add index i321(key3, key2, key1);
+explain select key3 from t2 where key1 = 100 or key2 = 100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index_merge i1_3,i2_3 i1_3,i2_3 4,4 NULL 2 Using sort_union(i1_3,i2_3); Using where
+explain select key3 from t2 where key1 <100 or key2 < 100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index i1_3,i2_3 i321 12 NULL 1024 Using where; Using index
+explain select key7 from t2 where key1 <100 or key2 < 100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL i1_3,i2_3 NULL NULL NULL 1024 Using where
+create table t4 (
+key1a int not null,
+key1b int not null,
+key2 int not null,
+key2_1 int not null,
+key2_2 int not null,
+key3 int not null,
+index i1a (key1a, key1b),
+index i1b (key1b, key1a),
+index i2_1(key2, key2_1),
+index i2_2(key2, key2_1)
+);
+insert into t4 select key1,key1,key1 div 10, key1 % 10, key1 % 10, key1 from t0;
+select * from t4 where key1a = 3 or key1b = 4;
+key1a key1b key2 key2_1 key2_2 key3
+3 3 0 3 3 3
+4 4 0 4 4 4
+explain select * from t4 where key1a = 3 or key1b = 4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 index_merge i1a,i1b i1a,i1b 4,4 NULL 2 Using sort_union(i1a,i1b); Using where
+explain select * from t4 where key2 = 1 and (key2_1 = 1 or key3 = 5);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 ref i2_1,i2_2 i2_1 4 const 10 Using where
+explain select * from t4 where key2 = 1 and (key2_1 = 1 or key2_2 = 5);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 ref i2_1,i2_2 i2_1 4 const 10 Using where
+explain select * from t4 where key2_1 = 1 or key2_2 = 5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 1024 Using where
+create table t1 like t0;
+insert into t1 select * from t0;
+explain select * from t0 left join t1 on (t0.key1=t1.key1)
+where t0.key1=3 or t0.key2=4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
+1 SIMPLE t1 ref i1 i1 4 test.t0.key1 1
+select * from t0 left join t1 on (t0.key1=t1.key1)
+where t0.key1=3 or t0.key2=4;
+key1 key2 key3 key4 key5 key6 key7 key8 key1 key2 key3 key4 key5 key6 key7 key8
+3 3 3 3 3 3 3 1021 3 3 3 3 3 3 3 1021
+4 4 4 4 4 4 4 1020 4 4 4 4 4 4 4 1020
+explain
+select * from t0,t1 where (t0.key1=t1.key1) and ( t0.key1=3 or t0.key2=4);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
+1 SIMPLE t1 ref i1 i1 4 test.t0.key1 1
+explain
+select * from t0,t1 where (t0.key1=t1.key1) and
+(t0.key1=3 or t0.key2=4) and t1.key1<200;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL i1,i2 NULL NULL NULL 1024 Using where
+1 SIMPLE t1 ref i1 i1 4 test.t0.key1 1
+explain
+select * from t0,t1 where (t0.key1=t1.key1) and
+(t0.key1=3 or t0.key2<4) and t1.key1=2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ref i1,i2 i1 4 const 1 Using where
+1 SIMPLE t1 ref i1 i1 4 const 1
+explain select * from t0,t1 where t0.key1 = 5 and
+(t1.key1 = t0.key1 or t1.key8 = t0.key1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ref i1 i1 4 const 1
+1 SIMPLE t1 index_merge i1,i8 i1,i8 4,4 NULL 2 Using union(i1,i8); Using where
+explain select * from t0,t1 where t0.key1 < 3 and
+(t1.key1 = t0.key1 or t1.key8 = t0.key1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 range i1 i1 4 NULL 3 Using where
+1 SIMPLE t1 ALL i1,i8 NULL NULL NULL 1024 Range checked for each record (index map: 0x81)
+explain select * from t1 where key1=3 or key2=4
+union select * from t1 where key1<4 or key3=5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
+2 UNION t1 index_merge i1,i3 i1,i3 4,4 NULL 5 Using sort_union(i1,i3); Using where
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
+explain select * from (select * from t1 where key1 = 3 or key2 =3) as Z where key8 >5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> system NULL NULL NULL NULL 1
+2 DERIVED t1 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
+create table t3 like t0;
+insert into t3 select * from t0;
+alter table t3 add key9 int not null, add index i9(key9);
+alter table t3 add keyA int not null, add index iA(keyA);
+alter table t3 add keyB int not null, add index iB(keyB);
+alter table t3 add keyC int not null, add index iC(keyC);
+update t3 set key9=key1,keyA=key1,keyB=key1,keyC=key1;
+explain select * from t3 where
+key1=1 or key2=2 or key3=3 or key4=4 or
+key5=5 or key6=6 or key7=7 or key8=8 or
+key9=9 or keyA=10 or keyB=11 or keyC=12;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 index_merge i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC 4,4,4,4,4,4,4,4,4,4,4,4 NULL 12 Using union(i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC); Using where
+select * from t3 where
+key1=1 or key2=2 or key3=3 or key4=4 or
+key5=5 or key6=6 or key7=7 or key8=8 or
+key9=9 or keyA=10 or keyB=11 or keyC=12;
+key1 key2 key3 key4 key5 key6 key7 key8 key9 keyA keyB keyC
+1 1 1 1 1 1 1 1023 1 1 1 1
+2 2 2 2 2 2 2 1022 2 2 2 2
+3 3 3 3 3 3 3 1021 3 3 3 3
+4 4 4 4 4 4 4 1020 4 4 4 4
+5 5 5 5 5 5 5 1019 5 5 5 5
+6 6 6 6 6 6 6 1018 6 6 6 6
+7 7 7 7 7 7 7 1017 7 7 7 7
+9 9 9 9 9 9 9 1015 9 9 9 9
+10 10 10 10 10 10 10 1014 10 10 10 10
+11 11 11 11 11 11 11 1013 11 11 11 11
+12 12 12 12 12 12 12 1012 12 12 12 12
+1016 1016 1016 1016 1016 1016 1016 8 1016 1016 1016 1016
+explain select * from t0 where key1 < 3 or key2 < 4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 7 Using sort_union(i1,i2); Using where
+select * from t0 where key1 < 3 or key2 < 4;
+key1 key2 key3 key4 key5 key6 key7 key8
+1 1 1 1 1 1 1 1023
+2 2 2 2 2 2 2 1022
+3 3 3 3 3 3 3 1021
+update t0 set key8=123 where key1 < 3 or key2 < 4;
+select * from t0 where key1 < 3 or key2 < 4;
+key1 key2 key3 key4 key5 key6 key7 key8
+1 1 1 1 1 1 1 123
+2 2 2 2 2 2 2 123
+3 3 3 3 3 3 3 123
+delete from t0 where key1 < 3 or key2 < 4;
+select * from t0 where key1 < 3 or key2 < 4;
+key1 key2 key3 key4 key5 key6 key7 key8
+select count(*) from t0;
+count(*)
+1021
+drop table t4;
+create table t4 (a int);
+insert into t4 values (1),(4),(3);
+set @save_join_buffer_size=@@join_buffer_size;
+set join_buffer_size= 4000;
+explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
+from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
+where (A.key1 < 500000 or A.key2 < 3)
+and (B.key1 < 500000 or B.key2 < 3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE A index_merge i1,i2 i1,i2 4,4 NULL 1013 Using sort_union(i1,i2); Using where
+1 SIMPLE B index_merge i1,i2 i1,i2 4,4 NULL 1013 Using sort_union(i1,i2); Using where
+select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
+from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
+where (A.key1 < 500000 or A.key2 < 3)
+and (B.key1 < 500000 or B.key2 < 3);
+max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
+10240
+update t0 set key1=1;
+explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
+from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
+where (A.key1 = 1 or A.key2 = 1)
+and (B.key1 = 1 or B.key2 = 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE A index_merge i1,i2 i1,i2 4,4 NULL 1020 Using union(i1,i2); Using where
+1 SIMPLE B index_merge i1,i2 i1,i2 4,4 NULL 1020 Using union(i1,i2); Using where
+select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
+from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
+where (A.key1 = 1 or A.key2 = 1)
+and (B.key1 = 1 or B.key2 = 1);
+max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
+8194
+alter table t0 add filler1 char(200), add filler2 char(200), add filler3 char(200);
+update t0 set key2=1, key3=1, key4=1, key5=1,key6=1,key7=1 where key7 < 500;
+explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
+from t0 as A, t0 as B
+where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1)
+and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE A index_merge i1,i2,i3,i4,i5,i6,i7?,i8 i2,i3,i4,i5,i6,i7?,i8 X NULL # Using union(intersect(i2,i3,i4,i5,i6,i7?),i8); Using where
+1 SIMPLE B index_merge i1,i2,i3,i4,i5,i6,i7?,i8 i2,i3,i4,i5,i6,i7?,i8 X NULL # Using union(intersect(i2,i3,i4,i5,i6,i7?),i8); Using where
+select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
+from t0 as A, t0 as B
+where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1)
+and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1);
+max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
+8186
+set join_buffer_size= @save_join_buffer_size;
+drop table t0, t1, t2, t3, t4;
+CREATE TABLE t1 (
+cola char(3) not null, colb char(3) not null, filler char(200),
+key(cola), key(colb)
+);
+INSERT INTO t1 VALUES ('foo','bar', 'ZZ'),('fuz','baz', 'ZZ');
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+select count(*) from t1;
+count(*)
+8704
+explain select * from t1 WHERE cola = 'foo' AND colb = 'bar';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge cola,colb cola,colb 3,3 NULL 32 Using intersect(cola,colb); Using where
+explain select * from t1 force index(cola,colb) WHERE cola = 'foo' AND colb = 'bar';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge cola,colb cola,colb 3,3 NULL 32 Using intersect(cola,colb); Using where
+drop table t1;
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (
+a int, b int,
+filler1 char(200), filler2 char(200),
+key(a),key(b)
+);
+insert into t1 select @v:= A.a, @v, 't1', 'filler2' from t0 A, t0 B, t0 C;
+create table t2 like t1;
+create table t3 (
+a int, b int,
+filler1 char(200), filler2 char(200),
+key(a),key(b)
+) engine=merge union=(t1,t2);
+explain select * from t1 where a=1 and b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge a,b a,b 5,5 NULL # Using intersect(a,b); Using where
+explain select * from t3 where a=1 and b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 index_merge a,b a,b 5,5 NULL # Using intersect(a,b); Using where
+drop table t3;
+drop table t0, t1, t2;
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES(1);
+CREATE TABLE t2(a INT, b INT, dummy CHAR(16) DEFAULT '', KEY(a), KEY(b));
+INSERT INTO t2(a,b) VALUES
+(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
+(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
+(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
+(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
+(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
+(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
+(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
+(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
+(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
+(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
+(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
+(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
+(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
+(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
+(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
+(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
+(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
+(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
+(1,2);
+LOCK TABLES t1 WRITE, t2 WRITE;
+INSERT INTO t2(a,b) VALUES(1,2);
+SELECT t2.a FROM t1,t2 WHERE t2.b=2 AND t2.a=1;
+a
+1
+1
+UNLOCK TABLES;
+DROP TABLE t1, t2;
+#---------------- ROR-index_merge tests -----------------------
+SET SESSION STORAGE_ENGINE = MyISAM;
+drop table if exists t0,t1,t2;
+create table t1
+(
+/* Field names reflect value(rowid) distribution, st=STairs, swt= SaWTooth */
+st_a int not null default 0,
+swt1a int not null default 0,
+swt2a int not null default 0,
+st_b int not null default 0,
+swt1b int not null default 0,
+swt2b int not null default 0,
+/* fields/keys for row retrieval tests */
+key1 int,
+key2 int,
+key3 int,
+key4 int,
+/* make rows much bigger then keys */
+filler1 char (200),
+filler2 char (200),
+filler3 char (200),
+filler4 char (200),
+filler5 char (200),
+filler6 char (200),
+/* order of keys is important */
+key sta_swt12a(st_a,swt1a,swt2a),
+key sta_swt1a(st_a,swt1a),
+key sta_swt2a(st_a,swt2a),
+key sta_swt21a(st_a,swt2a,swt1a),
+key st_a(st_a),
+key stb_swt1a_2b(st_b,swt1b,swt2a),
+key stb_swt1b(st_b,swt1b),
+key st_b(st_b),
+key(key1),
+key(key2),
+key(key3),
+key(key4)
+) ;
+create table t0 as select * from t1;
+# Printing of many insert into t0 values (....) disabled.
+alter table t1 disable keys;
+# Printing of many insert into t1 select .... from t0 disabled.
+# Printing of many insert into t1 (...) values (....) disabled.
+alter table t1 enable keys;
+select count(*) from t1;
+count(*)
+64801
+explain select key1,key2 from t1 where key1=100 and key2=100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 77 Using intersect(key1,key2); Using where; Using index
+select key1,key2 from t1 where key1=100 and key2=100;
+key1 key2
+100 100
+explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 Using union(intersect(key1,key2),intersect(key3,key4)); Using where
+select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
+key1 key2 key3 key4 filler1
+100 100 100 100 key1-key2-key3-key4
+insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, -1, -1, 'key1-key2');
+insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, 100, 100, 'key4-key3');
+explain select key1,key2,filler1 from t1 where key1=100 and key2=100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 77 Using intersect(key1,key2); Using where
+select key1,key2,filler1 from t1 where key1=100 and key2=100;
+key1 key2 filler1
+100 100 key1-key2-key3-key4
+100 100 key1-key2
+explain select key1,key2 from t1 where key1=100 and key2=100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 77 Using intersect(key1,key2); Using where; Using index
+select key1,key2 from t1 where key1=100 and key2=100;
+key1 key2
+100 100
+100 100
+explain select key1,key2,key3,key4 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 Using union(intersect(key1,key2),intersect(key3,key4)); Using where
+select key1,key2,key3,key4 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
+key1 key2 key3 key4
+100 100 100 100
+100 100 -1 -1
+-1 -1 100 100
+explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 Using union(intersect(key1,key2),intersect(key3,key4)); Using where
+select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
+key1 key2 key3 key4 filler1
+100 100 100 100 key1-key2-key3-key4
+100 100 -1 -1 key1-key2
+-1 -1 100 100 key4-key3
+explain select key1,key2,key3 from t1 where key1=100 and key2=100 and key3=100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge key1,key2,key3 key1,key2,key3 5,5,5 NULL 2 Using intersect(key1,key2,key3); Using where; Using index
+select key1,key2,key3 from t1 where key1=100 and key2=100 and key3=100;
+key1 key2 key3
+100 100 100
+insert into t1 (key1,key2,key3,key4,filler1) values (101,101,101,101, 'key1234-101');
+explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=101;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge key1,key2,key3 key1,key2,key3 5,5,5 NULL 83 Using union(intersect(key1,key2),key3); Using where
+select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=101;
+key1 key2 key3 key4 filler1
+100 100 100 100 key1-key2-key3-key4
+100 100 -1 -1 key1-key2
+101 101 101 101 key1234-101
+select key1,key2, filler1 from t1 where key1=100 and key2=100;
+key1 key2 filler1
+100 100 key1-key2-key3-key4
+100 100 key1-key2
+update t1 set filler1='to be deleted' where key1=100 and key2=100;
+update t1 set key1=200,key2=200 where key1=100 and key2=100;
+delete from t1 where key1=200 and key2=200;
+select key1,key2,filler1 from t1 where key2=100 and key2=200;
+key1 key2 filler1
+explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 152 Using union(intersect(key1,key2),intersect(key3,key4)); Using where
+select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
+key1 key2 key3 key4 filler1
+-1 -1 100 100 key4-key3
+delete from t1 where key3=100 and key4=100;
+explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 152 Using union(intersect(key1,key2),intersect(key3,key4)); Using where
+select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
+key1 key2 key3 key4 filler1
+explain select key1,key2 from t1 where key1=100 and key2=100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 76 Using intersect(key1,key2); Using where; Using index
+select key1,key2 from t1 where key1=100 and key2=100;
+key1 key2
+insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-1');
+insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-2');
+insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-3');
+explain select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge key1,key2,key3,key4 key3,key1,key2,key4 5,5,5,5 NULL 136 Using union(key3,intersect(key1,key2),key4); Using where
+select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200;
+key1 key2 key3 key4 filler1
+100 100 200 200 key1-key2-key3-key4-3
+100 100 200 200 key1-key2-key3-key4-2
+100 100 200 200 key1-key2-key3-key4-1
+insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, -1, 200,'key4');
+explain select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge key1,key2,key3,key4 key3,key1,key2,key4 5,5,5,5 NULL 146 Using union(key3,intersect(key1,key2),key4); Using where
+select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200;
+key1 key2 key3 key4 filler1
+100 100 200 200 key1-key2-key3-key4-3
+100 100 200 200 key1-key2-key3-key4-2
+100 100 200 200 key1-key2-key3-key4-1
+-1 -1 -1 200 key4
+insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, 200, -1,'key3');
+explain select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge key1,key2,key3,key4 key3,key1,key2,key4 5,5,5,5 NULL 156 Using union(key3,intersect(key1,key2),key4); Using where
+select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200;
+key1 key2 key3 key4 filler1
+100 100 200 200 key1-key2-key3-key4-3
+100 100 200 200 key1-key2-key3-key4-2
+100 100 200 200 key1-key2-key3-key4-1
+-1 -1 -1 200 key4
+-1 -1 200 -1 key3
+explain select * from t1 where st_a=1 and st_b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b st_a,st_b 4,4 NULL 3515 Using intersect(st_a,st_b); Using where
+explain select st_a,st_b from t1 where st_a=1 and st_b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b st_a,st_b 4,4 NULL 3515 Using intersect(st_a,st_b); Using where; Using index
+explain select st_a from t1 ignore index (st_a) where st_a=1 and st_b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,stb_swt1a_2b,stb_swt1b,st_b st_b 4 const 15093 Using where
+explain select * from t1 where st_a=1 and swt1a=1 and swt2a=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a sta_swt21a 12 const,const,const 971
+explain select * from t1 where st_b=1 and swt1b=1 and swt2b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref stb_swt1a_2b,stb_swt1b,st_b stb_swt1a_2b 8 const,const 3879 Using where
+explain select * from t1 where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt12a,stb_swt1a_2b 12,12 NULL 58 Using intersect(sta_swt12a,stb_swt1a_2b); Using where
+explain select * from t1 ignore index (sta_swt21a, stb_swt1a_2b)
+where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,st_a,stb_swt1b,st_b sta_swt12a,stb_swt1b 12,8 NULL 58 Using intersect(sta_swt12a,stb_swt1b); Using where
+explain select * from t1 ignore index (sta_swt21a, sta_swt12a, stb_swt1a_2b)
+where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge sta_swt1a,sta_swt2a,st_a,stb_swt1b,st_b sta_swt1a,sta_swt2a,stb_swt1b 8,8,8 NULL 57 Using intersect(sta_swt1a,sta_swt2a,stb_swt1b); Using where
+explain select * from t1 ignore index (sta_swt21a, sta_swt12a, stb_swt1a_2b, stb_swt1b)
+where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge sta_swt1a,sta_swt2a,st_a,st_b sta_swt1a,sta_swt2a,st_b 8,8,4 NULL 223 Using intersect(sta_swt1a,sta_swt2a,st_b); Using where
+explain select * from t1
+where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt12a,stb_swt1a_2b 12,12 NULL 58 Using intersect(sta_swt12a,stb_swt1a_2b); Using where
+explain select * from t1
+where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt1a,stb_swt1b 8,8 NULL 232 Using intersect(sta_swt1a,stb_swt1b); Using where
+explain select st_a from t1
+where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt1a,stb_swt1b 8,8 NULL 232 Using intersect(sta_swt1a,stb_swt1b); Using where; Using index
+explain select st_a from t1
+where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt1a,stb_swt1b 8,8 NULL 232 Using intersect(sta_swt1a,stb_swt1b); Using where; Using index
+drop table t0,t1;
+create table t2 (
+a char(10),
+b char(10),
+filler1 char(255),
+filler2 char(255),
+key(a(5)),
+key(b(5))
+);
+select count(a) from t2 where a='BBBBBBBB';
+count(a)
+4
+select count(a) from t2 where b='BBBBBBBB';
+count(a)
+4
+expla_or_bin select count(a_or_b) from t2 where a_or_b='AAAAAAAA' a_or_bnd a_or_b='AAAAAAAA';
+id select_type ta_or_ba_or_ble type possia_or_ble_keys key key_len ref rows Extra_or_b
+1 SIMPLE t2 ref a_or_b,a_or_b a_or_b 6 const 4 Using where
+select count(a) from t2 where a='AAAAAAAA' and b='AAAAAAAA';
+count(a)
+4
+select count(a) from t2 ignore index(a,b) where a='AAAAAAAA' and b='AAAAAAAA';
+count(a)
+4
+insert into t2 values ('ab', 'ab', 'uh', 'oh');
+explain select a from t2 where a='ab';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref a a 6 const 1 Using where
+drop table t2;
+#---------------- Index merge test 2 -------------------------------------------
+SET SESSION STORAGE_ENGINE = MyISAM;
+drop table if exists t1,t2;
+create table t1
+(
+key1 int not null,
+key2 int not null,
+INDEX i1(key1),
+INDEX i2(key2)
+);
+explain select * from t1 where key1 < 5 or key2 > 197;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge i1,i2 i1,i2 4,4 NULL 10 Using sort_union(i1,i2); Using where
+select * from t1 where key1 < 5 or key2 > 197;
+key1 key2
+0 200
+1 199
+2 198
+3 197
+4 196
+explain select * from t1 where key1 < 3 or key2 > 195;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge i1,i2 i1,i2 4,4 NULL 10 Using sort_union(i1,i2); Using where
+select * from t1 where key1 < 3 or key2 > 195;
+key1 key2
+0 200
+1 199
+2 198
+3 197
+4 196
+alter table t1 add str1 char (255) not null,
+add zeroval int not null default 0,
+add str2 char (255) not null,
+add str3 char (255) not null;
+update t1 set str1='aaa', str2='bbb', str3=concat(key2, '-', key1 div 2, '_' ,if(key1 mod 2 = 0, 'a', 'A'));
+alter table t1 add primary key (str1, zeroval, str2, str3);
+explain select * from t1 where key1 < 5 or key2 > 197;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge i1,i2 i1,i2 4,4 NULL 10 Using sort_union(i1,i2); Using where
+select * from t1 where key1 < 5 or key2 > 197;
+key1 key2 str1 zeroval str2 str3
+0 200 aaa 0 bbb 200-0_a
+1 199 aaa 0 bbb 199-0_A
+2 198 aaa 0 bbb 198-1_a
+3 197 aaa 0 bbb 197-1_A
+4 196 aaa 0 bbb 196-2_a
+explain select * from t1 where key1 < 3 or key2 > 195;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge i1,i2 i1,i2 4,4 NULL 10 Using sort_union(i1,i2); Using where
+select * from t1 where key1 < 3 or key2 > 195;
+key1 key2 str1 zeroval str2 str3
+0 200 aaa 0 bbb 200-0_a
+1 199 aaa 0 bbb 199-0_A
+2 198 aaa 0 bbb 198-1_a
+3 197 aaa 0 bbb 197-1_A
+4 196 aaa 0 bbb 196-2_a
+drop table t1;
+create table t1 (
+pk integer not null auto_increment primary key,
+key1 integer,
+key2 integer not null,
+filler char (200),
+index (key1),
+index (key2)
+);
+show warnings;
+Level Code Message
+explain select pk from t1 where key1 = 1 and key2 = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref key1,key2 key1 5 const 4 Using where
+select pk from t1 where key2 = 1 and key1 = 1;
+pk
+26
+27
+select pk from t1 ignore index(key1,key2) where key2 = 1 and key1 = 1;
+pk
+26
+27
+drop table t1;
+create table t1 (
+pk int primary key auto_increment,
+key1a int,
+key2a int,
+key1b int,
+key2b int,
+dummy1 int,
+dummy2 int,
+dummy3 int,
+dummy4 int,
+key3a int,
+key3b int,
+filler1 char (200),
+index i1(key1a, key1b),
+index i2(key2a, key2b),
+index i3(key3a, key3b)
+);
+create table t2 (a int);
+insert into t2 values (0),(1),(2),(3),(4),(NULL);
+insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
+select A.a, B.a, C.a, D.a, C.a, D.a from t2 A,t2 B,t2 C, t2 D;
+insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
+select key1a, key1b, key2a, key2b, key3a, key3b from t1;
+insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
+select key1a, key1b, key2a, key2b, key3a, key3b from t1;
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+select count(*) from t1;
+count(*)
+5184
+explain select count(*) from t1 where
+key1a = 2 and key1b is null and key2a = 2 and key2b is null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge i1,i2 i1,i2 10,10 NULL 2 Using intersect(i1,i2); Using where; Using index
+select count(*) from t1 where
+key1a = 2 and key1b is null and key2a = 2 and key2b is null;
+count(*)
+4
+explain select count(*) from t1 where
+key1a = 2 and key1b is null and key3a = 2 and key3b is null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge i1,i3 i1,i3 10,10 NULL 2 Using intersect(i1,i3); Using where; Using index
+select count(*) from t1 where
+key1a = 2 and key1b is null and key3a = 2 and key3b is null;
+count(*)
+4
+drop table t1,t2;
+create table t1 (
+id1 int,
+id2 date ,
+index idx2 (id1,id2),
+index idx1 (id2)
+);
+insert into t1 values(1,'20040101'), (2,'20040102');
+select * from t1 where id1 = 1 and id2= '20040101';
+id1 id2
+1 2004-01-01
+drop table t1;
+drop view if exists v1;
+CREATE TABLE t1 (
+`oid` int(11) unsigned NOT NULL auto_increment,
+`fk_bbk_niederlassung` int(11) unsigned NOT NULL,
+`fk_wochentag` int(11) unsigned NOT NULL,
+`uhrzeit_von` time NOT NULL COMMENT 'HH:MM',
+`uhrzeit_bis` time NOT NULL COMMENT 'HH:MM',
+`geloescht` tinyint(4) NOT NULL,
+`version` int(5) NOT NULL,
+PRIMARY KEY (`oid`),
+KEY `fk_bbk_niederlassung` (`fk_bbk_niederlassung`),
+KEY `fk_wochentag` (`fk_wochentag`),
+KEY `ix_version` (`version`)
+) DEFAULT CHARSET=latin1;
+insert into t1 values
+(1, 38, 1, '08:00:00', '13:00:00', 0, 1),
+(2, 38, 2, '08:00:00', '13:00:00', 0, 1),
+(3, 38, 3, '08:00:00', '13:00:00', 0, 1),
+(4, 38, 4, '08:00:00', '13:00:00', 0, 1),
+(5, 38, 5, '08:00:00', '13:00:00', 0, 1),
+(6, 38, 5, '08:00:00', '13:00:00', 1, 2),
+(7, 38, 3, '08:00:00', '13:00:00', 1, 2),
+(8, 38, 1, '08:00:00', '13:00:00', 1, 2),
+(9, 38, 2, '08:00:00', '13:00:00', 1, 2),
+(10, 38, 4, '08:00:00', '13:00:00', 1, 2),
+(11, 38, 1, '08:00:00', '13:00:00', 0, 3),
+(12, 38, 2, '08:00:00', '13:00:00', 0, 3),
+(13, 38, 3, '08:00:00', '13:00:00', 0, 3),
+(14, 38, 4, '08:00:00', '13:00:00', 0, 3),
+(15, 38, 5, '08:00:00', '13:00:00', 0, 3),
+(16, 38, 4, '08:00:00', '13:00:00', 0, 4),
+(17, 38, 5, '08:00:00', '13:00:00', 0, 4),
+(18, 38, 1, '08:00:00', '13:00:00', 0, 4),
+(19, 38, 2, '08:00:00', '13:00:00', 0, 4),
+(20, 38, 3, '08:00:00', '13:00:00', 0, 4),
+(21, 7, 1, '08:00:00', '13:00:00', 0, 1),
+(22, 7, 2, '08:00:00', '13:00:00', 0, 1),
+(23, 7, 3, '08:00:00', '13:00:00', 0, 1),
+(24, 7, 4, '08:00:00', '13:00:00', 0, 1),
+(25, 7, 5, '08:00:00', '13:00:00', 0, 1);
+create view v1 as
+select
+zeit1.oid AS oid,
+zeit1.fk_bbk_niederlassung AS fk_bbk_niederlassung,
+zeit1.fk_wochentag AS fk_wochentag,
+zeit1.uhrzeit_von AS uhrzeit_von,
+zeit1.uhrzeit_bis AS uhrzeit_bis,
+zeit1.geloescht AS geloescht,
+zeit1.version AS version
+from
+t1 zeit1
+where
+(zeit1.version =
+(select max(zeit2.version) AS `max(version)`
+ from t1 zeit2
+where
+((zeit1.fk_bbk_niederlassung = zeit2.fk_bbk_niederlassung) and
+(zeit1.fk_wochentag = zeit2.fk_wochentag) and
+(zeit1.uhrzeit_von = zeit2.uhrzeit_von) and
+(zeit1.uhrzeit_bis = zeit2.uhrzeit_bis)
+)
+)
+)
+and (zeit1.geloescht = 0);
+select * from v1 where oid = 21;
+oid fk_bbk_niederlassung fk_wochentag uhrzeit_von uhrzeit_bis geloescht version
+21 7 1 08:00:00 13:00:00 0 1
+drop view v1;
+drop table t1;
+CREATE TABLE t1(
+t_cpac varchar(2) NOT NULL,
+t_vers varchar(4) NOT NULL,
+t_rele varchar(2) NOT NULL,
+t_cust varchar(4) NOT NULL,
+filler1 char(250) default NULL,
+filler2 char(250) default NULL,
+PRIMARY KEY (t_cpac,t_vers,t_rele,t_cust),
+UNIQUE KEY IX_4 (t_cust,t_cpac,t_vers,t_rele),
+KEY IX_5 (t_vers,t_rele,t_cust)
+);
+insert into t1 values
+('tm','2.5 ','a ',' ','',''), ('tm','2.5U','a ','stnd','',''),
+('da','3.3 ','b ',' ','',''), ('da','3.3U','b ','stnd','',''),
+('tl','7.6 ','a ',' ','',''), ('tt','7.6 ','a ',' ','',''),
+('bc','B61 ','a ',' ','',''), ('bp','B61 ','a ',' ','',''),
+('ca','B61 ','a ',' ','',''), ('ci','B61 ','a ',' ','',''),
+('cp','B61 ','a ',' ','',''), ('dm','B61 ','a ',' ','',''),
+('ec','B61 ','a ',' ','',''), ('ed','B61 ','a ',' ','',''),
+('fm','B61 ','a ',' ','',''), ('nt','B61 ','a ',' ','',''),
+('qm','B61 ','a ',' ','',''), ('tc','B61 ','a ',' ','',''),
+('td','B61 ','a ',' ','',''), ('tf','B61 ','a ',' ','',''),
+('tg','B61 ','a ',' ','',''), ('ti','B61 ','a ',' ','',''),
+('tp','B61 ','a ',' ','',''), ('ts','B61 ','a ',' ','',''),
+('wh','B61 ','a ',' ','',''), ('bc','B61U','a ','stnd','',''),
+('bp','B61U','a ','stnd','',''), ('ca','B61U','a ','stnd','',''),
+('ci','B61U','a ','stnd','',''), ('cp','B61U','a ','stnd','',''),
+('dm','B61U','a ','stnd','',''), ('ec','B61U','a ','stnd','',''),
+('fm','B61U','a ','stnd','',''), ('nt','B61U','a ','stnd','',''),
+('qm','B61U','a ','stnd','',''), ('tc','B61U','a ','stnd','',''),
+('td','B61U','a ','stnd','',''), ('tf','B61U','a ','stnd','',''),
+('tg','B61U','a ','stnd','',''), ('ti','B61U','a ','stnd','',''),
+('tp','B61U','a ','stnd','',''), ('ts','B61U','a ','stnd','',''),
+('wh','B61U','a ','stnd','','');
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `t_cpac` varchar(2) NOT NULL,
+ `t_vers` varchar(4) NOT NULL,
+ `t_rele` varchar(2) NOT NULL,
+ `t_cust` varchar(4) NOT NULL,
+ `filler1` char(250) DEFAULT NULL,
+ `filler2` char(250) DEFAULT NULL,
+ PRIMARY KEY (`t_cpac`,`t_vers`,`t_rele`,`t_cust`),
+ UNIQUE KEY `IX_4` (`t_cust`,`t_cpac`,`t_vers`,`t_rele`),
+ KEY `IX_5` (`t_vers`,`t_rele`,`t_cust`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6';
+t_vers t_rele t_cust filler1
+7.6 a
+7.6 a
+select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6'
+ and t_rele='a' and t_cust = ' ';
+t_vers t_rele t_cust filler1
+7.6 a
+7.6 a
+drop table t1;
+create table t1 (
+pk int(11) not null auto_increment,
+a int(11) not null default '0',
+b int(11) not null default '0',
+c int(11) not null default '0',
+filler1 datetime, filler2 varchar(15),
+filler3 longtext,
+kp1 varchar(4), kp2 varchar(7),
+kp3 varchar(2), kp4 varchar(4),
+kp5 varchar(7),
+filler4 char(1),
+primary key (pk),
+key idx1(a,b,c),
+key idx2(c),
+key idx3(kp1,kp2,kp3,kp4,kp5)
+) default charset=latin1;
+set @fill=NULL;
+SELECT COUNT(*) FROM t1 WHERE b = 0 AND a = 0 AND c = 13286427 AND
+kp1='279' AND kp2='ELM0678' AND kp3='6' AND kp4='10' AND kp5 = 'R ';
+COUNT(*)
+1
+drop table t1;
+create table t1
+(
+key1 int not null,
+key2 int not null default 0,
+key3 int not null default 0
+);
+insert into t1(key1) values (1),(2),(3),(4),(5),(6),(7),(8);
+set @d=8;
+insert into t1 (key1) select key1+@d from t1;
+set @d=@d*2;
+insert into t1 (key1) select key1+@d from t1;
+set @d=@d*2;
+insert into t1 (key1) select key1+@d from t1;
+set @d=@d*2;
+insert into t1 (key1) select key1+@d from t1;
+set @d=@d*2;
+insert into t1 (key1) select key1+@d from t1;
+set @d=@d*2;
+insert into t1 (key1) select key1+@d from t1;
+set @d=@d*2;
+insert into t1 (key1) select key1+@d from t1;
+set @d=@d*2;
+alter table t1 add index i2(key2);
+alter table t1 add index i3(key3);
+update t1 set key2=key1,key3=key1;
+explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge i2,i3 i3,i2 4,4 NULL 11 Using sort_union(i3,i2); Using where
+select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
+key1 key2 key3
+31 31 31
+32 32 32
+33 33 33
+34 34 34
+35 35 35
+36 36 36
+37 37 37
+38 38 38
+39 39 39
+drop table t1;
+#---------------- 2-sweeps read Index merge test 2 -------------------------------
+SET SESSION STORAGE_ENGINE = MyISAM;
+drop table if exists t1;
+create table t1 (
+pk int primary key,
+key1 int,
+key2 int,
+filler char(200),
+filler2 char(200),
+index(key1),
+index(key2)
+);
+select * from t1 where (key1 >= 2 and key1 <= 10) or (pk >= 4 and pk <=8 );
+pk key1 key2 filler filler2
+10 10 10 filler-data filler-data-2
+9 9 9 filler-data filler-data-2
+8 8 8 filler-data filler-data-2
+7 7 7 filler-data filler-data-2
+6 6 6 filler-data filler-data-2
+5 5 5 filler-data filler-data-2
+4 4 4 filler-data filler-data-2
+3 3 3 filler-data filler-data-2
+2 2 2 filler-data filler-data-2
+set @maxv=1000;
+select * from t1 where
+(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
+or key1=18 or key1=60;
+pk key1 key2 filler filler2
+1000 1000 1000 filler-data filler-data-2
+999 999 999 filler-data filler-data-2
+998 998 998 filler-data filler-data-2
+997 997 997 filler-data filler-data-2
+996 996 996 filler-data filler-data-2
+995 995 995 filler-data filler-data-2
+994 994 994 filler-data filler-data-2
+993 993 993 filler-data filler-data-2
+992 992 992 filler-data filler-data-2
+991 991 991 filler-data filler-data-2
+60 60 60 filler-data filler-data-2
+54 54 54 filler-data filler-data-2
+53 53 53 filler-data filler-data-2
+52 52 52 filler-data filler-data-2
+51 51 51 filler-data filler-data-2
+50 50 50 filler-data filler-data-2
+18 18 18 filler-data filler-data-2
+14 14 14 filler-data filler-data-2
+13 13 13 filler-data filler-data-2
+12 12 12 filler-data filler-data-2
+11 11 11 filler-data filler-data-2
+4 4 4 filler-data filler-data-2
+3 3 3 filler-data filler-data-2
+2 2 2 filler-data filler-data-2
+1 1 1 filler-data filler-data-2
+select * from t1 where
+(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
+or key1 < 3 or key1 > @maxv-11;
+pk key1 key2 filler filler2
+1000 1000 1000 filler-data filler-data-2
+999 999 999 filler-data filler-data-2
+998 998 998 filler-data filler-data-2
+997 997 997 filler-data filler-data-2
+996 996 996 filler-data filler-data-2
+995 995 995 filler-data filler-data-2
+994 994 994 filler-data filler-data-2
+993 993 993 filler-data filler-data-2
+992 992 992 filler-data filler-data-2
+991 991 991 filler-data filler-data-2
+990 990 990 filler-data filler-data-2
+54 54 54 filler-data filler-data-2
+53 53 53 filler-data filler-data-2
+52 52 52 filler-data filler-data-2
+51 51 51 filler-data filler-data-2
+50 50 50 filler-data filler-data-2
+14 14 14 filler-data filler-data-2
+13 13 13 filler-data filler-data-2
+12 12 12 filler-data filler-data-2
+11 11 11 filler-data filler-data-2
+4 4 4 filler-data filler-data-2
+3 3 3 filler-data filler-data-2
+2 2 2 filler-data filler-data-2
+1 1 1 filler-data filler-data-2
+select * from t1 where
+(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
+or
+(key1 < 5) or (key1 > 10 and key1 < 15) or (key1 >= 50 and key1 < 55 ) or (key1 > @maxv-10);
+pk key1 key2 filler filler2
+1000 1000 1000 filler-data filler-data-2
+999 999 999 filler-data filler-data-2
+998 998 998 filler-data filler-data-2
+997 997 997 filler-data filler-data-2
+996 996 996 filler-data filler-data-2
+995 995 995 filler-data filler-data-2
+994 994 994 filler-data filler-data-2
+993 993 993 filler-data filler-data-2
+992 992 992 filler-data filler-data-2
+991 991 991 filler-data filler-data-2
+54 54 54 filler-data filler-data-2
+53 53 53 filler-data filler-data-2
+52 52 52 filler-data filler-data-2
+51 51 51 filler-data filler-data-2
+50 50 50 filler-data filler-data-2
+14 14 14 filler-data filler-data-2
+13 13 13 filler-data filler-data-2
+12 12 12 filler-data filler-data-2
+11 11 11 filler-data filler-data-2
+4 4 4 filler-data filler-data-2
+3 3 3 filler-data filler-data-2
+2 2 2 filler-data filler-data-2
+1 1 1 filler-data filler-data-2
+select * from t1 where
+(pk > 10 and pk < 15) or (pk >= 50 and pk < 55 )
+or
+(key1 < 5) or (key1 > @maxv-10);
+pk key1 key2 filler filler2
+1000 1000 1000 filler-data filler-data-2
+999 999 999 filler-data filler-data-2
+998 998 998 filler-data filler-data-2
+997 997 997 filler-data filler-data-2
+996 996 996 filler-data filler-data-2
+995 995 995 filler-data filler-data-2
+994 994 994 filler-data filler-data-2
+993 993 993 filler-data filler-data-2
+992 992 992 filler-data filler-data-2
+991 991 991 filler-data filler-data-2
+54 54 54 filler-data filler-data-2
+53 53 53 filler-data filler-data-2
+52 52 52 filler-data filler-data-2
+51 51 51 filler-data filler-data-2
+50 50 50 filler-data filler-data-2
+14 14 14 filler-data filler-data-2
+13 13 13 filler-data filler-data-2
+12 12 12 filler-data filler-data-2
+11 11 11 filler-data filler-data-2
+4 4 4 filler-data filler-data-2
+3 3 3 filler-data filler-data-2
+2 2 2 filler-data filler-data-2
+1 1 1 filler-data filler-data-2
+drop table t1;
+#---------------- Clustered PK ROR-index_merge tests -----------------------------
+SET SESSION STORAGE_ENGINE = MyISAM;
+drop table if exists t1;
+create table t1
+(
+pk1 int not null,
+pk2 int not null,
+key1 int not null,
+key2 int not null,
+pktail1ok int not null,
+pktail2ok int not null,
+pktail3bad int not null,
+pktail4bad int not null,
+pktail5bad int not null,
+pk2copy int not null,
+badkey int not null,
+filler1 char (200),
+filler2 char (200),
+key (key1),
+key (key2),
+/* keys with tails from CPK members */
+key (pktail1ok, pk1),
+key (pktail2ok, pk1, pk2),
+key (pktail3bad, pk2, pk1),
+key (pktail4bad, pk1, pk2copy),
+key (pktail5bad, pk1, pk2, pk2copy),
+primary key (pk1, pk2)
+);
+explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range PRIMARY,key1 PRIMARY 8 NULL 7 Using where
+select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
+pk1 pk2 key1 key2 pktail1ok pktail2ok pktail3bad pktail4bad pktail5bad pk2copy badkey filler1 filler2
+1 10 0 0 0 0 0 0 0 10 0 filler-data-10 filler2
+1 11 0 0 0 0 0 0 0 11 0 filler-data-11 filler2
+1 12 0 0 0 0 0 0 0 12 0 filler-data-12 filler2
+1 13 0 0 0 0 0 0 0 13 0 filler-data-13 filler2
+1 14 0 0 0 0 0 0 0 14 0 filler-data-14 filler2
+1 15 0 0 0 0 0 0 0 15 0 filler-data-15 filler2
+1 16 0 0 0 0 0 0 0 16 0 filler-data-16 filler2
+1 17 0 0 0 0 0 0 0 17 0 filler-data-17 filler2
+1 18 0 0 0 0 0 0 0 18 0 filler-data-18 filler2
+1 19 0 0 0 0 0 0 0 19 0 filler-data-19 filler2
+explain select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge key1,key2 key1,key2 4,4 NULL 1 Using intersect(key1,key2); Using where
+select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1;
+pk1 pk2
+95 59
+95 58
+95 57
+95 56
+95 55
+95 54
+95 53
+95 52
+95 51
+95 50
+explain select * from t1 where badkey=1 and key1=10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref key1 key1 4 const 91 Using where
+explain select * from t1 where pk1 < 7500 and key1 = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref PRIMARY,key1 key1 4 const ROWS Using where
+explain select * from t1 where pktail1ok=1 and key1=10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref key1,pktail1ok pktail1ok 4 const 76 Using where
+explain select * from t1 where pktail2ok=1 and key1=10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref key1,pktail2ok pktail2ok 4 const 82 Using where
+explain select * from t1 where (pktail2ok=1 and pk1< 50000) or key1=10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge PRIMARY,key1,pktail2ok pktail2ok,key1 8,4 NULL 173 Using sort_union(pktail2ok,key1); Using where
+explain select * from t1 where pktail3bad=1 and key1=10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref key1,pktail3bad pktail3bad 4 const 73 Using where
+explain select * from t1 where pktail4bad=1 and key1=10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref key1,pktail4bad pktail4bad 4 const 82 Using where
+explain select * from t1 where pktail5bad=1 and key1=10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref key1,pktail5bad pktail5bad 4 const 70 Using where
+explain select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge key1,key2 key1,key2 4,4 NULL 1 Using intersect(key1,key2); Using where
+select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10;
+pk1 pk2 key1 key2
+104 49 10 10
+104 48 10 10
+104 47 10 10
+104 46 10 10
+104 45 10 10
+104 44 10 10
+104 43 10 10
+104 42 10 10
+104 41 10 10
+104 40 10 10
+drop table t1;
+create table t1
+(
+RUNID varchar(22),
+SUBMITNR varchar(5),
+ORDERNR char(1),
+PROGRAMM varchar(8),
+TESTID varchar(4),
+UCCHECK char(1),
+ETEXT varchar(80),
+ETEXT_TYPE char(1),
+INFO char(1),
+SEVERITY tinyint(3),
+TADIRFLAG char(1),
+PRIMARY KEY (RUNID,SUBMITNR,ORDERNR,PROGRAMM,TESTID,UCCHECK),
+KEY `TVERM~KEY` (PROGRAMM,TESTID,UCCHECK)
+) DEFAULT CHARSET=latin1;
+update t1 set `ETEXT` = '', `ETEXT_TYPE`='', `INFO`='', `SEVERITY`='', `TADIRFLAG`=''
+WHERE
+`RUNID`= '' AND `SUBMITNR`= '' AND `ORDERNR`='' AND `PROGRAMM`='' AND
+`TESTID`='' AND `UCCHECK`='';
+drop table t1;
diff --git a/mysql-test/r/index_merge_ror.result b/mysql-test/r/index_merge_ror.result
deleted file mode 100644
index 69cd11d1dbf..00000000000
--- a/mysql-test/r/index_merge_ror.result
+++ /dev/null
@@ -1,196 +0,0 @@
-drop table if exists t0,t1,t2;
-select count(*) from t1;
-count(*)
-64801
-explain select key1,key2 from t1 where key1=100 and key2=100;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 58 Using intersect(key1,key2); Using where; Using index
-select key1,key2 from t1 where key1=100 and key2=100;
-key1 key2
-100 100
-explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 Using union(intersect(key1,key2),intersect(key3,key4)); Using where
-select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
-key1 key2 key3 key4 filler1
-100 100 100 100 key1-key2-key3-key4
-insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, -1, -1, 'key1-key2');
-insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, 100, 100, 'key4-key3');
-explain select key1,key2,filler1 from t1 where key1=100 and key2=100;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 58 Using intersect(key1,key2); Using where
-select key1,key2,filler1 from t1 where key1=100 and key2=100;
-key1 key2 filler1
-100 100 key1-key2-key3-key4
-100 100 key1-key2
-explain select key1,key2 from t1 where key1=100 and key2=100;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 58 Using intersect(key1,key2); Using where; Using index
-select key1,key2 from t1 where key1=100 and key2=100;
-key1 key2
-100 100
-100 100
-explain select key1,key2,key3,key4 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 Using union(intersect(key1,key2),intersect(key3,key4)); Using where
-select key1,key2,key3,key4 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
-key1 key2 key3 key4
-100 100 100 100
-100 100 -1 -1
--1 -1 100 100
-explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 Using union(intersect(key1,key2),intersect(key3,key4)); Using where
-select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
-key1 key2 key3 key4 filler1
-100 100 100 100 key1-key2-key3-key4
-100 100 -1 -1 key1-key2
--1 -1 100 100 key4-key3
-explain select key1,key2,key3 from t1 where key1=100 and key2=100 and key3=100;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge key1,key2,key3 key1,key2,key3 5,5,5 NULL 2 Using intersect(key1,key2,key3); Using where; Using index
-select key1,key2,key3 from t1 where key1=100 and key2=100 and key3=100;
-key1 key2 key3
-100 100 100
-insert into t1 (key1,key2,key3,key4,filler1) values (101,101,101,101, 'key1234-101');
-explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=101;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge key1,key2,key3 key1,key2,key3 5,5,5 NULL 83 Using union(intersect(key1,key2),key3); Using where
-select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=101;
-key1 key2 key3 key4 filler1
-100 100 100 100 key1-key2-key3-key4
-100 100 -1 -1 key1-key2
-101 101 101 101 key1234-101
-select key1,key2, filler1 from t1 where key1=100 and key2=100;
-key1 key2 filler1
-100 100 key1-key2-key3-key4
-100 100 key1-key2
-update t1 set filler1='to be deleted' where key1=100 and key2=100;
-update t1 set key1=200,key2=200 where key1=100 and key2=100;
-delete from t1 where key1=200 and key2=200;
-select key1,key2,filler1 from t1 where key2=100 and key2=200;
-key1 key2 filler1
-explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 152 Using union(intersect(key1,key2),intersect(key3,key4)); Using where
-select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
-key1 key2 key3 key4 filler1
--1 -1 100 100 key4-key3
-delete from t1 where key3=100 and key4=100;
-explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 152 Using union(intersect(key1,key2),intersect(key3,key4)); Using where
-select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
-key1 key2 key3 key4 filler1
-explain select key1,key2 from t1 where key1=100 and key2=100;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 57 Using intersect(key1,key2); Using where; Using index
-select key1,key2 from t1 where key1=100 and key2=100;
-key1 key2
-insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-1');
-insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-2');
-insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-3');
-explain select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge key1,key2,key3,key4 key3,key1,key2,key4 5,5,5,5 NULL 136 Using union(key3,intersect(key1,key2),key4); Using where
-select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200;
-key1 key2 key3 key4 filler1
-100 100 200 200 key1-key2-key3-key4-3
-100 100 200 200 key1-key2-key3-key4-2
-100 100 200 200 key1-key2-key3-key4-1
-insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, -1, 200,'key4');
-explain select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge key1,key2,key3,key4 key3,key1,key2,key4 5,5,5,5 NULL 146 Using union(key3,intersect(key1,key2),key4); Using where
-select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200;
-key1 key2 key3 key4 filler1
-100 100 200 200 key1-key2-key3-key4-3
-100 100 200 200 key1-key2-key3-key4-2
-100 100 200 200 key1-key2-key3-key4-1
--1 -1 -1 200 key4
-insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, 200, -1,'key3');
-explain select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge key1,key2,key3,key4 key3,key1,key2,key4 5,5,5,5 NULL 156 Using union(key3,intersect(key1,key2),key4); Using where
-select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200;
-key1 key2 key3 key4 filler1
-100 100 200 200 key1-key2-key3-key4-3
-100 100 200 200 key1-key2-key3-key4-2
-100 100 200 200 key1-key2-key3-key4-1
--1 -1 -1 200 key4
--1 -1 200 -1 key3
-explain select * from t1 where st_a=1 and st_b=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b st_a,st_b 4,4 NULL 2637 Using intersect(st_a,st_b); Using where
-explain select st_a,st_b from t1 where st_a=1 and st_b=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b st_a,st_b 4,4 NULL 2637 Using intersect(st_a,st_b); Using where; Using index
-explain select st_a from t1 ignore index (st_a) where st_a=1 and st_b=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,stb_swt1a_2b,stb_swt1b,st_b st_b 4 const 15093 Using where
-explain select * from t1 where st_a=1 and swt1a=1 and swt2a=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a sta_swt21a 12 const,const,const 971
-explain select * from t1 where st_b=1 and swt1b=1 and swt2b=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref stb_swt1a_2b,stb_swt1b,st_b stb_swt1a_2b 8 const,const 3879 Using where
-explain select * from t1 where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt12a,stb_swt1a_2b 12,12 NULL 44 Using intersect(sta_swt12a,stb_swt1a_2b); Using where
-explain select * from t1 ignore index (sta_swt21a, stb_swt1a_2b)
-where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,st_a,stb_swt1b,st_b sta_swt12a,stb_swt1b 12,8 NULL 44 Using intersect(sta_swt12a,stb_swt1b); Using where
-explain select * from t1 ignore index (sta_swt21a, sta_swt12a, stb_swt1a_2b)
-where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge sta_swt1a,sta_swt2a,st_a,stb_swt1b,st_b sta_swt1a,sta_swt2a,stb_swt1b 8,8,8 NULL 43 Using intersect(sta_swt1a,sta_swt2a,stb_swt1b); Using where
-explain select * from t1 ignore index (sta_swt21a, sta_swt12a, stb_swt1a_2b, stb_swt1b)
-where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge sta_swt1a,sta_swt2a,st_a,st_b sta_swt1a,sta_swt2a,st_b 8,8,4 NULL 168 Using intersect(sta_swt1a,sta_swt2a,st_b); Using where
-explain select * from t1
-where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt12a,stb_swt1a_2b 12,12 NULL 44 Using intersect(sta_swt12a,stb_swt1a_2b); Using where
-explain select * from t1
-where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt1a,stb_swt1b 8,8 NULL 174 Using intersect(sta_swt1a,stb_swt1b); Using where
-explain select st_a from t1
-where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt1a,stb_swt1b 8,8 NULL 174 Using intersect(sta_swt1a,stb_swt1b); Using where; Using index
-explain select st_a from t1
-where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt1a,stb_swt1b 8,8 NULL 174 Using intersect(sta_swt1a,stb_swt1b); Using where; Using index
-drop table t0,t1;
-create table t2 (
-a char(10),
-b char(10),
-filler1 char(255),
-filler2 char(255),
-key(a(5)),
-key(b(5))
-);
-select count(a) from t2 where a='BBBBBBBB';
-count(a)
-4
-select count(a) from t2 where b='BBBBBBBB';
-count(a)
-4
-expla_or_bin select count(a_or_b) from t2 where a_or_b='AAAAAAAA' a_or_bnd a_or_b='AAAAAAAA';
-id select_type ta_or_ba_or_ble type possia_or_ble_keys key key_len ref rows Extra_or_b
-1 SIMPLE t2 ref a_or_b,a_or_b a_or_b 6 const 4 Using where
-select count(a) from t2 where a='AAAAAAAA' and b='AAAAAAAA';
-count(a)
-4
-select count(a) from t2 ignore index(a,b) where a='AAAAAAAA' and b='AAAAAAAA';
-count(a)
-4
-insert into t2 values ('ab', 'ab', 'uh', 'oh');
-explain select a from t2 where a='ab';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ref a a 6 const 1 Using where
-drop table t2;
diff --git a/mysql-test/r/index_merge_ror_cpk.result b/mysql-test/r/index_merge_ror_cpk.result
deleted file mode 100644
index 79bb1297abf..00000000000
--- a/mysql-test/r/index_merge_ror_cpk.result
+++ /dev/null
@@ -1,120 +0,0 @@
-drop table if exists t1;
-create table t1
-(
-pk1 int not null,
-pk2 int not null,
-key1 int not null,
-key2 int not null,
-pktail1ok int not null,
-pktail2ok int not null,
-pktail3bad int not null,
-pktail4bad int not null,
-pktail5bad int not null,
-pk2copy int not null,
-badkey int not null,
-filler1 char (200),
-filler2 char (200),
-key (key1),
-key (key2),
-/* keys with tails from CPK members */
-key (pktail1ok, pk1),
-key (pktail2ok, pk1, pk2),
-key (pktail3bad, pk2, pk1),
-key (pktail4bad, pk1, pk2copy),
-key (pktail5bad, pk1, pk2, pk2copy),
-primary key (pk1, pk2)
-) engine=innodb;
-explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range PRIMARY,key1 PRIMARY 8 NULL 9 Using where
-select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
-pk1 pk2 key1 key2 pktail1ok pktail2ok pktail3bad pktail4bad pktail5bad pk2copy badkey filler1 filler2
-1 10 0 0 0 0 0 0 0 10 0 filler-data-10 filler2
-1 11 0 0 0 0 0 0 0 11 0 filler-data-11 filler2
-1 12 0 0 0 0 0 0 0 12 0 filler-data-12 filler2
-1 13 0 0 0 0 0 0 0 13 0 filler-data-13 filler2
-1 14 0 0 0 0 0 0 0 14 0 filler-data-14 filler2
-1 15 0 0 0 0 0 0 0 15 0 filler-data-15 filler2
-1 16 0 0 0 0 0 0 0 16 0 filler-data-16 filler2
-1 17 0 0 0 0 0 0 0 17 0 filler-data-17 filler2
-1 18 0 0 0 0 0 0 0 18 0 filler-data-18 filler2
-1 19 0 0 0 0 0 0 0 19 0 filler-data-19 filler2
-explain select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge key1,key2 key1,key2 4,4 NULL 1 Using intersect(key1,key2); Using where; Using index
-select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1;
-pk1 pk2
-95 50
-95 51
-95 52
-95 53
-95 54
-95 55
-95 56
-95 57
-95 58
-95 59
-explain select * from t1 where badkey=1 and key1=10;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref key1 key1 4 const 100 Using where
-explain select * from t1 where pk1 < 7500 and key1 = 10;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge PRIMARY,key1 key1,PRIMARY 4,4 NULL ROWS Using intersect(key1,PRIMARY); Using where
-explain select * from t1 where pktail1ok=1 and key1=10;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge key1,pktail1ok key1,pktail1ok 4,4 NULL 1 Using intersect(key1,pktail1ok); Using where
-explain select * from t1 where pktail2ok=1 and key1=10;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge key1,pktail2ok key1,pktail2ok 4,4 NULL 1 Using intersect(key1,pktail2ok); Using where
-select ' The following is actually a deficiency, it uses sort_union currently:' as 'note:';
-note:
- The following is actually a deficiency, it uses sort_union currently:
-explain select * from t1 where (pktail2ok=1 and pk1< 50000) or key1=10;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge PRIMARY,key1,pktail2ok pktail2ok,key1 8,4 NULL 199 Using sort_union(pktail2ok,key1); Using where
-explain select * from t1 where pktail3bad=1 and key1=10;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref key1,pktail3bad key1 4 const 100 Using where
-explain select * from t1 where pktail4bad=1 and key1=10;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref key1,pktail4bad key1 4 const 100 Using where
-explain select * from t1 where pktail5bad=1 and key1=10;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref key1,pktail5bad key1 4 const 100 Using where
-explain select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge key1,key2 key1,key2 4,4 NULL 1 Using intersect(key1,key2); Using where; Using index
-select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10;
-pk1 pk2 key1 key2
-95 50 10 10
-95 51 10 10
-95 52 10 10
-95 53 10 10
-95 54 10 10
-95 55 10 10
-95 56 10 10
-95 57 10 10
-95 58 10 10
-95 59 10 10
-drop table t1;
-create table t1
-(
-RUNID varchar(22),
-SUBMITNR varchar(5),
-ORDERNR char(1) ,
-PROGRAMM varchar(8),
-TESTID varchar(4),
-UCCHECK char(1),
-ETEXT varchar(80),
-ETEXT_TYPE char(1),
-INFO char(1),
-SEVERITY tinyint(3),
-TADIRFLAG char(1),
-PRIMARY KEY (RUNID,SUBMITNR,ORDERNR,PROGRAMM,TESTID,UCCHECK),
-KEY `TVERM~KEY` (PROGRAMM,TESTID,UCCHECK)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-update t1 set `ETEXT` = '', `ETEXT_TYPE`='', `INFO`='', `SEVERITY`='', `TADIRFLAG`=''
-WHERE
-`RUNID`= '' AND `SUBMITNR`= '' AND `ORDERNR`='' AND `PROGRAMM`='' AND
-`TESTID`='' AND `UCCHECK`='';
-drop table t1;
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 3fffce73aa9..305e89f0325 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -14,6 +14,7 @@ NULL test latin1 latin1_swedish_ci NULL
select schema_name from information_schema.schemata;
schema_name
information_schema
+cluster
mysql
test
show databases like 't%';
@@ -22,6 +23,7 @@ test
show databases;
Database
information_schema
+cluster
mysql
test
show databases where `database` = 't%';
@@ -33,7 +35,7 @@ create table t3(a int, KEY a_data (a));
create table mysqltest.t4(a int);
create table t5 (id int auto_increment primary key);
insert into t5 values (10);
-create view v1 (c) as select table_name from information_schema.TABLES;
+create view v1 (c) as select table_name from information_schema.TABLES where table_schema!='cluster';
select * from v1;
c
CHARACTER_SETS
@@ -41,10 +43,21 @@ COLLATIONS
COLLATION_CHARACTER_SET_APPLICABILITY
COLUMNS
COLUMN_PRIVILEGES
+ENGINES
+EVENTS
+FILES
+GLOBAL_STATUS
+GLOBAL_VARIABLES
KEY_COLUMN_USAGE
+PARTITIONS
+PLUGINS
+PROCESSLIST
+REFERENTIAL_CONSTRAINTS
ROUTINES
SCHEMATA
SCHEMA_PRIVILEGES
+SESSION_STATUS
+SESSION_VARIABLES
STATISTICS
TABLES
TABLE_CONSTRAINTS
@@ -54,14 +67,18 @@ USER_PRIVILEGES
VIEWS
columns_priv
db
+event
func
+general_log
help_category
help_keyword
help_relation
help_topic
host
+plugin
proc
procs_priv
+slow_log
tables_priv
time_zone
time_zone_leap_second
@@ -185,6 +202,8 @@ select table_name, column_name, privileges from information_schema.columns
where table_schema = 'mysqltest' and table_name = 'v1';
table_name column_name privileges
v1 c select
+explain select * from v1;
+ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
drop view v1, mysqltest.v1;
drop tables mysqltest.t4, mysqltest.t1, t2, t3, t5;
drop database mysqltest;
@@ -333,6 +352,7 @@ create view v0 (c) as select schema_name from information_schema.schemata;
select * from v0;
c
information_schema
+cluster
mysql
test
explain select * from v0;
@@ -400,6 +420,8 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'mysqltest_1'@'localhost' NULL test SHOW VIEW YES
'mysqltest_1'@'localhost' NULL test CREATE ROUTINE YES
'mysqltest_1'@'localhost' NULL test ALTER ROUTINE YES
+'mysqltest_1'@'localhost' NULL test EVENT YES
+'mysqltest_1'@'localhost' NULL test TRIGGER YES
select * from information_schema.TABLE_PRIVILEGES where grantee like '%mysqltest_1%';
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
'mysqltest_1'@'localhost' NULL test t1 SELECT NO
@@ -424,8 +446,8 @@ alter table t1 add constraint constraint_2 unique key_2(a);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL default '0',
- PRIMARY KEY (`a`),
+ `a` int(11) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`a`),
UNIQUE KEY `constraint_1` (`a`),
UNIQUE KEY `key_1` (`a`),
UNIQUE KEY `key_2` (`a`)
@@ -492,25 +514,24 @@ select s1 from t1 where s1 in (select version from
information_schema.tables) union select version from
information_schema.tables;
s1
-0
10
drop table t1;
SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
Table Create Table
CHARACTER_SETS CREATE TEMPORARY TABLE `CHARACTER_SETS` (
- `CHARACTER_SET_NAME` varchar(64) NOT NULL default '',
- `DEFAULT_COLLATE_NAME` varchar(64) NOT NULL default '',
- `DESCRIPTION` varchar(60) NOT NULL default '',
- `MAXLEN` bigint(3) NOT NULL default '0'
+ `CHARACTER_SET_NAME` varchar(64) NOT NULL DEFAULT '',
+ `DEFAULT_COLLATE_NAME` varchar(64) NOT NULL DEFAULT '',
+ `DESCRIPTION` varchar(60) NOT NULL DEFAULT '',
+ `MAXLEN` bigint(3) NOT NULL DEFAULT '0'
) ENGINE=MEMORY DEFAULT CHARSET=utf8
set names latin2;
SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
Table Create Table
CHARACTER_SETS CREATE TEMPORARY TABLE `CHARACTER_SETS` (
- `CHARACTER_SET_NAME` varchar(64) NOT NULL default '',
- `DEFAULT_COLLATE_NAME` varchar(64) NOT NULL default '',
- `DESCRIPTION` varchar(60) NOT NULL default '',
- `MAXLEN` bigint(3) NOT NULL default '0'
+ `CHARACTER_SET_NAME` varchar(64) NOT NULL DEFAULT '',
+ `DEFAULT_COLLATE_NAME` varchar(64) NOT NULL DEFAULT '',
+ `DESCRIPTION` varchar(60) NOT NULL DEFAULT '',
+ `MAXLEN` bigint(3) NOT NULL DEFAULT '0'
) ENGINE=MEMORY DEFAULT CHARSET=utf8
set names latin1;
create table t1 select * from information_schema.CHARACTER_SETS
@@ -522,10 +543,10 @@ alter table t1 default character set utf8;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `CHARACTER_SET_NAME` varchar(64) NOT NULL default '',
- `DEFAULT_COLLATE_NAME` varchar(64) NOT NULL default '',
- `DESCRIPTION` varchar(60) NOT NULL default '',
- `MAXLEN` bigint(3) NOT NULL default '0'
+ `CHARACTER_SET_NAME` varchar(64) NOT NULL DEFAULT '',
+ `DEFAULT_COLLATE_NAME` varchar(64) NOT NULL DEFAULT '',
+ `DESCRIPTION` varchar(60) NOT NULL DEFAULT '',
+ `MAXLEN` bigint(3) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8
drop table t1;
create view v1 as select * from information_schema.TABLES;
@@ -726,11 +747,12 @@ create view v1 as select * from t1, t2;
set @got_val= (select count(*) from information_schema.columns);
drop view v1;
drop table t1, t2;
+use test;
CREATE TABLE t_crashme ( f1 BIGINT);
CREATE VIEW a1 (t_CRASHME) AS SELECT f1 FROM t_crashme GROUP BY f1;
CREATE VIEW a2 AS SELECT t_CRASHME FROM a1;
count(*)
-101
+68
drop view a2, a1;
drop table t_crashme;
select table_schema,table_name, column_name from
@@ -739,8 +761,17 @@ where data_type = 'longtext';
table_schema table_name column_name
information_schema COLUMNS COLUMN_DEFAULT
information_schema COLUMNS COLUMN_TYPE
+information_schema EVENTS EVENT_DEFINITION
+information_schema EVENTS SQL_MODE
+information_schema GLOBAL_VARIABLES VARIABLE_VALUE
+information_schema PARTITIONS PARTITION_EXPRESSION
+information_schema PARTITIONS SUBPARTITION_EXPRESSION
+information_schema PARTITIONS PARTITION_DESCRIPTION
+information_schema PLUGINS PLUGIN_DESCRIPTION
+information_schema PROCESSLIST INFO
information_schema ROUTINES ROUTINE_DEFINITION
information_schema ROUTINES SQL_MODE
+information_schema SESSION_VARIABLES VARIABLE_VALUE
information_schema TRIGGERS ACTION_CONDITION
information_schema TRIGGERS ACTION_STATEMENT
information_schema TRIGGERS SQL_MODE
@@ -749,12 +780,31 @@ information_schema VIEWS VIEW_DEFINITION
select table_name, column_name, data_type from information_schema.columns
where data_type = 'datetime';
table_name column_name data_type
+EVENTS EXECUTE_AT datetime
+EVENTS STARTS datetime
+EVENTS ENDS datetime
+EVENTS CREATED datetime
+EVENTS LAST_ALTERED datetime
+EVENTS LAST_EXECUTED datetime
+FILES CREATION_TIME datetime
+FILES LAST_UPDATE_TIME datetime
+FILES LAST_ACCESS_TIME datetime
+FILES CREATE_TIME datetime
+FILES UPDATE_TIME datetime
+FILES CHECK_TIME datetime
+PARTITIONS CREATE_TIME datetime
+PARTITIONS UPDATE_TIME datetime
+PARTITIONS CHECK_TIME datetime
ROUTINES CREATED datetime
ROUTINES LAST_ALTERED datetime
TABLES CREATE_TIME datetime
TABLES UPDATE_TIME datetime
TABLES CHECK_TIME datetime
TRIGGERS CREATED datetime
+event execute_at datetime
+event last_executed datetime
+event starts datetime
+event ends datetime
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES A
WHERE NOT EXISTS
(SELECT * FROM INFORMATION_SCHEMA.COLUMNS B
@@ -790,7 +840,10 @@ where COLUMN_NAME='TABLE_NAME';
TABLE_NAME COLUMN_NAME PRIVILEGES
COLUMNS TABLE_NAME select
COLUMN_PRIVILEGES TABLE_NAME select
+FILES TABLE_NAME select
KEY_COLUMN_USAGE TABLE_NAME select
+PARTITIONS TABLE_NAME select
+REFERENTIAL_CONSTRAINTS TABLE_NAME select
STATISTICS TABLE_NAME select
TABLES TABLE_NAME select
TABLE_CONSTRAINTS TABLE_NAME select
@@ -799,10 +852,10 @@ VIEWS TABLE_NAME select
delete from mysql.user where user='mysqltest_4';
delete from mysql.db where user='mysqltest_4';
flush privileges;
-SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;
+SELECT table_schema, count(*) FROM information_schema.TABLES where TABLE_SCHEMA!='cluster' GROUP BY TABLE_SCHEMA;
table_schema count(*)
-information_schema 16
-mysql 17
+information_schema 27
+mysql 21
create table t1 (i int, j int);
create trigger trg1 before insert on t1 for each row
begin
@@ -1094,8 +1147,8 @@ table_schema='information_schema' and
(column_type = 'varchar(7)' or column_type = 'varchar(20)')
group by column_type order by num;
column_type group_concat(table_schema, '.', table_name) num
-varchar(20) information_schema.COLUMNS 1
varchar(7) information_schema.ROUTINES,information_schema.VIEWS 2
+varchar(20) information_schema.COLUMNS,information_schema.FILES,information_schema.FILES,information_schema.PLUGINS,information_schema.PLUGINS,information_schema.PLUGINS 6
create table t1(f1 char(1) not null, f2 char(9) not null)
default character set utf8;
select CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH from
@@ -1191,10 +1244,21 @@ COLLATIONS COLLATION_NAME
COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME
COLUMNS TABLE_SCHEMA
COLUMN_PRIVILEGES TABLE_SCHEMA
+ENGINES ENGINE
+EVENTS EVENT_SCHEMA
+FILES TABLE_SCHEMA
+GLOBAL_STATUS VARIABLE_NAME
+GLOBAL_VARIABLES VARIABLE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
+PARTITIONS TABLE_SCHEMA
+PLUGINS PLUGIN_NAME
+PROCESSLIST ID
+REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
ROUTINES ROUTINE_SCHEMA
SCHEMATA SCHEMA_NAME
SCHEMA_PRIVILEGES TABLE_SCHEMA
+SESSION_STATUS VARIABLE_NAME
+SESSION_VARIABLES VARIABLE_NAME
STATISTICS TABLE_SCHEMA
TABLES TABLE_SCHEMA
TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
@@ -1222,10 +1286,21 @@ COLLATIONS COLLATION_NAME
COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME
COLUMNS TABLE_SCHEMA
COLUMN_PRIVILEGES TABLE_SCHEMA
+ENGINES ENGINE
+EVENTS EVENT_SCHEMA
+FILES TABLE_SCHEMA
+GLOBAL_STATUS VARIABLE_NAME
+GLOBAL_VARIABLES VARIABLE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
+PARTITIONS TABLE_SCHEMA
+PLUGINS PLUGIN_NAME
+PROCESSLIST ID
+REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
ROUTINES ROUTINE_SCHEMA
SCHEMATA SCHEMA_NAME
SCHEMA_PRIVILEGES TABLE_SCHEMA
+SESSION_STATUS VARIABLE_NAME
+SESSION_VARIABLES VARIABLE_NAME
STATISTICS TABLE_SCHEMA
TABLES TABLE_SCHEMA
TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
@@ -1254,3 +1329,13 @@ COLUMN_NAME MD5(COLUMN_DEFAULT) LENGTH(COLUMN_DEFAULT) COLUMN_DEFAULT=get_value(
fld1 7cf7a6782be951a1f2464a350da926a5 65532 1
DROP TABLE bug23037;
DROP FUNCTION get_value;
+End of 5.0 tests.
+select * from information_schema.engines WHERE ENGINE="MyISAM";
+ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
+MyISAM ENABLED Default engine as of MySQL 3.23 with great performance NO NO NO
+grant select on *.* to user3148@localhost;
+select user,db from information_schema.processlist;
+user db
+user3148 test
+drop user user3148@localhost;
+End of 5.1 tests.
diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result
index 40773a7afc1..db14b7b6600 100644
--- a/mysql-test/r/information_schema_db.result
+++ b/mysql-test/r/information_schema_db.result
@@ -10,10 +10,21 @@ COLLATIONS
COLLATION_CHARACTER_SET_APPLICABILITY
COLUMNS
COLUMN_PRIVILEGES
+ENGINES
+EVENTS
+FILES
+GLOBAL_STATUS
+GLOBAL_VARIABLES
KEY_COLUMN_USAGE
+PARTITIONS
+PLUGINS
+PROCESSLIST
+REFERENTIAL_CONSTRAINTS
ROUTINES
SCHEMATA
SCHEMA_PRIVILEGES
+SESSION_STATUS
+SESSION_VARIABLES
STATISTICS
TABLES
TABLE_CONSTRAINTS
diff --git a/mysql-test/r/information_schema_inno.result b/mysql-test/r/information_schema_inno.result
index fb6584673f6..9bb3185c6fb 100644
--- a/mysql-test/r/information_schema_inno.result
+++ b/mysql-test/r/information_schema_inno.result
@@ -25,3 +25,34 @@ NULL test PRIMARY NULL test t3 id 1 NULL NULL NULL NULL
NULL test t3_ibfk_1 NULL test t3 id 1 1 test t2 t1_id
NULL test t3_ibfk_1 NULL test t3 t2_id 2 2 test t2 id
drop table t3, t2, t1;
+CREATE TABLE t1(a1 INT NOT NULL, a2 INT NOT NULL,
+PRIMARY KEY(a1, a2)) ENGINE=INNODB;
+CREATE TABLE t2(b1 INT, b2 INT, INDEX (b1, b2),
+CONSTRAINT A1
+FOREIGN KEY (b1, b2) REFERENCES t1(a1, a2)
+ON UPDATE CASCADE ON DELETE NO ACTION) ENGINE=INNODB;
+CREATE TABLE t3(b1 INT, b2 INT, INDEX (b1, b2),
+CONSTRAINT A2
+FOREIGN KEY (b1, b2) REFERENCES t2(b1, b2)
+ON UPDATE SET NULL ON DELETE RESTRICT) ENGINE=INNODB;
+CREATE TABLE t4(b1 INT, b2 INT, INDEX (b1, b2),
+CONSTRAINT A3
+FOREIGN KEY (b1, b2) REFERENCES t3(b1, b2)
+ON UPDATE NO ACTION ON DELETE SET NULL) ENGINE=INNODB;
+CREATE TABLE t5(b1 INT, b2 INT, INDEX (b1, b2),
+CONSTRAINT A4
+FOREIGN KEY (b1, b2) REFERENCES t4(b1, b2)
+ON UPDATE RESTRICT ON DELETE CASCADE) ENGINE=INNODB;
+select a.CONSTRAINT_SCHEMA, b.TABLE_NAME, CONSTRAINT_TYPE,
+b.CONSTRAINT_NAME, UNIQUE_CONSTRAINT_SCHEMA, UNIQUE_CONSTRAINT_NAME,
+MATCH_OPTION, UPDATE_RULE, DELETE_RULE
+from information_schema.TABLE_CONSTRAINTS a,
+information_schema.REFERENTIAL_CONSTRAINTS b
+where a.CONSTRAINT_SCHEMA = 'test' and a.CONSTRAINT_SCHEMA = b.CONSTRAINT_SCHEMA and
+a.CONSTRAINT_NAME = b.CONSTRAINT_NAME;
+CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_TYPE CONSTRAINT_NAME UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE
+test t2 FOREIGN KEY A1 test t1 NONE CASCADE NO ACTION
+test t3 FOREIGN KEY A2 test t2 NONE SET NULL RESTRICT
+test t4 FOREIGN KEY A3 test t3 NONE NO ACTION SET NULL
+test t5 FOREIGN KEY A4 test t4 NONE RESTRICT CASCADE
+drop tables t5, t4, t3, t2, t1;
diff --git a/mysql-test/r/information_schema_part.result b/mysql-test/r/information_schema_part.result
new file mode 100644
index 00000000000..6ba980e0f21
--- /dev/null
+++ b/mysql-test/r/information_schema_part.result
@@ -0,0 +1,142 @@
+drop table if exists t1,t2,t3,t4;
+create table t1 (a int not null,b int not null,c int not null, primary key(a,b))
+partition by list (b*a)
+(partition x1 values in (1) tablespace ts1,
+partition x2 values in (3, 11, 5, 7) tablespace ts2,
+partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
+select * from information_schema.partitions where table_schema="test"
+and table_name="t1";
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t1 x1 NULL 1 NULL LIST NULL b*a NULL 1 0 0 0 # 1024 0 # # NULL NULL default default ts1
+NULL test t1 x2 NULL 2 NULL LIST NULL b*a NULL 3,11,5,7 0 0 0 # 1024 0 # # NULL NULL default default ts2
+NULL test t1 x3 NULL 3 NULL LIST NULL b*a NULL 16,8,24,27 0 0 0 # 1024 0 # # NULL NULL default default ts3
+create table t2 (a int not null,b int not null,c int not null, primary key(a,b))
+partition by range (a)
+partitions 3
+(partition x1 values less than (5) tablespace ts1,
+partition x2 values less than (10) tablespace ts2,
+partition x3 values less than maxvalue tablespace ts3);
+select * from information_schema.partitions where table_schema="test"
+and table_name="t2";
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t2 x1 NULL 1 NULL RANGE NULL a NULL 5 0 0 0 # 1024 0 # # NULL NULL default default ts1
+NULL test t2 x2 NULL 2 NULL RANGE NULL a NULL 10 0 0 0 # 1024 0 # # NULL NULL default default ts2
+NULL test t2 x3 NULL 3 NULL RANGE NULL a NULL MAXVALUE 0 0 0 # 1024 0 # # NULL NULL default default ts3
+create table t3 (f1 date)
+partition by hash(month(f1))
+partitions 3;
+select * from information_schema.partitions where table_schema="test"
+and table_name="t3";
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t3 p0 NULL 1 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default
+NULL test t3 p1 NULL 2 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default
+NULL test t3 p2 NULL 3 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default
+create table t4 (f1 date, f2 int)
+partition by key(f1,f2)
+partitions 3;
+select * from information_schema.partitions where table_schema="test"
+and table_name="t4";
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t4 p0 NULL 1 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default
+NULL test t4 p1 NULL 2 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default
+NULL test t4 p2 NULL 3 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default
+drop table t1,t2,t3,t4;
+create table t1 (a int not null,b int not null,c int not null,primary key (a,b))
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+( subpartition x11 tablespace t1,
+subpartition x12 tablespace t2),
+partition x2 values less than (5)
+( subpartition x21 tablespace t1,
+subpartition x22 tablespace t2)
+);
+create table t2 (a int not null,b int not null,c int not null,primary key (a,b))
+partition by range (a)
+subpartition by key (a)
+( partition x1 values less than (1)
+( subpartition x11 tablespace t1,
+subpartition x12 tablespace t2),
+partition x2 values less than (5)
+( subpartition x21 tablespace t1,
+subpartition x22 tablespace t2)
+);
+select * from information_schema.partitions where table_schema="test";
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t1 x1 x11 1 1 RANGE HASH a a+b 1 0 0 0 # 1024 0 # # NULL NULL default default t1
+NULL test t1 x1 x12 1 2 RANGE HASH a a+b 1 0 0 0 # 1024 0 # # NULL NULL default default t2
+NULL test t1 x2 x21 2 1 RANGE HASH a a+b 5 0 0 0 # 1024 0 # # NULL NULL default default t1
+NULL test t1 x2 x22 2 2 RANGE HASH a a+b 5 0 0 0 # 1024 0 # # NULL NULL default default t2
+NULL test t2 x1 x11 1 1 RANGE KEY a a 1 0 0 0 # 1024 0 # # NULL NULL default default t1
+NULL test t2 x1 x12 1 2 RANGE KEY a a 1 0 0 0 # 1024 0 # # NULL NULL default default t2
+NULL test t2 x2 x21 2 1 RANGE KEY a a 5 0 0 0 # 1024 0 # # NULL NULL default default t1
+NULL test t2 x2 x22 2 2 RANGE KEY a a 5 0 0 0 # 1024 0 # # NULL NULL default default t2
+drop table t1,t2;
+create table t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+( subpartition x11 tablespace t1 nodegroup 0,
+subpartition x12 tablespace t2 nodegroup 1),
+partition x2 values less than (5)
+( subpartition x21 tablespace t1 nodegroup 0,
+subpartition x22 tablespace t2 nodegroup 1)
+);
+select * from information_schema.partitions where table_schema="test";
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t1 x1 x11 1 1 RANGE HASH a a+b 1 0 0 0 # 1024 0 # # NULL NULL default 0 t1
+NULL test t1 x1 x12 1 2 RANGE HASH a a+b 1 0 0 0 # 1024 0 # # NULL NULL default 1 t2
+NULL test t1 x2 x21 2 1 RANGE HASH a a+b 5 0 0 0 # 1024 0 # # NULL NULL default 0 t1
+NULL test t1 x2 x22 2 2 RANGE HASH a a+b 5 0 0 0 # 1024 0 # # NULL NULL default 1 t2
+show tables;
+Tables_in_test
+t1
+drop table t1;
+create table t1(f1 int, f2 int);
+select * from information_schema.partitions where table_schema="test";
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t1 NULL NULL NULL NULL NULL NULL NULL NULL NULL 0 0 0 # 1024 0 # # NULL NULL
+drop table t1;
+create table t1 (f1 date)
+partition by linear hash(month(f1))
+partitions 3;
+select * from information_schema.partitions where table_schema="test"
+and table_name="t1";
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t1 p0 NULL 1 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default
+NULL test t1 p1 NULL 2 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default
+NULL test t1 p2 NULL 3 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default
+drop table t1;
+create table t1 (a int)
+PARTITION BY RANGE (a)
+SUBPARTITION BY LINEAR HASH (a)
+(PARTITION p0 VALUES LESS THAN (10));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) SUBPARTITION BY LINEAR HASH (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM) */
+select SUBPARTITION_METHOD FROM information_schema.partitions WHERE
+table_schema="test" AND table_name="t1";
+SUBPARTITION_METHOD
+LINEAR HASH
+drop table t1;
+create table t1 (a int)
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN
+(10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
+32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) (PARTITION p0 VALUES IN (10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53) ENGINE = MyISAM) */
+SELECT PARTITION_DESCRIPTION FROM information_schema.partitions WHERE
+table_schema = "test" AND table_name = "t1";
+PARTITION_DESCRIPTION
+10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53
+drop table t1;
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 38d71ac7a42..e7fa950a131 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -234,7 +234,7 @@ n after commit
commit;
insert into t1 values (5);
insert into t1 values (4);
-ERROR 23000: Duplicate entry '4' for key 1
+ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
commit;
select n, "after commit" from t1;
n after commit
@@ -243,7 +243,7 @@ n after commit
set autocommit=1;
insert into t1 values (6);
insert into t1 values (4);
-ERROR 23000: Duplicate entry '4' for key 1
+ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
select n from t1;
n
4
@@ -318,7 +318,7 @@ drop table t1;
CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=innodb;
insert into t1 values ('pippo', 12);
insert into t1 values ('pippo', 12);
-ERROR 23000: Duplicate entry 'pippo' for key 1
+ERROR 23000: Duplicate entry 'pippo' for key 'PRIMARY'
delete from t1;
delete from t1 where id = 'pippo';
select * from t1;
@@ -482,9 +482,9 @@ UNIQUE ggid (ggid)
insert into t1 (ggid,passwd) values ('test1','xxx');
insert into t1 (ggid,passwd) values ('test2','yyy');
insert into t1 (ggid,passwd) values ('test2','this will fail');
-ERROR 23000: Duplicate entry 'test2' for key 2
+ERROR 23000: Duplicate entry 'test2' for key 'ggid'
insert into t1 (ggid,id) values ('this will fail',1);
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t1 where ggid='test1';
id ggid email passwd
1 test1 xxx
@@ -497,7 +497,7 @@ id ggid email passwd
replace into t1 (ggid,id) values ('this will work',1);
replace into t1 (ggid,passwd) values ('test2','this will work');
update t1 set id=100,ggid='test2' where id=1;
-ERROR 23000: Duplicate entry 'test2' for key 2
+ERROR 23000: Duplicate entry 'test2' for key 'ggid'
select * from t1;
id ggid email passwd
1 this will work
@@ -816,7 +816,7 @@ create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(3
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE;
insert into t1 values (99,1,2,'D'),(1,1,2,'D');
-ERROR 23000: Duplicate entry '1-1' for key 1
+ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY'
select id from t1;
id
0
@@ -834,7 +834,7 @@ insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJ
LOCK TABLES t1 WRITE;
begin;
insert into t1 values (99,1,2,'D'),(1,1,2,'D');
-ERROR 23000: Duplicate entry '1-1' for key 1
+ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY'
select id from t1;
id
0
@@ -856,7 +856,7 @@ create table t1 (a char(20), index (a(5))) engine=innodb;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(20) default NULL,
+ `a` char(20) DEFAULT NULL,
KEY `a` (`a`(5))
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1;
@@ -1295,22 +1295,14 @@ insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
select count(*) from t1;
count(*)
-29267
-explain select * from t1 where c between 1 and 10000;
+623
+explain select * from t1 where c between 1 and 2500;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 5 NULL # Using where
update t1 set c=a;
-explain select * from t1 where c between 1 and 10000;
+explain select * from t1 where c between 1 and 2500;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL c NULL NULL NULL # Using where
drop table t1,t2;
@@ -1378,9 +1370,9 @@ insert into `t2`values ( 1 ) ;
create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb;
insert into `t3`values ( 1 ) ;
delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
ERROR 42S22: Unknown column 't1.id' in 'where clause'
drop table t3,t2,t1;
@@ -1392,7 +1384,7 @@ foreign key(pid) references t1(id) on delete cascade) engine=innodb;
insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),
(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);
delete from t1 where id=0;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `t1` (`id`) ON DELETE CASCADE)
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `t1` (`id`) ON DELETE CASCADE)
delete from t1 where id=15;
delete from t1 where id=0;
drop table t1;
@@ -1587,9 +1579,9 @@ create table t2 (id int(11) not null auto_increment, id2 int(11) not null, const
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `id` int(11) NOT NULL auto_increment,
+ `id` int(11) NOT NULL AUTO_INCREMENT,
`id2` int(11) NOT NULL,
- PRIMARY KEY (`id`),
+ PRIMARY KEY (`id`),
KEY `id` (`id`,`id2`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
@@ -1598,7 +1590,7 @@ create table t2 (id int(11) not null auto_increment, id2 int(11) not null, const
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `id` int(11) NOT NULL auto_increment,
+ `id` int(11) NOT NULL AUTO_INCREMENT,
`id2` int(11) NOT NULL,
KEY `t1_id_fk` (`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
@@ -1607,7 +1599,7 @@ alter table t2 add index id_test (id), add index id_test2 (id,id2);
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `id` int(11) NOT NULL auto_increment,
+ `id` int(11) NOT NULL AUTO_INCREMENT,
`id2` int(11) NOT NULL,
KEY `id_test` (`id`),
KEY `id_test2` (`id`,`id2`),
@@ -1615,14 +1607,14 @@ t2 CREATE TABLE `t2` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2;
create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
-ERROR HY000: Can't create table './test/t2' (errno: 150)
+ERROR HY000: Can't create table 'test.t2' (errno: 150)
create table t2 (a int auto_increment primary key, b int, index(b), foreign key (b) references t1(id), unique(b)) engine=innodb;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` int(11) NOT NULL auto_increment,
- `b` int(11) default NULL,
- PRIMARY KEY (`a`),
+ `a` int(11) NOT NULL AUTO_INCREMENT,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`),
UNIQUE KEY `b_2` (`b`),
KEY `b` (`b`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
@@ -1632,24 +1624,25 @@ create table t2 (a int auto_increment primary key, b int, foreign key (b) refere
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` int(11) NOT NULL auto_increment,
- `b` int(11) default NULL,
- PRIMARY KEY (`a`),
+ `a` int(11) NOT NULL AUTO_INCREMENT,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`),
UNIQUE KEY `b` (`b`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`),
CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2, t1;
+flush status;
show status like "binlog_cache_use";
Variable_name Value
-Binlog_cache_use 155
+Binlog_cache_use 0
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 0
create table t1 (a int) engine=innodb;
show status like "binlog_cache_use";
Variable_name Value
-Binlog_cache_use 156
+Binlog_cache_use 1
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1
@@ -1658,7 +1651,7 @@ delete from t1;
commit;
show status like "binlog_cache_use";
Variable_name Value
-Binlog_cache_use 157
+Binlog_cache_use 2
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1
@@ -1785,10 +1778,10 @@ Variable_name Value
Innodb_rows_deleted 2070
show status like "Innodb_rows_inserted";
Variable_name Value
-Innodb_rows_inserted 31727
+Innodb_rows_inserted 3083
show status like "Innodb_rows_updated";
Variable_name Value
-Innodb_rows_updated 29530
+Innodb_rows_updated 886
show status like "Innodb_row_lock_waits";
Variable_name Value
Innodb_row_lock_waits 0
@@ -1881,40 +1874,40 @@ concat('*',v,'*',c,'*',t,'*')
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL,
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
`t` text
) ENGINE=InnoDB DEFAULT CHARSET=latin1
create table t2 like t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL,
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
`t` text
) ENGINE=InnoDB DEFAULT CHARSET=latin1
create table t3 select * from t1;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL,
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
`t` text
) ENGINE=InnoDB DEFAULT CHARSET=latin1
alter table t1 modify c varchar(10);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(10) default NULL,
- `c` varchar(10) default NULL,
+ `v` varchar(10) DEFAULT NULL,
+ `c` varchar(10) DEFAULT NULL,
`t` text
) ENGINE=InnoDB DEFAULT CHARSET=latin1
alter table t1 modify v char(10);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` char(10) default NULL,
- `c` varchar(10) default NULL,
+ `v` char(10) DEFAULT NULL,
+ `c` varchar(10) DEFAULT NULL,
`t` text
) ENGINE=InnoDB DEFAULT CHARSET=latin1
alter table t1 modify t varchar(10);
@@ -1923,9 +1916,9 @@ Note 1265 Data truncated for column 't' at row 2
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` char(10) default NULL,
- `c` varchar(10) default NULL,
- `t` varchar(10) default NULL
+ `v` char(10) DEFAULT NULL,
+ `c` varchar(10) DEFAULT NULL,
+ `t` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
select concat('*',v,'*',c,'*',t,'*') from t1;
concat('*',v,'*',c,'*',t,'*')
@@ -1936,8 +1929,8 @@ create table t1 (v varchar(10), c char(10), t text, key(v), key(c), key(t(10)));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL,
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
`t` text,
KEY `v` (`v`),
KEY `c` (`c`),
@@ -2002,7 +1995,7 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a '
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const # Using where; Using index
alter table t1 add unique(v);
-ERROR 23000: Duplicate entry '{ ' for key 1
+ERROR 23000: Duplicate entry '{ ' for key 'v_2'
alter table t1 add key(v);
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
qq
@@ -2155,8 +2148,8 @@ alter table t1 modify v varchar(300), drop key v, drop key v_2, add key v (v);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(300) default NULL,
- `c` char(10) default NULL,
+ `v` varchar(300) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
`t` text,
KEY `c` (`c`),
KEY `t` (`t`(10)),
@@ -2235,8 +2228,8 @@ alter table t1 drop key v, add key v (v(30));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(300) default NULL,
- `c` char(10) default NULL,
+ `v` varchar(300) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
`t` text,
KEY `c` (`c`),
KEY `t` (`t`(10)),
@@ -2315,8 +2308,8 @@ alter table t1 modify v varchar(600), drop key v, add key v (v);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(600) default NULL,
- `c` char(10) default NULL,
+ `v` varchar(600) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
`t` text,
KEY `c` (`c`),
KEY `t` (`t`(10)),
@@ -2362,16 +2355,16 @@ drop table t1;
create table t1 (a char(10), unique (a));
insert into t1 values ('a ');
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a' for key 1
+ERROR 23000: Duplicate entry 'a' for key 'a'
alter table t1 modify a varchar(10);
insert into t1 values ('a '),('a '),('a '),('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
update t1 set a='a ' where a like 'a%';
select concat(a,'.') from t1;
concat(a,'.')
@@ -2393,8 +2386,8 @@ create table t1 (v varchar(10), c char(10), t text, key(v(5)), key(c(5)), key(t(
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL,
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
`t` text,
KEY `v` (`v`(5)),
KEY `c` (`c`(5)),
@@ -2405,15 +2398,15 @@ create table t1 (v char(10) character set utf8);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` char(10) character set utf8 default NULL
+ `v` char(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1;
create table t1 (v varchar(10), c char(10)) row_format=fixed;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED
insert into t1 values('a','a'),('a ','a ');
select concat('*',v,'*',c,'*') from t1;
@@ -2455,7 +2448,7 @@ Note 1246 Converting column 'v' from VARCHAR to TEXT
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` mediumtext character set utf8
+ `v` mediumtext CHARACTER SET utf8
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1;
set storage_engine=MyISAM;
@@ -2494,7 +2487,7 @@ key (rowid), unique(val)) engine=innodb;
replace into t1 (val) values ('1'),('2');
replace into t1 (val) values ('1'),('2');
insert into t1 (val) values ('1'),('2');
-ERROR 23000: Duplicate entry '1' for key 2
+ERROR 23000: Duplicate entry '1' for key 'val'
select * from t1;
rowid val
3 1
@@ -2504,7 +2497,7 @@ create table t1 (a int not null auto_increment primary key, val int) engine=Inno
insert into t1 (val) values (1);
update t1 set a=2 where a=1;
insert into t1 (val) values (1);
-ERROR 23000: Duplicate entry '2' for key 1
+ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
select * from t1;
a val
2 1
@@ -2582,8 +2575,8 @@ character set = latin1 engine = innodb;
show create table t9;
Table Create Table
t9 CREATE TABLE `t9` (
- `col1` varchar(512) default NULL,
- `col2` varchar(512) default NULL,
+ `col1` varchar(512) DEFAULT NULL,
+ `col2` varchar(512) DEFAULT NULL,
KEY `col1` (`col1`,`col2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1, t2, t3, t4, t5, t6, t7, t8, t9;
@@ -2606,7 +2599,7 @@ Warning 1071 Specified key was too long; max key length is 767 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `col1` varchar(768) default NULL,
+ `col1` varchar(768) DEFAULT NULL,
KEY `col1` (`col1`(767))
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1, t2, t3, t4;
@@ -2632,18 +2625,18 @@ v INT,
CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id)
) ENGINE=InnoDB;
INSERT INTO t2 VALUES(2);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
INSERT INTO t1 VALUES(1);
INSERT INTO t2 VALUES(1);
DELETE FROM t1 WHERE id = 1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
DROP TABLE t1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE t1;
SET FOREIGN_KEY_CHECKS=1;
INSERT INTO t2 VALUES(3);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
DROP TABLE t2;
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
insert into t1 values (1),(2);
@@ -2885,13 +2878,13 @@ commit;
set foreign_key_checks=0;
create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb;
create table t1(a char(10) primary key, b varchar(20)) engine = innodb;
-ERROR HY000: Can't create table './test/t1.frm' (errno: 150)
+ERROR HY000: Can't create table 'test.t1' (errno: 150)
set foreign_key_checks=1;
drop table t2;
set foreign_key_checks=0;
create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1;
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8;
-ERROR HY000: Can't create table './test/t2.frm' (errno: 150)
+ERROR HY000: Can't create table 'test.t2' (errno: 150)
set foreign_key_checks=1;
drop table t1;
set foreign_key_checks=0;
@@ -2921,23 +2914,23 @@ create table t4(a int primary key,constraint foreign key(a)references t3(a)) row
insert into t1 values(1);
insert into t3 values(1);
insert into t2 values(2);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
insert into t4 values(2);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
insert into t2 values(1);
insert into t4 values(1);
update t1 set a=2;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
update t2 set a=2;
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
update t3 set a=2;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
update t4 set a=2;
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
truncate t1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
truncate t3;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
truncate t2;
truncate t4;
truncate t1;
@@ -2962,13 +2955,13 @@ create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb;
create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb;
insert into t1 values (0x41),(0x4120),(0x4100);
insert into t2 values (0x41),(0x4120),(0x4100);
-ERROR 23000: Duplicate entry 'A' for key 1
+ERROR 23000: Duplicate entry 'A' for key 'PRIMARY'
insert into t2 values (0x41),(0x4120);
insert into t3 values (0x41),(0x4120),(0x4100);
-ERROR 23000: Duplicate entry 'A ' for key 1
+ERROR 23000: Duplicate entry 'A ' for key 'PRIMARY'
insert into t3 values (0x41),(0x4100);
insert into t4 values (0x41),(0x4120),(0x4100);
-ERROR 23000: Duplicate entry 'A' for key 1
+ERROR 23000: Duplicate entry 'A' for key 'PRIMARY'
insert into t4 values (0x41),(0x4100);
select hex(s1) from t1;
hex(s1)
@@ -2992,7 +2985,7 @@ create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=innod
create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42);
insert into t2 values(0x42);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
insert into t2 values(0x41);
select hex(s1) from t2;
hex(s1)
@@ -3002,11 +2995,11 @@ select hex(s1) from t2;
hex(s1)
4100
update t1 set s1=0x12 where a=1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
update t1 set s1=0x12345678 where a=1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
update t1 set s1=0x123457 where a=1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
update t1 set s1=0x1220 where a=1;
select hex(s1) from t2;
hex(s1)
@@ -3020,11 +3013,11 @@ select hex(s1) from t2;
hex(s1)
4200
delete from t1 where a=1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
delete from t1 where a=2;
update t2 set s1=0x4120;
delete from t1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
delete from t1 where a!=3;
select a,hex(s1) from t1;
a hex(s1)
@@ -3050,7 +3043,7 @@ hex(s1)
12
delete from t1 where a=1;
delete from t1 where a=2;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
select a,hex(s1) from t1;
a hex(s1)
2 12
@@ -3170,7 +3163,7 @@ ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` int(11) default NULL,
+ `a` int(11) DEFAULT NULL,
KEY `t2_ibfk_0` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t2,t1;
@@ -3232,6 +3225,55 @@ drop trigger t2t;
drop trigger t3t;
drop trigger t4t;
drop table t1, t2, t3, t4, t5;
+CREATE TABLE t1 (
+field1 varchar(8) NOT NULL DEFAULT '',
+field2 varchar(8) NOT NULL DEFAULT '',
+PRIMARY KEY (field1, field2)
+) ENGINE=InnoDB;
+CREATE TABLE t2 (
+field1 varchar(8) NOT NULL DEFAULT '' PRIMARY KEY,
+FOREIGN KEY (field1) REFERENCES t1 (field1)
+ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('old', 'somevalu');
+INSERT INTO t1 VALUES ('other', 'anyvalue');
+INSERT INTO t2 VALUES ('old');
+INSERT INTO t2 VALUES ('other');
+UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu';
+ERROR 23000: Upholding foreign key constraints for table 't1', entry 'other-somevalu', key 1 would lead to a duplicate entry
+DROP TABLE t2;
+DROP TABLE t1;
+create table t1 (
+c1 bigint not null,
+c2 bigint not null,
+primary key (c1),
+unique key (c2)
+) engine=innodb;
+create table t2 (
+c1 bigint not null,
+primary key (c1)
+) engine=innodb;
+alter table t1 add constraint c2_fk foreign key (c2)
+references t2(c1) on delete cascade;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` bigint(20) NOT NULL,
+ `c2` bigint(20) NOT NULL,
+ PRIMARY KEY (`c1`),
+ UNIQUE KEY `c2` (`c2`),
+ CONSTRAINT `c2_fk` FOREIGN KEY (`c2`) REFERENCES `t2` (`c1`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+alter table t1 drop foreign key c2_fk;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` bigint(20) NOT NULL,
+ `c2` bigint(20) NOT NULL,
+ PRIMARY KEY (`c1`),
+ UNIQUE KEY `c2` (`c2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1, t2;
create table t1(a date) engine=innodb;
create table t2(a date, key(a)) engine=innodb;
insert into t1 values('2005-10-01');
@@ -3241,8 +3283,135 @@ where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
a a
2005-10-01 2005-10-01
drop table t1, t2;
+create table t1 (id int not null, f_id int not null, f int not null,
+primary key(f_id, id)) engine=innodb;
+create table t2 (id int not null,s_id int not null,s varchar(200),
+primary key(id)) engine=innodb;
+INSERT INTO t1 VALUES (8, 1, 3);
+INSERT INTO t1 VALUES (1, 2, 1);
+INSERT INTO t2 VALUES (1, 0, '');
+INSERT INTO t2 VALUES (8, 1, '');
+commit;
+DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id)
+WHERE mm.id IS NULL;
+select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
+where mm.id is null lock in share mode;
+id f_id f
+drop table t1,t2;
+create table t1(a int not null, b int, primary key(a)) engine=innodb;
+insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
+commit;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+update t1 set b = 5 where b = 1;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+select * from t1 where a = 7 and b = 3 for update;
+a b
+7 3
+commit;
+commit;
+drop table t1;
+create table t1(a int not null, b int, primary key(a)) engine=innodb;
+insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2);
+commit;
+set autocommit = 0;
+select * from t1 lock in share mode;
+a b
+1 1
+2 2
+3 1
+4 2
+5 1
+6 2
+update t1 set b = 5 where b = 1;
+set autocommit = 0;
+select * from t1 where a = 2 and b = 2 for update;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+commit;
+commit;
+drop table t1;
+create table t1(a int not null, b int, primary key(a)) engine=innodb;
+insert into t1 values (1,2),(5,3),(4,2);
+create table t2(d int not null, e int, primary key(d)) engine=innodb;
+insert into t2 values (8,6),(12,1),(3,1);
+commit;
+set autocommit = 0;
+select * from t2 for update;
+d e
+3 1
+8 6
+12 1
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+insert into t1 select * from t2;
+update t1 set b = (select e from t2 where a = d);
+create table t3(d int not null, e int, primary key(d)) engine=innodb
+select * from t2;
+commit;
+commit;
+drop table t1, t2, t3;
+create table t1(a int not null, b int, primary key(a)) engine=innodb;
+insert into t1 values (1,2),(5,3),(4,2);
+create table t2(a int not null, b int, primary key(a)) engine=innodb;
+insert into t2 values (8,6),(12,1),(3,1);
+create table t3(d int not null, b int, primary key(d)) engine=innodb;
+insert into t3 values (8,6),(12,1),(3,1);
+create table t5(a int not null, b int, primary key(a)) engine=innodb;
+insert into t5 values (1,2),(5,3),(4,2);
+create table t6(d int not null, e int, primary key(d)) engine=innodb;
+insert into t6 values (8,6),(12,1),(3,1);
+create table t8(a int not null, b int, primary key(a)) engine=innodb;
+insert into t8 values (1,2),(5,3),(4,2);
+create table t9(d int not null, e int, primary key(d)) engine=innodb;
+insert into t9 values (8,6),(12,1),(3,1);
+commit;
+set autocommit = 0;
+select * from t2 for update;
+a b
+3 1
+8 6
+12 1
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+insert into t1 select * from t2;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+update t3 set b = (select b from t2 where a = d);
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+insert into t5 (select * from t2 lock in share mode);
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+update t6 set e = (select b from t2 where a = d lock in share mode);
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+insert into t8 (select * from t2 for update);
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+update t9 set e = (select b from t2 where a = d for update);
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+commit;
+drop table t1, t2, t3, t5, t6, t8, t9;
CREATE TABLE t1 (DB_ROW_ID int) engine=innodb;
-ERROR HY000: Can't create table './test/t1.frm' (errno: -1)
+ERROR HY000: Can't create table 'test.t1' (errno: -1)
CREATE TABLE t1 (
a BIGINT(20) NOT NULL,
PRIMARY KEY (a)
@@ -3280,3 +3449,10 @@ a
drop table t2, t1;
create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
ERROR HY000: The used table type doesn't support SPATIAL indexes
+CREATE TABLE t1 ( a int ) ENGINE=innodb;
+BEGIN;
+INSERT INTO t1 VALUES (1);
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+DROP TABLE t1;
diff --git a/mysql-test/r/innodb_gis.result b/mysql-test/r/innodb_gis.result
index 826a17cb60d..09f0aebaefa 100644
--- a/mysql-test/r/innodb_gis.result
+++ b/mysql-test/r/innodb_gis.result
@@ -1,50 +1,51 @@
SET storage_engine=innodb;
DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
-CREATE TABLE gis_point (fid INTEGER, g POINT);
-CREATE TABLE gis_line (fid INTEGER, g LINESTRING);
-CREATE TABLE gis_polygon (fid INTEGER, g POLYGON);
-CREATE TABLE gis_multi_point (fid INTEGER, g MULTIPOINT);
-CREATE TABLE gis_multi_line (fid INTEGER, g MULTILINESTRING);
-CREATE TABLE gis_multi_polygon (fid INTEGER, g MULTIPOLYGON);
-CREATE TABLE gis_geometrycollection (fid INTEGER, g GEOMETRYCOLLECTION);
-CREATE TABLE gis_geometry (fid INTEGER, g GEOMETRY);
+CREATE TABLE gis_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POINT);
+CREATE TABLE gis_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g LINESTRING);
+CREATE TABLE gis_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POLYGON);
+CREATE TABLE gis_multi_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOINT);
+CREATE TABLE gis_multi_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTILINESTRING);
+CREATE TABLE gis_multi_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOLYGON);
+CREATE TABLE gis_geometrycollection (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRYCOLLECTION);
+CREATE TABLE gis_geometry (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRY);
SHOW CREATE TABLE gis_point;
Table Create Table
gis_point CREATE TABLE `gis_point` (
- `fid` int(11) default NULL,
- `g` point default NULL
+ `fid` int(11) NOT NULL AUTO_INCREMENT,
+ `g` point DEFAULT NULL,
+ PRIMARY KEY (`fid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SHOW FIELDS FROM gis_point;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g point YES NULL
SHOW FIELDS FROM gis_line;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g linestring YES NULL
SHOW FIELDS FROM gis_polygon;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g polygon YES NULL
SHOW FIELDS FROM gis_multi_point;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g multipoint YES NULL
SHOW FIELDS FROM gis_multi_line;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g multilinestring YES NULL
SHOW FIELDS FROM gis_multi_polygon;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g multipolygon YES NULL
SHOW FIELDS FROM gis_geometrycollection;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g geometrycollection YES NULL
SHOW FIELDS FROM gis_geometry;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g geometry YES NULL
INSERT INTO gis_point VALUES
(101, PointFromText('POINT(10 10)')),
@@ -232,8 +233,8 @@ fid AsText(Envelope(g))
120 POLYGON((0 0,10 0,10 10,0 10,0 0))
121 POLYGON((3 6,44 6,44 9,3 9,3 6))
explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21 100.00
Warnings:
Note 1003 select dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,astext(envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry`
SELECT fid, X(g) FROM gis_point ORDER by fid;
@@ -249,8 +250,8 @@ fid Y(g)
103 20
104 20
explain extended select X(g),Y(g) FROM gis_point;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_point ALL NULL NULL NULL NULL 4
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 100.00
Warnings:
Note 1003 select x(`test`.`gis_point`.`g`) AS `X(g)`,y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point`
SELECT fid, AsText(StartPoint(g)) FROM gis_line ORDER by fid;
@@ -284,8 +285,8 @@ fid IsClosed(g)
106 1
107 0
explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_line ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,astext(endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,glength(`test`.`gis_line`.`g`) AS `GLength(g)`,numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,astext(pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line`
SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid;
@@ -314,8 +315,8 @@ fid AsText(InteriorRingN(g, 1))
109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
110 NULL
explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM gis_polygon;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select astext(centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,area(`test`.`gis_polygon`.`g`) AS `Area(g)`,astext(exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,astext(interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon`
SELECT fid, IsClosed(g) FROM gis_multi_line ORDER by fid;
@@ -353,8 +354,8 @@ fid NumGeometries(g)
120 2
121 2
explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point`
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point ORDER by fid;
@@ -381,8 +382,8 @@ fid AsText(GeometryN(g, 1))
120 POINT(0 0)
121 POINT(44 6)
explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,astext(geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point`
SELECT g1.fid as first, g2.fid as second,
@@ -400,13 +401,14 @@ Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE g1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
-1 SIMPLE g2 ALL NULL NULL NULL NULL 2
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE g1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
+1 SIMPLE g2 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,overlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,disjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,intersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
CREATE TABLE t1 (
+a INTEGER PRIMARY KEY AUTO_INCREMENT,
gp point,
ln linestring,
pg polygon,
@@ -418,6 +420,7 @@ gm geometry
);
SHOW FIELDS FROM t1;
Field Type Null Key Default Extra
+a int(11) NO PRI NULL auto_increment
gp point YES NULL
ln linestring YES NULL
pg polygon YES NULL
@@ -429,6 +432,7 @@ gm geometry YES NULL
ALTER TABLE t1 ADD fid INT;
SHOW FIELDS FROM t1;
Field Type Null Key Default Extra
+a int(11) NO PRI NULL auto_increment
gp point YES NULL
ln linestring YES NULL
pg polygon YES NULL
@@ -439,20 +443,20 @@ gc geometrycollection YES NULL
gm geometry YES NULL
fid int(11) YES NULL
DROP TABLE t1;
-create table t1 (a geometry not null);
-insert into t1 values (GeomFromText('Point(1 2)'));
-insert into t1 values ('Garbage');
+create table t1 (pk integer primary key auto_increment, a geometry not null);
+insert into t1 (a) values (GeomFromText('Point(1 2)'));
+insert into t1 (a) values ('Garbage');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-insert IGNORE into t1 values ('Garbage');
+insert IGNORE into t1 (a) values ('Garbage');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
-create table t1 (fl geometry);
-insert into t1 values (1);
+create table t1 (pk integer primary key auto_increment, fl geometry);
+insert into t1 (fl) values (1);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-insert into t1 values (1.11);
+insert into t1 (fl) values (1.11);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-insert into t1 values ("qwerty");
+insert into t1 (fl) values ("qwerty");
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-insert into t1 values (pointfromtext('point(1,1)'));
+insert into t1 (fl) values (pointfromtext('point(1,1)'));
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
diff --git a/mysql-test/r/innodb_handler.result b/mysql-test/r/innodb_handler.result
deleted file mode 100644
index 7e853a55e37..00000000000
--- a/mysql-test/r/innodb_handler.result
+++ /dev/null
@@ -1,167 +0,0 @@
-drop table if exists t1,t2;
-create table t1 (a int, b char(10), key a(a), key b(a,b)) engine=innodb;
-insert into t1 values
-(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"),
-(14,"aaa"),(15,"bbb"),(16,"ccc"),(16,"xxx"),
-(20,"ggg"),(21,"hhh"),(22,"iii");
-handler t1 open as t2;
-handler t2 read a first;
-a b
-14 aaa
-handler t2 read a next;
-a b
-15 bbb
-handler t2 read a next;
-a b
-16 ccc
-handler t2 read a prev;
-a b
-15 bbb
-handler t2 read a last;
-a b
-22 iii
-handler t2 read a prev;
-a b
-21 hhh
-handler t2 read a prev;
-a b
-20 ggg
-handler t2 read a first;
-a b
-14 aaa
-handler t2 read a prev;
-a b
-handler t2 read a last;
-a b
-22 iii
-handler t2 read a prev;
-a b
-21 hhh
-handler t2 read a next;
-a b
-22 iii
-handler t2 read a next;
-a b
-handler t2 read a=(15);
-a b
-15 bbb
-handler t2 read a=(16);
-a b
-16 ccc
-handler t2 read a=(19,"fff");
-ERROR 42000: Too many key parts specified; max 1 parts allowed
-handler t2 read b=(19,"fff");
-a b
-19 fff
-handler t2 read b=(19,"yyy");
-a b
-19 yyy
-handler t2 read b=(19);
-a b
-19 fff
-handler t1 read a last;
-ERROR 42S02: Unknown table 't1' in HANDLER
-handler t2 read a=(11);
-a b
-handler t2 read a>=(11);
-a b
-14 aaa
-handler t2 read a=(18);
-a b
-18 eee
-handler t2 read a>=(18);
-a b
-18 eee
-handler t2 read a>(18);
-a b
-19 fff
-handler t2 read a<=(18);
-a b
-18 eee
-handler t2 read a<(18);
-a b
-17 ddd
-handler t2 read a first limit 5;
-a b
-14 aaa
-15 bbb
-16 ccc
-16 xxx
-17 ddd
-handler t2 read a next limit 3;
-a b
-18 eee
-19 fff
-19 yyy
-handler t2 read a prev limit 10;
-a b
-19 fff
-18 eee
-17 ddd
-16 xxx
-16 ccc
-15 bbb
-14 aaa
-handler t2 read a>=(16) limit 4;
-a b
-16 ccc
-16 xxx
-17 ddd
-18 eee
-handler t2 read a>=(16) limit 2,2;
-a b
-17 ddd
-18 eee
-handler t2 read a last limit 3;
-a b
-22 iii
-21 hhh
-20 ggg
-handler t2 read a=(19);
-a b
-19 fff
-handler t2 read a=(19) where b="yyy";
-a b
-19 yyy
-handler t2 read first;
-a b
-17 ddd
-handler t2 read next;
-a b
-18 eee
-handler t2 read last;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
-handler t2 close;
-handler t1 open;
-handler t1 read a next;
-a b
-14 aaa
-handler t1 read a next;
-a b
-15 bbb
-handler t1 close;
-handler t1 open;
-handler t1 read a prev;
-a b
-22 iii
-handler t1 read a prev;
-a b
-21 hhh
-handler t1 close;
-handler t1 open as t2;
-handler t2 read first;
-a b
-17 ddd
-alter table t1 engine=innodb;
-handler t2 read first;
-ERROR 42S02: Unknown table 't2' in HANDLER
-drop table t1;
-CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2);
-HANDLER t1 OPEN;
-HANDLER t1 READ `primary` = (1, 1000);
-no1 no2
-HANDLER t1 READ `primary` PREV;
-no1 no2
-1 275
-DROP TABLE t1;
diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result
index 012f9492d8d..fb854ed7992 100644
--- a/mysql-test/r/innodb_mysql.result
+++ b/mysql-test/r/innodb_mysql.result
@@ -1,11 +1,12 @@
-drop table if exists t1,t2;
+SET SESSION STORAGE_ENGINE = InnoDB;
+drop table if exists t1,t2,t1m,t1i,t2m,t2i,t4;
create table t1 (
c_id int(11) not null default '0',
org_id int(11) default null,
unique key contacts$c_id (c_id),
key contacts$org_id (org_id)
-) engine=innodb;
-insert into t1 values
+);
+insert into t1 values
(2,null),(120,null),(141,null),(218,7), (128,1),
(151,2),(234,2),(236,2),(243,2),(255,2),(259,2),(232,3),(235,3),(238,3),
(246,3),(253,3),(269,3),(285,3),(291,3),(293,3),(131,4),(230,4),(231,4);
@@ -27,16 +28,16 @@ sla_set int(11) default null,
unique key t2$slai_id (slai_id),
key t2$owner_id (owner_id),
key t2$sla_id (sla_id)
-) engine=innodb;
+);
insert into t2(slai_id, owner_tbl, owner_id, sla_id) values
(1,3,1,1), (3,3,10,2), (4,3,3,6), (5,3,2,5), (6,3,8,3), (7,3,9,7),
(8,3,6,8), (9,3,4,9), (10,3,5,10), (11,3,11,11), (12,3,7,12);
flush tables;
select si.slai_id
from t1 c join t2 si on
-((si.owner_tbl = 3 and si.owner_id = c.org_id) or
-( si.owner_tbl = 2 and si.owner_id = c.c_id))
-where
+((si.owner_tbl = 3 and si.owner_id = c.org_id) or
+( si.owner_tbl = 2 and si.owner_id = c.c_id))
+where
c.c_id = 218 and expiredate is null;
slai_id
12
@@ -47,17 +48,17 @@ c_id org_id
141 NULL
select si.slai_id
from t1 c join t2 si on
-((si.owner_tbl = 3 and si.owner_id = c.org_id) or
-( si.owner_tbl = 2 and si.owner_id = c.c_id))
-where
+((si.owner_tbl = 3 and si.owner_id = c.org_id) or
+( si.owner_tbl = 2 and si.owner_id = c.c_id))
+where
c.c_id = 218 and expiredate is null;
slai_id
12
drop table t1, t2;
-CREATE TABLE t1 (a int, b int, KEY b (b)) Engine=InnoDB;
-CREATE TABLE t2 (a int, b int, PRIMARY KEY (a,b)) Engine=InnoDB;
-CREATE TABLE t3 (a int, b int, c int, PRIMARY KEY (a),
-UNIQUE KEY b (b,c), KEY a (a,b,c)) Engine=InnoDB;
+CREATE TABLE t1 (a int, b int, KEY b (b));
+CREATE TABLE t2 (a int, b int, PRIMARY KEY (a,b));
+CREATE TABLE t3 (a int, b int, c int, PRIMARY KEY (a),
+UNIQUE KEY b (b,c), KEY a (a,b,c));
INSERT INTO t1 VALUES (1, 1);
INSERT INTO t1 SELECT a + 1, b + 1 FROM t1;
INSERT INTO t1 SELECT a + 2, b + 2 FROM t1;
@@ -67,14 +68,14 @@ DELETE FROM t2 WHERE a = 1 AND b < 2;
INSERT INTO t3 VALUES (1,1,1),(2,1,2);
INSERT INTO t3 SELECT a + 2, a + 2, 3 FROM t3;
INSERT INTO t3 SELECT a + 4, a + 4, 3 FROM t3;
-SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE
-t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2)
+SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE
+t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2)
ORDER BY t1.b LIMIT 2;
b a
1 1
2 2
-SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE
-t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2)
+SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE
+t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2)
ORDER BY t1.b LIMIT 5;
b a
1 1
@@ -92,8 +93,8 @@ CREATE TABLE `t2` (
`id4` INT NOT NULL,
UNIQUE (`id2`,`id4`),
KEY (`id1`)
-) ENGINE=InnoDB;
-INSERT INTO `t2`(`id1`,`id2`,`id3`,`id4`) VALUES
+);
+INSERT INTO `t2`(`id1`,`id2`,`id3`,`id4`) VALUES
(1,1,1,0),
(1,1,2,1),
(5,1,2,2),
@@ -112,66 +113,12 @@ Before and after comparison
0
drop table t1;
End of 4.1 tests
-create table t1m (a int) engine=myisam;
-create table t1i (a int) engine=innodb;
-create table t2m (a int) engine=myisam;
-create table t2i (a int) engine=innodb;
+create table t1m (a int) engine = MEMORY;
+create table t1i (a int);
+create table t2m (a int) engine = MEMORY;
+create table t2i (a int);
insert into t2m values (5);
insert into t2i values (5);
-select min(a) from t1m;
-min(a)
-NULL
-select min(7) from t1m;
-min(7)
-NULL
-select min(7) from DUAL;
-min(7)
-7
-explain select min(7) from t2m join t1m;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
-select min(7) from t2m join t1m;
-min(7)
-NULL
-select max(a) from t1m;
-max(a)
-NULL
-select max(7) from t1m;
-max(7)
-NULL
-select max(7) from DUAL;
-max(7)
-7
-explain select max(7) from t2m join t1m;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
-select max(7) from t2m join t1m;
-max(7)
-NULL
-select 1, min(a) from t1m where a=99;
-1 min(a)
-1 NULL
-select 1, min(a) from t1m where 1=99;
-1 min(a)
-1 NULL
-select 1, min(1) from t1m where a=99;
-1 min(1)
-1 NULL
-select 1, min(1) from t1m where 1=99;
-1 min(1)
-1 NULL
-select 1, max(a) from t1m where a=99;
-1 max(a)
-1 NULL
-select 1, max(a) from t1m where 1=99;
-1 max(a)
-1 NULL
-select 1, max(1) from t1m where a=99;
-1 max(1)
-1 NULL
-select 1, max(1) from t1m where 1=99;
-1 max(1)
-1 NULL
select min(a) from t1i;
min(a)
NULL
@@ -252,7 +199,7 @@ count(*) min(7) max(7)
drop table t1m, t1i, t2m, t2i;
create table t1 (
a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
-);
+) ENGINE = MEMORY;
insert into t1 (a1, a2, b, c, d) values
('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
@@ -288,14 +235,14 @@ insert into t1 (a1, a2, b, c, d) values
('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4');
create table t4 (
pk_col int auto_increment primary key, a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
-) engine=innodb;
+);
insert into t4 (a1, a2, b, c, d, dummy) select * from t1;
create index idx12672_0 on t4 (a1);
create index idx12672_1 on t4 (a1,a2,b,c);
create index idx12672_2 on t4 (a1,a2,b);
-analyze table t1;
+analyze table t4;
Table Op Msg_type Msg_text
-test.t1 analyze status OK
+test.t4 analyze status OK
select distinct a1 from t4 where pk_col not in (1,2,3,4);
a1
a
@@ -313,7 +260,7 @@ INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
DELETE IGNORE FROM t1 WHERE i = 1;
Warnings:
-Error 1451 Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`i`) REFERENCES `t1` (`i`) ON DELETE NO ACTION)
+Error 1451 Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`i`) REFERENCES `t1` (`i`) ON DELETE NO ACTION)
SELECT * FROM t1, t2;
i i
1 1
@@ -321,18 +268,18 @@ DROP TABLE t2, t1;
End of 4.1 tests.
create table t1 (
a varchar(30), b varchar(30), primary key(a), key(b)
-) engine=innodb;
+);
select distinct a from t1;
a
drop table t1;
-create table t1(a int, key(a)) engine=innodb;
+create table t1(a int, key(a));
insert into t1 values(1);
select a, count(a) from t1 group by a with rollup;
a count(a)
1 1
NULL 1
drop table t1;
-create table t1 (f1 int, f2 char(1), primary key(f1,f2)) engine=innodb;
+create table t1 (f1 int, f2 char(1), primary key(f1,f2));
insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d");
alter table t1 drop primary key, add primary key (f2, f1);
explain select distinct f1 a, f1 b from t1;
@@ -343,25 +290,98 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL PRIMARY 5 NULL 3 Using index for group-by; Using temporary
drop table t1;
CREATE TABLE t1 (id int(11) NOT NULL PRIMARY KEY, name varchar(20),
-INDEX (name)) ENGINE=InnoDB;
-CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11),
-FOREIGN KEY (fkey) REFERENCES t2(id)) ENGINE=InnoDB;
+INDEX (name));
+CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11));
+ALTER TABLE t2 ADD FOREIGN KEY (fkey) REFERENCES t2(id);
INSERT INTO t1 VALUES (1,'A1'),(2,'A2'),(3,'B');
INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3);
EXPLAIN
-SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
+SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
WHERE t1.name LIKE 'A%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY,name name 23 NULL 3 Using where; Using index
1 SIMPLE t2 ref fkey fkey 5 test.t1.id 1 Using where; Using index
EXPLAIN
-SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
+SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
WHERE t1.name LIKE 'A%' OR FALSE;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL fkey 5 NULL 5 Using index
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.fkey 1 Using where
DROP TABLE t1,t2;
-create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c FLOAT, KEY b(b)) ENGINE = INNODB;
+INSERT INTO t1 VALUES ( 1 , 1 , 1);
+INSERT INTO t1 SELECT a + 1 , MOD(a + 1 , 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 2 , MOD(a + 2 , 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 4 , MOD(a + 4 , 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 8 , MOD(a + 8 , 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 16, MOD(a + 16, 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 32, MOD(a + 32, 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 64, MOD(a + 64, 20), 1 FROM t1;
+EXPLAIN SELECT b, SUM(c) FROM t1 GROUP BY b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 5 NULL 128
+EXPLAIN SELECT SQL_BIG_RESULT b, SUM(c) FROM t1 GROUP BY b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 128 Using filesort
+DROP TABLE t1;
+CREATE TABLE t1 (a int, b int);
+insert into t1 values (1,1),(1,2);
+CREATE TABLE t2 (primary key (a)) select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+drop table if exists t2;
+Warnings:
+Note 1051 Unknown table 't2'
+CREATE TEMPORARY TABLE t2 (primary key (a)) select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+drop table if exists t2;
+Warnings:
+Note 1051 Unknown table 't2'
+CREATE TABLE t2 (a int, b int, primary key (a));
+BEGIN;
+INSERT INTO t2 values(100,100);
+CREATE TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT * from t2;
+a b
+100 100
+ROLLBACK;
+SELECT * from t2;
+a b
+100 100
+TRUNCATE table t2;
+INSERT INTO t2 select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT * from t2;
+a b
+drop table t2;
+CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a));
+BEGIN;
+INSERT INTO t2 values(100,100);
+CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT * from t2;
+a b
+100 100
+COMMIT;
+BEGIN;
+INSERT INTO t2 values(101,101);
+CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT * from t2;
+a b
+100 100
+101 101
+ROLLBACK;
+SELECT * from t2;
+a b
+100 100
+TRUNCATE table t2;
+INSERT INTO t2 select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT * from t2;
+a b
+drop table t1,t2;
+create table t1(f1 varchar(800) binary not null, key(f1))
character set utf8 collate utf8_general_ci;
Warnings:
Warning 1071 Specified key was too long; max key length is 765 bytes
@@ -384,3 +404,72 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 128 Using filesort
DROP TABLE t1;
End of 5.0 tests
+CREATE TABLE `t2` (
+`k` int(11) NOT NULL auto_increment,
+`a` int(11) default NULL,
+`c` int(11) default NULL,
+PRIMARY KEY (`k`),
+UNIQUE KEY `idx_1` (`a`)
+);
+insert into t2 ( a ) values ( 6 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1;
+insert into t2 ( a ) values ( 7 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1;
+select last_insert_id();
+last_insert_id()
+2
+select * from t2;
+k a c
+1 6 NULL
+2 7 NULL
+insert into t2 ( a ) values ( 6 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1;
+select last_insert_id();
+last_insert_id()
+2
+select last_insert_id(0);
+last_insert_id(0)
+0
+insert into t2 ( a ) values ( 6 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1;
+select last_insert_id();
+last_insert_id()
+0
+select * from t2;
+k a c
+1 6 2
+2 7 NULL
+insert ignore into t2 values (null,6,1),(10,8,1);
+select last_insert_id();
+last_insert_id()
+0
+insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
+select last_insert_id();
+last_insert_id()
+11
+select * from t2;
+k a c
+1 6 2
+2 7 NULL
+10 8 1
+11 15 1
+12 20 1
+insert into t2 ( a ) values ( 6 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1, k=last_insert_id(k);
+select last_insert_id();
+last_insert_id()
+1
+select * from t2;
+k a c
+1 6 3
+2 7 NULL
+10 8 1
+11 15 1
+12 20 1
+drop table t2;
+End of 5.1 tests
diff --git a/mysql-test/r/innodb_unsafe_binlog.result b/mysql-test/r/innodb_unsafe_binlog.result
deleted file mode 100644
index 4a4f0e0fae5..00000000000
--- a/mysql-test/r/innodb_unsafe_binlog.result
+++ /dev/null
@@ -1,48 +0,0 @@
-drop table if exists t1,t2;
-create table t1 (id int not null, f_id int not null, f int not null,
-primary key(f_id, id)) engine=innodb;
-create table t2 (id int not null,s_id int not null,s varchar(200),
-primary key(id)) engine=innodb;
-INSERT INTO t1 VALUES (8, 1, 3);
-INSERT INTO t1 VALUES (1, 2, 1);
-INSERT INTO t2 VALUES (1, 0, '');
-INSERT INTO t2 VALUES (8, 1, '');
-commit;
-DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id)
-WHERE mm.id IS NULL;
-select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
-where mm.id is null lock in share mode;
-id f_id f
-drop table t1,t2;
-create table t1 (id int not null, f_id int not null, f int not null,
-primary key(id),key(f_id)) engine=innodb;
-create table t2 (id int not null,s_id int not null,s varchar(200),
-primary key(id),key(s_id)) engine=innodb;
-INSERT INTO t1 VALUES (8, 1, 3);
-INSERT INTO t1 VALUES (1, 2, 1);
-INSERT INTO t2 VALUES (1, 0, '');
-INSERT INTO t2 VALUES (8, 1, '');
-commit;
-delete ml.* from t1 as ml left join t2 as mm on (mm.s_id=ml.f_id) where mm.s is null;
-select ml.* from t1 as ml left join t2 as mm on (mm.s_id=ml.f_id) where mm.s is null lock in share mode;
-id f_id f
-drop table t1,t2;
-create table t1(a int not null, b int, primary key(a)) engine=innodb;
-insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2);
-commit;
-set autocommit = 0;
-select * from t1 lock in share mode;
-a b
-1 1
-2 2
-3 1
-4 2
-5 1
-6 2
-update t1 set b = 5 where b = 1;
-set autocommit = 0;
-select * from t1 where a = 2 and b = 2 for update;
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-commit;
-commit;
-drop table t1;
diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result
index 80723d68b5a..b090f0f52c0 100644
--- a/mysql-test/r/insert.result
+++ b/mysql-test/r/insert.result
@@ -2,8 +2,8 @@ drop table if exists t1,t2,t3;
create table t1 (a int not null);
insert into t1 values (1);
insert into t1 values (a+2);
-insert into t1 values (a+3);
-insert into t1 values (4),(a+5);
+insert into t1 values (a+3),(a+4);
+insert into t1 values (5),(a+6);
select * from t1;
a
1
@@ -11,6 +11,7 @@ a
3
4
5
+6
drop table t1;
create table t1 (id int not null auto_increment primary key, username varchar(32) not null, unique (username));
insert into t1 values (0,"mysql");
@@ -63,7 +64,7 @@ insert into t1 values(NULL);
ERROR 23000: Column 'id' cannot be null
insert into t1 values (1), (NULL), (2);
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'id' at row 2
+Warning 1048 Column 'id' cannot be null
select * from t1;
id
1
@@ -157,20 +158,20 @@ f_float_3_1_u 0.0
set @value= "1e+1111111111a";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
-Warning 1264 Out of range value adjusted for column 'f_double' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float' at row 1
-Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1
-Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1
-Warning 1264 Out of range value adjusted for column 'f_double_u' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
-Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
-Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
+Warning 1264 Out of range value for column 'f_double' at row 1
+Warning 1264 Out of range value for column 'f_float' at row 1
+Warning 1264 Out of range value for column 'f_float' at row 1
+Warning 1264 Out of range value for column 'f_double_7_2' at row 1
+Warning 1264 Out of range value for column 'f_double_7_2' at row 1
+Warning 1264 Out of range value for column 'f_float_4_3' at row 1
+Warning 1264 Out of range value for column 'f_float_4_3' at row 1
+Warning 1264 Out of range value for column 'f_double_u' at row 1
+Warning 1264 Out of range value for column 'f_float_u' at row 1
+Warning 1264 Out of range value for column 'f_float_u' at row 1
+Warning 1264 Out of range value for column 'f_double_15_1_u' at row 1
+Warning 1264 Out of range value for column 'f_double_15_1_u' at row 1
+Warning 1264 Out of range value for column 'f_float_3_1_u' at row 1
+Warning 1264 Out of range value for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 4
original_value 1e+1111111111a
@@ -185,21 +186,21 @@ f_float_3_1_u 99.9
set @value= "-1e+1111111111a";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
-Warning 1264 Out of range value adjusted for column 'f_double' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float' at row 1
-Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1
-Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1
-Warning 1264 Out of range value adjusted for column 'f_double_u' at row 1
-Warning 1264 Out of range value adjusted for column 'f_double_u' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
-Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
-Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
+Warning 1264 Out of range value for column 'f_double' at row 1
+Warning 1264 Out of range value for column 'f_float' at row 1
+Warning 1264 Out of range value for column 'f_float' at row 1
+Warning 1264 Out of range value for column 'f_double_7_2' at row 1
+Warning 1264 Out of range value for column 'f_double_7_2' at row 1
+Warning 1264 Out of range value for column 'f_float_4_3' at row 1
+Warning 1264 Out of range value for column 'f_float_4_3' at row 1
+Warning 1264 Out of range value for column 'f_double_u' at row 1
+Warning 1264 Out of range value for column 'f_double_u' at row 1
+Warning 1264 Out of range value for column 'f_float_u' at row 1
+Warning 1264 Out of range value for column 'f_float_u' at row 1
+Warning 1264 Out of range value for column 'f_double_15_1_u' at row 1
+Warning 1264 Out of range value for column 'f_double_15_1_u' at row 1
+Warning 1264 Out of range value for column 'f_float_3_1_u' at row 1
+Warning 1264 Out of range value for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 5
original_value -1e+1111111111a
@@ -218,12 +219,12 @@ ERROR 22007: Illegal double '1e+1111111111' value found during parsing
set @value= 1e+111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
-Warning 1264 Out of range value adjusted for column 'f_float' at row 1
-Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
-Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
+Warning 1264 Out of range value for column 'f_float' at row 1
+Warning 1264 Out of range value for column 'f_double_7_2' at row 1
+Warning 1264 Out of range value for column 'f_float_4_3' at row 1
+Warning 1264 Out of range value for column 'f_float_u' at row 1
+Warning 1264 Out of range value for column 'f_double_15_1_u' at row 1
+Warning 1264 Out of range value for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 6
original_value 1e+111
@@ -238,13 +239,13 @@ f_float_3_1_u 99.9
set @value= -1e+111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
-Warning 1264 Out of range value adjusted for column 'f_float' at row 1
-Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1
-Warning 1264 Out of range value adjusted for column 'f_double_u' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
-Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
+Warning 1264 Out of range value for column 'f_float' at row 1
+Warning 1264 Out of range value for column 'f_double_7_2' at row 1
+Warning 1264 Out of range value for column 'f_float_4_3' at row 1
+Warning 1264 Out of range value for column 'f_double_u' at row 1
+Warning 1264 Out of range value for column 'f_float_u' at row 1
+Warning 1264 Out of range value for column 'f_double_15_1_u' at row 1
+Warning 1264 Out of range value for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 7
original_value -1e+111
@@ -272,10 +273,10 @@ f_float_3_1_u 1.0
set @value= -1;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
-Warning 1264 Out of range value adjusted for column 'f_double_u' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
-Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
-Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
+Warning 1264 Out of range value for column 'f_double_u' at row 1
+Warning 1264 Out of range value for column 'f_float_u' at row 1
+Warning 1264 Out of range value for column 'f_double_15_1_u' at row 1
+Warning 1264 Out of range value for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 9
original_value -1
@@ -299,6 +300,27 @@ select count(*) from t2;
count(*)
25500
drop table t1,t2,t3;
+create table t1 (a int, b int);
+insert into t1 (a,b) values (a,b);
+insert into t1 SET a=1, b=a+1;
+insert into t1 (a,b) select 1,2;
+INSERT INTO t1 ( a ) SELECT 0 ON DUPLICATE KEY UPDATE a = a + VALUES (a);
+prepare stmt1 from ' replace into t1 (a,a) select 100, ''hundred'' ';
+execute stmt1;
+ERROR 42000: Column 'a' specified twice
+insert into t1 (a,b,b) values (1,1,1);
+ERROR 42000: Column 'b' specified twice
+insert into t1 (a,a) values (1,1,1);
+ERROR 21S01: Column count doesn't match value count at row 1
+insert into t1 (a,a) values (1,1);
+ERROR 42000: Column 'a' specified twice
+insert into t1 SET a=1,b=2,a=1;
+ERROR 42000: Column 'a' specified twice
+insert into t1 (b,b) select 1,2;
+ERROR 42000: Column 'b' specified twice
+INSERT INTO t1 (b,b) SELECT 0,0 ON DUPLICATE KEY UPDATE a = a + VALUES (a);
+ERROR 42000: Column 'b' specified twice
+drop table t1;
create table t1 (n int);
create view v1 as select * from t1;
insert delayed into v1 values (1);
@@ -331,3 +353,18 @@ select row_count();
row_count()
1
drop table t1;
+create table t1 (id int primary key auto_increment, data int, unique(data));
+insert ignore into t1 values(NULL,100),(NULL,110),(NULL,120);
+insert ignore into t1 values(NULL,10),(NULL,20),(NULL,110),(NULL,120),(NULL,100),(NULL,90);
+insert ignore into t1 values(NULL,130),(NULL,140),(500,110),(550,120),(450,100),(NULL,150);
+select * from t1 order by id;
+id data
+1 100
+2 110
+3 120
+4 10
+5 20
+6 90
+7 130
+8 140
+9 150
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index 0af48d27cd5..95ada9d37be 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -4,7 +4,7 @@ insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,
create table t2 (payoutID SMALLINT UNSIGNED NOT NULL PRIMARY KEY);
insert into t2 (payoutID) SELECT DISTINCT payoutID FROM t1;
insert into t2 (payoutID) SELECT payoutID+10 FROM t1;
-ERROR 23000: Duplicate entry '16' for key 1
+ERROR 23000: Duplicate entry '16' for key 'PRIMARY'
insert ignore into t2 (payoutID) SELECT payoutID+10 FROM t1;
select * from t2;
payoutID
@@ -561,7 +561,7 @@ create table t2 (a int not null, b char(10));
insert into t1 values (1,"t1:1"),(3,"t1:3");
insert into t2 values (2,"t2:2"), (3,"t2:3");
insert into t1 select * from t2;
-ERROR 23000: Duplicate entry '3' for key 1
+ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
select * from t1;
a b
1 t1:1
@@ -606,8 +606,8 @@ NULL 2 100
create table t2(No int not null, Field int not null, Count int not null);
insert into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2;
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'No' at row 1
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'No' at row 2
+Warning 1048 Column 'No' cannot be null
+Warning 1048 Column 'No' cannot be null
select * from t2;
No Field Count
0 1 100
diff --git a/mysql-test/r/insert_update.result b/mysql-test/r/insert_update.result
index 6be37450835..baf3f71c4f7 100644
--- a/mysql-test/r/insert_update.result
+++ b/mysql-test/r/insert_update.result
@@ -26,7 +26,7 @@ a b c
3 4 1020
5 6 130
INSERT t1 VALUES (1,9,70) ON DUPLICATE KEY UPDATE c=c+100000, b=4;
-ERROR 23000: Duplicate entry '4' for key 2
+ERROR 23000: Duplicate entry '4' for key 'b'
SELECT * FROM t1;
a b c
1 2 10010
@@ -57,13 +57,13 @@ a b c VALUES(a)
8 9 60 NULL
2 1 11 NULL
explain extended SELECT *, VALUES(a) FROM t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 5
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,values(`test`.`t1`.`a`) AS `VALUES(a)` from `test`.`t1`
explain extended select * from t1 where values(a);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where values(`test`.`t1`.`a`)
DROP TABLE t1;
@@ -132,7 +132,7 @@ a b c
3 4 1020
5 6 130
INSERT t1 SELECT 1,9,70 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100000, b=4;
-ERROR 23000: Duplicate entry '4' for key 2
+ERROR 23000: Duplicate entry '4' for key 'b'
SELECT * FROM t1;
a b c
1 2 10010
diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result
index 48b7730481f..897ec4f7a6a 100644
--- a/mysql-test/r/join.result
+++ b/mysql-test/r/join.result
@@ -700,8 +700,8 @@ ERROR 42S22: Unknown column 't1.b' in 'on clause'
select * from information_schema.statistics join information_schema.columns
using(table_name,column_name) where table_name='user';
TABLE_NAME COLUMN_NAME TABLE_CATALOG TABLE_SCHEMA NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
-user Host NULL mysql 0 mysql PRIMARY 1 A NULL NULL NULL BTREE NULL mysql 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
-user User NULL mysql 0 mysql PRIMARY 2 A 5 NULL NULL BTREE NULL mysql 2 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
+user Host NULL mysql 0 mysql PRIMARY 1 A NULL NULL NULL BTREE NULL mysql 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI #
+user User NULL mysql 0 mysql PRIMARY 2 A 5 NULL NULL BTREE NULL mysql 2 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI #
drop table t1;
drop table t2;
drop table t3;
@@ -764,3 +764,43 @@ natural join t5;
y c b a z
1 3 2 1 4
drop table t1, t2, t3, t4, t5;
+create table t1 (a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t2 (a int, b int, filler char(100), key(a), key(b));
+create table t3 (a int, b int, filler char(100), key(a), key(b));
+insert into t2
+select @a:= A.a + 10*(B.a + 10*C.a), @a, 'filler' from t1 A, t1 B, t1 C;
+insert into t3 select * from t2 where a < 800;
+explain select * from t2,t3 where t2.a < 200 and t2.b=t3.b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL a,b NULL NULL NULL 1000 Using where
+1 SIMPLE t3 ref b b 5 test.t2.b 1 Using where
+drop table t1, t2, t3;
+create table t1 (a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t2 (a int, b int, primary key(a));
+insert into t2 select @v:=A.a+10*B.a, @v from t1 A, t1 B;
+explain select * from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10
+show status like '%cost%';
+Variable_name Value
+Last_query_cost 4.016090
+select 'The cost of accessing t1 (dont care if it changes' '^';
+The cost of accessing t1 (dont care if it changes
+The cost of accessing t1 (dont care if it changes^
+select 'vv: Following query must use ALL(t1), eq_ref(A), eq_ref(B): vv' Z;
+Z
+vv: Following query must use ALL(t1), eq_ref(A), eq_ref(B): vv
+explain select * from t1, t2 A, t2 B where A.a = t1.a and B.a=A.b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10
+1 SIMPLE A eq_ref PRIMARY PRIMARY 4 test.t1.a 1
+1 SIMPLE B eq_ref PRIMARY PRIMARY 4 test.A.b 1
+show status like '%cost%';
+Variable_name Value
+Last_query_cost 24.016090
+select '^^: The above should be ~= 20 + cost(select * from t1). Value less than 20 is an error' Z;
+Z
+^^: The above should be ~= 20 + cost(select * from t1). Value less than 20 is an error
+drop table t1, t2;
diff --git a/mysql-test/r/join_nested.result b/mysql-test/r/join_nested.result
index 0747418111b..6b9bea7aa21 100644
--- a/mysql-test/r/join_nested.result
+++ b/mysql-test/r/join_nested.result
@@ -71,10 +71,10 @@ LEFT JOIN
(t3, t4)
ON t2.b=t4.b
WHERE t3.a=1 OR t3.c IS NULL;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 3
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where
-1 SIMPLE t4 ALL NULL NULL NULL NULL 2
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on((`test`.`t4`.`b` = `test`.`t2`.`b`)) where ((`test`.`t3`.`a` = 1) or isnull(`test`.`t3`.`c`))
SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
@@ -147,11 +147,11 @@ LEFT JOIN
(t3, t4, t5)
ON t2.b=t4.b
WHERE t3.a>1 OR t3.c IS NULL;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 3
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where
-1 SIMPLE t4 ALL NULL NULL NULL NULL 2
-1 SIMPLE t5 ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on((`test`.`t4`.`b` = `test`.`t2`.`b`)) where ((`test`.`t3`.`a` > 1) or isnull(`test`.`t3`.`c`))
SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,t5.a,t5.b
@@ -177,11 +177,11 @@ LEFT JOIN
ON t2.b=t4.b
WHERE (t3.a>1 OR t3.c IS NULL) AND
(t5.a<3 OR t5.c IS NULL);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 3
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where
-1 SIMPLE t4 ALL NULL NULL NULL NULL 2
-1 SIMPLE t5 ALL NULL NULL NULL NULL 3 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on((`test`.`t4`.`b` = `test`.`t2`.`b`)) where (((`test`.`t3`.`a` > 1) or isnull(`test`.`t3`.`c`)) and ((`test`.`t5`.`a` < 3) or isnull(`test`.`t5`.`c`)))
SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,t5.a,t5.b
@@ -227,10 +227,10 @@ FROM (t6, t7)
LEFT JOIN
t8
ON t7.b=t8.b AND t6.b < 10;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t7 ALL NULL NULL NULL NULL 2
-1 SIMPLE t6 ALL NULL NULL NULL NULL 3
-1 SIMPLE t8 ALL NULL NULL NULL NULL 2
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t7`.`b` = `test`.`t8`.`b`) and (`test`.`t6`.`b` < 10))) where 1
SELECT t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
@@ -542,16 +542,16 @@ ON (t3.b=2 OR t3.c IS NULL) AND (t6.b=2 OR t6.c IS NULL) AND
WHERE t0.a=1 AND
t0.b=t1.b AND
(t2.a >= 4 OR t2.c IS NULL);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2
-1 SIMPLE t4 ALL NULL NULL NULL NULL 2
-1 SIMPLE t5 ALL NULL NULL NULL NULL 3
-1 SIMPLE t7 ALL NULL NULL NULL NULL 2
-1 SIMPLE t6 ALL NULL NULL NULL NULL 3
-1 SIMPLE t8 ALL NULL NULL NULL NULL 2
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) where ((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)))
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
@@ -637,17 +637,17 @@ t0.b=t1.b AND
(t8.a < 1 OR t8.c IS NULL) AND
(t8.b=t9.b OR t8.c IS NULL) AND
(t9.a=1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where
-1 SIMPLE t4 ALL NULL NULL NULL NULL 2 Using where
-1 SIMPLE t5 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t7 ALL NULL NULL NULL NULL 2 Using where
-1 SIMPLE t6 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t8 ALL NULL NULL NULL NULL 2 Using where
-1 SIMPLE t9 ALL NULL NULL NULL NULL 3 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
SELECT t9.a,t9.b
@@ -834,11 +834,11 @@ RIGHT JOIN
t2
ON t3.a=1 AND t2.b=t4.b
WHERE t1.a <= 2;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 3
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2
-1 SIMPLE t4 ALL NULL NULL NULL NULL 2
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t1` join `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) where (`test`.`t1`.`a` <= 2)
CREATE INDEX idx_b ON t2(b);
@@ -848,11 +848,11 @@ FROM (t3,t4)
LEFT JOIN
(t1,t2)
ON t3.a=1 AND t3.b=t2.b AND t2.b=t4.b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2
-1 SIMPLE t4 ALL NULL NULL NULL NULL 2
-1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 2
-1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 2 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(((`test`.`t3`.`a` = 1) and (`test`.`t3`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` = `test`.`t4`.`b`))) where 1
SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
@@ -904,17 +904,17 @@ t0.b=t1.b AND
(t8.a < 1 OR t8.c IS NULL) AND
(t8.b=t9.b OR t8.c IS NULL) AND
(t9.a=1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where
-1 SIMPLE t4 ALL NULL NULL NULL NULL 2 Using where
-1 SIMPLE t5 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t7 ALL NULL NULL NULL NULL 2 Using where
-1 SIMPLE t6 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t8 ALL NULL NULL NULL NULL 2 Using where
-1 SIMPLE t9 ALL NULL NULL NULL NULL 3 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
CREATE INDEX idx_b ON t4(b);
@@ -954,17 +954,17 @@ t0.b=t1.b AND
(t8.a < 1 OR t8.c IS NULL) AND
(t8.b=t9.b OR t8.c IS NULL) AND
(t9.a=1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where
-1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 Using where
-1 SIMPLE t5 ALL idx_b NULL NULL NULL 3 Using where
-1 SIMPLE t7 ALL NULL NULL NULL NULL 2 Using where
-1 SIMPLE t6 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t8 ALL NULL NULL NULL NULL 2 Using where
-1 SIMPLE t9 ALL NULL NULL NULL NULL 3 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 100.00 Using where
+1 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
CREATE INDEX idx_b ON t8(b);
@@ -1003,17 +1003,17 @@ t0.b=t1.b AND
(t8.a < 1 OR t8.c IS NULL) AND
(t8.b=t9.b OR t8.c IS NULL) AND
(t9.a=1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where
-1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 Using where
-1 SIMPLE t5 ALL idx_b NULL NULL NULL 3 Using where
-1 SIMPLE t7 ALL NULL NULL NULL NULL 2 Using where
-1 SIMPLE t6 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 Using where
-1 SIMPLE t9 ALL NULL NULL NULL NULL 3 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 100.00 Using where
+1 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where
+1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
CREATE INDEX idx_b ON t1(b);
@@ -1053,17 +1053,17 @@ t0.b=t1.b AND
(t8.a < 1 OR t8.c IS NULL) AND
(t8.b=t9.b OR t8.c IS NULL) AND
(t9.a=1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 ref idx_a idx_a 5 const 1 Using where
-1 SIMPLE t1 ref idx_b idx_b 5 test.t0.b 2 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where
-1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 Using where
-1 SIMPLE t5 ALL idx_b NULL NULL NULL 3 Using where
-1 SIMPLE t7 ALL NULL NULL NULL NULL 2 Using where
-1 SIMPLE t6 ALL NULL NULL NULL NULL 3 Using where
-1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 Using where
-1 SIMPLE t9 ALL NULL NULL NULL NULL 3 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t0 ref idx_a idx_a 5 const 1 100.00 Using where
+1 SIMPLE t1 ref idx_b idx_b 5 test.t0.b 2 100.00 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 100.00 Using where
+1 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where
+1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index 89bb26c4b3f..4d58d035f21 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -169,7 +169,7 @@ usr_id uniq_id increment usr2_id c_amount max
3 4 84676 NULL NULL NULL
INSERT INTO t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes');
INSERT INTO t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes');
-ERROR 23000: Duplicate entry '2-3' for key 1
+ERROR 23000: Duplicate entry '2-3' for key 'PRIMARY'
INSERT INTO t2 VALUES (7,3,1000,2000,0,0,746294,937484,'yes');
SELECT t1.usr_id,t1.uniq_id,t1.increment,t2.usr2_id,t2.c_amount,t2.max FROM t1 LEFT JOIN t2 ON t2.id = t1.uniq_id WHERE t1.uniq_id = 4 ORDER BY t2.c_amount;
usr_id uniq_id increment usr2_id c_amount max
diff --git a/mysql-test/r/join_outer_innodb.result b/mysql-test/r/join_outer_innodb.result
new file mode 100644
index 00000000000..e8a2d6f668b
--- /dev/null
+++ b/mysql-test/r/join_outer_innodb.result
@@ -0,0 +1,19 @@
+CREATE TABLE t1 (id int(11) NOT NULL PRIMARY KEY, name varchar(20),
+INDEX (name)) ENGINE=InnoDB;
+CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11),
+FOREIGN KEY (fkey) REFERENCES t2(id)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,'A1'),(2,'A2'),(3,'B');
+INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3);
+EXPLAIN
+SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
+WHERE t1.name LIKE 'A%';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY,name name 23 NULL 3 Using where; Using index
+1 SIMPLE t2 ref fkey fkey 5 test.t1.id 1 Using where; Using index
+EXPLAIN
+SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
+WHERE t1.name LIKE 'A%' OR FALSE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL fkey 5 NULL 5 Using index
+1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.fkey 1 Using where
+DROP TABLE t1,t2;
diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result
index eea884e4294..ea8d4338d08 100644
--- a/mysql-test/r/key.result
+++ b/mysql-test/r/key.result
@@ -127,7 +127,7 @@ primary key (SEQNO, MOTYPEID, MOINSTANCEID, ATTRID, VALUE )
INSERT INTO t1 VALUES (1, 1, 1, 1, 'a');
INSERT INTO t1 VALUES (1, 1, 1, 1, 'b');
INSERT INTO t1 VALUES (1, 1, 1, 1, 'a');
-ERROR 23000: Duplicate entry '1-1-1-1-a' for key 1
+ERROR 23000: Duplicate entry '1-1-1-1-a' for key 'PRIMARY'
drop table t1;
CREATE TABLE t1 (
a tinytext NOT NULL,
@@ -159,8 +159,8 @@ CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT,
UNIQUE (c,i));
INSERT INTO t1 (c) VALUES (NULL),(NULL);
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'c' at row 1
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'c' at row 2
+Warning 1048 Column 'c' cannot be null
+Warning 1048 Column 'c' cannot be null
SELECT * FROM t1;
c i
1
@@ -242,8 +242,8 @@ create table t1 (c varchar(30) character set utf8, t text character set utf8, un
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c` varchar(30) character set utf8 default NULL,
- `t` text character set utf8,
+ `c` varchar(30) CHARACTER SET utf8 DEFAULT NULL,
+ `t` text CHARACTER SET utf8,
UNIQUE KEY `c` (`c`(2)),
UNIQUE KEY `t` (`t`(3))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -251,13 +251,13 @@ insert t1 values ('cccc', 'tttt'),
(0xD0B1212223D0B1D0B1D0B1D0B1D0B1, 0xD0B1D0B1212223D0B1D0B1D0B1D0B1),
(0xD0B1222123D0B1D0B1D0B1D0B1D0B1, 0xD0B1D0B1222123D0B1D0B1D0B1D0B1);
insert t1 (c) values ('cc22');
-ERROR 23000: Duplicate entry 'cc22' for key 1
+ERROR 23000: Duplicate entry 'cc22' for key 'c'
insert t1 (t) values ('ttt22');
-ERROR 23000: Duplicate entry 'ttt22' for key 2
+ERROR 23000: Duplicate entry 'ttt22' for key 't'
insert t1 (c) values (0xD0B1212322D0B1D0B1D0B1D0B1D0B1);
-ERROR 23000: Duplicate entry 'б!#"' for key 1
+ERROR 23000: Duplicate entry 'б!#"' for key 'c'
insert t1 (t) values (0xD0B1D0B1212322D0B1D0B1D0B1D0B1);
-ERROR 23000: Duplicate entry 'бб!#"б' for key 2
+ERROR 23000: Duplicate entry 'бб!#"б' for key 't'
select c from t1 where c='cccc';
c
cccc
@@ -368,24 +368,24 @@ create table t1 (a varchar(10), b varchar(10), key(a(10),b(10)));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) default NULL,
- `b` varchar(10) default NULL,
+ `a` varchar(10) DEFAULT NULL,
+ `b` varchar(10) DEFAULT NULL,
KEY `a` (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 modify b varchar(20);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) default NULL,
- `b` varchar(20) default NULL,
+ `a` varchar(10) DEFAULT NULL,
+ `b` varchar(20) DEFAULT NULL,
KEY `a` (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 modify a varchar(20);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(20) default NULL,
- `b` varchar(20) default NULL,
+ `a` varchar(20) DEFAULT NULL,
+ `b` varchar(20) DEFAULT NULL,
KEY `a` (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -414,3 +414,71 @@ a int(11) NO PRI
b varchar(20) NO MUL
c varchar(20) NO
drop table t1;
+create table t1 (
+c1 int,
+c2 char(12),
+c3 varchar(123),
+c4 timestamp,
+index (c1),
+index i1 (c1),
+index i2 (c2),
+index i3 (c3),
+unique i4 (c4),
+index i5 (c1, c2, c3, c4),
+primary key (c2, c3),
+index (c2, c4));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) DEFAULT NULL,
+ `c2` char(12) NOT NULL DEFAULT '',
+ `c3` varchar(123) NOT NULL DEFAULT '',
+ `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`c2`,`c3`),
+ UNIQUE KEY `i4` (`c4`),
+ KEY `c1` (`c1`),
+ KEY `i1` (`c1`),
+ KEY `i2` (`c2`),
+ KEY `i3` (`c3`),
+ KEY `i5` (`c1`,`c2`,`c3`,`c4`),
+ KEY `c2` (`c2`,`c4`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t1 drop index c1;
+alter table t1 add index (c1);
+alter table t1 add index (c1);
+alter table t1 drop index i3;
+alter table t1 add index i3 (c3);
+alter table t1 drop index i2, drop index i4;
+alter table t1 add index i2 (c2), add index i4 (c4);
+alter table t1 drop index i2, drop index i4, add index i6 (c2, c4);
+alter table t1 add index i2 (c2), add index i4 (c4), drop index i6;
+alter table t1 drop index i2, drop index i4, add unique i4 (c4);
+alter table t1 add index i2 (c2), drop index i4, add index i4 (c4);
+alter table t1 drop index c2, add index (c2(4),c3(7));
+alter table t1 drop index c2, add index (c2(4),c3(7));
+alter table t1 add primary key (c1, c2), drop primary key;
+alter table t1 drop primary key;
+alter table t1 add primary key (c1, c2), drop primary key;
+ERROR 42000: Can't DROP 'PRIMARY'; check that column/key exists
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL DEFAULT '0',
+ `c2` char(12) NOT NULL DEFAULT '',
+ `c3` varchar(123) NOT NULL DEFAULT '',
+ `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ KEY `i1` (`c1`),
+ KEY `i5` (`c1`,`c2`,`c3`,`c4`),
+ KEY `c1` (`c1`),
+ KEY `c1_2` (`c1`),
+ KEY `i3` (`c3`),
+ KEY `i2` (`c2`),
+ KEY `i4` (`c4`),
+ KEY `c2` (`c2`(4),`c3`(7))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values(1, 'a', 'a', NULL);
+insert into t1 values(1, 'b', 'b', NULL);
+alter table t1 drop index i3, drop index i2, drop index i1;
+alter table t1 add index i3 (c3), add index i2 (c2), add unique index i1 (c1);
+ERROR 23000: Duplicate entry '1' for key 'i1'
+drop table t1;
diff --git a/mysql-test/r/key_diff.result b/mysql-test/r/key_diff.result
index c3f4f743967..8097186bde1 100644
--- a/mysql-test/r/key_diff.result
+++ b/mysql-test/r/key_diff.result
@@ -36,7 +36,7 @@ a a a a
explain select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL a NULL NULL NULL 5
-1 SIMPLE t2 ALL b NULL NULL NULL 4 Using where
+1 SIMPLE t2 ALL b NULL NULL NULL 5 Using where
select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B order by binary t1.a,t2.a;
a b a b
A B a a
diff --git a/mysql-test/r/keywords.result b/mysql-test/r/keywords.result
index 88a0ab8abd5..597983dab7e 100644
--- a/mysql-test/r/keywords.result
+++ b/mysql-test/r/keywords.result
@@ -16,3 +16,19 @@ select events.binlog from events;
binlog
1
drop table events;
+create procedure p1()
+begin
+declare n int default 2;
+authors: while n > 0 do
+set n = n -1;
+end while authors;
+end|
+create procedure p2()
+begin
+declare n int default 2;
+contributors: while n > 0 do
+set n = n -1;
+end while contributors;
+end|
+drop procedure p1;
+drop procedure p2;
diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result
index cf5486d1091..d198c943496 100644
--- a/mysql-test/r/kill.result
+++ b/mysql-test/r/kill.result
@@ -16,7 +16,7 @@ select 4;
4
drop table t1;
kill (select count(*) from mysql.user);
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select count(*) from mysql.user)' at line 1
+ERROR 42000: This version of MySQL doesn't yet support 'Usage of subqueries or stored function calls as part of this statement'
create table t1 (id int primary key);
create table t2 (id int unsigned not null);
insert into t2 select id from t1;
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index d415bd468e0..481b3de9f02 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -116,6 +116,15 @@ select @a, @b;
@a @b
NULL 15
truncate table t1;
+load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 set c=b;
+Warnings:
+Warning 1261 Row 1 doesn't contain data for all columns
+Warning 1261 Row 2 doesn't contain data for all columns
+select * from t1;
+a b c
+NULL 10 10
+NULL 15 15
+truncate table t1;
load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c="Wow";
select * from t1;
a b c
@@ -140,3 +149,30 @@ a b c
10 NULL Ten
15 NULL Fifteen
drop table t1, t2;
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (1);
+SET NAMES latin1;
+SET character_set_filesystem=filename;
+select @@character_set_filesystem;
+@@character_set_filesystem
+filename
+SELECT * INTO OUTFILE 't-1' FROM t1;
+DELETE FROM t1;
+LOAD DATA INFILE 't-1' INTO TABLE t1;
+SELECT * FROM t1;
+a
+1
+DELETE FROM t1;
+SET character_set_filesystem=latin1;
+select @@character_set_filesystem;
+@@character_set_filesystem
+latin1
+LOAD DATA INFILE 't@002d1' INTO TABLE t1;
+SELECT * FROM t1;
+a
+1
+DROP TABLE t1;
+SET character_set_filesystem=default;
+select @@character_set_filesystem;
+@@character_set_filesystem
+binary
diff --git a/mysql-test/r/loaddata_autocom_innodb.result b/mysql-test/r/loaddata_autocom_innodb.result
index 10da6b5dde7..11a07cdb783 100644
--- a/mysql-test/r/loaddata_autocom_innodb.result
+++ b/mysql-test/r/loaddata_autocom_innodb.result
@@ -1,8 +1,8 @@
SET SESSION STORAGE_ENGINE = InnoDB;
drop table if exists t1;
-create table t1 (a text, b text);
+create table t1 (id int unsigned not null auto_increment primary key, a text, b text);
start transaction;
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
+load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
Warnings:
Warning 1261 Row 3 doesn't contain data for all columns
commit;
@@ -11,7 +11,7 @@ count(*)
4
truncate table t1;
start transaction;
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
+load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
Warnings:
Warning 1261 Row 3 doesn't contain data for all columns
rollback;
diff --git a/mysql-test/r/loaddata_autocom_ndb.result b/mysql-test/r/loaddata_autocom_ndb.result
index 94e5f825fa2..f98e6a76981 100644
--- a/mysql-test/r/loaddata_autocom_ndb.result
+++ b/mysql-test/r/loaddata_autocom_ndb.result
@@ -1,8 +1,8 @@
SET SESSION STORAGE_ENGINE = ndbcluster;
drop table if exists t1;
-create table t1 (a text, b text);
+create table t1 (id int unsigned not null auto_increment primary key, a text, b text);
start transaction;
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
+load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
Warnings:
Warning 1261 Row 3 doesn't contain data for all columns
commit;
@@ -11,7 +11,7 @@ count(*)
4
truncate table t1;
start transaction;
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
+load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
Warnings:
Warning 1261 Row 3 doesn't contain data for all columns
rollback;
diff --git a/mysql-test/r/lock.result b/mysql-test/r/lock.result
index 079b0253ff6..7cd223197e7 100644
--- a/mysql-test/r/lock.result
+++ b/mysql-test/r/lock.result
@@ -68,3 +68,10 @@ ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
delete t2 from t1,t2 where t1.a=t2.a;
ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
drop table t1,t2;
+drop table if exists t1;
+create table t1 (a int);
+lock table t1 write;
+flush tables with read lock;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+unlock tables;
+drop table t1;
diff --git a/mysql-test/r/lock_multi.result b/mysql-test/r/lock_multi.result
index af49e1a27dc..2445b3e0c69 100644
--- a/mysql-test/r/lock_multi.result
+++ b/mysql-test/r/lock_multi.result
@@ -36,6 +36,13 @@ insert t1 select * from t2;
drop table t2;
ERROR 42S02: Table 'test.t2' doesn't exist
drop table t1;
+create table t1 (a int);
+create table t2 (a int);
+lock table t1 write, t2 write, t1 as t1_2 write, t2 as t2_2 write;
+insert t1 select * from t2;
+drop table t2;
+ERROR 42S02: Table 'test.t2' doesn't exist
+drop table t1;
create table t1(a int);
lock tables t1 write;
show columns from t1;
@@ -43,14 +50,6 @@ Field Type Null Key Default Extra
a int(11) YES NULL
unlock tables;
drop table t1;
-CREATE DATABASE mysqltest_1;
-FLUSH TABLES WITH READ LOCK;
-DROP DATABASE mysqltest_1;
-DROP DATABASE mysqltest_1;
-ERROR HY000: Can't execute the query because you have a conflicting read lock
-UNLOCK TABLES;
-DROP DATABASE mysqltest_1;
-ERROR HY000: Can't drop database 'mysqltest_1'; database doesn't exist
use mysql;
LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
FLUSH TABLES;
@@ -82,6 +81,14 @@ ERROR HY000: Table 't2' was not locked with LOCK TABLES
UNLOCK TABLES;
UNLOCK TABLES;
DROP TABLE t1;
+CREATE DATABASE mysqltest_1;
+FLUSH TABLES WITH READ LOCK;
+DROP DATABASE mysqltest_1;
+DROP DATABASE mysqltest_1;
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+UNLOCK TABLES;
+DROP DATABASE mysqltest_1;
+ERROR HY000: Can't drop database 'mysqltest_1'; database doesn't exist
create table t1 (f1 int(12) unsigned not null auto_increment, primary key(f1)) engine=innodb;
lock tables t1 write;
alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
diff --git a/mysql-test/r/log_state.result b/mysql-test/r/log_state.result
new file mode 100644
index 00000000000..0547c5a5bbf
--- /dev/null
+++ b/mysql-test/r/log_state.result
@@ -0,0 +1,155 @@
+set global general_log= OFF;
+truncate table mysql.general_log;
+truncate table mysql.slow_log;
+show global variables
+where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
+Variable_name = 'general_log' or Variable_name = 'slow_query_log';
+Variable_name Value
+general_log OFF
+log OFF
+log_slow_queries OFF
+slow_query_log OFF
+flush logs;
+set global general_log= ON;
+create table t1(f1 int);
+select * from mysql.general_log;
+event_time user_host thread_id server_id command_type argument
+TIMESTAMP USER_HOST # 1 Query create table t1(f1 int)
+TIMESTAMP USER_HOST # 1 Query select * from mysql.general_log
+set global general_log= OFF;
+drop table t1;
+select * from mysql.general_log;
+event_time user_host thread_id server_id command_type argument
+TIMESTAMP USER_HOST # 1 Query create table t1(f1 int)
+TIMESTAMP USER_HOST # 1 Query select * from mysql.general_log
+TIMESTAMP USER_HOST # 1 Query set global general_log= OFF
+set global general_log= ON;
+flush logs;
+show global variables
+where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
+Variable_name = 'general_log' or Variable_name = 'slow_query_log';
+Variable_name Value
+general_log ON
+log ON
+log_slow_queries OFF
+slow_query_log OFF
+set session long_query_time=1;
+select sleep(2);
+sleep(2)
+0
+select * from mysql.slow_log;
+start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text
+set global slow_query_log= ON;
+set session long_query_time=1;
+select sleep(2);
+sleep(2)
+0
+select * from mysql.slow_log;
+start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text
+TIMESTAMP USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 select sleep(2)
+show global variables
+where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
+Variable_name = 'general_log' or Variable_name = 'slow_query_log';
+Variable_name Value
+general_log ON
+log ON
+log_slow_queries ON
+slow_query_log ON
+set global general_log= ON;
+set global general_log= OFF;
+set global general_log= OFF;
+set global slow_query_log= ON;
+set global slow_query_log= OFF;
+set global slow_query_log= OFF;
+set global general_log= ON;
+truncate table mysql.general_log;
+create table t1(f1 int);
+drop table t1;
+select * from mysql.general_log;
+event_time user_host thread_id server_id command_type argument
+TIMESTAMP USER_HOST # 1 Query create table t1(f1 int)
+TIMESTAMP USER_HOST # 1 Query drop table t1
+TIMESTAMP USER_HOST # 1 Query select * from mysql.general_log
+set global general_log= OFF;
+truncate table mysql.general_log;
+select * from mysql.general_log;
+event_time user_host thread_id server_id command_type argument
+set global general_log= ON;
+show global variables
+where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
+Variable_name = 'general_log' or Variable_name = 'slow_query_log';
+Variable_name Value
+general_log ON
+log ON
+log_slow_queries OFF
+slow_query_log OFF
+show variables like 'general_log_file';
+Variable_name Value
+general_log_file #
+show variables like 'slow_query_log_file';
+Variable_name Value
+slow_query_log_file #
+show variables like 'log_output';
+Variable_name Value
+log_output FILE,TABLE
+set global general_log_file='/not exiting path/log.master';
+ERROR 42000: Variable 'general_log_file' can't be set to the value of '/not exiting path/log.master'
+set global general_log_file='/tmp';
+ERROR 42000: Variable 'general_log_file' can't be set to the value of '/tmp'
+set global general_log_file='';
+ERROR 42000: Variable 'general_log_file' can't be set to the value of ''
+show variables like 'general_log_file';
+Variable_name Value
+general_log_file #
+set global general_log= OFF;
+set global general_log_file='MYSQLTEST_VARDIR/tmp/log.master';
+set global general_log= ON;
+create table t1(f1 int);
+drop table t1;
+set global general_log= OFF;
+set global general_log_file=default;
+set global general_log= ON;
+create table t1(f1 int);
+drop table t1;
+show variables like 'general_log_file';
+Variable_name Value
+general_log_file #
+show variables like 'slow_query_log_file';
+Variable_name Value
+slow_query_log_file #
+set global general_log= default;
+set global slow_query_log= default;
+set global general_log_file= default;
+set global slow_query_log_file= default;
+show variables like 'general_log';
+Variable_name Value
+general_log OFF
+show variables like 'slow_query_log';
+Variable_name Value
+slow_query_log OFF
+set global general_log=ON;
+set global log_output=default;
+show variables like 'log_output';
+Variable_name Value
+log_output TABLE
+set global general_log=OFF;
+set global log_output=FILE;
+truncate table mysql.general_log;
+show variables like 'log_output';
+Variable_name Value
+log_output FILE
+set global general_log=ON;
+create table t1(f1 int);
+select * from mysql.general_log;
+event_time user_host thread_id server_id command_type argument
+set global general_log=OFF;
+set global log_output="FILE,TABLE";
+show variables like 'log_output';
+Variable_name Value
+log_output FILE,TABLE
+set global general_log=ON;
+drop table t1;
+select * from mysql.general_log;
+event_time user_host thread_id server_id command_type argument
+TIMESTAMP USER_HOST # 1 Query drop table t1
+TIMESTAMP USER_HOST # 1 Query select * from mysql.general_log
diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result
new file mode 100644
index 00000000000..2836b96d7b5
--- /dev/null
+++ b/mysql-test/r/log_tables.result
@@ -0,0 +1,288 @@
+use mysql;
+truncate table general_log;
+select * from general_log;
+event_time user_host thread_id server_id command_type argument
+TIMESTAMP USER_HOST THREAD_ID 1 Query select * from general_log
+truncate table slow_log;
+select * from slow_log;
+start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text
+truncate table general_log;
+select * from general_log where argument like '%general_log%';
+event_time user_host thread_id server_id command_type argument
+TIMESTAMP USER_HOST THREAD_ID 1 Query select * from general_log where argument like '%general_log%'
+create table join_test (verbose_comment varchar (80), command_type varchar(64));
+insert into join_test values ("User performed a usual SQL query", "Query");
+insert into join_test values ("New DB connection was registered", "Connect");
+insert into join_test values ("Get the table info", "Field List");
+select verbose_comment, user_host, argument
+from mysql.general_log join join_test
+on (mysql.general_log.command_type = join_test.command_type);
+verbose_comment user_host argument
+User performed a usual SQL query USER_HOST select * from general_log where argument like '%general_log%'
+User performed a usual SQL query USER_HOST create table join_test (verbose_comment varchar (80), command_type varchar(64))
+User performed a usual SQL query USER_HOST insert into join_test values ("User performed a usual SQL query", "Query")
+User performed a usual SQL query USER_HOST insert into join_test values ("New DB connection was registered", "Connect")
+User performed a usual SQL query USER_HOST insert into join_test values ("Get the table info", "Field List")
+User performed a usual SQL query USER_HOST select verbose_comment, user_host, argument
+from mysql.general_log join join_test
+on (mysql.general_log.command_type = join_test.command_type)
+drop table join_test;
+flush logs;
+lock tables mysql.general_log WRITE;
+ERROR HY000: You can't write-lock a log table. Only read access is possible
+lock tables mysql.slow_log WRITE;
+ERROR HY000: You can't write-lock a log table. Only read access is possible
+lock tables mysql.general_log READ;
+ERROR HY000: You can't use usual read lock with log tables. Try READ LOCAL instead
+lock tables mysql.slow_log READ;
+ERROR HY000: You can't use usual read lock with log tables. Try READ LOCAL instead
+lock tables mysql.slow_log READ LOCAL, mysql.general_log READ LOCAL;
+unlock tables;
+lock tables mysql.general_log READ LOCAL;
+flush logs;
+unlock tables;
+select "Mark that we woke up from flush logs in the test"
+ as "test passed";
+test passed
+Mark that we woke up from flush logs in the test
+lock tables mysql.general_log READ LOCAL;
+truncate mysql.general_log;
+unlock tables;
+select "Mark that we woke up from TRUNCATE in the test"
+ as "test passed";
+test passed
+Mark that we woke up from TRUNCATE in the test
+use test;
+truncate table mysql.general_log;
+set names utf8;
+create table bug16905 (s char(15) character set utf8 default 'пусто');
+insert into bug16905 values ('новое');
+select * from mysql.general_log;
+event_time user_host thread_id server_id command_type argument
+TIMESTAMP USER_HOST THREAD_ID 1 Query set names utf8
+TIMESTAMP USER_HOST THREAD_ID 1 Query create table bug16905 (s char(15) character set utf8 default 'пусто')
+TIMESTAMP USER_HOST THREAD_ID 1 Query insert into bug16905 values ('новое')
+TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.general_log
+drop table bug16905;
+truncate table mysql.slow_log;
+set session long_query_time=1;
+select sleep(2);
+sleep(2)
+0
+select * from mysql.slow_log;
+start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text
+TIMESTAMP USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 select sleep(2)
+alter table mysql.general_log engine=myisam;
+ERROR HY000: You cannot 'ALTER' a log table if logging is enabled
+alter table mysql.slow_log engine=myisam;
+ERROR HY000: You cannot 'ALTER' a log table if logging is enabled
+drop table mysql.general_log;
+ERROR HY000: You cannot 'DROP' a log table if logging is enabled
+drop table mysql.slow_log;
+ERROR HY000: You cannot 'DROP' a log table if logging is enabled
+set global general_log='OFF';
+alter table mysql.slow_log engine=myisam;
+ERROR HY000: You cannot 'ALTER' a log table if logging is enabled
+set global slow_query_log='OFF';
+show create table mysql.general_log;
+Table Create Table
+general_log CREATE TABLE `general_log` (
+ `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `user_host` mediumtext,
+ `thread_id` int(11) DEFAULT NULL,
+ `server_id` int(11) DEFAULT NULL,
+ `command_type` varchar(64) DEFAULT NULL,
+ `argument` mediumtext
+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
+show create table mysql.slow_log;
+Table Create Table
+slow_log CREATE TABLE `slow_log` (
+ `start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `user_host` mediumtext NOT NULL,
+ `query_time` time NOT NULL,
+ `lock_time` time NOT NULL,
+ `rows_sent` int(11) NOT NULL,
+ `rows_examined` int(11) NOT NULL,
+ `db` varchar(512) DEFAULT NULL,
+ `last_insert_id` int(11) DEFAULT NULL,
+ `insert_id` int(11) DEFAULT NULL,
+ `server_id` int(11) DEFAULT NULL,
+ `sql_text` mediumtext NOT NULL
+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
+alter table mysql.general_log engine=myisam;
+alter table mysql.slow_log engine=myisam;
+Warnings:
+Warning 1366 Incorrect integer value: '' for column 'last_insert_id' at row 0
+Warning 1366 Incorrect integer value: '' for column 'insert_id' at row 0
+show create table mysql.general_log;
+Table Create Table
+general_log CREATE TABLE `general_log` (
+ `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `user_host` mediumtext,
+ `thread_id` int(11) DEFAULT NULL,
+ `server_id` int(11) DEFAULT NULL,
+ `command_type` varchar(64) DEFAULT NULL,
+ `argument` mediumtext
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='General log'
+show create table mysql.slow_log;
+Table Create Table
+slow_log CREATE TABLE `slow_log` (
+ `start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `user_host` mediumtext NOT NULL,
+ `query_time` time NOT NULL,
+ `lock_time` time NOT NULL,
+ `rows_sent` int(11) NOT NULL,
+ `rows_examined` int(11) NOT NULL,
+ `db` varchar(512) DEFAULT NULL,
+ `last_insert_id` int(11) DEFAULT NULL,
+ `insert_id` int(11) DEFAULT NULL,
+ `server_id` int(11) DEFAULT NULL,
+ `sql_text` mediumtext NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Slow log'
+set global general_log='ON';
+set global slow_query_log='ON';
+select * from mysql.general_log;
+event_time user_host thread_id server_id command_type argument
+TIMESTAMP USER_HOST THREAD_ID 1 Query set names utf8
+TIMESTAMP USER_HOST THREAD_ID 1 Query create table bug16905 (s char(15) character set utf8 default 'пусто')
+TIMESTAMP USER_HOST THREAD_ID 1 Query insert into bug16905 values ('новое')
+TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.general_log
+TIMESTAMP USER_HOST THREAD_ID 1 Query drop table bug16905
+TIMESTAMP USER_HOST THREAD_ID 1 Query truncate table mysql.slow_log
+TIMESTAMP USER_HOST THREAD_ID 1 Query set session long_query_time=1
+TIMESTAMP USER_HOST THREAD_ID 1 Query select sleep(2)
+TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.slow_log
+TIMESTAMP USER_HOST THREAD_ID 1 Query alter table mysql.general_log engine=myisam
+TIMESTAMP USER_HOST THREAD_ID 1 Query alter table mysql.slow_log engine=myisam
+TIMESTAMP USER_HOST THREAD_ID 1 Query drop table mysql.general_log
+TIMESTAMP USER_HOST THREAD_ID 1 Query drop table mysql.slow_log
+TIMESTAMP USER_HOST THREAD_ID 1 Query set global general_log='OFF'
+TIMESTAMP USER_HOST THREAD_ID 1 Query set global slow_query_log='ON'
+TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.general_log
+flush logs;
+lock tables mysql.general_log WRITE;
+ERROR HY000: You can't write-lock a log table. Only read access is possible
+lock tables mysql.slow_log WRITE;
+ERROR HY000: You can't write-lock a log table. Only read access is possible
+lock tables mysql.general_log READ;
+ERROR HY000: You can't use usual read lock with log tables. Try READ LOCAL instead
+lock tables mysql.slow_log READ;
+ERROR HY000: You can't use usual read lock with log tables. Try READ LOCAL instead
+lock tables mysql.slow_log READ LOCAL, mysql.general_log READ LOCAL;
+unlock tables;
+set global general_log='OFF';
+set global slow_query_log='OFF';
+alter table mysql.slow_log engine=ndb;
+ERROR HY000: This storage engine cannot be used for log tables"
+alter table mysql.slow_log engine=innodb;
+ERROR HY000: This storage engine cannot be used for log tables"
+alter table mysql.slow_log engine=archive;
+ERROR HY000: This storage engine cannot be used for log tables"
+alter table mysql.slow_log engine=blackhole;
+ERROR HY000: This storage engine cannot be used for log tables"
+drop table mysql.slow_log;
+drop table mysql.general_log;
+drop table mysql.general_log;
+ERROR 42S02: Unknown table 'general_log'
+drop table mysql.slow_log;
+ERROR 42S02: Unknown table 'slow_log'
+use mysql;
+CREATE TABLE `general_log` (
+`event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+ON UPDATE CURRENT_TIMESTAMP,
+`user_host` mediumtext,
+`thread_id` int(11) DEFAULT NULL,
+`server_id` int(11) DEFAULT NULL,
+`command_type` varchar(64) DEFAULT NULL,
+`argument` mediumtext
+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log';
+CREATE TABLE `slow_log` (
+`start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+ON UPDATE CURRENT_TIMESTAMP,
+`user_host` mediumtext NOT NULL,
+`query_time` time NOT NULL,
+`lock_time` time NOT NULL,
+`rows_sent` int(11) NOT NULL,
+`rows_examined` int(11) NOT NULL,
+`db` varchar(512) DEFAULT NULL,
+`last_insert_id` int(11) DEFAULT NULL,
+`insert_id` int(11) DEFAULT NULL,
+`server_id` int(11) DEFAULT NULL,
+`sql_text` mediumtext NOT NULL
+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
+set global general_log='ON';
+set global slow_query_log='ON';
+use test;
+flush tables with read lock;
+unlock tables;
+use mysql;
+lock tables general_log read local, help_category read local;
+unlock tables;
+use mysql;
+RENAME TABLE general_log TO renamed_general_log;
+ERROR HY000: Cannot rename 'general_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'general_log'
+RENAME TABLE slow_log TO renamed_slow_log;
+ERROR HY000: Cannot rename 'slow_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'slow_log'
+truncate table general_log;
+select * from general_log;
+event_time user_host thread_id server_id command_type argument
+TIMESTAMP USER_HOST THREAD_ID 1 Query select * from general_log
+truncate table slow_log;
+select * from slow_log;
+start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text
+create table general_log_new like general_log;
+rename table general_log TO renamed_general_log, general_log_new TO general_log;
+create table slow_log_new like slow_log;
+rename table slow_log TO renamed_slow_log, slow_log_new TO slow_log;
+rename table general_log TO general_log_new, renamed_general_log TO general_log, slow_log to renamed_slow_log;
+ERROR HY000: Cannot rename 'slow_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'slow_log'
+select * from general_log;
+event_time user_host thread_id server_id command_type argument
+TIMESTAMP USER_HOST THREAD_ID 1 Query create table slow_log_new like slow_log
+TIMESTAMP USER_HOST THREAD_ID 1 Query rename table slow_log TO renamed_slow_log, slow_log_new TO slow_log
+TIMESTAMP USER_HOST THREAD_ID 1 Query rename table general_log TO general_log_new, renamed_general_log TO general_log, slow_log to renamed_slow_log
+TIMESTAMP USER_HOST THREAD_ID 1 Query select * from general_log
+select * from renamed_general_log;
+event_time user_host thread_id server_id command_type argument
+TIMESTAMP USER_HOST THREAD_ID 1 Query select * from general_log
+TIMESTAMP USER_HOST THREAD_ID 1 Query truncate table slow_log
+TIMESTAMP USER_HOST THREAD_ID 1 Query select * from slow_log
+TIMESTAMP USER_HOST THREAD_ID 1 Query create table general_log_new like general_log
+TIMESTAMP USER_HOST THREAD_ID 1 Query rename table general_log TO renamed_general_log, general_log_new TO general_log
+select * from slow_log;
+start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text
+select * from renamed_slow_log;
+start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text
+set global general_log='OFF';
+RENAME TABLE general_log TO general_log2;
+set global slow_query_log='OFF';
+RENAME TABLE slow_log TO slow_log2;
+set global general_log='ON';
+ERROR HY000: Cannot activate 'general' log
+set global slow_query_log='ON';
+ERROR HY000: Cannot activate 'slow query' log
+RENAME TABLE general_log2 TO general_log;
+RENAME TABLE slow_log2 TO slow_log;
+set global general_log='ON';
+set global slow_query_log='ON';
+flush logs;
+flush logs;
+drop table renamed_general_log, renamed_slow_log;
+use test;
+use mysql;
+repair table general_log;
+Table Op Msg_type Msg_text
+mysql.general_log repair status OK
+repair table slow_log;
+Table Op Msg_type Msg_text
+mysql.slow_log repair status OK
+create table general_log_new like general_log;
+create table slow_log_new like slow_log;
+show tables like "%log%";
+Tables_in_mysql (%log%)
+general_log
+general_log_new
+slow_log
+slow_log_new
+drop table slow_log_new, general_log_new;
+use test;
diff --git a/mysql-test/r/lowercase_table2.result b/mysql-test/r/lowercase_table2.result
index e369fb7e482..51c2ac0faf5 100644
--- a/mysql-test/r/lowercase_table2.result
+++ b/mysql-test/r/lowercase_table2.result
@@ -13,7 +13,7 @@ T1
SHOW CREATE TABLE T1;
Table Create Table
T1 CREATE TABLE `T1` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
RENAME TABLE T1 TO T2;
SHOW TABLES LIKE "T2";
@@ -68,7 +68,7 @@ T1
SHOW CREATE TABLE T1;
Table Create Table
T1 CREATE TABLE `T1` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
RENAME TABLE T1 TO T2;
SHOW TABLES LIKE "T2";
diff --git a/mysql-test/r/lowercase_table_grant.result b/mysql-test/r/lowercase_table_grant.result
index c3813d57074..afb54f8c472 100644
--- a/mysql-test/r/lowercase_table_grant.result
+++ b/mysql-test/r/lowercase_table_grant.result
@@ -6,8 +6,8 @@ Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
select * from db where user = 'mysqltest_1';
-Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv
-localhost mysqltest mysqltest_1 Y Y Y Y Y Y N Y Y Y Y Y Y Y Y Y Y
+Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv Event_priv Trigger_priv
+localhost mysqltest mysqltest_1 Y Y Y Y Y Y N Y Y Y Y Y Y Y Y Y Y Y Y
update db set db = 'MYSQLtest' where db = 'mysqltest' and user = 'mysqltest_1' and host = 'localhost';
flush privileges;
show grants for mysqltest_1@localhost;
@@ -15,8 +15,8 @@ Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
select * from db where user = 'mysqltest_1';
-Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv
-localhost MYSQLtest mysqltest_1 Y Y Y Y Y Y N Y Y Y Y Y Y Y Y Y Y
+Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv Event_priv Trigger_priv
+localhost MYSQLtest mysqltest_1 Y Y Y Y Y Y N Y Y Y Y Y Y Y Y Y Y Y Y
delete from db where db = 'MYSQLtest' and user = 'mysqltest_1' and host = 'localhost';
flush privileges;
drop user mysqltest_1@localhost;
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index af8a2d61505..277891788d1 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -173,7 +173,7 @@ show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` int(11) NOT NULL,
- `b` char(20) default NULL,
+ `b` char(20) DEFAULT NULL,
KEY `a` (`a`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`)
create table t4 (a int not null, b char(10), key(a)) engine=MERGE UNION=(t1,t2);
@@ -181,6 +181,9 @@ select * from t4;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
alter table t4 add column c int;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+flush tables;
+select * from t4;
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
create database mysqltest;
create table mysqltest.t6 (a int not null primary key auto_increment, message char(20));
create table t5 (a int not null, b char(20), key(a)) engine=MERGE UNION=(test.t1,mysqltest.t6);
@@ -188,7 +191,7 @@ show create table t5;
Table Create Table
t5 CREATE TABLE `t5` (
`a` int(11) NOT NULL,
- `b` char(20) default NULL,
+ `b` char(20) DEFAULT NULL,
KEY `a` (`a`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`mysqltest`.`t6`)
alter table t5 engine=myisam;
@@ -262,7 +265,7 @@ Table Create Table
t3 CREATE TABLE `t3` (
`incr` int(11) NOT NULL,
`othr` int(11) NOT NULL,
- PRIMARY KEY (`incr`)
+ PRIMARY KEY (`incr`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`)
alter table t3 drop primary key;
show create table t3;
@@ -274,7 +277,7 @@ t3 CREATE TABLE `t3` (
drop table t3,t2,t1;
create table t1 (a int not null, key(a)) engine=merge;
select * from t1;
-a
+ERROR HY000: Got error 124 from storage engine
drop table t1;
create table t1 (a int not null, b int not null, key(a,b));
create table t2 (a int not null, b int not null, key(a,b));
@@ -311,15 +314,15 @@ show create table t5;
Table Create Table
t5 CREATE TABLE `t5` (
`a` int(11) NOT NULL,
- `b` int(11) NOT NULL auto_increment,
- PRIMARY KEY (`a`,`b`)
+ `b` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`a`,`b`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`,`t2`)
show create table t6;
Table Create Table
t6 CREATE TABLE `t6` (
`a` int(11) NOT NULL,
- `b` int(11) NOT NULL auto_increment,
- PRIMARY KEY (`a`,`b`)
+ `b` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`a`,`b`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
insert into t1 values (1,NULL),(1,NULL),(1,NULL),(1,NULL);
insert into t2 values (2,NULL),(2,NULL),(2,NULL),(2,NULL);
@@ -545,9 +548,9 @@ select * from t4 where a+0 > 90;
a b
99 1
insert t5 values (1,1);
-ERROR 23000: Duplicate entry '1-1' for key 1
+ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY'
insert t6 values (2,1);
-ERROR 23000: Duplicate entry '2-1' for key 1
+ERROR 23000: Duplicate entry '2-1' for key 'PRIMARY'
insert t5 values (1,1) on duplicate key update b=b+10;
insert t6 values (2,1) on duplicate key update b=b+20;
select * from t5 where a < 3;
diff --git a/mysql-test/r/mix2_myisam.result b/mysql-test/r/mix2_myisam.result
new file mode 100644
index 00000000000..45b4784251a
--- /dev/null
+++ b/mysql-test/r/mix2_myisam.result
@@ -0,0 +1,2475 @@
+SET SESSION STORAGE_ENGINE = MEMORY;
+drop table if exists t1,t2,t3,t4;
+drop database if exists mysqltest;
+create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=MyISAM;
+insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
+select id, code, name from t1 order by id;
+id code name
+1 1 Tim
+2 1 Monty
+3 2 David
+4 2 Erik
+5 3 Sasha
+6 3 Jeremy
+7 4 Matt
+update ignore t1 set id = 8, name = 'Sinisa' where id < 3;
+select id, code, name from t1 order by id;
+id code name
+2 1 Monty
+3 2 David
+4 2 Erik
+5 3 Sasha
+6 3 Jeremy
+7 4 Matt
+8 1 Sinisa
+update ignore t1 set id = id + 10, name = 'Ralph' where id < 4;
+select id, code, name from t1 order by id;
+id code name
+3 2 David
+4 2 Erik
+5 3 Sasha
+6 3 Jeremy
+7 4 Matt
+8 1 Sinisa
+12 1 Ralph
+drop table t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL auto_increment,
+parent_id int(11) DEFAULT '0' NOT NULL,
+level tinyint(4) DEFAULT '0' NOT NULL,
+PRIMARY KEY (id),
+KEY parent_id (parent_id),
+KEY level (level)
+) engine=MyISAM;
+INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
+update t1 set parent_id=parent_id+100;
+select * from t1 where parent_id=102;
+id parent_id level
+8 102 2
+9 102 2
+15 102 2
+update t1 set id=id+1000;
+update t1 set id=1024 where id=1009;
+Got one of the listed errors
+select * from t1;
+id parent_id level
+1001 100 0
+1003 101 1
+1004 101 1
+1008 102 2
+1009 102 2
+1017 103 2
+1022 104 2
+1024 104 2
+1028 105 2
+1029 105 2
+1030 105 2
+1031 106 2
+1032 106 2
+1033 106 2
+1203 107 2
+1202 107 2
+1020 103 2
+1157 100 0
+1193 105 2
+1040 107 2
+1002 101 1
+1015 102 2
+1006 101 1
+1034 106 2
+1035 106 2
+1016 103 2
+1007 101 1
+1036 107 2
+1018 103 2
+1026 105 2
+1027 105 2
+1183 104 2
+1038 107 2
+1025 105 2
+1037 107 2
+1021 104 2
+1019 103 2
+1005 101 1
+1179 105 2
+update ignore t1 set id=id+1;
+select * from t1;
+id parent_id level
+1001 100 0
+1003 101 1
+1004 101 1
+1008 102 2
+1010 102 2
+1017 103 2
+1023 104 2
+1024 104 2
+1028 105 2
+1029 105 2
+1030 105 2
+1031 106 2
+1032 106 2
+1033 106 2
+1204 107 2
+1203 107 2
+1020 103 2
+1158 100 0
+1194 105 2
+1041 107 2
+1002 101 1
+1015 102 2
+1006 101 1
+1034 106 2
+1035 106 2
+1016 103 2
+1007 101 1
+1036 107 2
+1018 103 2
+1026 105 2
+1027 105 2
+1184 104 2
+1039 107 2
+1025 105 2
+1038 107 2
+1022 104 2
+1019 103 2
+1005 101 1
+1180 105 2
+update ignore t1 set id=1023 where id=1010;
+select * from t1 where parent_id=102;
+id parent_id level
+1008 102 2
+1010 102 2
+1015 102 2
+explain select level from t1 where level=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const # Using index
+explain select level,id from t1 where level=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const #
+explain select level,id,parent_id from t1 where level=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const #
+select level,id from t1 where level=1;
+level id
+1 1003
+1 1004
+1 1002
+1 1006
+1 1007
+1 1005
+select level,id,parent_id from t1 where level=1;
+level id parent_id
+1 1003 101
+1 1004 101
+1 1002 101
+1 1006 101
+1 1007 101
+1 1005 101
+optimize table t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 id A # NULL NULL BTREE
+t1 1 parent_id 1 parent_id A # NULL NULL BTREE
+t1 1 level 1 level A # NULL NULL BTREE
+drop table t1;
+CREATE TABLE t1 (
+gesuchnr int(11) DEFAULT '0' NOT NULL,
+benutzer_id int(11) DEFAULT '0' NOT NULL,
+PRIMARY KEY (gesuchnr,benutzer_id)
+) engine=MyISAM;
+replace into t1 (gesuchnr,benutzer_id) values (2,1);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+select * from t1;
+gesuchnr benutzer_id
+1 1
+2 1
+drop table t1;
+create table t1 (a int) engine=MyISAM;
+insert into t1 values (1), (2);
+optimize table t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+delete from t1 where a = 1;
+select * from t1;
+a
+2
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
+create table t1 (a int,b varchar(20)) engine=MyISAM;
+insert into t1 values (1,""), (2,"testing");
+delete from t1 where a = 1;
+select * from t1;
+a b
+2 testing
+create index skr on t1 (a);
+insert into t1 values (3,""), (4,"testing");
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 skr 1 a A # NULL NULL YES BTREE
+drop table t1;
+create table t1 (a int,b varchar(20),key(a)) engine=MyISAM;
+insert into t1 values (1,""), (2,"testing");
+select * from t1 where a = 1;
+a b
+1
+drop table t1;
+CREATE TABLE t1 (
+user_id int(10) DEFAULT '0' NOT NULL,
+name varchar(100),
+phone varchar(100),
+ref_email varchar(100) DEFAULT '' NOT NULL,
+detail varchar(200),
+PRIMARY KEY (user_id,ref_email)
+)engine=MyISAM;
+INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar');
+select * from t1 where user_id=10292;
+user_id name phone ref_email detail
+10292 sanjeev 29153373 sansh777@hotmail.com xxx
+10292 shirish 2333604 shirish@yahoo.com ddsds
+10292 sonali 323232 sonali@bolly.com filmstar
+INSERT INTO t1 VALUES (10291,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10293,'shirish','2333604','shirish@yahoo.com','ddsds');
+select * from t1 where user_id=10292;
+user_id name phone ref_email detail
+10292 sanjeev 29153373 sansh777@hotmail.com xxx
+10292 shirish 2333604 shirish@yahoo.com ddsds
+10292 sonali 323232 sonali@bolly.com filmstar
+select * from t1 where user_id>=10292;
+user_id name phone ref_email detail
+10292 sanjeev 29153373 sansh777@hotmail.com xxx
+10292 shirish 2333604 shirish@yahoo.com ddsds
+10292 sonali 323232 sonali@bolly.com filmstar
+10293 shirish 2333604 shirish@yahoo.com ddsds
+select * from t1 where user_id>10292;
+user_id name phone ref_email detail
+10293 shirish 2333604 shirish@yahoo.com ddsds
+select * from t1 where user_id<10292;
+user_id name phone ref_email detail
+10291 sanjeev 29153373 sansh777@hotmail.com xxx
+drop table t1;
+CREATE TABLE t1 (a int not null, b int not null,c int not null,
+key(a),primary key(a,b), unique(c),key(a),unique(b)) ENGINE = MyISAM;
+show index from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 a A # NULL NULL BTREE
+t1 0 PRIMARY 2 b A # NULL NULL BTREE
+t1 0 c 1 c A # NULL NULL BTREE
+t1 0 b 1 b A # NULL NULL BTREE
+t1 1 a 1 a A # NULL NULL BTREE
+t1 1 a_2 1 a A # NULL NULL BTREE
+drop table t1;
+create table t1 (col1 int not null, col2 char(4) not null, primary key(col1)) ENGINE = MEMORY;
+alter table t1 engine=MyISAM;
+insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4');
+select * from t1;
+col1 col2
+1 1
+5 2
+2 3
+3 4
+4 4
+update t1 set col2='7' where col1='4';
+select * from t1;
+col1 col2
+1 1
+5 2
+2 3
+3 4
+4 7
+alter table t1 add co3 int not null;
+select * from t1;
+col1 col2 co3
+1 1 0
+5 2 0
+2 3 0
+3 4 0
+4 7 0
+update t1 set col2='9' where col1='2';
+select * from t1;
+col1 col2 co3
+1 1 0
+5 2 0
+2 9 0
+3 4 0
+4 7 0
+drop table t1;
+create table t1 (a int not null , b int, primary key (a)) engine = MyISAM;
+create table t2 (a int not null , b int, primary key (a)) engine = MEMORY;
+insert into t1 VALUES (1,3) , (2,3), (3,3);
+select * from t1;
+a b
+1 3
+2 3
+3 3
+insert into t2 select * from t1;
+select * from t2;
+a b
+1 3
+2 3
+3 3
+delete from t1 where b = 3;
+select * from t1;
+a b
+insert into t1 select * from t2;
+select * from t1;
+a b
+3 3
+2 3
+1 3
+select * from t2;
+a b
+1 3
+2 3
+3 3
+drop table t1,t2;
+CREATE TABLE t1 (
+id int(11) NOT NULL auto_increment,
+ggid varchar(32) binary DEFAULT '' NOT NULL,
+email varchar(64) DEFAULT '' NOT NULL,
+passwd varchar(32) binary DEFAULT '' NOT NULL,
+PRIMARY KEY (id),
+UNIQUE ggid (ggid)
+) ENGINE=MyISAM;
+insert into t1 (ggid,passwd) values ('test1','xxx');
+insert into t1 (ggid,passwd) values ('test2','yyy');
+insert into t1 (ggid,passwd) values ('test2','this will fail');
+ERROR 23000: Duplicate entry 'test2' for key 'ggid'
+insert into t1 (ggid,id) values ('this will fail',1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+select * from t1 where ggid='test1';
+id ggid email passwd
+1 test1 xxx
+select * from t1 where passwd='xxx';
+id ggid email passwd
+1 test1 xxx
+select * from t1 where id=2;
+id ggid email passwd
+2 test2 yyy
+replace into t1 (ggid,id) values ('this will work',1);
+replace into t1 (ggid,passwd) values ('test2','this will work');
+update t1 set id=100,ggid='test2' where id=1;
+ERROR 23000: Duplicate entry 'test2' for key 'ggid'
+select * from t1;
+id ggid email passwd
+1 this will work
+3 test2 this will work
+select * from t1 where id=1;
+id ggid email passwd
+1 this will work
+select * from t1 where id=999;
+id ggid email passwd
+drop table t1;
+CREATE TABLE t1 (
+user_name varchar(12),
+password text,
+subscribed char(1),
+user_id int(11) DEFAULT '0' NOT NULL,
+quota bigint(20),
+weight double,
+access_date date,
+access_time time,
+approved datetime,
+dummy_primary_key int(11) NOT NULL auto_increment,
+PRIMARY KEY (dummy_primary_key)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1);
+INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2);
+INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3);
+INSERT INTO t1 VALUES ('user_3','somepassword','Y',3,3,1.7320508075689,'2000-09-07','23:06:59','2000-09-07 23:06:59',4);
+INSERT INTO t1 VALUES ('user_4','somepassword','N',4,4,2,'2000-09-07','23:06:59','2000-09-07 23:06:59',5);
+select user_name, password , subscribed, user_id, quota, weight, access_date, access_time, approved, dummy_primary_key from t1 order by user_name;
+user_name password subscribed user_id quota weight access_date access_time approved dummy_primary_key
+user_0 somepassword N 0 0 0 2000-09-07 23:06:59 2000-09-07 23:06:59 1
+user_1 somepassword Y 1 1 1 2000-09-07 23:06:59 2000-09-07 23:06:59 2
+user_2 somepassword N 2 2 1.4142135623731 2000-09-07 23:06:59 2000-09-07 23:06:59 3
+user_3 somepassword Y 3 3 1.7320508075689 2000-09-07 23:06:59 2000-09-07 23:06:59 4
+user_4 somepassword N 4 4 2 2000-09-07 23:06:59 2000-09-07 23:06:59 5
+drop table t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL auto_increment,
+parent_id int(11) DEFAULT '0' NOT NULL,
+level tinyint(4) DEFAULT '0' NOT NULL,
+KEY (id),
+KEY parent_id (parent_id),
+KEY level (level)
+) engine=MyISAM;
+INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1);
+INSERT INTO t1 values (179,5,2);
+update t1 set parent_id=parent_id+100;
+select * from t1 where parent_id=102;
+id parent_id level
+8 102 2
+9 102 2
+15 102 2
+update t1 set id=id+1000;
+update t1 set id=1024 where id=1009;
+select * from t1;
+id parent_id level
+1001 100 0
+1003 101 1
+1004 101 1
+1008 102 2
+1024 102 2
+1017 103 2
+1022 104 2
+1024 104 2
+1028 105 2
+1029 105 2
+1030 105 2
+1031 106 2
+1032 106 2
+1033 106 2
+1203 107 2
+1202 107 2
+1020 103 2
+1157 100 0
+1193 105 2
+1040 107 2
+1002 101 1
+1015 102 2
+1006 101 1
+1034 106 2
+1035 106 2
+1016 103 2
+1007 101 1
+1036 107 2
+1018 103 2
+1026 105 2
+1027 105 2
+1183 104 2
+1038 107 2
+1025 105 2
+1037 107 2
+1021 104 2
+1019 103 2
+1005 101 1
+1179 105 2
+update ignore t1 set id=id+1;
+select * from t1;
+id parent_id level
+1002 100 0
+1004 101 1
+1005 101 1
+1009 102 2
+1025 102 2
+1018 103 2
+1023 104 2
+1025 104 2
+1029 105 2
+1030 105 2
+1031 105 2
+1032 106 2
+1033 106 2
+1034 106 2
+1204 107 2
+1203 107 2
+1021 103 2
+1158 100 0
+1194 105 2
+1041 107 2
+1003 101 1
+1016 102 2
+1007 101 1
+1035 106 2
+1036 106 2
+1017 103 2
+1008 101 1
+1037 107 2
+1019 103 2
+1027 105 2
+1028 105 2
+1184 104 2
+1039 107 2
+1026 105 2
+1038 107 2
+1022 104 2
+1020 103 2
+1006 101 1
+1180 105 2
+update ignore t1 set id=1023 where id=1010;
+select * from t1 where parent_id=102;
+id parent_id level
+1009 102 2
+1025 102 2
+1016 102 2
+explain select level from t1 where level=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const # Using index
+select level,id from t1 where level=1;
+level id
+1 1004
+1 1005
+1 1003
+1 1007
+1 1008
+1 1006
+select level,id,parent_id from t1 where level=1;
+level id parent_id
+1 1004 101
+1 1005 101
+1 1003 101
+1 1007 101
+1 1008 101
+1 1006 101
+select level,id from t1 where level=1 order by id;
+level id
+1 1003
+1 1004
+1 1005
+1 1006
+1 1007
+1 1008
+delete from t1 where level=1;
+select * from t1;
+id parent_id level
+1002 100 0
+1009 102 2
+1025 102 2
+1018 103 2
+1023 104 2
+1025 104 2
+1029 105 2
+1030 105 2
+1031 105 2
+1032 106 2
+1033 106 2
+1034 106 2
+1204 107 2
+1203 107 2
+1021 103 2
+1158 100 0
+1194 105 2
+1041 107 2
+1016 102 2
+1035 106 2
+1036 106 2
+1017 103 2
+1037 107 2
+1019 103 2
+1027 105 2
+1028 105 2
+1184 104 2
+1039 107 2
+1026 105 2
+1038 107 2
+1022 104 2
+1020 103 2
+1180 105 2
+drop table t1;
+CREATE TABLE t1 (
+sca_code char(6) NOT NULL,
+cat_code char(6) NOT NULL,
+sca_desc varchar(50),
+lan_code char(2) NOT NULL,
+sca_pic varchar(100),
+sca_sdesc varchar(50),
+sca_sch_desc varchar(16),
+PRIMARY KEY (sca_code, cat_code, lan_code),
+INDEX sca_pic (sca_pic)
+) engine = MyISAM ;
+INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
+select count(*) from t1 where sca_code = 'PD';
+count(*)
+1
+select count(*) from t1 where sca_code <= 'PD';
+count(*)
+1
+select count(*) from t1 where sca_pic is null;
+count(*)
+2
+alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
+select count(*) from t1 where sca_code='PD' and sca_pic is null;
+count(*)
+1
+select count(*) from t1 where cat_code='E';
+count(*)
+0
+alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
+select count(*) from t1 where sca_code='PD' and sca_pic is null;
+count(*)
+1
+select count(*) from t1 where sca_pic >= 'n';
+count(*)
+1
+select sca_pic from t1 where sca_pic is null;
+sca_pic
+NULL
+NULL
+update t1 set sca_pic="test" where sca_pic is null;
+delete from t1 where sca_code='pd';
+drop table t1;
+set @a:=now();
+CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=MyISAM;
+insert into t1 (a) values(1),(2),(3);
+select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
+a
+1
+2
+3
+select a from t1 natural join t1 as t2 where b >= @a order by a;
+a
+1
+2
+3
+update t1 set a=5 where a=1;
+select a from t1;
+a
+2
+3
+5
+drop table t1;
+create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=MyISAM;
+insert into t1 values("hello",1),("world",2);
+select * from t1 order by b desc;
+a b
+world 2
+hello 1
+optimize table t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 a A # NULL NULL BTREE
+drop table t1;
+create table t1 (i int, j int ) ENGINE=MyISAM;
+insert into t1 values (1,2);
+select * from t1 where i=1 and j=2;
+i j
+1 2
+create index ax1 on t1 (i,j);
+select * from t1 where i=1 and j=2;
+i j
+1 2
+drop table t1;
+CREATE TABLE t1 (
+a int3 unsigned NOT NULL,
+b int1 unsigned NOT NULL,
+UNIQUE (a, b)
+) ENGINE = MyISAM;
+INSERT INTO t1 VALUES (1, 1);
+SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
+MIN(B) MAX(b)
+1 1
+drop table t1;
+CREATE TABLE t1 (a int unsigned NOT NULL) engine=MyISAM;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1;
+a
+1
+DROP TABLE t1;
+create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) engine = MyISAM;
+insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
+explain select * from t1 where a > 0 and a < 50;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system PRIMARY NULL NULL NULL #
+drop table t1;
+create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=MyISAM;
+insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
+LOCK TABLES t1 WRITE;
+insert into t1 values (99,1,2,'D'),(1,1,2,'D');
+ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY'
+select id from t1;
+id
+0
+1
+2
+99
+select id from t1;
+id
+0
+1
+2
+99
+UNLOCK TABLES;
+DROP TABLE t1;
+create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=MyISAM;
+insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
+LOCK TABLES t1 WRITE;
+begin;
+insert into t1 values (99,1,2,'D'),(1,1,2,'D');
+ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY'
+select id from t1;
+id
+0
+1
+2
+99
+insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
+commit;
+select id,id3 from t1;
+id id3
+0 0
+2 2
+1 1
+99 2
+100 2
+UNLOCK TABLES;
+DROP TABLE t1;
+create table t1 (a char(20), unique (a(5))) engine=MyISAM;
+drop table t1;
+create table t1 (a char(20), index (a(5))) engine=MyISAM;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(20) DEFAULT NULL,
+ KEY `a` (`a`(5))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create temporary table t1 (a int not null auto_increment, primary key(a)) engine=MyISAM;
+insert into t1 values (NULL),(NULL),(NULL);
+delete from t1 where a=3;
+insert into t1 values (NULL);
+select * from t1;
+a
+1
+2
+4
+alter table t1 add b int;
+select * from t1;
+a b
+1 NULL
+2 NULL
+4 NULL
+drop table t1;
+create table t1
+(
+id int auto_increment primary key,
+name varchar(32) not null,
+value text not null,
+uid int not null,
+unique key(name,uid)
+) engine=MyISAM;
+insert into t1 values (1,'one','one value',101),
+(2,'two','two value',102),(3,'three','three value',103);
+set insert_id=5;
+replace into t1 (value,name,uid) values ('other value','two',102);
+delete from t1 where uid=102;
+set insert_id=5;
+replace into t1 (value,name,uid) values ('other value','two',102);
+set insert_id=6;
+replace into t1 (value,name,uid) values ('other value','two',102);
+select * from t1;
+id name value uid
+1 one one value 101
+3 three three value 103
+6 two other value 102
+drop table t1;
+create database mysqltest;
+create table mysqltest.t1 (a int not null) engine= MyISAM;
+insert into mysqltest.t1 values(1);
+create table mysqltest.t2 (a int not null) engine= MEMORY;
+insert into mysqltest.t2 values(1);
+create table mysqltest.t3 (a int not null) engine= MEMORY;
+insert into mysqltest.t3 values(1);
+commit;
+drop database mysqltest;
+show tables from mysqltest;
+ERROR 42000: Unknown database 'mysqltest'
+set autocommit=0;
+create table t1 (a int not null) engine= MyISAM;
+insert into t1 values(1),(2);
+truncate table t1;
+commit;
+truncate table t1;
+truncate table t1;
+select * from t1;
+a
+insert into t1 values(1),(2);
+delete from t1;
+select * from t1;
+a
+commit;
+drop table t1;
+set autocommit=1;
+create table t1 (a int not null) engine= MyISAM;
+insert into t1 values(1),(2);
+truncate table t1;
+insert into t1 values(1),(2);
+select * from t1;
+a
+1
+2
+truncate table t1;
+insert into t1 values(1),(2);
+delete from t1;
+select * from t1;
+a
+drop table t1;
+create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=MyISAM;
+insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
+explain select * from t1 order by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort
+explain select * from t1 order by b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort
+explain select * from t1 order by c;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort
+explain select a from t1 order by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL # Using index
+explain select b from t1 order by b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL # Using index
+explain select a,b from t1 order by b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort
+explain select a,b from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL #
+explain select a,b,c from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL #
+drop table t1;
+create table t1 (t int not null default 1, key (t)) engine=MyISAM;
+desc t1;
+Field Type Null Key Default Extra
+t int(11) NO MUL 1
+drop table t1;
+CREATE TABLE t1 (
+number bigint(20) NOT NULL default '0',
+cname char(15) NOT NULL default '',
+carrier_id smallint(6) NOT NULL default '0',
+privacy tinyint(4) NOT NULL default '0',
+last_mod_date timestamp NOT NULL,
+last_mod_id smallint(6) NOT NULL default '0',
+last_app_date timestamp NOT NULL,
+last_app_id smallint(6) default '-1',
+version smallint(6) NOT NULL default '0',
+assigned_scps int(11) default '0',
+status tinyint(4) default '0'
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4077711111,'SeanWheeler',90,2,20020111112846,500,00000000000000,-1,2,3,1);
+INSERT INTO t1 VALUES (9197722223,'berry',90,3,20020111112809,500,20020102114532,501,4,10,0);
+INSERT INTO t1 VALUES (650,'San Francisco',0,0,20011227111336,342,00000000000000,-1,1,24,1);
+INSERT INTO t1 VALUES (302467,'Sue\'s Subshop',90,3,20020109113241,500,20020102115111,501,7,24,0);
+INSERT INTO t1 VALUES (6014911113,'SudzCarwash',520,1,20020102115234,500,20020102115259,501,33,32768,0);
+INSERT INTO t1 VALUES (333,'tubs',99,2,20020109113440,501,20020109113440,500,3,10,0);
+CREATE TABLE t2 (
+number bigint(20) NOT NULL default '0',
+cname char(15) NOT NULL default '',
+carrier_id smallint(6) NOT NULL default '0',
+privacy tinyint(4) NOT NULL default '0',
+last_mod_date timestamp NOT NULL,
+last_mod_id smallint(6) NOT NULL default '0',
+last_app_date timestamp NOT NULL,
+last_app_id smallint(6) default '-1',
+version smallint(6) NOT NULL default '0',
+assigned_scps int(11) default '0',
+status tinyint(4) default '0'
+) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (4077711111,'SeanWheeler',0,2,20020111112853,500,00000000000000,-1,2,3,1);
+INSERT INTO t2 VALUES (9197722223,'berry',90,3,20020111112818,500,20020102114532,501,4,10,0);
+INSERT INTO t2 VALUES (650,'San Francisco',90,0,20020109113158,342,00000000000000,-1,1,24,1);
+INSERT INTO t2 VALUES (333,'tubs',99,2,20020109113453,501,20020109113453,500,3,10,0);
+select * from t1;
+number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
+4077711111 SeanWheeler 90 2 2002-01-11 11:28:46 500 0000-00-00 00:00:00 -1 2 3 1
+9197722223 berry 90 3 2002-01-11 11:28:09 500 2002-01-02 11:45:32 501 4 10 0
+650 San Francisco 0 0 2001-12-27 11:13:36 342 0000-00-00 00:00:00 -1 1 24 1
+302467 Sue's Subshop 90 3 2002-01-09 11:32:41 500 2002-01-02 11:51:11 501 7 24 0
+6014911113 SudzCarwash 520 1 2002-01-02 11:52:34 500 2002-01-02 11:52:59 501 33 32768 0
+333 tubs 99 2 2002-01-09 11:34:40 501 2002-01-09 11:34:40 500 3 10 0
+select * from t2;
+number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
+4077711111 SeanWheeler 0 2 2002-01-11 11:28:53 500 0000-00-00 00:00:00 -1 2 3 1
+9197722223 berry 90 3 2002-01-11 11:28:18 500 2002-01-02 11:45:32 501 4 10 0
+650 San Francisco 90 0 2002-01-09 11:31:58 342 0000-00-00 00:00:00 -1 1 24 1
+333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
+delete t1, t2 from t1 left join t2 on t1.number=t2.number where (t1.carrier_id=90 and t1.number=t2.number) or (t2.carrier_id=90 and t1.number=t2.number) or (t1.carrier_id=90 and t2.number is null);
+select * from t1;
+number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
+6014911113 SudzCarwash 520 1 2002-01-02 11:52:34 500 2002-01-02 11:52:59 501 33 32768 0
+333 tubs 99 2 2002-01-09 11:34:40 501 2002-01-09 11:34:40 500 3 10 0
+select * from t2;
+number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
+333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
+select * from t2;
+number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
+333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
+drop table t1,t2;
+create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=MyISAM;
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+SELECT @@tx_isolation,@@global.tx_isolation;
+@@tx_isolation @@global.tx_isolation
+SERIALIZABLE REPEATABLE-READ
+insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David');
+select id, code, name from t1 order by id;
+id code name
+1 1 Tim
+2 1 Monty
+3 2 David
+COMMIT;
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+insert into t1 (code, name) values (2, 'Erik'), (3, 'Sasha');
+select id, code, name from t1 order by id;
+id code name
+1 1 Tim
+2 1 Monty
+3 2 David
+4 2 Erik
+5 3 Sasha
+COMMIT;
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt');
+select id, code, name from t1 order by id;
+id code name
+1 1 Tim
+2 1 Monty
+3 2 David
+4 2 Erik
+5 3 Sasha
+6 3 Jeremy
+7 4 Matt
+COMMIT;
+DROP TABLE t1;
+create table t1 (n int(10), d int(10)) engine=MyISAM;
+create table t2 (n int(10), d int(10)) engine=MyISAM;
+insert into t1 values(1,1),(1,2);
+insert into t2 values(1,10),(2,20);
+UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
+select * from t1;
+n d
+1 10
+1 10
+select * from t2;
+n d
+1 30
+2 20
+drop table t1,t2;
+create table t1 (a int, b int) engine=MyISAM;
+insert into t1 values(20,null);
+select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
+t2.b=t3.a;
+b ifnull(t2.b,"this is null")
+NULL this is null
+select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
+t2.b=t3.a order by 1;
+b ifnull(t2.b,"this is null")
+NULL this is null
+insert into t1 values(10,null);
+select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
+t2.b=t3.a order by 1;
+b ifnull(t2.b,"this is null")
+NULL this is null
+NULL this is null
+drop table t1;
+create table t1 (a varchar(10) not null) engine = MEMORY;
+create table t2 (b varchar(10) not null unique) engine=MyISAM;
+select t1.a from t1,t2 where t1.a=t2.b;
+a
+drop table t1,t2;
+create table t1 (a int not null, b int, primary key (a)) engine = MyISAM;
+create table t2 (a int not null, b int, primary key (a)) engine = MyISAM;
+insert into t1 values (10, 20);
+insert into t2 values (10, 20);
+update t1, t2 set t1.b = 150, t2.b = t1.b where t2.a = t1.a and t1.a = 10;
+drop table t1,t2;
+CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) engine=MyISAM;
+INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000;
+SELECT * from t1;
+a b
+1 1
+102 2
+103 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+drop table t1;
+CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=MyISAM;
+CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=MyISAM;
+INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
+INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+update t1,t2 set t1.a=t1.a+100;
+select * from t1;
+a b
+101 1
+102 2
+103 3
+104 4
+105 5
+106 6
+107 7
+108 8
+109 9
+110 10
+111 11
+112 12
+update t1,t2 set t1.a=t1.a+100 where t1.a=101;
+select * from t1;
+a b
+201 1
+102 2
+103 3
+104 4
+105 5
+106 6
+107 7
+108 8
+109 9
+110 10
+111 11
+112 12
+update t1,t2 set t1.b=t1.b+10 where t1.b=2;
+select * from t1;
+a b
+201 1
+102 12
+103 3
+104 4
+105 5
+106 6
+107 7
+108 8
+109 9
+110 10
+111 11
+112 12
+update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100;
+select * from t1;
+a b
+201 1
+102 12
+103 5
+104 6
+105 7
+106 6
+107 7
+108 8
+109 9
+110 10
+111 11
+112 12
+select * from t2;
+a b
+1 1
+2 2
+3 13
+4 14
+5 15
+6 6
+7 7
+8 8
+9 9
+drop table t1,t2;
+CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MEMORY;
+CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=MyISAM;
+SET AUTOCOMMIT=0;
+INSERT INTO t1 ( B_ID ) VALUES ( 1 );
+INSERT INTO t2 ( NEXT_T ) VALUES ( 1 );
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+SELECT * FROM t1;
+B_ID
+1
+drop table t1,t2;
+create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) engine = MyISAM;
+insert into t1 values (1,0,4), (2,1,3), (3,2,1), (4,1,2);
+select distinct parent,child from t1 order by parent;
+parent child
+0 4
+1 2
+1 3
+2 1
+drop table t1;
+create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) engine=MyISAM;
+create table t2 (a int not null auto_increment primary key, b int) ENGINE = MEMORY;
+insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null);
+insert into t2 (a) select b from t1;
+insert into t1 (b) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+select count(*) from t1;
+count(*)
+29267
+explain select * from t1 where c between 1 and 2500;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c c 5 NULL # Using where
+update t1 set c=a;
+explain select * from t1 where c between 1 and 2500;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c c 5 NULL # Using where
+drop table t1,t2;
+create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=MyISAM;
+insert into t1 (id) values (null),(null),(null),(null),(null);
+update t1 set fk=69 where fk is null order by id limit 1;
+SELECT * from t1;
+id fk
+1 69
+2 NULL
+3 NULL
+4 NULL
+5 NULL
+drop table t1;
+create table t1 (a int not null, b int not null, key (a)) engine=MyISAM;
+insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3);
+SET @tmp=0;
+update t1 set b=(@tmp:=@tmp+1) order by a;
+update t1 set b=99 where a=1 order by b asc limit 1;
+update t1 set b=100 where a=1 order by b desc limit 2;
+update t1 set a=a+10+b where a=1 order by b;
+select * from t1 order by a,b;
+a b
+2 4
+2 5
+2 6
+3 7
+3 8
+3 9
+3 10
+3 11
+3 12
+13 2
+111 100
+111 100
+drop table t1;
+create table t1 ( c char(8) not null ) engine=MyISAM;
+insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
+insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
+alter table t1 add b char(8) not null;
+alter table t1 add a char(8) not null;
+alter table t1 add primary key (a,b,c);
+update t1 set a=c, b=c;
+create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=MyISAM;
+insert into t2 select * from t1;
+delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
+drop table t1,t2;
+SET AUTOCOMMIT=1;
+create table t1 (a integer auto_increment primary key) engine=MyISAM;
+insert into t1 (a) values (NULL),(NULL);
+truncate table t1;
+insert into t1 (a) values (NULL),(NULL);
+SELECT * from t1;
+a
+1
+2
+drop table t1;
+CREATE TABLE t1 (col1 int(1))ENGINE=MyISAM;
+CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx
+(stamp))ENGINE=MyISAM;
+insert into t1 values (1),(2),(3);
+insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000);
+Warnings:
+Warning 1265 Data truncated for column 'stamp' at row 3
+SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp <
+'20020204120000' GROUP BY col1;
+col1
+1
+2
+3
+4
+drop table t1,t2;
+CREATE TABLE t1 (
+`id` int(10) unsigned NOT NULL auto_increment,
+`id_object` int(10) unsigned default '0',
+`id_version` int(10) unsigned NOT NULL default '1',
+`label` varchar(100) NOT NULL default '',
+`description` text,
+PRIMARY KEY (`id`),
+KEY `id_object` (`id_object`),
+KEY `id_version` (`id_version`)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES("6", "3382", "9", "Test", NULL), ("7", "102", "5", "Le Pekin (Test)", NULL),("584", "1794", "4", "Test de resto", NULL),("837", "1822", "6", "Test 3", NULL),("1119", "3524", "1", "Societe Test", NULL),("1122", "3525", "1", "Fournisseur Test", NULL);
+CREATE TABLE t2 (
+`id` int(10) unsigned NOT NULL auto_increment,
+`id_version` int(10) unsigned NOT NULL default '1',
+PRIMARY KEY (`id`),
+KEY `id_version` (`id_version`)
+) ENGINE=MyISAM;
+INSERT INTO t2 VALUES("3524", "1"),("3525", "1"),("1794", "4"),("102", "5"),("1822", "6"),("3382", "9");
+SELECT t2.id, t1.`label` FROM t2 INNER JOIN
+(SELECT t1.id_object as id_object FROM t1 WHERE t1.`label` LIKE '%test%') AS lbl
+ON (t2.id = lbl.id_object) INNER JOIN t1 ON (t2.id = t1.id_object);
+id label
+3382 Test
+102 Le Pekin (Test)
+1794 Test de resto
+1822 Test 3
+3524 Societe Test
+3525 Fournisseur Test
+drop table t1,t2;
+create table t1 (a int, b varchar(200), c text not null) checksum=1 engine=MyISAM;
+create table t2 (a int, b varchar(200), c text not null) checksum=0 engine=MyISAM;
+create table t3 (a int, b varchar(200), c varchar(200) not null) checksum=1 engine=MEMORY;
+create table t4 (a int, b varchar(200), c varchar(200) not null) checksum=0 engine=MEMORY;
+create table t5 (a int, b varchar(200), c text not null) checksum=1 engine=MyISAM;
+create table t6 (a int, b varchar(200), c text not null) checksum=0 engine=MyISAM;
+insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
+insert t2 select * from t1;
+insert t3 select * from t1;
+insert t4 select * from t1;
+insert t5 select * from t1;
+insert t6 select * from t1;
+checksum table t1, t2, t3, t4, t5, t6, t7 quick;
+Table Checksum
+test.t1 2948697075
+test.t2 NULL
+test.t3 NULL
+test.t4 NULL
+test.t5 2948697075
+test.t6 NULL
+test.t7 NULL
+Warnings:
+Error 1146 Table 'test.t7' doesn't exist
+checksum table t1, t2, t3, t4, t5, t6, t7;
+Table Checksum
+test.t1 2948697075
+test.t2 2948697075
+test.t3 2948697075
+test.t4 2948697075
+test.t5 2948697075
+test.t6 2948697075
+test.t7 NULL
+Warnings:
+Error 1146 Table 'test.t7' doesn't exist
+checksum table t1, t2, t3, t4, t5, t6, t7 extended;
+Table Checksum
+test.t1 2948697075
+test.t2 2948697075
+test.t3 2948697075
+test.t4 2948697075
+test.t5 2948697075
+test.t6 2948697075
+test.t7 NULL
+Warnings:
+Error 1146 Table 'test.t7' doesn't exist
+drop table t1,t2,t3, t4, t5, t6;
+create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=MyISAM;
+insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
+select trim(name2) from t1 union all select trim(name) from t1 union all select trim(id) from t1;
+trim(name2)
+fff
+sss
+ttt
+first
+second
+third
+1
+2
+3
+drop table t1;
+create table t1 (a int) engine=MyISAM;
+create table t2 like t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1,t2;
+flush status;
+show status like "binlog_cache_use";
+Variable_name Value
+Binlog_cache_use 0
+show status like "binlog_cache_disk_use";
+Variable_name Value
+Binlog_cache_disk_use 0
+create table t1 (a int) engine=MyISAM;
+show status like "binlog_cache_use";
+Variable_name Value
+Binlog_cache_use 0
+show status like "binlog_cache_disk_use";
+Variable_name Value
+Binlog_cache_disk_use 0
+begin;
+delete from t1;
+commit;
+show status like "binlog_cache_use";
+Variable_name Value
+Binlog_cache_use 0
+show status like "binlog_cache_disk_use";
+Variable_name Value
+Binlog_cache_disk_use 0
+drop table t1;
+create table t1 (c char(10), index (c,c)) engine=MyISAM;
+ERROR 42S21: Duplicate column name 'c'
+create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=MyISAM;
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=MyISAM;
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=MyISAM;
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10)) engine=MyISAM;
+alter table t1 add key (c1,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c2,c1,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c1,c2,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c1,c1,c2);
+ERROR 42S21: Duplicate column name 'c1'
+drop table t1;
+create table t1(a int(1) , b int(1)) engine=MyISAM;
+insert into t1 values ('1111', '3333');
+select distinct concat(a, b) from t1;
+concat(a, b)
+11113333
+drop table t1;
+create temporary table t1 (a int) engine=MyISAM;
+insert into t1 values (4711);
+truncate t1;
+insert into t1 values (42);
+select * from t1;
+a
+42
+drop table t1;
+create table t1 (a int) engine=MyISAM;
+insert into t1 values (4711);
+truncate t1;
+insert into t1 values (42);
+select * from t1;
+a
+42
+drop table t1;
+create table t1 (a int not null, b int not null, c blob not null, d int not null, e int, primary key (a,b,c(255),d)) engine=MyISAM;
+insert into t1 values (2,2,"b",2,2),(1,1,"a",1,1),(3,3,"ab",3,3);
+select * from t1 order by a,b,c,d;
+a b c d e
+1 1 a 1 1
+2 2 b 2 2
+3 3 ab 3 3
+explain select * from t1 order by a,b,c,d;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
+drop table t1;
+create table t1 (a char(1), b char(1), key(a, b)) engine=MyISAM;
+insert into t1 values ('8', '6'), ('4', '7');
+select min(a) from t1;
+min(a)
+4
+select min(b) from t1 where a='8';
+min(b)
+6
+drop table t1;
+create table t1 (x bigint unsigned not null primary key) engine=MyISAM;
+insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
+select * from t1;
+x
+18446744073709551600
+18446744073709551601
+select count(*) from t1 where x>0;
+count(*)
+2
+select count(*) from t1 where x=0;
+count(*)
+0
+select count(*) from t1 where x<0;
+count(*)
+0
+select count(*) from t1 where x < -16;
+count(*)
+0
+select count(*) from t1 where x = -16;
+count(*)
+0
+explain select count(*) from t1 where x > -16;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 2 Using where; Using index
+select count(*) from t1 where x > -16;
+count(*)
+2
+select * from t1 where x > -16;
+x
+18446744073709551600
+18446744073709551601
+select count(*) from t1 where x = 18446744073709551601;
+count(*)
+1
+drop table t1;
+set storage_engine=MyISAM;
+drop table if exists t1,t2,t3;
+--- Testing varchar ---
+--- Testing varchar ---
+create table t1 (v varchar(10), c char(10), t text);
+insert into t1 values('+ ', '+ ', '+ ');
+set @a=repeat(' ',20);
+insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
+Warnings:
+Note 1265 Data truncated for column 'v' at row 1
+select concat('*',v,'*',c,'*',t,'*') from t1;
+concat('*',v,'*',c,'*',t,'*')
+*+ *+*+ *
+*+ *+*+ *
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
+ `t` text
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create table t2 like t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
+ `t` text
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create table t3 select * from t1;
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
+ `t` text
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t1 modify c varchar(10);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` varchar(10) DEFAULT NULL,
+ `c` varchar(10) DEFAULT NULL,
+ `t` text
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t1 modify v char(10);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` char(10) DEFAULT NULL,
+ `c` varchar(10) DEFAULT NULL,
+ `t` text
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t1 modify t varchar(10);
+Warnings:
+Note 1265 Data truncated for column 't' at row 2
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` char(10) DEFAULT NULL,
+ `c` varchar(10) DEFAULT NULL,
+ `t` varchar(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select concat('*',v,'*',c,'*',t,'*') from t1;
+concat('*',v,'*',c,'*',t,'*')
+*+*+*+ *
+*+*+*+ *
+drop table t1,t2,t3;
+create table t1 (v varchar(10), c char(10), t text, key(v), key(c), key(t(10)));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
+ `t` text,
+ KEY `v` (`v`),
+ KEY `c` (`c`),
+ KEY `t` (`t`(10))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select count(*) from t1;
+count(*)
+270
+insert into t1 values(concat('a',char(1)),concat('a',char(1)),concat('a',char(1)));
+select count(*) from t1 where v='a';
+count(*)
+10
+select count(*) from t1 where c='a';
+count(*)
+10
+select count(*) from t1 where t='a';
+count(*)
+10
+select count(*) from t1 where v='a ';
+count(*)
+10
+select count(*) from t1 where c='a ';
+count(*)
+10
+select count(*) from t1 where t='a ';
+count(*)
+10
+select count(*) from t1 where v between 'a' and 'a ';
+count(*)
+10
+select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
+count(*)
+10
+select count(*) from t1 where v like 'a%';
+count(*)
+11
+select count(*) from t1 where c like 'a%';
+count(*)
+11
+select count(*) from t1 where t like 'a%';
+count(*)
+11
+select count(*) from t1 where v like 'a %';
+count(*)
+9
+explain select count(*) from t1 where v='a ';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v v 13 const # Using where; Using index
+explain select count(*) from t1 where c='a ';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref c c 11 const # Using where; Using index
+explain select count(*) from t1 where t='a ';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range t t 13 NULL # Using where
+explain select count(*) from t1 where v like 'a%';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range v v 13 NULL # Using where; Using index
+explain select count(*) from t1 where v between 'a' and 'a ';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v v 13 const # Using where; Using index
+explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v v 13 const # Using where; Using index
+alter table t1 add unique(v);
+ERROR 23000: Duplicate entry '{ ' for key 'v_2'
+alter table t1 add key(v);
+select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
+qq
+*a*a*a*
+*a *a*a *
+*a *a*a *
+*a *a*a *
+*a *a*a *
+*a *a*a *
+*a *a*a *
+*a *a*a *
+*a *a*a *
+*a *a*a *
+explain select * from t1 where v='a';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v,v_2 # 13 const # Using where
+select v,count(*) from t1 group by v limit 10;
+v count(*)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select v,count(t) from t1 group by v limit 10;
+v count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select v,count(c) from t1 group by v limit 10;
+v count(c)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select sql_big_result v,count(t) from t1 group by v limit 10;
+v count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select sql_big_result v,count(c) from t1 group by v limit 10;
+v count(c)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select c,count(*) from t1 group by c limit 10;
+c count(*)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select c,count(t) from t1 group by c limit 10;
+c count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select sql_big_result c,count(t) from t1 group by c limit 10;
+c count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select t,count(*) from t1 group by t limit 10;
+t count(*)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select t,count(t) from t1 group by t limit 10;
+t count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select sql_big_result t,count(t) from t1 group by t limit 10;
+t count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+alter table t1 modify v varchar(300), drop key v, drop key v_2, add key v (v);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` varchar(300) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
+ `t` text,
+ KEY `c` (`c`),
+ KEY `t` (`t`(10)),
+ KEY `v` (`v`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select count(*) from t1 where v='a';
+count(*)
+10
+select count(*) from t1 where v='a ';
+count(*)
+10
+select count(*) from t1 where v between 'a' and 'a ';
+count(*)
+10
+select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
+count(*)
+10
+select count(*) from t1 where v like 'a%';
+count(*)
+11
+select count(*) from t1 where v like 'a %';
+count(*)
+9
+explain select count(*) from t1 where v='a ';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v v 303 const # Using where; Using index
+explain select count(*) from t1 where v like 'a%';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range v v 303 NULL # Using where; Using index
+explain select count(*) from t1 where v between 'a' and 'a ';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v v 303 const # Using where; Using index
+explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v v 303 const # Using where; Using index
+explain select * from t1 where v='a';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v v 303 const # Using where
+select v,count(*) from t1 group by v limit 10;
+v count(*)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select v,count(t) from t1 group by v limit 10;
+v count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select sql_big_result v,count(t) from t1 group by v limit 10;
+v count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+alter table t1 drop key v, add key v (v(30));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` varchar(300) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
+ `t` text,
+ KEY `c` (`c`),
+ KEY `t` (`t`(10)),
+ KEY `v` (`v`(30))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select count(*) from t1 where v='a';
+count(*)
+10
+select count(*) from t1 where v='a ';
+count(*)
+10
+select count(*) from t1 where v between 'a' and 'a ';
+count(*)
+10
+select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
+count(*)
+10
+select count(*) from t1 where v like 'a%';
+count(*)
+11
+select count(*) from t1 where v like 'a %';
+count(*)
+9
+explain select count(*) from t1 where v='a ';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v v 33 const # Using where
+explain select count(*) from t1 where v like 'a%';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range v v 33 NULL # Using where
+explain select count(*) from t1 where v between 'a' and 'a ';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v v 33 const # Using where
+explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v v 33 const # Using where
+explain select * from t1 where v='a';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v v 33 const # Using where
+select v,count(*) from t1 group by v limit 10;
+v count(*)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select v,count(t) from t1 group by v limit 10;
+v count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select sql_big_result v,count(t) from t1 group by v limit 10;
+v count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+alter table t1 modify v varchar(600), drop key v, add key v (v);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` varchar(600) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
+ `t` text,
+ KEY `c` (`c`),
+ KEY `t` (`t`(10)),
+ KEY `v` (`v`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select v,count(*) from t1 group by v limit 10;
+v count(*)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select v,count(t) from t1 group by v limit 10;
+v count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select sql_big_result v,count(t) from t1 group by v limit 10;
+v count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+drop table t1;
+create table t1 (a char(10), unique (a));
+insert into t1 values ('a ');
+insert into t1 values ('a ');
+ERROR 23000: Duplicate entry 'a' for key 'a'
+alter table t1 modify a varchar(10);
+insert into t1 values ('a '),('a '),('a '),('a ');
+ERROR 23000: Duplicate entry 'a ' for key 'a'
+insert into t1 values ('a ');
+ERROR 23000: Duplicate entry 'a ' for key 'a'
+insert into t1 values ('a ');
+ERROR 23000: Duplicate entry 'a ' for key 'a'
+insert into t1 values ('a ');
+ERROR 23000: Duplicate entry 'a ' for key 'a'
+update t1 set a='a ' where a like 'a%';
+select concat(a,'.') from t1;
+concat(a,'.')
+a .
+update t1 set a='abc ' where a like 'a ';
+select concat(a,'.') from t1;
+concat(a,'.')
+a .
+update t1 set a='a ' where a like 'a %';
+select concat(a,'.') from t1;
+concat(a,'.')
+a .
+update t1 set a='a ' where a like 'a ';
+select concat(a,'.') from t1;
+concat(a,'.')
+a .
+drop table t1;
+create table t1 (v varchar(10), c char(10), t text, key(v(5)), key(c(5)), key(t(5)));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
+ `t` text,
+ KEY `v` (`v`(5)),
+ KEY `c` (`c`(5)),
+ KEY `t` (`t`(5))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (v char(10) character set utf8);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` char(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (v varchar(10), c char(10)) row_format=fixed;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED
+insert into t1 values('a','a'),('a ','a ');
+select concat('*',v,'*',c,'*') from t1;
+concat('*',v,'*',c,'*')
+*a*a*
+*a *a*
+drop table t1;
+create table t1 (v varchar(65530), key(v(10)));
+insert into t1 values(repeat('a',65530));
+select length(v) from t1 where v=repeat('a',65530);
+length(v)
+65530
+drop table t1;
+create table t1(a int, b varchar(12), key ba(b, a));
+insert into t1 values (1, 'A'), (20, NULL);
+explain select * from t1 where a=20 and b is null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref ba ba 20 const,const 1 Using where; Using index
+select * from t1 where a=20 and b is null;
+a b
+20 NULL
+drop table t1;
+create table t1 (v varchar(65530), key(v));
+Warnings:
+Warning 1071 Specified key was too long; max key length is 1000 bytes
+drop table t1;
+create table t1 (v varchar(65536));
+Warnings:
+Note 1246 Converting column 'v' from VARCHAR to TEXT
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` mediumtext
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (v varchar(65530) character set utf8);
+Warnings:
+Note 1246 Converting column 'v' from VARCHAR to TEXT
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` mediumtext CHARACTER SET utf8
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+set storage_engine=MEMORY;
+create table t1 (v varchar(16384)) engine=MyISAM;
+drop table t1;
+create table t1 (a char(1), b char(1), key(a, b)) engine=MyISAM;
+insert into t1 values ('8', '6'), ('4', '7');
+select min(a) from t1;
+min(a)
+4
+select min(b) from t1 where a='8';
+min(b)
+6
+drop table t1;
+CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)) ENGINE=MyISAM;
+insert into t1 (b) values (1);
+replace into t1 (b) values (2), (1), (3);
+select * from t1;
+a b
+3 1
+2 2
+4 3
+truncate table t1;
+insert into t1 (b) values (1);
+replace into t1 (b) values (2);
+replace into t1 (b) values (1);
+replace into t1 (b) values (3);
+select * from t1;
+a b
+3 1
+2 2
+4 3
+drop table t1;
+create table t1 (rowid int not null auto_increment, val int not null,primary
+key (rowid), unique(val)) engine=MyISAM;
+replace into t1 (val) values ('1'),('2');
+replace into t1 (val) values ('1'),('2');
+insert into t1 (val) values ('1'),('2');
+ERROR 23000: Duplicate entry '1' for key 'val'
+select * from t1;
+rowid val
+3 1
+4 2
+drop table t1;
+CREATE TABLE t1 (GRADE DECIMAL(4) NOT NULL, PRIMARY KEY (GRADE)) ENGINE=MyISAM;
+INSERT INTO t1 (GRADE) VALUES (151),(252),(343);
+SELECT GRADE FROM t1 WHERE GRADE > 160 AND GRADE < 300;
+GRADE
+252
+SELECT GRADE FROM t1 WHERE GRADE= 151;
+GRADE
+151
+DROP TABLE t1;
+create table t1 (f1 varchar(10), f2 varchar(10), primary key (f1,f2)) engine=MyISAM;
+create table t2 (f3 varchar(10), f4 varchar(10), key (f4)) engine=MyISAM;
+insert into t2 values ('aa','cc');
+insert into t1 values ('aa','bb'),('aa','cc');
+delete t1 from t1,t2 where f1=f3 and f4='cc';
+select * from t1;
+f1 f2
+drop table t1,t2;
+create table t1 (
+a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = MyISAM;
+create table t2 (
+a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = MyISAM;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a hex(b) hex(c) filler
+1 61626364656667 61626364656667 boo
+4 D0B1 D0B1 eight
+4 5B 5B five
+4 E880BD E880BD four
+4 E880BDD0B1E880BD E880BDD0B1E880BD seven
+4 E880BDE880BD E880BDE880BD six
+3 71727374757677 71727374757677 three
+2 696A6B696C6D6E 696A6B696C6D6E two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a hex(b) hex(c) filler
+4 05612020 05612020 email
+4 0000563001FC0563 0000563001FC0563 email
+4 05630563 05630563 email
+4 0563 0563 email
+4 0120 0120 email
+4 01FC 01FC email
+4 00E400E50068 00E400E50068 email
+4 00640065 00640065 email
+4 0000E400 0000E400 email
+1 0061006200630064006500660067 0061006200630064006500660067 one
+3 0071007200730074007500760077 0071007200730074007500760077 three
+2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two
+drop table t1;
+drop table t2;
+create table t1 (
+a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = MyISAM;
+create table t2 (
+a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = MyISAM;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a hex(b) hex(c) filler
+1 61626364656667 61626364656667 boo
+4 D0B1 D0B1 eight
+4 5B 5B five
+4 E880BD E880BD four
+4 E880BDD0B1E880BD E880BDD0B1E880BD seven
+4 E880BDE880BD E880BDE880BD six
+3 71727374757677 71727374757677 three
+2 696A6B696C6D6E 696A6B696C6D6E two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a hex(b) hex(c) filler
+4 05612020 05612020 email
+4 0000563001FC0563 0000563001FC0563 email
+4 05630563 05630563 email
+4 0563 0563 email
+4 0120 0120 email
+4 01FC 01FC email
+4 00E400E50068 00E400E50068 email
+4 00640065 00640065 email
+4 0000E400 0000E400 email
+1 0061006200630064006500660067 0061006200630064006500660067 one
+3 0071007200730074007500760077 0071007200730074007500760077 three
+2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two
+drop table t1;
+drop table t2;
+create table t1 (
+a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = MyISAM;
+create table t2 (
+a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = MyISAM;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a hex(b) hex(c) filler
+1 61626364656667 61626364656667 boo
+4 D0B1 D0B1 eight
+4 5B 5B five
+4 E880BD E880BD four
+4 E880BDD0B1E880BD E880BDD0B1E880BD seven
+4 E880BDE880BD E880BDE880BD six
+3 71727374757677 71727374757677 three
+2 696A6B696C6D6E 696A6B696C6D6E two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a hex(b) hex(c) filler
+4 0000E400 0000E400 email
+4 00640065 00640065 email
+4 00E400E50068 00E400E50068 email
+4 01FC 01FC email
+4 0120 0120 email
+4 0563 0563 email
+4 05630563 05630563 email
+4 0000563001FC0563 0000563001FC0563 email
+4 05612020 05612020 email
+1 0061006200630064006500660067 0061006200630064006500660067 one
+3 0071007200730074007500760077 0071007200730074007500760077 three
+2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two
+drop table t1;
+drop table t2;
+create table t1 (
+a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = MyISAM;
+create table t2 (
+a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = MyISAM;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a hex(b) hex(c) filler
+1 61626364656667 61626364656667 boo
+4 D0B1 D0B1 eight
+4 5B 5B five
+4 E880BD E880BD four
+3 71727374757677 71727374757677 three
+2 696A6B696C6D6E 696A6B696C6D6E two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a hex(b) hex(c) filler
+4 0000E400 0000E400 email
+4 00640065 00640065 email
+4 00E400E50068 00E400E50068 email
+4 01FC 01FC email
+4 0120 0120 email
+4 0563 0563 email
+4 05612020 05612020 email
+1 61626364656667 61626364656667 one
+3 71727374757677 71727374757677 three
+2 696A6B696C6D6E 696A6B696C6D6E two
+drop table t1;
+drop table t2;
+commit;
+CREATE TABLE t1 (
+ind enum('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ind enum('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2;
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+hex(ind) hex(string1)
+31
+32
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+hex(ind) hex(string1)
+0031
+0032
+drop table t1,t2;
+CREATE TABLE t1 (
+ind set('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ind set('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2;
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+hex(ind) hex(string1)
+31
+32
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+hex(ind) hex(string1)
+0031
+0032
+drop table t1,t2;
+CREATE TABLE t1 (
+ind bit not null,
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ind bit not null,
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2;
+insert into t1 values(0,''),(1,'');
+insert into t2 values(0,''),(1,'');
+select hex(ind),hex(string1) from t1 order by string1;
+hex(ind) hex(string1)
+0
+1
+select hex(ind),hex(string1) from t2 order by string1;
+hex(ind) hex(string1)
+0
+1
+drop table t1,t2;
+create table t2 (
+a int, b char(10), filler char(10), primary key(a, b(2))
+) character set utf8 engine = MyISAM;
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+create table t2 (
+a int, b char(10), filler char(10), primary key(a, b(2))
+) character set ucs2 engine = MyISAM;
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+create table t1(a int not null, b char(110),primary key(a,b(100))) engine=MyISAM default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+a hex(b)
+1 61626364656667
+2 6465666768696A6B
+6 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
+7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
+update t1 set b = 'three' where a = 6;
+drop table t1;
+create table t1(a int not null, b text(110),primary key(a,b(100))) engine=MyISAM default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+a hex(b)
+1 61626364656667
+2 6465666768696A6B
+6 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
+7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
+update t1 set b = 'three' where a = 6;
+drop table t1;
+create table t1(a int not null, b int, c int, d int, primary key(a)) engine=MyISAM;
+insert into t1(a) values (1),(2),(3);
+commit;
+set autocommit = 0;
+update t1 set b = 5 where a = 2;
+create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end |
+set autocommit = 0;
+insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100),
+(11),(21),(31),(41),(51),(61),(71),(81),(91),(101),
+(12),(22),(32),(42),(52),(62),(72),(82),(92),(102),
+(13),(23),(33),(43),(53),(63),(73),(83),(93),(103),
+(14),(24),(34),(44),(54),(64),(74),(84),(94),(104);
+commit;
+commit;
+drop trigger t1t;
+drop table t1;
+create table t1(a int not null, b int, c int, d int, primary key(a)) engine=MyISAM;
+create table t2(a int not null, b int, c int, d int, primary key(a)) engine=MyISAM;
+create table t3(a int not null, b int, c int, d int, primary key(a)) engine=MyISAM;
+create table t4(a int not null, b int, c int, d int, primary key(a)) engine=MyISAM;
+create table t5(a int not null, b int, c int, d int, primary key(a)) engine=MyISAM;
+insert into t1(a) values (1),(2),(3);
+insert into t2(a) values (1),(2),(3);
+insert into t3(a) values (1),(2),(3);
+insert into t4(a) values (1),(2),(3);
+insert into t3(a) values (5),(7),(8);
+insert into t4(a) values (5),(7),(8);
+insert into t5(a) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12);
+create trigger t1t before insert on t1 for each row begin
+INSERT INTO t2 SET a = NEW.a;
+end |
+create trigger t2t before insert on t2 for each row begin
+DELETE FROM t3 WHERE a = NEW.a;
+end |
+create trigger t3t before delete on t3 for each row begin
+UPDATE t4 SET b = b + 1 WHERE a = OLD.a;
+end |
+create trigger t4t before update on t4 for each row begin
+UPDATE t5 SET b = b + 1 where a = NEW.a;
+end |
+commit;
+set autocommit = 0;
+update t1 set b = b + 5 where a = 1;
+update t2 set b = b + 5 where a = 1;
+update t3 set b = b + 5 where a = 1;
+update t4 set b = b + 5 where a = 1;
+insert into t5(a) values(20);
+set autocommit = 0;
+insert into t1(a) values(7);
+insert into t2(a) values(8);
+delete from t2 where a = 3;
+update t4 set b = b + 1 where a = 3;
+commit;
+drop trigger t1t;
+drop trigger t2t;
+drop trigger t3t;
+drop trigger t4t;
+drop table t1, t2, t3, t4, t5;
+create table t1(a date) engine=MyISAM;
+create table t2(a date, key(a)) engine=MyISAM;
+insert into t1 values('2005-10-01');
+insert into t2 values('2005-10-01');
+select * from t1, t2
+where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
+a a
+2005-10-01 2005-10-01
+drop table t1, t2;
+create table t1 (id int not null, f_id int not null, f int not null,
+primary key(f_id, id)) engine=MyISAM;
+create table t2 (id int not null,s_id int not null,s varchar(200),
+primary key(id)) engine=MyISAM;
+INSERT INTO t1 VALUES (8, 1, 3);
+INSERT INTO t1 VALUES (1, 2, 1);
+INSERT INTO t2 VALUES (1, 0, '');
+INSERT INTO t2 VALUES (8, 1, '');
+commit;
+DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id)
+WHERE mm.id IS NULL;
+select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
+where mm.id is null lock in share mode;
+id f_id f
+drop table t1,t2;
+create table t1(a int not null, b int, primary key(a)) engine=MyISAM;
+insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
+commit;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+update t1 set b = 5 where b = 1;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+select * from t1 where a = 7 and b = 3 for update;
+a b
+7 3
+commit;
+commit;
+drop table t1;
+CREATE TABLE t1 ( a int ) ENGINE=MyISAM;
+BEGIN;
+INSERT INTO t1 VALUES (1);
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+DROP TABLE t1;
diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result
deleted file mode 100644
index 6c19c429296..00000000000
--- a/mysql-test/r/mix_innodb_myisam_binlog.result
+++ /dev/null
@@ -1,282 +0,0 @@
-drop table if exists t1, t2;
-create table t1 (a int) engine=innodb;
-create table t2 (a int) engine=myisam;
-reset master;
-begin;
-insert into t1 values(1);
-insert into t2 select * from t1;
-commit;
-show binlog events from 98;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; BEGIN
-master-bin.000001 166 Query 1 # use `test`; insert into t1 values(1)
-master-bin.000001 253 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 347 Xid 1 # COMMIT /* xid=8 */
-delete from t1;
-delete from t2;
-reset master;
-begin;
-insert into t1 values(2);
-insert into t2 select * from t1;
-rollback;
-Warnings:
-Warning 1196 Some non-transactional changed tables couldn't be rolled back
-show binlog events from 98;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; BEGIN
-master-bin.000001 166 Query 1 # use `test`; insert into t1 values(2)
-master-bin.000001 253 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 347 Query 1 # use `test`; ROLLBACK
-delete from t1;
-delete from t2;
-reset master;
-begin;
-insert into t1 values(3);
-savepoint my_savepoint;
-insert into t1 values(4);
-insert into t2 select * from t1;
-rollback to savepoint my_savepoint;
-Warnings:
-Warning 1196 Some non-transactional changed tables couldn't be rolled back
-commit;
-show binlog events from 98;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; BEGIN
-master-bin.000001 166 Query 1 # use `test`; insert into t1 values(3)
-master-bin.000001 253 Query 1 # use `test`; savepoint my_savepoint
-master-bin.000001 338 Query 1 # use `test`; insert into t1 values(4)
-master-bin.000001 425 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 519 Query 1 # use `test`; rollback to savepoint my_savepoint
-master-bin.000001 616 Xid 1 # COMMIT /* xid=25 */
-delete from t1;
-delete from t2;
-reset master;
-begin;
-insert into t1 values(5);
-savepoint my_savepoint;
-insert into t1 values(6);
-insert into t2 select * from t1;
-rollback to savepoint my_savepoint;
-Warnings:
-Warning 1196 Some non-transactional changed tables couldn't be rolled back
-insert into t1 values(7);
-commit;
-select a from t1 order by a;
-a
-5
-7
-show binlog events from 98;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; BEGIN
-master-bin.000001 166 Query 1 # use `test`; insert into t1 values(5)
-master-bin.000001 253 Query 1 # use `test`; savepoint my_savepoint
-master-bin.000001 338 Query 1 # use `test`; insert into t1 values(6)
-master-bin.000001 425 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 519 Query 1 # use `test`; rollback to savepoint my_savepoint
-master-bin.000001 616 Query 1 # use `test`; insert into t1 values(7)
-master-bin.000001 703 Xid 1 # COMMIT /* xid=37 */
-delete from t1;
-delete from t2;
-reset master;
-select get_lock("a",10);
-get_lock("a",10)
-1
-begin;
-insert into t1 values(8);
-insert into t2 select * from t1;
-select get_lock("a",10);
-get_lock("a",10)
-1
-show binlog events from 98;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; BEGIN
-master-bin.000001 166 Query 1 # use `test`; insert into t1 values(8)
-master-bin.000001 253 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 347 Query 1 # use `test`; ROLLBACK
-delete from t1;
-delete from t2;
-reset master;
-insert into t1 values(9);
-insert into t2 select * from t1;
-show binlog events from 98;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; insert into t1 values(9)
-master-bin.000001 185 Xid 1 # COMMIT /* xid=60 */
-master-bin.000001 212 Query 1 # use `test`; insert into t2 select * from t1
-delete from t1;
-delete from t2;
-reset master;
-insert into t1 values(10);
-begin;
-insert into t2 select * from t1;
-show binlog events from 98;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; insert into t1 values(10)
-master-bin.000001 186 Xid 1 # COMMIT /* xid=66 */
-master-bin.000001 213 Query 1 # use `test`; insert into t2 select * from t1
-insert into t1 values(11);
-commit;
-show binlog events from 98;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; insert into t1 values(10)
-master-bin.000001 186 Xid 1 # COMMIT /* xid=66 */
-master-bin.000001 213 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 307 Query 1 # use `test`; BEGIN
-master-bin.000001 375 Query 1 # use `test`; insert into t1 values(11)
-master-bin.000001 463 Xid 1 # COMMIT /* xid=68 */
-alter table t2 engine=INNODB;
-delete from t1;
-delete from t2;
-reset master;
-begin;
-insert into t1 values(12);
-insert into t2 select * from t1;
-commit;
-show binlog events from 98;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; BEGIN
-master-bin.000001 166 Query 1 # use `test`; insert into t1 values(12)
-master-bin.000001 254 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 348 Xid 1 # COMMIT /* xid=78 */
-delete from t1;
-delete from t2;
-reset master;
-begin;
-insert into t1 values(13);
-insert into t2 select * from t1;
-rollback;
-show binlog events from 98;
-Log_name Pos Event_type Server_id End_log_pos Info
-delete from t1;
-delete from t2;
-reset master;
-begin;
-insert into t1 values(14);
-savepoint my_savepoint;
-insert into t1 values(15);
-insert into t2 select * from t1;
-rollback to savepoint my_savepoint;
-commit;
-show binlog events from 98;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; BEGIN
-master-bin.000001 166 Query 1 # use `test`; insert into t1 values(14)
-master-bin.000001 254 Xid 1 # COMMIT /* xid=94 */
-delete from t1;
-delete from t2;
-reset master;
-begin;
-insert into t1 values(16);
-savepoint my_savepoint;
-insert into t1 values(17);
-insert into t2 select * from t1;
-rollback to savepoint my_savepoint;
-insert into t1 values(18);
-commit;
-select a from t1 order by a;
-a
-16
-18
-show binlog events from 98;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; BEGIN
-master-bin.000001 166 Query 1 # use `test`; insert into t1 values(16)
-master-bin.000001 254 Query 1 # use `test`; insert into t1 values(18)
-master-bin.000001 342 Xid 1 # COMMIT /* xid=105 */
-delete from t1;
-delete from t2;
-alter table t2 type=MyISAM;
-insert into t1 values (1);
-begin;
-select * from t1 for update;
-a
-1
-select (@before:=unix_timestamp())*0;
-(@before:=unix_timestamp())*0
-0
-begin;
-select * from t1 for update;
-insert into t2 values (20);
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-select (@after:=unix_timestamp())*0;
-(@after:=unix_timestamp())*0
-0
-select (@after-@before) >= 2;
-(@after-@before) >= 2
-1
-drop table t1,t2;
-commit;
-begin;
-create temporary table ti (a int) engine=innodb;
-rollback;
-Warnings:
-Warning 1196 Some non-transactional changed tables couldn't be rolled back
-insert into ti values(1);
-set autocommit=0;
-create temporary table t1 (a int) engine=myisam;
-commit;
-insert t1 values (1);
-rollback;
-Warnings:
-Warning 1196 Some non-transactional changed tables couldn't be rolled back
-create table t0 (n int);
-insert t0 select * from t1;
-set autocommit=1;
-insert into t0 select GET_LOCK("lock1",null);
-set autocommit=0;
-create table t2 (n int) engine=innodb;
-insert into t2 values (3);
-select get_lock("lock1",60);
-get_lock("lock1",60)
-1
-show binlog events from 98;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 # use `test`; BEGIN
-master-bin.000001 166 Query 1 # use `test`; insert into t1 values(16)
-master-bin.000001 254 Query 1 # use `test`; insert into t1 values(18)
-master-bin.000001 342 Xid 1 # COMMIT /* xid=105 */
-master-bin.000001 369 Query 1 # use `test`; delete from t1
-master-bin.000001 446 Xid 1 # COMMIT /* xid=114 */
-master-bin.000001 473 Query 1 # use `test`; delete from t2
-master-bin.000001 550 Xid 1 # COMMIT /* xid=115 */
-master-bin.000001 577 Query 1 # use `test`; alter table t2 type=MyISAM
-master-bin.000001 666 Query 1 # use `test`; insert into t1 values (1)
-master-bin.000001 754 Xid 1 # COMMIT /* xid=117 */
-master-bin.000001 781 Query 1 # use `test`; insert into t2 values (20)
-master-bin.000001 870 Query 1 # use `test`; drop table t1,t2
-master-bin.000001 949 Query 1 # use `test`; create temporary table ti (a int) engine=innodb
-master-bin.000001 1059 Query 1 # use `test`; insert into ti values(1)
-master-bin.000001 1146 Xid 1 # COMMIT /* xid=132 */
-master-bin.000001 1173 Query 1 # use `test`; create temporary table t1 (a int) engine=myisam
-master-bin.000001 1283 Query 1 # use `test`; insert t1 values (1)
-master-bin.000001 1366 Query 1 # use `test`; create table t0 (n int)
-master-bin.000001 1452 Query 1 # use `test`; insert t0 select * from t1
-master-bin.000001 1541 Query 1 # use `test`; insert into t0 select GET_LOCK("lock1",null)
-master-bin.000001 1648 Query 1 # use `test`; create table t2 (n int) engine=innodb
-master-bin.000001 1748 Query 1 # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti`
-do release_lock("lock1");
-drop table t0,t2;
-reset master;
-create table t1 (a int) engine=innodb;
-create table t2 (a int) engine=myisam;
-select get_lock("a",10);
-get_lock("a",10)
-1
-begin;
-insert into t1 values(8);
-insert into t2 select * from t1;
-select get_lock("a",10);
-get_lock("a",10)
-1
-select
-(@a:=load_file("MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
-is not null;
-(@a:=load_file("MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
-is not null
-1
-select
-@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%",
-@a not like "%#%error_code=%error_code=%";
-@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%"
-1 1
-drop table t1, t2;
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 78872f27c47..6d8e5dfdf2c 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -492,7 +492,7 @@ create table t2 like t1;
insert into t2 select * from t1;
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
drop table t1,t2;
-create table t1 ( c char(8) not null ) engine=bdb;
+create table t1 ( c char(8) not null ) engine=innodb;
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
alter table t1 add b char(8) not null;
@@ -524,3 +524,83 @@ a
30
drop view v1;
drop table t1, t2;
+create table t1 (i1 int, i2 int, i3 int);
+create table t2 (id int, c1 varchar(20), c2 varchar(20));
+insert into t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2);
+insert into t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test");
+select * from t1 order by i1;
+i1 i2 i3
+1 5 10
+2 2 2
+3 7 12
+4 5 2
+9 10 15
+select * from t2;
+id c1 c2
+9 abc def
+5 opq lmn
+2 test t t test
+update t1,t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id;
+select * from t1 order by i1;
+i1 i2 i3
+1 5 10
+2 15 2
+3 7 12
+4 5 2
+9 15 15
+select * from t2 order by id;
+id c1 c2
+2 test t ppc
+5 opq lmn
+9 abc ppc
+delete t1.*,t2.* from t1,t2 where t1.i2=t2.id;
+select * from t1 order by i1;
+i1 i2 i3
+2 15 2
+3 7 12
+9 15 15
+select * from t2 order by id;
+id c1 c2
+2 test t ppc
+9 abc ppc
+drop table t1, t2;
+create table t1 (i1 int auto_increment not null, i2 int, i3 int, primary key (i1));
+create table t2 (id int auto_increment not null, c1 varchar(20), c2 varchar(20), primary key(id));
+insert into t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2);
+insert into t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test");
+select * from t1 order by i1;
+i1 i2 i3
+1 5 10
+2 2 2
+3 7 12
+4 5 2
+9 10 15
+select * from t2 order by id;
+id c1 c2
+2 test t t test
+5 opq lmn
+9 abc def
+update t1,t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id;
+select * from t1 order by i1;
+i1 i2 i3
+1 5 10
+2 15 2
+3 7 12
+4 5 2
+9 15 15
+select * from t2 order by id;
+id c1 c2
+2 test t ppc
+5 opq lmn
+9 abc ppc
+delete t1.*,t2.* from t1,t2 where t1.i2=t2.id;
+select * from t1 order by i1;
+i1 i2 i3
+2 15 2
+3 7 12
+9 15 15
+select * from t2 order by id;
+id c1 c2
+2 test t ppc
+9 abc ppc
+drop table t1, t2;
diff --git a/mysql-test/r/myisam-system.result b/mysql-test/r/myisam-system.result
new file mode 100644
index 00000000000..e0629d955ae
--- /dev/null
+++ b/mysql-test/r/myisam-system.result
@@ -0,0 +1,13 @@
+drop table if exists t1,t2;
+create table t1 (a int) engine=myisam;
+drop table if exists t1;
+Warnings:
+Error 2 Can't find file: 't1' (errno: 2)
+create table t1 (a int) engine=myisam;
+drop table t1;
+Got one of the listed errors
+create table t1 (a int) engine=myisam;
+drop table t1;
+Got one of the listed errors
+drop table t1;
+ERROR 42S02: Unknown table 't1'
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index 2ea317754ec..7b8d7819c2e 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -346,11 +346,11 @@ t1 1 c_2 2 a A 5 NULL NULL BTREE
explain select * from t1,t2 where t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL a NULL NULL NULL 2
-1 SIMPLE t1 ALL a NULL NULL NULL 4 Using where
+1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where
explain select * from t1,t2 force index(a) where t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL a NULL NULL NULL 2
-1 SIMPLE t1 ALL a NULL NULL NULL 4 Using where
+1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where
explain select * from t1 force index(a),t2 force index(a) where t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL a NULL NULL NULL 2
@@ -362,7 +362,7 @@ id select_type table type possible_keys key key_len ref rows Extra
explain select * from t1,t2 force index(c) where t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
-1 SIMPLE t1 ALL a NULL NULL NULL 4 Using where
+1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where
explain select * from t1 where a=0 or a=2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where
@@ -469,9 +469,9 @@ b.
c.
update t1 set b='b ' where a=2;
update t1 set b='b ' where a > 1;
-ERROR 23000: Duplicate entry 'b ' for key 2
+ERROR 23000: Duplicate entry 'b ' for key 'b'
insert into t1 (b) values ('b');
-ERROR 23000: Duplicate entry 'b' for key 2
+ERROR 23000: Duplicate entry 'b' for key 'b'
select * from t1;
a b
1 a
@@ -939,40 +939,40 @@ concat('*',v,'*',c,'*',t,'*')
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL,
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
`t` text
) ENGINE=MyISAM DEFAULT CHARSET=latin1
create table t2 like t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL,
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
`t` text
) ENGINE=MyISAM DEFAULT CHARSET=latin1
create table t3 select * from t1;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL,
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
`t` text
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 modify c varchar(10);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(10) default NULL,
- `c` varchar(10) default NULL,
+ `v` varchar(10) DEFAULT NULL,
+ `c` varchar(10) DEFAULT NULL,
`t` text
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 modify v char(10);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` char(10) default NULL,
- `c` varchar(10) default NULL,
+ `v` char(10) DEFAULT NULL,
+ `c` varchar(10) DEFAULT NULL,
`t` text
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 modify t varchar(10);
@@ -981,9 +981,9 @@ Note 1265 Data truncated for column 't' at row 2
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` char(10) default NULL,
- `c` varchar(10) default NULL,
- `t` varchar(10) default NULL
+ `v` char(10) DEFAULT NULL,
+ `c` varchar(10) DEFAULT NULL,
+ `t` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select concat('*',v,'*',c,'*',t,'*') from t1;
concat('*',v,'*',c,'*',t,'*')
@@ -994,8 +994,8 @@ create table t1 (v varchar(10), c char(10), t text, key(v), key(c), key(t(10)));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL,
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
`t` text,
KEY `v` (`v`),
KEY `c` (`c`),
@@ -1060,7 +1060,7 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a '
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const # Using where; Using index
alter table t1 add unique(v);
-ERROR 23000: Duplicate entry '{ ' for key 1
+ERROR 23000: Duplicate entry '{ ' for key 'v_2'
alter table t1 add key(v);
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
qq
@@ -1213,8 +1213,8 @@ alter table t1 modify v varchar(300), drop key v, drop key v_2, add key v (v);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(300) default NULL,
- `c` char(10) default NULL,
+ `v` varchar(300) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
`t` text,
KEY `c` (`c`),
KEY `t` (`t`(10)),
@@ -1293,8 +1293,8 @@ alter table t1 drop key v, add key v (v(30));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(300) default NULL,
- `c` char(10) default NULL,
+ `v` varchar(300) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
`t` text,
KEY `c` (`c`),
KEY `t` (`t`(10)),
@@ -1373,8 +1373,8 @@ alter table t1 modify v varchar(600), drop key v, add key v (v);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(600) default NULL,
- `c` char(10) default NULL,
+ `v` varchar(600) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
`t` text,
KEY `c` (`c`),
KEY `t` (`t`(10)),
@@ -1420,16 +1420,16 @@ drop table t1;
create table t1 (a char(10), unique (a));
insert into t1 values ('a ');
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a' for key 1
+ERROR 23000: Duplicate entry 'a' for key 'a'
alter table t1 modify a varchar(10);
insert into t1 values ('a '),('a '),('a '),('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'a'
update t1 set a='a ' where a like 'a%';
select concat(a,'.') from t1;
concat(a,'.')
@@ -1451,8 +1451,8 @@ create table t1 (v varchar(10), c char(10), t text, key(v(5)), key(c(5)), key(t(
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL,
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
`t` text,
KEY `v` (`v`(5)),
KEY `c` (`c`(5)),
@@ -1463,15 +1463,15 @@ create table t1 (v char(10) character set utf8);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` char(10) character set utf8 default NULL
+ `v` char(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (v varchar(10), c char(10)) row_format=fixed;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(10) default NULL,
- `c` char(10) default NULL
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED
insert into t1 values('a','a'),('a ','a ');
select concat('*',v,'*',c,'*') from t1;
@@ -1513,24 +1513,12 @@ Note 1246 Converting column 'v' from VARCHAR to TEXT
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` mediumtext character set utf8
+ `v` mediumtext CHARACTER SET utf8
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (v varchar(65535));
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
set storage_engine=MyISAM;
-create table t1 (a int) engine=myisam;
-drop table if exists t1;
-Warnings:
-Error 2 Can't find file: 't1' (errno: 2)
-create table t1 (a int) engine=myisam;
-drop table t1;
-Got one of the listed errors
-create table t1 (a int) engine=myisam;
-drop table t1;
-Got one of the listed errors
-drop table t1;
-ERROR 42S02: Unknown table 't1'
set @save_concurrent_insert=@@concurrent_insert;
set global concurrent_insert=1;
create table t1 (a int);
@@ -1602,12 +1590,6 @@ show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 a 1 a A 8 NULL NULL YES BTREE
drop table t1;
-create table t1 (c1 int) engine=myisam pack_keys=0;
-create table t2 (c1 int) engine=myisam pack_keys=1;
-create table t3 (c1 int) engine=myisam pack_keys=default;
-create table t4 (c1 int) engine=myisam pack_keys=2;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2' at line 1
-drop table t1, t2, t3;
show create table t1;
show create table t1;
create table t1 (a int) engine=myisam select 42 a;
@@ -1621,3 +1603,158 @@ select * from t1;
a
42
drop table t1;
+End of 4.1 tests
+create table t1 (c1 int) engine=myisam pack_keys=0;
+create table t2 (c1 int) engine=myisam pack_keys=1;
+create table t3 (c1 int) engine=myisam pack_keys=default;
+create table t4 (c1 int) engine=myisam pack_keys=2;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2' at line 1
+drop table t1, t2, t3;
+End of 5.0 tests
+create table t1 (a int not null, key `a` (a) key_block_size=1024);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ KEY `a` (`a`) KEY_BLOCK_SIZE=1024
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (a int not null, key `a` (a) key_block_size=2048);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ KEY `a` (`a`) KEY_BLOCK_SIZE=2048
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (a varchar(2048), key `a` (a));
+Warnings:
+Warning 1071 Specified key was too long; max key length is 1000 bytes
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(2048) DEFAULT NULL,
+ KEY `a` (`a`(1000))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (a varchar(2048), key `a` (a) key_block_size=1024);
+Warnings:
+Warning 1071 Specified key was too long; max key length is 1000 bytes
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(2048) DEFAULT NULL,
+ KEY `a` (`a`(1000)) KEY_BLOCK_SIZE=4096
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=1024;
+Warnings:
+Warning 1071 Specified key was too long; max key length is 1000 bytes
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` varchar(2048) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`(1000)) KEY_BLOCK_SIZE=4096
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1024
+alter table t1 key_block_size=2048;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` varchar(2048) DEFAULT NULL,
+ KEY `a` (`a`) KEY_BLOCK_SIZE=1024,
+ KEY `b` (`b`(1000)) KEY_BLOCK_SIZE=4096
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=2048
+alter table t1 add c int, add key (c);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` varchar(2048) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`) KEY_BLOCK_SIZE=1024,
+ KEY `b` (`b`(1000)) KEY_BLOCK_SIZE=4096,
+ KEY `c` (`c`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=2048
+alter table t1 key_block_size=0;
+alter table t1 add d int, add key (d);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` varchar(2048) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ `d` int(11) DEFAULT NULL,
+ KEY `a` (`a`) KEY_BLOCK_SIZE=1024,
+ KEY `b` (`b`(1000)) KEY_BLOCK_SIZE=4096,
+ KEY `c` (`c`) KEY_BLOCK_SIZE=2048,
+ KEY `d` (`d`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=8192;
+Warnings:
+Warning 1071 Specified key was too long; max key length is 1000 bytes
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` varchar(2048) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`(1000))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=8192
+drop table t1;
+create table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) key_block_size=8192;
+Warnings:
+Warning 1071 Specified key was too long; max key length is 1000 bytes
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` varchar(2048) DEFAULT NULL,
+ KEY `a` (`a`) KEY_BLOCK_SIZE=1024,
+ KEY `b` (`b`(1000))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=8192
+drop table t1;
+create table t1 (a int not null, b int, key (a) key_block_size=1024, key(b) key_block_size=8192) key_block_size=16384;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`) KEY_BLOCK_SIZE=1024,
+ KEY `b` (`b`) KEY_BLOCK_SIZE=8192
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=16384
+drop table t1;
+create table t1 (a int not null, key `a` (a) key_block_size=512);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ KEY `a` (`a`) KEY_BLOCK_SIZE=1024
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000);
+Warnings:
+Warning 1071 Specified key was too long; max key length is 1000 bytes
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(2048) DEFAULT NULL,
+ KEY `a` (`a`(1000)) KEY_BLOCK_SIZE=4096
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (a int not null, key `a` (a) key_block_size=1025);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ KEY `a` (`a`) KEY_BLOCK_SIZE=2048
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (a int not null, key key_block_size=1024 (a));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=1024 (a))' at line 1
+create table t1 (a int not null, key `a` key_block_size=1024 (a));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_block_size=1024 (a))' at line 1
+End of 5.1 tests
diff --git a/mysql-test/r/mysqlbinlog_base64.result b/mysql-test/r/mysqlbinlog_base64.result
new file mode 100644
index 00000000000..c31dbee56c6
--- /dev/null
+++ b/mysql-test/r/mysqlbinlog_base64.result
@@ -0,0 +1,89 @@
+create table t1 (a int);
+insert into t1 values (1);
+insert into t1 values (2);
+insert into t1 values (3);
+update t1 set a=a+2 where a=2;
+update t1 set a=a+2 where a=3;
+create table t2 (word varchar(20));
+load data infile '../std_data_ln/words.dat' into table t2;
+drop table t1;
+drop table t2;
+select * from t1;
+a
+1
+4
+5
+select * from t2;
+word
+Aarhus
+Aaron
+Ababa
+aback
+abaft
+abandon
+abandoned
+abandoning
+abandonment
+abandons
+Aarhus
+Aaron
+Ababa
+aback
+abaft
+abandon
+abandoned
+abandoning
+abandonment
+abandons
+abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
+drop table t1;
+drop table t2;
diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result
index df0835b830c..c34aa995b2b 100644
--- a/mysql-test/r/mysqlcheck.result
+++ b/mysql-test/r/mysqlcheck.result
@@ -1,13 +1,24 @@
+drop database if exists client_test_db;
+DROP SCHEMA test;
+CREATE SCHEMA test;
+use test;
+cluster.binlog_index OK
mysql.columns_priv OK
mysql.db OK
+mysql.event OK
mysql.func OK
+mysql.general_log
+note : The storage engine for the table doesn't support optimize
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
+mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
+mysql.slow_log
+note : The storage engine for the table doesn't support optimize
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
@@ -17,14 +28,20 @@ mysql.time_zone_transition_type OK
mysql.user OK
mysql.columns_priv OK
mysql.db OK
+mysql.event OK
mysql.func OK
+mysql.general_log
+note : The storage engine for the table doesn't support optimize
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
+mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
+mysql.slow_log
+note : The storage engine for the table doesn't support optimize
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
diff --git a/mysql-test/r/mysqldump-max.result b/mysql-test/r/mysqldump-max.result
index 9ae3e368e28..e78fc4d386a 100644
--- a/mysql-test/r/mysqldump-max.result
+++ b/mysql-test/r/mysqldump-max.result
@@ -94,8 +94,8 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `id` int(8) default NULL,
- `name` varchar(32) default NULL
+ `id` int(8) DEFAULT NULL,
+ `name` varchar(32) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -103,8 +103,8 @@ INSERT DELAYED IGNORE INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `t2`;
CREATE TABLE `t2` (
- `id` int(8) default NULL,
- `name` varchar(32) default NULL
+ `id` int(8) DEFAULT NULL,
+ `name` varchar(32) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
@@ -112,8 +112,8 @@ INSERT DELAYED IGNORE INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
DROP TABLE IF EXISTS `t3`;
CREATE TABLE `t3` (
- `id` int(8) default NULL,
- `name` varchar(32) default NULL
+ `id` int(8) DEFAULT NULL,
+ `name` varchar(32) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
@@ -121,8 +121,8 @@ INSERT DELAYED IGNORE INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'
/*!40000 ALTER TABLE `t3` ENABLE KEYS */;
DROP TABLE IF EXISTS `t4`;
CREATE TABLE `t4` (
- `id` int(8) default NULL,
- `name` varchar(32) default NULL
+ `id` int(8) DEFAULT NULL,
+ `name` varchar(32) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t4` DISABLE KEYS */;
@@ -130,8 +130,8 @@ INSERT DELAYED IGNORE INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'
/*!40000 ALTER TABLE `t4` ENABLE KEYS */;
DROP TABLE IF EXISTS `t5`;
CREATE TABLE `t5` (
- `id` int(8) default NULL,
- `name` varchar(32) default NULL
+ `id` int(8) DEFAULT NULL,
+ `name` varchar(32) DEFAULT NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t5` DISABLE KEYS */;
@@ -139,8 +139,8 @@ INSERT DELAYED IGNORE INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'
/*!40000 ALTER TABLE `t5` ENABLE KEYS */;
DROP TABLE IF EXISTS `t6`;
CREATE TABLE `t6` (
- `id` int(8) default NULL,
- `name` varchar(32) default NULL
+ `id` int(8) DEFAULT NULL,
+ `name` varchar(32) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t6` DISABLE KEYS */;
@@ -173,8 +173,8 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `id` int(8) default NULL,
- `name` varchar(32) default NULL
+ `id` int(8) DEFAULT NULL,
+ `name` varchar(32) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -182,8 +182,8 @@ INSERT DELAYED INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first v
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `t2`;
CREATE TABLE `t2` (
- `id` int(8) default NULL,
- `name` varchar(32) default NULL
+ `id` int(8) DEFAULT NULL,
+ `name` varchar(32) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
@@ -191,8 +191,8 @@ INSERT DELAYED INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first v
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
DROP TABLE IF EXISTS `t3`;
CREATE TABLE `t3` (
- `id` int(8) default NULL,
- `name` varchar(32) default NULL
+ `id` int(8) DEFAULT NULL,
+ `name` varchar(32) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
@@ -200,8 +200,8 @@ INSERT DELAYED INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first v
/*!40000 ALTER TABLE `t3` ENABLE KEYS */;
DROP TABLE IF EXISTS `t4`;
CREATE TABLE `t4` (
- `id` int(8) default NULL,
- `name` varchar(32) default NULL
+ `id` int(8) DEFAULT NULL,
+ `name` varchar(32) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t4` DISABLE KEYS */;
@@ -209,8 +209,8 @@ INSERT DELAYED INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first v
/*!40000 ALTER TABLE `t4` ENABLE KEYS */;
DROP TABLE IF EXISTS `t5`;
CREATE TABLE `t5` (
- `id` int(8) default NULL,
- `name` varchar(32) default NULL
+ `id` int(8) DEFAULT NULL,
+ `name` varchar(32) DEFAULT NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t5` DISABLE KEYS */;
@@ -218,8 +218,8 @@ INSERT DELAYED INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first v
/*!40000 ALTER TABLE `t5` ENABLE KEYS */;
DROP TABLE IF EXISTS `t6`;
CREATE TABLE `t6` (
- `id` int(8) default NULL,
- `name` varchar(32) default NULL
+ `id` int(8) DEFAULT NULL,
+ `name` varchar(32) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t6` DISABLE KEYS */;
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 35a79d6a805..54c195900f4 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -3,13 +3,14 @@ drop database if exists mysqldump_test_db;
drop database if exists db1;
drop database if exists db2;
drop view if exists v1, v2, v3;
-CREATE TABLE t1(a int);
+CREATE TABLE t1(a int, key (a)) key_block_size=1024;
INSERT INTO t1 VALUES (1), (2);
<?xml version="1.0"?>
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="test">
<table_structure name="t1">
- <field Field="a" Type="int(11)" Null="YES" Key="" Extra="" />
+ <field Field="a" Type="int(11)" Null="YES" Key="MUL" Extra="" />
+ <key Table="t1" Non_unique="1" Key_name="a" Seq_in_index="1" Column_name="a" Collation="A" Null="YES" Index_type="BTREE" Comment="" />
</table_structure>
<table_data name="t1">
<row>
@@ -29,7 +30,7 @@ CREATE TABLE t1 (a decimal(64, 20));
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
("0987654321098765432109876543210987654321");
CREATE TABLE `t1` (
- `a` decimal(64,20) default NULL
+ `a` decimal(64,20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('987654321098765432109876543210987654321.00000000000000000000');
DROP TABLE t1;
@@ -39,9 +40,9 @@ DROP TABLE t1;
CREATE TABLE t1 (a double);
INSERT INTO t1 VALUES ('-9e999999');
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
CREATE TABLE `t1` (
- `a` double default NULL
+ `a` double DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `t1` VALUES (RES);
DROP TABLE t1;
@@ -59,13 +60,13 @@ INSERT INTO t1 VALUES ("1.2345", 2.3456);
ERROR 42S22: Unknown column '1.2345' in 'field list'
SET SQL_MODE=@OLD_SQL_MODE;
CREATE TABLE `t1` (
- `a` decimal(10,5) default NULL,
- `b` float default NULL
+ `a` decimal(10,5) DEFAULT NULL,
+ `b` float DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
CREATE TABLE `t1` (
- `a` decimal(10,5) default NULL,
- `b` float default NULL
+ `a` decimal(10,5) DEFAULT NULL,
+ `b` float DEFAULT NULL
);
INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
@@ -81,8 +82,8 @@ INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456)
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` decimal(10,5) default NULL,
- `b` float default NULL
+ `a` decimal(10,5) DEFAULT NULL,
+ `b` float DEFAULT NULL
);
LOCK TABLES `t1` WRITE;
@@ -107,8 +108,8 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE TABLE `t1` (
- `a` decimal(10,5) default NULL,
- `b` float default NULL
+ `a` decimal(10,5) DEFAULT NULL,
+ `b` float DEFAULT NULL
);
INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
@@ -186,7 +187,7 @@ INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL);
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` varchar(255) default NULL
+ `a` varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=koi8r;
LOCK TABLES `t1` WRITE;
@@ -219,7 +220,7 @@ INSERT INTO t1 VALUES (1), (2);
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) TYPE=MyISAM;
LOCK TABLES `t1` WRITE;
@@ -242,7 +243,7 @@ UNLOCK TABLES;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) TYPE=MyISAM;
LOCK TABLES `t1` WRITE;
@@ -263,7 +264,7 @@ DROP TABLE t1;
#
create table ```a` (i int);
CREATE TABLE ```a` (
- `i` int(11) default NULL
+ `i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
drop table ```a`;
#
@@ -283,7 +284,7 @@ create table t1(a int);
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
@@ -308,7 +309,7 @@ UNLOCK TABLES;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS "t1";
CREATE TABLE "t1" (
- "a" int(11) default NULL
+ "a" int(11) DEFAULT NULL
);
LOCK TABLES "t1" WRITE;
@@ -336,7 +337,7 @@ set global sql_mode='ANSI_QUOTES';
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
@@ -361,7 +362,7 @@ UNLOCK TABLES;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS "t1";
CREATE TABLE "t1" (
- "a" int(11) default NULL
+ "a" int(11) DEFAULT NULL
);
LOCK TABLES "t1" WRITE;
@@ -393,7 +394,7 @@ insert into t1 values (1),(2),(3);
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -484,7 +485,7 @@ INSERT INTO t1 VALUES (_latin1 '');
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` char(10) default NULL
+ `a` char(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
@@ -517,7 +518,7 @@ UNLOCK TABLES;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` char(10) default NULL
+ `a` char(10) DEFAULT NULL
) TYPE=MyISAM;
LOCK TABLES `t1` WRITE;
@@ -540,7 +541,7 @@ UNLOCK TABLES;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` char(10) default NULL
+ `a` char(10) DEFAULT NULL
) TYPE=MyISAM;
LOCK TABLES `t1` WRITE;
@@ -563,7 +564,7 @@ UNLOCK TABLES;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` char(10) default NULL
+ `a` char(10) DEFAULT NULL
) TYPE=MyISAM;
LOCK TABLES `t1` WRITE;
@@ -599,7 +600,7 @@ INSERT INTO t2 VALUES (4),(5),(6);
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t2`;
CREATE TABLE `t2` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t2` WRITE;
@@ -675,7 +676,7 @@ INSERT INTO t1 VALUES (4),(5),(6);
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
@@ -706,7 +707,7 @@ UNLOCK TABLES;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -1072,336 +1073,336 @@ insert into t1 (F_8d3bba7425e7c98c50f52ca1b52d3735) values (1);
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `F_c4ca4238a0b923820dcc509a6f75849b` int(11) default NULL,
- `F_c81e728d9d4c2f636f067f89cc14862c` int(11) default NULL,
- `F_eccbc87e4b5ce2fe28308fd9f2a7baf3` int(11) default NULL,
- `F_a87ff679a2f3e71d9181a67b7542122c` int(11) default NULL,
- `F_e4da3b7fbbce2345d7772b0674a318d5` int(11) default NULL,
- `F_1679091c5a880faf6fb5e6087eb1b2dc` int(11) default NULL,
- `F_8f14e45fceea167a5a36dedd4bea2543` int(11) default NULL,
- `F_c9f0f895fb98ab9159f51fd0297e236d` int(11) default NULL,
- `F_45c48cce2e2d7fbdea1afc51c7c6ad26` int(11) default NULL,
- `F_d3d9446802a44259755d38e6d163e820` int(11) default NULL,
- `F_6512bd43d9caa6e02c990b0a82652dca` int(11) default NULL,
- `F_c20ad4d76fe97759aa27a0c99bff6710` int(11) default NULL,
- `F_c51ce410c124a10e0db5e4b97fc2af39` int(11) default NULL,
- `F_aab3238922bcc25a6f606eb525ffdc56` int(11) default NULL,
- `F_9bf31c7ff062936a96d3c8bd1f8f2ff3` int(11) default NULL,
- `F_c74d97b01eae257e44aa9d5bade97baf` int(11) default NULL,
- `F_70efdf2ec9b086079795c442636b55fb` int(11) default NULL,
- `F_6f4922f45568161a8cdf4ad2299f6d23` int(11) default NULL,
- `F_1f0e3dad99908345f7439f8ffabdffc4` int(11) default NULL,
- `F_98f13708210194c475687be6106a3b84` int(11) default NULL,
- `F_3c59dc048e8850243be8079a5c74d079` int(11) default NULL,
- `F_b6d767d2f8ed5d21a44b0e5886680cb9` int(11) default NULL,
- `F_37693cfc748049e45d87b8c7d8b9aacd` int(11) default NULL,
- `F_1ff1de774005f8da13f42943881c655f` int(11) default NULL,
- `F_8e296a067a37563370ded05f5a3bf3ec` int(11) default NULL,
- `F_4e732ced3463d06de0ca9a15b6153677` int(11) default NULL,
- `F_02e74f10e0327ad868d138f2b4fdd6f0` int(11) default NULL,
- `F_33e75ff09dd601bbe69f351039152189` int(11) default NULL,
- `F_6ea9ab1baa0efb9e19094440c317e21b` int(11) default NULL,
- `F_34173cb38f07f89ddbebc2ac9128303f` int(11) default NULL,
- `F_c16a5320fa475530d9583c34fd356ef5` int(11) default NULL,
- `F_6364d3f0f495b6ab9dcf8d3b5c6e0b01` int(11) default NULL,
- `F_182be0c5cdcd5072bb1864cdee4d3d6e` int(11) default NULL,
- `F_e369853df766fa44e1ed0ff613f563bd` int(11) default NULL,
- `F_1c383cd30b7c298ab50293adfecb7b18` int(11) default NULL,
- `F_19ca14e7ea6328a42e0eb13d585e4c22` int(11) default NULL,
- `F_a5bfc9e07964f8dddeb95fc584cd965d` int(11) default NULL,
- `F_a5771bce93e200c36f7cd9dfd0e5deaa` int(11) default NULL,
- `F_d67d8ab4f4c10bf22aa353e27879133c` int(11) default NULL,
- `F_d645920e395fedad7bbbed0eca3fe2e0` int(11) default NULL,
- `F_3416a75f4cea9109507cacd8e2f2aefc` int(11) default NULL,
- `F_a1d0c6e83f027327d8461063f4ac58a6` int(11) default NULL,
- `F_17e62166fc8586dfa4d1bc0e1742c08b` int(11) default NULL,
- `F_f7177163c833dff4b38fc8d2872f1ec6` int(11) default NULL,
- `F_6c8349cc7260ae62e3b1396831a8398f` int(11) default NULL,
- `F_d9d4f495e875a2e075a1a4a6e1b9770f` int(11) default NULL,
- `F_67c6a1e7ce56d3d6fa748ab6d9af3fd7` int(11) default NULL,
- `F_642e92efb79421734881b53e1e1b18b6` int(11) default NULL,
- `F_f457c545a9ded88f18ecee47145a72c0` int(11) default NULL,
- `F_c0c7c76d30bd3dcaefc96f40275bdc0a` int(11) default NULL,
- `F_2838023a778dfaecdc212708f721b788` int(11) default NULL,
- `F_9a1158154dfa42caddbd0694a4e9bdc8` int(11) default NULL,
- `F_d82c8d1619ad8176d665453cfb2e55f0` int(11) default NULL,
- `F_a684eceee76fc522773286a895bc8436` int(11) default NULL,
- `F_b53b3a3d6ab90ce0268229151c9bde11` int(11) default NULL,
- `F_9f61408e3afb633e50cdf1b20de6f466` int(11) default NULL,
- `F_72b32a1f754ba1c09b3695e0cb6cde7f` int(11) default NULL,
- `F_66f041e16a60928b05a7e228a89c3799` int(11) default NULL,
- `F_093f65e080a295f8076b1c5722a46aa2` int(11) default NULL,
- `F_072b030ba126b2f4b2374f342be9ed44` int(11) default NULL,
- `F_7f39f8317fbdb1988ef4c628eba02591` int(11) default NULL,
- `F_44f683a84163b3523afe57c2e008bc8c` int(11) default NULL,
- `F_03afdbd66e7929b125f8597834fa83a4` int(11) default NULL,
- `F_ea5d2f1c4608232e07d3aa3d998e5135` int(11) default NULL,
- `F_fc490ca45c00b1249bbe3554a4fdf6fb` int(11) default NULL,
- `F_3295c76acbf4caaed33c36b1b5fc2cb1` int(11) default NULL,
- `F_735b90b4568125ed6c3f678819b6e058` int(11) default NULL,
- `F_a3f390d88e4c41f2747bfa2f1b5f87db` int(11) default NULL,
- `F_14bfa6bb14875e45bba028a21ed38046` int(11) default NULL,
- `F_7cbbc409ec990f19c78c75bd1e06f215` int(11) default NULL,
- `F_e2c420d928d4bf8ce0ff2ec19b371514` int(11) default NULL,
- `F_32bb90e8976aab5298d5da10fe66f21d` int(11) default NULL,
- `F_d2ddea18f00665ce8623e36bd4e3c7c5` int(11) default NULL,
- `F_ad61ab143223efbc24c7d2583be69251` int(11) default NULL,
- `F_d09bf41544a3365a46c9077ebb5e35c3` int(11) default NULL,
- `F_fbd7939d674997cdb4692d34de8633c4` int(11) default NULL,
- `F_28dd2c7955ce926456240b2ff0100bde` int(11) default NULL,
- `F_35f4a8d465e6e1edc05f3d8ab658c551` int(11) default NULL,
- `F_d1fe173d08e959397adf34b1d77e88d7` int(11) default NULL,
- `F_f033ab37c30201f73f142449d037028d` int(11) default NULL,
- `F_43ec517d68b6edd3015b3edc9a11367b` int(11) default NULL,
- `F_9778d5d219c5080b9a6a17bef029331c` int(11) default NULL,
- `F_fe9fc289c3ff0af142b6d3bead98a923` int(11) default NULL,
- `F_68d30a9594728bc39aa24be94b319d21` int(11) default NULL,
- `F_3ef815416f775098fe977004015c6193` int(11) default NULL,
- `F_93db85ed909c13838ff95ccfa94cebd9` int(11) default NULL,
- `F_c7e1249ffc03eb9ded908c236bd1996d` int(11) default NULL,
- `F_2a38a4a9316c49e5a833517c45d31070` int(11) default NULL,
- `F_7647966b7343c29048673252e490f736` int(11) default NULL,
- `F_8613985ec49eb8f757ae6439e879bb2a` int(11) default NULL,
- `F_54229abfcfa5649e7003b83dd4755294` int(11) default NULL,
- `F_92cc227532d17e56e07902b254dfad10` int(11) default NULL,
- `F_98dce83da57b0395e163467c9dae521b` int(11) default NULL,
- `F_f4b9ec30ad9f68f89b29639786cb62ef` int(11) default NULL,
- `F_812b4ba287f5ee0bc9d43bbf5bbe87fb` int(11) default NULL,
- `F_26657d5ff9020d2abefe558796b99584` int(11) default NULL,
- `F_e2ef524fbf3d9fe611d5a8e90fefdc9c` int(11) default NULL,
- `F_ed3d2c21991e3bef5e069713af9fa6ca` int(11) default NULL,
- `F_ac627ab1ccbdb62ec96e702f07f6425b` int(11) default NULL,
- `F_f899139df5e1059396431415e770c6dd` int(11) default NULL,
- `F_38b3eff8baf56627478ec76a704e9b52` int(11) default NULL,
- `F_ec8956637a99787bd197eacd77acce5e` int(11) default NULL,
- `F_6974ce5ac660610b44d9b9fed0ff9548` int(11) default NULL,
- `F_c9e1074f5b3f9fc8ea15d152add07294` int(11) default NULL,
- `F_65b9eea6e1cc6bb9f0cd2a47751a186f` int(11) default NULL,
- `F_f0935e4cd5920aa6c7c996a5ee53a70f` int(11) default NULL,
- `F_a97da629b098b75c294dffdc3e463904` int(11) default NULL,
- `F_a3c65c2974270fd093ee8a9bf8ae7d0b` int(11) default NULL,
- `F_2723d092b63885e0d7c260cc007e8b9d` int(11) default NULL,
- `F_5f93f983524def3dca464469d2cf9f3e` int(11) default NULL,
- `F_698d51a19d8a121ce581499d7b701668` int(11) default NULL,
- `F_7f6ffaa6bb0b408017b62254211691b5` int(11) default NULL,
- `F_73278a4a86960eeb576a8fd4c9ec6997` int(11) default NULL,
- `F_5fd0b37cd7dbbb00f97ba6ce92bf5add` int(11) default NULL,
- `F_2b44928ae11fb9384c4cf38708677c48` int(11) default NULL,
- `F_c45147dee729311ef5b5c3003946c48f` int(11) default NULL,
- `F_eb160de1de89d9058fcb0b968dbbbd68` int(11) default NULL,
- `F_5ef059938ba799aaa845e1c2e8a762bd` int(11) default NULL,
- `F_07e1cd7dca89a1678042477183b7ac3f` int(11) default NULL,
- `F_da4fb5c6e93e74d3df8527599fa62642` int(11) default NULL,
- `F_4c56ff4ce4aaf9573aa5dff913df997a` int(11) default NULL,
- `F_a0a080f42e6f13b3a2df133f073095dd` int(11) default NULL,
- `F_202cb962ac59075b964b07152d234b70` int(11) default NULL,
- `F_c8ffe9a587b126f152ed3d89a146b445` int(11) default NULL,
- `F_3def184ad8f4755ff269862ea77393dd` int(11) default NULL,
- `F_069059b7ef840f0c74a814ec9237b6ec` int(11) default NULL,
- `F_ec5decca5ed3d6b8079e2e7e7bacc9f2` int(11) default NULL,
- `F_76dc611d6ebaafc66cc0879c71b5db5c` int(11) default NULL,
- `F_d1f491a404d6854880943e5c3cd9ca25` int(11) default NULL,
- `F_9b8619251a19057cff70779273e95aa6` int(11) default NULL,
- `F_1afa34a7f984eeabdbb0a7d494132ee5` int(11) default NULL,
- `F_65ded5353c5ee48d0b7d48c591b8f430` int(11) default NULL,
- `F_9fc3d7152ba9336a670e36d0ed79bc43` int(11) default NULL,
- `F_02522a2b2726fb0a03bb19f2d8d9524d` int(11) default NULL,
- `F_7f1de29e6da19d22b51c68001e7e0e54` int(11) default NULL,
- `F_42a0e188f5033bc65bf8d78622277c4e` int(11) default NULL,
- `F_3988c7f88ebcb58c6ce932b957b6f332` int(11) default NULL,
- `F_013d407166ec4fa56eb1e1f8cbe183b9` int(11) default NULL,
- `F_e00da03b685a0dd18fb6a08af0923de0` int(11) default NULL,
- `F_1385974ed5904a438616ff7bdb3f7439` int(11) default NULL,
- `F_0f28b5d49b3020afeecd95b4009adf4c` int(11) default NULL,
- `F_a8baa56554f96369ab93e4f3bb068c22` int(11) default NULL,
- `F_903ce9225fca3e988c2af215d4e544d3` int(11) default NULL,
- `F_0a09c8844ba8f0936c20bd791130d6b6` int(11) default NULL,
- `F_2b24d495052a8ce66358eb576b8912c8` int(11) default NULL,
- `F_a5e00132373a7031000fd987a3c9f87b` int(11) default NULL,
- `F_8d5e957f297893487bd98fa830fa6413` int(11) default NULL,
- `F_47d1e990583c9c67424d369f3414728e` int(11) default NULL,
- `F_f2217062e9a397a1dca429e7d70bc6ca` int(11) default NULL,
- `F_7ef605fc8dba5425d6965fbd4c8fbe1f` int(11) default NULL,
- `F_a8f15eda80c50adb0e71943adc8015cf` int(11) default NULL,
- `F_37a749d808e46495a8da1e5352d03cae` int(11) default NULL,
- `F_b3e3e393c77e35a4a3f3cbd1e429b5dc` int(11) default NULL,
- `F_1d7f7abc18fcb43975065399b0d1e48e` int(11) default NULL,
- `F_2a79ea27c279e471f4d180b08d62b00a` int(11) default NULL,
- `F_1c9ac0159c94d8d0cbedc973445af2da` int(11) default NULL,
- `F_6c4b761a28b734fe93831e3fb400ce87` int(11) default NULL,
- `F_06409663226af2f3114485aa4e0a23b4` int(11) default NULL,
- `F_140f6969d5213fd0ece03148e62e461e` int(11) default NULL,
- `F_b73ce398c39f506af761d2277d853a92` int(11) default NULL,
- `F_bd4c9ab730f5513206b999ec0d90d1fb` int(11) default NULL,
- `F_82aa4b0af34c2313a562076992e50aa3` int(11) default NULL,
- `F_0777d5c17d4066b82ab86dff8a46af6f` int(11) default NULL,
- `F_fa7cdfad1a5aaf8370ebeda47a1ff1c3` int(11) default NULL,
- `F_9766527f2b5d3e95d4a733fcfb77bd7e` int(11) default NULL,
- `F_7e7757b1e12abcb736ab9a754ffb617a` int(11) default NULL,
- `F_5878a7ab84fb43402106c575658472fa` int(11) default NULL,
- `F_006f52e9102a8d3be2fe5614f42ba989` int(11) default NULL,
- `F_3636638817772e42b59d74cff571fbb3` int(11) default NULL,
- `F_149e9677a5989fd342ae44213df68868` int(11) default NULL,
- `F_a4a042cf4fd6bfb47701cbc8a1653ada` int(11) default NULL,
- `F_1ff8a7b5dc7a7d1f0ed65aaa29c04b1e` int(11) default NULL,
- `F_f7e6c85504ce6e82442c770f7c8606f0` int(11) default NULL,
- `F_bf8229696f7a3bb4700cfddef19fa23f` int(11) default NULL,
- `F_82161242827b703e6acf9c726942a1e4` int(11) default NULL,
- `F_38af86134b65d0f10fe33d30dd76442e` int(11) default NULL,
- `F_96da2f590cd7246bbde0051047b0d6f7` int(11) default NULL,
- `F_8f85517967795eeef66c225f7883bdcb` int(11) default NULL,
- `F_8f53295a73878494e9bc8dd6c3c7104f` int(11) default NULL,
- `F_045117b0e0a11a242b9765e79cbf113f` int(11) default NULL,
- `F_fc221309746013ac554571fbd180e1c8` int(11) default NULL,
- `F_4c5bde74a8f110656874902f07378009` int(11) default NULL,
- `F_cedebb6e872f539bef8c3f919874e9d7` int(11) default NULL,
- `F_6cdd60ea0045eb7a6ec44c54d29ed402` int(11) default NULL,
- `F_eecca5b6365d9607ee5a9d336962c534` int(11) default NULL,
- `F_9872ed9fc22fc182d371c3e9ed316094` int(11) default NULL,
- `F_31fefc0e570cb3860f2a6d4b38c6490d` int(11) default NULL,
- `F_9dcb88e0137649590b755372b040afad` int(11) default NULL,
- `F_a2557a7b2e94197ff767970b67041697` int(11) default NULL,
- `F_cfecdb276f634854f3ef915e2e980c31` int(11) default NULL,
- `F_0aa1883c6411f7873cb83dacb17b0afc` int(11) default NULL,
- `F_58a2fc6ed39fd083f55d4182bf88826d` int(11) default NULL,
- `F_bd686fd640be98efaae0091fa301e613` int(11) default NULL,
- `F_a597e50502f5ff68e3e25b9114205d4a` int(11) default NULL,
- `F_0336dcbab05b9d5ad24f4333c7658a0e` int(11) default NULL,
- `F_084b6fbb10729ed4da8c3d3f5a3ae7c9` int(11) default NULL,
- `F_85d8ce590ad8981ca2c8286f79f59954` int(11) default NULL,
- `F_0e65972dce68dad4d52d063967f0a705` int(11) default NULL,
- `F_84d9ee44e457ddef7f2c4f25dc8fa865` int(11) default NULL,
- `F_3644a684f98ea8fe223c713b77189a77` int(11) default NULL,
- `F_757b505cfd34c64c85ca5b5690ee5293` int(11) default NULL,
- `F_854d6fae5ee42911677c739ee1734486` int(11) default NULL,
- `F_e2c0be24560d78c5e599c2a9c9d0bbd2` int(11) default NULL,
- `F_274ad4786c3abca69fa097b85867d9a4` int(11) default NULL,
- `F_eae27d77ca20db309e056e3d2dcd7d69` int(11) default NULL,
- `F_7eabe3a1649ffa2b3ff8c02ebfd5659f` int(11) default NULL,
- `F_69adc1e107f7f7d035d7baf04342e1ca` int(11) default NULL,
- `F_091d584fced301b442654dd8c23b3fc9` int(11) default NULL,
- `F_b1d10e7bafa4421218a51b1e1f1b0ba2` int(11) default NULL,
- `F_6f3ef77ac0e3619e98159e9b6febf557` int(11) default NULL,
- `F_eb163727917cbba1eea208541a643e74` int(11) default NULL,
- `F_1534b76d325a8f591b52d302e7181331` int(11) default NULL,
- `F_979d472a84804b9f647bc185a877a8b5` int(11) default NULL,
- `F_ca46c1b9512a7a8315fa3c5a946e8265` int(11) default NULL,
- `F_3b8a614226a953a8cd9526fca6fe9ba5` int(11) default NULL,
- `F_45fbc6d3e05ebd93369ce542e8f2322d` int(11) default NULL,
- `F_63dc7ed1010d3c3b8269faf0ba7491d4` int(11) default NULL,
- `F_e96ed478dab8595a7dbda4cbcbee168f` int(11) default NULL,
- `F_c0e190d8267e36708f955d7ab048990d` int(11) default NULL,
- `F_ec8ce6abb3e952a85b8551ba726a1227` int(11) default NULL,
- `F_060ad92489947d410d897474079c1477` int(11) default NULL,
- `F_bcbe3365e6ac95ea2c0343a2395834dd` int(11) default NULL,
- `F_115f89503138416a242f40fb7d7f338e` int(11) default NULL,
- `F_13fe9d84310e77f13a6d184dbf1232f3` int(11) default NULL,
- `F_d1c38a09acc34845c6be3a127a5aacaf` int(11) default NULL,
- `F_9cfdf10e8fc047a44b08ed031e1f0ed1` int(11) default NULL,
- `F_705f2172834666788607efbfca35afb3` int(11) default NULL,
- `F_74db120f0a8e5646ef5a30154e9f6deb` int(11) default NULL,
- `F_57aeee35c98205091e18d1140e9f38cf` int(11) default NULL,
- `F_6da9003b743b65f4c0ccd295cc484e57` int(11) default NULL,
- `F_9b04d152845ec0a378394003c96da594` int(11) default NULL,
- `F_be83ab3ecd0db773eb2dc1b0a17836a1` int(11) default NULL,
- `F_e165421110ba03099a1c0393373c5b43` int(11) default NULL,
- `F_289dff07669d7a23de0ef88d2f7129e7` int(11) default NULL,
- `F_577ef1154f3240ad5b9b413aa7346a1e` int(11) default NULL,
- `F_01161aaa0b6d1345dd8fe4e481144d84` int(11) default NULL,
- `F_539fd53b59e3bb12d203f45a912eeaf2` int(11) default NULL,
- `F_ac1dd209cbcc5e5d1c6e28598e8cbbe8` int(11) default NULL,
- `F_555d6702c950ecb729a966504af0a635` int(11) default NULL,
- `F_335f5352088d7d9bf74191e006d8e24c` int(11) default NULL,
- `F_f340f1b1f65b6df5b5e3f94d95b11daf` int(11) default NULL,
- `F_e4a6222cdb5b34375400904f03d8e6a5` int(11) default NULL,
- `F_cb70ab375662576bd1ac5aaf16b3fca4` int(11) default NULL,
- `F_9188905e74c28e489b44e954ec0b9bca` int(11) default NULL,
- `F_0266e33d3f546cb5436a10798e657d97` int(11) default NULL,
- `F_38db3aed920cf82ab059bfccbd02be6a` int(11) default NULL,
- `F_3cec07e9ba5f5bb252d13f5f431e4bbb` int(11) default NULL,
- `F_621bf66ddb7c962aa0d22ac97d69b793` int(11) default NULL,
- `F_077e29b11be80ab57e1a2ecabb7da330` int(11) default NULL,
- `F_6c9882bbac1c7093bd25041881277658` int(11) default NULL,
- `F_19f3cd308f1455b3fa09a282e0d496f4` int(11) default NULL,
- `F_03c6b06952c750899bb03d998e631860` int(11) default NULL,
- `F_c24cd76e1ce41366a4bbe8a49b02a028` int(11) default NULL,
- `F_c52f1bd66cc19d05628bd8bf27af3ad6` int(11) default NULL,
- `F_fe131d7f5a6b38b23cc967316c13dae2` int(11) default NULL,
- `F_f718499c1c8cef6730f9fd03c8125cab` int(11) default NULL,
- `F_d96409bf894217686ba124d7356686c9` int(11) default NULL,
- `F_502e4a16930e414107ee22b6198c578f` int(11) default NULL,
- `F_cfa0860e83a4c3a763a7e62d825349f7` int(11) default NULL,
- `F_a4f23670e1833f3fdb077ca70bbd5d66` int(11) default NULL,
- `F_b1a59b315fc9a3002ce38bbe070ec3f5` int(11) default NULL,
- `F_36660e59856b4de58a219bcf4e27eba3` int(11) default NULL,
- `F_8c19f571e251e61cb8dd3612f26d5ecf` int(11) default NULL,
- `F_d6baf65e0b240ce177cf70da146c8dc8` int(11) default NULL,
- `F_e56954b4f6347e897f954495eab16a88` int(11) default NULL,
- `F_f7664060cc52bc6f3d620bcedc94a4b6` int(11) default NULL,
- `F_eda80a3d5b344bc40f3bc04f65b7a357` int(11) default NULL,
- `F_8f121ce07d74717e0b1f21d122e04521` int(11) default NULL,
- `F_06138bc5af6023646ede0e1f7c1eac75` int(11) default NULL,
- `F_39059724f73a9969845dfe4146c5660e` int(11) default NULL,
- `F_7f100b7b36092fb9b06dfb4fac360931` int(11) default NULL,
- `F_7a614fd06c325499f1680b9896beedeb` int(11) default NULL,
- `F_4734ba6f3de83d861c3176a6273cac6d` int(11) default NULL,
- `F_d947bf06a885db0d477d707121934ff8` int(11) default NULL,
- `F_63923f49e5241343aa7acb6a06a751e7` int(11) default NULL,
- `F_db8e1af0cb3aca1ae2d0018624204529` int(11) default NULL,
- `F_20f07591c6fcb220ffe637cda29bb3f6` int(11) default NULL,
- `F_07cdfd23373b17c6b337251c22b7ea57` int(11) default NULL,
- `F_d395771085aab05244a4fb8fd91bf4ee` int(11) default NULL,
- `F_92c8c96e4c37100777c7190b76d28233` int(11) default NULL,
- `F_e3796ae838835da0b6f6ea37bcf8bcb7` int(11) default NULL,
- `F_6a9aeddfc689c1d0e3b9ccc3ab651bc5` int(11) default NULL,
- `F_0f49c89d1e7298bb9930789c8ed59d48` int(11) default NULL,
- `F_46ba9f2a6976570b0353203ec4474217` int(11) default NULL,
- `F_0e01938fc48a2cfb5f2217fbfb00722d` int(11) default NULL,
- `F_16a5cdae362b8d27a1d8f8c7b78b4330` int(11) default NULL,
- `F_918317b57931b6b7a7d29490fe5ec9f9` int(11) default NULL,
- `F_48aedb8880cab8c45637abc7493ecddd` int(11) default NULL,
- `F_839ab46820b524afda05122893c2fe8e` int(11) default NULL,
- `F_f90f2aca5c640289d0a29417bcb63a37` int(11) default NULL,
- `F_9c838d2e45b2ad1094d42f4ef36764f6` int(11) default NULL,
- `F_1700002963a49da13542e0726b7bb758` int(11) default NULL,
- `F_53c3bce66e43be4f209556518c2fcb54` int(11) default NULL,
- `F_6883966fd8f918a4aa29be29d2c386fb` int(11) default NULL,
- `F_49182f81e6a13cf5eaa496d51fea6406` int(11) default NULL,
- `F_d296c101daa88a51f6ca8cfc1ac79b50` int(11) default NULL,
- `F_9fd81843ad7f202f26c1a174c7357585` int(11) default NULL,
- `F_26e359e83860db1d11b6acca57d8ea88` int(11) default NULL,
- `F_ef0d3930a7b6c95bd2b32ed45989c61f` int(11) default NULL,
- `F_94f6d7e04a4d452035300f18b984988c` int(11) default NULL,
- `F_34ed066df378efacc9b924ec161e7639` int(11) default NULL,
- `F_577bcc914f9e55d5e4e4f82f9f00e7d4` int(11) default NULL,
- `F_11b9842e0a271ff252c1903e7132cd68` int(11) default NULL,
- `F_37bc2f75bf1bcfe8450a1a41c200364c` int(11) default NULL,
- `F_496e05e1aea0a9c4655800e8a7b9ea28` int(11) default NULL,
- `F_b2eb7349035754953b57a32e2841bda5` int(11) default NULL,
- `F_8e98d81f8217304975ccb23337bb5761` int(11) default NULL,
- `F_a8c88a0055f636e4a163a5e3d16adab7` int(11) default NULL,
- `F_eddea82ad2755b24c4e168c5fc2ebd40` int(11) default NULL,
- `F_06eb61b839a0cefee4967c67ccb099dc` int(11) default NULL,
- `F_9dfcd5e558dfa04aaf37f137a1d9d3e5` int(11) default NULL,
- `F_950a4152c2b4aa3ad78bdd6b366cc179` int(11) default NULL,
- `F_158f3069a435b314a80bdcb024f8e422` int(11) default NULL,
- `F_758874998f5bd0c393da094e1967a72b` int(11) default NULL,
- `F_ad13a2a07ca4b7642959dc0c4c740ab6` int(11) default NULL,
- `F_3fe94a002317b5f9259f82690aeea4cd` int(11) default NULL,
- `F_5b8add2a5d98b1a652ea7fd72d942dac` int(11) default NULL,
- `F_432aca3a1e345e339f35a30c8f65edce` int(11) default NULL,
- `F_8d3bba7425e7c98c50f52ca1b52d3735` int(11) default NULL,
- `F_320722549d1751cf3f247855f937b982` int(11) default NULL,
- `F_caf1a3dfb505ffed0d024130f58c5cfa` int(11) default NULL,
- `F_5737c6ec2e0716f3d8a7a5c4e0de0d9a` int(11) default NULL,
- `F_bc6dc48b743dc5d013b1abaebd2faed2` int(11) default NULL,
- `F_f2fc990265c712c49d51a18a32b39f0c` int(11) default NULL,
- `F_89f0fd5c927d466d6ec9a21b9ac34ffa` int(11) default NULL,
- `F_a666587afda6e89aec274a3657558a27` int(11) default NULL,
- `F_b83aac23b9528732c23cc7352950e880` int(11) default NULL,
- `F_cd00692c3bfe59267d5ecfac5310286c` int(11) default NULL,
- `F_6faa8040da20ef399b63a72d0e4ab575` int(11) default NULL,
- `F_fe73f687e5bc5280214e0486b273a5f9` int(11) default NULL
+ `F_c4ca4238a0b923820dcc509a6f75849b` int(11) DEFAULT NULL,
+ `F_c81e728d9d4c2f636f067f89cc14862c` int(11) DEFAULT NULL,
+ `F_eccbc87e4b5ce2fe28308fd9f2a7baf3` int(11) DEFAULT NULL,
+ `F_a87ff679a2f3e71d9181a67b7542122c` int(11) DEFAULT NULL,
+ `F_e4da3b7fbbce2345d7772b0674a318d5` int(11) DEFAULT NULL,
+ `F_1679091c5a880faf6fb5e6087eb1b2dc` int(11) DEFAULT NULL,
+ `F_8f14e45fceea167a5a36dedd4bea2543` int(11) DEFAULT NULL,
+ `F_c9f0f895fb98ab9159f51fd0297e236d` int(11) DEFAULT NULL,
+ `F_45c48cce2e2d7fbdea1afc51c7c6ad26` int(11) DEFAULT NULL,
+ `F_d3d9446802a44259755d38e6d163e820` int(11) DEFAULT NULL,
+ `F_6512bd43d9caa6e02c990b0a82652dca` int(11) DEFAULT NULL,
+ `F_c20ad4d76fe97759aa27a0c99bff6710` int(11) DEFAULT NULL,
+ `F_c51ce410c124a10e0db5e4b97fc2af39` int(11) DEFAULT NULL,
+ `F_aab3238922bcc25a6f606eb525ffdc56` int(11) DEFAULT NULL,
+ `F_9bf31c7ff062936a96d3c8bd1f8f2ff3` int(11) DEFAULT NULL,
+ `F_c74d97b01eae257e44aa9d5bade97baf` int(11) DEFAULT NULL,
+ `F_70efdf2ec9b086079795c442636b55fb` int(11) DEFAULT NULL,
+ `F_6f4922f45568161a8cdf4ad2299f6d23` int(11) DEFAULT NULL,
+ `F_1f0e3dad99908345f7439f8ffabdffc4` int(11) DEFAULT NULL,
+ `F_98f13708210194c475687be6106a3b84` int(11) DEFAULT NULL,
+ `F_3c59dc048e8850243be8079a5c74d079` int(11) DEFAULT NULL,
+ `F_b6d767d2f8ed5d21a44b0e5886680cb9` int(11) DEFAULT NULL,
+ `F_37693cfc748049e45d87b8c7d8b9aacd` int(11) DEFAULT NULL,
+ `F_1ff1de774005f8da13f42943881c655f` int(11) DEFAULT NULL,
+ `F_8e296a067a37563370ded05f5a3bf3ec` int(11) DEFAULT NULL,
+ `F_4e732ced3463d06de0ca9a15b6153677` int(11) DEFAULT NULL,
+ `F_02e74f10e0327ad868d138f2b4fdd6f0` int(11) DEFAULT NULL,
+ `F_33e75ff09dd601bbe69f351039152189` int(11) DEFAULT NULL,
+ `F_6ea9ab1baa0efb9e19094440c317e21b` int(11) DEFAULT NULL,
+ `F_34173cb38f07f89ddbebc2ac9128303f` int(11) DEFAULT NULL,
+ `F_c16a5320fa475530d9583c34fd356ef5` int(11) DEFAULT NULL,
+ `F_6364d3f0f495b6ab9dcf8d3b5c6e0b01` int(11) DEFAULT NULL,
+ `F_182be0c5cdcd5072bb1864cdee4d3d6e` int(11) DEFAULT NULL,
+ `F_e369853df766fa44e1ed0ff613f563bd` int(11) DEFAULT NULL,
+ `F_1c383cd30b7c298ab50293adfecb7b18` int(11) DEFAULT NULL,
+ `F_19ca14e7ea6328a42e0eb13d585e4c22` int(11) DEFAULT NULL,
+ `F_a5bfc9e07964f8dddeb95fc584cd965d` int(11) DEFAULT NULL,
+ `F_a5771bce93e200c36f7cd9dfd0e5deaa` int(11) DEFAULT NULL,
+ `F_d67d8ab4f4c10bf22aa353e27879133c` int(11) DEFAULT NULL,
+ `F_d645920e395fedad7bbbed0eca3fe2e0` int(11) DEFAULT NULL,
+ `F_3416a75f4cea9109507cacd8e2f2aefc` int(11) DEFAULT NULL,
+ `F_a1d0c6e83f027327d8461063f4ac58a6` int(11) DEFAULT NULL,
+ `F_17e62166fc8586dfa4d1bc0e1742c08b` int(11) DEFAULT NULL,
+ `F_f7177163c833dff4b38fc8d2872f1ec6` int(11) DEFAULT NULL,
+ `F_6c8349cc7260ae62e3b1396831a8398f` int(11) DEFAULT NULL,
+ `F_d9d4f495e875a2e075a1a4a6e1b9770f` int(11) DEFAULT NULL,
+ `F_67c6a1e7ce56d3d6fa748ab6d9af3fd7` int(11) DEFAULT NULL,
+ `F_642e92efb79421734881b53e1e1b18b6` int(11) DEFAULT NULL,
+ `F_f457c545a9ded88f18ecee47145a72c0` int(11) DEFAULT NULL,
+ `F_c0c7c76d30bd3dcaefc96f40275bdc0a` int(11) DEFAULT NULL,
+ `F_2838023a778dfaecdc212708f721b788` int(11) DEFAULT NULL,
+ `F_9a1158154dfa42caddbd0694a4e9bdc8` int(11) DEFAULT NULL,
+ `F_d82c8d1619ad8176d665453cfb2e55f0` int(11) DEFAULT NULL,
+ `F_a684eceee76fc522773286a895bc8436` int(11) DEFAULT NULL,
+ `F_b53b3a3d6ab90ce0268229151c9bde11` int(11) DEFAULT NULL,
+ `F_9f61408e3afb633e50cdf1b20de6f466` int(11) DEFAULT NULL,
+ `F_72b32a1f754ba1c09b3695e0cb6cde7f` int(11) DEFAULT NULL,
+ `F_66f041e16a60928b05a7e228a89c3799` int(11) DEFAULT NULL,
+ `F_093f65e080a295f8076b1c5722a46aa2` int(11) DEFAULT NULL,
+ `F_072b030ba126b2f4b2374f342be9ed44` int(11) DEFAULT NULL,
+ `F_7f39f8317fbdb1988ef4c628eba02591` int(11) DEFAULT NULL,
+ `F_44f683a84163b3523afe57c2e008bc8c` int(11) DEFAULT NULL,
+ `F_03afdbd66e7929b125f8597834fa83a4` int(11) DEFAULT NULL,
+ `F_ea5d2f1c4608232e07d3aa3d998e5135` int(11) DEFAULT NULL,
+ `F_fc490ca45c00b1249bbe3554a4fdf6fb` int(11) DEFAULT NULL,
+ `F_3295c76acbf4caaed33c36b1b5fc2cb1` int(11) DEFAULT NULL,
+ `F_735b90b4568125ed6c3f678819b6e058` int(11) DEFAULT NULL,
+ `F_a3f390d88e4c41f2747bfa2f1b5f87db` int(11) DEFAULT NULL,
+ `F_14bfa6bb14875e45bba028a21ed38046` int(11) DEFAULT NULL,
+ `F_7cbbc409ec990f19c78c75bd1e06f215` int(11) DEFAULT NULL,
+ `F_e2c420d928d4bf8ce0ff2ec19b371514` int(11) DEFAULT NULL,
+ `F_32bb90e8976aab5298d5da10fe66f21d` int(11) DEFAULT NULL,
+ `F_d2ddea18f00665ce8623e36bd4e3c7c5` int(11) DEFAULT NULL,
+ `F_ad61ab143223efbc24c7d2583be69251` int(11) DEFAULT NULL,
+ `F_d09bf41544a3365a46c9077ebb5e35c3` int(11) DEFAULT NULL,
+ `F_fbd7939d674997cdb4692d34de8633c4` int(11) DEFAULT NULL,
+ `F_28dd2c7955ce926456240b2ff0100bde` int(11) DEFAULT NULL,
+ `F_35f4a8d465e6e1edc05f3d8ab658c551` int(11) DEFAULT NULL,
+ `F_d1fe173d08e959397adf34b1d77e88d7` int(11) DEFAULT NULL,
+ `F_f033ab37c30201f73f142449d037028d` int(11) DEFAULT NULL,
+ `F_43ec517d68b6edd3015b3edc9a11367b` int(11) DEFAULT NULL,
+ `F_9778d5d219c5080b9a6a17bef029331c` int(11) DEFAULT NULL,
+ `F_fe9fc289c3ff0af142b6d3bead98a923` int(11) DEFAULT NULL,
+ `F_68d30a9594728bc39aa24be94b319d21` int(11) DEFAULT NULL,
+ `F_3ef815416f775098fe977004015c6193` int(11) DEFAULT NULL,
+ `F_93db85ed909c13838ff95ccfa94cebd9` int(11) DEFAULT NULL,
+ `F_c7e1249ffc03eb9ded908c236bd1996d` int(11) DEFAULT NULL,
+ `F_2a38a4a9316c49e5a833517c45d31070` int(11) DEFAULT NULL,
+ `F_7647966b7343c29048673252e490f736` int(11) DEFAULT NULL,
+ `F_8613985ec49eb8f757ae6439e879bb2a` int(11) DEFAULT NULL,
+ `F_54229abfcfa5649e7003b83dd4755294` int(11) DEFAULT NULL,
+ `F_92cc227532d17e56e07902b254dfad10` int(11) DEFAULT NULL,
+ `F_98dce83da57b0395e163467c9dae521b` int(11) DEFAULT NULL,
+ `F_f4b9ec30ad9f68f89b29639786cb62ef` int(11) DEFAULT NULL,
+ `F_812b4ba287f5ee0bc9d43bbf5bbe87fb` int(11) DEFAULT NULL,
+ `F_26657d5ff9020d2abefe558796b99584` int(11) DEFAULT NULL,
+ `F_e2ef524fbf3d9fe611d5a8e90fefdc9c` int(11) DEFAULT NULL,
+ `F_ed3d2c21991e3bef5e069713af9fa6ca` int(11) DEFAULT NULL,
+ `F_ac627ab1ccbdb62ec96e702f07f6425b` int(11) DEFAULT NULL,
+ `F_f899139df5e1059396431415e770c6dd` int(11) DEFAULT NULL,
+ `F_38b3eff8baf56627478ec76a704e9b52` int(11) DEFAULT NULL,
+ `F_ec8956637a99787bd197eacd77acce5e` int(11) DEFAULT NULL,
+ `F_6974ce5ac660610b44d9b9fed0ff9548` int(11) DEFAULT NULL,
+ `F_c9e1074f5b3f9fc8ea15d152add07294` int(11) DEFAULT NULL,
+ `F_65b9eea6e1cc6bb9f0cd2a47751a186f` int(11) DEFAULT NULL,
+ `F_f0935e4cd5920aa6c7c996a5ee53a70f` int(11) DEFAULT NULL,
+ `F_a97da629b098b75c294dffdc3e463904` int(11) DEFAULT NULL,
+ `F_a3c65c2974270fd093ee8a9bf8ae7d0b` int(11) DEFAULT NULL,
+ `F_2723d092b63885e0d7c260cc007e8b9d` int(11) DEFAULT NULL,
+ `F_5f93f983524def3dca464469d2cf9f3e` int(11) DEFAULT NULL,
+ `F_698d51a19d8a121ce581499d7b701668` int(11) DEFAULT NULL,
+ `F_7f6ffaa6bb0b408017b62254211691b5` int(11) DEFAULT NULL,
+ `F_73278a4a86960eeb576a8fd4c9ec6997` int(11) DEFAULT NULL,
+ `F_5fd0b37cd7dbbb00f97ba6ce92bf5add` int(11) DEFAULT NULL,
+ `F_2b44928ae11fb9384c4cf38708677c48` int(11) DEFAULT NULL,
+ `F_c45147dee729311ef5b5c3003946c48f` int(11) DEFAULT NULL,
+ `F_eb160de1de89d9058fcb0b968dbbbd68` int(11) DEFAULT NULL,
+ `F_5ef059938ba799aaa845e1c2e8a762bd` int(11) DEFAULT NULL,
+ `F_07e1cd7dca89a1678042477183b7ac3f` int(11) DEFAULT NULL,
+ `F_da4fb5c6e93e74d3df8527599fa62642` int(11) DEFAULT NULL,
+ `F_4c56ff4ce4aaf9573aa5dff913df997a` int(11) DEFAULT NULL,
+ `F_a0a080f42e6f13b3a2df133f073095dd` int(11) DEFAULT NULL,
+ `F_202cb962ac59075b964b07152d234b70` int(11) DEFAULT NULL,
+ `F_c8ffe9a587b126f152ed3d89a146b445` int(11) DEFAULT NULL,
+ `F_3def184ad8f4755ff269862ea77393dd` int(11) DEFAULT NULL,
+ `F_069059b7ef840f0c74a814ec9237b6ec` int(11) DEFAULT NULL,
+ `F_ec5decca5ed3d6b8079e2e7e7bacc9f2` int(11) DEFAULT NULL,
+ `F_76dc611d6ebaafc66cc0879c71b5db5c` int(11) DEFAULT NULL,
+ `F_d1f491a404d6854880943e5c3cd9ca25` int(11) DEFAULT NULL,
+ `F_9b8619251a19057cff70779273e95aa6` int(11) DEFAULT NULL,
+ `F_1afa34a7f984eeabdbb0a7d494132ee5` int(11) DEFAULT NULL,
+ `F_65ded5353c5ee48d0b7d48c591b8f430` int(11) DEFAULT NULL,
+ `F_9fc3d7152ba9336a670e36d0ed79bc43` int(11) DEFAULT NULL,
+ `F_02522a2b2726fb0a03bb19f2d8d9524d` int(11) DEFAULT NULL,
+ `F_7f1de29e6da19d22b51c68001e7e0e54` int(11) DEFAULT NULL,
+ `F_42a0e188f5033bc65bf8d78622277c4e` int(11) DEFAULT NULL,
+ `F_3988c7f88ebcb58c6ce932b957b6f332` int(11) DEFAULT NULL,
+ `F_013d407166ec4fa56eb1e1f8cbe183b9` int(11) DEFAULT NULL,
+ `F_e00da03b685a0dd18fb6a08af0923de0` int(11) DEFAULT NULL,
+ `F_1385974ed5904a438616ff7bdb3f7439` int(11) DEFAULT NULL,
+ `F_0f28b5d49b3020afeecd95b4009adf4c` int(11) DEFAULT NULL,
+ `F_a8baa56554f96369ab93e4f3bb068c22` int(11) DEFAULT NULL,
+ `F_903ce9225fca3e988c2af215d4e544d3` int(11) DEFAULT NULL,
+ `F_0a09c8844ba8f0936c20bd791130d6b6` int(11) DEFAULT NULL,
+ `F_2b24d495052a8ce66358eb576b8912c8` int(11) DEFAULT NULL,
+ `F_a5e00132373a7031000fd987a3c9f87b` int(11) DEFAULT NULL,
+ `F_8d5e957f297893487bd98fa830fa6413` int(11) DEFAULT NULL,
+ `F_47d1e990583c9c67424d369f3414728e` int(11) DEFAULT NULL,
+ `F_f2217062e9a397a1dca429e7d70bc6ca` int(11) DEFAULT NULL,
+ `F_7ef605fc8dba5425d6965fbd4c8fbe1f` int(11) DEFAULT NULL,
+ `F_a8f15eda80c50adb0e71943adc8015cf` int(11) DEFAULT NULL,
+ `F_37a749d808e46495a8da1e5352d03cae` int(11) DEFAULT NULL,
+ `F_b3e3e393c77e35a4a3f3cbd1e429b5dc` int(11) DEFAULT NULL,
+ `F_1d7f7abc18fcb43975065399b0d1e48e` int(11) DEFAULT NULL,
+ `F_2a79ea27c279e471f4d180b08d62b00a` int(11) DEFAULT NULL,
+ `F_1c9ac0159c94d8d0cbedc973445af2da` int(11) DEFAULT NULL,
+ `F_6c4b761a28b734fe93831e3fb400ce87` int(11) DEFAULT NULL,
+ `F_06409663226af2f3114485aa4e0a23b4` int(11) DEFAULT NULL,
+ `F_140f6969d5213fd0ece03148e62e461e` int(11) DEFAULT NULL,
+ `F_b73ce398c39f506af761d2277d853a92` int(11) DEFAULT NULL,
+ `F_bd4c9ab730f5513206b999ec0d90d1fb` int(11) DEFAULT NULL,
+ `F_82aa4b0af34c2313a562076992e50aa3` int(11) DEFAULT NULL,
+ `F_0777d5c17d4066b82ab86dff8a46af6f` int(11) DEFAULT NULL,
+ `F_fa7cdfad1a5aaf8370ebeda47a1ff1c3` int(11) DEFAULT NULL,
+ `F_9766527f2b5d3e95d4a733fcfb77bd7e` int(11) DEFAULT NULL,
+ `F_7e7757b1e12abcb736ab9a754ffb617a` int(11) DEFAULT NULL,
+ `F_5878a7ab84fb43402106c575658472fa` int(11) DEFAULT NULL,
+ `F_006f52e9102a8d3be2fe5614f42ba989` int(11) DEFAULT NULL,
+ `F_3636638817772e42b59d74cff571fbb3` int(11) DEFAULT NULL,
+ `F_149e9677a5989fd342ae44213df68868` int(11) DEFAULT NULL,
+ `F_a4a042cf4fd6bfb47701cbc8a1653ada` int(11) DEFAULT NULL,
+ `F_1ff8a7b5dc7a7d1f0ed65aaa29c04b1e` int(11) DEFAULT NULL,
+ `F_f7e6c85504ce6e82442c770f7c8606f0` int(11) DEFAULT NULL,
+ `F_bf8229696f7a3bb4700cfddef19fa23f` int(11) DEFAULT NULL,
+ `F_82161242827b703e6acf9c726942a1e4` int(11) DEFAULT NULL,
+ `F_38af86134b65d0f10fe33d30dd76442e` int(11) DEFAULT NULL,
+ `F_96da2f590cd7246bbde0051047b0d6f7` int(11) DEFAULT NULL,
+ `F_8f85517967795eeef66c225f7883bdcb` int(11) DEFAULT NULL,
+ `F_8f53295a73878494e9bc8dd6c3c7104f` int(11) DEFAULT NULL,
+ `F_045117b0e0a11a242b9765e79cbf113f` int(11) DEFAULT NULL,
+ `F_fc221309746013ac554571fbd180e1c8` int(11) DEFAULT NULL,
+ `F_4c5bde74a8f110656874902f07378009` int(11) DEFAULT NULL,
+ `F_cedebb6e872f539bef8c3f919874e9d7` int(11) DEFAULT NULL,
+ `F_6cdd60ea0045eb7a6ec44c54d29ed402` int(11) DEFAULT NULL,
+ `F_eecca5b6365d9607ee5a9d336962c534` int(11) DEFAULT NULL,
+ `F_9872ed9fc22fc182d371c3e9ed316094` int(11) DEFAULT NULL,
+ `F_31fefc0e570cb3860f2a6d4b38c6490d` int(11) DEFAULT NULL,
+ `F_9dcb88e0137649590b755372b040afad` int(11) DEFAULT NULL,
+ `F_a2557a7b2e94197ff767970b67041697` int(11) DEFAULT NULL,
+ `F_cfecdb276f634854f3ef915e2e980c31` int(11) DEFAULT NULL,
+ `F_0aa1883c6411f7873cb83dacb17b0afc` int(11) DEFAULT NULL,
+ `F_58a2fc6ed39fd083f55d4182bf88826d` int(11) DEFAULT NULL,
+ `F_bd686fd640be98efaae0091fa301e613` int(11) DEFAULT NULL,
+ `F_a597e50502f5ff68e3e25b9114205d4a` int(11) DEFAULT NULL,
+ `F_0336dcbab05b9d5ad24f4333c7658a0e` int(11) DEFAULT NULL,
+ `F_084b6fbb10729ed4da8c3d3f5a3ae7c9` int(11) DEFAULT NULL,
+ `F_85d8ce590ad8981ca2c8286f79f59954` int(11) DEFAULT NULL,
+ `F_0e65972dce68dad4d52d063967f0a705` int(11) DEFAULT NULL,
+ `F_84d9ee44e457ddef7f2c4f25dc8fa865` int(11) DEFAULT NULL,
+ `F_3644a684f98ea8fe223c713b77189a77` int(11) DEFAULT NULL,
+ `F_757b505cfd34c64c85ca5b5690ee5293` int(11) DEFAULT NULL,
+ `F_854d6fae5ee42911677c739ee1734486` int(11) DEFAULT NULL,
+ `F_e2c0be24560d78c5e599c2a9c9d0bbd2` int(11) DEFAULT NULL,
+ `F_274ad4786c3abca69fa097b85867d9a4` int(11) DEFAULT NULL,
+ `F_eae27d77ca20db309e056e3d2dcd7d69` int(11) DEFAULT NULL,
+ `F_7eabe3a1649ffa2b3ff8c02ebfd5659f` int(11) DEFAULT NULL,
+ `F_69adc1e107f7f7d035d7baf04342e1ca` int(11) DEFAULT NULL,
+ `F_091d584fced301b442654dd8c23b3fc9` int(11) DEFAULT NULL,
+ `F_b1d10e7bafa4421218a51b1e1f1b0ba2` int(11) DEFAULT NULL,
+ `F_6f3ef77ac0e3619e98159e9b6febf557` int(11) DEFAULT NULL,
+ `F_eb163727917cbba1eea208541a643e74` int(11) DEFAULT NULL,
+ `F_1534b76d325a8f591b52d302e7181331` int(11) DEFAULT NULL,
+ `F_979d472a84804b9f647bc185a877a8b5` int(11) DEFAULT NULL,
+ `F_ca46c1b9512a7a8315fa3c5a946e8265` int(11) DEFAULT NULL,
+ `F_3b8a614226a953a8cd9526fca6fe9ba5` int(11) DEFAULT NULL,
+ `F_45fbc6d3e05ebd93369ce542e8f2322d` int(11) DEFAULT NULL,
+ `F_63dc7ed1010d3c3b8269faf0ba7491d4` int(11) DEFAULT NULL,
+ `F_e96ed478dab8595a7dbda4cbcbee168f` int(11) DEFAULT NULL,
+ `F_c0e190d8267e36708f955d7ab048990d` int(11) DEFAULT NULL,
+ `F_ec8ce6abb3e952a85b8551ba726a1227` int(11) DEFAULT NULL,
+ `F_060ad92489947d410d897474079c1477` int(11) DEFAULT NULL,
+ `F_bcbe3365e6ac95ea2c0343a2395834dd` int(11) DEFAULT NULL,
+ `F_115f89503138416a242f40fb7d7f338e` int(11) DEFAULT NULL,
+ `F_13fe9d84310e77f13a6d184dbf1232f3` int(11) DEFAULT NULL,
+ `F_d1c38a09acc34845c6be3a127a5aacaf` int(11) DEFAULT NULL,
+ `F_9cfdf10e8fc047a44b08ed031e1f0ed1` int(11) DEFAULT NULL,
+ `F_705f2172834666788607efbfca35afb3` int(11) DEFAULT NULL,
+ `F_74db120f0a8e5646ef5a30154e9f6deb` int(11) DEFAULT NULL,
+ `F_57aeee35c98205091e18d1140e9f38cf` int(11) DEFAULT NULL,
+ `F_6da9003b743b65f4c0ccd295cc484e57` int(11) DEFAULT NULL,
+ `F_9b04d152845ec0a378394003c96da594` int(11) DEFAULT NULL,
+ `F_be83ab3ecd0db773eb2dc1b0a17836a1` int(11) DEFAULT NULL,
+ `F_e165421110ba03099a1c0393373c5b43` int(11) DEFAULT NULL,
+ `F_289dff07669d7a23de0ef88d2f7129e7` int(11) DEFAULT NULL,
+ `F_577ef1154f3240ad5b9b413aa7346a1e` int(11) DEFAULT NULL,
+ `F_01161aaa0b6d1345dd8fe4e481144d84` int(11) DEFAULT NULL,
+ `F_539fd53b59e3bb12d203f45a912eeaf2` int(11) DEFAULT NULL,
+ `F_ac1dd209cbcc5e5d1c6e28598e8cbbe8` int(11) DEFAULT NULL,
+ `F_555d6702c950ecb729a966504af0a635` int(11) DEFAULT NULL,
+ `F_335f5352088d7d9bf74191e006d8e24c` int(11) DEFAULT NULL,
+ `F_f340f1b1f65b6df5b5e3f94d95b11daf` int(11) DEFAULT NULL,
+ `F_e4a6222cdb5b34375400904f03d8e6a5` int(11) DEFAULT NULL,
+ `F_cb70ab375662576bd1ac5aaf16b3fca4` int(11) DEFAULT NULL,
+ `F_9188905e74c28e489b44e954ec0b9bca` int(11) DEFAULT NULL,
+ `F_0266e33d3f546cb5436a10798e657d97` int(11) DEFAULT NULL,
+ `F_38db3aed920cf82ab059bfccbd02be6a` int(11) DEFAULT NULL,
+ `F_3cec07e9ba5f5bb252d13f5f431e4bbb` int(11) DEFAULT NULL,
+ `F_621bf66ddb7c962aa0d22ac97d69b793` int(11) DEFAULT NULL,
+ `F_077e29b11be80ab57e1a2ecabb7da330` int(11) DEFAULT NULL,
+ `F_6c9882bbac1c7093bd25041881277658` int(11) DEFAULT NULL,
+ `F_19f3cd308f1455b3fa09a282e0d496f4` int(11) DEFAULT NULL,
+ `F_03c6b06952c750899bb03d998e631860` int(11) DEFAULT NULL,
+ `F_c24cd76e1ce41366a4bbe8a49b02a028` int(11) DEFAULT NULL,
+ `F_c52f1bd66cc19d05628bd8bf27af3ad6` int(11) DEFAULT NULL,
+ `F_fe131d7f5a6b38b23cc967316c13dae2` int(11) DEFAULT NULL,
+ `F_f718499c1c8cef6730f9fd03c8125cab` int(11) DEFAULT NULL,
+ `F_d96409bf894217686ba124d7356686c9` int(11) DEFAULT NULL,
+ `F_502e4a16930e414107ee22b6198c578f` int(11) DEFAULT NULL,
+ `F_cfa0860e83a4c3a763a7e62d825349f7` int(11) DEFAULT NULL,
+ `F_a4f23670e1833f3fdb077ca70bbd5d66` int(11) DEFAULT NULL,
+ `F_b1a59b315fc9a3002ce38bbe070ec3f5` int(11) DEFAULT NULL,
+ `F_36660e59856b4de58a219bcf4e27eba3` int(11) DEFAULT NULL,
+ `F_8c19f571e251e61cb8dd3612f26d5ecf` int(11) DEFAULT NULL,
+ `F_d6baf65e0b240ce177cf70da146c8dc8` int(11) DEFAULT NULL,
+ `F_e56954b4f6347e897f954495eab16a88` int(11) DEFAULT NULL,
+ `F_f7664060cc52bc6f3d620bcedc94a4b6` int(11) DEFAULT NULL,
+ `F_eda80a3d5b344bc40f3bc04f65b7a357` int(11) DEFAULT NULL,
+ `F_8f121ce07d74717e0b1f21d122e04521` int(11) DEFAULT NULL,
+ `F_06138bc5af6023646ede0e1f7c1eac75` int(11) DEFAULT NULL,
+ `F_39059724f73a9969845dfe4146c5660e` int(11) DEFAULT NULL,
+ `F_7f100b7b36092fb9b06dfb4fac360931` int(11) DEFAULT NULL,
+ `F_7a614fd06c325499f1680b9896beedeb` int(11) DEFAULT NULL,
+ `F_4734ba6f3de83d861c3176a6273cac6d` int(11) DEFAULT NULL,
+ `F_d947bf06a885db0d477d707121934ff8` int(11) DEFAULT NULL,
+ `F_63923f49e5241343aa7acb6a06a751e7` int(11) DEFAULT NULL,
+ `F_db8e1af0cb3aca1ae2d0018624204529` int(11) DEFAULT NULL,
+ `F_20f07591c6fcb220ffe637cda29bb3f6` int(11) DEFAULT NULL,
+ `F_07cdfd23373b17c6b337251c22b7ea57` int(11) DEFAULT NULL,
+ `F_d395771085aab05244a4fb8fd91bf4ee` int(11) DEFAULT NULL,
+ `F_92c8c96e4c37100777c7190b76d28233` int(11) DEFAULT NULL,
+ `F_e3796ae838835da0b6f6ea37bcf8bcb7` int(11) DEFAULT NULL,
+ `F_6a9aeddfc689c1d0e3b9ccc3ab651bc5` int(11) DEFAULT NULL,
+ `F_0f49c89d1e7298bb9930789c8ed59d48` int(11) DEFAULT NULL,
+ `F_46ba9f2a6976570b0353203ec4474217` int(11) DEFAULT NULL,
+ `F_0e01938fc48a2cfb5f2217fbfb00722d` int(11) DEFAULT NULL,
+ `F_16a5cdae362b8d27a1d8f8c7b78b4330` int(11) DEFAULT NULL,
+ `F_918317b57931b6b7a7d29490fe5ec9f9` int(11) DEFAULT NULL,
+ `F_48aedb8880cab8c45637abc7493ecddd` int(11) DEFAULT NULL,
+ `F_839ab46820b524afda05122893c2fe8e` int(11) DEFAULT NULL,
+ `F_f90f2aca5c640289d0a29417bcb63a37` int(11) DEFAULT NULL,
+ `F_9c838d2e45b2ad1094d42f4ef36764f6` int(11) DEFAULT NULL,
+ `F_1700002963a49da13542e0726b7bb758` int(11) DEFAULT NULL,
+ `F_53c3bce66e43be4f209556518c2fcb54` int(11) DEFAULT NULL,
+ `F_6883966fd8f918a4aa29be29d2c386fb` int(11) DEFAULT NULL,
+ `F_49182f81e6a13cf5eaa496d51fea6406` int(11) DEFAULT NULL,
+ `F_d296c101daa88a51f6ca8cfc1ac79b50` int(11) DEFAULT NULL,
+ `F_9fd81843ad7f202f26c1a174c7357585` int(11) DEFAULT NULL,
+ `F_26e359e83860db1d11b6acca57d8ea88` int(11) DEFAULT NULL,
+ `F_ef0d3930a7b6c95bd2b32ed45989c61f` int(11) DEFAULT NULL,
+ `F_94f6d7e04a4d452035300f18b984988c` int(11) DEFAULT NULL,
+ `F_34ed066df378efacc9b924ec161e7639` int(11) DEFAULT NULL,
+ `F_577bcc914f9e55d5e4e4f82f9f00e7d4` int(11) DEFAULT NULL,
+ `F_11b9842e0a271ff252c1903e7132cd68` int(11) DEFAULT NULL,
+ `F_37bc2f75bf1bcfe8450a1a41c200364c` int(11) DEFAULT NULL,
+ `F_496e05e1aea0a9c4655800e8a7b9ea28` int(11) DEFAULT NULL,
+ `F_b2eb7349035754953b57a32e2841bda5` int(11) DEFAULT NULL,
+ `F_8e98d81f8217304975ccb23337bb5761` int(11) DEFAULT NULL,
+ `F_a8c88a0055f636e4a163a5e3d16adab7` int(11) DEFAULT NULL,
+ `F_eddea82ad2755b24c4e168c5fc2ebd40` int(11) DEFAULT NULL,
+ `F_06eb61b839a0cefee4967c67ccb099dc` int(11) DEFAULT NULL,
+ `F_9dfcd5e558dfa04aaf37f137a1d9d3e5` int(11) DEFAULT NULL,
+ `F_950a4152c2b4aa3ad78bdd6b366cc179` int(11) DEFAULT NULL,
+ `F_158f3069a435b314a80bdcb024f8e422` int(11) DEFAULT NULL,
+ `F_758874998f5bd0c393da094e1967a72b` int(11) DEFAULT NULL,
+ `F_ad13a2a07ca4b7642959dc0c4c740ab6` int(11) DEFAULT NULL,
+ `F_3fe94a002317b5f9259f82690aeea4cd` int(11) DEFAULT NULL,
+ `F_5b8add2a5d98b1a652ea7fd72d942dac` int(11) DEFAULT NULL,
+ `F_432aca3a1e345e339f35a30c8f65edce` int(11) DEFAULT NULL,
+ `F_8d3bba7425e7c98c50f52ca1b52d3735` int(11) DEFAULT NULL,
+ `F_320722549d1751cf3f247855f937b982` int(11) DEFAULT NULL,
+ `F_caf1a3dfb505ffed0d024130f58c5cfa` int(11) DEFAULT NULL,
+ `F_5737c6ec2e0716f3d8a7a5c4e0de0d9a` int(11) DEFAULT NULL,
+ `F_bc6dc48b743dc5d013b1abaebd2faed2` int(11) DEFAULT NULL,
+ `F_f2fc990265c712c49d51a18a32b39f0c` int(11) DEFAULT NULL,
+ `F_89f0fd5c927d466d6ec9a21b9ac34ffa` int(11) DEFAULT NULL,
+ `F_a666587afda6e89aec274a3657558a27` int(11) DEFAULT NULL,
+ `F_b83aac23b9528732c23cc7352950e880` int(11) DEFAULT NULL,
+ `F_cd00692c3bfe59267d5ecfac5310286c` int(11) DEFAULT NULL,
+ `F_6faa8040da20ef399b63a72d0e4ab575` int(11) DEFAULT NULL,
+ `F_fe73f687e5bc5280214e0486b273a5f9` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
@@ -1444,7 +1445,7 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
@@ -1485,11 +1486,11 @@ INSERT INTO t2 VALUES (1), (2);
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `t2`;
CREATE TABLE `t2` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -1514,11 +1515,11 @@ CREATE TABLE `t2` (
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `t2`;
CREATE TABLE `t2` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -1593,7 +1594,7 @@ mysqldump: Couldn't find table: "T_"
test_sequence
------ Testing with illegal database names ------
mysqldump: Got error: 1049: Unknown database 'mysqldump_test_d' when selecting the database
-mysqldump: Got error: 1102: Incorrect database name 'mysqld\ump_test_db' when selecting the database
+mysqldump: Got error: 1049: Unknown database 'mysqld\ump_test_db' when selecting the database
drop table t1, t2, t3;
drop database mysqldump_test_db;
use test;
@@ -1693,9 +1694,9 @@ bla 1002
show create table `t1`;
Table Create Table
t1 CREATE TABLE `t1` (
- `t1_name` varchar(255) default NULL,
- `t1_id` int(10) unsigned NOT NULL auto_increment,
- PRIMARY KEY (`t1_id`),
+ `t1_name` varchar(255) DEFAULT NULL,
+ `t1_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`t1_id`),
KEY `t1_name` (`t1_name`)
) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1
DROP TABLE `t1`;
@@ -1707,9 +1708,9 @@ bla 1002
show create table `t1`;
Table Create Table
t1 CREATE TABLE `t1` (
- `t1_name` varchar(255) default NULL,
- `t1_id` int(10) unsigned NOT NULL auto_increment,
- PRIMARY KEY (`t1_id`),
+ `t1_name` varchar(255) DEFAULT NULL,
+ `t1_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`t1_id`),
KEY `t1_name` (`t1_name`)
) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1
drop table `t1`;
@@ -1732,15 +1733,15 @@ create table t3(a int);
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t3`;
CREATE TABLE `t3` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `t2`;
CREATE TABLE `t2` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -1772,7 +1773,7 @@ mysqldump: Got error: 1064: You have an error in your SQL syntax; check the manu
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -1815,7 +1816,7 @@ create view v2 as select * from t2 where a like 'a%' with check option;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t2`;
CREATE TABLE `t2` (
- `a` varchar(30) default NULL,
+ `a` varchar(30) DEFAULT NULL,
KEY `a` (`a`(5))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@@ -1881,6 +1882,9 @@ a b
drop table t1, t2;
drop database db1;
use test;
+#
+# dump of view
+#
create table t1(a int);
create view v1 as select * from t1;
@@ -1896,7 +1900,7 @@ create view v1 as select * from t1;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
@@ -1953,7 +1957,7 @@ create view v2 as select * from t2 where a like 'a%' with check option;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t2`;
CREATE TABLE `t2` (
- `a` varchar(30) default NULL,
+ `a` varchar(30) DEFAULT NULL,
KEY `a` (`a`(5))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@@ -2005,7 +2009,7 @@ INSERT INTO t1 VALUES ('\'');
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` char(10) default NULL
+ `a` char(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
@@ -2048,9 +2052,9 @@ select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` int(11) default NULL,
- `b` int(11) default NULL,
- `c` varchar(30) default NULL
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` varchar(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
@@ -2168,8 +2172,8 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` int(11) default NULL,
- `b` bigint(20) default NULL
+ `a` int(11) DEFAULT NULL,
+ `b` bigint(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
@@ -2204,7 +2208,7 @@ DELIMITER ;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
DROP TABLE IF EXISTS `t2`;
CREATE TABLE `t2` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t2` WRITE;
@@ -2250,8 +2254,8 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` int(11) default NULL,
- `b` bigint(20) default NULL
+ `a` int(11) DEFAULT NULL,
+ `b` bigint(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
@@ -2261,7 +2265,7 @@ INSERT INTO `t1` VALUES (1,NULL),(2,NULL),(4,NULL),(11,NULL);
UNLOCK TABLES;
DROP TABLE IF EXISTS `t2`;
CREATE TABLE `t2` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t2` WRITE;
@@ -2358,7 +2362,7 @@ INSERT INTO t1 VALUES(1), (2), (3), (4), (5);
CREATE FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11) RETURN a+b //
CREATE PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT)
BEGIN SELECT a+b INTO c; end //
-create function bug9056_func2(f1 char binary) returns char binary
+create function bug9056_func2(f1 char binary) returns char
begin
set f1= concat( 'hello', f1 );
return f1;
@@ -2387,7 +2391,7 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `id` int(11) default NULL
+ `id` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
@@ -2477,7 +2481,7 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `d` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+ `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY `d` (`d`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@@ -2511,7 +2515,7 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `d` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+ `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY `d` (`d`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@@ -2561,7 +2565,7 @@ a2
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS "t1 test";
CREATE TABLE "t1 test" (
- "a1" int(11) default NULL
+ "a1" int(11) DEFAULT NULL
);
LOCK TABLES "t1 test" WRITE;
@@ -2580,7 +2584,7 @@ DELIMITER ;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
DROP TABLE IF EXISTS "t2 test";
CREATE TABLE "t2 test" (
- "a2" int(11) default NULL
+ "a2" int(11) DEFAULT NULL
);
LOCK TABLES "t2 test" WRITE;
@@ -2631,9 +2635,9 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` int(11) default NULL,
- `b` varchar(32) default NULL,
- `c` varchar(32) default NULL
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(32) DEFAULT NULL,
+ `c` varchar(32) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
@@ -2723,7 +2727,7 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` int(11) default NULL
+ `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
@@ -2770,7 +2774,7 @@ insert into t1 values ('','');
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` binary(1) default NULL,
+ `a` binary(1) DEFAULT NULL,
`b` blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@@ -2802,7 +2806,7 @@ UNLOCK TABLES;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` binary(1) default NULL,
+ `a` binary(1) DEFAULT NULL,
`b` blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@@ -2958,7 +2962,7 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_test_db` /*!40100 DEFAULT CH
USE `mysqldump_test_db`;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `id` int(11) default NULL
+ `id` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
@@ -3005,8 +3009,8 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_tables` /*!40100 DEFAULT CHA
USE `mysqldump_tables`;
CREATE TABLE `basetable` (
- `id` bigint(20) unsigned NOT NULL auto_increment,
- `tag` varchar(64) default NULL,
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `tag` varchar(64) DEFAULT NULL,
UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@@ -3074,11 +3078,6 @@ grant RELOAD on *.* to mysqltest_1@localhost;
mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SUPER,REPLICATION CLIENT privilege for this operation (1227)
mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SUPER,REPLICATION CLIENT privilege for this operation (1227)
grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
-CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=537;
-CREATE TABLE `t1` (
- `a` int(11) default NULL,
- `b` varchar(34) default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
drop table t1;
drop user mysqltest_1@localhost;
#
@@ -3123,6 +3122,7 @@ revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
drop user myDB_User@localhost;
drop database mysqldump_myDB;
use test;
+
#
# BUG#13926: --order-by-primary fails if PKEY contains quote character
#
@@ -3142,10 +3142,10 @@ insert into t1 values (0815, 4711, 2006);
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS "t1";
CREATE TABLE "t1" (
- "a b" int(11) NOT NULL default '0',
- "c""d" int(11) NOT NULL default '0',
- "e`f" int(11) NOT NULL default '0',
- PRIMARY KEY ("a b","c""d","e`f")
+ "a b" int(11) NOT NULL DEFAULT '0',
+ "c""d" int(11) NOT NULL DEFAULT '0',
+ "e`f" int(11) NOT NULL DEFAULT '0',
+ PRIMARY KEY ("a b","c""d","e`f")
);
LOCK TABLES "t1" WRITE;
@@ -3173,10 +3173,10 @@ UNLOCK TABLES;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a b` int(11) NOT NULL default '0',
- `c"d` int(11) NOT NULL default '0',
- `e``f` int(11) NOT NULL default '0',
- PRIMARY KEY (`a b`,`c"d`,`e``f`)
+ `a b` int(11) NOT NULL DEFAULT '0',
+ `c"d` int(11) NOT NULL DEFAULT '0',
+ `e``f` int(11) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`a b`,`c"d`,`e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
@@ -3220,3 +3220,324 @@ DROP TABLE t1;
#
# End of 5.0 tests
#
+drop table if exists t1;
+CREATE TABLE t1(a int, b int);
+INSERT INTO t1 VALUES (1,1);
+INSERT INTO t1 VALUES (2,3);
+INSERT INTO t1 VALUES (3,4), (4,5);
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+REPLACE INTO `t1` VALUES (1,1),(2,3),(3,4),(4,5);
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+DROP TABLE t1;
+create table t1 (a text , b text);
+create table t2 (a text , b text);
+insert t1 values ("Duck, Duck", "goose");
+insert t1 values ("Duck, Duck", "pidgeon");
+insert t2 values ("We the people", "in order to perform");
+insert t2 values ("a more perfect", "union");
+select * from t1;
+a b
+Duck, Duck goose
+Duck, Duck pidgeon
+select * from t2;
+a b
+We the people in order to perform
+a more perfect union
+test.t1: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0
+test.t2: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0
+select * from t1;
+a b
+Duck, Duck goose
+Duck, Duck pidgeon
+Duck, Duck goose
+Duck, Duck pidgeon
+select * from t2;
+a b
+We the people in order to perform
+a more perfect union
+We the people in order to perform
+a more perfect union
+create table words(a varchar(255));
+create table words2(b varchar(255));
+select * from t1;
+a b
+Duck, Duck goose
+Duck, Duck pidgeon
+Duck, Duck goose
+Duck, Duck pidgeon
+Duck, Duck goose
+Duck, Duck pidgeon
+select * from t2;
+a b
+We the people in order to perform
+a more perfect union
+We the people in order to perform
+a more perfect union
+We the people in order to perform
+a more perfect union
+select * from words;
+a
+Aarhus
+Aaron
+Ababa
+aback
+abaft
+abandon
+abandoned
+abandoning
+abandonment
+abandons
+Aarhus
+Aaron
+Ababa
+aback
+abaft
+abandon
+abandoned
+abandoning
+abandonment
+abandons
+abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
+select * from words2;
+b
+abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
+drop table words;
+mysql-import: Error: 1146, Table 'test.words' doesn't exist, when using table: words
+drop table t1;
+drop table t2;
+drop table words2;
+#
+# BUG# 16853: mysqldump doesn't show events
+#
+create database first;
+use first;
+set time_zone = 'UTC';
+create event ee1 on schedule at '2035-12-31 20:01:23' do set @a=5;
+show events;
+Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+first ee1 root@localhost ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED
+show create event ee1;
+Event sql_mode Create Event
+ee1 CREATE EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5
+drop database first;
+create database second;
+use second;
+show events;
+Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+second ee1 root@localhost ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED
+show create event ee1;
+Event sql_mode Create Event
+ee1 NO_AUTO_VALUE_ON_ZERO CREATE EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5
+create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5;
+create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5;
+show events;
+Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+second ee1 root@localhost ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED
+second ee2 root@localhost ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED
+second ee3 root@localhost ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED
+drop database second;
+create database third;
+use third;
+show events;
+Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+third ee1 root@localhost ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED
+third ee2 root@localhost ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED
+third ee3 root@localhost ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED
+drop database third;
+set time_zone = 'SYSTEM';
+use test;
+#
+# BUG#17201 Spurious 'DROP DATABASE' in output,
+# also confusion between tables and views.
+# Example code from Markus Popp
+#
+create database mysqldump_test_db;
+use mysqldump_test_db;
+create table t1 (id int);
+create view v1 as select * from t1;
+insert into t1 values (1232131);
+insert into t1 values (4711);
+insert into t1 values (3231);
+insert into t1 values (0815);
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+/*!40000 DROP DATABASE IF EXISTS `mysqldump_test_db`*/;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_test_db` /*!40100 DEFAULT CHARACTER SET latin1 */;
+
+USE `mysqldump_test_db`;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `id` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+INSERT INTO `t1` VALUES (1232131),(4711),(3231),(815);
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `v1`;
+/*!50001 DROP VIEW IF EXISTS `v1`*/;
+/*!50001 CREATE TABLE `v1` (
+ `id` int(11)
+) */;
+
+USE `mysqldump_test_db`;
+/*!50001 DROP TABLE IF EXISTS `v1`*/;
+/*!50001 DROP VIEW IF EXISTS `v1`*/;
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50001 VIEW `v1` AS select `t1`.`id` AS `id` from `t1` */;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+drop view v1;
+drop table t1;
+drop database mysqldump_test_db;
+#
+# End of 5.1 tests
+#
diff --git a/mysql-test/r/mysqlshow.result b/mysql-test/r/mysqlshow.result
index 2bf8a58de4e..14d8e4f464b 100644
--- a/mysql-test/r/mysqlshow.result
+++ b/mysql-test/r/mysqlshow.result
@@ -84,10 +84,21 @@ Database: information_schema
| COLLATION_CHARACTER_SET_APPLICABILITY |
| COLUMNS |
| COLUMN_PRIVILEGES |
+| ENGINES |
+| EVENTS |
+| FILES |
+| GLOBAL_STATUS |
+| GLOBAL_VARIABLES |
| KEY_COLUMN_USAGE |
+| PARTITIONS |
+| PLUGINS |
+| PROCESSLIST |
+| REFERENTIAL_CONSTRAINTS |
| ROUTINES |
| SCHEMATA |
| SCHEMA_PRIVILEGES |
+| SESSION_STATUS |
+| SESSION_VARIABLES |
| STATISTICS |
| TABLES |
| TABLE_CONSTRAINTS |
@@ -105,10 +116,21 @@ Database: INFORMATION_SCHEMA
| COLLATION_CHARACTER_SET_APPLICABILITY |
| COLUMNS |
| COLUMN_PRIVILEGES |
+| ENGINES |
+| EVENTS |
+| FILES |
+| GLOBAL_STATUS |
+| GLOBAL_VARIABLES |
| KEY_COLUMN_USAGE |
+| PARTITIONS |
+| PLUGINS |
+| PROCESSLIST |
+| REFERENTIAL_CONSTRAINTS |
| ROUTINES |
| SCHEMATA |
| SCHEMA_PRIVILEGES |
+| SESSION_STATUS |
+| SESSION_VARIABLES |
| STATISTICS |
| TABLES |
| TABLE_CONSTRAINTS |
diff --git a/mysql-test/r/mysqlslap.result b/mysql-test/r/mysqlslap.result
new file mode 100644
index 00000000000..045a34a7458
--- /dev/null
+++ b/mysql-test/r/mysqlslap.result
@@ -0,0 +1,143 @@
+DROP SCHEMA IF EXISTS `mysqlslap`;
+CREATE SCHEMA `mysqlslap`;
+use mysqlslap;
+CREATE TABLE t1 (id int, name varchar(64));
+INSERT INTO t1 VALUES (1, 'This is a test');
+select * from t1;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+CREATE SCHEMA `mysqlslap`;
+use mysqlslap;
+CREATE TABLE t1 (id int, name varchar(64));
+INSERT INTO t1 VALUES (1, 'This is a test');
+select * from t1;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+CREATE SCHEMA `mysqlslap`;
+use mysqlslap;
+CREATE TABLE t1 (id int, name varchar(64));
+INSERT INTO t1 VALUES (1, 'This is a test');
+select * from t1;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+CREATE SCHEMA `mysqlslap`;
+use mysqlslap;
+CREATE TABLE t1 (id int, name varchar(64));
+INSERT INTO t1 VALUES (1, 'This is a test');
+select * from t1;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+CREATE SCHEMA `mysqlslap`;
+use mysqlslap;
+CREATE TABLE t1 (id int, name varchar(64));
+INSERT INTO t1 VALUES (1, 'This is a test');
+select * from t1;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+CREATE SCHEMA `mysqlslap`;
+use mysqlslap;
+CREATE TABLE t1 (id int, name varchar(64));
+INSERT INTO t1 VALUES (1, 'This is a test');
+select * from t1;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+CREATE SCHEMA `mysqlslap`;
+use mysqlslap;
+CREATE TABLE t1 (id int, name varchar(64));
+INSERT INTO t1 VALUES (1, 'This is a test');
+select * from t1;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+CREATE SCHEMA `mysqlslap`;
+use mysqlslap;
+CREATE TABLE t1 (id int, name varchar(64));
+INSERT INTO t1 VALUES (1, 'This is a test');
+select * from t1;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+CREATE SCHEMA `mysqlslap`;
+use mysqlslap;
+CREATE TABLE t1 (id int, name varchar(64));
+INSERT INTO t1 VALUES (1, 'This is a test');
+select * from t1;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+CREATE SCHEMA `mysqlslap`;
+use mysqlslap;
+CREATE TABLE t1 (id int, name varchar(64));
+INSERT INTO t1 VALUES (1, 'This is a test');
+select * from t1;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+CREATE SCHEMA `mysqlslap`;
+use mysqlslap;
+CREATE TABLE t1 (id int, name varchar(64));
+INSERT INTO t1 VALUES (1, 'This is a test');
+select * from t1;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+CREATE SCHEMA `mysqlslap`;
+use mysqlslap;
+CREATE TABLE t1 (id int, name varchar(64));
+INSERT INTO t1 VALUES (1, 'This is a test');
+select * from t1;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+CREATE SCHEMA `mysqlslap`;
+use mysqlslap;
+CREATE TABLE t1 (id int, name varchar(64));
+INSERT INTO t1 VALUES (1, 'This is a test');
+select * from t1;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+CREATE SCHEMA `mysqlslap`;
+use mysqlslap;
+CREATE TABLE t1 (id int, name varchar(64));
+INSERT INTO t1 VALUES (1, 'This is a test');
+select * from t1;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+CREATE SCHEMA `mysqlslap`;
+use mysqlslap;
+CREATE TABLE t1 (id int, name varchar(64));
+INSERT INTO t1 VALUES (1, 'This is a test');
+select * from t1;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+CREATE SCHEMA `mysqlslap`;
+use mysqlslap;
+CREATE TABLE t1 (id int, name varchar(64));
+INSERT INTO t1 VALUES (1, 'This is a test');
+select * from t1;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+CREATE SCHEMA `mysqlslap`;
+use mysqlslap;
+CREATE TABLE t1 (id int, name varchar(64));
+INSERT INTO t1 VALUES (1, 'This is a test');
+select * from t1;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+CREATE SCHEMA `mysqlslap`;
+use mysqlslap;
+CREATE TABLE t1 (id int, name varchar(64));
+INSERT INTO t1 VALUES (1, 'This is a test');
+select * from t1;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+CREATE SCHEMA `mysqlslap`;
+use mysqlslap;
+CREATE TABLE t1 (id int, name varchar(64));
+INSERT INTO t1 VALUES (1, 'This is a test');
+select * from t1;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+CREATE SCHEMA `mysqlslap`;
+use mysqlslap;
+CREATE TABLE t1 (id int, name varchar(64));
+INSERT INTO t1 VALUES (1, 'This is a test');
+select * from t1;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+CREATE SCHEMA `mysqlslap`;
+use mysqlslap;
+set storage_engine=`heap`;
+CREATE TABLE t1 (id int, name varchar(64));
+create table t2(foo1 varchar(32), foo2 varchar(32));
+INSERT INTO t1 VALUES (1, 'This is a test');
+insert into t2 values ('test', 'test2');
+select * from t1;
+select * from t2;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+DROP SCHEMA IF EXISTS `mysqlslap`;
+CREATE SCHEMA `mysqlslap`;
+use mysqlslap;
+set storage_engine=`myisam`;
+CREATE TABLE t1 (id int, name varchar(64));
+create table t2(foo1 varchar(32), foo2 varchar(32));
+INSERT INTO t1 VALUES (1, 'This is a test');
+insert into t2 values ('test', 'test2');
+select * from t1;
+select * from t2;
+DROP SCHEMA IF EXISTS `mysqlslap`;
diff --git a/mysql-test/r/ndb_alter_table.result b/mysql-test/r/ndb_alter_table.result
index 89999eca051..7facb5fa286 100644
--- a/mysql-test/r/ndb_alter_table.result
+++ b/mysql-test/r/ndb_alter_table.result
@@ -34,13 +34,13 @@ col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
col6 int not null, to_be_deleted int) ENGINE=ndbcluster;
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 ndbcluster 10 Dynamic 0 0 # # 0 # 1 # # # latin1_swedish_ci NULL #
+t1 NDBCLUSTER 10 Dynamic 0 # # # 0 # 1 # # # latin1_swedish_ci NULL #
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
insert into t1 values
(0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 ndbcluster 10 Dynamic 9 96 # # 0 # 102 # # # latin1_swedish_ci NULL #
+t1 NDBCLUSTER 10 Dynamic 9 # # # 0 # 102 # # # latin1_swedish_ci NULL #
select * from t1 order by col1;
col1 col2 col3 col4 col5 col6 to_be_deleted
0 4 3 5 PENDING 1 7
@@ -60,7 +60,7 @@ change column col2 fourth varchar(30) not null after col3,
modify column col6 int not null first;
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 ndbcluster 10 Dynamic 9 152 # # 0 # 102 # # # latin1_swedish_ci NULL #
+t1 NDBCLUSTER 10 Dynamic 9 # # # 0 # 102 # # # latin1_swedish_ci NULL #
select * from t1 order by col1;
col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 0 3 4 5 PENDING 0000-00-00 00:00:00
@@ -75,7 +75,7 @@ col6 col1 col3 fourth col4 col4_5 col5 col7 col8
insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 ndbcluster 10 Dynamic 10 152 # # 0 # 103 # # # latin1_swedish_ci NULL #
+t1 NDBCLUSTER 10 Dynamic 10 # # # 0 # 103 # # # latin1_swedish_ci NULL #
select * from t1 order by col1;
col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 0 3 4 5 PENDING 0000-00-00 00:00:00
@@ -170,35 +170,6 @@ c
4
5
drop table t1;
-create table t1 ( a int primary key, b varchar(10), c varchar(10), index (b) )
-engine=ndb;
-insert into t1 values (1,'one','one'), (2,'two','two'), (3,'three','three');
-create index c on t1(c);
-select * from t1 where b = 'two';
-a b c
-2 two two
-alter table t1 drop index c;
-select * from t1 where b = 'two';
-ERROR HY000: Can't lock file (errno: 241)
-select * from t1 where b = 'two';
-a b c
-2 two two
-drop table t1;
-create table t3 (a int primary key) engine=ndbcluster;
-begin;
-insert into t3 values (1);
-alter table t3 rename t4;
-delete from t3;
-insert into t3 values (1);
-commit;
-select * from t3;
-ERROR HY000: Can't lock file (errno: 155)
-select * from t4;
-a
-1
-drop table t4;
-show tables;
-Tables_in_test
create table t1 (
ai bigint auto_increment,
c001 int(11) not null,
@@ -315,6 +286,53 @@ unique key tx1 (c002, c003, c004, c005)) engine=ndb;
create index tx2
on t1 (c010, c011, c012, c013);
drop table t1;
+CREATE TABLE t1 (
+auto int(5) unsigned NOT NULL auto_increment,
+string char(10),
+vstring varchar(10),
+bin binary(2),
+vbin varbinary(7),
+tiny tinyint(4) DEFAULT '0' NOT NULL ,
+short smallint(6) DEFAULT '1' NOT NULL ,
+medium mediumint(8) DEFAULT '0' NOT NULL,
+long_int int(11) DEFAULT '0' NOT NULL,
+longlong bigint(13) DEFAULT '0' NOT NULL,
+real_float float(13,1) DEFAULT 0.0 NOT NULL,
+real_double double(16,4),
+real_decimal decimal(16,4),
+utiny tinyint(3) unsigned DEFAULT '0' NOT NULL,
+ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
+umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
+ulong int(11) unsigned DEFAULT '0' NOT NULL,
+ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
+bits bit(3),
+options enum('zero','one','two','three','four') not null,
+flags set('zero','one','two','three','four') not null,
+date_field date,
+year_field year,
+time_field time,
+date_time datetime,
+time_stamp timestamp,
+PRIMARY KEY (auto)
+) engine=ndb;
+CREATE TEMPORARY TABLE ndb_show_tables (id INT, type VARCHAR(20), state VARCHAR(20), logging VARCHAR(20), _database VARCHAR(255), _schema VARCHAR(20), name VARCHAR(255));
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+set @t1_id = (select id from ndb_show_tables where name like '%t1%');
+truncate ndb_show_tables;
+alter table t1 change tiny new_tiny tinyint(4) DEFAULT '0' NOT NULL;
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+select 'no_copy' from ndb_show_tables where id = @t1_id and name like '%t1%';
+no_copy
+set @t1_id = (select id from ndb_show_tables where name like '%t1%');
+truncate ndb_show_tables;
+create index i1 on t1(medium);
+alter table t1 add index i2(new_tiny);
+drop index i1 on t1;
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+select 'no_copy' from ndb_show_tables where id = @t1_id and name like '%t1%';
+no_copy
+no_copy
+DROP TABLE t1, ndb_show_tables;
create table t1 (a int primary key auto_increment, b int) engine=ndb;
insert into t1 (b) values (101),(102),(103);
select * from t1 where a = 3;
diff --git a/mysql-test/r/ndb_alter_table2.result b/mysql-test/r/ndb_alter_table2.result
index 399578dc97b..3783c76447c 100644
--- a/mysql-test/r/ndb_alter_table2.result
+++ b/mysql-test/r/ndb_alter_table2.result
@@ -28,7 +28,6 @@ b INT NOT NULL,
c INT NOT NULL
) ENGINE=ndbcluster;
select * from t1;
-ERROR HY000: Got error 241 'Invalid schema object version' from ndbcluster
select * from t1;
a b c
select * from t1;
diff --git a/mysql-test/r/ndb_alter_table3.result b/mysql-test/r/ndb_alter_table3.result
new file mode 100644
index 00000000000..ee7c9b1c7b0
--- /dev/null
+++ b/mysql-test/r/ndb_alter_table3.result
@@ -0,0 +1,35 @@
+DROP TABLE IF EXISTS t1;
+create table t1 ( a int primary key, b varchar(10), c varchar(10), index (b) )
+engine=ndb;
+insert into t1 values (1,'one','one'), (2,'two','two'), (3,'three','three');
+create index c on t1(c);
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 a A 3 NULL NULL BTREE
+t1 1 b 1 b A 3 NULL NULL YES BTREE
+t1 1 c 1 c A 3 NULL NULL YES BTREE
+select * from t1 where c = 'two';
+a b c
+2 two two
+alter table t1 drop index c;
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 a A 3 NULL NULL BTREE
+t1 1 b 1 b A 3 NULL NULL YES BTREE
+select * from t1 where c = 'two';
+a b c
+2 two two
+drop table t1;
+create table t3 (a int primary key) engine=ndbcluster;
+begin;
+insert into t3 values (1);
+alter table t3 rename t4;
+commit;
+select * from t3;
+ERROR 42S02: Table 'test.t3' doesn't exist
+select * from t4;
+a
+1
+drop table t4;
+show tables;
+Tables_in_test
diff --git a/mysql-test/r/ndb_autodiscover.result b/mysql-test/r/ndb_autodiscover.result
index 6d1b7eb152d..cb85c4ac873 100644
--- a/mysql-test/r/ndb_autodiscover.result
+++ b/mysql-test/r/ndb_autodiscover.result
@@ -110,7 +110,7 @@ t3 CREATE TABLE `t3` (
`id` int(11) NOT NULL,
`name` char(255) default NULL,
PRIMARY KEY (`id`)
-) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY ()
select * from t3;
id name
1 Explorer
@@ -146,8 +146,8 @@ Handler_discover 1
flush tables;
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t6 MyISAM 10 Fixed 1 260 # # # 0 NULL # # NULL # NULL #
-t7 ndbcluster 10 Fixed 1 276 # # # 0 NULL # # NULL # NULL #
+t6 MyISAM 10 Fixed 1 # # # # 0 NULL # # NULL # NULL #
+t7 NDBCLUSTER 10 Fixed 1 # # # # 0 NULL # # NULL # NULL #
show status like 'handler_discover%';
Variable_name Value
Handler_discover 2
diff --git a/mysql-test/r/ndb_autodiscover2.result b/mysql-test/r/ndb_autodiscover2.result
index 91f018b5d02..269888e0820 100644
--- a/mysql-test/r/ndb_autodiscover2.result
+++ b/mysql-test/r/ndb_autodiscover2.result
@@ -6,8 +6,8 @@ a b
4 5
show status like 'handler_discover%';
Variable_name Value
-Handler_discover 1
+Handler_discover 0
drop table t9;
select * from t10;
-ERROR HY000: Got error 4263 'Invalid blob attributes or invalid blob parts table' from ndbcluster
+ERROR HY000: Got error 4263 'Invalid blob attributes or invalid blob parts table' from NDBCLUSTER
drop table t10;
diff --git a/mysql-test/r/ndb_autodiscover3.result b/mysql-test/r/ndb_autodiscover3.result
index 8bc1b968436..86495ebb3eb 100644
--- a/mysql-test/r/ndb_autodiscover3.result
+++ b/mysql-test/r/ndb_autodiscover3.result
@@ -3,9 +3,9 @@ create table t1 (a int key) engine=ndbcluster;
begin;
insert into t1 values (1);
insert into t1 values (2);
-ERROR HY000: Got temporary error 4025 'Node failure caused abort of transaction' from ndbcluster
+ERROR HY000: Got temporary error 4025 'Node failure caused abort of transaction' from NDBCLUSTER
commit;
-ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
+ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
drop table t1;
create table t2 (a int, b int, primary key(a,b)) engine=ndbcluster;
insert into t2 values (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1);
@@ -14,6 +14,11 @@ a b
1 1
2 1
3 1
+select * from t2;
+ERROR 42S02: Table 'test.t2' doesn't exist
+show tables like 't2';
+Tables_in_test (t2)
+reset master;
create table t2 (a int key) engine=ndbcluster;
insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
select * from t2 order by a limit 3;
@@ -22,14 +27,16 @@ a
2
3
select * from t2 order by a limit 3;
-ERROR HY000: Can't lock file (errno: 241)
-select * from t2 order by a limit 3;
a
1
2
3
-show tables;
-Tables_in_test
+reset master;
+select * from t2;
+ERROR 42S02: Table 'test.t2' doesn't exist
+show tables like 't2';
+Tables_in_test (t2)
+reset master;
create table t2 (a int key) engine=ndbcluster;
insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
select * from t2 order by a limit 3;
@@ -42,4 +49,5 @@ a
1
2
3
+reset master;
drop table t2;
diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result
index d2111db24fe..e0255ddb9e7 100644
--- a/mysql-test/r/ndb_basic.result
+++ b/mysql-test/r/ndb_basic.result
@@ -555,7 +555,7 @@ c125 int,
c126 int,
c127 int,
c128 int,
-primary key(c1)) engine=ndb;
+primary key using hash(c1)) engine=ndb partition by key(c1);
drop table t1;
create table t1 (
a1234567890123456789012345678901234567890 int primary key,
@@ -568,7 +568,7 @@ t1
insert into t1 values (1,1),(2,1),(3,1),(4,1),(5,2),(6,1),(7,1);
explain select * from t1 where a12345678901234567890123456789a1234567890=2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a12345678901234567890123456789a1234567890 a12345678901234567890123456789a1234567890 5 const 10 Using where
+1 SIMPLE t1 ref a12345678901234567890123456789a1234567890 a12345678901234567890123456789a1234567890 5 const # Using where
select * from t1 where a12345678901234567890123456789a1234567890=2;
a1234567890123456789012345678901234567890 a12345678901234567890123456789a1234567890
5 2
@@ -642,30 +642,30 @@ counter datavalue
6 newval
7 newval
8 newval
-35 newval
-36 newval
-37 newval
-38 newval
-39 newval
-40 newval
-41 newval
-42 newval
-43 newval
-44 newval
-45 newval
-46 newval
-47 newval
-48 newval
-49 newval
-50 newval
-51 newval
-52 newval
-53 newval
-54 newval
-55 newval
-56 newval
-57 newval
-58 newval
+9 newval
+10 newval
+11 newval
+12 newval
+13 newval
+14 newval
+15 newval
+16 newval
+17 newval
+18 newval
+19 newval
+20 newval
+21 newval
+22 newval
+23 newval
+24 newval
+25 newval
+26 newval
+27 newval
+28 newval
+29 newval
+30 newval
+31 newval
+32 newval
drop table t1;
CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb;
select * from t1;
@@ -749,3 +749,13 @@ f1 f2 f3
222222 bbbbbb 2
drop table t1;
Illegal ndb error code: 1186
+End of 5.0 tests
+CREATE TABLE t1 (a VARCHAR(255) NOT NULL,
+CONSTRAINT pk_a PRIMARY KEY (a))engine=ndb;
+CREATE TABLE t2(a VARCHAR(255) NOT NULL,
+b VARCHAR(255) NOT NULL,
+c VARCHAR(255) NOT NULL,
+CONSTRAINT pk_b_c_id PRIMARY KEY (b,c),
+CONSTRAINT fk_a FOREIGN KEY(a) REFERENCES t1(a))engine=ndb;
+drop table t1, t2;
+End of 5.1 tests
diff --git a/mysql-test/r/ndb_binlog_basic.result b/mysql-test/r/ndb_binlog_basic.result
new file mode 100644
index 00000000000..a8f88c2192e
--- /dev/null
+++ b/mysql-test/r/ndb_binlog_basic.result
@@ -0,0 +1,51 @@
+drop table if exists t1, t2;
+drop database if exists mysqltest;
+create database mysqltest;
+use mysqltest;
+drop database mysqltest;
+use test;
+create table t1 (a int primary key) engine=ndb;
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+select @max_epoch:=max(epoch)-1 from cluster.binlog_index;
+@max_epoch:=max(epoch)-1
+#
+delete from t1;
+alter table t1 add (b int);
+insert into t1 values (3,3),(4,4);
+alter table t1 rename t2;
+begin;
+insert into t2 values (1,1),(2,2);
+update t2 set b=1 where a=3;
+delete from t2 where a=4;
+commit;
+drop table t2;
+select inserts from cluster.binlog_index where epoch > @max_epoch and inserts > 5;
+inserts
+10
+select deletes from cluster.binlog_index where epoch > @max_epoch and deletes > 5;
+deletes
+10
+select inserts,updates,deletes from
+cluster.binlog_index where epoch > @max_epoch and updates > 0;
+inserts updates deletes
+2 1 1
+flush logs;
+purge master logs before now();
+select count(*) from cluster.binlog_index;
+count(*)
+0
+create table t1 (a int primary key, b int) engine=ndb;
+create database mysqltest;
+use mysqltest;
+create table t1 (c int, d int primary key) engine=ndb;
+use test;
+insert into mysqltest.t1 values (2,1),(2,2);
+select @max_epoch:=max(epoch)-1 from cluster.binlog_index;
+@max_epoch:=max(epoch)-1
+#
+drop table t1;
+drop database mysqltest;
+select inserts,updates,deletes from
+cluster.binlog_index where epoch > @max_epoch and inserts > 0;
+inserts updates deletes
+2 0 0
diff --git a/mysql-test/r/ndb_binlog_basic2.result b/mysql-test/r/ndb_binlog_basic2.result
new file mode 100644
index 00000000000..9b9f642bd86
--- /dev/null
+++ b/mysql-test/r/ndb_binlog_basic2.result
@@ -0,0 +1,12 @@
+set session binlog_format=row;
+ERROR HY000: The NDB cluster engine does not support changing the binlog format on the fly yet
+set session binlog_format=statement;
+ERROR HY000: The NDB cluster engine does not support changing the binlog format on the fly yet
+set global binlog_format=row;
+ERROR HY000: The NDB cluster engine does not support changing the binlog format on the fly yet
+set global binlog_format=statement;
+ERROR HY000: The NDB cluster engine does not support changing the binlog format on the fly yet
+set session binlog_format=default;
+ERROR HY000: The NDB cluster engine does not support changing the binlog format on the fly yet
+set global binlog_format=default;
+ERROR HY000: The NDB cluster engine does not support changing the binlog format on the fly yet
diff --git a/mysql-test/r/ndb_binlog_ddl_multi.result b/mysql-test/r/ndb_binlog_ddl_multi.result
new file mode 100644
index 00000000000..19414cf75c5
--- /dev/null
+++ b/mysql-test/r/ndb_binlog_ddl_multi.result
@@ -0,0 +1,194 @@
+drop database if exists mysqltest;
+drop table if exists t1,t2,t3;
+drop database if exists mysqltest;
+drop table if exists t1,t2,t3;
+reset master;
+reset master;
+create database mysqltest;
+use mysqltest;
+create table t1 (a int primary key) engine=ndb;
+create table t2 (a int primary key) engine=ndb;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin1.000001 # Query # # create database mysqltest
+master-bin1.000001 # Query # # use `mysqltest`; create table t1 (a int primary key) engine=ndb
+master-bin1.000001 # Query # # use `test`; create table t2 (a int primary key) engine=ndb
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # create database mysqltest
+master-bin.000001 # Query # # use `mysqltest`; create table t1 (a int primary key) engine=ndb
+master-bin.000001 # Query # # use `test`; create table t2 (a int primary key) engine=ndb
+reset master;
+reset master;
+alter table t2 add column (b int);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin1.000001 # Query # # use `test`; alter table t2 add column (b int)
+reset master;
+reset master;
+ALTER DATABASE mysqltest CHARACTER SET latin1;
+drop table mysqltest.t1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # ALTER DATABASE mysqltest CHARACTER SET latin1
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # ALTER DATABASE mysqltest CHARACTER SET latin1
+reset master;
+reset master;
+use test;
+insert into t2 values (1,2);
+drop database mysqltest;
+create table t1 (a int primary key) engine=ndb;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin1.000001 # Query # # BEGIN
+master-bin1.000001 # Table_map # # table_id: # (test.t2)
+master-bin1.000001 # Table_map # # table_id: # (cluster.apply_status)
+master-bin1.000001 # Write_rows # # table_id: #
+master-bin1.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin1.000001 # Query # # COMMIT
+master-bin1.000001 # Query # # drop database mysqltest
+master-bin1.000001 # Query # # use `test`; create table t1 (a int primary key) engine=ndb
+drop table t2;
+reset master;
+reset master;
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE = 4M
+ENGINE=NDB;
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M
+ENGINE NDB;
+ALTER TABLESPACE ts1
+ADD DATAFILE 'datafile02.dat'
+INITIAL_SIZE = 4M
+ENGINE=NDB;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile.dat'
+ENGINE = NDB;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile02.dat'
+ENGINE = NDB;
+DROP TABLESPACE ts1
+ENGINE = NDB;
+DROP LOGFILE GROUP lg1
+ENGINE =NDB;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin1.000001 # Query # # CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB
+master-bin1.000001 # Query # # ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE = 4M
+ENGINE=NDB
+master-bin1.000001 # Query # # CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M
+ENGINE NDB
+master-bin1.000001 # Query # # ALTER TABLESPACE ts1
+ADD DATAFILE 'datafile02.dat'
+INITIAL_SIZE = 4M
+ENGINE=NDB
+master-bin1.000001 # Query # # ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile.dat'
+ENGINE = NDB
+master-bin1.000001 # Query # # ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile02.dat'
+ENGINE = NDB
+master-bin1.000001 # Query # # DROP TABLESPACE ts1
+ENGINE = NDB
+master-bin1.000001 # Query # # DROP LOGFILE GROUP lg1
+ENGINE =NDB
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin1.000001 # Query # # CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB
+master-bin1.000001 # Query # # ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE = 4M
+ENGINE=NDB
+master-bin1.000001 # Query # # CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M
+ENGINE NDB
+master-bin1.000001 # Query # # ALTER TABLESPACE ts1
+ADD DATAFILE 'datafile02.dat'
+INITIAL_SIZE = 4M
+ENGINE=NDB
+master-bin1.000001 # Query # # ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile.dat'
+ENGINE = NDB
+master-bin1.000001 # Query # # ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile02.dat'
+ENGINE = NDB
+master-bin1.000001 # Query # # DROP TABLESPACE ts1
+ENGINE = NDB
+master-bin1.000001 # Query # # DROP LOGFILE GROUP lg1
+ENGINE =NDB
+drop table t1;
+reset master;
+show tables;
+Tables_in_test
+reset master;
+show tables;
+Tables_in_test
+create table t1 (a int key) engine=ndb;
+create table t2 (a int key) engine=ndb;
+create table t3 (a int key) engine=ndb;
+rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin1.000001 # Query # # use `test`; create table t1 (a int key) engine=ndb
+master-bin1.000001 # Query # # use `test`; create table t2 (a int key) engine=ndb
+master-bin1.000001 # Query # # use `test`; create table t3 (a int key) engine=ndb
+master-bin1.000001 # Query # # use `test`; rename table `test.t3` to `test.t4`
+master-bin1.000001 # Query # # use `test`; rename table `test.t2` to `test.t3`
+master-bin1.000001 # Query # # use `test`; rename table `test.t1` to `test.t2`
+master-bin1.000001 # Query # # use `test`; rename table `test.t4` to `test.t1`
+drop table t1;
+drop table t2;
+drop table t3;
+reset master;
+show tables;
+Tables_in_test
+reset master;
+show tables;
+Tables_in_test
+create table t1 (a int key) engine=ndb;
+insert into t1 values(1);
+rename table t1 to t2;
+insert into t2 values(2);
+drop table t2;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin1.000001 # Query # # use `test`; create table t1 (a int key) engine=ndb
+master-bin1.000001 # Query # # BEGIN
+master-bin1.000001 # Table_map # # table_id: # (test.t1)
+master-bin1.000001 # Table_map # # table_id: # (cluster.apply_status)
+master-bin1.000001 # Write_rows # # table_id: #
+master-bin1.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin1.000001 # Query # # COMMIT
+master-bin1.000001 # Query # # use `test`; rename table `test.t1` to `test.t2`
+master-bin1.000001 # Query # # BEGIN
+master-bin1.000001 # Table_map # # table_id: # (test.t2)
+master-bin1.000001 # Table_map # # table_id: # (cluster.apply_status)
+master-bin1.000001 # Write_rows # # table_id: #
+master-bin1.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin1.000001 # Query # # COMMIT
+master-bin1.000001 # Query # # use `test`; drop table t2
diff --git a/mysql-test/r/ndb_binlog_discover.result b/mysql-test/r/ndb_binlog_discover.result
new file mode 100644
index 00000000000..01e15dc1c39
--- /dev/null
+++ b/mysql-test/r/ndb_binlog_discover.result
@@ -0,0 +1,12 @@
+drop table if exists t1;
+create table t1 (a int key) engine=ndb;
+reset master;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (cluster.apply_status)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+drop table t1;
diff --git a/mysql-test/r/ndb_binlog_ignore_db.result b/mysql-test/r/ndb_binlog_ignore_db.result
new file mode 100644
index 00000000000..8dc2c1ff1f8
--- /dev/null
+++ b/mysql-test/r/ndb_binlog_ignore_db.result
@@ -0,0 +1,10 @@
+drop table if exists t1;
+drop database if exists mysqltest;
+create database mysqltest;
+use mysqltest;
+create table t1 (a int primary key, b int) engine=ndb;
+insert into t1 values (1, 1);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; drop table if exists t1
+drop database mysqltest;
diff --git a/mysql-test/r/ndb_binlog_multi.result b/mysql-test/r/ndb_binlog_multi.result
new file mode 100644
index 00000000000..119174039f9
--- /dev/null
+++ b/mysql-test/r/ndb_binlog_multi.result
@@ -0,0 +1,80 @@
+drop table if exists t1,t2,t3;
+drop table if exists t1,t2,t3;
+CREATE TABLE t3 (dummy INT PRIMARY KEY) ENGINE = NDB;
+DROP TABLE t3;
+reset master;
+reset master;
+CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB;
+INSERT INTO t2 VALUES (1,1),(2,2);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin1.000001 # Query # # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB
+master-bin1.000001 # Query # # BEGIN
+master-bin1.000001 # Table_map # # table_id: # (test.t2)
+master-bin1.000001 # Table_map # # table_id: # (cluster.apply_status)
+master-bin1.000001 # Write_rows # # table_id: #
+master-bin1.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin1.000001 # Query # # COMMIT
+select * from t2 order by a;
+a b
+1 1
+2 2
+SELECT @the_epoch:=epoch,inserts,updates,deletes,schemaops FROM
+cluster.binlog_index ORDER BY epoch DESC LIMIT 1;
+@the_epoch:=epoch inserts updates deletes schemaops
+<the_epoch> 2 0 0 0
+SELECT * FROM t2 ORDER BY a;
+a b
+1 1
+2 2
+DROP TABLE t2;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Table_map # # table_id: # (cluster.apply_status)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; DROP TABLE t2
+SELECT inserts,updates,deletes,schemaops FROM
+cluster.binlog_index WHERE epoch=<the_epoch>;
+inserts updates deletes schemaops
+2 0 0 0
+reset master;
+reset master;
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB;
+INSERT INTO t1 VALUES (1),(2);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin1.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB
+master-bin1.000001 # Query # # BEGIN
+master-bin1.000001 # Table_map # # table_id: # (test.t1)
+master-bin1.000001 # Table_map # # table_id: # (cluster.apply_status)
+master-bin1.000001 # Write_rows # # table_id: #
+master-bin1.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin1.000001 # Query # # COMMIT
+SELECT @the_epoch2:=epoch,inserts,updates,deletes,schemaops FROM
+cluster.binlog_index ORDER BY epoch DESC LIMIT 1;
+@the_epoch2:=epoch inserts updates deletes schemaops
+<the_epoch2> 2 0 0 0
+SELECT inserts,updates,deletes,schemaops FROM
+cluster.binlog_index WHERE epoch > <the_epoch> AND epoch <= <the_epoch2>;
+inserts updates deletes schemaops
+2 0 0 0
+drop table t1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin1.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB
+master-bin1.000001 # Query # # BEGIN
+master-bin1.000001 # Table_map # # table_id: # (test.t1)
+master-bin1.000001 # Table_map # # table_id: # (cluster.apply_status)
+master-bin1.000001 # Write_rows # # table_id: #
+master-bin1.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin1.000001 # Query # # COMMIT
+master-bin1.000001 # Query # # use `test`; drop table t1
+SELECT inserts,updates,deletes,schemaops FROM
+cluster.binlog_index WHERE epoch > <the_epoch> AND epoch <= <the_epoch2>;
+inserts updates deletes schemaops
+2 0 0 0
diff --git a/mysql-test/r/ndb_bitfield.result b/mysql-test/r/ndb_bitfield.result
index 389e19f2893..59c4d420b22 100644
--- a/mysql-test/r/ndb_bitfield.result
+++ b/mysql-test/r/ndb_bitfield.result
@@ -7,8 +7,8 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk1` int(11) NOT NULL,
- `b` bit(64) default NULL,
- PRIMARY KEY (`pk1`)
+ `b` bit(64) DEFAULT NULL,
+ PRIMARY KEY (`pk1`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
insert into t1 values
(0,b'1111111111111111111111111111111111111111111111111111111111111111'),
@@ -201,13 +201,21 @@ create table t1 (
pk1 bit(9) not null primary key,
b int
) engine=ndbcluster;
-ERROR HY000: Can't create table './test/t1.frm' (errno: 906)
+ERROR HY000: Can't create table 'test.t1' (errno: 906)
+show warnings;
+Level Code Message
+Error 1296 Got error 906 'Unsupported attribute type in index' from NDB
+Error 1005 Can't create table 'test.t1' (errno: 906)
create table t1 (
pk1 int not null primary key,
b bit(9),
key(b)
) engine=ndbcluster;
-ERROR HY000: Can't create table './test/t1.frm' (errno: 906)
+ERROR HY000: Can't create table 'test.t1' (errno: 906)
+show warnings;
+Level Code Message
+Error 1296 Got error 906 'Unsupported attribute type in index' from NDB
+Error 1005 Can't create table 'test.t1' (errno: 906)
create table t1 (
pk1 int primary key,
b bit(32) not null
diff --git a/mysql-test/r/ndb_blob.result b/mysql-test/r/ndb_blob.result
index a5a40cffa91..04f2cea6250 100644
--- a/mysql-test/r/ndb_blob.result
+++ b/mysql-test/r/ndb_blob.result
@@ -40,7 +40,7 @@ insert into t1 values(2,@b2,222,@d2);
commit;
explain select * from t1 where a = 1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
+1 SIMPLE t1 const PRIMARY PRIMARY 4 const #
select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
from t1 where a=1;
a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
@@ -87,7 +87,7 @@ replace t1 set a=2,b=@b2,c=222,d=@d2;
commit;
explain select * from t1 where a = 1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
+1 SIMPLE t1 const PRIMARY PRIMARY 4 const #
select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
from t1 where a=1;
a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
@@ -134,7 +134,7 @@ insert into t1 values(2,@b2,222,@d2);
commit;
explain select * from t1 where c = 111;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref c c 4 const 10
+1 SIMPLE t1 ref c c 4 const #
select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
from t1 where c=111;
a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
@@ -177,7 +177,7 @@ insert into t1 values(9,'b9',999,'dd9');
commit;
explain select * from t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 9
+1 SIMPLE t1 ALL NULL NULL NULL NULL #
select * from t1 order by a;
a b c d
1 b1 111 dd1
@@ -212,7 +212,7 @@ insert into t1 values(2,@b2,222,@d2);
commit;
explain select * from t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 2
+1 SIMPLE t1 ALL NULL NULL NULL NULL #
select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
from t1 order by a;
a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
@@ -242,7 +242,7 @@ insert into t1 values(9,'b9',999,'dd9');
commit;
explain select * from t1 where c >= 100 order by a;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 4 NULL 10 Using where; Using filesort
+1 SIMPLE t1 range c c 4 NULL # Using where; Using filesort
select * from t1 where c >= 100 order by a;
a b c d
1 b1 111 dd1
@@ -278,7 +278,7 @@ insert into t1 values(2,@b2,222,@d2);
commit;
explain select * from t1 where c >= 100 order by a;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 4 NULL 10 Using where; Using filesort
+1 SIMPLE t1 range c c 4 NULL # Using where; Using filesort
select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
from t1 where c >= 100 order by a;
a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
diff --git a/mysql-test/r/ndb_blob_partition.result b/mysql-test/r/ndb_blob_partition.result
new file mode 100644
index 00000000000..b08a91f0cdd
--- /dev/null
+++ b/mysql-test/r/ndb_blob_partition.result
@@ -0,0 +1,104 @@
+drop table if exists t1;
+create table t1 (
+a mediumint not null,
+b text not null,
+c int not null,
+d longblob,
+primary key using hash (a,c),
+unique key (c)
+)
+engine=ndb
+partition by range (c)
+partitions 3
+( partition p1 values less than (200),
+partition p2 values less than (300),
+partition p3 values less than (400));
+insert into t1 values (1, @v1, 101, @v2);
+insert into t1 values (1, @v2, 102, @v3);
+insert into t1 values (1, @v3, 103, @v4);
+insert into t1 values (2, @v4, 201, @v5);
+insert into t1 values (2, @v5, 202, @v6);
+insert into t1 values (2, @v6, 203, @v7);
+insert into t1 values (3, @v7, 301, @v8);
+insert into t1 values (3, @v8, 302, @v9);
+insert into t1 values (3, @v9, 303, @v1);
+select a, sha1(b), c, sha1(d) from t1 order by a;
+a sha1(b) c sha1(d)
+1 1d42dd9090cf78314a06665d4ea938c35cc760f4 101 10d3c783026b310218d10b7188da96a2401648c6
+1 10d3c783026b310218d10b7188da96a2401648c6 102 a33549d9844092289a58ac348dd59f09fc28406a
+1 a33549d9844092289a58ac348dd59f09fc28406a 103 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
+2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 201 70fc9a7d08beebc522258bfb02000a30c77a8f1d
+2 70fc9a7d08beebc522258bfb02000a30c77a8f1d 202 090565c580809efed3d369481a4bbb168b20713e
+2 090565c580809efed3d369481a4bbb168b20713e 203 1e0070bec426871a46291de27b9bd6e4255ab4e5
+3 1e0070bec426871a46291de27b9bd6e4255ab4e5 301 acbaba01bc2e682f015f40e79d9cbe475db3002e
+3 acbaba01bc2e682f015f40e79d9cbe475db3002e 302 9ee30d99162574f79c66ae95cdf132dcf9cbc259
+3 9ee30d99162574f79c66ae95cdf132dcf9cbc259 303 1d42dd9090cf78314a06665d4ea938c35cc760f4
+select a, sha1(b), c, sha1(d) from t1 where a = 1 and c = 101;
+a sha1(b) c sha1(d)
+1 1d42dd9090cf78314a06665d4ea938c35cc760f4 101 10d3c783026b310218d10b7188da96a2401648c6
+select a, sha1(b), c, sha1(d) from t1 where a = 2 and c = 201;
+a sha1(b) c sha1(d)
+2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 201 70fc9a7d08beebc522258bfb02000a30c77a8f1d
+select a, sha1(b), c, sha1(d) from t1 where a = 3 and c = 301;
+a sha1(b) c sha1(d)
+3 1e0070bec426871a46291de27b9bd6e4255ab4e5 301 acbaba01bc2e682f015f40e79d9cbe475db3002e
+update t1 set b = @v3, d = @v4 where a = 1 and c = 102;
+update t1 set b = @v6, d = @v7 where a = 2 and c = 202;
+update t1 set b = @v9, d = @v1 where a = 3 and c = 302;
+select a, sha1(b), c, sha1(d) from t1 order by a;
+a sha1(b) c sha1(d)
+1 1d42dd9090cf78314a06665d4ea938c35cc760f4 101 10d3c783026b310218d10b7188da96a2401648c6
+1 a33549d9844092289a58ac348dd59f09fc28406a 102 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
+1 a33549d9844092289a58ac348dd59f09fc28406a 103 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
+2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 201 70fc9a7d08beebc522258bfb02000a30c77a8f1d
+2 090565c580809efed3d369481a4bbb168b20713e 202 1e0070bec426871a46291de27b9bd6e4255ab4e5
+2 090565c580809efed3d369481a4bbb168b20713e 203 1e0070bec426871a46291de27b9bd6e4255ab4e5
+3 1e0070bec426871a46291de27b9bd6e4255ab4e5 301 acbaba01bc2e682f015f40e79d9cbe475db3002e
+3 9ee30d99162574f79c66ae95cdf132dcf9cbc259 302 1d42dd9090cf78314a06665d4ea938c35cc760f4
+3 9ee30d99162574f79c66ae95cdf132dcf9cbc259 303 1d42dd9090cf78314a06665d4ea938c35cc760f4
+update t1 set b = @v4, d = @v5 where c = 103;
+update t1 set b = @v7, d = @v8 where c = 203;
+update t1 set b = @v1, d = @v2 where c = 303;
+select a, sha1(b), c, sha1(d) from t1 order by a;
+a sha1(b) c sha1(d)
+1 1d42dd9090cf78314a06665d4ea938c35cc760f4 101 10d3c783026b310218d10b7188da96a2401648c6
+1 a33549d9844092289a58ac348dd59f09fc28406a 102 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
+1 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 103 70fc9a7d08beebc522258bfb02000a30c77a8f1d
+2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 201 70fc9a7d08beebc522258bfb02000a30c77a8f1d
+2 090565c580809efed3d369481a4bbb168b20713e 202 1e0070bec426871a46291de27b9bd6e4255ab4e5
+2 1e0070bec426871a46291de27b9bd6e4255ab4e5 203 acbaba01bc2e682f015f40e79d9cbe475db3002e
+3 1e0070bec426871a46291de27b9bd6e4255ab4e5 301 acbaba01bc2e682f015f40e79d9cbe475db3002e
+3 9ee30d99162574f79c66ae95cdf132dcf9cbc259 302 1d42dd9090cf78314a06665d4ea938c35cc760f4
+3 1d42dd9090cf78314a06665d4ea938c35cc760f4 303 10d3c783026b310218d10b7188da96a2401648c6
+update t1 set b = @v5, d = @v6;
+select a, sha1(b), c, sha1(d) from t1 order by a;
+a sha1(b) c sha1(d)
+1 70fc9a7d08beebc522258bfb02000a30c77a8f1d 101 090565c580809efed3d369481a4bbb168b20713e
+1 70fc9a7d08beebc522258bfb02000a30c77a8f1d 102 090565c580809efed3d369481a4bbb168b20713e
+1 70fc9a7d08beebc522258bfb02000a30c77a8f1d 103 090565c580809efed3d369481a4bbb168b20713e
+2 70fc9a7d08beebc522258bfb02000a30c77a8f1d 201 090565c580809efed3d369481a4bbb168b20713e
+2 70fc9a7d08beebc522258bfb02000a30c77a8f1d 202 090565c580809efed3d369481a4bbb168b20713e
+2 70fc9a7d08beebc522258bfb02000a30c77a8f1d 203 090565c580809efed3d369481a4bbb168b20713e
+3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 301 090565c580809efed3d369481a4bbb168b20713e
+3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 302 090565c580809efed3d369481a4bbb168b20713e
+3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 303 090565c580809efed3d369481a4bbb168b20713e
+update t1 set b = @v1, d = @v2 where 100 < c and c < 200;
+update t1 set b = @v4, d = @v5 where 200 < c and c < 300;
+update t1 set b = @v7, d = @v8 where 300 < c and c < 400;
+select a, sha1(b), c, sha1(d) from t1 order by a;
+a sha1(b) c sha1(d)
+1 1d42dd9090cf78314a06665d4ea938c35cc760f4 101 10d3c783026b310218d10b7188da96a2401648c6
+1 1d42dd9090cf78314a06665d4ea938c35cc760f4 102 10d3c783026b310218d10b7188da96a2401648c6
+1 1d42dd9090cf78314a06665d4ea938c35cc760f4 103 10d3c783026b310218d10b7188da96a2401648c6
+2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 201 70fc9a7d08beebc522258bfb02000a30c77a8f1d
+2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 202 70fc9a7d08beebc522258bfb02000a30c77a8f1d
+2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 203 70fc9a7d08beebc522258bfb02000a30c77a8f1d
+3 1e0070bec426871a46291de27b9bd6e4255ab4e5 301 acbaba01bc2e682f015f40e79d9cbe475db3002e
+3 1e0070bec426871a46291de27b9bd6e4255ab4e5 302 acbaba01bc2e682f015f40e79d9cbe475db3002e
+3 1e0070bec426871a46291de27b9bd6e4255ab4e5 303 acbaba01bc2e682f015f40e79d9cbe475db3002e
+delete from t1 where a = 1 and c = 101;
+delete from t1 where c = 102;
+delete from t1;
+select a, sha1(b), c, sha1(d) from t1 order by a;
+a sha1(b) c sha1(d)
+drop table t1;
diff --git a/mysql-test/r/ndb_cache_multi.result b/mysql-test/r/ndb_cache_multi.result
index c7135ed9e8a..388131ec30a 100644
--- a/mysql-test/r/ndb_cache_multi.result
+++ b/mysql-test/r/ndb_cache_multi.result
@@ -70,3 +70,5 @@ show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
drop table t1, t2;
+set GLOBAL query_cache_size=0;
+set GLOBAL query_cache_size=0;
diff --git a/mysql-test/r/ndb_charset.result b/mysql-test/r/ndb_charset.result
index 9e519c39496..1c65a380039 100644
--- a/mysql-test/r/ndb_charset.result
+++ b/mysql-test/r/ndb_charset.result
@@ -27,9 +27,9 @@ a char(3) character set latin1 collate latin1_swedish_ci primary key
) engine=ndb;
insert into t1 values('aAa');
insert into t1 values('aaa');
-ERROR 23000: Duplicate entry 'aaa' for key 1
+ERROR 23000: Duplicate entry 'aaa' for key 'PRIMARY'
insert into t1 values('AAA');
-ERROR 23000: Duplicate entry 'AAA' for key 1
+ERROR 23000: Duplicate entry 'AAA' for key 'PRIMARY'
select * from t1 order by a;
a
aAa
@@ -51,9 +51,9 @@ a varchar(20) character set latin1 collate latin1_swedish_ci primary key
) engine=ndb;
insert into t1 values ('A'),('b '),('C '),('d '),('E'),('f');
insert into t1 values('b');
-ERROR 23000: Duplicate entry 'b' for key 1
+ERROR 23000: Duplicate entry 'b' for key 'PRIMARY'
insert into t1 values('a ');
-ERROR 23000: Duplicate entry 'a ' for key 1
+ERROR 23000: Duplicate entry 'a ' for key 'PRIMARY'
select a,length(a) from t1 order by a;
a length(a)
A 1
@@ -112,9 +112,9 @@ unique key(a)
) engine=ndb;
insert into t1 values(1, 'aAa');
insert into t1 values(2, 'aaa');
-ERROR 23000: Duplicate entry '' for key 0
+ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
insert into t1 values(3, 'AAA');
-ERROR 23000: Duplicate entry '' for key 0
+ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
select * from t1 order by p;
p a
1 aAa
@@ -138,9 +138,9 @@ unique key(a)
) engine=ndb;
insert into t1 values (1,'A'),(2,'b '),(3,'C '),(4,'d '),(5,'E'),(6,'f');
insert into t1 values(99,'b');
-ERROR 23000: Duplicate entry '' for key 0
+ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
insert into t1 values(99,'a ');
-ERROR 23000: Duplicate entry '' for key 0
+ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
select a,length(a) from t1 order by a;
a length(a)
A 1
@@ -186,9 +186,6 @@ p a
4 aAa
5 aaa
6 AAA
-explain select * from t1 where a = 'zZz' order by p;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a a 3 const 10 Using where; Using filesort
select * from t1 where a = 'aAa' order by p;
p a
1 aAa
@@ -223,9 +220,6 @@ p a
4 aAa
5 aaa
6 AAA
-explain select * from t1 where a = 'zZz' order by p;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a a 3 const 10 Using where; Using filesort
select * from t1 where a = 'aAa' order by p;
p a
1 aAa
diff --git a/mysql-test/r/ndb_condition_pushdown.result b/mysql-test/r/ndb_condition_pushdown.result
index 6012c9b6969..0d67d310a2b 100644
--- a/mysql-test/r/ndb_condition_pushdown.result
+++ b/mysql-test/r/ndb_condition_pushdown.result
@@ -1,4 +1,4 @@
-DROP TABLE IF EXISTS t1,t2;
+DROP TABLE IF EXISTS t1,t2,t3,t4;
CREATE TABLE t1 (
auto int(5) unsigned NOT NULL auto_increment,
string char(10),
@@ -513,7 +513,7 @@ time_field = '01:01:01' and
date_time = '1901-01-01 01:01:01'
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where with pushed condition; Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where with pushed condition; Using filesort
select auto from t1 where
string = "aaaa" and
vstring = "aaaa" and
@@ -570,7 +570,7 @@ time_field != '01:01:01' and
date_time != '1901-01-01 01:01:01'
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where with pushed condition; Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where with pushed condition; Using filesort
select auto from t1 where
string != "aaaa" and
vstring != "aaaa" and
@@ -629,7 +629,7 @@ time_field > '01:01:01' and
date_time > '1901-01-01 01:01:01'
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where with pushed condition; Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where with pushed condition; Using filesort
select auto from t1 where
string > "aaaa" and
vstring > "aaaa" and
@@ -688,7 +688,7 @@ time_field >= '01:01:01' and
date_time >= '1901-01-01 01:01:01'
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where with pushed condition; Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where with pushed condition; Using filesort
select auto from t1 where
string >= "aaaa" and
vstring >= "aaaa" and
@@ -748,7 +748,7 @@ time_field < '04:04:04' and
date_time < '1904-04-04 04:04:04'
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where with pushed condition; Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where with pushed condition; Using filesort
select auto from t1 where
string < "dddd" and
vstring < "dddd" and
@@ -807,7 +807,7 @@ time_field <= '04:04:04' and
date_time <= '1904-04-04 04:04:04'
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where with pushed condition; Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where with pushed condition; Using filesort
select auto from t1 where
string <= "dddd" and
vstring <= "dddd" and
@@ -868,7 +868,7 @@ time_field = '01:01:01' and
date_time = '1901-01-01 01:01:01'
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref medium_index medium_index 3 const 10 Using where with pushed condition; Using filesort
+1 SIMPLE t1 ref medium_index medium_index 3 const # Using where with pushed condition; Using filesort
select auto from t1 where
string = "aaaa" and
vstring = "aaaa" and
@@ -925,7 +925,7 @@ time_field != '01:01:01' and
date_time != '1901-01-01 01:01:01'
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range medium_index medium_index 3 NULL 20 Using where with pushed condition; Using filesort
+1 SIMPLE t1 range medium_index medium_index 3 NULL # Using where with pushed condition; Using filesort
select auto from t1 where
string != "aaaa" and
vstring != "aaaa" and
@@ -984,7 +984,7 @@ time_field > '01:01:01' and
date_time > '1901-01-01 01:01:01'
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range medium_index medium_index 3 NULL 10 Using where with pushed condition; Using filesort
+1 SIMPLE t1 range medium_index medium_index 3 NULL # Using where with pushed condition; Using filesort
select auto from t1 where
string > "aaaa" and
vstring > "aaaa" and
@@ -1043,7 +1043,7 @@ time_field >= '01:01:01' and
date_time >= '1901-01-01 01:01:01'
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range medium_index medium_index 3 NULL 10 Using where with pushed condition; Using filesort
+1 SIMPLE t1 range medium_index medium_index 3 NULL # Using where with pushed condition; Using filesort
select auto from t1 where
string >= "aaaa" and
vstring >= "aaaa" and
@@ -1103,7 +1103,7 @@ time_field < '04:04:04' and
date_time < '1904-04-04 04:04:04'
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range medium_index medium_index 3 NULL 10 Using where with pushed condition; Using filesort
+1 SIMPLE t1 range medium_index medium_index 3 NULL # Using where with pushed condition; Using filesort
select auto from t1 where
string < "dddd" and
vstring < "dddd" and
@@ -1162,7 +1162,7 @@ time_field <= '04:04:04' and
date_time <= '1904-04-04 04:04:04'
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range medium_index medium_index 3 NULL 10 Using where with pushed condition; Using filesort
+1 SIMPLE t1 range medium_index medium_index 3 NULL # Using where with pushed condition; Using filesort
select auto from t1 where
string <= "dddd" and
vstring <= "dddd" and
@@ -1202,7 +1202,7 @@ bin like concat(0xBB, '%') and
vbin like concat(0xBB, '%')
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where with pushed condition; Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where with pushed condition; Using filesort
select auto from t1 where
string like "b%" and
vstring like "b%" and
@@ -1219,7 +1219,7 @@ bin not like concat(0xBB, '%') and
vbin not like concat(0xBB, '%')
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where with pushed condition; Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where with pushed condition; Using filesort
select auto from t1 where
string not like "b%" and
vstring not like "b%" and
@@ -1255,7 +1255,7 @@ select auto from t1 where
(date_time between '1901-01-01 01:01:01' and '1903-03-03 03:03:03')
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range medium_index medium_index 3 NULL 10 Using where with pushed condition; Using filesort
+1 SIMPLE t1 range medium_index medium_index 3 NULL # Using where with pushed condition; Using filesort
select auto from t1 where
(string between "aaaa" and "cccc") and
(vstring between "aaaa" and "cccc") and
@@ -1307,7 +1307,7 @@ select auto from t1 where
('1901-01-01 01:01:01' between date_time and date_time)
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range medium_index medium_index 3 NULL 10 Using where with pushed condition; Using filesort
+1 SIMPLE t1 range medium_index medium_index 3 NULL # Using where with pushed condition; Using filesort
select auto from t1 where
("aaaa" between string and string) and
("aaaa" between vstring and vstring) and
@@ -1358,7 +1358,7 @@ select auto from t1 where
(date_time not between '1901-01-01 01:01:01' and '1903-03-03 03:03:03')
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range medium_index medium_index 3 NULL 20 Using where with pushed condition; Using filesort
+1 SIMPLE t1 range medium_index medium_index 3 NULL # Using where with pushed condition; Using filesort
select auto from t1 where
(string not between "aaaa" and "cccc") and
(vstring not between "aaaa" and "cccc") and
@@ -1409,7 +1409,7 @@ select auto from t1 where
('1901-01-01 01:01:01' not between date_time and date_time)
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range medium_index medium_index 3 NULL 20 Using where with pushed condition; Using filesort
+1 SIMPLE t1 range medium_index medium_index 3 NULL # Using where with pushed condition; Using filesort
select auto from t1 where
("aaaa" not between string and string) and
("aaaa" not between vstring and vstring) and
@@ -1462,7 +1462,7 @@ time_field in('01:01:01','03:03:03') and
date_time in('1901-01-01 01:01:01','1903-03-03 03:03:03')
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range medium_index medium_index 3 NULL 20 Using where with pushed condition; Using filesort
+1 SIMPLE t1 range medium_index medium_index 3 NULL # Using where with pushed condition; Using filesort
select auto from t1 where
string in("aaaa","cccc") and
vstring in("aaaa","cccc") and
@@ -1514,7 +1514,7 @@ select auto from t1 where
'1901-01-01 01:01:01' in(date_time)
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref medium_index medium_index 3 const 10 Using where with pushed condition; Using filesort
+1 SIMPLE t1 ref medium_index medium_index 3 const # Using where with pushed condition; Using filesort
select auto from t1 where
"aaaa" in(string) and
"aaaa" in(vstring) and
@@ -1565,7 +1565,7 @@ time_field not in('01:01:01','03:03:03') and
date_time not in('1901-01-01 01:01:01','1903-03-03 03:03:03')
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range medium_index medium_index 3 NULL 30 Using where with pushed condition; Using filesort
+1 SIMPLE t1 range medium_index medium_index 3 NULL # Using where with pushed condition; Using filesort
select auto from t1 where
string not in("aaaa","cccc") and
vstring not in("aaaa","cccc") and
@@ -1617,7 +1617,7 @@ select auto from t1 where
'1901-01-01 01:01:01' not in(date_time)
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where with pushed condition; Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where with pushed condition; Using filesort
select auto from t1 where
"aaaa" not in(string) and
"aaaa" not in(vstring) and
@@ -1704,7 +1704,7 @@ count(*)
explain
select * from t2 where attr3 is null or attr1 > 2 and pk1= 3 order by pk1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 6 Using where with pushed condition; Using filesort
+1 SIMPLE t2 ALL PRIMARY NULL NULL NULL # Using where with pushed condition; Using filesort
select * from t2 where attr3 is null or attr1 > 2 and pk1= 3 order by pk1;
pk1 attr1 attr2 attr3
2 2 NULL NULL
@@ -1712,7 +1712,7 @@ pk1 attr1 attr2 attr3
explain
select * from t2 where attr3 is not null and attr1 > 2 order by pk1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where with pushed condition; Using filesort
+1 SIMPLE t2 ALL NULL NULL NULL NULL # Using where with pushed condition; Using filesort
select * from t2 where attr3 is not null and attr1 > 2 order by pk1;
pk1 attr1 attr2 attr3
3 3 3 d
@@ -1721,7 +1721,7 @@ pk1 attr1 attr2 attr3
explain
select * from t3 where attr2 > 9223372036854775803 and attr3 != 3 order by pk1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 ALL NULL NULL NULL NULL 6 Using where with pushed condition; Using filesort
+1 SIMPLE t3 ALL NULL NULL NULL NULL # Using where with pushed condition; Using filesort
select * from t3 where attr2 > 9223372036854775803 and attr3 != 3 order by pk1;
pk1 attr1 attr2 attr3 attr4
2 2 9223372036854775804 2 c
@@ -1730,15 +1730,15 @@ pk1 attr1 attr2 attr3 attr4
explain
select * from t2,t3 where t2.attr1 < 1 and t2.attr2 = t3.attr2 and t3.attr1 < 5 order by t2.pk1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where with pushed condition; Using temporary; Using filesort
-1 SIMPLE t3 ALL NULL NULL NULL NULL 6 Using where with pushed condition
+1 SIMPLE t2 ALL NULL NULL NULL NULL # Using where with pushed condition; Using temporary; Using filesort
+1 SIMPLE t3 ALL NULL NULL NULL NULL # Using where with pushed condition
select * from t2,t3 where t2.attr1 < 1 and t2.attr2 = t3.attr2 and t3.attr1 < 5 order by t2.pk1;
pk1 attr1 attr2 attr3 pk1 attr1 attr2 attr3 attr4
0 0 0 a 0 0 0 0 a
explain
select * from t4 where attr1 < 5 and attr2 > 9223372036854775803 and attr3 != 3 order by t4.pk1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t4 range attr1 attr1 4 NULL 10 Using where with pushed condition; Using filesort
+1 SIMPLE t4 range attr1 attr1 4 NULL # Using where with pushed condition; Using filesort
select * from t4 where attr1 < 5 and attr2 > 9223372036854775803 and attr3 != 3 order by t4.pk1;
pk1 attr1 attr2 attr3 attr4
2 2 9223372036854775804 2 c
@@ -1746,8 +1746,8 @@ pk1 attr1 attr2 attr3 attr4
explain
select * from t3,t4 where t4.attr1 > 1 and t4.attr2 = t3.attr2 and t4.attr3 < 5 order by t4.pk1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t4 range attr1 attr1 4 NULL 10 Using where with pushed condition; Using temporary; Using filesort
-1 SIMPLE t3 ALL NULL NULL NULL NULL 6 Using where
+1 SIMPLE t4 range attr1 attr1 4 NULL # Using where with pushed condition; Using temporary; Using filesort
+1 SIMPLE t3 ALL NULL NULL NULL NULL # Using where
select * from t3,t4 where t4.attr1 > 1 and t4.attr2 = t3.attr2 and t4.attr3 < 5 order by t4.pk1;
pk1 attr1 attr2 attr3 attr4 pk1 attr1 attr2 attr3 attr4
2 2 9223372036854775804 2 c 2 2 9223372036854775804 2 c
@@ -1756,16 +1756,16 @@ pk1 attr1 attr2 attr3 attr4 pk1 attr1 attr2 attr3 attr4
explain
select auto from t1 where string = "aaaa" collate latin1_general_ci order by auto;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where; Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where; Using filesort
explain
select * from t2 where (attr1 < 2) = (attr2 < 2) order by pk1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using filesort
+1 SIMPLE t2 ALL NULL NULL NULL NULL # Using where; Using filesort
explain
select * from t3 left join t4 on t4.attr2 = t3.attr2 where t4.attr1 > 1 and t4.attr3 < 5 or t4.attr1 is null order by t4.pk1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
-1 SIMPLE t4 ALL NULL NULL NULL NULL 6 Using where
+1 SIMPLE t3 ALL NULL NULL NULL NULL # Using temporary; Using filesort
+1 SIMPLE t4 ALL NULL NULL NULL NULL # Using where
create table t5 (a int primary key auto_increment, b tinytext not null)
engine = ndb;
insert into t5 (b) values ('jonas'), ('jensing'), ('johan');
@@ -1777,7 +1777,7 @@ a b
set engine_condition_pushdown = on;
explain select * from t5 where b like '%jo%';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t5 ALL NULL NULL NULL NULL 3 Using where
+1 SIMPLE t5 ALL NULL NULL NULL NULL # Using where
select * from t5 where b like '%jo%' order by a;
a b
1 jonas
@@ -1793,13 +1793,13 @@ auto
set engine_condition_pushdown = on;
explain select auto from t1 where date_time like '1902-02-02 %';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where
select auto from t1 where date_time like '1902-02-02 %' order by auto;
auto
2
explain select auto from t1 where date_time not like '1902-02-02 %';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where
select auto from t1 where date_time not like '1902-02-02 %' order by auto;
auto
3
diff --git a/mysql-test/r/ndb_config.result b/mysql-test/r/ndb_config.result
index 9470cd7256c..9495af29df6 100644
--- a/mysql-test/r/ndb_config.result
+++ b/mysql-test/r/ndb_config.result
@@ -1,9 +1,9 @@
-ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4, mysqld,5, mysqld,6, mysqld,7,
-1,localhost,41943040,12582912 2,localhost,41943040,12582912
-1 localhost 41943040 12582912
-2 localhost 41943040 12582912
+ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4, mysqld,5, mysqld,6, mysqld,7, mysqld,8, mysqld,9, mysqld,10, mysqld,11,
+1,localhost,20971520,1048576 2,localhost,20971520,1048576
+1 localhost 20971520 1048576
+2 localhost 20971520 1048576
1 2
-ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4, mysqld,5, mysqld,6, mysqld,7,
+ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4, mysqld,5, mysqld,6, mysqld,7, mysqld,8, mysqld,9, mysqld,10, mysqld,11,
ndbd,1,localhost,52428800,26214400 ndbd,2,localhost,52428800,36700160 ndbd,3,localhost,52428800,52428800 ndbd,4,localhost,52428800,52428800 ndb_mgmd,5,localhost,, mysqld,6,localhost,,
ndbd,1,localhost ndbd,2,localhost ndbd,3,localhost ndbd,4,localhost ndb_mgmd,5,localhost mysqld,6, mysqld,7, mysqld,8, mysqld,9, mysqld,10,
ndbd,2,localhost ndbd,3,localhost ndbd,4,localhost ndbd,5,localhost ndb_mgmd,6,localhost mysqld,1, mysqld,7, mysqld,8, mysqld,9, mysqld,10,
diff --git a/mysql-test/r/ndb_config2.result b/mysql-test/r/ndb_config2.result
new file mode 100644
index 00000000000..cfd012933c4
--- /dev/null
+++ b/mysql-test/r/ndb_config2.result
@@ -0,0 +1 @@
+shm,3,4,35,3 shm,3,5,35,3 shm,3,6,35,3 shm,4,5,35,4 shm,4,6,35,4 shm,5,6,35,5 tcp,11,3,55,3 tcp,11,4,55,4 tcp,11,5,55,5 tcp,11,6,55,6 tcp,12,3,55,3 tcp,12,4,55,4 tcp,12,5,55,5 tcp,12,6,55,6 tcp,13,3,55,3 tcp,13,4,55,4 tcp,13,5,55,5 tcp,13,6,55,6 tcp,14,3,55,3 tcp,14,4,55,4 tcp,14,5,55,5 tcp,14,6,55,6 tcp,15,3,55,3 tcp,15,4,55,4 tcp,15,5,55,5 tcp,15,6,55,6 tcp,1,3,55,1 tcp,1,4,55,1 tcp,1,5,55,1 tcp,1,6,55,1 tcp,2,3,55,2 tcp,2,4,55,2 tcp,2,5,55,2 tcp,2,6,55,2
diff --git a/mysql-test/r/ndb_database.result b/mysql-test/r/ndb_database.result
index 566a3eaf3dd..e3da4af0265 100644
--- a/mysql-test/r/ndb_database.result
+++ b/mysql-test/r/ndb_database.result
@@ -1,8 +1,4 @@
-drop table if exists t1;
drop database if exists mysqltest;
-drop table if exists t1;
-drop database if exists mysqltest;
-create database mysqltest;
create database mysqltest;
create table mysqltest.t1 (a int primary key, b int) engine=ndb;
use mysqltest;
@@ -10,18 +6,8 @@ show tables;
Tables_in_mysqltest
t1
drop database mysqltest;
-use mysqltest;
-show tables;
-Tables_in_mysqltest
create database mysqltest;
-create table mysqltest.t1 (c int, d int primary key) engine=ndb;
use mysqltest;
show tables;
Tables_in_mysqltest
-t1
drop database mysqltest;
-use mysqltest;
-show tables;
-Tables_in_mysqltest
-drop table if exists t1;
-drop database if exists mysqltest;
diff --git a/mysql-test/r/ndb_dd_alter.result b/mysql-test/r/ndb_dd_alter.result
new file mode 100644
index 00000000000..a9505747a94
--- /dev/null
+++ b/mysql-test/r/ndb_dd_alter.result
@@ -0,0 +1,441 @@
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+**** Test Setup Section ****
+CREATE LOGFILE GROUP lg
+ADD UNDOFILE './lg_group/undofile.dat'
+ INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+CREATE TABLESPACE ts
+ADD DATAFILE './table_space/datafile.dat'
+ USE LOGFILE GROUP lg
+INITIAL_SIZE 12M
+ENGINE NDB;
+CREATE TABLE test.t1 (
+a1 smallint NOT NULL,
+a2 int NOT NULL,
+a3 bigint NOT NULL,
+a4 char(10),
+a5 decimal(5,1),
+a6 time,
+a7 date,
+a8 datetime,
+a9 VARCHAR(255),
+a10 blob,
+PRIMARY KEY(a1)
+) ENGINE=InnoDB;
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a1` smallint(6) NOT NULL,
+ `a2` int(11) NOT NULL,
+ `a3` bigint(20) NOT NULL,
+ `a4` char(10) DEFAULT NULL,
+ `a5` decimal(5,1) DEFAULT NULL,
+ `a6` time DEFAULT NULL,
+ `a7` date DEFAULT NULL,
+ `a8` datetime DEFAULT NULL,
+ `a9` varchar(255) DEFAULT NULL,
+ `a10` blob,
+ PRIMARY KEY (`a1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SELECT * FROM test.t1 ORDER BY a1;
+a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
+1 2 2000000001 aaa1 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb1 binary data
+2 3 2000000002 aaa2 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb2 binary data
+3 4 2000000003 aaa3 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb3 binary data
+4 5 2000000004 aaa4 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb4 binary data
+5 6 2000000005 aaa5 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb5 binary data
+6 7 2000000006 aaa6 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb6 binary data
+7 8 2000000007 aaa7 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb7 binary data
+8 9 2000000008 aaa8 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb8 binary data
+9 10 2000000009 aaa9 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb9 binary data
+10 11 2000000010 aaa10 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb10 binary data
+11 12 2000000011 aaa11 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb11 binary data
+12 13 2000000012 aaa12 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb12 binary data
+13 14 2000000013 aaa13 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb13 binary data
+14 15 2000000014 aaa14 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb14 binary data
+15 16 2000000015 aaa15 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb15 binary data
+16 17 2000000016 aaa16 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb16 binary data
+17 18 2000000017 aaa17 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb17 binary data
+18 19 2000000018 aaa18 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb18 binary data
+19 20 2000000019 aaa19 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb19 binary data
+20 21 2000000020 aaa20 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb20 binary data
+ALTER TABLE test.t1 TABLESPACE ts STORAGE DISK ENGINE=NDB;
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a1` smallint(6) NOT NULL,
+ `a2` int(11) NOT NULL,
+ `a3` bigint(20) NOT NULL,
+ `a4` char(10) DEFAULT NULL,
+ `a5` decimal(5,1) DEFAULT NULL,
+ `a6` time DEFAULT NULL,
+ `a7` date DEFAULT NULL,
+ `a8` datetime DEFAULT NULL,
+ `a9` varchar(255) DEFAULT NULL,
+ `a10` blob,
+ PRIMARY KEY (`a1`)
+) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
+SELECT * FROM test.t1 ORDER BY a1;
+a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
+1 2 2000000001 aaa1 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb1 binary data
+2 3 2000000002 aaa2 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb2 binary data
+3 4 2000000003 aaa3 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb3 binary data
+4 5 2000000004 aaa4 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb4 binary data
+5 6 2000000005 aaa5 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb5 binary data
+6 7 2000000006 aaa6 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb6 binary data
+7 8 2000000007 aaa7 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb7 binary data
+8 9 2000000008 aaa8 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb8 binary data
+9 10 2000000009 aaa9 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb9 binary data
+10 11 2000000010 aaa10 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb10 binary data
+11 12 2000000011 aaa11 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb11 binary data
+12 13 2000000012 aaa12 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb12 binary data
+13 14 2000000013 aaa13 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb13 binary data
+14 15 2000000014 aaa14 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb14 binary data
+15 16 2000000015 aaa15 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb15 binary data
+16 17 2000000016 aaa16 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb16 binary data
+17 18 2000000017 aaa17 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb17 binary data
+18 19 2000000018 aaa18 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb18 binary data
+19 20 2000000019 aaa19 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb19 binary data
+20 21 2000000020 aaa20 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb20 binary data
+DROP TABLE test.t1;
+CREATE TABLE test.t1 (
+a1 smallint NOT NULL,
+a2 int NOT NULL,
+a3 bigint NOT NULL,
+a4 char(10),
+a5 decimal(5,1),
+a6 time,
+a7 date,
+a8 datetime,
+a9 VARCHAR(255),
+a10 blob,
+PRIMARY KEY(a1)
+) ENGINE=MyISAM;
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a1` smallint(6) NOT NULL,
+ `a2` int(11) NOT NULL,
+ `a3` bigint(20) NOT NULL,
+ `a4` char(10) DEFAULT NULL,
+ `a5` decimal(5,1) DEFAULT NULL,
+ `a6` time DEFAULT NULL,
+ `a7` date DEFAULT NULL,
+ `a8` datetime DEFAULT NULL,
+ `a9` varchar(255) DEFAULT NULL,
+ `a10` blob,
+ PRIMARY KEY (`a1`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM test.t1 ORDER BY a1;
+a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
+1 2 2000000001 aaa1 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb1 binary data
+2 3 2000000002 aaa2 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb2 binary data
+3 4 2000000003 aaa3 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb3 binary data
+4 5 2000000004 aaa4 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb4 binary data
+5 6 2000000005 aaa5 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb5 binary data
+6 7 2000000006 aaa6 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb6 binary data
+7 8 2000000007 aaa7 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb7 binary data
+8 9 2000000008 aaa8 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb8 binary data
+9 10 2000000009 aaa9 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb9 binary data
+10 11 2000000010 aaa10 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb10 binary data
+11 12 2000000011 aaa11 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb11 binary data
+12 13 2000000012 aaa12 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb12 binary data
+13 14 2000000013 aaa13 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb13 binary data
+14 15 2000000014 aaa14 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb14 binary data
+15 16 2000000015 aaa15 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb15 binary data
+16 17 2000000016 aaa16 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb16 binary data
+17 18 2000000017 aaa17 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb17 binary data
+18 19 2000000018 aaa18 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb18 binary data
+19 20 2000000019 aaa19 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb19 binary data
+20 21 2000000020 aaa20 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb20 binary data
+ALTER TABLE test.t1 TABLESPACE ts STORAGE DISK ENGINE=NDB;
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a1` smallint(6) NOT NULL,
+ `a2` int(11) NOT NULL,
+ `a3` bigint(20) NOT NULL,
+ `a4` char(10) DEFAULT NULL,
+ `a5` decimal(5,1) DEFAULT NULL,
+ `a6` time DEFAULT NULL,
+ `a7` date DEFAULT NULL,
+ `a8` datetime DEFAULT NULL,
+ `a9` varchar(255) DEFAULT NULL,
+ `a10` blob,
+ PRIMARY KEY (`a1`)
+) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
+SELECT * FROM test.t1 ORDER BY a1;
+a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
+1 2 2000000001 aaa1 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb1 binary data
+2 3 2000000002 aaa2 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb2 binary data
+3 4 2000000003 aaa3 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb3 binary data
+4 5 2000000004 aaa4 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb4 binary data
+5 6 2000000005 aaa5 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb5 binary data
+6 7 2000000006 aaa6 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb6 binary data
+7 8 2000000007 aaa7 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb7 binary data
+8 9 2000000008 aaa8 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb8 binary data
+9 10 2000000009 aaa9 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb9 binary data
+10 11 2000000010 aaa10 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb10 binary data
+11 12 2000000011 aaa11 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb11 binary data
+12 13 2000000012 aaa12 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb12 binary data
+13 14 2000000013 aaa13 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb13 binary data
+14 15 2000000014 aaa14 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb14 binary data
+15 16 2000000015 aaa15 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb15 binary data
+16 17 2000000016 aaa16 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb16 binary data
+17 18 2000000017 aaa17 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb17 binary data
+18 19 2000000018 aaa18 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb18 binary data
+19 20 2000000019 aaa19 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb19 binary data
+20 21 2000000020 aaa20 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb20 binary data
+ALTER TABLE test.t1 ENGINE=InnoDB;
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a1` smallint(6) NOT NULL,
+ `a2` int(11) NOT NULL,
+ `a3` bigint(20) NOT NULL,
+ `a4` char(10) DEFAULT NULL,
+ `a5` decimal(5,1) DEFAULT NULL,
+ `a6` time DEFAULT NULL,
+ `a7` date DEFAULT NULL,
+ `a8` datetime DEFAULT NULL,
+ `a9` varchar(255) DEFAULT NULL,
+ `a10` blob,
+ PRIMARY KEY (`a1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SELECT * FROM test.t1 ORDER BY a1;
+a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
+1 2 2000000001 aaa1 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb1 binary data
+2 3 2000000002 aaa2 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb2 binary data
+3 4 2000000003 aaa3 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb3 binary data
+4 5 2000000004 aaa4 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb4 binary data
+5 6 2000000005 aaa5 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb5 binary data
+6 7 2000000006 aaa6 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb6 binary data
+7 8 2000000007 aaa7 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb7 binary data
+8 9 2000000008 aaa8 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb8 binary data
+9 10 2000000009 aaa9 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb9 binary data
+10 11 2000000010 aaa10 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb10 binary data
+11 12 2000000011 aaa11 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb11 binary data
+12 13 2000000012 aaa12 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb12 binary data
+13 14 2000000013 aaa13 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb13 binary data
+14 15 2000000014 aaa14 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb14 binary data
+15 16 2000000015 aaa15 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb15 binary data
+16 17 2000000016 aaa16 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb16 binary data
+17 18 2000000017 aaa17 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb17 binary data
+18 19 2000000018 aaa18 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb18 binary data
+19 20 2000000019 aaa19 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb19 binary data
+20 21 2000000020 aaa20 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb20 binary data
+ALTER TABLE test.t1 TABLESPACE ts STORAGE DISK ENGINE=NDB;
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a1` smallint(6) NOT NULL,
+ `a2` int(11) NOT NULL,
+ `a3` bigint(20) NOT NULL,
+ `a4` char(10) DEFAULT NULL,
+ `a5` decimal(5,1) DEFAULT NULL,
+ `a6` time DEFAULT NULL,
+ `a7` date DEFAULT NULL,
+ `a8` datetime DEFAULT NULL,
+ `a9` varchar(255) DEFAULT NULL,
+ `a10` blob,
+ PRIMARY KEY (`a1`)
+) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
+ALTER TABLE test.t1 ENGINE=MyISAM;
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a1` smallint(6) NOT NULL,
+ `a2` int(11) NOT NULL,
+ `a3` bigint(20) NOT NULL,
+ `a4` char(10) DEFAULT NULL,
+ `a5` decimal(5,1) DEFAULT NULL,
+ `a6` time DEFAULT NULL,
+ `a7` date DEFAULT NULL,
+ `a8` datetime DEFAULT NULL,
+ `a9` varchar(255) DEFAULT NULL,
+ `a10` blob,
+ PRIMARY KEY (`a1`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE test.t1;
+CREATE TABLE test.t1 (a1 INT PRIMARY KEY) TABLESPACE ts STORAGE DISK ENGINE=NDB;
+SELECT * FROM test.t1 ORDER BY a1;
+a1
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+ALTER TABLE test.t1 ADD a2 FLOAT, ADD a3 DOUBLE;
+SELECT * FROM test.t1 ORDER BY a1;
+a1 a2 a3
+1 2.2345 20000001
+2 3.2345 20000002
+3 4.2345 20000003
+4 5.2345 20000004
+5 6.2345 20000005
+6 7.2345 20000006
+7 8.2345 20000007
+8 9.2345 20000008
+9 10.2345 20000009
+10 11.2345 20000010
+11 12.2345 20000011
+12 13.2345 20000012
+13 14.2345 20000013
+14 15.2345 20000014
+15 16.2345 20000015
+16 17.2345 20000016
+17 18.2345 20000017
+18 19.2345 20000018
+19 20.2345 20000019
+20 21.2345 20000020
+ALTER TABLE test.t1 ADD a4 BIT, ADD a5 TINYINT, ADD a6 BIGINT, ADD a7 DATE, ADD a8 TIME;
+SELECT a1,a2,a3,hex(a4), a5,a6,a7,a8 FROM test.t1 ORDER BY a1;
+a1 a2 a3 hex(a4) a5 a6 a7 a8
+1 2.2345 20000001 0 1 23457 2006-01-01 07:04:00
+2 3.2345 20000002 0 1 23458 2006-01-01 07:04:00
+3 4.2345 20000003 0 1 23459 2006-01-01 07:04:00
+4 5.2345 20000004 0 1 23460 2006-01-01 07:04:00
+5 6.2345 20000005 0 1 23461 2006-01-01 07:04:00
+6 7.2345 20000006 0 1 23462 2006-01-01 07:04:00
+7 8.2345 20000007 0 1 23463 2006-01-01 07:04:00
+8 9.2345 20000008 0 1 23464 2006-01-01 07:04:00
+9 10.2345 20000009 0 1 23465 2006-01-01 07:04:00
+10 11.2345 20000010 0 1 23466 2006-01-01 07:04:00
+11 12.2345 20000011 0 1 23467 2006-01-01 07:04:00
+12 13.2345 20000012 0 1 23468 2006-01-01 07:04:00
+13 14.2345 20000013 0 1 23469 2006-01-01 07:04:00
+14 15.2345 20000014 0 1 23470 2006-01-01 07:04:00
+15 16.2345 20000015 0 1 23471 2006-01-01 07:04:00
+16 17.2345 20000016 0 1 23472 2006-01-01 07:04:00
+17 18.2345 20000017 0 1 23473 2006-01-01 07:04:00
+18 19.2345 20000018 0 1 23474 2006-01-01 07:04:00
+19 20.2345 20000019 0 1 23475 2006-01-01 07:04:00
+20 21.2345 20000020 0 1 23476 2006-01-01 07:04:00
+ALTER TABLE test.t1 ADD a9 DATETIME, ADD a10 TINYTEXT, ADD a11 MEDIUMTEXT, ADD a12 LONGTEXT, ADD a13 TEXT, ADD a14 BLOB;
+SELECT a1, a2,a3,hex(a4),a5,a6,a7,a8,a9,a10,a11,a12,a13 FROM test.t1 ORDER BY a1;
+a1 a2 a3 hex(a4) a5 a6 a7 a8 a9 a10 a11 a12 a13
+1 2.2345 20000001 0 1 23457 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
+2 3.2345 20000002 0 1 23458 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
+3 4.2345 20000003 0 1 23459 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
+4 5.2345 20000004 0 1 23460 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
+5 6.2345 20000005 0 1 23461 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
+6 7.2345 20000006 0 1 23462 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
+7 8.2345 20000007 0 1 23463 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
+8 9.2345 20000008 0 1 23464 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
+9 10.2345 20000009 0 1 23465 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
+10 11.2345 20000010 0 1 23466 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
+11 12.2345 20000011 0 1 23467 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
+12 13.2345 20000012 0 1 23468 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
+13 14.2345 20000013 0 1 23469 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
+14 15.2345 20000014 0 1 23470 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
+15 16.2345 20000015 0 1 23471 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
+16 17.2345 20000016 0 1 23472 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
+17 18.2345 20000017 0 1 23473 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
+18 19.2345 20000018 0 1 23474 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
+19 20.2345 20000019 0 1 23475 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
+20 21.2345 20000020 0 1 23476 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a1` int(11) NOT NULL,
+ `a2` float DEFAULT NULL,
+ `a3` double DEFAULT NULL,
+ `a4` bit(1) DEFAULT NULL,
+ `a5` tinyint(4) DEFAULT NULL,
+ `a6` bigint(20) DEFAULT NULL,
+ `a7` date DEFAULT NULL,
+ `a8` time DEFAULT NULL,
+ `a9` datetime DEFAULT NULL,
+ `a10` tinytext,
+ `a11` mediumtext,
+ `a12` longtext,
+ `a13` text,
+ `a14` blob,
+ PRIMARY KEY (`a1`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+ALTER TABLE test.t1 ADD INDEX a2_i (a2), ADD INDEX a3_i (a3);
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a1` int(11) NOT NULL,
+ `a2` float DEFAULT NULL,
+ `a3` double DEFAULT NULL,
+ `a4` bit(1) DEFAULT NULL,
+ `a5` tinyint(4) DEFAULT NULL,
+ `a6` bigint(20) DEFAULT NULL,
+ `a7` date DEFAULT NULL,
+ `a8` time DEFAULT NULL,
+ `a9` datetime DEFAULT NULL,
+ `a10` tinytext,
+ `a11` mediumtext,
+ `a12` longtext,
+ `a13` text,
+ `a14` blob,
+ PRIMARY KEY (`a1`),
+ KEY `a2_i` (`a2`),
+ KEY `a3_i` (`a3`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+ALTER TABLE test.t1 DROP INDEX a2_i;
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a1` int(11) NOT NULL,
+ `a2` float DEFAULT NULL,
+ `a3` double DEFAULT NULL,
+ `a4` bit(1) DEFAULT NULL,
+ `a5` tinyint(4) DEFAULT NULL,
+ `a6` bigint(20) DEFAULT NULL,
+ `a7` date DEFAULT NULL,
+ `a8` time DEFAULT NULL,
+ `a9` datetime DEFAULT NULL,
+ `a10` tinytext,
+ `a11` mediumtext,
+ `a12` longtext,
+ `a13` text,
+ `a14` blob,
+ PRIMARY KEY (`a1`),
+ KEY `a3_i` (`a3`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+ALTER TABLE test.t1 DROP a14;
+ALTER TABLE test.t1 DROP a13;
+ALTER TABLE test.t1 DROP a12;
+ALTER TABLE test.t1 DROP a11;
+ALTER TABLE test.t1 DROP a10;
+ALTER TABLE test.t1 DROP a9;
+ALTER TABLE test.t1 DROP a8;
+ALTER TABLE test.t1 DROP a7;
+ALTER TABLE test.t1 DROP a6;
+ALTER TABLE test.t1 DROP PRIMARY KEY;
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a1` int(11) NOT NULL,
+ `a2` float DEFAULT NULL,
+ `a3` double DEFAULT NULL,
+ `a4` bit(1) DEFAULT NULL,
+ `a5` tinyint(4) DEFAULT NULL,
+ KEY `a3_i` (`a3`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+DROP TABLE test.t1;
+ALTER TABLESPACE ts
+DROP DATAFILE './table_space/datafile.dat'
+ ENGINE NDB;
+DROP TABLESPACE ts ENGINE NDB;
+DROP LOGFILE GROUP lg ENGINE=NDB;
diff --git a/mysql-test/r/ndb_dd_backuprestore.result b/mysql-test/r/ndb_dd_backuprestore.result
new file mode 100644
index 00000000000..3c0815cbec8
--- /dev/null
+++ b/mysql-test/r/ndb_dd_backuprestore.result
@@ -0,0 +1,487 @@
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+DROP TABLE IF EXISTS test.t4;
+DROP TABLE IF EXISTS test.t5;
+DROP TABLE IF EXISTS test.t6;
+**** Test 1 Simple DD backup and restore ****
+CREATE LOGFILE GROUP log_group1
+ADD UNDOFILE './log_group1/undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+CREATE TABLESPACE table_space1
+ADD DATAFILE './table_space1/datafile.dat'
+USE LOGFILE GROUP log_group1
+INITIAL_SIZE 12M
+ENGINE NDB;
+CREATE TABLE test.t1
+(pk1 MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 CHAR(50) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL) TABLESPACE table_space1 STORAGE DISK ENGINE=NDB;
+SELECT COUNT(*) FROM test.t1;
+COUNT(*)
+500
+SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
+pk1 c2 c3 hex(c4)
+1 Sweden 500 1
+2 Sweden 499 1
+3 Sweden 498 1
+4 Sweden 497 1
+5 Sweden 496 1
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM test.backup_info;
+LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM test.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+DROP TABLE test.backup_info;
+DROP TABLE test.t1;
+ALTER TABLESPACE table_space1
+DROP DATAFILE './table_space1/datafile.dat'
+ENGINE = NDB;
+DROP TABLESPACE table_space1
+ENGINE = NDB;
+DROP LOGFILE GROUP log_group1
+ENGINE =NDB;
+SELECT COUNT(*) FROM test.t1;
+COUNT(*)
+500
+SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
+pk1 c2 c3 hex(c4)
+1 Sweden 500 1
+2 Sweden 499 1
+3 Sweden 498 1
+4 Sweden 497 1
+5 Sweden 496 1
+**** Test 2 Mixed Cluster Test backup and restore ****
+CREATE TABLE test.t2
+(pk1 MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 VARCHAR(200) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL)ENGINE=NDB;
+CREATE TABLE test.t3 (c1 int not null auto_increment, data LONGBLOB, PRIMARY KEY(c1))TABLESPACE table_space1 STORAGE DISK ENGINE=NDB;
+CREATE TABLE test.t4 (c1 int not null auto_increment, data LONGBLOB, PRIMARY KEY(c1))ENGINE=NDB;
+SELECT COUNT(*) FROM test.t1;
+COUNT(*)
+500
+SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
+pk1 c2 c3 hex(c4)
+1 Sweden 500 1
+2 Sweden 499 1
+3 Sweden 498 1
+4 Sweden 497 1
+5 Sweden 496 1
+SELECT COUNT(*) FROM test.t2;
+COUNT(*)
+500
+SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY pk1 LIMIT 5;
+pk1 c2 c3 hex(c4)
+1 Sweden, Texas 500 0
+2 Sweden, Texas 499 0
+3 Sweden, Texas 498 0
+4 Sweden, Texas 497 0
+5 Sweden, Texas 496 0
+SELECT COUNT(*) FROM test.t3;
+COUNT(*)
+100
+SELECT LENGTH(data) FROM test.t3 WHERE c1 = 1;
+LENGTH(data)
+1024
+SELECT LENGTH(data) FROM test.t3 WHERE c1 = 2;
+LENGTH(data)
+16384
+SELECT COUNT(*) FROM test.t4;
+COUNT(*)
+100
+SELECT LENGTH(data) FROM test.t4 WHERE c1 = 1;
+LENGTH(data)
+1024
+SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2;
+LENGTH(data)
+16384
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM test.backup_info;
+LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM test.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+DROP TABLE test.backup_info;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
+DROP TABLE test.t4;
+ALTER TABLESPACE table_space1
+DROP DATAFILE './table_space1/datafile.dat'
+ENGINE = NDB;
+DROP TABLESPACE table_space1
+ENGINE = NDB;
+DROP LOGFILE GROUP log_group1
+ENGINE =NDB;
+SELECT COUNT(*) FROM test.t1;
+COUNT(*)
+500
+SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
+pk1 c2 c3 hex(c4)
+1 Sweden 500 1
+2 Sweden 499 1
+3 Sweden 498 1
+4 Sweden 497 1
+5 Sweden 496 1
+SELECT COUNT(*) FROM test.t2;
+COUNT(*)
+500
+SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY pk1 LIMIT 5;
+pk1 c2 c3 hex(c4)
+1 Sweden, Texas 500 0
+2 Sweden, Texas 499 0
+3 Sweden, Texas 498 0
+4 Sweden, Texas 497 0
+5 Sweden, Texas 496 0
+SELECT COUNT(*) FROM test.t3;
+COUNT(*)
+100
+SELECT LENGTH(data) FROM test.t3 WHERE c1 = 1;
+LENGTH(data)
+1024
+SELECT LENGTH(data) FROM test.t3 WHERE c1 = 2;
+LENGTH(data)
+16384
+SELECT COUNT(*) FROM test.t4;
+COUNT(*)
+100
+SELECT LENGTH(data) FROM test.t4 WHERE c1 = 1;
+LENGTH(data)
+1024
+SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2;
+LENGTH(data)
+16384
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
+DROP TABLE test.t4;
+**** Test 3 Adding partition Test backup and restore ****
+CREATE TABLESPACE table_space2
+ADD DATAFILE './table_space2/datafile.dat'
+USE LOGFILE GROUP log_group1
+INITIAL_SIZE 12M
+ENGINE NDB;
+CREATE TABLE test.t1 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(150) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space1 STORAGE DISK ENGINE=NDB PARTITION BY HASH(c3) PARTITIONS 4;
+CREATE TABLE test.t4 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(180) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY HASH(c3) PARTITIONS 2;
+CREATE TABLE test.t2 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space2 STORAGE DISK ENGINE=NDB PARTITION BY KEY(c3) (PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
+CREATE TABLE test.t5 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY KEY(pk1) (PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
+CREATE TABLE test.t3 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(202) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space2 STORAGE DISK ENGINE=NDB PARTITION BY RANGE (c3) PARTITIONS 3 (PARTITION x1 VALUES LESS THAN (105), PARTITION x2 VALUES LESS THAN (333), PARTITION x3 VALUES LESS THAN (720));
+CREATE TABLE test.t6 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(220) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY RANGE (pk1) PARTITIONS 2 (PARTITION x1 VALUES LESS THAN (333), PARTITION x2 VALUES LESS THAN (720));
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(150) NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */
+SHOW CREATE TABLE test.t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` text NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
+SHOW CREATE TABLE test.t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(202) NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */
+SHOW CREATE TABLE test.t4;
+Table Create Table
+t4 CREATE TABLE `t4` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(180) NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 2 */
+SHOW CREATE TABLE test.t5;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` text NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (pk1) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
+SHOW CREATE TABLE test.t6;
+Table Create Table
+t6 CREATE TABLE `t6` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(220) NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (pk1) (PARTITION x1 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (720) ENGINE = ndbcluster) */
+SELECT * FROM information_schema.partitions WHERE table_name= 't1';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t1 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+NULL test t1 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+NULL test t1 p2 NULL 3 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+NULL test t1 p3 NULL 4 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+SELECT * FROM information_schema.partitions WHERE table_name= 't2';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t2 p0 NULL 1 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+NULL test t2 p1 NULL 2 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+SELECT * FROM information_schema.partitions WHERE table_name= 't3';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t3 x1 NULL 1 NULL RANGE NULL c3 NULL 105 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+NULL test t3 x2 NULL 2 NULL RANGE NULL c3 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+NULL test t3 x3 NULL 3 NULL RANGE NULL c3 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+SELECT * FROM information_schema.partitions WHERE table_name= 't4';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t4 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+NULL test t4 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+SELECT * FROM information_schema.partitions WHERE table_name= 't5';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t5 p0 NULL 1 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+NULL test t5 p1 NULL 2 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+SELECT * FROM information_schema.partitions WHERE table_name= 't6';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t6 x1 NULL 1 NULL RANGE NULL pk1 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+NULL test t6 x2 NULL 2 NULL RANGE NULL pk1 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+SELECT COUNT(*) FROM test.t1;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 Sweden, Texas 2 0
+249 Sweden, Texas 4 0
+248 Sweden, Texas 6 0
+247 Sweden, Texas 8 0
+246 Sweden, Texas 10 0
+SELECT COUNT(*) FROM test.t2;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 1 1
+249 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 3 1
+248 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 5 1
+247 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 7 1
+246 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 9 1
+SELECT COUNT(*) FROM test.t3;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t3 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 0 1
+249 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 2 1
+248 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 4 1
+247 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 6 1
+246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1
+SELECT COUNT(*) FROM test.t4;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t4 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 Sweden, Texas 2 0
+249 Sweden, Texas 4 0
+248 Sweden, Texas 6 0
+247 Sweden, Texas 8 0
+246 Sweden, Texas 10 0
+SELECT COUNT(*) FROM test.t5;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t5 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 1 1
+249 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 3 1
+248 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 5 1
+247 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 7 1
+246 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 9 1
+SELECT COUNT(*) FROM test.t6;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t6 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 0 1
+249 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 2 1
+248 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 4 1
+247 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 6 1
+246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM test.backup_info;
+LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM test.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+DROP TABLE test.backup_info;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
+DROP TABLE test.t4;
+DROP TABLE test.t5;
+DROP TABLE test.t6;
+ALTER TABLESPACE table_space1
+DROP DATAFILE './table_space1/datafile.dat'
+ENGINE = NDB;
+ALTER TABLESPACE table_space2
+DROP DATAFILE './table_space2/datafile.dat'
+ENGINE = NDB;
+DROP TABLESPACE table_space1
+ENGINE = NDB;
+DROP TABLESPACE table_space2
+ENGINE = NDB;
+DROP LOGFILE GROUP log_group1
+ENGINE =NDB;
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(150) NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */
+SHOW CREATE TABLE test.t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` text NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
+SHOW CREATE TABLE test.t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(202) NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */
+SHOW CREATE TABLE test.t4;
+Table Create Table
+t4 CREATE TABLE `t4` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(180) NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 2 */
+SHOW CREATE TABLE test.t5;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` text NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (pk1) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
+SHOW CREATE TABLE test.t6;
+Table Create Table
+t6 CREATE TABLE `t6` (
+ `pk1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(220) NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` bit(1) NOT NULL,
+ PRIMARY KEY (`pk1`,`c3`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (pk1) (PARTITION x1 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (720) ENGINE = ndbcluster) */
+SELECT * FROM information_schema.partitions WHERE table_name= 't1';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t1 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+NULL test t1 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+NULL test t1 p2 NULL 3 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+NULL test t1 p3 NULL 4 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+SELECT * FROM information_schema.partitions WHERE table_name= 't2';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t2 p0 NULL 1 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+NULL test t2 p1 NULL 2 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+SELECT * FROM information_schema.partitions WHERE table_name= 't3';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t3 x1 NULL 1 NULL RANGE NULL c3 NULL 105 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+NULL test t3 x2 NULL 2 NULL RANGE NULL c3 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+NULL test t3 x3 NULL 3 NULL RANGE NULL c3 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+SELECT * FROM information_schema.partitions WHERE table_name= 't4';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t4 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+NULL test t4 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+SELECT * FROM information_schema.partitions WHERE table_name= 't5';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t5 p0 NULL 1 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+NULL test t5 p1 NULL 2 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+SELECT * FROM information_schema.partitions WHERE table_name= 't6';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t6 x1 NULL 1 NULL RANGE NULL pk1 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+NULL test t6 x2 NULL 2 NULL RANGE NULL pk1 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default default default
+SELECT COUNT(*) FROM test.t1;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 Sweden, Texas 2 0
+249 Sweden, Texas 4 0
+248 Sweden, Texas 6 0
+247 Sweden, Texas 8 0
+246 Sweden, Texas 10 0
+SELECT COUNT(*) FROM test.t2;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 1 1
+249 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 3 1
+248 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 5 1
+247 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 7 1
+246 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 9 1
+SELECT COUNT(*) FROM test.t3;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t3 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 0 1
+249 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 2 1
+248 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 4 1
+247 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 6 1
+246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1
+SELECT COUNT(*) FROM test.t4;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t4 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 Sweden, Texas 2 0
+249 Sweden, Texas 4 0
+248 Sweden, Texas 6 0
+247 Sweden, Texas 8 0
+246 Sweden, Texas 10 0
+SELECT COUNT(*) FROM test.t5;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t5 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 1 1
+249 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 3 1
+248 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 5 1
+247 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 7 1
+246 Sweden, Texas, ITALY, Kyle, JO, JBM,TU 9 1
+SELECT COUNT(*) FROM test.t6;
+COUNT(*)
+250
+SELECT pk1, c2, c3, hex(c4) FROM test.t6 ORDER BY c3 LIMIT 5;
+pk1 c2 c3 hex(c4)
+250 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 0 1
+249 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 2 1
+248 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 4 1
+247 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 6 1
+246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
+DROP TABLE test.t4;
+DROP TABLE test.t5;
+DROP TABLE test.t6;
+ALTER TABLESPACE table_space1 DROP DATAFILE './table_space1/datafile.dat' ENGINE=NDB;
+ALTER TABLESPACE table_space2 DROP DATAFILE './table_space2/datafile.dat' ENGINE=NDB;
+DROP TABLESPACE table_space1 ENGINE = NDB;
+DROP TABLESPACE table_space2 ENGINE = NDB;
+DROP LOGFILE GROUP log_group1 ENGINE = NDB;
diff --git a/mysql-test/r/ndb_dd_basic.result b/mysql-test/r/ndb_dd_basic.result
new file mode 100644
index 00000000000..83cb12ce964
--- /dev/null
+++ b/mysql-test/r/ndb_dd_basic.result
@@ -0,0 +1,475 @@
+DROP TABLE IF EXISTS t1;
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=MYISAM;
+Warnings:
+Error 1465 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE = 4M
+ENGINE=XYZ;
+Warnings:
+Error 1286 Unknown table engine 'XYZ'
+Error 1465 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M;
+Warnings:
+Error 1465 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
+set storage_engine=ndb;
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M;
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE = 4M
+ENGINE=NDB;
+set storage_engine=myisam;
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M
+ENGINE NDB;
+ALTER TABLESPACE ts1
+ADD DATAFILE 'datafile02.dat'
+INITIAL_SIZE = 4M
+ENGINE=NDB;
+CREATE TABLE t1
+(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
+TABLESPACE ts1 STORAGE DISK
+ENGINE=NDB;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `pk1` int(11) NOT NULL,
+ `b` int(11) NOT NULL,
+ `c` int(11) NOT NULL,
+ PRIMARY KEY (`pk1`)
+) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (0, 0, 0);
+SELECT * FROM t1;
+pk1 b c
+0 0 0
+INSERT INTO t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
+(11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15),
+(16,16,16),(17,17,17),(18,18,18),(19,19,19),(20,20,20),
+(21,21,21),(22,22,22),(23,23,23),(24,24,24),(25,25,25),
+(26,26,26),(27,27,27),(28,28,28),(29,29,29),(30,30,30),
+(31,31,31),(32,32,32),(33,33,33),(34,34,34),(35,35,35),
+(36,36,36),(37,37,37),(38,38,38),(39,39,39),(40,40,40),
+(41,41,41),(42,42,42),(43,43,43),(44,44,44),(45,45,45),
+(46,46,46),(47,47,47),(48,48,48),(49,49,49),(50,50,50),
+(51,51,51),(52,52,52),(53,53,53),(54,54,54),(55,55,55),
+(56,56,56),(57,57,57),(58,58,58),(59,59,59),(60,60,60),
+(61,61,61),(62,62,62),(63,63,63),(64,64,64),(65,65,65),
+(66,66,66),(67,67,67),(68,68,68),(69,69,69),(70,70,70),
+(71,71,71),(72,72,72),(73,73,73),(74,74,74),(75,75,75),
+(76,76,76),(77,77,77),(78,78,78),(79,79,79),(80,80,80),
+(81,81,81),(82,82,82),(83,83,83),(84,84,84),(85,85,85),
+(86,86,86),(87,87,87),(88,88,88),(89,89,89),(90,90,90),
+(91,91,91),(92,92,92),(93,93,93),(94,94,94),(95,95,95),
+(96,96,96),(97,97,97),(98,98,98),(99,99,99),(100,100,100),
+(101,101,101),(102,102,102),(103,103,103),(104,104,104),(105,105,105),
+(106,106,106),(107,107,107),(108,108,108),(109,109,109),(110,110,110),
+(111,111,111),(112,112,112),(113,113,113),(114,114,114),(115,115,115),
+(116,116,116),(117,117,117),(118,118,118),(119,119,119),(120,120,120),
+(121,121,121),(122,122,122),(123,123,123),(124,124,124),(125,125,125),
+(126,126,126),(127,127,127),(128,128,128),(129,129,129),(130,130,130),
+(131,131,131),(132,132,132),(133,133,133),(134,134,134),(135,135,135),
+(136,136,136),(137,137,137),(138,138,138),(139,139,139),(140,140,140),
+(141,141,141),(142,142,142),(143,143,143),(144,144,144),(145,145,145),
+(146,146,146),(147,147,147),(148,148,148),(149,149,149),(150,150,150),
+(151,151,151),(152,152,152),(153,153,153),(154,154,154),(155,155,155),
+(156,156,156),(157,157,157),(158,158,158),(159,159,159),(160,160,160),
+(161,161,161),(162,162,162),(163,163,163),(164,164,164),(165,165,165),
+(166,166,166),(167,167,167),(168,168,168),(169,169,169),(170,170,170),
+(171,171,171),(172,172,172),(173,173,173),(174,174,174),(175,175,175),
+(176,176,176),(177,177,177),(178,178,178),(179,179,179),(180,180,180),
+(181,181,181),(182,182,182),(183,183,183),(184,184,184),(185,185,185),
+(186,186,186),(187,187,187),(188,188,188),(189,189,189),(190,190,190),
+(191,191,191),(192,192,192),(193,193,193),(194,194,194),(195,195,195),
+(196,196,196),(197,197,197),(198,198,198),(199,199,199),(200,200,200),
+(201,201,201),(202,202,202),(203,203,203),(204,204,204),(205,205,205),
+(206,206,206),(207,207,207),(208,208,208),(209,209,209),(210,210,210),
+(211,211,211),(212,212,212),(213,213,213),(214,214,214),(215,215,215),
+(216,216,216),(217,217,217),(218,218,218),(219,219,219),(220,220,220),
+(221,221,221),(222,222,222),(223,223,223),(224,224,224),(225,225,225),
+(226,226,226),(227,227,227),(228,228,228),(229,229,229),(230,230,230),
+(231,231,231),(232,232,232),(233,233,233),(234,234,234),(235,235,235),
+(236,236,236),(237,237,237),(238,238,238),(239,239,239),(240,240,240),
+(241,241,241),(242,242,242),(243,243,243),(244,244,244),(245,245,245),
+(246,246,246),(247,247,247),(248,248,248),(249,249,249),(250,250,250),
+(251,251,251),(252,252,252),(253,253,253),(254,254,254),(255,255,255),
+(256,256,256),(257,257,257),(258,258,258),(259,259,259),(260,260,260),
+(261,261,261),(262,262,262),(263,263,263),(264,264,264),(265,265,265),
+(266,266,266),(267,267,267),(268,268,268),(269,269,269),(270,270,270),
+(271,271,271),(272,272,272),(273,273,273),(274,274,274),(275,275,275),
+(276,276,276),(277,277,277),(278,278,278),(279,279,279),(280,280,280),
+(281,281,281),(282,282,282),(283,283,283),(284,284,284),(285,285,285),
+(286,286,286),(287,287,287),(288,288,288),(289,289,289),(290,290,290),
+(291,291,291),(292,292,292),(293,293,293),(294,294,294),(295,295,295),
+(296,296,296),(297,297,297),(298,298,298),(299,299,299),(300,300,300),
+(301,301,301),(302,302,302),(303,303,303),(304,304,304),(305,305,305),
+(306,306,306),(307,307,307),(308,308,308),(309,309,309),(310,310,310),
+(311,311,311),(312,312,312),(313,313,313),(314,314,314),(315,315,315),
+(316,316,316),(317,317,317),(318,318,318),(319,319,319),(320,320,320),
+(321,321,321),(322,322,322),(323,323,323),(324,324,324),(325,325,325),
+(326,326,326),(327,327,327),(328,328,328),(329,329,329),(330,330,330),
+(331,331,331),(332,332,332),(333,333,333),(334,334,334),(335,335,335),
+(336,336,336),(337,337,337),(338,338,338),(339,339,339),(340,340,340),
+(341,341,341),(342,342,342),(343,343,343),(344,344,344),(345,345,345),
+(346,346,346),(347,347,347),(348,348,348),(349,349,349),(350,350,350),
+(351,351,351),(352,352,352),(353,353,353),(354,354,354),(355,355,355),
+(356,356,356),(357,357,357),(358,358,358),(359,359,359),(360,360,360),
+(361,361,361),(362,362,362),(363,363,363),(364,364,364),(365,365,365),
+(366,366,366),(367,367,367),(368,368,368),(369,369,369),(370,370,370),
+(371,371,371),(372,372,372),(373,373,373),(374,374,374),(375,375,375),
+(376,376,376),(377,377,377),(378,378,378),(379,379,379),(380,380,380),
+(381,381,381),(382,382,382),(383,383,383),(384,384,384),(385,385,385),
+(386,386,386),(387,387,387),(388,388,388),(389,389,389),(390,390,390),
+(391,391,391),(392,392,392),(393,393,393),(394,394,394),(395,395,395),
+(396,396,396),(397,397,397),(398,398,398),(399,399,399),(400,400,400),
+(401,401,401),(402,402,402),(403,403,403),(404,404,404),(405,405,405),
+(406,406,406),(407,407,407),(408,408,408),(409,409,409),(410,410,410),
+(411,411,411),(412,412,412),(413,413,413),(414,414,414),(415,415,415),
+(416,416,416),(417,417,417),(418,418,418),(419,419,419),(420,420,420),
+(421,421,421),(422,422,422),(423,423,423),(424,424,424),(425,425,425),
+(426,426,426),(427,427,427),(428,428,428),(429,429,429),(430,430,430),
+(431,431,431),(432,432,432),(433,433,433),(434,434,434),(435,435,435),
+(436,436,436),(437,437,437),(438,438,438),(439,439,439),(440,440,440),
+(441,441,441),(442,442,442),(443,443,443),(444,444,444),(445,445,445),
+(446,446,446),(447,447,447),(448,448,448),(449,449,449),(450,450,450),
+(451,451,451),(452,452,452),(453,453,453),(454,454,454),(455,455,455),
+(456,456,456),(457,457,457),(458,458,458),(459,459,459),(460,460,460),
+(461,461,461),(462,462,462),(463,463,463),(464,464,464),(465,465,465),
+(466,466,466),(467,467,467),(468,468,468),(469,469,469),(470,470,470),
+(471,471,471),(472,472,472),(473,473,473),(474,474,474),(475,475,475),
+(476,476,476),(477,477,477),(478,478,478),(479,479,479),(480,480,480),
+(481,481,481),(482,482,482),(483,483,483),(484,484,484),(485,485,485),
+(486,486,486),(487,487,487),(488,488,488),(489,489,489),(490,490,490),
+(491,491,491),(492,492,492),(493,493,493),(494,494,494),(495,495,495),
+(496,496,496),(497,497,497),(498,498,498),(499,499,499),(500, 500, 500);
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+501
+CREATE LOGFILE GROUP lg2
+ADD UNDOFILE 'x.dat'
+INITIAL_SIZE 10y
+ENGINE = NDB;
+ERROR HY000: A size parameter was incorrectly specified, either number or on the form 10M
+CREATE LOGFILE GROUP lg2
+ADD UNDOFILE 'x.dat'
+INITIAL_SIZE 10MB
+ENGINE = NDB;
+ERROR HY000: A size parameter was incorrectly specified, either number or on the form 10M
+CREATE LOGFILE GROUP lg2
+ADD UNDOFILE 'x.dat'
+INITIAL_SIZE 10 MB
+ENGINE = NDB;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MB
+ENGINE = NDB' at line 3
+CREATE LOGFILE GROUP lg2
+ADD UNDOFILE 'x.dat'
+INITIAL_SIZE 10 M
+ENGINE = NDB;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'M
+ENGINE = NDB' at line 3
+CREATE LOGFILE GROUP lg2
+ADD UNDOFILE 'x.dat'
+INITIAL_SIZE 1000000000000K
+ENGINE = NDB;
+ERROR HY000: The size number was correct but we don't allow the digit part to be more than 2 billion
+DROP TABLE t1;
+CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(4) NOT NULL, c CHAR(4) NOT NULL, KEY(b)) TABLESPACE ts1 STORAGE DISK ENGINE = NDB;
+INSERT INTO t1 VALUES (1,'1','1'), (2,'2','2'), (3,'3','3');
+BEGIN;
+UPDATE t1 SET b = '2' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+b
+2
+SELECT * FROM t1 WHERE a = 1;
+a b c
+1 2 1
+UPDATE t1 SET c = '2' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+b
+2
+SELECT * FROM t1 WHERE a = 1;
+a b c
+1 2 2
+UPDATE t1 SET b = '3' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+b
+3
+SELECT * FROM t1 WHERE a = 1;
+a b c
+1 3 2
+COMMIT;
+SELECT * FROM t1 ORDER BY 1;
+a b c
+1 3 2
+2 2 2
+3 3 3
+BEGIN;
+UPDATE t1 SET c = '3' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+b
+3
+SELECT * FROM t1 WHERE a = 1;
+a b c
+1 3 3
+UPDATE t1 SET b = '4' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+b
+4
+SELECT * FROM t1 WHERE a = 1;
+a b c
+1 4 3
+UPDATE t1 SET c = '4' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+b
+4
+SELECT * FROM t1 WHERE a = 1;
+a b c
+1 4 4
+COMMIT;
+SELECT * FROM t1 ORDER BY 1;
+a b c
+1 4 4
+2 2 2
+3 3 3
+UPDATE t1 SET b = '5' WHERE a = 1;
+SELECT * FROM t1 ORDER BY 1;
+a b c
+1 5 4
+2 2 2
+3 3 3
+UPDATE t1 SET b = '6' WHERE b = '5';
+SELECT * FROM t1 ORDER BY 1;
+a b c
+1 6 4
+2 2 2
+3 3 3
+UPDATE t1 SET b = '7'WHERE c = '4';
+SELECT * FROM t1 ORDER BY 1;
+a b c
+1 7 4
+2 2 2
+3 3 3
+UPDATE t1 SET c = '5' WHERE a = 1;
+SELECT * FROM t1 ORDER BY 1;
+a b c
+1 7 5
+2 2 2
+3 3 3
+UPDATE t1 SET c = '6' WHERE b = '7';
+SELECT * FROM t1 ORDER BY 1;
+a b c
+1 7 6
+2 2 2
+3 3 3
+UPDATE t1 SET c = '7' WHERE c = '6';
+SELECT * FROM t1 ORDER BY 1;
+a b c
+1 7 7
+2 2 2
+3 3 3
+DROP TABLE t1;
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(4) NOT NULL, c CHAR(4) NOT NULL, KEY(b)) TABLESPACE ts1 STORAGE DISK ENGINE NDB;
+INSERT INTO t1 VALUE (1,'1','1'), (2,'2','2'), (3,'3','3');
+BEGIN;
+UPDATE t1 SET b = '2' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+b
+2
+SELECT * FROM t1 WHERE a = 1;
+a b c
+1 2 1
+UPDATE t1 SET c = '2' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+b
+2
+SELECT * FROM t1 WHERE a = 1;
+a b c
+1 2 2
+UPDATE t1 SET b = '3' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+b
+3
+SELECT * FROM t1 WHERE a = 1;
+a b c
+1 3 2
+COMMIT;
+SELECT * FROM t1 ORDER BY 1;
+a b c
+1 3 2
+2 2 2
+3 3 3
+BEGIN;
+UPDATE t1 SET c = '3' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+b
+3
+SELECT * FROM t1 WHERE a = 1;
+a b c
+1 3 3
+UPDATE t1 SET b = '4' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+b
+4
+SELECT * FROM t1 WHERE a = 1;
+a b c
+1 4 3
+UPDATE t1 SET c = '4' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+b
+4
+SELECT * FROM t1 WHERE a = 1;
+a b c
+1 4 4
+COMMIT;
+SELECT * FROM t1 ORDER BY 1;
+a b c
+1 4 4
+2 2 2
+3 3 3
+UPDATE t1 SET b = '5' WHERE a = 1;
+SELECT * FROM t1 ORDER BY 1;
+a b c
+1 5 4
+2 2 2
+3 3 3
+UPDATE t1 SET b = '6' WHERE b = '5';
+SELECT * FROM t1 ORDER BY 1;
+a b c
+1 6 4
+2 2 2
+3 3 3
+UPDATE t1 SET b = '7' WHERE c = '4';
+SELECT * FROM t1 ORDER BY 1;
+a b c
+1 7 4
+2 2 2
+3 3 3
+UPDATE t1 SET c = '5' WHERE a = 1;
+SELECT * FROM t1 ORDER BY 1;
+a b c
+1 7 5
+2 2 2
+3 3 3
+UPDATE t1 SET c = '6' WHERE b = '7';
+SELECT * FROM t1 ORDER BY 1;
+a b c
+1 7 6
+2 2 2
+3 3 3
+UPDATE t1 SET c = '7' WHERE c = '6';
+SELECT * FROM t1 ORDER BY 1;
+a b c
+1 7 7
+2 2 2
+3 3 3
+DROP TABLE t1;
+CREATE TABLE t1 (
+a INT NOT NULL PRIMARY KEY,
+b TEXT NOT NULL
+) TABLESPACE ts1 STORAGE DISK ENGINE=NDBCLUSTER;
+set @x0 = '01234567012345670123456701234567';
+set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@x0);
+set @b2 = 'b2';
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+INSERT INTO t1 VALUES(1,@b1);
+INSERT INTO t1 VALUES(2,@b2);
+SELECT a,length(b),substr(b,1+2*900,2) FROM t1 WHERE a=1;
+a length(b) substr(b,1+2*900,2)
+1 2256 b1
+SELECT a,length(b),substr(b,1+2*9000,2) FROM t1 WHERE a=2;
+a length(b) substr(b,1+2*9000,2)
+2 20000 b2
+UPDATE t1 SET b=@b2 WHERE a=1;
+UPDATE t1 SET b=@b1 WHERE a=2;
+SELECT a,length(b),substr(b,1+2*9000,2) FROM t1 WHERE a=1;
+a length(b) substr(b,1+2*9000,2)
+1 20000 b2
+SELECT a,length(b),substr(b,1+2*900,2) FROM t1 WHERE a=2;
+a length(b) substr(b,1+2*900,2)
+2 2256 b1
+UPDATE t1 SET b=concat(b,b) WHERE a=1;
+UPDATE t1 SET b=concat(b,b) WHERE a=2;
+SELECT a,length(b),substr(b,1+4*9000,2) FROM t1 WHERE a=1;
+a length(b) substr(b,1+4*9000,2)
+1 40000 b2
+SELECT a,length(b),substr(b,1+4*900,2) FROM t1 WHERE a=2;
+a length(b) substr(b,1+4*900,2)
+2 4512 b1
+DELETE FROM t1 WHERE a=1;
+DELETE FROM t1 WHERE a=2;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+DROP TABLE t1;
+CREATE TABLE t1 (
+a int NOT NULL,
+b varchar(4000), -- must use 2 pages undo
+PRIMARY KEY using hash (a)
+)
+TABLESPACE ts1 STORAGE DISK ENGINE=NDBCLUSTER;
+set autocommit = 0;
+insert into t1 values(0,'x');
+insert into t1 values(1,'x');
+insert into t1 values(2,'x');
+insert into t1 values(3,'x');
+insert into t1 values(4,'x');
+insert into t1 values(5,'x');
+insert into t1 values(6,'x');
+insert into t1 values(7,'x');
+insert into t1 values(8,'x');
+delete from t1 where a = 0;
+commit;
+set autocommit = 1;
+drop table t1;
+create table test.t1 (f1 varchar(50) primary key, f2 text,f3 int)
+TABLESPACE ts1 STORAGE DISK engine=NDB;
+insert into test.t1 (f1,f2,f3)VALUES("111111","aaaaaa",1);
+insert into test.t1 (f1,f2,f3)VALUES("222222","bbbbbb",2);
+select * from test.t1 order by f1;
+f1 f2 f3
+111111 aaaaaa 1
+222222 bbbbbb 2
+select f1,f2 from test.t1 order by f2;
+f1 f2
+111111 aaaaaa
+222222 bbbbbb
+select f2 from test.t1 order by f2;
+f2
+aaaaaa
+bbbbbb
+select f1,f2 from test.t1 order by f1;
+f1 f2
+111111 aaaaaa
+222222 bbbbbb
+drop table test.t1;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile.dat'
+ENGINE = NDB;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile02.dat'
+ENGINE = NDB;
+DROP TABLESPACE ts1
+ENGINE = NDB;
+DROP LOGFILE GROUP lg1
+ENGINE =NDB;
diff --git a/mysql-test/r/ndb_dd_ddl.result b/mysql-test/r/ndb_dd_ddl.result
new file mode 100644
index 00000000000..eea80090768
--- /dev/null
+++ b/mysql-test/r/ndb_dd_ddl.result
@@ -0,0 +1,235 @@
+DROP TABLE IF EXISTS t1;
+DROP DATABASE IF EXISTS mysqltest;
+CREATE DATABASE mysqltest;
+**** Begin Duplicate Statement Testing ****
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 1M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+CREATE LOGFILE GROUP lg2
+ADD UNDOFILE 'undofile2.dat'
+INITIAL_SIZE 1M
+UNDO_BUFFER_SIZE 1M
+ENGINE NDB;
+ERROR HY000: Failed to create LOGFILE GROUP
+SHOW WARNINGS;
+Level Code Message
+Error 1296 Got error 1514 'Currently there is a limit of one logfile group' from NDB
+Error 1515 Failed to create LOGFILE GROUP
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 1M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+ERROR HY000: Failed to create LOGFILE GROUP
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE 1M ENGINE NDB;
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE 1M ENGINE=NDB;
+ERROR HY000: Failed to alter: CREATE UNDOFILE
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 1M
+ENGINE NDB;
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 1M
+ENGINE NDB;
+ERROR HY000: Failed to create TABLESPACE
+ALTER TABLESPACE ts1
+ADD DATAFILE 'datafile2.dat'
+INITIAL_SIZE 1M
+ENGINE=NDB;
+ALTER TABLESPACE ts1
+ADD DATAFILE 'datafile2.dat'
+INITIAL_SIZE 1M
+ENGINE=NDB;
+ERROR HY000: Failed to alter: CREATE DATAFILE
+CREATE TABLE mysqltest.t1
+(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
+TABLESPACE ts1 STORAGE DISK
+ENGINE=NDB;
+CREATE TABLE mysqltest.t1
+(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
+TABLESPACE ts1 STORAGE DISK
+ENGINE=NDB;
+ERROR 42S01: Table 't1' already exists
+CREATE TABLE mysqltest.t1
+(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
+ENGINE=NDB;
+ERROR 42S01: Table 't1' already exists
+DROP TABLE mysqltest.t1;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile2.dat'
+ENGINE=NDB;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile2.dat'
+ENGINE=NDB;
+ERROR HY000: Failed to alter: NO SUCH FILE
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile.dat'
+ENGINE=NDB;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile.dat'
+ENGINE=NDB;
+ERROR HY000: Failed to alter: NO SUCH FILE
+DROP TABLESPACE ts1
+ENGINE=NDB;
+DROP TABLESPACE ts1
+ENGINE=NDB;
+ERROR HY000: Failed to drop TABLESPACE
+DROP LOGFILE GROUP lg1
+ENGINE=NDB;
+DROP LOGFILE GROUP lg1
+ENGINE=NDB;
+ERROR HY000: Failed to drop LOGFILE GROUP
+DROP DATABASE IF EXISTS mysqltest;
+**** End Duplicate Statement Testing ****
+
+**** Begin Statment CaSe Testing ****
+creaTE LOgfilE GrOuP lg1
+adD undoFILE 'undofile.dat'
+initiAL_siZE 1M
+UnDo_BuFfEr_SiZe = 1M
+ENGInE=NDb;
+altER LOgFiLE GrOUp lg1
+AdD UnDOfILe 'uNdOfiLe02.daT'
+INItIAl_SIzE 1M ENgINE nDB;
+CrEAtE TABLEspaCE ts1
+ADD DATAfilE 'datafile.dat'
+UsE LoGFiLE GRoUP lg1
+INITiaL_SizE 1M
+ENGiNe NDb;
+AlTeR tAbLeSpAcE ts1
+AdD DaTaFiLe 'dAtAfiLe2.daT'
+InItIaL_SiZe 1M
+EnGiNe=NDB;
+CREATE TABLE t1
+(pk1 int not null primary key, b int not null, c int not null)
+TABLEspace ts1 storAGE dISk
+ENGine nDb;
+DROP TABLE t1;
+AlteR TAblespaCE ts1
+droP DATAfile 'dAtAfiLe2.daT'
+ENGINE=NDB;
+ALter tablesPACE ts1
+dROp dAtAfIlE 'datafile.dat'
+ENGine=Ndb;
+DrOp TaBleSpAcE ts1
+engINE=ndB;
+DrOp lOgFiLe GrOuP lg1
+EnGiNe=nDb;
+**** End Statment CaSe Testing ****
+
+**** Begin = And No = Testing ****
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE=1M
+UNDO_BUFFER_SIZE=1M
+ENGINE=NDB;
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE=1M
+ENGINE=NDB;
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE=1M
+ENGINE=NDB;
+ALTER TABLESPACE ts1
+ADD DATAFILE 'datafile2.dat'
+INITIAL_SIZE=1M
+ENGINE=NDB;
+CREATE TABLE t1
+(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
+TABLESPACE ts1 STORAGE DISK
+ENGINE=NDB;
+DROP TABLE t1;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile2.dat'
+ENGINE=NDB;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile.dat'
+ENGINE=NDB;
+DROP TABLESPACE ts1
+ENGINE=NDB;
+DROP LOGFILE GROUP lg1
+ENGINE=NDB;
+
+**** End of = ****
+
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 1M
+UNDO_BUFFER_SIZE 1M
+ENGINE NDB;
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE 1M
+ENGINE NDB;
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 1M
+ENGINE NDB;
+ALTER TABLESPACE ts1
+ADD DATAFILE 'datafile2.dat'
+INITIAL_SIZE 1M
+ENGINE NDB;
+CREATE TABLE t1
+(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
+TABLESPACE ts1 STORAGE DISK
+ENGINE NDB;
+CREATE INDEX b_i on t1(b);
+CREATE INDEX bc_i on t1(b, c);
+DROP TABLE t1;
+CREATE TABLESPACE ts2
+ADD DATAFILE 'datafile3.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 1M
+ENGINE NDB;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile3.dat'
+ENGINE NDB;
+ERROR HY000: Failed to alter: NO SUCH FILE
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile2.dat'
+ENGINE NDB;
+ERROR HY000: Failed to alter: NO SUCH FILE
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile2.dat'
+ENGINE NDB;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile.dat'
+ENGINE NDB;
+DROP TABLESPACE ts1
+ENGINE NDB;
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile3.dat'
+ENGINE NDB;
+DROP TABLESPACE ts2
+ENGINE NDB;
+DROP LOGFILE GROUP lg1
+ENGINE NDB;
+**** End = And No = ****
+create table t1 (a int primary key) engine = myisam;
+create logfile group lg1 add undofile 'MYSQLTEST_VARDIR/master-data/test/t1.frm' initial_size 1M undo_buffer_size = 1M engine=ndb;;
+ERROR HY000: Failed to create UNDOFILE
+create logfile group lg1
+add undofile 'undofile.dat'
+initial_size 1M
+undo_buffer_size = 1M
+engine=ndb;
+create tablespace ts1 add datafile 'MYSQLTEST_VARDIR/master-data/test/t1.frm' use logfile group lg1 initial_size 1M engine ndb;;
+ERROR HY000: Failed to create DATAFILE
+drop tablespace ts1
+engine ndb;
+ERROR HY000: Failed to drop TABLESPACE
+drop logfile group lg1
+engine ndb;
+drop table t1;
diff --git a/mysql-test/r/ndb_dd_disk2memory.result b/mysql-test/r/ndb_dd_disk2memory.result
new file mode 100644
index 00000000000..9da506bf743
--- /dev/null
+++ b/mysql-test/r/ndb_dd_disk2memory.result
@@ -0,0 +1,505 @@
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+**** Test Setup Section ****
+CREATE LOGFILE GROUP log_group1
+ADD UNDOFILE './log_group1/undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+CREATE TABLESPACE table_space1
+ADD DATAFILE './table_space1/datafile.dat'
+USE LOGFILE GROUP log_group1
+INITIAL_SIZE 12M
+ENGINE NDB;
+CREATE TABLE test.t1
+(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
+TABLESPACE table_space1 STORAGE DISK
+ENGINE=NDB;
+CREATE TABLE test.t2
+(pk2 INT NOT NULL PRIMARY KEY, b2 INT NOT NULL, c2 INT NOT NULL)
+ENGINE=NDB;
+
+**** Data load for first test ****
+INSERT INTO test.t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
+(11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15),
+(16,16,16),(17,17,17),(18,18,18),(19,19,19),(20,20,20),
+(21,21,21),(22,22,22),(23,23,23),(24,24,24),(25,25,25),
+(26,26,26),(27,27,27),(28,28,28),(29,29,29),(30,30,30),
+(31,31,31),(32,32,32),(33,33,33),(34,34,34),(35,35,35),
+(36,36,36),(37,37,37),(38,38,38),(39,39,39),(40,40,40),
+(41,41,41),(42,42,42),(43,43,43),(44,44,44),(45,45,45),
+(46,46,46),(47,47,47),(48,48,48),(49,49,49),(50,50,50),
+(51,51,51),(52,52,52),(53,53,53),(54,54,54),(55,55,55),
+(56,56,56),(57,57,57),(58,58,58),(59,59,59),(60,60,60),
+(61,61,61),(62,62,62),(63,63,63),(64,64,64),(65,65,65),
+(66,66,66),(67,67,67),(68,68,68),(69,69,69),(70,70,70),
+(71,71,71),(72,72,72),(73,73,73),(74,74,74),(75,75,75);
+INSERT INTO test.t2 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
+(11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15),
+(16,16,16),(17,17,17),(18,18,18),(19,19,19),(20,20,20),
+(21,21,21),(22,22,22),(23,23,23),(24,24,24),(25,25,25),
+(26,26,26),(27,27,27),(28,28,28),(29,29,29),(30,30,30),
+(31,31,31),(32,32,32),(33,33,33),(34,34,34),(35,35,35),
+(36,36,36),(37,37,37),(38,38,38),(39,39,39),(40,40,40),
+(41,41,41),(42,42,42),(43,43,43),(44,44,44),(45,45,45),
+(46,46,46),(47,47,47),(48,48,48),(49,49,49),(50,50,50),
+(51,51,51),(52,52,52),(53,53,53),(54,54,54),(55,55,55),
+(56,56,56),(57,57,57),(58,58,58),(59,59,59),(60,60,60),
+(61,61,61),(62,62,62),(63,63,63),(64,64,64),(65,65,65),
+(66,66,66),(67,67,67),(68,68,68),(69,69,69),(70,70,70),
+(71,71,71),(72,72,72),(73,73,73),(74,74,74),(75,75,75);
+
+*** Test 1 Section Begins ***
+SELECT COUNT(*) FROM test.t2 LEFT JOIN test.t1 ON pk2=pk1 WHERE b2 IN (4);
+COUNT(*)
+1
+SELECT * FROM test.t2 LEFT JOIN test.t1 ON pk2=pk1 WHERE b2 IN (4);
+pk2 b2 c2 pk1 b c
+4 4 4 4 4 4
+SELECT COUNT(*) FROM test.t1 LEFT JOIN test.t2 ON pk1=pk2 WHERE b IN (4);
+COUNT(*)
+1
+SELECT COUNT(*) FROM test.t1 LEFT JOIN test.t2 ON b=b2 WHERE pk1 IN (75);
+COUNT(*)
+1
+SELECT b, c FROM test.t1 LEFT JOIN test.t2 ON pk1=pk2 ORDER BY b;
+b c
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+13 13
+14 14
+15 15
+16 16
+17 17
+18 18
+19 19
+20 20
+21 21
+22 22
+23 23
+24 24
+25 25
+26 26
+27 27
+28 28
+29 29
+30 30
+31 31
+32 32
+33 33
+34 34
+35 35
+36 36
+37 37
+38 38
+39 39
+40 40
+41 41
+42 42
+43 43
+44 44
+45 45
+46 46
+47 47
+48 48
+49 49
+50 50
+51 51
+52 52
+53 53
+54 54
+55 55
+56 56
+57 57
+58 58
+59 59
+60 60
+61 61
+62 62
+63 63
+64 64
+65 65
+66 66
+67 67
+68 68
+69 69
+70 70
+71 71
+72 72
+73 73
+74 74
+75 75
+
+*** Setup for test 2 ****
+DELETE FROM test.t1;
+INSERT INTO test.t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
+(11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15),
+(16,16,16),(17,17,17),(18,18,18),(19,19,19),(20,20,20),
+(21,21,21),(22,22,22),(23,23,23),(24,24,24),(25,25,25),
+(26,26,26),(27,27,27),(28,28,28),(29,29,29),(30,30,30),
+(31,31,31),(32,32,32),(33,33,33),(34,34,34),(35,35,35),
+(36,36,36),(37,37,37),(38,38,38),(39,39,39),(40,40,40),
+(41,41,41),(42,42,42),(43,43,43),(44,44,44),(45,45,45);
+
+**** Test Section 2 ****
+SELECT b, c FROM test.t1 LEFT JOIN test.t2 ON pk1=pk2 ORDER BY b;
+b c
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+13 13
+14 14
+15 15
+16 16
+17 17
+18 18
+19 19
+20 20
+21 21
+22 22
+23 23
+24 24
+25 25
+26 26
+27 27
+28 28
+29 29
+30 30
+31 31
+32 32
+33 33
+34 34
+35 35
+36 36
+37 37
+38 38
+39 39
+40 40
+41 41
+42 42
+43 43
+44 44
+45 45
+SELECT COUNT(*) FROM test.t1 LEFT JOIN test.t2 ON b=b2;
+COUNT(*)
+45
+SELECT COUNT(*) FROM test.t1 RIGHT JOIN test.t2 ON b=b2;
+COUNT(*)
+75
+SHOW CREATE TABLE test.t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `pk2` int(11) NOT NULL,
+ `b2` int(11) NOT NULL,
+ `c2` int(11) NOT NULL,
+ PRIMARY KEY (`pk2`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `pk1` int(11) NOT NULL,
+ `b` int(11) NOT NULL,
+ `c` int(11) NOT NULL,
+ PRIMARY KEY (`pk1`)
+) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
+ALTER TABLE test.t2 TABLESPACE table_space1 STORAGE DISK
+ENGINE=NDB;
+SHOW CREATE TABLE test.t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `pk2` int(11) NOT NULL,
+ `b2` int(11) NOT NULL,
+ `c2` int(11) NOT NULL,
+ PRIMARY KEY (`pk2`)
+) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
+ALTER TABLE test.t1 ENGINE=NDBCLUSTER;
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `pk1` int(11) NOT NULL,
+ `b` int(11) NOT NULL,
+ `c` int(11) NOT NULL,
+ PRIMARY KEY (`pk1`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+*** Setup for Test Section 3 ***
+CREATE TABLE test.t1 (
+usr_id INT unsigned NOT NULL,
+uniq_id INT unsigned NOT NULL AUTO_INCREMENT,
+start_num INT unsigned NOT NULL DEFAULT 1,
+increment INT unsigned NOT NULL DEFAULT 1,
+PRIMARY KEY (uniq_id),
+INDEX usr_uniq_idx (usr_id, uniq_id),
+INDEX uniq_usr_idx (uniq_id, usr_id))
+TABLESPACE table_space1 STORAGE DISK
+ENGINE=NDB;
+CREATE TABLE test.t2 (
+id INT unsigned NOT NULL DEFAULT 0,
+usr2_id INT unsigned NOT NULL DEFAULT 0,
+max INT unsigned NOT NULL DEFAULT 0,
+c_amount INT unsigned NOT NULL DEFAULT 0,
+d_max INT unsigned NOT NULL DEFAULT 0,
+d_num INT unsigned NOT NULL DEFAULT 0,
+orig_time INT unsigned NOT NULL DEFAULT 0,
+c_time INT unsigned NOT NULL DEFAULT 0,
+active ENUM ("no","yes") NOT NULL,
+PRIMARY KEY (id,usr2_id),
+INDEX id_idx (id),
+INDEX usr2_idx (usr2_id))
+ENGINE=NDB;
+INSERT INTO test.t1 VALUES (3,NULL,0,50),(3,NULL,0,200),(3,NULL,0,25),(3,NULL,0,84676),(3,NULL,0,235),(3,NULL,0,10),(3,NULL,0,3098),(3,NULL,0,2947),(3,NULL,0,8987),(3,NULL,0,8347654),(3,NULL,0,20398),(3,NULL,0,8976),(3,NULL,0,500),(3,NULL,0,198);
+
+**** Test Section 3 ****
+SELECT test.t1.usr_id,test.t1.uniq_id,test.t1.increment,
+test.t2.usr2_id,test.t2.c_amount,test.t2.max
+FROM test.t1
+LEFT JOIN test.t2 ON test.t2.id = test.t1.uniq_id
+WHERE test.t1.uniq_id = 4
+ORDER BY test.t2.c_amount;
+usr_id uniq_id increment usr2_id c_amount max
+3 4 84676 NULL NULL NULL
+INSERT INTO test.t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes');
+INSERT INTO test.t2 VALUES (4,3,3000,6000,0,0,746584,837484,'yes');
+INSERT INTO test.t2 VALUES (7,3,1000,2000,0,0,746294,937484,'yes');
+SELECT test.t1.usr_id,test.t1.uniq_id,test.t1.increment,
+test.t2.usr2_id,test.t2.c_amount,test.t2.max
+FROM test.t1
+LEFT JOIN test.t2 ON test.t2.id = test.t1.uniq_id
+WHERE test.t1.uniq_id = 4
+ORDER BY test.t2.c_amount;
+usr_id uniq_id increment usr2_id c_amount max
+3 4 84676 3 6000 3000
+
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+CREATE TABLE test.t1 (
+a1 smallint NOT NULL,
+a2 int NOT NULL,
+a3 bigint NOT NULL,
+a4 char(10),
+a5 decimal(5,1),
+a6 time,
+a7 date,
+a8 datetime,
+a9 VARCHAR(255),
+a10 blob,
+PRIMARY KEY(a1)
+) TABLESPACE table_space1 STORAGE DISK ENGINE=NDB;
+CREATE TABLE test.t2 (
+b1 smallint NOT NULL,
+b2 int NOT NULL,
+b3 bigint NOT NULL,
+b4 char(10),
+b5 decimal(5,1),
+b6 time,
+b7 date,
+b8 datetime,
+b9 VARCHAR(255),
+b10 blob,
+PRIMARY KEY(b1)
+) ENGINE=NDB;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a1` smallint(6) NOT NULL,
+ `a2` int(11) NOT NULL,
+ `a3` bigint(20) NOT NULL,
+ `a4` char(10) DEFAULT NULL,
+ `a5` decimal(5,1) DEFAULT NULL,
+ `a6` time DEFAULT NULL,
+ `a7` date DEFAULT NULL,
+ `a8` datetime DEFAULT NULL,
+ `a9` varchar(255) DEFAULT NULL,
+ `a10` blob,
+ PRIMARY KEY (`a1`),
+ KEY `a2` (`a2`),
+ KEY `a3` (`a3`),
+ KEY `a8` (`a8`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `b1` smallint(6) NOT NULL,
+ `b2` int(11) NOT NULL,
+ `b3` bigint(20) NOT NULL,
+ `b4` char(10) DEFAULT NULL,
+ `b5` decimal(5,1) DEFAULT NULL,
+ `b6` time DEFAULT NULL,
+ `b7` date DEFAULT NULL,
+ `b8` datetime DEFAULT NULL,
+ `b9` varchar(255) DEFAULT NULL,
+ `b10` blob,
+ PRIMARY KEY (`b1`),
+ KEY `b2` (`b2`),
+ KEY `b3` (`b3`),
+ KEY `b8` (`b8`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
+1 2 2000000001 aaa1 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb1 binary data
+2 3 2000000002 aaa2 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb2 binary data
+3 4 2000000003 aaa3 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb3 binary data
+4 5 2000000004 aaa4 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb4 binary data
+5 6 2000000005 aaa5 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb5 binary data
+6 7 2000000006 aaa6 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb6 binary data
+7 8 2000000007 aaa7 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb7 binary data
+8 9 2000000008 aaa8 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb8 binary data
+9 10 2000000009 aaa9 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb9 binary data
+10 11 2000000010 aaa10 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb10 binary data
+11 12 2000000011 aaa11 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb11 binary data
+12 13 2000000012 aaa12 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb12 binary data
+13 14 2000000013 aaa13 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb13 binary data
+14 15 2000000014 aaa14 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb14 binary data
+15 16 2000000015 aaa15 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb15 binary data
+16 17 2000000016 aaa16 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb16 binary data
+17 18 2000000017 aaa17 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb17 binary data
+18 19 2000000018 aaa18 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb18 binary data
+19 20 2000000019 aaa19 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb19 binary data
+20 21 2000000020 aaa20 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb20 binary data
+b1 b2 b3 b4 b5 b6 b7 b8 b9 b10
+3 4 3000000001 aaa1 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb1 binary data
+4 5 3000000002 aaa2 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb2 binary data
+5 6 3000000003 aaa3 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb3 binary data
+6 7 3000000004 aaa4 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb4 binary data
+7 8 3000000005 aaa5 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb5 binary data
+8 9 3000000006 aaa6 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb6 binary data
+9 10 3000000007 aaa7 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb7 binary data
+10 11 3000000008 aaa8 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb8 binary data
+11 12 3000000009 aaa9 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb9 binary data
+12 13 3000000010 aaa10 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb10 binary data
+13 14 3000000011 aaa11 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb11 binary data
+14 15 3000000012 aaa12 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb12 binary data
+15 16 3000000013 aaa13 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb13 binary data
+16 17 3000000014 aaa14 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb14 binary data
+17 18 3000000015 aaa15 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb15 binary data
+18 19 3000000016 aaa16 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb16 binary data
+19 20 3000000017 aaa17 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb17 binary data
+20 21 3000000018 aaa18 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb18 binary data
+21 22 3000000019 aaa19 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb19 binary data
+22 23 3000000020 aaa20 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb20 binary data
+COUNT(a1) a1 COUNT(a1)*a1
+1 1 1
+1 2 2
+1 3 3
+1 4 4
+1 5 5
+1 6 6
+1 7 7
+1 8 8
+1 9 9
+1 10 10
+1 11 11
+1 12 12
+1 13 13
+1 14 14
+1 15 15
+1 16 16
+1 17 17
+1 18 18
+1 19 19
+1 20 20
+COUNT(a2) (a2+1) COUNT(a2)*(a2+0)
+1 3 2
+1 4 3
+1 5 4
+1 6 5
+1 7 6
+1 8 7
+1 9 8
+1 10 9
+1 11 10
+1 12 11
+1 13 12
+1 14 13
+1 15 14
+1 16 15
+1 17 16
+1 18 17
+1 19 18
+1 20 19
+1 21 20
+1 22 21
+a
+8
+7
+6
+5
+a c
+8 Clavin
+7 Serge
+6 Jeb
+5 Stewart
+4 Martin
+3 Pekka
+a
+2
+3
+4
+5
+6
+7
+8
+a c
+4 Martin
+5 Stewart
+6 Jeb
+7 Serge
+8 Clavin
+a
+1
+1
+1
+2
+2
+3
+3
+a
+3
+2
+1
+a
+3
+2
+1
+a
+1
+2
+3
+email shipcode
+test1@testdomain.com Z001
+test2@testdomain.com R002
+test2@testdomain.com Z001
+test3@testdomain.com Z001
+email
+test1@testdomain.com
+test2@testdomain.com
+test3@testdomain.com
+email shipcode
+test1@testdomain.com Z001
+test2@testdomain.com Z001
+test2@testdomain.com R002
+test3@testdomain.com Z001
diff --git a/mysql-test/r/ndb_dd_dump.result b/mysql-test/r/ndb_dd_dump.result
new file mode 100644
index 00000000000..9b1a1295588
--- /dev/null
+++ b/mysql-test/r/ndb_dd_dump.result
@@ -0,0 +1,218 @@
+DROP TABLE IF EXISTS t1, t2, t3;
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile_lg1_01.dat'
+INITIAL_SIZE 2M
+UNDO_BUFFER_SIZE = 1M
+ENGINE NDB;
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile_lg1_02.dat'
+INITIAL_SIZE = 4M
+ENGINE NDB;
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile_ts1_01.dat'
+USE LOGFILE GROUP lg1
+EXTENT_SIZE 1M
+INITIAL_SIZE 2M
+ENGINE NDB;
+ALTER TABLESPACE ts1
+ADD DATAFILE 'datafile_ts1_02.dat'
+INITIAL_SIZE = 1M
+ENGINE=NDB;
+CREATE TABLESPACE ts2
+ADD DATAFILE 'datafile_ts2_01.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 2M
+ENGINE NDB;
+CREATE TABLESPACE ts3
+ADD DATAFILE 'datafile_ts3_01.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 4M
+ENGINE NDB;
+CREATE TABLE t1
+(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
+TABLESPACE ts1 STORAGE DISK
+ENGINE=NDB;
+CREATE TABLE t2
+(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
+TABLESPACE ts2 STORAGE DISK
+ENGINE=NDB;
+CREATE TABLE t3
+(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
+TABLESPACE ts3 STORAGE DISK
+ENGINE=NDB;
+INSERT INTO t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
+(11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15),
+(16,16,16),(17,17,17),(18,18,18),(19,19,19),(20,20,20),
+(21,21,21),(22,22,22),(23,23,23),(24,24,24),(25,25,25),
+(26,26,26),(27,27,27),(28,28,28),(29,29,29),(30,30,30),
+(31,31,31),(32,32,32),(33,33,33),(34,34,34),(35,35,35),
+(36,36,36),(37,37,37),(38,38,38),(39,39,39),(40,40,40),
+(41,41,41),(42,42,42),(43,43,43),(44,44,44),(45,45,45),
+(46,46,46),(47,47,47),(48,48,48),(49,49,49),(50,50,50),
+(51,51,51),(52,52,52),(53,53,53),(54,54,54),(55,55,55),
+(56,56,56),(57,57,57),(58,58,58),(59,59,59),(60,60,60),
+(61,61,61),(62,62,62),(63,63,63),(64,64,64),(65,65,65),
+(66,66,66),(67,67,67),(68,68,68),(69,69,69),(70,70,70),
+(71,71,71),(72,72,72),(73,73,73),(74,74,74),(75,75,75),
+(76,76,76),(77,77,77),(78,78,78),(79,79,79),(80,80,80),
+(81,81,81),(82,82,82),(83,83,83),(84,84,84),(85,85,85),
+(86,86,86),(87,87,87),(88,88,88),(89,89,89),(90,90,90),
+(91,91,91),(92,92,92),(93,93,93),(94,94,94),(95,95,95),
+(96,96,96),(97,97,97),(98,98,98),(99,99,99),(100,100,100),
+(101,101,101),(102,102,102),(103,103,103),(104,104,104),(105,105,105),
+(106,106,106),(107,107,107),(108,108,108),(109,109,109),(110,110,110),
+(111,111,111),(112,112,112),(113,113,113),(114,114,114),(115,115,115),
+(116,116,116),(117,117,117),(118,118,118),(119,119,119),(120,120,120),
+(121,121,121),(122,122,122),(123,123,123),(124,124,124),(125,125,125),
+(126,126,126),(127,127,127),(128,128,128),(129,129,129),(130,130,130),
+(131,131,131),(132,132,132),(133,133,133),(134,134,134),(135,135,135),
+(136,136,136),(137,137,137),(138,138,138),(139,139,139),(140,140,140),
+(141,141,141),(142,142,142),(143,143,143),(144,144,144),(145,145,145),
+(146,146,146),(147,147,147),(148,148,148),(149,149,149),(150,150,150),
+(151,151,151),(152,152,152),(153,153,153),(154,154,154),(155,155,155),
+(156,156,156),(157,157,157),(158,158,158),(159,159,159),(160,160,160),
+(161,161,161),(162,162,162),(163,163,163),(164,164,164),(165,165,165),
+(166,166,166),(167,167,167),(168,168,168),(169,169,169),(170,170,170),
+(171,171,171),(172,172,172),(173,173,173),(174,174,174),(175,175,175),
+(176,176,176),(177,177,177),(178,178,178),(179,179,179),(180,180,180),
+(181,181,181),(182,182,182),(183,183,183),(184,184,184),(185,185,185),
+(186,186,186),(187,187,187),(188,188,188),(189,189,189),(190,190,190),
+(191,191,191),(192,192,192),(193,193,193),(194,194,194),(195,195,195),
+(196,196,196),(197,197,197),(198,198,198),(199,199,199),(200,200,200),
+(201,201,201),(202,202,202),(203,203,203),(204,204,204),(205,205,205),
+(206,206,206),(207,207,207),(208,208,208),(209,209,209),(210,210,210),
+(211,211,211),(212,212,212),(213,213,213),(214,214,214),(215,215,215),
+(216,216,216),(217,217,217),(218,218,218),(219,219,219),(220,220,220),
+(221,221,221),(222,222,222),(223,223,223),(224,224,224),(225,225,225),
+(226,226,226),(227,227,227),(228,228,228),(229,229,229),(230,230,230),
+(231,231,231),(232,232,232),(233,233,233),(234,234,234),(235,235,235),
+(236,236,236),(237,237,237),(238,238,238),(239,239,239),(240,240,240),
+(241,241,241),(242,242,242),(243,243,243),(244,244,244),(245,245,245),
+(246,246,246),(247,247,247),(248,248,248),(249,249,249),(250,250,250),
+(251,251,251),(252,252,252),(253,253,253),(254,254,254),(255,255,255),
+(256,256,256),(257,257,257),(258,258,258),(259,259,259),(260,260,260),
+(261,261,261),(262,262,262),(263,263,263),(264,264,264),(265,265,265),
+(266,266,266),(267,267,267),(268,268,268),(269,269,269),(270,270,270),
+(271,271,271),(272,272,272),(273,273,273),(274,274,274),(275,275,275),
+(276,276,276),(277,277,277),(278,278,278),(279,279,279),(280,280,280),
+(281,281,281),(282,282,282),(283,283,283),(284,284,284),(285,285,285),
+(286,286,286),(287,287,287),(288,288,288),(289,289,289),(290,290,290),
+(291,291,291),(292,292,292),(293,293,293),(294,294,294),(295,295,295),
+(296,296,296),(297,297,297),(298,298,298),(299,299,299),(300,300,300),
+(301,301,301),(302,302,302),(303,303,303),(304,304,304),(305,305,305),
+(306,306,306),(307,307,307),(308,308,308),(309,309,309),(310,310,310),
+(311,311,311),(312,312,312),(313,313,313),(314,314,314),(315,315,315),
+(316,316,316),(317,317,317),(318,318,318),(319,319,319),(320,320,320),
+(321,321,321),(322,322,322),(323,323,323),(324,324,324),(325,325,325),
+(326,326,326),(327,327,327),(328,328,328),(329,329,329),(330,330,330),
+(331,331,331),(332,332,332),(333,333,333),(334,334,334),(335,335,335),
+(336,336,336),(337,337,337),(338,338,338),(339,339,339),(340,340,340),
+(341,341,341),(342,342,342),(343,343,343),(344,344,344),(345,345,345),
+(346,346,346),(347,347,347),(348,348,348),(349,349,349),(350,350,350),
+(351,351,351),(352,352,352),(353,353,353),(354,354,354),(355,355,355),
+(356,356,356),(357,357,357),(358,358,358),(359,359,359),(360,360,360),
+(361,361,361),(362,362,362),(363,363,363),(364,364,364),(365,365,365),
+(366,366,366),(367,367,367),(368,368,368),(369,369,369),(370,370,370),
+(371,371,371),(372,372,372),(373,373,373),(374,374,374),(375,375,375),
+(376,376,376),(377,377,377),(378,378,378),(379,379,379),(380,380,380),
+(381,381,381),(382,382,382),(383,383,383),(384,384,384),(385,385,385),
+(386,386,386),(387,387,387),(388,388,388),(389,389,389),(390,390,390),
+(391,391,391),(392,392,392),(393,393,393),(394,394,394),(395,395,395),
+(396,396,396),(397,397,397),(398,398,398),(399,399,399),(400,400,400),
+(401,401,401),(402,402,402),(403,403,403),(404,404,404),(405,405,405),
+(406,406,406),(407,407,407),(408,408,408),(409,409,409),(410,410,410),
+(411,411,411),(412,412,412),(413,413,413),(414,414,414),(415,415,415),
+(416,416,416),(417,417,417),(418,418,418),(419,419,419),(420,420,420),
+(421,421,421),(422,422,422),(423,423,423),(424,424,424),(425,425,425),
+(426,426,426),(427,427,427),(428,428,428),(429,429,429),(430,430,430),
+(431,431,431),(432,432,432),(433,433,433),(434,434,434),(435,435,435),
+(436,436,436),(437,437,437),(438,438,438),(439,439,439),(440,440,440),
+(441,441,441),(442,442,442),(443,443,443),(444,444,444),(445,445,445),
+(446,446,446),(447,447,447),(448,448,448),(449,449,449),(450,450,450),
+(451,451,451),(452,452,452),(453,453,453),(454,454,454),(455,455,455),
+(456,456,456),(457,457,457),(458,458,458),(459,459,459),(460,460,460),
+(461,461,461),(462,462,462),(463,463,463),(464,464,464),(465,465,465),
+(466,466,466),(467,467,467),(468,468,468),(469,469,469),(470,470,470),
+(471,471,471),(472,472,472),(473,473,473),(474,474,474),(475,475,475),
+(476,476,476),(477,477,477),(478,478,478),(479,479,479),(480,480,480),
+(481,481,481),(482,482,482),(483,483,483),(484,484,484),(485,485,485),
+(486,486,486),(487,487,487),(488,488,488),(489,489,489),(490,490,490),
+(491,491,491),(492,492,492),(493,493,493),(494,494,494),(495,495,495),
+(496,496,496),(497,497,497),(498,498,498),(499,499,499),(500, 500, 500);
+INSERT INTO t2 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5);
+INSERT INTO t3 VALUES
+(1,1,1);
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile_ts1_01.dat'
+ENGINE = NDB;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile_ts1_02.dat'
+ENGINE = NDB;
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile_ts2_01.dat'
+ENGINE = NDB;
+ALTER TABLESPACE ts3
+DROP DATAFILE 'datafile_ts3_01.dat'
+ENGINE = NDB;
+DROP TABLESPACE ts1 ENGINE = NDB;
+DROP TABLESPACE ts2 ENGINE = NDB;
+DROP TABLESPACE ts3 ENGINE = NDB;
+DROP LOGFILE GROUP lg1 ENGINE = NDB;
+SELECT DISTINCT
+LOGFILE_GROUP_NAME,
+FILE_NAME,
+TOTAL_EXTENTS,
+INITIAL_SIZE,
+ENGINE
+FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE="UNDO LOG" ORDER BY FILE_NAME;
+LOGFILE_GROUP_NAME FILE_NAME TOTAL_EXTENTS INITIAL_SIZE ENGINE
+lg1 NULL NULL NULL ndbcluster
+lg1 undofile_lg1_01.dat 524288 2097152 ndbcluster
+lg1 undofile_lg1_02.dat 1048576 4194304 ndbcluster
+SELECT DISTINCT
+TABLESPACE_NAME,
+LOGFILE_GROUP_NAME,
+FILE_NAME,
+EXTENT_SIZE,
+INITIAL_SIZE,
+ENGINE
+FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE="DATAFILE" ORDER BY FILE_NAME;
+TABLESPACE_NAME LOGFILE_GROUP_NAME FILE_NAME EXTENT_SIZE INITIAL_SIZE ENGINE
+ts1 lg1 datafile_ts1_01.dat 1048576 2097152 ndbcluster
+ts1 lg1 datafile_ts1_02.dat 1048576 1048576 ndbcluster
+ts2 lg1 datafile_ts2_01.dat 1048576 2097152 ndbcluster
+ts3 lg1 datafile_ts3_01.dat 1048576 4194304 ndbcluster
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+500
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+5
+SELECT COUNT(*) FROM t3;
+COUNT(*)
+1
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile_ts1_01.dat'
+ENGINE = NDB;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile_ts1_02.dat'
+ENGINE = NDB;
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile_ts2_01.dat'
+ENGINE = NDB;
+ALTER TABLESPACE ts3
+DROP DATAFILE 'datafile_ts3_01.dat'
+ENGINE = NDB;
+DROP TABLESPACE ts1 ENGINE = NDB;
+DROP TABLESPACE ts2 ENGINE = NDB;
+DROP TABLESPACE ts3 ENGINE = NDB;
+DROP LOGFILE GROUP lg1 ENGINE = NDB;
diff --git a/mysql-test/r/ndb_dd_sql_features.result b/mysql-test/r/ndb_dd_sql_features.result
new file mode 100644
index 00000000000..135250fe7e8
--- /dev/null
+++ b/mysql-test/r/ndb_dd_sql_features.result
@@ -0,0 +1,599 @@
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+*****
+**** Copy data from table in one table space to table
+**** in different table space
+*****
+CREATE LOGFILE GROUP lg
+ADD UNDOFILE './lg_group/undofile.dat'
+ INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+CREATE TABLESPACE ts1
+ADD DATAFILE './table_space1/datafile.dat'
+ USE LOGFILE GROUP lg
+INITIAL_SIZE 25M
+ENGINE NDB;
+CREATE TABLESPACE ts2
+ADD DATAFILE './table_space2/datafile.dat'
+ USE LOGFILE GROUP lg
+INITIAL_SIZE 20M
+ENGINE NDB;
+CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(256), a3 BLOB)
+TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+CREATE TABLE test.t2 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(256), a3 BLOB)
+TABLESPACE ts2 STORAGE DISK ENGINE=NDB;
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a1` int(11) NOT NULL,
+ `a2` varchar(256) DEFAULT NULL,
+ `a3` blob,
+ PRIMARY KEY (`a1`)
+) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
+SHOW CREATE TABLE test.t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a1` int(11) NOT NULL,
+ `a2` varchar(256) DEFAULT NULL,
+ `a3` blob,
+ PRIMARY KEY (`a1`)
+) /*!50100 TABLESPACE ts2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
+INSERT INTO test.t1 VALUES (1,'111111','aaaaaaaa');
+INSERT INTO test.t1 VALUES (2,'222222','bbbbbbbb');
+SELECT * FROM test.t1 ORDER BY a1;
+a1 a2 a3
+1 111111 aaaaaaaa
+2 222222 bbbbbbbb
+INSERT INTO test.t2(a1,a2,a3) SELECT * FROM test.t1;
+SELECT * FROM test.t2 ORDER BY a1;
+a1 a2 a3
+1 111111 aaaaaaaa
+2 222222 bbbbbbbb
+DROP TABLE test.t1, test.t2;
+set @vc1 = repeat('a', 200);
+set @vc2 = repeat('b', 500);
+set @vc3 = repeat('c', 1000);
+set @vc4 = repeat('d', 4000);
+set @x0 = '01234567012345670123456701234567';
+set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@x0);
+set @d1 = 'dd1';
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @b2 = 'b2';
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @d2 = 'dd2';
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+select length(@x0),length(@b1),length(@d1) from dual;
+length(@x0) length(@b1) length(@d1)
+256 2256 3000
+select length(@x0),length(@b2),length(@d2) from dual;
+length(@x0) length(@b2) length(@d2)
+256 20000 30000
+CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(5000), a3 BLOB)
+TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+CREATE TABLE test.t2 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(5000), a3 BLOB)
+TABLESPACE ts2 STORAGE DISK ENGINE=NDB;
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a1` int(11) NOT NULL,
+ `a2` varchar(5000) DEFAULT NULL,
+ `a3` blob,
+ PRIMARY KEY (`a1`)
+) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
+SHOW CREATE TABLE test.t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a1` int(11) NOT NULL,
+ `a2` varchar(5000) DEFAULT NULL,
+ `a3` blob,
+ PRIMARY KEY (`a1`)
+) /*!50100 TABLESPACE ts2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
+INSERT INTO test.t1 VALUES (1,@vc1,@d1);
+INSERT INTO test.t1 VALUES (2,@vc2,@b1);
+INSERT INTO test.t1 VALUES (3,@vc3,@d2);
+INSERT INTO test.t1 VALUES (4,@vc4,@b2);
+SELECT a1,length(a2),substr(a2,180,2),length(a3),substr(a3,1+3*900,3)
+FROM test.t1 WHERE a1=1;
+a1 length(a2) substr(a2,180,2) length(a3) substr(a3,1+3*900,3)
+1 200 aa 3000 dd1
+SELECT a1,length(a2),substr(a2,480,2),length(a3),substr(a3,1+2*900,3)
+FROM test.t1 where a1=2;
+a1 length(a2) substr(a2,480,2) length(a3) substr(a3,1+2*900,3)
+2 500 bb 2256 b1b
+INSERT INTO test.t2(a1,a2,a3) SELECT * FROM test.t1;
+SELECT a1,length(a2),substr(a2,180,2),length(a3),substr(a3,1+3*900,3)
+FROM test.t2 WHERE a1=1;
+a1 length(a2) substr(a2,180,2) length(a3) substr(a3,1+3*900,3)
+1 200 aa 3000 dd1
+SELECT a1,length(a2),substr(a2,480,2),length(a3),substr(a3,1+2*900,3)
+FROM test.t2 where a1=2;
+a1 length(a2) substr(a2,480,2) length(a3) substr(a3,1+2*900,3)
+2 500 bb 2256 b1b
+DROP TABLE test.t1, test.t2;
+*****
+**** Insert, Update, Delete from NDB table with BLOB fields
+*****
+set @vc1 = repeat('a', 200);
+set @vc2 = repeat('b', 500);
+set @vc3 = repeat('c', 1000);
+set @vc4 = repeat('d', 4000);
+set @vc5 = repeat('d', 5000);
+set @bb1 = repeat('1', 2000);
+set @bb2 = repeat('2', 5000);
+set @bb3 = repeat('3', 10000);
+set @bb4 = repeat('4', 40000);
+set @bb5 = repeat('5', 50000);
+select length(@vc1),length(@vc2),length(@vc3),length(@vc4),length(@vc5)
+from dual;
+length(@vc1) length(@vc2) length(@vc3) length(@vc4) length(@vc5)
+200 500 1000 4000 5000
+select length(@bb1),length(@bb2),length(@bb3),length(@bb4),length(@bb5)
+from dual;
+length(@bb1) length(@bb2) length(@bb3) length(@bb4) length(@bb5)
+2000 5000 10000 40000 50000
+CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(5000), a3 BLOB)
+TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+INSERT INTO test.t1 VALUES (1,@vc1,@bb1);
+INSERT INTO test.t1 VALUES (2,@vc2,@bb2);
+INSERT INTO test.t1 VALUES (3,@vc3,@bb3);
+INSERT INTO test.t1 VALUES (4,@vc4,@bb4);
+INSERT INTO test.t1 VALUES (5,@vc5,@bb5);
+UPDATE test.t1 SET a2=@vc5, a3=@bb5 WHERE a1=1;
+SELECT a1,length(a2),substr(a2,4998,2),length(a3),substr(a3,49997,3)
+FROM test.t1 WHERE a1=1;
+a1 length(a2) substr(a2,4998,2) length(a3) substr(a3,49997,3)
+1 5000 dd 50000 555
+UPDATE test.t1 SET a2=@vc4, a3=@bb4 WHERE a1=2;
+SELECT a1,length(a2),substr(a2,3998,2),length(a3),substr(a3,39997,3)
+FROM test.t1 WHERE a1=2;
+a1 length(a2) substr(a2,3998,2) length(a3) substr(a3,39997,3)
+2 4000 dd 40000 444
+UPDATE test.t1 SET a2=@vc2, a3=@bb2 WHERE a1=3;
+SELECT a1,length(a2),substr(a2,498,2),length(a3),substr(a3,3997,3)
+FROM test.t1 WHERE a1=3;
+a1 length(a2) substr(a2,498,2) length(a3) substr(a3,3997,3)
+3 500 bb 5000 222
+UPDATE test.t1 SET a2=@vc3, a3=@bb3 WHERE a1=4;
+SELECT a1,length(a2),substr(a2,998,2),length(a3),substr(a3,9997,3)
+FROM test.t1 WHERE a1=4;
+a1 length(a2) substr(a2,998,2) length(a3) substr(a3,9997,3)
+4 1000 cc 10000 333
+UPDATE test.t1 SET a2=@vc1, a3=@bb1 WHERE a1=5;
+SELECT a1,length(a2),substr(a2,198,2),length(a3),substr(a3,1997,3)
+FROM test.t1 WHERE a1=5;
+a1 length(a2) substr(a2,198,2) length(a3) substr(a3,1997,3)
+5 200 aa 2000 111
+DELETE FROM test.t1 where a1=5;
+SELECT count(*) from test.t1;
+count(*)
+4
+DELETE FROM test.t1 where a1=4;
+SELECT count(*) from test.t1;
+count(*)
+3
+DELETE FROM test.t1 where a1=3;
+SELECT count(*) from test.t1;
+count(*)
+2
+DELETE FROM test.t1 where a1=2;
+SELECT count(*) from test.t1;
+count(*)
+1
+DELETE FROM test.t1 where a1=1;
+SELECT count(*) from test.t1;
+count(*)
+0
+DROP TABLE test.t1;
+*****
+**** Create Stored procedures that use disk based tables
+*****
+CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(256), a3 BLOB)
+TABLESPACE ts1 STORAGE DISK ENGINE=NDB//
+CREATE PROCEDURE test.sp1()
+BEGIN
+INSERT INTO test.t1 values (1,'111111','aaaaaaaa');
+END//
+CALL test.sp1();
+SELECT * FROM test.t1;
+a1 a2 a3
+1 111111 aaaaaaaa
+CREATE PROCEDURE test.sp2(n INT, vc VARCHAR(256), blb BLOB)
+BEGIN
+UPDATE test.t1 SET a2=vc, a3=blb where a1=n;
+END//
+CALL test.sp2(1,'222222','bbbbbbbb');
+SELECT * FROM test.t1;
+a1 a2 a3
+1 222222 bbbbbbbb
+DELETE FROM test.t1;
+DROP PROCEDURE test.sp1;
+DROP PROCEDURE test.sp2;
+DROP TABLE test.t1;
+*****
+***** Create function that operate on disk based tables
+*****
+CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(256), a3 BLOB)
+TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+CREATE FUNCTION test.fn1(n INT) RETURNS INT
+BEGIN
+DECLARE v INT;
+SELECT a1 INTO v FROM test.t1 WHERE a1=n;
+RETURN v;
+END//
+CREATE FUNCTION test.fn2(n INT, blb BLOB) RETURNS BLOB
+BEGIN
+DECLARE vv BLOB;
+UPDATE test.t1 SET a3=blb where a1=n;
+SELECT a3 INTO vv FROM test.t1 WHERE a1=n;
+RETURN vv;
+END//
+SELECT test.fn1(10) FROM DUAL;
+test.fn1(10)
+10
+SELECT test.fn2(50, 'new BLOB content') FROM DUAL;
+test.fn2(50, 'new BLOB content')
+new BLOB content
+DELETE FROM test.t1;
+DROP FUNCTION test.fn1;
+DROP FUNCTION test.fn2;
+DROP TABLE test.t1;
+*****
+***** Create triggers that operate on disk based tables
+*****
+CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(256), a3 BLOB)
+TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+CREATE TRIGGER test.trg1 BEFORE INSERT ON test.t1 FOR EACH ROW
+BEGIN
+if isnull(new.a2) then
+set new.a2:= 'trg1 works on a2 field';
+end if;
+if isnull(new.a3) then
+set new.a3:= 'trg1 works on a3 field';
+end if;
+end//
+insert into test.t1 (a1) values (1)//
+insert into test.t1 (a1,a2) values (2, 'ccccccc')//
+select * from test.t1 order by a1//
+a1 a2 a3
+1 trg1 works on a2 field trg1 works on a3 field
+2 ccccccc trg1 works on a3 field
+DELETE FROM test.t1;
+DROP TRIGGER test.trg1;
+DROP TABLE test.t1;
+*****
+***** Create, update views that operate on disk based tables
+*****
+CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(256), a3 BLOB)
+TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+CREATE VIEW test.v1 AS SELECT * FROM test.t1;
+SELECT * FROM test.v1 order by a1;
+a1 a2 a3
+1 aaaaa1 bbbbb1
+2 aaaaa2 bbbbb2
+3 aaaaa3 bbbbb3
+4 aaaaa4 bbbbb4
+5 aaaaa5 bbbbb5
+6 aaaaa6 bbbbb6
+7 aaaaa7 bbbbb7
+8 aaaaa8 bbbbb8
+9 aaaaa9 bbbbb9
+10 aaaaa10 bbbbb10
+CHECK TABLE test.v1, test.t1;
+Table Op Msg_type Msg_text
+test.v1 check status OK
+test.t1 check note The storage engine for the table doesn't support check
+UPDATE test.v1 SET a2='zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz' WHERE a1=5;
+SELECT * FROM test.v1 order by a1;
+a1 a2 a3
+1 aaaaa1 bbbbb1
+2 aaaaa2 bbbbb2
+3 aaaaa3 bbbbb3
+4 aaaaa4 bbbbb4
+5 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz bbbbb5
+6 aaaaa6 bbbbb6
+7 aaaaa7 bbbbb7
+8 aaaaa8 bbbbb8
+9 aaaaa9 bbbbb9
+10 aaaaa10 bbbbb10
+DROP VIEW test.v1;
+DELETE FROM test.t1;
+DROP TABLE test.t1;
+*****
+***** Create and use disk based table that use auto inc
+*****
+CREATE TABLE test.t1 (a1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+a2 VARCHAR(256), a3 BLOB)
+TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+SELECT * FROM test.t1 ORDER BY a1;
+a1 a2 a3
+1 aaaaa10 bbbbb10
+2 aaaaa9 bbbbb9
+3 aaaaa8 bbbbb8
+4 aaaaa7 bbbbb7
+5 aaaaa6 bbbbb6
+6 aaaaa5 bbbbb5
+7 aaaaa4 bbbbb4
+8 aaaaa3 bbbbb3
+9 aaaaa2 bbbbb2
+10 aaaaa1 bbbbb1
+DELETE FROM test.t1;
+DROP TABLE test.t1;
+*****
+***** Create test that use transaction (commit, rollback)
+*****
+SET AUTOCOMMIT=0;
+CREATE TABLE test.t1 (a1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+a2 VARCHAR(256), a3 BLOB)
+TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+INSERT INTO test.t1 VALUES(NULL, "aaaaa1", "bbbbb1");
+COMMIT;
+SELECT * FROM test.t1 ORDER BY a1;
+a1 a2 a3
+1 aaaaa1 bbbbb1
+INSERT INTO test.t1 VALUES(NULL, "aaaaa2", "bbbbb2");
+ROLLBACK;
+SELECT * FROM test.t1 ORDER BY a1;
+a1 a2 a3
+1 aaaaa1 bbbbb1
+DELETE FROM test.t1;
+DROP TABLE test.t1;
+SET AUTOCOMMIT=1;
+CREATE TABLE test.t1 (a1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+a2 VARCHAR(256), a3 BLOB)
+TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+START TRANSACTION;
+INSERT INTO test.t1 VALUES(NULL, "aaaaa1", "bbbbb1");
+COMMIT;
+SELECT * FROM test.t1 ORDER BY a1;
+a1 a2 a3
+1 aaaaa1 bbbbb1
+START TRANSACTION;
+INSERT INTO test.t1 VALUES(NULL, "aaaaa2", "bbbbb2");
+ROLLBACK;
+SELECT * FROM test.t1 ORDER BY a1;
+a1 a2 a3
+1 aaaaa1 bbbbb1
+DELETE FROM test.t1;
+DROP TABLE test.t1;
+*****
+***** Create test that uses locks
+*****
+drop table if exists test.t1;
+CREATE TABLE test.t1 (a1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+a2 VARCHAR(256), a3 BLOB)
+TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+LOCK TABLES test.t1 write;
+INSERT INTO test.t1 VALUES(NULL, "aaaaa1", "bbbbb1");
+INSERT INTO test.t1 VALUES(NULL, "aaaaa2", "bbbbb2");
+SELECT * FROM test.t1 ORDER BY a1;
+a1 a2 a3
+1 aaaaa1 bbbbb1
+2 aaaaa2 bbbbb2
+SELECT * FROM test.t1 ORDER BY a1;
+a1 a2 a3
+1 aaaaa1 bbbbb1
+2 aaaaa2 bbbbb2
+INSERT INTO test.t1 VALUES(NULL, "aaaaa3", "bbbbb3");
+UNLOCK TABLES;
+INSERT INTO test.t1 VALUES(NULL, "aaaaa3", "bbbbb3");
+SELECT * FROM test.t1 ORDER BY a1;
+a1 a2 a3
+1 aaaaa1 bbbbb1
+2 aaaaa2 bbbbb2
+3 aaaaa3 bbbbb3
+4 aaaaa3 bbbbb3
+DELETE FROM test.t1;
+DROP TABLE test.t1;
+*****
+***** Create large disk base table, do random queries, check cache hits
+*****
+set @vc1 = repeat('a', 200);
+SELECT @vc1 FROM DUAL;
+@vc1
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+set @vc2 = repeat('b', 500);
+set @vc3 = repeat('b', 998);
+set @x0 = '01234567012345670123456701234567';
+set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@x0);
+set @d1 = 'dd1';
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @b2 = 'b2';
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @d2 = 'dd2';
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+select length(@x0),length(@b1),length(@d1) from dual;
+length(@x0) length(@b1) length(@d1)
+256 2256 3000
+select length(@x0),length(@b2),length(@d2) from dual;
+length(@x0) length(@b2) length(@d2)
+256 20000 30000
+CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(1000), a3 BLOB)
+TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+INSERT INTO test.t1 values(1,@vc1,@d1);
+INSERT INTO test.t1 values(2,@vc2,@d2);
+explain SELECT * from test.t1 WHERE a1 = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY PRIMARY 4 const #
+SELECT a1,length(a2),substr(a2,1+2*900,2),length(a3),substr(a3,1+3*900,3)
+FROM test.t1 WHERE a1=1 ORDER BY a1;
+a1 length(a2) substr(a2,1+2*900,2) length(a3) substr(a3,1+3*900,3)
+1 200 3000 dd1
+SELECT a1,length(a2),substr(a2,1+2*9000,2),length(a3),substr(a3,1+3*9000,3)
+FROM test.t1 where a1=2 ORDER BY a1;
+a1 length(a2) substr(a2,1+2*9000,2) length(a3) substr(a3,1+3*9000,3)
+2 500 30000 dd2
+UPDATE test.t1 set a2=@vc2,a3=@d2 where a1=1;
+UPDATE test.t1 set a2=@vc1,a3=@d1 where a1=2;
+SELECT a1,length(a2),substr(a2,1+2*9000,2),length(a3),substr(a3,1+3*9000,3)
+FROM test.t1 where a1=1;
+a1 length(a2) substr(a2,1+2*9000,2) length(a3) substr(a3,1+3*9000,3)
+1 500 30000 dd2
+SELECT a1,length(a2),substr(a2,1+2*900,2),length(a3),substr(a3,1+3*900,3)
+FROM test.t1 where a1=2;
+a1 length(a2) substr(a2,1+2*900,2) length(a3) substr(a3,1+3*900,3)
+2 200 3000 dd1
+DELETE FROM test.t1;
+DROP TABLE test.t1;
+*****
+***** Create test that uses COUNT(), SUM(), MAX(), MIN(), NOW(),
+***** USER(), TRUNCATE
+*****
+CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(256),
+a3 BLOB, a4 DATE, a5 CHAR(250))
+TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+SELECT COUNT(*) from test.t1;
+COUNT(*)
+100
+SELECT SUM(a1) from test.t1;
+SUM(a1)
+5050
+SELECT MIN(a1) from test.t1;
+MIN(a1)
+1
+SELECT MAX(a1) from test.t1;
+MAX(a1)
+100
+SELECT a5 from test.t1 where a1=50;
+a5
+root@localhost
+SELECT * from test.t1 order by a1;
+a1 a2 a3 a4 a5
+1 aaaaaaaaaaaaaaaa1 bbbbbbbbbbbbbbbbbb1 2006-06-20 root@localhost
+2 aaaaaaaaaaaaaaaa2 bbbbbbbbbbbbbbbbbb2 2006-06-20 root@localhost
+3 aaaaaaaaaaaaaaaa3 bbbbbbbbbbbbbbbbbb3 2006-06-20 root@localhost
+4 aaaaaaaaaaaaaaaa4 bbbbbbbbbbbbbbbbbb4 2006-06-20 root@localhost
+5 aaaaaaaaaaaaaaaa5 bbbbbbbbbbbbbbbbbb5 2006-06-20 root@localhost
+6 aaaaaaaaaaaaaaaa6 bbbbbbbbbbbbbbbbbb6 2006-06-20 root@localhost
+7 aaaaaaaaaaaaaaaa7 bbbbbbbbbbbbbbbbbb7 2006-06-20 root@localhost
+8 aaaaaaaaaaaaaaaa8 bbbbbbbbbbbbbbbbbb8 2006-06-20 root@localhost
+9 aaaaaaaaaaaaaaaa9 bbbbbbbbbbbbbbbbbb9 2006-06-20 root@localhost
+10 aaaaaaaaaaaaaaaa10 bbbbbbbbbbbbbbbbbb10 2006-06-20 root@localhost
+11 aaaaaaaaaaaaaaaa11 bbbbbbbbbbbbbbbbbb11 2006-06-20 root@localhost
+12 aaaaaaaaaaaaaaaa12 bbbbbbbbbbbbbbbbbb12 2006-06-20 root@localhost
+13 aaaaaaaaaaaaaaaa13 bbbbbbbbbbbbbbbbbb13 2006-06-20 root@localhost
+14 aaaaaaaaaaaaaaaa14 bbbbbbbbbbbbbbbbbb14 2006-06-20 root@localhost
+15 aaaaaaaaaaaaaaaa15 bbbbbbbbbbbbbbbbbb15 2006-06-20 root@localhost
+16 aaaaaaaaaaaaaaaa16 bbbbbbbbbbbbbbbbbb16 2006-06-20 root@localhost
+17 aaaaaaaaaaaaaaaa17 bbbbbbbbbbbbbbbbbb17 2006-06-20 root@localhost
+18 aaaaaaaaaaaaaaaa18 bbbbbbbbbbbbbbbbbb18 2006-06-20 root@localhost
+19 aaaaaaaaaaaaaaaa19 bbbbbbbbbbbbbbbbbb19 2006-06-20 root@localhost
+20 aaaaaaaaaaaaaaaa20 bbbbbbbbbbbbbbbbbb20 2006-06-20 root@localhost
+21 aaaaaaaaaaaaaaaa21 bbbbbbbbbbbbbbbbbb21 2006-06-20 root@localhost
+22 aaaaaaaaaaaaaaaa22 bbbbbbbbbbbbbbbbbb22 2006-06-20 root@localhost
+23 aaaaaaaaaaaaaaaa23 bbbbbbbbbbbbbbbbbb23 2006-06-20 root@localhost
+24 aaaaaaaaaaaaaaaa24 bbbbbbbbbbbbbbbbbb24 2006-06-20 root@localhost
+25 aaaaaaaaaaaaaaaa25 bbbbbbbbbbbbbbbbbb25 2006-06-20 root@localhost
+26 aaaaaaaaaaaaaaaa26 bbbbbbbbbbbbbbbbbb26 2006-06-20 root@localhost
+27 aaaaaaaaaaaaaaaa27 bbbbbbbbbbbbbbbbbb27 2006-06-20 root@localhost
+28 aaaaaaaaaaaaaaaa28 bbbbbbbbbbbbbbbbbb28 2006-06-20 root@localhost
+29 aaaaaaaaaaaaaaaa29 bbbbbbbbbbbbbbbbbb29 2006-06-20 root@localhost
+30 aaaaaaaaaaaaaaaa30 bbbbbbbbbbbbbbbbbb30 2006-06-20 root@localhost
+31 aaaaaaaaaaaaaaaa31 bbbbbbbbbbbbbbbbbb31 2006-06-20 root@localhost
+32 aaaaaaaaaaaaaaaa32 bbbbbbbbbbbbbbbbbb32 2006-06-20 root@localhost
+33 aaaaaaaaaaaaaaaa33 bbbbbbbbbbbbbbbbbb33 2006-06-20 root@localhost
+34 aaaaaaaaaaaaaaaa34 bbbbbbbbbbbbbbbbbb34 2006-06-20 root@localhost
+35 aaaaaaaaaaaaaaaa35 bbbbbbbbbbbbbbbbbb35 2006-06-20 root@localhost
+36 aaaaaaaaaaaaaaaa36 bbbbbbbbbbbbbbbbbb36 2006-06-20 root@localhost
+37 aaaaaaaaaaaaaaaa37 bbbbbbbbbbbbbbbbbb37 2006-06-20 root@localhost
+38 aaaaaaaaaaaaaaaa38 bbbbbbbbbbbbbbbbbb38 2006-06-20 root@localhost
+39 aaaaaaaaaaaaaaaa39 bbbbbbbbbbbbbbbbbb39 2006-06-20 root@localhost
+40 aaaaaaaaaaaaaaaa40 bbbbbbbbbbbbbbbbbb40 2006-06-20 root@localhost
+41 aaaaaaaaaaaaaaaa41 bbbbbbbbbbbbbbbbbb41 2006-06-20 root@localhost
+42 aaaaaaaaaaaaaaaa42 bbbbbbbbbbbbbbbbbb42 2006-06-20 root@localhost
+43 aaaaaaaaaaaaaaaa43 bbbbbbbbbbbbbbbbbb43 2006-06-20 root@localhost
+44 aaaaaaaaaaaaaaaa44 bbbbbbbbbbbbbbbbbb44 2006-06-20 root@localhost
+45 aaaaaaaaaaaaaaaa45 bbbbbbbbbbbbbbbbbb45 2006-06-20 root@localhost
+46 aaaaaaaaaaaaaaaa46 bbbbbbbbbbbbbbbbbb46 2006-06-20 root@localhost
+47 aaaaaaaaaaaaaaaa47 bbbbbbbbbbbbbbbbbb47 2006-06-20 root@localhost
+48 aaaaaaaaaaaaaaaa48 bbbbbbbbbbbbbbbbbb48 2006-06-20 root@localhost
+49 aaaaaaaaaaaaaaaa49 bbbbbbbbbbbbbbbbbb49 2006-06-20 root@localhost
+50 aaaaaaaaaaaaaaaa50 bbbbbbbbbbbbbbbbbb50 2006-06-20 root@localhost
+51 aaaaaaaaaaaaaaaa51 bbbbbbbbbbbbbbbbbb51 2006-06-20 root@localhost
+52 aaaaaaaaaaaaaaaa52 bbbbbbbbbbbbbbbbbb52 2006-06-20 root@localhost
+53 aaaaaaaaaaaaaaaa53 bbbbbbbbbbbbbbbbbb53 2006-06-20 root@localhost
+54 aaaaaaaaaaaaaaaa54 bbbbbbbbbbbbbbbbbb54 2006-06-20 root@localhost
+55 aaaaaaaaaaaaaaaa55 bbbbbbbbbbbbbbbbbb55 2006-06-20 root@localhost
+56 aaaaaaaaaaaaaaaa56 bbbbbbbbbbbbbbbbbb56 2006-06-20 root@localhost
+57 aaaaaaaaaaaaaaaa57 bbbbbbbbbbbbbbbbbb57 2006-06-20 root@localhost
+58 aaaaaaaaaaaaaaaa58 bbbbbbbbbbbbbbbbbb58 2006-06-20 root@localhost
+59 aaaaaaaaaaaaaaaa59 bbbbbbbbbbbbbbbbbb59 2006-06-20 root@localhost
+60 aaaaaaaaaaaaaaaa60 bbbbbbbbbbbbbbbbbb60 2006-06-20 root@localhost
+61 aaaaaaaaaaaaaaaa61 bbbbbbbbbbbbbbbbbb61 2006-06-20 root@localhost
+62 aaaaaaaaaaaaaaaa62 bbbbbbbbbbbbbbbbbb62 2006-06-20 root@localhost
+63 aaaaaaaaaaaaaaaa63 bbbbbbbbbbbbbbbbbb63 2006-06-20 root@localhost
+64 aaaaaaaaaaaaaaaa64 bbbbbbbbbbbbbbbbbb64 2006-06-20 root@localhost
+65 aaaaaaaaaaaaaaaa65 bbbbbbbbbbbbbbbbbb65 2006-06-20 root@localhost
+66 aaaaaaaaaaaaaaaa66 bbbbbbbbbbbbbbbbbb66 2006-06-20 root@localhost
+67 aaaaaaaaaaaaaaaa67 bbbbbbbbbbbbbbbbbb67 2006-06-20 root@localhost
+68 aaaaaaaaaaaaaaaa68 bbbbbbbbbbbbbbbbbb68 2006-06-20 root@localhost
+69 aaaaaaaaaaaaaaaa69 bbbbbbbbbbbbbbbbbb69 2006-06-20 root@localhost
+70 aaaaaaaaaaaaaaaa70 bbbbbbbbbbbbbbbbbb70 2006-06-20 root@localhost
+71 aaaaaaaaaaaaaaaa71 bbbbbbbbbbbbbbbbbb71 2006-06-20 root@localhost
+72 aaaaaaaaaaaaaaaa72 bbbbbbbbbbbbbbbbbb72 2006-06-20 root@localhost
+73 aaaaaaaaaaaaaaaa73 bbbbbbbbbbbbbbbbbb73 2006-06-20 root@localhost
+74 aaaaaaaaaaaaaaaa74 bbbbbbbbbbbbbbbbbb74 2006-06-20 root@localhost
+75 aaaaaaaaaaaaaaaa75 bbbbbbbbbbbbbbbbbb75 2006-06-20 root@localhost
+76 aaaaaaaaaaaaaaaa76 bbbbbbbbbbbbbbbbbb76 2006-06-20 root@localhost
+77 aaaaaaaaaaaaaaaa77 bbbbbbbbbbbbbbbbbb77 2006-06-20 root@localhost
+78 aaaaaaaaaaaaaaaa78 bbbbbbbbbbbbbbbbbb78 2006-06-20 root@localhost
+79 aaaaaaaaaaaaaaaa79 bbbbbbbbbbbbbbbbbb79 2006-06-20 root@localhost
+80 aaaaaaaaaaaaaaaa80 bbbbbbbbbbbbbbbbbb80 2006-06-20 root@localhost
+81 aaaaaaaaaaaaaaaa81 bbbbbbbbbbbbbbbbbb81 2006-06-20 root@localhost
+82 aaaaaaaaaaaaaaaa82 bbbbbbbbbbbbbbbbbb82 2006-06-20 root@localhost
+83 aaaaaaaaaaaaaaaa83 bbbbbbbbbbbbbbbbbb83 2006-06-20 root@localhost
+84 aaaaaaaaaaaaaaaa84 bbbbbbbbbbbbbbbbbb84 2006-06-20 root@localhost
+85 aaaaaaaaaaaaaaaa85 bbbbbbbbbbbbbbbbbb85 2006-06-20 root@localhost
+86 aaaaaaaaaaaaaaaa86 bbbbbbbbbbbbbbbbbb86 2006-06-20 root@localhost
+87 aaaaaaaaaaaaaaaa87 bbbbbbbbbbbbbbbbbb87 2006-06-20 root@localhost
+88 aaaaaaaaaaaaaaaa88 bbbbbbbbbbbbbbbbbb88 2006-06-20 root@localhost
+89 aaaaaaaaaaaaaaaa89 bbbbbbbbbbbbbbbbbb89 2006-06-20 root@localhost
+90 aaaaaaaaaaaaaaaa90 bbbbbbbbbbbbbbbbbb90 2006-06-20 root@localhost
+91 aaaaaaaaaaaaaaaa91 bbbbbbbbbbbbbbbbbb91 2006-06-20 root@localhost
+92 aaaaaaaaaaaaaaaa92 bbbbbbbbbbbbbbbbbb92 2006-06-20 root@localhost
+93 aaaaaaaaaaaaaaaa93 bbbbbbbbbbbbbbbbbb93 2006-06-20 root@localhost
+94 aaaaaaaaaaaaaaaa94 bbbbbbbbbbbbbbbbbb94 2006-06-20 root@localhost
+95 aaaaaaaaaaaaaaaa95 bbbbbbbbbbbbbbbbbb95 2006-06-20 root@localhost
+96 aaaaaaaaaaaaaaaa96 bbbbbbbbbbbbbbbbbb96 2006-06-20 root@localhost
+97 aaaaaaaaaaaaaaaa97 bbbbbbbbbbbbbbbbbb97 2006-06-20 root@localhost
+98 aaaaaaaaaaaaaaaa98 bbbbbbbbbbbbbbbbbb98 2006-06-20 root@localhost
+99 aaaaaaaaaaaaaaaa99 bbbbbbbbbbbbbbbbbb99 2006-06-20 root@localhost
+100 aaaaaaaaaaaaaaaa100 bbbbbbbbbbbbbbbbbb100 2006-06-20 root@localhost
+DROP TABLE test.t1;
+ALTER TABLESPACE ts1
+DROP DATAFILE './table_space1/datafile.dat'
+ ENGINE=NDB;
+DROP TABLESPACE ts1 ENGINE=NDB;
+ALTER TABLESPACE ts2
+DROP DATAFILE './table_space2/datafile.dat'
+ ENGINE=NDB;
+DROP TABLESPACE ts2 ENGINE=NDB;
+DROP LOGFILE GROUP lg
+ENGINE=NDB;
diff --git a/mysql-test/r/ndb_gis.result b/mysql-test/r/ndb_gis.result
index 43075306bd2..ecdba448f1b 100644
--- a/mysql-test/r/ndb_gis.result
+++ b/mysql-test/r/ndb_gis.result
@@ -1,50 +1,51 @@
SET storage_engine=ndbcluster;
DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
-CREATE TABLE gis_point (fid INTEGER, g POINT);
-CREATE TABLE gis_line (fid INTEGER, g LINESTRING);
-CREATE TABLE gis_polygon (fid INTEGER, g POLYGON);
-CREATE TABLE gis_multi_point (fid INTEGER, g MULTIPOINT);
-CREATE TABLE gis_multi_line (fid INTEGER, g MULTILINESTRING);
-CREATE TABLE gis_multi_polygon (fid INTEGER, g MULTIPOLYGON);
-CREATE TABLE gis_geometrycollection (fid INTEGER, g GEOMETRYCOLLECTION);
-CREATE TABLE gis_geometry (fid INTEGER, g GEOMETRY);
+CREATE TABLE gis_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POINT);
+CREATE TABLE gis_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g LINESTRING);
+CREATE TABLE gis_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POLYGON);
+CREATE TABLE gis_multi_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOINT);
+CREATE TABLE gis_multi_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTILINESTRING);
+CREATE TABLE gis_multi_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOLYGON);
+CREATE TABLE gis_geometrycollection (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRYCOLLECTION);
+CREATE TABLE gis_geometry (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRY);
SHOW CREATE TABLE gis_point;
Table Create Table
gis_point CREATE TABLE `gis_point` (
- `fid` int(11) default NULL,
- `g` point default NULL
+ `fid` int(11) NOT NULL AUTO_INCREMENT,
+ `g` point DEFAULT NULL,
+ PRIMARY KEY (`fid`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
SHOW FIELDS FROM gis_point;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g point YES NULL
SHOW FIELDS FROM gis_line;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g linestring YES NULL
SHOW FIELDS FROM gis_polygon;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g polygon YES NULL
SHOW FIELDS FROM gis_multi_point;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g multipoint YES NULL
SHOW FIELDS FROM gis_multi_line;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g multilinestring YES NULL
SHOW FIELDS FROM gis_multi_polygon;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g multipolygon YES NULL
SHOW FIELDS FROM gis_geometrycollection;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g geometrycollection YES NULL
SHOW FIELDS FROM gis_geometry;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g geometry YES NULL
INSERT INTO gis_point VALUES
(101, PointFromText('POINT(10 10)')),
@@ -232,8 +233,8 @@ fid AsText(Envelope(g))
120 POLYGON((0 0,10 0,10 10,0 10,0 0))
121 POLYGON((3 6,44 6,44 9,3 9,3 6))
explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21 100.00
Warnings:
Note 1003 select dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,astext(envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry`
SELECT fid, X(g) FROM gis_point ORDER by fid;
@@ -249,8 +250,8 @@ fid Y(g)
103 20
104 20
explain extended select X(g),Y(g) FROM gis_point;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_point ALL NULL NULL NULL NULL 4
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 100.00
Warnings:
Note 1003 select x(`test`.`gis_point`.`g`) AS `X(g)`,y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point`
SELECT fid, AsText(StartPoint(g)) FROM gis_line ORDER by fid;
@@ -284,8 +285,8 @@ fid IsClosed(g)
106 1
107 0
explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_line ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,astext(endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,glength(`test`.`gis_line`.`g`) AS `GLength(g)`,numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,astext(pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line`
SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid;
@@ -314,8 +315,8 @@ fid AsText(InteriorRingN(g, 1))
109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
110 NULL
explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM gis_polygon;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select astext(centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,area(`test`.`gis_polygon`.`g`) AS `Area(g)`,astext(exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,astext(interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon`
SELECT fid, IsClosed(g) FROM gis_multi_line ORDER by fid;
@@ -353,8 +354,8 @@ fid NumGeometries(g)
120 2
121 2
explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point`
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point ORDER by fid;
@@ -381,8 +382,8 @@ fid AsText(GeometryN(g, 1))
120 POINT(0 0)
121 POINT(44 6)
explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,astext(geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point`
SELECT g1.fid as first, g2.fid as second,
@@ -400,13 +401,14 @@ Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE g1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
-1 SIMPLE g2 ALL NULL NULL NULL NULL 2
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE g1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
+1 SIMPLE g2 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,overlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,disjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,intersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
CREATE TABLE t1 (
+a INTEGER PRIMARY KEY AUTO_INCREMENT,
gp point,
ln linestring,
pg polygon,
@@ -418,6 +420,7 @@ gm geometry
);
SHOW FIELDS FROM t1;
Field Type Null Key Default Extra
+a int(11) NO PRI NULL auto_increment
gp point YES NULL
ln linestring YES NULL
pg polygon YES NULL
@@ -429,6 +432,7 @@ gm geometry YES NULL
ALTER TABLE t1 ADD fid INT;
SHOW FIELDS FROM t1;
Field Type Null Key Default Extra
+a int(11) NO PRI NULL auto_increment
gp point YES NULL
ln linestring YES NULL
pg polygon YES NULL
@@ -439,70 +443,71 @@ gc geometrycollection YES NULL
gm geometry YES NULL
fid int(11) YES NULL
DROP TABLE t1;
-create table t1 (a geometry not null);
-insert into t1 values (GeomFromText('Point(1 2)'));
-insert into t1 values ('Garbage');
+create table t1 (pk integer primary key auto_increment, a geometry not null);
+insert into t1 (a) values (GeomFromText('Point(1 2)'));
+insert into t1 (a) values ('Garbage');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-insert IGNORE into t1 values ('Garbage');
+insert IGNORE into t1 (a) values ('Garbage');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
-create table t1 (fl geometry);
-insert into t1 values (1);
+create table t1 (pk integer primary key auto_increment, fl geometry);
+insert into t1 (fl) values (1);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-insert into t1 values (1.11);
+insert into t1 (fl) values (1.11);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-insert into t1 values ("qwerty");
+insert into t1 (fl) values ("qwerty");
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-insert into t1 values (pointfromtext('point(1,1)'));
+insert into t1 (fl) values (pointfromtext('point(1,1)'));
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
set engine_condition_pushdown = on;
DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
-CREATE TABLE gis_point (fid INTEGER, g POINT);
-CREATE TABLE gis_line (fid INTEGER, g LINESTRING);
-CREATE TABLE gis_polygon (fid INTEGER, g POLYGON);
-CREATE TABLE gis_multi_point (fid INTEGER, g MULTIPOINT);
-CREATE TABLE gis_multi_line (fid INTEGER, g MULTILINESTRING);
-CREATE TABLE gis_multi_polygon (fid INTEGER, g MULTIPOLYGON);
-CREATE TABLE gis_geometrycollection (fid INTEGER, g GEOMETRYCOLLECTION);
-CREATE TABLE gis_geometry (fid INTEGER, g GEOMETRY);
+CREATE TABLE gis_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POINT);
+CREATE TABLE gis_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g LINESTRING);
+CREATE TABLE gis_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POLYGON);
+CREATE TABLE gis_multi_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOINT);
+CREATE TABLE gis_multi_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTILINESTRING);
+CREATE TABLE gis_multi_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOLYGON);
+CREATE TABLE gis_geometrycollection (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRYCOLLECTION);
+CREATE TABLE gis_geometry (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRY);
SHOW CREATE TABLE gis_point;
Table Create Table
gis_point CREATE TABLE `gis_point` (
- `fid` int(11) default NULL,
- `g` point default NULL
+ `fid` int(11) NOT NULL AUTO_INCREMENT,
+ `g` point DEFAULT NULL,
+ PRIMARY KEY (`fid`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
SHOW FIELDS FROM gis_point;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g point YES NULL
SHOW FIELDS FROM gis_line;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g linestring YES NULL
SHOW FIELDS FROM gis_polygon;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g polygon YES NULL
SHOW FIELDS FROM gis_multi_point;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g multipoint YES NULL
SHOW FIELDS FROM gis_multi_line;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g multilinestring YES NULL
SHOW FIELDS FROM gis_multi_polygon;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g multipolygon YES NULL
SHOW FIELDS FROM gis_geometrycollection;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g geometrycollection YES NULL
SHOW FIELDS FROM gis_geometry;
Field Type Null Key Default Extra
-fid int(11) YES NULL
+fid int(11) NO PRI NULL auto_increment
g geometry YES NULL
INSERT INTO gis_point VALUES
(101, PointFromText('POINT(10 10)')),
@@ -690,8 +695,8 @@ fid AsText(Envelope(g))
120 POLYGON((0 0,10 0,10 10,0 10,0 0))
121 POLYGON((3 6,44 6,44 9,3 9,3 6))
explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21 100.00
Warnings:
Note 1003 select dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,astext(envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry`
SELECT fid, X(g) FROM gis_point ORDER by fid;
@@ -707,8 +712,8 @@ fid Y(g)
103 20
104 20
explain extended select X(g),Y(g) FROM gis_point;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_point ALL NULL NULL NULL NULL 4
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 100.00
Warnings:
Note 1003 select x(`test`.`gis_point`.`g`) AS `X(g)`,y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point`
SELECT fid, AsText(StartPoint(g)) FROM gis_line ORDER by fid;
@@ -742,8 +747,8 @@ fid IsClosed(g)
106 1
107 0
explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_line ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,astext(endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,glength(`test`.`gis_line`.`g`) AS `GLength(g)`,numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,astext(pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line`
SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid;
@@ -772,8 +777,8 @@ fid AsText(InteriorRingN(g, 1))
109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
110 NULL
explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM gis_polygon;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select astext(centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,area(`test`.`gis_polygon`.`g`) AS `Area(g)`,astext(exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,astext(interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon`
SELECT fid, IsClosed(g) FROM gis_multi_line ORDER by fid;
@@ -811,8 +816,8 @@ fid NumGeometries(g)
120 2
121 2
explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point`
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point ORDER by fid;
@@ -839,8 +844,8 @@ fid AsText(GeometryN(g, 1))
120 POINT(0 0)
121 POINT(44 6)
explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,astext(geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point`
SELECT g1.fid as first, g2.fid as second,
@@ -858,13 +863,14 @@ Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE g1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
-1 SIMPLE g2 ALL NULL NULL NULL NULL 2
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE g1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
+1 SIMPLE g2 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,overlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,disjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,intersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
CREATE TABLE t1 (
+a INTEGER PRIMARY KEY AUTO_INCREMENT,
gp point,
ln linestring,
pg polygon,
@@ -876,6 +882,7 @@ gm geometry
);
SHOW FIELDS FROM t1;
Field Type Null Key Default Extra
+a int(11) NO PRI NULL auto_increment
gp point YES NULL
ln linestring YES NULL
pg polygon YES NULL
@@ -887,6 +894,7 @@ gm geometry YES NULL
ALTER TABLE t1 ADD fid INT;
SHOW FIELDS FROM t1;
Field Type Null Key Default Extra
+a int(11) NO PRI NULL auto_increment
gp point YES NULL
ln linestring YES NULL
pg polygon YES NULL
@@ -897,20 +905,20 @@ gc geometrycollection YES NULL
gm geometry YES NULL
fid int(11) YES NULL
DROP TABLE t1;
-create table t1 (a geometry not null);
-insert into t1 values (GeomFromText('Point(1 2)'));
-insert into t1 values ('Garbage');
+create table t1 (pk integer primary key auto_increment, a geometry not null);
+insert into t1 (a) values (GeomFromText('Point(1 2)'));
+insert into t1 (a) values ('Garbage');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-insert IGNORE into t1 values ('Garbage');
+insert IGNORE into t1 (a) values ('Garbage');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
-create table t1 (fl geometry);
-insert into t1 values (1);
+create table t1 (pk integer primary key auto_increment, fl geometry);
+insert into t1 (fl) values (1);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-insert into t1 values (1.11);
+insert into t1 (fl) values (1.11);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-insert into t1 values ("qwerty");
+insert into t1 (fl) values ("qwerty");
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-insert into t1 values (pointfromtext('point(1,1)'));
+insert into t1 (fl) values (pointfromtext('point(1,1)'));
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
diff --git a/mysql-test/r/ndb_index_ordered.result b/mysql-test/r/ndb_index_ordered.result
index 36bac7b0f9d..3b8415b9267 100644
--- a/mysql-test/r/ndb_index_ordered.result
+++ b/mysql-test/r/ndb_index_ordered.result
@@ -658,3 +658,141 @@ insert into t1 (a, c) values (1,'aaa'),(3,'bbb');
select count(*) from t1 where c<'bbb';
count(*)
1
+drop table t1;
+set autocommit=1;
+show session variables like 'ndb_index_stat_%';
+Variable_name Value
+ndb_index_stat_cache_entries 32
+ndb_index_stat_enable OFF
+ndb_index_stat_update_freq 20
+set ndb_index_stat_enable = off;
+show session variables like 'ndb_index_stat_%';
+Variable_name Value
+ndb_index_stat_cache_entries 32
+ndb_index_stat_enable OFF
+ndb_index_stat_update_freq 20
+create table t1 (a int, b int, c varchar(10) not null,
+primary key using hash (a), index(b,c)) engine=ndb;
+insert into t1 values
+(1,10,'aaa'),(2,10,'bbb'),(3,10,'ccc'),
+(4,20,'aaa'),(5,20,'bbb'),(6,20,'ccc'),
+(7,30,'aaa'),(8,30,'bbb'),(9,30,'ccc');
+select count(*) from t1 where b < 10;
+count(*)
+0
+select count(*) from t1 where b >= 10 and c >= 'bbb';
+count(*)
+6
+select count(*) from t1 where b > 10;
+count(*)
+6
+select count(*) from t1 where b <= 20 and c < 'ccc';
+count(*)
+4
+select count(*) from t1 where b = 20 and c = 'ccc';
+count(*)
+1
+select count(*) from t1 where b > 20;
+count(*)
+3
+select count(*) from t1 where b = 30 and c > 'aaa';
+count(*)
+2
+select count(*) from t1 where b <= 20;
+count(*)
+6
+select count(*) from t1 where b >= 20 and c > 'aaa';
+count(*)
+4
+drop table t1;
+set ndb_index_stat_enable = on;
+set ndb_index_stat_cache_entries = 0;
+show session variables like 'ndb_index_stat_%';
+Variable_name Value
+ndb_index_stat_cache_entries 0
+ndb_index_stat_enable ON
+ndb_index_stat_update_freq 20
+create table t1 (a int, b int, c varchar(10) not null,
+primary key using hash (a), index(b,c)) engine=ndb;
+insert into t1 values
+(1,10,'aaa'),(2,10,'bbb'),(3,10,'ccc'),
+(4,20,'aaa'),(5,20,'bbb'),(6,20,'ccc'),
+(7,30,'aaa'),(8,30,'bbb'),(9,30,'ccc');
+select count(*) from t1 where b < 10;
+count(*)
+0
+select count(*) from t1 where b >= 10 and c >= 'bbb';
+count(*)
+6
+select count(*) from t1 where b > 10;
+count(*)
+6
+select count(*) from t1 where b <= 20 and c < 'ccc';
+count(*)
+4
+select count(*) from t1 where b = 20 and c = 'ccc';
+count(*)
+1
+select count(*) from t1 where b > 20;
+count(*)
+3
+select count(*) from t1 where b = 30 and c > 'aaa';
+count(*)
+2
+select count(*) from t1 where b <= 20;
+count(*)
+6
+select count(*) from t1 where b >= 20 and c > 'aaa';
+count(*)
+4
+drop table t1;
+set ndb_index_stat_enable = on;
+set ndb_index_stat_cache_entries = 4;
+set ndb_index_stat_update_freq = 2;
+show session variables like 'ndb_index_stat_%';
+Variable_name Value
+ndb_index_stat_cache_entries 4
+ndb_index_stat_enable ON
+ndb_index_stat_update_freq 2
+create table t1 (a int, b int, c varchar(10) not null,
+primary key using hash (a), index(b,c)) engine=ndb;
+insert into t1 values
+(1,10,'aaa'),(2,10,'bbb'),(3,10,'ccc'),
+(4,20,'aaa'),(5,20,'bbb'),(6,20,'ccc'),
+(7,30,'aaa'),(8,30,'bbb'),(9,30,'ccc');
+select count(*) from t1 where b < 10;
+count(*)
+0
+select count(*) from t1 where b >= 10 and c >= 'bbb';
+count(*)
+6
+select count(*) from t1 where b > 10;
+count(*)
+6
+select count(*) from t1 where b <= 20 and c < 'ccc';
+count(*)
+4
+select count(*) from t1 where b = 20 and c = 'ccc';
+count(*)
+1
+select count(*) from t1 where b > 20;
+count(*)
+3
+select count(*) from t1 where b = 30 and c > 'aaa';
+count(*)
+2
+select count(*) from t1 where b <= 20;
+count(*)
+6
+select count(*) from t1 where b >= 20 and c > 'aaa';
+count(*)
+4
+drop table t1;
+set ndb_index_stat_enable = @@global.ndb_index_stat_enable;
+set ndb_index_stat_cache_entries = @@global.ndb_index_stat_cache_entries;
+set ndb_index_stat_update_freq = @@global.ndb_index_stat_update_freq;
+show session variables like 'ndb_index_stat_%';
+Variable_name Value
+ndb_index_stat_cache_entries 32
+ndb_index_stat_enable OFF
+ndb_index_stat_update_freq 20
diff --git a/mysql-test/r/ndb_index_unique.result b/mysql-test/r/ndb_index_unique.result
index ce4759ad553..563024a8800 100644
--- a/mysql-test/r/ndb_index_unique.result
+++ b/mysql-test/r/ndb_index_unique.result
@@ -1,9 +1,9 @@
drop table if exists t1, t2, t3, t4, t5, t6, t7, t8;
CREATE TABLE t1 (
-a int unsigned NOT NULL PRIMARY KEY,
-b int unsigned not null,
-c int unsigned,
-UNIQUE(b)
+a int NOT NULL PRIMARY KEY,
+b int not null,
+c int,
+UNIQUE ib(b)
) engine=ndbcluster;
insert t1 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
select * from t1 order by b;
@@ -22,7 +22,7 @@ select * from t1 where b = 4 order by a;
a b c
3 4 6
insert into t1 values(8, 2, 3);
-ERROR 23000: Duplicate entry '' for key 0
+ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
select * from t1 order by a;
a b c
1 2 3
@@ -43,6 +43,10 @@ a b c
6 7 2
7 8 3
8 2 3
+alter table t1 drop index ib;
+insert into t1 values(1, 2, 3);
+create unique index ib on t1(b);
+ERROR 23000: Can't write, because of unique constraint, to table 't1'
drop table t1;
CREATE TABLE t1 (
a int unsigned NOT NULL PRIMARY KEY,
@@ -89,13 +93,13 @@ a b c
1 1 1
4 4 NULL
insert into t1 values(5,1,1);
-ERROR 23000: Duplicate entry '' for key 0
+ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
drop table t1;
CREATE TABLE t2 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned not null,
-UNIQUE USING HASH (b, c)
+UNIQUE (b, c) USING HASH
) engine=ndbcluster;
insert t2 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
select * from t2 where a = 3;
@@ -112,7 +116,7 @@ select * from t2 where b = 4 order by a;
a b c
3 4 6
insert into t2 values(8, 2, 3);
-ERROR 23000: Duplicate entry '' for key 0
+ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
select * from t2 order by a;
a b c
1 2 3
@@ -138,14 +142,14 @@ CREATE TABLE t2 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned,
-UNIQUE USING HASH (b, c)
+UNIQUE (b, c) USING HASH
) engine=ndbcluster;
-ERROR 42000: Column 'c' is used with UNIQUE or INDEX but is not defined as NOT NULL
+ERROR 42000: Table handler doesn't support NULL in given index. Please change column 'c' to be NOT NULL or use another handler
CREATE TABLE t3 (
a int unsigned NOT NULL,
b int unsigned not null,
c int unsigned,
-PRIMARY KEY USING HASH (a, b)
+PRIMARY KEY (a, b) USING HASH
) engine=ndbcluster;
insert t3 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
select * from t3 where a = 3;
@@ -177,7 +181,7 @@ pk a
3 NULL
4 4
insert into t1 values (5,0);
-ERROR 23000: Duplicate entry '' for key 0
+ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
select * from t1 order by pk;
pk a
-1 NULL
@@ -210,7 +214,7 @@ pk a b c
0 NULL 18 NULL
1 3 19 abc
insert into t2 values(2,3,19,'abc');
-ERROR 23000: Duplicate entry '' for key 0
+ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
select * from t2 order by pk;
pk a b c
-1 1 17 NULL
@@ -630,8 +634,11 @@ create table t1 (a int primary key, b varchar(1000) not null, unique key (b))
engine=ndb charset=utf8;
insert into t1 values (1, repeat(_utf8 0xe288ab6474, 200));
insert into t1 values (2, repeat(_utf8 0xe288ab6474, 200));
-ERROR 23000: Duplicate entry '' for key 0
+ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
select a, sha1(b) from t1;
a sha1(b)
1 08f5d02c8b8bc244f275bdfc22c42c5cab0d9d7d
drop table t1;
+create table t1(id int not null) engine = NDB;
+alter table t1 add constraint uk_test unique (id) using hash;
+drop table t1;
diff --git a/mysql-test/r/ndb_insert.result b/mysql-test/r/ndb_insert.result
index 0818f9ce9ac..3f9a5d7c6c5 100644
--- a/mysql-test/r/ndb_insert.result
+++ b/mysql-test/r/ndb_insert.result
@@ -417,7 +417,7 @@ SELECT COUNT(*) FROM t1;
COUNT(*)
2000
INSERT INTO t1 VALUES (1,1,1);
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO t1 VALUES
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
@@ -441,7 +441,7 @@ INSERT INTO t1 VALUES
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
ERROR 23000: Can't write; duplicate key in table 't1'
commit;
-ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
+ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
select * from t1 where pk1=1;
pk1 b c
1 1 1
@@ -478,7 +478,7 @@ INSERT INTO t1 VALUES
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
ERROR 23000: Can't write; duplicate key in table 't1'
SELECT * FROM t1 WHERE pk1=10;
-ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
+ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
rollback;
select * from t1 where pk1=1;
pk1 b c
@@ -498,11 +498,11 @@ INSERT INTO t1 VALUES
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
ERROR 23000: Can't write; duplicate key in table 't1'
SELECT * FROM t1 WHERE pk1=10;
-ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
+ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
SELECT * FROM t1 WHERE pk1=10;
-ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
+ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
commit;
-ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
+ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
select * from t1 where pk1=1;
pk1 b c
1 1 1
@@ -521,7 +521,7 @@ INSERT INTO t1 VALUES
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
ERROR 23000: Can't write; duplicate key in table 't1'
INSERT INTO t1 values (4000, 40, 44);
-ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
+ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
rollback;
select * from t1 where pk1=1;
pk1 b c
diff --git a/mysql-test/r/ndb_lock.result b/mysql-test/r/ndb_lock.result
index 2c212b9cfef..668c26aad03 100644
--- a/mysql-test/r/ndb_lock.result
+++ b/mysql-test/r/ndb_lock.result
@@ -152,3 +152,14 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
rollback;
commit;
drop table t1;
+create table t3 (id2 int) engine=ndb;
+lock tables t3 write;
+unlock tables;
+drop table t3;
+create table t2 (id int, j int) engine=ndb;
+insert into t2 values (2, 2);
+create table t3 (id int) engine=ndb;
+lock tables t3 read;
+delete t2 from t2, t3 where t2.id = t3.id;
+unlock tables;
+drop table t2, t3;
diff --git a/mysql-test/r/ndb_multi.result b/mysql-test/r/ndb_multi.result
index 5d75722982f..1c9633589e0 100644
--- a/mysql-test/r/ndb_multi.result
+++ b/mysql-test/r/ndb_multi.result
@@ -1,4 +1,5 @@
drop table if exists t1, t2, t3, t4;
+drop table if exists t1, t2, t3, t4;
flush status;
create table t1 (a int) engine=ndbcluster;
create table t2 (a int) engine=ndbcluster;
@@ -28,7 +29,9 @@ Handler_discover 0
drop table t1;
create table t1 (a int) engine=ndbcluster;
insert into t1 value (2);
-flush table t1;
+select * from t1;
+a
+2
select * from t1;
a
2
@@ -50,15 +53,9 @@ a
select * from t3;
a b c last_col
1 Hi! 89 Longtext column
-show status like 'handler_discover%';
-Variable_name Value
-Handler_discover 2
show tables like 't4';
Tables_in_test (t4)
t4
-show status like 'handler_discover%';
-Variable_name Value
-Handler_discover 3
show tables;
Tables_in_test
t1
@@ -66,7 +63,6 @@ t2
t3
t4
drop table t1, t2, t3, t4;
-drop table t1, t3, t4;
create table t1(c1 int key)ENGINE=MyISAM;
insert into t1 values(1),(3),(5);
select * from t1 order by c1;
@@ -74,6 +70,8 @@ c1
1
3
5
+show tables;
+Tables_in_test
create table t1(c1 int key)ENGINE=MyISAM;
insert into t1 values(100),(344),(533);
select * from t1 order by c1;
diff --git a/mysql-test/r/ndb_multi_row.result b/mysql-test/r/ndb_multi_row.result
new file mode 100644
index 00000000000..cf5a76d6f01
--- /dev/null
+++ b/mysql-test/r/ndb_multi_row.result
@@ -0,0 +1,67 @@
+drop table if exists t1, t2, t3, t4;
+drop table if exists t1, t2, t3, t4;
+flush status;
+create table t1 (a int) engine=ndbcluster;
+create table t2 (a int) engine=ndbcluster;
+insert into t1 value (2);
+insert into t2 value (3);
+select * from t1;
+a
+2
+select * from t2;
+a
+3
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 0
+select * from t1;
+a
+2
+drop table t1;
+create table t1 (a int) engine=ndbcluster;
+insert into t1 value (2);
+select * from t1;
+a
+2
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 0
+drop table t1;
+create table t1 (a int) engine=ndbcluster;
+insert into t1 value (2);
+select * from t1;
+a
+2
+flush status;
+select * from t1;
+a
+2
+update t1 set a=3 where a=2;
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 0
+create table t3 (a int not null primary key, b varchar(22),
+c int, last_col text) engine=ndb;
+insert into t3 values(1, 'Hi!', 89, 'Longtext column');
+create table t4 (pk int primary key, b int) engine=ndb;
+select * from t1;
+a
+3
+select * from t3;
+a b c last_col
+1 Hi! 89 Longtext column
+show tables like 't4';
+Tables_in_test (t4)
+t4
+show tables;
+Tables_in_test
+t1
+t2
+t3
+t4
+drop table t1, t2, t3, t4;
+drop table if exists t1, t3, t4;
+Warnings:
+Error 155 Table 'test.t1' doesn't exist
+Error 155 Table 'test.t3' doesn't exist
+Error 155 Table 'test.t4' doesn't exist
diff --git a/mysql-test/r/ndb_partition_error.result b/mysql-test/r/ndb_partition_error.result
new file mode 100644
index 00000000000..d86dc382185
--- /dev/null
+++ b/mysql-test/r/ndb_partition_error.result
@@ -0,0 +1,47 @@
+drop table if exists t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b),
+index (a))
+engine = ndb
+partition by range (a)
+partitions 3
+(partition x1 values less than (5) nodegroup 12,
+partition x2 values less than (10) nodegroup 13,
+partition x3 values less than (20) nodegroup 14);
+ERROR HY000: Can't create table 'test.t1' (errno: 140)
+show warnings;
+Level Code Message
+Error 1296 Got error 771 'Given NODEGROUP doesn't exist in this cluster' from NDB
+Error 1005 Can't create table 'test.t1' (errno: 140)
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a))
+engine = ndb
+partition by range (a)
+partitions 3
+(partition x1 values less than (5),
+partition x2 values less than (10),
+partition x3 values less than (20));
+drop table t1;
+CREATE TABLE t1 (id INT) ENGINE=NDB
+PARTITION BY LIST(id)
+(PARTITION p0 VALUES IN (2, 4),
+PARTITION p1 VALUES IN (42, 142));
+INSERT INTO t1 VALUES (2);
+UPDATE t1 SET id=5 WHERE id=2;
+ERROR HY000: Table has no partition for value 5
+DROP TABLE t1;
+create table t1 (a int,b int, c int)
+engine = ndb
+partition by list(a)
+partitions 2
+(partition x123 values in (11, 12),
+partition x234 values in (5, 1));
+insert into t1 values (NULL,1,1);
+ERROR HY000: Table has no partition for value NULL
+drop table t1;
diff --git a/mysql-test/r/ndb_partition_key.result b/mysql-test/r/ndb_partition_key.result
new file mode 100644
index 00000000000..7e480f68dd9
--- /dev/null
+++ b/mysql-test/r/ndb_partition_key.result
@@ -0,0 +1,205 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a int, b int, c int, d int, PRIMARY KEY(a,b,c))
+ENGINE = NDB
+PARTITION BY KEY (a,b);
+insert into t1 values (1,1,1,1);
+select * from t1;
+a b c d
+1 1 1 1
+update t1 set d = 2 where a = 1 and b = 1 and c = 1;
+select * from t1;
+a b c d
+1 1 1 2
+delete from t1;
+select * from t1;
+a b c d
+drop table t1;
+CREATE TABLE t1 (a int, b int, c int, d int, PRIMARY KEY(a,b))
+ENGINE = NDB
+PARTITION BY KEY (c);
+ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
+CREATE TABLE t1 (a int, b int, c int, PRIMARY KEY(a,b))
+ENGINE = NDB
+PARTITION BY KEY (a);
+insert into t1 values
+(1,1,3),(1,2,3),(1,3,3),(1,4,3),(1,5,3),(1,6,3),
+(1,7,3),(1,8,3),(1,9,3),(1,10,3),(1,11,3),(1,12,3);
+select * from t1 order by b;
+a b c
+1 1 3
+1 2 3
+1 3 3
+1 4 3
+1 5 3
+1 6 3
+1 7 3
+1 8 3
+1 9 3
+1 10 3
+1 11 3
+1 12 3
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b CHAR(10) COLLATE latin1_bin, c INT, d INT,
+PRIMARY KEY (a,b,c) USING HASH)
+ENGINE=NDB
+DEFAULT CHARSET=latin1
+PARTITION BY KEY (b);
+insert into t1 values (1,"a",1,1),(2,"a",1,1),(3,"a",1,1);
+-- t1 --
+
+Fragment type: 5
+K Value: 6
+Min load factor: 78
+Max load factor: 80
+Temporary table: no
+Number of attributes: 4
+Number of primary keys: 3
+Length of frm data: #
+Row Checksum: 1
+Row GCI: 1
+TableStatus: Retrieved
+-- Attributes --
+a Int PRIMARY KEY AT=FIXED ST=MEMORY
+b Char(10;latin1_bin) PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
+c Int PRIMARY KEY AT=FIXED ST=MEMORY
+d Int NULL AT=FIXED ST=MEMORY
+
+-- Indexes --
+PRIMARY KEY(a, b, c) - UniqueHashIndex
+
+
+NDBT_ProgramExit: 0 - OK
+
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL DEFAULT '0',
+ `b` char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
+ `c` int(11) NOT NULL DEFAULT '0',
+ `d` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`,`b`,`c`) USING HASH
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (b) */
+DROP TABLE t1;
+CREATE TABLE t1 (a int not null primary key)
+PARTITION BY KEY(a)
+(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
+drop table t1;
+CREATE TABLE t1 (a int not null primary key);
+ALTER TABLE t1
+PARTITION BY KEY(a)
+(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
+drop table t1;
+create table t1 (a int)
+engine=ndb
+partition by key(a)
+(partition p0, partition p1);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
+alter table t1 engine=heap;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY) */
+alter table t1 engine=ndb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
+alter table t1 engine=heap remove partitioning;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+alter table t1 engine=ndb
+partition by key(a)
+(partition p0, partition p1 engine = ndb);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
+alter table t1
+partition by key (a)
+(partition p0 engine=ndb, partition p1 engine=ndb);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
+alter table t1 remove partitioning;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+alter table t1
+partition by key(a)
+(partition p0 engine=ndb, partition p1);
+ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
+alter table t1
+engine=ndb
+partition by key(a)
+(partition p0 engine=ndb, partition p1 engine = ndb);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
+drop table t1;
+CREATE TABLE t1 (
+c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
+c2 TEXT NOT NULL,
+c3 INT NOT NULL,
+c4 BIT NOT NULL,
+c5 FLOAT,
+c6 VARCHAR(255),
+c7 TIMESTAMP,
+PRIMARY KEY(c1,c3))
+ENGINE=NDB
+PARTITION BY KEY(c3) PARTITIONS 5;
+ALTER TABLE t1 COALESCE PARTITION 4;
+DROP TABLE t1;
+CREATE TABLE t1 (a int primary key)
+ENGINE=NDB
+PARTITION BY KEY(a);
+ALTER TABLE t1 OPTIMIZE PARTITION p0;
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+ALTER TABLE t1 CHECK PARTITION p0;
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+ALTER TABLE t1 REPAIR PARTITION p0;
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+ALTER TABLE t1 ANALYZE PARTITION p0;
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+ALTER TABLE t1 REBUILD PARTITION p0;
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+DROP TABLE t1;
+CREATE TABLE t1 (
+c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
+c2 TEXT NOT NULL,
+c3 INT NOT NULL,
+PRIMARY KEY(c1,c3))
+ENGINE=NDB
+PARTITION BY KEY(c3) PARTITIONS 5;
+ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1;
+DROP TABLE t1;
+CREATE TABLE t1 (
+c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
+c2 TEXT NOT NULL,
+c3 INT NOT NULL,
+PRIMARY KEY(c1,c3))
+ENGINE=NDB
+PARTITION BY KEY(c3)
+(PARTITION p0 NODEGROUP 0, PARTITION p1 NODEGROUP 0);
+ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1;
+SELECT NODEGROUP,PARTITION_NAME FROM information_schema.partitions WHERE
+table_name = "t1";
+NODEGROUP PARTITION_NAME
+0 p0
+0 p1
+DROP TABLE t1;
diff --git a/mysql-test/r/ndb_partition_list.result b/mysql-test/r/ndb_partition_list.result
new file mode 100644
index 00000000000..ce2574ddcc4
--- /dev/null
+++ b/mysql-test/r/ndb_partition_list.result
@@ -0,0 +1,51 @@
+drop table if exists t1;
+CREATE TABLE t1 ( f_int1 INTEGER NOT NULL, f_int2 INTEGER NOT NULL,
+f_char1 CHAR(10),
+f_char2 CHAR(10), f_charbig VARCHAR(1000),
+PRIMARY KEY (f_int1,f_int2))
+ENGINE = NDB
+PARTITION BY LIST(MOD(f_int1 + f_int2,4))
+(PARTITION part_3 VALUES IN (-3),
+PARTITION part_2 VALUES IN (-2),
+PARTITION part_1 VALUES IN (-1),
+PARTITION part0 VALUES IN (0),
+PARTITION part1 VALUES IN (1),
+PARTITION part2 VALUES IN (2),
+PARTITION part3 VALUES IN (3,4,5));
+INSERT INTO t1 SET f_int1 = -2, f_int2 = 20, f_char1 = '20', f_char2 = '20', f_charbig = '===20===';
+INSERT INTO t1 SET f_int1 = 1, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 2, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 3, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 4, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 5, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 20, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+SELECT * FROM t1 ORDER BY f_int1;
+f_int1 f_int2 f_char1 f_char2 f_charbig
+-2 20 20 20 ===20===
+1 1 1 1 ===1===
+2 1 1 1 ===1===
+3 1 1 1 ===1===
+4 1 1 1 ===1===
+5 1 1 1 ===1===
+20 1 1 1 ===1===
+DROP TABLE t1;
+CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(10),
+f_char2 CHAR(10), f_charbig VARCHAR(1000))
+ENGINE = NDB
+PARTITION BY LIST(f_int1)
+(PARTITION part_1 VALUES IN (-1),
+PARTITION part0 VALUES IN (0,1),
+PARTITION part1 VALUES IN (2));
+INSERT INTO t1 SET f_int1 = -1, f_int2 = 20, f_char1 = '20', f_char2 = '20', f_charbig = '===20===';
+INSERT INTO t1 SET f_int1 = 0, f_int2 = 20, f_char1 = '20', f_char2 = '20', f_charbig = '===20===';
+INSERT INTO t1 SET f_int1 = 1, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 2, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 20, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+ERROR HY000: Table has no partition for value 20
+SELECT * FROM t1 ORDER BY f_int1;
+f_int1 f_int2 f_char1 f_char2 f_charbig
+-1 20 20 20 ===20===
+0 20 20 20 ===20===
+1 1 1 1 ===1===
+2 1 1 1 ===1===
+DROP TABLE t1;
diff --git a/mysql-test/r/ndb_partition_range.result b/mysql-test/r/ndb_partition_range.result
new file mode 100644
index 00000000000..f4bae479239
--- /dev/null
+++ b/mysql-test/r/ndb_partition_range.result
@@ -0,0 +1,263 @@
+drop table if exists t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b),
+index (a))
+engine = ndb
+partition by range (a)
+partitions 3
+(partition x1 values less than (5),
+partition x2 values less than (10),
+partition x3 values less than (20));
+INSERT into t1 values (1, 1, 1);
+INSERT into t1 values (6, 1, 1);
+INSERT into t1 values (10, 1, 1);
+INSERT into t1 values (15, 1, 1);
+select * from information_schema.partitions where table_name= 't1';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t1 x1 NULL 1 NULL RANGE NULL a NULL 5 0 0 0 # 0 0 # # NULL NULL default default default
+NULL test t1 x2 NULL 2 NULL RANGE NULL a NULL 10 0 0 0 # 0 0 # # NULL NULL default default default
+NULL test t1 x3 NULL 3 NULL RANGE NULL a NULL 20 0 0 0 # 0 0 # # NULL NULL default default default
+select * from t1 order by a;
+a b c
+1 1 1
+6 1 1
+10 1 1
+15 1 1
+select * from t1 where a=1 order by a;
+a b c
+1 1 1
+select * from t1 where a=15 and b=1 order by a;
+a b c
+15 1 1
+select * from t1 where a=21 and b=1 order by a;
+a b c
+select * from t1 where a=21 order by a;
+a b c
+select * from t1 where a in (1,6,10,21) order by a;
+a b c
+1 1 1
+6 1 1
+10 1 1
+select * from t1 where b=1 and a in (1,6,10,21) order by a;
+a b c
+1 1 1
+6 1 1
+10 1 1
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(b),
+unique (a))
+engine = ndb
+partition by range (b)
+partitions 3
+(partition x1 values less than (5),
+partition x2 values less than (10),
+partition x3 values less than (20));
+INSERT into t1 values (1, 1, 1);
+INSERT into t1 values (2, 6, 1);
+INSERT into t1 values (3, 10, 1);
+INSERT into t1 values (4, 15, 1);
+select * from t1 order by a;
+a b c
+1 1 1
+2 6 1
+3 10 1
+4 15 1
+UPDATE t1 set a = 5 WHERE b = 15;
+select * from t1 order by a;
+a b c
+1 1 1
+2 6 1
+3 10 1
+5 15 1
+UPDATE t1 set a = 6 WHERE a = 5;
+select * from t1 order by a;
+a b c
+1 1 1
+2 6 1
+3 10 1
+6 15 1
+select * from t1 where b=1 order by b;
+a b c
+1 1 1
+select * from t1 where b=15 and a=1 order by b;
+a b c
+select * from t1 where b=21 and a=1 order by b;
+a b c
+select * from t1 where b=21 order by b;
+a b c
+select * from t1 where b in (1,6,10,21) order by b;
+a b c
+1 1 1
+2 6 1
+3 10 1
+select * from t1 where a in (1,2,5,6) order by b;
+a b c
+1 1 1
+2 6 1
+6 15 1
+select * from t1 where a=1 and b in (1,6,10,21) order by b;
+a b c
+1 1 1
+DELETE from t1 WHERE b = 6;
+DELETE from t1 WHERE a = 6;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` int(11) NOT NULL,
+ `c` int(11) NOT NULL,
+ PRIMARY KEY (`b`),
+ UNIQUE KEY `a` (`a`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (b) (PARTITION x1 VALUES LESS THAN (5) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (10) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (20) ENGINE = ndbcluster) */
+drop table t1;
+CREATE TABLE t1
+(id MEDIUMINT NOT NULL,
+b1 BIT(8),
+vc VARCHAR(255),
+bc CHAR(255),
+d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0,
+total BIGINT UNSIGNED,
+y YEAR,
+t DATE) ENGINE=NDB
+PARTITION BY RANGE (YEAR(t))
+(PARTITION p0 VALUES LESS THAN (1901),
+PARTITION p1 VALUES LESS THAN (1946),
+PARTITION p2 VALUES LESS THAN (1966),
+PARTITION p3 VALUES LESS THAN (1986),
+PARTITION p4 VALUES LESS THAN (2005),
+PARTITION p5 VALUES LESS THAN MAXVALUE);
+INSERT INTO t1 VALUES (0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+SELECT * FROM t1;
+id b1 vc bc d f total y t
+0 NULL NULL NULL NULL NULL NULL NULL NULL
+ALTER TABLE t1 ENGINE=MYISAM;
+SELECT * FROM t1;
+id b1 vc bc d f total y t
+0 NULL NULL NULL NULL NULL NULL NULL NULL
+DROP TABLE t1;
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+ INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE=1M
+ENGINE=NDB;
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+ USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M
+ENGINE NDB;
+CREATE TABLE test.t1 (
+a1 INT,
+a2 TEXT NOT NULL,
+a3 BIT NOT NULL,
+a4 DECIMAL(8,3),
+a5 INT NOT NULL,
+a6 INT,
+PRIMARY KEY(a1))
+TABLESPACE ts1 STORAGE DISK ENGINE=NDB
+PARTITION BY LIST (a1)
+(PARTITION p0 VALUES IN (1,2,3,4,5),
+PARTITION p1 VALUES IN (6,7,8,9, 10),
+PARTITION p2 VALUES IN (11, 12, 13, 14, 15));
+ALTER TABLE test.t1 DROP COLUMN a6;
+ALTER TABLE test.t1 ADD COLUMN a6 VARCHAR(255);
+SELECT COUNT(*) FROM test.t1;
+COUNT(*)
+15
+ALTER TABLE test.t1 DROP COLUMN a4;
+SELECT COUNT(*) FROM test.t1;
+COUNT(*)
+15
+DROP TABLE t1;
+CREATE TABLE test.t1 (
+a1 INT,
+a2 TEXT NOT NULL,
+a3 BIT NOT NULL,
+a4 DECIMAL(8,3),
+a5 INT NOT NULL,
+a6 VARCHAR(255),
+PRIMARY KEY(a1))
+TABLESPACE ts1 STORAGE DISK ENGINE=NDB
+PARTITION BY HASH(a1)
+PARTITIONS 4;
+SELECT COUNT(*) FROM test.t1;
+COUNT(*)
+15
+ALTER TABLE test.t1 DROP COLUMN a4;
+SELECT COUNT(*) FROM test.t1;
+COUNT(*)
+15
+DROP TABLE t1;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile.dat'
+ENGINE=NDB;
+DROP TABLESPACE ts1 ENGINE=NDB;
+DROP LOGFILE GROUP lg1 ENGINE=NDB;
+CREATE TABLE t1
+(id MEDIUMINT NOT NULL,
+b1 BIT(8),
+vc VARCHAR(255),
+bc CHAR(255),
+d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0,
+total BIGINT UNSIGNED,
+y YEAR,
+t DATE) ENGINE=NDB
+PARTITION BY LIST(id)
+(PARTITION p0 VALUES IN (2, 4),
+PARTITION p1 VALUES IN (42, 142));
+INSERT INTO t1 VALUES (2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+SELECT * FROM t1;
+id b1 vc bc d f total y t
+2 NULL NULL NULL NULL NULL NULL NULL NULL
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p2 VALUES IN (412));
+SELECT * FROM t1;
+id b1 vc bc d f total y t
+2 NULL NULL NULL NULL NULL NULL NULL NULL
+DROP TABLE t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null)
+partition by list(a)
+partitions 2
+(partition x123 values in (1,5,6),
+partition x234 values in (4,7,8));
+INSERT into t1 VALUES (5,1,1);
+select * from t1;
+a b c
+5 1 1
+UPDATE t1 SET a=8 WHERE a=5 AND b=1;
+select * from t1;
+a b c
+8 1 1
+drop table t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20)) engine=ndb
+PARTITION BY RANGE(f1)
+( PARTITION part1 VALUES LESS THAN (2),
+PARTITION part2 VALUES LESS THAN (1000));
+INSERT INTO t1 VALUES(1, '---1---');
+INSERT INTO t1 VALUES(2, '---2---');
+select * from t1 order by f1;
+f1 f2
+1 ---1---
+2 ---2---
+UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 2;
+select * from t1 order by f1;
+f1 f2
+1 ---1---
+6 ---2---
+UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 1;
+select * from t1 order by f1;
+f1 f2
+5 ---1---
+6 ---2---
+drop table t1;
diff --git a/mysql-test/r/ndb_read_multi_range.result b/mysql-test/r/ndb_read_multi_range.result
index 9941d2b28a3..53c10552668 100644
--- a/mysql-test/r/ndb_read_multi_range.result
+++ b/mysql-test/r/ndb_read_multi_range.result
@@ -286,10 +286,10 @@ INSERT INTO t1 VALUES
(406990,67,'2006-02-23 18:01:45'),(148815,67,'2005-10-25 15:34:17'),
(148812,67,'2005-10-25 15:30:01'),(245651,67,'2005-12-08 15:58:27'),
(154503,67,'2005-10-28 11:52:38');
-create table t11 select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) order by 3 asc;
-create table t12 select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) order by 3 desc;
+create table t11 engine = ndbcluster select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) order by 3 asc;
+create table t12 engine = ndbcluster select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) order by 3 desc;
create table t21 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08') order by 3 asc;
-create table t22 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08') order by 3 desc;
+create table t22 engine = ndbcluster select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08') order by 3 desc;
select * from t11 order by 1,2,3;
a b c
254 67 NULL
@@ -366,4 +366,65 @@ a b c
406993 67 2006-02-27 11:20:57
406994 67 2006-02-27 11:26:46
406995 67 2006-02-28 11:55:00
+select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null order by t12.a;
+a
+255
+256
+update t22 set c = '2005-12-08 15:58:27' where a = 255;
+select * from t22 order by 1,2,3;
+a b c
+1 67 2006-02-23 15:01:35
+254 67 NULL
+255 67 2005-12-08 15:58:27
+256 67 NULL
+1120 67 NULL
+1133 67 NULL
+4101 67 NULL
+9199 67 NULL
+223456 67 NULL
+245651 67 2005-12-08 15:58:27
+245652 67 2005-12-08 15:58:27
+245653 67 2005-12-08 15:59:07
+245654 67 2005-12-08 15:59:08
+245655 67 2005-12-08 15:59:08
+398340 67 2006-02-20 04:38:53
+398341 67 2006-02-20 04:48:44
+398545 67 2006-02-20 04:53:13
+406631 67 2006-02-23 10:49:42
+406988 67 2006-02-23 17:07:22
+406989 67 2006-02-23 17:08:46
+406990 67 2006-02-23 18:01:45
+406991 67 2006-02-24 16:42:32
+406992 67 2006-02-24 16:47:18
+406993 67 2006-02-27 11:20:57
+406994 67 2006-02-27 11:26:46
+406995 67 2006-02-28 11:55:00
+select t21.* from t21,t22 where t21.a = t22.a and
+t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null) and t22.c is null order by t21.a;
+a b c
+256 67 NULL
+delete from t22 where a > 245651;
+update t22 set b = a + 1;
+select * from t22 order by 1,2,3;
+a b c
+1 2 2006-02-23 15:01:35
+254 255 NULL
+255 256 2005-12-08 15:58:27
+256 257 NULL
+1120 1121 NULL
+1133 1134 NULL
+4101 4102 NULL
+9199 9200 NULL
+223456 223457 NULL
+245651 245652 2005-12-08 15:58:27
+select c, count(*)
+from t21
+inner join t22 using (a)
+where t22.b in (2,256,257,1121,1134,4102,9200,223457,245652)
+group by c
+order by c;
+c count(*)
+NULL 7
+2005-12-08 15:58:27 1
+2006-02-23 15:01:35 1
DROP TABLE t1, t11, t12, t21, t22;
diff --git a/mysql-test/r/ndb_rename.result b/mysql-test/r/ndb_rename.result
index cacef136311..2cc2dfb3ff1 100644
--- a/mysql-test/r/ndb_rename.result
+++ b/mysql-test/r/ndb_rename.result
@@ -7,8 +7,18 @@ attr2 INT,
attr3 VARCHAR(10),
INDEX i1(attr1)
) ENGINE=ndbcluster;
+INSERT INTO t1 VALUES (0,0,0,"zero"),(1,1,1,"one"),(2,2,2,"two");
+SELECT * FROM t1 WHERE attr1 = 1;
+pk1 attr1 attr2 attr3
+1 1 1 one
alter table t1 rename t2;
+SELECT * FROM t2 WHERE attr1 = 1;
+pk1 attr1 attr2 attr3
+1 1 1 one
create database ndbtest;
alter table t2 rename ndbtest.t2;
+SELECT * FROM ndbtest.t2 WHERE attr1 = 1;
+pk1 attr1 attr2 attr3
+1 1 1 one
drop table ndbtest.t2;
drop database ndbtest;
diff --git a/mysql-test/r/ndb_replace.result b/mysql-test/r/ndb_replace.result
index 4d63c397d60..23844ce3bff 100644
--- a/mysql-test/r/ndb_replace.result
+++ b/mysql-test/r/ndb_replace.result
@@ -11,7 +11,7 @@ insert into t1 (gesuchnr, benutzer_id) value (3,2);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
insert into t1 (gesuchnr,benutzer_id) values (1,1);
-ERROR 23000: Duplicate entry '1-1' for key 1
+ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY'
replace into t1 (gesuchnr,benutzer_id) values (1,1);
select * from t1 order by gesuchnr;
gesuchnr benutzer_id
diff --git a/mysql-test/r/ndb_restore.result b/mysql-test/r/ndb_restore.result
index e5bf4315e5c..b946d97bea1 100644
--- a/mysql-test/r/ndb_restore.result
+++ b/mysql-test/r/ndb_restore.result
@@ -1,14 +1,14 @@
use test;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
-CREATE TABLE `t1` (
+CREATE TABLE `t1_c` (
`capgoaledatta` smallint(5) unsigned NOT NULL auto_increment,
`goaledatta` char(2) NOT NULL default '',
`maturegarbagefa` varchar(32) NOT NULL default '',
PRIMARY KEY (`capgoaledatta`,`goaledatta`,`maturegarbagefa`)
-) ENGINE=myisam DEFAULT CHARSET=latin1;
-INSERT INTO `t1` VALUES (2,'3','q3plus.qt'),(4,'4','q3plus.qt'),(1,'3','q3.net'),(3,'4','q3.net'),(3,'20','threetrees.qt');
-CREATE TABLE `t2` (
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t1_c` VALUES (2,'3','q3plus.qt'),(4,'4','q3plus.qt'),(1,'3','q3.net'),(3,'4','q3.net'),(3,'20','threetrees.qt');
+CREATE TABLE `t2_c` (
`capgotod` smallint(5) unsigned NOT NULL auto_increment,
`gotod` smallint(5) unsigned NOT NULL default '0',
`goaledatta` char(2) default NULL,
@@ -17,15 +17,15 @@ CREATE TABLE `t2` (
`svcutonsa` varchar(64) NOT NULL default '',
PRIMARY KEY (`capgotod`),
KEY `i_quadaddsvr` (`gotod`)
-) ENGINE=myisam DEFAULT CHARSET=latin1;
-INSERT INTO `t2` VALUES (5,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST');
-CREATE TABLE `t3` (
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t2_c` VALUES (5,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST');
+CREATE TABLE `t3_c` (
`CapGoaledatta` smallint(5) unsigned NOT NULL default '0',
`capgotod` smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (`capgotod`,`CapGoaledatta`)
-) ENGINE=myisam DEFAULT CHARSET=latin1;
-INSERT INTO `t3` VALUES (5,3),(2,4),(5,4),(1,3);
-CREATE TABLE `t4` (
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t3_c` VALUES (5,3),(2,4),(5,4),(1,3);
+CREATE TABLE `t4_c` (
`capfa` bigint(20) unsigned NOT NULL auto_increment,
`realm` varchar(32) NOT NULL default '',
`authpwchap` varchar(32) default NULL,
@@ -35,23 +35,23 @@ CREATE TABLE `t4` (
PRIMARY KEY (`fa`,`realm`),
KEY `capfa` (`capfa`),
KEY `i_quadentity` (`fa`,`realm`)
-) ENGINE=myisam DEFAULT CHARSET=latin1;
-INSERT INTO `t4` VALUES (18,'john.smith','q3.net','dessjohn.smith',0,NULL),(21,'quad_katt_with_brandtad','q3.net','acne',0,NULL),(22,'quad_katt_carattoaa','q3.net','acne',0,NULL),(26,'436462612809','sqasdt.q3.net','N/A',0,'6'),(19,'john','smith.qt','dessjohn',0,NULL),(33,'436643196120','sqasdt.q3.net','N/A',1,'6'),(28,'436642900019','sqasdt.q3.net','N/A',0,'6'),(30,'436462900209','sqasdt.q3.net','N/A',0,'6'),(16,'436640006666','sqasdt.q3.net','',0,NULL),(19,'dette','el-redun.com','dessdette',0,NULL),(12,'quad_kattPP','q3.net','acne',2,NULL),(14,'436640008888','sqasdt.q3.net','',0,NULL),(29,'463624900028','sqasdt.q3.net','N/A',0,'6'),(15,'436640099099','sqasdt.q3.net','',0,NULL),(13,'pap','q3plus.qt','acne',1,NULL),(19,'436642612091','sqasdt.q3.net','N/A',0,'6'),(12,'quad_katt','q3.net','acne',0,NULL),(11,'quad_kattVK','q3.net','acne',1,NULL),(32,'463641969502','sqasdt.q3.net','N/A',1,'6'),(20,'joe','q3.net','joedesswd',0,NULL),(29,'436642900034','sqasdt.q3.net','N/A',0,'6'),(25,'contind','armerde.qt','acne',1,NULL);
-CREATE TABLE `t5` (
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t4_c` VALUES (18,'john.smith','q3.net','dessjohn.smith',0,NULL),(21,'quad_katt_with_brandtad','q3.net','acne',0,NULL),(22,'quad_katt_carattoaa','q3.net','acne',0,NULL),(26,'436462612809','sqasdt.q3.net','N/A',0,'6'),(19,'john','smith.qt','dessjohn',0,NULL),(33,'436643196120','sqasdt.q3.net','N/A',1,'6'),(28,'436642900019','sqasdt.q3.net','N/A',0,'6'),(30,'436462900209','sqasdt.q3.net','N/A',0,'6'),(16,'436640006666','sqasdt.q3.net','',0,NULL),(19,'dette','el-redun.com','dessdette',0,NULL),(12,'quad_kattPP','q3.net','acne',2,NULL),(14,'436640008888','sqasdt.q3.net','',0,NULL),(29,'463624900028','sqasdt.q3.net','N/A',0,'6'),(15,'436640099099','sqasdt.q3.net','',0,NULL),(13,'pap','q3plus.qt','acne',1,NULL),(19,'436642612091','sqasdt.q3.net','N/A',0,'6'),(12,'quad_katt','q3.net','acne',0,NULL),(11,'quad_kattVK','q3.net','acne',1,NULL),(32,'463641969502','sqasdt.q3.net','N/A',1,'6'),(20,'joe','q3.net','joedesswd',0,NULL),(29,'436642900034','sqasdt.q3.net','N/A',0,'6'),(25,'contind','armerde.qt','acne',1,NULL);
+CREATE TABLE `t5_c` (
`capfa` bigint(20) unsigned NOT NULL default '0',
`gotod` smallint(5) unsigned NOT NULL default '0',
`orderutonsa` varchar(64) NOT NULL default '',
PRIMARY KEY (`capfa`,`gotod`,`orderutonsa`)
-) ENGINE=myisam DEFAULT CHARSET=latin1;
-INSERT INTO `t5` VALUES (21,2,''),(21,1,''),(22,4,'');
-CREATE TABLE `t6` (
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t5_c` VALUES (21,2,''),(21,1,''),(22,4,'');
+CREATE TABLE `t6_c` (
`capfa_parent` bigint(20) unsigned NOT NULL default '0',
`capfa_child` bigint(20) unsigned NOT NULL default '0',
`relatta` smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (`capfa_child`,`capfa_parent`,`relatta`)
-) ENGINE=myisam DEFAULT CHARSET=latin1;
-INSERT INTO `t6` VALUES (15,16,0),(19,20,0),(18326932092909551615,30,0),(26,29,0),(18326932092909551615,29,0),(19,18,0),(26,28,0),(12,14,0);
-CREATE TABLE `t7` (
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t6_c` VALUES (15,16,0),(19,20,0),(18326932092909551615,30,0),(26,29,0),(18326932092909551615,29,0),(19,18,0),(26,28,0),(12,14,0);
+CREATE TABLE `t7_c` (
`dardpo` char(15) NOT NULL default '',
`dardtestard` tinyint(3) unsigned NOT NULL default '0',
`FastFA` char(5) NOT NULL default '',
@@ -60,9 +60,9 @@ CREATE TABLE `t7` (
`Fastmag` char(1) NOT NULL default '',
`Beareratta` char(2) NOT NULL default '',
PRIMARY KEY (`dardpo`,`dardtestard`)
-) ENGINE=myisam DEFAULT CHARSET=latin1;
-INSERT INTO `t7` VALUES ('2.6.2.4',24,'CECHP','54545','0','0','5'),('2.2.5.4',26,'CANFA','33223','1','1','4'),('4.3.2.4',28,'ITALD','54222','1','0','5'),('129..0.0.eins',28,'G','99999','1','1','5'),('1.1.1.1',24,'AUTPT','32323','0','1','3');
-CREATE TABLE `t8` (
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t7_c` VALUES ('2.6.2.4',24,'CECHP','54545','0','0','5'),('2.2.5.4',26,'CANFA','33223','1','1','4'),('4.3.2.4',28,'ITALD','54222','1','0','5'),('129..0.0.eins',28,'G','99999','1','1','5'),('1.1.1.1',24,'AUTPT','32323','0','1','3');
+CREATE TABLE `t8_c` (
`kattjame` varchar(32) NOT NULL default '',
`realm` varchar(32) NOT NULL default '',
`realm_entered` varchar(32) NOT NULL default '',
@@ -88,9 +88,9 @@ CREATE TABLE `t8` (
`acctinputoctets` bigint(20) unsigned default NULL,
PRIMARY KEY (`kattjame`,`hunderaaarbagefa`,`hassetistart`,`hassetino`),
KEY `squardporoot` (`squardporoot`)
-) ENGINE=myisam DEFAULT CHARSET=latin1;
-INSERT INTO `t8` VALUES ('4tt45345235','pap','q3plus.qt','q3plus.qt','q3.net','436643196120','436643196929','8956234534568968','5524595699','uxasmt21.net.acne.qt/481889229462692422','','1.1.1.1','2.2.4.6','4','86989','34','x','x','2012-03-12 12:55:34','2012-12-05 11:20:04',3223433,3369,9565),('4545435545','john','q3.net','q3.net','acne.li','436643196120','436643196929','45345234568968','995696699','uxasmt21.net.acne.qt/481889229462692423','','1.1.1.1','2.2.9.8','2','86989','34','x','x','2012-03-12 11:35:03','2012-12-05 08:50:04',8821923,169,3565),('versteckter_q3net_katt','joe','q3.net','elredun.com','q3.net','436643196120','436643196939','91341234568968','695595699','uxasmt21.net.acne.qt/481889229462692421','','1.1.1.1','2.5.2.5','3','86989','34','x','x','2012-03-12 18:35:04','2012-12-05 12:35:04',1923123,9569,6565);
-CREATE TABLE `t9` (
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t8_c` VALUES ('4tt45345235','pap','q3plus.qt','q3plus.qt','q3.net','436643196120','436643196929','8956234534568968','5524595699','uxasmt21.net.acne.qt/481889229462692422','','1.1.1.1','2.2.4.6','4','86989','34','x','x','2012-03-12 12:55:34','2012-12-05 11:20:04',3223433,3369,9565),('4545435545','john','q3.net','q3.net','acne.li','436643196120','436643196929','45345234568968','995696699','uxasmt21.net.acne.qt/481889229462692423','','1.1.1.1','2.2.9.8','2','86989','34','x','x','2012-03-12 11:35:03','2012-12-05 08:50:04',8821923,169,3565),('versteckter_q3net_katt','joe','q3.net','elredun.com','q3.net','436643196120','436643196939','91341234568968','695595699','uxasmt21.net.acne.qt/481889229462692421','','1.1.1.1','2.5.2.5','3','86989','34','x','x','2012-03-12 18:35:04','2012-12-05 12:35:04',1923123,9569,6565);
+CREATE TABLE `t9_c` (
`kattjame` varchar(32) NOT NULL default '',
`kattjame_entered` varchar(32) NOT NULL default '',
`realm` varchar(32) NOT NULL default '',
@@ -114,43 +114,28 @@ CREATE TABLE `t9` (
`actinputocctets` bigint(20) unsigned default NULL,
`terminateraste` tinyint(3) unsigned default NULL,
PRIMARY KEY (`kattjame`,`hunderaaarbagefa`,`hassetistart`,`hassetino`)
-) ENGINE=myisam DEFAULT CHARSET=latin1;
-INSERT INTO `t9` VALUES ('3g4jh8gar2t','joe','q3.net','elredun.com','q3.net','436643316120','436643316939','91341234568968','695595699','1.1.1.1','2.2.6.2','3','86989','34','x','x','2012-03-12 18:35:04','2012-12-05 12:35:04',3123123,9569,6565,1),('4tt45345235','pap','q3plus.qt','q3plus.qt','q3.net','436643316120','436643316939','8956234534568968','5254595969','1.1.1.1','8.6.2.2','4','86989','34','x','x','2012-03-12 12:55:34','2012-12-05 11:20:04',3223433,3369,9565,2),('4545435545','john','q3.net','q3.net','acne.li','436643316120','436643316939','45345234568968','995696699','1.1.1.1','2.9.9.2','2','86998','34','x','x','2012-03-12 11:35:03','2012-12-05 08:50:04',8823123,169,3565,3);
-create table t10 (a int auto_increment key);
-insert into t10 values (1),(2),(3);
-create table t1_c engine=ndbcluster as select * from t1;
-create table t2_c engine=ndbcluster as select * from t2;
-create table t3_c engine=ndbcluster as select * from t3;
-create table t4_c engine=ndbcluster as select * from t4;
-create table t5_c engine=ndbcluster as select * from t5;
-create table t6_c engine=ndbcluster as select * from t6;
-create table t7_c engine=ndbcluster as select * from t7;
-create table t8_c engine=ndbcluster as select * from t8;
-create table t9_c engine=ndbcluster as select * from t9;
-create table t10_c engine=ndbcluster as select * from t10;
-drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c, t10_c;
-show tables;
-Tables_in_test
-t1
-t10
-t2
-t3
-t4
-t5
-t6
-t7
-t8
-t9
-t3_c
-t9_c
-t1_c
-t8_c
-t7_c
-t6_c
-t5_c
-t4_c
-t10_c
-t2_c
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t9_c` VALUES ('3g4jh8gar2t','joe','q3.net','elredun.com','q3.net','436643316120','436643316939','91341234568968','695595699','1.1.1.1','2.2.6.2','3','86989','34','x','x','2012-03-12 18:35:04','2012-12-05 12:35:04',3123123,9569,6565,1),('4tt45345235','pap','q3plus.qt','q3plus.qt','q3.net','436643316120','436643316939','8956234534568968','5254595969','1.1.1.1','8.6.2.2','4','86989','34','x','x','2012-03-12 12:55:34','2012-12-05 11:20:04',3223433,3369,9565,2),('4545435545','john','q3.net','q3.net','acne.li','436643316120','436643316939','45345234568968','995696699','1.1.1.1','2.9.9.2','2','86998','34','x','x','2012-03-12 11:35:03','2012-12-05 08:50:04',8823123,169,3565,3);
+CREATE TABLE t10_c (a INT AUTO_INCREMENT KEY) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO t10_c VALUES (1),(2),(3);
+create table t1 engine=myisam as select * from t1_c;
+create table t2 engine=myisam as select * from t2_c;
+create table t3 engine=myisam as select * from t3_c;
+create table t4 engine=myisam as select * from t4_c;
+create table t5 engine=myisam as select * from t5_c;
+create table t6 engine=myisam as select * from t6_c;
+create table t7 engine=myisam as select * from t7_c;
+create table t8 engine=myisam as select * from t8_c;
+create table t9 engine=myisam as select * from t9_c;
+create table t10 engine=myisam as select * from t10_c;
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM test.backup_info;
+LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM test.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+DROP TABLE test.backup_info;
+drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
select count(*) from t1;
count(*)
5
@@ -255,6 +240,223 @@ a
1
2
3
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9, t10;
-drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c, t10_c;
-520093696,1
+ALTER TABLE t7_c
+PARTITION BY LINEAR KEY (`dardtestard`);
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM test.backup_info;
+LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM test.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+DROP TABLE test.backup_info;
+drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
+select count(*) from t1;
+count(*)
+5
+select count(*) from t1_c;
+count(*)
+5
+select count(*)
+from (select * from t1 union
+select * from t1_c) a;
+count(*)
+5
+select count(*) from t2;
+count(*)
+6
+select count(*) from t2_c;
+count(*)
+6
+select count(*)
+from (select * from t2 union
+select * from t2_c) a;
+count(*)
+6
+select count(*) from t3;
+count(*)
+4
+select count(*) from t3_c;
+count(*)
+4
+select count(*)
+from (select * from t3 union
+select * from t3_c) a;
+count(*)
+4
+select count(*) from t4;
+count(*)
+22
+select count(*) from t4_c;
+count(*)
+22
+select count(*)
+from (select * from t4 union
+select * from t4_c) a;
+count(*)
+22
+select count(*) from t5;
+count(*)
+3
+select count(*) from t5_c;
+count(*)
+3
+select count(*)
+from (select * from t5 union
+select * from t5_c) a;
+count(*)
+3
+select count(*) from t6;
+count(*)
+8
+select count(*) from t6_c;
+count(*)
+8
+select count(*)
+from (select * from t6 union
+select * from t6_c) a;
+count(*)
+8
+select count(*) from t7;
+count(*)
+5
+select count(*) from t7_c;
+count(*)
+5
+select count(*)
+from (select * from t7 union
+select * from t7_c) a;
+count(*)
+5
+select count(*) from t8;
+count(*)
+3
+select count(*) from t8_c;
+count(*)
+3
+select count(*)
+from (select * from t8 union
+select * from t8_c) a;
+count(*)
+3
+select count(*) from t9;
+count(*)
+3
+select count(*) from t9_c;
+count(*)
+3
+select count(*)
+from (select * from t9 union
+select * from t9_c) a;
+count(*)
+3
+drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
+select count(*) from t1;
+count(*)
+5
+select count(*) from t1_c;
+count(*)
+5
+select count(*)
+from (select * from t1 union
+select * from t1_c) a;
+count(*)
+5
+select count(*) from t2;
+count(*)
+6
+select count(*) from t2_c;
+count(*)
+6
+select count(*)
+from (select * from t2 union
+select * from t2_c) a;
+count(*)
+6
+select count(*) from t3;
+count(*)
+4
+select count(*) from t3_c;
+count(*)
+4
+select count(*)
+from (select * from t3 union
+select * from t3_c) a;
+count(*)
+4
+select count(*) from t4;
+count(*)
+22
+select count(*) from t4_c;
+count(*)
+22
+select count(*)
+from (select * from t4 union
+select * from t4_c) a;
+count(*)
+22
+select count(*) from t5;
+count(*)
+3
+select count(*) from t5_c;
+count(*)
+3
+select count(*)
+from (select * from t5 union
+select * from t5_c) a;
+count(*)
+3
+select count(*) from t6;
+count(*)
+8
+select count(*) from t6_c;
+count(*)
+8
+select count(*)
+from (select * from t6 union
+select * from t6_c) a;
+count(*)
+8
+select count(*) from t7;
+count(*)
+5
+select count(*) from t7_c;
+count(*)
+5
+select count(*)
+from (select * from t7 union
+select * from t7_c) a;
+count(*)
+5
+select count(*) from t8;
+count(*)
+3
+select count(*) from t8_c;
+count(*)
+3
+select count(*)
+from (select * from t8 union
+select * from t8_c) a;
+count(*)
+3
+select count(*) from t9;
+count(*)
+3
+select count(*) from t9_c;
+count(*)
+3
+select count(*)
+from (select * from t9 union
+select * from t9_c) a;
+count(*)
+3
+drop table t1_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM test.backup_info;
+LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM test.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+DROP TABLE test.backup_info;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+drop table if exists t2_c;
+520093696,<the_backup_id>
diff --git a/mysql-test/r/ndb_restore_compat.result b/mysql-test/r/ndb_restore_compat.result
new file mode 100644
index 00000000000..358ca36b2df
--- /dev/null
+++ b/mysql-test/r/ndb_restore_compat.result
@@ -0,0 +1,104 @@
+DROP DATABASE IF EXISTS BANK;
+CREATE DATABASE BANK default charset=latin1 default collate=latin1_bin;
+USE BANK;
+SHOW TABLES;
+Tables_in_BANK
+ACCOUNT
+GL
+ACCOUNT_TYPE
+TRANSACTION
+SYSTEM_VALUES
+SELECT * FROM GL ORDER BY TIME,ACCOUNT_TYPE;
+TIME ACCOUNT_TYPE BALANCE DEPOSIT_COUNT DEPOSIT_SUM WITHDRAWAL_COUNT WITHDRAWAL_SUM PURGED
+0 0 10000000 0 0 0 0 1
+0 1 30000 0 0 0 0 1
+0 2 20000 0 0 0 0 1
+0 3 20000 0 0 0 0 1
+0 4 20000 0 0 0 0 1
+1 0 10000000 0 0 0 0 0
+1 1 30000 0 0 0 0 0
+1 2 20000 0 0 0 0 0
+1 3 20000 0 0 0 0 0
+1 4 20000 0 0 0 0 0
+2 0 9981761 17 80457 19 98696 0
+2 1 17823 55 203688 46 215865 0
+2 2 47056 33 159275 33 132219 0
+2 3 15719 26 126833 29 131114 0
+2 4 27641 32 133459 36 125818 0
+SELECT * FROM ACCOUNT ORDER BY ACCOUNT_ID;
+ACCOUNT_ID OWNER BALANCE ACCOUNT_TYPE
+0 0 9863546 0
+1 3001 12885 1
+2 3002 11012 2
+3 3003 32789 3
+4 3004 10992 4
+5 3005 2247 1
+6 3006 3170 1
+7 3007 60321 2
+8 3008 30508 3
+9 3009 62530 4
+SELECT COUNT(*) FROM TRANSACTION;
+COUNT(*)
+3444
+SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID;
+SYSTEM_VALUES_ID VALUE
+0 2039
+1 3
+SELECT * FROM cluster.apply_status WHERE server_id=0;
+server_id epoch
+0 151
+TRUNCATE GL;
+TRUNCATE ACCOUNT;
+TRUNCATE TRANSACTION;
+TRUNCATE SYSTEM_VALUES;
+TRUNCATE ACCOUNT_TYPE;
+SELECT * FROM GL ORDER BY TIME,ACCOUNT_TYPE;
+TIME ACCOUNT_TYPE BALANCE DEPOSIT_COUNT DEPOSIT_SUM WITHDRAWAL_COUNT WITHDRAWAL_SUM PURGED
+0 0 10000000 0 0 0 0 1
+0 1 30000 0 0 0 0 1
+0 2 20000 0 0 0 0 1
+0 3 20000 0 0 0 0 1
+0 4 20000 0 0 0 0 1
+1 0 10000000 0 0 0 0 1
+1 1 30000 0 0 0 0 1
+1 2 20000 0 0 0 0 1
+1 3 20000 0 0 0 0 1
+1 4 20000 0 0 0 0 1
+2 0 10000000 0 0 0 0 1
+2 1 30000 0 0 0 0 1
+2 2 20000 0 0 0 0 1
+2 3 20000 0 0 0 0 1
+2 4 20000 0 0 0 0 1
+3 0 9963591 14 59111 19 95520 0
+3 1 44264 49 255559 53 241295 0
+3 2 25515 39 177806 36 172291 0
+3 3 16779 26 129200 29 132421 0
+3 4 39851 43 182771 34 162920 0
+4 0 9733661 141 632616 162 862546 0
+4 1 63853 426 2005337 415 1985748 0
+4 2 140473 314 1548632 297 1433674 0
+4 3 13481 310 1528043 324 1531341 0
+4 4 138532 316 1540206 309 1441525 0
+SELECT * FROM ACCOUNT ORDER BY ACCOUNT_ID;
+ACCOUNT_ID OWNER BALANCE ACCOUNT_TYPE
+0 0 9679579 0
+1 3001 18130 1
+2 3002 12318 2
+3 3003 3049 3
+4 3004 39517 4
+5 3005 37051 1
+6 3006 144497 1
+7 3007 130670 2
+8 3008 13747 3
+9 3009 11442 4
+SELECT COUNT(*) FROM TRANSACTION;
+COUNT(*)
+4056
+SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID;
+SYSTEM_VALUES_ID VALUE
+0 2297
+1 5
+SELECT * FROM cluster.apply_status WHERE server_id=0;
+server_id epoch
+0 331
+DROP DATABASE BANK;
diff --git a/mysql-test/r/ndb_restore_partition.result b/mysql-test/r/ndb_restore_partition.result
new file mode 100644
index 00000000000..7dc4057e615
--- /dev/null
+++ b/mysql-test/r/ndb_restore_partition.result
@@ -0,0 +1,469 @@
+use test;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+CREATE TABLE `t1_c` (
+`capgoaledatta` smallint(5) unsigned NOT NULL auto_increment,
+`goaledatta` char(2) NOT NULL default '',
+`maturegarbagefa` varchar(32) NOT NULL default '',
+PRIMARY KEY (`capgoaledatta`,`goaledatta`,`maturegarbagefa`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t1_c` VALUES (2,'3','q3plus.qt'),(4,'4','q3plus.qt'),(1,'3','q3.net'),(3,'4','q3.net'),(3,'20','threetrees.qt');
+CREATE TABLE `t2_c` (
+`capgotod` smallint(5) unsigned NOT NULL auto_increment,
+`gotod` smallint(5) unsigned NOT NULL default '0',
+`goaledatta` char(2) default NULL,
+`maturegarbagefa` varchar(32) default NULL,
+`descrpooppo` varchar(64) default NULL,
+`svcutonsa` varchar(64) NOT NULL default '',
+PRIMARY KEY (`capgotod`),
+KEY `i_quadaddsvr` (`gotod`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t2_c` VALUES (5,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST');
+CREATE TABLE `t3_c` (
+`CapGoaledatta` smallint(5) unsigned NOT NULL default '0',
+`capgotod` smallint(5) unsigned NOT NULL default '0',
+PRIMARY KEY (`capgotod`,`CapGoaledatta`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t3_c` VALUES (5,3),(2,4),(5,4),(1,3);
+CREATE TABLE `t4_c` (
+`capfa` bigint(20) unsigned NOT NULL auto_increment,
+`realm` varchar(32) NOT NULL default '',
+`authpwchap` varchar(32) default NULL,
+`fa` varchar(32) NOT NULL default '',
+`payyingatta` tinyint(4) NOT NULL default '0',
+`status` char(1) default NULL,
+PRIMARY KEY (`fa`,`realm`),
+KEY `capfa` (`capfa`),
+KEY `i_quadentity` (`fa`,`realm`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t4_c` VALUES (18,'john.smith','q3.net','dessjohn.smith',0,NULL),(21,'quad_katt_with_brandtad','q3.net','acne',0,NULL),(22,'quad_katt_carattoaa','q3.net','acne',0,NULL),(26,'436462612809','sqasdt.q3.net','N/A',0,'6'),(19,'john','smith.qt','dessjohn',0,NULL),(33,'436643196120','sqasdt.q3.net','N/A',1,'6'),(28,'436642900019','sqasdt.q3.net','N/A',0,'6'),(30,'436462900209','sqasdt.q3.net','N/A',0,'6'),(16,'436640006666','sqasdt.q3.net','',0,NULL),(19,'dette','el-redun.com','dessdette',0,NULL),(12,'quad_kattPP','q3.net','acne',2,NULL),(14,'436640008888','sqasdt.q3.net','',0,NULL),(29,'463624900028','sqasdt.q3.net','N/A',0,'6'),(15,'436640099099','sqasdt.q3.net','',0,NULL),(13,'pap','q3plus.qt','acne',1,NULL),(19,'436642612091','sqasdt.q3.net','N/A',0,'6'),(12,'quad_katt','q3.net','acne',0,NULL),(11,'quad_kattVK','q3.net','acne',1,NULL),(32,'463641969502','sqasdt.q3.net','N/A',1,'6'),(20,'joe','q3.net','joedesswd',0,NULL),(29,'436642900034','sqasdt.q3.net','N/A',0,'6'),(25,'contind','armerde.qt','acne',1,NULL);
+CREATE TABLE `t5_c` (
+`capfa` bigint(20) unsigned NOT NULL default '0',
+`gotod` smallint(5) unsigned NOT NULL default '0',
+`orderutonsa` varchar(64) NOT NULL default '',
+PRIMARY KEY (`capfa`,`gotod`,`orderutonsa`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t5_c` VALUES (21,2,''),(21,1,''),(22,4,'');
+CREATE TABLE `t6_c` (
+`capfa_parent` bigint(20) unsigned NOT NULL default '0',
+`capfa_child` bigint(20) unsigned NOT NULL default '0',
+`relatta` smallint(5) unsigned NOT NULL default '0',
+PRIMARY KEY (`capfa_child`,`capfa_parent`,`relatta`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t6_c` VALUES (15,16,0),(19,20,0),(18326932092909551615,30,0),(26,29,0),(18326932092909551615,29,0),(19,18,0),(26,28,0),(12,14,0);
+CREATE TABLE `t7_c` (
+`dardpo` char(15) NOT NULL default '',
+`dardtestard` tinyint(3) unsigned NOT NULL default '0',
+`FastFA` char(5) NOT NULL default '',
+`FastCode` char(6) NOT NULL default '',
+`Fastca` char(1) NOT NULL default '',
+`Fastmag` char(1) NOT NULL default '',
+`Beareratta` char(2) NOT NULL default '',
+PRIMARY KEY (`dardpo`,`dardtestard`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t7_c` VALUES ('2.6.2.4',24,'CECHP','54545','0','0','5'),('2.2.5.4',26,'CANFA','33223','1','1','4'),('4.3.2.4',28,'ITALD','54222','1','0','5'),('129..0.0.eins',28,'G','99999','1','1','5'),('1.1.1.1',24,'AUTPT','32323','0','1','3');
+CREATE TABLE `t8_c` (
+`kattjame` varchar(32) NOT NULL default '',
+`realm` varchar(32) NOT NULL default '',
+`realm_entered` varchar(32) NOT NULL default '',
+`maturegarbagefa` varchar(32) NOT NULL default '',
+`hunderaaarbagefa_parent` varchar(32) NOT NULL default '',
+`kattjame_entered` varchar(32) NOT NULL default '',
+`hunderaaarbagefa` varchar(32) NOT NULL default '',
+`gest` varchar(16) default NULL,
+`hassetino` varchar(16) NOT NULL default '',
+`aaaproxysessfa` varchar(255) default NULL,
+`autologonallowed` char(1) default NULL,
+`squardporoot` varchar(15) NOT NULL default '',
+`naspo` varchar(15) default NULL,
+`beareratta` char(2) default NULL,
+`fastCode` varchar(6) default NULL,
+`fastFA` varchar(5) default NULL,
+`fastca` char(1) default NULL,
+`fastmag` char(1) default NULL,
+`lastupdate` datetime default NULL,
+`hassetistart` datetime NOT NULL default '0000-00-00 00:00:00',
+`accthassetitime` int(10) unsigned default NULL,
+`acctoutputoctets` bigint(20) unsigned default NULL,
+`acctinputoctets` bigint(20) unsigned default NULL,
+PRIMARY KEY (`kattjame`,`hunderaaarbagefa`,`hassetistart`,`hassetino`),
+KEY `squardporoot` (`squardporoot`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t8_c` VALUES ('4tt45345235','pap','q3plus.qt','q3plus.qt','q3.net','436643196120','436643196929','8956234534568968','5524595699','uxasmt21.net.acne.qt/481889229462692422','','1.1.1.1','2.2.4.6','4','86989','34','x','x','2012-03-12 12:55:34','2012-12-05 11:20:04',3223433,3369,9565),('4545435545','john','q3.net','q3.net','acne.li','436643196120','436643196929','45345234568968','995696699','uxasmt21.net.acne.qt/481889229462692423','','1.1.1.1','2.2.9.8','2','86989','34','x','x','2012-03-12 11:35:03','2012-12-05 08:50:04',8821923,169,3565),('versteckter_q3net_katt','joe','q3.net','elredun.com','q3.net','436643196120','436643196939','91341234568968','695595699','uxasmt21.net.acne.qt/481889229462692421','','1.1.1.1','2.5.2.5','3','86989','34','x','x','2012-03-12 18:35:04','2012-12-05 12:35:04',1923123,9569,6565);
+CREATE TABLE `t9_c` (
+`kattjame` varchar(32) NOT NULL default '',
+`kattjame_entered` varchar(32) NOT NULL default '',
+`realm` varchar(32) NOT NULL default '',
+`realm_entered` varchar(32) NOT NULL default '',
+`maturegarbagefa` varchar(32) NOT NULL default '',
+`hunderaaarbagefa` varchar(32) NOT NULL default '',
+`hunderaaarbagefa_parent` varchar(32) NOT NULL default '',
+`gest` varchar(16) default NULL,
+`hassetino` varchar(16) NOT NULL default '',
+`squardporoot` varchar(15) NOT NULL default '',
+`naspo` varchar(15) default NULL,
+`beareratta` char(2) default NULL,
+`fastCode` varchar(6) default NULL,
+`fastFA` varchar(5) default NULL,
+`fastca` char(1) default NULL,
+`fastmag` char(1) default NULL,
+`lastupdate` datetime default NULL,
+`hassetistart` datetime NOT NULL default '0000-00-00 00:00:00',
+`accthassetitime` int(10) unsigned default NULL,
+`actcoutpuocttets` bigint(20) unsigned default NULL,
+`actinputocctets` bigint(20) unsigned default NULL,
+`terminateraste` tinyint(3) unsigned default NULL,
+PRIMARY KEY (`kattjame`,`hunderaaarbagefa`,`hassetistart`,`hassetino`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t9_c` VALUES ('3g4jh8gar2t','joe','q3.net','elredun.com','q3.net','436643316120','436643316939','91341234568968','695595699','1.1.1.1','2.2.6.2','3','86989','34','x','x','2012-03-12 18:35:04','2012-12-05 12:35:04',3123123,9569,6565,1),('4tt45345235','pap','q3plus.qt','q3plus.qt','q3.net','436643316120','436643316939','8956234534568968','5254595969','1.1.1.1','8.6.2.2','4','86989','34','x','x','2012-03-12 12:55:34','2012-12-05 11:20:04',3223433,3369,9565,2),('4545435545','john','q3.net','q3.net','acne.li','436643316120','436643316939','45345234568968','995696699','1.1.1.1','2.9.9.2','2','86998','34','x','x','2012-03-12 11:35:03','2012-12-05 08:50:04',8823123,169,3565,3);
+create table t1 engine=myisam as select * from t1_c;
+create table t2 engine=myisam as select * from t2_c;
+create table t3 engine=myisam as select * from t3_c;
+create table t4 engine=myisam as select * from t4_c;
+create table t5 engine=myisam as select * from t5_c;
+create table t6 engine=myisam as select * from t6_c;
+create table t7 engine=myisam as select * from t7_c;
+create table t8 engine=myisam as select * from t8_c;
+create table t9 engine=myisam as select * from t9_c;
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM test.backup_info;
+LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM test.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+DROP TABLE test.backup_info;
+drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+select count(*) from t1;
+count(*)
+5
+select count(*) from t1_c;
+count(*)
+5
+select count(*)
+from (select * from t1 union
+select * from t1_c) a;
+count(*)
+5
+select count(*) from t2;
+count(*)
+6
+select count(*) from t2_c;
+count(*)
+6
+select count(*)
+from (select * from t2 union
+select * from t2_c) a;
+count(*)
+6
+select count(*) from t3;
+count(*)
+4
+select count(*) from t3_c;
+count(*)
+4
+select count(*)
+from (select * from t3 union
+select * from t3_c) a;
+count(*)
+4
+select count(*) from t4;
+count(*)
+22
+select count(*) from t4_c;
+count(*)
+22
+select count(*)
+from (select * from t4 union
+select * from t4_c) a;
+count(*)
+22
+select count(*) from t5;
+count(*)
+3
+select count(*) from t5_c;
+count(*)
+3
+select count(*)
+from (select * from t5 union
+select * from t5_c) a;
+count(*)
+3
+select count(*) from t6;
+count(*)
+8
+select count(*) from t6_c;
+count(*)
+8
+select count(*)
+from (select * from t6 union
+select * from t6_c) a;
+count(*)
+8
+select count(*) from t7;
+count(*)
+5
+select count(*) from t7_c;
+count(*)
+5
+select count(*)
+from (select * from t7 union
+select * from t7_c) a;
+count(*)
+5
+select count(*) from t8;
+count(*)
+3
+select count(*) from t8_c;
+count(*)
+3
+select count(*)
+from (select * from t8 union
+select * from t8_c) a;
+count(*)
+3
+select count(*) from t9;
+count(*)
+3
+select count(*) from t9_c;
+count(*)
+3
+select count(*)
+from (select * from t9 union
+select * from t9_c) a;
+count(*)
+3
+ALTER TABLE t1_c
+PARTITION BY RANGE (`capgoaledatta`)
+(PARTITION p0 VALUES LESS THAN MAXVALUE);
+ALTER TABLE t2_c
+PARTITION BY LIST(`capgotod`)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6));
+ALTER TABLE t3_c
+PARTITION BY HASH (`CapGoaledatta`);
+ALTER TABLE t5_c
+PARTITION BY HASH (`capfa`)
+PARTITIONS 4;
+ALTER TABLE t6_c
+PARTITION BY LINEAR HASH (`relatta`)
+PARTITIONS 4;
+ALTER TABLE t7_c
+PARTITION BY LINEAR KEY (`dardtestard`);
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM test.backup_info;
+LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM test.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+DROP TABLE test.backup_info;
+drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+select count(*) from t1;
+count(*)
+5
+select count(*) from t1_c;
+count(*)
+5
+select count(*)
+from (select * from t1 union
+select * from t1_c) a;
+count(*)
+5
+select count(*) from t2;
+count(*)
+6
+select count(*) from t2_c;
+count(*)
+6
+select count(*)
+from (select * from t2 union
+select * from t2_c) a;
+count(*)
+6
+select count(*) from t3;
+count(*)
+4
+select count(*) from t3_c;
+count(*)
+4
+select count(*)
+from (select * from t3 union
+select * from t3_c) a;
+count(*)
+4
+select count(*) from t4;
+count(*)
+22
+select count(*) from t4_c;
+count(*)
+22
+select count(*)
+from (select * from t4 union
+select * from t4_c) a;
+count(*)
+22
+select count(*) from t5;
+count(*)
+3
+select count(*) from t5_c;
+count(*)
+3
+select count(*)
+from (select * from t5 union
+select * from t5_c) a;
+count(*)
+3
+select count(*) from t6;
+count(*)
+8
+select count(*) from t6_c;
+count(*)
+8
+select count(*)
+from (select * from t6 union
+select * from t6_c) a;
+count(*)
+8
+select count(*) from t7;
+count(*)
+5
+select count(*) from t7_c;
+count(*)
+5
+select count(*)
+from (select * from t7 union
+select * from t7_c) a;
+count(*)
+5
+select count(*) from t8;
+count(*)
+3
+select count(*) from t8_c;
+count(*)
+3
+select count(*)
+from (select * from t8 union
+select * from t8_c) a;
+count(*)
+3
+select count(*) from t9;
+count(*)
+3
+select count(*) from t9_c;
+count(*)
+3
+select count(*)
+from (select * from t9 union
+select * from t9_c) a;
+count(*)
+3
+drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+select count(*) from t1;
+count(*)
+5
+select count(*) from t1_c;
+count(*)
+5
+select count(*)
+from (select * from t1 union
+select * from t1_c) a;
+count(*)
+5
+select count(*) from t2;
+count(*)
+6
+select count(*) from t2_c;
+count(*)
+6
+select count(*)
+from (select * from t2 union
+select * from t2_c) a;
+count(*)
+6
+select count(*) from t3;
+count(*)
+4
+select count(*) from t3_c;
+count(*)
+4
+select count(*)
+from (select * from t3 union
+select * from t3_c) a;
+count(*)
+4
+select count(*) from t4;
+count(*)
+22
+select count(*) from t4_c;
+count(*)
+22
+select count(*)
+from (select * from t4 union
+select * from t4_c) a;
+count(*)
+22
+select count(*) from t5;
+count(*)
+3
+select count(*) from t5_c;
+count(*)
+3
+select count(*)
+from (select * from t5 union
+select * from t5_c) a;
+count(*)
+3
+select count(*) from t6;
+count(*)
+8
+select count(*) from t6_c;
+count(*)
+8
+select count(*)
+from (select * from t6 union
+select * from t6_c) a;
+count(*)
+8
+select count(*) from t7;
+count(*)
+5
+select count(*) from t7_c;
+count(*)
+5
+select count(*)
+from (select * from t7 union
+select * from t7_c) a;
+count(*)
+5
+select count(*) from t8;
+count(*)
+3
+select count(*) from t8_c;
+count(*)
+3
+select count(*)
+from (select * from t8 union
+select * from t8_c) a;
+count(*)
+3
+select count(*) from t9;
+count(*)
+3
+select count(*) from t9_c;
+count(*)
+3
+select count(*)
+from (select * from t9 union
+select * from t9_c) a;
+count(*)
+3
+drop table t1_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM test.backup_info;
+LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM test.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+DROP TABLE test.backup_info;
+Create table test/def/t2_c failed: Translate frm error
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+drop table if exists t2_c;
+520093696,<the_backup_id>
diff --git a/mysql-test/r/ndb_subquery.result b/mysql-test/r/ndb_subquery.result
index b19571b05c1..312711ab4b7 100644
--- a/mysql-test/r/ndb_subquery.result
+++ b/mysql-test/r/ndb_subquery.result
@@ -8,32 +8,32 @@ insert into t1 values (1,1,1),(2,2,2),(3,3,3);
insert into t2 values (1,1,1),(2,2,2),(3,3,3), (4,4,4), (5,5,5);
explain select * from t2 where p NOT IN (select p from t1);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where
-2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index
+1 PRIMARY t2 ALL NULL NULL NULL NULL # Using where
+2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func # Using index
select * from t2 where p NOT IN (select p from t1) order by p;
p u o
4 4 4
5 5 5
explain select * from t2 where p NOT IN (select u from t1);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where
-2 DEPENDENT SUBQUERY t1 unique_subquery u u 4 func 1 Using index
+1 PRIMARY t2 ALL NULL NULL NULL NULL # Using where
+2 DEPENDENT SUBQUERY t1 unique_subquery u u 4 func # Using index
select * from t2 where p NOT IN (select u from t1) order by p;
p u o
4 4 4
5 5 5
explain select * from t2 where p NOT IN (select o from t1);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where
-2 DEPENDENT SUBQUERY t1 index_subquery o o 4 func 1 Using index
+1 PRIMARY t2 ALL NULL NULL NULL NULL # Using where
+2 DEPENDENT SUBQUERY t1 index_subquery o o 4 func # Using index
select * from t2 where p NOT IN (select o from t1) order by p;
p u o
4 4 4
5 5 5
explain select * from t2 where p NOT IN (select p+0 from t1);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where
-2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where
+1 PRIMARY t2 ALL NULL NULL NULL NULL # Using where
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL # Using where
select * from t2 where p NOT IN (select p+0 from t1) order by p;
p u o
4 4 4
diff --git a/mysql-test/r/ndb_temporary.result b/mysql-test/r/ndb_temporary.result
new file mode 100644
index 00000000000..61fc1561e4f
--- /dev/null
+++ b/mysql-test/r/ndb_temporary.result
@@ -0,0 +1,21 @@
+DROP TABLE IF EXISTS t1;
+create temporary table t1 (a int key) engine=ndb;
+ERROR HY000: Table storage engine 'ndbcluster' does not support the create option 'TEMPORARY'
+create temporary table t1 (a int key) engine=myisam;
+alter table t1 engine=ndb;
+ERROR HY000: Table storage engine 'ndbcluster' does not support the create option 'TEMPORARY'
+drop table t1;
+SET SESSION storage_engine=NDBCLUSTER;
+create table t1 (a int key);
+select engine from information_schema.tables where table_name = 't1';
+engine
+NDBCLUSTER
+drop table t1;
+create temporary table t1 (a int key);
+show create table t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
diff --git a/mysql-test/r/ndb_update.result b/mysql-test/r/ndb_update.result
index 164d1bd700c..8166a554084 100644
--- a/mysql-test/r/ndb_update.result
+++ b/mysql-test/r/ndb_update.result
@@ -18,7 +18,7 @@ pk1 b c
2 2 2
4 1 1
UPDATE t1 set pk1 = 1, c = 2 where pk1 = 4;
-ERROR 23000: Duplicate entry '' for key 0
+ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
select * from t1 order by pk1;
pk1 b c
0 0 0
diff --git a/mysql-test/r/ndb_view.result b/mysql-test/r/ndb_view.result
new file mode 100644
index 00000000000..b7d1b6860c8
--- /dev/null
+++ b/mysql-test/r/ndb_view.result
@@ -0,0 +1,24 @@
+DROP TABLE IF EXISTS t1,t2,t3;
+DROP VIEW IF EXISTS v1,v2,v3;
+create table t1 (a int, b int, c int, d int) engine=ndb;
+insert into t1 values (1,2,3,4),(5,6,7,8);
+create view v1 as select t1.c as a, t1.a as b, t1.d as c, t1.a+t1.b+t1.c as d from t1;
+select * from v1 order by a,b,c;
+a b c d
+3 1 4 6
+7 5 8 18
+update v1 set a=a+100 where b=1;
+select * from v1 order by a,b,c;
+a b c d
+7 5 8 18
+103 1 4 106
+drop view v1;
+create view v1 as select t1.c as a from t1;
+insert into v1 values (200);
+select * from t1 order by a,b,c,d;
+a b c d
+NULL NULL 200 NULL
+1 2 103 4
+5 6 7 8
+drop view v1;
+drop table t1;
diff --git a/mysql-test/r/ndbapi.result b/mysql-test/r/ndbapi.result
new file mode 100644
index 00000000000..8e680391a81
--- /dev/null
+++ b/mysql-test/r/ndbapi.result
@@ -0,0 +1,22 @@
+DROP TABLE IF EXISTS t0;
+drop database if exists mysqltest;
+Running ndbapi_simple
+Running ndbapi_simple_index
+Running ndbapi_scan
+Running ndbapi_retries
+Running ndbapi_async
+Running ndbapi_async1
+use TEST_DB;
+create table t0(c0 int, c1 int, c2 char(4), c3 char(4), c4 text,
+primary key(c0, c2)) engine ndb charset latin1;
+insert into t0 values (1, 2, 'a', 'b', null);
+insert into t0 values (3, 4, 'c', 'd', null);
+update t0 set c3 = 'e' where c0 = 1 and c2 = 'a';
+update t0 set c3 = 'f';
+update t0 set c3 = 'F';
+update t0 set c2 = 'g' where c0 = 1;
+update t0 set c2 = 'G' where c0 = 1;
+update t0 set c0 = 5, c2 = 'H' where c0 = 3;
+delete from t0;
+drop table t0;
+Running mgmapi_logevent
diff --git a/mysql-test/r/negation_elimination.result b/mysql-test/r/negation_elimination.result
index a7dbe0d9052..ccb8e87b714 100644
--- a/mysql-test/r/negation_elimination.result
+++ b/mysql-test/r/negation_elimination.result
@@ -384,8 +384,8 @@ NULL NULL
2 1
3 1
explain extended select a, not(not(a)), not(a <= 2 and not(a)), not(a not like "1"), not (a not in (1,2)), not(a != 2) from t1 where not(not(a)) having not(not(a));
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL a 5 NULL 5 Using where; Using index
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 index NULL a 5 NULL 5 100.00 Using where; Using index
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,(`test`.`t1`.`a` <> 0) AS `not(not(a))`,((`test`.`t1`.`a` > 2) or `test`.`t1`.`a`) AS `not(a <= 2 and not(a))`,(`test`.`t1`.`a` like _latin1'1') AS `not(a not like "1")`,(`test`.`t1`.`a` in (1,2)) AS `not (a not in (1,2))`,(`test`.`t1`.`a` = 2) AS `not(a != 2)` from `test`.`t1` where `test`.`t1`.`a` having `test`.`t1`.`a`
drop table t1;
diff --git a/mysql-test/r/not_embedded_server.result b/mysql-test/r/not_embedded_server.result
index e471b5a3afa..63351d187b6 100644
--- a/mysql-test/r/not_embedded_server.result
+++ b/mysql-test/r/not_embedded_server.result
@@ -1,5 +1,5 @@
-prepare stmt1 from ' show full processlist ';
+prepare stmt1 from ' SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!=\'Daemon\' ';
execute stmt1;
-Id User Host db Command Time State Info
-number root localhost test Query time NULL show full processlist
+ID USER HOST DB COMMAND TIME STATE INFO
+number root localhost test Query time preparing SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!='Daemon'
deallocate prepare stmt1;
diff --git a/mysql-test/r/have_bdb.require b/mysql-test/r/not_ndb.require
index 969cd6863db..36fcf7958d4 100644
--- a/mysql-test/r/have_bdb.require
+++ b/mysql-test/r/not_ndb.require
@@ -1,2 +1,2 @@
Variable_name Value
-have_bdb YES
+have_ndbcluster NO
diff --git a/mysql-test/r/not_ndb_default.require b/mysql-test/r/not_ndb_default.require
new file mode 100644
index 00000000000..09aae1ed1d0
--- /dev/null
+++ b/mysql-test/r/not_ndb_default.require
@@ -0,0 +1,2 @@
+TRUE
+1
diff --git a/mysql-test/r/not_partition.require b/mysql-test/r/not_partition.require
new file mode 100644
index 00000000000..808242277cb
--- /dev/null
+++ b/mysql-test/r/not_partition.require
@@ -0,0 +1,2 @@
+Variable_name Value
+have_partitioning NO
diff --git a/mysql-test/r/not_partition.result b/mysql-test/r/not_partition.result
new file mode 100644
index 00000000000..9e205a09d78
--- /dev/null
+++ b/mysql-test/r/not_partition.result
@@ -0,0 +1,48 @@
+CREATE TABLE t1 (
+firstname VARCHAR(25) NOT NULL,
+lastname VARCHAR(25) NOT NULL,
+username VARCHAR(16) NOT NULL,
+email VARCHAR(35),
+joined DATE NOT NULL
+)
+PARTITION BY KEY(joined)
+PARTITIONS 6;
+ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-partition' to have it working
+ALTER TABLE t1 PARTITION BY KEY(joined) PARTITIONS 2;
+ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-partition' to have it working
+drop table t1;
+ERROR 42S02: Unknown table 't1'
+CREATE TABLE t1 (
+firstname VARCHAR(25) NOT NULL,
+lastname VARCHAR(25) NOT NULL,
+username VARCHAR(16) NOT NULL,
+email VARCHAR(35),
+joined DATE NOT NULL
+)
+PARTITION BY RANGE( YEAR(joined) ) (
+PARTITION p0 VALUES LESS THAN (1960),
+PARTITION p1 VALUES LESS THAN (1970),
+PARTITION p2 VALUES LESS THAN (1980),
+PARTITION p3 VALUES LESS THAN (1990),
+PARTITION p4 VALUES LESS THAN MAXVALUE
+);
+ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-partition' to have it working
+drop table t1;
+ERROR 42S02: Unknown table 't1'
+CREATE TABLE t1 (id INT, purchased DATE)
+PARTITION BY RANGE( YEAR(purchased) )
+SUBPARTITION BY HASH( TO_DAYS(purchased) )
+SUBPARTITIONS 2 (
+PARTITION p0 VALUES LESS THAN (1990),
+PARTITION p1 VALUES LESS THAN (2000),
+PARTITION p2 VALUES LESS THAN MAXVALUE
+);
+ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-partition' to have it working
+drop table t1;
+ERROR 42S02: Unknown table 't1'
+create table t1 (a varchar(10) charset latin1 collate latin1_bin);
+insert into t1 values (''),(' '),('a'),('a '),('a ');
+explain partitions select * from t1 where a='a ' OR a='a';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where
+drop table t1;
diff --git a/mysql-test/r/not_row_based.require b/mysql-test/r/not_row_based.require
new file mode 100644
index 00000000000..e30e73320fb
--- /dev/null
+++ b/mysql-test/r/not_row_based.require
@@ -0,0 +1,2 @@
+Variable_name Value
+have_row_based_replication NO
diff --git a/mysql-test/r/not_valgrind.require b/mysql-test/r/not_valgrind.require
new file mode 100644
index 00000000000..5d779c6bfcb
--- /dev/null
+++ b/mysql-test/r/not_valgrind.require
@@ -0,0 +1,2 @@
+using_valgrind
+0
diff --git a/mysql-test/r/not_windows.require b/mysql-test/r/not_windows.require
new file mode 100644
index 00000000000..09aae1ed1d0
--- /dev/null
+++ b/mysql-test/r/not_windows.require
@@ -0,0 +1,2 @@
+TRUE
+1
diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result
index daedfa50b80..bf9d9764db2 100644
--- a/mysql-test/r/null.result
+++ b/mysql-test/r/null.result
@@ -3,8 +3,8 @@ select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull
NULL NULL isnull(null) isnull(1/0) isnull(1/0 = null) ifnull(null,1) ifnull(null,"TRUE") ifnull("TRUE","ERROR") 1/0 is null 1 is not null
NULL NULL 1 1 1 1 TRUE TRUE 1 1
explain extended select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select NULL AS `NULL`,NULL AS `NULL`,isnull(NULL) AS `isnull(null)`,isnull((1 / 0)) AS `isnull(1/0)`,isnull(((1 / 0) = NULL)) AS `isnull(1/0 = null)`,ifnull(NULL,1) AS `ifnull(null,1)`,ifnull(NULL,_latin1'TRUE') AS `ifnull(null,"TRUE")`,ifnull(_latin1'TRUE',_latin1'ERROR') AS `ifnull("TRUE","ERROR")`,isnull((1 / 0)) AS `1/0 is null`,(1 is not null) AS `1 is not null`
select 1 | NULL,1 & NULL,1+NULL,1-NULL;
@@ -29,8 +29,8 @@ select 2 between null and 1,2 between 3 AND NULL,NULL between 1 and 2,2 between
2 between null and 1 2 between 3 AND NULL NULL between 1 and 2 2 between NULL and 3 2 between 1 AND null
0 0 NULL NULL NULL
explain extended select 2 between null and 1,2 between 3 AND NULL,NULL between 1 and 2,2 between NULL and 3, 2 between 1 AND null;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select (2 between NULL and 1) AS `2 between null and 1`,(2 between 3 and NULL) AS `2 between 3 AND NULL`,(NULL between 1 and 2) AS `NULL between 1 and 2`,(2 between NULL and 3) AS `2 between NULL and 3`,(2 between 1 and NULL) AS `2 between 1 AND null`
SELECT NULL AND NULL, 1 AND NULL, NULL AND 1, NULL OR NULL, 0 OR NULL, NULL OR 0;
@@ -46,8 +46,8 @@ select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."
inet_ntoa(null) inet_aton(null) inet_aton("122.256") inet_aton("122.226.") inet_aton("")
NULL NULL NULL NULL NULL
explain extended select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton("");
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select inet_ntoa(NULL) AS `inet_ntoa(null)`,inet_aton(NULL) AS `inet_aton(null)`,inet_aton(_latin1'122.256') AS `inet_aton("122.256")`,inet_aton(_latin1'122.226.') AS `inet_aton("122.226.")`,inet_aton(_latin1'') AS `inet_aton("")`
create table t1 (x int);
@@ -97,39 +97,39 @@ Warnings:
Warning 1265 Data truncated for column 'd' at row 1
UPDATE t1 SET d=NULL;
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'd' at row 1
+Warning 1048 Column 'd' cannot be null
INSERT INTO t1 (a) values (null);
ERROR 23000: Column 'a' cannot be null
INSERT INTO t1 (a) values (1/null);
ERROR 23000: Column 'a' cannot be null
INSERT INTO t1 (a) values (null),(null);
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 2
+Warning 1048 Column 'a' cannot be null
+Warning 1048 Column 'a' cannot be null
INSERT INTO t1 (b) values (null);
ERROR 23000: Column 'b' cannot be null
INSERT INTO t1 (b) values (1/null);
ERROR 23000: Column 'b' cannot be null
INSERT INTO t1 (b) values (null),(null);
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'b' at row 1
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'b' at row 2
+Warning 1048 Column 'b' cannot be null
+Warning 1048 Column 'b' cannot be null
INSERT INTO t1 (c) values (null);
ERROR 23000: Column 'c' cannot be null
INSERT INTO t1 (c) values (1/null);
ERROR 23000: Column 'c' cannot be null
INSERT INTO t1 (c) values (null),(null);
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'c' at row 1
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'c' at row 2
+Warning 1048 Column 'c' cannot be null
+Warning 1048 Column 'c' cannot be null
INSERT INTO t1 (d) values (null);
ERROR 23000: Column 'd' cannot be null
INSERT INTO t1 (d) values (1/null);
ERROR 23000: Column 'd' cannot be null
INSERT INTO t1 (d) values (null),(null);
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'd' at row 1
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'd' at row 2
+Warning 1048 Column 'd' cannot be null
+Warning 1048 Column 'd' cannot be null
select * from t1;
a b c d
0 0000-00-00 00:00:00 0
@@ -227,44 +227,44 @@ rpad(null, 10, 'str') as c38;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c00` binary(0) default NULL,
- `c01` varchar(6) character set latin2 default NULL,
- `c02` varchar(6) character set latin2 default NULL,
- `c03` varchar(6) character set latin2 NOT NULL default '',
- `c04` varchar(6) character set latin2 default NULL,
- `c05` varchar(6) character set latin2 default NULL,
- `c06` varchar(6) character set latin2 default NULL,
- `c07` varchar(6) character set latin2 default NULL,
- `c08` varchar(6) character set latin2 default NULL,
- `c09` varchar(6) character set latin2 default NULL,
- `c10` varchar(6) character set latin2 default NULL,
- `c11` varchar(6) character set latin2 default NULL,
- `c12` varchar(6) character set latin2 default NULL,
- `c13` varchar(6) character set latin2 default NULL,
- `c14` char(0) character set latin2 default NULL,
- `c15` char(0) character set latin2 default NULL,
- `c16` varchar(6) character set latin2 default NULL,
- `c17` varchar(6) character set latin2 default NULL,
- `c18` char(0) character set latin2 default NULL,
- `c19` varchar(6) character set latin2 default NULL,
- `c20` varchar(6) character set latin2 default NULL,
- `c21` varchar(6) character set latin2 default NULL,
- `c22` varchar(6) character set latin2 default NULL,
- `c23` varchar(9) character set latin2 default NULL,
- `c24` varchar(9) character set latin2 default NULL,
- `c25` varchar(12) character set latin2 default NULL,
- `c26` varchar(7) character set latin2 default NULL,
- `c27` varchar(7) character set latin2 default NULL,
- `c29` varchar(381) character set latin2 default NULL,
- `c30` varchar(317) character set latin2 default NULL,
- `c31` varchar(192) character set latin2 default NULL,
- `c32` char(0) character set latin2 default NULL,
- `c33` varchar(3) character set latin2 default NULL,
- `c34` varchar(3) character set latin2 default NULL,
- `c35` varchar(3) character set latin2 default NULL,
- `c36` varchar(3) character set latin2 default NULL,
- `c37` varchar(10) character set latin2 default NULL,
- `c38` varchar(10) character set latin2 default NULL
+ `c00` binary(0) DEFAULT NULL,
+ `c01` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
+ `c02` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
+ `c03` varchar(6) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `c04` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
+ `c05` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
+ `c06` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
+ `c07` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
+ `c08` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
+ `c09` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
+ `c10` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
+ `c11` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
+ `c12` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
+ `c13` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
+ `c14` char(0) CHARACTER SET latin2 DEFAULT NULL,
+ `c15` char(0) CHARACTER SET latin2 DEFAULT NULL,
+ `c16` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
+ `c17` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
+ `c18` char(0) CHARACTER SET latin2 DEFAULT NULL,
+ `c19` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
+ `c20` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
+ `c21` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
+ `c22` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
+ `c23` varchar(9) CHARACTER SET latin2 DEFAULT NULL,
+ `c24` varchar(9) CHARACTER SET latin2 DEFAULT NULL,
+ `c25` varchar(12) CHARACTER SET latin2 DEFAULT NULL,
+ `c26` varchar(7) CHARACTER SET latin2 DEFAULT NULL,
+ `c27` varchar(7) CHARACTER SET latin2 DEFAULT NULL,
+ `c29` varchar(381) CHARACTER SET latin2 DEFAULT NULL,
+ `c30` varchar(317) CHARACTER SET latin2 DEFAULT NULL,
+ `c31` varchar(192) CHARACTER SET latin2 DEFAULT NULL,
+ `c32` char(0) CHARACTER SET latin2 DEFAULT NULL,
+ `c33` varchar(3) CHARACTER SET latin2 DEFAULT NULL,
+ `c34` varchar(3) CHARACTER SET latin2 DEFAULT NULL,
+ `c35` varchar(3) CHARACTER SET latin2 DEFAULT NULL,
+ `c36` varchar(3) CHARACTER SET latin2 DEFAULT NULL,
+ `c37` varchar(10) CHARACTER SET latin2 DEFAULT NULL,
+ `c38` varchar(10) CHARACTER SET latin2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select
@@ -299,23 +299,23 @@ alter table bug19145c add column (i int);
show create table bug19145a;
Table Create Table
bug19145a CREATE TABLE `bug19145a` (
- `e` enum('a','b','c') default NULL,
- `s` set('x','y','z') default NULL,
- `i` int(11) default NULL
+ `e` enum('a','b','c') DEFAULT NULL,
+ `s` set('x','y','z') DEFAULT NULL,
+ `i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table bug19145b;
Table Create Table
bug19145b CREATE TABLE `bug19145b` (
- `e` enum('a','b','c') default NULL,
- `s` set('x','y','z') default NULL,
- `i` int(11) default NULL
+ `e` enum('a','b','c') DEFAULT NULL,
+ `s` set('x','y','z') DEFAULT NULL,
+ `i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table bug19145c;
Table Create Table
bug19145c CREATE TABLE `bug19145c` (
- `e` enum('a','b','c') NOT NULL default 'b',
- `s` set('x','y','z') NOT NULL default 'y',
- `i` int(11) default NULL
+ `e` enum('a','b','c') NOT NULL DEFAULT 'b',
+ `s` set('x','y','z') NOT NULL DEFAULT 'y',
+ `i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table bug19145a;
drop table bug19145b;
diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result
index 6eb3cf312a0..15ca73dd7c9 100644
--- a/mysql-test/r/null_key.result
+++ b/mysql-test/r/null_key.result
@@ -342,7 +342,7 @@ index (id2)
);
insert into t1 values(null,null),(1,1);
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'id2' at row 1
+Warning 1048 Column 'id2' cannot be null
select * from t1;
id id2
NULL 0
diff --git a/mysql-test/r/olap.result b/mysql-test/r/olap.result
index a392de613f8..fd657c93bd7 100644
--- a/mysql-test/r/olap.result
+++ b/mysql-test/r/olap.result
@@ -87,8 +87,8 @@ TV 2 NULL 200
TV NULL NULL 600
NULL NULL NULL 7785
explain extended select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using filesort
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 15 100.00 Using filesort
Warnings:
Note 1003 select `test`.`t1`.`product` AS `product`,`test`.`t1`.`country_id` AS `country_id`,`test`.`t1`.`year` AS `year`,sum(`test`.`t1`.`profit`) AS `sum(profit)` from `test`.`t1` group by `test`.`t1`.`product`,`test`.`t1`.`country_id`,`test`.`t1`.`year` with rollup
select product, country_id , sum(profit) from t1 group by product desc, country_id with rollup;
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index 64653de5e9c..6461696b0d0 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -495,17 +495,17 @@ gid sid uid
103853 5 250
EXPLAIN select t1.gid, t2.sid, t3.uid from t3, t2, t1 where t2.gid = t1.gid and t2.uid = t3.uid order by t1.gid, t3.uid;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 6 Using index
-1 SIMPLE t2 eq_ref PRIMARY,uid PRIMARY 4 test.t1.gid 1
+1 SIMPLE t2 ALL PRIMARY,uid NULL NULL NULL 6 Using temporary; Using filesort
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t2.uid 1 Using where; Using index
+1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.gid 1 Using index
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t1.gid,t3.skr;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 ALL PRIMARY NULL NULL NULL 6 Using temporary; Using filesort
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.uid 1 Using where; Using index
EXPLAIN SELECT t1.gid, t2.sid, t3.uid from t2, t1, t3 where t2.gid = t1.gid and t2.uid = t3.uid order by t3.uid, t1.gid;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 6 Using index; Using temporary; Using filesort
-1 SIMPLE t2 eq_ref PRIMARY,uid PRIMARY 4 test.t1.gid 1
+1 SIMPLE t2 ALL PRIMARY,uid NULL NULL NULL 6 Using temporary; Using filesort
+1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.gid 1 Using index
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t2.uid 1 Using where; Using index
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t3.skr,t1.gid;
id select_type table type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/r/parser.result b/mysql-test/r/parser.result
new file mode 100644
index 00000000000..afd78561898
--- /dev/null
+++ b/mysql-test/r/parser.result
@@ -0,0 +1,388 @@
+SET @save_sql_mode=@@sql_mode;
+set SQL_MODE='';
+create table ADDDATE(a int);
+drop table ADDDATE;
+create table ADDDATE (a int);
+drop table ADDDATE;
+create table BIT_AND(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BIT_AND(a int)' at line 1
+create table BIT_AND (a int);
+drop table BIT_AND;
+create table BIT_OR(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BIT_OR(a int)' at line 1
+create table BIT_OR (a int);
+drop table BIT_OR;
+create table BIT_XOR(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BIT_XOR(a int)' at line 1
+create table BIT_XOR (a int);
+drop table BIT_XOR;
+create table CAST(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CAST(a int)' at line 1
+create table CAST (a int);
+drop table CAST;
+create table COUNT(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COUNT(a int)' at line 1
+create table COUNT (a int);
+drop table COUNT;
+create table CURDATE(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CURDATE(a int)' at line 1
+create table CURDATE (a int);
+drop table CURDATE;
+create table CURTIME(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CURTIME(a int)' at line 1
+create table CURTIME (a int);
+drop table CURTIME;
+create table DATE_ADD(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DATE_ADD(a int)' at line 1
+create table DATE_ADD (a int);
+drop table DATE_ADD;
+create table DATE_SUB(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DATE_SUB(a int)' at line 1
+create table DATE_SUB (a int);
+drop table DATE_SUB;
+create table EXTRACT(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'EXTRACT(a int)' at line 1
+create table EXTRACT (a int);
+drop table EXTRACT;
+create table GROUP_CONCAT(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP_CONCAT(a int)' at line 1
+create table GROUP_CONCAT (a int);
+drop table GROUP_CONCAT;
+create table GROUP_UNIQUE_USERS(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP_UNIQUE_USERS(a int)' at line 1
+create table GROUP_UNIQUE_USERS (a int);
+drop table GROUP_UNIQUE_USERS;
+create table MAX(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MAX(a int)' at line 1
+create table MAX (a int);
+drop table MAX;
+create table MID(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MID(a int)' at line 1
+create table MID (a int);
+drop table MID;
+create table MIN(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MIN(a int)' at line 1
+create table MIN (a int);
+drop table MIN;
+create table NOW(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOW(a int)' at line 1
+create table NOW (a int);
+drop table NOW;
+create table POSITION(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'POSITION(a int)' at line 1
+create table POSITION (a int);
+drop table POSITION;
+create table SESSION_USER(a int);
+drop table SESSION_USER;
+create table SESSION_USER (a int);
+drop table SESSION_USER;
+create table STD(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'STD(a int)' at line 1
+create table STD (a int);
+drop table STD;
+create table STDDEV(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'STDDEV(a int)' at line 1
+create table STDDEV (a int);
+drop table STDDEV;
+create table STDDEV_POP(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'STDDEV_POP(a int)' at line 1
+create table STDDEV_POP (a int);
+drop table STDDEV_POP;
+create table STDDEV_SAMP(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'STDDEV_SAMP(a int)' at line 1
+create table STDDEV_SAMP (a int);
+drop table STDDEV_SAMP;
+create table SUBDATE(a int);
+drop table SUBDATE;
+create table SUBDATE (a int);
+drop table SUBDATE;
+create table SUBSTR(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SUBSTR(a int)' at line 1
+create table SUBSTR (a int);
+drop table SUBSTR;
+create table SUBSTRING(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SUBSTRING(a int)' at line 1
+create table SUBSTRING (a int);
+drop table SUBSTRING;
+create table SUM(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SUM(a int)' at line 1
+create table SUM (a int);
+drop table SUM;
+create table SYSDATE(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SYSDATE(a int)' at line 1
+create table SYSDATE (a int);
+drop table SYSDATE;
+create table SYSTEM_USER(a int);
+drop table SYSTEM_USER;
+create table SYSTEM_USER (a int);
+drop table SYSTEM_USER;
+create table TRIM(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TRIM(a int)' at line 1
+create table TRIM (a int);
+drop table TRIM;
+create table UNIQUE_USERS(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNIQUE_USERS(a int)' at line 1
+create table UNIQUE_USERS (a int);
+drop table UNIQUE_USERS;
+create table VARIANCE(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VARIANCE(a int)' at line 1
+create table VARIANCE (a int);
+drop table VARIANCE;
+create table VAR_POP(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VAR_POP(a int)' at line 1
+create table VAR_POP (a int);
+drop table VAR_POP;
+create table VAR_SAMP(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VAR_SAMP(a int)' at line 1
+create table VAR_SAMP (a int);
+drop table VAR_SAMP;
+set SQL_MODE='IGNORE_SPACE';
+create table ADDDATE(a int);
+drop table ADDDATE;
+create table ADDDATE (a int);
+drop table ADDDATE;
+create table BIT_AND(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BIT_AND(a int)' at line 1
+create table BIT_AND (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BIT_AND (a int)' at line 1
+create table BIT_OR(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BIT_OR(a int)' at line 1
+create table BIT_OR (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BIT_OR (a int)' at line 1
+create table BIT_XOR(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BIT_XOR(a int)' at line 1
+create table BIT_XOR (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BIT_XOR (a int)' at line 1
+create table CAST(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CAST(a int)' at line 1
+create table CAST (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CAST (a int)' at line 1
+create table COUNT(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COUNT(a int)' at line 1
+create table COUNT (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COUNT (a int)' at line 1
+create table CURDATE(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CURDATE(a int)' at line 1
+create table CURDATE (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CURDATE (a int)' at line 1
+create table CURTIME(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CURTIME(a int)' at line 1
+create table CURTIME (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CURTIME (a int)' at line 1
+create table DATE_ADD(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DATE_ADD(a int)' at line 1
+create table DATE_ADD (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DATE_ADD (a int)' at line 1
+create table DATE_SUB(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DATE_SUB(a int)' at line 1
+create table DATE_SUB (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DATE_SUB (a int)' at line 1
+create table EXTRACT(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'EXTRACT(a int)' at line 1
+create table EXTRACT (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'EXTRACT (a int)' at line 1
+create table GROUP_CONCAT(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP_CONCAT(a int)' at line 1
+create table GROUP_CONCAT (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP_CONCAT (a int)' at line 1
+create table GROUP_UNIQUE_USERS(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP_UNIQUE_USERS(a int)' at line 1
+create table GROUP_UNIQUE_USERS (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP_UNIQUE_USERS (a int)' at line 1
+create table MAX(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MAX(a int)' at line 1
+create table MAX (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MAX (a int)' at line 1
+create table MID(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MID(a int)' at line 1
+create table MID (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MID (a int)' at line 1
+create table MIN(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MIN(a int)' at line 1
+create table MIN (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MIN (a int)' at line 1
+create table NOW(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOW(a int)' at line 1
+create table NOW (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOW (a int)' at line 1
+create table POSITION(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'POSITION(a int)' at line 1
+create table POSITION (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'POSITION (a int)' at line 1
+create table SESSION_USER(a int);
+drop table SESSION_USER;
+create table SESSION_USER (a int);
+drop table SESSION_USER;
+create table STD(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'STD(a int)' at line 1
+create table STD (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'STD (a int)' at line 1
+create table STDDEV(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'STDDEV(a int)' at line 1
+create table STDDEV (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'STDDEV (a int)' at line 1
+create table STDDEV_POP(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'STDDEV_POP(a int)' at line 1
+create table STDDEV_POP (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'STDDEV_POP (a int)' at line 1
+create table STDDEV_SAMP(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'STDDEV_SAMP(a int)' at line 1
+create table STDDEV_SAMP (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'STDDEV_SAMP (a int)' at line 1
+create table SUBDATE(a int);
+drop table SUBDATE;
+create table SUBDATE (a int);
+drop table SUBDATE;
+create table SUBSTR(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SUBSTR(a int)' at line 1
+create table SUBSTR (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SUBSTR (a int)' at line 1
+create table SUBSTRING(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SUBSTRING(a int)' at line 1
+create table SUBSTRING (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SUBSTRING (a int)' at line 1
+create table SUM(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SUM(a int)' at line 1
+create table SUM (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SUM (a int)' at line 1
+create table SYSDATE(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SYSDATE(a int)' at line 1
+create table SYSDATE (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SYSDATE (a int)' at line 1
+create table SYSTEM_USER(a int);
+drop table SYSTEM_USER;
+create table SYSTEM_USER (a int);
+drop table SYSTEM_USER;
+create table TRIM(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TRIM(a int)' at line 1
+create table TRIM (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TRIM (a int)' at line 1
+create table UNIQUE_USERS(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNIQUE_USERS(a int)' at line 1
+create table UNIQUE_USERS (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNIQUE_USERS (a int)' at line 1
+create table VARIANCE(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VARIANCE(a int)' at line 1
+create table VARIANCE (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VARIANCE (a int)' at line 1
+create table VAR_POP(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VAR_POP(a int)' at line 1
+create table VAR_POP (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VAR_POP (a int)' at line 1
+create table VAR_SAMP(a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VAR_SAMP(a int)' at line 1
+create table VAR_SAMP (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VAR_SAMP (a int)' at line 1
+SET @@sql_mode=@save_sql_mode;
+select pi(3.14);
+ERROR 42000: Incorrect parameter count in the call to native function 'pi'
+select tan();
+ERROR 42000: Incorrect parameter count in the call to native function 'tan'
+select tan(1, 2);
+ERROR 42000: Incorrect parameter count in the call to native function 'tan'
+select makedate(1);
+ERROR 42000: Incorrect parameter count in the call to native function 'makedate'
+select makedate(1, 2, 3);
+ERROR 42000: Incorrect parameter count in the call to native function 'makedate'
+select maketime();
+ERROR 42000: Incorrect parameter count in the call to native function 'maketime'
+select maketime(1);
+ERROR 42000: Incorrect parameter count in the call to native function 'maketime'
+select maketime(1, 2);
+ERROR 42000: Incorrect parameter count in the call to native function 'maketime'
+select maketime(1, 2, 3, 4);
+ERROR 42000: Incorrect parameter count in the call to native function 'maketime'
+select atan();
+ERROR 42000: Incorrect parameter count in the call to native function 'atan'
+select atan2(1, 2, 3);
+ERROR 42000: Incorrect parameter count in the call to native function 'atan2'
+select benchmark(10, 1+1);
+benchmark(10, 1+1)
+0
+select benchmark(5+5, 2);
+ERROR 42000: Incorrect parameters in the call to native function 'BENCHMARK'
+select concat();
+ERROR 42000: Incorrect parameter count in the call to native function 'concat'
+select concat("foo");
+concat("foo")
+foo
+select concat_ws();
+ERROR 42000: Incorrect parameter count in the call to native function 'concat_ws'
+select concat_ws("foo");
+ERROR 42000: Incorrect parameter count in the call to native function 'concat_ws'
+set @pwd="my password";
+select encode("secret", @pwd);
+ERROR 42000: Incorrect parameters in the call to native function 'ENCODE'
+select decode("encoded-secret", @pwd);
+ERROR 42000: Incorrect parameters in the call to native function 'DECODE'
+select encrypt();
+ERROR 42000: Incorrect parameter count in the call to native function 'encrypt'
+select encrypt(1, 2, 3);
+ERROR 42000: Incorrect parameter count in the call to native function 'encrypt'
+select des_encrypt("p1", "p2", "not expected");
+ERROR 42000: Incorrect parameter count in the call to native function 'des_encrypt'
+select des_decrypt("p1", "p2", "not expected");
+ERROR 42000: Incorrect parameter count in the call to native function 'des_decrypt'
+select elt();
+ERROR 42000: Incorrect parameter count in the call to native function 'elt'
+select elt(1);
+ERROR 42000: Incorrect parameter count in the call to native function 'elt'
+select export_set();
+ERROR 42000: Incorrect parameter count in the call to native function 'export_set'
+select export_set("p1");
+ERROR 42000: Incorrect parameter count in the call to native function 'export_set'
+select export_set("p1", "p2");
+ERROR 42000: Incorrect parameter count in the call to native function 'export_set'
+select export_set("p1", "p2", "p3", "p4", "p5", "p6");
+ERROR 42000: Incorrect parameter count in the call to native function 'export_set'
+select field();
+ERROR 42000: Incorrect parameter count in the call to native function 'field'
+select field("p1");
+ERROR 42000: Incorrect parameter count in the call to native function 'field'
+set @dec=2;
+select format(pi(), @dec);
+ERROR 42000: Incorrect parameters in the call to native function 'FORMAT'
+select from_unixtime();
+ERROR 42000: Incorrect parameter count in the call to native function 'from_unixtime'
+select from_unixtime(1, 2, 3);
+ERROR 42000: Incorrect parameter count in the call to native function 'from_unixtime'
+select unix_timestamp(1, 2);
+ERROR 42000: Incorrect parameter count in the call to native function 'unix_timestamp'
+select greatest();
+ERROR 42000: Incorrect parameter count in the call to native function 'greatest'
+select greatest(12);
+ERROR 42000: Incorrect parameter count in the call to native function 'greatest'
+select last_insert_id(1, 2);
+ERROR 42000: Incorrect parameter count in the call to native function 'last_insert_id'
+select least();
+ERROR 42000: Incorrect parameter count in the call to native function 'least'
+select least(12);
+ERROR 42000: Incorrect parameter count in the call to native function 'least'
+select locate();
+ERROR 42000: Incorrect parameter count in the call to native function 'locate'
+select locate(1);
+ERROR 42000: Incorrect parameter count in the call to native function 'locate'
+select locate(1, 2, 3, 4);
+ERROR 42000: Incorrect parameter count in the call to native function 'locate'
+select log();
+ERROR 42000: Incorrect parameter count in the call to native function 'log'
+select log(1, 2, 3);
+ERROR 42000: Incorrect parameter count in the call to native function 'log'
+select make_set();
+ERROR 42000: Incorrect parameter count in the call to native function 'make_set'
+select make_set(1);
+ERROR 42000: Incorrect parameter count in the call to native function 'make_set'
+select master_pos_wait();
+ERROR 42000: Incorrect parameter count in the call to native function 'master_pos_wait'
+select master_pos_wait(1);
+ERROR 42000: Incorrect parameter count in the call to native function 'master_pos_wait'
+select master_pos_wait(1, 2, 3, 4);
+ERROR 42000: Incorrect parameter count in the call to native function 'master_pos_wait'
+select rand(1, 2, 3);
+ERROR 42000: Incorrect parameter count in the call to native function 'rand'
+select round(1, 2, 3);
+ERROR 42000: Incorrect parameter count in the call to native function 'round'
+select yearweek();
+ERROR 42000: Incorrect parameter count in the call to native function 'yearweek'
+select yearweek(1, 2, 3);
+ERROR 42000: Incorrect parameter count in the call to native function 'yearweek'
diff --git a/mysql-test/r/parser_bug21114_innodb.result b/mysql-test/r/parser_bug21114_innodb.result
new file mode 100644
index 00000000000..e39b63f571d
--- /dev/null
+++ b/mysql-test/r/parser_bug21114_innodb.result
@@ -0,0 +1,867 @@
+drop table if exists abs;
+drop table if exists bug21114_child;
+SHOW CREATE TABLE abs;
+Table Create Table
+abs CREATE TABLE `abs` (
+ `col1` int(11) NOT NULL,
+ `col2` int(11) NOT NULL,
+ `col3` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`col1`,`col2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW CREATE TABLE bug21114_child;
+Table Create Table
+bug21114_child CREATE TABLE `bug21114_child` (
+ `pk` int(11) NOT NULL,
+ `fk_col1` int(11) NOT NULL,
+ `fk_col2` int(11) NOT NULL,
+ `fk_col3` int(11) NOT NULL,
+ `fk_col4` int(11) NOT NULL,
+ KEY `fk_fct` (`fk_col1`,`fk_col2`),
+ KEY `fk_fct_space` (`fk_col3`,`fk_col4`),
+ CONSTRAINT `fk_fct` FOREIGN KEY (`fk_col1`, `fk_col2`) REFERENCES `abs` (`col1`, `col2`),
+ CONSTRAINT `fk_fct_space` FOREIGN KEY (`fk_col3`, `fk_col4`) REFERENCES `abs` (`col1`, `col2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE bug21114_child;
+DROP TABLE abs;
+drop table if exists field;
+drop table if exists bug21114_child;
+SHOW CREATE TABLE field;
+Table Create Table
+field CREATE TABLE `field` (
+ `col1` int(11) NOT NULL,
+ `col2` int(11) NOT NULL,
+ `col3` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`col1`,`col2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW CREATE TABLE bug21114_child;
+Table Create Table
+bug21114_child CREATE TABLE `bug21114_child` (
+ `pk` int(11) NOT NULL,
+ `fk_col1` int(11) NOT NULL,
+ `fk_col2` int(11) NOT NULL,
+ `fk_col3` int(11) NOT NULL,
+ `fk_col4` int(11) NOT NULL,
+ KEY `fk_fct` (`fk_col1`,`fk_col2`),
+ KEY `fk_fct_space` (`fk_col3`,`fk_col4`),
+ CONSTRAINT `fk_fct` FOREIGN KEY (`fk_col1`, `fk_col2`) REFERENCES `field` (`col1`, `col2`),
+ CONSTRAINT `fk_fct_space` FOREIGN KEY (`fk_col3`, `fk_col4`) REFERENCES `field` (`col1`, `col2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE bug21114_child;
+DROP TABLE field;
+drop table if exists format;
+drop table if exists bug21114_child;
+SHOW CREATE TABLE format;
+Table Create Table
+format CREATE TABLE `format` (
+ `col1` int(11) NOT NULL,
+ `col2` int(11) NOT NULL,
+ `col3` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`col1`,`col2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW CREATE TABLE bug21114_child;
+Table Create Table
+bug21114_child CREATE TABLE `bug21114_child` (
+ `pk` int(11) NOT NULL,
+ `fk_col1` int(11) NOT NULL,
+ `fk_col2` int(11) NOT NULL,
+ `fk_col3` int(11) NOT NULL,
+ `fk_col4` int(11) NOT NULL,
+ KEY `fk_fct` (`fk_col1`,`fk_col2`),
+ KEY `fk_fct_space` (`fk_col3`,`fk_col4`),
+ CONSTRAINT `fk_fct` FOREIGN KEY (`fk_col1`, `fk_col2`) REFERENCES `format` (`col1`, `col2`),
+ CONSTRAINT `fk_fct_space` FOREIGN KEY (`fk_col3`, `fk_col4`) REFERENCES `format` (`col1`, `col2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE bug21114_child;
+DROP TABLE format;
+drop table if exists acos;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE acos;
+drop table if exists adddate;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE adddate;
+drop table if exists addtime;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE addtime;
+drop table if exists aes_decrypt;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE aes_decrypt;
+drop table if exists aes_encrypt;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE aes_encrypt;
+drop table if exists area;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE area;
+drop table if exists asbinary;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE asbinary;
+drop table if exists asin;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE asin;
+drop table if exists astext;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE astext;
+drop table if exists aswkb;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE aswkb;
+drop table if exists aswkt;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE aswkt;
+drop table if exists atan;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE atan;
+drop table if exists atan2;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE atan2;
+drop table if exists benchmark;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE benchmark;
+drop table if exists bin;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE bin;
+drop table if exists bit_count;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE bit_count;
+drop table if exists bit_length;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE bit_length;
+drop table if exists ceil;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE ceil;
+drop table if exists ceiling;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE ceiling;
+drop table if exists centroid;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE centroid;
+drop table if exists character_length;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE character_length;
+drop table if exists char_length;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE char_length;
+drop table if exists coercibility;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE coercibility;
+drop table if exists compress;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE compress;
+drop table if exists concat;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE concat;
+drop table if exists concat_ws;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE concat_ws;
+drop table if exists connection_id;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE connection_id;
+drop table if exists conv;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE conv;
+drop table if exists convert_tz;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE convert_tz;
+drop table if exists cos;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE cos;
+drop table if exists cot;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE cot;
+drop table if exists crc32;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE crc32;
+drop table if exists crosses;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE crosses;
+drop table if exists datediff;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE datediff;
+drop table if exists date_format;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE date_format;
+drop table if exists dayname;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE dayname;
+drop table if exists dayofmonth;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE dayofmonth;
+drop table if exists dayofweek;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE dayofweek;
+drop table if exists dayofyear;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE dayofyear;
+drop table if exists decode;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE decode;
+drop table if exists degrees;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE degrees;
+drop table if exists des_decrypt;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE des_decrypt;
+drop table if exists des_encrypt;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE des_encrypt;
+drop table if exists dimension;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE dimension;
+drop table if exists disjoint;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE disjoint;
+drop table if exists elt;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE elt;
+drop table if exists encode;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE encode;
+drop table if exists encrypt;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE encrypt;
+drop table if exists endpoint;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE endpoint;
+drop table if exists envelope;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE envelope;
+drop table if exists equals;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE equals;
+drop table if exists exp;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE exp;
+drop table if exists export_set;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE export_set;
+drop table if exists exteriorring;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE exteriorring;
+drop table if exists extractvalue;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE extractvalue;
+drop table if exists find_in_set;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE find_in_set;
+drop table if exists floor;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE floor;
+drop table if exists found_rows;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE found_rows;
+drop table if exists from_days;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE from_days;
+drop table if exists from_unixtime;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE from_unixtime;
+drop table if exists geomcollfromtext;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE geomcollfromtext;
+drop table if exists geomcollfromwkb;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE geomcollfromwkb;
+drop table if exists geometrycollectionfromtext;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE geometrycollectionfromtext;
+drop table if exists geometrycollectionfromwkb;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE geometrycollectionfromwkb;
+drop table if exists geometryfromtext;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE geometryfromtext;
+drop table if exists geometryfromwkb;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE geometryfromwkb;
+drop table if exists geometryn;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE geometryn;
+drop table if exists geometrytype;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE geometrytype;
+drop table if exists geomfromtext;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE geomfromtext;
+drop table if exists geomfromwkb;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE geomfromwkb;
+drop table if exists get_lock;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE get_lock;
+drop table if exists glength;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE glength;
+drop table if exists greatest;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE greatest;
+drop table if exists hex;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE hex;
+drop table if exists ifnull;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE ifnull;
+drop table if exists inet_aton;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE inet_aton;
+drop table if exists inet_ntoa;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE inet_ntoa;
+drop table if exists instr;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE instr;
+drop table if exists interiorringn;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE interiorringn;
+drop table if exists intersects;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE intersects;
+drop table if exists isclosed;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE isclosed;
+drop table if exists isempty;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE isempty;
+drop table if exists isnull;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE isnull;
+drop table if exists issimple;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE issimple;
+drop table if exists is_free_lock;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE is_free_lock;
+drop table if exists is_used_lock;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE is_used_lock;
+drop table if exists last_day;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE last_day;
+drop table if exists last_insert_id;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE last_insert_id;
+drop table if exists lcase;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE lcase;
+drop table if exists least;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE least;
+drop table if exists length;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE length;
+drop table if exists linefromtext;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE linefromtext;
+drop table if exists linefromwkb;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE linefromwkb;
+drop table if exists linestringfromtext;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE linestringfromtext;
+drop table if exists linestringfromwkb;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE linestringfromwkb;
+drop table if exists ln;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE ln;
+drop table if exists load_file;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE load_file;
+drop table if exists locate;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE locate;
+drop table if exists log;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE log;
+drop table if exists log10;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE log10;
+drop table if exists log2;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE log2;
+drop table if exists lower;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE lower;
+drop table if exists lpad;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE lpad;
+drop table if exists ltrim;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE ltrim;
+drop table if exists makedate;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE makedate;
+drop table if exists maketime;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE maketime;
+drop table if exists make_set;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE make_set;
+drop table if exists master_pos_wait;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE master_pos_wait;
+drop table if exists mbrcontains;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE mbrcontains;
+drop table if exists mbrdisjoint;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE mbrdisjoint;
+drop table if exists mbrequal;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE mbrequal;
+drop table if exists mbrintersects;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE mbrintersects;
+drop table if exists mbroverlaps;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE mbroverlaps;
+drop table if exists mbrtouches;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE mbrtouches;
+drop table if exists mbrwithin;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE mbrwithin;
+drop table if exists md5;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE md5;
+drop table if exists mlinefromtext;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE mlinefromtext;
+drop table if exists mlinefromwkb;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE mlinefromwkb;
+drop table if exists monthname;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE monthname;
+drop table if exists mpointfromtext;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE mpointfromtext;
+drop table if exists mpointfromwkb;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE mpointfromwkb;
+drop table if exists mpolyfromtext;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE mpolyfromtext;
+drop table if exists mpolyfromwkb;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE mpolyfromwkb;
+drop table if exists multilinestringfromtext;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE multilinestringfromtext;
+drop table if exists multilinestringfromwkb;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE multilinestringfromwkb;
+drop table if exists multipointfromtext;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE multipointfromtext;
+drop table if exists multipointfromwkb;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE multipointfromwkb;
+drop table if exists multipolygonfromtext;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE multipolygonfromtext;
+drop table if exists multipolygonfromwkb;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE multipolygonfromwkb;
+drop table if exists name_const;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE name_const;
+drop table if exists nullif;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE nullif;
+drop table if exists numgeometries;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE numgeometries;
+drop table if exists numinteriorrings;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE numinteriorrings;
+drop table if exists numpoints;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE numpoints;
+drop table if exists oct;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE oct;
+drop table if exists octet_length;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE octet_length;
+drop table if exists ord;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE ord;
+drop table if exists overlaps;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE overlaps;
+drop table if exists period_add;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE period_add;
+drop table if exists period_diff;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE period_diff;
+drop table if exists pi;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE pi;
+drop table if exists pointfromtext;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE pointfromtext;
+drop table if exists pointfromwkb;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE pointfromwkb;
+drop table if exists pointn;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE pointn;
+drop table if exists polyfromtext;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE polyfromtext;
+drop table if exists polyfromwkb;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE polyfromwkb;
+drop table if exists polygonfromtext;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE polygonfromtext;
+drop table if exists polygonfromwkb;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE polygonfromwkb;
+drop table if exists pow;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE pow;
+drop table if exists power;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE power;
+drop table if exists quote;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE quote;
+drop table if exists radians;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE radians;
+drop table if exists rand;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE rand;
+drop table if exists release_lock;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE release_lock;
+drop table if exists reverse;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE reverse;
+drop table if exists round;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE round;
+drop table if exists row_count;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE row_count;
+drop table if exists rpad;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE rpad;
+drop table if exists rtrim;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE rtrim;
+drop table if exists sec_to_time;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE sec_to_time;
+drop table if exists session_user;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE session_user;
+drop table if exists sha;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE sha;
+drop table if exists sha1;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE sha1;
+drop table if exists sign;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE sign;
+drop table if exists sin;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE sin;
+drop table if exists sleep;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE sleep;
+drop table if exists soundex;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE soundex;
+drop table if exists space;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE space;
+drop table if exists sqrt;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE sqrt;
+drop table if exists srid;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE srid;
+drop table if exists startpoint;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE startpoint;
+drop table if exists strcmp;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE strcmp;
+drop table if exists str_to_date;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE str_to_date;
+drop table if exists subdate;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE subdate;
+drop table if exists substring_index;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE substring_index;
+drop table if exists subtime;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE subtime;
+drop table if exists system_user;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE system_user;
+drop table if exists tan;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE tan;
+drop table if exists timediff;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE timediff;
+drop table if exists time_format;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE time_format;
+drop table if exists time_to_sec;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE time_to_sec;
+drop table if exists touches;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE touches;
+drop table if exists to_days;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE to_days;
+drop table if exists ucase;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE ucase;
+drop table if exists uncompress;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE uncompress;
+drop table if exists uncompressed_length;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE uncompressed_length;
+drop table if exists unhex;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE unhex;
+drop table if exists unix_timestamp;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE unix_timestamp;
+drop table if exists updatexml;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE updatexml;
+drop table if exists upper;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE upper;
+drop table if exists uuid;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE uuid;
+drop table if exists version;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE version;
+drop table if exists weekday;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE weekday;
+drop table if exists weekofyear;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE weekofyear;
+drop table if exists within;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE within;
+drop table if exists x;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE x;
+drop table if exists y;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE y;
+drop table if exists yearweek;
+drop table if exists bug21114_child;
+DROP TABLE bug21114_child;
+DROP TABLE yearweek;
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
new file mode 100644
index 00000000000..5a8f5a3137d
--- /dev/null
+++ b/mysql-test/r/partition.result
@@ -0,0 +1,1131 @@
+drop table if exists t1;
+create table t1 (a int)
+partition by key(a)
+partitions 0.2+e1;
+ERROR 42000: Only integers allowed as number here near '0.2+e1' at line 3
+create table t1 (a int)
+partition by key(a)
+partitions -1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1' at line 3
+create table t1 (a int)
+partition by key(a)
+partitions 1.5;
+ERROR 42000: Only integers allowed as number here near '1.5' at line 3
+create table t1 (a int)
+partition by key(a)
+partitions 1e+300;
+ERROR 42000: Only integers allowed as number here near '1e+300' at line 3
+create table t1 (a int)
+partition by key (a)
+(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
+ERROR 42000: Incorrect table name 'part-data'
+create table t1 (a int)
+partition by key (a)
+(partition p0,
+partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
+ERROR 42000: Incorrect table name 'part-data'
+create table t1 (a int)
+partition by list (a)
+(partition p0 values in (1));
+create procedure pz()
+alter table t1 engine = myisam;
+call pz();
+call pz();
+drop procedure pz;
+drop table t1;
+create table t1 (a int)
+engine = csv
+partition by list (a)
+(partition p0 values in (null));
+ERROR HY000: Engine cannot be used in partitioned tables
+create table t1 (a bigint)
+partition by range (a)
+(partition p0 values less than (0xFFFFFFFFFFFFFFFF),
+partition p1 values less than (10));
+ERROR 42000: VALUES value must be of same type as partition function near '),
+partition p1 values less than (10))' at line 3
+create table t1 (a bigint)
+partition by list (a)
+(partition p0 values in (0xFFFFFFFFFFFFFFFF),
+partition p1 values in (10));
+ERROR 42000: VALUES value must be of same type as partition function near '),
+partition p1 values in (10))' at line 3
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (100),
+partition p1 values less than MAXVALUE);
+insert into t1 values (1);
+drop table t1;
+create table t1 (a bigint unsigned)
+partition by hash (a);
+insert into t1 values (0xFFFFFFFFFFFFFFFD);
+insert into t1 values (0xFFFFFFFFFFFFFFFE);
+select * from t1 where (a + 1) < 10;
+a
+select * from t1 where (a + 1) > 10;
+a
+18446744073709551613
+18446744073709551614
+drop table t1;
+create table t1 (a int)
+engine = csv
+partition by list (a)
+(partition p0 values in (null));
+ERROR HY000: Engine cannot be used in partitioned tables
+create table t1 (a int)
+partition by key(a)
+(partition p0 engine = MEMORY);
+drop table t1;
+create table t1 (a int)
+partition by range (a)
+subpartition by key (a)
+(partition p0 values less than (1));
+alter table t1 add partition (partition p1 values less than (2));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) SUBPARTITION BY KEY (a) (PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (2) ENGINE = MyISAM) */
+alter table t1 reorganize partition p1 into (partition p1 values less than (3));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) SUBPARTITION BY KEY (a) (PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (3) ENGINE = MyISAM) */
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by key (a);
+select count(*) from t1;
+count(*)
+0
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` int(11) NOT NULL,
+ `c` int(11) NOT NULL,
+ PRIMARY KEY (`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) */
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by key (a, b);
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by key (a)
+partitions 3
+(partition x1, partition x2, partition x3);
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by key (a)
+partitions 3
+(partition x1 nodegroup 0,
+partition x2 nodegroup 1,
+partition x3 nodegroup 2);
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by key (a)
+partitions 3
+(partition x1 engine myisam,
+partition x2 engine myisam,
+partition x3 engine myisam);
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by key (a)
+partitions 3
+(partition x1 tablespace ts1,
+partition x2 tablespace ts2,
+partition x3 tablespace ts3);
+CREATE TABLE t2 LIKE t1;
+drop table t2;
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a)
+partitions 3
+(partition x1 values in (1,2,9,4) tablespace ts1,
+partition x2 values in (3, 11, 5, 7) tablespace ts2,
+partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (b*a)
+partitions 3
+(partition x1 values in (1,2,9,4) tablespace ts1,
+partition x2 values in (3, 11, 5, 7) tablespace ts2,
+partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (b*a)
+(partition x1 values in (1) tablespace ts1,
+partition x2 values in (3, 11, 5, 7) tablespace ts2,
+partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
+drop table t1;
+CREATE TABLE t1 (
+a int not null)
+partition by key(a);
+LOCK TABLES t1 WRITE;
+insert into t1 values (1);
+insert into t1 values (2);
+insert into t1 values (3);
+insert into t1 values (4);
+UNLOCK TABLES;
+drop table t1;
+CREATE TABLE t1 (a int, name VARCHAR(50), purchased DATE)
+PARTITION BY RANGE (a)
+(PARTITION p0 VALUES LESS THAN (3),
+PARTITION p1 VALUES LESS THAN (7),
+PARTITION p2 VALUES LESS THAN (9),
+PARTITION p3 VALUES LESS THAN (11));
+INSERT INTO t1 VALUES
+(1, 'desk organiser', '2003-10-15'),
+(2, 'CD player', '1993-11-05'),
+(3, 'TV set', '1996-03-10'),
+(4, 'bookcase', '1982-01-10'),
+(5, 'exercise bike', '2004-05-09'),
+(6, 'sofa', '1987-06-05'),
+(7, 'popcorn maker', '2001-11-22'),
+(8, 'acquarium', '1992-08-04'),
+(9, 'study desk', '1984-09-16'),
+(10, 'lava lamp', '1998-12-25');
+SELECT * from t1 ORDER BY a;
+a name purchased
+1 desk organiser 2003-10-15
+2 CD player 1993-11-05
+3 TV set 1996-03-10
+4 bookcase 1982-01-10
+5 exercise bike 2004-05-09
+6 sofa 1987-06-05
+7 popcorn maker 2001-11-22
+8 acquarium 1992-08-04
+9 study desk 1984-09-16
+10 lava lamp 1998-12-25
+ALTER TABLE t1 DROP PARTITION p0;
+SELECT * from t1 ORDER BY a;
+a name purchased
+3 TV set 1996-03-10
+4 bookcase 1982-01-10
+5 exercise bike 2004-05-09
+6 sofa 1987-06-05
+7 popcorn maker 2001-11-22
+8 acquarium 1992-08-04
+9 study desk 1984-09-16
+10 lava lamp 1998-12-25
+drop table t1;
+CREATE TABLE t1 (a int)
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (1,2,3), PARTITION p1 VALUES IN (4,5,6));
+insert into t1 values (1),(2),(3),(4),(5),(6);
+select * from t1;
+a
+1
+2
+3
+4
+5
+6
+truncate t1;
+select * from t1;
+a
+truncate t1;
+select * from t1;
+a
+drop table t1;
+CREATE TABLE t1 (a int, b int, primary key(a,b))
+PARTITION BY KEY(b,a) PARTITIONS 4;
+insert into t1 values (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6);
+select * from t1 where a = 4;
+a b
+4 4
+drop table t1;
+CREATE TABLE t1 (a int)
+PARTITION BY LIST (a)
+PARTITIONS 1
+(PARTITION x1 VALUES IN (1) ENGINE=MEMORY);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) (PARTITION x1 VALUES IN (1) ENGINE = MEMORY) */
+drop table t1;
+CREATE TABLE t1 (a int, unique(a))
+PARTITION BY LIST (a)
+(PARTITION x1 VALUES IN (10), PARTITION x2 VALUES IN (20));
+REPLACE t1 SET a = 4;
+ERROR HY000: Table has no partition for value 4
+drop table t1;
+CREATE TABLE t1 (a int)
+PARTITION BY LIST (a)
+(PARTITION x1 VALUES IN (2), PARTITION x2 VALUES IN (3));
+insert into t1 values (2), (3);
+insert into t1 values (4);
+ERROR HY000: Table has no partition for value 4
+insert into t1 values (1);
+ERROR HY000: Table has no partition for value 1
+drop table t1;
+CREATE TABLE t1 (a int)
+PARTITION BY HASH(a)
+PARTITIONS 5;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (a) PARTITIONS 5 */
+drop table t1;
+CREATE TABLE t1 (a int)
+PARTITION BY RANGE (a)
+(PARTITION x1 VALUES LESS THAN (2));
+insert into t1 values (1);
+update t1 set a = 5;
+ERROR HY000: Table has no partition for value 5
+drop table t1;
+CREATE TABLE t1 (a int)
+PARTITION BY LIST (a)
+(PARTITION x1 VALUES IN (10), PARTITION x2 VALUES IN (20));
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+drop table t1;
+CREATE TABLE `t1` (
+`id` int(11) default NULL
+) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 PARTITION BY HASH (id) ;
+SELECT * FROM t1;
+id
+drop table t1;
+CREATE TABLE `t1` (
+`id` int(11) default NULL
+) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 PARTITION BY HASH (id) ;
+SELECT * FROM t1;
+id
+drop table t1;
+create table t1
+(a int)
+partition by range (a)
+( partition p0 values less than(10),
+partition p1 values less than (20),
+partition p2 values less than (25));
+alter table t1 reorganize partition p2 into (partition p2 values less than (30));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (20) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (30) ENGINE = MyISAM) */
+drop table t1;
+CREATE TABLE t1 (a int, b int)
+PARTITION BY RANGE (a)
+(PARTITION x0 VALUES LESS THAN (2),
+PARTITION x1 VALUES LESS THAN (4),
+PARTITION x2 VALUES LESS THAN (6),
+PARTITION x3 VALUES LESS THAN (8),
+PARTITION x4 VALUES LESS THAN (10),
+PARTITION x5 VALUES LESS THAN (12),
+PARTITION x6 VALUES LESS THAN (14),
+PARTITION x7 VALUES LESS THAN (16),
+PARTITION x8 VALUES LESS THAN (18),
+PARTITION x9 VALUES LESS THAN (20));
+ALTER TABLE t1 REORGANIZE PARTITION x0,x1,x2 INTO
+(PARTITION x1 VALUES LESS THAN (6));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) (PARTITION x1 VALUES LESS THAN (6) ENGINE = MyISAM, PARTITION x3 VALUES LESS THAN (8) ENGINE = MyISAM, PARTITION x4 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION x5 VALUES LESS THAN (12) ENGINE = MyISAM, PARTITION x6 VALUES LESS THAN (14) ENGINE = MyISAM, PARTITION x7 VALUES LESS THAN (16) ENGINE = MyISAM, PARTITION x8 VALUES LESS THAN (18) ENGINE = MyISAM, PARTITION x9 VALUES LESS THAN (20) ENGINE = MyISAM) */
+drop table t1;
+create table t1 (a int not null, b int not null) partition by LIST (a+b) (
+partition p0 values in (12),
+partition p1 values in (14)
+);
+insert into t1 values (10,1);
+ERROR HY000: Table has no partition for value 11
+drop table t1;
+create table t1 (f1 integer,f2 integer, f3 varchar(10), primary key(f1,f2))
+partition by range(f1) subpartition by hash(f2) subpartitions 2
+(partition p1 values less than (0),
+partition p2 values less than (2),
+partition p3 values less than (2147483647));
+insert into t1 values(10,10,'10');
+insert into t1 values(2,2,'2');
+select * from t1 where f1 = 2;
+f1 f2 f3
+2 2 2
+drop table t1;
+create table t1 (f1 integer,f2 integer, unique index(f1))
+partition by range(f1 div 2)
+subpartition by hash(f1) subpartitions 2
+(partition partb values less than (2),
+partition parte values less than (4),
+partition partf values less than (10000));
+insert into t1 values(10,1);
+select * from t1 where f1 = 10;
+f1 f2
+10 1
+drop table t1;
+set session storage_engine= 'memory';
+create table t1 (f_int1 int(11) default null) engine = memory
+partition by range (f_int1) subpartition by hash (f_int1)
+(partition part1 values less than (1000)
+(subpartition subpart11 engine = memory));
+drop table t1;
+set session storage_engine='myisam';
+create table t1 (f_int1 integer, f_int2 integer, primary key (f_int1))
+partition by hash(f_int1) partitions 2;
+insert into t1 values (1,1),(2,2);
+replace into t1 values (1,1),(2,2);
+drop table t1;
+create table t1 (s1 int, unique (s1)) partition by list (s1) (partition x1 VALUES in (10), partition x2 values in (20));
+alter table t1 add partition (partition x3 values in (30));
+drop table t1;
+create table t1 (a int)
+partition by key(a)
+partitions 2
+(partition p0 engine=myisam, partition p1 engine=myisam);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM) */
+alter table t1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM) */
+alter table t1 engine=myisam;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM) */
+alter table t1 engine=heap;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY) */
+alter table t1 remove partitioning;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (a int)
+engine=myisam
+partition by key(a)
+partitions 2
+(partition p0 engine=myisam, partition p1 engine=myisam);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM) */
+alter table t1 add column b int remove partitioning;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t1
+engine=myisam
+partition by key(a)
+(partition p0 engine=myisam, partition p1);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM) */
+alter table t1
+engine=heap
+partition by key(a)
+(partition p0, partition p1 engine=heap);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY) */
+alter table t1 engine=myisam, add column c int remove partitioning;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t1
+engine=heap
+partition by key (a)
+(partition p0, partition p1);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY) */
+alter table t1
+partition by key (a)
+(partition p0, partition p1);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY) */
+alter table t1
+engine=heap
+partition by key (a)
+(partition p0, partition p1);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY) */
+alter table t1
+partition by key(a)
+(partition p0, partition p1 engine=heap);
+ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
+alter table t1
+partition by key(a)
+(partition p0 engine=heap, partition p1);
+ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
+alter table t1
+engine=heap
+partition by key (a)
+(partition p0 engine=heap, partition p1 engine=myisam);
+ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
+alter table t1
+partition by key (a)
+(partition p0 engine=heap, partition p1 engine=myisam);
+ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
+drop table t1;
+CREATE TABLE t1 (
+f_int1 INTEGER, f_int2 INTEGER,
+f_char1 CHAR(10), f_char2 CHAR(10), f_charbig VARCHAR(1000)
+)
+PARTITION BY RANGE(f_int1 DIV 2)
+SUBPARTITION BY HASH(f_int1)
+SUBPARTITIONS 2
+(PARTITION parta VALUES LESS THAN (0),
+PARTITION partb VALUES LESS THAN (5),
+PARTITION parte VALUES LESS THAN (10),
+PARTITION partf VALUES LESS THAN (2147483647));
+INSERT INTO t1 SET f_int1 = NULL , f_int2 = -20, f_char1 = CAST(-20 AS CHAR),
+f_char2 = CAST(-20 AS CHAR), f_charbig = '#NULL#';
+SELECT * FROM t1 WHERE f_int1 IS NULL;
+f_int1 f_int2 f_char1 f_char2 f_charbig
+NULL -20 -20 -20 #NULL#
+SELECT * FROM t1;
+f_int1 f_int2 f_char1 f_char2 f_charbig
+NULL -20 -20 -20 #NULL#
+drop table t1;
+CREATE TABLE t1 (
+f_int1 INTEGER, f_int2 INTEGER,
+f_char1 CHAR(10), f_char2 CHAR(10), f_charbig VARCHAR(1000) )
+PARTITION BY LIST(MOD(f_int1,2))
+SUBPARTITION BY KEY(f_int1)
+(PARTITION part1 VALUES IN (-1) (SUBPARTITION sp1, SUBPARTITION sp2),
+PARTITION part2 VALUES IN (0) (SUBPARTITION sp3, SUBPARTITION sp5),
+PARTITION part3 VALUES IN (1) (SUBPARTITION sp4, SUBPARTITION sp6));
+INSERT INTO t1 SET f_int1 = 2, f_int2 = 2, f_char1 = '2', f_char2 = '2', f_charbig = '===2===';
+INSERT INTO t1 SET f_int1 = 2, f_int2 = 2, f_char1 = '2', f_char2 = '2', f_charbig = '===2===';
+SELECT * FROM t1 WHERE f_int1 IS NULL;
+f_int1 f_int2 f_char1 f_char2 f_charbig
+drop table t1;
+create procedure p ()
+begin
+create table t1 (s1 mediumint,s2 mediumint)
+partition by list (s2)
+(partition p1 values in (0),
+partition p2 values in (1));
+end//
+call p()//
+drop procedure p//
+drop table t1;
+create procedure p ()
+begin
+create table t1 (a int not null,b int not null,c int not null,primary key (a,b))
+partition by range (a)
+subpartition by hash (a+b)
+(partition x1 values less than (1)
+(subpartition x11,
+subpartition x12),
+partition x2 values less than (5)
+(subpartition x21,
+subpartition x22));
+end//
+call p()//
+drop procedure p//
+drop table t1//
+create table t1 (a int,b int,c int,key(a,b))
+partition by range (a)
+partitions 3
+(partition x1 values less than (0) tablespace ts1,
+partition x2 values less than (10) tablespace ts2,
+partition x3 values less than maxvalue tablespace ts3);
+insert into t1 values (NULL, 1, 1);
+insert into t1 values (0, 1, 1);
+insert into t1 values (12, 1, 1);
+select partition_name, partition_description, table_rows
+from information_schema.partitions where table_schema ='test';
+partition_name partition_description table_rows
+x1 0 1
+x2 10 1
+x3 MAXVALUE 1
+drop table t1;
+create table t1 (a int,b int, c int)
+partition by list(a)
+partitions 2
+(partition x123 values in (11,12),
+partition x234 values in (1 ,NULL, NULL));
+ERROR HY000: Multiple definition of same constant in list partitioning
+create table t1 (a int,b int, c int)
+partition by list(a)
+partitions 2
+(partition x123 values in (11, NULL),
+partition x234 values in (1 ,NULL));
+ERROR HY000: Multiple definition of same constant in list partitioning
+create table t1 (a int,b int, c int)
+partition by list(a)
+partitions 2
+(partition x123 values in (11, 12),
+partition x234 values in (5, 1));
+insert into t1 values (NULL,1,1);
+ERROR HY000: Table has no partition for value NULL
+drop table t1;
+create table t1 (a int,b int, c int)
+partition by list(a)
+partitions 2
+(partition x123 values in (11, 12),
+partition x234 values in (NULL, 1));
+insert into t1 values (11,1,6);
+insert into t1 values (NULL,1,1);
+select partition_name, partition_description, table_rows
+from information_schema.partitions where table_schema ='test';
+partition_name partition_description table_rows
+x123 11,12 1
+x234 NULL,1 1
+drop table t1;
+create table t1 (a int)
+partition by list (a)
+(partition p0 values in (1));
+alter table t1 rebuild partition;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+drop table t1;
+create table t1 (a int)
+partition by list (a)
+(partition p0 values in (5));
+insert into t1 values (0);
+ERROR HY000: Table has no partition for value 0
+drop table t1;
+create table t1 (a int)
+partition by range (a) subpartition by hash (a)
+(partition p0 values less than (100));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM) */
+alter table t1 add partition (partition p1 values less than (200)
+(subpartition subpart21));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION p0 VALUES LESS THAN (100) (SUBPARTITION p0sp0 ENGINE = MyISAM), PARTITION p1 VALUES LESS THAN (200) (SUBPARTITION subpart21 ENGINE = MyISAM)) */
+drop table t1;
+create table t1 (a int)
+partition by key (a);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) */
+alter table t1 add partition (partition p1);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM) */
+drop table t1;
+create table t1 (a int, b int)
+partition by range (a)
+subpartition by hash(a)
+(partition p0 values less than (0) (subpartition sp0),
+partition p1 values less than (1));
+ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near ')' at line 5
+create table t1 (a int, b int)
+partition by range (a)
+subpartition by hash(a)
+(partition p0 values less than (0),
+partition p1 values less than (1) (subpartition sp0));
+ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '))' at line 5
+create table t1 (a int)
+partition by hash (a)
+(partition p0 (subpartition sp0));
+ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
+create table t1 (a int)
+partition by range (a)
+(partition p0 values less than (1));
+alter table t1 add partition (partition p1 values in (2));
+ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition
+alter table t1 add partition (partition p1);
+ERROR HY000: RANGE PARTITIONING requires definition of VALUES LESS THAN for each partition
+drop table t1;
+create table t1 (a int)
+partition by list (a)
+(partition p0 values in (1));
+alter table t1 add partition (partition p1 values less than (2));
+ERROR HY000: Only RANGE PARTITIONING can use VALUES LESS THAN in partition definition
+alter table t1 add partition (partition p1);
+ERROR HY000: LIST PARTITIONING requires definition of VALUES IN for each partition
+drop table t1;
+create table t1 (a int)
+partition by hash (a)
+(partition p0);
+alter table t1 add partition (partition p1 values less than (2));
+ERROR HY000: Only RANGE PARTITIONING can use VALUES LESS THAN in partition definition
+alter table t1 add partition (partition p1 values in (2));
+ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition
+drop table t1;
+create table t1 (a int)
+partition by list (a)
+(partition p0 values in (1));
+alter table t1 rebuild partition;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+drop table t1;
+create table t2 (s1 int not null auto_increment, primary key (s1)) partition by list (s1) (partition p1 values in (1),partition p2 values in (2),partition p3 values in (3),partition p4 values in (4));
+insert into t2 values (null),(null),(null);
+select * from t2;
+s1
+1
+2
+3
+select * from t2 where s1 < 2;
+s1
+1
+update t2 set s1 = s1 + 1 order by s1 desc;
+select * from t2 where s1 < 3;
+s1
+2
+select * from t2 where s1 = 2;
+s1
+2
+drop table t2;
+create temporary table t1 (a int) partition by hash(a);
+ERROR HY000: Cannot create temporary table with partitions
+create table t1 (a int, b int) partition by list (a)
+(partition p1 values in (1), partition p2 values in (2));
+alter table t1 add primary key (b);
+ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) (PARTITION p1 VALUES IN (1) ENGINE = MyISAM, PARTITION p2 VALUES IN (2) ENGINE = MyISAM) */
+drop table t1;
+create table t1 (a int unsigned not null auto_increment primary key)
+partition by key(a);
+alter table t1 rename t2, add c char(10), comment "no comment";
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `c` char(10) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='no comment' /*!50100 PARTITION BY KEY (a) */
+drop table t2;
+create table t1 (f1 int) partition by hash (f1) as select 1;
+drop table t1;
+prepare stmt1 from 'create table t1 (s1 int) partition by hash (s1)';
+execute stmt1;
+execute stmt1;
+ERROR 42S01: Table 't1' already exists
+drop table t1;
+CREATE PROCEDURE test.p1(IN i INT)
+BEGIN
+DECLARE CONTINUE HANDLER FOR sqlexception BEGIN END;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (num INT,PRIMARY KEY(num));
+START TRANSACTION;
+INSERT INTO t1 VALUES(i);
+savepoint t1_save;
+INSERT INTO t1 VALUES (14);
+ROLLBACK to savepoint t1_save;
+COMMIT;
+END|
+CALL test.p1(12);
+Warnings:
+Note 1051 Unknown table 't1'
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+CALL test.p1(13);
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+drop table t1;
+drop procedure test.p1;
+CREATE TABLE t1 (a int not null)
+partition by key(a)
+(partition p0 COMMENT='first partition');
+drop table t1;
+CREATE TABLE t1 (`a b` int not null)
+partition by key(`a b`);
+drop table t1;
+CREATE TABLE t1 (`a b` int not null)
+partition by hash(`a b`);
+drop table t1;
+create table t1 (f1 integer) partition by range(f1)
+(partition p1 values less than (0), partition p2 values less than (10));
+insert into t1 set f1 = null;
+select * from t1 where f1 is null;
+f1
+NULL
+explain partitions select * from t1 where f1 is null;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1 system NULL NULL NULL NULL 1
+drop table t1;
+create table t1 (f1 integer) partition by list(f1)
+(partition p1 values in (1), partition p2 values in (null));
+insert into t1 set f1 = null;
+insert into t1 set f1 = 1;
+select * from t1 where f1 is null or f1 = 1;
+f1
+1
+NULL
+drop table t1;
+create table t1 (f1 smallint)
+partition by list (f1) (partition p0 values in (null));
+insert into t1 values (null);
+select * from t1 where f1 is null;
+f1
+NULL
+select * from t1 where f1 < 1;
+f1
+select * from t1 where f1 <= NULL;
+f1
+select * from t1 where f1 < NULL;
+f1
+select * from t1 where f1 >= NULL;
+f1
+select * from t1 where f1 > NULL;
+f1
+select * from t1 where f1 > 1;
+f1
+drop table t1;
+create table t1 (f1 smallint)
+partition by range (f1) (partition p0 values less than (0));
+insert into t1 values (null);
+select * from t1 where f1 is null;
+f1
+NULL
+drop table t1;
+create table t1 (f1 integer) partition by list(f1)
+(
+partition p1 values in (1),
+partition p2 values in (NULL),
+partition p3 values in (2),
+partition p4 values in (3),
+partition p5 values in (4)
+);
+insert into t1 values (1),(2),(3),(4),(null);
+select * from t1 where f1 < 3;
+f1
+1
+2
+explain partitions select * from t1 where f1 < 3;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1,p3 ALL NULL NULL NULL NULL 2 Using where
+select * from t1 where f1 is null;
+f1
+NULL
+explain partitions select * from t1 where f1 is null;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2 system NULL NULL NULL NULL 1
+drop table t1;
+create table t1 (f1 int) partition by list(f1 div 2)
+(
+partition p1 values in (1),
+partition p2 values in (NULL),
+partition p3 values in (2),
+partition p4 values in (3),
+partition p5 values in (4)
+);
+insert into t1 values (2),(4),(6),(8),(null);
+select * from t1 where f1 < 3;
+f1
+2
+explain partitions select * from t1 where f1 < 3;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1,p2,p3,p4,p5 ALL NULL NULL NULL NULL 5 Using where
+select * from t1 where f1 is null;
+f1
+NULL
+explain partitions select * from t1 where f1 is null;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2 system NULL NULL NULL NULL 1
+drop table t1;
+create table t1 (a int) partition by LIST(a) (
+partition pn values in (NULL),
+partition p0 values in (0),
+partition p1 values in (1),
+partition p2 values in (2)
+);
+insert into t1 values (NULL),(0),(1),(2);
+select * from t1 where a is null or a < 2;
+a
+NULL
+0
+1
+explain partitions select * from t1 where a is null or a < 2;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 pn,p0,p1 ALL NULL NULL NULL NULL 3 Using where
+select * from t1 where a is null or a < 0 or a > 1;
+a
+NULL
+2
+explain partitions select * from t1 where a is null or a < 0 or a > 1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 pn,p2 ALL NULL NULL NULL NULL 2 Using where
+drop table t1;
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, name VARCHAR(20))
+ENGINE=MyISAM DEFAULT CHARSET=latin1
+PARTITION BY RANGE(id)
+(PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM,
+PARTITION p1 VALUES LESS THAN (20) ENGINE = MyISAM,
+PARTITION p2 VALUES LESS THAN (30) ENGINE = MyISAM);
+SHOW TABLE STATUS;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 MyISAM 10 Dynamic 0 0 0 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
+DROP TABLE t1;
+create table t1 (a bigint unsigned)
+partition by list (a)
+(partition p0 values in (0-1));
+ERROR HY000: Partition constant is out of partition function domain
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (10));
+insert into t1 values (0xFFFFFFFFFFFFFFFF);
+ERROR HY000: Table has no partition for value 18446744073709551615
+drop table t1;
+create table t1 (a int)
+partition by list (a)
+(partition `s1 s2` values in (0));
+drop table t1;
+create table t1 (a int)
+partition by list (a)
+(partition `7` values in (0));
+drop table t1;
+create table t1 (a int)
+partition by list (a)
+(partition `s1 s2 ` values in (0));
+ERROR HY000: Incorrect partition name
+create table t1 (a int)
+partition by list (a)
+subpartition by hash (a)
+(partition p1 values in (0) (subpartition `p1 p2 `));
+ERROR HY000: Incorrect partition name
+CREATE TABLE t1 (a int)
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (NULL));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) (PARTITION p0 VALUES IN (NULL) ENGINE = MyISAM) */
+DROP TABLE t1;
+CREATE TABLE t1 (a int)
+PARTITION BY RANGE(a)
+(PARTITION p0 VALUES LESS THAN (NULL));
+ERROR 42000: Not allowed to use NULL value in VALUES LESS THAN near '))' at line 3
+create table t1 (s1 int auto_increment primary key)
+partition by list (s1)
+(partition p1 values in (1),
+partition p2 values in (2),
+partition p3 values in (3));
+insert into t1 values (null);
+insert into t1 values (null);
+insert into t1 values (null);
+select auto_increment from information_schema.tables where table_name='t1';
+auto_increment
+4
+select * from t1;
+s1
+1
+2
+3
+drop table t1;
+create table t1 (a int) engine=memory
+partition by key(a);
+insert into t1 values (1);
+create index inx1 on t1(a);
+drop table t1;
+create table t1 (a int)
+PARTITION BY KEY (a)
+(PARTITION p0);
+set session sql_mode='no_table_options';
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 PARTITION BY KEY (a) (PARTITION p0) */
+set session sql_mode='';
+drop table t1;
+create table t1 (a int)
+partition by key (a)
+(partition p0 engine = MERGE);
+ERROR HY000: Engine cannot be used in partitioned tables
+create table t1 (a varchar(1))
+partition by key (a)
+as select 'a';
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) */
+drop table t1;
+CREATE TABLE t1 (a int) ENGINE = MYISAM PARTITION BY KEY(a);
+INSERT into t1 values (1), (2);
+SHOW TABLE STATUS;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 MyISAM 10 Fixed 2 7 14 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
+DELETE from t1 where a = 1;
+SHOW TABLE STATUS;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 MyISAM 10 Fixed 1 14 14 0 0 7 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
+ALTER TABLE t1 OPTIMIZE PARTITION p0;
+SHOW TABLE STATUS;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 MyISAM 10 Fixed 1 7 7 0 1024 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
+DROP TABLE t1;
+CREATE TABLE t1 (a int, index(a)) PARTITION BY KEY(a);
+ALTER TABLE t1 DISABLE KEYS;
+ALTER TABLE t1 ENABLE KEYS;
+DROP TABLE t1;
+create table t1 (a int)
+engine=MEMORY
+partition by key (a);
+REPAIR TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 repair note The storage engine for the table doesn't support repair
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize note The storage engine for the table doesn't support optimize
+drop table t1;
+create database db99;
+use db99;
+create table t1 (a int not null)
+engine=archive
+partition by list (a)
+(partition p0 values in (1), partition p1 values in (2));
+insert into t1 values (1), (2);
+create index inx on t1 (a);
+alter table t1 add partition (partition p2 values in (3));
+alter table t1 drop partition p2;
+use test;
+drop database db99;
+drop procedure if exists mysqltest_1;
+create table t1 (a int)
+partition by list (a)
+(partition p0 values in (0));
+insert into t1 values (0);
+create procedure mysqltest_1 ()
+begin
+begin
+declare continue handler for sqlexception begin end;
+update ignore t1 set a = 1 where a = 0;
+end;
+prepare stmt1 from 'alter table t1';
+execute stmt1;
+end//
+call mysqltest_1()//
+drop table t1;
+drop procedure mysqltest_1;
+create table t1 (a int, index(a))
+partition by hash(a);
+insert into t1 values (1),(2);
+select * from t1 ORDER BY a DESC;
+a
+2
+1
+drop table t1;
+create table t1 (a int) engine myisam
+partition by range (a)
+subpartition by hash (a)
+(partition p0 VALUES LESS THAN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpdata' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpinx'
+(SUBPARTITION subpart00, SUBPARTITION subpart01));
+Checking if file exists before alter
+ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
+(partition p1 VALUES LESS THAN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpdata' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpinx'
+(SUBPARTITION subpart10, SUBPARTITION subpart11),
+partition p2 VALUES LESS THAN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpdata' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpinx'
+(SUBPARTITION subpart20, SUBPARTITION subpart21));
+Checking if file exists after alter
+drop table t1;
+create table t1 (a bigint unsigned not null, primary key(a))
+engine = myisam
+partition by key (a)
+partitions 10;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) PARTITIONS 10 */
+insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE),
+(18446744073709551613), (18446744073709551612);
+select * from t1;
+a
+18446744073709551612
+18446744073709551613
+18446744073709551614
+18446744073709551615
+select * from t1 where a = 18446744073709551615;
+a
+18446744073709551615
+delete from t1 where a = 18446744073709551615;
+select * from t1;
+a
+18446744073709551612
+18446744073709551613
+18446744073709551614
+drop table t1;
+End of 5.1 tests
diff --git a/mysql-test/r/partition_02myisam.result b/mysql-test/r/partition_02myisam.result
new file mode 100644
index 00000000000..55263e4f8ce
--- /dev/null
+++ b/mysql-test/r/partition_02myisam.result
@@ -0,0 +1,1725 @@
+SET SESSION storage_engine='MYISAM';
+SET @max_row = 200;
+SET AUTOCOMMIT= 1;
+
+#------------------------------------------------------------------------
+# There are several testcases disabled because ouf the open bugs
+# #15407 , #15408 , #15890 , #15961 , #13447 , #15966 , #15968, #16370
+#------------------------------------------------------------------------
+
+#------------------------------------------------------------------------
+# 0. Setting of auxiliary variables + Creation of an auxiliary table
+# needed in all testcases
+#------------------------------------------------------------------------
+DROP TABLE IF EXISTS t0_template;
+CREATE TABLE t0_template ( f1 INTEGER, f2 char(20), PRIMARY KEY(f1))
+ENGINE = MEMORY;
+# Logging of <max_row> INSERTs into t0_template suppressed
+
+#------------------------------------------------------------------------
+# 1. Some syntax checks
+#------------------------------------------------------------------------
+# 1.1 Subpartioned table without subpartitioning rule must be rejected
+DROP TABLE IF EXISTS t1;
+# FIXME Implement testcases, where it is checked that all create and
+# alter table statements
+# - with missing mandatory parameters are rejected
+# - with optional parameters are accepted
+# - with wrong combinations of optional parameters are rejected
+# - ............
+
+#------------------------------------------------------------------------
+# 2. Checks where the engine is assigned on all supported (CREATE TABLE
+# statement) positions + basic operations on the tables
+# Storage engine mixups are currently (2005-12-23) not supported
+#------------------------------------------------------------------------
+DROP TABLE IF EXISTS t1;
+# 2.1 non partitioned table (for comparison)
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20)) ENGINE = 'MYISAM';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 2.2 Assignment of storage engine just after column list only
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20)) ENGINE = 'MYISAM'
+PARTITION BY HASH(f1) PARTITIONS 2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) PARTITIONS 2 */
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 2.3 Assignment of storage engine just after partition or subpartition
+# name only
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1)
+( PARTITION part1 STORAGE ENGINE = 'MYISAM',
+PARTITION part2 STORAGE ENGINE = 'MYISAM'
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) */
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1)
+( PARTITION part1 VALUES LESS THAN (100)
+(SUBPARTITION subpart11 STORAGE ENGINE = 'MYISAM',
+SUBPARTITION subpart12 STORAGE ENGINE = 'MYISAM'),
+PARTITION part2 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart21 STORAGE ENGINE = 'MYISAM',
+SUBPARTITION subpart22 STORAGE ENGINE = 'MYISAM')
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) */
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 2.4 Some but not all named partitions or subpartitions get a storage
+# engine assigned
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1)
+( PARTITION part1 STORAGE ENGINE = 'MYISAM',
+PARTITION part2
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) */
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1)
+( PARTITION part1 ,
+PARTITION part2 STORAGE ENGINE = 'MYISAM'
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) */
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1)
+( PARTITION part1 VALUES LESS THAN (100)
+(SUBPARTITION subpart11,
+SUBPARTITION subpart12 STORAGE ENGINE = 'MYISAM'),
+PARTITION part2 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart21 STORAGE ENGINE = 'MYISAM',
+SUBPARTITION subpart22 STORAGE ENGINE = 'MYISAM')
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) */
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1)
+( PARTITION part1 VALUES LESS THAN (100)
+(SUBPARTITION subpart11 STORAGE ENGINE = 'MYISAM',
+SUBPARTITION subpart12 STORAGE ENGINE = 'MYISAM'),
+PARTITION part2 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart21,
+SUBPARTITION subpart22 )
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) */
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 2.5 Storage engine assignment after partition name + after name of
+# subpartitions belonging to another partition
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1)
+( PARTITION part1 VALUES LESS THAN (100) ENGINE = 'MYISAM'
+(SUBPARTITION subpart11,
+SUBPARTITION subpart12),
+PARTITION part2 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart21 STORAGE ENGINE = 'MYISAM',
+SUBPARTITION subpart22 STORAGE ENGINE = 'MYISAM')
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) */
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1)
+( PARTITION part1 VALUES LESS THAN (100)
+(SUBPARTITION subpart11 STORAGE ENGINE = 'MYISAM',
+SUBPARTITION subpart12 STORAGE ENGINE = 'MYISAM'),
+PARTITION part2 VALUES LESS THAN (2147483647) ENGINE = 'MYISAM'
+(SUBPARTITION subpart21,
+SUBPARTITION subpart22)
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) */
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 2.6 Precedence of storage engine assignments
+# 2.6.1 Storage engine assignment after column list + after partition
+# or subpartition name
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20)) ENGINE = 'MYISAM'
+PARTITION BY HASH(f1)
+( PARTITION part1 STORAGE ENGINE = 'MYISAM',
+PARTITION part2 STORAGE ENGINE = 'MYISAM'
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) */
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20)) ENGINE = 'MYISAM'
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1)
+( PARTITION part1 VALUES LESS THAN (100)
+(SUBPARTITION subpart11 STORAGE ENGINE = 'MYISAM',
+SUBPARTITION subpart12 STORAGE ENGINE = 'MYISAM'),
+PARTITION part2 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart21 STORAGE ENGINE = 'MYISAM',
+SUBPARTITION subpart22 STORAGE ENGINE = 'MYISAM')
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) */
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 2.6.2 Storage engine assignment after partition name + after
+# subpartition name
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1)
+( PARTITION part1 VALUES LESS THAN (100) STORAGE ENGINE = 'MYISAM'
+(SUBPARTITION subpart11 STORAGE ENGINE = 'MYISAM',
+SUBPARTITION subpart12 STORAGE ENGINE = 'MYISAM'),
+PARTITION part2 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart21 STORAGE ENGINE = 'MYISAM',
+SUBPARTITION subpart22 STORAGE ENGINE = 'MYISAM')
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) */
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 2.7 Session default engine differs from engine used within create table
+SET SESSION storage_engine='MEMORY';
+SET SESSION storage_engine='MYISAM';
+
+#------------------------------------------------------------------------
+# 3. Check assigning the number of partitions and subpartitions
+# with and without named partitions/subpartitions
+#------------------------------------------------------------------------
+DROP TABLE IF EXISTS t1;
+# 3.1 (positive) without partition/subpartition number assignment
+# 3.1.1 no partition number, no named partitions
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) */
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 3.1.2 no partition number, named partitions
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) (PARTITION part1, PARTITION part2);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) */
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 3.1.3 variations on no partition/subpartition number, named partitions,
+# different subpartitions are/are not named
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1) (PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (200), PARTITION part3 VALUES LESS THAN (2147483647)) ;
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1) (PARTITION part1 VALUES LESS THAN (100)
+(SUBPARTITION subpart11 , SUBPARTITION subpart12 ), PARTITION part2 VALUES LESS THAN (200)
+(SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart31 , SUBPARTITION subpart32 )) ;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (200) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (2147483647) (SUBPARTITION subpart31 ENGINE = MyISAM, SUBPARTITION subpart32 ENGINE = MyISAM)) */
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 3.2 partition/subpartition numbers good and bad values and notations
+DROP TABLE IF EXISTS t1;
+# 3.2.1 partition/subpartition numbers INTEGER notation
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS 2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) PARTITIONS 2 */
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS 2
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (2147483647));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) SUBPARTITIONS 2 (PARTITION part1 VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION part2 VALUES LESS THAN (2147483647) ENGINE = MyISAM) */
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS 1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) PARTITIONS 1 */
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS 1
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (2147483647));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) SUBPARTITIONS 1 (PARTITION part1 VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION part2 VALUES LESS THAN (2147483647) ENGINE = MyISAM) */
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS 0;
+ERROR HY000: Number of partitions = 0 is not an allowed value
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS 0
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR HY000: Number of subpartitions = 0 is not an allowed value
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS -1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS -1
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (21' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS 1000000;
+ERROR HY000: Too many partitions (including subpartitions) were defined
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS 1000000
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR HY000: Too many partitions (including subpartitions) were defined
+# 3.2.4 partition/subpartition numbers STRING notation
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS '2';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2'' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS '2'
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2'
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (2' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS '2.0';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2.0'' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS '2.0'
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2.0'
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN ' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS '0.2E+1';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''0.2E+1'' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS '0.2E+1'
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''0.2E+1'
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS TH' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS '2A';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2A'' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS '2A'
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2A'
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS 'A2';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''A2'' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS 'A2'
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''A2'
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS '';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS ''
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (21' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS 'GARBAGE';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''GARBAGE'' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS 'GARBAGE'
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''GARBAGE'
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS T' at line 3
+# 3.2.5 partition/subpartition numbers other notations
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS 2A;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2A' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS 2A
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2A
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (21' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS A2;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'A2' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS A2
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'A2
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (21' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS GARBAGE;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GARBAGE' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS GARBAGE
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GARBAGE
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THA' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS "2";
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"2"' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS "2"
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"2"
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (2' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS "2A";
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"2A"' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS "2A"
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"2A"
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS "A2";
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"A2"' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS "A2"
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"A2"
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS "GARBAGE";
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"GARBAGE"' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS "GARBAGE"
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"GARBAGE"
+(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS T' at line 3
+# 3.3 Mixups of assigned partition/subpartition numbers and names
+# 3.3.1 (positive) number of partition/subpartition
+# = number of named partition/subpartition
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS 2 ( PARTITION part1, PARTITION part2 ) ;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) */
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) PARTITIONS 2
+SUBPARTITION BY HASH(f1) SUBPARTITIONS 2
+( PARTITION part1 VALUES LESS THAN (1000)
+(SUBPARTITION subpart11, SUBPARTITION subpart12),
+PARTITION part2 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart21, SUBPARTITION subpart22)
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (1000) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) */
+DROP TABLE t1;
+# 3.3.2 (positive) number of partition/subpartition ,
+# 0 (= no) named partition/subpartition
+# already checked above
+# 3.3.3 (negative) number of partitions/subpartitions
+# > number of named partitions/subpartitions
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS 2 ( PARTITION part1 ) ;
+ERROR 42000: Wrong number of partitions defined, mismatch with previous setting near ')' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1) SUBPARTITIONS 2
+( PARTITION part1 VALUES LESS THAN (1000)
+(SUBPARTITION subpart11 ),
+PARTITION part2 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart21, SUBPARTITION subpart22)
+);
+ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
+PARTITION part2 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart21, SUBPAR' at line 5
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1) SUBPARTITIONS 2
+( PARTITION part1 VALUES LESS THAN (1000)
+(SUBPARTITION subpart11, SUBPARTITION subpart12),
+PARTITION part2 VALUES LESS THAN (2000)
+(SUBPARTITION subpart21 ),
+PARTITION part3 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart31, SUBPARTITION subpart32)
+);
+ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
+PARTITION part3 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart31, SUBPAR' at line 7
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) PARTITIONS 2
+SUBPARTITION BY HASH(f1) SUBPARTITIONS 2
+( PARTITION part1 VALUES LESS THAN (1000)
+(SUBPARTITION subpart11, SUBPARTITION subpart12),
+PARTITION part2 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart21 )
+);
+ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near ')
+)' at line 7
+# 3.3.4 (negative) number of partitions < number of named partitions
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS 1 ( PARTITION part1, PARTITION part2 ) ;
+ERROR 42000: Wrong number of partitions defined, mismatch with previous setting near ')' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1) SUBPARTITIONS 1
+( PARTITION part1 VALUES LESS THAN (1000)
+(SUBPARTITION subpart11, SUBPARTITION subpart12),
+PARTITION part2 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart21, SUBPARTITION subpart22)
+);
+ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
+PARTITION part2 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart21, SUBPAR' at line 5
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1) SUBPARTITIONS 1
+( PARTITION part1 VALUES LESS THAN (1000)
+(SUBPARTITION subpart11, SUBPARTITION subpart12),
+PARTITION part2 VALUES LESS THAN (2000)
+(SUBPARTITION subpart21 ),
+PARTITION part3 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart31, SUBPARTITION subpart32)
+);
+ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
+PARTITION part2 VALUES LESS THAN (2000)
+(SUBPARTITION subpart21 ' at line 5
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1) SUBPARTITIONS 1
+( PARTITION part1 VALUES LESS THAN (1000)
+(SUBPARTITION subpart11, SUBPARTITION subpart12),
+PARTITION part2 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart21, SUBPARTITION subpart22)
+);
+ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
+PARTITION part2 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart21, SUBPAR' at line 5
+
+#------------------------------------------------------------------------
+# 4. Checks of logical partition/subpartition name
+# file name clashes during CREATE TABLE
+#------------------------------------------------------------------------
+DROP TABLE IF EXISTS t1;
+# 4.1 (negative) A partition name used more than once
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) (PARTITION part1, PARTITION part1);
+ERROR HY000: Duplicate partition name part1
+# FIXME Implement testcases with filename problems
+# existing file of other table --- partition/subpartition file name
+# partition/subpartition file name --- file of the same table
+
+#------------------------------------------------------------------------
+# 5. Alter table experiments
+#------------------------------------------------------------------------
+DROP TABLE IF EXISTS t1;
+# 5.1 alter table add partition
+# 5.1.1 (negative) add partition to non partitioned table
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1 ADD PARTITION (PARTITION part1);
+Got one of the listed errors
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+# 5.1.2 Add one partition to a table with one partition
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) */
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 100 - 1;
+ALTER TABLE t1 ADD PARTITION (PARTITION part1);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM) */
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 100 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 5.1.3 Several times add one partition to a table with some partitions
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) (PARTITION part1, PARTITION part3);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM) */
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 100 - 1;
+ALTER TABLE t1 ADD PARTITION (PARTITION part0);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM, PARTITION part0 ENGINE = MyISAM) */
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 100 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1;
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 100 - 1;
+ALTER TABLE t1 ADD PARTITION (PARTITION part2);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM, PARTITION part0 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) */
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 100 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1;
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 100 - 1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM, PARTITION part0 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) */
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 100 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 5.1.4 Add several partitions to a table with some partitions
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) (PARTITION part1, PARTITION part3);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM) */
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 100 - 1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM) */
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 100 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 5.1.5 (negative) Add partitions to a table with some partitions
+# clash on new and already existing partition names
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) (PARTITION part1, PARTITION part2, PARTITION part3);
+ALTER TABLE t1 ADD PARTITION (PARTITION part1);
+ERROR HY000: Duplicate partition name part1
+ALTER TABLE t1 ADD PARTITION (PARTITION part2);
+ERROR HY000: Duplicate partition name part2
+ALTER TABLE t1 ADD PARTITION (PARTITION part3);
+ERROR HY000: Duplicate partition name part3
+ALTER TABLE t1 ADD PARTITION (PARTITION part1, PARTITION part2, PARTITION part3);
+ERROR HY000: Duplicate partition name part1
+DROP TABLE t1;
+# 5.2 alter table add subpartition
+# 5.2.1 Add one subpartition to a table with subpartitioning rule and
+# no explicit defined subpartitions
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1)
+(PARTITION part1 VALUES LESS THAN (100));
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 100 - 1;
+ALTER TABLE t1 ADD PARTITION (PARTITION part2 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart21));
+DROP TABLE t1;
+DROP TABLE if exists t0_template;
diff --git a/mysql-test/r/partition_03ndb.result b/mysql-test/r/partition_03ndb.result
new file mode 100644
index 00000000000..28339cc7435
--- /dev/null
+++ b/mysql-test/r/partition_03ndb.result
@@ -0,0 +1,1361 @@
+SET SESSION storage_engine='NDB' ;
+SET @max_row = 200;
+SET AUTOCOMMIT= 1;
+#------------------------------------------------------------------------
+# 0. Creation of an auxiliary table needed in all testcases
+#------------------------------------------------------------------------
+DROP TABLE IF EXISTS t0_template;
+CREATE TABLE t0_template ( f1 INTEGER, f2 char(20), PRIMARY KEY(f1))
+ENGINE = MEMORY;
+# Logging of 200 INSERTs into t0_template suppressed
+#------------------------------------------------------------------------
+# 1. Some syntax checks
+#------------------------------------------------------------------------
+# 1.1 Subpartioned table without subpartitioning rule must be rejected
+DROP TABLE IF EXISTS t1;
+#------------------------------------------------------------------------
+# 2. Checks where the engine is set on all supported CREATE TABLE
+# statement positions + basic operations on the tables
+#------------------------------------------------------------------------
+DROP TABLE IF EXISTS t1;
+# 2.1 table (non partitioned) for comparison
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20)) ENGINE = 'NDB' ;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) default NULL,
+ `f2` char(20) default NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY ()
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 2.2 table with engine setting just after column list
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20)) ENGINE = 'NDB'
+PARTITION BY HASH(f1) PARTITIONS 2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) default NULL,
+ `f2` char(20) default NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) PARTITIONS 2
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 2.3 table with engine setting in the named partition part
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1)
+( PARTITION part1 STORAGE ENGINE = 'NDB' ,
+PARTITION part2 STORAGE ENGINE = 'NDB'
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) default NULL,
+ `f2` char(20) default NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = ndbcluster, PARTITION part2 ENGINE = ndbcluster)
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 2.4 table with engine setting in the named subpartition part
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1)
+( PARTITION part1 VALUES LESS THAN (1000)
+(SUBPARTITION subpart11 STORAGE ENGINE = 'NDB' ,
+SUBPARTITION subpart12 STORAGE ENGINE = 'NDB' ),
+PARTITION part2 VALUES LESS THAN (2000)
+(SUBPARTITION subpart21 STORAGE ENGINE = 'NDB' ,
+SUBPARTITION subpart22 STORAGE ENGINE = 'NDB' )
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) default NULL,
+ `f2` char(20) default NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (1000) (SUBPARTITION subpart11 ENGINE = ndbcluster, SUBPARTITION subpart12 ENGINE = ndbcluster), PARTITION part2 VALUES LESS THAN (2000) (SUBPARTITION subpart21 ENGINE = ndbcluster, SUBPARTITION subpart22 ENGINE = ndbcluster))
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 2.5 Ugly "incomplete" storage engine assignments
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1)
+( PARTITION part1 STORAGE ENGINE = 'NDB' ,
+PARTITION part2
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) default NULL,
+ `f2` char(20) default NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = ndbcluster, PARTITION part2 ENGINE = ndbcluster)
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1)
+( PARTITION part1 ,
+PARTITION part2 STORAGE ENGINE = 'NDB'
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) default NULL,
+ `f2` char(20) default NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = ndbcluster, PARTITION part2 ENGINE = ndbcluster)
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1)
+( PARTITION part1 VALUES LESS THAN (1000)
+(SUBPARTITION subpart11,
+SUBPARTITION subpart12 STORAGE ENGINE = 'NDB' ),
+PARTITION part2 VALUES LESS THAN (2000)
+(SUBPARTITION subpart21 STORAGE ENGINE = 'NDB' ,
+SUBPARTITION subpart22 STORAGE ENGINE = 'NDB' )
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) default NULL,
+ `f2` char(20) default NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (1000) (SUBPARTITION subpart11 ENGINE = ndbcluster, SUBPARTITION subpart12 ENGINE = ndbcluster), PARTITION part2 VALUES LESS THAN (2000) (SUBPARTITION subpart21 ENGINE = ndbcluster, SUBPARTITION subpart22 ENGINE = ndbcluster))
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1)
+( PARTITION part1 VALUES LESS THAN (1000)
+(SUBPARTITION subpart11 STORAGE ENGINE = 'NDB' ,
+SUBPARTITION subpart12 STORAGE ENGINE = 'NDB' ),
+PARTITION part2 VALUES LESS THAN (2000)
+(SUBPARTITION subpart21 ,
+SUBPARTITION subpart22 )
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) default NULL,
+ `f2` char(20) default NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (1000) (SUBPARTITION subpart11 ENGINE = ndbcluster, SUBPARTITION subpart12 ENGINE = ndbcluster), PARTITION part2 VALUES LESS THAN (2000) (SUBPARTITION subpart21 ENGINE = ndbcluster, SUBPARTITION subpart22 ENGINE = ndbcluster))
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 2.6 Ugly "over determined" storage engine assignments
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20)) ENGINE = 'NDB'
+PARTITION BY HASH(f1)
+( PARTITION part1 STORAGE ENGINE = 'NDB' ,
+PARTITION part2 STORAGE ENGINE = 'NDB'
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) default NULL,
+ `f2` char(20) default NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = ndbcluster, PARTITION part2 ENGINE = ndbcluster)
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20)) ENGINE = 'NDB'
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1)
+( PARTITION part1 VALUES LESS THAN (1000)
+(SUBPARTITION subpart11 STORAGE ENGINE = 'NDB' ,
+SUBPARTITION subpart12 STORAGE ENGINE = 'NDB' ),
+PARTITION part2 VALUES LESS THAN (2000)
+(SUBPARTITION subpart21 STORAGE ENGINE = 'NDB' ,
+SUBPARTITION subpart22 STORAGE ENGINE = 'NDB' )
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) default NULL,
+ `f2` char(20) default NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (1000) (SUBPARTITION subpart11 ENGINE = ndbcluster, SUBPARTITION subpart12 ENGINE = ndbcluster), PARTITION part2 VALUES LESS THAN (2000) (SUBPARTITION subpart21 ENGINE = ndbcluster, SUBPARTITION subpart22 ENGINE = ndbcluster))
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1)
+( PARTITION part1 VALUES LESS THAN (1000) STORAGE ENGINE = 'NDB'
+(SUBPARTITION subpart11 STORAGE ENGINE = 'NDB' ,
+SUBPARTITION subpart12 STORAGE ENGINE = 'NDB' ),
+PARTITION part2 VALUES LESS THAN (2000)
+(SUBPARTITION subpart21 STORAGE ENGINE = 'NDB' ,
+SUBPARTITION subpart22 STORAGE ENGINE = 'NDB' )
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) default NULL,
+ `f2` char(20) default NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (1000) (SUBPARTITION subpart11 ENGINE = ndbcluster, SUBPARTITION subpart12 ENGINE = ndbcluster), PARTITION part2 VALUES LESS THAN (2000) (SUBPARTITION subpart21 ENGINE = ndbcluster, SUBPARTITION subpart22 ENGINE = ndbcluster))
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 2.7 Ugly storage engine assignments mixups
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1)
+( PARTITION part1 VALUES LESS THAN (1000) ENGINE = 'NDB'
+(SUBPARTITION subpart11 ,
+SUBPARTITION subpart12 ),
+PARTITION part2 VALUES LESS THAN (2000)
+(SUBPARTITION subpart21 STORAGE ENGINE = 'NDB' ,
+SUBPARTITION subpart22 STORAGE ENGINE = 'NDB' )
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) default NULL,
+ `f2` char(20) default NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (1000) (SUBPARTITION subpart11 ENGINE = ndbcluster, SUBPARTITION subpart12 ENGINE = ndbcluster), PARTITION part2 VALUES LESS THAN (2000) (SUBPARTITION subpart21 ENGINE = ndbcluster, SUBPARTITION subpart22 ENGINE = ndbcluster))
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1)
+( PARTITION part1 VALUES LESS THAN (1000)
+(SUBPARTITION subpart11 STORAGE ENGINE = 'NDB' ,
+SUBPARTITION subpart12 STORAGE ENGINE = 'NDB' ),
+PARTITION part2 VALUES LESS THAN (2000) ENGINE = 'NDB'
+(SUBPARTITION subpart21 ,
+SUBPARTITION subpart22 )
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) default NULL,
+ `f2` char(20) default NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (1000) (SUBPARTITION subpart11 ENGINE = ndbcluster, SUBPARTITION subpart12 ENGINE = ndbcluster), PARTITION part2 VALUES LESS THAN (2000) (SUBPARTITION subpart21 ENGINE = ndbcluster, SUBPARTITION subpart22 ENGINE = ndbcluster))
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 2.8 Session default engine differs from engine used within create table
+SET SESSION storage_engine='MEMORY';
+SET SESSION storage_engine='NDB' ;
+#------------------------------------------------------------------------
+# 3. Check number of partitions and subpartitions
+#------------------------------------------------------------------------
+DROP TABLE IF EXISTS t1;
+# 3.1 (positive) without partition/subpartition number assignment
+# 3.1.1 no partition number, no named partitions, no subpartitions mentioned
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) default NULL,
+ `f2` char(20) default NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (f1)
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 3.1.2 no partition number, named partitions, no subpartitions mentioned
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) (PARTITION part1, PARTITION part2);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) default NULL,
+ `f2` char(20) default NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = ndbcluster, PARTITION part2 ENGINE = ndbcluster)
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 3.1.3 variations on no partition/subpartition number, named partitions,
+# different subpartitions are/are not named
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1) (PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2000), PARTITION part3 VALUES LESS THAN (2147483647)) ;
+DROP TABLE t1;
+# FIXME several subtestcases of 3.1.3 disabled because of server crashes
+# Bug#15407 Partitions: crash if subpartition
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1) (PARTITION part1 VALUES LESS THAN (1000)
+(SUBPARTITION subpart11 , SUBPARTITION subpart12 ), PARTITION part2 VALUES LESS THAN (2000)
+(SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart21 , SUBPARTITION subpart22 )) ;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) default NULL,
+ `f2` char(20) default NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (1000) (SUBPARTITION subpart11 ENGINE = ndbcluster, SUBPARTITION subpart12 ENGINE = ndbcluster), PARTITION part2 VALUES LESS THAN (2000) (SUBPARTITION subpart21 ENGINE = ndbcluster, SUBPARTITION subpart22 ENGINE = ndbcluster), PARTITION part3 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = ndbcluster, SUBPARTITION subpart22 ENGINE = ndbcluster))
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+# 3.2 partition/subpartition numbers good and bad values and notations
+DROP TABLE IF EXISTS t1;
+# 3.2.1 partition/subpartition numbers INTEGER notation
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS 2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) default NULL,
+ `f2` char(20) default NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) PARTITIONS 2
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS 2
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2147483647));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) default NULL,
+ `f2` char(20) default NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) SUBPARTITIONS 2 (PARTITION part1 VALUES LESS THAN (1000) , PARTITION part2 VALUES LESS THAN (2147483647) )
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS 1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) default NULL,
+ `f2` char(20) default NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) PARTITIONS 1
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS 1
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2147483647));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) default NULL,
+ `f2` char(20) default NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) SUBPARTITIONS 1 (PARTITION part1 VALUES LESS THAN (1000) , PARTITION part2 VALUES LESS THAN (2147483647) )
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 200;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+UPDATE t1 SET f1 = f1 + 200
+WHERE f1 BETWEEN 100 - 50 AND 100 + 50;
+SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 100 + 50 + 200 )
+AS my_value FROM t1;
+my_value
+1
+DELETE FROM t1
+WHERE f1 BETWEEN 100 - 50 + 200 AND 100 + 50 + 200;
+SELECT (COUNT(*) = 200 - 50 - 50 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
+AS my_value FROM t1;
+my_value
+1
+INSERT INTO t1 SET f1 = 0 , f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
+my_value
+1
+INSERT INTO t1 SET f1 = 200 + 1, f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 1 AND f2 = '#######';
+my_value
+1
+UPDATE t1 SET f1 = 200 + 2, f2 = 'ZZZZZZZ'
+ WHERE f1 = 0 AND f2 = '#######';
+SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+my_value
+1
+DELETE FROM t1 WHERE f1 = 200 + 2 AND f2 = 'ZZZZZZZ';
+SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
+my_value
+1
+TRUNCATE t1;
+SELECT COUNT(*) = 0 AS my_value FROM t1;
+my_value
+1
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS 0;
+ERROR HY000: Number of partitions = 0 is not an allowed value
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS 0
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR HY000: Number of subpartitions = 0 is not an allowed value
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS -1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS -1
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS 1000000;
+ERROR HY000: Too many partitions were defined
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS 1000000
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR HY000: Too many partitions were defined
+# 3.2.4 partition/subpartition numbers STRING notation
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS '2';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2'' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS '2'
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2'
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS '2.0';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2.0'' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS '2.0'
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2.0'
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS '0.2E+1';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''0.2E+1'' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS '0.2E+1'
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''0.2E+1'
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS T' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS '2A';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2A'' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS '2A'
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2A'
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN ' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS 'A2';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''A2'' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS 'A2'
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''A2'
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN ' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS '';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS ''
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS 'GARBAGE';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''GARBAGE'' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS 'GARBAGE'
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''GARBAGE'
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS ' at line 3
+# 3.2.5 partition/subpartition numbers other notations
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS 2A;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2A' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS 2A
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2A
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS A2;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'A2' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS A2
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'A2
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS GARBAGE;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GARBAGE' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS GARBAGE
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GARBAGE
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS TH' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS "2";
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"2"' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS "2"
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"2"
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS "2A";
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"2A"' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS "2A"
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"2A"
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN ' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS "A2";
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"A2"' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS "A2"
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"A2"
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN ' at line 3
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS "GARBAGE";
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"GARBAGE"' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
+SUBPARTITIONS "GARBAGE"
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS THAN (2147483647));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"GARBAGE"
+(PARTITION part1 VALUES LESS THAN (1000), PARTITION part2 VALUES LESS ' at line 3
+# 3.3 Mixups of number and names of partition/subpartition assigned
+# 3.3.1 (positive) number of partition/subpartition = number of named partition/subpartition
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS 2 ( PARTITION part1, PARTITION part2 ) ;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) default NULL,
+ `f2` char(20) default NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = ndbcluster, PARTITION part2 ENGINE = ndbcluster)
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) PARTITIONS 2
+SUBPARTITION BY HASH(f1) SUBPARTITIONS 2
+( PARTITION part1 VALUES LESS THAN (1000)
+(SUBPARTITION subpart11, SUBPARTITION subpart12),
+PARTITION part2 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart21, SUBPARTITION subpart22)
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) default NULL,
+ `f2` char(20) default NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (1000) (SUBPARTITION subpart11 ENGINE = ndbcluster, SUBPARTITION subpart12 ENGINE = ndbcluster), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = ndbcluster, SUBPARTITION subpart22 ENGINE = ndbcluster))
+DROP TABLE t1;
+# 3.3.2 (positive) number of partition/subpartition , 0 (= no) named partition/subpartition
+# already checked above
+# 3.3.3 (negative) number of partitions > number of named partitions
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) PARTITIONS 2 ( PARTITION part1 ) ;
+ERROR 42000: Wrong number of partitions defined, mismatch with previous setting near ')' at line 2
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1) SUBPARTITIONS 2
+( PARTITION part1 VALUES LESS THAN (1000)
+(SUBPARTITION subpart11 ),
+PARTITION part2 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart21, SUBPARTITION subpart22)
+);
+ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
+PARTITION part2 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart21, SUBPAR' at line 5
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1)
+SUBPARTITION BY HASH(f1) SUBPARTITIONS 2
+( PARTITION part1 VALUES LESS THAN (1000)
+(SUBPARTITION subpart11, SUBPARTITION subpart12),
+PARTITION part2 VALUES LESS THAN (2000)
+(SUBPARTITION subpart21 ),
+PARTITION part3 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart31, SUBPARTITION subpart32)
+);
+ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
+PARTITION part3 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart31, SUBPAR' at line 7
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY RANGE(f1) PARTITIONS 2
+SUBPARTITION BY HASH(f1) SUBPARTITIONS 2
+( PARTITION part1 VALUES LESS THAN (1000)
+(SUBPARTITION subpart11, SUBPARTITION subpart12),
+PARTITION part2 VALUES LESS THAN (2147483647)
+(SUBPARTITION subpart21 )
+);
+ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near ')
+)' at line 7
+#------------------------------------------------------------------------
+# 4. Checks of logical partition/subpartition name
+# file name clashes during CREATE TABLE
+#------------------------------------------------------------------------
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1) (PARTITION part1, PARTITION part1);
+ERROR HY000: Duplicate partition name part1
+#------------------------------------------------------------------------
+# 5. Alter table experiments
+#------------------------------------------------------------------------
+# 5.1 alter table add partition
+# 5.1.1 (negative) add partition to non partitioned table
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20));
+# FIXME Why does the error numbers of MyISAM(1482) and NDB(1005) differ ?
+ALTER TABLE t1 ADD PARTITION (PARTITION part1);
+Got one of the listed errors
+DROP TABLE t1;
+# 5.1.2 Add one partition to a table with one partition
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
+PARTITION BY HASH(f1);
+INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 100;
diff --git a/mysql-test/r/partition_charset.result b/mysql-test/r/partition_charset.result
new file mode 100644
index 00000000000..665e5d55f8f
--- /dev/null
+++ b/mysql-test/r/partition_charset.result
@@ -0,0 +1,18 @@
+drop table if exists t1;
+set names utf8;
+create table t1 (s1 int)
+partition by list (s1)
+(partition c values in (1),
+partition Ç values in (3));
+insert into t1 values (1),(3);
+select * from t1;
+s1
+1
+3
+flush tables;
+set names latin1;
+select * from t1;
+s1
+1
+3
+drop table t1;
diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result
new file mode 100644
index 00000000000..4b01b759902
--- /dev/null
+++ b/mysql-test/r/partition_error.result
@@ -0,0 +1,622 @@
+drop table if exists t1;
+partition by list (a)
+partitions 3
+(partition x1 values in (1,2,9,4) tablespace ts1,
+partition x2 values in (3, 11, 5, 7) tablespace ts2,
+partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
+ERROR 42000: Partitioning can not be used stand-alone in query near 'partition by list (a)
+partitions 3
+(partition x1 values in (1,2,9,4) tablespace ' at line 1
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a)
+partitions 2;
+ERROR HY000: For LIST partitions each partition must be defined
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (sin(a))
+partitions 3
+(partition x1 values in (1,2,9,4) tablespace ts1,
+partition x2 values in (3, 11, 5, 7) tablespace ts2,
+partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
+ERROR HY000: The PARTITION function returns the wrong type
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by key (a+2)
+partitions 3
+(partition x1 tablespace ts1,
+partition x2 tablespace ts2,
+partition x3 tablespace ts3);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '+2)
+partitions 3
+(partition x1 tablespace ts1,
+partition x2 tablespace ts2,
+part' at line 6
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by key (a)
+partitions 3
+(partition tablespace ts1,
+partition x2 tablespace ts2,
+partition x3 tablespace ts3);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ts1,
+partition x2 tablespace ts2,
+partition x3 tablespace ts3)' at line 8
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by key (a,d)
+partitions 3
+(partition x1 tablespace ts1,
+partition x2 tablespace ts2,
+partition x3 tablespace ts3);
+ERROR HY000: Field in list of fields for partition function not found in table
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by hash (a + d)
+partitions 3
+(partition x1 tablespace ts1,
+partition x2 tablespace ts2,
+partition x3 tablespace ts3);
+ERROR 42S22: Unknown column 'd' in 'partition function'
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by hash (sin(a))
+partitions 3
+(partition x1 tablespace ts1,
+partition x2 tablespace ts2,
+partition x3 tablespace ts3);
+ERROR HY000: The PARTITION function returns the wrong type
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by key (a)
+partitions 3
+(partition x1, partition x2);
+ERROR 42000: Wrong number of partitions defined, mismatch with previous setting near ')' at line 8
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by hash (rand(a))
+partitions 2
+(partition x1, partition x2);
+ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')
+partitions 2
+(partition x1, partition x2)' at line 6
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (rand(a))
+partitions 2
+(partition x1 values less than (0), partition x2 values less than (2));
+ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')
+partitions 2
+(partition x1 values less than (0), partition x2 values less than' at line 6
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (rand(a))
+partitions 2
+(partition x1 values in (1), partition x2 values in (2));
+ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')
+partitions 2
+(partition x1 values in (1), partition x2 values in (2))' at line 6
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by hash (a)
+partitions 2
+(partition x1 values less than (4),
+partition x2 values less than (5));
+ERROR HY000: Only RANGE PARTITIONING can use VALUES LESS THAN in partition definition
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by hash (a)
+partitions 2
+(partition x1 values in (4),
+partition x2 values in (5));
+ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by hash (a)
+partitions 2
+(partition x1 values in (4,6),
+partition x2 values in (5,7));
+ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by key (a)
+subpartition by key (b);
+ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by key (a)
+subpartition by key (a, b);
+ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by key (a)
+subpartition by hash (a+b);
+ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by key (a)
+subpartition by key (b);
+ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by key (a)
+subpartition by key (a, b);
+ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by key (a)
+subpartition by hash (a+b);
+ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by key (a)
+subpartition by hash (rand(a+b));
+ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 7
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by key (a)
+subpartition by hash (sin(a+b))
+(partition x1 (subpartition x11, subpartition x12),
+partition x2 (subpartition x21, subpartition x22));
+ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by range (a)
+subpartition by key (a+b)
+(partition x1 values less than (1) (subpartition x11, subpartition x12),
+partition x2 values less than (2) (subpartition x21, subpartition x22));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '+b)
+(partition x1 values less than (1) (subpartition x11, subpartition x12),
+par' at line 7
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by range (a)
+subpartition by key (a,d)
+(partition x1 values less than (1) (subpartition x11, subpartition x12),
+partition x2 values less than (2) (subpartition x21, subpartition x22));
+ERROR HY000: Field in list of fields for partition function not found in table
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by key (a)
+subpartition by hash (3+4);
+ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by range (a)
+subpartition by hash (a+d)
+(partition x1 values less than (1) (subpartition x11, subpartition x12),
+partition x2 values less than (2) (subpartition x21, subpartition x22));
+ERROR 42S22: Unknown column 'd' in 'partition function'
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a);
+ERROR HY000: For RANGE partitions each partition must be defined
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+NULL
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a+d)
+partitions 2
+(partition x1 values less than (4) tablespace ts1,
+partition x2 values less than (8) tablespace ts2);
+ERROR 42S22: Unknown column 'd' in 'partition function'
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (4.0) tablespace ts1,
+partition x2 values less than (8) tablespace ts2);
+ERROR 42000: VALUES value must be of same type as partition function near ') tablespace ts1,
+partition x2 values less than (8) tablespace ts2)' at line 8
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (3+4)
+partitions 2
+(partition x1 values less than (4) tablespace ts1,
+partition x2 values less than (8) tablespace ts2);
+ERROR HY000: Constant/Random expression in (sub)partitioning function is not allowed
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (4),
+partition x2);
+ERROR HY000: RANGE PARTITIONING requires definition of VALUES LESS THAN for each partition
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a)
+partitions 2
+(partition x1 values in (4),
+partition x2);
+ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a)
+partitions 2
+(partition x1 values in (4),
+partition x2 values less than (5));
+ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a)
+partitions 2
+(partition x1 values less than 4,
+partition x2 values less than (5));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '4,
+partition x2 values less than (5))' at line 8
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a)
+partitions 2
+(partition x1 values less than maxvalue,
+partition x2 values less than (5));
+ERROR 42000: MAXVALUE can only be used in last partition definition near '))' at line 9
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a)
+partitions 2
+(partition x1 values less than maxvalue,
+partition x2 values less than maxvalue);
+ERROR 42000: MAXVALUE can only be used in last partition definition near 'maxvalue)' at line 9
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (4),
+partition x2 values less than (3));
+ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (sin(a))
+partitions 2
+(partition x1 values less than (4),
+partition x2 values less than (5));
+ERROR HY000: The PARTITION function returns the wrong type
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by list (a)
+subpartition by hash (a+b)
+subpartitions 3
+( partition x1 values in (1,2,4)
+( subpartition x11 nodegroup 0,
+subpartition x12 nodegroup 1),
+partition x2 values in (3,5,6)
+( subpartition x21 nodegroup 0,
+subpartition x22 nodegroup 1)
+);
+ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
+partition x2 values in (3,5,6)
+( subpartition x21 nodegroup 0,
+subpartition x' at line 11
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by list (a)
+subpartition by hash (a+b)
+( partition x1 values in (1)
+( subpartition x11 nodegroup 0,
+subpartition xextra,
+subpartition x12 nodegroup 1),
+partition x2 values in (2)
+( subpartition x21 nodegroup 0,
+subpartition x22 nodegroup 1)
+);
+ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near ')
+)' at line 14
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by key (a)
+subpartition by list (a+b)
+( partition x1
+( subpartition x11 engine myisam,
+subpartition x12 engine myisam),
+partition x2
+( subpartition x21 engine myisam,
+subpartition x22 engine myisam)
+);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'list (a+b)
+( partition x1
+( subpartition x11 engine myisam,
+subpartition x12 eng' at line 7
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by key (a)
+subpartition by list (a+b)
+( partition x1
+( subpartition x11 engine myisam values in (0),
+subpartition x12 engine myisam values in (1)),
+partition x2
+( subpartition x21 engine myisam values in (0),
+subpartition x22 engine myisam values in (1))
+);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'list (a+b)
+( partition x1
+( subpartition x11 engine myisam values in (0),
+subpar' at line 7
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a);
+ERROR HY000: For LIST partitions each partition must be defined
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (3+4)
+partitions 2
+(partition x1 values in (4) tablespace ts1,
+partition x2 values in (8) tablespace ts2);
+ERROR HY000: Constant/Random expression in (sub)partitioning function is not allowed
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a+d)
+partitions 2
+(partition x1 values in (4) tablespace ts1,
+partition x2 values in (8) tablespace ts2);
+ERROR 42S22: Unknown column 'd' in 'partition function'
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a)
+partitions 2
+(partition x1 values in (4),
+partition x2);
+ERROR HY000: LIST PARTITIONING requires definition of VALUES IN for each partition
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a)
+partitions 2
+(partition x1 values in (4),
+partition x2 values less than (5));
+ERROR HY000: Only RANGE PARTITIONING can use VALUES LESS THAN in partition definition
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a)
+partitions 2
+(partition x1 values in (4,6),
+partition x2);
+ERROR HY000: LIST PARTITIONING requires definition of VALUES IN for each partition
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a)
+partitions 2
+(partition x1 values in (4, 12+9),
+partition x2 values in (3, 21));
+ERROR HY000: Multiple definition of same constant in list partitioning
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a)
+partitions 2
+(partition x1 values in (4.0, 12+8),
+partition x2 values in (3, 21));
+ERROR 42000: VALUES value must be of same type as partition function near ' 12+8),
+partition x2 values in (3, 21))' at line 8
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a)
+partitions 2
+(partition x1 values in 4,
+partition x2 values in (5));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '4,
+partition x2 values in (5))' at line 8
+CREATE TABLE t1 (a int)
+PARTITION BY RANGE (a)
+(PARTITION p0 VALUES LESS THAN (x1));
+ERROR 42S22: Unknown column 'x1' in 'partition function'
+CREATE TABLE t1(a int)
+PARTITION BY RANGE (a) (PARTITION p1 VALUES LESS THAN(5));
+insert into t1 values (10);
+ERROR HY000: Table has no partition for value 10
+drop table t1;
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (-1));
+ERROR HY000: Partition constant is out of partition function domain
+create table t1 (v varchar(12))
+partition by range (ascii(v))
+(partition p0 values less than (10));
+drop table t1;
+create table t1 (a int)
+partition by hash (rand(a));
+ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 2
+create table t1 (a int)
+partition by hash(CURTIME() + a);
+ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 2
+create table t1 (a int)
+partition by hash (NOW()+a);
+ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 2
+create table t1 (a int)
+partition by hash (extract(hour from convert_tz(a, '+00:00', '+00:00')));
+ERROR HY000: This partition function is not allowed
+create table t1 (a int)
+partition by range (a + (select count(*) from t1))
+(partition p1 values less than (1));
+ERROR HY000: This partition function is not allowed
+create table t1 (a char(10))
+partition by hash (extractvalue(a,'a'));
+ERROR HY000: The PARTITION function returns the wrong type
diff --git a/mysql-test/r/partition_grant.result b/mysql-test/r/partition_grant.result
new file mode 100644
index 00000000000..e88427e5396
--- /dev/null
+++ b/mysql-test/r/partition_grant.result
@@ -0,0 +1,25 @@
+drop schema if exists mysqltest_1;
+create schema mysqltest_1;
+use mysqltest_1;
+create table t1 (a int) partition by list (a) (partition p1 values in (1), partition p2 values in (2), partition p3 values in (3));
+insert into t1 values (1),(2);
+grant usage on *.* to mysqltest_1@localhost;
+revoke all privileges on *.* from mysqltest_1@localhost;
+grant select,alter on mysqltest_1.* to mysqltest_1@localhost;
+show grants for current_user;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT SELECT, ALTER ON `mysqltest_1`.* TO 'mysqltest_1'@'localhost'
+alter table t1 add b int;
+alter table t1 drop partition p2;
+ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1'
+grant drop on mysqltest_1.* to mysqltest_1@localhost;
+alter table t1 drop partition p2;
+revoke alter on mysqltest_1.* from mysqltest_1@localhost;
+alter table t1 drop partition p3;
+ERROR 42000: ALTER command denied to user 'mysqltest_1'@'localhost' for table 't1'
+revoke select,alter,drop on mysqltest_1.* from mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
+drop table t1;
+drop schema mysqltest_1;
+End of 5.1 tests
diff --git a/mysql-test/r/partition_hash.result b/mysql-test/r/partition_hash.result
new file mode 100644
index 00000000000..7ef3ee5c6c8
--- /dev/null
+++ b/mysql-test/r/partition_hash.result
@@ -0,0 +1,199 @@
+drop table if exists t1;
+create table t1 (a varchar(10) charset latin1 collate latin1_bin)
+partition by hash(length(a))
+partitions 10;
+insert into t1 values (''),(' '),('a'),('a '),('a ');
+explain partitions select * from t1 where a='a ';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where
+explain partitions select * from t1 where a='a';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where
+explain partitions select * from t1 where a='a ' OR a='a';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where
+drop table t1;
+create table t1 (a int unsigned)
+partition by hash(a div 2)
+partitions 4;
+insert into t1 values (null),(0),(1),(2),(3),(4),(5),(6),(7);
+select * from t1 where a < 0;
+a
+select * from t1 where a is null or (a >= 5 and a <= 7);
+a
+NULL
+5
+6
+7
+select * from t1 where a is null;
+a
+NULL
+select * from t1 where a is not null;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+select * from t1 where a >= 1 and a < 3;
+a
+1
+2
+select * from t1 where a >= 3 and a <= 5;
+a
+3
+4
+5
+select * from t1 where a > 2 and a < 4;
+a
+3
+select * from t1 where a > 3 and a <= 6;
+a
+4
+5
+6
+select * from t1 where a > 5;
+a
+6
+7
+select * from t1 where a >= 1 and a <= 5;
+a
+1
+2
+3
+4
+5
+explain partitions select * from t1 where a < 0;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where
+explain partitions select * from t1 where a is null or (a >= 5 and a <= 7);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0,p2,p3 ALL NULL NULL NULL NULL 7 Using where
+explain partitions select * from t1 where a is null;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 3 Using where
+explain partitions select * from t1 where a is not null;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where
+explain partitions select * from t1 where a >= 1 and a < 3;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 5 Using where
+explain partitions select * from t1 where a >= 3 and a <= 5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1,p2 ALL NULL NULL NULL NULL 4 Using where
+explain partitions select * from t1 where a > 2 and a < 4;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t1 where a > 3 and a <= 6;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL 4 Using where
+explain partitions select * from t1 where a > 5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where
+explain partitions select * from t1 where a >= 1 and a <= 5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by hash (a + 2)
+partitions 3
+(partition x1 tablespace ts1,
+partition x2 tablespace ts2,
+partition x3 tablespace ts3);
+insert into t1 values (1,1,1);
+insert into t1 values (2,1,1);
+insert into t1 values (3,1,1);
+insert into t1 values (4,1,1);
+insert into t1 values (5,1,1);
+select * from t1;
+a b c
+1 1 1
+4 1 1
+2 1 1
+5 1 1
+3 1 1
+update t1 set c=3 where b=1;
+select * from t1;
+a b c
+1 1 3
+4 1 3
+2 1 3
+5 1 3
+3 1 3
+select b from t1 where a=3;
+b
+1
+select b,c from t1 where a=1 AND b=1;
+b c
+1 3
+delete from t1 where a=1;
+delete from t1 where c=3;
+select * from t1;
+a b c
+ALTER TABLE t1
+partition by hash (a + 3)
+partitions 3
+(partition x1 tablespace ts1,
+partition x2 tablespace ts2,
+partition x3 tablespace ts3);
+select * from t1;
+a b c
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by hash (a)
+(partition x1);
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by key (a)
+(partition x1);
+drop table t1;
+CREATE TABLE t1 (f1 INTEGER, f2 char(20)) ENGINE = 'MYISAM' PARTITION BY HASH(f1) PARTITIONS 2;
+INSERT INTO t1 SET f1 = 0 - 1, f2 = '#######';
+select * from t1;
+f1 f2
+-1 #######
+drop table t1;
+CREATE TABLE t1 (s1 int) ENGINE=BLACKHOLE PARTITION BY HASH (s1);
+INSERT INTO t1 VALUES (0);
+DROP TABLE t1;
+create table t1 (c1 int DEFAULT NULL,
+c2 varchar (30) DEFAULT NULL,
+c3 date DEFAULT NULL)
+engine = myisam
+partition by hash (to_days(c3))
+partitions 12;
+insert into t1 values
+(136,'abc','2002-01-05'),(142,'abc','2002-02-14'),(162,'abc','2002-06-28'),
+(182,'abc','2002-11-09'),(158,'abc','2002-06-01'),(184,'abc','2002-11-22');
+select * from t1;
+c1 c2 c3
+136 abc 2002-01-05
+158 abc 2002-06-01
+142 abc 2002-02-14
+162 abc 2002-06-28
+182 abc 2002-11-09
+184 abc 2002-11-22
+select * from t1 where c3 between '2002-01-01' and '2002-12-31';
+c1 c2 c3
+136 abc 2002-01-05
+158 abc 2002-06-01
+142 abc 2002-02-14
+162 abc 2002-06-28
+182 abc 2002-11-09
+184 abc 2002-11-22
+drop table t1;
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
new file mode 100644
index 00000000000..8619d0909ee
--- /dev/null
+++ b/mysql-test/r/partition_innodb.result
@@ -0,0 +1,76 @@
+create table t1 (a int) engine=innodb partition by hash(a) ;
+show table status like 't1';
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 InnoDB 10 Compact 2 8192 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
+drop table t1;
+create table t1 (a int)
+engine = innodb
+partition by key (a);
+show table status;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 InnoDB 10 Compact 2 8192 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
+insert into t1 values (0), (1), (2), (3);
+show table status;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 InnoDB 10 Compact 4 4096 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
+drop table t1;
+create table t1 (a int auto_increment primary key)
+engine = innodb
+partition by key (a);
+show table status;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 InnoDB 10 Compact 2 8192 16384 0 0 0 1 NULL NULL NULL latin1_swedish_ci NULL partitioned
+insert into t1 values (NULL), (NULL), (NULL), (NULL);
+show table status;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 InnoDB 10 Compact 4 4096 16384 0 0 0 5 NULL NULL NULL latin1_swedish_ci NULL partitioned
+insert into t1 values (NULL), (NULL), (NULL), (NULL);
+show table status;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 InnoDB 10 Compact 8 2048 16384 0 0 0 9 NULL NULL NULL latin1_swedish_ci NULL partitioned
+drop table t1;
+create table t1 (a int)
+partition by key (a)
+(partition p1 engine = innodb);
+alter table t1 rebuild partition p1;
+alter table t1 rebuild partition p1;
+alter table t1 rebuild partition p1;
+alter table t1 rebuild partition p1;
+alter table t1 rebuild partition p1;
+alter table t1 rebuild partition p1;
+alter table t1 rebuild partition p1;
+drop table t1;
+create table t1 (a date)
+engine = innodb
+partition by range (year(a))
+(partition p0 values less than (2006),
+partition p1 values less than (2007));
+explain partitions select * from t1
+where a between '2006-01-01' and '2007-06-01';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where
+drop table t1;
+create table t1 (a int)
+engine = x
+partition by key (a);
+Warnings:
+Error 1286 Unknown table engine 'x'
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) */
+drop table t1;
+create table t1 (a int)
+engine = innodb
+partition by list (a)
+(partition p0 values in (0));
+alter table t1 engine = x;
+Warnings:
+Error 1286 Unknown table engine 'x'
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0) ENGINE = InnoDB) */
+drop table t1;
diff --git a/mysql-test/r/partition_list.result b/mysql-test/r/partition_list.result
new file mode 100644
index 00000000000..e64a7a8d154
--- /dev/null
+++ b/mysql-test/r/partition_list.result
@@ -0,0 +1,297 @@
+drop table if exists t1;
+create table t1 (a int unsigned)
+partition by list (a)
+(partition p0 values in (0),
+partition p1 values in (1),
+partition pnull values in (null),
+partition p2 values in (2));
+insert into t1 values (null),(0),(1),(2);
+select * from t1 where a < 2;
+a
+0
+1
+select * from t1 where a <= 0;
+a
+0
+select * from t1 where a < 1;
+a
+0
+select * from t1 where a > 0;
+a
+1
+2
+select * from t1 where a > 1;
+a
+2
+select * from t1 where a >= 0;
+a
+0
+1
+2
+select * from t1 where a >= 1;
+a
+1
+2
+select * from t1 where a is null;
+a
+NULL
+select * from t1 where a is not null;
+a
+0
+1
+2
+select * from t1 where a is null or a > 0;
+a
+1
+NULL
+2
+drop table t1;
+create table t1 (a int unsigned, b int)
+partition by list (a)
+subpartition by hash (b)
+subpartitions 2
+(partition p0 values in (0),
+partition p1 values in (1),
+partition pnull values in (null, 2),
+partition p3 values in (3));
+insert into t1 values (0,0),(0,1),(1,0),(1,1),(null,0),(null,1);
+insert into t1 values (2,0),(2,1),(3,0),(3,1);
+explain partitions select * from t1 where a is null;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 4 Using where
+select * from t1 where a is null;
+a b
+NULL 0
+NULL 1
+explain partitions select * from t1 where a = 2;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 4 Using where
+select * from t1 where a = 2;
+a b
+2 0
+2 1
+select * from t1 where a <= 0;
+a b
+0 0
+0 1
+select * from t1 where a < 3;
+a b
+0 0
+0 1
+1 0
+1 1
+2 0
+2 1
+select * from t1 where a >= 1 or a is null;
+a b
+1 0
+1 1
+NULL 0
+2 0
+NULL 1
+2 1
+3 0
+3 1
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null)
+partition by list(a)
+partitions 2
+(partition x123 values in (1,5,6),
+partition x234 values in (4,7,8));
+INSERT into t1 VALUES (1,1,1);
+INSERT into t1 VALUES (2,1,1);
+ERROR HY000: Table has no partition for value 2
+INSERT into t1 VALUES (3,1,1);
+ERROR HY000: Table has no partition for value 3
+INSERT into t1 VALUES (4,1,1);
+INSERT into t1 VALUES (5,1,1);
+INSERT into t1 VALUES (6,1,1);
+INSERT into t1 VALUES (7,1,1);
+INSERT into t1 VALUES (8,1,1);
+INSERT into t1 VALUES (9,1,1);
+ERROR HY000: Table has no partition for value 9
+INSERT into t1 VALUES (1,2,1);
+INSERT into t1 VALUES (1,3,1);
+INSERT into t1 VALUES (1,4,1);
+INSERT into t1 VALUES (7,2,1);
+INSERT into t1 VALUES (7,3,1);
+INSERT into t1 VALUES (7,4,1);
+SELECT * from t1;
+a b c
+1 1 1
+5 1 1
+6 1 1
+1 2 1
+1 3 1
+1 4 1
+4 1 1
+7 1 1
+8 1 1
+7 2 1
+7 3 1
+7 4 1
+SELECT * from t1 WHERE a=1;
+a b c
+1 1 1
+1 2 1
+1 3 1
+1 4 1
+SELECT * from t1 WHERE a=7;
+a b c
+7 1 1
+7 2 1
+7 3 1
+7 4 1
+SELECT * from t1 WHERE b=2;
+a b c
+1 2 1
+7 2 1
+UPDATE t1 SET a=8 WHERE a=7 AND b=3;
+SELECT * from t1;
+a b c
+1 1 1
+5 1 1
+6 1 1
+1 2 1
+1 3 1
+1 4 1
+4 1 1
+7 1 1
+8 1 1
+7 2 1
+8 3 1
+7 4 1
+UPDATE t1 SET a=8 WHERE a=5 AND b=1;
+SELECT * from t1;
+a b c
+1 1 1
+6 1 1
+1 2 1
+1 3 1
+1 4 1
+4 1 1
+7 1 1
+8 1 1
+7 2 1
+8 3 1
+7 4 1
+8 1 1
+DELETE from t1 WHERE a=8;
+SELECT * from t1;
+a b c
+1 1 1
+6 1 1
+1 2 1
+1 3 1
+1 4 1
+4 1 1
+7 1 1
+7 2 1
+7 4 1
+DELETE from t1 WHERE a=2;
+SELECT * from t1;
+a b c
+1 1 1
+6 1 1
+1 2 1
+1 3 1
+1 4 1
+4 1 1
+7 1 1
+7 2 1
+7 4 1
+DELETE from t1 WHERE a=5 OR a=6;
+SELECT * from t1;
+a b c
+1 1 1
+1 2 1
+1 3 1
+1 4 1
+4 1 1
+7 1 1
+7 2 1
+7 4 1
+ALTER TABLE t1
+partition by list(a)
+partitions 2
+(partition x123 values in (1,5,6),
+partition x234 values in (4,7,8));
+SELECT * from t1;
+a b c
+1 1 1
+1 2 1
+1 3 1
+1 4 1
+4 1 1
+7 1 1
+7 2 1
+7 4 1
+INSERT into t1 VALUES (6,2,1);
+INSERT into t1 VALUES (2,2,1);
+ERROR HY000: Table has no partition for value 2
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by list (a)
+subpartition by hash (a+b)
+( partition x1 values in (1,2,3)
+( subpartition x11 nodegroup 0,
+subpartition x12 nodegroup 1),
+partition x2 values in (4,5,6)
+( subpartition x21 nodegroup 0,
+subpartition x22 nodegroup 1)
+);
+INSERT into t1 VALUES (1,1,1);
+INSERT into t1 VALUES (4,1,1);
+INSERT into t1 VALUES (7,1,1);
+ERROR HY000: Table has no partition for value 7
+UPDATE t1 SET a=5 WHERE a=1;
+SELECT * from t1;
+a b c
+5 1 1
+4 1 1
+UPDATE t1 SET a=6 WHERE a=4;
+SELECT * from t1;
+a b c
+5 1 1
+6 1 1
+DELETE from t1 WHERE a=6;
+SELECT * from t1;
+a b c
+5 1 1
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a)
+(partition x1 values in (1,2,9,4) tablespace ts1);
+drop table t1;
+CREATE TABLE t1 (s1 int) PARTITION BY LIST (s1)
+(PARTITION p1 VALUES IN (1),
+PARTITION p2 VALUES IN (2),
+PARTITION p3 VALUES IN (3),
+PARTITION p4 VALUES IN (4),
+PARTITION p5 VALUES IN (5));
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
+SELECT COUNT(*) FROM t1 WHERE s1 < 3;
+COUNT(*)
+2
+DROP TABLE t1;
+create table t1 (a int auto_increment primary key)
+auto_increment=100
+partition by list (a)
+(partition p0 values in (1, 100));
+create index inx on t1 (a);
+insert into t1 values (null);
+select * from t1;
+a
+100
+drop table t1;
diff --git a/mysql-test/r/partition_mgm.result b/mysql-test/r/partition_mgm.result
new file mode 100644
index 00000000000..9b5a34bda50
--- /dev/null
+++ b/mysql-test/r/partition_mgm.result
@@ -0,0 +1,48 @@
+DROP TABLE IF EXISTS t1;
+create table t1 (a int)
+partition by range (a)
+subpartition by key (a)
+(partition p0 values less than (10) (subpartition sp00, subpartition sp01),
+partition p1 values less than (20) (subpartition sp10, subpartition sp11));
+alter table t1 reorganize partition p0 into
+(partition p0 values less than (10) (subpartition sp00,
+subpartition sp01, subpartition sp02));
+ERROR HY000: Wrong number of subpartitions defined, mismatch with previous setting
+drop table t1;
+CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30))
+PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f_date` date DEFAULT NULL,
+ `f_varchar` varchar(30) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2 */
+hello/master-data/test/t1#P#p0.MYD
+hello/master-data/test/t1#P#p0.MYI
+hello/master-data/test/t1#P#p1.MYD
+hello/master-data/test/t1#P#p1.MYI
+hello/master-data/test/t1.frm
+hello/master-data/test/t1.par
+ALTER TABLE t1 COALESCE PARTITION 1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f_date` date DEFAULT NULL,
+ `f_varchar` varchar(30) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 1 */
+hello/master-data/test/t1#P#p0.MYD
+hello/master-data/test/t1#P#p0.MYI
+hello/master-data/test/t1.frm
+hello/master-data/test/t1.par
+drop table t1;
+create table t1 (a int)
+partition by list (a)
+subpartition by hash (a)
+(partition p11 values in (1,2),
+partition p12 values in (3,4));
+alter table t1 REORGANIZE partition p11, p12 INTO
+(partition p1 values in (1,2,3,4));
+alter table t1 REORGANIZE partition p1 INTO
+(partition p11 values in (1,2),
+partition p12 values in (3,4));
+drop table t1;
diff --git a/mysql-test/r/partition_mgm_err.result b/mysql-test/r/partition_mgm_err.result
new file mode 100644
index 00000000000..764f6fb5632
--- /dev/null
+++ b/mysql-test/r/partition_mgm_err.result
@@ -0,0 +1,150 @@
+drop table if exists t1;
+CREATE TABLE t1 (a int, b int)
+PARTITION BY RANGE (a)
+(PARTITION x0 VALUES LESS THAN (2),
+PARTITION x1 VALUES LESS THAN (4),
+PARTITION x2 VALUES LESS THAN (6),
+PARTITION x3 VALUES LESS THAN (8),
+PARTITION x4 VALUES LESS THAN (10),
+PARTITION x5 VALUES LESS THAN (12),
+PARTITION x6 VALUES LESS THAN (14),
+PARTITION x7 VALUES LESS THAN (16),
+PARTITION x8 VALUES LESS THAN (18),
+PARTITION x9 VALUES LESS THAN (20));
+ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
+(PARTITION x01 VALUES LESS THAN (2),
+PARTITION x11 VALUES LESS THAN (5));
+ERROR HY000: Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range
+ALTER TABLE t1 DROP PARTITION x0, x1, x2, x3, x3;
+ERROR HY000: Error in list of partitions to DROP
+ALTER TABLE t1 DROP PARTITION x0, x1, x2, x10;
+ERROR HY000: Error in list of partitions to DROP
+ALTER TABLE t1 DROP PARTITION x10, x1, x2, x1;
+ERROR HY000: Error in list of partitions to DROP
+ALTER TABLE t1 DROP PARTITION x10, x1, x2, x3;
+ERROR HY000: Error in list of partitions to DROP
+ALTER TABLE t1 REORGANIZE PARTITION x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10 INTO
+(PARTITION x11 VALUES LESS THAN (22));
+ERROR HY000: More partitions to reorganise than there are partitions
+ALTER TABLE t1 REORGANIZE PARTITION x0,x1,x2 INTO
+(PARTITION x3 VALUES LESS THAN (6));
+ERROR HY000: Duplicate partition name x3
+ALTER TABLE t1 REORGANIZE PARTITION x0, x2 INTO
+(PARTITION x11 VALUES LESS THAN (2));
+ERROR HY000: When reorganising a set of partitions they must be in consecutive order
+ALTER TABLE t1 REORGANIZE PARTITION x0, x1, x1 INTO
+(PARTITION x11 VALUES LESS THAN (4));
+ERROR HY000: Error in list of partitions to REORGANIZE
+ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
+(PARTITION x01 VALUES LESS THAN (5));
+ERROR HY000: Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range
+ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
+(PARTITION x01 VALUES LESS THAN (4),
+PARTITION x11 VALUES LESS THAN (2));
+ERROR HY000: Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range
+ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
+(PARTITION x01 VALUES LESS THAN (6),
+PARTITION x11 VALUES LESS THAN (4));
+ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition
+DROP TABLE t1;
+CREATE TABLE t1 (a int)
+PARTITION BY KEY (a)
+PARTITIONS 2;
+ALTER TABLE t1 ADD PARTITION (PARTITION p1);
+ERROR HY000: Duplicate partition name p1
+DROP TABLE t1;
+CREATE TABLE t1 (a int)
+PARTITION BY KEY (a)
+(PARTITION x0, PARTITION x1, PARTITION x2, PARTITION x3, PARTITION x3);
+ERROR HY000: Duplicate partition name x3
+CREATE TABLE t1 (a int)
+PARTITION BY RANGE (a)
+SUBPARTITION BY KEY (a)
+SUBPARTITIONS 2
+(PARTITION x0 VALUES LESS THAN (4),
+PARTITION x1 VALUES LESS THAN (8));
+ALTER TABLE t1 ADD PARTITION (PARTITION x2 VALUES LESS THAN (5)
+(SUBPARTITION sp0, SUBPARTITION sp1));
+ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition
+ALTER TABLE t1 ADD PARTITION (PARTITION x2 VALUES LESS THAN (12)
+(SUBPARTITION sp0, SUBPARTITION sp1, SUBPARTITION sp2));
+ERROR HY000: Trying to Add partition(s) with wrong number of subpartitions
+DROP TABLE t1;
+CREATE TABLE t1 (a int)
+PARTITION BY LIST (a)
+(PARTITION x0 VALUES IN (1,2,3),
+PARTITION x1 VALUES IN (4,5,6));
+ALTER TABLE t1 ADD PARTITION (PARTITION x2 VALUES IN (3,4));
+ERROR HY000: Multiple definition of same constant in list partitioning
+DROP TABLE t1;
+CREATE TABLE t1 (a int);
+ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
+ERROR HY000: Partition management on a not partitioned table is not possible
+ALTER TABLE t1 DROP PARTITION x1;
+ERROR HY000: Partition management on a not partitioned table is not possible
+ALTER TABLE t1 COALESCE PARTITION 1;
+ERROR HY000: Partition management on a not partitioned table is not possible
+DROP TABLE t1;
+CREATE TABLE t1 (a int)
+PARTITION BY KEY (a)
+(PARTITION x0, PARTITION x1);
+ALTER TABLE t1 ADD PARTITION PARTITIONS 0;
+ERROR HY000: At least one partition must be added
+ALTER TABLE t1 ADD PARTITION PARTITIONS 1024;
+ERROR HY000: Too many partitions (including subpartitions) were defined
+ALTER TABLE t1 DROP PARTITION x0;
+ERROR HY000: DROP PARTITION can only be used on RANGE/LIST partitions
+ALTER TABLE t1 COALESCE PARTITION 1;
+ALTER TABLE t1 COALESCE PARTITION 1;
+ERROR HY000: Cannot remove all partitions, use DROP TABLE instead
+DROP TABLE t1;
+CREATE TABLE t1 (a int)
+PARTITION BY RANGE (a)
+(PARTITION x0 VALUES LESS THAN (4),
+PARTITION x1 VALUES LESS THAN (8));
+ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
+ERROR HY000: For RANGE partitions each partition must be defined
+ALTER TABLE t1 DROP PARTITION x2;
+ERROR HY000: Error in list of partitions to DROP
+ALTER TABLE t1 COALESCE PARTITION 1;
+ERROR HY000: COALESCE PARTITION can only be used on HASH/KEY partitions
+ALTER TABLE t1 DROP PARTITION x1;
+ALTER TABLE t1 DROP PARTITION x0;
+ERROR HY000: Cannot remove all partitions, use DROP TABLE instead
+DROP TABLE t1;
+CREATE TABLE t1 ( id INT NOT NULL,
+fname VARCHAR(50) NOT NULL,
+lname VARCHAR(50) NOT NULL,
+hired DATE NOT NULL )
+PARTITION BY RANGE(YEAR(hired)) (
+PARTITION p1 VALUES LESS THAN (1991),
+PARTITION p2 VALUES LESS THAN (1996),
+PARTITION p3 VALUES LESS THAN (2001),
+PARTITION p4 VALUES LESS THAN (2005));
+ALTER TABLE t1 ADD PARTITION (
+PARTITION p5 VALUES LESS THAN (2010),
+PARTITION p6 VALUES LESS THAN MAXVALUE);
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1 PARTITION BY KEY(a) PARTITIONS 2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) PARTITIONS 2 */
+DROP TABLE t1;
+CREATE TABLE t1 (a INT) PARTITION BY HASH(a);
+ALTER TABLE t1 ADD PARTITION PARTITIONS 4;
+DROP TABLE t1;
+CREATE TABLE t1 (s1 int, s2 int)
+PARTITION BY LIST (s1)
+SUBPARTITION BY KEY (s2) (
+PARTITION p1 VALUES IN (0) (SUBPARTITION p1b),
+PARTITION p2 VALUES IN (2) (SUBPARTITION p1b)
+);
+ERROR HY000: Duplicate partition name p1b
diff --git a/mysql-test/r/partition_mgm_err2.result b/mysql-test/r/partition_mgm_err2.result
new file mode 100644
index 00000000000..7e5763b8f1b
--- /dev/null
+++ b/mysql-test/r/partition_mgm_err2.result
@@ -0,0 +1,2 @@
+INSERT INTO t1 VALUES (15);
+DROP TABLE t1;
diff --git a/mysql-test/r/partition_order.result b/mysql-test/r/partition_order.result
new file mode 100644
index 00000000000..78ff7cd3121
--- /dev/null
+++ b/mysql-test/r/partition_order.result
@@ -0,0 +1,785 @@
+drop table if exists t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+select * from t1 order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+select * from t1 force index (b) where b > 0 order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int unsigned not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+select * from t1 force index (b) where b > 0 order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b tinyint not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+select * from t1 force index (b) where b > 0 order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b tinyint unsigned not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+select * from t1 force index (b) where b > 0 order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b smallint not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+select * from t1 force index (b) where b > 0 order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b smallint unsigned not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+select * from t1 force index (b) where b > 0 order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b mediumint not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+select * from t1 force index (b) where b > 0 order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b mediumint unsigned not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+select * from t1 force index (b) where b > 0 order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b bigint unsigned not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+select * from t1 force index (b) where b > 0 order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b bigint not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+select * from t1 force index (b) where b > 0 order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b bigint not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+select * from t1 force index (b) where b > 0 order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b float not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+select * from t1 force index (b) where b > 0 order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b double not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+select * from t1 force index (b) where b > 0 order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b double unsigned not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+select * from t1 force index (b) where b > 0 order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b float unsigned not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+select * from t1 force index (b) where b > 0 order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b double precision not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+select * from t1 force index (b) where b > 0 order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b double precision unsigned not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+select * from t1 force index (b) where b > 0 order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b decimal not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+select * from t1 force index (b) where b > 0 order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b char(10) not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, '1');
+INSERT into t1 values (2, '5');
+INSERT into t1 values (30, '4');
+INSERT into t1 values (35, '2');
+select * from t1 force index (b) where b > 0 order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b varchar(10) not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, '1');
+INSERT into t1 values (2, '5');
+INSERT into t1 values (30, '4');
+INSERT into t1 values (35, '2');
+select * from t1 force index (b) where b > '0' order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b varchar(10) not null,
+primary key(a),
+index (b(5)))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, '1');
+INSERT into t1 values (2, '5');
+INSERT into t1 values (30, '4');
+INSERT into t1 values (35, '2');
+select * from t1 force index (b) where b > '0' order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b varchar(10) binary not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, '1');
+INSERT into t1 values (2, '5');
+INSERT into t1 values (30, '4');
+INSERT into t1 values (35, '2');
+select * from t1 force index (b) where b > '0' order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b tinytext not null,
+primary key(a),
+index (b(10)))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, '1');
+INSERT into t1 values (2, '5');
+INSERT into t1 values (30, '4');
+INSERT into t1 values (35, '2');
+select * from t1 force index (b) where b > '0' order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b text not null,
+primary key(a),
+index (b(10)))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, '1');
+INSERT into t1 values (2, '5');
+INSERT into t1 values (30, '4');
+INSERT into t1 values (35, '2');
+select * from t1 force index (b) where b > '0' order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b mediumtext not null,
+primary key(a),
+index (b(10)))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, '1');
+INSERT into t1 values (2, '5');
+INSERT into t1 values (30, '4');
+INSERT into t1 values (35, '2');
+select * from t1 force index (b) where b > '0' order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b longtext not null,
+primary key(a),
+index (b(10)))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, '1');
+INSERT into t1 values (2, '5');
+INSERT into t1 values (30, '4');
+INSERT into t1 values (35, '2');
+select * from t1 force index (b) where b > '0' order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b enum('1','2', '4', '5') not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, '1');
+INSERT into t1 values (2, '5');
+INSERT into t1 values (30, '4');
+INSERT into t1 values (35, '2');
+select * from t1 force index (b) where b >= '1' order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b set('1','2', '4', '5') not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, '1');
+INSERT into t1 values (2, '5');
+INSERT into t1 values (30, '4');
+INSERT into t1 values (35, '2');
+select * from t1 force index (b) where b >= '1' order by b;
+a b
+1 1
+35 2
+30 4
+2 5
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b date not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, '2001-01-01');
+INSERT into t1 values (2, '2005-01-01');
+INSERT into t1 values (30, '2004-01-01');
+INSERT into t1 values (35, '2002-01-01');
+select * from t1 force index (b) where b > '2000-01-01' order by b;
+a b
+1 2001-01-01
+35 2002-01-01
+30 2004-01-01
+2 2005-01-01
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b datetime not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, '2001-01-01 00:00:00');
+INSERT into t1 values (2, '2005-01-01 00:00:00');
+INSERT into t1 values (30, '2004-01-01 00:00:00');
+INSERT into t1 values (35, '2002-01-01 00:00:00');
+select * from t1 force index (b) where b > '2000-01-01 00:00:00' order by b;
+a b
+1 2001-01-01 00:00:00
+35 2002-01-01 00:00:00
+30 2004-01-01 00:00:00
+2 2005-01-01 00:00:00
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b timestamp not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, '2001-01-01 00:00:00');
+INSERT into t1 values (2, '2005-01-01 00:00:00');
+INSERT into t1 values (30, '2004-01-01 00:00:00');
+INSERT into t1 values (35, '2002-01-01 00:00:00');
+select * from t1 force index (b) where b > '2000-01-01 00:00:00' order by b;
+a b
+1 2001-01-01 00:00:00
+35 2002-01-01 00:00:00
+30 2004-01-01 00:00:00
+2 2005-01-01 00:00:00
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b time not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, '01:00:00');
+INSERT into t1 values (2, '05:00:00');
+INSERT into t1 values (30, '04:00:00');
+INSERT into t1 values (35, '02:00:00');
+select * from t1 force index (b) where b > '00:00:00' order by b;
+a b
+1 01:00:00
+35 02:00:00
+30 04:00:00
+2 05:00:00
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b year not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, 2001);
+INSERT into t1 values (2, 2005);
+INSERT into t1 values (30, 2004);
+INSERT into t1 values (35, 2002);
+select * from t1 force index (b) where b > 2000 order by b;
+a b
+1 2001
+35 2002
+30 2004
+2 2005
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b bit(5) not null,
+c int,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, b'00001', NULL);
+INSERT into t1 values (2, b'00101', 2);
+INSERT into t1 values (30, b'00100', 2);
+INSERT into t1 values (35, b'00010', NULL);
+select a from t1 force index (b) where b > b'00000' order by b;
+a
+1
+35
+30
+2
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b bit(15) not null,
+c int,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, b'000000000000001', NULL);
+INSERT into t1 values (2, b'001010000000101', 2);
+INSERT into t1 values (30, b'001000000000100', 2);
+INSERT into t1 values (35, b'000100000000010', NULL);
+select a from t1 force index (b) where b > b'000000000000000' order by b;
+a
+1
+35
+30
+2
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+partition x2 values less than (100));
+INSERT into t1 values (1, 1);
+INSERT into t1 values (5, NULL);
+INSERT into t1 values (2, 4);
+INSERT into t1 values (3, 3);
+INSERT into t1 values (4, 5);
+INSERT into t1 values (7, 1);
+INSERT into t1 values (6, 6);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+INSERT into t1 values (40, NULL);
+select * from t1 force index (b) where b < 10 OR b IS NULL order by b;
+a b
+5 NULL
+40 NULL
+1 1
+7 1
+35 2
+3 3
+2 4
+30 4
+4 5
+6 6
+select * from t1 force index (b) where b < 10 ORDER BY b;
+a b
+1 1
+7 1
+35 2
+3 3
+2 4
+30 4
+4 5
+6 6
+select * from t1 force index (b) where b < 10 ORDER BY b DESC;
+a b
+6 6
+4 5
+2 4
+30 4
+3 3
+35 2
+7 1
+1 1
+drop table t1;
+create table t1 (a int not null, b int, c varchar(20), key (a,b,c))
+partition by range (b)
+(partition p0 values less than (5),
+partition p1 values less than (10));
+INSERT into t1 values (1,1,'1'),(2,2,'2'),(1,3,'3'),(2,4,'4'),(1,5,'5');
+INSERT into t1 values (2,6,'6'),(1,7,'7'),(2,8,'8'),(1,9,'9');
+INSERT into t1 values (1, NULL, NULL), (2, NULL, '10');
+select * from t1 where a = 1 order by a desc, b desc;
+a b c
+1 9 9
+1 7 7
+1 5 5
+1 3 3
+1 1 1
+1 NULL NULL
+select * from t1 where a = 1 order by b desc;
+a b c
+1 9 9
+1 7 7
+1 5 5
+1 3 3
+1 1 1
+1 NULL NULL
+drop table t1;
diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result
new file mode 100644
index 00000000000..5fc0058356d
--- /dev/null
+++ b/mysql-test/r/partition_pruning.result
@@ -0,0 +1,897 @@
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+create table t1 ( a int not null) partition by hash(a) partitions 2;
+insert into t1 values (1),(2),(3);
+explain select * from t1 where a=5 and a=6;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+drop table t1;
+create table t1 (
+a int(11) not null
+) partition by hash (a) partitions 2;
+insert into t1 values (1),(2),(3);
+explain partitions select * from t1 where a=1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t1 where a=2;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 system NULL NULL NULL NULL 1
+explain partitions select * from t1 where a=1 or a=2;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 3 Using where
+create table t2 (
+a int not null,
+b int not null
+) partition by key(a,b) partitions 2;
+insert into t2 values (1,1),(2,2),(3,3);
+explain partitions select * from t2 where a=1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p0,p1 ALL NULL NULL NULL NULL 3 Using where
+explain partitions select * from t2 where b=1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p0,p1 ALL NULL NULL NULL NULL 3 Using where
+explain partitions select * from t2 where a=1 and b=1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 2 Using where
+create table t3 (
+a int
+)
+partition by range (a*1) (
+partition p0 values less than (10),
+partition p1 values less than (20)
+);
+insert into t3 values (5),(15);
+explain partitions select * from t3 where a=11;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t3 where a=10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t3 where a=20;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t3 where a=30;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+create table t4 (a int not null, b int not null) partition by LIST (a+b) (
+partition p0 values in (12),
+partition p1 values in (14)
+);
+insert into t4 values (10,2), (10,4);
+explain partitions select * from t4 where (a=10 and b=1) or (a=10 and b=2);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 p0 system NULL NULL NULL NULL 1
+explain partitions select * from t4
+where (a=10 and b=1) or (a=10 and b=2) or (a=10 and b = 3);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 p0 system NULL NULL NULL NULL 1
+explain partitions select * from t4 where (a=10 and b=2) or (a=10 and b=3)
+or (a=10 and b = 4);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 p0,p1 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t4 where (a=10 and b=1) or a=11;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 p0,p1 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t4 where (a=10 and b=2) or a=11;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 p0,p1 ALL NULL NULL NULL NULL 2 Using where
+drop table t1, t2, t3, t4;
+create table t5 (a int not null, b int not null,
+c int not null, d int not null)
+partition by LIST(a+b) subpartition by HASH (c+d) subpartitions 2
+(
+partition p0 values in (12),
+partition p1 values in (14)
+);
+insert into t5 values (10,2,0,0), (10,4,0,0), (10,2,0,1), (10,4,0,1);
+explain partitions select * from t5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 4
+explain partitions select * from t5
+where (a=10 and b=1) or (a=10 and b=2) or (a=10 and b = 3);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t5 p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t5 where (a=10 and b=2) or (a=10 and b=3)
+or (a=10 and b = 4);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 4 Using where
+explain partitions select * from t5 where (c=1 and d=1);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t5 p0_p0sp0,p1_p1sp0 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t5 where (c=2 and d=1);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t5 p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t5 where (a=10 and b=2 and c=1 and d=1) or
+(c=2 and d=1);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 3 Using where
+explain partitions select * from t5 where (a=10 and b=2 and c=1 and d=1) or
+(b=2 and c=2 and d=1);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 3 Using where
+create table t6 (a int not null) partition by LIST(a) (
+partition p1 values in (1),
+partition p3 values in (3),
+partition p5 values in (5),
+partition p7 values in (7),
+partition p9 values in (9)
+);
+insert into t6 values (1),(3),(5);
+explain partitions select * from t6 where a < 1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t6 where a <= 1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t6 p1 system NULL NULL NULL NULL 1
+explain partitions select * from t6 where a > 9;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t6 where a >= 9;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t6 where a > 0 and a < 5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t6 p1,p3 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t6 where a > 5 and a < 12;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t6 where a > 3 and a < 8 ;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t6 p5,p7 system NULL NULL NULL NULL 1
+explain partitions select * from t6 where a >= 0 and a <= 5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t6 p1,p3,p5 ALL NULL NULL NULL NULL 3 Using where
+explain partitions select * from t6 where a >= 5 and a <= 12;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t6 p5,p7,p9 system NULL NULL NULL NULL 1
+explain partitions select * from t6 where a >= 3 and a <= 8;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t6 p3,p5,p7 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t6 where a > 3 and a < 5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+drop table t6;
+create table t6 (a int unsigned not null) partition by LIST(a) (
+partition p1 values in (1),
+partition p3 values in (3),
+partition p5 values in (5),
+partition p7 values in (7),
+partition p9 values in (9)
+);
+insert into t6 values (1),(3),(5);
+explain partitions select * from t6 where a < 1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t6 where a <= 1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t6 p1 system NULL NULL NULL NULL 1
+explain partitions select * from t6 where a > 9;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t6 where a >= 9;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t6 where a > 0 and a < 5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t6 p1,p3 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t6 where a > 5 and a < 12;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t6 where a > 3 and a < 8 ;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t6 p5,p7 system NULL NULL NULL NULL 1
+explain partitions select * from t6 where a >= 0 and a <= 5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t6 p1,p3,p5 ALL NULL NULL NULL NULL 3 Using where
+explain partitions select * from t6 where a >= 5 and a <= 12;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t6 p5,p7,p9 system NULL NULL NULL NULL 1
+explain partitions select * from t6 where a >= 3 and a <= 8;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t6 p3,p5,p7 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t6 where a > 3 and a < 5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+create table t7 (a int not null) partition by RANGE(a) (
+partition p10 values less than (10),
+partition p30 values less than (30),
+partition p50 values less than (50),
+partition p70 values less than (70),
+partition p90 values less than (90)
+);
+insert into t7 values (10),(30),(50);
+explain partitions select * from t7 where a < 5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t7 where a < 10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t7 where a <= 10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t7 p10,p30 system NULL NULL NULL NULL 1
+explain partitions select * from t7 where a = 10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t7 p30 system NULL NULL NULL NULL 1
+explain partitions select * from t7 where a < 90;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
+explain partitions select * from t7 where a = 90;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t7 where a > 90;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t7 where a >= 90;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t7 where a > 11 and a < 29;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+drop table t7;
+create table t7 (a int unsigned not null) partition by RANGE(a) (
+partition p10 values less than (10),
+partition p30 values less than (30),
+partition p50 values less than (50),
+partition p70 values less than (70),
+partition p90 values less than (90)
+);
+insert into t7 values (10),(30),(50);
+explain partitions select * from t7 where a < 5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t7 where a < 10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t7 where a <= 10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t7 p10,p30 system NULL NULL NULL NULL 1
+explain partitions select * from t7 where a = 10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t7 p30 system NULL NULL NULL NULL 1
+explain partitions select * from t7 where a < 90;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
+explain partitions select * from t7 where a = 90;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t7 where a > 90;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t7 where a >= 90;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t7 where a > 11 and a < 29;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+create table t8 (a date not null) partition by RANGE(YEAR(a)) (
+partition p0 values less than (1980),
+partition p1 values less than (1990),
+partition p2 values less than (2000)
+);
+insert into t8 values ('1985-05-05'),('1995-05-05');
+explain partitions select * from t8 where a < '1980-02-02';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+create table t9 (a date not null) partition by RANGE(TO_DAYS(a)) (
+partition p0 values less than (732299), -- 2004-12-19
+partition p1 values less than (732468), -- 2005-06-06
+partition p2 values less than (732664) -- 2005-12-19
+);
+insert into t9 values ('2005-05-05'), ('2005-04-04');
+explain partitions select * from t9 where a < '2004-12-19';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t9 where a <= '2004-12-19';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t9 p0,p1 ALL NULL NULL NULL NULL 2 Using where
+drop table t5,t6,t7,t8,t9;
+create table t1 (
+a1 int not null
+)
+partition by range (a1) (
+partition p0 values less than (3),
+partition p1 values less than (6),
+partition p2 values less than (9)
+);
+insert into t1 values (1),(2),(3);
+explain partitions select * from t1 where a1 > 3;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t1 where a1 >= 3;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1,p2 system NULL NULL NULL NULL 1
+explain partitions select * from t1 where a1 < 3 and a1 > 3;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+drop table t1;
+create table t3 (a int, b int)
+partition by list(a) subpartition by hash(b) subpartitions 4 (
+partition p0 values in (1),
+partition p1 values in (2),
+partition p2 values in (3),
+partition p3 values in (4)
+);
+insert into t3 values (1,1),(2,2),(3,3);
+explain partitions select * from t3 where a=2 or b=1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 p0_p0sp1,p1_p1sp0,p1_p1sp1,p1_p1sp2,p1_p1sp3,p2_p2sp1,p3_p3sp1 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t3 where a=4 or b=2;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 p0_p0sp2,p1_p1sp2,p2_p2sp2,p3_p3sp0,p3_p3sp1,p3_p3sp2,p3_p3sp3 system NULL NULL NULL NULL 1
+explain partitions select * from t3 where (a=2 or b=1) and (a=4 or b=2) ;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 p1_p1sp2,p3_p3sp1 system NULL NULL NULL NULL 1
+drop table t3;
+create table t1 (a int) partition by hash(a) partitions 2;
+insert into t1 values (1),(2);
+explain partitions select * from t1 where a is null;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t1 where a is not null;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 2 Using where
+drop table t1;
+create table t1 (a int not null, b int not null, key(a), key(b))
+partition by hash(a) partitions 4;
+insert into t1 values (1,1),(2,2),(3,3),(4,4);
+explain partitions
+select * from t1 X, t1 Y
+where X.b = Y.b and (X.a=1 or X.a=2) and (Y.a=2 or Y.a=3);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE X p1,p2 ALL a,b NULL NULL NULL 2 Using where
+1 SIMPLE Y p2,p3 ref a,b b 4 test.X.b 2 Using where
+explain partitions
+select * from t1 X, t1 Y where X.a = Y.a and (X.a=1 or X.a=2);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE X p1,p2 ALL a NULL NULL NULL 2 Using where
+1 SIMPLE Y p1,p2 ref a a 4 test.X.a 2
+drop table t1;
+create table t1 (a int) partition by hash(a) partitions 20;
+insert into t1 values (1),(2),(3);
+explain partitions select * from t1 where a > 1 and a < 3;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2 system NULL NULL NULL NULL 1
+explain partitions select * from t1 where a >= 1 and a < 3;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1,p2 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t1 where a > 1 and a <= 3;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t1 where a >= 1 and a <= 3;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1,p2,p3 ALL NULL NULL NULL NULL 3 Using where
+drop table t1;
+create table t1 (a int, b int)
+partition by list(a) subpartition by hash(b) subpartitions 20
+(
+partition p0 values in (0),
+partition p1 values in (1),
+partition p2 values in (2),
+partition p3 values in (3)
+);
+insert into t1 values (1,1),(2,2),(3,3);
+explain partitions select * from t1 where b > 1 and b < 3;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0_p0sp2,p1_p1sp2,p2_p2sp2,p3_p3sp2 system NULL NULL NULL NULL 1
+explain partitions select * from t1 where b > 1 and b < 3 and (a =1 or a =2);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1_p1sp2,p2_p2sp2 system NULL NULL NULL NULL 1
+drop table t1;
+create table t1 (a int) partition by list(a) (
+partition p0 values in (1,2),
+partition p1 values in (3,4)
+);
+insert into t1 values (1),(1),(2),(2),(3),(4),(3),(4);
+flush status;
+update t1 set a=100 where a=5;
+show status like 'Handler_read_rnd_next';
+Variable_name Value
+Handler_read_rnd_next 0
+flush status;
+update t1 set a=100 where a+1=5+1;
+show status like 'Handler_read_rnd_next';
+Variable_name Value
+Handler_read_rnd_next 10
+flush status;
+delete from t1 where a=5;
+show status like 'Handler_read_rnd_next';
+Variable_name Value
+Handler_read_rnd_next 0
+flush status;
+delete from t1 where a+1=5+1;
+show status like 'Handler_read_rnd_next';
+Variable_name Value
+Handler_read_rnd_next 10
+create table t2 like t1;
+insert into t2 select * from t2;
+flush status;
+update t1,t2 set t1.a=1000, t2.a=1000 where t1.a=5 and t2.a=5;
+show status like 'Handler_read_rnd_next';
+Variable_name Value
+Handler_read_rnd_next 0
+flush status;
+delete t1,t2 from t1, t2 where t1.a=5 and t2.a=5;
+show status like 'Handler_read_rnd_next';
+Variable_name Value
+Handler_read_rnd_next 0
+drop table t1,t2;
+CREATE TABLE `t1` (
+`a` int(11) default NULL
+);
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+CREATE TABLE `t2` (
+`a` int(11) default NULL,
+KEY `a` (`a`)
+) ;
+insert into t2 select A.a + 10*(B.a + 10* C.a) from t1 A, t1 B, t1 C ;
+insert into t1 select a from t2;
+drop table t2;
+CREATE TABLE `t2` (
+`a` int(11) default NULL,
+`b` int(11) default NULL
+)
+PARTITION BY RANGE (a) (
+PARTITION p0 VALUES LESS THAN (200),
+PARTITION p1 VALUES LESS THAN (400),
+PARTITION p2 VALUES LESS THAN (600),
+PARTITION p3 VALUES LESS THAN (800),
+PARTITION p4 VALUES LESS THAN (1001));
+insert into t2 select a,1 from t1 where a < 200;
+insert into t2 select a,2 from t1 where a >= 200 and a < 400;
+insert into t2 select a,3 from t1 where a >= 400 and a < 600;
+insert into t2 select a,4 from t1 where a >= 600 and a < 800;
+insert into t2 select a,5 from t1 where a >= 800 and a < 1001;
+explain partitions select * from t2;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p0,p1,p2,p3,p4 ALL NULL NULL NULL NULL 1010
+explain partitions select * from t2 where a < 801 and a > 200;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p1,p2,p3,p4 ALL NULL NULL NULL NULL 800 Using where
+explain partitions select * from t2 where a < 801 and a > 800;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p4 ALL NULL NULL NULL NULL 200 Using where
+explain partitions select * from t2 where a > 600;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 400 Using where
+explain partitions select * from t2 where a > 600 and b = 1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 400 Using where
+explain partitions select * from t2 where a > 600 and b = 4;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 400 Using where
+explain partitions select * from t2 where a > 600 and b = 5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 400 Using where
+explain partitions select * from t2 where b = 5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p0,p1,p2,p3,p4 ALL NULL NULL NULL NULL 1010 Using where
+flush status;
+update t2 set b = 100 where b = 6;
+show status like 'Handler_read_rnd_next';
+Variable_name Value
+Handler_read_rnd_next 1015
+flush status;
+update t2 set a = 1002 where a = 1001;
+show status like 'Handler_read_rnd_next';
+Variable_name Value
+Handler_read_rnd_next 0
+flush status;
+update t2 set b = 6 where a = 600;
+show status like 'Handler_read_rnd_next';
+Variable_name Value
+Handler_read_rnd_next 201
+flush status;
+update t2 set b = 6 where a > 600 and a < 800;
+show status like 'Handler_read_rnd_next';
+Variable_name Value
+Handler_read_rnd_next 201
+flush status;
+delete from t2 where a > 600;
+show status like 'Handler_read_rnd_next';
+Variable_name Value
+Handler_read_rnd_next 402
+drop table t2;
+CREATE TABLE `t2` (
+`a` int(11) default NULL,
+`b` int(11) default NULL,
+index (b)
+)
+PARTITION BY RANGE (a) (
+PARTITION p0 VALUES LESS THAN (200),
+PARTITION p1 VALUES LESS THAN (400),
+PARTITION p2 VALUES LESS THAN (600),
+PARTITION p3 VALUES LESS THAN (800),
+PARTITION p4 VALUES LESS THAN (1001));
+insert into t2 select a,1 from t1 where a < 100;
+insert into t2 select a,2 from t1 where a >= 200 and a < 300;
+insert into t2 select a,3 from t1 where a >= 300 and a < 400;
+insert into t2 select a,4 from t1 where a >= 400 and a < 500;
+insert into t2 select a,5 from t1 where a >= 500 and a < 600;
+insert into t2 select a,6 from t1 where a >= 600 and a < 700;
+insert into t2 select a,7 from t1 where a >= 700 and a < 800;
+insert into t2 select a,8 from t1 where a >= 800 and a < 900;
+insert into t2 select a,9 from t1 where a >= 900 and a < 1001;
+explain partitions select * from t2;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p0,p1,p2,p3,p4 ALL NULL NULL NULL NULL 910
+explain partitions select * from t2 where a = 101;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 110 Using where
+explain partitions select * from t2 where a = 550;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 200 Using where
+explain partitions select * from t2 where a = 833;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p4 ALL NULL NULL NULL NULL 200 Using where
+explain partitions select * from t2 where (a = 100 OR a = 900);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p0,p4 ALL NULL NULL NULL NULL 310 Using where
+explain partitions select * from t2 where (a > 100 AND a < 600);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p0,p1,p2,p3 ALL NULL NULL NULL NULL 710 Using where
+explain partitions select * from t2 where b = 4;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 76 Using where
+explain extended select * from t2 where b = 6;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ref b b 5 const 76 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = 6)
+explain partitions select * from t2 where b = 6;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 76 Using where
+explain extended select * from t2 where b in (1,3,5);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL b NULL NULL NULL 910 40.66 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` in (1,3,5))
+explain partitions select * from t2 where b in (1,3,5);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
+explain extended select * from t2 where b in (2,4,6);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL b NULL NULL NULL 910 25.05 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` in (2,4,6))
+explain partitions select * from t2 where b in (2,4,6);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
+explain extended select * from t2 where b in (7,8,9);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL b NULL NULL NULL 910 36.70 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` in (7,8,9))
+explain partitions select * from t2 where b in (7,8,9);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
+explain extended select * from t2 where b > 5;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL b NULL NULL NULL 910 44.84 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` > 5)
+explain partitions select * from t2 where b > 5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
+explain extended select * from t2 where b > 5 and b < 8;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL b NULL NULL NULL 910 22.09 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where ((`test`.`t2`.`b` > 5) and (`test`.`t2`.`b` < 8))
+explain partitions select * from t2 where b > 5 and b < 8;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
+explain extended select * from t2 where b > 5 and b < 7;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 range b b 5 NULL 76 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where ((`test`.`t2`.`b` > 5) and (`test`.`t2`.`b` < 7))
+explain partitions select * from t2 where b > 5 and b < 7;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p0,p1,p2,p3,p4 range b b 5 NULL 76 Using where
+explain extended select * from t2 where b > 0 and b < 5;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL b NULL NULL NULL 910 41.65 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where ((`test`.`t2`.`b` > 0) and (`test`.`t2`.`b` < 5))
+explain partitions select * from t2 where b > 0 and b < 5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
+flush status;
+update t2 set a = 111 where b = 10;
+show status like 'Handler_read_rnd_next';
+Variable_name Value
+Handler_read_rnd_next 0
+show status like 'Handler_read_key';
+Variable_name Value
+Handler_read_key 5
+flush status;
+update t2 set a = 111 where b in (5,6);
+show status like 'Handler_read_rnd_next';
+Variable_name Value
+Handler_read_rnd_next 915
+show status like 'Handler_read_key';
+Variable_name Value
+Handler_read_key 0
+flush status;
+update t2 set a = 222 where b = 7;
+show status like 'Handler_read_rnd_next';
+Variable_name Value
+Handler_read_rnd_next 0
+show status like 'Handler_read_key';
+Variable_name Value
+Handler_read_key 5
+flush status;
+delete from t2 where b = 7;
+show status like 'Handler_read_rnd_next';
+Variable_name Value
+Handler_read_rnd_next 0
+show status like 'Handler_read_key';
+Variable_name Value
+Handler_read_key 5
+flush status;
+delete from t2 where b > 5;
+show status like 'Handler_read_rnd_next';
+Variable_name Value
+Handler_read_rnd_next 1215
+show status like 'Handler_read_key';
+Variable_name Value
+Handler_read_key 0
+show status like 'Handler_read_prev';
+Variable_name Value
+Handler_read_prev 0
+show status like 'Handler_read_next';
+Variable_name Value
+Handler_read_next 0
+flush status;
+delete from t2 where b < 5 or b > 3;
+show status like 'Handler_read_rnd_next';
+Variable_name Value
+Handler_read_rnd_next 1215
+show status like 'Handler_read_key';
+Variable_name Value
+Handler_read_key 0
+show status like 'Handler_read_prev';
+Variable_name Value
+Handler_read_prev 0
+show status like 'Handler_read_next';
+Variable_name Value
+Handler_read_next 0
+drop table t1, t2;
+create table t1 ( f_int1 mediumint, f_int2 integer)
+partition by list(mod(f_int1,4)) (
+partition p_3 values in (-3),
+partition p_2 values in (-2),
+partition p_1 values in (-1),
+partition p0 values in (0),
+partition p1 values in (1),
+partition p2 values in (2),
+partition p3 values in (3)
+);
+insert into t1 values (9, 9), (8, 8), (7, 7), (6, 6), (5, 5),
+(4, 4), (3, 3), (2, 2), (1, 1);
+select * from t1 where f_int1 between 5 and 15 order by f_int1;
+f_int1 f_int2
+5 5
+6 6
+7 7
+8 8
+9 9
+drop table t1;
+create table t1 (a char(10) binary)
+partition by list(length(a))
+(partition p1 values in (1),
+partition p2 values in (2),
+partition p3 values in (3),
+partition p4 values in (4),
+partition p5 values in (5)
+);
+insert into t1 values ('a'),('bb'),('ccc'),('dddd'),('eeEee');
+select * from t1 where a>='a' and a <= 'dddd';
+a
+a
+bb
+ccc
+dddd
+explain partitions select * from t1 where a>='a' and a <= 'dddd';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1,p2,p3,p4,p5 ALL NULL NULL NULL NULL 5 Using where
+drop table t1;
+create table t1 (f_int1 integer) partition by list(abs(mod(f_int1,2)))
+subpartition by hash(f_int1) subpartitions 2
+(
+partition part1 values in (0),
+partition part2 values in (1),
+partition part4 values in (null)
+);
+insert into t1 set f_int1 = null;
+select * from t1 where f_int1 is null;
+f_int1
+NULL
+explain partitions select * from t1 where f_int1 is null;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 part4_part4sp0 system NULL NULL NULL NULL 1
+drop table t1;
+create table t1 (a int not null, b int not null)
+partition by list(a)
+subpartition by hash(b) subpartitions 4
+(
+partition p0 values in (1),
+partition p1 values in (2),
+partition p2 values in (3)
+);
+insert into t1 values (1,1),(1,2),(1,3),(1,4),
+(2,1),(2,2),(2,3),(2,4);
+explain partitions select * from t1 where a=1 AND (b=1 OR b=2);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0_p0sp1,p0_p0sp2 ALL NULL NULL NULL NULL 2 Using where
+drop table t1;
+create table t1 (a int, b int not null)
+partition by list(a)
+subpartition by hash(b) subpartitions 2
+(
+partition p0 values in (1),
+partition p1 values in (2),
+partition p2 values in (3),
+partition pn values in (NULL)
+);
+insert into t1 values (1,1),(1,2),(1,3),(1,4),
+(2,1),(2,2),(2,3),(2,4), (NULL,1);
+explain partitions select * from t1 where a IS NULL AND (b=1 OR b=2);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 pn_pnsp0,pn_pnsp1 system NULL NULL NULL NULL 1
+explain partitions select * from t1 where (a IS NULL or a < 1) AND (b=1 OR b=2);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 pn_pnsp0,pn_pnsp1 system NULL NULL NULL NULL 1
+explain partitions select * from t1 where (a IS NULL or a < 2) AND (b=1 OR b=2);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0_p0sp0,p0_p0sp1,pn_pnsp0,pn_pnsp1 ALL NULL NULL NULL NULL 5 Using where
+explain partitions select * from t1 where (a IS NULL or a <= 1) AND (b=1 OR b=2);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0_p0sp0,p0_p0sp1,pn_pnsp0,pn_pnsp1 ALL NULL NULL NULL NULL 5 Using where
+drop table t1;
+create table t1 ( a int) partition by list (MOD(a, 10))
+( partition p0 values in (0), partition p1 values in (1),
+partition p2 values in (2), partition p3 values in (3),
+partition p4 values in (4), partition p5 values in (5),
+partition p6 values in (6), partition pn values in (NULL)
+);
+insert into t1 values (NULL), (0),(1),(2),(3),(4),(5),(6);
+explain partitions select * from t1 where a is null or a < 2;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,pn ALL NULL NULL NULL NULL 8 Using where
+drop table t1;
+create table t1 (s1 int) partition by list (s1)
+(partition p1 values in (0),
+partition p2 values in (1),
+partition p3 values in (null));
+insert into t1 values (0),(1),(null);
+select count(*) from t1 where s1 < 0 or s1 is null;
+count(*)
+1
+explain partitions select count(*) from t1 where s1 < 0 or s1 is null;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p3 system NULL NULL NULL NULL 1
+drop table t1;
+create table t1 (a char(32) primary key)
+partition by key()
+partitions 100;
+insert into t1 values ('na');
+select * from t1;
+a
+na
+select * from t1 where a like 'n%';
+a
+na
+drop table t1;
+create table t1 (s1 varchar(15)) partition by key (s1);
+select * from t1 where s1 = 0 or s1 is null;
+s1
+insert into t1 values ('aa'),('bb'),('0');
+explain partitions select * from t1 where s1 = 0 or s1 is null;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 3 Using where
+drop table t1;
+create table t2 (a int, b int)
+partition by LIST(a)
+subpartition by HASH(b) subpartitions 40
+( partition p_0_long_partition_name values in(1),
+partition p_1_long_partition_name values in(2));
+insert into t2 values (1,1),(2,2);
+explain partitions select * from t2;
+id 1
+select_type SIMPLE
+table t2
+partitions p_0_long_partition_name_p_0_long_partition_namesp0,p_0_long_partition_name_p_0_long_partition_namesp1,p_0_long_partition_name_p_0_long_partition_namesp2,p_0_long_partition_name_p_0_long_partition_namesp3,p_0_long_partition_name_p_0_long_partition_namesp4,p_0_long_partition_name_p_0_long_partition_namesp5,p_0_long_partition_name_p_0_long_partition_namesp6,p_0_long_partition_name_p_0_long_partition_namesp7,p_0_long_partition_name_p_0_long_partition_namesp8,p_0_long_partition_name_p_0_long_partition_namesp9,p_0_long_partition_name_p_0_long_partition_namesp10,p_0_long_partition_name_p_0_long_partition_namesp11,p_0_long_partition_name_p_0_long_partition_namesp12,p_0_long_partition_name_p_0_long_partition_namesp13,p_0_long_partition_name_p_0_long_partition_namesp14,p_0_long_partition_name_p_0_long_partition_namesp15,p_0_long_partition_name_p_0_long_partition_namesp16,p_0_long_partition_name_p_0_long_partition_namesp17,p_0_long_partition_name_p_0_long_partition_namesp18,p_0_long_partition_name_p_0_long_partition_namesp19,p_0_long_partition_name_p_0_long_partition_namesp20,p_0_long_partition_name_p_0_long_partition_namesp21,p_0_long_partition_name_p_0_long_partition_namesp22,p_0_long_partition_name_p_0_long_partition_namesp23,p_0_long_partition_name_p_0_long_partition_namesp24,p_0_long_partition_name_p_0_long_partition_namesp25,p_0_long_partition_name_p_0_long_partition_namesp26,p_0_long_partition_name_p_0_long_partition_namesp27,p_0_long_partition_name_p_0_long_partition_namesp28,p_0_long_partition_name_p_0_long_partition_namesp29,p_0_long_partition_name_p_0_long_partition_namesp30,p_0_long_partition_name_p_0_long_partition_namesp31,p_0_long_partition_name_p_0_long_partition_namesp32,p_0_long_partition_name_p_0_long_partition_namesp33,p_0_long_partition_name_p_0_long_partition_namesp34,p_0_long_partition_name_p_0_long_partition_namesp35,p_0_long_partition_name_p_0_long_partition_namesp36,p_0_long_partition_name_p_0_long_partition_namesp37,p_0_long_partition_name_p_0_long_partition_namesp38,p_0_long_partition_name_p_0_long_partition_namesp39,p_1_long_partition_name_p_1_long_partition_namesp0,p_1_long_partition_name_p_1_long_partition_namesp1,p_1_long_partition_name_p_1_long_partition_namesp2,p_1_long_partition_name_p_1_long_partition_namesp3,p_1_long_partition_name_p_1_long_partition_namesp4,p_1_long_partition_name_p_1_long_partition_namesp5,p_1_long_partition_name_p_1_long_partition_namesp6,p_1_long_partition_name_p_1_long_partition_namesp7,p_1_long_partition_name_p_1_long_partition_namesp8,p_1_long_partition_name_p_1_long_partition_namesp9,p_1_long_partition_name_p_1_long_partition_namesp10,p_1_long_partition_name_p_1_long_partition_namesp11,p_1_long_partition_name_p_1_long_partition_namesp12,p_1_long_partition_name_p_1_long_partition_namesp13,p_1_long_partition_name_p_1_long_partition_namesp14,p_1_long_partition_name_p_1_long_partition_namesp15,p_1_long_partition_name_p_1_long_partition_namesp16,p_1_long_partition_name_p_1_long_partition_namesp17,p_1_long_partition_name_p_1_long_partition_namesp18,p_1_long_partition_name_p_1_long_partition_namesp19,p_1_long_partition_name_p_1_long_partition_namesp20,p_1_long_partition_name_p_1_long_partition_namesp21,p_1_long_partition_name_p_1_long_partition_namesp22,p_1_long_partition_name_p_1_long_partition_namesp23,p_1_long_partition_name_p_1_long_partition_namesp24,p_1_long_partition_name_p_1_long_partition_namesp25,p_1_long_partition_name_p_1_long_partition_namesp26,p_1_long_partition_name_p_1_long_partition_namesp27,p_1_long_partition_name_p_1_long_partition_namesp28,p_1_long_partition_name_p_1_long_partition_namesp29,p_1_long_partition_name_p_1_long_partition_namesp30,p_1_long_partition_name_p_1_long_partition_namesp31,p_1_long_partition_name_p_1_long_partition_namesp32,p_1_long_partition_name_p_1_long_partition_namesp33,p_1_long_partition_name_p_1_long_partition_namesp34,p_1_long_partition_name_p_1_long_partition_namesp35,p_1_long_partition_name_p_1_long_partition_namesp36,p_1_long_partition_name_p_1_long_partition_namesp37,p_1_long_partition_name_p_1_long_partition_namesp38,p_1_long_partition_name_p_1_long_partition_namesp39
+type ALL
+possible_keys NULL
+key NULL
+key_len NULL
+ref NULL
+rows 2
+Extra
+drop table t2;
+create table t1 (s1 int);
+explain partitions select 1 from t1 union all select 2;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 const row not found
+2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL
+drop table t1;
+create table t1 (a bigint unsigned not null) partition by range(a) (
+partition p0 values less than (10),
+partition p1 values less than (100),
+partition p2 values less than (1000),
+partition p3 values less than (18446744073709551000),
+partition p4 values less than (18446744073709551614)
+);
+insert into t1 values (5),(15),(105),(1005);
+insert into t1 values (18446744073709551000+1);
+insert into t1 values (18446744073709551614-1);
+explain partitions select * from t1 where a < 10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 system NULL NULL NULL NULL 1
+explain partitions select * from t1
+where a >= 18446744073709551000-1 and a <= 18446744073709551000+1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p3,p4 ALL NULL NULL NULL NULL 3 Using where
+explain partitions select * from t1
+where a between 18446744073709551001 and 18446744073709551002;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t1 where a = 18446744073709551000;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t1 where a = 18446744073709551613;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t1 where a = 18446744073709551614;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+drop table t1;
+create table t1 (a int)
+partition by range((a & 0xFF) << 56) (
+partition p0 values less than (0x40 << 56),
+partition p1 values less than (0x80 << 56),
+partition p2 values less than (0xFF << 56)
+);
+insert into t1 values (0x20), (0x20), (0x41), (0x41), (0xFE), (0xFE);
+explain partitions select * from t1 where a=0;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t1 where a=0xFE;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t1 where a>0xFE and a<= 0xFF;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+drop table t1;
+create table t1(a bigint unsigned not null) partition by range(a+0) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (2305561538531885056),
+partition p4 values less than (2305561538531950591)
+);
+insert into t1 values (9),(19),(0xFFFF0000FFFF000-1), (0xFFFF0000FFFFFFF-1);
+insert into t1 values (9),(19),(0xFFFF0000FFFF000-1), (0xFFFF0000FFFFFFF-1);
+explain partitions select * from t1 where
+a >= 2305561538531885056-10 and a <= 2305561538531885056-8;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p3 ALL NULL NULL NULL NULL 4 Using where
+explain partitions select * from t1 where
+a > 0xFFFFFFFFFFFFFFEC and a < 0xFFFFFFFFFFFFFFEE;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t1 where a>=0 and a <= 0xFFFFFFFFFFFFFFFF;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1,p2,p3,p4 ALL NULL NULL NULL NULL 8 Using where
+drop table t1;
+create table t1 (a bigint) partition by range(a+0) (
+partition p1 values less than (-1000),
+partition p2 values less than (-10),
+partition p3 values less than (10),
+partition p4 values less than (1000)
+);
+insert into t1 values (-15),(-5),(5),(15),(-15),(-5),(5),(15);
+explain partitions select * from t1 where a>-2 and a <=0;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p3 ALL NULL NULL NULL NULL 4 Using where
+drop table t1;
diff --git a/mysql-test/r/partition_range.result b/mysql-test/r/partition_range.result
new file mode 100644
index 00000000000..d39b39f413a
--- /dev/null
+++ b/mysql-test/r/partition_range.result
@@ -0,0 +1,787 @@
+drop table if exists t1;
+create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int)
+partition by range (length(a) * b)
+(partition p0 values less than (2), partition p1 values less than (400));
+insert into t1 values ('a ', 2),('a',3);
+drop table t1;
+create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int)
+partition by range (b* length(a) * b)
+(partition p0 values less than (2), partition p1 values less than (400));
+insert into t1 values ('a ', 2),('a',3);
+drop table t1;
+create table t1 (a varchar(10) charset latin1 collate latin1_bin,
+b varchar(10) charset latin1 collate latin1_bin)
+partition by range (length(b) * length(a))
+(partition p0 values less than (2), partition p1 values less than (400));
+insert into t1 values ('a ', 'b '),('a','b');
+drop table t1;
+create table t1 (a varchar(10) charset latin1 collate latin1_bin,
+b varchar(10) charset latin1 collate latin1_bin)
+partition by range (length(a) * length(b))
+(partition p0 values less than (2), partition p1 values less than (400));
+insert into t1 values ('a ', 'b '),('a','b');
+drop table t1;
+create table t1 (a varchar(10) charset latin1 collate latin1_bin,
+b varchar(10) charset latin1 collate latin1_bin, c int)
+partition by range (length(a) * c)
+(partition p0 values less than (2), partition p1 values less than (400));
+insert into t1 values ('a ', 'b ', 2),('a','b', 3);
+drop table t1;
+create table t1 (a varchar(10) charset latin1 collate latin1_bin,
+b varchar(10) charset latin1 collate latin1_bin, c int)
+partition by range (c * length(a))
+(partition p0 values less than (2), partition p1 values less than (400));
+insert into t1 values ('a ', 'b ', 2),('a','b', 3);
+drop table t1;
+create table t1 (a int unsigned)
+partition by range (a)
+(partition pnull values less than (0),
+partition p0 values less than (1),
+partition p1 values less than(2));
+insert into t1 values (null),(0),(1);
+select * from t1 where a is null;
+a
+NULL
+select * from t1 where a >= 0;
+a
+0
+1
+select * from t1 where a < 0;
+a
+select * from t1 where a <= 0;
+a
+0
+select * from t1 where a > 1;
+a
+explain partitions select * from t1 where a is null;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 pnull system NULL NULL NULL NULL 1
+explain partitions select * from t1 where a >= 0;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t1 where a < 0;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain partitions select * from t1 where a <= 0;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 pnull,p0 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t1 where a > 1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+drop table t1;
+create table t1 (a int unsigned, b int unsigned)
+partition by range (a)
+subpartition by hash (b)
+subpartitions 2
+(partition pnull values less than (0),
+partition p0 values less than (1),
+partition p1 values less than(2));
+insert into t1 values (null,0),(null,1),(0,0),(0,1),(1,0),(1,1);
+select * from t1 where a is null;
+a b
+NULL 0
+NULL 1
+select * from t1 where a >= 0;
+a b
+0 0
+0 1
+1 0
+1 1
+select * from t1 where a < 0;
+a b
+select * from t1 where a <= 0;
+a b
+0 0
+0 1
+select * from t1 where a > 1;
+a b
+explain partitions select * from t1 where a is null;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t1 where a >= 0;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 4 Using where
+explain partitions select * from t1 where a < 0;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 2 Using where
+explain partitions select * from t1 where a <= 0;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1,p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 4 Using where
+explain partitions select * from t1 where a > 1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 2 Using where
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a)
+partitions 3
+(partition x1 values less than (5) tablespace ts1,
+partition x2 values less than (10) tablespace ts2,
+partition x3 values less than maxvalue tablespace ts3);
+INSERT into t1 values (1, 1, 1);
+INSERT into t1 values (6, 1, 1);
+INSERT into t1 values (10, 1, 1);
+INSERT into t1 values (15, 1, 1);
+select * from t1;
+a b c
+1 1 1
+6 1 1
+10 1 1
+15 1 1
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` int(11) NOT NULL,
+ `c` int(11) NOT NULL,
+ PRIMARY KEY (`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) (PARTITION x1 VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM, PARTITION x2 VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM, PARTITION x3 VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM) */
+ALTER TABLE t1
+partition by range (a)
+partitions 3
+(partition x1 values less than (5) tablespace ts1,
+partition x2 values less than (10) tablespace ts2,
+partition x3 values less than maxvalue tablespace ts3);
+select * from t1;
+a b c
+1 1 1
+6 1 1
+10 1 1
+15 1 1
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` int(11) NOT NULL,
+ `c` int(11) NOT NULL,
+ PRIMARY KEY (`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) (PARTITION x1 VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM, PARTITION x2 VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM, PARTITION x3 VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM) */
+drop table if exists t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null)
+partition by range (a)
+partitions 3
+(partition x1 values less than (5) tablespace ts1,
+partition x2 values less than (10) tablespace ts2,
+partition x3 values less than maxvalue tablespace ts3);
+INSERT into t1 values (1, 1, 1);
+INSERT into t1 values (6, 1, 1);
+INSERT into t1 values (10, 1, 1);
+INSERT into t1 values (15, 1, 1);
+select * from t1;
+a b c
+1 1 1
+6 1 1
+10 1 1
+15 1 1
+ALTER TABLE t1
+partition by range (a)
+partitions 3
+(partition x1 values less than (5) tablespace ts1,
+partition x2 values less than (10) tablespace ts2,
+partition x3 values less than maxvalue tablespace ts3);
+select * from t1;
+a b c
+1 1 1
+6 1 1
+10 1 1
+15 1 1
+drop table if exists t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a)
+partitions 3
+(partition x1 values less than (5) tablespace ts1,
+partition x2 values less than (10) tablespace ts2,
+partition x3 values less than (15) tablespace ts3);
+INSERT into t1 values (1, 1, 1);
+INSERT into t1 values (6, 1, 1);
+INSERT into t1 values (10, 1, 1);
+INSERT into t1 values (15, 1, 1);
+ERROR HY000: Table has no partition for value 15
+select * from t1;
+a b c
+1 1 1
+6 1 1
+10 1 1
+ALTER TABLE t1
+partition by range (a)
+partitions 3
+(partition x1 values less than (5) tablespace ts1,
+partition x2 values less than (10) tablespace ts2,
+partition x3 values less than (15) tablespace ts3);
+select * from t1;
+a b c
+1 1 1
+6 1 1
+10 1 1
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a)
+(partition x1 values less than (1));
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+( subpartition x11,
+subpartition x12),
+partition x2 values less than (5)
+( subpartition x21,
+subpartition x22)
+);
+SELECT * from t1;
+a b c
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` int(11) NOT NULL,
+ `c` int(11) NOT NULL,
+ PRIMARY KEY (`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a+b) (PARTITION x1 VALUES LESS THAN (1) (SUBPARTITION x11 ENGINE = MyISAM, SUBPARTITION x12 ENGINE = MyISAM), PARTITION x2 VALUES LESS THAN (5) (SUBPARTITION x21 ENGINE = MyISAM, SUBPARTITION x22 ENGINE = MyISAM)) */
+ALTER TABLE t1 ADD COLUMN d int;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` int(11) NOT NULL,
+ `c` int(11) NOT NULL,
+ `d` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a+b) (PARTITION x1 VALUES LESS THAN (1) (SUBPARTITION x11 ENGINE = MyISAM, SUBPARTITION x12 ENGINE = MyISAM), PARTITION x2 VALUES LESS THAN (5) (SUBPARTITION x21 ENGINE = MyISAM, SUBPARTITION x22 ENGINE = MyISAM)) */
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+( subpartition x11 tablespace t1 engine myisam nodegroup 0,
+subpartition x12 tablespace t2 engine myisam nodegroup 1),
+partition x2 values less than (5)
+( subpartition x21 tablespace t1 engine myisam nodegroup 0,
+subpartition x22 tablespace t2 engine myisam nodegroup 1)
+);
+SELECT * from t1;
+a b c
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+( subpartition x11 tablespace t1 nodegroup 0,
+subpartition x12 tablespace t2 nodegroup 1),
+partition x2 values less than (5)
+( subpartition x21 tablespace t1 nodegroup 0,
+subpartition x22 tablespace t2 nodegroup 1)
+);
+SELECT * from t1;
+a b c
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+( subpartition x11 engine myisam nodegroup 0,
+subpartition x12 engine myisam nodegroup 1),
+partition x2 values less than (5)
+( subpartition x21 engine myisam nodegroup 0,
+subpartition x22 engine myisam nodegroup 1)
+);
+INSERT into t1 VALUES (1,1,1);
+INSERT into t1 VALUES (4,1,1);
+INSERT into t1 VALUES (5,1,1);
+ERROR HY000: Table has no partition for value 5
+SELECT * from t1;
+a b c
+1 1 1
+4 1 1
+ALTER TABLE t1
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+( subpartition x11 engine myisam nodegroup 0,
+subpartition x12 engine myisam nodegroup 1),
+partition x2 values less than (5)
+( subpartition x21 engine myisam nodegroup 0,
+subpartition x22 engine myisam nodegroup 1)
+);
+SELECT * from t1;
+a b c
+1 1 1
+4 1 1
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+( subpartition x11 tablespace t1 engine myisam,
+subpartition x12 tablespace t2 engine myisam),
+partition x2 values less than (5)
+( subpartition x21 tablespace t1 engine myisam,
+subpartition x22 tablespace t2 engine myisam)
+);
+INSERT into t1 VALUES (1,1,1);
+INSERT into t1 VALUES (4,1,1);
+INSERT into t1 VALUES (5,1,1);
+ERROR HY000: Table has no partition for value 5
+SELECT * from t1;
+a b c
+1 1 1
+4 1 1
+ALTER TABLE t1
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+( subpartition x11 tablespace t1 engine myisam,
+subpartition x12 tablespace t2 engine myisam),
+partition x2 values less than (5)
+( subpartition x21 tablespace t1 engine myisam,
+subpartition x22 tablespace t2 engine myisam)
+);
+SELECT * from t1;
+a b c
+1 1 1
+4 1 1
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+( subpartition x11 tablespace t1,
+subpartition x12 tablespace t2),
+partition x2 values less than (5)
+( subpartition x21 tablespace t1,
+subpartition x22 tablespace t2)
+);
+INSERT into t1 VALUES (1,1,1);
+INSERT into t1 VALUES (4,1,1);
+INSERT into t1 VALUES (5,1,1);
+ERROR HY000: Table has no partition for value 5
+SELECT * from t1;
+a b c
+1 1 1
+4 1 1
+ALTER TABLE t1
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+( subpartition x11 tablespace t1 engine myisam,
+subpartition x12 tablespace t2 engine myisam),
+partition x2 values less than (5)
+( subpartition x21 tablespace t1 engine myisam,
+subpartition x22 tablespace t2 engine myisam)
+);
+SELECT * from t1;
+a b c
+1 1 1
+4 1 1
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+( subpartition x11 engine myisam,
+subpartition x12 engine myisam),
+partition x2 values less than (5)
+( subpartition x21 engine myisam,
+subpartition x22 engine myisam)
+);
+INSERT into t1 VALUES (1,1,1);
+INSERT into t1 VALUES (4,1,1);
+INSERT into t1 VALUES (5,1,1);
+ERROR HY000: Table has no partition for value 5
+SELECT * from t1;
+a b c
+1 1 1
+4 1 1
+ALTER TABLE t1
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+( subpartition x11 engine myisam,
+subpartition x12 engine myisam),
+partition x2 values less than (5)
+( subpartition x21 engine myisam,
+subpartition x22 engine myisam)
+);
+SELECT * from t1;
+a b c
+1 1 1
+4 1 1
+drop table t1;
+CREATE TABLE t1 (c1 int default NULL, c2 varchar(30) default NULL,
+c3 date default NULL) engine=myisam
+PARTITION BY RANGE (year(c3)) (PARTITION p0 VALUES LESS THAN (1995),
+PARTITION p1 VALUES LESS THAN (1996) , PARTITION p2 VALUES LESS THAN (1997) ,
+PARTITION p3 VALUES LESS THAN (1998) , PARTITION p4 VALUES LESS THAN (1999) ,
+PARTITION p5 VALUES LESS THAN (2000) , PARTITION p6 VALUES LESS THAN (2001) ,
+PARTITION p7 VALUES LESS THAN (2002) , PARTITION p8 VALUES LESS THAN (2003) ,
+PARTITION p9 VALUES LESS THAN (2004) , PARTITION p10 VALUES LESS THAN (2010),
+PARTITION p11 VALUES LESS THAN MAXVALUE );
+INSERT INTO t1 VALUES (1, 'testing partitions', '1995-07-17'),
+(3, 'testing partitions','1995-07-31'),
+(5, 'testing partitions','1995-08-13'),
+(7, 'testing partitions','1995-08-26'),
+(9, 'testing partitions','1995-09-09'),
+(0, 'testing partitions','2000-07-10'),
+(2, 'testing partitions','2000-07-23'),
+(4, 'testing partitions','2000-08-05'),
+(6, 'testing partitions','2000-08-19'),
+(8, 'testing partitions','2000-09-01');
+SELECT COUNT(*) FROM t1 WHERE c3 BETWEEN '1996-12-31' AND '2000-12-31';
+COUNT(*)
+5
+SELECT COUNT(*) FROM t1 WHERE c3 < '2000-12-31';
+COUNT(*)
+10
+DROP TABLE t1;
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (10),
+partition p1 values less than (0));
+ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (0),
+partition p1 values less than (10));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (10) ENGINE = MyISAM) */
+drop table t1;
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (2),
+partition p1 values less than (10));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (2) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (10) ENGINE = MyISAM) */
+insert into t1 values (0xFFFFFFFFFFFFFFFF);
+ERROR HY000: Table has no partition for value 18446744073709551615
+drop table t1;
+create table t1 (a int)
+partition by range (MOD(a,3))
+subpartition by hash(a)
+subpartitions 2
+(partition p0 values less than (1),
+partition p1 values less than (2),
+partition p2 values less than (3),
+partition p3 values less than (4));
+ALTER TABLE t1 DROP PARTITION p3;
+ALTER TABLE t1 DROP PARTITION p1;
+ALTER TABLE t1 DROP PARTITION p2;
+drop table t1;
+create table t1 (a int)
+partition by range (MOD(a,3))
+subpartition by hash(a)
+subpartitions 2
+(partition p0 values less than (1),
+partition p1 values less than (2),
+partition p2 values less than (3),
+partition p3 values less than (4));
+ALTER TABLE t1 DROP PARTITION p0;
+ALTER TABLE t1 DROP PARTITION p1;
+ALTER TABLE t1 DROP PARTITION p2;
+drop table t1;
+create table t1 (a int DEFAULT NULL,
+b varchar(30) DEFAULT NULL,
+c date DEFAULT NULL)
+ENGINE=MYISAM DEFAULT CHARSET=latin1;
+insert into t1 values (1, 'abc', '1995-01-01');
+insert into t1 values (1, 'abc', '1995-01-02');
+insert into t1 values (1, 'abc', '1995-01-03');
+insert into t1 values (1, 'abc', '1995-01-04');
+insert into t1 values (1, 'abc', '1995-01-05');
+insert into t1 values (1, 'abc', '1995-01-06');
+insert into t1 values (1, 'abc', '1995-01-07');
+insert into t1 values (1, 'abc', '1995-01-08');
+insert into t1 values (1, 'abc', '1995-01-09');
+insert into t1 values (1, 'abc', '1995-01-10');
+insert into t1 values (1, 'abc', '1995-01-11');
+insert into t1 values (1, 'abc', '1995-01-12');
+insert into t1 values (1, 'abc', '1995-01-13');
+insert into t1 values (1, 'abc', '1995-01-14');
+insert into t1 values (1, 'abc', '1995-01-15');
+insert into t1 values (1, 'abc', '1997-01-01');
+insert into t1 values (1, 'abc', '1997-01-02');
+insert into t1 values (1, 'abc', '1997-01-03');
+insert into t1 values (1, 'abc', '1997-01-04');
+insert into t1 values (1, 'abc', '1997-01-05');
+insert into t1 values (1, 'abc', '1997-01-06');
+insert into t1 values (1, 'abc', '1997-01-07');
+insert into t1 values (1, 'abc', '1997-01-08');
+insert into t1 values (1, 'abc', '1997-01-09');
+insert into t1 values (1, 'abc', '1997-01-10');
+insert into t1 values (1, 'abc', '1997-01-11');
+insert into t1 values (1, 'abc', '1997-01-12');
+insert into t1 values (1, 'abc', '1997-01-13');
+insert into t1 values (1, 'abc', '1997-01-14');
+insert into t1 values (1, 'abc', '1997-01-15');
+insert into t1 values (1, 'abc', '1998-01-01');
+insert into t1 values (1, 'abc', '1998-01-02');
+insert into t1 values (1, 'abc', '1998-01-03');
+insert into t1 values (1, 'abc', '1998-01-04');
+insert into t1 values (1, 'abc', '1998-01-05');
+insert into t1 values (1, 'abc', '1998-01-06');
+insert into t1 values (1, 'abc', '1998-01-07');
+insert into t1 values (1, 'abc', '1998-01-08');
+insert into t1 values (1, 'abc', '1998-01-09');
+insert into t1 values (1, 'abc', '1998-01-10');
+insert into t1 values (1, 'abc', '1998-01-11');
+insert into t1 values (1, 'abc', '1998-01-12');
+insert into t1 values (1, 'abc', '1998-01-13');
+insert into t1 values (1, 'abc', '1998-01-14');
+insert into t1 values (1, 'abc', '1998-01-15');
+insert into t1 values (1, 'abc', '1999-01-01');
+insert into t1 values (1, 'abc', '1999-01-02');
+insert into t1 values (1, 'abc', '1999-01-03');
+insert into t1 values (1, 'abc', '1999-01-04');
+insert into t1 values (1, 'abc', '1999-01-05');
+insert into t1 values (1, 'abc', '1999-01-06');
+insert into t1 values (1, 'abc', '1999-01-07');
+insert into t1 values (1, 'abc', '1999-01-08');
+insert into t1 values (1, 'abc', '1999-01-09');
+insert into t1 values (1, 'abc', '1999-01-10');
+insert into t1 values (1, 'abc', '1999-01-11');
+insert into t1 values (1, 'abc', '1999-01-12');
+insert into t1 values (1, 'abc', '1999-01-13');
+insert into t1 values (1, 'abc', '1999-01-14');
+insert into t1 values (1, 'abc', '1999-01-15');
+insert into t1 values (1, 'abc', '2000-01-01');
+insert into t1 values (1, 'abc', '2000-01-02');
+insert into t1 values (1, 'abc', '2000-01-03');
+insert into t1 values (1, 'abc', '2000-01-04');
+insert into t1 values (1, 'abc', '2000-01-05');
+insert into t1 values (1, 'abc', '2000-01-06');
+insert into t1 values (1, 'abc', '2000-01-07');
+insert into t1 values (1, 'abc', '2000-01-08');
+insert into t1 values (1, 'abc', '2000-01-09');
+insert into t1 values (1, 'abc', '2000-01-15');
+insert into t1 values (1, 'abc', '2000-01-11');
+insert into t1 values (1, 'abc', '2000-01-12');
+insert into t1 values (1, 'abc', '2000-01-13');
+insert into t1 values (1, 'abc', '2000-01-14');
+insert into t1 values (1, 'abc', '2000-01-15');
+insert into t1 values (1, 'abc', '2001-01-01');
+insert into t1 values (1, 'abc', '2001-01-02');
+insert into t1 values (1, 'abc', '2001-01-03');
+insert into t1 values (1, 'abc', '2001-01-04');
+insert into t1 values (1, 'abc', '2001-01-05');
+insert into t1 values (1, 'abc', '2001-01-06');
+insert into t1 values (1, 'abc', '2001-01-07');
+insert into t1 values (1, 'abc', '2001-01-08');
+insert into t1 values (1, 'abc', '2001-01-09');
+insert into t1 values (1, 'abc', '2001-01-15');
+insert into t1 values (1, 'abc', '2001-01-11');
+insert into t1 values (1, 'abc', '2001-01-12');
+insert into t1 values (1, 'abc', '2001-01-13');
+insert into t1 values (1, 'abc', '2001-01-14');
+insert into t1 values (1, 'abc', '2001-01-15');
+alter table t1
+partition by range (year(c))
+(partition p5 values less than (2000), partition p10 values less than (2010));
+alter table t1
+reorganize partition p5 into
+(partition p1 values less than (1996),
+partition p2 values less than (1997),
+partition p3 values less than (1998),
+partition p4 values less than (1999),
+partition p5 values less than (2000));
+drop table t1;
+CREATE TABLE t1 (a date)
+PARTITION BY RANGE (TO_DAYS(a))
+(PARTITION p3xx VALUES LESS THAN (TO_DAYS('2004-01-01')),
+PARTITION p401 VALUES LESS THAN (TO_DAYS('2004-02-01')),
+PARTITION p402 VALUES LESS THAN (TO_DAYS('2004-03-01')),
+PARTITION p403 VALUES LESS THAN (TO_DAYS('2004-04-01')),
+PARTITION p404 VALUES LESS THAN (TO_DAYS('2004-05-01')),
+PARTITION p405 VALUES LESS THAN (TO_DAYS('2004-06-01')),
+PARTITION p406 VALUES LESS THAN (TO_DAYS('2004-07-01')),
+PARTITION p407 VALUES LESS THAN (TO_DAYS('2004-08-01')),
+PARTITION p408 VALUES LESS THAN (TO_DAYS('2004-09-01')),
+PARTITION p409 VALUES LESS THAN (TO_DAYS('2004-10-01')),
+PARTITION p410 VALUES LESS THAN (TO_DAYS('2004-11-01')),
+PARTITION p411 VALUES LESS THAN (TO_DAYS('2004-12-01')),
+PARTITION p412 VALUES LESS THAN (TO_DAYS('2005-01-01')),
+PARTITION p501 VALUES LESS THAN (TO_DAYS('2005-02-01')),
+PARTITION p502 VALUES LESS THAN (TO_DAYS('2005-03-01')),
+PARTITION p503 VALUES LESS THAN (TO_DAYS('2005-04-01')),
+PARTITION p504 VALUES LESS THAN (TO_DAYS('2005-05-01')),
+PARTITION p505 VALUES LESS THAN (TO_DAYS('2005-06-01')),
+PARTITION p506 VALUES LESS THAN (TO_DAYS('2005-07-01')),
+PARTITION p507 VALUES LESS THAN (TO_DAYS('2005-08-01')),
+PARTITION p508 VALUES LESS THAN (TO_DAYS('2005-09-01')),
+PARTITION p509 VALUES LESS THAN (TO_DAYS('2005-10-01')),
+PARTITION p510 VALUES LESS THAN (TO_DAYS('2005-11-01')),
+PARTITION p511 VALUES LESS THAN (TO_DAYS('2005-12-01')),
+PARTITION p512 VALUES LESS THAN (TO_DAYS('2006-01-01')),
+PARTITION p601 VALUES LESS THAN (TO_DAYS('2006-02-01')),
+PARTITION p602 VALUES LESS THAN (TO_DAYS('2006-03-01')),
+PARTITION p603 VALUES LESS THAN (TO_DAYS('2006-04-01')),
+PARTITION p604 VALUES LESS THAN (TO_DAYS('2006-05-01')),
+PARTITION p605 VALUES LESS THAN (TO_DAYS('2006-06-01')),
+PARTITION p606 VALUES LESS THAN (TO_DAYS('2006-07-01')),
+PARTITION p607 VALUES LESS THAN (TO_DAYS('2006-08-01')));
+INSERT INTO t1 VALUES ('2003-01-13'),('2003-06-20'),('2003-08-30');
+INSERT INTO t1 VALUES ('2003-04-13'),('2003-07-20'),('2003-10-30');
+INSERT INTO t1 VALUES ('2003-05-13'),('2003-11-20'),('2003-12-30');
+INSERT INTO t1 VALUES ('2004-01-13'),('2004-01-20'),('2004-01-30');
+INSERT INTO t1 VALUES ('2004-02-13'),('2004-02-20'),('2004-02-28');
+INSERT INTO t1 VALUES ('2004-03-13'),('2004-03-20'),('2004-03-30');
+INSERT INTO t1 VALUES ('2004-04-13'),('2004-04-20'),('2004-04-30');
+INSERT INTO t1 VALUES ('2004-05-13'),('2004-05-20'),('2004-05-30');
+INSERT INTO t1 VALUES ('2004-06-13'),('2004-06-20'),('2004-06-30');
+INSERT INTO t1 VALUES ('2004-07-13'),('2004-07-20'),('2004-07-30');
+INSERT INTO t1 VALUES ('2004-08-13'),('2004-08-20'),('2004-08-30');
+INSERT INTO t1 VALUES ('2004-09-13'),('2004-09-20'),('2004-09-30');
+INSERT INTO t1 VALUES ('2004-10-13'),('2004-10-20'),('2004-10-30');
+INSERT INTO t1 VALUES ('2004-11-13'),('2004-11-20'),('2004-11-30');
+INSERT INTO t1 VALUES ('2004-12-13'),('2004-12-20'),('2004-12-30');
+INSERT INTO t1 VALUES ('2005-01-13'),('2005-01-20'),('2005-01-30');
+INSERT INTO t1 VALUES ('2005-02-13'),('2005-02-20'),('2005-02-28');
+INSERT INTO t1 VALUES ('2005-03-13'),('2005-03-20'),('2005-03-30');
+INSERT INTO t1 VALUES ('2005-04-13'),('2005-04-20'),('2005-04-30');
+INSERT INTO t1 VALUES ('2005-05-13'),('2005-05-20'),('2005-05-30');
+INSERT INTO t1 VALUES ('2005-06-13'),('2005-06-20'),('2005-06-30');
+INSERT INTO t1 VALUES ('2005-07-13'),('2005-07-20'),('2005-07-30');
+INSERT INTO t1 VALUES ('2005-08-13'),('2005-08-20'),('2005-08-30');
+INSERT INTO t1 VALUES ('2005-09-13'),('2005-09-20'),('2005-09-30');
+INSERT INTO t1 VALUES ('2005-10-13'),('2005-10-20'),('2005-10-30');
+INSERT INTO t1 VALUES ('2005-11-13'),('2005-11-20'),('2005-11-30');
+INSERT INTO t1 VALUES ('2005-12-13'),('2005-12-20'),('2005-12-30');
+INSERT INTO t1 VALUES ('2006-01-13'),('2006-01-20'),('2006-01-30');
+INSERT INTO t1 VALUES ('2006-02-13'),('2006-02-20'),('2006-02-28');
+INSERT INTO t1 VALUES ('2006-03-13'),('2006-03-20'),('2006-03-30');
+INSERT INTO t1 VALUES ('2006-04-13'),('2006-04-20'),('2006-04-30');
+INSERT INTO t1 VALUES ('2006-05-13'),('2006-05-20'),('2006-05-30');
+INSERT INTO t1 VALUES ('2006-06-13'),('2006-06-20'),('2006-06-30');
+INSERT INTO t1 VALUES ('2006-07-13'),('2006-07-20'),('2006-07-30');
+SELECT * FROM t1
+WHERE a >= '2004-07-01' AND a <= '2004-09-30';
+a
+2004-07-13
+2004-07-20
+2004-07-30
+2004-08-13
+2004-08-20
+2004-08-30
+2004-09-13
+2004-09-20
+2004-09-30
+EXPLAIN PARTITIONS SELECT * FROM t1
+WHERE a >= '2004-07-01' AND a <= '2004-09-30';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p407,p408,p409 ALL NULL NULL NULL NULL 9 Using where
+SELECT * from t1
+WHERE (a >= '2004-07-01' AND a <= '2004-09-30') OR
+(a >= '2005-07-01' AND a <= '2005-09-30');
+a
+2004-07-13
+2004-07-20
+2004-07-30
+2004-08-13
+2004-08-20
+2004-08-30
+2004-09-13
+2004-09-20
+2004-09-30
+2005-07-13
+2005-07-20
+2005-07-30
+2005-08-13
+2005-08-20
+2005-08-30
+2005-09-13
+2005-09-20
+2005-09-30
+EXPLAIN PARTITIONS SELECT * from t1
+WHERE (a >= '2004-07-01' AND a <= '2004-09-30') OR
+(a >= '2005-07-01' AND a <= '2005-09-30');
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p407,p408,p409,p507,p508,p509 ALL NULL NULL NULL NULL 18 Using where
+DROP TABLE t1;
+create table t1 (a varchar(20))
+partition by range (crc32(md5(a)))
+(partition p0 values less than (100),
+partition p1 values less than maxvalue);
+insert into t1 values ("12345678901234567890");
+insert into t1 values ("A2345678901234567890");
+insert into t1 values ("B2345678901234567890");
+insert into t1 values ("1234567890123456789");
+insert into t1 values ("1234567890123456");
+select * from t1;
+a
+12345678901234567890
+A2345678901234567890
+B2345678901234567890
+1234567890123456789
+1234567890123456
+explain partitions select * from t1 where a = "12345678901234567890";
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 5 Using where
+explain partitions select * from t1 where a = "12345678901234567890" OR
+a = "A2345678901234567890" OR
+a = "B2345678901234567890" OR
+a = "C2345678901234567890";
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 5 Using where
+explain partitions select * from t1 where a = "01234567890123456";
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 5 Using where
+select * from t1 where a = "01234567890123456";
+a
+select * from t1 where a = "12345678901234567890" OR
+a = "A2345678901234567890" OR
+a = "B2345678901234567890" OR
+a = "C2345678901234567890";
+a
+12345678901234567890
+A2345678901234567890
+B2345678901234567890
+select * from t1 where a = "12345678901234567890";
+a
+12345678901234567890
+drop table t1;
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 003e57edb8e..617e289d30d 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -1,4 +1,4 @@
-drop table if exists t1,t2;
+drop table if exists t1,t2,t3,t4;
drop database if exists client_test_db;
create table t1
(
@@ -502,7 +502,8 @@ deallocate prepare stmt;
create table t1 (a varchar(20));
insert into t1 values ('foo');
prepare stmt FROM 'SELECT char_length (a) FROM t1';
-ERROR 42000: FUNCTION test.char_length does not exist
+prepare stmt2 FROM 'SELECT not_a_function (a) FROM t1';
+ERROR 42000: FUNCTION test.not_a_function does not exist
drop table t1;
prepare stmt from "SELECT SQL_CALC_FOUND_ROWS 'foo' UNION SELECT 'bar' LIMIT 0";
execute stmt;
@@ -1056,7 +1057,8 @@ End of 4.1 tests.
create table t1 (a varchar(20));
insert into t1 values ('foo');
prepare stmt FROM 'SELECT char_length (a) FROM t1';
-ERROR 42000: FUNCTION test.char_length does not exist
+prepare stmt2 FROM 'SELECT not_a_function (a) FROM t1';
+ERROR 42000: FUNCTION test.not_a_function does not exist
drop table t1;
create table t1 (a char(3) not null, b char(3) not null,
c char(3) not null, primary key (a, b, c));
@@ -1093,13 +1095,13 @@ SET @aux= "SELECT COUNT(*)
prepare my_stmt from @aux;
execute my_stmt;
COUNT(*)
-37
+39
execute my_stmt;
COUNT(*)
-37
+39
execute my_stmt;
COUNT(*)
-37
+39
deallocate prepare my_stmt;
drop procedure if exists p1|
drop table if exists t1|
@@ -1494,3 +1496,898 @@ Slow_queries 1
deallocate prepare no_index;
deallocate prepare sq;
End of 5.0 tests.
+create procedure proc_1() reset query cache;
+call proc_1();
+call proc_1();
+call proc_1();
+create function func_1() returns int begin reset query cache; return 1; end|
+ERROR 0A000: RESET is not allowed in stored function or trigger
+create function func_1() returns int begin call proc_1(); return 1; end|
+select func_1(), func_1(), func_1() from dual;
+ERROR 0A000: RESET is not allowed in stored function or trigger
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "reset query cache";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+create procedure proc_1() reset master;
+create function func_1() returns int begin reset master; return 1; end|
+ERROR 0A000: RESET is not allowed in stored function or trigger
+create function func_1() returns int begin call proc_1(); return 1; end|
+select func_1(), func_1(), func_1() from dual;
+ERROR 0A000: RESET is not allowed in stored function or trigger
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "reset master";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+create procedure proc_1() reset slave;
+call proc_1();
+call proc_1();
+call proc_1();
+create function func_1() returns int begin reset slave; return 1; end|
+ERROR 0A000: RESET is not allowed in stored function or trigger
+create function func_1() returns int begin call proc_1(); return 1; end|
+select func_1(), func_1(), func_1() from dual;
+ERROR 0A000: RESET is not allowed in stored function or trigger
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "reset slave";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+create procedure proc_1(a integer) kill a;
+call proc_1(0);
+ERROR HY000: Unknown thread id: 0
+call proc_1(0);
+ERROR HY000: Unknown thread id: 0
+call proc_1(0);
+ERROR HY000: Unknown thread id: 0
+drop procedure proc_1;
+create function func_1() returns int begin kill 0; return 1; end|
+select func_1() from dual;
+ERROR HY000: Unknown thread id: 0
+select func_1() from dual;
+ERROR HY000: Unknown thread id: 0
+select func_1() from dual;
+ERROR HY000: Unknown thread id: 0
+drop function func_1;
+prepare abc from "kill 0";
+execute abc;
+ERROR HY000: Unknown thread id: 0
+execute abc;
+ERROR HY000: Unknown thread id: 0
+execute abc;
+ERROR HY000: Unknown thread id: 0
+deallocate prepare abc;
+create procedure proc_1() flush hosts;
+call proc_1();
+call proc_1();
+call proc_1();
+call proc_1();
+create function func_1() returns int begin flush hosts; return 1; end|
+ERROR 0A000: FLUSH is not allowed in stored function or trigger
+create function func_1() returns int begin call proc_1(); return 1; end|
+select func_1(), func_1(), func_1() from dual;
+ERROR 0A000: FLUSH is not allowed in stored function or trigger
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "flush hosts";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+create procedure proc_1() flush privileges;
+call proc_1();
+call proc_1();
+call proc_1();
+create function func_1() returns int begin flush privileges; return 1; end|
+ERROR 0A000: FLUSH is not allowed in stored function or trigger
+create function func_1() returns int begin call proc_1(); return 1; end|
+select func_1(), func_1(), func_1() from dual;
+ERROR 0A000: FLUSH is not allowed in stored function or trigger
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "flush privileges";
+deallocate prepare abc;
+create procedure proc_1() flush tables with read lock;
+call proc_1();
+unlock tables;
+call proc_1();
+unlock tables;
+call proc_1();
+unlock tables;
+create function func_1() returns int begin flush tables with read lock; return 1; end|
+ERROR 0A000: FLUSH is not allowed in stored function or trigger
+create function func_1() returns int begin call proc_1(); return 1; end|
+select func_1(), func_1(), func_1() from dual;
+ERROR 0A000: FLUSH is not allowed in stored function or trigger
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "flush tables with read lock";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+unlock tables;
+create procedure proc_1() flush tables;
+call proc_1();
+call proc_1();
+call proc_1();
+create function func_1() returns int begin flush tables; return 1; end|
+ERROR 0A000: FLUSH is not allowed in stored function or trigger
+create function func_1() returns int begin call proc_1(); return 1; end|
+select func_1(), func_1(), func_1() from dual;
+ERROR 0A000: FLUSH is not allowed in stored function or trigger
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "flush tables";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+create procedure proc_1() flush tables;
+flush tables;
+show open tables from mysql;
+Database Table In_use Name_locked
+mysql general_log 1 0
+mysql slow_log 1 0
+select Host, User from mysql.user limit 0;
+Host User
+select Host, Db from mysql.host limit 0;
+Host Db
+show open tables from mysql;
+Database Table In_use Name_locked
+mysql general_log 1 0
+mysql slow_log 1 0
+mysql host 0 0
+mysql user 0 0
+call proc_1();
+show open tables from mysql;
+Database Table In_use Name_locked
+mysql general_log 1 0
+mysql slow_log 1 0
+select Host, User from mysql.user limit 0;
+Host User
+select Host, Db from mysql.host limit 0;
+Host Db
+show open tables from mysql;
+Database Table In_use Name_locked
+mysql general_log 1 0
+mysql slow_log 1 0
+mysql host 0 0
+mysql user 0 0
+call proc_1();
+show open tables from mysql;
+Database Table In_use Name_locked
+mysql general_log 1 0
+mysql slow_log 1 0
+select Host, User from mysql.user limit 0;
+Host User
+select Host, Db from mysql.host limit 0;
+Host Db
+show open tables from mysql;
+Database Table In_use Name_locked
+mysql general_log 1 0
+mysql slow_log 1 0
+mysql host 0 0
+mysql user 0 0
+call proc_1();
+show open tables from mysql;
+Database Table In_use Name_locked
+mysql general_log 1 0
+mysql slow_log 1 0
+select Host, User from mysql.user limit 0;
+Host User
+select Host, Db from mysql.host limit 0;
+Host Db
+show open tables from mysql;
+Database Table In_use Name_locked
+mysql general_log 1 0
+mysql slow_log 1 0
+mysql host 0 0
+mysql user 0 0
+flush tables;
+create function func_1() returns int begin flush tables; return 1; end|
+ERROR 0A000: FLUSH is not allowed in stored function or trigger
+create function func_1() returns int begin call proc_1(); return 1; end|
+select func_1(), func_1(), func_1() from dual;
+ERROR 0A000: FLUSH is not allowed in stored function or trigger
+drop function func_1;
+drop procedure proc_1;
+flush tables;
+select Host, User from mysql.user limit 0;
+Host User
+select Host, Db from mysql.host limit 0;
+Host Db
+show open tables from mysql;
+Database Table In_use Name_locked
+mysql general_log 1 0
+mysql slow_log 1 0
+mysql host 0 0
+mysql user 0 0
+prepare abc from "flush tables";
+execute abc;
+show open tables from mysql;
+Database Table In_use Name_locked
+mysql general_log 1 0
+mysql slow_log 1 0
+select Host, User from mysql.user limit 0;
+Host User
+select Host, Db from mysql.host limit 0;
+Host Db
+show open tables from mysql;
+Database Table In_use Name_locked
+mysql general_log 1 0
+mysql slow_log 1 0
+mysql host 0 0
+mysql user 0 0
+execute abc;
+show open tables from mysql;
+Database Table In_use Name_locked
+mysql general_log 1 0
+mysql slow_log 1 0
+select Host, User from mysql.user limit 0;
+Host User
+select Host, Db from mysql.host limit 0;
+Host Db
+show open tables from mysql;
+Database Table In_use Name_locked
+mysql general_log 1 0
+mysql slow_log 1 0
+mysql host 0 0
+mysql user 0 0
+execute abc;
+show open tables from mysql;
+Database Table In_use Name_locked
+mysql general_log 1 0
+mysql slow_log 1 0
+select Host, User from mysql.user limit 0;
+Host User
+select Host, Db from mysql.host limit 0;
+Host Db
+show open tables from mysql;
+Database Table In_use Name_locked
+mysql general_log 1 0
+mysql slow_log 1 0
+mysql host 0 0
+mysql user 0 0
+flush tables;
+deallocate prepare abc;
+create procedure proc_1() flush logs;
+call proc_1();
+call proc_1();
+call proc_1();
+create function func_1() returns int begin flush logs; return 1; end|
+ERROR 0A000: FLUSH is not allowed in stored function or trigger
+create function func_1() returns int begin call proc_1(); return 1; end|
+select func_1(), func_1(), func_1() from dual;
+ERROR 0A000: FLUSH is not allowed in stored function or trigger
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "flush logs";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+create procedure proc_1() flush status;
+call proc_1();
+call proc_1();
+call proc_1();
+create function func_1() returns int begin flush status; return 1; end|
+ERROR 0A000: FLUSH is not allowed in stored function or trigger
+create function func_1() returns int begin call proc_1(); return 1; end|
+select func_1(), func_1(), func_1() from dual;
+ERROR 0A000: FLUSH is not allowed in stored function or trigger
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "flush status";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+create procedure proc_1() flush slave;
+call proc_1();
+call proc_1();
+call proc_1();
+create function func_1() returns int begin flush slave; return 1; end|
+ERROR 0A000: FLUSH is not allowed in stored function or trigger
+create function func_1() returns int begin call proc_1(); return 1; end|
+select func_1(), func_1(), func_1() from dual;
+ERROR 0A000: FLUSH is not allowed in stored function or trigger
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "flush slave";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+create procedure proc_1() flush master;
+create function func_1() returns int begin flush master; return 1; end|
+ERROR 0A000: FLUSH is not allowed in stored function or trigger
+create function func_1() returns int begin call proc_1(); return 1; end|
+select func_1(), func_1(), func_1() from dual;
+ERROR 0A000: FLUSH is not allowed in stored function or trigger
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "flush master";
+deallocate prepare abc;
+create procedure proc_1() flush des_key_file;
+call proc_1();
+call proc_1();
+call proc_1();
+create function func_1() returns int begin flush des_key_file; return 1; end|
+ERROR 0A000: FLUSH is not allowed in stored function or trigger
+create function func_1() returns int begin call proc_1(); return 1; end|
+select func_1(), func_1(), func_1() from dual;
+ERROR 0A000: FLUSH is not allowed in stored function or trigger
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "flush des_key_file";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+create procedure proc_1() flush user_resources;
+call proc_1();
+call proc_1();
+call proc_1();
+create function func_1() returns int begin flush user_resources; return 1; end|
+ERROR 0A000: FLUSH is not allowed in stored function or trigger
+create function func_1() returns int begin call proc_1(); return 1; end|
+select func_1(), func_1(), func_1() from dual;
+ERROR 0A000: FLUSH is not allowed in stored function or trigger
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "flush user_resources";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+create procedure proc_1() start slave;
+drop procedure proc_1;
+create function func_1() returns int begin start slave; return 1; end|
+drop function func_1;
+prepare abc from "start slave";
+deallocate prepare abc;
+create procedure proc_1() stop slave;
+drop procedure proc_1;
+create function func_1() returns int begin stop slave; return 1; end|
+drop function func_1;
+prepare abc from "stop slave";
+deallocate prepare abc;
+create procedure proc_1() show binlog events;
+drop procedure proc_1;
+create function func_1() returns int begin show binlog events; return 1; end|
+ERROR 0A000: Not allowed to return a result set from a function
+select func_1(), func_1(), func_1() from dual;
+ERROR 42000: FUNCTION test.func_1 does not exist
+drop function func_1;
+ERROR 42000: FUNCTION test.func_1 does not exist
+prepare abc from "show binlog events";
+deallocate prepare abc;
+create procedure proc_1() show slave status;
+drop procedure proc_1;
+create function func_1() returns int begin show slave status; return 1; end|
+ERROR 0A000: Not allowed to return a result set from a function
+select func_1(), func_1(), func_1() from dual;
+ERROR 42000: FUNCTION test.func_1 does not exist
+drop function func_1;
+ERROR 42000: FUNCTION test.func_1 does not exist
+prepare abc from "show slave status";
+deallocate prepare abc;
+create procedure proc_1() show master status;
+drop procedure proc_1;
+create function func_1() returns int begin show master status; return 1; end|
+ERROR 0A000: Not allowed to return a result set from a function
+select func_1(), func_1(), func_1() from dual;
+ERROR 42000: FUNCTION test.func_1 does not exist
+drop function func_1;
+ERROR 42000: FUNCTION test.func_1 does not exist
+prepare abc from "show master status";
+deallocate prepare abc;
+create procedure proc_1() show master logs;
+drop procedure proc_1;
+create function func_1() returns int begin show master logs; return 1; end|
+ERROR 0A000: Not allowed to return a result set from a function
+select func_1(), func_1(), func_1() from dual;
+ERROR 42000: FUNCTION test.func_1 does not exist
+drop function func_1;
+ERROR 42000: FUNCTION test.func_1 does not exist
+prepare abc from "show master logs";
+deallocate prepare abc;
+create procedure proc_1() show events;
+call proc_1();
+Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+call proc_1();
+Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+call proc_1();
+Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+drop procedure proc_1;
+create function func_1() returns int begin show events; return 1; end|
+ERROR 0A000: Not allowed to return a result set from a function
+select func_1(), func_1(), func_1() from dual;
+ERROR 42000: FUNCTION test.func_1 does not exist
+drop function func_1;
+ERROR 42000: FUNCTION test.func_1 does not exist
+prepare abc from "show events";
+execute abc;
+Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+execute abc;
+Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+execute abc;
+Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
+deallocate prepare abc;
+drop procedure if exists a;
+create procedure a() select 42;
+create procedure proc_1(a char(2)) show create procedure a;
+call proc_1("bb");
+Procedure sql_mode Create Procedure
+a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
+select 42
+call proc_1("bb");
+Procedure sql_mode Create Procedure
+a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
+select 42
+call proc_1("bb");
+Procedure sql_mode Create Procedure
+a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
+select 42
+drop procedure proc_1;
+create function func_1() returns int begin show create procedure a; return 1; end|
+ERROR 0A000: Not allowed to return a result set from a function
+select func_1(), func_1(), func_1() from dual;
+ERROR 42000: FUNCTION test.func_1 does not exist
+drop function func_1;
+ERROR 42000: FUNCTION test.func_1 does not exist
+prepare abc from "show create procedure a";
+execute abc;
+Procedure sql_mode Create Procedure
+a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
+select 42
+execute abc;
+Procedure sql_mode Create Procedure
+a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
+select 42
+execute abc;
+Procedure sql_mode Create Procedure
+a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
+select 42
+deallocate prepare abc;
+drop procedure a;
+drop function if exists a;
+create function a() returns int return 42+13;
+create procedure proc_1(a char(2)) show create function a;
+call proc_1("bb");
+Function sql_mode Create Function
+a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
+return 42+13
+call proc_1("bb");
+Function sql_mode Create Function
+a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
+return 42+13
+call proc_1("bb");
+Function sql_mode Create Function
+a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
+return 42+13
+drop procedure proc_1;
+create function func_1() returns int begin show create function a; return 1; end|
+ERROR 0A000: Not allowed to return a result set from a function
+select func_1(), func_1(), func_1() from dual;
+ERROR 42000: FUNCTION test.func_1 does not exist
+drop function func_1;
+ERROR 42000: FUNCTION test.func_1 does not exist
+prepare abc from "show create function a";
+execute abc;
+Function sql_mode Create Function
+a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
+return 42+13
+execute abc;
+Function sql_mode Create Function
+a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
+return 42+13
+execute abc;
+Function sql_mode Create Function
+a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
+return 42+13
+deallocate prepare abc;
+drop function a;
+drop table if exists tab1;
+create table tab1(a int, b char(1), primary key(a,b));
+create procedure proc_1() show create table tab1;
+call proc_1();
+Table Create Table
+tab1 CREATE TABLE `tab1` (
+ `a` int(11) NOT NULL DEFAULT '0',
+ `b` char(1) NOT NULL DEFAULT '',
+ PRIMARY KEY (`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+call proc_1();
+Table Create Table
+tab1 CREATE TABLE `tab1` (
+ `a` int(11) NOT NULL DEFAULT '0',
+ `b` char(1) NOT NULL DEFAULT '',
+ PRIMARY KEY (`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+call proc_1();
+Table Create Table
+tab1 CREATE TABLE `tab1` (
+ `a` int(11) NOT NULL DEFAULT '0',
+ `b` char(1) NOT NULL DEFAULT '',
+ PRIMARY KEY (`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop procedure proc_1;
+create function func_1() returns int begin show create table tab1; return 1; end|
+ERROR 0A000: Not allowed to return a result set from a function
+select func_1(), func_1(), func_1() from dual;
+ERROR 42000: FUNCTION test.func_1 does not exist
+drop function func_1;
+ERROR 42000: FUNCTION test.func_1 does not exist
+prepare abc from "show create table tab1";
+execute abc;
+Table Create Table
+tab1 CREATE TABLE `tab1` (
+ `a` int(11) NOT NULL DEFAULT '0',
+ `b` char(1) NOT NULL DEFAULT '',
+ PRIMARY KEY (`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+execute abc;
+Table Create Table
+tab1 CREATE TABLE `tab1` (
+ `a` int(11) NOT NULL DEFAULT '0',
+ `b` char(1) NOT NULL DEFAULT '',
+ PRIMARY KEY (`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+execute abc;
+Table Create Table
+tab1 CREATE TABLE `tab1` (
+ `a` int(11) NOT NULL DEFAULT '0',
+ `b` char(1) NOT NULL DEFAULT '',
+ PRIMARY KEY (`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+deallocate prepare abc;
+drop table tab1;
+drop view if exists v1;
+drop table if exists t1;
+create table t1(a int, b char(5));
+insert into t1 values (1, "one"), (1, "edno"), (2, "two"), (2, "dve");
+create view v1 as
+(select a, count(*) from t1 group by a)
+union all
+(select b, count(*) from t1 group by b);
+create procedure proc_1() show create view v1;
+call proc_1();
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`)
+call proc_1();
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`)
+call proc_1();
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`)
+drop procedure proc_1;
+create function func_1() returns int begin show create view v1; return 1; end|
+ERROR 0A000: Not allowed to return a result set from a function
+select func_1(), func_1(), func_1() from dual;
+ERROR 42000: FUNCTION test.func_1 does not exist
+drop function func_1;
+ERROR 42000: FUNCTION test.func_1 does not exist
+prepare abc from "show create view v1";
+execute abc;
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`)
+execute abc;
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`)
+execute abc;
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`)
+deallocate prepare abc;
+drop view v1;
+drop table t1;
+create procedure proc_1() install plugin my_plug soname '/root/some_plugin.so';
+call proc_1();
+ERROR HY000: No paths allowed for shared library
+call proc_1();
+ERROR HY000: No paths allowed for shared library
+call proc_1();
+ERROR HY000: No paths allowed for shared library
+drop procedure proc_1;
+create procedure proc_1() install plugin my_plug soname 'some_plugin.so';
+call proc_1();
+ERROR HY000: Can't open shared library
+call proc_1();
+ERROR HY000: Can't open shared library
+call proc_1();
+ERROR HY000: Can't open shared library
+drop procedure proc_1;
+create function func_1() returns int begin install plugin my_plug soname '/tmp/plugin'; return 1; end|
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+select func_1(), func_1(), func_1() from dual;
+ERROR 42000: FUNCTION test.func_1 does not exist
+drop function func_1;
+ERROR 42000: FUNCTION test.func_1 does not exist
+prepare abc from "install plugin my_plug soname '/root/some_plugin.so'";
+execute abc;
+ERROR HY000: No paths allowed for shared library
+execute abc;
+ERROR HY000: No paths allowed for shared library
+deallocate prepare abc;
+prepare abc from "install plugin my_plug soname 'some_plugin.so'";
+deallocate prepare abc;
+create procedure proc_1() uninstall plugin my_plug;
+call proc_1();
+ERROR 42000: PLUGIN my_plug does not exist
+call proc_1();
+ERROR 42000: PLUGIN my_plug does not exist
+call proc_1();
+ERROR 42000: PLUGIN my_plug does not exist
+drop procedure proc_1;
+create function func_1() returns int begin uninstall plugin my_plug; return 1; end|
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+select func_1(), func_1(), func_1() from dual;
+ERROR 42000: FUNCTION test.func_1 does not exist
+drop function func_1;
+ERROR 42000: FUNCTION test.func_1 does not exist
+prepare abc from "uninstall plugin my_plug";
+execute abc;
+ERROR 42000: PLUGIN my_plug does not exist
+execute abc;
+ERROR 42000: PLUGIN my_plug does not exist
+execute abc;
+ERROR 42000: PLUGIN my_plug does not exist
+deallocate prepare abc;
+drop database if exists mysqltest_xyz;
+create procedure proc_1() create database mysqltest_xyz;
+call proc_1();
+drop database if exists mysqltest_xyz;
+call proc_1();
+call proc_1();
+ERROR HY000: Can't create database 'mysqltest_xyz'; database exists
+drop database if exists mysqltest_xyz;
+call proc_1();
+drop database if exists mysqltest_xyz;
+drop procedure proc_1;
+create function func_1() returns int begin create database mysqltest_xyz; return 1; end|
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+select func_1(), func_1(), func_1() from dual;
+ERROR 42000: FUNCTION test.func_1 does not exist
+drop function func_1;
+ERROR 42000: FUNCTION test.func_1 does not exist
+prepare abc from "create database mysqltest_xyz";
+execute abc;
+drop database if exists mysqltest_xyz;
+execute abc;
+execute abc;
+ERROR HY000: Can't create database 'mysqltest_xyz'; database exists
+drop database if exists mysqltest_xyz;
+execute abc;
+drop database if exists mysqltest_xyz;
+deallocate prepare abc;
+drop table if exists t1;
+create table t1 (a int, b char(5));
+insert into t1 values (1, "one"), (2, "two"), (3, "three");
+create procedure proc_1() checksum table xyz;
+call proc_1();
+Table Checksum
+test.xyz NULL
+Warnings:
+Error 1146 Table 'test.xyz' doesn't exist
+call proc_1();
+Table Checksum
+test.xyz NULL
+Warnings:
+Error 1146 Table 'test.xyz' doesn't exist
+call proc_1();
+Table Checksum
+test.xyz NULL
+Warnings:
+Error 1146 Table 'test.xyz' doesn't exist
+drop procedure proc_1;
+create function func_1() returns int begin checksum table t1; return 1; end|
+ERROR 0A000: Not allowed to return a result set from a function
+select func_1(), func_1(), func_1() from dual;
+ERROR 42000: FUNCTION test.func_1 does not exist
+drop function func_1;
+ERROR 42000: FUNCTION test.func_1 does not exist
+prepare abc from "checksum table t1";
+execute abc;
+Table Checksum
+test.t1 645809265
+execute abc;
+Table Checksum
+test.t1 645809265
+execute abc;
+Table Checksum
+test.t1 645809265
+deallocate prepare abc;
+create procedure proc_1() create user pstest_xyz@localhost;
+call proc_1();
+drop user pstest_xyz@localhost;
+call proc_1();
+call proc_1();
+ERROR HY000: Operation CREATE USER failed for 'pstest_xyz'@'localhost'
+drop user pstest_xyz@localhost;
+call proc_1();
+drop user pstest_xyz@localhost;
+drop procedure proc_1;
+create function func_1() returns int begin create user pstest_xyz@localhost; return 1; end|
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+select func_1(), func_1(), func_1() from dual;
+ERROR 42000: FUNCTION test.func_1 does not exist
+drop function func_1;
+ERROR 42000: FUNCTION test.func_1 does not exist
+prepare abc from "create user pstest_xyz@localhost";
+execute abc;
+drop user pstest_xyz@localhost;
+execute abc;
+execute abc;
+ERROR HY000: Operation CREATE USER failed for 'pstest_xyz'@'localhost'
+drop user pstest_xyz@localhost;
+execute abc;
+drop user pstest_xyz@localhost;
+deallocate prepare abc;
+drop event if exists xyz;
+create function func_1() returns int begin create event xyz on schedule at now() do select 123; return 1; end|
+ERROR HY000: Recursivity of EVENT DDL statements is forbidden when body is present
+select func_1(), func_1(), func_1() from dual;
+ERROR 42000: FUNCTION test.func_1 does not exist
+drop function func_1;
+ERROR 42000: FUNCTION test.func_1 does not exist
+prepare abc from "create event xyz on schedule at now() do select 123";
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+deallocate prepare abc;
+ERROR HY000: Unknown prepared statement handler (abc) given to DEALLOCATE PREPARE
+drop event if exists xyz;
+create event xyz on schedule every 5 minute disable do select 123;
+create procedure proc_1() alter event xyz comment 'xyz';
+call proc_1();
+drop event xyz;
+create event xyz on schedule every 5 minute disable do select 123;
+call proc_1();
+drop event xyz;
+create event xyz on schedule every 5 minute disable do select 123;
+call proc_1();
+drop event xyz;
+drop procedure proc_1;
+create function func_1() returns int begin alter event xyz comment 'xyz'; return 1; end|
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+prepare abc from "alter event xyz comment 'xyz'";
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+deallocate prepare abc;
+ERROR HY000: Unknown prepared statement handler (abc) given to DEALLOCATE PREPARE
+drop event if exists xyz;
+create event xyz on schedule every 5 minute disable do select 123;
+create procedure proc_1() drop event xyz;
+call proc_1();
+create event xyz on schedule every 5 minute disable do select 123;
+call proc_1();
+call proc_1();
+ERROR HY000: Unknown event 'xyz'
+drop procedure proc_1;
+create function func_1() returns int begin drop event xyz; return 1; end|
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+prepare abc from "drop event xyz";
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+deallocate prepare abc;
+ERROR HY000: Unknown prepared statement handler (abc) given to DEALLOCATE PREPARE
+drop table if exists t1;
+create table t1 (a int, b char(5)) engine=myisam;
+insert into t1 values (1, "one"), (2, "two"), (3, "three");
+SET GLOBAL new_cache.key_buffer_size=128*1024;
+create procedure proc_1() cache index t1 in new_cache;
+call proc_1();
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+call proc_1();
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+call proc_1();
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+drop procedure proc_1;
+SET GLOBAL second_cache.key_buffer_size=128*1024;
+prepare abc from "cache index t1 in second_cache";
+execute abc;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+execute abc;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+execute abc;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+deallocate prepare abc;
+drop table t1;
+drop table if exists t1;
+drop table if exists t2;
+create table t1 (a int, b char(5)) engine=myisam;
+insert into t1 values (1, "one"), (2, "two"), (3, "three");
+create table t2 (a int, b char(5)) engine=myisam;
+insert into t2 values (1, "one"), (2, "two"), (3, "three");
+create procedure proc_1() load index into cache t1 ignore leaves;
+call proc_1();
+Table Op Msg_type Msg_text
+test.t1 preload_keys status OK
+call proc_1();
+Table Op Msg_type Msg_text
+test.t1 preload_keys status OK
+call proc_1();
+Table Op Msg_type Msg_text
+test.t1 preload_keys status OK
+drop procedure proc_1;
+create function func_1() returns int begin load index into cache t1 ignore leaves; return 1; end|
+ERROR 0A000: Not allowed to return a result set from a function
+prepare abc from "load index into cache t2 ignore leaves";
+execute abc;
+Table Op Msg_type Msg_text
+test.t2 preload_keys status OK
+execute abc;
+Table Op Msg_type Msg_text
+test.t2 preload_keys status OK
+execute abc;
+Table Op Msg_type Msg_text
+test.t2 preload_keys status OK
+deallocate prepare abc;
+drop table t1, t2;
+create procedure proc_1() show errors;
+call proc_1();
+Level Code Message
+call proc_1();
+Level Code Message
+call proc_1();
+Level Code Message
+drop procedure proc_1;
+create function func_1() returns int begin show errors; return 1; end|
+ERROR 0A000: Not allowed to return a result set from a function
+prepare abc from "show errors";
+deallocate prepare abc;
+drop table if exists t1;
+drop table if exists t2;
+create procedure proc_1() show warnings;
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 't1'
+call proc_1();
+Level Code Message
+drop table if exists t2;
+Warnings:
+Note 1051 Unknown table 't2'
+call proc_1();
+Level Code Message
+drop table if exists t1, t2;
+Warnings:
+Note 1051 Unknown table 't1'
+Note 1051 Unknown table 't2'
+call proc_1();
+Level Code Message
+drop procedure proc_1;
+create function func_1() returns int begin show warnings; return 1; end|
+ERROR 0A000: Not allowed to return a result set from a function
+prepare abc from "show warnings";
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 't1'
+execute abc;
+Level Code Message
+Note 1051 Unknown table 't1'
+drop table if exists t2;
+Warnings:
+Note 1051 Unknown table 't2'
+execute abc;
+Level Code Message
+Note 1051 Unknown table 't2'
+drop table if exists t1, t2;
+Warnings:
+Note 1051 Unknown table 't1'
+Note 1051 Unknown table 't2'
+execute abc;
+Level Code Message
+Note 1051 Unknown table 't1'
+Note 1051 Unknown table 't2'
+deallocate prepare abc;
diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result
index ac8ae6def9f..67959920248 100644
--- a/mysql-test/r/ps_1general.result
+++ b/mysql-test/r/ps_1general.result
@@ -259,6 +259,7 @@ prepare stmt4 from ' show databases ';
execute stmt4;
Database
information_schema
+cluster
mysql
test
prepare stmt4 from ' show tables from test like ''t2%'' ';
@@ -307,32 +308,13 @@ prepare stmt4 from ' show engine bdb logs ';
execute stmt4;
prepare stmt4 from ' show grants for user ';
prepare stmt4 from ' show create table t2 ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt4 from ' show master status ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt4 from ' show master logs ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt4 from ' show slave status ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt4 from ' show warnings limit 20 ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt4 from ' show errors limit 20 ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt4 from ' show storage engines ';
execute stmt4;
-Engine Support Comment
-MyISAM YES/NO Default engine as of MySQL 3.23 with great performance
-MEMORY YES/NO Hash based, stored in memory, useful for temporary tables
-InnoDB YES/NO Supports transactions, row-level locking, and foreign keys
-BerkeleyDB YES/NO Supports transactions and page-level locking
-BLACKHOLE YES/NO /dev/null storage engine (anything you write to it disappears)
-EXAMPLE YES/NO Example storage engine
-ARCHIVE YES/NO Archive storage engine
-CSV YES/NO CSV storage engine
-ndbcluster YES/NO Clustered, fault-tolerant, memory-based tables
-FEDERATED YES/NO Federated MySQL storage engine
-MRG_MYISAM YES/NO Collection of identical MyISAM tables
-ISAM YES/NO Obsolete storage engine
drop table if exists t5;
prepare stmt1 from ' drop table if exists t5 ' ;
execute stmt1 ;
@@ -399,10 +381,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
prepare stmt4 from ' use test ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt3 from ' create database mysqltest ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
create database mysqltest ;
prepare stmt3 from ' drop database mysqltest ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
drop database mysqltest ;
prepare stmt3 from ' describe t2 ';
execute stmt3;
@@ -424,7 +404,6 @@ execute stmt1 ;
prepare stmt1 from ' optimize table t1 ' ;
prepare stmt1 from ' analyze table t1 ' ;
prepare stmt1 from ' checksum table t1 ' ;
-ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' repair table t1 ' ;
prepare stmt1 from ' restore table t1 from ''data.txt'' ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
@@ -452,11 +431,8 @@ execute stmt5;
1
SET sql_mode="";
prepare stmt1 from ' flush local privileges ' ;
-ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' reset query cache ' ;
-ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' KILL 0 ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' explain select a from t1 order by b ';
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result
index 2a7b0e959af..2bfd6d31ac9 100644
--- a/mysql-test/r/ps_2myisam.result
+++ b/mysql-test/r/ps_2myisam.result
@@ -1304,7 +1304,7 @@ set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1
+Warning 1048 Column 'a' cannot be null
select a,b from t1 order by a;
a b
0 two
@@ -1426,7 +1426,7 @@ select a,b from t1 where b = @arg00;
a b
6 six
execute stmt1 using @arg00;
-ERROR 23000: Duplicate entry '6' for key 1
+ERROR 23000: Duplicate entry '6' for key 'PRIMARY'
set @arg00=NULL ;
prepare stmt1 from 'insert into t1 values(0, ? )';
execute stmt1 using @arg00;
@@ -1539,7 +1539,7 @@ a b
set @arg00=81 ;
set @arg01=1 ;
execute stmt1 using @arg00, @arg01;
-ERROR 23000: Duplicate entry '82' for key 1
+ERROR 23000: Duplicate entry '82' for key 'PRIMARY'
drop table if exists t2 ;
create table t2 (id int auto_increment primary key)
ENGINE= 'MYISAM' ;
@@ -1775,31 +1775,31 @@ NULL as const12, @arg12 as param12,
show create table t5 ;
Table Create Table
t5 CREATE TABLE `t5` (
- `const01` int(1) NOT NULL default '0',
- `param01` bigint(20) default NULL,
- `const02` decimal(2,1) NOT NULL default '0.0',
- `param02` decimal(65,30) default NULL,
- `const03` double NOT NULL default '0',
- `param03` double default NULL,
- `const04` varchar(3) NOT NULL default '',
+ `const01` int(1) NOT NULL DEFAULT '0',
+ `param01` bigint(20) DEFAULT NULL,
+ `const02` decimal(2,1) NOT NULL DEFAULT '0.0',
+ `param02` decimal(65,30) DEFAULT NULL,
+ `const03` double NOT NULL DEFAULT '0',
+ `param03` double DEFAULT NULL,
+ `const04` varchar(3) NOT NULL DEFAULT '',
`param04` longtext,
- `const05` varbinary(3) NOT NULL default '',
+ `const05` varbinary(3) NOT NULL DEFAULT '',
`param05` longblob,
- `const06` varchar(10) NOT NULL default '',
+ `const06` varchar(10) NOT NULL DEFAULT '',
`param06` longtext,
- `const07` date default NULL,
+ `const07` date DEFAULT NULL,
`param07` longblob,
- `const08` varchar(19) NOT NULL default '',
+ `const08` varchar(19) NOT NULL DEFAULT '',
`param08` longtext,
- `const09` datetime default NULL,
+ `const09` datetime DEFAULT NULL,
`param09` longblob,
- `const10` int(10) NOT NULL default '0',
- `param10` bigint(20) default NULL,
- `const11` int(4) default NULL,
- `param11` bigint(20) default NULL,
- `const12` binary(0) default NULL,
- `param12` bigint(20) default NULL,
- `param13` decimal(65,30) default NULL,
+ `const10` int(10) NOT NULL DEFAULT '0',
+ `param10` bigint(20) DEFAULT NULL,
+ `const11` int(4) DEFAULT NULL,
+ `param11` bigint(20) DEFAULT NULL,
+ `const12` binary(0) DEFAULT NULL,
+ `param12` bigint(20) DEFAULT NULL,
+ `param13` decimal(65,30) DEFAULT NULL,
`param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -1929,26 +1929,26 @@ def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
def @arg11 253 67 6 Y 128 30 63
def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
+def @arg13 253 16777216 10 Y 128 31 63
+def @arg14 253 16777216 19 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 8 Y 128 31 63
def @arg17 253 20 4 Y 128 0 63
def @arg18 253 20 1 Y 128 0 63
def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 128 31 63
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 128 31 63
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 128 31 63
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 128 31 63
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
+def @arg20 253 16777216 1 Y 0 31 8
+def @arg21 253 16777216 10 Y 0 31 8
+def @arg22 253 16777216 30 Y 0 31 8
+def @arg23 253 16777216 8 Y 128 31 63
+def @arg24 253 16777216 8 Y 0 31 8
+def @arg25 253 16777216 4 Y 128 31 63
+def @arg26 253 16777216 4 Y 0 31 8
+def @arg27 253 16777216 10 Y 128 31 63
+def @arg28 253 16777216 10 Y 0 31 8
+def @arg29 253 16777216 8 Y 128 31 63
+def @arg30 253 16777216 8 Y 0 31 8
+def @arg31 253 16777216 3 Y 0 31 8
+def @arg32 253 16777216 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@@ -1976,26 +1976,26 @@ def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
def @arg11 253 67 0 Y 128 30 63
def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
+def @arg13 253 16777216 0 Y 128 31 63
+def @arg14 253 16777216 0 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 0 Y 128 31 63
def @arg17 253 20 0 Y 128 0 63
def @arg18 253 20 0 Y 128 0 63
def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 128 31 63
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 128 31 63
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 128 31 63
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 128 31 63
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
+def @arg20 253 16777216 0 Y 0 31 8
+def @arg21 253 16777216 0 Y 0 31 8
+def @arg22 253 16777216 0 Y 0 31 8
+def @arg23 253 16777216 0 Y 128 31 63
+def @arg24 253 16777216 0 Y 0 31 8
+def @arg25 253 16777216 0 Y 128 31 63
+def @arg26 253 16777216 0 Y 0 31 8
+def @arg27 253 16777216 0 Y 128 31 63
+def @arg28 253 16777216 0 Y 0 31 8
+def @arg29 253 16777216 0 Y 128 31 63
+def @arg30 253 16777216 0 Y 0 31 8
+def @arg31 253 16777216 0 Y 0 31 8
+def @arg32 253 16777216 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -2026,26 +2026,26 @@ def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
def @arg11 253 67 6 Y 128 30 63
def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
+def @arg13 253 16777216 10 Y 128 31 63
+def @arg14 253 16777216 19 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 8 Y 128 31 63
def @arg17 253 20 4 Y 128 0 63
def @arg18 253 20 1 Y 128 0 63
def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 128 31 63
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 128 31 63
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 128 31 63
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 128 31 63
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
+def @arg20 253 16777216 1 Y 0 31 8
+def @arg21 253 16777216 10 Y 0 31 8
+def @arg22 253 16777216 30 Y 0 31 8
+def @arg23 253 16777216 8 Y 128 31 63
+def @arg24 253 16777216 8 Y 0 31 8
+def @arg25 253 16777216 4 Y 128 31 63
+def @arg26 253 16777216 4 Y 0 31 8
+def @arg27 253 16777216 10 Y 128 31 63
+def @arg28 253 16777216 10 Y 0 31 8
+def @arg29 253 16777216 8 Y 128 31 63
+def @arg30 253 16777216 8 Y 0 31 8
+def @arg31 253 16777216 3 Y 0 31 8
+def @arg32 253 16777216 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2066,26 +2066,26 @@ def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
def @arg11 253 67 0 Y 128 30 63
def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
+def @arg13 253 16777216 0 Y 128 31 63
+def @arg14 253 16777216 0 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 0 Y 128 31 63
def @arg17 253 20 0 Y 128 0 63
def @arg18 253 20 0 Y 128 0 63
def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 128 31 63
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 128 31 63
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 128 31 63
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 128 31 63
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
+def @arg20 253 16777216 0 Y 0 31 8
+def @arg21 253 16777216 0 Y 0 31 8
+def @arg22 253 16777216 0 Y 0 31 8
+def @arg23 253 16777216 0 Y 128 31 63
+def @arg24 253 16777216 0 Y 0 31 8
+def @arg25 253 16777216 0 Y 128 31 63
+def @arg26 253 16777216 0 Y 0 31 8
+def @arg27 253 16777216 0 Y 128 31 63
+def @arg28 253 16777216 0 Y 0 31 8
+def @arg29 253 16777216 0 Y 128 31 63
+def @arg30 253 16777216 0 Y 0 31 8
+def @arg31 253 16777216 0 Y 0 31 8
+def @arg32 253 16777216 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2114,26 +2114,26 @@ def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
def @arg11 253 67 6 Y 128 30 63
def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
+def @arg13 253 16777216 10 Y 128 31 63
+def @arg14 253 16777216 19 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 8 Y 128 31 63
def @arg17 253 20 4 Y 128 0 63
def @arg18 253 20 1 Y 128 0 63
def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 128 31 63
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 128 31 63
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 128 31 63
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 128 31 63
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
+def @arg20 253 16777216 1 Y 0 31 8
+def @arg21 253 16777216 10 Y 0 31 8
+def @arg22 253 16777216 30 Y 0 31 8
+def @arg23 253 16777216 8 Y 128 31 63
+def @arg24 253 16777216 8 Y 0 31 8
+def @arg25 253 16777216 4 Y 128 31 63
+def @arg26 253 16777216 4 Y 0 31 8
+def @arg27 253 16777216 10 Y 128 31 63
+def @arg28 253 16777216 10 Y 0 31 8
+def @arg29 253 16777216 8 Y 128 31 63
+def @arg30 253 16777216 8 Y 0 31 8
+def @arg31 253 16777216 3 Y 0 31 8
+def @arg32 253 16777216 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2158,26 +2158,26 @@ def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
def @arg11 253 67 0 Y 128 30 63
def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
+def @arg13 253 16777216 0 Y 128 31 63
+def @arg14 253 16777216 0 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 0 Y 128 31 63
def @arg17 253 20 0 Y 128 0 63
def @arg18 253 20 0 Y 128 0 63
def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 128 31 63
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 128 31 63
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 128 31 63
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 128 31 63
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
+def @arg20 253 16777216 0 Y 0 31 8
+def @arg21 253 16777216 0 Y 0 31 8
+def @arg22 253 16777216 0 Y 0 31 8
+def @arg23 253 16777216 0 Y 128 31 63
+def @arg24 253 16777216 0 Y 0 31 8
+def @arg25 253 16777216 0 Y 128 31 63
+def @arg26 253 16777216 0 Y 0 31 8
+def @arg27 253 16777216 0 Y 128 31 63
+def @arg28 253 16777216 0 Y 0 31 8
+def @arg29 253 16777216 0 Y 128 31 63
+def @arg30 253 16777216 0 Y 0 31 8
+def @arg31 253 16777216 0 Y 0 31 8
+def @arg32 253 16777216 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2204,26 +2204,26 @@ def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
def @arg11 253 67 6 Y 128 30 63
def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
+def @arg13 253 16777216 10 Y 128 31 63
+def @arg14 253 16777216 19 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 8 Y 128 31 63
def @arg17 253 20 4 Y 128 0 63
def @arg18 253 20 1 Y 128 0 63
def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 128 31 63
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 128 31 63
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 128 31 63
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 128 31 63
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
+def @arg20 253 16777216 1 Y 0 31 8
+def @arg21 253 16777216 10 Y 0 31 8
+def @arg22 253 16777216 30 Y 0 31 8
+def @arg23 253 16777216 8 Y 128 31 63
+def @arg24 253 16777216 8 Y 0 31 8
+def @arg25 253 16777216 4 Y 128 31 63
+def @arg26 253 16777216 4 Y 0 31 8
+def @arg27 253 16777216 10 Y 128 31 63
+def @arg28 253 16777216 10 Y 0 31 8
+def @arg29 253 16777216 8 Y 128 31 63
+def @arg30 253 16777216 8 Y 0 31 8
+def @arg31 253 16777216 3 Y 0 31 8
+def @arg32 253 16777216 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2242,26 +2242,26 @@ def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
def @arg11 253 67 0 Y 128 30 63
def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
+def @arg13 253 16777216 0 Y 128 31 63
+def @arg14 253 16777216 0 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 0 Y 128 31 63
def @arg17 253 20 0 Y 128 0 63
def @arg18 253 20 0 Y 128 0 63
def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 128 31 63
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 128 31 63
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 128 31 63
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 128 31 63
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
+def @arg20 253 16777216 0 Y 0 31 8
+def @arg21 253 16777216 0 Y 0 31 8
+def @arg22 253 16777216 0 Y 0 31 8
+def @arg23 253 16777216 0 Y 128 31 63
+def @arg24 253 16777216 0 Y 0 31 8
+def @arg25 253 16777216 0 Y 128 31 63
+def @arg26 253 16777216 0 Y 0 31 8
+def @arg27 253 16777216 0 Y 128 31 63
+def @arg28 253 16777216 0 Y 0 31 8
+def @arg29 253 16777216 0 Y 128 31 63
+def @arg30 253 16777216 0 Y 0 31 8
+def @arg31 253 16777216 0 Y 0 31 8
+def @arg32 253 16777216 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
@@ -2572,12 +2572,12 @@ set @arg00= 9223372036854775807 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -2595,12 +2595,12 @@ set @arg00= '9223372036854775807' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -2618,12 +2618,12 @@ set @arg00= -9223372036854775808 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -2641,12 +2641,12 @@ set @arg00= '-9223372036854775808' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -2664,14 +2664,14 @@ set @arg00= 1.11111111111111111111e+50 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -2689,14 +2689,14 @@ set @arg00= '1.11111111111111111111e+50' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -2714,14 +2714,14 @@ set @arg00= -1.11111111111111111111e+50 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -2739,14 +2739,14 @@ set @arg00= '-1.11111111111111111111e+50' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -2977,45 +2977,45 @@ Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
c1 c13 c14 c15 c16 c17
20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result
index 88e8bf3ce04..607a0426bd7 100644
--- a/mysql-test/r/ps_3innodb.result
+++ b/mysql-test/r/ps_3innodb.result
@@ -1287,7 +1287,7 @@ set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1
+Warning 1048 Column 'a' cannot be null
select a,b from t1 order by a;
a b
0 two
@@ -1409,7 +1409,7 @@ select a,b from t1 where b = @arg00;
a b
6 six
execute stmt1 using @arg00;
-ERROR 23000: Duplicate entry '6' for key 1
+ERROR 23000: Duplicate entry '6' for key 'PRIMARY'
set @arg00=NULL ;
prepare stmt1 from 'insert into t1 values(0, ? )';
execute stmt1 using @arg00;
@@ -1522,7 +1522,7 @@ a b
set @arg00=81 ;
set @arg01=1 ;
execute stmt1 using @arg00, @arg01;
-ERROR 23000: Duplicate entry '82' for key 1
+ERROR 23000: Duplicate entry '82' for key 'PRIMARY'
drop table if exists t2 ;
create table t2 (id int auto_increment primary key)
ENGINE= 'InnoDB' ;
@@ -1758,31 +1758,31 @@ NULL as const12, @arg12 as param12,
show create table t5 ;
Table Create Table
t5 CREATE TABLE `t5` (
- `const01` int(1) NOT NULL default '0',
- `param01` bigint(20) default NULL,
- `const02` decimal(2,1) NOT NULL default '0.0',
- `param02` decimal(65,30) default NULL,
- `const03` double NOT NULL default '0',
- `param03` double default NULL,
- `const04` varchar(3) NOT NULL default '',
+ `const01` int(1) NOT NULL DEFAULT '0',
+ `param01` bigint(20) DEFAULT NULL,
+ `const02` decimal(2,1) NOT NULL DEFAULT '0.0',
+ `param02` decimal(65,30) DEFAULT NULL,
+ `const03` double NOT NULL DEFAULT '0',
+ `param03` double DEFAULT NULL,
+ `const04` varchar(3) NOT NULL DEFAULT '',
`param04` longtext,
- `const05` varbinary(3) NOT NULL default '',
+ `const05` varbinary(3) NOT NULL DEFAULT '',
`param05` longblob,
- `const06` varchar(10) NOT NULL default '',
+ `const06` varchar(10) NOT NULL DEFAULT '',
`param06` longtext,
- `const07` date default NULL,
+ `const07` date DEFAULT NULL,
`param07` longblob,
- `const08` varchar(19) NOT NULL default '',
+ `const08` varchar(19) NOT NULL DEFAULT '',
`param08` longtext,
- `const09` datetime default NULL,
+ `const09` datetime DEFAULT NULL,
`param09` longblob,
- `const10` int(10) NOT NULL default '0',
- `param10` bigint(20) default NULL,
- `const11` int(4) default NULL,
- `param11` bigint(20) default NULL,
- `const12` binary(0) default NULL,
- `param12` bigint(20) default NULL,
- `param13` decimal(65,30) default NULL,
+ `const10` int(10) NOT NULL DEFAULT '0',
+ `param10` bigint(20) DEFAULT NULL,
+ `const11` int(4) DEFAULT NULL,
+ `param11` bigint(20) DEFAULT NULL,
+ `const12` binary(0) DEFAULT NULL,
+ `param12` bigint(20) DEFAULT NULL,
+ `param13` decimal(65,30) DEFAULT NULL,
`param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -1912,26 +1912,26 @@ def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
def @arg11 253 67 6 Y 128 30 63
def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
+def @arg13 253 16777216 10 Y 128 31 63
+def @arg14 253 16777216 19 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 8 Y 128 31 63
def @arg17 253 20 4 Y 128 0 63
def @arg18 253 20 1 Y 128 0 63
def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 128 31 63
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 128 31 63
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 128 31 63
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 128 31 63
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
+def @arg20 253 16777216 1 Y 0 31 8
+def @arg21 253 16777216 10 Y 0 31 8
+def @arg22 253 16777216 30 Y 0 31 8
+def @arg23 253 16777216 8 Y 128 31 63
+def @arg24 253 16777216 8 Y 0 31 8
+def @arg25 253 16777216 4 Y 128 31 63
+def @arg26 253 16777216 4 Y 0 31 8
+def @arg27 253 16777216 10 Y 128 31 63
+def @arg28 253 16777216 10 Y 0 31 8
+def @arg29 253 16777216 8 Y 128 31 63
+def @arg30 253 16777216 8 Y 0 31 8
+def @arg31 253 16777216 3 Y 0 31 8
+def @arg32 253 16777216 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@@ -1959,26 +1959,26 @@ def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
def @arg11 253 67 0 Y 128 30 63
def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
+def @arg13 253 16777216 0 Y 128 31 63
+def @arg14 253 16777216 0 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 0 Y 128 31 63
def @arg17 253 20 0 Y 128 0 63
def @arg18 253 20 0 Y 128 0 63
def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 128 31 63
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 128 31 63
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 128 31 63
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 128 31 63
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
+def @arg20 253 16777216 0 Y 0 31 8
+def @arg21 253 16777216 0 Y 0 31 8
+def @arg22 253 16777216 0 Y 0 31 8
+def @arg23 253 16777216 0 Y 128 31 63
+def @arg24 253 16777216 0 Y 0 31 8
+def @arg25 253 16777216 0 Y 128 31 63
+def @arg26 253 16777216 0 Y 0 31 8
+def @arg27 253 16777216 0 Y 128 31 63
+def @arg28 253 16777216 0 Y 0 31 8
+def @arg29 253 16777216 0 Y 128 31 63
+def @arg30 253 16777216 0 Y 0 31 8
+def @arg31 253 16777216 0 Y 0 31 8
+def @arg32 253 16777216 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -2009,26 +2009,26 @@ def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
def @arg11 253 67 6 Y 128 30 63
def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
+def @arg13 253 16777216 10 Y 128 31 63
+def @arg14 253 16777216 19 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 8 Y 128 31 63
def @arg17 253 20 4 Y 128 0 63
def @arg18 253 20 1 Y 128 0 63
def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 128 31 63
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 128 31 63
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 128 31 63
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 128 31 63
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
+def @arg20 253 16777216 1 Y 0 31 8
+def @arg21 253 16777216 10 Y 0 31 8
+def @arg22 253 16777216 30 Y 0 31 8
+def @arg23 253 16777216 8 Y 128 31 63
+def @arg24 253 16777216 8 Y 0 31 8
+def @arg25 253 16777216 4 Y 128 31 63
+def @arg26 253 16777216 4 Y 0 31 8
+def @arg27 253 16777216 10 Y 128 31 63
+def @arg28 253 16777216 10 Y 0 31 8
+def @arg29 253 16777216 8 Y 128 31 63
+def @arg30 253 16777216 8 Y 0 31 8
+def @arg31 253 16777216 3 Y 0 31 8
+def @arg32 253 16777216 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2049,26 +2049,26 @@ def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
def @arg11 253 67 0 Y 128 30 63
def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
+def @arg13 253 16777216 0 Y 128 31 63
+def @arg14 253 16777216 0 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 0 Y 128 31 63
def @arg17 253 20 0 Y 128 0 63
def @arg18 253 20 0 Y 128 0 63
def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 128 31 63
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 128 31 63
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 128 31 63
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 128 31 63
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
+def @arg20 253 16777216 0 Y 0 31 8
+def @arg21 253 16777216 0 Y 0 31 8
+def @arg22 253 16777216 0 Y 0 31 8
+def @arg23 253 16777216 0 Y 128 31 63
+def @arg24 253 16777216 0 Y 0 31 8
+def @arg25 253 16777216 0 Y 128 31 63
+def @arg26 253 16777216 0 Y 0 31 8
+def @arg27 253 16777216 0 Y 128 31 63
+def @arg28 253 16777216 0 Y 0 31 8
+def @arg29 253 16777216 0 Y 128 31 63
+def @arg30 253 16777216 0 Y 0 31 8
+def @arg31 253 16777216 0 Y 0 31 8
+def @arg32 253 16777216 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2097,26 +2097,26 @@ def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
def @arg11 253 67 6 Y 128 30 63
def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
+def @arg13 253 16777216 10 Y 128 31 63
+def @arg14 253 16777216 19 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 8 Y 128 31 63
def @arg17 253 20 4 Y 128 0 63
def @arg18 253 20 1 Y 128 0 63
def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 128 31 63
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 128 31 63
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 128 31 63
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 128 31 63
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
+def @arg20 253 16777216 1 Y 0 31 8
+def @arg21 253 16777216 10 Y 0 31 8
+def @arg22 253 16777216 30 Y 0 31 8
+def @arg23 253 16777216 8 Y 128 31 63
+def @arg24 253 16777216 8 Y 0 31 8
+def @arg25 253 16777216 4 Y 128 31 63
+def @arg26 253 16777216 4 Y 0 31 8
+def @arg27 253 16777216 10 Y 128 31 63
+def @arg28 253 16777216 10 Y 0 31 8
+def @arg29 253 16777216 8 Y 128 31 63
+def @arg30 253 16777216 8 Y 0 31 8
+def @arg31 253 16777216 3 Y 0 31 8
+def @arg32 253 16777216 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2141,26 +2141,26 @@ def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
def @arg11 253 67 0 Y 128 30 63
def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
+def @arg13 253 16777216 0 Y 128 31 63
+def @arg14 253 16777216 0 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 0 Y 128 31 63
def @arg17 253 20 0 Y 128 0 63
def @arg18 253 20 0 Y 128 0 63
def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 128 31 63
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 128 31 63
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 128 31 63
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 128 31 63
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
+def @arg20 253 16777216 0 Y 0 31 8
+def @arg21 253 16777216 0 Y 0 31 8
+def @arg22 253 16777216 0 Y 0 31 8
+def @arg23 253 16777216 0 Y 128 31 63
+def @arg24 253 16777216 0 Y 0 31 8
+def @arg25 253 16777216 0 Y 128 31 63
+def @arg26 253 16777216 0 Y 0 31 8
+def @arg27 253 16777216 0 Y 128 31 63
+def @arg28 253 16777216 0 Y 0 31 8
+def @arg29 253 16777216 0 Y 128 31 63
+def @arg30 253 16777216 0 Y 0 31 8
+def @arg31 253 16777216 0 Y 0 31 8
+def @arg32 253 16777216 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2187,26 +2187,26 @@ def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
def @arg11 253 67 6 Y 128 30 63
def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
+def @arg13 253 16777216 10 Y 128 31 63
+def @arg14 253 16777216 19 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 8 Y 128 31 63
def @arg17 253 20 4 Y 128 0 63
def @arg18 253 20 1 Y 128 0 63
def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 128 31 63
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 128 31 63
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 128 31 63
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 128 31 63
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
+def @arg20 253 16777216 1 Y 0 31 8
+def @arg21 253 16777216 10 Y 0 31 8
+def @arg22 253 16777216 30 Y 0 31 8
+def @arg23 253 16777216 8 Y 128 31 63
+def @arg24 253 16777216 8 Y 0 31 8
+def @arg25 253 16777216 4 Y 128 31 63
+def @arg26 253 16777216 4 Y 0 31 8
+def @arg27 253 16777216 10 Y 128 31 63
+def @arg28 253 16777216 10 Y 0 31 8
+def @arg29 253 16777216 8 Y 128 31 63
+def @arg30 253 16777216 8 Y 0 31 8
+def @arg31 253 16777216 3 Y 0 31 8
+def @arg32 253 16777216 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2225,26 +2225,26 @@ def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
def @arg11 253 67 0 Y 128 30 63
def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
+def @arg13 253 16777216 0 Y 128 31 63
+def @arg14 253 16777216 0 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 0 Y 128 31 63
def @arg17 253 20 0 Y 128 0 63
def @arg18 253 20 0 Y 128 0 63
def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 128 31 63
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 128 31 63
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 128 31 63
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 128 31 63
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
+def @arg20 253 16777216 0 Y 0 31 8
+def @arg21 253 16777216 0 Y 0 31 8
+def @arg22 253 16777216 0 Y 0 31 8
+def @arg23 253 16777216 0 Y 128 31 63
+def @arg24 253 16777216 0 Y 0 31 8
+def @arg25 253 16777216 0 Y 128 31 63
+def @arg26 253 16777216 0 Y 0 31 8
+def @arg27 253 16777216 0 Y 128 31 63
+def @arg28 253 16777216 0 Y 0 31 8
+def @arg29 253 16777216 0 Y 128 31 63
+def @arg30 253 16777216 0 Y 0 31 8
+def @arg31 253 16777216 0 Y 0 31 8
+def @arg32 253 16777216 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
@@ -2555,12 +2555,12 @@ set @arg00= 9223372036854775807 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -2578,12 +2578,12 @@ set @arg00= '9223372036854775807' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -2601,12 +2601,12 @@ set @arg00= -9223372036854775808 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -2624,12 +2624,12 @@ set @arg00= '-9223372036854775808' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -2647,14 +2647,14 @@ set @arg00= 1.11111111111111111111e+50 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -2672,14 +2672,14 @@ set @arg00= '1.11111111111111111111e+50' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -2697,14 +2697,14 @@ set @arg00= -1.11111111111111111111e+50 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -2722,14 +2722,14 @@ set @arg00= '-1.11111111111111111111e+50' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -2960,45 +2960,45 @@ Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
c1 c13 c14 c15 c16 c17
20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result
index 0e4c6fc3077..f4eec0c610c 100644
--- a/mysql-test/r/ps_4heap.result
+++ b/mysql-test/r/ps_4heap.result
@@ -1288,7 +1288,7 @@ set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1
+Warning 1048 Column 'a' cannot be null
select a,b from t1 order by a;
a b
0 two
@@ -1410,7 +1410,7 @@ select a,b from t1 where b = @arg00;
a b
6 six
execute stmt1 using @arg00;
-ERROR 23000: Duplicate entry '6' for key 1
+ERROR 23000: Duplicate entry '6' for key 'PRIMARY'
set @arg00=NULL ;
prepare stmt1 from 'insert into t1 values(0, ? )';
execute stmt1 using @arg00;
@@ -1523,7 +1523,7 @@ a b
set @arg00=81 ;
set @arg01=1 ;
execute stmt1 using @arg00, @arg01;
-ERROR 23000: Duplicate entry '82' for key 1
+ERROR 23000: Duplicate entry '82' for key 'PRIMARY'
drop table if exists t2 ;
create table t2 (id int auto_increment primary key)
ENGINE= 'HEAP' ;
@@ -1759,31 +1759,31 @@ NULL as const12, @arg12 as param12,
show create table t5 ;
Table Create Table
t5 CREATE TABLE `t5` (
- `const01` int(1) NOT NULL default '0',
- `param01` bigint(20) default NULL,
- `const02` decimal(2,1) NOT NULL default '0.0',
- `param02` decimal(65,30) default NULL,
- `const03` double NOT NULL default '0',
- `param03` double default NULL,
- `const04` varchar(3) NOT NULL default '',
+ `const01` int(1) NOT NULL DEFAULT '0',
+ `param01` bigint(20) DEFAULT NULL,
+ `const02` decimal(2,1) NOT NULL DEFAULT '0.0',
+ `param02` decimal(65,30) DEFAULT NULL,
+ `const03` double NOT NULL DEFAULT '0',
+ `param03` double DEFAULT NULL,
+ `const04` varchar(3) NOT NULL DEFAULT '',
`param04` longtext,
- `const05` varbinary(3) NOT NULL default '',
+ `const05` varbinary(3) NOT NULL DEFAULT '',
`param05` longblob,
- `const06` varchar(10) NOT NULL default '',
+ `const06` varchar(10) NOT NULL DEFAULT '',
`param06` longtext,
- `const07` date default NULL,
+ `const07` date DEFAULT NULL,
`param07` longblob,
- `const08` varchar(19) NOT NULL default '',
+ `const08` varchar(19) NOT NULL DEFAULT '',
`param08` longtext,
- `const09` datetime default NULL,
+ `const09` datetime DEFAULT NULL,
`param09` longblob,
- `const10` int(10) NOT NULL default '0',
- `param10` bigint(20) default NULL,
- `const11` int(4) default NULL,
- `param11` bigint(20) default NULL,
- `const12` binary(0) default NULL,
- `param12` bigint(20) default NULL,
- `param13` decimal(65,30) default NULL,
+ `const10` int(10) NOT NULL DEFAULT '0',
+ `param10` bigint(20) DEFAULT NULL,
+ `const11` int(4) DEFAULT NULL,
+ `param11` bigint(20) DEFAULT NULL,
+ `const12` binary(0) DEFAULT NULL,
+ `param12` bigint(20) DEFAULT NULL,
+ `param13` decimal(65,30) DEFAULT NULL,
`param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -1913,26 +1913,26 @@ def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
def @arg11 253 67 6 Y 128 30 63
def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
+def @arg13 253 16777216 10 Y 128 31 63
+def @arg14 253 16777216 19 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 8 Y 128 31 63
def @arg17 253 20 4 Y 128 0 63
def @arg18 253 20 1 Y 128 0 63
def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 0 31 8
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 0 31 8
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 0 31 8
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 0 31 8
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
+def @arg20 253 16777216 1 Y 0 31 8
+def @arg21 253 16777216 10 Y 0 31 8
+def @arg22 253 16777216 30 Y 0 31 8
+def @arg23 253 16777216 8 Y 0 31 8
+def @arg24 253 16777216 8 Y 0 31 8
+def @arg25 253 16777216 4 Y 0 31 8
+def @arg26 253 16777216 4 Y 0 31 8
+def @arg27 253 16777216 10 Y 0 31 8
+def @arg28 253 16777216 10 Y 0 31 8
+def @arg29 253 16777216 8 Y 0 31 8
+def @arg30 253 16777216 8 Y 0 31 8
+def @arg31 253 16777216 3 Y 0 31 8
+def @arg32 253 16777216 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@@ -1960,26 +1960,26 @@ def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
def @arg11 253 67 0 Y 128 30 63
def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
+def @arg13 253 16777216 0 Y 128 31 63
+def @arg14 253 16777216 0 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 0 Y 128 31 63
def @arg17 253 20 0 Y 128 0 63
def @arg18 253 20 0 Y 128 0 63
def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 0 31 8
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 0 31 8
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 0 31 8
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 0 31 8
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
+def @arg20 253 16777216 0 Y 0 31 8
+def @arg21 253 16777216 0 Y 0 31 8
+def @arg22 253 16777216 0 Y 0 31 8
+def @arg23 253 16777216 0 Y 0 31 8
+def @arg24 253 16777216 0 Y 0 31 8
+def @arg25 253 16777216 0 Y 0 31 8
+def @arg26 253 16777216 0 Y 0 31 8
+def @arg27 253 16777216 0 Y 0 31 8
+def @arg28 253 16777216 0 Y 0 31 8
+def @arg29 253 16777216 0 Y 0 31 8
+def @arg30 253 16777216 0 Y 0 31 8
+def @arg31 253 16777216 0 Y 0 31 8
+def @arg32 253 16777216 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -2010,26 +2010,26 @@ def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
def @arg11 253 67 6 Y 128 30 63
def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
+def @arg13 253 16777216 10 Y 128 31 63
+def @arg14 253 16777216 19 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 8 Y 128 31 63
def @arg17 253 20 4 Y 128 0 63
def @arg18 253 20 1 Y 128 0 63
def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 0 31 8
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 0 31 8
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 0 31 8
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 0 31 8
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
+def @arg20 253 16777216 1 Y 0 31 8
+def @arg21 253 16777216 10 Y 0 31 8
+def @arg22 253 16777216 30 Y 0 31 8
+def @arg23 253 16777216 8 Y 0 31 8
+def @arg24 253 16777216 8 Y 0 31 8
+def @arg25 253 16777216 4 Y 0 31 8
+def @arg26 253 16777216 4 Y 0 31 8
+def @arg27 253 16777216 10 Y 0 31 8
+def @arg28 253 16777216 10 Y 0 31 8
+def @arg29 253 16777216 8 Y 0 31 8
+def @arg30 253 16777216 8 Y 0 31 8
+def @arg31 253 16777216 3 Y 0 31 8
+def @arg32 253 16777216 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2050,26 +2050,26 @@ def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
def @arg11 253 67 0 Y 128 30 63
def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
+def @arg13 253 16777216 0 Y 128 31 63
+def @arg14 253 16777216 0 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 0 Y 128 31 63
def @arg17 253 20 0 Y 128 0 63
def @arg18 253 20 0 Y 128 0 63
def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 0 31 8
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 0 31 8
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 0 31 8
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 0 31 8
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
+def @arg20 253 16777216 0 Y 0 31 8
+def @arg21 253 16777216 0 Y 0 31 8
+def @arg22 253 16777216 0 Y 0 31 8
+def @arg23 253 16777216 0 Y 0 31 8
+def @arg24 253 16777216 0 Y 0 31 8
+def @arg25 253 16777216 0 Y 0 31 8
+def @arg26 253 16777216 0 Y 0 31 8
+def @arg27 253 16777216 0 Y 0 31 8
+def @arg28 253 16777216 0 Y 0 31 8
+def @arg29 253 16777216 0 Y 0 31 8
+def @arg30 253 16777216 0 Y 0 31 8
+def @arg31 253 16777216 0 Y 0 31 8
+def @arg32 253 16777216 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2098,26 +2098,26 @@ def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
def @arg11 253 67 6 Y 128 30 63
def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
+def @arg13 253 16777216 10 Y 128 31 63
+def @arg14 253 16777216 19 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 8 Y 128 31 63
def @arg17 253 20 4 Y 128 0 63
def @arg18 253 20 1 Y 128 0 63
def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 0 31 8
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 0 31 8
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 0 31 8
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 0 31 8
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
+def @arg20 253 16777216 1 Y 0 31 8
+def @arg21 253 16777216 10 Y 0 31 8
+def @arg22 253 16777216 30 Y 0 31 8
+def @arg23 253 16777216 8 Y 0 31 8
+def @arg24 253 16777216 8 Y 0 31 8
+def @arg25 253 16777216 4 Y 0 31 8
+def @arg26 253 16777216 4 Y 0 31 8
+def @arg27 253 16777216 10 Y 0 31 8
+def @arg28 253 16777216 10 Y 0 31 8
+def @arg29 253 16777216 8 Y 0 31 8
+def @arg30 253 16777216 8 Y 0 31 8
+def @arg31 253 16777216 3 Y 0 31 8
+def @arg32 253 16777216 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2142,26 +2142,26 @@ def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
def @arg11 253 67 0 Y 128 30 63
def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
+def @arg13 253 16777216 0 Y 128 31 63
+def @arg14 253 16777216 0 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 0 Y 128 31 63
def @arg17 253 20 0 Y 128 0 63
def @arg18 253 20 0 Y 128 0 63
def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 0 31 8
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 0 31 8
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 0 31 8
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 0 31 8
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
+def @arg20 253 16777216 0 Y 0 31 8
+def @arg21 253 16777216 0 Y 0 31 8
+def @arg22 253 16777216 0 Y 0 31 8
+def @arg23 253 16777216 0 Y 0 31 8
+def @arg24 253 16777216 0 Y 0 31 8
+def @arg25 253 16777216 0 Y 0 31 8
+def @arg26 253 16777216 0 Y 0 31 8
+def @arg27 253 16777216 0 Y 0 31 8
+def @arg28 253 16777216 0 Y 0 31 8
+def @arg29 253 16777216 0 Y 0 31 8
+def @arg30 253 16777216 0 Y 0 31 8
+def @arg31 253 16777216 0 Y 0 31 8
+def @arg32 253 16777216 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2188,26 +2188,26 @@ def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
def @arg11 253 67 6 Y 128 30 63
def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
+def @arg13 253 16777216 10 Y 128 31 63
+def @arg14 253 16777216 19 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 8 Y 128 31 63
def @arg17 253 20 4 Y 128 0 63
def @arg18 253 20 1 Y 128 0 63
def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 0 31 8
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 0 31 8
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 0 31 8
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 0 31 8
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
+def @arg20 253 16777216 1 Y 0 31 8
+def @arg21 253 16777216 10 Y 0 31 8
+def @arg22 253 16777216 30 Y 0 31 8
+def @arg23 253 16777216 8 Y 0 31 8
+def @arg24 253 16777216 8 Y 0 31 8
+def @arg25 253 16777216 4 Y 0 31 8
+def @arg26 253 16777216 4 Y 0 31 8
+def @arg27 253 16777216 10 Y 0 31 8
+def @arg28 253 16777216 10 Y 0 31 8
+def @arg29 253 16777216 8 Y 0 31 8
+def @arg30 253 16777216 8 Y 0 31 8
+def @arg31 253 16777216 3 Y 0 31 8
+def @arg32 253 16777216 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2226,26 +2226,26 @@ def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
def @arg11 253 67 0 Y 128 30 63
def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
+def @arg13 253 16777216 0 Y 128 31 63
+def @arg14 253 16777216 0 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 0 Y 128 31 63
def @arg17 253 20 0 Y 128 0 63
def @arg18 253 20 0 Y 128 0 63
def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 0 31 8
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 0 31 8
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 0 31 8
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 0 31 8
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
+def @arg20 253 16777216 0 Y 0 31 8
+def @arg21 253 16777216 0 Y 0 31 8
+def @arg22 253 16777216 0 Y 0 31 8
+def @arg23 253 16777216 0 Y 0 31 8
+def @arg24 253 16777216 0 Y 0 31 8
+def @arg25 253 16777216 0 Y 0 31 8
+def @arg26 253 16777216 0 Y 0 31 8
+def @arg27 253 16777216 0 Y 0 31 8
+def @arg28 253 16777216 0 Y 0 31 8
+def @arg29 253 16777216 0 Y 0 31 8
+def @arg30 253 16777216 0 Y 0 31 8
+def @arg31 253 16777216 0 Y 0 31 8
+def @arg32 253 16777216 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
@@ -2556,12 +2556,12 @@ set @arg00= 9223372036854775807 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -2579,12 +2579,12 @@ set @arg00= '9223372036854775807' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -2602,12 +2602,12 @@ set @arg00= -9223372036854775808 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -2625,12 +2625,12 @@ set @arg00= '-9223372036854775808' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -2648,14 +2648,14 @@ set @arg00= 1.11111111111111111111e+50 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -2673,14 +2673,14 @@ set @arg00= '1.11111111111111111111e+50' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -2698,14 +2698,14 @@ set @arg00= -1.11111111111111111111e+50 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -2723,14 +2723,14 @@ set @arg00= '-1.11111111111111111111e+50' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -2961,45 +2961,45 @@ Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
c1 c13 c14 c15 c16 c17
20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result
index 1e337072ecb..38e4626d59c 100644
--- a/mysql-test/r/ps_5merge.result
+++ b/mysql-test/r/ps_5merge.result
@@ -1330,7 +1330,7 @@ set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1
+Warning 1048 Column 'a' cannot be null
select a,b from t1 order by a;
a b
0 two
@@ -1452,7 +1452,7 @@ select a,b from t1 where b = @arg00;
a b
6 six
execute stmt1 using @arg00;
-ERROR 23000: Duplicate entry '6' for key 1
+ERROR 23000: Duplicate entry '6' for key 'PRIMARY'
set @arg00=NULL ;
prepare stmt1 from 'insert into t1 values(0, ? )';
execute stmt1 using @arg00;
@@ -1565,7 +1565,7 @@ a b
set @arg00=81 ;
set @arg01=1 ;
execute stmt1 using @arg00, @arg01;
-ERROR 23000: Duplicate entry '82' for key 1
+ERROR 23000: Duplicate entry '82' for key 'PRIMARY'
drop table if exists t2 ;
create table t2 (id int auto_increment primary key)
ENGINE= 'MYISAM' ;
@@ -1695,31 +1695,31 @@ NULL as const12, @arg12 as param12,
show create table t5 ;
Table Create Table
t5 CREATE TABLE `t5` (
- `const01` int(1) NOT NULL default '0',
- `param01` bigint(20) default NULL,
- `const02` decimal(2,1) NOT NULL default '0.0',
- `param02` decimal(65,30) default NULL,
- `const03` double NOT NULL default '0',
- `param03` double default NULL,
- `const04` varchar(3) NOT NULL default '',
+ `const01` int(1) NOT NULL DEFAULT '0',
+ `param01` bigint(20) DEFAULT NULL,
+ `const02` decimal(2,1) NOT NULL DEFAULT '0.0',
+ `param02` decimal(65,30) DEFAULT NULL,
+ `const03` double NOT NULL DEFAULT '0',
+ `param03` double DEFAULT NULL,
+ `const04` varchar(3) NOT NULL DEFAULT '',
`param04` longtext,
- `const05` varbinary(3) NOT NULL default '',
+ `const05` varbinary(3) NOT NULL DEFAULT '',
`param05` longblob,
- `const06` varchar(10) NOT NULL default '',
+ `const06` varchar(10) NOT NULL DEFAULT '',
`param06` longtext,
- `const07` date default NULL,
+ `const07` date DEFAULT NULL,
`param07` longblob,
- `const08` varchar(19) NOT NULL default '',
+ `const08` varchar(19) NOT NULL DEFAULT '',
`param08` longtext,
- `const09` datetime default NULL,
+ `const09` datetime DEFAULT NULL,
`param09` longblob,
- `const10` int(10) NOT NULL default '0',
- `param10` bigint(20) default NULL,
- `const11` int(4) default NULL,
- `param11` bigint(20) default NULL,
- `const12` binary(0) default NULL,
- `param12` bigint(20) default NULL,
- `param13` decimal(65,30) default NULL,
+ `const10` int(10) NOT NULL DEFAULT '0',
+ `param10` bigint(20) DEFAULT NULL,
+ `const11` int(4) DEFAULT NULL,
+ `param11` bigint(20) DEFAULT NULL,
+ `const12` binary(0) DEFAULT NULL,
+ `param12` bigint(20) DEFAULT NULL,
+ `param13` decimal(65,30) DEFAULT NULL,
`param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -1849,26 +1849,26 @@ def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
def @arg11 253 67 6 Y 128 30 63
def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
+def @arg13 253 16777216 10 Y 128 31 63
+def @arg14 253 16777216 19 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 8 Y 128 31 63
def @arg17 253 20 4 Y 128 0 63
def @arg18 253 20 1 Y 128 0 63
def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 128 31 63
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 128 31 63
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 128 31 63
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 128 31 63
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
+def @arg20 253 16777216 1 Y 0 31 8
+def @arg21 253 16777216 10 Y 0 31 8
+def @arg22 253 16777216 30 Y 0 31 8
+def @arg23 253 16777216 8 Y 128 31 63
+def @arg24 253 16777216 8 Y 0 31 8
+def @arg25 253 16777216 4 Y 128 31 63
+def @arg26 253 16777216 4 Y 0 31 8
+def @arg27 253 16777216 10 Y 128 31 63
+def @arg28 253 16777216 10 Y 0 31 8
+def @arg29 253 16777216 8 Y 128 31 63
+def @arg30 253 16777216 8 Y 0 31 8
+def @arg31 253 16777216 3 Y 0 31 8
+def @arg32 253 16777216 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@@ -1896,26 +1896,26 @@ def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
def @arg11 253 67 0 Y 128 30 63
def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
+def @arg13 253 16777216 0 Y 128 31 63
+def @arg14 253 16777216 0 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 0 Y 128 31 63
def @arg17 253 20 0 Y 128 0 63
def @arg18 253 20 0 Y 128 0 63
def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 128 31 63
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 128 31 63
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 128 31 63
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 128 31 63
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
+def @arg20 253 16777216 0 Y 0 31 8
+def @arg21 253 16777216 0 Y 0 31 8
+def @arg22 253 16777216 0 Y 0 31 8
+def @arg23 253 16777216 0 Y 128 31 63
+def @arg24 253 16777216 0 Y 0 31 8
+def @arg25 253 16777216 0 Y 128 31 63
+def @arg26 253 16777216 0 Y 0 31 8
+def @arg27 253 16777216 0 Y 128 31 63
+def @arg28 253 16777216 0 Y 0 31 8
+def @arg29 253 16777216 0 Y 128 31 63
+def @arg30 253 16777216 0 Y 0 31 8
+def @arg31 253 16777216 0 Y 0 31 8
+def @arg32 253 16777216 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -1946,26 +1946,26 @@ def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
def @arg11 253 67 6 Y 128 30 63
def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
+def @arg13 253 16777216 10 Y 128 31 63
+def @arg14 253 16777216 19 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 8 Y 128 31 63
def @arg17 253 20 4 Y 128 0 63
def @arg18 253 20 1 Y 128 0 63
def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 128 31 63
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 128 31 63
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 128 31 63
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 128 31 63
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
+def @arg20 253 16777216 1 Y 0 31 8
+def @arg21 253 16777216 10 Y 0 31 8
+def @arg22 253 16777216 30 Y 0 31 8
+def @arg23 253 16777216 8 Y 128 31 63
+def @arg24 253 16777216 8 Y 0 31 8
+def @arg25 253 16777216 4 Y 128 31 63
+def @arg26 253 16777216 4 Y 0 31 8
+def @arg27 253 16777216 10 Y 128 31 63
+def @arg28 253 16777216 10 Y 0 31 8
+def @arg29 253 16777216 8 Y 128 31 63
+def @arg30 253 16777216 8 Y 0 31 8
+def @arg31 253 16777216 3 Y 0 31 8
+def @arg32 253 16777216 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -1986,26 +1986,26 @@ def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
def @arg11 253 67 0 Y 128 30 63
def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
+def @arg13 253 16777216 0 Y 128 31 63
+def @arg14 253 16777216 0 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 0 Y 128 31 63
def @arg17 253 20 0 Y 128 0 63
def @arg18 253 20 0 Y 128 0 63
def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 128 31 63
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 128 31 63
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 128 31 63
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 128 31 63
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
+def @arg20 253 16777216 0 Y 0 31 8
+def @arg21 253 16777216 0 Y 0 31 8
+def @arg22 253 16777216 0 Y 0 31 8
+def @arg23 253 16777216 0 Y 128 31 63
+def @arg24 253 16777216 0 Y 0 31 8
+def @arg25 253 16777216 0 Y 128 31 63
+def @arg26 253 16777216 0 Y 0 31 8
+def @arg27 253 16777216 0 Y 128 31 63
+def @arg28 253 16777216 0 Y 0 31 8
+def @arg29 253 16777216 0 Y 128 31 63
+def @arg30 253 16777216 0 Y 0 31 8
+def @arg31 253 16777216 0 Y 0 31 8
+def @arg32 253 16777216 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2034,26 +2034,26 @@ def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
def @arg11 253 67 6 Y 128 30 63
def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
+def @arg13 253 16777216 10 Y 128 31 63
+def @arg14 253 16777216 19 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 8 Y 128 31 63
def @arg17 253 20 4 Y 128 0 63
def @arg18 253 20 1 Y 128 0 63
def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 128 31 63
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 128 31 63
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 128 31 63
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 128 31 63
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
+def @arg20 253 16777216 1 Y 0 31 8
+def @arg21 253 16777216 10 Y 0 31 8
+def @arg22 253 16777216 30 Y 0 31 8
+def @arg23 253 16777216 8 Y 128 31 63
+def @arg24 253 16777216 8 Y 0 31 8
+def @arg25 253 16777216 4 Y 128 31 63
+def @arg26 253 16777216 4 Y 0 31 8
+def @arg27 253 16777216 10 Y 128 31 63
+def @arg28 253 16777216 10 Y 0 31 8
+def @arg29 253 16777216 8 Y 128 31 63
+def @arg30 253 16777216 8 Y 0 31 8
+def @arg31 253 16777216 3 Y 0 31 8
+def @arg32 253 16777216 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2078,26 +2078,26 @@ def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
def @arg11 253 67 0 Y 128 30 63
def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
+def @arg13 253 16777216 0 Y 128 31 63
+def @arg14 253 16777216 0 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 0 Y 128 31 63
def @arg17 253 20 0 Y 128 0 63
def @arg18 253 20 0 Y 128 0 63
def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 128 31 63
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 128 31 63
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 128 31 63
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 128 31 63
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
+def @arg20 253 16777216 0 Y 0 31 8
+def @arg21 253 16777216 0 Y 0 31 8
+def @arg22 253 16777216 0 Y 0 31 8
+def @arg23 253 16777216 0 Y 128 31 63
+def @arg24 253 16777216 0 Y 0 31 8
+def @arg25 253 16777216 0 Y 128 31 63
+def @arg26 253 16777216 0 Y 0 31 8
+def @arg27 253 16777216 0 Y 128 31 63
+def @arg28 253 16777216 0 Y 0 31 8
+def @arg29 253 16777216 0 Y 128 31 63
+def @arg30 253 16777216 0 Y 0 31 8
+def @arg31 253 16777216 0 Y 0 31 8
+def @arg32 253 16777216 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2124,26 +2124,26 @@ def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
def @arg11 253 67 6 Y 128 30 63
def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
+def @arg13 253 16777216 10 Y 128 31 63
+def @arg14 253 16777216 19 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 8 Y 128 31 63
def @arg17 253 20 4 Y 128 0 63
def @arg18 253 20 1 Y 128 0 63
def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 128 31 63
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 128 31 63
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 128 31 63
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 128 31 63
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
+def @arg20 253 16777216 1 Y 0 31 8
+def @arg21 253 16777216 10 Y 0 31 8
+def @arg22 253 16777216 30 Y 0 31 8
+def @arg23 253 16777216 8 Y 128 31 63
+def @arg24 253 16777216 8 Y 0 31 8
+def @arg25 253 16777216 4 Y 128 31 63
+def @arg26 253 16777216 4 Y 0 31 8
+def @arg27 253 16777216 10 Y 128 31 63
+def @arg28 253 16777216 10 Y 0 31 8
+def @arg29 253 16777216 8 Y 128 31 63
+def @arg30 253 16777216 8 Y 0 31 8
+def @arg31 253 16777216 3 Y 0 31 8
+def @arg32 253 16777216 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2162,26 +2162,26 @@ def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
def @arg11 253 67 0 Y 128 30 63
def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
+def @arg13 253 16777216 0 Y 128 31 63
+def @arg14 253 16777216 0 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 0 Y 128 31 63
def @arg17 253 20 0 Y 128 0 63
def @arg18 253 20 0 Y 128 0 63
def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 128 31 63
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 128 31 63
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 128 31 63
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 128 31 63
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
+def @arg20 253 16777216 0 Y 0 31 8
+def @arg21 253 16777216 0 Y 0 31 8
+def @arg22 253 16777216 0 Y 0 31 8
+def @arg23 253 16777216 0 Y 128 31 63
+def @arg24 253 16777216 0 Y 0 31 8
+def @arg25 253 16777216 0 Y 128 31 63
+def @arg26 253 16777216 0 Y 0 31 8
+def @arg27 253 16777216 0 Y 128 31 63
+def @arg28 253 16777216 0 Y 0 31 8
+def @arg29 253 16777216 0 Y 128 31 63
+def @arg30 253 16777216 0 Y 0 31 8
+def @arg31 253 16777216 0 Y 0 31 8
+def @arg32 253 16777216 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
@@ -2492,12 +2492,12 @@ set @arg00= 9223372036854775807 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -2515,12 +2515,12 @@ set @arg00= '9223372036854775807' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -2538,12 +2538,12 @@ set @arg00= -9223372036854775808 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -2561,12 +2561,12 @@ set @arg00= '-9223372036854775808' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -2584,14 +2584,14 @@ set @arg00= 1.11111111111111111111e+50 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -2609,14 +2609,14 @@ set @arg00= '1.11111111111111111111e+50' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -2634,14 +2634,14 @@ set @arg00= -1.11111111111111111111e+50 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -2659,14 +2659,14 @@ set @arg00= '-1.11111111111111111111e+50' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -2897,45 +2897,45 @@ Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
c1 c13 c14 c15 c16 c17
20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
@@ -4344,7 +4344,7 @@ set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1
+Warning 1048 Column 'a' cannot be null
select a,b from t1 order by a;
a b
0 two
@@ -4466,7 +4466,7 @@ select a,b from t1 where b = @arg00;
a b
6 six
execute stmt1 using @arg00;
-ERROR 23000: Duplicate entry '6' for key 1
+ERROR 23000: Duplicate entry '6' for key 'PRIMARY'
set @arg00=NULL ;
prepare stmt1 from 'insert into t1 values(0, ? )';
execute stmt1 using @arg00;
@@ -4579,7 +4579,7 @@ a b
set @arg00=81 ;
set @arg01=1 ;
execute stmt1 using @arg00, @arg01;
-ERROR 23000: Duplicate entry '82' for key 1
+ERROR 23000: Duplicate entry '82' for key 'PRIMARY'
drop table if exists t2 ;
create table t2 (id int auto_increment primary key)
ENGINE= 'MYISAM' ;
@@ -4709,31 +4709,31 @@ NULL as const12, @arg12 as param12,
show create table t5 ;
Table Create Table
t5 CREATE TABLE `t5` (
- `const01` int(1) NOT NULL default '0',
- `param01` bigint(20) default NULL,
- `const02` decimal(2,1) NOT NULL default '0.0',
- `param02` decimal(65,30) default NULL,
- `const03` double NOT NULL default '0',
- `param03` double default NULL,
- `const04` varchar(3) NOT NULL default '',
+ `const01` int(1) NOT NULL DEFAULT '0',
+ `param01` bigint(20) DEFAULT NULL,
+ `const02` decimal(2,1) NOT NULL DEFAULT '0.0',
+ `param02` decimal(65,30) DEFAULT NULL,
+ `const03` double NOT NULL DEFAULT '0',
+ `param03` double DEFAULT NULL,
+ `const04` varchar(3) NOT NULL DEFAULT '',
`param04` longtext,
- `const05` varbinary(3) NOT NULL default '',
+ `const05` varbinary(3) NOT NULL DEFAULT '',
`param05` longblob,
- `const06` varchar(10) NOT NULL default '',
+ `const06` varchar(10) NOT NULL DEFAULT '',
`param06` longtext,
- `const07` date default NULL,
+ `const07` date DEFAULT NULL,
`param07` longblob,
- `const08` varchar(19) NOT NULL default '',
+ `const08` varchar(19) NOT NULL DEFAULT '',
`param08` longtext,
- `const09` datetime default NULL,
+ `const09` datetime DEFAULT NULL,
`param09` longblob,
- `const10` int(10) NOT NULL default '0',
- `param10` bigint(20) default NULL,
- `const11` int(4) default NULL,
- `param11` bigint(20) default NULL,
- `const12` binary(0) default NULL,
- `param12` bigint(20) default NULL,
- `param13` decimal(65,30) default NULL,
+ `const10` int(10) NOT NULL DEFAULT '0',
+ `param10` bigint(20) DEFAULT NULL,
+ `const11` int(4) DEFAULT NULL,
+ `param11` bigint(20) DEFAULT NULL,
+ `const12` binary(0) DEFAULT NULL,
+ `param12` bigint(20) DEFAULT NULL,
+ `param13` decimal(65,30) DEFAULT NULL,
`param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -4863,26 +4863,26 @@ def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
def @arg11 253 67 6 Y 128 30 63
def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
+def @arg13 253 16777216 10 Y 128 31 63
+def @arg14 253 16777216 19 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 8 Y 128 31 63
def @arg17 253 20 4 Y 128 0 63
def @arg18 253 20 1 Y 128 0 63
def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 128 31 63
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 128 31 63
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 128 31 63
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 128 31 63
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
+def @arg20 253 16777216 1 Y 0 31 8
+def @arg21 253 16777216 10 Y 0 31 8
+def @arg22 253 16777216 30 Y 0 31 8
+def @arg23 253 16777216 8 Y 128 31 63
+def @arg24 253 16777216 8 Y 0 31 8
+def @arg25 253 16777216 4 Y 128 31 63
+def @arg26 253 16777216 4 Y 0 31 8
+def @arg27 253 16777216 10 Y 128 31 63
+def @arg28 253 16777216 10 Y 0 31 8
+def @arg29 253 16777216 8 Y 128 31 63
+def @arg30 253 16777216 8 Y 0 31 8
+def @arg31 253 16777216 3 Y 0 31 8
+def @arg32 253 16777216 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@@ -4910,26 +4910,26 @@ def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
def @arg11 253 67 0 Y 128 30 63
def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
+def @arg13 253 16777216 0 Y 128 31 63
+def @arg14 253 16777216 0 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 0 Y 128 31 63
def @arg17 253 20 0 Y 128 0 63
def @arg18 253 20 0 Y 128 0 63
def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 128 31 63
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 128 31 63
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 128 31 63
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 128 31 63
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
+def @arg20 253 16777216 0 Y 0 31 8
+def @arg21 253 16777216 0 Y 0 31 8
+def @arg22 253 16777216 0 Y 0 31 8
+def @arg23 253 16777216 0 Y 128 31 63
+def @arg24 253 16777216 0 Y 0 31 8
+def @arg25 253 16777216 0 Y 128 31 63
+def @arg26 253 16777216 0 Y 0 31 8
+def @arg27 253 16777216 0 Y 128 31 63
+def @arg28 253 16777216 0 Y 0 31 8
+def @arg29 253 16777216 0 Y 128 31 63
+def @arg30 253 16777216 0 Y 0 31 8
+def @arg31 253 16777216 0 Y 0 31 8
+def @arg32 253 16777216 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -4960,26 +4960,26 @@ def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
def @arg11 253 67 6 Y 128 30 63
def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
+def @arg13 253 16777216 10 Y 128 31 63
+def @arg14 253 16777216 19 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 8 Y 128 31 63
def @arg17 253 20 4 Y 128 0 63
def @arg18 253 20 1 Y 128 0 63
def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 128 31 63
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 128 31 63
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 128 31 63
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 128 31 63
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
+def @arg20 253 16777216 1 Y 0 31 8
+def @arg21 253 16777216 10 Y 0 31 8
+def @arg22 253 16777216 30 Y 0 31 8
+def @arg23 253 16777216 8 Y 128 31 63
+def @arg24 253 16777216 8 Y 0 31 8
+def @arg25 253 16777216 4 Y 128 31 63
+def @arg26 253 16777216 4 Y 0 31 8
+def @arg27 253 16777216 10 Y 128 31 63
+def @arg28 253 16777216 10 Y 0 31 8
+def @arg29 253 16777216 8 Y 128 31 63
+def @arg30 253 16777216 8 Y 0 31 8
+def @arg31 253 16777216 3 Y 0 31 8
+def @arg32 253 16777216 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -5000,26 +5000,26 @@ def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
def @arg11 253 67 0 Y 128 30 63
def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
+def @arg13 253 16777216 0 Y 128 31 63
+def @arg14 253 16777216 0 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 0 Y 128 31 63
def @arg17 253 20 0 Y 128 0 63
def @arg18 253 20 0 Y 128 0 63
def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 128 31 63
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 128 31 63
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 128 31 63
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 128 31 63
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
+def @arg20 253 16777216 0 Y 0 31 8
+def @arg21 253 16777216 0 Y 0 31 8
+def @arg22 253 16777216 0 Y 0 31 8
+def @arg23 253 16777216 0 Y 128 31 63
+def @arg24 253 16777216 0 Y 0 31 8
+def @arg25 253 16777216 0 Y 128 31 63
+def @arg26 253 16777216 0 Y 0 31 8
+def @arg27 253 16777216 0 Y 128 31 63
+def @arg28 253 16777216 0 Y 0 31 8
+def @arg29 253 16777216 0 Y 128 31 63
+def @arg30 253 16777216 0 Y 0 31 8
+def @arg31 253 16777216 0 Y 0 31 8
+def @arg32 253 16777216 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -5048,26 +5048,26 @@ def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
def @arg11 253 67 6 Y 128 30 63
def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
+def @arg13 253 16777216 10 Y 128 31 63
+def @arg14 253 16777216 19 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 8 Y 128 31 63
def @arg17 253 20 4 Y 128 0 63
def @arg18 253 20 1 Y 128 0 63
def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 128 31 63
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 128 31 63
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 128 31 63
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 128 31 63
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
+def @arg20 253 16777216 1 Y 0 31 8
+def @arg21 253 16777216 10 Y 0 31 8
+def @arg22 253 16777216 30 Y 0 31 8
+def @arg23 253 16777216 8 Y 128 31 63
+def @arg24 253 16777216 8 Y 0 31 8
+def @arg25 253 16777216 4 Y 128 31 63
+def @arg26 253 16777216 4 Y 0 31 8
+def @arg27 253 16777216 10 Y 128 31 63
+def @arg28 253 16777216 10 Y 0 31 8
+def @arg29 253 16777216 8 Y 128 31 63
+def @arg30 253 16777216 8 Y 0 31 8
+def @arg31 253 16777216 3 Y 0 31 8
+def @arg32 253 16777216 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -5092,26 +5092,26 @@ def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
def @arg11 253 67 0 Y 128 30 63
def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
+def @arg13 253 16777216 0 Y 128 31 63
+def @arg14 253 16777216 0 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 0 Y 128 31 63
def @arg17 253 20 0 Y 128 0 63
def @arg18 253 20 0 Y 128 0 63
def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 128 31 63
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 128 31 63
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 128 31 63
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 128 31 63
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
+def @arg20 253 16777216 0 Y 0 31 8
+def @arg21 253 16777216 0 Y 0 31 8
+def @arg22 253 16777216 0 Y 0 31 8
+def @arg23 253 16777216 0 Y 128 31 63
+def @arg24 253 16777216 0 Y 0 31 8
+def @arg25 253 16777216 0 Y 128 31 63
+def @arg26 253 16777216 0 Y 0 31 8
+def @arg27 253 16777216 0 Y 128 31 63
+def @arg28 253 16777216 0 Y 0 31 8
+def @arg29 253 16777216 0 Y 128 31 63
+def @arg30 253 16777216 0 Y 0 31 8
+def @arg31 253 16777216 0 Y 0 31 8
+def @arg32 253 16777216 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -5138,26 +5138,26 @@ def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
def @arg11 253 67 6 Y 128 30 63
def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
+def @arg13 253 16777216 10 Y 128 31 63
+def @arg14 253 16777216 19 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 8 Y 128 31 63
def @arg17 253 20 4 Y 128 0 63
def @arg18 253 20 1 Y 128 0 63
def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 128 31 63
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 128 31 63
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 128 31 63
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 128 31 63
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
+def @arg20 253 16777216 1 Y 0 31 8
+def @arg21 253 16777216 10 Y 0 31 8
+def @arg22 253 16777216 30 Y 0 31 8
+def @arg23 253 16777216 8 Y 128 31 63
+def @arg24 253 16777216 8 Y 0 31 8
+def @arg25 253 16777216 4 Y 128 31 63
+def @arg26 253 16777216 4 Y 0 31 8
+def @arg27 253 16777216 10 Y 128 31 63
+def @arg28 253 16777216 10 Y 0 31 8
+def @arg29 253 16777216 8 Y 128 31 63
+def @arg30 253 16777216 8 Y 0 31 8
+def @arg31 253 16777216 3 Y 0 31 8
+def @arg32 253 16777216 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -5176,26 +5176,26 @@ def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
def @arg11 253 67 0 Y 128 30 63
def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
+def @arg13 253 16777216 0 Y 128 31 63
+def @arg14 253 16777216 0 Y 128 31 63
+def @arg15 253 16777216 19 Y 128 31 63
+def @arg16 253 16777216 0 Y 128 31 63
def @arg17 253 20 0 Y 128 0 63
def @arg18 253 20 0 Y 128 0 63
def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 128 31 63
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 128 31 63
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 128 31 63
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 128 31 63
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
+def @arg20 253 16777216 0 Y 0 31 8
+def @arg21 253 16777216 0 Y 0 31 8
+def @arg22 253 16777216 0 Y 0 31 8
+def @arg23 253 16777216 0 Y 128 31 63
+def @arg24 253 16777216 0 Y 0 31 8
+def @arg25 253 16777216 0 Y 128 31 63
+def @arg26 253 16777216 0 Y 0 31 8
+def @arg27 253 16777216 0 Y 128 31 63
+def @arg28 253 16777216 0 Y 0 31 8
+def @arg29 253 16777216 0 Y 128 31 63
+def @arg30 253 16777216 0 Y 0 31 8
+def @arg31 253 16777216 0 Y 0 31 8
+def @arg32 253 16777216 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
@@ -5506,12 +5506,12 @@ set @arg00= 9223372036854775807 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -5529,12 +5529,12 @@ set @arg00= '9223372036854775807' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -5552,12 +5552,12 @@ set @arg00= -9223372036854775808 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -5575,12 +5575,12 @@ set @arg00= '-9223372036854775808' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -5598,14 +5598,14 @@ set @arg00= 1.11111111111111111111e+50 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -5623,14 +5623,14 @@ set @arg00= '1.11111111111111111111e+50' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -5648,14 +5648,14 @@ set @arg00= -1.11111111111111111111e+50 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -5673,14 +5673,14 @@ set @arg00= '-1.11111111111111111111e+50' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -5911,45 +5911,45 @@ Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
c1 c13 c14 c15 c16 c17
20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result
deleted file mode 100644
index 49e3f9d9bb7..00000000000
--- a/mysql-test/r/ps_6bdb.result
+++ /dev/null
@@ -1,3120 +0,0 @@
-use test;
-drop table if exists t1, t9 ;
-create table t1
-(
-a int, b varchar(30),
-primary key(a)
-) engine = 'BDB' ;
-create table t9
-(
-c1 tinyint, c2 smallint, c3 mediumint, c4 int,
-c5 integer, c6 bigint, c7 float, c8 double,
-c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
-c13 date, c14 datetime, c15 timestamp, c16 time,
-c17 year, c18 tinyint, c19 bool, c20 char,
-c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
-c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
-c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
-c32 set('monday', 'tuesday', 'wednesday'),
-primary key(c1)
-) engine = 'BDB' ;
-delete from t1 ;
-insert into t1 values (1,'one');
-insert into t1 values (2,'two');
-insert into t1 values (3,'three');
-insert into t1 values (4,'four');
-commit ;
-delete from t9 ;
-insert into t9
-set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
-c10= 1, c11= 1, c12 = 1,
-c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
-c16= '11:11:11', c17= '2004',
-c18= 1, c19=true, c20= 'a', c21= '123456789a',
-c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
-c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
-c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
-insert into t9
-set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
-c10= 9, c11= 9, c12 = 9,
-c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
-c16= '11:11:11', c17= '2004',
-c18= 1, c19=false, c20= 'a', c21= '123456789a',
-c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
-c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
-c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
-commit ;
-test_sequence
------- simple select tests ------
-prepare stmt1 from ' select * from t9 order by c1 ' ;
-execute stmt1;
-Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def test t9 t9 c1 c1 1 4 1 N 49155 0 63
-def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
-def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
-def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
-def test t9 t9 c5 c5 3 11 1 Y 32768 0 63
-def test t9 t9 c6 c6 8 20 1 Y 32768 0 63
-def test t9 t9 c7 c7 4 12 1 Y 32768 31 63
-def test t9 t9 c8 c8 5 22 1 Y 32768 31 63
-def test t9 t9 c9 c9 5 22 1 Y 32768 31 63
-def test t9 t9 c10 c10 5 22 1 Y 32768 31 63
-def test t9 t9 c11 c11 246 9 6 Y 0 4 63
-def test t9 t9 c12 c12 246 10 6 Y 0 4 63
-def test t9 t9 c13 c13 10 10 10 Y 128 0 63
-def test t9 t9 c14 c14 12 19 19 Y 128 0 63
-def test t9 t9 c15 c15 7 19 19 N 1249 0 63
-def test t9 t9 c16 c16 11 8 8 Y 128 0 63
-def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
-def test t9 t9 c18 c18 1 4 1 Y 32768 0 63
-def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
-def test t9 t9 c20 c20 254 1 1 Y 0 0 8
-def test t9 t9 c21 c21 254 10 10 Y 0 0 8
-def test t9 t9 c22 c22 253 30 30 Y 0 0 8
-def test t9 t9 c23 c23 252 255 8 Y 144 0 63
-def test t9 t9 c24 c24 252 255 8 Y 16 0 8
-def test t9 t9 c25 c25 252 65535 4 Y 144 0 63
-def test t9 t9 c26 c26 252 65535 4 Y 16 0 8
-def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63
-def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8
-def test t9 t9 c29 c29 252 4294967295 8 Y 144 0 63
-def test t9 t9 c30 c30 252 4294967295 8 Y 16 0 8
-def test t9 t9 c31 c31 254 5 3 Y 256 0 8
-def test t9 t9 c32 c32 254 24 7 Y 2048 0 8
-c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
-1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
-9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
-set @arg00='SELECT' ;
-@arg00 a from t1 where a=1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a from t1 where a=1' at line 1
-prepare stmt1 from ' ? a from t1 where a=1 ';
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
-set @arg00=1 ;
-select @arg00, b from t1 where a=1 ;
-@arg00 b
-1 one
-prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
-execute stmt1 using @arg00 ;
-? b
-1 one
-set @arg00='lion' ;
-select @arg00, b from t1 where a=1 ;
-@arg00 b
-lion one
-prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
-execute stmt1 using @arg00 ;
-? b
-lion one
-set @arg00=NULL ;
-select @arg00, b from t1 where a=1 ;
-@arg00 b
-NULL one
-prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
-execute stmt1 using @arg00 ;
-? b
-NULL one
-set @arg00=1 ;
-select b, a - @arg00 from t1 where a=1 ;
-b a - @arg00
-one 0
-prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
-execute stmt1 using @arg00 ;
-b a - ?
-one 0
-set @arg00=null ;
-select @arg00 as my_col ;
-my_col
-NULL
-prepare stmt1 from ' select ? as my_col';
-execute stmt1 using @arg00 ;
-my_col
-NULL
-select @arg00 + 1 as my_col ;
-my_col
-NULL
-prepare stmt1 from ' select ? + 1 as my_col';
-execute stmt1 using @arg00 ;
-my_col
-NULL
-select 1 + @arg00 as my_col ;
-my_col
-NULL
-prepare stmt1 from ' select 1 + ? as my_col';
-execute stmt1 using @arg00 ;
-my_col
-NULL
-set @arg00='MySQL' ;
-select substr(@arg00,1,2) from t1 where a=1 ;
-substr(@arg00,1,2)
-My
-prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ;
-execute stmt1 using @arg00 ;
-substr(?,1,2)
-My
-set @arg00=3 ;
-select substr('MySQL',@arg00,5) from t1 where a=1 ;
-substr('MySQL',@arg00,5)
-SQL
-prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ;
-execute stmt1 using @arg00 ;
-substr('MySQL',?,5)
-SQL
-select substr('MySQL',1,@arg00) from t1 where a=1 ;
-substr('MySQL',1,@arg00)
-MyS
-prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ;
-execute stmt1 using @arg00 ;
-substr('MySQL',1,?)
-MyS
-set @arg00='MySQL' ;
-select a , concat(@arg00,b) from t1 order by a;
-a concat(@arg00,b)
-1 MySQLone
-2 MySQLtwo
-3 MySQLthree
-4 MySQLfour
-prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
-execute stmt1 using @arg00;
-a concat(?,b)
-1 MySQLone
-2 MySQLtwo
-3 MySQLthree
-4 MySQLfour
-select a , concat(b,@arg00) from t1 order by a ;
-a concat(b,@arg00)
-1 oneMySQL
-2 twoMySQL
-3 threeMySQL
-4 fourMySQL
-prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
-execute stmt1 using @arg00;
-a concat(b,?)
-1 oneMySQL
-2 twoMySQL
-3 threeMySQL
-4 fourMySQL
-set @arg00='MySQL' ;
-select group_concat(@arg00,b order by a) from t1
-group by 'a' ;
-group_concat(@arg00,b order by a)
-MySQLone,MySQLtwo,MySQLthree,MySQLfour
-prepare stmt1 from ' select group_concat(?,b order by a) from t1
-group by ''a'' ' ;
-execute stmt1 using @arg00;
-group_concat(?,b order by a)
-MySQLone,MySQLtwo,MySQLthree,MySQLfour
-select group_concat(b,@arg00 order by a) from t1
-group by 'a' ;
-group_concat(b,@arg00 order by a)
-oneMySQL,twoMySQL,threeMySQL,fourMySQL
-prepare stmt1 from ' select group_concat(b,? order by a) from t1
-group by ''a'' ' ;
-execute stmt1 using @arg00;
-group_concat(b,? order by a)
-oneMySQL,twoMySQL,threeMySQL,fourMySQL
-set @arg00='first' ;
-set @arg01='second' ;
-set @arg02=NULL;
-select @arg00, @arg01 from t1 where a=1 ;
-@arg00 @arg01
-first second
-prepare stmt1 from ' select ?, ? from t1 where a=1 ' ;
-execute stmt1 using @arg00, @arg01 ;
-? ?
-first second
-execute stmt1 using @arg02, @arg01 ;
-? ?
-NULL second
-execute stmt1 using @arg00, @arg02 ;
-? ?
-first NULL
-execute stmt1 using @arg02, @arg02 ;
-? ?
-NULL NULL
-drop table if exists t5 ;
-create table t5 (id1 int(11) not null default '0',
-value2 varchar(100), value1 varchar(100)) ;
-insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
-(1,'ii','ii'),(2,'ii','ii') ;
-prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ;
-set @arg00=1 ;
-set @arg01='hh' ;
-execute stmt1 using @arg00, @arg01 ;
-id1 value1
-1 hh
-1 ii
-2 hh
-drop table t5 ;
-drop table if exists t5 ;
-create table t5(session_id char(9) not null) ;
-insert into t5 values ('abc') ;
-prepare stmt1 from ' select * from t5
-where ?=''1111'' and session_id = ''abc'' ' ;
-set @arg00='abc' ;
-execute stmt1 using @arg00 ;
-session_id
-set @arg00='1111' ;
-execute stmt1 using @arg00 ;
-session_id
-abc
-set @arg00='abc' ;
-execute stmt1 using @arg00 ;
-session_id
-drop table t5 ;
-set @arg00='FROM' ;
-select a @arg00 t1 where a=1 ;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 t1 where a=1' at line 1
-prepare stmt1 from ' select a ? t1 where a=1 ' ;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? t1 where a=1' at line 1
-set @arg00='t1' ;
-select a from @arg00 where a=1 ;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 where a=1' at line 1
-prepare stmt1 from ' select a from ? where a=1 ' ;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? where a=1' at line 1
-set @arg00='WHERE' ;
-select a from t1 @arg00 a=1 ;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a=1' at line 1
-prepare stmt1 from ' select a from t1 ? a=1 ' ;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a=1' at line 1
-set @arg00=1 ;
-select a FROM t1 where a=@arg00 ;
-a
-1
-prepare stmt1 from ' select a FROM t1 where a=? ' ;
-execute stmt1 using @arg00 ;
-a
-1
-set @arg00=1000 ;
-execute stmt1 using @arg00 ;
-a
-set @arg00=NULL ;
-select a FROM t1 where a=@arg00 ;
-a
-prepare stmt1 from ' select a FROM t1 where a=? ' ;
-execute stmt1 using @arg00 ;
-a
-set @arg00=4 ;
-select a FROM t1 where a=sqrt(@arg00) ;
-a
-2
-prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
-execute stmt1 using @arg00 ;
-a
-2
-set @arg00=NULL ;
-select a FROM t1 where a=sqrt(@arg00) ;
-a
-prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
-execute stmt1 using @arg00 ;
-a
-set @arg00=2 ;
-set @arg01=3 ;
-select a FROM t1 where a in (@arg00,@arg01) order by a;
-a
-2
-3
-prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a ';
-execute stmt1 using @arg00, @arg01;
-a
-2
-3
-set @arg00= 'one' ;
-set @arg01= 'two' ;
-set @arg02= 'five' ;
-prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ;
-execute stmt1 using @arg00, @arg01, @arg02 ;
-b
-one
-two
-prepare stmt1 from ' select b FROM t1 where b like ? ';
-set @arg00='two' ;
-execute stmt1 using @arg00 ;
-b
-two
-set @arg00='tw%' ;
-execute stmt1 using @arg00 ;
-b
-two
-set @arg00='%wo' ;
-execute stmt1 using @arg00 ;
-b
-two
-set @arg00=null ;
-insert into t9 set c1= 0, c5 = NULL ;
-select c5 from t9 where c5 > NULL ;
-c5
-prepare stmt1 from ' select c5 from t9 where c5 > ? ';
-execute stmt1 using @arg00 ;
-c5
-select c5 from t9 where c5 < NULL ;
-c5
-prepare stmt1 from ' select c5 from t9 where c5 < ? ';
-execute stmt1 using @arg00 ;
-c5
-select c5 from t9 where c5 = NULL ;
-c5
-prepare stmt1 from ' select c5 from t9 where c5 = ? ';
-execute stmt1 using @arg00 ;
-c5
-select c5 from t9 where c5 <=> NULL ;
-c5
-NULL
-prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
-execute stmt1 using @arg00 ;
-c5
-NULL
-delete from t9 where c1= 0 ;
-set @arg00='>' ;
-select a FROM t1 where a @arg00 1 ;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 1' at line 1
-prepare stmt1 from ' select a FROM t1 where a ? 1 ' ;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? 1' at line 1
-set @arg00=1 ;
-select a,b FROM t1 where a is not NULL
-AND b is not NULL group by a - @arg00 ;
-a b
-1 one
-2 two
-3 three
-4 four
-prepare stmt1 from ' select a,b FROM t1 where a is not NULL
-AND b is not NULL group by a - ? ' ;
-execute stmt1 using @arg00 ;
-a b
-1 one
-2 two
-3 three
-4 four
-set @arg00='two' ;
-select a,b FROM t1 where a is not NULL
-AND b is not NULL having b <> @arg00 order by a ;
-a b
-1 one
-3 three
-4 four
-prepare stmt1 from ' select a,b FROM t1 where a is not NULL
-AND b is not NULL having b <> ? order by a ' ;
-execute stmt1 using @arg00 ;
-a b
-1 one
-3 three
-4 four
-set @arg00=1 ;
-select a,b FROM t1 where a is not NULL
-AND b is not NULL order by a - @arg00 ;
-a b
-1 one
-2 two
-3 three
-4 four
-prepare stmt1 from ' select a,b FROM t1 where a is not NULL
-AND b is not NULL order by a - ? ' ;
-execute stmt1 using @arg00 ;
-a b
-1 one
-2 two
-3 three
-4 four
-set @arg00=2 ;
-select a,b from t1 order by 2 ;
-a b
-4 four
-1 one
-3 three
-2 two
-prepare stmt1 from ' select a,b from t1
-order by ? ';
-execute stmt1 using @arg00;
-a b
-4 four
-1 one
-3 three
-2 two
-set @arg00=1 ;
-execute stmt1 using @arg00;
-a b
-1 one
-2 two
-3 three
-4 four
-set @arg00=0 ;
-execute stmt1 using @arg00;
-ERROR 42S22: Unknown column '?' in 'order clause'
-set @arg00=1;
-prepare stmt1 from ' select a,b from t1 order by a
-limit 1 ';
-execute stmt1 ;
-a b
-1 one
-prepare stmt1 from ' select a,b from t1 order by a limit ? ';
-execute stmt1 using @arg00;
-a b
-1 one
-set @arg00='b' ;
-set @arg01=0 ;
-set @arg02=2 ;
-set @arg03=2 ;
-select sum(a), @arg00 from t1 where a > @arg01
-and b is not null group by substr(b,@arg02)
-having sum(a) <> @arg03 ;
-sum(a) @arg00
-3 b
-1 b
-4 b
-prepare stmt1 from ' select sum(a), ? from t1 where a > ?
-and b is not null group by substr(b,?)
-having sum(a) <> ? ';
-execute stmt1 using @arg00, @arg01, @arg02, @arg03;
-sum(a) ?
-3 b
-1 b
-4 b
-test_sequence
------- join tests ------
-select first.a as a1, second.a as a2
-from t1 first, t1 second
-where first.a = second.a order by a1 ;
-a1 a2
-1 1
-2 2
-3 3
-4 4
-prepare stmt1 from ' select first.a as a1, second.a as a2
- from t1 first, t1 second
- where first.a = second.a order by a1 ';
-execute stmt1 ;
-a1 a2
-1 1
-2 2
-3 3
-4 4
-set @arg00='ABC';
-set @arg01='two';
-set @arg02='one';
-select first.a, @arg00, second.a FROM t1 first, t1 second
-where @arg01 = first.b or first.a = second.a or second.b = @arg02
-order by second.a, first.a;
-a @arg00 a
-1 ABC 1
-2 ABC 1
-3 ABC 1
-4 ABC 1
-2 ABC 2
-2 ABC 3
-3 ABC 3
-2 ABC 4
-4 ABC 4
-prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
- where ? = first.b or first.a = second.a or second.b = ?
- order by second.a, first.a';
-execute stmt1 using @arg00, @arg01, @arg02;
-a ? a
-1 ABC 1
-2 ABC 1
-3 ABC 1
-4 ABC 1
-2 ABC 2
-2 ABC 3
-3 ABC 3
-2 ABC 4
-4 ABC 4
-drop table if exists t2 ;
-create table t2 as select * from t1 ;
-set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
-set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
-set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
-set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
-set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
-set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
-set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
-set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
-set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
-the join statement is:
-SELECT * FROM t2 right join t1 using(a) order by t2.a
-prepare stmt1 from @query9 ;
-execute stmt1 ;
-a b b
-1 one one
-2 two two
-3 three three
-4 four four
-execute stmt1 ;
-a b b
-1 one one
-2 two two
-3 three three
-4 four four
-execute stmt1 ;
-a b b
-1 one one
-2 two two
-3 three three
-4 four four
-the join statement is:
-SELECT * FROM t2 natural right join t1 order by t2.a
-prepare stmt1 from @query8 ;
-execute stmt1 ;
-a b
-1 one
-2 two
-3 three
-4 four
-execute stmt1 ;
-a b
-1 one
-2 two
-3 three
-4 four
-execute stmt1 ;
-a b
-1 one
-2 two
-3 three
-4 four
-the join statement is:
-SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a
-prepare stmt1 from @query7 ;
-execute stmt1 ;
-a b a b
-1 one 1 one
-2 two 2 two
-3 three 3 three
-4 four 4 four
-execute stmt1 ;
-a b a b
-1 one 1 one
-2 two 2 two
-3 three 3 three
-4 four 4 four
-execute stmt1 ;
-a b a b
-1 one 1 one
-2 two 2 two
-3 three 3 three
-4 four 4 four
-the join statement is:
-SELECT * FROM t2 left join t1 using(a) order by t2.a
-prepare stmt1 from @query6 ;
-execute stmt1 ;
-a b b
-1 one one
-2 two two
-3 three three
-4 four four
-execute stmt1 ;
-a b b
-1 one one
-2 two two
-3 three three
-4 four four
-execute stmt1 ;
-a b b
-1 one one
-2 two two
-3 three three
-4 four four
-the join statement is:
-SELECT * FROM t2 natural left join t1 order by t2.a
-prepare stmt1 from @query5 ;
-execute stmt1 ;
-a b
-1 one
-2 two
-3 three
-4 four
-execute stmt1 ;
-a b
-1 one
-2 two
-3 three
-4 four
-execute stmt1 ;
-a b
-1 one
-2 two
-3 three
-4 four
-the join statement is:
-SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a
-prepare stmt1 from @query4 ;
-execute stmt1 ;
-a b a b
-1 one 1 one
-2 two 2 two
-3 three 3 three
-4 four 4 four
-execute stmt1 ;
-a b a b
-1 one 1 one
-2 two 2 two
-3 three 3 three
-4 four 4 four
-execute stmt1 ;
-a b a b
-1 one 1 one
-2 two 2 two
-3 three 3 three
-4 four 4 four
-the join statement is:
-SELECT * FROM t2 join t1 using(a) order by t2.a
-prepare stmt1 from @query3 ;
-execute stmt1 ;
-a b b
-1 one one
-2 two two
-3 three three
-4 four four
-execute stmt1 ;
-a b b
-1 one one
-2 two two
-3 three three
-4 four four
-execute stmt1 ;
-a b b
-1 one one
-2 two two
-3 three three
-4 four four
-the join statement is:
-SELECT * FROM t2 natural join t1 order by t2.a
-prepare stmt1 from @query2 ;
-execute stmt1 ;
-a b
-1 one
-2 two
-3 three
-4 four
-execute stmt1 ;
-a b
-1 one
-2 two
-3 three
-4 four
-execute stmt1 ;
-a b
-1 one
-2 two
-3 three
-4 four
-the join statement is:
-SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a
-prepare stmt1 from @query1 ;
-execute stmt1 ;
-a b a b
-1 one 1 one
-2 two 2 two
-3 three 3 three
-4 four 4 four
-execute stmt1 ;
-a b a b
-1 one 1 one
-2 two 2 two
-3 three 3 three
-4 four 4 four
-execute stmt1 ;
-a b a b
-1 one 1 one
-2 two 2 two
-3 three 3 three
-4 four 4 four
-drop table t2 ;
-test_sequence
------- subquery tests ------
-prepare stmt1 from ' select a, b FROM t1 outer_table where
- a = (select a from t1 where b = ''two'') ';
-execute stmt1 ;
-a b
-2 two
-set @arg00='two' ;
-select a, b FROM t1 outer_table where
-a = (select a from t1 where b = 'two' ) and b=@arg00 ;
-a b
-2 two
-prepare stmt1 from ' select a, b FROM t1 outer_table where
- a = (select a from t1 where b = ''two'') and b=? ';
-execute stmt1 using @arg00;
-a b
-2 two
-set @arg00='two' ;
-select a, b FROM t1 outer_table where
-a = (select a from t1 where b = @arg00 ) and b='two' ;
-a b
-2 two
-prepare stmt1 from ' select a, b FROM t1 outer_table where
- a = (select a from t1 where b = ? ) and b=''two'' ' ;
-execute stmt1 using @arg00;
-a b
-2 two
-set @arg00=3 ;
-set @arg01='three' ;
-select a,b FROM t1 where (a,b) in (select 3, 'three');
-a b
-3 three
-select a FROM t1 where (a,b) in (select @arg00,@arg01);
-a
-3
-prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) ';
-execute stmt1 using @arg00, @arg01;
-a
-3
-set @arg00=1 ;
-set @arg01='two' ;
-set @arg02=2 ;
-set @arg03='two' ;
-select a, @arg00, b FROM t1 outer_table where
-b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ;
-a @arg00 b
-2 1 two
-prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
- b=? and a = (select ? from t1 where b = ? ) ' ;
-execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
-a ? b
-2 1 two
-prepare stmt1 from 'select c4 FROM t9 where
- c13 = (select MAX(b) from t1 where a = ?) and c22 = ? ' ;
-execute stmt1 using @arg01, @arg02;
-c4
-prepare stmt1 from ' select a, b FROM t1 outer_table where
- a = (select a from t1 where b = outer_table.b ) order by a ';
-execute stmt1 ;
-a b
-1 one
-2 two
-3 three
-4 four
-prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
- (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
-execute stmt1 ;
-ccc
-1
-deallocate prepare stmt1 ;
-prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
- (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
-execute stmt1 ;
-ccc
-1
-deallocate prepare stmt1 ;
-prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
- (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
-execute stmt1 ;
-ccc
-1
-deallocate prepare stmt1 ;
-set @arg00='two' ;
-select a, b FROM t1 outer_table where
-a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
-a b
-2 two
-prepare stmt1 from ' select a, b FROM t1 outer_table where
- a = (select a from t1 where b = outer_table.b) and b=? ';
-execute stmt1 using @arg00;
-a b
-2 two
-set @arg00=2 ;
-select a, b FROM t1 outer_table where
-a = (select a from t1 where a = @arg00 and b = outer_table.b) and b='two' ;
-a b
-2 two
-prepare stmt1 from ' select a, b FROM t1 outer_table where
- a = (select a from t1 where a = ? and b = outer_table.b) and b=''two'' ' ;
-execute stmt1 using @arg00;
-a b
-2 two
-set @arg00=2 ;
-select a, b FROM t1 outer_table where
-a = (select a from t1 where outer_table.a = @arg00 and a=2) and b='two' ;
-a b
-2 two
-prepare stmt1 from ' select a, b FROM t1 outer_table where
- a = (select a from t1 where outer_table.a = ? and a=2) and b=''two'' ' ;
-execute stmt1 using @arg00;
-a b
-2 two
-set @arg00=1 ;
-set @arg01='two' ;
-set @arg02=2 ;
-set @arg03='two' ;
-select a, @arg00, b FROM t1 outer_table where
-b=@arg01 and a = (select @arg02 from t1 where outer_table.b = @arg03
-and outer_table.a=a ) ;
-a @arg00 b
-2 1 two
-prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
- b=? and a = (select ? from t1 where outer_table.b = ?
- and outer_table.a=a ) ' ;
-execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
-a ? b
-2 1 two
-set @arg00=1 ;
-set @arg01=0 ;
-select a, @arg00
-from ( select a - @arg00 as a from t1 where a=@arg00 ) as t2
-where a=@arg01;
-a @arg00
-0 1
-prepare stmt1 from ' select a, ?
- from ( select a - ? as a from t1 where a=? ) as t2
- where a=? ';
-execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
-a ?
-0 1
-drop table if exists t2 ;
-create table t2 as select * from t1;
-prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
-execute stmt1 ;
-a in (select a from t2)
-1
-1
-1
-1
-drop table if exists t5, t6, t7 ;
-create table t5 (a int , b int) ;
-create table t6 like t5 ;
-create table t7 like t5 ;
-insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
-(2, -1), (3, 10) ;
-insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
-insert into t7 values (3, 3), (2, 2), (1, 1) ;
-prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
- where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
- group by t5.a order by sum limit 1) from t7 ' ;
-execute stmt1 ;
-a (select count(distinct t5.b) as sum from t5, t6
- where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
- group by t5.a order by sum limit 1)
-3 1
-2 2
-1 2
-execute stmt1 ;
-a (select count(distinct t5.b) as sum from t5, t6
- where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
- group by t5.a order by sum limit 1)
-3 1
-2 2
-1 2
-execute stmt1 ;
-a (select count(distinct t5.b) as sum from t5, t6
- where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
- group by t5.a order by sum limit 1)
-3 1
-2 2
-1 2
-drop table t5, t6, t7 ;
-drop table if exists t2 ;
-create table t2 as select * from t9;
-set @stmt= ' SELECT
- (SELECT SUM(c1 + c12 + 0.0) FROM t2
- where (t9.c2 - 0e-3) = t2.c2
- GROUP BY t9.c15 LIMIT 1) as scalar_s,
- exists (select 1.0e+0 from t2
- where t2.c3 * 9.0000000000 = t9.c4) as exists_s,
- c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s,
- (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s
-FROM t9,
-(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
-prepare stmt1 from @stmt ;
-execute stmt1 ;
-execute stmt1 ;
-set @stmt= concat('explain ',@stmt);
-prepare stmt1 from @stmt ;
-execute stmt1 ;
-execute stmt1 ;
-set @stmt= ' SELECT
- (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
- GROUP BY t9.c15 LIMIT 1) as scalar_s,
- exists (select ? from t2
- where t2.c3*?=t9.c4) as exists_s,
- c5*? in (select c6+? from t2) as in_s,
- (c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s
-FROM t9,
-(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
-set @arg00= 0.0 ;
-set @arg01= 0e-3 ;
-set @arg02= 1.0e+0 ;
-set @arg03= 9.0000000000 ;
-set @arg04= 4 ;
-set @arg05= 0.3e+1 ;
-set @arg06= 4 ;
-set @arg07= 4 ;
-set @arg08= 4.0 ;
-set @arg09= 40e-1 ;
-prepare stmt1 from @stmt ;
-execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
-@arg07, @arg08, @arg09 ;
-execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
-@arg07, @arg08, @arg09 ;
-set @stmt= concat('explain ',@stmt);
-prepare stmt1 from @stmt ;
-execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
-@arg07, @arg08, @arg09 ;
-execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
-@arg07, @arg08, @arg09 ;
-drop table t2 ;
-select 1 < (select a from t1) ;
-ERROR 21000: Subquery returns more than 1 row
-prepare stmt1 from ' select 1 < (select a from t1) ' ;
-execute stmt1 ;
-ERROR 21000: Subquery returns more than 1 row
-select 1 as my_col ;
-my_col
-1
-test_sequence
------- union tests ------
-prepare stmt1 from ' select a FROM t1 where a=1
- union distinct
- select a FROM t1 where a=1 ';
-execute stmt1 ;
-a
-1
-execute stmt1 ;
-a
-1
-prepare stmt1 from ' select a FROM t1 where a=1
- union all
- select a FROM t1 where a=1 ';
-execute stmt1 ;
-a
-1
-1
-prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
-ERROR 21000: The used SELECT statements have a different number of columns
-prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
-ERROR 21000: The used SELECT statements have a different number of columns
-prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
-ERROR 21000: The used SELECT statements have a different number of columns
-prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
-ERROR 21000: The used SELECT statements have a different number of columns
-set @arg00=1 ;
-select @arg00 FROM t1 where a=1
-union distinct
-select 1 FROM t1 where a=1;
-@arg00
-1
-prepare stmt1 from ' select ? FROM t1 where a=1
- union distinct
- select 1 FROM t1 where a=1 ' ;
-execute stmt1 using @arg00;
-?
-1
-set @arg00=1 ;
-select 1 FROM t1 where a=1
-union distinct
-select @arg00 FROM t1 where a=1;
-1
-1
-prepare stmt1 from ' select 1 FROM t1 where a=1
- union distinct
- select ? FROM t1 where a=1 ' ;
-execute stmt1 using @arg00;
-1
-1
-set @arg00='a' ;
-select @arg00 FROM t1 where a=1
-union distinct
-select @arg00 FROM t1 where a=1;
-@arg00
-a
-prepare stmt1 from ' select ? FROM t1 where a=1
- union distinct
- select ? FROM t1 where a=1 ';
-execute stmt1 using @arg00, @arg00;
-?
-a
-prepare stmt1 from ' select ?
- union distinct
- select ? ';
-execute stmt1 using @arg00, @arg00;
-?
-a
-set @arg00='a' ;
-set @arg01=1 ;
-set @arg02='a' ;
-set @arg03=2 ;
-select @arg00 FROM t1 where a=@arg01
-union distinct
-select @arg02 FROM t1 where a=@arg03;
-@arg00
-a
-prepare stmt1 from ' select ? FROM t1 where a=?
- union distinct
- select ? FROM t1 where a=? ' ;
-execute stmt1 using @arg00, @arg01, @arg02, @arg03;
-?
-a
-set @arg00=1 ;
-prepare stmt1 from ' select sum(a) + 200, ? from t1
-union distinct
-select sum(a) + 200, 1 from t1
-group by b ' ;
-execute stmt1 using @arg00;
-sum(a) + 200 ?
-210 1
-204 1
-201 1
-203 1
-202 1
-set @Oporto='Oporto' ;
-set @Lisboa='Lisboa' ;
-set @0=0 ;
-set @1=1 ;
-set @2=2 ;
-set @3=3 ;
-set @4=4 ;
-select @Oporto,@Lisboa,@0,@1,@2,@3,@4 ;
-@Oporto @Lisboa @0 @1 @2 @3 @4
-Oporto Lisboa 0 1 2 3 4
-select sum(a) + 200 as the_sum, @Oporto as the_town from t1
-group by b
-union distinct
-select sum(a) + 200, @Lisboa from t1
-group by b ;
-the_sum the_town
-204 Oporto
-201 Oporto
-203 Oporto
-202 Oporto
-204 Lisboa
-201 Lisboa
-203 Lisboa
-202 Lisboa
-prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
- group by b
- union distinct
- select sum(a) + 200, ? from t1
- group by b ' ;
-execute stmt1 using @Oporto, @Lisboa;
-the_sum the_town
-204 Oporto
-201 Oporto
-203 Oporto
-202 Oporto
-204 Lisboa
-201 Lisboa
-203 Lisboa
-202 Lisboa
-select sum(a) + 200 as the_sum, @Oporto as the_town from t1
-where a > @1
-group by b
-union distinct
-select sum(a) + 200, @Lisboa from t1
-where a > @2
-group by b ;
-the_sum the_town
-204 Oporto
-203 Oporto
-202 Oporto
-204 Lisboa
-203 Lisboa
-prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
- where a > ?
- group by b
- union distinct
- select sum(a) + 200, ? from t1
- where a > ?
- group by b ' ;
-execute stmt1 using @Oporto, @1, @Lisboa, @2;
-the_sum the_town
-204 Oporto
-203 Oporto
-202 Oporto
-204 Lisboa
-203 Lisboa
-select sum(a) + 200 as the_sum, @Oporto as the_town from t1
-where a > @1
-group by b
-having avg(a) > @2
-union distinct
-select sum(a) + 200, @Lisboa from t1
-where a > @2
-group by b
-having avg(a) > @3;
-the_sum the_town
-204 Oporto
-203 Oporto
-204 Lisboa
-prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
- where a > ?
- group by b
- having avg(a) > ?
- union distinct
- select sum(a) + 200, ? from t1
- where a > ?
- group by b
- having avg(a) > ? ';
-execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3;
-the_sum the_town
-204 Oporto
-203 Oporto
-204 Lisboa
-test_sequence
------- explain select tests ------
-prepare stmt1 from ' explain select * from t9 ' ;
-execute stmt1;
-Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def id 8 3 1 N 32929 0 63
-def select_type 253 19 6 N 1 31 8
-def table 253 64 2 Y 0 31 8
-def type 253 10 3 Y 0 31 8
-def possible_keys 253 4096 0 Y 0 31 8
-def key 253 64 0 Y 0 31 8
-def key_len 253 4096 0 Y 128 31 63
-def ref 253 1024 0 Y 0 31 8
-def rows 8 10 1 Y 32928 0 63
-def Extra 253 255 0 N 1 31 8
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t9 ALL NULL NULL NULL NULL 3
-test_sequence
------- delete tests ------
-delete from t1 ;
-insert into t1 values (1,'one');
-insert into t1 values (2,'two');
-insert into t1 values (3,'three');
-insert into t1 values (4,'four');
-commit ;
-delete from t9 ;
-insert into t9
-set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
-c10= 1, c11= 1, c12 = 1,
-c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
-c16= '11:11:11', c17= '2004',
-c18= 1, c19=true, c20= 'a', c21= '123456789a',
-c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
-c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
-c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
-insert into t9
-set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
-c10= 9, c11= 9, c12 = 9,
-c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
-c16= '11:11:11', c17= '2004',
-c18= 1, c19=false, c20= 'a', c21= '123456789a',
-c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
-c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
-c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
-commit ;
-prepare stmt1 from 'delete from t1 where a=2' ;
-execute stmt1;
-select a,b from t1 where a=2;
-a b
-execute stmt1;
-insert into t1 values(0,NULL);
-set @arg00=NULL;
-prepare stmt1 from 'delete from t1 where b=?' ;
-execute stmt1 using @arg00;
-select a,b from t1 where b is NULL ;
-a b
-0 NULL
-set @arg00='one';
-execute stmt1 using @arg00;
-select a,b from t1 where b=@arg00;
-a b
-prepare stmt1 from 'truncate table t1' ;
-test_sequence
------- update tests ------
-delete from t1 ;
-insert into t1 values (1,'one');
-insert into t1 values (2,'two');
-insert into t1 values (3,'three');
-insert into t1 values (4,'four');
-commit ;
-delete from t9 ;
-insert into t9
-set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
-c10= 1, c11= 1, c12 = 1,
-c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
-c16= '11:11:11', c17= '2004',
-c18= 1, c19=true, c20= 'a', c21= '123456789a',
-c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
-c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
-c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
-insert into t9
-set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
-c10= 9, c11= 9, c12 = 9,
-c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
-c16= '11:11:11', c17= '2004',
-c18= 1, c19=false, c20= 'a', c21= '123456789a',
-c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
-c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
-c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
-commit ;
-prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
-execute stmt1;
-select a,b from t1 where a=2;
-a b
-2 a=two
-execute stmt1;
-select a,b from t1 where a=2;
-a b
-2 a=two
-set @arg00=NULL;
-prepare stmt1 from 'update t1 set b=? where a=2' ;
-execute stmt1 using @arg00;
-select a,b from t1 where a=2;
-a b
-2 NULL
-set @arg00='two';
-execute stmt1 using @arg00;
-select a,b from t1 where a=2;
-a b
-2 two
-set @arg00=2;
-prepare stmt1 from 'update t1 set b=NULL where a=?' ;
-execute stmt1 using @arg00;
-select a,b from t1 where a=@arg00;
-a b
-2 NULL
-update t1 set b='two' where a=@arg00;
-set @arg00=2000;
-execute stmt1 using @arg00;
-select a,b from t1 where a=@arg00;
-a b
-set @arg00=2;
-set @arg01=22;
-prepare stmt1 from 'update t1 set a=? where a=?' ;
-execute stmt1 using @arg00, @arg00;
-select a,b from t1 where a=@arg00;
-a b
-2 two
-execute stmt1 using @arg01, @arg00;
-select a,b from t1 where a=@arg01;
-a b
-22 two
-execute stmt1 using @arg00, @arg01;
-select a,b from t1 where a=@arg00;
-a b
-2 two
-set @arg00=NULL;
-set @arg01=2;
-execute stmt1 using @arg00, @arg01;
-Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1
-select a,b from t1 order by a;
-a b
-0 two
-1 one
-3 three
-4 four
-set @arg00=0;
-execute stmt1 using @arg01, @arg00;
-select a,b from t1 order by a;
-a b
-1 one
-2 two
-3 three
-4 four
-set @arg00=23;
-set @arg01='two';
-set @arg02=2;
-set @arg03='two';
-set @arg04=2;
-drop table if exists t2;
-create table t2 as select a,b from t1 ;
-prepare stmt1 from 'update t1 set a=? where b=?
- and a in (select ? from t2
- where b = ? or a = ?)';
-execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
-affected rows: 1
-info: Rows matched: 1 Changed: 1 Warnings: 0
-select a,b from t1 where a = @arg00 ;
-a b
-23 two
-prepare stmt1 from 'update t1 set a=? where b=?
- and a not in (select ? from t2
- where b = ? or a = ?)';
-execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
-affected rows: 1
-info: Rows matched: 1 Changed: 1 Warnings: 0
-select a,b from t1 order by a ;
-a b
-1 one
-2 two
-3 three
-4 four
-drop table t2 ;
-create table t2
-(
-a int, b varchar(30),
-primary key(a)
-) engine = 'BDB' ;
-insert into t2(a,b) select a, b from t1 ;
-prepare stmt1 from 'update t1 set a=? where b=?
- and a in (select ? from t2
- where b = ? or a = ?)';
-execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
-affected rows: 1
-info: Rows matched: 1 Changed: 1 Warnings: 0
-select a,b from t1 where a = @arg00 ;
-a b
-23 two
-prepare stmt1 from 'update t1 set a=? where b=?
- and a not in (select ? from t2
- where b = ? or a = ?)';
-execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
-affected rows: 1
-info: Rows matched: 1 Changed: 1 Warnings: 0
-select a,b from t1 order by a ;
-a b
-1 one
-2 two
-3 three
-4 four
-drop table t2 ;
-set @arg00=1;
-prepare stmt1 from 'update t1 set b=''bla''
-where a=2
-limit 1';
-execute stmt1 ;
-select a,b from t1 where b = 'bla' ;
-a b
-2 bla
-prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
-execute stmt1 using @arg00;
-test_sequence
------- insert tests ------
-delete from t1 ;
-insert into t1 values (1,'one');
-insert into t1 values (2,'two');
-insert into t1 values (3,'three');
-insert into t1 values (4,'four');
-commit ;
-delete from t9 ;
-insert into t9
-set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
-c10= 1, c11= 1, c12 = 1,
-c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
-c16= '11:11:11', c17= '2004',
-c18= 1, c19=true, c20= 'a', c21= '123456789a',
-c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
-c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
-c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
-insert into t9
-set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
-c10= 9, c11= 9, c12 = 9,
-c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
-c16= '11:11:11', c17= '2004',
-c18= 1, c19=false, c20= 'a', c21= '123456789a',
-c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
-c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
-c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
-commit ;
-prepare stmt1 from 'insert into t1 values(5, ''five'' )';
-execute stmt1;
-select a,b from t1 where a = 5;
-a b
-5 five
-set @arg00='six' ;
-prepare stmt1 from 'insert into t1 values(6, ? )';
-execute stmt1 using @arg00;
-select a,b from t1 where b = @arg00;
-a b
-6 six
-execute stmt1 using @arg00;
-ERROR 23000: Duplicate entry '6' for key 1
-set @arg00=NULL ;
-prepare stmt1 from 'insert into t1 values(0, ? )';
-execute stmt1 using @arg00;
-select a,b from t1 where b is NULL;
-a b
-0 NULL
-set @arg00=8 ;
-set @arg01='eight' ;
-prepare stmt1 from 'insert into t1 values(?, ? )';
-execute stmt1 using @arg00, @arg01 ;
-select a,b from t1 where b = @arg01;
-a b
-8 eight
-set @NULL= null ;
-set @arg00= 'abc' ;
-execute stmt1 using @NULL, @NULL ;
-ERROR 23000: Column 'a' cannot be null
-execute stmt1 using @NULL, @NULL ;
-ERROR 23000: Column 'a' cannot be null
-execute stmt1 using @NULL, @arg00 ;
-ERROR 23000: Column 'a' cannot be null
-execute stmt1 using @NULL, @arg00 ;
-ERROR 23000: Column 'a' cannot be null
-set @arg01= 10000 + 2 ;
-execute stmt1 using @arg01, @arg00 ;
-set @arg01= 10000 + 1 ;
-execute stmt1 using @arg01, @arg00 ;
-select * from t1 where a > 10000 order by a ;
-a b
-10001 abc
-10002 abc
-delete from t1 where a > 10000 ;
-set @arg01= 10000 + 2 ;
-execute stmt1 using @arg01, @NULL ;
-set @arg01= 10000 + 1 ;
-execute stmt1 using @arg01, @NULL ;
-select * from t1 where a > 10000 order by a ;
-a b
-10001 NULL
-10002 NULL
-delete from t1 where a > 10000 ;
-set @arg01= 10000 + 10 ;
-execute stmt1 using @arg01, @arg01 ;
-set @arg01= 10000 + 9 ;
-execute stmt1 using @arg01, @arg01 ;
-set @arg01= 10000 + 8 ;
-execute stmt1 using @arg01, @arg01 ;
-set @arg01= 10000 + 7 ;
-execute stmt1 using @arg01, @arg01 ;
-set @arg01= 10000 + 6 ;
-execute stmt1 using @arg01, @arg01 ;
-set @arg01= 10000 + 5 ;
-execute stmt1 using @arg01, @arg01 ;
-set @arg01= 10000 + 4 ;
-execute stmt1 using @arg01, @arg01 ;
-set @arg01= 10000 + 3 ;
-execute stmt1 using @arg01, @arg01 ;
-set @arg01= 10000 + 2 ;
-execute stmt1 using @arg01, @arg01 ;
-set @arg01= 10000 + 1 ;
-execute stmt1 using @arg01, @arg01 ;
-select * from t1 where a > 10000 order by a ;
-a b
-10001 10001
-10002 10002
-10003 10003
-10004 10004
-10005 10005
-10006 10006
-10007 10007
-10008 10008
-10009 10009
-10010 10010
-delete from t1 where a > 10000 ;
-set @arg00=81 ;
-set @arg01='8-1' ;
-set @arg02=82 ;
-set @arg03='8-2' ;
-prepare stmt1 from 'insert into t1 values(?,?),(?,?)';
-execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
-select a,b from t1 where a in (@arg00,@arg02) ;
-a b
-81 8-1
-82 8-2
-set @arg00=9 ;
-set @arg01='nine' ;
-prepare stmt1 from 'insert into t1 set a=?, b=? ';
-execute stmt1 using @arg00, @arg01 ;
-select a,b from t1 where a = @arg00 ;
-a b
-9 nine
-set @arg00=6 ;
-set @arg01=1 ;
-prepare stmt1 from 'insert into t1 set a=?, b=''sechs''
- on duplicate key update a=a + ?, b=concat(b,''modified'') ';
-execute stmt1 using @arg00, @arg01;
-select * from t1 order by a;
-a b
-0 NULL
-1 one
-2 two
-3 three
-4 four
-5 five
-7 sixmodified
-8 eight
-9 nine
-81 8-1
-82 8-2
-set @arg00=81 ;
-set @arg01=1 ;
-execute stmt1 using @arg00, @arg01;
-ERROR 23000: Duplicate entry '82' for key 1
-drop table if exists t2 ;
-create table t2 (id int auto_increment primary key)
-ENGINE= 'BDB' ;
-prepare stmt1 from ' select last_insert_id() ' ;
-insert into t2 values (NULL) ;
-execute stmt1 ;
-last_insert_id()
-1
-insert into t2 values (NULL) ;
-execute stmt1 ;
-last_insert_id()
-2
-drop table t2 ;
-set @1000=1000 ;
-set @x1000_2="x1000_2" ;
-set @x1000_3="x1000_3" ;
-set @x1000="x1000" ;
-set @1100=1100 ;
-set @x1100="x1100" ;
-set @100=100 ;
-set @updated="updated" ;
-insert into t1 values(1000,'x1000_1') ;
-insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3)
-on duplicate key update a = a + @100, b = concat(b,@updated) ;
-select a,b from t1 where a >= 1000 order by a ;
-a b
-1000 x1000_3
-1100 x1000_1updated
-delete from t1 where a >= 1000 ;
-insert into t1 values(1000,'x1000_1') ;
-prepare stmt1 from ' insert into t1 values(?,?),(?,?)
- on duplicate key update a = a + ?, b = concat(b,?) ';
-execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ;
-select a,b from t1 where a >= 1000 order by a ;
-a b
-1000 x1000_3
-1100 x1000_1updated
-delete from t1 where a >= 1000 ;
-insert into t1 values(1000,'x1000_1') ;
-execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ;
-select a,b from t1 where a >= 1000 order by a ;
-a b
-1200 x1000_1updatedupdated
-delete from t1 where a >= 1000 ;
-prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
-execute stmt1;
-execute stmt1;
-execute stmt1;
-test_sequence
------- multi table tests ------
-delete from t1 ;
-delete from t9 ;
-insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
-insert into t9 (c1,c21)
-values (1, 'one'), (2, 'two'), (3, 'three') ;
-prepare stmt_delete from " delete t1, t9
- from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
-prepare stmt_update from " update t1, t9
- set t1.b='updated', t9.c21='updated'
- where t1.a=t9.c1 and t1.a=? ";
-prepare stmt_select1 from " select a, b from t1 order by a" ;
-prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
-set @arg00= 1 ;
-execute stmt_update using @arg00 ;
-execute stmt_delete ;
-execute stmt_select1 ;
-a b
-2 two
-3 three
-execute stmt_select2 ;
-c1 c21
-2 two
-3 three
-set @arg00= @arg00 + 1 ;
-execute stmt_update using @arg00 ;
-execute stmt_delete ;
-execute stmt_select1 ;
-a b
-3 three
-execute stmt_select2 ;
-c1 c21
-3 three
-set @arg00= @arg00 + 1 ;
-execute stmt_update using @arg00 ;
-execute stmt_delete ;
-execute stmt_select1 ;
-a b
-execute stmt_select2 ;
-c1 c21
-set @arg00= @arg00 + 1 ;
-delete from t1 ;
-insert into t1 values (1,'one');
-insert into t1 values (2,'two');
-insert into t1 values (3,'three');
-insert into t1 values (4,'four');
-commit ;
-delete from t9 ;
-insert into t9
-set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
-c10= 1, c11= 1, c12 = 1,
-c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
-c16= '11:11:11', c17= '2004',
-c18= 1, c19=true, c20= 'a', c21= '123456789a',
-c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
-c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
-c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
-insert into t9
-set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
-c10= 9, c11= 9, c12 = 9,
-c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
-c16= '11:11:11', c17= '2004',
-c18= 1, c19=false, c20= 'a', c21= '123456789a',
-c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
-c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
-c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
-commit ;
-insert into t1 values(0,NULL) ;
-set @duplicate='duplicate ' ;
-set @1000=1000 ;
-set @5=5 ;
-select a,b from t1 where a < 5 order by a ;
-a b
-0 NULL
-1 one
-2 two
-3 three
-4 four
-insert into t1 select a + @1000, concat(@duplicate,b) from t1
-where a < @5 ;
-affected rows: 5
-info: Records: 5 Duplicates: 0 Warnings: 0
-select a,b from t1 where a >= 1000 order by a ;
-a b
-1000 NULL
-1001 duplicate one
-1002 duplicate two
-1003 duplicate three
-1004 duplicate four
-delete from t1 where a >= 1000 ;
-prepare stmt1 from ' insert into t1 select a + ?, concat(?,b) from t1
-where a < ? ' ;
-execute stmt1 using @1000, @duplicate, @5;
-affected rows: 5
-info: Records: 5 Duplicates: 0 Warnings: 0
-select a,b from t1 where a >= 1000 order by a ;
-a b
-1000 NULL
-1001 duplicate one
-1002 duplicate two
-1003 duplicate three
-1004 duplicate four
-delete from t1 where a >= 1000 ;
-set @1=1 ;
-set @2=2 ;
-set @100=100 ;
-set @float=1.00;
-set @five='five' ;
-drop table if exists t2;
-create table t2 like t1 ;
-insert into t2 (b,a)
-select @duplicate, sum(first.a) from t1 first, t1 second
-where first.a <> @5 and second.b = first.b
-and second.b <> @five
-group by second.b
-having sum(second.a) > @2
-union
-select b, a + @100 from t1
-where (a,b) in ( select sqrt(a+@1)+CAST(@float AS signed),b
-from t1);
-affected rows: 3
-info: Records: 3 Duplicates: 0 Warnings: 0
-select a,b from t2 order by a ;
-a b
-3 duplicate
-4 duplicate
-103 three
-delete from t2 ;
-prepare stmt1 from ' insert into t2 (b,a)
-select ?, sum(first.a)
- from t1 first, t1 second
- where first.a <> ? and second.b = first.b and second.b <> ?
- group by second.b
- having sum(second.a) > ?
-union
-select b, a + ? from t1
- where (a,b) in ( select sqrt(a+?)+CAST(? AS signed),b
- from t1 ) ' ;
-execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ;
-affected rows: 3
-info: Records: 3 Duplicates: 0 Warnings: 0
-select a,b from t2 order by a ;
-a b
-3 duplicate
-4 duplicate
-103 three
-drop table t2;
-drop table if exists t5 ;
-set @arg01= 8;
-set @arg02= 8.0;
-set @arg03= 80.00000000000e-1;
-set @arg04= 'abc' ;
-set @arg05= CAST('abc' as binary) ;
-set @arg06= '1991-08-05' ;
-set @arg07= CAST('1991-08-05' as date);
-set @arg08= '1991-08-05 01:01:01' ;
-set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
-set @arg10= unix_timestamp('1991-01-01 01:01:01');
-set @arg11= YEAR('1991-01-01 01:01:01');
-set @arg12= 8 ;
-set @arg12= NULL ;
-set @arg13= 8.0 ;
-set @arg13= NULL ;
-set @arg14= 'abc';
-set @arg14= NULL ;
-set @arg15= CAST('abc' as binary) ;
-set @arg15= NULL ;
-create table t5 as select
-8 as const01, @arg01 as param01,
-8.0 as const02, @arg02 as param02,
-80.00000000000e-1 as const03, @arg03 as param03,
-'abc' as const04, @arg04 as param04,
-CAST('abc' as binary) as const05, @arg05 as param05,
-'1991-08-05' as const06, @arg06 as param06,
-CAST('1991-08-05' as date) as const07, @arg07 as param07,
-'1991-08-05 01:01:01' as const08, @arg08 as param08,
-CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09,
-unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10,
-YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
-NULL as const12, @arg12 as param12,
-@arg13 as param13,
-@arg14 as param14,
-@arg15 as param15;
-show create table t5 ;
-Table Create Table
-t5 CREATE TABLE `t5` (
- `const01` int(1) NOT NULL default '0',
- `param01` bigint(20) default NULL,
- `const02` decimal(2,1) NOT NULL default '0.0',
- `param02` decimal(65,30) default NULL,
- `const03` double NOT NULL default '0',
- `param03` double default NULL,
- `const04` varchar(3) NOT NULL default '',
- `param04` longtext,
- `const05` varbinary(3) NOT NULL default '',
- `param05` longblob,
- `const06` varchar(10) NOT NULL default '',
- `param06` longtext,
- `const07` date default NULL,
- `param07` longblob,
- `const08` varchar(19) NOT NULL default '',
- `param08` longtext,
- `const09` datetime default NULL,
- `param09` longblob,
- `const10` int(10) NOT NULL default '0',
- `param10` bigint(20) default NULL,
- `const11` int(4) default NULL,
- `param11` bigint(20) default NULL,
- `const12` binary(0) default NULL,
- `param12` bigint(20) default NULL,
- `param13` decimal(65,30) default NULL,
- `param14` longtext,
- `param15` longblob
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-select * from t5 ;
-Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def test t5 t5 const01 const01 3 1 1 N 32769 0 63
-def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
-def test t5 t5 const02 const02 246 4 3 N 1 1 63
-def test t5 t5 param02 param02 246 67 32 Y 0 30 63
-def test t5 t5 const03 const03 5 17 1 N 32769 31 63
-def test t5 t5 param03 param03 5 23 1 Y 32768 31 63
-def test t5 t5 const04 const04 253 3 3 N 1 0 8
-def test t5 t5 param04 param04 252 4294967295 3 Y 16 0 8
-def test t5 t5 const05 const05 253 3 3 N 129 0 63
-def test t5 t5 param05 param05 252 4294967295 3 Y 144 0 63
-def test t5 t5 const06 const06 253 10 10 N 1 0 8
-def test t5 t5 param06 param06 252 4294967295 10 Y 16 0 8
-def test t5 t5 const07 const07 10 10 10 Y 128 0 63
-def test t5 t5 param07 param07 252 4294967295 10 Y 144 0 63
-def test t5 t5 const08 const08 253 19 19 N 1 0 8
-def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
-def test t5 t5 const09 const09 12 19 19 Y 128 0 63
-def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63
-def test t5 t5 const10 const10 3 10 9 N 32769 0 63
-def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
-def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
-def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
-def test t5 t5 const12 const12 254 0 0 Y 128 0 63
-def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
-def test t5 t5 param13 param13 246 67 0 Y 0 30 63
-def test t5 t5 param14 param14 252 4294967295 0 Y 16 0 8
-def test t5 t5 param15 param15 252 4294967295 0 Y 144 0 63
-const01 8
-param01 8
-const02 8.0
-param02 8.000000000000000000000000000000
-const03 8
-param03 8
-const04 abc
-param04 abc
-const05 abc
-param05 abc
-const06 1991-08-05
-param06 1991-08-05
-const07 1991-08-05
-param07 1991-08-05
-const08 1991-08-05 01:01:01
-param08 1991-08-05 01:01:01
-const09 1991-08-05 01:01:01
-param09 1991-08-05 01:01:01
-const10 662680861
-param10 662680861
-const11 1991
-param11 1991
-const12 NULL
-param12 NULL
-param13 NULL
-param14 NULL
-param15 NULL
-drop table t5 ;
-test_sequence
------- data type conversion tests ------
-delete from t1 ;
-insert into t1 values (1,'one');
-insert into t1 values (2,'two');
-insert into t1 values (3,'three');
-insert into t1 values (4,'four');
-commit ;
-delete from t9 ;
-insert into t9
-set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
-c10= 1, c11= 1, c12 = 1,
-c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
-c16= '11:11:11', c17= '2004',
-c18= 1, c19=true, c20= 'a', c21= '123456789a',
-c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
-c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
-c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
-insert into t9
-set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
-c10= 9, c11= 9, c12 = 9,
-c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
-c16= '11:11:11', c17= '2004',
-c18= 1, c19=false, c20= 'a', c21= '123456789a',
-c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
-c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
-c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
-commit ;
-insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
-select * from t9 order by c1 ;
-c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
-0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
-9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
-test_sequence
------- select @parameter:= column ------
-prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
- @arg05, @arg06, @arg07, @arg08,
- @arg09, @arg10, @arg11, @arg12,
- @arg13, @arg14, @arg15, @arg16,
- @arg17, @arg18, @arg19, @arg20,
- @arg21, @arg22, @arg23, @arg24,
- @arg25, @arg26, @arg27, @arg28,
- @arg29, @arg30, @arg31, @arg32" ;
-select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
-@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
-@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
-@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
-@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
-@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
-@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
-@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
-from t9 where c1= 1 ;
-@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
-1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
-execute full_info ;
-Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def @arg01 253 20 1 Y 128 0 63
-def @arg02 253 20 1 Y 128 0 63
-def @arg03 253 20 1 Y 128 0 63
-def @arg04 253 20 1 Y 128 0 63
-def @arg05 253 20 1 Y 128 0 63
-def @arg06 253 20 1 Y 128 0 63
-def @arg07 253 23 1 Y 128 31 63
-def @arg08 253 23 1 Y 128 31 63
-def @arg09 253 23 1 Y 128 31 63
-def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
-def @arg17 253 20 4 Y 128 0 63
-def @arg18 253 20 1 Y 128 0 63
-def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 128 31 63
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 128 31 63
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 128 31 63
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 128 31 63
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
-@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
-1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
-select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
-@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
-@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
-@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
-@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
-@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
-@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
-@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
-from t9 where c1= 0 ;
-@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
-0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-execute full_info ;
-Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def @arg01 253 20 1 Y 128 0 63
-def @arg02 253 20 0 Y 128 0 63
-def @arg03 253 20 0 Y 128 0 63
-def @arg04 253 20 0 Y 128 0 63
-def @arg05 253 20 0 Y 128 0 63
-def @arg06 253 20 0 Y 128 0 63
-def @arg07 253 23 0 Y 128 31 63
-def @arg08 253 23 0 Y 128 31 63
-def @arg09 253 23 0 Y 128 31 63
-def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
-def @arg17 253 20 0 Y 128 0 63
-def @arg18 253 20 0 Y 128 0 63
-def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 128 31 63
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 128 31 63
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 128 31 63
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 128 31 63
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
-@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
-0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-prepare stmt1 from "select
- @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
- @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
- @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
- @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
- @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
- @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
- @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
- @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
-from t9 where c1= ?" ;
-set @my_key= 1 ;
-execute stmt1 using @my_key ;
-@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
-1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
-execute full_info ;
-Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def @arg01 253 20 1 Y 128 0 63
-def @arg02 253 20 1 Y 128 0 63
-def @arg03 253 20 1 Y 128 0 63
-def @arg04 253 20 1 Y 128 0 63
-def @arg05 253 20 1 Y 128 0 63
-def @arg06 253 20 1 Y 128 0 63
-def @arg07 253 23 1 Y 128 31 63
-def @arg08 253 23 1 Y 128 31 63
-def @arg09 253 23 1 Y 128 31 63
-def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
-def @arg17 253 20 4 Y 128 0 63
-def @arg18 253 20 1 Y 128 0 63
-def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 128 31 63
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 128 31 63
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 128 31 63
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 128 31 63
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
-@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
-1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
-set @my_key= 0 ;
-execute stmt1 using @my_key ;
-@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
-0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-execute full_info ;
-Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def @arg01 253 20 1 Y 128 0 63
-def @arg02 253 20 0 Y 128 0 63
-def @arg03 253 20 0 Y 128 0 63
-def @arg04 253 20 0 Y 128 0 63
-def @arg05 253 20 0 Y 128 0 63
-def @arg06 253 20 0 Y 128 0 63
-def @arg07 253 23 0 Y 128 31 63
-def @arg08 253 23 0 Y 128 31 63
-def @arg09 253 23 0 Y 128 31 63
-def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
-def @arg17 253 20 0 Y 128 0 63
-def @arg18 253 20 0 Y 128 0 63
-def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 128 31 63
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 128 31 63
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 128 31 63
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 128 31 63
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
-@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
-0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':= c1 from t9 where c1= 1' at line 1
-test_sequence
------- select column, .. into @parm,.. ------
-select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
-c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
-c25, c26, c27, c28, c29, c30, c31, c32
-into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
-@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
-@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
-@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
-from t9 where c1= 1 ;
-execute full_info ;
-Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def @arg01 253 20 1 Y 128 0 63
-def @arg02 253 20 1 Y 128 0 63
-def @arg03 253 20 1 Y 128 0 63
-def @arg04 253 20 1 Y 128 0 63
-def @arg05 253 20 1 Y 128 0 63
-def @arg06 253 20 1 Y 128 0 63
-def @arg07 253 23 1 Y 128 31 63
-def @arg08 253 23 1 Y 128 31 63
-def @arg09 253 23 1 Y 128 31 63
-def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
-def @arg17 253 20 4 Y 128 0 63
-def @arg18 253 20 1 Y 128 0 63
-def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 128 31 63
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 128 31 63
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 128 31 63
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 128 31 63
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
-@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
-1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
-select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
-c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
-c25, c26, c27, c28, c29, c30, c31, c32
-into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
-@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
-@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
-@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
-from t9 where c1= 0 ;
-execute full_info ;
-Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def @arg01 253 20 1 Y 128 0 63
-def @arg02 253 20 0 Y 128 0 63
-def @arg03 253 20 0 Y 128 0 63
-def @arg04 253 20 0 Y 128 0 63
-def @arg05 253 20 0 Y 128 0 63
-def @arg06 253 20 0 Y 128 0 63
-def @arg07 253 23 0 Y 128 31 63
-def @arg08 253 23 0 Y 128 31 63
-def @arg09 253 23 0 Y 128 31 63
-def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
-def @arg17 253 20 0 Y 128 0 63
-def @arg18 253 20 0 Y 128 0 63
-def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 128 31 63
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 128 31 63
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 128 31 63
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 128 31 63
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
-@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
-0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
- c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
- c25, c26, c27, c28, c29, c30, c31, c32
-into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
- @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
- @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
- @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
-from t9 where c1= ?" ;
-set @my_key= 1 ;
-execute stmt1 using @my_key ;
-execute full_info ;
-Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def @arg01 253 20 1 Y 128 0 63
-def @arg02 253 20 1 Y 128 0 63
-def @arg03 253 20 1 Y 128 0 63
-def @arg04 253 20 1 Y 128 0 63
-def @arg05 253 20 1 Y 128 0 63
-def @arg06 253 20 1 Y 128 0 63
-def @arg07 253 23 1 Y 128 31 63
-def @arg08 253 23 1 Y 128 31 63
-def @arg09 253 23 1 Y 128 31 63
-def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
-def @arg13 253 8192 10 Y 128 31 63
-def @arg14 253 8192 19 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 8 Y 128 31 63
-def @arg17 253 20 4 Y 128 0 63
-def @arg18 253 20 1 Y 128 0 63
-def @arg19 253 20 1 Y 128 0 63
-def @arg20 253 8192 1 Y 0 31 8
-def @arg21 253 8192 10 Y 0 31 8
-def @arg22 253 8192 30 Y 0 31 8
-def @arg23 253 8192 8 Y 128 31 63
-def @arg24 253 8192 8 Y 0 31 8
-def @arg25 253 8192 4 Y 128 31 63
-def @arg26 253 8192 4 Y 0 31 8
-def @arg27 253 8192 10 Y 128 31 63
-def @arg28 253 8192 10 Y 0 31 8
-def @arg29 253 8192 8 Y 128 31 63
-def @arg30 253 8192 8 Y 0 31 8
-def @arg31 253 8192 3 Y 0 31 8
-def @arg32 253 8192 6 Y 0 31 8
-@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
-1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
-set @my_key= 0 ;
-execute stmt1 using @my_key ;
-execute full_info ;
-Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def @arg01 253 20 1 Y 128 0 63
-def @arg02 253 20 0 Y 128 0 63
-def @arg03 253 20 0 Y 128 0 63
-def @arg04 253 20 0 Y 128 0 63
-def @arg05 253 20 0 Y 128 0 63
-def @arg06 253 20 0 Y 128 0 63
-def @arg07 253 23 0 Y 128 31 63
-def @arg08 253 23 0 Y 128 31 63
-def @arg09 253 23 0 Y 128 31 63
-def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
-def @arg13 253 8192 0 Y 128 31 63
-def @arg14 253 8192 0 Y 128 31 63
-def @arg15 253 8192 19 Y 128 31 63
-def @arg16 253 8192 0 Y 128 31 63
-def @arg17 253 20 0 Y 128 0 63
-def @arg18 253 20 0 Y 128 0 63
-def @arg19 253 20 0 Y 128 0 63
-def @arg20 253 8192 0 Y 0 31 8
-def @arg21 253 8192 0 Y 0 31 8
-def @arg22 253 8192 0 Y 0 31 8
-def @arg23 253 8192 0 Y 128 31 63
-def @arg24 253 8192 0 Y 0 31 8
-def @arg25 253 8192 0 Y 128 31 63
-def @arg26 253 8192 0 Y 0 31 8
-def @arg27 253 8192 0 Y 128 31 63
-def @arg28 253 8192 0 Y 0 31 8
-def @arg29 253 8192 0 Y 128 31 63
-def @arg30 253 8192 0 Y 0 31 8
-def @arg31 253 8192 0 Y 0 31 8
-def @arg32 253 8192 0 Y 0 31 8
-@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
-0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? from t9 where c1= 1' at line 1
-test_sequence
--- insert into numeric columns --
-insert into t9
-( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
-( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
-set @arg00= 21 ;
-insert into t9
-( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
-( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
-prepare stmt1 from "insert into t9
- ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
- ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
-execute stmt1 ;
-set @arg00= 23;
-prepare stmt2 from "insert into t9
- ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
- ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
-execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00 ;
-insert into t9
-( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
-( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
-30.0, 30.0, 30.0 ) ;
-set @arg00= 31.0 ;
-insert into t9
-( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
-( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
-prepare stmt1 from "insert into t9
- ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
- ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
- 32.0, 32.0, 32.0 )" ;
-execute stmt1 ;
-set @arg00= 33.0;
-prepare stmt2 from "insert into t9
- ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
- ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
-execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00 ;
-insert into t9
-( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
-( '40', '40', '40', '40', '40', '40', '40', '40',
-'40', '40', '40' ) ;
-set @arg00= '41' ;
-insert into t9
-( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
-( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
-prepare stmt1 from "insert into t9
- ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
- ( '42', '42', '42', '42', '42', '42', '42', '42',
- '42', '42', '42' )" ;
-execute stmt1 ;
-set @arg00= '43';
-prepare stmt2 from "insert into t9
- ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
- ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
-execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00 ;
-insert into t9
-( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
-( CAST('50' as binary), CAST('50' as binary),
-CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
-CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
-CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
-set @arg00= CAST('51' as binary) ;
-insert into t9
-( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
-( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
-prepare stmt1 from "insert into t9
- ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
- ( CAST('52' as binary), CAST('52' as binary),
- CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
- CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
- CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
-execute stmt1 ;
-set @arg00= CAST('53' as binary) ;
-prepare stmt2 from "insert into t9
- ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
- ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
-execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00 ;
-set @arg00= 2 ;
-set @arg00= NULL ;
-insert into t9
-( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
-( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-NULL, NULL, NULL ) ;
-insert into t9
-( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
-( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
-prepare stmt1 from "insert into t9
- ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
- ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL )" ;
-execute stmt1 ;
-prepare stmt2 from "insert into t9
- ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
- ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
-execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00 ;
-set @arg00= 8.0 ;
-set @arg00= NULL ;
-insert into t9
-( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
-( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
-prepare stmt2 from "insert into t9
- ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
- ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
-execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00 ;
-set @arg00= 'abc' ;
-set @arg00= NULL ;
-insert into t9
-( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
-( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
-prepare stmt2 from "insert into t9
- ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
- ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
-execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00 ;
-select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
-from t9 where c1 >= 20
-order by c1 ;
-c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12
-20 20 20 20 20 20 20 20 20 20 20.0000
-21 21 21 21 21 21 21 21 21 21 21.0000
-22 22 22 22 22 22 22 22 22 22 22.0000
-23 23 23 23 23 23 23 23 23 23 23.0000
-30 30 30 30 30 30 30 30 30 30 30.0000
-31 31 31 31 31 31 31 31 31 31 31.0000
-32 32 32 32 32 32 32 32 32 32 32.0000
-33 33 33 33 33 33 33 33 33 33 33.0000
-40 40 40 40 40 40 40 40 40 40 40.0000
-41 41 41 41 41 41 41 41 41 41 41.0000
-42 42 42 42 42 42 42 42 42 42 42.0000
-43 43 43 43 43 43 43 43 43 43 43.0000
-50 50 50 50 50 50 50 50 50 50 50.0000
-51 51 51 51 51 51 51 51 51 51 51.0000
-52 52 52 52 52 52 52 52 52 52 52.0000
-53 53 53 53 53 53 53 53 53 53 53.0000
-60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-test_sequence
--- select .. where numeric column = .. --
-set @arg00= 20;
-select 'true' as found from t9
-where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
-and c8= 20 and c9= 20 and c10= 20 and c12= 20;
-found
-true
-select 'true' as found from t9
-where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
-and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
-and c12= @arg00;
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
- and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
-execute stmt1 ;
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
- and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
- and c12= ? ";
-execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00 ;
-found
-true
-set @arg00= 20.0;
-select 'true' as found from t9
-where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
-and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
-found
-true
-select 'true' as found from t9
-where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
-and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
-and c12= @arg00;
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
- and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
-execute stmt1 ;
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
- and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
- and c12= ? ";
-execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00 ;
-found
-true
-select 'true' as found from t9
-where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
- and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
- and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
-execute stmt1 ;
-found
-true
-set @arg00= '20';
-select 'true' as found from t9
-where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
-and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
-and c12= @arg00;
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
- and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
- and c12= ? ";
-execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00 ;
-found
-true
-select 'true' as found from t9
-where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
-c3= CAST('20' as binary) and c4= CAST('20' as binary) and
-c5= CAST('20' as binary) and c6= CAST('20' as binary) and
-c7= CAST('20' as binary) and c8= CAST('20' as binary) and
-c9= CAST('20' as binary) and c10= CAST('20' as binary) and
-c12= CAST('20' as binary);
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
- c3= CAST('20' as binary) and c4= CAST('20' as binary) and
- c5= CAST('20' as binary) and c6= CAST('20' as binary) and
- c7= CAST('20' as binary) and c8= CAST('20' as binary) and
- c9= CAST('20' as binary) and c10= CAST('20' as binary) and
- c12= CAST('20' as binary) ";
-execute stmt1 ;
-found
-true
-set @arg00= CAST('20' as binary) ;
-select 'true' as found from t9
-where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
-and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
-and c12= @arg00;
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
- and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
- and c12= ? ";
-execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00 ;
-found
-true
-delete from t9 ;
-test_sequence
--- some numeric overflow experiments --
-prepare my_insert from "insert into t9
- ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
-values
- ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
-prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
-from t9 where c21 = 'O' ";
-prepare my_delete from "delete from t9 where c21 = 'O' ";
-set @arg00= 9223372036854775807 ;
-execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00 ;
-Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
-execute my_select ;
-c1 127
-c2 32767
-c3 8388607
-c4 2147483647
-c5 2147483647
-c6 9223372036854775807
-c7 9.22337e+18
-c8 9.22337203685478e+18
-c9 9.22337203685478e+18
-c10 9.22337203685478e+18
-c12 9999.9999
-execute my_delete ;
-set @arg00= '9223372036854775807' ;
-execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00 ;
-Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
-execute my_select ;
-c1 127
-c2 32767
-c3 8388607
-c4 2147483647
-c5 2147483647
-c6 9223372036854775807
-c7 9.22337e+18
-c8 9.22337203685478e+18
-c9 9.22337203685478e+18
-c10 9.22337203685478e+18
-c12 9999.9999
-execute my_delete ;
-set @arg00= -9223372036854775808 ;
-execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00 ;
-Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
-execute my_select ;
-c1 -128
-c2 -32768
-c3 -8388608
-c4 -2147483648
-c5 -2147483648
-c6 -9223372036854775808
-c7 -9.22337e+18
-c8 -9.22337203685478e+18
-c9 -9.22337203685478e+18
-c10 -9.22337203685478e+18
-c12 -9999.9999
-execute my_delete ;
-set @arg00= '-9223372036854775808' ;
-execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00 ;
-Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
-execute my_select ;
-c1 -128
-c2 -32768
-c3 -8388608
-c4 -2147483648
-c5 -2147483648
-c6 -9223372036854775808
-c7 -9.22337e+18
-c8 -9.22337203685478e+18
-c9 -9.22337203685478e+18
-c10 -9.22337203685478e+18
-c12 -9999.9999
-execute my_delete ;
-set @arg00= 1.11111111111111111111e+50 ;
-execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00 ;
-Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
-execute my_select ;
-c1 127
-c2 32767
-c3 8388607
-c4 2147483647
-c5 2147483647
-c6 9223372036854775807
-c7 3.40282e+38
-c8 1.11111111111111e+50
-c9 1.11111111111111e+50
-c10 1.11111111111111e+50
-c12 9999.9999
-execute my_delete ;
-set @arg00= '1.11111111111111111111e+50' ;
-execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00 ;
-Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
-execute my_select ;
-c1 127
-c2 32767
-c3 8388607
-c4 2147483647
-c5 2147483647
-c6 9223372036854775807
-c7 3.40282e+38
-c8 1.11111111111111e+50
-c9 1.11111111111111e+50
-c10 1.11111111111111e+50
-c12 9999.9999
-execute my_delete ;
-set @arg00= -1.11111111111111111111e+50 ;
-execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00 ;
-Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
-execute my_select ;
-c1 -128
-c2 -32768
-c3 -8388608
-c4 -2147483648
-c5 -2147483648
-c6 -9223372036854775808
-c7 -3.40282e+38
-c8 -1.11111111111111e+50
-c9 -1.11111111111111e+50
-c10 -1.11111111111111e+50
-c12 -9999.9999
-execute my_delete ;
-set @arg00= '-1.11111111111111111111e+50' ;
-execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00 ;
-Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
-execute my_select ;
-c1 -128
-c2 -32768
-c3 -8388608
-c4 -2147483648
-c5 -2147483648
-c6 -9223372036854775808
-c7 -3.40282e+38
-c8 -1.11111111111111e+50
-c9 -1.11111111111111e+50
-c10 -1.11111111111111e+50
-c12 -9999.9999
-execute my_delete ;
-test_sequence
--- insert into string columns --
-Warnings:
-Warning 1265 Data truncated for column 'c20' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c20' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c20' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c20' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c20' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c20' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c20' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c20' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c20' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c20' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c20' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c20' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c20' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c20' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c20' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c20' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c20' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c20' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c20' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c20' at row 1
-select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
-from t9 where c1 >= 20
-order by c1 ;
-c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
-20 2 20 20 20 20 20 20 20 20 20 20
-21 2 21 21 21 21 21 21 21 21 21 21
-22 2 22 22 22 22 22 22 22 22 22 22
-23 2 23 23 23 23 23 23 23 23 23 23
-30 3 30 30 30 30 30 30 30 30 30 30
-31 3 31 31 31 31 31 31 31 31 31 31
-32 3 32 32 32 32 32 32 32 32 32 32
-33 3 33 33 33 33 33 33 33 33 33 33
-40 4 40 40 40 40 40 40 40 40 40 40
-41 4 41 41 41 41 41 41 41 41 41 41
-42 4 42 42 42 42 42 42 42 42 42 42
-43 4 43 43 43 43 43 43 43 43 43 43
-50 5 50.0 50.0 50.0 50.0 50.0 50.0 50.0 50.0 50.0 50.0
-51 5 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0
-52 5 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0
-53 5 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0
-54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
-55 5 55 55 55 55 55 55 55 55 55 55
-56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
-57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
-60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
-test_sequence
--- select .. where string column = .. --
-set @arg00= '20';
-select 'true' as found from t9
-where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
-c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
-c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
-found
-true
-select 'true' as found from t9
-where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
-c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
-c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
- c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
- c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
-execute stmt1 ;
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
- c21= ? and c22= ? and c23= ? and c25= ? and
- c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
-execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00 ;
-found
-true
-set @arg00= CAST('20' as binary);
-select 'true' as found from t9
-where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
-= CAST('20' as binary) and c21= CAST('20' as binary)
-and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
-c24= CAST('20' as binary) and c25= CAST('20' as binary) and
-c26= CAST('20' as binary) and c27= CAST('20' as binary) and
-c28= CAST('20' as binary) and c29= CAST('20' as binary) and
-c30= CAST('20' as binary) ;
-found
-true
-select 'true' as found from t9
-where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
-c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
-c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
-c30= @arg00;
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
- = CAST('20' as binary) and c21= CAST('20' as binary)
- and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
- c24= CAST('20' as binary) and c25= CAST('20' as binary) and
- c26= CAST('20' as binary) and c27= CAST('20' as binary) and
- c28= CAST('20' as binary) and c29= CAST('20' as binary) and
- c30= CAST('20' as binary)" ;
-execute stmt1 ;
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
- c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
- c29= ? and c30= ?";
-execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00 ;
-found
-true
-set @arg00= 20;
-select 'true' as found from t9
-where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
-c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
-c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
-found
-true
-select 'true' as found from t9
-where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
-c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
-c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
- c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
- c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
-execute stmt1 ;
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
- c21= ? and c22= ? and c23= ? and c25= ? and
- c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
-execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00 ;
-found
-true
-set @arg00= 20.0;
-select 'true' as found from t9
-where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
-c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
-c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
-found
-true
-select 'true' as found from t9
-where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
-c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
-c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
- c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
- c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
-execute stmt1 ;
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
- c21= ? and c22= ? and c23= ? and c25= ? and
- c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
-execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00 ;
-found
-true
-delete from t9 ;
-test_sequence
--- insert into date/time columns --
-Warnings:
-Warning 1265 Data truncated for column 'c17' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c17' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c17' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c17' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c17' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c17' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c17' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c17' at row 1
-Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
-Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
-Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
-Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
-Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
-Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
-Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
-Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
-Warnings:
-Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
-select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
-c1 c13 c14 c15 c16 c17
-20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
-21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
-22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
-23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
-30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
-31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
-32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
-33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
-40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
-41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
-42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
-43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
-50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
-51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
-52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
-53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
-60 NULL NULL 1991-01-01 01:01:01 NULL NULL
-61 NULL NULL 1991-01-01 01:01:01 NULL NULL
-62 NULL NULL 1991-01-01 01:01:01 NULL NULL
-63 NULL NULL 1991-01-01 01:01:01 NULL NULL
-71 NULL NULL 1991-01-01 01:01:01 NULL NULL
-73 NULL NULL 1991-01-01 01:01:01 NULL NULL
-81 NULL NULL 1991-01-01 01:01:01 NULL NULL
-83 NULL NULL 1991-01-01 01:01:01 NULL NULL
-test_sequence
--- select .. where date/time column = .. --
-set @arg00= '1991-01-01 01:01:01' ;
-select 'true' as found from t9
-where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
-c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
-c17= '1991-01-01 01:01:01' ;
-found
-true
-select 'true' as found from t9
-where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
-and c17= @arg00 ;
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
- c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
- c17= '1991-01-01 01:01:01'" ;
-execute stmt1 ;
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
-execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
-found
-true
-set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
-select 'true' as found from t9
-where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
-c14= CAST('1991-01-01 01:01:01' as datetime) and
-c15= CAST('1991-01-01 01:01:01' as datetime) and
-c16= CAST('1991-01-01 01:01:01' as datetime) and
-c17= CAST('1991-01-01 01:01:01' as datetime) ;
-found
-true
-select 'true' as found from t9
-where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
-and c17= @arg00 ;
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
- c14= CAST('1991-01-01 01:01:01' as datetime) and
- c15= CAST('1991-01-01 01:01:01' as datetime) and
- c16= CAST('1991-01-01 01:01:01' as datetime) and
- c17= CAST('1991-01-01 01:01:01' as datetime)" ;
-execute stmt1 ;
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
-execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
-found
-true
-set @arg00= 1991 ;
-select 'true' as found from t9
-where c1= 20 and c17= 1991 ;
-found
-true
-select 'true' as found from t9
-where c1= 20 and c17= @arg00 ;
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= 20 and c17= 1991" ;
-execute stmt1 ;
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= 20 and c17= ?" ;
-execute stmt1 using @arg00 ;
-found
-true
-set @arg00= 1.991e+3 ;
-select 'true' as found from t9
-where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
-found
-true
-select 'true' as found from t9
-where c1= 20 and abs(c17 - @arg00) < 0.01 ;
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
-execute stmt1 ;
-found
-true
-prepare stmt1 from "select 'true' as found from t9
-where c1= 20 and abs(c17 - ?) < 0.01" ;
-execute stmt1 using @arg00 ;
-found
-true
-drop table t1, t9;
diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result
index c84cced15f5..9e0577f8ae2 100644
--- a/mysql-test/r/ps_7ndb.result
+++ b/mysql-test/r/ps_7ndb.result
@@ -1287,7 +1287,7 @@ set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1
+Warning 1048 Column 'a' cannot be null
select a,b from t1 order by a;
a b
0 two
@@ -2555,12 +2555,12 @@ set @arg00= 9223372036854775807 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -2578,12 +2578,12 @@ set @arg00= '9223372036854775807' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -2601,12 +2601,12 @@ set @arg00= -9223372036854775808 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -2624,12 +2624,12 @@ set @arg00= '-9223372036854775808' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -2647,14 +2647,14 @@ set @arg00= 1.11111111111111111111e+50 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -2672,14 +2672,14 @@ set @arg00= '1.11111111111111111111e+50' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
@@ -2697,14 +2697,14 @@ set @arg00= -1.11111111111111111111e+50 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -2722,14 +2722,14 @@ set @arg00= '-1.11111111111111111111e+50' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
-Warning 1264 Out of range value adjusted for column 'c3' at row 1
-Warning 1264 Out of range value adjusted for column 'c4' at row 1
-Warning 1264 Out of range value adjusted for column 'c5' at row 1
-Warning 1264 Out of range value adjusted for column 'c6' at row 1
-Warning 1264 Out of range value adjusted for column 'c7' at row 1
-Warning 1264 Out of range value adjusted for column 'c12' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c2' at row 1
+Warning 1264 Out of range value for column 'c3' at row 1
+Warning 1264 Out of range value for column 'c4' at row 1
+Warning 1264 Out of range value for column 'c5' at row 1
+Warning 1264 Out of range value for column 'c6' at row 1
+Warning 1264 Out of range value for column 'c7' at row 1
+Warning 1264 Out of range value for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
@@ -2960,45 +2960,45 @@ Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
-Warning 1264 Out of range value adjusted for column 'c13' at row 1
-Warning 1264 Out of range value adjusted for column 'c14' at row 1
+Warning 1264 Out of range value for column 'c13' at row 1
+Warning 1264 Out of range value for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
-Warning 1264 Out of range value adjusted for column 'c16' at row 1
-Warning 1264 Out of range value adjusted for column 'c17' at row 1
+Warning 1264 Out of range value for column 'c16' at row 1
+Warning 1264 Out of range value for column 'c17' at row 1
select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
c1 c13 c14 c15 c16 c17
20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
diff --git a/mysql-test/r/ps_grant.result b/mysql-test/r/ps_grant.result
index fdc1f97bb4c..8b16123ccea 100644
--- a/mysql-test/r/ps_grant.result
+++ b/mysql-test/r/ps_grant.result
@@ -78,13 +78,10 @@ ERROR 42000: There is no such grant defined for user 'second_user' on host 'loca
drop database mysqltest;
prepare stmt3 from ' grant all on test.t1 to drop_user@localhost
identified by ''looser'' ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
grant all on test.t1 to drop_user@localhost
identified by 'looser' ;
prepare stmt3 from ' revoke all privileges on test.t1 from
drop_user@localhost ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
revoke all privileges on test.t1 from drop_user@localhost ;
prepare stmt3 from ' drop user drop_user@localhost ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
drop user drop_user@localhost;
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index 846c687967d..d5996ee8163 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -3,8 +3,10 @@ flush query cache;
flush query cache;
reset query cache;
flush status;
-drop table if exists t1,t2,t3,t4,t11,t21;
+drop table if exists t1,t2,t3,t4,t11,t21,t1_1,t1_2,t9,t9_1,t9_2;
drop database if exists mysqltest;
+drop table if exists ```a`;
+drop view if exists v1;
create table t1 (a int not null);
insert into t1 values (1),(2),(3);
select * from t1;
@@ -228,8 +230,8 @@ CURRENT_USER()
select benchmark(1,1) from t1;
benchmark(1,1)
explain extended select benchmark(1,1) from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
Note 1003 select benchmark(1,1) AS `benchmark(1,1)` from `test`.`t1`
show status like "Qcache_queries_in_cache";
@@ -1053,6 +1055,7 @@ Qcache_hits 1
drop table t1;
create table t1 (a int);
insert into t1 values (1),(2);
+drop procedure if exists p1;
CREATE PROCEDURE `p1`()
begin
Declare c1 cursor for select a from t1;
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index c96173e74cc..04923c9e24c 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -406,7 +406,7 @@ insert into t2(uid, name) values
(24, CHAR(64+24)),
(25, CHAR(64+25)),
(26, CHAR(64+26));
-insert into t1(uid, name) select uid, name from t2;
+insert into t1(uid, name) select uid, name from t2 order by uid;
delete from t2;
insert into t2(id, uid, name) select id, uid, name from t1;
select count(*) from t1;
@@ -951,3 +951,17 @@ item started price
A1 2005-11-01 08:00:00 1000.000
A1 2005-11-15 00:00:00 2000.000
DROP TABLE t1;
+create table t1 (a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t2 (a int, b int, filler char(100));
+insert into t2 select A.a + 10 * (B.a + 10 * C.a), 10, 'filler' from t1 A,
+t1 B, t1 C where A.a < 5;
+insert into t2 select 1000, b, 'filler' from t2;
+alter table t2 add index (a,b);
+select 'In following EXPLAIN the access method should be ref, #rows~=500 (and not 2)' Z;
+Z
+In following EXPLAIN the access method should be ref, #rows~=500 (and not 2)
+explain select * from t2 where a=1000 and b<11;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref a a 5 const 502 Using where
+drop table t1, t2;
diff --git a/mysql-test/r/innodb-big.result b/mysql-test/r/read_many_rows_innodb.result
index 19204b7cc65..ff11535f687 100644
--- a/mysql-test/r/innodb-big.result
+++ b/mysql-test/r/read_many_rows_innodb.result
@@ -1,8 +1,9 @@
+SET SESSION STORAGE_ENGINE = InnoDB;
DROP TABLE IF EXISTS t1, t2, t3, t4;
-CREATE TABLE t1 (id INTEGER) ENGINE=MYISAM;
-CREATE TABLE t2 (id INTEGER primary key) ENGINE=INNODB;
-CREATE TABLE t3 (a char(32) primary key,id INTEGER) ENGINE=INNODB;
-CREATE TABLE t4 (a char(32) primary key,id INTEGER) ENGINE=MYISAM;
+CREATE TABLE t1 (id INTEGER) ENGINE=MyISAM;
+CREATE TABLE t2 (id INTEGER PRIMARY KEY);
+CREATE TABLE t3 (a CHAR(32) PRIMARY KEY,id INTEGER);
+CREATE TABLE t4 (a CHAR(32) PRIMARY KEY,id INTEGER) ENGINE=MyISAM;
INSERT INTO t1 (id) VALUES (1);
INSERT INTO t1 SELECT id+1 FROM t1;
INSERT INTO t1 SELECT id+2 FROM t1;
@@ -26,9 +27,9 @@ INSERT INTO t1 SELECT id+262144 FROM t1;
INSERT INTO t1 SELECT id+524288 FROM t1;
INSERT INTO t1 SELECT id+1048576 FROM t1;
INSERT INTO t2 SELECT * FROM t1;
-INSERT INTO t3 SELECT concat(id),id from t2 ORDER BY -id;
-INSERT INTO t4 SELECT * from t3 ORDER BY concat(a);
-select sum(id) from t3;
-sum(id)
+INSERT INTO t3 SELECT CONCAT(id),id FROM t2 ORDER BY -id;
+INSERT INTO t4 SELECT * FROM t3 ORDER BY CONCAT(a);
+SELECT SUM(id) FROM t3;
+SUM(id)
2199024304128
-drop table t1,t2,t3,t4;
+DROP TABLE t1,t2,t3,t4;
diff --git a/mysql-test/r/renamedb.result b/mysql-test/r/renamedb.result
new file mode 100644
index 00000000000..b22322fbe8d
--- /dev/null
+++ b/mysql-test/r/renamedb.result
@@ -0,0 +1,33 @@
+drop database if exists testdb1;
+create database testdb1 default character set latin2;
+use testdb1;
+create table t1 (a int);
+insert into t1 values (1),(2),(3);
+show create database testdb1;
+Database Create Database
+testdb1 CREATE DATABASE `testdb1` /*!40100 DEFAULT CHARACTER SET latin2 */
+show tables;
+Tables_in_testdb1
+t1
+rename database testdb1 to testdb2;
+show create database testdb1;
+ERROR 42000: Unknown database 'testdb1'
+show create database testdb2;
+Database Create Database
+testdb2 CREATE DATABASE `testdb2` /*!40100 DEFAULT CHARACTER SET latin2 */
+select database();
+database()
+testdb2
+show tables;
+Tables_in_testdb2
+t1
+select a from t1 order by a;
+a
+1
+2
+3
+drop database testdb2;
+create database testdb1;
+rename database testdb1 to testdb1;
+ERROR HY000: Can't create database 'testdb1'; database exists
+drop database testdb1;
diff --git a/mysql-test/r/repair.result b/mysql-test/r/repair.result
index 54d53299743..1269c4c85a9 100644
--- a/mysql-test/r/repair.result
+++ b/mysql-test/r/repair.result
@@ -90,3 +90,9 @@ test.t1 repair status OK
SET myisam_repair_threads=@@global.myisam_repair_threads;
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
DROP TABLE t1;
+DROP TABLE IF EXISTS tt1;
+CREATE TEMPORARY TABLE tt1 (c1 INT);
+REPAIR TABLE tt1 USE_FRM;
+Table Op Msg_type Msg_text
+tt1 repair error Cannot repair temporary table from .frm file
+DROP TABLE tt1;
diff --git a/mysql-test/r/replace.result b/mysql-test/r/replace.result
index 5a5e4571ba9..842302c89ac 100644
--- a/mysql-test/r/replace.result
+++ b/mysql-test/r/replace.result
@@ -13,9 +13,9 @@ drop table t1;
create table t1 (a tinyint not null auto_increment primary key, b char(20) default "default_value");
insert into t1 values (126,"first"),(63, "middle"),(0,"last");
insert into t1 values (0,"error");
-ERROR 23000: Duplicate entry '127' for key 1
+ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
replace into t1 values (0,"error");
-ERROR 23000: Duplicate entry '127' for key 1
+ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
replace into t1 values (126,"first updated");
replace into t1 values (63,default);
select * from t1;
diff --git a/mysql-test/r/round.result b/mysql-test/r/round.result
index e9a80df0f49..49a00885f34 100644
--- a/mysql-test/r/round.result
+++ b/mysql-test/r/round.result
@@ -5,7 +5,7 @@ INSERT INTO t1 VALUES ('0.5');
INSERT INTO t1 VALUES ('127.4');
INSERT INTO t1 VALUES ('127.5');
Warnings:
-Warning 1264 Out of range value adjusted for column 'sint8' at row 1
+Warning 1264 Out of range value for column 'sint8' at row 1
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
INSERT INTO t1 VALUES ('-127.4');
@@ -13,7 +13,7 @@ INSERT INTO t1 VALUES ('-127.5');
INSERT INTO t1 VALUES ('-128.4');
INSERT INTO t1 VALUES ('-128.5');
Warnings:
-Warning 1264 Out of range value adjusted for column 'sint8' at row 1
+Warning 1264 Out of range value for column 'sint8' at row 1
SELECT * FROM t1;
sint8
0
@@ -35,11 +35,11 @@ INSERT INTO t1 VALUES ('127.5');
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
Warnings:
-Warning 1264 Out of range value adjusted for column 'uint8' at row 1
+Warning 1264 Out of range value for column 'uint8' at row 1
INSERT INTO t1 VALUES ('255.4');
INSERT INTO t1 VALUES ('255.5');
Warnings:
-Warning 1264 Out of range value adjusted for column 'uint8' at row 1
+Warning 1264 Out of range value for column 'uint8' at row 1
SELECT * FROM t1;
uint8
0
@@ -57,7 +57,7 @@ INSERT INTO t1 VALUES ('0.5');
INSERT INTO t1 VALUES ('32767.4');
INSERT INTO t1 VALUES ('32767.5');
Warnings:
-Warning 1264 Out of range value adjusted for column 'sint16' at row 1
+Warning 1264 Out of range value for column 'sint16' at row 1
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
INSERT INTO t1 VALUES ('-32767.4');
@@ -65,7 +65,7 @@ INSERT INTO t1 VALUES ('-32767.5');
INSERT INTO t1 VALUES ('-32768.4');
INSERT INTO t1 VALUES ('-32768.5');
Warnings:
-Warning 1264 Out of range value adjusted for column 'sint16' at row 1
+Warning 1264 Out of range value for column 'sint16' at row 1
SELECT * FROM t1;
sint16
0
@@ -87,11 +87,11 @@ INSERT INTO t1 VALUES ('32767.5');
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
Warnings:
-Warning 1264 Out of range value adjusted for column 'uint16' at row 1
+Warning 1264 Out of range value for column 'uint16' at row 1
INSERT INTO t1 VALUES ('65535.4');
INSERT INTO t1 VALUES ('65535.5');
Warnings:
-Warning 1264 Out of range value adjusted for column 'uint16' at row 1
+Warning 1264 Out of range value for column 'uint16' at row 1
SELECT * FROM t1;
uint16
0
@@ -109,7 +109,7 @@ INSERT INTO t1 VALUES ('0.5');
INSERT INTO t1 VALUES ('8388607.4');
INSERT INTO t1 VALUES ('8388607.5');
Warnings:
-Warning 1264 Out of range value adjusted for column 'sint24' at row 1
+Warning 1264 Out of range value for column 'sint24' at row 1
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
INSERT INTO t1 VALUES ('-8388607.4');
@@ -117,7 +117,7 @@ INSERT INTO t1 VALUES ('-8388607.5');
INSERT INTO t1 VALUES ('-8388608.4');
INSERT INTO t1 VALUES ('-8388608.5');
Warnings:
-Warning 1264 Out of range value adjusted for column 'sint24' at row 1
+Warning 1264 Out of range value for column 'sint24' at row 1
SELECT * FROM t1;
sint24
0
@@ -139,11 +139,11 @@ INSERT INTO t1 VALUES ('8388607.5');
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
Warnings:
-Warning 1264 Out of range value adjusted for column 'uint24' at row 1
+Warning 1264 Out of range value for column 'uint24' at row 1
INSERT INTO t1 VALUES ('16777215.4');
INSERT INTO t1 VALUES ('16777215.5');
Warnings:
-Warning 1264 Out of range value adjusted for column 'uint24' at row 1
+Warning 1264 Out of range value for column 'uint24' at row 1
SELECT * FROM t1;
uint24
0
@@ -161,7 +161,7 @@ INSERT INTO t1 VALUES ('0.5');
INSERT INTO t1 VALUES ('9223372036854775807.4');
INSERT INTO t1 VALUES ('9223372036854775807.5');
Warnings:
-Warning 1264 Out of range value adjusted for column 'sint64' at row 1
+Warning 1264 Out of range value for column 'sint64' at row 1
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
INSERT INTO t1 VALUES ('-9223372036854775807.4');
@@ -169,7 +169,7 @@ INSERT INTO t1 VALUES ('-9223372036854775807.5');
INSERT INTO t1 VALUES ('-9223372036854775808.4');
INSERT INTO t1 VALUES ('-9223372036854775808.5');
Warnings:
-Warning 1264 Out of range value adjusted for column 'sint64' at row 1
+Warning 1264 Out of range value for column 'sint64' at row 1
SELECT * FROM t1;
sint64
0
@@ -191,11 +191,11 @@ INSERT INTO t1 VALUES ('9223372036854775807.5');
INSERT INTO t1 VALUES ('-0.1');
INSERT INTO t1 VALUES ('-0.5');
Warnings:
-Warning 1264 Out of range value adjusted for column 'uint64' at row 1
+Warning 1264 Out of range value for column 'uint64' at row 1
INSERT INTO t1 VALUES ('18446744073709551615.4');
INSERT INTO t1 VALUES ('18446744073709551615.5');
Warnings:
-Warning 1264 Out of range value adjusted for column 'uint64' at row 1
+Warning 1264 Out of range value for column 'uint64' at row 1
INSERT INTO t1 VALUES ('1844674407370955161.0');
INSERT INTO t1 VALUES ('1844674407370955161.1');
INSERT INTO t1 VALUES ('1844674407370955161.2');
diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result
index 5b5f8b7b954..08d457f7ad7 100644
--- a/mysql-test/r/row.result
+++ b/mysql-test/r/row.result
@@ -46,8 +46,8 @@ select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)));
row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)))
NULL
explain extended select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)));
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select ((1,2,(3,4)) in ((3,2,(3,4)),(1,2,(3,NULL)))) AS `row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)))`
SELECT (1,2,3)=(0,NULL,3);
@@ -225,11 +225,11 @@ a b a b c
3 1 3 1 3
EXPLAIN SELECT * FROM t1,t2 WHERE t1.a=t2.a AND t1.b=2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 5 Using where; Using index
+1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 Using where; Using index
1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a 1 Using index
EXPLAIN SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,2);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 5 Using where; Using index
+1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 Using where; Using index
1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a 1 Using index
SELECT * FROM t1,t2 WHERE t1.a=1 and t1.b=t2.b;
a b a b c
@@ -248,9 +248,9 @@ a b a b c
3 2 3 1 1
3 2 3 1 3
EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,t2.b+1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 Using index
-1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 100.00 Using index
+1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using where; Using index
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = (`test`.`t2`.`b` + 1)))
SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,t2.b+1);
@@ -260,9 +260,9 @@ a b a b c
3 2 3 1 1
3 2 3 1 3
EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE (t1.a-1,t1.b)=(t2.a-1,t2.b+1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL PRIMARY 8 NULL 6 Using index
-1 SIMPLE t2 index NULL PRIMARY 12 NULL 7 Using where; Using index
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 index NULL PRIMARY 8 NULL 6 100.00 Using index
+1 SIMPLE t2 index NULL PRIMARY 12 NULL 7 100.00 Using where; Using index
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where (((`test`.`t1`.`a` - 1) = (`test`.`t2`.`a` - 1)) and (`test`.`t1`.`b` = (`test`.`t2`.`b` + 1)))
SELECT * FROM t1,t2 WHERE (t1.a-1,t1.b)=(t2.a-1,t2.b+1);
@@ -286,9 +286,9 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 Using index
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 12 test.t1.a,const,const 1 Using index
EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE (t2.a,(t2.b,t2.c))=(t1.a,(2,1));
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 Using index
-1 SIMPLE t2 eq_ref PRIMARY PRIMARY 12 test.t1.a,const,const 1 Using index
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 100.00 Using index
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 12 test.t1.a,const,const 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c` = 1) and (`test`.`t2`.`b` = 2) and (`test`.`t2`.`a` = `test`.`t1`.`a`))
SELECT * FROM t1,t2 WHERE (t2.a,(t2.b,t2.c))=(t1.a,(2,1));
@@ -296,9 +296,9 @@ a b a b c
1 1 1 2 1
1 2 1 2 1
EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE t2.a=t1.a AND (t2.b,t2.c)=(2,1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 Using index
-1 SIMPLE t2 eq_ref PRIMARY PRIMARY 12 test.t1.a,const,const 1 Using index
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 100.00 Using index
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 12 test.t1.a,const,const 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c` = 1) and (`test`.`t2`.`b` = 2) and (`test`.`t2`.`a` = `test`.`t1`.`a`))
SELECT * FROM t1,t2 WHERE t2.a=t1.a AND (t2.b,t2.c)=(2,1);
diff --git a/mysql-test/r/rowid_order_bdb.result b/mysql-test/r/rowid_order_bdb.result
deleted file mode 100644
index bbdc6f6ff77..00000000000
--- a/mysql-test/r/rowid_order_bdb.result
+++ /dev/null
@@ -1,186 +0,0 @@
-drop table if exists t1, t2, t3,t4;
-create table t1 (
-pk1 int not NULL,
-key1 int(11),
-key2 int(11),
-PRIMARY KEY (pk1),
-KEY key1 (key1),
-KEY key2 (key2)
-) engine=bdb;
-insert into t1 values (-5, 1, 1),
-(-100, 1, 1),
-(3, 1, 1),
-(0, 1, 1),
-(10, 1, 1);
-explain select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 5 Using sort_union(key1,key2); Using where
-select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
-pk1 key1 key2
--100 1 1
--5 1 1
-0 1 1
-3 1 1
-10 1 1
-drop table t1;
-create table t1 (
-pk1 int unsigned not NULL,
-key1 int(11),
-key2 int(11),
-PRIMARY KEY (pk1),
-KEY key1 (key1),
-KEY key2 (key2)
-) engine=bdb;
-insert into t1 values (0, 1, 1),
-(0xFFFFFFFF, 1, 1),
-(0xFFFFFFFE, 1, 1),
-(1, 1, 1),
-(2, 1, 1);
-select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
-pk1 key1 key2
-0 1 1
-1 1 1
-2 1 1
-4294967294 1 1
-4294967295 1 1
-drop table t1;
-create table t1 (
-pk1 char(4) not NULL,
-key1 int(11),
-key2 int(11),
-PRIMARY KEY (pk1),
-KEY key1 (key1),
-KEY key2 (key2)
-) engine=bdb collate latin2_general_ci;
-insert into t1 values ('a1', 1, 1),
-('b2', 1, 1),
-('A3', 1, 1),
-('B4', 1, 1);
-select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
-pk1 key1 key2
-a1 1 1
-A3 1 1
-b2 1 1
-B4 1 1
-drop table t1;
-create table t1 (
-pk1 int not NULL,
-pk2 char(4) not NULL collate latin1_german1_ci,
-pk3 char(4) not NULL collate latin1_bin,
-key1 int(11),
-key2 int(11),
-PRIMARY KEY (pk1,pk2,pk3),
-KEY key1 (key1),
-KEY key2 (key2)
-) engine=bdb;
-insert into t1 values
-(1, 'u', 'u', 1, 1),
-(1, 'u', char(0xEC), 1, 1),
-(1, 'u', 'x', 1, 1);
-insert ignore into t1 select pk1, char(0xEC), pk3, key1, key2 from t1;
-insert ignore into t1 select pk1, 'x', pk3, key1, key2 from t1 where pk2='u';
-insert ignore into t1 select 2, pk2, pk3, key1, key2 from t1;
-select * from t1;
-pk1 pk2 pk3 key1 key2
-1 u 1 1
-1 x 1 1
-1 1 1
-1 u u 1 1
-1 u x 1 1
-1 u 1 1
-1 x u 1 1
-1 x x 1 1
-1 x 1 1
-2 u 1 1
-2 x 1 1
-2 1 1
-2 u u 1 1
-2 u x 1 1
-2 u 1 1
-2 x u 1 1
-2 x x 1 1
-2 x 1 1
-select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
-pk1 pk2 pk3 key1 key2
-1 u 1 1
-1 x 1 1
-1 1 1
-1 u u 1 1
-1 u x 1 1
-1 u 1 1
-1 x u 1 1
-1 x x 1 1
-1 x 1 1
-2 u 1 1
-2 x 1 1
-2 1 1
-2 u u 1 1
-2 u x 1 1
-2 u 1 1
-2 x u 1 1
-2 x x 1 1
-2 x 1 1
-alter table t1 drop primary key;
-select * from t1;
-pk1 pk2 pk3 key1 key2
-1 u 1 1
-1 x 1 1
-1 1 1
-1 u u 1 1
-1 u x 1 1
-1 u 1 1
-1 x u 1 1
-1 x x 1 1
-1 x 1 1
-2 u 1 1
-2 x 1 1
-2 1 1
-2 u u 1 1
-2 u x 1 1
-2 u 1 1
-2 x u 1 1
-2 x x 1 1
-2 x 1 1
-select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
-pk1 pk2 pk3 key1 key2
-1 u 1 1
-1 x 1 1
-1 1 1
-1 u u 1 1
-1 u x 1 1
-1 u 1 1
-1 x u 1 1
-1 x x 1 1
-1 x 1 1
-2 u 1 1
-2 x 1 1
-2 1 1
-2 u u 1 1
-2 u x 1 1
-2 u 1 1
-2 x u 1 1
-2 x x 1 1
-2 x 1 1
-drop table t1;
-create table t1 (
-pk1 varchar(8) NOT NULL default '',
-pk2 varchar(4) NOT NULL default '',
-key1 int(11),
-key2 int(11),
-primary key(pk1, pk2),
-KEY key1 (key1),
-KEY key2 (key2)
-) engine=bdb;
-insert into t1 values ('','empt',2,2),
-('a','a--a',2,2),
-('bb','b--b',2,2),
-('ccc','c--c',2,2),
-('dddd','d--d',2,2);
-select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
-pk1 pk2 key1 key2
- empt 2 2
-a a--a 2 2
-bb b--b 2 2
-ccc c--c 2 2
-dddd d--d 2 2
-drop table t1;
diff --git a/mysql-test/r/rowid_order_innodb.result b/mysql-test/r/rowid_order_innodb.result
index f76002e9cb2..e0796cd7ab5 100644
--- a/mysql-test/r/rowid_order_innodb.result
+++ b/mysql-test/r/rowid_order_innodb.result
@@ -1,12 +1,13 @@
+SET SESSION STORAGE_ENGINE = InnoDB;
drop table if exists t1, t2, t3,t4;
-create table t1 (
+create table t1 (
pk1 int not NULL,
key1 int(11),
key2 int(11),
PRIMARY KEY (pk1),
KEY key1 (key1),
KEY key2 (key2)
-) engine=innodb;
+);
insert into t1 values (-5, 1, 1),
(-100, 1, 1),
(3, 1, 1),
@@ -23,14 +24,14 @@ pk1 key1 key2
3 1 1
10 1 1
drop table t1;
-create table t1 (
+create table t1 (
pk1 int unsigned not NULL,
key1 int(11),
key2 int(11),
PRIMARY KEY (pk1),
KEY key1 (key1),
KEY key2 (key2)
-) engine=innodb;
+);
insert into t1 values (0, 1, 1),
(0xFFFFFFFF, 1, 1),
(0xFFFFFFFE, 1, 1),
@@ -44,14 +45,14 @@ pk1 key1 key2
4294967294 1 1
4294967295 1 1
drop table t1;
-create table t1 (
+create table t1 (
pk1 char(4) not NULL,
key1 int(11),
key2 int(11),
PRIMARY KEY (pk1),
KEY key1 (key1),
KEY key2 (key2)
-) engine=innodb collate latin2_general_ci;
+) collate latin2_general_ci;
insert into t1 values ('a1', 1, 1),
('b2', 1, 1),
('A3', 1, 1),
@@ -72,8 +73,8 @@ key2 int(11),
PRIMARY KEY (pk1,pk2,pk3),
KEY key1 (key1),
KEY key2 (key2)
-) engine=innodb;
-insert into t1 values
+);
+insert into t1 values
(1, 'u', 'u', 1, 1),
(1, 'u', char(0xEC), 1, 1),
(1, 'u', 'x', 1, 1);
@@ -170,7 +171,7 @@ key2 int(11),
primary key(pk1, pk2),
KEY key1 (key1),
KEY key2 (key2)
-) engine=innodb;
+);
insert into t1 values ('','empt',2,2),
('a','a--a',2,2),
('bb','b--b',2,2),
diff --git a/mysql-test/r/rpl000004.a.result b/mysql-test/r/rpl000004.a.result
deleted file mode 100644
index 694d7429a14..00000000000
--- a/mysql-test/r/rpl000004.a.result
+++ /dev/null
@@ -1,2 +0,0 @@
-Table Op Msg_type Msg_text
-test.t1 check status OK
diff --git a/mysql-test/r/rpl000004.b.result b/mysql-test/r/rpl000004.b.result
deleted file mode 100644
index 7e05933909e..00000000000
--- a/mysql-test/r/rpl000004.b.result
+++ /dev/null
@@ -1,2 +0,0 @@
-count(*)
-10
diff --git a/mysql-test/r/rpl000004.result b/mysql-test/r/rpl000004.result
deleted file mode 100644
index e25a48939e3..00000000000
--- a/mysql-test/r/rpl000004.result
+++ /dev/null
@@ -1,28 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-set SQL_LOG_BIN=0;
-create table t1 (word char(20) not null, index(word));
-load data infile '../std_data_ln/words.dat' into table t1;
-create table t2 (word char(20) not null);
-load data infile '../std_data_ln/words.dat' into table t2;
-create table t3 (word char(20) not null primary key);
-load table t1 from master;
-load table t2 from master;
-load table t3 from master;
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-select count(*) from t2;
-count(*)
-70
-select count(*) from t3;
-count(*)
-0
-set SQL_LOG_BIN=1;
-drop table if exists t1,t2,t3;
-create table t1(n int);
-drop table t1;
diff --git a/mysql-test/r/rpl000006.result b/mysql-test/r/rpl000006.result
deleted file mode 100644
index e4c2006c2f0..00000000000
--- a/mysql-test/r/rpl000006.result
+++ /dev/null
@@ -1,29 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-set SQL_LOG_BIN=0,timestamp=200006;
-create table t1(t timestamp not null,a char(1));
-insert into t1 ( a) values ('F');
-select unix_timestamp(t) from t1;
-unix_timestamp(t)
-200006
-load table t1 from master;
-select unix_timestamp(t) from t1;
-unix_timestamp(t)
-200006
-set SQL_LOG_BIN=1,timestamp=default;
-drop table t1;
-set SQL_LOG_BIN=0;
-CREATE TABLE t1 (
-a int not null
-) ENGINE=MyISAM MAX_ROWS=4000 CHECKSUM=1;
-INSERT INTO t1 VALUES (1);
-load table t1 from master;
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-drop table t1;
-drop table t1;
diff --git a/mysql-test/r/rpl000017.result b/mysql-test/r/rpl000017.result
index 7a283699370..1c611357e64 100644
--- a/mysql-test/r/rpl000017.result
+++ b/mysql-test/r/rpl000017.result
@@ -1,4 +1,10 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab';
grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab';
start slave;
diff --git a/mysql-test/r/rpl000015.result b/mysql-test/r/rpl_000015.result
index e33201ced93..a2763d4f023 100644
--- a/mysql-test/r/rpl000015.result
+++ b/mysql-test/r/rpl_000015.result
@@ -1,7 +1,7 @@
reset master;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 98
+master-bin.000001 102
reset slave;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
@@ -17,11 +17,16 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File
start slave;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 7 master-bin.000001 98 # # master-bin.000001 Yes Yes 0 0 98 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 7 master-bin.000001 102 # # master-bin.000001 Yes Yes 0 0 102 # None 0 No #
drop table if exists t1;
-create table t1 (n int);
+create table t1 (n int, PRIMARY KEY(n));
insert into t1 values (10),(45),(90);
-select * from t1;
+SELECT * FROM t1 ORDER BY n;
+n
+10
+45
+90
+SELECT * FROM t1 ORDER BY n;
n
10
45
diff --git a/mysql-test/r/rpl_EE_err.result b/mysql-test/r/rpl_EE_err.result
new file mode 100644
index 00000000000..16fa931e303
--- /dev/null
+++ b/mysql-test/r/rpl_EE_err.result
@@ -0,0 +1,11 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int) engine=myisam;
+flush tables;
+drop table if exists t1;
+Warnings:
+Error 2 Can't find file: 't1' (errno: 2)
diff --git a/mysql-test/r/rpl_LD_INFILE.result b/mysql-test/r/rpl_LD_INFILE.result
new file mode 100644
index 00000000000..70013f95d85
--- /dev/null
+++ b/mysql-test/r/rpl_LD_INFILE.result
@@ -0,0 +1,117 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a));
+LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1;
+DELETE FROM test.t1 WHERE a = 'abashed';
+DELETE FROM test.t1;
+LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1;
+SELECT * FROM test.t1 ORDER BY a DESC;
+a
+aberration
+aberrant
+Abernathy
+Aberdeen
+Abelson
+Abelian
+Abel
+abed
+Abe
+abducts
+abductors
+abductor
+abductions
+abduction
+abducted
+abduct
+abdominal
+abdomens
+abdomen
+Abby
+abbreviations
+abbreviation
+abbreviating
+abbreviates
+abbreviated
+abbreviate
+Abbott
+abbots
+abbot
+abbeys
+abbey
+abbe
+Abba
+abating
+abates
+abater
+abatements
+abatement
+abated
+abate
+abasing
+abashing
+abashes
+abashed
+abash
+abases
+abasements
+abasement
+abased
+abase
+SELECT * FROM test.t1 ORDER BY a DESC;
+a
+aberration
+aberrant
+Abernathy
+Aberdeen
+Abelson
+Abelian
+Abel
+abed
+Abe
+abducts
+abductors
+abductor
+abductions
+abduction
+abducted
+abduct
+abdominal
+abdomens
+abdomen
+Abby
+abbreviations
+abbreviation
+abbreviating
+abbreviates
+abbreviated
+abbreviate
+Abbott
+abbots
+abbot
+abbeys
+abbey
+abbe
+Abba
+abating
+abates
+abater
+abatements
+abatement
+abated
+abate
+abasing
+abashing
+abashes
+abashed
+abash
+abases
+abasements
+abasement
+abased
+abase
+DROP TABLE test.t1;
diff --git a/mysql-test/r/rpl_alter_db.result b/mysql-test/r/rpl_alter_db.result
new file mode 100644
index 00000000000..6edbe5d427f
--- /dev/null
+++ b/mysql-test/r/rpl_alter_db.result
@@ -0,0 +1,8 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+use mysql;
+alter database collate latin1_bin;
diff --git a/mysql-test/r/rpl_auto_increment.result b/mysql-test/r/rpl_auto_increment.result
index ea4815e5e64..083f3a4e901 100644
--- a/mysql-test/r/rpl_auto_increment.result
+++ b/mysql-test/r/rpl_auto_increment.result
@@ -126,7 +126,7 @@ a
504
set @@insert_id=600;
insert into t1 values(600),(NULL),(NULL);
-ERROR 23000: Duplicate entry '600' for key 1
+ERROR 23000: Duplicate entry '600' for key 'PRIMARY'
set @@insert_id=600;
insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL);
select * from t1;
@@ -190,7 +190,7 @@ set auto_increment_offset=4;
insert into t1 values(null);
insert into t1 values(null);
insert into t1 values(null);
-ERROR 23000: Duplicate entry '125' for key 1
+ERROR 23000: Duplicate entry '125' for key 'PRIMARY'
select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t1 order by a;
a mod(a-@@auto_increment_offset,@@auto_increment_increment)
103 0
@@ -202,7 +202,7 @@ set auto_increment_offset=1;
set insert_id=1000;
insert into t2 values(null);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t2 order by a;
a mod(a-@@auto_increment_offset,@@auto_increment_increment)
251 0
@@ -211,7 +211,7 @@ set auto_increment_increment=1000;
set auto_increment_offset=700;
insert into t3 values(null);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
select * from t3 order by a;
a
127
diff --git a/mysql-test/r/rpl_bit.result b/mysql-test/r/rpl_bit.result
new file mode 100644
index 00000000000..924de8a65f8
--- /dev/null
+++ b/mysql-test/r/rpl_bit.result
@@ -0,0 +1,138 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1 (
+dummyKey INTEGER NOT NULL,
+f01 TINYINT,
+f10 TINYINT,
+f12 TINYINT,
+f15 TINYINT,
+f16 TINYINT,
+f7 TINYINT,
+f9 TINYINT,
+f29 TINYINT,
+f0 TINYINT,
+fA1 TINYINT,
+C32 TINYINT,
+A42 TINYINT,
+CA3 TINYINT,
+A044 TINYINT,
+f001 TINYINT,
+A3002 TINYINT,
+fC003 TINYINT,
+CA300 TINYINT,
+A305 TINYINT,
+CA321 TINYINT,
+r001 TINYINT,
+bit1 BIT(6),
+bit2 BIT(6),
+bit3 BIT(6),
+State1 TINYINT,
+State2 TINYINT,
+State3 TINYINT,
+State4 TINYINT,
+SubState TINYINT,
+gState TINYINT,
+oSupp TINYINT,
+tSupp TINYINT,
+sSuppD TINYINT,
+mSuppf TINYINT,
+GSuppDf TINYINT,
+VNotSupp TINYINT,
+x034 TINYINT,
+PRIMARY KEY USING HASH (dummyKey) );
+LOCK TABLES test.t1 WRITE;
+INSERT INTO test.t1 VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'111110',b'110101',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'100100',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'101010',b'010101',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'101010',b'111111',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+UNLOCK TABLES;
+SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1;
+oSupp sSuppD GSuppDf VNotSupp x034
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+SELECT hex(bit1) FROM test.t1 ORDER BY bit1;
+hex(bit1)
+0
+0
+0
+0
+0
+2A
+3F
+3F
+SELECT hex(bit2) from test.t1 ORDER BY bit2;
+hex(bit2)
+0
+1
+1
+1
+1
+2A
+3E
+3F
+SELECT hex(bit3) from test.t1 ORDER BY bit3;
+hex(bit3)
+0
+1
+1
+1
+1
+15
+24
+35
+SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1;
+oSupp sSuppD GSuppDf VNotSupp x034
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+SELECT hex(bit1) FROM test.t1 ORDER BY bit1;
+hex(bit1)
+0
+0
+0
+0
+0
+2A
+3F
+3F
+SELECT hex(bit2) from test.t1 ORDER BY bit2;
+hex(bit2)
+0
+1
+1
+1
+1
+2A
+3E
+3F
+SELECT hex(bit3) from test.t1 ORDER BY bit3;
+hex(bit3)
+0
+1
+1
+1
+1
+15
+24
+35
+DROP TABLE IF EXISTS test.t1;
diff --git a/mysql-test/r/rpl_bit_npk.result b/mysql-test/r/rpl_bit_npk.result
new file mode 100644
index 00000000000..9599660f18f
--- /dev/null
+++ b/mysql-test/r/rpl_bit_npk.result
@@ -0,0 +1,169 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1 (
+dummyKey INTEGER NOT NULL,
+f01 TINYINT,
+f10 TINYINT,
+f12 TINYINT,
+f15 TINYINT,
+f16 TINYINT,
+f7 TINYINT,
+f9 TINYINT,
+f29 TINYINT,
+f0 TINYINT,
+fA1 TINYINT,
+C32 TINYINT,
+A42 TINYINT,
+CA3 TINYINT,
+A044 TINYINT,
+f001 TINYINT,
+A3002 TINYINT,
+fC003 TINYINT,
+CA300 TINYINT,
+A305 TINYINT,
+CA321 TINYINT,
+r001 TINYINT,
+bit1 BIT(6),
+bit2 BIT(6),
+bit3 BIT(6),
+State1 TINYINT,
+State2 TINYINT,
+State3 TINYINT,
+State4 TINYINT,
+SubState TINYINT,
+gState TINYINT,
+oSupp TINYINT,
+tSupp TINYINT,
+sSuppD TINYINT,
+mSuppf TINYINT,
+GSuppDf TINYINT,
+VNotSupp TINYINT,
+x034 TINYINT);
+LOCK TABLES test.t1 WRITE;
+INSERT INTO test.t1 VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'111110',b'110101',4,5,5,5,5,5,5,5,5,5,3,NULL,1);
+INSERT INTO test.t1 VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'100100',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'101010',b'010101',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'101010',b'111111',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'0',1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+UNLOCK TABLES;
+UPDATE test.t1 set x034 = 50 where bit3 = b'000000';
+UPDATE test.t1 set VNotSupp = 33 where bit1 = b'0';
+SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034
+FROM test.t1
+ORDER BY oSupp, sSuppD, GSuppDf, VNotSupp, x034;
+oSupp sSuppD GSuppDf VNotSupp x034
+5 5 3 NULL 1
+5 5 3 2 1
+5 5 3 2 50
+5 5 3 33 1
+5 5 3 33 1
+5 5 3 33 1
+5 5 3 33 1
+5 5 3 33 1
+SELECT hex(bit1) from test.t1 ORDER BY bit1;
+hex(bit1)
+0
+0
+0
+0
+0
+2A
+3F
+3F
+SELECT hex(bit2) from test.t1 ORDER BY bit2;
+hex(bit2)
+0
+1
+1
+1
+1
+2A
+3E
+3F
+SELECT hex(bit3) from test.t1 ORDER BY bit3;
+hex(bit3)
+0
+1
+1
+1
+1
+15
+24
+35
+SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034
+FROM test.t1
+ORDER BY oSupp, sSuppD, GSuppDf, VNotSupp, x034;
+oSupp sSuppD GSuppDf VNotSupp x034
+5 5 3 NULL 1
+5 5 3 2 1
+5 5 3 2 50
+5 5 3 33 1
+5 5 3 33 1
+5 5 3 33 1
+5 5 3 33 1
+5 5 3 33 1
+SELECT hex(bit1) from test.t1 ORDER BY bit1;
+hex(bit1)
+0
+0
+0
+0
+0
+2A
+3F
+3F
+SELECT hex(bit2) from test.t1 ORDER BY bit2;
+hex(bit2)
+0
+1
+1
+1
+1
+2A
+3E
+3F
+SELECT hex(bit3) from test.t1 ORDER BY bit3;
+hex(bit3)
+0
+1
+1
+1
+1
+15
+24
+35
+CREATE TABLE test.t2 (a INT, b BIT(1));
+INSERT INTO test.t2 VALUES (1, b'0');
+INSERT INTO test.t2 VALUES (1, b'1');
+UPDATE test.t2 SET a = 2 WHERE b = b'1';
+CREATE TABLE test.t3 (a INT, b INT);
+INSERT INTO test.t3 VALUES (1, NULL);
+INSERT INTO test.t3 VALUES (1, 0);
+UPDATE test.t3 SET a = 2 WHERE b = 0;
+SELECT a, hex(b) FROM test.t2 ORDER BY a,b;
+a hex(b)
+1 0
+2 1
+SELECT * FROM test.t3 ORDER BY a,b;
+a b
+1 NULL
+2 0
+SELECT a, hex(b) FROM test.t2 ORDER BY a,b;
+a hex(b)
+1 0
+2 1
+SELECT * FROM test.t3 ORDER BY a,b;
+a b
+1 NULL
+2 0
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
diff --git a/mysql-test/r/rpl_change_master.result b/mysql-test/r/rpl_change_master.result
index 7f2ba568fb3..513de9494ba 100644
--- a/mysql-test/r/rpl_change_master.result
+++ b/mysql-test/r/rpl_change_master.result
@@ -13,11 +13,11 @@ insert into t1 values(2);
stop slave;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 357 # # master-bin.000001 No No 0 0 183 # None 0 No #
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 187 # None 0 No #
change master to master_user='root';
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 183 # # master-bin.000001 No No 0 0 183 # None 0 No #
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 187 # None 0 No #
start slave;
select * from t1;
n
diff --git a/mysql-test/r/rpl_commit_after_flush.result b/mysql-test/r/rpl_commit_after_flush.result
index d3aba779219..eaddda63b6a 100644
--- a/mysql-test/r/rpl_commit_after_flush.result
+++ b/mysql-test/r/rpl_commit_after_flush.result
@@ -4,7 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-create table t1 (a int) engine=innodb;
+CREATE TABLE t1 (a INT) ENGINE=innodb;
begin;
insert into t1 values(1);
flush tables with read lock;
diff --git a/mysql-test/r/rpl_create_database.result b/mysql-test/r/rpl_create_database.result
index ca4585d0d8d..0593501f623 100644
--- a/mysql-test/r/rpl_create_database.result
+++ b/mysql-test/r/rpl_create_database.result
@@ -23,6 +23,7 @@ ALTER DATABASE mysqltest_bob CHARACTER SET latin1;
SHOW DATABASES;
Database
information_schema
+cluster
mysql
mysqltest_bob
mysqltest_prometheus
@@ -31,6 +32,7 @@ test
SHOW DATABASES;
Database
information_schema
+cluster
mysql
mysqltest_prometheus
mysqltest_sisyfos
@@ -42,24 +44,10 @@ INSERT INTO t1 VALUES (1);
CREATE DATABASE mysqltest_sisyfos;
USE mysqltest_sisyfos;
CREATE TABLE t2 (a INT);
-SHOW BINLOG EVENTS;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
-master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS mysqltest_prometheus
-master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS mysqltest_sisyfos
-master-bin.000001 # Query 1 # CREATE DATABASE mysqltest_prometheus
-master-bin.000001 # Query 1 # CREATE DATABASE mysqltest_sisyfos
-master-bin.000001 # Query 1 # use `mysqltest_sisyfos`; CREATE TABLE t1 (b int)
-master-bin.000001 # Query 1 # use `mysqltest_sisyfos`; INSERT INTO t1 VALUES(1)
-master-bin.000001 # Query 1 # ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1
-master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS mysqltest_sisyfos
-master-bin.000001 # Query 1 # use `mysqltest_prometheus`; CREATE TABLE t1 (a INT)
-master-bin.000001 # Query 1 # use `mysqltest_prometheus`; INSERT INTO t1 VALUES (1)
-master-bin.000001 # Query 1 # CREATE DATABASE mysqltest_sisyfos
-master-bin.000001 # Query 1 # use `mysqltest_sisyfos`; CREATE TABLE t2 (a INT)
SHOW DATABASES;
Database
information_schema
+cluster
mysql
mysqltest_bob
mysqltest_prometheus
@@ -68,20 +56,19 @@ test
SHOW DATABASES;
Database
information_schema
+cluster
mysql
mysqltest_prometheus
mysqltest_sisyfos
test
-SHOW CREATE TABLE mysqltest_prometheus.t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-SHOW CREATE TABLE mysqltest_sisyfos.t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
+USE mysqltest_prometheus;
+SHOW TABLES;
+Tables_in_mysqltest_prometheus
+t1
+USE mysqltest_sisyfos;
+SHOW TABLES;
+Tables_in_mysqltest_sisyfos
+t2
DROP DATABASE IF EXISTS mysqltest_prometheus;
DROP DATABASE IF EXISTS mysqltest_sisyfos;
DROP DATABASE IF EXISTS mysqltest_bob;
diff --git a/mysql-test/r/rpl_ddl.result b/mysql-test/r/rpl_ddl.result
index 92e91b31459..ace86532b12 100644
--- a/mysql-test/r/rpl_ddl.result
+++ b/mysql-test/r/rpl_ddl.result
@@ -10,28 +10,28 @@ DROP DATABASE IF EXISTS mysqltest2;
DROP DATABASE IF EXISTS mysqltest3;
CREATE DATABASE mysqltest1;
CREATE DATABASE mysqltest2;
-CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE= "InnoDB";
+CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE="InnoDB";
INSERT INTO mysqltest1.t1 SET f1= 0;
-CREATE TABLE mysqltest1.t2 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t3 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t4 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t5 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t6 (f1 BIGINT) ENGINE= "InnoDB";
+CREATE TABLE mysqltest1.t2 (f1 BIGINT) ENGINE="InnoDB";
+CREATE TABLE mysqltest1.t3 (f1 BIGINT) ENGINE="InnoDB";
+CREATE TABLE mysqltest1.t4 (f1 BIGINT) ENGINE="InnoDB";
+CREATE TABLE mysqltest1.t5 (f1 BIGINT) ENGINE="InnoDB";
+CREATE TABLE mysqltest1.t6 (f1 BIGINT) ENGINE="InnoDB";
CREATE INDEX my_idx6 ON mysqltest1.t6(f1);
-CREATE TABLE mysqltest1.t7 (f1 BIGINT) ENGINE= "InnoDB";
+CREATE TABLE mysqltest1.t7 (f1 BIGINT) ENGINE="InnoDB";
INSERT INTO mysqltest1.t7 SET f1= 0;
-CREATE TABLE mysqltest1.t8 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t9 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t10 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t11 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t12 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t13 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t14 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t15 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t16 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t17 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t18 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t19 (f1 BIGINT) ENGINE= "InnoDB";
+CREATE TABLE mysqltest1.t8 (f1 BIGINT) ENGINE="InnoDB";
+CREATE TABLE mysqltest1.t9 (f1 BIGINT) ENGINE="InnoDB";
+CREATE TABLE mysqltest1.t10 (f1 BIGINT) ENGINE="InnoDB";
+CREATE TABLE mysqltest1.t11 (f1 BIGINT) ENGINE="InnoDB";
+CREATE TABLE mysqltest1.t12 (f1 BIGINT) ENGINE="InnoDB";
+CREATE TABLE mysqltest1.t13 (f1 BIGINT) ENGINE="InnoDB";
+CREATE TABLE mysqltest1.t14 (f1 BIGINT) ENGINE="InnoDB";
+CREATE TABLE mysqltest1.t15 (f1 BIGINT) ENGINE="InnoDB";
+CREATE TABLE mysqltest1.t16 (f1 BIGINT) ENGINE="InnoDB";
+CREATE TABLE mysqltest1.t17 (f1 BIGINT) ENGINE="InnoDB";
+CREATE TABLE mysqltest1.t18 (f1 BIGINT) ENGINE="InnoDB";
+CREATE TABLE mysqltest1.t19 (f1 BIGINT) ENGINE="InnoDB";
CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT);
SET AUTOCOMMIT = 0;
use mysqltest1;
@@ -359,8 +359,6 @@ MAX(f1)
-------- switch to master -------
ROLLBACK;
-Warnings:
-Warning 1196 Some non-transactional changed tables couldn't be rolled back
SELECT MAX(f1) FROM t1;
MAX(f1)
5
@@ -579,8 +577,6 @@ MAX(f1)
-------- switch to master -------
ROLLBACK;
-Warnings:
-Warning 1196 Some non-transactional changed tables couldn't be rolled back
SELECT MAX(f1) FROM t1;
MAX(f1)
8
@@ -650,11 +646,9 @@ flush logs;
-------- switch to master -------
SELECT * FROM mysqltest1.t7;
f1
-
-------- switch to slave --------
SELECT * FROM mysqltest1.t7;
f1
-
-------- switch to master -------
######## LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ ########
diff --git a/mysql-test/r/rpl_deadlock.result b/mysql-test/r/rpl_deadlock_innodb.result
index 63b15bc1a1f..a384be6eb37 100644
--- a/mysql-test/r/rpl_deadlock.result
+++ b/mysql-test/r/rpl_deadlock_innodb.result
@@ -4,10 +4,10 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-create table t1 (a int not null, key(a)) engine=innodb;
-create table t2 (a int not null, key(a)) engine=innodb;
-create table t3 (a int) engine=innodb;
-create table t4 (a int) engine=innodb;
+CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=innodb;
+CREATE TABLE t2 (a INT NOT NULL, KEY(a)) ENGINE=innodb;
+CREATE TABLE t3 (a INT) ENGINE=innodb;
+CREATE TABLE t4 (a INT) ENGINE=innodb;
show variables like 'slave_transaction_retries';
Variable_name Value
slave_transaction_retries 10
@@ -50,7 +50,7 @@ Master_User root
Master_Port MASTER_MYPORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 18911
+Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -59,13 +59,13 @@ Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
-Replicate_Ignore_Table
+Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 18911
+Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -78,7 +78,7 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
stop slave;
-change master to master_log_pos=532;
+change master to master_log_pos=536;
begin;
select * from t2 for update;
a
@@ -99,7 +99,7 @@ Master_User root
Master_Port MASTER_MYPORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 18911
+Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -108,13 +108,13 @@ Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
-Replicate_Ignore_Table
+Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 18911
+Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -129,7 +129,7 @@ Seconds_Behind_Master #
set @my_max_relay_log_size= @@global.max_relay_log_size;
set global max_relay_log_size=0;
stop slave;
-change master to master_log_pos=532;
+change master to master_log_pos=536;
begin;
select * from t2 for update;
a
@@ -151,7 +151,7 @@ Master_User root
Master_Port MASTER_MYPORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 18911
+Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -160,13 +160,13 @@ Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
-Replicate_Ignore_Table
+Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 18911
+Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
diff --git a/mysql-test/r/rpl_delete_no_where.result b/mysql-test/r/rpl_delete_no_where.result
new file mode 100644
index 00000000000..78edf4bf3fa
--- /dev/null
+++ b/mysql-test/r/rpl_delete_no_where.result
@@ -0,0 +1,15 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int, b int) engine=myisam;
+insert into t1 values(1,1);
+select * from t1;
+a b
+1 1
+delete from t1;
+select * from t1;
+a b
+drop table t1;
diff --git a/mysql-test/r/rpl_do_grant.result b/mysql-test/r/rpl_do_grant.result
index ff3e059503c..8bf8e615448 100644
--- a/mysql-test/r/rpl_do_grant.result
+++ b/mysql-test/r/rpl_do_grant.result
@@ -24,3 +24,55 @@ delete from mysql.user where user=_binary'rpl_do_grant';
delete from mysql.db where user=_binary'rpl_do_grant';
flush privileges;
flush privileges;
+show grants for rpl_do_grant@localhost;
+ERROR 42000: There is no such grant defined for user 'rpl_do_grant' on host 'localhost'
+show grants for rpl_do_grant@localhost;
+ERROR 42000: There is no such grant defined for user 'rpl_do_grant' on host 'localhost'
+create user rpl_do_grant@localhost;
+show grants for rpl_do_grant@localhost;
+Grants for rpl_do_grant@localhost
+GRANT USAGE ON *.* TO 'rpl_do_grant'@'localhost'
+show grants for rpl_do_grant2@localhost;
+ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost'
+show grants for rpl_do_grant@localhost;
+Grants for rpl_do_grant@localhost
+GRANT USAGE ON *.* TO 'rpl_do_grant'@'localhost'
+show grants for rpl_do_grant2@localhost;
+ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost'
+rename user rpl_do_grant@localhost to rpl_do_grant2@localhost;
+show grants for rpl_do_grant2@localhost;
+Grants for rpl_do_grant2@localhost
+GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+show grants for rpl_do_grant2@localhost;
+Grants for rpl_do_grant2@localhost
+GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+grant DELETE,INSERT on mysqltest1.* to rpl_do_grant2@localhost;
+show grants for rpl_do_grant2@localhost;
+Grants for rpl_do_grant2@localhost
+GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+GRANT INSERT, DELETE ON `mysqltest1`.* TO 'rpl_do_grant2'@'localhost'
+show grants for rpl_do_grant2@localhost;
+Grants for rpl_do_grant2@localhost
+GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+GRANT INSERT, DELETE ON `mysqltest1`.* TO 'rpl_do_grant2'@'localhost'
+revoke DELETE on mysqltest1.* from rpl_do_grant2@localhost;
+show grants for rpl_do_grant2@localhost;
+Grants for rpl_do_grant2@localhost
+GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+GRANT INSERT ON `mysqltest1`.* TO 'rpl_do_grant2'@'localhost'
+show grants for rpl_do_grant2@localhost;
+Grants for rpl_do_grant2@localhost
+GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+GRANT INSERT ON `mysqltest1`.* TO 'rpl_do_grant2'@'localhost'
+revoke all privileges, grant option from rpl_do_grant2@localhost;
+show grants for rpl_do_grant2@localhost;
+Grants for rpl_do_grant2@localhost
+GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+show grants for rpl_do_grant2@localhost;
+Grants for rpl_do_grant2@localhost
+GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+drop user rpl_do_grant2@localhost;
+show grants for rpl_do_grant2@localhost;
+ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost'
+show grants for rpl_do_grant2@localhost;
+ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost'
diff --git a/mysql-test/r/rpl_drop_db.result b/mysql-test/r/rpl_drop_db.result
index 97a24d980b6..89b33ea262e 100644
--- a/mysql-test/r/rpl_drop_db.result
+++ b/mysql-test/r/rpl_drop_db.result
@@ -31,7 +31,9 @@ use test;
select * from t1;
n
1234
-drop table t1;
+DROP DATABASE mysqltest1;
stop slave;
drop database mysqltest1;
drop database mysqltest1;
+use test;
+drop table t1;
diff --git a/mysql-test/r/rpl_drop_temp.result b/mysql-test/r/rpl_drop_temp.result
index 04fe094ea26..40d578dd13e 100644
--- a/mysql-test/r/rpl_drop_temp.result
+++ b/mysql-test/r/rpl_drop_temp.result
@@ -5,8 +5,8 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create database if not exists mysqltest;
-create temporary table mysqltest.t1 (n int);
-create temporary table mysqltest.t2 (n int);
+create temporary table mysqltest.t1 (n int)ENGINE=MyISAM;
+create temporary table mysqltest.t2 (n int)ENGINE=MyISAM;
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0
diff --git a/mysql-test/r/rpl_err_ignoredtable.result b/mysql-test/r/rpl_err_ignoredtable.result
new file mode 100644
index 00000000000..f211d5d9a2f
--- /dev/null
+++ b/mysql-test/r/rpl_err_ignoredtable.result
@@ -0,0 +1,42 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int primary key);
+create table t4 (a int primary key);
+insert into t1 values (1),(1);
+Got one of the listed errors
+insert into t4 values (1),(2);
+show tables like 't1';
+Tables_in_test (t1)
+show tables like 't4';
+Tables_in_test (t4)
+t4
+SELECT * FROM test.t4 ORDER BY a;
+a
+1
+2
+drop table t1;
+select get_lock('crash_lock%20C', 10);
+get_lock('crash_lock%20C', 10)
+1
+create table t2 (a int primary key);
+insert into t2 values(1);
+create table t3 (id int);
+insert into t3 values(connection_id());
+update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
+select (@id := id) - id from t3;
+(@id := id) - id
+0
+kill @id;
+drop table t2,t3;
+insert into t4 values (3),(4);
+SELECT * FROM test.t4 ORDER BY a;
+a
+1
+2
+3
+4
+DROP TABLE test.t4;
diff --git a/mysql-test/r/rpl_failed_optimize.result b/mysql-test/r/rpl_failed_optimize.result
index c2c07dc6343..ec0b3856ae7 100644
--- a/mysql-test/r/rpl_failed_optimize.result
+++ b/mysql-test/r/rpl_failed_optimize.result
@@ -18,4 +18,8 @@ Table Op Msg_type Msg_text
test.non_existing optimize error Table 'test.non_existing' doesn't exist
Warnings:
Error 1146 Table 'test.non_existing' doesn't exist
+select * from t1;
+a
+1
+commit;
drop table t1;
diff --git a/mysql-test/r/rpl_flush_log_loop.result b/mysql-test/r/rpl_flush_log_loop.result
deleted file mode 100644
index f9bd42ec26c..00000000000
--- a/mysql-test/r/rpl_flush_log_loop.result
+++ /dev/null
@@ -1,17 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
-change master to master_host='127.0.0.1',master_user='root',
-master_password='',master_port=MASTER_PORT;
-start slave;
-change master to master_host='127.0.0.1',master_user='root',
-master_password='',master_port=SLAVE_PORT;
-start slave;
-flush logs;
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 208 # # slave-bin.000001 Yes Yes 0 0 208 # None 0 No #
diff --git a/mysql-test/r/rpl_flush_tables.result b/mysql-test/r/rpl_flush_tables.result
deleted file mode 100644
index 7d0bc54ae31..00000000000
--- a/mysql-test/r/rpl_flush_tables.result
+++ /dev/null
@@ -1,47 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-create table t1 (a int);
-insert into t1 values (10);
-create table t2 (a int);
-create table t3 (a int) engine=merge union(t1);
-create table t4 (a int);
-insert into t4 select * from t3;
-rename table t1 to t5, t2 to t1;
-flush no_write_to_binlog tables;
-show binlog events;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Format_desc 1 # Server ver: SERVER_VERSION, Binlog ver: 4
-master-bin.000001 # Query 1 # use `test`; create table t1 (a int)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values (10)
-master-bin.000001 # Query 1 # use `test`; create table t2 (a int)
-master-bin.000001 # Query 1 # use `test`; create table t3 (a int) engine=merge union(t1)
-master-bin.000001 # Query 1 # use `test`; create table t4 (a int)
-master-bin.000001 # Query 1 # use `test`; insert into t4 select * from t3
-master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1
-select * from t3;
-a
-flush tables;
-show binlog events;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Format_desc 1 # Server ver: SERVER_VERSION, Binlog ver: 4
-master-bin.000001 # Query 1 # use `test`; create table t1 (a int)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values (10)
-master-bin.000001 # Query 1 # use `test`; create table t2 (a int)
-master-bin.000001 # Query 1 # use `test`; create table t3 (a int) engine=merge union(t1)
-master-bin.000001 # Query 1 # use `test`; create table t4 (a int)
-master-bin.000001 # Query 1 # use `test`; insert into t4 select * from t3
-master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1
-master-bin.000001 # Query 1 # use `test`; flush tables
-select * from t3;
-a
-stop slave;
-drop table t1;
-flush tables with read lock;
-start slave;
-stop slave;
-ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
-drop table t3, t4, t5;
diff --git a/mysql-test/r/rpl_flushlog_loop.result b/mysql-test/r/rpl_flushlog_loop.result
new file mode 100644
index 00000000000..16d8ba251f4
--- /dev/null
+++ b/mysql-test/r/rpl_flushlog_loop.result
@@ -0,0 +1,53 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+change master to master_host='127.0.0.1',master_user='root',
+master_password='',master_port=MASTER_PORT;
+start slave;
+stop slave;
+change master to master_host='127.0.0.1',master_user='root',
+master_password='',master_port=SLAVE_PORT;
+start slave;
+
+let $result_pattern= '%127.0.0.1%root%slave-bin.000001%slave-bin.000001%Yes%Yes%0%0%None%' ;
+
+--source include/wait_slave_status.inc
+flush logs;
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port SLAVE_PORT
+Connect_Retry 60
+Master_Log_File slave-bin.000001
+Read_Master_Log_Pos 212
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File slave-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 212
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
diff --git a/mysql-test/r/rpl_foreign_key_innodb.result b/mysql-test/r/rpl_foreign_key_innodb.result
new file mode 100644
index 00000000000..2239c32eea3
--- /dev/null
+++ b/mysql-test/r/rpl_foreign_key_innodb.result
@@ -0,0 +1,42 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (a INT AUTO_INCREMENT KEY) ENGINE=INNODB;
+CREATE TABLE t2 (b INT AUTO_INCREMENT KEY, c INT, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE=INNODB;
+SET FOREIGN_KEY_CHECKS=0;
+INSERT INTO t1 VALUES (10);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL);
+INSERT INTO t2 VALUES (5,0);
+INSERT INTO t2 VALUES (NULL,LAST_INSERT_ID());
+SET FOREIGN_KEY_CHECKS=1;
+SELECT * FROM t1 ORDER BY a;
+a
+10
+11
+12
+13
+SELECT * FROM t2 ORDER BY b;
+b c
+5 0
+6 11
+SELECT * FROM t1 ORDER BY a;
+a
+10
+11
+12
+13
+SELECT * FROM t2 ORDER BY b;
+b c
+5 0
+6 11
+SET TIMESTAMP=1000000000;
+CREATE TABLE t3 ( a INT UNIQUE );
+SET FOREIGN_KEY_CHECKS=0;
+INSERT INTO t3 VALUES (1),(1);
+Got one of the listed errors
+SET FOREIGN_KEY_CHECKS=0;
+DROP TABLE IF EXISTS t1,t2,t3;
+SET FOREIGN_KEY_CHECKS=1;
diff --git a/mysql-test/r/rpl_get_lock.result b/mysql-test/r/rpl_get_lock.result
index da300d99964..235640acad0 100644
--- a/mysql-test/r/rpl_get_lock.result
+++ b/mysql-test/r/rpl_get_lock.result
@@ -22,8 +22,8 @@ select is_free_lock("lock"), is_used_lock("lock") = connection_id();
is_free_lock("lock") is_used_lock("lock") = connection_id()
0 1
explain extended select is_free_lock("lock"), is_used_lock("lock");
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select is_free_lock(_latin1'lock') AS `is_free_lock("lock")`,is_used_lock(_latin1'lock') AS `is_used_lock("lock")`
select is_free_lock("lock2");
diff --git a/mysql-test/r/rpl000008.result b/mysql-test/r/rpl_ignore_table_update.result
index a88a3c690ed..a88a3c690ed 100644
--- a/mysql-test/r/rpl000008.result
+++ b/mysql-test/r/rpl_ignore_table_update.result
diff --git a/mysql-test/r/rpl_insert.result b/mysql-test/r/rpl_insert.result
new file mode 100644
index 00000000000..b6a97926f73
--- /dev/null
+++ b/mysql-test/r/rpl_insert.result
@@ -0,0 +1,23 @@
+#
+# Bug#20821: INSERT DELAYED fails to write some rows to binlog
+#
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE SCHEMA IF NOT EXISTS mysqlslap;
+USE mysqlslap;
+CREATE TABLE t1 (id INT, name VARCHAR(64));
+SELECT COUNT(*) FROM mysqlslap.t1;
+COUNT(*)
+5000
+SELECT COUNT(*) FROM mysqlslap.t1;
+COUNT(*)
+5000
+#
+# Cleanup
+#
+USE test;
+DROP SCHEMA mysqlslap;
diff --git a/mysql-test/r/rpl_insert_id.result b/mysql-test/r/rpl_insert_id.result
index d133a2ae8ed..63be35b8720 100644
--- a/mysql-test/r/rpl_insert_id.result
+++ b/mysql-test/r/rpl_insert_id.result
@@ -1,12 +1,6 @@
#
# Setup
#
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
use test;
drop table if exists t1, t2, t3;
#
@@ -15,18 +9,24 @@ drop table if exists t1, t2, t3;
#
# We also check how the foreign_key_check variable is replicated
#
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
create table t1(a int auto_increment, key(a));
create table t2(b int auto_increment, c int, key(b));
insert into t1 values (1),(2),(3);
insert into t1 values (null);
insert into t2 values (null,last_insert_id());
-select * from t1;
+select * from t1 ORDER BY a;
a
1
2
3
4
-select * from t2;
+select * from t2 ORDER BY b;
b c
1 4
drop table t1;
@@ -59,21 +59,21 @@ create table t2(b int auto_increment, c int, key(b));
insert into t1 values (10);
insert into t1 values (null),(null),(null);
insert into t2 values (5,0);
-insert into t2 (c) select * from t1;
-select * from t2;
+insert into t2 (c) select * from t1 ORDER BY a;
+select * from t2 ORDER BY b;
b c
5 0
6 10
7 11
8 12
9 13
-select * from t1;
+select * from t1 ORDER BY a;
a
10
11
12
13
-select * from t2;
+select * from t2 ORDER BY b;
b c
5 0
6 10
@@ -90,7 +90,7 @@ SET TIMESTAMP=1000000000;
CREATE TABLE t1 ( a INT UNIQUE );
SET FOREIGN_KEY_CHECKS=0;
INSERT INTO t1 VALUES (1),(1);
-ERROR 23000: Duplicate entry '1' for key 1
+Got one of the listed errors
drop table t1;
#
# Bug#14553: NULL in WHERE resets LAST_INSERT_ID
@@ -111,6 +111,11 @@ drop table t2;
#
# End of 4.1 tests
#
+#
+# BUG#15728: LAST_INSERT_ID function inside a stored function returns 0
+#
+# The solution is not to reset last_insert_id on enter to sub-statement.
+#
drop function if exists bug15728;
drop function if exists bug15728_insert;
drop table if exists t1, t2;
@@ -155,6 +160,14 @@ insert into t1 (last_id) values (bug15728());
select last_insert_id();
last_insert_id()
5
+drop procedure if exists foo;
+create procedure foo()
+begin
+declare res int;
+insert into t2 (last_id) values (bug15728());
+insert into t1 (last_id) values (bug15728());
+end|
+call foo();
select * from t1;
id last_id
1 0
@@ -162,13 +175,29 @@ id last_id
3 2
4 1
5 4
+6 3
select * from t2;
id last_id
1 3
2 4
+3 5
+select * from t1;
+id last_id
+1 0
+2 1
+3 2
+4 1
+5 4
+6 3
+select * from t2;
+id last_id
+1 3
+2 4
+3 5
drop function bug15728;
drop function bug15728_insert;
-drop table t1, t2;
+drop table t1;
+drop procedure foo;
create table t1 (n int primary key auto_increment not null,
b int, unique(b));
set sql_log_bin=0;
@@ -381,6 +410,71 @@ DROP FUNCTION f1;
DROP FUNCTION f2;
DROP FUNCTION f3;
DROP TABLE t1, t2;
-
+#
# End of 5.0 tests
-
+#
+create table t2 (
+id int not null auto_increment,
+last_id int,
+primary key (id)
+);
+truncate table t2;
+create table t1 (id tinyint primary key);
+create function insid() returns int
+begin
+insert into t2 (last_id) values (0);
+return 0;
+end|
+set sql_log_bin=0;
+insert into t2 (id) values(1),(2),(3);
+delete from t2;
+set sql_log_bin=1;
+select insid();
+insid()
+0
+set sql_log_bin=0;
+insert into t2 (id) values(5),(6),(7);
+delete from t2 where id>=5;
+set sql_log_bin=1;
+insert into t1 select insid();
+select * from t1;
+id
+0
+select * from t2;
+id last_id
+4 0
+8 0
+select * from t1;
+id
+0
+select * from t2;
+id last_id
+4 0
+8 0
+drop table t1;
+drop function insid;
+truncate table t2;
+create table t1 (n int primary key auto_increment not null,
+b int, unique(b));
+create procedure foo()
+begin
+insert into t1 values(null,10);
+insert ignore into t1 values(null,10);
+insert ignore into t1 values(null,10);
+insert into t2 values(null,3);
+end|
+call foo();
+select * from t1;
+n b
+1 10
+select * from t2;
+id last_id
+1 3
+select * from t1;
+n b
+1 10
+select * from t2;
+id last_id
+1 3
+drop table t1, t2;
+drop procedure foo;
diff --git a/mysql-test/r/rpl_insert_id_pk.result b/mysql-test/r/rpl_insert_id_pk.result
new file mode 100644
index 00000000000..79815355332
--- /dev/null
+++ b/mysql-test/r/rpl_insert_id_pk.result
@@ -0,0 +1,76 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1(a int auto_increment, primary key(a));
+create table t2(b int auto_increment, c int, primary key(b));
+insert into t1 values (1),(2),(3);
+insert into t1 values (null);
+insert into t2 values (null,last_insert_id());
+select * from t1 ORDER BY a;
+a
+1
+2
+3
+4
+select * from t2 ORDER BY b;
+b c
+1 4
+drop table t1;
+drop table t2;
+create table t1(a int auto_increment, key(a)) engine=innodb;
+create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=innodb;
+SET FOREIGN_KEY_CHECKS=0;
+insert into t1 values (10);
+insert into t1 values (null),(null),(null);
+insert into t2 values (5,0);
+insert into t2 values (null,last_insert_id());
+SET FOREIGN_KEY_CHECKS=1;
+select * from t1;
+a
+10
+11
+12
+13
+select * from t2;
+b c
+5 0
+6 11
+drop table t2;
+drop table t1;
+create table t1(a int auto_increment, primary key(a));
+create table t2(b int auto_increment, c int, primary key(b));
+insert into t1 values (10);
+insert into t1 values (null),(null),(null);
+insert into t2 values (5,0);
+insert into t2 (c) select * from t1 ORDER BY a;
+select * from t2 ORDER BY b;
+b c
+5 0
+6 10
+7 11
+8 12
+9 13
+select * from t1 ORDER BY a;
+a
+10
+11
+12
+13
+select * from t2 ORDER BY b;
+b c
+5 0
+6 10
+7 11
+8 12
+9 13
+drop table t1;
+drop table t2;
+SET TIMESTAMP=1000000000;
+CREATE TABLE t1 ( a INT UNIQUE );
+SET FOREIGN_KEY_CHECKS=0;
+INSERT INTO t1 VALUES (1),(1);
+Got one of the listed errors
+drop table t1;
diff --git a/mysql-test/r/rpl000009.result b/mysql-test/r/rpl_load_from_master.result
index a4dbf54f39b..c279ee6e0aa 100644
--- a/mysql-test/r/rpl000009.result
+++ b/mysql-test/r/rpl_load_from_master.result
@@ -13,11 +13,11 @@ drop database if exists mysqltest3;
create database mysqltest2;
create database mysqltest;
create database mysqltest2;
-create table mysqltest2.foo (n int);
+create table mysqltest2.foo (n int)ENGINE=MyISAM;
insert into mysqltest2.foo values(4);
-create table mysqltest2.foo (n int);
+create table mysqltest2.foo (n int)ENGINE=MyISAM;
insert into mysqltest2.foo values(5);
-create table mysqltest.bar (m int);
+create table mysqltest.bar (m int)ENGINE=MyISAM;
insert into mysqltest.bar values(15);
select mysqltest2.foo.n,mysqltest.bar.m from mysqltest2.foo,mysqltest.bar;
n m
@@ -33,16 +33,17 @@ create database mysqltest;
show databases;
Database
information_schema
+cluster
mysql
mysqltest
mysqltest2
test
-create table mysqltest2.t1(n int, s char(20));
-create table mysqltest2.t2(n int, s text);
+create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM;
+create table mysqltest2.t2(n int, s text)ENGINE=MyISAM;
insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three');
insert into mysqltest2.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen');
-create table mysqltest.t1(n int, s char(20));
-create table mysqltest.t2(n int, s text);
+create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM;
+create table mysqltest.t2(n int, s text)ENGINE=MyISAM;
insert into mysqltest.t1 values (1, 'one test'), (2, 'two test'), (3, 'three test');
insert into mysqltest.t2 values (11, 'eleven test'), (12, 'twelve test'),
(13, 'thirteen test');
@@ -50,25 +51,27 @@ set sql_log_bin = 1;
show databases;
Database
information_schema
+cluster
mysql
test
create database mysqltest2;
-create table mysqltest2.t1(n int, s char(20));
+create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM;
insert into mysqltest2.t1 values (1, 'original foo.t1');
-create table mysqltest2.t3(n int, s char(20));
+create table mysqltest2.t3(n int, s char(20))ENGINE=MyISAM;
insert into mysqltest2.t3 values (1, 'original foo.t3');
create database mysqltest3;
-create table mysqltest3.t1(n int, s char(20));
+create table mysqltest3.t1(n int, s char(20))ENGINE=MyISAM;
insert into mysqltest3.t1 values (1, 'original foo2.t1');
create database mysqltest;
-create table mysqltest.t1(n int, s char(20));
+create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM;
insert into mysqltest.t1 values (1, 'original bar.t1');
-create table mysqltest.t3(n int, s char(20));
+create table mysqltest.t3(n int, s char(20))ENGINE=MyISAM;
insert into mysqltest.t3 values (1, 'original bar.t3');
load data from master;
show databases;
Database
information_schema
+cluster
mysql
mysqltest
mysqltest2
diff --git a/mysql-test/r/rpl_load_table_from_master.result b/mysql-test/r/rpl_load_table_from_master.result
new file mode 100644
index 00000000000..c24f857d829
--- /dev/null
+++ b/mysql-test/r/rpl_load_table_from_master.result
@@ -0,0 +1,51 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+"******************** Test Requirment 1 *************"
+SET SQL_LOG_BIN=0,timestamp=200006;
+CREATE TABLE t1(t TIMESTAMP NOT NULL,a CHAR(1))ENGINE=MyISAM;
+INSERT INTO t1 ( a) VALUE ('F');
+select unix_timestamp(t) from t1;
+unix_timestamp(t)
+200006
+load table t1 from master;
+select unix_timestamp(t) from t1;
+unix_timestamp(t)
+200006
+set SQL_LOG_BIN=1,timestamp=default;
+drop table t1;
+set SQL_LOG_BIN=0;
+"******************** Test Requirment 2 *************"
+CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM MAX_ROWS=4000 CHECKSUM=1;
+INSERT INTO t1 VALUES (1);
+load table t1 from master;
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
+drop table t1;
+set SQL_LOG_BIN=0;
+create table t1 (word char(20) not null, index(word))ENGINE=MyISAM;
+load data infile '../std_data_ln/words.dat' into table t1;
+create table t2 (word char(20) not null)ENGINE=MyISAM;
+load data infile '../std_data_ln/words.dat' into table t2;
+create table t3 (word char(20) not null primary key)ENGINE=MyISAM;
+load table t1 from master;
+load table t2 from master;
+load table t3 from master;
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+select count(*) from t2;
+count(*)
+70
+select count(*) from t3;
+count(*)
+0
+set SQL_LOG_BIN=1;
+drop table if exists t1,t2,t3;
+create table t1(n int);
+drop table t1;
diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result
index d69786c00a1..cae11e98caa 100644
--- a/mysql-test/r/rpl_loaddata.result
+++ b/mysql-test/r/rpl_loaddata.result
@@ -5,8 +5,14 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
reset master;
+select last_insert_id();
+last_insert_id()
+0
create table t1(a int not null auto_increment, b int, primary key(a) );
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+select last_insert_id();
+last_insert_id()
+1
create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
@@ -22,7 +28,7 @@ day id category name
2003-03-22 2416 a bbbbb
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-slave-bin.000001 1272
+slave-bin.000001 1276
drop table t1;
drop table t2;
drop table t3;
@@ -33,7 +39,7 @@ set global sql_slave_skip_counter=1;
start slave;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1789 # # master-bin.000001 Yes Yes 0 0 1789 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1793 # # master-bin.000001 Yes Yes # 0 0 1793 # None 0 No #
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
@@ -43,7 +49,7 @@ change master to master_user='test';
change master to master_user='root';
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1824 # # master-bin.000001 No No 0 0 1824 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1828 # # master-bin.000001 No No # 0 0 1828 # None 0 No #
set global sql_slave_skip_counter=1;
start slave;
set sql_log_bin=0;
@@ -54,14 +60,14 @@ stop slave;
reset slave;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 4 # # No No 0 0 0 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 4 # # No No # 0 0 0 # None 0 No #
reset master;
create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day)) engine=MyISAM;
load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
-ERROR 23000: Duplicate entry '2003-03-22' for key 1
+ERROR 23000: Duplicate entry '2003-03-22' for key 'day'
select * from t2;
day id category name
2003-02-22 2461 b a a a @ %  ' " a
@@ -76,7 +82,7 @@ delete from t2;
load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
-ERROR 23000: Duplicate entry '2003-03-22' for key 1
+ERROR 23000: Duplicate entry '2003-03-22' for key 'day'
drop table t2;
drop table t2;
drop table t1;
diff --git a/mysql-test/r/rpl_loaddata2.result b/mysql-test/r/rpl_loaddata2.result
new file mode 100644
index 00000000000..196093211b6
--- /dev/null
+++ b/mysql-test/r/rpl_loaddata2.result
@@ -0,0 +1,153 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (word CHAR(20) NOT NULL);
+LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
+SELECT * FROM t1 ORDER BY word;
+word
+Aarhus
+Aarhus
+Aaron
+Aaron
+Ababa
+Ababa
+aback
+aback
+abaft
+abaft
+abandon
+abandon
+abandoned
+abandoned
+abandoning
+abandoning
+abandonment
+abandonment
+abandons
+abandons
+abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
+SELECT * FROM t1 ORDER BY word;
+word
+Aarhus
+Aarhus
+Aaron
+Aaron
+Ababa
+Ababa
+aback
+aback
+abaft
+abaft
+abandon
+abandon
+abandoned
+abandoned
+abandoning
+abandoning
+abandonment
+abandonment
+abandons
+abandons
+abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
+drop table t1;
diff --git a/mysql-test/r/rpl_loaddata_m.result b/mysql-test/r/rpl_loaddata_m.result
new file mode 100644
index 00000000000..ec2f788a5e1
--- /dev/null
+++ b/mysql-test/r/rpl_loaddata_m.result
@@ -0,0 +1,39 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest;
+USE test;
+CREATE TABLE t1(a INT, b INT, UNIQUE(b));
+LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE test.t1;
+SELECT COUNT(*) FROM test.t1;
+COUNT(*)
+2
+CREATE DATABASE mysqltest;
+USE mysqltest;
+CREATE TABLE t1(a INT, b INT, UNIQUE(b));
+LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
+SELECT COUNT(*) FROM mysqltest.t1;
+COUNT(*)
+2
+SHOW DATABASES;
+Database
+information_schema
+cluster
+mysql
+mysqltest
+test
+USE test;
+SHOW TABLES;
+Tables_in_test
+USE mysqltest;
+SHOW TABLES;
+Tables_in_mysqltest
+t1
+SELECT COUNT(*) FROM mysqltest.t1;
+COUNT(*)
+2
+DROP DATABASE mysqltest;
+DROP TABLE test.t1;
diff --git a/mysql-test/r/rpl_loaddata_rule_m.result b/mysql-test/r/rpl_loaddata_rule_m.result
deleted file mode 100644
index 375057aad0a..00000000000
--- a/mysql-test/r/rpl_loaddata_rule_m.result
+++ /dev/null
@@ -1,21 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-drop database if exists mysqltest;
-stop slave;
-create database mysqltest;
-create table t1(a int, b int, unique(b));
-use mysqltest;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table test.t1;
-show binlog events from 98;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 1 # drop database if exists mysqltest
-master-bin.000001 # Query 1 # create database mysqltest
-master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=12
-master-bin.000001 # Execute_load_query 1 # use `mysqltest`; load data infile '../std_data_ln/rpl_loaddata.dat' into table test.t1 ;file_id=1
-drop database mysqltest;
-use test;
-drop table t1;
diff --git a/mysql-test/r/rpl_loaddata_rule_s.result b/mysql-test/r/rpl_loaddata_s.result
index 62e9b64cb0d..f0c79c81c15 100644
--- a/mysql-test/r/rpl_loaddata_rule_s.result
+++ b/mysql-test/r/rpl_loaddata_s.result
@@ -5,11 +5,11 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
reset master;
-create table t1(a int, b int, unique(b));
+create table test.t1(a int, b int, unique(b));
load data infile '../std_data_ln/rpl_loaddata.dat' into table test.t1;
-select count(*) from t1;
+select count(*) from test.t1;
count(*)
2
-show binlog events from 98;
+show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
-drop table t1;
+drop table test.t1;
diff --git a/mysql-test/r/rpl_loaddatalocal.result b/mysql-test/r/rpl_loaddatalocal.result
index 20e56a62133..bb1b0610aa8 100644
--- a/mysql-test/r/rpl_loaddatalocal.result
+++ b/mysql-test/r/rpl_loaddatalocal.result
@@ -18,12 +18,12 @@ select * into outfile 'MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_out
drop table t1;
create table t1(a int primary key);
load data local infile 'MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1;
-select * from t1;
+SELECT * FROM t1 ORDER BY a;
a
1
2
3
-select * from t1;
+SELECT * FROM t1 ORDER BY a;
a
1
2
diff --git a/mysql-test/r/rpl_loadfile.result b/mysql-test/r/rpl_loadfile.result
new file mode 100644
index 00000000000..7487693a9f7
--- /dev/null
+++ b/mysql-test/r/rpl_loadfile.result
@@ -0,0 +1,227 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a));
+INSERT INTO test.t1 VALUES(1,'test');
+UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=1;
+create procedure test.p1()
+begin
+INSERT INTO test.t1 VALUES(2,'test');
+UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=2;
+end|
+CALL test.p1();
+SELECT * FROM test.t1 ORDER BY blob_column;
+a blob_column
+1 abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
+
+2 abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
+
+SELECT * FROM test.t1 ORDER BY blob_column;
+a blob_column
+1 abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
+
+2 abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
+
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE test.t1;
diff --git a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result
deleted file mode 100644
index 6ee0eb283b5..00000000000
--- a/mysql-test/r/rpl_log.result
+++ /dev/null
@@ -1,120 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
-reset master;
-reset slave;
-reset master;
-create table t1(n int not null auto_increment primary key);
-insert into t1 values (NULL);
-drop table t1;
-create table t1 (word char(20) not null);
-load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
-select count(*) from t1;
-count(*)
-69
-drop table t1;
-show binlog events;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 98 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 98 Query 1 219 use `test`; create table t1(n int not null auto_increment primary key)
-master-bin.000001 219 Intvar 1 247 INSERT_ID=1
-master-bin.000001 247 Query 1 338 use `test`; insert into t1 values (NULL)
-master-bin.000001 338 Query 1 414 use `test`; drop table t1
-master-bin.000001 414 Query 1 517 use `test`; create table t1 (word char(20) not null)
-master-bin.000001 517 Begin_load_query 1 1121 ;file_id=1;block_len=581
-master-bin.000001 1121 Execute_load_query 1 1269 use `test`; load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=1
-master-bin.000001 1269 Query 1 1345 use `test`; drop table t1
-show binlog events from 98 limit 1;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 219 use `test`; create table t1(n int not null auto_increment primary key)
-show binlog events from 98 limit 2;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 Query 1 219 use `test`; create table t1(n int not null auto_increment primary key)
-master-bin.000001 219 Intvar 1 247 INSERT_ID=1
-show binlog events from 98 limit 2,1;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 247 Query 1 338 use `test`; insert into t1 values (NULL)
-flush logs;
-create table t5 (a int);
-drop table t5;
-start slave;
-flush logs;
-stop slave;
-create table t1 (n int);
-insert into t1 values (1);
-drop table t1;
-show binlog events;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 98 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 98 Query 1 219 use `test`; create table t1(n int not null auto_increment primary key)
-master-bin.000001 219 Intvar 1 247 INSERT_ID=1
-master-bin.000001 247 Query 1 338 use `test`; insert into t1 values (NULL)
-master-bin.000001 338 Query 1 414 use `test`; drop table t1
-master-bin.000001 414 Query 1 517 use `test`; create table t1 (word char(20) not null)
-master-bin.000001 517 Begin_load_query 1 1121 ;file_id=1;block_len=581
-master-bin.000001 1121 Execute_load_query 1 1269 use `test`; load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=1
-master-bin.000001 1269 Query 1 1345 use `test`; drop table t1
-master-bin.000001 1345 Rotate 1 1389 master-bin.000002;pos=4
-show binlog events in 'master-bin.000002';
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000002 4 Format_desc 1 98 Server ver: VERSION, Binlog ver: 4
-master-bin.000002 98 Query 1 184 use `test`; create table t5 (a int)
-master-bin.000002 184 Query 1 260 use `test`; drop table t5
-master-bin.000002 260 Query 1 346 use `test`; create table t1 (n int)
-master-bin.000002 346 Query 1 434 use `test`; insert into t1 values (1)
-master-bin.000002 434 Query 1 510 use `test`; drop table t1
-show binary logs;
-Log_name File_size
-master-bin.000001 1389
-master-bin.000002 510
-start slave;
-show binary logs;
-Log_name File_size
-slave-bin.000001 1552
-slave-bin.000002 348
-show binlog events in 'slave-bin.000001' from 4;
-Log_name Pos Event_type Server_id End_log_pos Info
-slave-bin.000001 4 Format_desc 2 98 Server ver: VERSION, Binlog ver: 4
-slave-bin.000001 98 Query 1 219 use `test`; create table t1(n int not null auto_increment primary key)
-slave-bin.000001 219 Intvar 1 247 INSERT_ID=1
-slave-bin.000001 247 Query 1 338 use `test`; insert into t1 values (NULL)
-slave-bin.000001 338 Query 1 414 use `test`; drop table t1
-slave-bin.000001 414 Query 1 517 use `test`; create table t1 (word char(20) not null)
-slave-bin.000001 517 Begin_load_query 1 1121 ;file_id=1;block_len=581
-slave-bin.000001 1121 Execute_load_query 1 1271 use `test`; load data INFILE '../tmp/SQL_LOAD-2-1-1.data' INTO table t1 ignore 1 lines ;file_id=1
-slave-bin.000001 1271 Query 1 1347 use `test`; drop table t1
-slave-bin.000001 1347 Query 1 1433 use `test`; create table t5 (a int)
-slave-bin.000001 1433 Query 1 1509 use `test`; drop table t5
-slave-bin.000001 1509 Rotate 2 1552 slave-bin.000002;pos=4
-show binlog events in 'slave-bin.000002' from 4;
-Log_name Pos Event_type Server_id End_log_pos Info
-slave-bin.000002 4 Format_desc 2 98 Server ver: VERSION, Binlog ver: 4
-slave-bin.000002 98 Query 1 184 use `test`; create table t1 (n int)
-slave-bin.000002 184 Query 1 272 use `test`; insert into t1 values (1)
-slave-bin.000002 272 Query 1 348 use `test`; drop table t1
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 510 # # master-bin.000002 Yes Yes 0 0 510 # None 0 No #
-show binlog events in 'slave-bin.000005' from 4;
-ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
-create table t1(a int auto_increment primary key, b int);
-insert into t1 values (NULL, 1);
-reset master;
-set insert_id=5;
-insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
-show binlog events;
-Log_name Pos Event_type Server_id End_log_pos Info
-slave-bin.000001 4 Format_desc 2 98 Server ver: VERSION, Binlog ver: 4
-slave-bin.000001 98 Intvar 2 126 LAST_INSERT_ID=1
-slave-bin.000001 126 Intvar 2 154 INSERT_ID=5
-slave-bin.000001 154 Query 2 289 use `test`; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id())
-select * from t1;
-a b
-1 1
-5 1
-6 1
-drop table t1;
diff --git a/mysql-test/r/rpl_log_pos.result b/mysql-test/r/rpl_log_pos.result
index cf13756966e..c7484022b23 100644
--- a/mysql-test/r/rpl_log_pos.result
+++ b/mysql-test/r/rpl_log_pos.result
@@ -6,39 +6,39 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 98
+master-bin.000001 102 <Binlog_Ignore_DB>
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 98 # # master-bin.000001 Yes Yes 0 0 98 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 102 # # master-bin.000001 Yes Yes 0 0 102 # None 0 No #
stop slave;
-change master to master_log_pos=73;
+change master to master_log_pos=74;
start slave;
stop slave;
-change master to master_log_pos=73;
+change master to master_log_pos=74;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 # # master-bin.000001 No No 0 0 73 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 74 # # master-bin.000001 No No 0 0 74 # None 0 No #
start slave;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 # # master-bin.000001 No Yes 0 0 73 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 74 # # master-bin.000001 No Yes 0 0 74 # None 0 No #
stop slave;
-change master to master_log_pos=173;
+change master to master_log_pos=177;
start slave;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 173 # # master-bin.000001 No Yes 0 0 173 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 177 # # master-bin.000001 No Yes 0 0 177 # None 0 No #
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 98
+master-bin.000001 102 <Binlog_Ignore_DB>
create table if not exists t1 (n int);
drop table if exists t1;
create table t1 (n int);
insert into t1 values (1),(2),(3);
stop slave;
-change master to master_log_pos=98;
+change master to master_log_pos=102;
start slave;
-select * from t1;
+select * from t1 ORDER BY n;
n
1
2
diff --git a/mysql-test/r/rpl_master_pos_wait.result b/mysql-test/r/rpl_master_pos_wait.result
index f0f48de4e07..951e944fddc 100644
--- a/mysql-test/r/rpl_master_pos_wait.result
+++ b/mysql-test/r/rpl_master_pos_wait.result
@@ -8,8 +8,8 @@ select master_pos_wait('master-bin.999999',0,2);
master_pos_wait('master-bin.999999',0,2)
-1
explain extended select master_pos_wait('master-bin.999999',0,2);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select master_pos_wait(_latin1'master-bin.999999',0,2) AS `master_pos_wait('master-bin.999999',0,2)`
select master_pos_wait('master-bin.999999',0);
diff --git a/mysql-test/r/rpl000002.result b/mysql-test/r/rpl_mixed_ddl_dml.result
index e5e661795fe..38972a4f571 100644
--- a/mysql-test/r/rpl000002.result
+++ b/mysql-test/r/rpl_mixed_ddl_dml.result
@@ -33,14 +33,14 @@ id created
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `id` int(11) NOT NULL auto_increment,
- `created` datetime default NULL,
- PRIMARY KEY (`id`)
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `created` datetime DEFAULT NULL,
+ PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table t5;
Table Create Table
t5 CREATE TABLE `t5` (
- `id` int(11) NOT NULL default '0',
- `created` datetime default NULL
+ `id` int(11) NOT NULL DEFAULT '0',
+ `created` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2,t3,t5;
diff --git a/mysql-test/r/rpl_multi_delete.result b/mysql-test/r/rpl_multi_delete.result
index d2c68eee62e..4831502eb88 100644
--- a/mysql-test/r/rpl_multi_delete.result
+++ b/mysql-test/r/rpl_multi_delete.result
@@ -4,7 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-create table t1 (a int);
+create table t1 (a int primary key);
create table t2 (a int);
insert into t1 values (1);
insert into t2 values (1);
@@ -19,13 +19,4 @@ a
select * from t2;
a
1
-delete from t1;
-delete from t2;
-insert into t1 values(1);
-insert into t2 values(1);
-DELETE t1.*, t2.* from t1, t2;
-select * from t1;
-a
-select * from t2;
-a
drop table t1,t2;
diff --git a/mysql-test/r/rpl_multi_delete2.result b/mysql-test/r/rpl_multi_delete2.result
index 73db9f62eb4..87abe60b268 100644
--- a/mysql-test/r/rpl_multi_delete2.result
+++ b/mysql-test/r/rpl_multi_delete2.result
@@ -24,7 +24,7 @@ use mysqltest_to;
select * from a;
i
3
-create table t1 (a int);
+create table t1 (a int primary key);
create table t2 (a int);
insert into t1 values (1);
insert into t2 values (1);
diff --git a/mysql-test/r/rpl_multi_engine.result b/mysql-test/r/rpl_multi_engine.result
new file mode 100644
index 00000000000..7cb7d873415
--- /dev/null
+++ b/mysql-test/r/rpl_multi_engine.result
@@ -0,0 +1,366 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create database if not exists mysqltest1;
+use mysqltest1;
+drop table if exists t1;
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc
+VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT
+0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
+use mysqltest1;
+alter table t1 engine=myisam;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t1 engine=myisam;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14");
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+UPDATE t1 SET b1 = 0, t="2005-09-09" WHERE b1 = 1;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+DELETE FROM mysqltest1.t1 WHERE id = 42;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+alter table t1 engine=innodb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14");
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+UPDATE t1 SET b1 = 0, t="2005-09-09" WHERE b1 = 1;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+DELETE FROM mysqltest1.t1 WHERE id = 42;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+alter table t1 engine=memory;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14");
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+UPDATE t1 SET b1 = 0, t="2005-09-09" WHERE b1 = 1;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+DELETE FROM mysqltest1.t1 WHERE id = 42;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+alter table t1 engine=memory;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+alter table t1 engine=myisam;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14");
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+UPDATE t1 SET b1 = 0, t="2005-09-09" WHERE b1 = 1;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+DELETE FROM mysqltest1.t1 WHERE id = 42;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+alter table t1 engine=innodb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14");
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+UPDATE t1 SET b1 = 0, t="2005-09-09" WHERE b1 = 1;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+DELETE FROM mysqltest1.t1 WHERE id = 42;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+alter table t1 engine=memory;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14");
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+UPDATE t1 SET b1 = 0, t="2005-09-09" WHERE b1 = 1;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+DELETE FROM mysqltest1.t1 WHERE id = 42;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+alter table t1 engine=innodb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+alter table t1 engine=myisam;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14");
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+UPDATE t1 SET b1 = 0, t="2005-09-09" WHERE b1 = 1;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+DELETE FROM mysqltest1.t1 WHERE id = 42;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+alter table t1 engine=innodb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14");
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+UPDATE t1 SET b1 = 0, t="2005-09-09" WHERE b1 = 1;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+DELETE FROM mysqltest1.t1 WHERE id = 42;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+alter table t1 engine=memory;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14");
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+UPDATE t1 SET b1 = 0, t="2005-09-09" WHERE b1 = 1;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+DELETE FROM mysqltest1.t1 WHERE id = 42;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+DROP TABLE t1;
+DROP DATABASE mysqltest1;
diff --git a/mysql-test/r/rpl_multi_update.result b/mysql-test/r/rpl_multi_update.result
index 04cb1bc7460..524278be042 100644
--- a/mysql-test/r/rpl_multi_update.result
+++ b/mysql-test/r/rpl_multi_update.result
@@ -24,16 +24,4 @@ a b
1 0
2 1
UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a;
-delete from t1;
-delete from t2;
-insert into t1 values(1,1);
-insert into t2 values(1,1);
-update t1 set a=2;
-UPDATE t1, t2 SET t1.a = t2.a;
-select * from t1;
-a b
-1 1
-select * from t2;
-a b
-1 1
drop table t1, t2;
diff --git a/mysql-test/r/rpl_multi_update3.result b/mysql-test/r/rpl_multi_update3.result
index bf454c7bb48..dba7f770ba2 100644
--- a/mysql-test/r/rpl_multi_update3.result
+++ b/mysql-test/r/rpl_multi_update3.result
@@ -25,7 +25,7 @@ SELECT * FROM t2 ORDER BY a;
a b
1 0
2 1
-UPDATE t2, (SELECT a FROM t1) AS t SET t2.b = t.a+5 ;
+UPDATE t2, (SELECT a FROM t1 ORDER BY a) AS t SET t2.b = t.a+5 ;
SELECT * FROM t1 ORDER BY a;
a b
1 0
@@ -194,4 +194,4 @@ idpro price nbprice
1 1.0000 3
2 1.0000 2
3 2.0000 1
-drop table t1, t2;
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/rpl_mystery22.result b/mysql-test/r/rpl_mystery22.result
deleted file mode 100644
index 348b3211cd5..00000000000
--- a/mysql-test/r/rpl_mystery22.result
+++ /dev/null
@@ -1,23 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-create table t1(n int auto_increment primary key);
-insert into t1 values (2);
-insert into t1 values(NULL);
-insert into t1 values(NULL);
-delete from t1 where n = 2;
-start slave;
-stop slave;
-create table t2(n int);
-drop table t2;
-insert into t1 values(NULL);
-start slave;
-select * from t1;
-n
-1
-2
-3
-drop table t1;
diff --git a/mysql-test/r/rpl_ndb_2innodb.result b/mysql-test/r/rpl_ndb_2innodb.result
new file mode 100644
index 00000000000..f8ec4624062
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_2innodb.result
@@ -0,0 +1,855 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+SET storage_engine=ndb;
+--- Doing pre test cleanup ---
+DROP TABLE IF EXISTS t1;
+--- Start test 1 Basic testing ---
+--- Create Table Section ---
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE,PRIMARY KEY(id));
+--- Show table on master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY ()
+--- Show table on slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- Check that simple Alter statements are replicated correctly --
+ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
+ALTER TABLE t1 MODIFY vc TEXT;
+--- Show the new improved table on the master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY ()
+--- Make sure that our tables on slave are still same engine ---
+--- and that the alter statements replicated correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- End test 1 Basic testing ---
+--- Do Cleanup --
+DROP TABLE IF EXISTS t1;
+--- Start test 2 partition RANGE testing --
+--- Do setup --
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE)
+PARTITION BY RANGE (YEAR(t))
+(PARTITION p0 VALUES LESS THAN (1901),
+PARTITION p1 VALUES LESS THAN (1946),
+PARTITION p2 VALUES LESS THAN (1966),
+PARTITION p3 VALUES LESS THAN (1986),
+PARTITION p4 VALUES LESS THAN (2005),
+PARTITION p5 VALUES LESS THAN MAXVALUE);
+--- Show table on master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster)
+--- Show table on slave --
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = InnoDB, PARTITION p1 VALUES LESS THAN (1946) ENGINE = InnoDB, PARTITION p2 VALUES LESS THAN (1966) ENGINE = InnoDB, PARTITION p3 VALUES LESS THAN (1986) ENGINE = InnoDB, PARTITION p4 VALUES LESS THAN (2005) ENGINE = InnoDB, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 ADD PRIMARY KEY(t,id);
+ALTER TABLE t1 MODIFY vc TEXT;
+--- Show the new improved table on the master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date NOT NULL DEFAULT '0000-00-00',
+ PRIMARY KEY (`t`,`id`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster)
+--- Make sure that our tables on slave are still same engine ---
+--- and that the alter statements replicated correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date NOT NULL DEFAULT '0000-00-00',
+ PRIMARY KEY (`t`,`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = InnoDB, PARTITION p1 VALUES LESS THAN (1946) ENGINE = InnoDB, PARTITION p2 VALUES LESS THAN (1966) ENGINE = InnoDB, PARTITION p3 VALUES LESS THAN (1986) ENGINE = InnoDB, PARTITION p4 VALUES LESS THAN (2005) ENGINE = InnoDB, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- End test 2 partition RANGE testing ---
+--- Do Cleanup ---
+DROP TABLE IF EXISTS t1;
+--- Start test 3 partition LIST testing ---
+--- Do setup ---
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE)
+PARTITION BY LIST(id)
+(PARTITION p0 VALUES IN (2, 4),
+PARTITION p1 VALUES IN (42, 142));
+--- Test 3 Alter to add partition ---
+ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412));
+--- Show table on master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster)
+--- Show table on slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = InnoDB, PARTITION p1 VALUES IN (42,142) ENGINE = InnoDB, PARTITION p2 VALUES IN (412) ENGINE = InnoDB)
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 ADD PRIMARY KEY(id);
+ALTER TABLE t1 MODIFY vc TEXT;
+--- Show the new improved table on the master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster)
+--- Make sure that our tables on slave are still same engine ---
+--- and that the alter statements replicated correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = InnoDB, PARTITION p1 VALUES IN (42,142) ENGINE = InnoDB, PARTITION p2 VALUES IN (412) ENGINE = InnoDB)
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- End test 3 partition LIST testing ---
+--- Do Cleanup --
+DROP TABLE IF EXISTS t1;
+--- Start test 4 partition HASH testing ---
+--- Do setup ---
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE)
+PARTITION BY HASH( YEAR(t) )
+PARTITIONS 4;
+--- show that tables have been created correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 ADD PRIMARY KEY(t,id);
+ALTER TABLE t1 MODIFY vc TEXT;
+--- Show the new improved table on the master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date NOT NULL DEFAULT '0000-00-00',
+ PRIMARY KEY (`t`,`id`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4
+--- Make sure that our tables on slave are still same engine ---
+--- and that the alter statements replicated correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date NOT NULL DEFAULT '0000-00-00',
+ PRIMARY KEY (`t`,`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- End test 4 partition HASH testing ---
+--- Do Cleanup --
+DROP TABLE IF EXISTS t1;
+--- Start test 5 partition by key testing ---
+--- Create Table Section ---
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE,PRIMARY KEY(id))
+PARTITION BY KEY()
+PARTITIONS 4;
+--- Show that tables on master are ndbcluster tables ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Show that tables on slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
+--- Show the new improved table on the master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Make sure that our tables on slave are still right type ---
+--- and that the alter statements replicated correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 MODIFY vc TEXT;
+--- Show the new improved table on the master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Make sure that our tables on slave are still same engine ---
+--- and that the alter statements replicated correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- End test 5 key partition testing ---
+--- Do Cleanup ---
+DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/r/rpl_ndb_2myisam.result b/mysql-test/r/rpl_ndb_2myisam.result
new file mode 100644
index 00000000000..8611d83f3f3
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_2myisam.result
@@ -0,0 +1,855 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+SET storage_engine=ndb;
+--- Doing pre test cleanup ---
+DROP TABLE IF EXISTS t1;
+--- Start test 1 Basic testing ---
+--- Create Table Section ---
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE,PRIMARY KEY(id));
+--- Show table on master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+--- Show table on slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- Check that simple Alter statements are replicated correctly --
+ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
+ALTER TABLE t1 MODIFY vc TEXT;
+--- Show the new improved table on the master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+--- Make sure that our tables on slave are still same engine ---
+--- and that the alter statements replicated correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- End test 1 Basic testing ---
+--- Do Cleanup --
+DROP TABLE IF EXISTS t1;
+--- Start test 2 partition RANGE testing --
+--- Do setup --
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE)
+PARTITION BY RANGE (YEAR(t))
+(PARTITION p0 VALUES LESS THAN (1901),
+PARTITION p1 VALUES LESS THAN (1946),
+PARTITION p2 VALUES LESS THAN (1966),
+PARTITION p3 VALUES LESS THAN (1986),
+PARTITION p4 VALUES LESS THAN (2005),
+PARTITION p5 VALUES LESS THAN MAXVALUE);
+--- Show table on master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster)
+--- Show table on slave --
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 ADD PRIMARY KEY(t,id);
+ALTER TABLE t1 MODIFY vc TEXT;
+--- Show the new improved table on the master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date NOT NULL DEFAULT '0000-00-00',
+ PRIMARY KEY (`t`,`id`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster)
+--- Make sure that our tables on slave are still same engine ---
+--- and that the alter statements replicated correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date NOT NULL DEFAULT '0000-00-00',
+ PRIMARY KEY (`t`,`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- End test 2 partition RANGE testing ---
+--- Do Cleanup ---
+DROP TABLE IF EXISTS t1;
+--- Start test 3 partition LIST testing ---
+--- Do setup ---
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE)
+PARTITION BY LIST(id)
+(PARTITION p0 VALUES IN (2, 4),
+PARTITION p1 VALUES IN (42, 142));
+--- Test 3 Alter to add partition ---
+ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412));
+--- Show table on master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster)
+--- Show table on slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM)
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 ADD PRIMARY KEY(id);
+ALTER TABLE t1 MODIFY vc TEXT;
+--- Show the new improved table on the master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster)
+--- Make sure that our tables on slave are still same engine ---
+--- and that the alter statements replicated correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM)
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- End test 3 partition LIST testing ---
+--- Do Cleanup --
+DROP TABLE IF EXISTS t1;
+--- Start test 4 partition HASH testing ---
+--- Do setup ---
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE)
+PARTITION BY HASH( YEAR(t) )
+PARTITIONS 4;
+--- show that tables have been created correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 ADD PRIMARY KEY(t,id);
+ALTER TABLE t1 MODIFY vc TEXT;
+--- Show the new improved table on the master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date NOT NULL DEFAULT '0000-00-00',
+ PRIMARY KEY (`t`,`id`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4
+--- Make sure that our tables on slave are still same engine ---
+--- and that the alter statements replicated correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date NOT NULL DEFAULT '0000-00-00',
+ PRIMARY KEY (`t`,`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- End test 4 partition HASH testing ---
+--- Do Cleanup --
+DROP TABLE IF EXISTS t1;
+--- Start test 5 partition by key testing ---
+--- Create Table Section ---
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE,PRIMARY KEY(id))
+PARTITION BY KEY()
+PARTITIONS 4;
+--- Show that tables on master are ndbcluster tables ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Show that tables on slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
+--- Show the new improved table on the master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Make sure that our tables on slave are still right type ---
+--- and that the alter statements replicated correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 MODIFY vc TEXT;
+--- Show the new improved table on the master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Make sure that our tables on slave are still same engine ---
+--- and that the alter statements replicated correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- End test 5 key partition testing ---
+--- Do Cleanup ---
+DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/r/rpl_ndb_UUID.result b/mysql-test/r/rpl_ndb_UUID.result
new file mode 100644
index 00000000000..422379d4f55
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_UUID.result
@@ -0,0 +1,40 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, vchar_column VARCHAR(100), PRIMARY KEY(a)) engine=NDB;
+INSERT INTO test.t1 VALUES(1,UUID(),UUID());
+create procedure test.p1()
+begin
+INSERT INTO test.t1 VALUES(2,UUID(),UUID());
+INSERT INTO test.t1 VALUES(3,UUID(),UUID());
+end|
+CALL test.p1();
+create function test.fn1(x int)
+returns int
+begin
+insert into t1 values (4+x,UUID(),UUID());
+insert into t1 values (5+x,UUID(),UUID());
+return 0;
+end|
+select fn1(0);
+fn1(0)
+0
+create table t2 (a int);
+insert into t2 values(fn1(2));
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL DEFAULT '0',
+ `blob_column` longblob,
+ `vchar_column` varchar(100) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+DROP PROCEDURE test.p1;
+DROP FUNCTION test.fn1;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
diff --git a/mysql-test/r/rpl_ndb_auto_inc.result b/mysql-test/r/rpl_ndb_auto_inc.result
new file mode 100644
index 00000000000..dd4cc90a75f
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_auto_inc.result
@@ -0,0 +1,170 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+***************** Test 1 ************************
+
+CREATE TABLE t1 (a INT NOT NULL auto_increment,b INT, PRIMARY KEY (a)) ENGINE=NDB auto_increment=3;
+insert into t1 values (NULL,1),(NULL,2),(NULL,3);
+******* Select from Master *************
+
+select * from t1 ORDER BY a;
+a b
+3 1
+4 2
+5 3
+******* Select from Slave *************
+
+select * from t1 ORDER BY a;
+a b
+3 1
+4 2
+5 3
+drop table t1;
+create table t1 (a int not null auto_increment,b int, primary key (a)) engine=NDB;
+insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4);
+delete from t1 where b=4;
+insert into t1 values (NULL,5),(NULL,6);
+******* Select from Master *************
+
+select * from t1 ORDER BY a;
+a b
+1 1
+2 2
+3 3
+5 5
+6 6
+******* Select from Slave *************
+
+select * from t1 ORDER BY a;
+a b
+1 1
+2 2
+3 3
+5 5
+6 6
+drop table t1;
+create table t1 (a int not null auto_increment, primary key (a)) engine=NDB;
+insert into t1 values (NULL),(5),(NULL);
+insert into t1 values (250),(NULL);
+******* Select from Master *************
+
+select * from t1 ORDER BY a;
+a
+1
+5
+6
+250
+251
+insert into t1 values (1000);
+set @@insert_id=400;
+insert into t1 values(NULL),(NULL);
+******* Select from Master *************
+
+select * from t1 ORDER BY a;
+a
+1
+5
+6
+250
+251
+400
+401
+1000
+******* Select from Slave *************
+
+select * from t1 ORDER BY a;
+a
+1
+5
+6
+250
+251
+400
+401
+1000
+drop table t1;
+create table t1 (a int not null auto_increment, primary key (a)) engine=NDB;
+insert into t1 values (NULL),(5),(NULL),(NULL);
+insert into t1 values (500),(NULL),(502),(NULL),(600);
+******* Select from Master *************
+
+select * from t1 ORDER BY a;
+a
+1
+5
+6
+7
+500
+501
+502
+503
+600
+set @@insert_id=600;
+insert into t1 values(600),(NULL),(NULL);
+ERROR 23000: Can't write; duplicate key in table 't1'
+set @@insert_id=600;
+insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL);
+******* Select from Master *************
+
+select * from t1 ORDER BY a;
+a
+1
+5
+6
+7
+500
+501
+502
+503
+600
+610
+611
+******* Select from Slave *************
+
+select * from t1 ORDER BY a;
+a
+1
+5
+6
+7
+500
+501
+502
+503
+600
+610
+611
+drop table t1;
+create table t1 (a int not null auto_increment, primary key (a)) engine=NDB;
+insert into t1 values(2),(12),(22),(32),(42);
+insert into t1 values (NULL),(NULL);
+insert into t1 values (3),(NULL),(NULL);
+******* Select from Master *************
+
+select * from t1 ORDER BY a;
+a
+1
+2
+3
+4
+5
+******* Select from Slave *************
+
+** Slave should have 2, 12, 22, 32, 42 **
+** Master will have 2 but not 12, 22, 32, 42 **
+
+select * from t1 ORDER BY a;
+a
+1
+2
+3
+4
+5
+12
+22
+32
+42
+drop table t1;
diff --git a/mysql-test/r/rpl_ndb_bank.result b/mysql-test/r/rpl_ndb_bank.result
new file mode 100644
index 00000000000..62ab3f18d37
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_bank.result
@@ -0,0 +1,120 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE DATABASE IF NOT EXISTS BANK;
+DROP DATABASE BANK;
+CREATE DATABASE BANK default charset=latin1 default collate=latin1_bin;
+USE BANK;
+CREATE TABLE GL ( TIME BIGINT UNSIGNED NOT NULL,
+ACCOUNT_TYPE INT UNSIGNED NOT NULL,
+BALANCE INT UNSIGNED NOT NULL,
+DEPOSIT_COUNT INT UNSIGNED NOT NULL,
+DEPOSIT_SUM INT UNSIGNED NOT NULL,
+WITHDRAWAL_COUNT INT UNSIGNED NOT NULL,
+WITHDRAWAL_SUM INT UNSIGNED NOT NULL,
+PURGED INT UNSIGNED NOT NULL,
+PRIMARY KEY USING HASH (TIME,ACCOUNT_TYPE))
+ENGINE = NDB;
+CREATE TABLE ACCOUNT ( ACCOUNT_ID INT UNSIGNED NOT NULL,
+OWNER INT UNSIGNED NOT NULL,
+BALANCE INT UNSIGNED NOT NULL,
+ACCOUNT_TYPE INT UNSIGNED NOT NULL,
+PRIMARY KEY USING HASH (ACCOUNT_ID))
+ENGINE = NDB;
+CREATE TABLE TRANSACTION ( TRANSACTION_ID BIGINT UNSIGNED NOT NULL,
+ACCOUNT INT UNSIGNED NOT NULL,
+ACCOUNT_TYPE INT UNSIGNED NOT NULL,
+OTHER_ACCOUNT INT UNSIGNED NOT NULL,
+TRANSACTION_TYPE INT UNSIGNED NOT NULL,
+TIME BIGINT UNSIGNED NOT NULL,
+AMOUNT INT UNSIGNED NOT NULL,
+PRIMARY KEY USING HASH (TRANSACTION_ID,ACCOUNT))
+ENGINE = NDB;
+CREATE TABLE SYSTEM_VALUES ( SYSTEM_VALUES_ID INT UNSIGNED NOT NULL,
+VALUE BIGINT UNSIGNED NOT NULL,
+PRIMARY KEY USING HASH (SYSTEM_VALUES_ID))
+ENGINE = NDB;
+CREATE TABLE ACCOUNT_TYPE ( ACCOUNT_TYPE_ID INT UNSIGNED NOT NULL,
+DESCRIPTION CHAR(64) NOT NULL,
+PRIMARY KEY USING HASH (ACCOUNT_TYPE_ID))
+ENGINE = NDB;
+STOP SLAVE;
+RESET SLAVE;
+CREATE DATABASE IF NOT EXISTS BANK;
+DROP DATABASE BANK;
+CREATE DATABASE BANK;
+RESET MASTER;
+CREATE TABLE IF NOT EXISTS cluster.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM cluster.backup_info;
+LOAD DATA INFILE '../tmp.dat' INTO TABLE cluster.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM cluster.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+SELECT @the_epoch:=MAX(epoch) FROM cluster.apply_status;
+@the_epoch:=MAX(epoch)
+<the_epoch>
+SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+FROM cluster.binlog_index WHERE epoch > <the_epoch> ORDER BY epoch ASC LIMIT 1;
+@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+<the_pos> master-bin.000001
+CHANGE MASTER TO
+master_log_file = 'master-bin.000001',
+master_log_pos = <the_pos>;
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+STOP SLAVE;
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+STOP SLAVE;
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+STOP SLAVE;
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+STOP SLAVE;
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+STOP SLAVE;
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+STOP SLAVE;
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+STOP SLAVE;
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+STOP SLAVE;
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+STOP SLAVE;
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+STOP SLAVE;
+START SLAVE;
+use test;
+create table t1 (a int primary key) engine=ndb;
+insert into t1 values (1);
+drop table t1;
diff --git a/mysql-test/r/rpl_ndb_basic.result b/mysql-test/r/rpl_ndb_basic.result
new file mode 100644
index 00000000000..32a1c790c99
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_basic.result
@@ -0,0 +1,164 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
+`nom` char(4) default NULL,
+`prenom` char(4) default NULL,
+PRIMARY KEY (`nid`))
+ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES(1,"XYZ1","ABC1");
+select * from t1 order by nid;
+nid nom prenom
+1 XYZ1 ABC1
+select * from t1 order by nid;
+nid nom prenom
+1 XYZ1 ABC1
+delete from t1;
+INSERT INTO t1 VALUES(1,"XYZ2","ABC2");
+select * from t1 order by nid;
+nid nom prenom
+1 XYZ2 ABC2
+select * from t1 order by nid;
+nid nom prenom
+1 XYZ2 ABC2
+DROP table t1;
+CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
+`nom` char(4) default NULL,
+`prenom` char(4) default NULL)
+ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES(1,"XYZ1","ABC1"),(2,"AAA","BBB"),(3,"CCC","DDD");
+select * from t1 order by nid;
+nid nom prenom
+1 XYZ1 ABC1
+2 AAA BBB
+3 CCC DDD
+select * from t1 order by nid;
+nid nom prenom
+1 XYZ1 ABC1
+2 AAA BBB
+3 CCC DDD
+delete from t1 where nid = 2;
+INSERT INTO t1 VALUES(4,"EEE","FFF");
+select * from t1 order by nid;
+nid nom prenom
+1 XYZ1 ABC1
+3 CCC DDD
+4 EEE FFF
+select * from t1 order by nid;
+nid nom prenom
+1 XYZ1 ABC1
+3 CCC DDD
+4 EEE FFF
+UPDATE t1 set nid=nid+1;
+UPDATE t1 set nom="CCP" where nid = 4;
+select * from t1 order by nid;
+nid nom prenom
+2 XYZ1 ABC1
+4 CCP DDD
+5 EEE FFF
+select * from t1 order by nid;
+nid nom prenom
+2 XYZ1 ABC1
+4 CCP DDD
+5 EEE FFF
+DROP table t1;
+CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
+`nom` char(4) default NULL,
+`prenom` char(4) default NULL,
+PRIMARY KEY USING HASH (`nid`))
+ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES(1,"XYZ1","ABC1");
+**** On Slave ****
+BEGIN;
+UPDATE t1 SET `nom`="LOCK" WHERE `nid`=1;
+set GLOBAL slave_transaction_retries=1;
+**** On Master ****
+UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1;
+**** On Slave ****
+SHOW SLAVE STATUS;;
+Slave_IO_State <Slave_IO_State>
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos <Read_Master_Log_Pos>
+Relay_Log_File <Relay_Log_File>
+Relay_Log_Pos <Relay_Log_Pos>
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table <Replicate_Ignore_Table>
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 146
+Last_Error Error in Write_rows event: error during transaction execution on table test.t1
+Skip_Counter 0
+Exec_Master_Log_Pos <Exec_Master_Log_Pos>
+Relay_Log_Space <Relay_Log_Space>
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master <Seconds_Behind_Master>
+set GLOBAL slave_transaction_retries=10;
+START SLAVE;
+select * from t1 order by nid;
+nid nom prenom
+1 LOCK ABC1
+COMMIT;
+select * from t1 order by nid;
+nid nom prenom
+1 DEAD ABC1
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT KEY) ENGINE=NDB;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+ALTER TABLE t1 ADD c2 INT;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+1 NULL
+2 NULL
+3 NULL
+4 NULL
+5 NULL
+6 NULL
+7 NULL
+8 NULL
+9 NULL
+10 NULL
+ALTER TABLE t1 CHANGE c2 c2 TEXT CHARACTER SET utf8;
+ALTER TABLE t1 CHANGE c2 c2 BLOB;
+SELECT * FROM t1 ORDER BY c1 LIMIT 5;
+c1 c2
+1 NULL
+2 NULL
+3 NULL
+4 NULL
+5 NULL
+TRUNCATE t1;
+SELECT count(*) FROM t1;
+count(*)
+0
+INSERT INTO t1 VALUES (101,NULL),(102,NULL),(103,NULL),(104,NULL),(105,NULL),(106,NULL),(107,NULL),(108,NULL),(109,NULL),(1010,NULL);
+SELECT count(*) FROM t1;
+count(*)
+10
+SELECT c1 FROM t1 ORDER BY c1 LIMIT 5;
+c1
+101
+102
+103
+104
+105
+DROP TABLE t1;
diff --git a/mysql-test/r/rpl_ndb_blob.result b/mysql-test/r/rpl_ndb_blob.result
new file mode 100644
index 00000000000..c11de8c27e3
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_blob.result
@@ -0,0 +1,135 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (
+a int not null primary key,
+b text not null
+) engine=ndb;
+insert into t1 values(1, repeat('abc',10));
+insert into t1 values(2, repeat('def',200));
+insert into t1 values(3, repeat('ghi',3000));
+select 'M', a, sha1(b) from t1
+order by a;
+M a sha1(b)
+M 1 8a6c4cf7cf97e66c487c3e3b717e9ae13623d07d
+M 2 0ccd08c0fa6ad6a4382b27b1d36586d6ceb4fffa
+M 3 75e7b3299e0b776aeac2a4d1542d5b3c0ba2e05e
+select 'S', a, sha1(b) from t1
+order by a;
+S a sha1(b)
+S 1 8a6c4cf7cf97e66c487c3e3b717e9ae13623d07d
+S 2 0ccd08c0fa6ad6a4382b27b1d36586d6ceb4fffa
+S 3 75e7b3299e0b776aeac2a4d1542d5b3c0ba2e05e
+drop table t1;
+create table t1 (
+a int not null primary key,
+b text not null,
+c int,
+d longblob,
+e tinyblob
+) engine=ndbcluster;
+insert into t1 values (
+0, repeat(@s2,454), 100, repeat(@s2,345), NULL);
+insert into t1 values (
+1, repeat(@s0,504), NULL, repeat(@s1,732), repeat(@s1,1));
+insert into t1 values (
+2, '', 102, '', repeat(@s2,1));
+insert into t1 values (
+3, repeat(@s0,545), 103, repeat(@s2,788), repeat(@s0,1));
+insert into t1 values (
+4, repeat(@s1,38), 104, repeat(@s0,260), repeat(@s0,1));
+insert into t1 values (
+5, repeat(@s2,12), 105, repeat(@s2,40), repeat(@s1,1));
+insert into t1 values (
+6, repeat(@s1,242), 106, NULL, repeat(@s1,1));
+insert into t1 values (
+7, repeat(@s1,30), 107, repeat(@s0,161), '');
+insert into t1 values (
+8, repeat(@s1,719), 108, repeat(@s2,104), NULL);
+insert into t1 values (
+9, repeat(@s2,427), NULL, NULL, NULL);
+select 'M', a, sha1(b), c, sha1(d), sha1(e)
+from t1 order by a;
+M a sha1(b) c sha1(d) sha1(e)
+M 0 9538f61e649383c0d1054de2a2f0171188129f33 100 2b6515f29c20b8e9e17cc597527e516c0de8d612 NULL
+M 1 dcb9a12ca86e718ff2564be041b7c1b3ff5ea559 NULL f23e7439d9a73c3954979b85a7ef6ef35faf4e9d abfe8ae5212b22d023aa6de84beeb1344ac5668a
+M 2 da39a3ee5e6b4b0d3255bfef95601890afd80709 102 da39a3ee5e6b4b0d3255bfef95601890afd80709 33deebe47470a40e960834bffa4cdc66790845a6
+M 3 ec8e06d9ac4695d6a898b519ba840590263a9bff 103 278629ad080c3c4377978c006c2e54d0992e43cc 700915801f853603510aeb67b331866d996fdbda
+M 4 0392fa8c425d293c79291f0f34779d1101d13fcb 104 5084b602c7203e0e9590a163415ac605da17ac32 700915801f853603510aeb67b331866d996fdbda
+M 5 0f9653f0c7a69cd1c617792d546582e974a7a24d 105 566588a04ff26d05160d61c83435292bfda2978e abfe8ae5212b22d023aa6de84beeb1344ac5668a
+M 6 a37e8b0ff4fc13a42be02cdecb36186436959bae 106 NULL abfe8ae5212b22d023aa6de84beeb1344ac5668a
+M 7 a6bae0cfe6b45ff8c3c12d2ce577a1cd3931190f 107 39ee712b4b9e47f2cf3ba7c9790b2bf0d8f378e8 da39a3ee5e6b4b0d3255bfef95601890afd80709
+M 8 e139adcb7b2974ee7ff227fd405709e5cb7c896c 108 ba8073b0e1a281d4111bd2d82c7722b01574c00b NULL
+M 9 1fc5168fe4be566b17b658d94e7813f0b5032cdb NULL NULL NULL
+select 'S', a, sha1(b), c, sha1(d), sha1(e)
+from t1 order by a;
+S a sha1(b) c sha1(d) sha1(e)
+S 0 9538f61e649383c0d1054de2a2f0171188129f33 100 2b6515f29c20b8e9e17cc597527e516c0de8d612 NULL
+S 1 dcb9a12ca86e718ff2564be041b7c1b3ff5ea559 NULL f23e7439d9a73c3954979b85a7ef6ef35faf4e9d abfe8ae5212b22d023aa6de84beeb1344ac5668a
+S 2 da39a3ee5e6b4b0d3255bfef95601890afd80709 102 da39a3ee5e6b4b0d3255bfef95601890afd80709 33deebe47470a40e960834bffa4cdc66790845a6
+S 3 ec8e06d9ac4695d6a898b519ba840590263a9bff 103 278629ad080c3c4377978c006c2e54d0992e43cc 700915801f853603510aeb67b331866d996fdbda
+S 4 0392fa8c425d293c79291f0f34779d1101d13fcb 104 5084b602c7203e0e9590a163415ac605da17ac32 700915801f853603510aeb67b331866d996fdbda
+S 5 0f9653f0c7a69cd1c617792d546582e974a7a24d 105 566588a04ff26d05160d61c83435292bfda2978e abfe8ae5212b22d023aa6de84beeb1344ac5668a
+S 6 a37e8b0ff4fc13a42be02cdecb36186436959bae 106 NULL abfe8ae5212b22d023aa6de84beeb1344ac5668a
+S 7 a6bae0cfe6b45ff8c3c12d2ce577a1cd3931190f 107 39ee712b4b9e47f2cf3ba7c9790b2bf0d8f378e8 da39a3ee5e6b4b0d3255bfef95601890afd80709
+S 8 e139adcb7b2974ee7ff227fd405709e5cb7c896c 108 ba8073b0e1a281d4111bd2d82c7722b01574c00b NULL
+S 9 1fc5168fe4be566b17b658d94e7813f0b5032cdb NULL NULL NULL
+drop table t1;
+CREATE TABLE IF NOT EXISTS t1 (
+db VARBINARY(63) NOT NULL,
+name VARBINARY(63) NOT NULL,
+slock BINARY(32) NOT NULL,
+query BLOB NOT NULL,
+node_id INT UNSIGNED NOT NULL,
+epoch BIGINT UNSIGNED NOT NULL,
+id INT UNSIGNED NOT NULL,
+version INT UNSIGNED NOT NULL,
+type INT UNSIGNED NOT NULL,
+PRIMARY KEY USING HASH (db,name))
+ENGINE=NDB;
+insert into t1 values ('test','t1',
+'abc',repeat(@s0,10), 11,12,13,14,15);
+insert into t1 values ('test','t2',
+'def',repeat(@s1,100), 21,22,23,24,25);
+insert into t1 values ('test','t3',
+'ghi',repeat(@s2,1000),31,32,33,34,35);
+insert into t1 values ('testtttttttttt','t1',
+'abc',repeat(@s0,10), 11,12,13,14,15);
+insert into t1 values ('testttttttttttt','t1',
+'def',repeat(@s1,100), 21,22,23,24,25);
+insert into t1 values ('testtttttttttttt','t1',
+'ghi',repeat(@s2,1000),31,32,33,34,35);
+insert into t1 values ('t','t11111111111',
+'abc',repeat(@s0,10), 11,12,13,14,15);
+insert into t1 values ('t','t111111111111',
+'def',repeat(@s1,100), 21,22,23,24,25);
+insert into t1 values ('t','t1111111111111',
+'ghi',repeat(@s2,1000),31,32,33,34,35);
+select 'M', db, name, sha1(query), node_id, epoch, id, version, type
+from t1 order by db, name;
+M db name sha1(query) node_id epoch id version type
+M t t11111111111 8fc937d303ee7e4795c0b964d4066cedd6d74cfd 11 12 13 14 15
+M t t111111111111 a5229e9f8977bc99afc3b3627c56f083e97e01bd 21 22 23 24 25
+M t t1111111111111 0820e6ad3eeb06ea60e5e04d0bfe36f286b91098 31 32 33 34 35
+M test t1 8fc937d303ee7e4795c0b964d4066cedd6d74cfd 11 12 13 14 15
+M test t2 a5229e9f8977bc99afc3b3627c56f083e97e01bd 21 22 23 24 25
+M test t3 0820e6ad3eeb06ea60e5e04d0bfe36f286b91098 31 32 33 34 35
+M testtttttttttt t1 8fc937d303ee7e4795c0b964d4066cedd6d74cfd 11 12 13 14 15
+M testttttttttttt t1 a5229e9f8977bc99afc3b3627c56f083e97e01bd 21 22 23 24 25
+M testtttttttttttt t1 0820e6ad3eeb06ea60e5e04d0bfe36f286b91098 31 32 33 34 35
+select 'S', db, name, sha1(query), node_id, epoch, id, version, type
+from t1 order by db, name;
+S db name sha1(query) node_id epoch id version type
+S t t11111111111 8fc937d303ee7e4795c0b964d4066cedd6d74cfd 11 12 13 14 15
+S t t111111111111 a5229e9f8977bc99afc3b3627c56f083e97e01bd 21 22 23 24 25
+S t t1111111111111 0820e6ad3eeb06ea60e5e04d0bfe36f286b91098 31 32 33 34 35
+S test t1 8fc937d303ee7e4795c0b964d4066cedd6d74cfd 11 12 13 14 15
+S test t2 a5229e9f8977bc99afc3b3627c56f083e97e01bd 21 22 23 24 25
+S test t3 0820e6ad3eeb06ea60e5e04d0bfe36f286b91098 31 32 33 34 35
+S testtttttttttt t1 8fc937d303ee7e4795c0b964d4066cedd6d74cfd 11 12 13 14 15
+S testttttttttttt t1 a5229e9f8977bc99afc3b3627c56f083e97e01bd 21 22 23 24 25
+S testtttttttttttt t1 0820e6ad3eeb06ea60e5e04d0bfe36f286b91098 31 32 33 34 35
+drop table t1;
diff --git a/mysql-test/r/rpl_ndb_blob2.result b/mysql-test/r/rpl_ndb_blob2.result
new file mode 100644
index 00000000000..055efffbd6a
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_blob2.result
@@ -0,0 +1,156 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+***** Table Create Section ****
+
+CREATE TABLE test.t1 (c1 int not null auto_increment,
+data LONGBLOB, PRIMARY KEY(c1))ENGINE=#;
+
+**** Data Insert Section test.t1 *****
+
+INSERT INTO test.t1 VALUES (NULL, NULL);
+INSERT INTO test.t1 VALUES (NULL, repeat('a',1*1024));
+INSERT INTO test.t1 VALUES (NULL, repeat('b',16*1024));
+
+**** Data Insert Validation Master Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+NULL
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+1024
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
+LENGTH(data)
+16384
+
+**** Data Insert Validation Slave Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+NULL
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+1024
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
+LENGTH(data)
+16384
+
+**** Data Update Section test.t1 ****
+
+UPDATE test.t1 set data=repeat('a',18*1024) where c1 = 1;
+UPDATE t1 set data=repeat('c',17*1024) where c1 = 2;
+
+**** Data Update Validation Master Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+18432
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+17408
+
+**** Data Update Validation Slave Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+18432
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+17408
+
+**** End Test Section test.t1 ****
+
+**** Create Table test.t2 ****
+
+CREATE TABLE test.t2 (
+c1 INT NOT NULL PRIMARY KEY,
+c2 TEXT,
+c3 INT,
+c4 LONGBLOB,
+KEY(c3))ENGINE=#;
+
+*** Setup Values For test.t2 ***
+set @x0 = '01234567012345670123456701234567';
+set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@x0);
+set @d1 = 'dd1';
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @b2 = 'b2';
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @d2 = 'dd2';
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+
+**** Data Insert Section test.t2 *****
+
+INSERT INTO test.t2 VALUES(1,@b1,111,@d1);
+INSERT INTO test.t2 VALUES(2,@b2,222,@d2);
+
+**** Data Insert Validation Master Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+1 2256 b1 3000 dd1
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+2 20000 b2 30000 dd2
+
+**** Data Insert Validation Slave Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+1 2256 b1 3000 dd1
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+2 20000 b2 30000 dd2
+
+**** Data Update Section test.t2 ****
+
+UPDATE test.t2 SET c2=@b2, c4=@d2 WHERE c1=1;
+UPDATE test.t2 SET c2=@b1, c4=@d1 WHERE c1=2;
+
+**** Data Update Validation Master Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+1 20000 b2 30000 dd2
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+2 2256 b1 3000 dd1
+
+**** Data Update Validation Slave Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+1 20000 b2 30000 dd2
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+2 2256 b1 3000 dd1
+
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
diff --git a/mysql-test/r/rpl_ndb_charset.result b/mysql-test/r/rpl_ndb_charset.result
new file mode 100644
index 00000000000..0ce4446c8a5
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_charset.result
@@ -0,0 +1,201 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+set timestamp=1000000000;
+drop database if exists mysqltest2;
+drop database if exists mysqltest3;
+create database mysqltest2 character set latin2;
+set @@character_set_server=latin5;
+create database mysqltest3;
+
+--- --master--
+show create database mysqltest2;
+Database Create Database
+mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */
+show create database mysqltest3;
+Database Create Database
+mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin5 */
+
+--- --slave--
+show create database mysqltest2;
+Database Create Database
+mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */
+show create database mysqltest3;
+Database Create Database
+mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin5 */
+set @@collation_server=armscii8_bin;
+drop database mysqltest3;
+create database mysqltest3;
+
+--- --master--
+show create database mysqltest3;
+Database Create Database
+mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */
+
+--- --slave--
+show create database mysqltest3;
+Database Create Database
+mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */
+use mysqltest2;
+create table t1 (a int auto_increment primary key, b varchar(100));
+set character_set_client=cp850, collation_connection=latin2_croatian_ci;
+insert into t1 (b) values(@@character_set_server);
+insert into t1 (b) values(@@collation_server);
+insert into t1 (b) values(@@character_set_client);
+insert into t1 (b) values(@@character_set_connection);
+insert into t1 (b) values(@@collation_connection);
+
+--- --master--
+select * from t1 order by a;
+a b
+1 armscii8
+2 armscii8_bin
+3 cp850
+4 latin2
+5 latin2_croatian_ci
+
+--- --slave--
+select * from mysqltest2.t1 order by a;
+a b
+1 armscii8
+2 armscii8_bin
+3 cp850
+4 latin2
+5 latin2_croatian_ci
+select "--- --muller--" as "";
+
+--- --muller--
+set character_set_client=latin1, collation_connection=latin1_german1_ci;
+truncate table t1;
+insert into t1 (b) values(@@collation_connection);
+insert into t1 (b) values(LEAST("Mller","Muffler"));
+set collation_connection=latin1_german2_ci;
+insert into t1 (b) values(@@collation_connection);
+insert into t1 (b) values(LEAST("Mller","Muffler"));
+
+--- --master--
+select * from t1 order by a;
+a b
+1 latin1_german1_ci
+2 Muffler
+3 latin1_german2_ci
+4 Mller
+
+--- --slave--
+select * from mysqltest2.t1 order by a;
+a b
+1 latin1_german1_ci
+2 Muffler
+3 latin1_german2_ci
+4 Mller
+select "--- --INSERT--" as "";
+
+--- --INSERT--
+set @a= _cp850 'Mller' collate cp850_general_ci;
+truncate table t1;
+insert into t1 (b) values(collation(@a));
+
+--- --master--
+select * from t1 order by a;
+a b
+1 cp850_general_ci
+
+--- --slave--
+select * from mysqltest2.t1 order by a;
+a b
+1 cp850_general_ci
+drop database mysqltest2;
+drop database mysqltest3;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # drop database if exists mysqltest2
+master-bin.000001 # Query 1 # drop database if exists mysqltest3
+master-bin.000001 # Query 1 # create database mysqltest2 character set latin2
+master-bin.000001 # Query 1 # create database mysqltest3
+master-bin.000001 # Query 1 # drop database mysqltest3
+master-bin.000001 # Query 1 # create database mysqltest3
+master-bin.000001 # Query 1 # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100))
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # drop database mysqltest2
+master-bin.000001 # Query 1 # drop database mysqltest3
+select "--- --global--" as "";
+
+--- --global--
+set global character_set_server=latin2;
+set global character_set_server=latin1;
+set global character_set_server=latin2;
+set global character_set_server=latin1;
+select "--- --oneshot--" as "";
+
+--- --oneshot--
+set one_shot @@character_set_server=latin5;
+set @@max_join_size=1000;
+select @@character_set_server;
+@@character_set_server
+latin5
+select @@character_set_server;
+@@character_set_server
+latin1
+set @@character_set_server=latin5;
+select @@character_set_server;
+@@character_set_server
+latin5
+select @@character_set_server;
+@@character_set_server
+latin5
+set one_shot max_join_size=10;
+ERROR HY000: The 'SET ONE_SHOT' syntax is reserved for purposes internal to the MySQL server
+set character_set_client=9999999;
+ERROR 42000: Unknown character set: '9999999'
+set collation_server=9999998;
+ERROR HY000: Unknown collation: '9999998'
+select "--- --3943--" as "";
+
+--- --3943--
+use test;
+CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255));
+SET CHARACTER_SET_CLIENT=koi8r,
+CHARACTER_SET_CONNECTION=cp1251,
+CHARACTER_SET_RESULTS=koi8r;
+INSERT INTO t1 (c1, c2) VALUES (', ',', ');
+select hex(c1), hex(c2) from t1;
+hex(c1) hex(c2)
+CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
+select hex(c1), hex(c2) from t1;
+hex(c1) hex(c2)
+CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
+drop table t1;
+select "--- --6676--" as "";
+
+--- --6676--
+create table `t1` (
+`pk` varchar(10) not null default '',
+primary key (`pk`)
+) engine=NDB default charset=latin1;
+set @p=_latin1 'test';
+update t1 set pk='test' where pk=@p;
+drop table t1;
diff --git a/mysql-test/r/rpl_ndb_commit_afterflush.result b/mysql-test/r/rpl_ndb_commit_afterflush.result
new file mode 100644
index 00000000000..3fc4ca26967
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_commit_afterflush.result
@@ -0,0 +1,13 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (a INT) ENGINE=NDB;
+begin;
+insert into t1 values(1);
+flush tables with read lock;
+commit;
+unlock tables;
+drop table t1;
diff --git a/mysql-test/r/rpl_ndb_dd_advance.result b/mysql-test/r/rpl_ndb_dd_advance.result
new file mode 100644
index 00000000000..bbc67a04027
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_dd_advance.result
@@ -0,0 +1,417 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TABLE IF EXISTS t1, t2, t3;
+***** Test 1 RPL of CDD and Alter *****
+***** Test 1 setup *****
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE 4M
+ENGINE=NDB;
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M
+ENGINE=NDB;
+ALTER TABLESPACE ts1
+ADD DATAFILE 'datafile02.dat'
+INITIAL_SIZE 4M
+ENGINE=NDB;
+CREATE TABLE t1
+(c1 INT NOT NULL PRIMARY KEY,
+c2 INT NOT NULL,
+c3 INT NOT NULL)
+TABLESPACE ts1 STORAGE DISK
+ENGINE=NDB;
+***** insert some data *****
+***** Select from Master *****
+SELECT * FROM t1 ORDER BY c1 LIMIT 5;
+c1 c2 c3
+1 2 4
+2 4 5
+3 6 6
+4 8 7
+5 10 8
+***** Select from Slave *****
+SELECT * FROM t1 ORDER BY c1 LIMIT 5;
+c1 c2 c3
+1 2 4
+2 4 5
+3 6 6
+4 8 7
+5 10 8
+FILE_NAME FILE_TYPE TABLESPACE_NAME LOGFILE_GROUP_NAME
+NULL UNDO LOG NULL lg1
+datafile.dat DATAFILE ts1 lg1
+datafile02.dat DATAFILE ts1 lg1
+undofile.dat UNDO LOG NULL lg1
+undofile02.dat UNDO LOG NULL lg1
+**** Do First Set of ALTERs in the master table ****
+CREATE INDEX t1_i ON t1(c2, c3);
+ALTER TABLE t1 ADD c4 TIMESTAMP;
+ALTER TABLE t1 ADD c5 DOUBLE;
+ALTER TABLE t1 ADD INDEX (c5);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL,
+ `c2` int(11) NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `c5` double DEFAULT NULL,
+ PRIMARY KEY (`c1`),
+ KEY `t1_i` (`c2`,`c3`),
+ KEY `c5` (`c5`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+**** Show first set of ALTERs on SLAVE ****
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL,
+ `c2` int(11) NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `c5` double DEFAULT NULL,
+ PRIMARY KEY (`c1`),
+ KEY `t1_i` (`c2`,`c3`),
+ KEY `c5` (`c5`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+**** Second set of alters test 1 ****
+ALTER TABLE t1 RENAME t2;
+ALTER TABLE t2 DROP INDEX c5;
+CREATE TABLE t1(c1 INT)ENGINE=NDB;
+INSERT INTO t1 VALUES(1);
+DROP TABLE t1;
+ALTER TABLE t2 RENAME t1;
+**** Show second set of ALTERs on MASTER ****
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL,
+ `c2` int(11) NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `c5` double DEFAULT NULL,
+ PRIMARY KEY (`c1`),
+ KEY `t1_i` (`c2`,`c3`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+**** Show second set of ALTERs on SLAVE ****
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL,
+ `c2` int(11) NOT NULL,
+ `c3` int(11) NOT NULL,
+ `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `c5` double DEFAULT NULL,
+ PRIMARY KEY (`c1`),
+ KEY `t1_i` (`c2`,`c3`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+**** Third and last set of alters for test1 ****
+ALTER TABLE t1 CHANGE c1 c1 DOUBLE;
+ALTER TABLE t1 CHANGE c2 c2 DECIMAL(10,2);
+ALTER TABLE t1 DROP COLUMN c3;
+ALTER TABLE t1 CHANGE c4 c4 TEXT CHARACTER SET utf8;
+ALTER TABLE t1 CHANGE c4 c4 BLOB;
+ALTER TABLE t1 CHANGE c4 c3 BLOB;
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+UPDATE t1 SET c3=@b1 where c1 = 1;
+UPDATE t1 SET c3=@b1 where c1 = 2;
+**** Show last set of ALTERs on MASTER ****
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` double NOT NULL DEFAULT '0',
+ `c2` decimal(10,2) DEFAULT NULL,
+ `c3` blob,
+ `c5` double DEFAULT NULL,
+ PRIMARY KEY (`c1`),
+ KEY `t1_i` (`c2`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+SELECT * FROM t1 ORDER BY c1 LIMIT 5;
+c1 c2 c3 c5
+1 2.00 b1b1b1b1b1b1b1b1b1b1 NULL
+2 4.00 b1b1b1b1b1b1b1b1b1b1 NULL
+3 6.00 0000-00-00 00:00:00 NULL
+4 8.00 0000-00-00 00:00:00 NULL
+5 10.00 0000-00-00 00:00:00 NULL
+**** Show last set of ALTERs on SLAVE ****
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` double NOT NULL DEFAULT '0',
+ `c2` decimal(10,2) DEFAULT NULL,
+ `c3` blob,
+ `c5` double DEFAULT NULL,
+ PRIMARY KEY (`c1`),
+ KEY `t1_i` (`c2`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+SELECT * FROM t1 where c1 = 1;
+c1 c2 c3 c5
+1 2.00 b1b1b1b1b1b1b1b1b1b1 NULL
+DROP TABLE t1;
+STOP SLAVE;
+RESET SLAVE;
+RESET MASTER;
+START SLAVE;
+******** Create additional TABLESPACE test 2 **************
+CREATE TABLESPACE ts2
+ADD DATAFILE 'datafile03.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M
+ENGINE=NDB;
+ALTER TABLESPACE ts2
+ADD DATAFILE 'datafile04.dat'
+INITIAL_SIZE 12M
+ENGINE=NDB;
+DROP DATABASE IF EXISTS tpcb;
+Warnings:
+Note 1008 Can't drop database 'tpcb'; database doesn't exist
+CREATE DATABASE tpcb;
+*********** Create TPCB Tables *****************
+CREATE TABLE tpcb.account
+(id INT, bid INT, balance DECIMAL(10,2),
+filler CHAR(255), PRIMARY KEY(id))
+TABLESPACE ts1 STORAGE DISK
+ENGINE=NDB;
+CREATE TABLE tpcb.branch
+(bid INT, balance DECIMAL(10,2), filler VARCHAR(255),
+PRIMARY KEY(bid))
+ENGINE=NDB;
+CREATE TABLE tpcb.teller
+(tid INT, balance DECIMAL(10,2), filler VARCHAR(255),
+PRIMARY KEY(tid))
+TABLESPACE ts2 STORAGE DISK
+ENGINE=NDB;
+CREATE TABLE tpcb.history
+(id MEDIUMINT NOT NULL AUTO_INCREMENT,aid INT,
+tid INT, bid INT, amount DECIMAL(10,2),
+tdate DATETIME, teller CHAR(20), uuidf LONGBLOB,
+filler CHAR(80),PRIMARY KEY (id))
+TABLESPACE ts2 STORAGE DISK
+ENGINE=NDB;
+********* Create Procedures and Functions ************
+CREATE PROCEDURE tpcb.load()
+BEGIN
+DECLARE acct INT DEFAULT 1000;
+DECLARE brch INT DEFAULT 100;
+DECLARE tell INT DEFAULT 1000;
+DECLARE tmp INT DEFAULT 100;
+WHILE brch > 0 DO
+SET tmp = 100;
+WHILE tmp > 0 DO
+INSERT INTO tpcb.account VALUES (acct, brch, 0.0, "FRESH ACCOUNT");
+SET acct = acct - 1;
+SET tmp = tmp -1;
+END WHILE;
+INSERT INTO tpcb.branch VALUES (brch, 0.0, "FRESH BRANCH");
+SET brch = brch - 1;
+END WHILE;
+WHILE tell > 0 DO
+INSERT INTO tpcb.teller VALUES (tell, 0.0, "FRESH TELLER");
+SET tell = tell - 1;
+END WHILE;
+END|
+CREATE FUNCTION tpcb.account_id () RETURNS INT
+BEGIN
+DECLARE num INT;
+DECLARE ran INT;
+SELECT RAND() * 10 INTO ran;
+IF (ran < 2)
+THEN
+SELECT RAND() * 10 INTO num;
+ELSEIF (ran < 4)
+THEN
+SELECT RAND() * 100 INTO num;
+ELSE
+SELECT RAND() * 1000 INTO num;
+END IF;
+IF (num < 1)
+THEN
+RETURN 1;
+END IF;
+RETURN num;
+END|
+CREATE FUNCTION tpcb.teller_id () RETURNS INT
+BEGIN
+DECLARE num INT;
+DECLARE ran INT;
+SELECT RAND() * 10 INTO ran;
+IF (ran < 2)
+THEN
+SELECT RAND() * 10 INTO num;
+ELSEIF (ran < 5)
+THEN
+SELECT RAND() * 100 INTO num;
+ELSE
+SELECT RAND() * 1000 INTO num;
+END IF;
+IF (num < 1)
+THEN
+RETURN 1;
+END IF;
+RETURN num;
+END|
+CREATE PROCEDURE tpcb.trans()
+BEGIN
+DECLARE acct INT DEFAULT 0;
+DECLARE brch INT DEFAULT 0;
+DECLARE tell INT DEFAULT 0;
+DECLARE bal DECIMAL(10,2) DEFAULT 0.0;
+DECLARE amount DECIMAL(10,2) DEFAULT 1.00;
+DECLARE test INT DEFAULT 0;
+DECLARE bbal DECIMAL(10,2) DEFAULT 0.0;
+DECLARE tbal DECIMAL(10,2) DEFAULT 0.0;
+DECLARE local_uuid VARCHAR(255);
+DECLARE local_user VARCHAR(255);
+DECLARE local_time TIMESTAMP;
+SELECT RAND() * 10 INTO test;
+SELECT tpcb.account_id() INTO acct;
+SELECT tpcb.teller_id() INTO tell;
+SELECT account.balance INTO bal FROM tpcb.account WHERE id = acct;
+SELECT account.bid INTO brch FROM tpcb.account WHERE id = acct;
+SELECT teller.balance INTO tbal FROM tpcb.teller WHERE tid = tell;
+SELECT branch.balance INTO bbal FROM tpcb.branch WHERE bid = brch;
+IF (test < 5)
+THEN
+SET bal = bal + amount;
+SET bbal = bbal + amount;
+SET tbal = tbal + amount;
+UPDATE tpcb.account SET balance = bal, filler = 'account updated'
+ WHERE id = acct;
+UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated'
+ WHERE bid = brch;
+UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated'
+ WHERE tid = tell;
+ELSE
+SET bal = bal - amount;
+SET bbal = bbal - amount;
+SET tbal = tbal - amount;
+UPDATE tpcb.account SET balance = bal, filler = 'account updated'
+ WHERE id = acct;
+UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated'
+ WHERE bid = brch;
+UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated'
+ WHERE tid = tell;
+END IF;
+SET local_uuid=UUID();
+SET local_user=USER();
+SET local_time= NOW();
+INSERT INTO tpcb.history VALUES(NULL,acct,tell,brch,amount, local_time,local_user,
+local_uuid,'completed trans');
+END|
+****** TEST 2 test time *********************************
+USE tpcb;
+*********** Load up the database ******************
+CALL tpcb.load();
+********** Check load master and slave **************
+SELECT COUNT(*) FROM account;
+COUNT(*)
+10000
+USE tpcb;
+SELECT COUNT(*) FROM account;
+COUNT(*)
+10000
+******** Run in some transactions ***************
+***** Time to try slave sync ***********
+**** Must make sure slave is clean *****
+STOP SLAVE;
+RESET SLAVE;
+DROP PROCEDURE tpcb.load;
+DROP PROCEDURE tpcb.trans;
+DROP TABLE tpcb.account;
+DROP TABLE tpcb.teller;
+DROP TABLE tpcb.branch;
+DROP TABLE tpcb.history;
+DROP DATABASE tpcb;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile.dat'
+ENGINE=NDB;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile02.dat'
+ENGINE=NDB;
+DROP TABLESPACE ts1 ENGINE=NDB;
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile03.dat'
+ENGINE=NDB;
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile04.dat'
+ENGINE=NDB;
+DROP TABLESPACE ts2 ENGINE=NDB;
+DROP LOGFILE GROUP lg1 ENGINE=NDB;
+********** Take a backup of the Master *************
+SELECT COUNT(*) FROM history;
+COUNT(*)
+1000
+SELECT COUNT(*) FROM history;
+COUNT(*)
+2000
+CREATE TEMPORARY TABLE IF NOT EXISTS cluster.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM cluster.backup_info;
+LOAD DATA INFILE '../tmp.dat' INTO TABLE cluster.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM cluster.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+DROP TABLE IF EXISTS cluster.backup_info;
+************ Restore the slave ************************
+CREATE DATABASE tpcb;
+***** Check a few slave restore values ***************
+USE tpcb;
+SELECT COUNT(*) FROM account;
+COUNT(*)
+10000
+***** Add some more records to master *********
+***** Finsh the slave sync process *******
+@the_epoch:=MAX(epoch)
+<the_epoch>
+@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+<the_pos> master-bin.000001
+* 4. *
+* 5. *
+START SLAVE;
+**** We should be ready to continue on *************
+****** Let's make sure we match *******
+***** MASTER *******
+USE tpcb;
+SELECT COUNT(*) FROM history;
+COUNT(*)
+4050
+****** SLAVE ********
+USE tpcb;
+SELECT COUNT(*) FROM history;
+COUNT(*)
+4050
+*** DUMP MASTER & SLAVE FOR COMPARE ********
+*************** TEST 2 CLEANUP SECTION ********************
+DROP PROCEDURE tpcb.load;
+DROP PROCEDURE tpcb.trans;
+DROP TABLE tpcb.account;
+DROP TABLE tpcb.teller;
+DROP TABLE tpcb.branch;
+DROP TABLE tpcb.history;
+DROP DATABASE tpcb;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile.dat'
+ENGINE=NDB;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile02.dat'
+ENGINE=NDB;
+DROP TABLESPACE ts1 ENGINE=NDB;
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile03.dat'
+ENGINE=NDB;
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile04.dat'
+ENGINE=NDB;
+DROP TABLESPACE ts2 ENGINE=NDB;
+DROP LOGFILE GROUP lg1 ENGINE=NDB;
+****** Do dumps compare ************
diff --git a/mysql-test/r/rpl_ndb_dd_basic.result b/mysql-test/r/rpl_ndb_dd_basic.result
new file mode 100644
index 00000000000..bb5919193eb
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_dd_basic.result
@@ -0,0 +1,72 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TABLE IF EXISTS t1;
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+alter logfile group lg1
+add undofile 'undofile02.dat'
+initial_size 4M engine=ndb;
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M
+ENGINE NDB;
+alter tablespace ts1
+add datafile 'datafile02.dat'
+initial_size 4M engine=ndb;
+CREATE TABLE t1
+(pk1 int not null primary key, b int not null, c int not null)
+tablespace ts1 storage disk
+engine ndb;
+insert into t1 values (1,2,3);
+select * from t1 order by pk1;
+pk1 b c
+1 2 3
+select * from t1 order by pk1;
+pk1 b c
+1 2 3
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t1
+master-bin.000001 # Query # # CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB
+master-bin.000001 # Query # # alter logfile group lg1
+add undofile 'undofile02.dat'
+initial_size 4M engine=ndb
+master-bin.000001 # Query # # CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M
+ENGINE NDB
+master-bin.000001 # Query # # alter tablespace ts1
+add datafile 'datafile02.dat'
+initial_size 4M engine=ndb
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1
+(pk1 int not null primary key, b int not null, c int not null)
+tablespace ts1 storage disk
+engine ndb
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (cluster.apply_status)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+drop table t1;
+alter tablespace ts1
+drop datafile 'datafile.dat'
+engine=ndb;
+alter tablespace ts1
+drop datafile 'datafile02.dat'
+engine=ndb;
+DROP TABLESPACE ts1 ENGINE=NDB;
+DROP LOGFILE GROUP lg1 ENGINE=NDB;
diff --git a/mysql-test/r/rpl_ndb_dd_partitions.result b/mysql-test/r/rpl_ndb_dd_partitions.result
new file mode 100644
index 00000000000..ece6b84c227
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_dd_partitions.result
@@ -0,0 +1,726 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+--- Doing pre test cleanup ---
+DROP TABLE IF EXISTS t1;
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE = 4M
+ENGINE=NDB;
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M
+ENGINE NDB;
+ALTER TABLESPACE ts1
+ADD DATAFILE 'datafile02.dat'
+INITIAL_SIZE = 4M
+ENGINE=NDB;
+--- Start test 2 partition RANGE testing --
+--- Do setup --
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63),
+bc CHAR(63), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE)
+TABLESPACE ts1 STORAGE DISK
+ENGINE=NDB
+PARTITION BY RANGE (YEAR(t))
+(PARTITION p0 VALUES LESS THAN (1901),
+PARTITION p1 VALUES LESS THAN (1946),
+PARTITION p2 VALUES LESS THAN (1966),
+PARTITION p3 VALUES LESS THAN (1986),
+PARTITION p4 VALUES LESS THAN (2005),
+PARTITION p5 VALUES LESS THAN MAXVALUE);
+--- Show table on master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(63) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster)
+--- Show table on slave --
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(63) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster)
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 MODIFY vc VARCHAR(255);
+--- Show the new improved table on the master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster)
+--- Make sure that our tables on slave are still same engine ---
+--- and that the alter statements replicated correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster)
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- End test 2 partition RANGE testing ---
+--- Do Cleanup ---
+DROP TABLE IF EXISTS t1;
+--- Start test 3 partition LIST testing ---
+--- Do setup ---
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63),
+bc CHAR(63), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE)
+TABLESPACE ts1 STORAGE DISK
+ENGINE=NDB
+PARTITION BY LIST(id)
+(PARTITION p0 VALUES IN (2, 4),
+PARTITION p1 VALUES IN (42, 142));
+--- Test 3 Alter to add partition ---
+ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412));
+--- Show table on master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(63) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster)
+--- Show table on slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(63) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster)
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 MODIFY vc VARCHAR(255);
+--- Show the new improved table on the master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster)
+--- Make sure that our tables on slave are still same engine ---
+--- and that the alter statements replicated correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster)
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- End test 3 partition LIST testing ---
+--- Do Cleanup --
+DROP TABLE IF EXISTS t1;
+--- Start test 4 partition HASH testing ---
+--- Do setup ---
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63),
+bc CHAR(63), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE)
+TABLESPACE ts1 STORAGE DISK
+ENGINE=NDB
+PARTITION BY HASH( YEAR(t) )
+PARTITIONS 4;
+--- show that tables have been created correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(63) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(63) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 MODIFY vc VARCHAR(255);
+--- Show the new improved table on the master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4
+--- Make sure that our tables on slave are still same engine ---
+--- and that the alter statements replicated correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- End test 4 partition HASH testing ---
+--- Do Cleanup --
+DROP TABLE IF EXISTS t1;
+--- Start test 5 partition by key testing ---
+--- Create Table Section ---
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63),
+bc CHAR(63), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE,PRIMARY KEY(id))
+TABLESPACE ts1 STORAGE DISK
+ENGINE=NDB
+PARTITION BY KEY()
+PARTITIONS 4;
+--- Show that tables on master are ndbcluster tables ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(63) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Show that tables on slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(63) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
+--- Show the new improved table on the master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(63) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Make sure that our tables on slave are still right type ---
+--- and that the alter statements replicated correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(63) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 MODIFY vc VARCHAR(255);
+--- Show the new improved table on the master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Make sure that our tables on slave are still same engine ---
+--- and that the alter statements replicated correctly ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(63) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4
+--- Perform basic operation on master ---
+--- and ensure replicated correctly ---
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+--- End test 5 key partition testing ---
+--- Do Cleanup ---
+DROP TABLE IF EXISTS t1;
+alter tablespace ts1
+drop datafile 'datafile.dat'
+engine=ndb;
+alter tablespace ts1
+drop datafile 'datafile02.dat'
+engine=ndb;
+DROP TABLESPACE ts1 ENGINE=NDB;
+DROP LOGFILE GROUP lg1 ENGINE=NDB;
diff --git a/mysql-test/r/rpl_ndb_ddl.result b/mysql-test/r/rpl_ndb_ddl.result
new file mode 100644
index 00000000000..de35175bf18
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_ddl.result
@@ -0,0 +1,1693 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+SET AUTOCOMMIT = 1;
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+DROP DATABASE IF EXISTS mysqltest3;
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE="NDB";
+INSERT INTO mysqltest1.t1 SET f1= 0;
+CREATE TABLE mysqltest1.t2 (f1 BIGINT) ENGINE="NDB";
+CREATE TABLE mysqltest1.t3 (f1 BIGINT) ENGINE="NDB";
+CREATE TABLE mysqltest1.t4 (f1 BIGINT) ENGINE="NDB";
+CREATE TABLE mysqltest1.t5 (f1 BIGINT) ENGINE="NDB";
+CREATE TABLE mysqltest1.t6 (f1 BIGINT) ENGINE="NDB";
+CREATE INDEX my_idx6 ON mysqltest1.t6(f1);
+CREATE TABLE mysqltest1.t7 (f1 BIGINT) ENGINE="NDB";
+INSERT INTO mysqltest1.t7 SET f1= 0;
+CREATE TABLE mysqltest1.t8 (f1 BIGINT) ENGINE="NDB";
+CREATE TABLE mysqltest1.t9 (f1 BIGINT) ENGINE="NDB";
+CREATE TABLE mysqltest1.t10 (f1 BIGINT) ENGINE="NDB";
+CREATE TABLE mysqltest1.t11 (f1 BIGINT) ENGINE="NDB";
+CREATE TABLE mysqltest1.t12 (f1 BIGINT) ENGINE="NDB";
+CREATE TABLE mysqltest1.t13 (f1 BIGINT) ENGINE="NDB";
+CREATE TABLE mysqltest1.t14 (f1 BIGINT) ENGINE="NDB";
+CREATE TABLE mysqltest1.t15 (f1 BIGINT) ENGINE="NDB";
+CREATE TABLE mysqltest1.t16 (f1 BIGINT) ENGINE="NDB";
+CREATE TABLE mysqltest1.t17 (f1 BIGINT) ENGINE="NDB";
+CREATE TABLE mysqltest1.t18 (f1 BIGINT) ENGINE="NDB";
+CREATE TABLE mysqltest1.t19 (f1 BIGINT) ENGINE="NDB";
+CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT);
+SET AUTOCOMMIT = 0;
+use mysqltest1;
+
+-------- switch to slave --------
+SET AUTOCOMMIT = 0;
+use mysqltest1;
+
+-------- switch to master -------
+
+######## COMMIT ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 0 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+0
+
+-------- switch to master -------
+COMMIT;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+
+######## ROLLBACK ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 1 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+2
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+TEST-INFO: MASTER: The INSERT is not committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+TEST-INFO: SLAVE: The INSERT is not committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+
+######## SET AUTOCOMMIT=1 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 1 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+2
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+-------- switch to master -------
+SET AUTOCOMMIT=1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+2
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+2
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+2
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+2
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+SET AUTOCOMMIT=0;
+
+######## START TRANSACTION ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 2 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+3
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+2
+
+-------- switch to master -------
+START TRANSACTION;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+3
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+3
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+3
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+3
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+
+######## BEGIN ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 3 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+4
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+3
+
+-------- switch to master -------
+BEGIN;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+4
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+4
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+4
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+4
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+
+######## DROP TABLE mysqltest1.t2 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 4 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+5
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+4
+
+-------- switch to master -------
+DROP TABLE mysqltest1.t2;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+5
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+5
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+5
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+5
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+SHOW TABLES LIKE 't2';
+Tables_in_mysqltest1 (t2)
+
+-------- switch to slave --------
+SHOW TABLES LIKE 't2';
+Tables_in_mysqltest1 (t2)
+
+-------- switch to master -------
+
+######## DROP TEMPORARY TABLE mysqltest1.t23 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 5 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+6
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+5
+
+-------- switch to master -------
+DROP TEMPORARY TABLE mysqltest1.t23;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+6
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+5
+
+-------- switch to master -------
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+5
+
+TEST-INFO: MASTER: The INSERT is not committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+6
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+SHOW TABLES LIKE 't23';
+Tables_in_mysqltest1 (t23)
+
+-------- switch to slave --------
+SHOW TABLES LIKE 't23';
+Tables_in_mysqltest1 (t23)
+
+-------- switch to master -------
+
+######## RENAME TABLE mysqltest1.t3 to mysqltest1.t20 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 5 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+6
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+6
+
+-------- switch to master -------
+RENAME TABLE mysqltest1.t3 to mysqltest1.t20;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+6
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+6
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+6
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+6
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+SHOW TABLES LIKE 't20';
+Tables_in_mysqltest1 (t20)
+t20
+
+-------- switch to slave --------
+SHOW TABLES LIKE 't20';
+Tables_in_mysqltest1 (t20)
+t20
+
+-------- switch to master -------
+
+######## ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 6 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+7
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+6
+
+-------- switch to master -------
+ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+7
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+7
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+7
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+7
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+describe mysqltest1.t4;
+Field Type Null Key Default Extra
+f1 bigint(20) YES NULL
+f2 bigint(20) YES NULL
+
+-------- switch to slave --------
+describe mysqltest1.t4;
+Field Type Null Key Default Extra
+f1 bigint(20) YES NULL
+f2 bigint(20) YES NULL
+
+-------- switch to master -------
+
+######## CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= "InnoDB" ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 7 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+8
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+7
+
+-------- switch to master -------
+CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= "InnoDB";
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+8
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+8
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+8
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+8
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+
+######## CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT) ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 8 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+9
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+8
+
+-------- switch to master -------
+CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT);
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+9
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+8
+
+-------- switch to master -------
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+8
+
+TEST-INFO: MASTER: The INSERT is not committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+9
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+
+######## TRUNCATE TABLE mysqltest1.t7 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 8 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+9
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+9
+
+-------- switch to master -------
+TRUNCATE TABLE mysqltest1.t7;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+9
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+9
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+9
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+9
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+SELECT * FROM mysqltest1.t7;
+f1
+
+-------- switch to slave --------
+SELECT * FROM mysqltest1.t7;
+f1
+
+-------- switch to master -------
+
+######## LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 9 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+9
+
+-------- switch to master -------
+LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+UNLOCK TABLES;
+
+######## UNLOCK TABLES ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 10 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+11
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+-------- switch to master -------
+UNLOCK TABLES;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+11
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+TEST-INFO: MASTER: The INSERT is not committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+TEST-INFO: SLAVE: The INSERT is not committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+LOCK TABLES mysqltest1.t1 READ;
+
+######## UNLOCK TABLES ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 10 + 1;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+-------- switch to master -------
+UNLOCK TABLES;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+TEST-INFO: MASTER: The INSERT is not committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+TEST-INFO: SLAVE: The INSERT is not committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ;
+
+######## UNLOCK TABLES ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 10 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+11
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+-------- switch to master -------
+UNLOCK TABLES;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+11
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+11
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+11
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+11
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+
+######## DROP INDEX my_idx6 ON mysqltest1.t6 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 11 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+12
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+11
+
+-------- switch to master -------
+DROP INDEX my_idx6 ON mysqltest1.t6;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+12
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+12
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+12
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+12
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+SHOW INDEX FROM mysqltest1.t6;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+
+-------- switch to slave --------
+SHOW INDEX FROM mysqltest1.t6;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+
+-------- switch to master -------
+
+######## CREATE INDEX my_idx5 ON mysqltest1.t5(f1) ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 12 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+13
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+12
+
+-------- switch to master -------
+CREATE INDEX my_idx5 ON mysqltest1.t5(f1);
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+13
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+13
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+13
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+13
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+SHOW INDEX FROM mysqltest1.t5;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t5 1 my_idx5 1 f1 A 0 NULL NULL YES BTREE
+
+-------- switch to slave --------
+SHOW INDEX FROM mysqltest1.t5;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t5 1 my_idx5 1 f1 A NULL NULL NULL YES BTREE
+
+-------- switch to master -------
+
+######## DROP DATABASE mysqltest2 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 13 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+14
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+13
+
+-------- switch to master -------
+DROP DATABASE mysqltest2;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+14
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+14
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+14
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+14
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+SHOW DATABASES LIKE "mysqltest2";
+Database (mysqltest2)
+
+-------- switch to slave --------
+SHOW DATABASES LIKE "mysqltest2";
+Database (mysqltest2)
+
+-------- switch to master -------
+
+######## CREATE DATABASE mysqltest3 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 14 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+15
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+14
+
+-------- switch to master -------
+CREATE DATABASE mysqltest3;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+15
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+15
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+15
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+15
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+SHOW DATABASES LIKE "mysqltest3";
+Database (mysqltest3)
+mysqltest3
+
+-------- switch to slave --------
+SHOW DATABASES LIKE "mysqltest3";
+Database (mysqltest3)
+mysqltest3
+
+-------- switch to master -------
+
+######## CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1" ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 15 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+16
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+15
+
+-------- switch to master -------
+CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1";
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+16
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+16
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+16
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+16
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+SHOW PROCEDURE STATUS LIKE 'p1';
+Db mysqltest1
+Name p1
+Type PROCEDURE
+Definer root@localhost
+Modified #
+Created #
+Security_type DEFINER
+Comment
+ -------- switch to slave -------
+SHOW PROCEDURE STATUS LIKE 'p1';
+Db mysqltest1
+Name p1
+Type PROCEDURE
+Definer root@localhost
+Modified #
+Created #
+Security_type DEFINER
+Comment
+
+######## ALTER PROCEDURE p1 COMMENT "I have been altered" ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 16 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+17
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+16
+
+-------- switch to master -------
+ALTER PROCEDURE p1 COMMENT "I have been altered";
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+17
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+17
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+17
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+17
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+SHOW PROCEDURE STATUS LIKE 'p1';
+Db mysqltest1
+Name p1
+Type PROCEDURE
+Definer root@localhost
+Modified #
+Created #
+Security_type DEFINER
+Comment I have been altered
+ -------- switch to slave -------
+SHOW PROCEDURE STATUS LIKE 'p1';
+Db mysqltest1
+Name p1
+Type PROCEDURE
+Definer root@localhost
+Modified #
+Created #
+Security_type DEFINER
+Comment I have been altered
+
+######## DROP PROCEDURE p1 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 17 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+18
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+17
+
+-------- switch to master -------
+DROP PROCEDURE p1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+18
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+18
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+18
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+18
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+SHOW PROCEDURE STATUS LIKE 'p1';
+ -------- switch to slave -------
+SHOW PROCEDURE STATUS LIKE 'p1';
+
+######## CREATE OR REPLACE VIEW v1 as select * from t1 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 18 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+19
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+18
+
+-------- switch to master -------
+CREATE OR REPLACE VIEW v1 as select * from t1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+19
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+19
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+19
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+19
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+SHOW CREATE VIEW v1;
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1`
+
+-------- switch to slave -------
+SHOW CREATE VIEW v1;
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1`
+
+######## ALTER VIEW v1 AS select f1 from t1 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 19 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+20
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+19
+
+-------- switch to master -------
+ALTER VIEW v1 AS select f1 from t1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+20
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+20
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+20
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+20
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+SHOW CREATE VIEW v1;
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1`
+
+-------- switch to slave -------
+SHOW CREATE VIEW v1;
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1`
+
+######## DROP VIEW IF EXISTS v1 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 20 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+21
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+20
+
+-------- switch to master -------
+DROP VIEW IF EXISTS v1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+21
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+21
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+21
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+21
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+SHOW CREATE VIEW v1;
+ERROR 42S02: Table 'mysqltest1.v1' doesn't exist
+
+-------- switch to slave -------
+SHOW CREATE VIEW v1;
+ERROR 42S02: Table 'mysqltest1.v1' doesn't exist
+
+######## CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 21 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+22
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+21
+
+-------- switch to master -------
+CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+22
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+22
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+22
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+22
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+SHOW TRIGGERS;
+Trigger Event Table Statement Timing Created sql_mode Definer
+trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost
+
+-------- switch to slave -------
+SHOW TRIGGERS;
+Trigger Event Table Statement Timing Created sql_mode Definer
+trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost
+
+######## DROP TRIGGER trg1 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 22 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+23
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+22
+
+-------- switch to master -------
+DROP TRIGGER trg1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+23
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+23
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+23
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+23
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+SHOW TRIGGERS;
+Trigger Event Table Statement Timing Created sql_mode Definer
+
+-------- switch to slave -------
+SHOW TRIGGERS;
+Trigger Event Table Statement Timing Created sql_mode Definer
+
+######## CREATE USER user1@localhost ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 23 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+24
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+23
+
+-------- switch to master -------
+CREATE USER user1@localhost;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+24
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+24
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+24
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+24
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+SELECT user FROM mysql.user WHERE user = 'user1';
+user
+user1
+
+-------- switch to slave -------
+SELECT user FROM mysql.user WHERE user = 'user1';
+user
+user1
+
+######## RENAME USER user1@localhost TO rename1@localhost ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 24 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+25
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+24
+
+-------- switch to master -------
+RENAME USER user1@localhost TO rename1@localhost;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+25
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+25
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+25
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+25
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+SELECT user FROM mysql.user WHERE user = 'rename1';
+user
+rename1
+
+-------- switch to slave -------
+SELECT user FROM mysql.user WHERE user = 'rename1';
+user
+rename1
+
+######## DROP USER rename1@localhost ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 25 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+26
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+25
+
+-------- switch to master -------
+DROP USER rename1@localhost;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+26
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+26
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+26
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+26
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+flush logs;
+
+-------- switch to slave --------
+flush logs;
+
+-------- switch to master -------
+SELECT user FROM mysql.user WHERE user = 'rename1';
+user
+
+-------- switch to slave -------
+SELECT user FROM mysql.user WHERE user = 'rename1';
+user
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+DROP DATABASE IF EXISTS mysqltest3;
diff --git a/mysql-test/r/rpl_ndb_delete_nowhere.result b/mysql-test/r/rpl_ndb_delete_nowhere.result
new file mode 100644
index 00000000000..1cecb030181
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_delete_nowhere.result
@@ -0,0 +1,15 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int, b int) engine=NDB;
+insert into t1 values(1,1);
+select * from t1;
+a b
+1 1
+delete from t1;
+select * from t1;
+a b
+drop table t1;
diff --git a/mysql-test/r/rpl_ndb_func003.result b/mysql-test/r/rpl_ndb_func003.result
new file mode 100644
index 00000000000..ad72a3fb244
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_func003.result
@@ -0,0 +1,29 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP FUNCTION IF EXISTS test.f1;
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, c CHAR(16),PRIMARY KEY(a))ENGINE=NDB;
+create function test.f1() RETURNS CHAR(16)
+BEGIN
+DECLARE tmp CHAR(16);
+DECLARE var_name FLOAT;
+SET var_name = RAND();
+IF var_name > .6
+THEN SET tmp = 'Texas';
+ELSE SET tmp = 'MySQL';
+END IF;
+RETURN tmp;
+END|
+INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1());
+INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1());
+SET AUTOCOMMIT=0;
+START TRANSACTION;
+INSERT INTO test.t1 VALUES (null,test.f1());
+ROLLBACK;
+SET AUTOCOMMIT=1;
+DROP FUNCTION test.f1;
+DROP TABLE test.t1;
diff --git a/mysql-test/r/rpl_ndb_idempotent.result b/mysql-test/r/rpl_ndb_idempotent.result
new file mode 100644
index 00000000000..1ba23e703c2
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_idempotent.result
@@ -0,0 +1,73 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (c1 CHAR(15), c2 CHAR(15), c3 INT, PRIMARY KEY (c3)) ENGINE = NDB ;
+INSERT INTO t1 VALUES ("row1","will go away",1);
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row1 will go away 1
+SELECT @the_epoch:=MAX(epoch) FROM cluster.apply_status;
+@the_epoch:=MAX(epoch)
+<the_epoch>
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row1 will go away 1
+SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+FROM cluster.binlog_index WHERE epoch = <the_epoch> ;
+@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+<the_pos> master-bin.000001
+INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
+DELETE FROM t1 WHERE c3 = 1;
+UPDATE t1 SET c2="should go away" WHERE c3 = 2;
+UPDATE t1 SET c2="C" WHERE c3 = 3;
+DELETE FROM t1 WHERE c3 = 2;
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row3 C 3
+row4 D 4
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row3 C 3
+row4 D 4
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+STOP SLAVE;
+CHANGE MASTER TO
+master_log_file = 'master-bin.000001',
+master_log_pos = <the_pos> ;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 No No <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+START SLAVE;
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row3 C 3
+row4 D 4
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row3 C 3
+row4 D 4
+STOP SLAVE;
+DROP TABLE t1;
+RESET master;
+DROP TABLE t1;
+RESET slave;
+START SLAVE;
+CREATE TABLE t1 (c1 CHAR(15) NOT NULL, c2 CHAR(15) NOT NULL, c3 INT NOT NULL, PRIMARY KEY (c3)) ENGINE = NDB ;
+INSERT INTO t1 VALUES ("row1","remove on slave",1);
+DELETE FROM t1;
+BEGIN;
+UPDATE t1 SET c2="does not exist" WHERE c3=1;
+INSERT INTO t1 VALUES ("row2","new on slave",2);
+COMMIT;
+SELECT * FROM t1;
+c1 c2 c3
+row2 new on slave 2
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/r/rpl_ndb_insert_ignore.result b/mysql-test/r/rpl_ndb_insert_ignore.result
new file mode 100644
index 00000000000..030845e89e2
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_insert_ignore.result
@@ -0,0 +1,70 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned,
+unique (b)
+) ENGINE=NDB;
+CREATE TABLE t2 (
+a int unsigned, # to force INSERT SELECT to have a certain order
+b int unsigned
+) ENGINE=NDB;
+INSERT INTO t1 VALUES (NULL, 1);
+INSERT INTO t1 VALUES (NULL, 2);
+INSERT INTO t1 VALUES (NULL, 3);
+INSERT INTO t1 VALUES (NULL, 4);
+INSERT INTO t2 VALUES (1, 1);
+INSERT INTO t2 VALUES (2, 2);
+INSERT INTO t2 VALUES (3, 5);
+INSERT INTO t2 VALUES (4, 3);
+INSERT INTO t2 VALUES (5, 4);
+INSERT INTO t2 VALUES (6, 6);
+INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+SELECT * FROM t1 ORDER BY a;
+a b
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+SELECT * FROM t1 ORDER BY a;
+a b
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+drop table t1;
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned,
+unique (b)
+) ENGINE=myisam;
+INSERT INTO t1 VALUES (1, 1);
+INSERT INTO t1 VALUES (2, 2);
+INSERT INTO t1 VALUES (3, 3);
+INSERT INTO t1 VALUES (4, 4);
+INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+SELECT * FROM t1 ORDER BY a;
+a b
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+SELECT * FROM t1 ORDER BY a;
+a b
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+drop table t1, t2;
diff --git a/mysql-test/r/rpl_ndb_load.result b/mysql-test/r/rpl_ndb_load.result
new file mode 100644
index 00000000000..e51f0096557
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_load.result
@@ -0,0 +1,42 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP DATABASE IF EXISTS TEST_DB;
+CREATE DATABASE TEST_DB;
+USE TEST_DB;
+CREATE TABLE SUBSCRIBER
+( NUMBER CHAR(12) BINARY NOT NULL,
+NAME CHAR(32) BINARY NOT NULL,
+GROUP_ID INT UNSIGNED NOT NULL,
+LOCATION INT UNSIGNED NOT NULL,
+SESSIONS INT UNSIGNED NOT NULL,
+CHANGED_BY CHAR(32) BINARY NOT NULL,
+CHANGED_TIME CHAR(32) BINARY NOT NULL,
+PRIMARY KEY USING HASH (NUMBER))
+ENGINE = NDB;
+CREATE TABLE GROUP2
+( GROUP_ID INT UNSIGNED NOT NULL,
+GROUP_NAME CHAR(32) BINARY NOT NULL,
+ALLOW_READ CHAR(1) BINARY NOT NULL,
+ALLOW_INSERT INT UNSIGNED NOT NULL,
+ALLOW_DELETE INT UNSIGNED NOT NULL,
+PRIMARY KEY USING HASH (GROUP_ID))
+ENGINE = NDB;
+CREATE TABLE SESSION
+( NUMBER CHAR(12) BINARY NOT NULL,
+SERVER_ID INT UNSIGNED NOT NULL,
+DATA BINARY(2000) NOT NULL,
+PRIMARY KEY USING HASH (NUMBER,SERVER_ID))
+ENGINE = NDB;
+CREATE TABLE SERVER
+( SUFFIX CHAR(2) BINARY NOT NULL,
+SERVER_ID INT UNSIGNED NOT NULL,
+NAME CHAR(32) BINARY NOT NULL,
+NO_OF_READ INT UNSIGNED NOT NULL,
+NO_OF_INSERT INT UNSIGNED NOT NULL,
+NO_OF_DELETE INT UNSIGNED NOT NULL,
+PRIMARY KEY USING HASH (SUFFIX, SERVER_ID))
+ENGINE = NDB;
diff --git a/mysql-test/r/rpl_ndb_log.result b/mysql-test/r/rpl_ndb_log.result
new file mode 100644
index 00000000000..e0135a94c63
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_log.result
@@ -0,0 +1,150 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+reset master;
+reset slave;
+reset master;
+create table t1(n int not null auto_increment primary key)ENGINE=NDB;
+insert into t1 values (NULL);
+drop table t1;
+create table t1 (word char(20) not null)ENGINE=NDB;
+load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
+select count(*) from t1;
+count(*)
+69
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
+master-bin.000001 # Query 1 # BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Table_map 1 # table_id: # (cluster.apply_status)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # COMMIT
+master-bin.000001 # Query 1 # use `test`; drop table t1
+master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB
+master-bin.000001 # Query 1 # BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Table_map 1 # table_id: # (cluster.apply_status)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # COMMIT
+show binlog events from 102 limit 1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
+show binlog events from 102 limit 2;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
+master-bin.000001 # Query 1 # BEGIN
+show binlog events from 102 limit 2,1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+flush logs;
+create table t3 (a int)ENGINE=NDB;
+start slave;
+
+let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ;
+
+--source include/wait_slave_status.inc
+flush logs;
+stop slave;
+create table t2 (n int)ENGINE=NDB;
+insert into t2 values (1);
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
+master-bin.000001 # Query 1 # BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Table_map 1 # table_id: # (cluster.apply_status)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # COMMIT
+master-bin.000001 # Query 1 # use `test`; drop table t1
+master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB
+master-bin.000001 # Query 1 # BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Table_map 1 # table_id: # (cluster.apply_status)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # COMMIT
+master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
+show binlog events in 'master-bin.000002';
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=NDB
+master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=NDB
+master-bin.000002 # Query 1 # BEGIN
+master-bin.000002 # Table_map 1 # table_id: # (test.t2)
+master-bin.000002 # Table_map 1 # table_id: # (cluster.apply_status)
+master-bin.000002 # Write_rows 1 # table_id: #
+master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000002 # Query 1 # COMMIT
+show binary logs;
+Log_name File_size
+master-bin.000001 1698
+master-bin.000002 591
+start slave;
+show binary logs;
+Log_name File_size
+slave-bin.000001 1793
+slave-bin.000002 198
+show binlog events in 'slave-bin.000001' from 4;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
+slave-bin.000001 # Query 2 # BEGIN
+slave-bin.000001 # Table_map 2 # table_id: # (test.t1)
+slave-bin.000001 # Table_map 2 # table_id: # (cluster.apply_status)
+slave-bin.000001 # Write_rows 2 # table_id: #
+slave-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query 2 # COMMIT
+slave-bin.000001 # Query 1 # use `test`; drop table t1
+slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB
+slave-bin.000001 # Query 2 # BEGIN
+slave-bin.000001 # Table_map 2 # table_id: # (test.t1)
+slave-bin.000001 # Table_map 2 # table_id: # (cluster.apply_status)
+slave-bin.000001 # Write_rows 2 # table_id: #
+slave-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query 2 # COMMIT
+slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=NDB
+slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
+show binlog events in 'slave-bin.000002' from 4;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=NDB
+slave-bin.000002 # Query 2 # BEGIN
+slave-bin.000002 # Table_map 2 # table_id: # (test.t2)
+slave-bin.000002 # Table_map 2 # table_id: # (cluster.apply_status)
+slave-bin.000002 # Write_rows 2 # table_id: #
+slave-bin.000002 # Write_rows 2 # table_id: # flags: STMT_END_F
+slave-bin.000002 # Query 2 # COMMIT
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 591 # # master-bin.000002 Yes Yes # 0 0 591 # None 0 No #
+show binlog events in 'slave-bin.000005' from 4;
+ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+create table t1(a int auto_increment primary key, b int);
+insert into t1 values (NULL, 1);
+reset master;
+set insert_id=5;
+insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000001 # Table_map 2 # table_id: # (test.t1)
+slave-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
+select * from t1;
+a b
+1 1
+5 1
+6 1
+drop table t1;
diff --git a/mysql-test/r/rpl_ndb_multi.result b/mysql-test/r/rpl_ndb_multi.result
new file mode 100644
index 00000000000..13751060ed3
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_multi.result
@@ -0,0 +1,55 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (c1 CHAR(15), c2 CHAR(15), c3 INT, PRIMARY KEY (c3)) ENGINE = NDB ;
+reset master;
+SHOW TABLES;
+Tables_in_test
+t1
+INSERT INTO t1 VALUES ("row1","will go away",1);
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row1 will go away 1
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row1 will go away 1
+SELECT @the_epoch:=MAX(epoch) FROM cluster.apply_status;
+@the_epoch:=MAX(epoch)
+<the_epoch>
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row1 will go away 1
+stop slave;
+SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+FROM cluster.binlog_index WHERE epoch = <the_epoch> ;
+@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+102 master-bin1.000001
+CHANGE MASTER TO
+master_port=<MASTER_PORT1>,
+master_log_file = 'master-bin1.000001',
+master_log_pos = 102 ;
+start slave;
+INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
+DELETE FROM t1 WHERE c3 = 1;
+UPDATE t1 SET c2="should go away" WHERE c3 = 2;
+UPDATE t1 SET c2="C" WHERE c3 = 3;
+DELETE FROM t1 WHERE c3 = 2;
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row3 C 3
+row4 D 4
+INSERT INTO t1 VALUES ("row5","E",5);
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row3 C 3
+row4 D 4
+row5 E 5
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row3 C 3
+row4 D 4
+row5 E 5
+STOP SLAVE;
diff --git a/mysql-test/r/rpl_ndb_multi_update2.result b/mysql-test/r/rpl_ndb_multi_update2.result
new file mode 100644
index 00000000000..5d00ae6598c
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_multi_update2.result
@@ -0,0 +1,55 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop table if exists t1,t2;
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned
+) ENGINE=NDB;
+CREATE TABLE t2 (
+a int unsigned not null auto_increment primary key,
+b int unsigned
+) ENGINE=NDB;
+INSERT INTO t1 VALUES (NULL, 0);
+INSERT INTO t1 SELECT NULL, 0 FROM t1;
+INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
+SELECT * FROM t1 ORDER BY a;
+a b
+1 0
+2 0
+SELECT * FROM t2 ORDER BY a;
+a b
+1 0
+2 1
+UPDATE t1, t2 SET t1.b = (t2.b+4) WHERE t1.a = t2.a;
+SELECT * FROM t1 ORDER BY a;
+a b
+1 4
+2 5
+SELECT * FROM t2 ORDER BY a;
+a b
+1 0
+2 1
+SELECT * FROM t1 ORDER BY a;
+a b
+1 4
+2 5
+SELECT * FROM t2 ORDER BY a;
+a b
+1 0
+2 1
+drop table t1,t2;
+reset master;
+CREATE TABLE t1 ( a INT );
+INSERT INTO t1 VALUES (0);
+UPDATE t1, (SELECT 3 as b) AS x SET t1.a = x.b;
+select * from t1;
+a
+3
+select * from t1;
+a
+3
+drop table t1;
diff --git a/mysql-test/r/rpl_ndb_multi_update3.result b/mysql-test/r/rpl_ndb_multi_update3.result
new file mode 100644
index 00000000000..dc4e11c9c9e
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_multi_update3.result
@@ -0,0 +1,197 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+
+-------- Test for BUG#9361 --------
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned
+) ENGINE=NDB;
+CREATE TABLE t2 (
+a int unsigned not null auto_increment primary key,
+b int unsigned
+) ENGINE=NDB;
+INSERT INTO t1 VALUES (NULL, 0);
+INSERT INTO t1 SELECT NULL, 0 FROM t1;
+INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
+SELECT * FROM t1 ORDER BY a;
+a b
+1 0
+2 0
+SELECT * FROM t2 ORDER BY a;
+a b
+1 0
+2 1
+UPDATE t2, (SELECT a FROM t1 ORDER BY a) AS t SET t2.b = t.a+5 ;
+SELECT * FROM t1 ORDER BY a;
+a b
+1 0
+2 0
+SELECT * FROM t2 ORDER BY a;
+a b
+1 6
+2 6
+SELECT * FROM t1 ORDER BY a;
+a b
+1 0
+2 0
+SELECT * FROM t2 ORDER BY a;
+a b
+1 6
+2 6
+drop table t1,t2;
+
+-------- Test 1 for BUG#9361 --------
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+CREATE TABLE t1 (
+a1 char(30),
+a2 int,
+a3 int,
+a4 char(30),
+a5 char(30)
+);
+CREATE TABLE t2 (
+b1 int,
+b2 char(30)
+);
+INSERT INTO t1 VALUES ('Yes', 1, NULL, 'foo', 'bar');
+INSERT INTO t2 VALUES (1, 'baz');
+UPDATE t1 a, t2
+SET a.a1 = 'No'
+WHERE a.a2 =
+(SELECT b1
+FROM t2
+WHERE b2 = 'baz')
+AND a.a3 IS NULL
+AND a.a4 = 'foo'
+AND a.a5 = 'bar';
+SELECT * FROM t1;
+a1 a2 a3 a4 a5
+No 1 NULL foo bar
+SELECT * FROM t2;
+b1 b2
+1 baz
+DROP TABLE t1, t2;
+
+-------- Test 2 for BUG#9361 --------
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP TABLE IF EXISTS t3;
+CREATE TABLE t1 (
+i INT,
+j INT,
+x INT,
+y INT,
+z INT
+);
+CREATE TABLE t2 (
+i INT,
+k INT,
+x INT,
+y INT,
+z INT
+);
+CREATE TABLE t3 (
+j INT,
+k INT,
+x INT,
+y INT,
+z INT
+);
+INSERT INTO t1 VALUES ( 1, 2,13,14,15);
+INSERT INTO t2 VALUES ( 1, 3,23,24,25);
+INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
+UPDATE t1 AS a
+INNER JOIN t2 AS b
+ON a.i = b.i
+INNER JOIN t3 AS c
+ON a.j = c.j AND b.k = c.k
+SET a.x = b.x,
+a.y = b.y,
+a.z = (
+SELECT sum(z)
+FROM t3
+WHERE y = 34
+)
+WHERE b.x = 23;
+SELECT * FROM t1;
+i j x y z
+1 2 23 24 71
+DROP TABLE t1, t2, t3;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+DROP TABLE IF EXISTS t2;
+Warnings:
+Note 1051 Unknown table 't2'
+CREATE TABLE t1 (
+idp int(11) NOT NULL default '0',
+idpro int(11) default NULL,
+price decimal(19,4) default NULL,
+PRIMARY KEY (idp)
+);
+CREATE TABLE t2 (
+idpro int(11) NOT NULL default '0',
+price decimal(19,4) default NULL,
+nbprice int(11) default NULL,
+PRIMARY KEY (idpro)
+);
+INSERT INTO t1 VALUES
+(1,1,'3.0000'),
+(2,2,'1.0000'),
+(3,1,'1.0000'),
+(4,1,'4.0000'),
+(5,3,'2.0000'),
+(6,2,'4.0000');
+INSERT INTO t2 VALUES
+(1,'0.0000',0),
+(2,'0.0000',0),
+(3,'0.0000',0);
+update
+t2
+join
+( select idpro, min(price) as min_price, count(*) as nbr_price
+from t1
+where idpro>0 and price>0
+group by idpro
+) as table_price
+on t2.idpro = table_price.idpro
+set t2.price = table_price.min_price,
+t2.nbprice = table_price.nbr_price;
+select "-- MASTER AFTER JOIN --" as "";
+
+-- MASTER AFTER JOIN --
+select * from t1;
+idp idpro price
+1 1 3.0000
+2 2 1.0000
+3 1 1.0000
+4 1 4.0000
+5 3 2.0000
+6 2 4.0000
+select * from t2;
+idpro price nbprice
+1 1.0000 3
+2 1.0000 2
+3 2.0000 1
+select "-- SLAVE AFTER JOIN --" as "";
+
+-- SLAVE AFTER JOIN --
+select * from t1;
+idp idpro price
+1 1 3.0000
+2 2 1.0000
+3 1 1.0000
+4 1 4.0000
+5 3 2.0000
+6 2 4.0000
+select * from t2;
+idpro price nbprice
+1 1.0000 3
+2 1.0000 2
+3 2.0000 1
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/rpl_ndb_relayrotate.result b/mysql-test/r/rpl_ndb_relayrotate.result
new file mode 100644
index 00000000000..6aa64973611
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_relayrotate.result
@@ -0,0 +1,16 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+create table t1 (a int) engine=NDB;
+reset slave;
+start slave;
+stop slave;
+start slave;
+select max(a) from t1;
+max(a)
+8000
+drop table t1;
diff --git a/mysql-test/r/rpl_ndb_row_001.result b/mysql-test/r/rpl_ndb_row_001.result
new file mode 100644
index 00000000000..56bb31e329d
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_row_001.result
@@ -0,0 +1,55 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (word CHAR(20) NOT NULL);
+LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
+LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1;
+SELECT * FROM t1 ORDER BY word LIMIT 10;
+word
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+Aaron
+Aaron
+Aaron
+Aaron
+Ababa
+Ababa
+STOP SLAVE;
+SET PASSWORD FOR root@"localhost" = PASSWORD('foo');
+START SLAVE;
+SET PASSWORD FOR root@"localhost" = PASSWORD('');
+CREATE TABLE t3(n INT);
+INSERT INTO t3 VALUES(1),(2);
+SELECT * FROM t3 ORDER BY n;
+n
+1
+2
+SELECT SUM(LENGTH(word)) FROM t1;
+SUM(LENGTH(word))
+1022
+DROP TABLE t1,t3;
+CREATE TABLE t1 (n INT) ENGINE=NDB;
+RESET MASTER;
+STOP SLAVE;
+RESET SLAVE;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+LOCK TABLES t1 READ;
+START SLAVE;
+UNLOCK TABLES;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+DROP TABLE t1;
+CREATE TABLE t1 (n INT);
+INSERT INTO t1 VALUES(3456);
+SELECT n FROM t1;
+n
+3456
+DROP TABLE t1;
diff --git a/mysql-test/r/rpl_ndb_sp003.result b/mysql-test/r/rpl_ndb_sp003.result
new file mode 100644
index 00000000000..d7922c61b52
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_sp003.result
@@ -0,0 +1,49 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=NDBCLUSTER;
+CREATE PROCEDURE test.p1()
+BEGIN
+INSERT INTO test.t1 VALUES (4);
+SELECT get_lock("test", 100);
+UPDATE test.t1 set a=a+4 WHERE a=4;
+END|
+CREATE PROCEDURE test.p2()
+BEGIN
+UPDATE test.t1 SET a=a+1;
+END|
+SELECT get_lock("test", 200);
+get_lock("test", 200)
+1
+CALL test.p1();
+CALL test.p2();
+SELECT release_lock("test");
+release_lock("test")
+1
+SELECT * FROM test.t1;
+a
+5
+SELECT * FROM test.t1;
+a
+5
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=NDBCLUSTER;
+CALL test.p2();
+CALL test.p1();
+get_lock("test", 100)
+0
+SELECT * FROM test.t1;
+a
+8
+SELECT * FROM test.t1;
+a
+8
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
diff --git a/mysql-test/r/rpl_ndb_sp006.result b/mysql-test/r/rpl_ndb_sp006.result
new file mode 100644
index 00000000000..482d43c8f10
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_sp006.result
@@ -0,0 +1,46 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create database if not exists mysqltest1;
+DROP PROCEDURE IF EXISTS mysqltest1.p1;
+DROP PROCEDURE IF EXISTS mysqltest1.p2;
+DROP TABLE IF EXISTS mysqltest1.t2;
+DROP TABLE IF EXISTS mysqltest1.t1;
+CREATE TABLE IF NOT EXISTS mysqltest1.t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=NDBCLUSTER;
+CREATE TABLE IF NOT EXISTS mysqltest1.t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=NDBCLUSTER;
+CREATE PROCEDURE mysqltest1.p1()
+BEGIN
+DECLARE done INT DEFAULT 0;
+DECLARE spa CHAR(16);
+DECLARE spb INT;
+DECLARE cur1 CURSOR FOR SELECT name,
+(YEAR(CURDATE())-YEAR(birth))-(RIGHT(CURDATE(),5)<RIGHT(birth,5))
+FROM mysqltest1.t1;
+DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
+OPEN cur1;
+SET AUTOCOMMIT=0;
+REPEAT
+FETCH cur1 INTO spa, spb;
+IF NOT done THEN
+START TRANSACTION;
+INSERT INTO mysqltest1.t2 VALUES (spa,spb);
+COMMIT;
+END IF;
+UNTIL done END REPEAT;
+SET AUTOCOMMIT=1;
+CLOSE cur1;
+END|
+CREATE PROCEDURE mysqltest1.p2()
+BEGIN
+INSERT INTO mysqltest1.t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
+END|
+CALL mysqltest1.p2();
+CALL mysqltest1.p1();
+DROP PROCEDURE IF EXISTS mysqltest1.p1;
+DROP PROCEDURE IF EXISTS mysqltest1.p2;
+DROP TABLE IF EXISTS mysqltest1.t1;
+DROP TABLE IF EXISTS mysqltest1.t2;
+DROP DATABASE mysqltest1;
diff --git a/mysql-test/r/rpl_ndb_sync.result b/mysql-test/r/rpl_ndb_sync.result
new file mode 100644
index 00000000000..4ca73167603
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_sync.result
@@ -0,0 +1,96 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+STOP SLAVE;
+CREATE DATABASE ndbsynctest;
+USE ndbsynctest;
+CREATE DATABASE ndbsynctest;
+USE ndbsynctest;
+CREATE TABLE t1 (c1 BIT(1) NOT NULL, c2 BIT(1) NOT NULL, c3 CHAR(15), PRIMARY KEY(c3)) ENGINE = NDB ;
+INSERT INTO t1 VALUES (1,1,"row1"),(0,1,"row2"),(1,0,"row3"),(0,0,"row4");
+CREATE TABLE t2 (c1 CHAR(15), c2 BIT(1) NOT NULL, c3 BIT(1) NOT NULL, PRIMARY KEY(c1)) ENGINE = NDB ;
+INSERT INTO t2 VALUES ("ABC",1,1),("BCDEF",0,1),("CD",1,0),("DEFGHIJKL",0,0);
+SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
+hex(c1) hex(c2) c3
+1 1 row1
+0 1 row2
+1 0 row3
+0 0 row4
+SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1;
+hex(c2) hex(c3) c1
+1 1 ABC
+0 1 BCDEF
+1 0 CD
+0 0 DEFGHIJKL
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM test.backup_info;
+LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM test.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+DROP TABLE test.backup_info;
+UPDATE t1 SET c2=0 WHERE c3="row2";
+SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
+hex(c1) hex(c2) c3
+1 1 row1
+0 0 row2
+1 0 row3
+0 0 row4
+SHOW TABLES;
+Tables_in_ndbsynctest
+DROP DATABASE ndbsynctest;
+CREATE DATABASE ndbsynctest;
+USE ndbsynctest;
+SHOW TABLES;
+Tables_in_ndbsynctest
+t1
+t2
+SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
+hex(c1) hex(c2) c3
+1 1 row1
+0 1 row2
+1 0 row3
+0 0 row4
+SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1;
+hex(c2) hex(c3) c1
+1 1 ABC
+0 1 BCDEF
+1 0 CD
+0 0 DEFGHIJKL
+SELECT @the_epoch:=MAX(epoch) FROM cluster.apply_status;
+@the_epoch:=MAX(epoch)
+<the_epoch>
+SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+FROM cluster.binlog_index WHERE epoch > <the_epoch> ORDER BY epoch ASC LIMIT 1;
+@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+<the_pos> master-bin.000001
+CHANGE MASTER TO
+master_log_file = 'master-bin.000001',
+master_log_pos = <the_pos> ;
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
+hex(c1) hex(c2) c3
+1 1 row1
+0 0 row2
+1 0 row3
+0 0 row4
+SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1;
+hex(c2) hex(c3) c1
+1 1 ABC
+0 1 BCDEF
+1 0 CD
+0 0 DEFGHIJKL
+DROP DATABASE ndbsynctest;
+STOP SLAVE;
+reset master;
+select * from cluster.binlog_index;
+Position File epoch inserts updates deletes schemaops
+reset slave;
+select * from cluster.apply_status;
+server_id epoch
diff --git a/mysql-test/r/rpl_ndb_trig004.result b/mysql-test/r/rpl_ndb_trig004.result
new file mode 100644
index 00000000000..ba5f0dea91c
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_trig004.result
@@ -0,0 +1,30 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TRIGGER test.t1_bi_t2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+CREATE TABLE test.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d FLOAT, PRIMARY KEY(n))ENGINE=NDB;
+CREATE TABLE test.t2 (n MEDIUMINT NOT NULL, f FLOAT, PRIMARY KEY(n))ENGINE=NDB;
+CREATE TRIGGER test.t1_bi_t2 BEFORE INSERT ON test.t2 FOR EACH ROW INSERT INTO test.t1 VALUES (NULL, 1.234)//
+INSERT INTO test.t2 VALUES (1, 0.0);
+INSERT INTO test.t2 VALUES (1, 0.0);
+Got one of the listed errors
+select * from test.t1;
+n d
+1 1.234
+select * from test.t2;
+n f
+1 0
+select * from test.t1;
+n d
+1 1.234
+select * from test.t2;
+n f
+1 0
+DROP TRIGGER test.t1_bi_t2;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
diff --git a/mysql-test/r/rpl_ndbapi_multi.result b/mysql-test/r/rpl_ndbapi_multi.result
new file mode 100644
index 00000000000..5de6914882d
--- /dev/null
+++ b/mysql-test/r/rpl_ndbapi_multi.result
@@ -0,0 +1,8 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+Running ndbapi_simple_dual
+Running mgmapi_logevent
diff --git a/mysql-test/r/rpl_openssl.result b/mysql-test/r/rpl_openssl.result
index c10606bc03f..4fe02088632 100644
--- a/mysql-test/r/rpl_openssl.result
+++ b/mysql-test/r/rpl_openssl.result
@@ -20,7 +20,7 @@ t
1
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 replssl MASTER_MYPORT 1 master-bin.000001 398 # # master-bin.000001 Yes Yes 0 0 398 # None 0 Yes MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem #
+# 127.0.0.1 replssl MASTER_MYPORT 1 # # # # # # Yes # 0 0 # # None 0 Yes MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem #
stop slave;
change master to master_user='root',master_password='', master_ssl=0;
start slave;
@@ -28,4 +28,4 @@ drop user replssl@localhost;
drop table t1;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 564 # # master-bin.000001 Yes Yes 0 0 564 # None 0 No MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem #
+# 127.0.0.1 root MASTER_MYPORT 1 # # # # # # Yes # 0 0 # # None 0 No MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem #
diff --git a/mysql-test/r/rpl_ps.result b/mysql-test/r/rpl_ps.result
index c969575de76..73c36af4862 100644
--- a/mysql-test/r/rpl_ps.result
+++ b/mysql-test/r/rpl_ps.result
@@ -11,7 +11,7 @@ set @var1= "from-master-1";
execute stmt1 using @var1;
set @var1= "from-master-2-'',";
execute stmt1 using @var1;
-select * from t1;
+SELECT * FROM t1 ORDER BY n;
n
from-master-1
from-master-2-'',
@@ -19,10 +19,12 @@ set @var2= 'insert into t1 values (concat("from-var-", ?))';
prepare stmt2 from @var2;
set @var1='from-master-3';
execute stmt2 using @var1;
-select * from t1;
+SELECT * FROM t1 ORDER BY n;
n
from-master-1
from-master-2-'',
from-var-from-master-3
drop table t1;
stop slave;
+reset master;
+reset slave;
diff --git a/mysql-test/r/rpl_rbr_to_sbr.result b/mysql-test/r/rpl_rbr_to_sbr.result
new file mode 100644
index 00000000000..4b2d129c732
--- /dev/null
+++ b/mysql-test/r/rpl_rbr_to_sbr.result
@@ -0,0 +1,66 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+SET BINLOG_FORMAT=MIXED;
+SET GLOBAL BINLOG_FORMAT=MIXED;
+SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT;
+@@GLOBAL.BINLOG_FORMAT @@SESSION.BINLOG_FORMAT
+MIXED MIXED
+**** On Master ****
+CREATE TABLE t1 (a INT, b LONG);
+INSERT INTO t1 VALUES (1,1), (2,2);
+INSERT INTO t1 VALUES (3,UUID()), (4,UUID());
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1 (a INT, b LONG)
+master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+**** On Slave ****
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 450
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 450
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000001 # Query 2 # use `test`; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9
+slave-bin.000001 # Query 1 # use `test`; CREATE TABLE t1 (a INT, b LONG)
+slave-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/r/rpl_redirect.result b/mysql-test/r/rpl_redirect.result
index 9dd51eaba4d..dd16626cbe3 100644
--- a/mysql-test/r/rpl_redirect.result
+++ b/mysql-test/r/rpl_redirect.result
@@ -12,26 +12,26 @@ Server_id Host Port Rpl_recovery_rank Master_id
create table t1 ( n int);
insert into t1 values (1),(2),(3),(4);
insert into t1 values(5);
-select * from t1;
+SELECT * FROM t1 ORDER BY n;
n
1
2
3
4
5
-select * from t1;
+SELECT * FROM t1 ORDER BY n;
n
1
2
3
4
-select * from t1;
+SELECT * FROM t1 ORDER BY n;
n
1
2
3
4
-select * from t1;
+SELECT * FROM t1 ORDER BY n;
n
1
2
@@ -39,4 +39,3 @@ n
4
5
drop table t1;
-drop table t1;
diff --git a/mysql-test/r/rpl000005.result b/mysql-test/r/rpl_relay_space_innodb.result
index 8acfa2cbfac..54aac2eca35 100644
--- a/mysql-test/r/rpl000005.result
+++ b/mysql-test/r/rpl_relay_space_innodb.result
@@ -7,19 +7,19 @@ start slave;
SHOW VARIABLES LIKE 'relay_log_space_limit';
Variable_name Value
relay_log_space_limit 0
-CREATE TABLE t1 (name varchar(64), age smallint(3));
-INSERT INTO t1 SET name='Andy', age=31;
-INSERT t1 SET name='Jacob', age=2;
-INSERT into t1 SET name='Caleb', age=1;
+CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=InnoDB;
+INSERT INTO t1 SET name='Andy', age=31;
+INSERT INTO t1 SET name='Jacob', age=2;
+INSERT INTO t1 SET name='Caleb', age=1;
ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY;
-select * from t1;
+SELECT * FROM t1 ORDER BY id;
name age id
Andy 31 00000001
Jacob 2 00000002
Caleb 1 00000003
-select * from t1;
+SELECT * FROM t1 ORDER BY id;
name age id
Andy 31 00000001
Jacob 2 00000002
Caleb 1 00000003
-drop table t1;
+DROP TABLE t1;
diff --git a/mysql-test/r/rpl_relay_space_myisam.result b/mysql-test/r/rpl_relay_space_myisam.result
new file mode 100644
index 00000000000..e8d2d63e46e
--- /dev/null
+++ b/mysql-test/r/rpl_relay_space_myisam.result
@@ -0,0 +1,25 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+SHOW VARIABLES LIKE 'relay_log_space_limit';
+Variable_name Value
+relay_log_space_limit 0
+CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=MyISAM;
+INSERT INTO t1 SET name='Andy', age=31;
+INSERT INTO t1 SET name='Jacob', age=2;
+INSERT INTO t1 SET name='Caleb', age=1;
+ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY;
+SELECT * FROM t1 ORDER BY id;
+name age id
+Andy 31 00000001
+Jacob 2 00000002
+Caleb 1 00000003
+SELECT * FROM t1 ORDER BY id;
+name age id
+Andy 31 00000001
+Jacob 2 00000002
+Caleb 1 00000003
+DROP TABLE t1;
diff --git a/mysql-test/r/rpl_replicate_do.result b/mysql-test/r/rpl_replicate_do.result
index f79f6305342..43e7c6779bf 100644
--- a/mysql-test/r/rpl_replicate_do.result
+++ b/mysql-test/r/rpl_replicate_do.result
@@ -16,7 +16,7 @@ insert into t1 values(15),(16),(17);
update t1 set m=20 where m=16;
delete from t1 where m=17;
create table t11 select * from t1;
-select * from t1;
+select * from t1 ORDER BY m;
m
15
20
@@ -28,7 +28,7 @@ ERROR 42S02: Table 'test.t11' doesn't exist
drop table if exists t1,t2,t11;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1658 # # master-bin.000001 Yes Yes test.t1 0 0 1658 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 # # # master-bin.000001 Yes Yes test.t1 # 0 0 # # None 0 No #
create table t1 (ts timestamp);
set one_shot time_zone='met';
insert into t1 values('2005-08-12 00:00:00');
diff --git a/mysql-test/r/rpl_replicate_ignore_db.result b/mysql-test/r/rpl_replicate_ignore_db.result
new file mode 100644
index 00000000000..0135804c02d
--- /dev/null
+++ b/mysql-test/r/rpl_replicate_ignore_db.result
@@ -0,0 +1,23 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest1;
+drop database if exists mysqltest2;
+create database mysqltest1;
+create database mysqltest2;
+use mysqltest1;
+create table t1 (a int);
+insert into t1 values(1);
+select * from mysqltest1.t1;
+ERROR 42S02: Table 'mysqltest1.t1' doesn't exist
+use mysqltest2;
+create table t1 (a int);
+insert into t1 values(1);
+select * from mysqltest2.t1;
+a
+1
+drop database mysqltest1;
+drop database mysqltest2;
diff --git a/mysql-test/r/rpl_rewrite_db.result b/mysql-test/r/rpl_rewrt_db.result
index 1b843bffdca..1b843bffdca 100644
--- a/mysql-test/r/rpl_rewrite_db.result
+++ b/mysql-test/r/rpl_rewrt_db.result
diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result
index bf2ef98c87f..264f5d224bd 100644
--- a/mysql-test/r/rpl_rotate_logs.result
+++ b/mysql-test/r/rpl_rotate_logs.result
@@ -16,7 +16,7 @@ create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard');
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 60 master-bin.000001 548 # # master-bin.000001 Yes Yes 0 0 548 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 60 master-bin.000001 552 # # master-bin.000001 Yes Yes # 0 0 552 # None 0 No #
select * from t1;
s
Could not break slave
@@ -27,9 +27,9 @@ insert into t2 values (34),(67),(123);
flush logs;
show binary logs;
Log_name File_size
-master-bin.000001 592
-master-bin.000002 363
-master-bin.000003 98
+master-bin.000001 596
+master-bin.000002 367
+master-bin.000003 102
create table t3 select * from temp_table;
select * from t3;
a
@@ -43,21 +43,21 @@ start slave;
purge master logs to 'master-bin.000002';
show master logs;
Log_name File_size
-master-bin.000002 363
-master-bin.000003 407
+master-bin.000002 367
+master-bin.000003 411
purge binary logs to 'master-bin.000002';
show binary logs;
Log_name File_size
-master-bin.000002 363
-master-bin.000003 407
+master-bin.000002 367
+master-bin.000003 411
purge master logs before now();
show binary logs;
Log_name File_size
-master-bin.000003 407
+master-bin.000003 411
insert into t2 values (65);
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 60 master-bin.000003 496 # # master-bin.000003 Yes Yes 0 0 496 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 60 master-bin.000003 500 # # master-bin.000003 Yes Yes # 0 0 500 # None 0 No #
select * from t2;
m
34
@@ -74,18 +74,18 @@ count(*)
create table t4 select * from temp_table;
show binary logs;
Log_name File_size
-master-bin.000003 4185
-master-bin.000004 4190
-master-bin.000005 2032
+master-bin.000003 4189
+master-bin.000004 4194
+master-bin.000005 2036
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000005 2032
+master-bin.000005 2036
select * from t4;
a
testing temporary tables part 2
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 60 master-bin.000005 2032 # # master-bin.000005 Yes Yes 0 0 2032 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 60 master-bin.000005 2036 # # master-bin.000005 Yes Yes # 0 0 2036 # None 0 No #
lock tables t3 read;
select count(*) from t3 where n >= 4;
count(*)
diff --git a/mysql-test/r/rpl_row_001.result b/mysql-test/r/rpl_row_001.result
new file mode 100644
index 00000000000..fad60af664f
--- /dev/null
+++ b/mysql-test/r/rpl_row_001.result
@@ -0,0 +1,55 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (word CHAR(20) NOT NULL);
+LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
+LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1;
+SELECT * FROM t1 ORDER BY word LIMIT 10;
+word
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+Aaron
+Aaron
+Aaron
+Aaron
+Ababa
+Ababa
+STOP SLAVE;
+SET PASSWORD FOR root@"localhost" = PASSWORD('foo');
+START SLAVE;
+SET PASSWORD FOR root@"localhost" = PASSWORD('');
+CREATE TABLE t3(n INT);
+INSERT INTO t3 VALUES(1),(2);
+SELECT * FROM t3 ORDER BY n;
+n
+1
+2
+SELECT SUM(LENGTH(word)) FROM t1;
+SUM(LENGTH(word))
+1022
+DROP TABLE t1,t3;
+CREATE TABLE t1 (n INT) ENGINE=MYISAM;
+RESET MASTER;
+STOP SLAVE;
+RESET SLAVE;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+LOCK TABLES t1 READ;
+START SLAVE;
+UNLOCK TABLES;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+DROP TABLE t1;
+CREATE TABLE t1 (n INT);
+INSERT INTO t1 VALUES(3456);
+SELECT n FROM t1;
+n
+3456
+DROP TABLE t1;
diff --git a/mysql-test/r/rpl_row_4_bytes.result b/mysql-test/r/rpl_row_4_bytes.result
new file mode 100644
index 00000000000..e2431364ed3
--- /dev/null
+++ b/mysql-test/r/rpl_row_4_bytes.result
@@ -0,0 +1,27 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest1;
+create database mysqltest1;
+use mysqltest1;
+CREATE TABLE t1 (a char(3));
+CREATE TABLE t2 (a char(3));
+insert into t1 values("ANN");
+insert into t1 values("GUI");
+insert into t2 values("LIL");
+insert into t2 values("ABE");
+insert into t2 values("ANG");
+use mysqltest1;
+select * from t1 order by a;
+a
+ANN
+GUI
+select * from t2 order by a;
+a
+ABE
+ANG
+LIL
+DROP DATABASE mysqltest1;
diff --git a/mysql-test/r/rpl_row_NOW.result b/mysql-test/r/rpl_row_NOW.result
new file mode 100644
index 00000000000..ed045efa7af
--- /dev/null
+++ b/mysql-test/r/rpl_row_NOW.result
@@ -0,0 +1,28 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create database if not exists mysqltest1;
+DROP TABLE IF EXISTS mysqltest1.t1;
+CREATE TABLE mysqltest1.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT,
+a TIMESTAMP DEFAULT '2005-05-05 01:01:01',
+b TIMESTAMP DEFAULT '2005-05-05 01:01:01',
+PRIMARY KEY(n));
+CREATE FUNCTION mysqltest1.f1() RETURNS TIMESTAMP
+BEGIN
+DECLARE v1 INT DEFAULT 300;
+WHILE v1 > 0 DO
+SET v1 = v1 - 1;
+END WHILE;
+RETURN NOW();
+END|
+INSERT INTO mysqltest1.t1 VALUES(NULL,NOW(),mysqltest1.f1());
+CREATE TRIGGER mysqltest1.trig1 BEFORE INSERT ON mysqltest1.t1
+FOR EACH ROW BEGIN
+SET new.b = mysqltest1.f1();
+END|
+INSERT INTO mysqltest1.t1 SET n = NULL, a = now();
+DROP TABLE IF EXISTS mysqltest1.t1;
+DROP FUNCTION mysqltest1.f1;
diff --git a/mysql-test/r/rpl_row_USER.result b/mysql-test/r/rpl_row_USER.result
new file mode 100644
index 00000000000..c061ccbdc62
--- /dev/null
+++ b/mysql-test/r/rpl_row_USER.result
@@ -0,0 +1,36 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP DATABASE IF EXISTS mysqltest1;
+CREATE DATABASE mysqltest1;
+CREATE USER tester IDENTIFIED BY 'test';
+GRANT ALL ON mysqltest1.* TO 'tester'@'%' IDENTIFIED BY 'test';
+GRANT ALL ON mysqltest1.* TO ''@'localhost%';
+FLUSH PRIVILEGES;
+CREATE TABLE mysqltest1.t1 (a INT, users VARCHAR(255), PRIMARY KEY(a));
+INSERT INTO mysqltest1.t1 VALUES(1,USER());
+INSERT INTO mysqltest1.t1 VALUES(2,CURRENT_USER());
+create procedure mysqltest1.p1()
+begin
+INSERT INTO mysqltest1.t1 VALUES(3,USER());
+INSERT INTO mysqltest1.t1 VALUES(4,CURRENT_USER());
+end|
+CALL mysqltest1.p1();
+SELECT * FROM mysqltest1.t1 ORDER BY a;
+a users
+1 tester@localhost
+2 @localhost
+3 tester@localhost
+4 @localhost
+SELECT * FROM mysqltest1.t1 ORDER BY a;
+a users
+1 tester@localhost
+2 @localhost
+3 tester@localhost
+4 @localhost
+DROP DATABASE mysqltest1;
+REVOKE ALL ON mysqltest1.* FROM 'tester'@'%';
+REVOKE ALL ON mysqltest1.* FROM ''@'localhost%';
diff --git a/mysql-test/r/rpl_row_UUID.result b/mysql-test/r/rpl_row_UUID.result
new file mode 100644
index 00000000000..f56dc145901
--- /dev/null
+++ b/mysql-test/r/rpl_row_UUID.result
@@ -0,0 +1,40 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, vchar_column VARCHAR(100), PRIMARY KEY(a)) engine=myisam;
+INSERT INTO test.t1 VALUES(1,UUID(),UUID());
+create procedure test.p1()
+begin
+INSERT INTO test.t1 VALUES(2,UUID(),UUID());
+INSERT INTO test.t1 VALUES(3,UUID(),UUID());
+end|
+CALL test.p1();
+create function test.fn1(x int)
+returns int
+begin
+insert into t1 values (4+x,UUID(),UUID());
+insert into t1 values (5+x,UUID(),UUID());
+return 0;
+end|
+select fn1(0);
+fn1(0)
+0
+create table t2 (a int);
+insert into t2 values(fn1(2));
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL DEFAULT '0',
+ `blob_column` longblob,
+ `vchar_column` varchar(100) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP PROCEDURE test.p1;
+DROP FUNCTION test.fn1;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
diff --git a/mysql-test/r/rpl_row_basic_11bugs.result b/mysql-test/r/rpl_row_basic_11bugs.result
new file mode 100644
index 00000000000..e49facd2d70
--- /dev/null
+++ b/mysql-test/r/rpl_row_basic_11bugs.result
@@ -0,0 +1,122 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE DATABASE test_ignore;
+**** On Master ****
+SHOW DATABASES;
+Database
+information_schema
+cluster
+mysql
+test
+test_ignore
+USE test;
+CREATE TABLE t1 (a INT, b INT);
+SHOW TABLES;
+Tables_in_test
+t1
+INSERT INTO t1 VALUES (1,1), (2,2);
+USE test_ignore;
+CREATE TABLE t2 (a INT, b INT);
+SHOW TABLES;
+Tables_in_test_ignore
+t2
+INSERT INTO t2 VALUES (3,3), (4,4);
+SHOW BINLOG EVENTS FROM 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 102 Query 1 195 use `test`; CREATE TABLE t1 (a INT, b INT)
+master-bin.000001 195 Table_map 1 235 table_id: # (test.t1)
+master-bin.000001 235 Write_rows 1 282 table_id: # flags: STMT_END_F
+**** On Slave ****
+SHOW DATABASES;
+Database
+information_schema
+cluster
+mysql
+test
+USE test;
+SHOW TABLES;
+Tables_in_test
+t1
+USE test_ignore;
+ERROR 42000: Unknown database 'test_ignore'
+DROP DATABASE test_ignore;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (a INT);
+DELETE FROM t1;
+INSERT INTO t1 VALUES (1),(2);
+DELETE FROM t1 WHERE a = 0;
+UPDATE t1 SET a=99 WHERE a = 0;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 188 use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001 188 Table_map 1 227 table_id: # (test.t1)
+master-bin.000001 227 Write_rows 1 266 table_id: # flags: STMT_END_F
+DROP TABLE t1;
+================ Test for BUG#17620 ================
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** On Slave ****
+SET GLOBAL QUERY_CACHE_SIZE=0;
+**** On Master ****
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+**** On Slave ****
+SET GLOBAL QUERY_CACHE_SIZE=16*1024*1024;
+**** On Master ****
+INSERT INTO t1 VALUES (4),(5),(6);
+**** On Slave ****
+SELECT * FROM t1;
+a
+1
+2
+3
+4
+5
+6
+**** On Master ****
+INSERT INTO t1 VALUES (7),(8),(9);
+**** On Slave ****
+SELECT * FROM t1;
+a
+1
+2
+3
+4
+5
+6
+7
+8
+9
+================ Test for BUG#22550 ================
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (a BIT(1), b INT) ENGINE=MYISAM;
+INSERT INTO t1 VALUES(1,2);
+SELECT HEX(a),b FROM t1;
+HEX(a) b
+1 2
+SELECT HEX(a),b FROM t1;
+HEX(a) b
+1 2
+UPDATE t1 SET a=0 WHERE b=2;
+SELECT HEX(a),b FROM t1;
+HEX(a) b
+0 2
+SELECT HEX(a),b FROM t1;
+HEX(a) b
+0 2
diff --git a/mysql-test/r/rpl_row_basic_2myisam.result b/mysql-test/r/rpl_row_basic_2myisam.result
new file mode 100644
index 00000000000..a6877b27b95
--- /dev/null
+++ b/mysql-test/r/rpl_row_basic_2myisam.result
@@ -0,0 +1,418 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)) ENGINE = 'MYISAM' ;
+SELECT * FROM t1;
+C1 C2
+SELECT * FROM t1;
+C1 C2
+INSERT INTO t1 VALUES ('A','B'), ('X','Y'), ('X','X');
+INSERT INTO t1 VALUES ('A','C'), ('X','Z'), ('A','A');
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A A
+A B
+A C
+X X
+X Y
+X Z
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A A
+A B
+A C
+X X
+X Y
+X Z
+DELETE FROM t1 WHERE C1 = C2;
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A C
+X Y
+X Z
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A C
+X Y
+X Z
+UPDATE t1 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A I
+X Y
+X Z
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A I
+X Y
+X Z
+UPDATE t1 SET c2 = 'Q' WHERE c1 = 'A' AND c2 = 'N';
+SELECT * FROM t1 ORDER BY c1,c2;
+C1 C2
+A B
+A I
+X Y
+X Z
+SELECT * FROM t1 ORDER BY c1,c2;
+C1 C2
+A B
+A I
+X Y
+X Z
+CREATE TABLE t2 (c1 INT, c12 char(1), c2 INT, PRIMARY KEY (c1)) ENGINE = 'MYISAM' ;
+INSERT INTO t2
+VALUES (1,'A',2), (2,'A',4), (3,'A',9), (4,'A',15), (5,'A',25),
+(6,'A',35), (7,'A',50), (8,'A',64), (9,'A',81);
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 2
+2 A 4
+3 A 9
+4 A 15
+5 A 25
+6 A 35
+7 A 50
+8 A 64
+9 A 81
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+2 A 4
+3 A 9
+5 A 25
+8 A 64
+9 A 81
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 2
+2 A 4
+3 A 9
+4 A 15
+5 A 25
+6 A 35
+7 A 50
+8 A 64
+9 A 81
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+2 A 4
+3 A 9
+5 A 25
+8 A 64
+9 A 81
+UPDATE t2 SET c2 = c1*c1 WHERE c2 != c1*c1;
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+UPDATE t2 SET c12 = 'Q' WHERE c1 = 1 AND c2 = 999;
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+DELETE FROM t2 WHERE c1 % 4 = 0;
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+5 A 25
+6 A 36
+7 A 49
+9 A 81
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+5 A 25
+6 A 36
+7 A 49
+9 A 81
+UPDATE t2 SET c12='X';
+CREATE TABLE t3 (C1 CHAR(1), C2 CHAR(1), pk1 INT, C3 CHAR(1), pk2 INT, PRIMARY KEY (pk1,pk2)) ENGINE = 'MYISAM' ;
+INSERT INTO t3 VALUES ('A','B',1,'B',1), ('X','Y',2,'B',1), ('X','X',3,'B',1);
+INSERT INTO t3 VALUES ('A','C',1,'B',2), ('X','Z',2,'B',2), ('A','A',3,'B',2);
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A A 3 B 2
+A B 1 B 1
+A C 1 B 2
+X X 3 B 1
+X Y 2 B 1
+X Z 2 B 2
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A A 3 B 2
+A B 1 B 1
+A C 1 B 2
+X X 3 B 1
+X Y 2 B 1
+X Z 2 B 2
+DELETE FROM t3 WHERE C1 = C2;
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A C 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A C 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+UPDATE t3 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A I 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A I 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+CREATE TABLE t6 (C1 CHAR(1), C2 CHAR(1), C3 INT) ENGINE = 'MYISAM' ;
+INSERT INTO t6 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
+INSERT INTO t6 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+X X 3
+A C 4
+X Z 5
+A A 6
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+X X 3
+A C 4
+X Z 5
+A A 6
+DELETE FROM t6 WHERE C1 = C2;
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A C 4
+X Z 5
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A C 4
+X Z 5
+UPDATE t6 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A I 4
+X Z 5
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A I 4
+X Z 5
+CREATE TABLE t5 (C1 CHAR(1), C2 CHAR(1), C3 INT PRIMARY KEY) ENGINE = 'MYISAM' ;
+INSERT INTO t5 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
+INSERT INTO t5 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
+UPDATE t5,t2,t3 SET t5.C2='Q', t2.c12='R', t3.C3 ='S' WHERE t5.C1 = t2.c12 AND t5.C1 = t3.C1;
+SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2;
+C1 C2 C3 c1 c12 c2 C1 C2 pk1 C3 pk2
+X Q 2 1 R 1 X Y 2 S 1
+X Q 2 1 R 1 X Z 2 S 2
+X Q 2 2 R 4 X Y 2 S 1
+X Q 2 2 R 4 X Z 2 S 2
+X Q 2 3 R 9 X Y 2 S 1
+X Q 2 3 R 9 X Z 2 S 2
+X Q 2 5 R 25 X Y 2 S 1
+X Q 2 5 R 25 X Z 2 S 2
+X Q 2 6 R 36 X Y 2 S 1
+X Q 2 6 R 36 X Z 2 S 2
+X Q 2 7 R 49 X Y 2 S 1
+X Q 2 7 R 49 X Z 2 S 2
+X Q 2 9 R 81 X Y 2 S 1
+X Q 2 9 R 81 X Z 2 S 2
+X Q 3 1 R 1 X Y 2 S 1
+X Q 3 1 R 1 X Z 2 S 2
+X Q 3 2 R 4 X Y 2 S 1
+X Q 3 2 R 4 X Z 2 S 2
+X Q 3 3 R 9 X Y 2 S 1
+X Q 3 3 R 9 X Z 2 S 2
+X Q 3 5 R 25 X Y 2 S 1
+X Q 3 5 R 25 X Z 2 S 2
+X Q 3 6 R 36 X Y 2 S 1
+X Q 3 6 R 36 X Z 2 S 2
+X Q 3 7 R 49 X Y 2 S 1
+X Q 3 7 R 49 X Z 2 S 2
+X Q 3 9 R 81 X Y 2 S 1
+X Q 3 9 R 81 X Z 2 S 2
+X Q 5 1 R 1 X Y 2 S 1
+X Q 5 1 R 1 X Z 2 S 2
+X Q 5 2 R 4 X Y 2 S 1
+X Q 5 2 R 4 X Z 2 S 2
+X Q 5 3 R 9 X Y 2 S 1
+X Q 5 3 R 9 X Z 2 S 2
+X Q 5 5 R 25 X Y 2 S 1
+X Q 5 5 R 25 X Z 2 S 2
+X Q 5 6 R 36 X Y 2 S 1
+X Q 5 6 R 36 X Z 2 S 2
+X Q 5 7 R 49 X Y 2 S 1
+X Q 5 7 R 49 X Z 2 S 2
+X Q 5 9 R 81 X Y 2 S 1
+X Q 5 9 R 81 X Z 2 S 2
+SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2;
+C1 C2 C3 c1 c12 c2 C1 C2 pk1 C3 pk2
+X Q 2 1 R 1 X Y 2 S 1
+X Q 2 1 R 1 X Z 2 S 2
+X Q 2 2 R 4 X Y 2 S 1
+X Q 2 2 R 4 X Z 2 S 2
+X Q 2 3 R 9 X Y 2 S 1
+X Q 2 3 R 9 X Z 2 S 2
+X Q 2 5 R 25 X Y 2 S 1
+X Q 2 5 R 25 X Z 2 S 2
+X Q 2 6 R 36 X Y 2 S 1
+X Q 2 6 R 36 X Z 2 S 2
+X Q 2 7 R 49 X Y 2 S 1
+X Q 2 7 R 49 X Z 2 S 2
+X Q 2 9 R 81 X Y 2 S 1
+X Q 2 9 R 81 X Z 2 S 2
+X Q 3 1 R 1 X Y 2 S 1
+X Q 3 1 R 1 X Z 2 S 2
+X Q 3 2 R 4 X Y 2 S 1
+X Q 3 2 R 4 X Z 2 S 2
+X Q 3 3 R 9 X Y 2 S 1
+X Q 3 3 R 9 X Z 2 S 2
+X Q 3 5 R 25 X Y 2 S 1
+X Q 3 5 R 25 X Z 2 S 2
+X Q 3 6 R 36 X Y 2 S 1
+X Q 3 6 R 36 X Z 2 S 2
+X Q 3 7 R 49 X Y 2 S 1
+X Q 3 7 R 49 X Z 2 S 2
+X Q 3 9 R 81 X Y 2 S 1
+X Q 3 9 R 81 X Z 2 S 2
+X Q 5 1 R 1 X Y 2 S 1
+X Q 5 1 R 1 X Z 2 S 2
+X Q 5 2 R 4 X Y 2 S 1
+X Q 5 2 R 4 X Z 2 S 2
+X Q 5 3 R 9 X Y 2 S 1
+X Q 5 3 R 9 X Z 2 S 2
+X Q 5 5 R 25 X Y 2 S 1
+X Q 5 5 R 25 X Z 2 S 2
+X Q 5 6 R 36 X Y 2 S 1
+X Q 5 6 R 36 X Z 2 S 2
+X Q 5 7 R 49 X Y 2 S 1
+X Q 5 7 R 49 X Z 2 S 2
+X Q 5 9 R 81 X Y 2 S 1
+X Q 5 9 R 81 X Z 2 S 2
+CREATE TABLE t4 (C1 CHAR(1) PRIMARY KEY, B1 BIT(1), B2 BIT(1) NOT NULL DEFAULT 0, C2 CHAR(1) NOT NULL DEFAULT 'A') ENGINE = 'MYISAM' ;
+INSERT INTO t4 SET C1 = 1;
+SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
+C1 HEX(B1) HEX(B2)
+1 NULL 0
+SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
+C1 HEX(B1) HEX(B2)
+1 NULL 0
+CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = 'MYISAM' ;
+--- on slave: original values ---
+INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
+SELECT * FROM t7 ORDER BY C1;
+C1 C2
+1 3
+2 6
+3 9
+--- on master: new values inserted ---
+INSERT INTO t7 VALUES (1,2), (2,4), (3,6);
+SELECT * FROM t7 ORDER BY C1;
+C1 C2
+1 2
+2 4
+3 6
+--- on slave: old values should be overwritten by replicated values ---
+SELECT * FROM t7 ORDER BY C1;
+C1 C2
+1 2
+2 4
+3 6
+--- on master ---
+CREATE TABLE t8 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = 'MYISAM' ;
+INSERT INTO t8 VALUES (99,99,99);
+INSERT INTO t8 VALUES (99,22,33);
+ERROR 23000: Duplicate entry '99' for key 'PRIMARY'
+INSERT INTO t8 VALUES (11,99,33);
+ERROR 23000: Duplicate entry '99' for key 'b'
+INSERT INTO t8 VALUES (11,22,99);
+ERROR 23000: Duplicate entry '99' for key 'c'
+SELECT * FROM t8 ORDER BY a;
+a b c
+99 99 99
+--- on slave ---
+SELECT * FROM t8 ORDER BY a;
+a b c
+99 99 99
+INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9);
+SELECT * FROM t8 ORDER BY a;
+a b c
+1 2 3
+2 4 6
+3 6 9
+99 99 99
+--- on master ---
+INSERT INTO t8 VALUES (2,4,8);
+--- on slave ---
+SELECT * FROM t8 ORDER BY a;
+a b c
+1 2 3
+2 4 8
+3 6 9
+99 99 99
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
diff --git a/mysql-test/r/rpl_row_basic_3innodb.result b/mysql-test/r/rpl_row_basic_3innodb.result
new file mode 100644
index 00000000000..4c6ec627db5
--- /dev/null
+++ b/mysql-test/r/rpl_row_basic_3innodb.result
@@ -0,0 +1,418 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)) ENGINE = 'INNODB' ;
+SELECT * FROM t1;
+C1 C2
+SELECT * FROM t1;
+C1 C2
+INSERT INTO t1 VALUES ('A','B'), ('X','Y'), ('X','X');
+INSERT INTO t1 VALUES ('A','C'), ('X','Z'), ('A','A');
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A A
+A B
+A C
+X X
+X Y
+X Z
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A A
+A B
+A C
+X X
+X Y
+X Z
+DELETE FROM t1 WHERE C1 = C2;
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A C
+X Y
+X Z
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A C
+X Y
+X Z
+UPDATE t1 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A I
+X Y
+X Z
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A I
+X Y
+X Z
+UPDATE t1 SET c2 = 'Q' WHERE c1 = 'A' AND c2 = 'N';
+SELECT * FROM t1 ORDER BY c1,c2;
+C1 C2
+A B
+A I
+X Y
+X Z
+SELECT * FROM t1 ORDER BY c1,c2;
+C1 C2
+A B
+A I
+X Y
+X Z
+CREATE TABLE t2 (c1 INT, c12 char(1), c2 INT, PRIMARY KEY (c1)) ENGINE = 'INNODB' ;
+INSERT INTO t2
+VALUES (1,'A',2), (2,'A',4), (3,'A',9), (4,'A',15), (5,'A',25),
+(6,'A',35), (7,'A',50), (8,'A',64), (9,'A',81);
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 2
+2 A 4
+3 A 9
+4 A 15
+5 A 25
+6 A 35
+7 A 50
+8 A 64
+9 A 81
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+2 A 4
+3 A 9
+5 A 25
+8 A 64
+9 A 81
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 2
+2 A 4
+3 A 9
+4 A 15
+5 A 25
+6 A 35
+7 A 50
+8 A 64
+9 A 81
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+2 A 4
+3 A 9
+5 A 25
+8 A 64
+9 A 81
+UPDATE t2 SET c2 = c1*c1 WHERE c2 != c1*c1;
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+UPDATE t2 SET c12 = 'Q' WHERE c1 = 1 AND c2 = 999;
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+DELETE FROM t2 WHERE c1 % 4 = 0;
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+5 A 25
+6 A 36
+7 A 49
+9 A 81
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+5 A 25
+6 A 36
+7 A 49
+9 A 81
+UPDATE t2 SET c12='X';
+CREATE TABLE t3 (C1 CHAR(1), C2 CHAR(1), pk1 INT, C3 CHAR(1), pk2 INT, PRIMARY KEY (pk1,pk2)) ENGINE = 'INNODB' ;
+INSERT INTO t3 VALUES ('A','B',1,'B',1), ('X','Y',2,'B',1), ('X','X',3,'B',1);
+INSERT INTO t3 VALUES ('A','C',1,'B',2), ('X','Z',2,'B',2), ('A','A',3,'B',2);
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A A 3 B 2
+A B 1 B 1
+A C 1 B 2
+X X 3 B 1
+X Y 2 B 1
+X Z 2 B 2
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A A 3 B 2
+A B 1 B 1
+A C 1 B 2
+X X 3 B 1
+X Y 2 B 1
+X Z 2 B 2
+DELETE FROM t3 WHERE C1 = C2;
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A C 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A C 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+UPDATE t3 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A I 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A I 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+CREATE TABLE t6 (C1 CHAR(1), C2 CHAR(1), C3 INT) ENGINE = 'INNODB' ;
+INSERT INTO t6 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
+INSERT INTO t6 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+X X 3
+A C 4
+X Z 5
+A A 6
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+X X 3
+A C 4
+X Z 5
+A A 6
+DELETE FROM t6 WHERE C1 = C2;
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A C 4
+X Z 5
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A C 4
+X Z 5
+UPDATE t6 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A I 4
+X Z 5
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A I 4
+X Z 5
+CREATE TABLE t5 (C1 CHAR(1), C2 CHAR(1), C3 INT PRIMARY KEY) ENGINE = 'INNODB' ;
+INSERT INTO t5 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
+INSERT INTO t5 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
+UPDATE t5,t2,t3 SET t5.C2='Q', t2.c12='R', t3.C3 ='S' WHERE t5.C1 = t2.c12 AND t5.C1 = t3.C1;
+SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2;
+C1 C2 C3 c1 c12 c2 C1 C2 pk1 C3 pk2
+X Q 2 1 R 1 X Y 2 S 1
+X Q 2 1 R 1 X Z 2 S 2
+X Q 2 2 R 4 X Y 2 S 1
+X Q 2 2 R 4 X Z 2 S 2
+X Q 2 3 R 9 X Y 2 S 1
+X Q 2 3 R 9 X Z 2 S 2
+X Q 2 5 R 25 X Y 2 S 1
+X Q 2 5 R 25 X Z 2 S 2
+X Q 2 6 R 36 X Y 2 S 1
+X Q 2 6 R 36 X Z 2 S 2
+X Q 2 7 R 49 X Y 2 S 1
+X Q 2 7 R 49 X Z 2 S 2
+X Q 2 9 R 81 X Y 2 S 1
+X Q 2 9 R 81 X Z 2 S 2
+X Q 3 1 R 1 X Y 2 S 1
+X Q 3 1 R 1 X Z 2 S 2
+X Q 3 2 R 4 X Y 2 S 1
+X Q 3 2 R 4 X Z 2 S 2
+X Q 3 3 R 9 X Y 2 S 1
+X Q 3 3 R 9 X Z 2 S 2
+X Q 3 5 R 25 X Y 2 S 1
+X Q 3 5 R 25 X Z 2 S 2
+X Q 3 6 R 36 X Y 2 S 1
+X Q 3 6 R 36 X Z 2 S 2
+X Q 3 7 R 49 X Y 2 S 1
+X Q 3 7 R 49 X Z 2 S 2
+X Q 3 9 R 81 X Y 2 S 1
+X Q 3 9 R 81 X Z 2 S 2
+X Q 5 1 R 1 X Y 2 S 1
+X Q 5 1 R 1 X Z 2 S 2
+X Q 5 2 R 4 X Y 2 S 1
+X Q 5 2 R 4 X Z 2 S 2
+X Q 5 3 R 9 X Y 2 S 1
+X Q 5 3 R 9 X Z 2 S 2
+X Q 5 5 R 25 X Y 2 S 1
+X Q 5 5 R 25 X Z 2 S 2
+X Q 5 6 R 36 X Y 2 S 1
+X Q 5 6 R 36 X Z 2 S 2
+X Q 5 7 R 49 X Y 2 S 1
+X Q 5 7 R 49 X Z 2 S 2
+X Q 5 9 R 81 X Y 2 S 1
+X Q 5 9 R 81 X Z 2 S 2
+SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2;
+C1 C2 C3 c1 c12 c2 C1 C2 pk1 C3 pk2
+X Q 2 1 R 1 X Y 2 S 1
+X Q 2 1 R 1 X Z 2 S 2
+X Q 2 2 R 4 X Y 2 S 1
+X Q 2 2 R 4 X Z 2 S 2
+X Q 2 3 R 9 X Y 2 S 1
+X Q 2 3 R 9 X Z 2 S 2
+X Q 2 5 R 25 X Y 2 S 1
+X Q 2 5 R 25 X Z 2 S 2
+X Q 2 6 R 36 X Y 2 S 1
+X Q 2 6 R 36 X Z 2 S 2
+X Q 2 7 R 49 X Y 2 S 1
+X Q 2 7 R 49 X Z 2 S 2
+X Q 2 9 R 81 X Y 2 S 1
+X Q 2 9 R 81 X Z 2 S 2
+X Q 3 1 R 1 X Y 2 S 1
+X Q 3 1 R 1 X Z 2 S 2
+X Q 3 2 R 4 X Y 2 S 1
+X Q 3 2 R 4 X Z 2 S 2
+X Q 3 3 R 9 X Y 2 S 1
+X Q 3 3 R 9 X Z 2 S 2
+X Q 3 5 R 25 X Y 2 S 1
+X Q 3 5 R 25 X Z 2 S 2
+X Q 3 6 R 36 X Y 2 S 1
+X Q 3 6 R 36 X Z 2 S 2
+X Q 3 7 R 49 X Y 2 S 1
+X Q 3 7 R 49 X Z 2 S 2
+X Q 3 9 R 81 X Y 2 S 1
+X Q 3 9 R 81 X Z 2 S 2
+X Q 5 1 R 1 X Y 2 S 1
+X Q 5 1 R 1 X Z 2 S 2
+X Q 5 2 R 4 X Y 2 S 1
+X Q 5 2 R 4 X Z 2 S 2
+X Q 5 3 R 9 X Y 2 S 1
+X Q 5 3 R 9 X Z 2 S 2
+X Q 5 5 R 25 X Y 2 S 1
+X Q 5 5 R 25 X Z 2 S 2
+X Q 5 6 R 36 X Y 2 S 1
+X Q 5 6 R 36 X Z 2 S 2
+X Q 5 7 R 49 X Y 2 S 1
+X Q 5 7 R 49 X Z 2 S 2
+X Q 5 9 R 81 X Y 2 S 1
+X Q 5 9 R 81 X Z 2 S 2
+CREATE TABLE t4 (C1 CHAR(1) PRIMARY KEY, B1 BIT(1), B2 BIT(1) NOT NULL DEFAULT 0, C2 CHAR(1) NOT NULL DEFAULT 'A') ENGINE = 'INNODB' ;
+INSERT INTO t4 SET C1 = 1;
+SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
+C1 HEX(B1) HEX(B2)
+1 NULL 0
+SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
+C1 HEX(B1) HEX(B2)
+1 NULL 0
+CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = 'INNODB' ;
+--- on slave: original values ---
+INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
+SELECT * FROM t7 ORDER BY C1;
+C1 C2
+1 3
+2 6
+3 9
+--- on master: new values inserted ---
+INSERT INTO t7 VALUES (1,2), (2,4), (3,6);
+SELECT * FROM t7 ORDER BY C1;
+C1 C2
+1 2
+2 4
+3 6
+--- on slave: old values should be overwritten by replicated values ---
+SELECT * FROM t7 ORDER BY C1;
+C1 C2
+1 2
+2 4
+3 6
+--- on master ---
+CREATE TABLE t8 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = 'INNODB' ;
+INSERT INTO t8 VALUES (99,99,99);
+INSERT INTO t8 VALUES (99,22,33);
+ERROR 23000: Duplicate entry '99' for key 'PRIMARY'
+INSERT INTO t8 VALUES (11,99,33);
+ERROR 23000: Duplicate entry '99' for key 'b'
+INSERT INTO t8 VALUES (11,22,99);
+ERROR 23000: Duplicate entry '99' for key 'c'
+SELECT * FROM t8 ORDER BY a;
+a b c
+99 99 99
+--- on slave ---
+SELECT * FROM t8 ORDER BY a;
+a b c
+99 99 99
+INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9);
+SELECT * FROM t8 ORDER BY a;
+a b c
+1 2 3
+2 4 6
+3 6 9
+99 99 99
+--- on master ---
+INSERT INTO t8 VALUES (2,4,8);
+--- on slave ---
+SELECT * FROM t8 ORDER BY a;
+a b c
+1 2 3
+2 4 8
+3 6 9
+99 99 99
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
diff --git a/mysql-test/r/rpl_row_basic_7ndb.result b/mysql-test/r/rpl_row_basic_7ndb.result
new file mode 100644
index 00000000000..5519e0dcd0c
--- /dev/null
+++ b/mysql-test/r/rpl_row_basic_7ndb.result
@@ -0,0 +1,418 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)) ENGINE = 'NDB' ;
+SELECT * FROM t1;
+C1 C2
+SELECT * FROM t1;
+C1 C2
+INSERT INTO t1 VALUES ('A','B'), ('X','Y'), ('X','X');
+INSERT INTO t1 VALUES ('A','C'), ('X','Z'), ('A','A');
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A A
+A B
+A C
+X X
+X Y
+X Z
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A A
+A B
+A C
+X X
+X Y
+X Z
+DELETE FROM t1 WHERE C1 = C2;
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A C
+X Y
+X Z
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A C
+X Y
+X Z
+UPDATE t1 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A I
+X Y
+X Z
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A I
+X Y
+X Z
+UPDATE t1 SET c2 = 'Q' WHERE c1 = 'A' AND c2 = 'N';
+SELECT * FROM t1 ORDER BY c1,c2;
+C1 C2
+A B
+A I
+X Y
+X Z
+SELECT * FROM t1 ORDER BY c1,c2;
+C1 C2
+A B
+A I
+X Y
+X Z
+CREATE TABLE t2 (c1 INT, c12 char(1), c2 INT, PRIMARY KEY (c1)) ENGINE = 'NDB' ;
+INSERT INTO t2
+VALUES (1,'A',2), (2,'A',4), (3,'A',9), (4,'A',15), (5,'A',25),
+(6,'A',35), (7,'A',50), (8,'A',64), (9,'A',81);
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 2
+2 A 4
+3 A 9
+4 A 15
+5 A 25
+6 A 35
+7 A 50
+8 A 64
+9 A 81
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+2 A 4
+3 A 9
+5 A 25
+8 A 64
+9 A 81
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 2
+2 A 4
+3 A 9
+4 A 15
+5 A 25
+6 A 35
+7 A 50
+8 A 64
+9 A 81
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+2 A 4
+3 A 9
+5 A 25
+8 A 64
+9 A 81
+UPDATE t2 SET c2 = c1*c1 WHERE c2 != c1*c1;
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+UPDATE t2 SET c12 = 'Q' WHERE c1 = 1 AND c2 = 999;
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+DELETE FROM t2 WHERE c1 % 4 = 0;
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+5 A 25
+6 A 36
+7 A 49
+9 A 81
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+5 A 25
+6 A 36
+7 A 49
+9 A 81
+UPDATE t2 SET c12='X';
+CREATE TABLE t3 (C1 CHAR(1), C2 CHAR(1), pk1 INT, C3 CHAR(1), pk2 INT, PRIMARY KEY (pk1,pk2)) ENGINE = 'NDB' ;
+INSERT INTO t3 VALUES ('A','B',1,'B',1), ('X','Y',2,'B',1), ('X','X',3,'B',1);
+INSERT INTO t3 VALUES ('A','C',1,'B',2), ('X','Z',2,'B',2), ('A','A',3,'B',2);
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A A 3 B 2
+A B 1 B 1
+A C 1 B 2
+X X 3 B 1
+X Y 2 B 1
+X Z 2 B 2
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A A 3 B 2
+A B 1 B 1
+A C 1 B 2
+X X 3 B 1
+X Y 2 B 1
+X Z 2 B 2
+DELETE FROM t3 WHERE C1 = C2;
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A C 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A C 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+UPDATE t3 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A I 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A I 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+CREATE TABLE t6 (C1 CHAR(1), C2 CHAR(1), C3 INT) ENGINE = 'NDB' ;
+INSERT INTO t6 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
+INSERT INTO t6 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+X X 3
+A C 4
+X Z 5
+A A 6
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+X X 3
+A C 4
+X Z 5
+A A 6
+DELETE FROM t6 WHERE C1 = C2;
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A C 4
+X Z 5
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A C 4
+X Z 5
+UPDATE t6 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A I 4
+X Z 5
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A I 4
+X Z 5
+CREATE TABLE t5 (C1 CHAR(1), C2 CHAR(1), C3 INT PRIMARY KEY) ENGINE = 'NDB' ;
+INSERT INTO t5 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
+INSERT INTO t5 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
+UPDATE t5,t2,t3 SET t5.C2='Q', t2.c12='R', t3.C3 ='S' WHERE t5.C1 = t2.c12 AND t5.C1 = t3.C1;
+SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2;
+C1 C2 C3 c1 c12 c2 C1 C2 pk1 C3 pk2
+X Q 2 1 R 1 X Y 2 S 1
+X Q 2 1 R 1 X Z 2 S 2
+X Q 2 2 R 4 X Y 2 S 1
+X Q 2 2 R 4 X Z 2 S 2
+X Q 2 3 R 9 X Y 2 S 1
+X Q 2 3 R 9 X Z 2 S 2
+X Q 2 5 R 25 X Y 2 S 1
+X Q 2 5 R 25 X Z 2 S 2
+X Q 2 6 R 36 X Y 2 S 1
+X Q 2 6 R 36 X Z 2 S 2
+X Q 2 7 R 49 X Y 2 S 1
+X Q 2 7 R 49 X Z 2 S 2
+X Q 2 9 R 81 X Y 2 S 1
+X Q 2 9 R 81 X Z 2 S 2
+X Q 3 1 R 1 X Y 2 S 1
+X Q 3 1 R 1 X Z 2 S 2
+X Q 3 2 R 4 X Y 2 S 1
+X Q 3 2 R 4 X Z 2 S 2
+X Q 3 3 R 9 X Y 2 S 1
+X Q 3 3 R 9 X Z 2 S 2
+X Q 3 5 R 25 X Y 2 S 1
+X Q 3 5 R 25 X Z 2 S 2
+X Q 3 6 R 36 X Y 2 S 1
+X Q 3 6 R 36 X Z 2 S 2
+X Q 3 7 R 49 X Y 2 S 1
+X Q 3 7 R 49 X Z 2 S 2
+X Q 3 9 R 81 X Y 2 S 1
+X Q 3 9 R 81 X Z 2 S 2
+X Q 5 1 R 1 X Y 2 S 1
+X Q 5 1 R 1 X Z 2 S 2
+X Q 5 2 R 4 X Y 2 S 1
+X Q 5 2 R 4 X Z 2 S 2
+X Q 5 3 R 9 X Y 2 S 1
+X Q 5 3 R 9 X Z 2 S 2
+X Q 5 5 R 25 X Y 2 S 1
+X Q 5 5 R 25 X Z 2 S 2
+X Q 5 6 R 36 X Y 2 S 1
+X Q 5 6 R 36 X Z 2 S 2
+X Q 5 7 R 49 X Y 2 S 1
+X Q 5 7 R 49 X Z 2 S 2
+X Q 5 9 R 81 X Y 2 S 1
+X Q 5 9 R 81 X Z 2 S 2
+SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2;
+C1 C2 C3 c1 c12 c2 C1 C2 pk1 C3 pk2
+X Q 2 1 R 1 X Y 2 S 1
+X Q 2 1 R 1 X Z 2 S 2
+X Q 2 2 R 4 X Y 2 S 1
+X Q 2 2 R 4 X Z 2 S 2
+X Q 2 3 R 9 X Y 2 S 1
+X Q 2 3 R 9 X Z 2 S 2
+X Q 2 5 R 25 X Y 2 S 1
+X Q 2 5 R 25 X Z 2 S 2
+X Q 2 6 R 36 X Y 2 S 1
+X Q 2 6 R 36 X Z 2 S 2
+X Q 2 7 R 49 X Y 2 S 1
+X Q 2 7 R 49 X Z 2 S 2
+X Q 2 9 R 81 X Y 2 S 1
+X Q 2 9 R 81 X Z 2 S 2
+X Q 3 1 R 1 X Y 2 S 1
+X Q 3 1 R 1 X Z 2 S 2
+X Q 3 2 R 4 X Y 2 S 1
+X Q 3 2 R 4 X Z 2 S 2
+X Q 3 3 R 9 X Y 2 S 1
+X Q 3 3 R 9 X Z 2 S 2
+X Q 3 5 R 25 X Y 2 S 1
+X Q 3 5 R 25 X Z 2 S 2
+X Q 3 6 R 36 X Y 2 S 1
+X Q 3 6 R 36 X Z 2 S 2
+X Q 3 7 R 49 X Y 2 S 1
+X Q 3 7 R 49 X Z 2 S 2
+X Q 3 9 R 81 X Y 2 S 1
+X Q 3 9 R 81 X Z 2 S 2
+X Q 5 1 R 1 X Y 2 S 1
+X Q 5 1 R 1 X Z 2 S 2
+X Q 5 2 R 4 X Y 2 S 1
+X Q 5 2 R 4 X Z 2 S 2
+X Q 5 3 R 9 X Y 2 S 1
+X Q 5 3 R 9 X Z 2 S 2
+X Q 5 5 R 25 X Y 2 S 1
+X Q 5 5 R 25 X Z 2 S 2
+X Q 5 6 R 36 X Y 2 S 1
+X Q 5 6 R 36 X Z 2 S 2
+X Q 5 7 R 49 X Y 2 S 1
+X Q 5 7 R 49 X Z 2 S 2
+X Q 5 9 R 81 X Y 2 S 1
+X Q 5 9 R 81 X Z 2 S 2
+CREATE TABLE t4 (C1 CHAR(1) PRIMARY KEY, B1 BIT(1), B2 BIT(1) NOT NULL DEFAULT 0, C2 CHAR(1) NOT NULL DEFAULT 'A') ENGINE = 'NDB' ;
+INSERT INTO t4 SET C1 = 1;
+SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
+C1 HEX(B1) HEX(B2)
+1 NULL 0
+SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
+C1 HEX(B1) HEX(B2)
+1 NULL 0
+CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = 'NDB' ;
+--- on slave: original values ---
+INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
+SELECT * FROM t7 ORDER BY C1;
+C1 C2
+1 3
+2 6
+3 9
+--- on master: new values inserted ---
+INSERT INTO t7 VALUES (1,2), (2,4), (3,6);
+SELECT * FROM t7 ORDER BY C1;
+C1 C2
+1 2
+2 4
+3 6
+--- on slave: old values should be overwritten by replicated values ---
+SELECT * FROM t7 ORDER BY C1;
+C1 C2
+1 2
+2 4
+3 6
+--- on master ---
+CREATE TABLE t8 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = 'NDB' ;
+INSERT INTO t8 VALUES (99,99,99);
+INSERT INTO t8 VALUES (99,22,33);
+ERROR 23000: Duplicate entry '99' for key 'PRIMARY'
+INSERT INTO t8 VALUES (11,99,33);
+ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
+INSERT INTO t8 VALUES (11,22,99);
+ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
+SELECT * FROM t8 ORDER BY a;
+a b c
+99 99 99
+--- on slave ---
+SELECT * FROM t8 ORDER BY a;
+a b c
+99 99 99
+INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9);
+SELECT * FROM t8 ORDER BY a;
+a b c
+1 2 3
+2 4 6
+3 6 9
+99 99 99
+--- on master ---
+INSERT INTO t8 VALUES (2,4,8);
+--- on slave ---
+SELECT * FROM t8 ORDER BY a;
+a b c
+1 2 3
+2 4 8
+3 6 9
+99 99 99
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
diff --git a/mysql-test/r/rpl_row_basic_8partition.result b/mysql-test/r/rpl_row_basic_8partition.result
new file mode 100644
index 00000000000..dedd5d044e0
--- /dev/null
+++ b/mysql-test/r/rpl_row_basic_8partition.result
@@ -0,0 +1,655 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TABLE IF EXISTS t1;
+SET @@BINLOG_FORMAT = ROW;
+SELECT @@BINLOG_FORMAT;
+@@BINLOG_FORMAT
+ROW
+**** Partition RANGE testing ****
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE)
+PARTITION BY RANGE (YEAR(t))
+(PARTITION p0 VALUES LESS THAN (1901),
+PARTITION p1 VALUES LESS THAN (1946),
+PARTITION p2 VALUES LESS THAN (1966),
+PARTITION p3 VALUES LESS THAN (1986),
+PARTITION p4 VALUES LESS THAN (2005),
+PARTITION p5 VALUES LESS THAN MAXVALUE);
+--- On master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+--- On slave --
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+ALTER TABLE t1 MODIFY vc TEXT;
+--- On master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+DROP TABLE IF EXISTS t1;
+**** Partition LIST testing ****
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE)
+PARTITION BY LIST(id)
+(PARTITION p0 VALUES IN (2, 4),
+PARTITION p1 VALUES IN (42, 142),
+PARTITION p2 VALUES IN (412));
+--- On master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM) */
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM) */
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+ALTER TABLE t1 MODIFY vc TEXT;
+--- On master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM) */
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM) */
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+DROP TABLE IF EXISTS t1;
+**** Partition HASH testing ****
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE)
+PARTITION BY HASH( YEAR(t) )
+PARTITIONS 4;
+--- On master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 */
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 */
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+ALTER TABLE t1 MODIFY vc TEXT;
+--- On master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 */
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 */
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+DROP TABLE IF EXISTS t1;
+**** Partition by KEY ****
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE,PRIMARY KEY(id))
+PARTITION BY KEY()
+PARTITIONS 4;
+--- On master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
+--- On master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+ALTER TABLE t1 MODIFY vc TEXT;
+--- On master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/r/rpl_row_blob_innodb.result b/mysql-test/r/rpl_row_blob_innodb.result
new file mode 100644
index 00000000000..055efffbd6a
--- /dev/null
+++ b/mysql-test/r/rpl_row_blob_innodb.result
@@ -0,0 +1,156 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+***** Table Create Section ****
+
+CREATE TABLE test.t1 (c1 int not null auto_increment,
+data LONGBLOB, PRIMARY KEY(c1))ENGINE=#;
+
+**** Data Insert Section test.t1 *****
+
+INSERT INTO test.t1 VALUES (NULL, NULL);
+INSERT INTO test.t1 VALUES (NULL, repeat('a',1*1024));
+INSERT INTO test.t1 VALUES (NULL, repeat('b',16*1024));
+
+**** Data Insert Validation Master Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+NULL
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+1024
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
+LENGTH(data)
+16384
+
+**** Data Insert Validation Slave Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+NULL
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+1024
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
+LENGTH(data)
+16384
+
+**** Data Update Section test.t1 ****
+
+UPDATE test.t1 set data=repeat('a',18*1024) where c1 = 1;
+UPDATE t1 set data=repeat('c',17*1024) where c1 = 2;
+
+**** Data Update Validation Master Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+18432
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+17408
+
+**** Data Update Validation Slave Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+18432
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+17408
+
+**** End Test Section test.t1 ****
+
+**** Create Table test.t2 ****
+
+CREATE TABLE test.t2 (
+c1 INT NOT NULL PRIMARY KEY,
+c2 TEXT,
+c3 INT,
+c4 LONGBLOB,
+KEY(c3))ENGINE=#;
+
+*** Setup Values For test.t2 ***
+set @x0 = '01234567012345670123456701234567';
+set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@x0);
+set @d1 = 'dd1';
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @b2 = 'b2';
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @d2 = 'dd2';
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+
+**** Data Insert Section test.t2 *****
+
+INSERT INTO test.t2 VALUES(1,@b1,111,@d1);
+INSERT INTO test.t2 VALUES(2,@b2,222,@d2);
+
+**** Data Insert Validation Master Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+1 2256 b1 3000 dd1
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+2 20000 b2 30000 dd2
+
+**** Data Insert Validation Slave Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+1 2256 b1 3000 dd1
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+2 20000 b2 30000 dd2
+
+**** Data Update Section test.t2 ****
+
+UPDATE test.t2 SET c2=@b2, c4=@d2 WHERE c1=1;
+UPDATE test.t2 SET c2=@b1, c4=@d1 WHERE c1=2;
+
+**** Data Update Validation Master Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+1 20000 b2 30000 dd2
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+2 2256 b1 3000 dd1
+
+**** Data Update Validation Slave Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+1 20000 b2 30000 dd2
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+2 2256 b1 3000 dd1
+
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
diff --git a/mysql-test/r/rpl_row_blob_myisam.result b/mysql-test/r/rpl_row_blob_myisam.result
new file mode 100644
index 00000000000..055efffbd6a
--- /dev/null
+++ b/mysql-test/r/rpl_row_blob_myisam.result
@@ -0,0 +1,156 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+***** Table Create Section ****
+
+CREATE TABLE test.t1 (c1 int not null auto_increment,
+data LONGBLOB, PRIMARY KEY(c1))ENGINE=#;
+
+**** Data Insert Section test.t1 *****
+
+INSERT INTO test.t1 VALUES (NULL, NULL);
+INSERT INTO test.t1 VALUES (NULL, repeat('a',1*1024));
+INSERT INTO test.t1 VALUES (NULL, repeat('b',16*1024));
+
+**** Data Insert Validation Master Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+NULL
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+1024
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
+LENGTH(data)
+16384
+
+**** Data Insert Validation Slave Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+NULL
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+1024
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
+LENGTH(data)
+16384
+
+**** Data Update Section test.t1 ****
+
+UPDATE test.t1 set data=repeat('a',18*1024) where c1 = 1;
+UPDATE t1 set data=repeat('c',17*1024) where c1 = 2;
+
+**** Data Update Validation Master Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+18432
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+17408
+
+**** Data Update Validation Slave Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+18432
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+17408
+
+**** End Test Section test.t1 ****
+
+**** Create Table test.t2 ****
+
+CREATE TABLE test.t2 (
+c1 INT NOT NULL PRIMARY KEY,
+c2 TEXT,
+c3 INT,
+c4 LONGBLOB,
+KEY(c3))ENGINE=#;
+
+*** Setup Values For test.t2 ***
+set @x0 = '01234567012345670123456701234567';
+set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@x0);
+set @d1 = 'dd1';
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @b2 = 'b2';
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @d2 = 'dd2';
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+
+**** Data Insert Section test.t2 *****
+
+INSERT INTO test.t2 VALUES(1,@b1,111,@d1);
+INSERT INTO test.t2 VALUES(2,@b2,222,@d2);
+
+**** Data Insert Validation Master Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+1 2256 b1 3000 dd1
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+2 20000 b2 30000 dd2
+
+**** Data Insert Validation Slave Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+1 2256 b1 3000 dd1
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+2 20000 b2 30000 dd2
+
+**** Data Update Section test.t2 ****
+
+UPDATE test.t2 SET c2=@b2, c4=@d2 WHERE c1=1;
+UPDATE test.t2 SET c2=@b1, c4=@d1 WHERE c1=2;
+
+**** Data Update Validation Master Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+1 20000 b2 30000 dd2
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+2 2256 b1 3000 dd1
+
+**** Data Update Validation Slave Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+1 20000 b2 30000 dd2
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+2 2256 b1 3000 dd1
+
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
diff --git a/mysql-test/r/rpl_row_charset.result b/mysql-test/r/rpl_row_charset.result
new file mode 100644
index 00000000000..79cf75c8cc1
--- /dev/null
+++ b/mysql-test/r/rpl_row_charset.result
@@ -0,0 +1,201 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+set timestamp=1000000000;
+drop database if exists mysqltest2;
+drop database if exists mysqltest3;
+create database mysqltest2 character set latin2;
+set @@character_set_server=latin5;
+create database mysqltest3;
+
+--- --master--
+show create database mysqltest2;
+Database Create Database
+mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */
+show create database mysqltest3;
+Database Create Database
+mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin5 */
+
+--- --slave--
+show create database mysqltest2;
+Database Create Database
+mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */
+show create database mysqltest3;
+Database Create Database
+mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin5 */
+set @@collation_server=armscii8_bin;
+drop database mysqltest3;
+create database mysqltest3;
+
+--- --master--
+show create database mysqltest3;
+Database Create Database
+mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */
+
+--- --slave--
+show create database mysqltest3;
+Database Create Database
+mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */
+use mysqltest2;
+create table t1 (a int auto_increment primary key, b varchar(100));
+set character_set_client=cp850, collation_connection=latin2_croatian_ci;
+insert into t1 (b) values(@@character_set_server);
+insert into t1 (b) values(@@collation_server);
+insert into t1 (b) values(@@character_set_client);
+insert into t1 (b) values(@@character_set_connection);
+insert into t1 (b) values(@@collation_connection);
+
+--- --master--
+select * from t1 order by a;
+a b
+1 armscii8
+2 armscii8_bin
+3 cp850
+4 latin2
+5 latin2_croatian_ci
+
+--- --slave--
+select * from mysqltest2.t1 order by a;
+a b
+1 armscii8
+2 armscii8_bin
+3 cp850
+4 latin2
+5 latin2_croatian_ci
+select "--- --muller--" as "";
+
+--- --muller--
+set character_set_client=latin1, collation_connection=latin1_german1_ci;
+truncate table t1;
+insert into t1 (b) values(@@collation_connection);
+insert into t1 (b) values(LEAST("Mller","Muffler"));
+set collation_connection=latin1_german2_ci;
+insert into t1 (b) values(@@collation_connection);
+insert into t1 (b) values(LEAST("Mller","Muffler"));
+
+--- --master--
+select * from t1 order by a;
+a b
+1 latin1_german1_ci
+2 Muffler
+3 latin1_german2_ci
+4 Mller
+
+--- --slave--
+select * from mysqltest2.t1 order by a;
+a b
+1 latin1_german1_ci
+2 Muffler
+3 latin1_german2_ci
+4 Mller
+select "--- --INSERT--" as "";
+
+--- --INSERT--
+set @a= _cp850 'Mller' collate cp850_general_ci;
+truncate table t1;
+insert into t1 (b) values(collation(@a));
+
+--- --master--
+select * from t1 order by a;
+a b
+1 cp850_general_ci
+
+--- --slave--
+select * from mysqltest2.t1 order by a;
+a b
+1 cp850_general_ci
+drop database mysqltest2;
+drop database mysqltest3;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # drop database if exists mysqltest2
+master-bin.000001 # Query 1 # drop database if exists mysqltest3
+master-bin.000001 # Query 1 # create database mysqltest2 character set latin2
+master-bin.000001 # Query 1 # create database mysqltest3
+master-bin.000001 # Query 1 # drop database mysqltest3
+master-bin.000001 # Query 1 # create database mysqltest3
+master-bin.000001 # Query 1 # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100))
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # drop database mysqltest2
+master-bin.000001 # Query 1 # drop database mysqltest3
+select "--- --global--" as "";
+
+--- --global--
+set global character_set_server=latin2;
+set global character_set_server=latin1;
+set global character_set_server=latin2;
+set global character_set_server=latin1;
+select "--- --oneshot--" as "";
+
+--- --oneshot--
+set one_shot @@character_set_server=latin5;
+set @@max_join_size=1000;
+select @@character_set_server;
+@@character_set_server
+latin5
+select @@character_set_server;
+@@character_set_server
+latin1
+set @@character_set_server=latin5;
+select @@character_set_server;
+@@character_set_server
+latin5
+select @@character_set_server;
+@@character_set_server
+latin5
+set one_shot max_join_size=10;
+ERROR HY000: The 'SET ONE_SHOT' syntax is reserved for purposes internal to the MySQL server
+set character_set_client=9999999;
+ERROR 42000: Unknown character set: '9999999'
+set collation_server=9999998;
+ERROR HY000: Unknown collation: '9999998'
+select "--- --3943--" as "";
+
+--- --3943--
+use test;
+CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255));
+SET CHARACTER_SET_CLIENT=koi8r,
+CHARACTER_SET_CONNECTION=cp1251,
+CHARACTER_SET_RESULTS=koi8r;
+INSERT INTO t1 (c1, c2) VALUES (', ',', ');
+select hex(c1), hex(c2) from t1;
+hex(c1) hex(c2)
+CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
+select hex(c1), hex(c2) from t1;
+hex(c1) hex(c2)
+CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
+drop table t1;
+select "--- --6676--" as "";
+
+--- --6676--
+create table `t1` (
+`pk` varchar(10) not null default '',
+primary key (`pk`)
+) engine=myisam default charset=latin1;
+set @p=_latin1 'test';
+update t1 set pk='test' where pk=@p;
+drop table t1;
diff --git a/mysql-test/r/rpl_row_create_table.result b/mysql-test/r/rpl_row_create_table.result
new file mode 100644
index 00000000000..03388f59b8c
--- /dev/null
+++ b/mysql-test/r/rpl_row_create_table.result
@@ -0,0 +1,214 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (a INT, b INT);
+CREATE TABLE t2 (a INT, b INT) ENGINE=Merge;
+CREATE TABLE t3 (a INT, b INT) CHARSET=utf8;
+CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8;
+SHOW BINLOG EVENTS FROM 212;
+Log_name #
+Pos 212
+Event_type Query
+Server_id #
+End_log_pos #
+Info use `test`; CREATE TABLE t1 (a INT, b INT)
+Log_name #
+Pos 305
+Event_type Query
+Server_id #
+End_log_pos #
+Info use `test`; CREATE TABLE t2 (a INT, b INT) ENGINE=Merge
+Log_name #
+Pos 411
+Event_type Query
+Server_id #
+End_log_pos #
+Info use `test`; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8
+Log_name #
+Pos 517
+Event_type Query
+Server_id #
+End_log_pos #
+Info use `test`; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8
+**** On Master ****
+SHOW CREATE TABLE t1;
+Table t1
+Create Table CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW CREATE TABLE t2;
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=()
+SHOW CREATE TABLE t3;
+Table t3
+Create Table CREATE TABLE `t3` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8
+**** On Slave ****
+SHOW CREATE TABLE t1;
+Table t1
+Create Table CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+SHOW CREATE TABLE t2;
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=()
+SHOW CREATE TABLE t3;
+Table t3
+Create Table CREATE TABLE `t3` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
+CREATE TABLE t5 (b INT, c INT) SELECT * FROM t3;
+CREATE TEMPORARY TABLE tt3 (a INT, b INT);
+INSERT INTO tt3 VALUES (1,2), (2,4), (3,6), (4,2), (5,10), (6,12);
+CREATE TABLE t6 (b INT, c INT) SELECT * FROM tt3;
+**** On Master ****
+SHOW CREATE TABLE t5;
+Table t5
+Create Table CREATE TABLE `t5` (
+ `c` int(11) DEFAULT NULL,
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t5 ORDER BY a,b,c;
+c a b
+SHOW CREATE TABLE t6;
+Table t6
+Create Table CREATE TABLE `t6` (
+ `c` int(11) DEFAULT NULL,
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t6 ORDER BY a,b,c;
+c a b
+NULL 1 2
+NULL 2 4
+NULL 3 6
+NULL 4 2
+NULL 5 10
+NULL 6 12
+**** On Slave ****
+SHOW CREATE TABLE t5;
+Table t5
+Create Table CREATE TABLE `t5` (
+ `c` int(11) DEFAULT NULL,
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+SELECT * FROM t5 ORDER BY a,b,c;
+c a b
+SHOW CREATE TABLE t6;
+Table t6
+Create Table CREATE TABLE `t6` (
+ `c` int(11) DEFAULT NULL,
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+SELECT * FROM t6 ORDER BY a,b,c;
+c a b
+NULL 1 2
+NULL 2 4
+NULL 3 6
+NULL 4 2
+NULL 5 10
+NULL 6 12
+CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
+ERROR 23000: Duplicate entry '2' for key 'b'
+SHOW BINLOG EVENTS FROM 1256;
+Log_name Pos Event_type Server_id End_log_pos Info
+CREATE TABLE t7 (a INT, b INT UNIQUE);
+INSERT INTO t7 SELECT a,b FROM tt3;
+ERROR 23000: Duplicate entry '2' for key 'b'
+SELECT * FROM t7 ORDER BY a,b;
+a b
+1 2
+2 4
+3 6
+SHOW BINLOG EVENTS FROM 1118;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 1118 Query 1 1218 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE)
+master-bin.000001 1218 Table_map 1 1258 table_id: # (test.t7)
+master-bin.000001 1258 Write_rows 1 1314 table_id: # flags: STMT_END_F
+SELECT * FROM t7 ORDER BY a,b;
+a b
+1 2
+2 4
+3 6
+CREATE TEMPORARY TABLE tt4 (a INT, b INT);
+INSERT INTO tt4 VALUES (4,8), (5,10), (6,12);
+BEGIN;
+INSERT INTO t7 SELECT a,b FROM tt4;
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+SHOW BINLOG EVENTS FROM 1314;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 1314 Table_map 1 1354 table_id: # (test.t7)
+master-bin.000001 1354 Write_rows 1 1410 table_id: # flags: STMT_END_F
+SELECT * FROM t7 ORDER BY a,b;
+a b
+1 2
+2 4
+3 6
+4 8
+5 10
+6 12
+SELECT * FROM t7 ORDER BY a,b;
+a b
+1 2
+2 4
+3 6
+4 8
+5 10
+6 12
+CREATE TABLE t8 LIKE t4;
+CREATE TABLE t9 LIKE tt4;
+CREATE TEMPORARY TABLE tt5 LIKE t4;
+CREATE TEMPORARY TABLE tt6 LIKE tt4;
+CREATE TEMPORARY TABLE tt7 SELECT 1;
+**** On Master ****
+SHOW CREATE TABLE t8;
+Table t8
+Create Table CREATE TABLE `t8` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8 UNION=()
+SHOW CREATE TABLE t9;
+Table t9
+Create Table CREATE TABLE `t9` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW BINLOG EVENTS FROM 1410;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 1410 Query 1 1496 use `test`; CREATE TABLE t8 LIKE t4
+master-bin.000001 1496 Query 1 1635 use `test`; CREATE TABLE `t9` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+)
+**** On Slave ****
+SHOW CREATE TABLE t8;
+Table t8
+Create Table CREATE TABLE `t8` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8 UNION=()
+SHOW CREATE TABLE t9;
+Table t9
+Create Table CREATE TABLE `t9` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
diff --git a/mysql-test/r/rpl_row_delayed_ins.result b/mysql-test/r/rpl_row_delayed_ins.result
new file mode 100644
index 00000000000..31fffeb59cc
--- /dev/null
+++ b/mysql-test/r/rpl_row_delayed_ins.result
@@ -0,0 +1,29 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1(a int not null primary key) engine=myisam;
+insert delayed into t1 values (1),(2),(3);
+flush tables;
+SELECT * FROM t1 ORDER BY a;
+a
+1
+2
+3
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 222 use `test`; create table t1(a int not null primary key) engine=myisam
+master-bin.000001 222 Table_map 1 261 table_id: # (test.t1)
+master-bin.000001 261 Write_rows 1 295 table_id: # flags: STMT_END_F
+master-bin.000001 295 Table_map 1 334 table_id: # (test.t1)
+master-bin.000001 334 Write_rows 1 373 table_id: # flags: STMT_END_F
+master-bin.000001 373 Query 1 448 use `test`; flush tables
+SELECT * FROM t1 ORDER BY a;
+a
+1
+2
+3
+drop table t1;
diff --git a/mysql-test/r/rpl_row_drop.result b/mysql-test/r/rpl_row_drop.result
new file mode 100644
index 00000000000..4ef21884fda
--- /dev/null
+++ b/mysql-test/r/rpl_row_drop.result
@@ -0,0 +1,56 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** On Master ****
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (a int);
+CREATE TEMPORARY TABLE t2 (a int, b int);
+SHOW TABLES;
+Tables_in_test
+t1
+t2
+**** On Slave ****
+SHOW TABLES;
+Tables_in_test
+t1
+t2
+**** On Master ****
+DROP TABLE t2;
+SHOW TABLES;
+Tables_in_test
+t1
+t2
+**** On Slave ****
+SHOW TABLES;
+Tables_in_test
+t1
+t2
+**** On Master ****
+CREATE TEMPORARY TABLE t2 (a int, b int);
+SHOW TABLES;
+Tables_in_test
+t1
+t2
+**** On Slave ****
+SHOW TABLES;
+Tables_in_test
+t1
+t2
+**** On Master ****
+DROP TABLE t1,t2;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 188 use `test`; CREATE TABLE t1 (a int)
+master-bin.000001 188 Query 1 274 use `test`; CREATE TABLE t2 (a int)
+master-bin.000001 274 Query 1 378 use `test`; DROP TABLE `t1` /* generated by server */
+SHOW TABLES;
+Tables_in_test
+t2
+**** On Slave ****
+SHOW TABLES;
+Tables_in_test
+t2
diff --git a/mysql-test/r/rpl_error_ignored_table.result b/mysql-test/r/rpl_row_err_ignoredtable.result
index b813941a782..b696baa57db 100644
--- a/mysql-test/r/rpl_error_ignored_table.result
+++ b/mysql-test/r/rpl_row_err_ignoredtable.result
@@ -9,9 +9,10 @@ insert into t1 values (1),(1);
ERROR 23000: Duplicate entry '1' for key 1
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 288 # # master-bin.000001 Yes Yes test.t3,test.t1,test.t2 0 0 288 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 269 # # master-bin.000001 Yes Yes 0 0 269 # None 0 No #
show tables like 't1';
Tables_in_test (t1)
+t1
drop table t1;
select get_lock('crash_lock%20C', 10);
get_lock('crash_lock%20C', 10)
@@ -20,20 +21,24 @@ create table t2 (a int primary key);
insert into t2 values(1);
create table t3 (id int);
insert into t3 values(connection_id());
-update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
+ update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
select (@id := id) - id from t3;
(@id := id) - id
0
kill @id;
drop table t2,t3;
-show binlog events from 98;
+show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 1 # use `test`; create table t1 (a int primary key)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values (1),(1)
-master-bin.000001 # Query 1 # use `test`; drop table t1
-master-bin.000001 # Query 1 # use `test`; create table t2 (a int primary key)
-master-bin.000001 # Query 1 # use `test`; insert into t2 values(1)
-master-bin.000001 # Query 1 # use `test`; create table t3 (id int)
-master-bin.000001 # Query 1 # use `test`; insert into t3 values(connection_id())
-master-bin.000001 # Query 1 # use `test`; update t2 set a = a + 1 + get_lock('crash_lock%20C', 10)
-master-bin.000001 # Query 1 # use `test`; drop table t2,t3
+master-bin.000001 # Query 1 # #
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Write_rows 1 # #
+master-bin.000001 # Query 1 # #
+master-bin.000001 # Query 1 # #
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Write_rows 1 # #
+master-bin.000001 # Query 1 # #
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Write_rows 1 # #
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Update_rows 1 # #
+master-bin.000001 # Query 1 # #
diff --git a/mysql-test/r/rpl_row_flsh_tbls.result b/mysql-test/r/rpl_row_flsh_tbls.result
new file mode 100644
index 00000000000..e2352b8605b
--- /dev/null
+++ b/mysql-test/r/rpl_row_flsh_tbls.result
@@ -0,0 +1,33 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int);
+insert into t1 values (10);
+create table t2 (a int);
+create table t3 (a int) engine=merge union(t1);
+create table t4 (a int);
+insert into t4 select * from t3;
+rename table t1 to t5, t2 to t1;
+flush no_write_to_binlog tables;
+SHOW BINLOG EVENTS FROM 615 ;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1
+select * from t3;
+a
+flush tables;
+SHOW BINLOG EVENTS FROM 615 ;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1
+master-bin.000001 # Query 1 # use `test`; flush tables
+select * from t3;
+a
+stop slave;
+drop table t1;
+flush tables with read lock;
+start slave;
+stop slave;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+drop table t3, t4, t5;
diff --git a/mysql-test/r/rpl_row_func001.result b/mysql-test/r/rpl_row_func001.result
new file mode 100644
index 00000000000..b20f3f724d0
--- /dev/null
+++ b/mysql-test/r/rpl_row_func001.result
@@ -0,0 +1,30 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP FUNCTION test.f1;
+DROP TABLE IF EXISTS test.t1;
+create table test.t1 (a int, PRIMARY KEY(a));
+create function test.f1(i int) returns int
+begin
+insert into test.t1 values(i);
+return 0;
+end//
+select test.f1(1);
+test.f1(1)
+0
+select test.f1(2);
+test.f1(2)
+0
+select * from test.t1;
+a
+1
+2
+select * from test.t1;
+a
+1
+2
+DROP FUNCTION test.f1;
+DROP TABLE test.t1;
diff --git a/mysql-test/r/rpl_row_func002.result b/mysql-test/r/rpl_row_func002.result
new file mode 100644
index 00000000000..e65c0a35180
--- /dev/null
+++ b/mysql-test/r/rpl_row_func002.result
@@ -0,0 +1,25 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP FUNCTION test.f1;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, t TIMESTAMP, t2 TIMESTAMP, PRIMARY KEY(a));
+CREATE TABLE test.t2 (a INT NOT NULL AUTO_INCREMENT, t TIMESTAMP, t2 TIMESTAMP, PRIMARY KEY(a));
+create function test.f1() RETURNS TIMESTAMP
+BEGIN
+UPDATE test.t1 SET t = CURRENT_TIMESTAMP;
+RETURN CURRENT_TIMESTAMP;
+END//
+INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
+SET TIMESTAMP=2;
+INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
+SET TIMESTAMP=1;
+INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
+SET TIMESTAMP=333300000;
+INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
+DROP FUNCTION test.f1;
+DROP TABLE test.t1;
diff --git a/mysql-test/r/rpl_row_func003.result b/mysql-test/r/rpl_row_func003.result
new file mode 100644
index 00000000000..a5fd46a2ce3
--- /dev/null
+++ b/mysql-test/r/rpl_row_func003.result
@@ -0,0 +1,29 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP FUNCTION IF EXISTS test.f1;
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, c CHAR(16),PRIMARY KEY(a))ENGINE=INNODB;
+create function test.f1() RETURNS CHAR(16)
+BEGIN
+DECLARE tmp CHAR(16);
+DECLARE var_name FLOAT;
+SET var_name = RAND();
+IF var_name > .6
+THEN SET tmp = 'Texas';
+ELSE SET tmp = 'MySQL';
+END IF;
+RETURN tmp;
+END|
+INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1());
+INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1());
+SET AUTOCOMMIT=0;
+START TRANSACTION;
+INSERT INTO test.t1 VALUES (null,test.f1());
+ROLLBACK;
+SET AUTOCOMMIT=1;
+DROP FUNCTION test.f1;
+DROP TABLE test.t1;
diff --git a/mysql-test/r/rpl_row_inexist_tbl.result b/mysql-test/r/rpl_row_inexist_tbl.result
new file mode 100644
index 00000000000..5f5a4556d76
--- /dev/null
+++ b/mysql-test/r/rpl_row_inexist_tbl.result
@@ -0,0 +1,54 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int not null primary key);
+insert into t1 values (1);
+create table t2 (a int);
+insert into t2 values (1);
+update t1, t2 set t1.a = 0 where t1.a = t2.a;
+show tables;
+Tables_in_test
+t1
+select * from t1;
+a
+0
+drop table t1;
+insert into t1 values (1);
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table test.t2
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1146
+Last_Error Error 'Table 'test.t1' doesn't exist' on opening table `test`.`t1`
+Skip_Counter 0
+Exec_Master_Log_Pos 519
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+drop table t1, t2;
diff --git a/mysql-test/r/rpl_row_loaddata_m.result b/mysql-test/r/rpl_row_loaddata_m.result
new file mode 100644
index 00000000000..149efddaf8d
--- /dev/null
+++ b/mysql-test/r/rpl_row_loaddata_m.result
@@ -0,0 +1,20 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest;
+stop slave;
+create database mysqltest;
+use mysqltest;
+create table t1(a int, b int, unique(b));
+load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # #
+master-bin.000001 # Query 1 # #
+master-bin.000001 # Query 1 # #
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Write_rows 1 # #
+drop database mysqltest;
diff --git a/mysql-test/r/rpl_row_log.result b/mysql-test/r/rpl_row_log.result
new file mode 100644
index 00000000000..89163e1e37b
--- /dev/null
+++ b/mysql-test/r/rpl_row_log.result
@@ -0,0 +1,118 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+reset master;
+reset slave;
+reset master;
+create table t1(n int not null auto_increment primary key)ENGINE=MyISAM;
+insert into t1 values (NULL);
+drop table t1;
+create table t1 (word char(20) not null)ENGINE=MyISAM;
+load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
+select count(*) from t1;
+count(*)
+69
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `test`; drop table t1
+master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+show binlog events from 102 limit 1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+show binlog events from 102 limit 2;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+show binlog events from 102 limit 2,1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+flush logs;
+create table t3 (a int)ENGINE=MyISAM;
+start slave;
+
+let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ;
+
+--source include/wait_slave_status.inc
+flush logs;
+stop slave;
+create table t2 (n int)ENGINE=MyISAM;
+insert into t2 values (1);
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `test`; drop table t1
+master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
+show binlog events in 'master-bin.000002';
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
+master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM
+master-bin.000002 # Table_map 1 # table_id: # (test.t2)
+master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
+show binary logs;
+Log_name File_size
+master-bin.000001 1256
+master-bin.000002 373
+start slave;
+show binary logs;
+Log_name File_size
+slave-bin.000001 1354
+slave-bin.000002 274
+show binlog events in 'slave-bin.000001' from 4;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query 1 # use `test`; drop table t1
+slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
+slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
+slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
+show binlog events in 'slave-bin.000002' from 4;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM
+slave-bin.000002 # Table_map 1 # table_id: # (test.t2)
+slave-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 373 # # master-bin.000002 Yes Yes # 0 0 373 # None 0 No #
+show binlog events in 'slave-bin.000005' from 4;
+ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+create table t1(a int auto_increment primary key, b int);
+insert into t1 values (NULL, 1);
+reset master;
+set insert_id=5;
+insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000001 # Table_map 2 # table_id: # (test.t1)
+slave-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
+select * from t1;
+a b
+1 1
+5 1
+6 1
+drop table t1;
diff --git a/mysql-test/r/rpl_row_log_innodb.result b/mysql-test/r/rpl_row_log_innodb.result
new file mode 100644
index 00000000000..3bcd8a6a0fb
--- /dev/null
+++ b/mysql-test/r/rpl_row_log_innodb.result
@@ -0,0 +1,126 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+reset master;
+reset slave;
+reset master;
+create table t1(n int not null auto_increment primary key)ENGINE=InnoDB;
+insert into t1 values (NULL);
+drop table t1;
+create table t1 (word char(20) not null)ENGINE=InnoDB;
+load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
+select count(*) from t1;
+count(*)
+69
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid 1 # COMMIT /* XID */
+master-bin.000001 # Query 1 # use `test`; drop table t1
+master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid 1 # COMMIT /* XID */
+show binlog events from 102 limit 1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
+show binlog events from 102 limit 2;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+show binlog events from 102 limit 2,1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+flush logs;
+create table t3 (a int)ENGINE=InnoDB;
+start slave;
+
+let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ;
+
+--source include/wait_slave_status.inc
+flush logs;
+stop slave;
+create table t2 (n int)ENGINE=InnoDB;
+insert into t2 values (1);
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid 1 # COMMIT /* XID */
+master-bin.000001 # Query 1 # use `test`; drop table t1
+master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid 1 # COMMIT /* XID */
+master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
+show binlog events in 'master-bin.000002';
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=InnoDB
+master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=InnoDB
+master-bin.000002 # Table_map 1 # table_id: # (test.t2)
+master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000002 # Xid 1 # COMMIT /* XID */
+show binary logs;
+Log_name File_size
+master-bin.000001 1310
+master-bin.000002 400
+start slave;
+show binary logs;
+Log_name File_size
+slave-bin.000001 1408
+slave-bin.000002 301
+show binlog events in 'slave-bin.000001' from 4;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
+slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+slave-bin.000001 # Xid 1 # COMMIT /* XID */
+slave-bin.000001 # Query 1 # use `test`; drop table t1
+slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
+slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+slave-bin.000001 # Xid 1 # COMMIT /* XID */
+slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=InnoDB
+slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
+show binlog events in 'slave-bin.000002' from 4;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=InnoDB
+slave-bin.000002 # Table_map 1 # table_id: # (test.t2)
+slave-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
+slave-bin.000002 # Xid 1 # COMMIT /* XID */
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 400 # # master-bin.000002 Yes Yes # 0 0 400 # None 0 No #
+show binlog events in 'slave-bin.000005' from 4;
+ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+create table t1(a int auto_increment primary key, b int);
+insert into t1 values (NULL, 1);
+reset master;
+set insert_id=5;
+insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000001 # Table_map 2 # table_id: # (test.t1)
+slave-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
+select * from t1;
+a b
+1 1
+5 1
+6 1
+drop table t1;
diff --git a/mysql-test/r/rpl_row_max_relay_size.result b/mysql-test/r/rpl_row_max_relay_size.result
new file mode 100644
index 00000000000..163e8231de5
--- /dev/null
+++ b/mysql-test/r/rpl_row_max_relay_size.result
@@ -0,0 +1,273 @@
+SET SESSION BINLOG_FORMAT=ROW;
+SET GLOBAL BINLOG_FORMAT=ROW;
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+#
+# Generate a big enough master's binlog to cause relay log rotations
+#
+create table t1 (a int);
+drop table t1;
+reset slave;
+#
+# Test 1
+#
+set global max_binlog_size=8192;
+set global max_relay_log_size=8192-1;
+select @@global.max_relay_log_size;
+@@global.max_relay_log_size
+4096
+start slave;
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 58664
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 58664
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+#
+# Test 2
+#
+stop slave;
+reset slave;
+set global max_relay_log_size=(5*4096);
+select @@global.max_relay_log_size;
+@@global.max_relay_log_size 20480
+start slave;
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 58664
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 58664
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+#
+# Test 3: max_relay_log_size = 0
+#
+stop slave;
+reset slave;
+set global max_relay_log_size=0;
+select @@global.max_relay_log_size;
+@@global.max_relay_log_size 0
+start slave;
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 58664
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 58664
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+#
+# Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
+#
+stop slave;
+reset slave;
+flush logs;
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File
+Read_Master_Log_Pos 4
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File
+Slave_IO_Running No
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 0
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+#
+# Test 5
+#
+reset slave;
+start slave;
+flush logs;
+create table t1 (a int);
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 58750
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 58750
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+#
+# Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
+#
+flush logs;
+drop table t1;
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 58826
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 58826
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+flush logs;
+show master status;
+File master-bin.000002
+Position 102
+Binlog_Do_DB <Binlog_Ignore_DB>
+Binlog_Ignore_DB
+#
+# End of 4.1 tests
+#
diff --git a/mysql-test/r/rpl_row_multi_query.result b/mysql-test/r/rpl_row_multi_query.result
new file mode 100644
index 00000000000..8cb1aec522b
--- /dev/null
+++ b/mysql-test/r/rpl_row_multi_query.result
@@ -0,0 +1,37 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest;
+create database mysqltest;
+create table mysqltest.t1 ( n int);
+insert into mysqltest.t1 values(1)/
+insert into mysqltest.t1 values(2);
+insert into mysqltest.t1 values(3);
+insert into mysqltest.t1 values(4);
+insert into mysqltest.t1 values(5)/
+select * from mysqltest.t1;
+n
+1
+2
+3
+4
+5
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # #
+master-bin.000001 # Query 1 # #
+master-bin.000001 # Query 1 # #
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Write_rows 1 # #
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Write_rows 1 # #
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Write_rows 1 # #
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Write_rows 1 # #
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Write_rows 1 # #
+drop database mysqltest;
diff --git a/mysql-test/r/rpl_row_mysqlbinlog.result b/mysql-test/r/rpl_row_mysqlbinlog.result
new file mode 100644
index 00000000000..374f2d3ee82
--- /dev/null
+++ b/mysql-test/r/rpl_row_mysqlbinlog.result
@@ -0,0 +1,266 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+
+---Setup Section --
+set timestamp=1000000000;
+DROP TABLE IF EXISTS t1,t2,t3;
+CREATE TABLE t1(word VARCHAR(20));
+CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY);
+CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT);
+
+---Test1 check table load --
+SELECT COUNT(*) from t1;
+COUNT(*)
+351
+SELECT COUNT(*) from t2;
+COUNT(*)
+500
+SELECT COUNT(*) from t3;
+COUNT(*)
+500
+SELECT * FROM t1 ORDER BY word LIMIT 5;
+word
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+SELECT * FROM t2 ORDER BY id LIMIT 5;
+id
+1
+2
+3
+4
+5
+SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
+c1 c3 c4 c5
+1 2006-02-22 00:00:00 Tested in Texas 2.2
+2 2006-02-22 00:00:00 Tested in Texas 4.4
+3 2006-02-22 00:00:00 Tested in Texas 6.6
+4 2006-02-22 00:00:00 Tested in Texas 8.8
+5 2006-02-22 00:00:00 Tested in Texas 11
+SELECT COUNT(*) from t1;
+COUNT(*)
+351
+SELECT COUNT(*) from t2;
+COUNT(*)
+500
+SELECT COUNT(*) from t3;
+COUNT(*)
+500
+SELECT * FROM t1 ORDER BY word LIMIT 5;
+word
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+SELECT * FROM t2 ORDER BY id LIMIT 5;
+id
+1
+2
+3
+4
+5
+SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
+c1 c3 c4 c5
+1 2006-02-22 00:00:00 Tested in Texas 2.2
+2 2006-02-22 00:00:00 Tested in Texas 4.4
+3 2006-02-22 00:00:00 Tested in Texas 6.6
+4 2006-02-22 00:00:00 Tested in Texas 8.8
+5 2006-02-22 00:00:00 Tested in Texas 11
+insert into t1 values ("Alas");
+flush logs;
+
+--- Test 1 Dump binlog to file --
+
+--- Test 1 delete tables, clean master and slave --
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+stop slave;
+reset master;
+reset slave;
+start slave;
+
+--- Test 1 Load from Dump binlog file --
+
+--- Test 1 Check Load Results --
+SELECT COUNT(*) from t1;
+COUNT(*)
+352
+SELECT COUNT(*) from t2;
+COUNT(*)
+500
+SELECT COUNT(*) from t3;
+COUNT(*)
+500
+SELECT * FROM t1 ORDER BY word LIMIT 5;
+word
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+SELECT * FROM t2 ORDER BY id LIMIT 5;
+id
+1
+2
+3
+4
+5
+SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
+c1 c3 c4 c5
+1 2006-02-22 00:00:00 Tested in Texas 2.2
+2 2006-02-22 00:00:00 Tested in Texas 4.4
+3 2006-02-22 00:00:00 Tested in Texas 6.6
+4 2006-02-22 00:00:00 Tested in Texas 8.8
+5 2006-02-22 00:00:00 Tested in Texas 11
+SELECT COUNT(*) from t1;
+COUNT(*)
+352
+SELECT COUNT(*) from t2;
+COUNT(*)
+500
+SELECT COUNT(*) from t3;
+COUNT(*)
+500
+SELECT * FROM t1 ORDER BY word LIMIT 5;
+word
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+SELECT * FROM t2 ORDER BY id LIMIT 5;
+id
+1
+2
+3
+4
+5
+SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
+c1 c3 c4 c5
+1 2006-02-22 00:00:00 Tested in Texas 2.2
+2 2006-02-22 00:00:00 Tested in Texas 4.4
+3 2006-02-22 00:00:00 Tested in Texas 6.6
+4 2006-02-22 00:00:00 Tested in Texas 8.8
+5 2006-02-22 00:00:00 Tested in Texas 11
+
+--- Test 2 position test --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+use test;
+SET TIMESTAMP=1000000000;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
+SET @@session.sql_mode=0;
+/*!\C latin1 */;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
+CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT);
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
+--- Test 3 First Remote test --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+ROLLBACK;
+use test;
+SET TIMESTAMP=1000000000;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
+SET @@session.sql_mode=0;
+/*!\C latin1 */;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
+DROP TABLE IF EXISTS t1,t2,t3;
+SET TIMESTAMP=1000000000;
+CREATE TABLE t1(word VARCHAR(20));
+SET TIMESTAMP=1000000000;
+CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY);
+SET TIMESTAMP=1000000000;
+CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT);
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
+--- Test 5 LOAD DATA --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
+--- Test 6 reading stdin --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+ROLLBACK;
+use test;
+SET TIMESTAMP=1000000000;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
+SET @@session.sql_mode=0;
+/*!\C latin1 */;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
+DROP TABLE IF EXISTS t1,t2,t3;
+SET TIMESTAMP=1000000000;
+CREATE TABLE t1(word VARCHAR(20));
+SET TIMESTAMP=1000000000;
+CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY);
+SET TIMESTAMP=1000000000;
+CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT);
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
+--- Test 7 reading stdin w/position --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+use test;
+SET TIMESTAMP=1000000000;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
+SET @@session.sql_mode=0;
+/*!\C latin1 */;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
+CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT);
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
+--- Test 8 switch internal charset --
+stop slave;
+reset master;
+reset slave;
+start slave;
+create table t4 (f text character set utf8);
+create table t5 (f text character set cp932);
+flush logs;
+rename table t4 to t04, t5 to t05;
+select HEX(f) from t04;
+HEX(f)
+E382BD
+select HEX(f) from t4;
+HEX(f)
+E382BD
+select HEX(f) from t05;
+HEX(f)
+835C
+select HEX(f) from t5;
+HEX(f)
+835C
+select HEX(f) from t04;
+HEX(f)
+E382BD
+select HEX(f) from t4;
+HEX(f)
+E382BD
+select HEX(f) from t05;
+HEX(f)
+835C
+select HEX(f) from t5;
+HEX(f)
+835C
+
+--- Test cleanup --
+DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5;
diff --git a/mysql-test/r/rpl_row_mystery22.result b/mysql-test/r/rpl_row_mystery22.result
new file mode 100644
index 00000000000..bcf65e4ede3
--- /dev/null
+++ b/mysql-test/r/rpl_row_mystery22.result
@@ -0,0 +1,30 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1(n int auto_increment primary key, s char(10));
+insert into t1 values (2,'old');
+insert into t1 values(NULL,'new');
+insert into t1 values(NULL,'new');
+select * from t1 order by n;
+n s
+1 new
+2 new
+delete from t1 where n = 2;
+start slave;
+stop slave;
+create table t2(n int);
+drop table t2;
+insert into t1 values(NULL,'new');
+set sql_log_bin=0;
+insert into t1 values(NULL,'new');
+set sql_log_bin=1;
+delete from t1 where n=4;
+start slave;
+select * from t1 order by n;
+n s
+1 new
+3 new
+drop table t1;
diff --git a/mysql-test/r/rpl_row_reset_slave.result b/mysql-test/r/rpl_row_reset_slave.result
new file mode 100644
index 00000000000..57fc95708e5
--- /dev/null
+++ b/mysql-test/r/rpl_row_reset_slave.result
@@ -0,0 +1,32 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 102 # # master-bin.000001 Yes Yes # 0 0 102 # None 0 No #
+stop slave;
+change master to master_user='test';
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 test MASTER_PORT 1 master-bin.000001 102 # # master-bin.000001 No No # 0 0 102 # None 0 No #
+reset slave;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 4 # # No No # 0 0 0 # None 0 No #
+start slave;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 102 # # master-bin.000001 Yes Yes # 0 0 102 # None 0 No #
+stop slave;
+reset slave;
+start slave;
+create temporary table t1 (a int);
+stop slave;
+reset slave;
+start slave;
+show status like 'slave_open_temp_tables';
+Variable_name Value
+Slave_open_temp_tables 0
diff --git a/mysql-test/r/rpl_row_sp001.result b/mysql-test/r/rpl_row_sp001.result
new file mode 100644
index 00000000000..8c26c061376
--- /dev/null
+++ b/mysql-test/r/rpl_row_sp001.result
@@ -0,0 +1,85 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+
+<Begin test section 1 (non deterministic SP)>
+---------------------------------------------
+create table test.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
+create procedure test.p1()
+begin
+INSERT INTO test.t1 (f,d) VALUES (RAND(),NOW());
+end//
+
+<End test section 1 (non deterministic SP)>
+-------------------------------------------
+CREATE TABLE test.t2 (a INT NOT NULL AUTO_INCREMENT, t CHAR(4), PRIMARY KEY(a));
+CREATE PROCEDURE test.p2(n int)
+begin
+CASE n
+WHEN 1 THEN
+UPDATE test.t2 set t ='Tex';
+WHEN 2 THEN
+UPDATE test.t2 set t ='SQL';
+ELSE
+UPDATE test.t2 set t ='NONE';
+END CASE;
+end//
+INSERT INTO test.t2 VALUES(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW');
+SELECT * FROM t2 ORDER BY a;
+a t
+1 NEW
+2 NEW
+3 NEW
+4 NEW
+SELECT * FROM t2 ORDER BY a;
+a t
+1 NEW
+2 NEW
+3 NEW
+4 NEW
+call test.p2(1);
+SELECT * FROM t2 ORDER BY a;
+a t
+1 Tex
+2 Tex
+3 Tex
+4 Tex
+SELECT * FROM t2 ORDER BY a;
+a t
+1 Tex
+2 Tex
+3 Tex
+4 Tex
+call test.p2(2);
+SELECT * FROM t2 ORDER BY a;
+a t
+1 SQL
+2 SQL
+3 SQL
+4 SQL
+SELECT * FROM t2 ORDER BY a;
+a t
+1 SQL
+2 SQL
+3 SQL
+4 SQL
+call test.p2(3);
+SELECT * FROM t2 ORDER BY a;
+a t
+1 NONE
+2 NONE
+3 NONE
+4 NONE
+SELECT * FROM t2 ORDER BY a;
+a t
+1 NONE
+2 NONE
+3 NONE
+4 NONE
+DROP PROCEDURE test.p1;
+DROP PROCEDURE test.p2;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
diff --git a/mysql-test/r/rpl_row_sp002_innodb.result b/mysql-test/r/rpl_row_sp002_innodb.result
new file mode 100644
index 00000000000..a42c9af988c
--- /dev/null
+++ b/mysql-test/r/rpl_row_sp002_innodb.result
@@ -0,0 +1,239 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP TABLE IF EXISTS test.t3;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+CREATE TABLE test.t1 (a INT AUTO_INCREMENT KEY, t CHAR(6)) ENGINE=INNODB;
+CREATE TABLE test.t2 (a INT AUTO_INCREMENT KEY, f INT, FOREIGN KEY(a) REFERENCES test.t1(a) ON DELETE CASCADE) ENGINE=INNODB;
+create procedure test.p1(IN i CHAR(6))
+begin
+INSERT INTO test.t1 (t) VALUES (i);
+INSERT INTO test.t2 VALUES (NULL,LAST_INSERT_ID());
+end|
+create procedure test.p2(IN i INT)
+begin
+DELETE FROM test.t1 where a < i;
+end|
+
+< -- test 1 call p1 -- >
+------------------------
+SET FOREIGN_KEY_CHECKS=1;
+call test.p1('texas');
+call test.p1('Live');
+call test.p1('next');
+call test.p1('to');
+call test.p1('OK');
+call test.p1('MySQL');
+
+< -- test 1 select master after p1 -- >
+---------------------------------------
+SELECT * FROM test.t1;
+a t
+1 texas
+2 Live
+3 next
+4 to
+5 OK
+6 MySQL
+SELECT * FROM test.t2;
+a f
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+
+< -- test 1 select slave after p1 -- >
+--------------------------------------
+SELECT * FROM test.t1;
+a t
+1 texas
+2 Live
+3 next
+4 to
+5 OK
+6 MySQL
+SELECT * FROM test.t2;
+a f
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+
+< -- test 1 call p2 & select master -- >
+----------------------------------------
+call test.p2(4);
+SELECT * FROM test.t1;
+a t
+4 to
+5 OK
+6 MySQL
+SELECT * FROM test.t2;
+a f
+4 4
+5 5
+6 6
+
+< -- test 1 select slave after p2 -- >
+--------------------------------------
+SELECT * FROM test.t1;
+a t
+4 to
+5 OK
+6 MySQL
+SELECT * FROM test.t2;
+a f
+4 4
+5 5
+6 6
+
+< -- End test 1 Begin test 2 -- >
+---------------------------------
+SET FOREIGN_KEY_CHECKS=0;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+CREATE TABLE test.t1 (a INT, t CHAR(6), PRIMARY KEY(a)) ENGINE=INNODB;
+CREATE TABLE test.t2 (a INT, f INT, FOREIGN KEY(a) REFERENCES test.t1(a) ON UPDATE CASCADE, PRIMARY KEY(a)) ENGINE=INNODB;
+CREATE PROCEDURE test.p1(IN nm INT, IN ch CHAR(6))
+BEGIN
+INSERT INTO test.t1 (a,t) VALUES (nm, ch);
+INSERT INTO test.t2 VALUES (nm, LAST_INSERT_ID());
+END|
+CREATE PROCEDURE test.p2(IN i INT)
+BEGIN
+UPDATE test.t1 SET a = i*10 WHERE a = i;
+END|
+SET FOREIGN_KEY_CHECKS=1;
+CALL test.p1(1,'texas');
+CALL test.p1(2,'Live');
+CALL test.p1(3,'next');
+CALL test.p1(4,'to');
+CALL test.p1(5,'OK');
+CALL test.p1(6,'MySQL');
+
+< -- test 2 select Master after p1 -- >
+---------------------------------------
+SELECT * FROM test.t1;
+a t
+1 texas
+2 Live
+3 next
+4 to
+5 OK
+6 MySQL
+SELECT * FROM test.t2;
+a f
+1 6
+2 6
+3 6
+4 6
+5 6
+6 6
+
+< -- test 2 select Slave after p1 -- >
+--------------------------------------
+SELECT * FROM test.t1;
+a t
+1 texas
+2 Live
+3 next
+4 to
+5 OK
+6 MySQL
+SELECT * FROM test.t2;
+a f
+1 6
+2 6
+3 6
+4 6
+5 6
+6 6
+
+< -- test 2 call p2 & select Master -- >
+----------------------------------------
+CALL test.p2(2);
+CALL test.p2(4);
+CALL test.p2(6);
+SELECT * FROM test.t1;
+a t
+1 texas
+3 next
+5 OK
+20 Live
+40 to
+60 MySQL
+SELECT * FROM test.t2;
+a f
+1 6
+3 6
+5 6
+20 6
+40 6
+60 6
+
+< -- test 1 select Slave after p2 -- >
+--------------------------------------
+SELECT * FROM test.t1;
+a t
+1 texas
+3 next
+5 OK
+20 Live
+40 to
+60 MySQL
+SELECT * FROM test.t2;
+a f
+1 6
+3 6
+5 6
+20 6
+40 6
+60 6
+
+< -- End test 2 Begin test 3 -- >
+---------------------------------
+CREATE TABLE test.t3 (a INT AUTO_INCREMENT KEY, t CHAR(6))ENGINE=INNODB;
+CREATE PROCEDURE test.p3(IN n INT)
+begin
+CASE n
+WHEN 2 THEN
+DELETE from test.t3;
+ELSE
+INSERT INTO test.t3 VALUES (NULL,'NONE');
+END CASE;
+end|
+SET AUTOCOMMIT=0;
+START TRANSACTION;
+ROLLBACK;
+select * from test.t3;
+a t
+select * from test.t3;
+a t
+START TRANSACTION;
+COMMIT;
+select * from test.t3;
+a t
+98 NONE
+select * from test.t3;
+a t
+98 NONE
+SET AUTOCOMMIT=1;
+SET FOREIGN_KEY_CHECKS=0;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
diff --git a/mysql-test/r/rpl_row_sp003.result b/mysql-test/r/rpl_row_sp003.result
new file mode 100644
index 00000000000..df3e2a7ceed
--- /dev/null
+++ b/mysql-test/r/rpl_row_sp003.result
@@ -0,0 +1,49 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=INNODB;
+CREATE PROCEDURE test.p1()
+BEGIN
+INSERT INTO test.t1 VALUES (4);
+SELECT get_lock("test", 100);
+UPDATE test.t1 set a=a+4 WHERE a=4;
+END|
+CREATE PROCEDURE test.p2()
+BEGIN
+UPDATE test.t1 SET a=a+1;
+END|
+SELECT get_lock("test", 200);
+get_lock("test", 200)
+1
+CALL test.p1();
+CALL test.p2();
+SELECT release_lock("test");
+release_lock("test")
+1
+SELECT * FROM test.t1;
+a
+5
+SELECT * FROM test.t1;
+a
+5
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=INNODB;
+CALL test.p2();
+CALL test.p1();
+get_lock("test", 100)
+0
+SELECT * FROM test.t1;
+a
+8
+SELECT * FROM test.t1;
+a
+8
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
diff --git a/mysql-test/r/rpl_row_sp005.result b/mysql-test/r/rpl_row_sp005.result
new file mode 100644
index 00000000000..01e1970e0df
--- /dev/null
+++ b/mysql-test/r/rpl_row_sp005.result
@@ -0,0 +1,100 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t3;
+CREATE TABLE IF NOT EXISTS test.t1(id INT, data CHAR(16),PRIMARY KEY(id));
+CREATE TABLE IF NOT EXISTS test.t2(id2 INT,PRIMARY KEY(id2));
+CREATE TABLE IF NOT EXISTS test.t3(id3 INT,PRIMARY KEY(id3), c CHAR(16));
+CREATE PROCEDURE test.p1()
+BEGIN
+DECLARE done INT DEFAULT 0;
+DECLARE spa CHAR(16);
+DECLARE spb,spc INT;
+DECLARE cur1 CURSOR FOR SELECT id,data FROM test.t1 ORDER BY id;
+DECLARE cur2 CURSOR FOR SELECT id2 FROM test.t2 ORDER BY id2;
+DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
+OPEN cur1;
+OPEN cur2;
+REPEAT
+FETCH cur1 INTO spb, spa;
+FETCH cur2 INTO spc;
+IF NOT done THEN
+IF spb < spc THEN
+INSERT INTO test.t3 VALUES (spb,spa);
+ELSE
+INSERT INTO test.t3 VALUES (spc,spa);
+END IF;
+END IF;
+UNTIL done END REPEAT;
+CLOSE cur1;
+CLOSE cur2;
+END|
+CREATE PROCEDURE test.p2()
+BEGIN
+INSERT INTO test.t1 VALUES (4,'MySQL'),(20,'ROCKS'),(11,'Texas'),(10,'kyle');
+INSERT INTO test.t2 VALUES (4),(2),(1),(3);
+UPDATE test.t1 SET id=id+4 WHERE id=4;
+END|
+
+< ---- Master selects-- >
+-------------------------
+CALL test.p2();
+SELECT * FROM test.t1 ORDER BY id;
+id data
+8 MySQL
+10 kyle
+11 Texas
+20 ROCKS
+SELECT * FROM test.t2 ORDER BY id2;
+id2
+1
+2
+3
+4
+
+< ---- Slave selects-- >
+------------------------
+SELECT * FROM test.t1 ORDER BY id;
+id data
+8 MySQL
+10 kyle
+11 Texas
+20 ROCKS
+SELECT * FROM test.t2 ORDER BY id2;
+id2
+1
+2
+3
+4
+
+< ---- Master selects-- >
+-------------------------
+CALL test.p1();
+SELECT * FROM test.t3 ORDER BY id3;
+id3 c
+1 MySQL
+2 kyle
+3 Texas
+4 ROCKS
+
+< ---- Slave selects-- >
+------------------------
+SELECT * FROM test.t3 ORDER BY id3;
+id3 c
+1 MySQL
+2 kyle
+3 Texas
+4 ROCKS
+ALTER PROCEDURE test.p1 MODIFIES SQL DATA;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
diff --git a/mysql-test/r/rpl_row_sp006_InnoDB.result b/mysql-test/r/rpl_row_sp006_InnoDB.result
new file mode 100644
index 00000000000..8339e77d3a0
--- /dev/null
+++ b/mysql-test/r/rpl_row_sp006_InnoDB.result
@@ -0,0 +1,46 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create database if not exists mysqltest1;
+DROP PROCEDURE IF EXISTS mysqltest1.p1;
+DROP PROCEDURE IF EXISTS mysqltest1.p2;
+DROP TABLE IF EXISTS mysqltest1.t2;
+DROP TABLE IF EXISTS mysqltest1.t1;
+CREATE TABLE IF NOT EXISTS mysqltest1.t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=InnoDB;
+CREATE TABLE IF NOT EXISTS mysqltest1.t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=InnoDB;
+CREATE PROCEDURE mysqltest1.p1()
+BEGIN
+DECLARE done INT DEFAULT 0;
+DECLARE spa CHAR(16);
+DECLARE spb INT;
+DECLARE cur1 CURSOR FOR SELECT name,
+(YEAR(CURDATE())-YEAR(birth))-(RIGHT(CURDATE(),5)<RIGHT(birth,5))
+FROM mysqltest1.t1;
+DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
+OPEN cur1;
+SET AUTOCOMMIT=0;
+REPEAT
+FETCH cur1 INTO spa, spb;
+IF NOT done THEN
+START TRANSACTION;
+INSERT INTO mysqltest1.t2 VALUES (spa,spb);
+COMMIT;
+END IF;
+UNTIL done END REPEAT;
+SET AUTOCOMMIT=1;
+CLOSE cur1;
+END|
+CREATE PROCEDURE mysqltest1.p2()
+BEGIN
+INSERT INTO mysqltest1.t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
+END|
+CALL mysqltest1.p2();
+CALL mysqltest1.p1();
+DROP PROCEDURE IF EXISTS mysqltest1.p1;
+DROP PROCEDURE IF EXISTS mysqltest1.p2;
+DROP TABLE IF EXISTS mysqltest1.t1;
+DROP TABLE IF EXISTS mysqltest1.t2;
+DROP DATABASE mysqltest1;
diff --git a/mysql-test/r/rpl_row_sp007_innodb.result b/mysql-test/r/rpl_row_sp007_innodb.result
new file mode 100644
index 00000000000..9a2822835f8
--- /dev/null
+++ b/mysql-test/r/rpl_row_sp007_innodb.result
@@ -0,0 +1,50 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
+CREATE PROCEDURE test.p1(IN i INT)
+BEGIN
+DECLARE CONTINUE HANDLER FOR sqlexception BEGIN END;
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1 (num INT,PRIMARY KEY(num))ENGINE=INNODB;
+START TRANSACTION;
+INSERT INTO test.t1 VALUES(i);
+savepoint t1_save;
+INSERT INTO test.t1 VALUES (14);
+ROLLBACK to savepoint t1_save;
+COMMIT;
+END|
+
+< ---- Master selects-- >
+-------------------------
+CALL test.p1(12);
+Warnings:
+Note 1051 Unknown table 't1'
+SELECT * FROM test.t1;
+num
+12
+
+< ---- Slave selects-- >
+------------------------
+SELECT * FROM test.t1;
+num
+12
+
+< ---- Master selects-- >
+-------------------------
+CALL test.p1(13);
+SELECT * FROM test.t1;
+num
+13
+
+< ---- Slave selects-- >
+------------------------
+SELECT * FROM test.t1;
+num
+13
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
diff --git a/mysql-test/r/rpl_row_sp008.result b/mysql-test/r/rpl_row_sp008.result
new file mode 100644
index 00000000000..2026ba8a03a
--- /dev/null
+++ b/mysql-test/r/rpl_row_sp008.result
@@ -0,0 +1,33 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t2;
+CREATE TABLE test.t1 (a INT,PRIMARY KEY(a));
+CREATE TABLE test.t2 (a INT,PRIMARY KEY(a));
+INSERT INTO test.t1 VALUES(1),(2);
+CREATE PROCEDURE test.p1()
+BEGIN
+SELECT SQL_CALC_FOUND_ROWS * FROM test.t1 LIMIT 1;
+INSERT INTO test.t2 VALUES(FOUND_ROWS());
+END|
+
+< ---- Master selects-- >
+-------------------------
+CALL test.p1();
+a
+1
+SELECT * FROM test.t2;
+a
+2
+
+< ---- Slave selects-- >
+------------------------
+SELECT * FROM test.t2;
+a
+2
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
diff --git a/mysql-test/r/rpl_row_sp009.result b/mysql-test/r/rpl_row_sp009.result
new file mode 100644
index 00000000000..35ce0d7b420
--- /dev/null
+++ b/mysql-test/r/rpl_row_sp009.result
@@ -0,0 +1,77 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+CREATE TABLE test.t1 (a INT, PRIMARY KEY(a));
+INSERT INTO test.t1 VALUES (1),(2),(3),(4);
+CREATE TABLE test.t2 (a INT, PRIMARY KEY(a));
+CREATE PROCEDURE test.p1 (arg1 CHAR(1))
+BEGIN
+DECLARE b, c INT;
+IF arg1 = 'a' THEN
+BEGIN
+DECLARE cur1 CURSOR FOR SELECT A FROM test.t1 WHERE a % 2;
+DECLARE continue handler for not found set b = 1;
+SET b = 0;
+OPEN cur1;
+c1_repeat: REPEAT
+FETCH cur1 INTO c;
+IF (b = 1) THEN
+LEAVE c1_repeat;
+END IF;
+INSERT INTO test.t2 VALUES (c);
+UNTIL b = 1
+END REPEAT;
+CLOSE cur1;
+END;
+END IF;
+IF arg1 = 'b' THEN
+BEGIN
+DECLARE cur2 CURSOR FOR SELECT a FROM test.t1 WHERE NOT a % 2;
+DECLARE continue handler for not found set b = 1;
+SET b = 0;
+OPEN cur2;
+c2_repeat: REPEAT
+FETCH cur2 INTO c;
+IF (b = 1) THEN
+LEAVE c2_repeat;
+END IF;
+INSERT INTO test.t2 VALUES (c);
+UNTIL b = 1
+END REPEAT;
+CLOSE cur2;
+END;
+END IF;
+END|
+CALL test.p1('a');
+SELECT * FROM test.t2 ORDER BY a;
+a
+1
+3
+SELECT * FROM test.t2 ORDER BY a;
+a
+1
+3
+truncate test.t2;
+call test.p1('b');
+select * from test.t2 ORDER BY a;
+a
+2
+4
+SELECT * FROM test.t2 ORDER BY a;
+a
+2
+4
+truncate test.t2;
+SELECT * FROM test.t2 ORDER BY a;
+a
+SELECT * FROM test.t2 ORDER BY a;
+a
+DROP PROCEDURE test.p1;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
diff --git a/mysql-test/r/rpl_row_sp010.result b/mysql-test/r/rpl_row_sp010.result
new file mode 100644
index 00000000000..02567465428
--- /dev/null
+++ b/mysql-test/r/rpl_row_sp010.result
@@ -0,0 +1,56 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p4;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+CREATE PROCEDURE test.p1()
+BEGIN
+INSERT INTO test.t1 VALUES(2);
+END|
+CREATE PROCEDURE test.p2()
+BEGIN
+DROP TEMPORARY TABLE IF EXISTS test.t1;
+CREATE TEMPORARY TABLE test.t1 (a int, PRIMARY KEY(a));
+INSERT INTO test.t1 VALUES(1);
+CALL test.p1();
+END|
+CALL test.p2();
+SELECT * FROM test.t1 ORDER BY a;
+a
+1
+2
+show tables;
+Tables_in_test
+CREATE PROCEDURE test.p3()
+BEGIN
+INSERT INTO test.t2 VALUES(7);
+END|
+CREATE PROCEDURE test.p4()
+BEGIN
+DROP TABLE IF EXISTS test.t2;
+CREATE TABLE test.t2 (a int, PRIMARY KEY(a));
+INSERT INTO test.t2 VALUES(6);
+CALL test.p3();
+END|
+CALL test.p4();
+SELECT * FROM test.t2 ORDER BY a;
+a
+6
+7
+SELECT * FROM test.t2 ORDER BY a;
+a
+6
+7
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p4;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
diff --git a/mysql-test/r/rpl_row_sp011.result b/mysql-test/r/rpl_row_sp011.result
new file mode 100644
index 00000000000..e35c9f21adb
--- /dev/null
+++ b/mysql-test/r/rpl_row_sp011.result
@@ -0,0 +1,69 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p4;
+DROP PROCEDURE IF EXISTS test.p5;
+DROP PROCEDURE IF EXISTS test.p6;
+DROP PROCEDURE IF EXISTS test.p7;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+CREATE TABLE test.t1 (a int, PRIMARY KEY(a));
+INSERT INTO test.t1 VALUES (1);
+CREATE PROCEDURE test.p1()
+BEGIN
+ALTER TABLE test.t1 ADD COLUMN b CHAR(4) AFTER a;
+UPDATE test.t1 SET b = 'rbr' WHERE a = 1;
+CALL test.p2();
+END|
+CREATE PROCEDURE test.p2()
+BEGIN
+ALTER TABLE test.t1 ADD COLUMN f FLOAT AFTER b;
+UPDATE test.t1 SET f = RAND() WHERE a = 1;
+CALL test.p3();
+END|
+CREATE PROCEDURE test.p3()
+BEGIN
+ALTER TABLE test.t1 RENAME test.t2;
+CALL test.p4();
+END|
+CREATE PROCEDURE test.p4()
+BEGIN
+ALTER TABLE test.t2 ADD INDEX (f);
+ALTER TABLE test.t2 CHANGE a a INT UNSIGNED NOT NULL AUTO_INCREMENT;
+INSERT INTO test.t2 VALUES (NULL,'TEST',RAND());
+CALL test.p5();
+END|
+CREATE PROCEDURE test.p5()
+BEGIN
+ALTER TABLE test.t2 ORDER BY f;
+INSERT INTO test.t2 VALUES (NULL,'STM',RAND());
+CALL test.p6();
+END|
+CREATE PROCEDURE test.p6()
+BEGIN
+ALTER TABLE test.t2 ADD COLUMN b2 CHAR(4) FIRST;
+ALTER TABLE test.t2 ADD COLUMN to_drop BIT(8) AFTER b2;
+INSERT INTO test.t2 VALUES ('new',1,NULL,'STM',RAND());
+CALL test.p7();
+END|
+CREATE PROCEDURE test.p7()
+BEGIN
+ALTER TABLE test.t2 DROP COLUMN to_drop;
+INSERT INTO test.t2 VALUES ('gone',NULL,'STM',RAND());
+END|
+CALL test.p1();
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p4;
+DROP PROCEDURE IF EXISTS test.p5;
+DROP PROCEDURE IF EXISTS test.p6;
+DROP PROCEDURE IF EXISTS test.p7;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
diff --git a/mysql-test/r/rpl_row_sp012.result b/mysql-test/r/rpl_row_sp012.result
new file mode 100644
index 00000000000..28da1c3208e
--- /dev/null
+++ b/mysql-test/r/rpl_row_sp012.result
@@ -0,0 +1,58 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+grant usage on *.* to user1@localhost;
+flush privileges;
+SELECT CURRENT_USER();
+CURRENT_USER()
+root@localhost
+SELECT USER();
+USER()
+root@localhost
+CREATE PROCEDURE test.p1 () SQL SECURITY INVOKER SELECT CURRENT_USER(), USER();
+CREATE PROCEDURE test.p2 () SQL SECURITY DEFINER CALL test.p1();
+CREATE PROCEDURE test.p3 () SQL SECURITY INVOKER CALL test.p1();
+GRANT EXECUTE ON PROCEDURE p1 TO user1@localhost;
+GRANT EXECUTE ON PROCEDURE p2 TO user1@localhost;
+GRANT EXECUTE ON PROCEDURE p3 TO user1@localhost;
+
+<******** Master user1 p3 & p2 calls *******>
+----------------------------------------------
+SELECT CURRENT_USER();
+CURRENT_USER()
+user1@localhost
+SELECT USER();
+USER()
+user1@localhost
+CALL test.p3();
+CURRENT_USER() USER()
+user1@localhost user1@localhost
+CALL test.p2();
+CURRENT_USER() USER()
+root@localhost user1@localhost
+
+<******** Slave user1 p3 & p2 calls *******>
+---------------------------------------------
+SELECT CURRENT_USER();
+CURRENT_USER()
+user1@localhost
+SELECT USER();
+USER()
+user1@localhost
+CALL test.p3();
+CURRENT_USER() USER()
+user1@localhost user1@localhost
+CALL test.p2();
+CURRENT_USER() USER()
+root@localhost user1@localhost
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
diff --git a/mysql-test/r/rpl_row_stop_middle.result b/mysql-test/r/rpl_row_stop_middle.result
new file mode 100644
index 00000000000..46ca5748174
--- /dev/null
+++ b/mysql-test/r/rpl_row_stop_middle.result
@@ -0,0 +1,26 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int not null auto_increment primary key, b int, key(b));
+stop slave;
+INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+start slave;
+stop slave;
+drop table t1;
+drop table t1;
diff --git a/mysql-test/r/rpl_row_stop_middle_update.result b/mysql-test/r/rpl_row_stop_middle_update.result
new file mode 100644
index 00000000000..0fd4ff86893
--- /dev/null
+++ b/mysql-test/r/rpl_row_stop_middle_update.result
@@ -0,0 +1,16 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (words varchar(20)) engine=myisam;
+load data infile '../std_data_ln/words.dat' into table t1 (words);
+select count(*) from t1;
+count(*)
+70
+select count(*) from t1;
+count(*)
+70
+drop table t1;
+drop table t1;
diff --git a/mysql-test/r/rpl_row_tabledefs_2myisam.result b/mysql-test/r/rpl_row_tabledefs_2myisam.result
new file mode 100644
index 00000000000..ae792a5dc2a
--- /dev/null
+++ b/mysql-test/r/rpl_row_tabledefs_2myisam.result
@@ -0,0 +1,381 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+STOP SLAVE;
+SET GLOBAL SQL_MODE='STRICT_ALL_TABLES';
+START SLAVE;
+CREATE TABLE t1_int (a INT PRIMARY KEY, b INT) ENGINE='MyISAM';
+CREATE TABLE t1_bit (a INT PRIMARY KEY, b INT) ENGINE='MyISAM';
+CREATE TABLE t1_char (a INT PRIMARY KEY, b INT) ENGINE='MyISAM';
+CREATE TABLE t1_nodef (a INT PRIMARY KEY, b INT) ENGINE='MyISAM';
+CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE='MyISAM';
+CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE='MyISAM';
+CREATE TABLE t4 (a INT) ENGINE='MyISAM';
+CREATE TABLE t5 (a INT, b INT, c INT) ENGINE='MyISAM';
+CREATE TABLE t6 (a INT, b INT, c INT) ENGINE='MyISAM';
+CREATE TABLE t7 (a INT NOT NULL) ENGINE='MyISAM';
+CREATE TABLE t8 (a INT NOT NULL) ENGINE='MyISAM';
+CREATE TABLE t9 (a INT) ENGINE='MyISAM';
+ALTER TABLE t1_int ADD x INT DEFAULT 42;
+ALTER TABLE t1_bit
+ADD x BIT(3) DEFAULT b'011',
+ADD y BIT(5) DEFAULT b'10101',
+ADD z BIT(2) DEFAULT b'10';
+ALTER TABLE t1_char ADD x CHAR(20) DEFAULT 'Just a test';
+ALTER TABLE t1_nodef ADD x INT NOT NULL;
+ALTER TABLE t2 DROP b;
+ALTER TABLE t4 MODIFY a FLOAT;
+ALTER TABLE t5 MODIFY b FLOAT;
+ALTER TABLE t6 MODIFY c FLOAT;
+ALTER TABLE t7 ADD e1 INT, ADD e2 INT, ADD e3 INT, ADD e4 INT,
+ADD e5 INT, ADD e6 INT, ADD e7 INT, ADD e8 INT;
+ALTER TABLE t8 ADD e1 INT NOT NULL DEFAULT 0, ADD e2 INT NOT NULL DEFAULT 0,
+ADD e3 INT NOT NULL DEFAULT 0, ADD e4 INT NOT NULL DEFAULT 0,
+ADD e5 INT NOT NULL DEFAULT 0, ADD e6 INT NOT NULL DEFAULT 0,
+ADD e7 INT NOT NULL DEFAULT 0, ADD e8 INT NOT NULL DEFAULT 0;
+INSERT INTO t1_int VALUES (2, 4, 4711);
+INSERT INTO t1_char VALUES (2, 4, 'Foo is a bar');
+INSERT INTO t1_bit VALUES (2, 4, b'101', b'11100', b'01');
+**** On Master ****
+INSERT INTO t1_int VALUES (1,2);
+INSERT INTO t1_int VALUES (2,5);
+INSERT INTO t1_bit VALUES (1,2);
+INSERT INTO t1_bit VALUES (2,5);
+INSERT INTO t1_char VALUES (1,2);
+INSERT INTO t1_char VALUES (2,5);
+SELECT * FROM t1_int;
+a b
+1 2
+2 5
+SELECT * FROM t1_bit;
+a b
+1 2
+2 5
+SELECT * FROM t1_char;
+a b
+1 2
+2 5
+**** On Slave ****
+SELECT a,b,x FROM t1_int;
+a b x
+2 5 4711
+1 2 42
+SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
+a b HEX(x) HEX(y) HEX(z)
+2 5 5 1C 1
+1 2 3 15 2
+SELECT a,b,x FROM t1_char;
+a b x
+2 5 Foo is a bar
+1 2 Just a test
+**** On Master ****
+UPDATE t1_int SET b=2*b WHERE a=2;
+UPDATE t1_char SET b=2*b WHERE a=2;
+UPDATE t1_bit SET b=2*b WHERE a=2;
+SELECT * FROM t1_int;
+a b
+1 2
+2 10
+SELECT * FROM t1_bit;
+a b
+1 2
+2 10
+SELECT * FROM t1_char;
+a b
+1 2
+2 10
+**** On Slave ****
+SELECT a,b,x FROM t1_int;
+a b x
+2 10 4711
+1 2 42
+SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
+a b HEX(x) HEX(y) HEX(z)
+2 10 5 1C 1
+1 2 3 15 2
+SELECT a,b,x FROM t1_char;
+a b x
+2 10 Foo is a bar
+1 2 Just a test
+INSERT INTO t9 VALUES (2);
+INSERT INTO t1_nodef VALUES (1,2);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1364
+Last_Error Error in Write_rows event: error during transaction execution on table test.t1_nodef
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (2);
+INSERT INTO t2 VALUES (2,4);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1522
+Last_Error Table width mismatch - received 2 columns, test.t2 has 1 columns
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (4);
+INSERT INTO t4 VALUES (4);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1522
+Last_Error Column 0 type mismatch - received type 3, test.t4 has type 4
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (5);
+INSERT INTO t5 VALUES (5,10,25);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1522
+Last_Error Column 1 type mismatch - received type 3, test.t5 has type 4
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (6);
+INSERT INTO t6 VALUES (6,12,36);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1522
+Last_Error Column 2 type mismatch - received type 3, test.t6 has type 4
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (6);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+INSERT INTO t7 VALUES (1),(2),(3);
+INSERT INTO t8 VALUES (1),(2),(3);
+SELECT * FROM t7;
+a
+1
+2
+3
+SELECT * FROM t8;
+a
+1
+2
+3
+SELECT * FROM t7;
+a e1 e2 e3 e4 e5 e6 e7 e8
+1 NULL NULL NULL NULL NULL NULL NULL NULL
+2 NULL NULL NULL NULL NULL NULL NULL NULL
+3 NULL NULL NULL NULL NULL NULL NULL NULL
+SELECT * FROM t8;
+a e1 e2 e3 e4 e5 e6 e7 e8
+1 0 0 0 0 0 0 0 0
+2 0 0 0 0 0 0 0 0
+3 0 0 0 0 0 0 0 0
+**** On Master ****
+TRUNCATE t1_nodef;
+SET SQL_LOG_BIN=0;
+INSERT INTO t1_nodef VALUES (1,2);
+INSERT INTO t1_nodef VALUES (2,4);
+SET SQL_LOG_BIN=1;
+**** On Slave ****
+INSERT INTO t1_nodef VALUES (1,2,3);
+INSERT INTO t1_nodef VALUES (2,4,6);
+**** On Master ****
+UPDATE t1_nodef SET b=2*b WHERE a=1;
+SELECT * FROM t1_nodef;
+a b
+1 4
+2 4
+**** On Slave ****
+SELECT * FROM t1_nodef;
+a b x
+1 4 3
+2 4 6
+**** On Master ****
+DELETE FROM t1_nodef WHERE a=2;
+SELECT * FROM t1_nodef;
+a b
+1 4
+**** On Slave ****
+SELECT * FROM t1_nodef;
+a b x
+1 4 3
+**** Cleanup ****
+DROP TABLE IF EXISTS t1_int,t1_bit,t1_char,t1_nodef;
+DROP TABLE IF EXISTS t2,t3,t4,t5,t6,t7,t8,t9;
diff --git a/mysql-test/r/rpl_row_tabledefs_3innodb.result b/mysql-test/r/rpl_row_tabledefs_3innodb.result
new file mode 100644
index 00000000000..b7f0b7b15e2
--- /dev/null
+++ b/mysql-test/r/rpl_row_tabledefs_3innodb.result
@@ -0,0 +1,381 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+STOP SLAVE;
+SET GLOBAL SQL_MODE='STRICT_ALL_TABLES';
+START SLAVE;
+CREATE TABLE t1_int (a INT PRIMARY KEY, b INT) ENGINE='InnoDB';
+CREATE TABLE t1_bit (a INT PRIMARY KEY, b INT) ENGINE='InnoDB';
+CREATE TABLE t1_char (a INT PRIMARY KEY, b INT) ENGINE='InnoDB';
+CREATE TABLE t1_nodef (a INT PRIMARY KEY, b INT) ENGINE='InnoDB';
+CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE='InnoDB';
+CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE='InnoDB';
+CREATE TABLE t4 (a INT) ENGINE='InnoDB';
+CREATE TABLE t5 (a INT, b INT, c INT) ENGINE='InnoDB';
+CREATE TABLE t6 (a INT, b INT, c INT) ENGINE='InnoDB';
+CREATE TABLE t7 (a INT NOT NULL) ENGINE='InnoDB';
+CREATE TABLE t8 (a INT NOT NULL) ENGINE='InnoDB';
+CREATE TABLE t9 (a INT) ENGINE='InnoDB';
+ALTER TABLE t1_int ADD x INT DEFAULT 42;
+ALTER TABLE t1_bit
+ADD x BIT(3) DEFAULT b'011',
+ADD y BIT(5) DEFAULT b'10101',
+ADD z BIT(2) DEFAULT b'10';
+ALTER TABLE t1_char ADD x CHAR(20) DEFAULT 'Just a test';
+ALTER TABLE t1_nodef ADD x INT NOT NULL;
+ALTER TABLE t2 DROP b;
+ALTER TABLE t4 MODIFY a FLOAT;
+ALTER TABLE t5 MODIFY b FLOAT;
+ALTER TABLE t6 MODIFY c FLOAT;
+ALTER TABLE t7 ADD e1 INT, ADD e2 INT, ADD e3 INT, ADD e4 INT,
+ADD e5 INT, ADD e6 INT, ADD e7 INT, ADD e8 INT;
+ALTER TABLE t8 ADD e1 INT NOT NULL DEFAULT 0, ADD e2 INT NOT NULL DEFAULT 0,
+ADD e3 INT NOT NULL DEFAULT 0, ADD e4 INT NOT NULL DEFAULT 0,
+ADD e5 INT NOT NULL DEFAULT 0, ADD e6 INT NOT NULL DEFAULT 0,
+ADD e7 INT NOT NULL DEFAULT 0, ADD e8 INT NOT NULL DEFAULT 0;
+INSERT INTO t1_int VALUES (2, 4, 4711);
+INSERT INTO t1_char VALUES (2, 4, 'Foo is a bar');
+INSERT INTO t1_bit VALUES (2, 4, b'101', b'11100', b'01');
+**** On Master ****
+INSERT INTO t1_int VALUES (1,2);
+INSERT INTO t1_int VALUES (2,5);
+INSERT INTO t1_bit VALUES (1,2);
+INSERT INTO t1_bit VALUES (2,5);
+INSERT INTO t1_char VALUES (1,2);
+INSERT INTO t1_char VALUES (2,5);
+SELECT * FROM t1_int;
+a b
+1 2
+2 5
+SELECT * FROM t1_bit;
+a b
+1 2
+2 5
+SELECT * FROM t1_char;
+a b
+1 2
+2 5
+**** On Slave ****
+SELECT a,b,x FROM t1_int;
+a b x
+2 5 4711
+1 2 42
+SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
+a b HEX(x) HEX(y) HEX(z)
+2 5 5 1C 1
+1 2 3 15 2
+SELECT a,b,x FROM t1_char;
+a b x
+2 5 Foo is a bar
+1 2 Just a test
+**** On Master ****
+UPDATE t1_int SET b=2*b WHERE a=2;
+UPDATE t1_char SET b=2*b WHERE a=2;
+UPDATE t1_bit SET b=2*b WHERE a=2;
+SELECT * FROM t1_int;
+a b
+1 2
+2 10
+SELECT * FROM t1_bit;
+a b
+1 2
+2 10
+SELECT * FROM t1_char;
+a b
+1 2
+2 10
+**** On Slave ****
+SELECT a,b,x FROM t1_int;
+a b x
+2 10 4711
+1 2 42
+SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
+a b HEX(x) HEX(y) HEX(z)
+2 10 5 1C 1
+1 2 3 15 2
+SELECT a,b,x FROM t1_char;
+a b x
+2 10 Foo is a bar
+1 2 Just a test
+INSERT INTO t9 VALUES (2);
+INSERT INTO t1_nodef VALUES (1,2);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1364
+Last_Error Error in Write_rows event: error during transaction execution on table test.t1_nodef
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (2);
+INSERT INTO t2 VALUES (2,4);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1522
+Last_Error Table width mismatch - received 2 columns, test.t2 has 1 columns
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (4);
+INSERT INTO t4 VALUES (4);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1522
+Last_Error Column 0 type mismatch - received type 3, test.t4 has type 4
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (5);
+INSERT INTO t5 VALUES (5,10,25);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1522
+Last_Error Column 1 type mismatch - received type 3, test.t5 has type 4
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (6);
+INSERT INTO t6 VALUES (6,12,36);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1522
+Last_Error Column 2 type mismatch - received type 3, test.t6 has type 4
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (6);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+INSERT INTO t7 VALUES (1),(2),(3);
+INSERT INTO t8 VALUES (1),(2),(3);
+SELECT * FROM t7;
+a
+1
+2
+3
+SELECT * FROM t8;
+a
+1
+2
+3
+SELECT * FROM t7;
+a e1 e2 e3 e4 e5 e6 e7 e8
+1 NULL NULL NULL NULL NULL NULL NULL NULL
+2 NULL NULL NULL NULL NULL NULL NULL NULL
+3 NULL NULL NULL NULL NULL NULL NULL NULL
+SELECT * FROM t8;
+a e1 e2 e3 e4 e5 e6 e7 e8
+1 0 0 0 0 0 0 0 0
+2 0 0 0 0 0 0 0 0
+3 0 0 0 0 0 0 0 0
+**** On Master ****
+TRUNCATE t1_nodef;
+SET SQL_LOG_BIN=0;
+INSERT INTO t1_nodef VALUES (1,2);
+INSERT INTO t1_nodef VALUES (2,4);
+SET SQL_LOG_BIN=1;
+**** On Slave ****
+INSERT INTO t1_nodef VALUES (1,2,3);
+INSERT INTO t1_nodef VALUES (2,4,6);
+**** On Master ****
+UPDATE t1_nodef SET b=2*b WHERE a=1;
+SELECT * FROM t1_nodef;
+a b
+1 4
+2 4
+**** On Slave ****
+SELECT * FROM t1_nodef;
+a b x
+1 4 3
+2 4 6
+**** On Master ****
+DELETE FROM t1_nodef WHERE a=2;
+SELECT * FROM t1_nodef;
+a b
+1 4
+**** On Slave ****
+SELECT * FROM t1_nodef;
+a b x
+1 4 3
+**** Cleanup ****
+DROP TABLE IF EXISTS t1_int,t1_bit,t1_char,t1_nodef;
+DROP TABLE IF EXISTS t2,t3,t4,t5,t6,t7,t8,t9;
diff --git a/mysql-test/r/rpl_row_tabledefs_7ndb.result b/mysql-test/r/rpl_row_tabledefs_7ndb.result
new file mode 100644
index 00000000000..0d0da3b6185
--- /dev/null
+++ b/mysql-test/r/rpl_row_tabledefs_7ndb.result
@@ -0,0 +1,286 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+STOP SLAVE;
+SET GLOBAL SQL_MODE='STRICT_ALL_TABLES';
+START SLAVE;
+CREATE TABLE t1_int (a INT PRIMARY KEY, b INT) ENGINE='NDB';
+CREATE TABLE t1_bit (a INT PRIMARY KEY, b INT) ENGINE='NDB';
+CREATE TABLE t1_char (a INT PRIMARY KEY, b INT) ENGINE='NDB';
+CREATE TABLE t1_nodef (a INT PRIMARY KEY, b INT) ENGINE='NDB';
+CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE='NDB';
+CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE='NDB';
+CREATE TABLE t4 (a INT) ENGINE='NDB';
+CREATE TABLE t5 (a INT, b INT, c INT) ENGINE='NDB';
+CREATE TABLE t6 (a INT, b INT, c INT) ENGINE='NDB';
+CREATE TABLE t9 (a INT) ENGINE='NDB';
+ALTER TABLE t1_int ADD x INT DEFAULT 42;
+ALTER TABLE t1_bit
+ADD x BIT(3) DEFAULT b'011',
+ADD y BIT(5) DEFAULT b'10101',
+ADD z BIT(2) DEFAULT b'10';
+ALTER TABLE t1_char ADD x CHAR(20) DEFAULT 'Just a test';
+ALTER TABLE t1_nodef ADD x INT NOT NULL;
+ALTER TABLE t2 DROP b;
+ALTER TABLE t4 MODIFY a FLOAT;
+ALTER TABLE t5 MODIFY b FLOAT;
+ALTER TABLE t6 MODIFY c FLOAT;
+INSERT INTO t1_int VALUES (2, 4, 4711);
+INSERT INTO t1_char VALUES (2, 4, 'Foo is a bar');
+INSERT INTO t1_bit VALUES (2, 4, b'101', b'11100', b'01');
+**** On Master ****
+INSERT INTO t1_int VALUES (1,2);
+INSERT INTO t1_int VALUES (2,5);
+INSERT INTO t1_bit VALUES (1,2);
+INSERT INTO t1_bit VALUES (2,5);
+INSERT INTO t1_char VALUES (1,2);
+INSERT INTO t1_char VALUES (2,5);
+SELECT * FROM t1_int;
+a b
+1 2
+2 5
+SELECT * FROM t1_bit;
+a b
+1 2
+2 5
+SELECT * FROM t1_char;
+a b
+1 2
+2 5
+**** On Slave ****
+SELECT a,b,x FROM t1_int;
+a b x
+1 2 42
+2 5 42
+SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
+a b HEX(x) HEX(y) HEX(z)
+1 2 3 15 2
+2 5 3 15 2
+SELECT a,b,x FROM t1_char;
+a b x
+1 2 Just a test
+2 5 Just a test
+**** On Master ****
+UPDATE t1_int SET b=2*b WHERE a=2;
+UPDATE t1_char SET b=2*b WHERE a=2;
+UPDATE t1_bit SET b=2*b WHERE a=2;
+SELECT * FROM t1_int;
+a b
+1 2
+2 10
+SELECT * FROM t1_bit;
+a b
+1 2
+2 10
+SELECT * FROM t1_char;
+a b
+1 2
+2 10
+**** On Slave ****
+SELECT a,b,x FROM t1_int;
+a b x
+1 2 42
+2 10 42
+SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
+a b HEX(x) HEX(y) HEX(z)
+1 2 3 15 2
+2 10 3 15 2
+SELECT a,b,x FROM t1_char;
+a b x
+1 2 Just a test
+2 10 Just a test
+INSERT INTO t9 VALUES (2);
+INSERT INTO t1_nodef VALUES (1,2);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1364
+Last_Error Error in Write_rows event: error during transaction execution on table test.t1_nodef
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (2);
+INSERT INTO t2 VALUES (2,4);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1514
+Last_Error Table width mismatch - received 2 columns, test.t2 has 1 columns
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (4);
+INSERT INTO t4 VALUES (4);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1514
+Last_Error Column 0 type mismatch - received type 3, test.t4 has type 4
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (5);
+INSERT INTO t5 VALUES (5,10,25);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1514
+Last_Error Column 1 type mismatch - received type 3, test.t5 has type 4
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (6);
+INSERT INTO t6 VALUES (6,12,36);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1514
+Last_Error Column 2 type mismatch - received type 3, test.t6 has type 4
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+DROP TABLE IF EXISTS t1_int,t1_bit,t1_char,t1_nodef;
+DROP TABLE IF EXISTS t2,t3,t4,t5,t6,t9;
diff --git a/mysql-test/r/rpl_row_trig001.result b/mysql-test/r/rpl_row_trig001.result
new file mode 100644
index 00000000000..6665dc6d555
--- /dev/null
+++ b/mysql-test/r/rpl_row_trig001.result
@@ -0,0 +1,30 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE test.t1 (n MEDIUMINT NOT NULL, d DATETIME, PRIMARY KEY(n));
+CREATE TABLE test.t2 (n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
+CREATE TABLE test.t3 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d DATETIME, PRIMARY KEY(n));
+INSERT INTO test.t1 VALUES (1,NOW());
+CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t1 SET d=NOW() where n = 1;//
+CREATE PROCEDURE test.p3()
+BEGIN
+INSERT INTO test.t3 (d) VALUES (NOW());
+END//
+CREATE TRIGGER test.t3_bi_t2 BEFORE INSERT ON test.t2 FOR EACH ROW CALL test.p3()//
+CREATE PROCEDURE test.p2()
+BEGIN
+INSERT INTO test.t2 (f,d) VALUES (RAND(),NOW());
+END//
+
+<End test section 2 (Tiggers & SP)>
+-----------------------------------
+DROP PROCEDURE test.p2;
+DROP PROCEDURE test.p3;
+DROP TRIGGER test.t2_ai;
+DROP TRIGGER test.t3_bi_t2;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
diff --git a/mysql-test/r/rpl_row_trig002.result b/mysql-test/r/rpl_row_trig002.result
new file mode 100644
index 00000000000..794104db750
--- /dev/null
+++ b/mysql-test/r/rpl_row_trig002.result
@@ -0,0 +1,69 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TRIGGER test.t2_ai;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+CREATE TABLE test.t2 (value CHAR(30),domain_id INT, mailaccount_id INT, program CHAR(30),keey CHAR(30),PRIMARY KEY(domain_id));
+CREATE TABLE test.t3 (value CHAR(30),domain_id INT, mailaccount_id INT, program CHAR(30),keey CHAR(30),PRIMARY KEY(domain_id));
+CREATE TABLE test.t1 (id INT,domain CHAR(30),PRIMARY KEY(id));
+CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t3 ms, test.t1 d SET ms.value='No' WHERE ms.domain_id = (SELECT max(id) FROM test.t1 WHERE domain='example.com') AND ms.mailaccount_id IS NULL AND ms.program='spamfilter' AND ms.keey='scan_incoming'|
+INSERT INTO test.t1 VALUES (1, 'example.com'),(2, 'mysql.com'),(3, 'earthmotherwear.com'), (4, 'yahoo.com'),(5, 'example.com');
+SELECT * FROM test.t1 ORDER BY id;
+id domain
+1 example.com
+2 mysql.com
+3 earthmotherwear.com
+4 yahoo.com
+5 example.com
+SELECT * FROM test.t1 ORDER BY id;
+id domain
+1 example.com
+2 mysql.com
+3 earthmotherwear.com
+4 yahoo.com
+5 example.com
+INSERT INTO test.t3 VALUES ('Yes', 5, NULL, 'spamfilter','scan_incoming');
+INSERT INTO test.t3 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
+INSERT INTO test.t2 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
+select * from test.t2;
+value domain_id mailaccount_id program keey
+Yes 1 NULL spamfilter scan_incoming
+select * from test.t3;
+value domain_id mailaccount_id program keey
+No 5 NULL spamfilter scan_incoming
+Yes 1 NULL spamfilter scan_incoming
+select * from test.t2;
+value domain_id mailaccount_id program keey
+Yes 1 NULL spamfilter scan_incoming
+select * from test.t3;
+value domain_id mailaccount_id program keey
+No 5 NULL spamfilter scan_incoming
+Yes 1 NULL spamfilter scan_incoming
+DELETE FROM test.t1 WHERE id = 1;
+SELECT * FROM test.t1 ORDER BY id;
+id domain
+2 mysql.com
+3 earthmotherwear.com
+4 yahoo.com
+5 example.com
+SELECT * FROM test.t1 ORDER BY id;
+id domain
+2 mysql.com
+3 earthmotherwear.com
+4 yahoo.com
+5 example.com
+SELECT * FROM test.t1 ORDER BY id;
+id domain
+2 mysql.com
+3 earthmotherwear.com
+4 yahoo.com
+5 example.com
+DROP TRIGGER test.t2_ai;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
diff --git a/mysql-test/r/rpl_row_trig003.result b/mysql-test/r/rpl_row_trig003.result
new file mode 100644
index 00000000000..43c2ecde2b4
--- /dev/null
+++ b/mysql-test/r/rpl_row_trig003.result
@@ -0,0 +1,83 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TRIGGER test.t1_bi;
+DROP TRIGGER test.t2_ai;
+DROP TRIGGER test.t1_bu;
+DROP TRIGGER test.t2_au;
+DROP TRIGGER test.t1_bd;
+DROP TRIGGER test.t2_ad;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+CREATE TABLE test.t1 (id MEDIUMINT NOT NULL AUTO_INCREMENT, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
+CREATE TABLE test.t2 (id MEDIUMINT NOT NULL AUTO_INCREMENT, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
+CREATE TABLE test.t3 (id MEDIUMINT NOT NULL AUTO_INCREMENT, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
+CREATE TRIGGER test.t1_bi BEFORE INSERT ON test.t1 FOR EACH ROW UPDATE test.t3 SET b1=1 and y=YEAR(NOW())|
+CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW BEGIN
+INSERT INTO test.t3 VALUES(NULL,0,'MySQL Replication team rocks!', 'Dark beer in prague is #1',12345.34,12.51,0,1965,NOW());
+UPDATE test.t3 SET f = ROUND(f);
+END|
+CREATE TRIGGER test.t1_bu BEFORE UPDATE on test.t1 FOR EACH ROW BEGIN
+UPDATE test.t3 SET y = '2000';
+INSERT INTO test.t3 VALUES(NULL,1,'Testing MySQL databases before update ', 'Insert should work',621.43, 0105.21,0,1974,NOW());
+END|
+CREATE TRIGGER test.t2_au AFTER UPDATE on test.t2 FOR EACH ROW BEGIN
+DECLARE done INT DEFAULT 0;
+DECLARE a DECIMAL(10,4);
+DECLARE b FLOAT;
+DECLARE num MEDIUMINT;
+DECLARE cur1 CURSOR FOR SELECT t2.id, t2.d, t2.f FROM test.t2;
+DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
+OPEN cur1;
+REPEAT
+FETCH cur1 INTO num, a, b;
+IF NOT done THEN
+UPDATE test.t3 SET total =(a*b) WHERE ID = num;
+END IF;
+UNTIL done END REPEAT;
+CLOSE cur1;
+END|
+CREATE TRIGGER test.t1_bd BEFORE DELETE on test.t1 FOR EACH ROW BEGIN
+DECLARE done INT DEFAULT 0;
+DECLARE a BIT(8);
+DECLARE b VARCHAR(255);
+DECLARE c CHAR(255);
+DECLARE d DECIMAL(10,4);
+DECLARE e FLOAT;
+DECLARE f BIGINT UNSIGNED;
+DECLARE g YEAR;
+DECLARE h TIMESTAMP;
+DECLARE cur1 CURSOR FOR SELECT t1.b1, t1.vc, t1.bc, t1.d, t1.f, t1.total, t1.y, t1.t FROM test.t1;
+DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
+OPEN cur1;
+REPEAT
+FETCH cur1 INTO a, b, c, d, e, f, g, h;
+IF NOT done THEN
+INSERT INTO test.t3 VALUES(NULL, a, b, c, d, e, f, g, h);
+END IF;
+UNTIL done END REPEAT;
+CLOSE cur1;
+END|
+CREATE TRIGGER test.t2_ad AFTER DELETE ON test.t2 FOR EACH ROW
+DELETE FROM test.t1|
+INSERT INTO test.t1 VALUES(NULL,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,NOW());
+INSERT INTO test.t2 VALUES(NULL,0,'Testing MySQL databases is a cool ', 'MySQL Customers ROCK!',654321.4321,1.24521,0,YEAR(NOW()),NOW());
+UPDATE test.t1 SET b1 = 0 WHERE b1 = 1;
+INSERT INTO test.t2 VALUES(NULL,1,'This is an after update test.', 'If this works, total will not be zero on the master or slave',1.4321,5.221,0,YEAR(NOW()),NOW());
+UPDATE test.t2 SET b1 = 0 WHERE b1 = 1;
+INSERT INTO test.t1 VALUES(NULL,1,'add some more test data test.', 'and hope for the best', 3.321,5.221,0,YEAR(NOW()),NOW());
+DELETE FROM test.t1 WHERE id = 1;
+DELETE FROM test.t2 WHERE id = 1;
+DROP TRIGGER test.t1_bi;
+DROP TRIGGER test.t2_ai;
+DROP TRIGGER test.t1_bu;
+DROP TRIGGER test.t2_au;
+DROP TRIGGER test.t1_bd;
+DROP TRIGGER test.t2_ad;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
diff --git a/mysql-test/r/rpl_row_trig004.result b/mysql-test/r/rpl_row_trig004.result
new file mode 100644
index 00000000000..d0d0657f875
--- /dev/null
+++ b/mysql-test/r/rpl_row_trig004.result
@@ -0,0 +1,30 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TRIGGER test.t1_bi_t2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+CREATE TABLE test.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d FLOAT, PRIMARY KEY(n))ENGINE=INNODB;
+CREATE TABLE test.t2 (n MEDIUMINT NOT NULL, f FLOAT, PRIMARY KEY(n))ENGINE=INNODB;
+CREATE TRIGGER test.t1_bi_t2 BEFORE INSERT ON test.t2 FOR EACH ROW INSERT INTO test.t1 VALUES (NULL, 1.234)//
+INSERT INTO test.t2 VALUES (1, 0.0);
+INSERT INTO test.t2 VALUES (1, 0.0);
+Got one of the listed errors
+select * from test.t1;
+n d
+1 1.234
+select * from test.t2;
+n f
+1 0
+select * from test.t1;
+n d
+1 1.234
+select * from test.t2;
+n f
+1 0
+DROP TRIGGER test.t1_bi_t2;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
diff --git a/mysql-test/r/rpl_row_until.result b/mysql-test/r/rpl_row_until.result
new file mode 100644
index 00000000000..8d4b0d6b591
--- /dev/null
+++ b/mysql-test/r/rpl_row_until.result
@@ -0,0 +1,62 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+create table t1(n int not null auto_increment primary key);
+insert into t1 values (1),(2),(3),(4);
+drop table t1;
+create table t2(n int not null auto_increment primary key);
+insert into t2 values (1),(2);
+insert into t2 values (3),(4);
+drop table t2;
+start slave until master_log_file='master-bin.000001', master_log_pos=311;
+select * from t1;
+n
+1
+2
+3
+4
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 740 slave-relay-bin.000004 # master-bin.000001 # No 0 0 311 # Master master-bin.000001 311 No #
+start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
+select * from t1;
+n
+1
+2
+3
+4
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 740 slave-relay-bin.000004 # master-bin.000001 # No 0 0 311 # Master master-no-such-bin.000001 291 No #
+start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728;
+select * from t2;
+n
+1
+2
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 740 slave-relay-bin.000004 # master-bin.000001 # No 0 0 586 # Relay slave-relay-bin.000004 728 No #
+start slave;
+stop slave;
+start slave until master_log_file='master-bin.000001', master_log_pos=740;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 740 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 740 # Master master-bin.000001 740 No #
+start slave until master_log_file='master-bin', master_log_pos=561;
+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
+start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
+start slave until master_log_file='master-bin.000001';
+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
+start slave until relay_log_file='slave-relay-bin.000002';
+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
+start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
+start slave sql_thread;
+start slave until master_log_file='master-bin.000001', master_log_pos=740;
+Warnings:
+Note 1254 Slave is already running
diff --git a/mysql-test/r/rpl_row_view01.result b/mysql-test/r/rpl_row_view01.result
new file mode 100644
index 00000000000..0006ec99f5e
--- /dev/null
+++ b/mysql-test/r/rpl_row_view01.result
@@ -0,0 +1,100 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create database if not exists mysqltest1;
+DROP VIEW IF EXISTS mysqltest1.v1;
+DROP VIEW IF EXISTS mysqltest1.v2;
+DROP VIEW IF EXISTS mysqltest1.v3;
+DROP VIEW IF EXISTS mysqltest1.v4;
+DROP TABLE IF EXISTS mysqltest1.t3;
+DROP TABLE IF EXISTS mysqltest1.t1;
+DROP TABLE IF EXISTS mysqltest1.t2;
+DROP TABLE IF EXISTS mysqltest1.t4;
+CREATE TABLE mysqltest1.t1 (a INT, c CHAR(6),PRIMARY KEY(a));
+CREATE TABLE mysqltest1.t2 (a INT, c CHAR(6),PRIMARY KEY(a));
+CREATE TABLE mysqltest1.t3 (a INT, c CHAR(6), c2 CHAR(6), PRIMARY KEY(a));
+CREATE TABLE mysqltest1.t4 (a INT, qty INT, price INT,PRIMARY KEY(a));
+CREATE TABLE mysqltest1.t5 (qty INT, price INT, total INT, PRIMARY KEY(qty));
+INSERT INTO mysqltest1.t1 VALUES (1,'Thank'),(2,'it'),(3,'Friday');
+INSERT INTO mysqltest1.t2 VALUES (1,'GOD'),(2,'is'),(3,'TGIF');
+INSERT INTO mysqltest1.t4 VALUES(1, 3, 50),(2, 18, 3),(4, 4, 4);
+CREATE VIEW mysqltest1.v2 AS SELECT qty, price, qty*price AS value FROM mysqltest1.t4 ORDER BY qty;
+CREATE VIEW mysqltest1.v1 AS SELECT t1.a, t1.c, t2.c as c2 FROM mysqltest1.t1 as t1, mysqltest1.t2 AS t2 WHERE mysqltest1.t1.a = mysqltest1.t2.a ORDER BY a;
+CREATE VIEW mysqltest1.v3 AS SELECT * FROM mysqltest1.t1;
+CREATE VIEW mysqltest1.v4 AS SELECT * FROM mysqltest1.v3 WHERE a > 1 WITH LOCAL CHECK OPTION;
+SELECT * FROM mysqltest1.v2;
+qty price value
+3 50 150
+4 4 16
+18 3 54
+SELECT * FROM mysqltest1.v1;
+a c c2
+1 Thank GOD
+2 it is
+3 Friday TGIF
+SELECT * FROM mysqltest1.v2;
+qty price value
+3 50 150
+4 4 16
+18 3 54
+SELECT * FROM mysqltest1.v1;
+a c c2
+1 Thank GOD
+2 it is
+3 Friday TGIF
+INSERT INTO mysqltest1.t5 SELECT * FROM mysqltest1.v2;
+INSERT INTO mysqltest1.t3 SELECT * FROM mysqltest1.v1;
+SELECT * FROM mysqltest1.t5 ORDER BY qty;
+qty price total
+3 50 150
+4 4 16
+18 3 54
+SELECT * FROM mysqltest1.t3 ORDER BY a;
+a c c2
+1 Thank GOD
+2 it is
+3 Friday TGIF
+SELECT * FROM mysqltest1.t5 ORDER BY qty;
+qty price total
+3 50 150
+4 4 16
+18 3 54
+SELECT * FROM mysqltest1.t3 ORDER BY a;
+a c c2
+1 Thank GOD
+2 it is
+3 Friday TGIF
+INSERT INTO mysqltest1.v4 VALUES (4,'TEST');
+SELECT * FROM mysqltest1.t1 ORDER BY a;
+a c
+1 Thank
+2 it
+3 Friday
+4 TEST
+SELECT * FROM mysqltest1.v4 ORDER BY a;
+a c
+2 it
+3 Friday
+4 TEST
+SELECT * FROM mysqltest1.t1 ORDER BY a;
+a c
+1 Thank
+2 it
+3 Friday
+4 TEST
+SELECT * FROM mysqltest1.v4 ORDER BY a;
+a c
+2 it
+3 Friday
+4 TEST
+DROP VIEW IF EXISTS mysqltest1.v1;
+DROP VIEW IF EXISTS mysqltest1.v2;
+DROP VIEW IF EXISTS mysqltest1.v3;
+DROP VIEW IF EXISTS mysqltest1.v4;
+DROP TABLE IF EXISTS mysqltest1.t3;
+DROP TABLE IF EXISTS mysqltest1.t1;
+DROP TABLE IF EXISTS mysqltest1.t2;
+DROP TABLE IF EXISTS mysqltest1.t4;
diff --git a/mysql-test/r/rpl_server_id1.result b/mysql-test/r/rpl_server_id1.result
index a3ab6672f69..c94a7748fcd 100644
--- a/mysql-test/r/rpl_server_id1.result
+++ b/mysql-test/r/rpl_server_id1.result
@@ -10,7 +10,7 @@ stop slave;
change master to master_port=SLAVE_PORT;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
- 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 98 None 0 No NULL
+ 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # # 0 0 0 102 None 0 No NULL
start slave;
insert into t1 values (1);
show status like "slave_running";
diff --git a/mysql-test/r/rpl_server_id2.result b/mysql-test/r/rpl_server_id2.result
index b196646aecc..72db862040e 100644
--- a/mysql-test/r/rpl_server_id2.result
+++ b/mysql-test/r/rpl_server_id2.result
@@ -10,7 +10,7 @@ stop slave;
change master to master_port=SLAVE_PORT;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
- 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 98 None 0 No NULL
+ 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 102 None 0 No NULL
start slave;
insert into t1 values (1);
select * from t1;
diff --git a/mysql-test/r/rpl_skip_error.result b/mysql-test/r/rpl_skip_error.result
index adc61f8c2c8..248ce5b52c3 100644
--- a/mysql-test/r/rpl_skip_error.result
+++ b/mysql-test/r/rpl_skip_error.result
@@ -8,7 +8,7 @@ create table t1 (n int not null primary key);
insert into t1 values (1);
insert into t1 values (1);
insert into t1 values (2),(3);
-select * from t1;
+select * from t1 ORDER BY n;
n
1
2
diff --git a/mysql-test/r/rpl_slave_status.result b/mysql-test/r/rpl_slave_status.result
index 9a4ec4131b0..641a65f5ed7 100644
--- a/mysql-test/r/rpl_slave_status.result
+++ b/mysql-test/r/rpl_slave_status.result
@@ -53,3 +53,4 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master NULL
drop table t1;
+drop table t1;
diff --git a/mysql-test/r/rpl_sp.result b/mysql-test/r/rpl_sp.result
index 7f152862373..87af3cc622b 100644
--- a/mysql-test/r/rpl_sp.result
+++ b/mysql-test/r/rpl_sp.result
@@ -269,7 +269,7 @@ insert into t1 values (1);
select * from t1;
a
1
-show binlog events in 'master-bin.000001' from 98;
+show binlog events in 'master-bin.000001' from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # drop database if exists mysqltest1
master-bin.000001 # Query 1 # create database mysqltest1
diff --git a/mysql-test/r/rpl_sp004.result b/mysql-test/r/rpl_sp004.result
new file mode 100644
index 00000000000..1c0ed3cc50a
--- /dev/null
+++ b/mysql-test/r/rpl_sp004.result
@@ -0,0 +1,93 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t3;
+CREATE PROCEDURE test.p1()
+BEGIN
+CREATE TABLE IF NOT EXISTS test.t1(a INT,PRIMARY KEY(a));
+CREATE TABLE IF NOT EXISTS test.t2(a INT,PRIMARY KEY(a));
+INSERT INTO test.t1 VALUES (4),(2),(1),(3);
+UPDATE test.t1 SET a=a+4 WHERE a=4;
+INSERT INTO test.t2 (a) SELECT t1.a FROM test.t1;
+UPDATE test.t1 SET a=a+4 WHERE a=8;
+CREATE TABLE IF NOT EXISTS test.t3(n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
+END|
+CREATE PROCEDURE test.p2()
+BEGIN
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+INSERT INTO test.t3 VALUES(NULL,11111111.233333,NOW());
+END|
+CALL test.p1();
+SELECT * FROM test.t1 ORDER BY a;
+a
+1
+2
+3
+12
+SELECT * FROM test.t2 ORDER BY a;
+a
+1
+2
+3
+8
+SELECT * FROM test.t1 ORDER BY a;
+a
+1
+2
+3
+12
+SELECT * FROM test.t2 ORDER BY a;
+a
+1
+2
+3
+8
+CALL test.p2();
+USE test;
+SHOW TABLES;
+Tables_in_test
+t3
+USE test;
+SHOW TABLES;
+Tables_in_test
+t3
+CALL test.p1();
+Warnings:
+Note 1050 Table 't3' already exists
+SELECT * FROM test.t1 ORDER BY a;
+a
+1
+2
+3
+12
+SELECT * FROM test.t2 ORDER BY a;
+a
+1
+2
+3
+8
+SELECT * FROM test.t1 ORDER BY a;
+a
+1
+2
+3
+12
+SELECT * FROM test.t2 ORDER BY a;
+a
+1
+2
+3
+8
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
diff --git a/mysql-test/r/rpl_sp_effects.result b/mysql-test/r/rpl_sp_effects.result
index bf8128d9385..b42fe64e603 100644
--- a/mysql-test/r/rpl_sp_effects.result
+++ b/mysql-test/r/rpl_sp_effects.result
@@ -19,24 +19,30 @@ set spv=spv+1;
end while;
end//
call p1();
-select * from t1;
+SELECT * FROM t1 ORDER BY a;
+a
+1
+2
+3
+4
+5
+SELECT * FROM t1 ORDER BY a;
a
1
2
3
4
5
-delete from t1;
create procedure p2()
begin
declare a int default 4;
create table t2 as select a;
end//
call p2();
-select * from t2;
+SELECT * FROM t2 ORDER BY a;
a
4
-select * from t2;
+SELECT * FROM t2 ORDER BY a;
a
4
drop procedure p1;
@@ -61,58 +67,73 @@ end//
call p1(f1(1), f1(2));
yes
yes
-select * from t1;
+SELECT * FROM t1 ORDER BY a;
a
1
+1
+2
2
+3
+4
+5
5
6
7
8
create table t2(a int);
insert into t2 values (10),(11);
-select a,f1(a) from t2;
+SELECT a,f1(a) FROM t2 ORDER BY a;
a f1(a)
10 11
11 12
insert into t2 select f1(3);
-select 'master:',a from t1;
+SELECT 'master:',a FROM t1 ORDER BY a;
master: a
master: 1
+master: 1
+master: 2
master: 2
+master: 3
+master: 3
+master: 4
+master: 5
master: 5
master: 6
master: 7
master: 8
master: 10
master: 11
-master: 3
-select 'slave:',a from t1;
+SELECT 'slave:',a FROM t1 ORDER BY a;
slave: a
slave: 1
+slave: 1
+slave: 2
slave: 2
+slave: 3
+slave: 3
+slave: 4
+slave: 5
slave: 5
slave: 6
slave: 7
slave: 8
slave: 10
slave: 11
-slave: 3
drop procedure p1;
delete from t1;
delete from t2;
delete from t1;
insert into t2 values(1),(2);
-create view v1 as select f1(a) from t2;
-select * from v1;
-f1(a)
+create view v1 as select f1(a) as f from t2;
+select * from v1 order by f;
+f
2
3
-select 'master:',a from t1;
+SELECT 'master:',a FROM t1 ORDER BY a;
master: a
master: 1
master: 2
-select 'slave:',a from t1;
+SELECT 'slave:',a FROM t1 ORDER BY a;
slave: a
slave: 1
slave: 2
@@ -123,10 +144,10 @@ set @xx=123;
execute s1 using @xx;
f1(?)
124
-select 'master:',a from t1;
+SELECT 'master:',a FROM t1 ORDER BY a;
master: a
master: 123
-select 'slave:',a from t1;
+SELECT 'slave:',a FROM t1 ORDER BY a;
slave: a
slave: 123
delete from t1;
@@ -141,18 +162,18 @@ set spv= spv - 10;
end while;
end//
call p1(15);
-select 'master:',a from t1;
+SELECT 'master:',a FROM t1 ORDER BY a;
master: a
-master: 15
-master: 15
master: 6
master: 6
-select 'slave:',a from t1;
+master: 15
+master: 15
+SELECT 'slave:',a FROM t1 ORDER BY a;
slave: a
-slave: 15
-slave: 15
slave: 6
slave: 6
+slave: 15
+slave: 15
drop procedure p1;
drop function f1;
drop table t1,t2;
@@ -187,26 +208,26 @@ f1()
0
set @x=30;
call p1();
-select 'master', a from t1;
+SELECT 'master', a FROM t1 ORDER BY a;
master a
-master 20
master 10
master 11
-master 100
-master 101
+master 20
master 30
master 31
+master 100
+master 101
master 101
master 102
-select 'slave', a from t1;
+SELECT 'slave', a FROM t1 ORDER BY a;
slave a
-slave 20
slave 10
slave 11
-slave 100
-slave 101
+slave 20
slave 30
slave 31
+slave 100
+slave 101
slave 101
slave 102
drop table t1;
diff --git a/mysql-test/r/rpl_sporadic_master.result b/mysql-test/r/rpl_sporadic_master.result
index 789c3bf2b2b..14fb673a081 100644
--- a/mysql-test/r/rpl_sporadic_master.result
+++ b/mysql-test/r/rpl_sporadic_master.result
@@ -15,7 +15,7 @@ insert into t1 values (NULL),(NULL);
flush logs;
truncate table t1;
insert into t1 values (10),(NULL),(NULL),(NULL),(NULL),(NULL);
-select * from t1;
+select * from t1 ORDER BY n;
n
10
11
diff --git a/mysql-test/r/rpl000001.result b/mysql-test/r/rpl_stm_000001.result
index 3b4cd05f640..3b4cd05f640 100644
--- a/mysql-test/r/rpl000001.result
+++ b/mysql-test/r/rpl_stm_000001.result
diff --git a/mysql-test/r/rpl_EE_error.result b/mysql-test/r/rpl_stm_EE_err2.result
index f4765b4b13c..13aa45d8ced 100644
--- a/mysql-test/r/rpl_EE_error.result
+++ b/mysql-test/r/rpl_stm_EE_err2.result
@@ -4,15 +4,10 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-create table t1 (a int) engine=myisam;
-flush tables;
-drop table if exists t1;
-Warnings:
-Error 2 Can't find file: 't1' (errno: 2)
create table t1 (a int, unique(a)) engine=myisam;
set sql_log_bin=0;
insert into t1 values(2);
set sql_log_bin=1;
insert into t1 values(1),(2);
-ERROR 23000: Duplicate entry '2' for key 1
+ERROR 23000: Duplicate entry '2' for key 'a'
drop table t1;
diff --git a/mysql-test/r/rpl_charset.result b/mysql-test/r/rpl_stm_charset.result
index e3e677ad0da..12f5b636125 100644
--- a/mysql-test/r/rpl_charset.result
+++ b/mysql-test/r/rpl_stm_charset.result
@@ -103,7 +103,7 @@ a b
1 cp850_general_ci
drop database mysqltest2;
drop database mysqltest3;
-show binlog events from 98;
+show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # drop database if exists mysqltest2
master-bin.000001 # Query 1 # drop database if exists mysqltest3
diff --git a/mysql-test/r/rpl_stm_flsh_tbls.result b/mysql-test/r/rpl_stm_flsh_tbls.result
new file mode 100644
index 00000000000..a6123d75cb3
--- /dev/null
+++ b/mysql-test/r/rpl_stm_flsh_tbls.result
@@ -0,0 +1,33 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int);
+insert into t1 values (10);
+create table t2 (a int);
+create table t3 (a int) engine=merge union(t1);
+create table t4 (a int);
+insert into t4 select * from t3;
+rename table t1 to t5, t2 to t1;
+flush no_write_to_binlog tables;
+SHOW BINLOG EVENTS FROM 652 ;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1
+select * from t3;
+a
+flush tables;
+SHOW BINLOG EVENTS FROM 652 ;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1
+master-bin.000001 # Query 1 # use `test`; flush tables
+select * from t3;
+a
+stop slave;
+drop table t1;
+flush tables with read lock;
+start slave;
+stop slave;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+drop table t3, t4, t5;
diff --git a/mysql-test/r/rpl_stm_log.result b/mysql-test/r/rpl_stm_log.result
new file mode 100644
index 00000000000..e0b1aa12c9b
--- /dev/null
+++ b/mysql-test/r/rpl_stm_log.result
@@ -0,0 +1,117 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+reset master;
+reset slave;
+reset master;
+create table t1(n int not null auto_increment primary key)ENGINE=MyISAM;
+insert into t1 values (NULL);
+drop table t1;
+create table t1 (word char(20) not null)ENGINE=MyISAM;
+load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
+select count(*) from t1;
+count(*)
+69
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+master-bin.000001 # Intvar 1 # INSERT_ID=1
+master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
+master-bin.000001 # Query 1 # use `test`; drop table t1
+master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
+master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
+master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=1
+show binlog events from 102 limit 1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+show binlog events from 102 limit 2;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+master-bin.000001 # Intvar 1 # INSERT_ID=1
+show binlog events from 102 limit 2,1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
+flush logs;
+create table t3 (a int)ENGINE=MyISAM;
+start slave;
+
+let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ;
+
+--source include/wait_slave_status.inc
+flush logs;
+stop slave;
+create table t2 (n int)ENGINE=MyISAM;
+insert into t2 values (1);
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+master-bin.000001 # Intvar 1 # INSERT_ID=1
+master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
+master-bin.000001 # Query 1 # use `test`; drop table t1
+master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
+master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
+master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=1
+master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
+show binlog events in 'master-bin.000002';
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
+master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM
+master-bin.000002 # Query 1 # use `test`; insert into t2 values (1)
+show binary logs;
+Log_name File_size
+master-bin.000001 1343
+master-bin.000002 388
+start slave;
+show binary logs;
+Log_name File_size
+slave-bin.000001 1443
+slave-bin.000002 289
+show binlog events in 'slave-bin.000001' from 4;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+slave-bin.000001 # Intvar 1 # INSERT_ID=1
+slave-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
+slave-bin.000001 # Query 1 # use `test`; drop table t1
+slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
+slave-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
+slave-bin.000001 # Execute_load_query 1 # use `test`; load data INFILE '../tmp/SQL_LOAD-2-1-1.data' INTO table t1 ignore 1 lines ;file_id=1
+slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
+slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
+show binlog events in 'slave-bin.000002' from 4;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM
+slave-bin.000002 # Query 1 # use `test`; insert into t2 values (1)
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 388 # # master-bin.000002 Yes Yes # 0 0 388 # None 0 No #
+show binlog events in 'slave-bin.000005' from 4;
+ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+create table t1(a int auto_increment primary key, b int);
+insert into t1 values (NULL, 1);
+reset master;
+set insert_id=5;
+insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000001 # Intvar 2 # LAST_INSERT_ID=1
+slave-bin.000001 # Intvar 2 # INSERT_ID=5
+slave-bin.000001 # Query 2 # use `test`; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id())
+select * from t1;
+a b
+1 1
+5 1
+6 1
+drop table t1;
diff --git a/mysql-test/r/rpl_max_relay_size.result b/mysql-test/r/rpl_stm_max_relay_size.result
index 95c9ae79d05..c4a9a5bd3ff 100644
--- a/mysql-test/r/rpl_max_relay_size.result
+++ b/mysql-test/r/rpl_stm_max_relay_size.result
@@ -28,7 +28,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 72952
+Read_Master_Log_Pos 72956
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -37,13 +37,13 @@ Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
-Replicate_Ignore_Table
+Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 72952
+Exec_Master_Log_Pos 72956
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -71,7 +71,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 72952
+Read_Master_Log_Pos 72956
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -80,13 +80,13 @@ Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
-Replicate_Ignore_Table
+Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 72952
+Exec_Master_Log_Pos 72956
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -114,7 +114,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 72952
+Read_Master_Log_Pos 72956
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -123,13 +123,13 @@ Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
-Replicate_Ignore_Table
+Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 72952
+Exec_Master_Log_Pos 72956
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -163,7 +163,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
-Replicate_Ignore_Table
+Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
@@ -195,7 +195,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 73038
+Read_Master_Log_Pos 73042
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -204,13 +204,13 @@ Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
-Replicate_Ignore_Table
+Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 73038
+Exec_Master_Log_Pos 73042
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -234,7 +234,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 73114
+Read_Master_Log_Pos 73118
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -243,13 +243,13 @@ Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
-Replicate_Ignore_Table
+Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 73114
+Exec_Master_Log_Pos 73118
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -264,8 +264,8 @@ Seconds_Behind_Master #
flush logs;
show master status;
File master-bin.000002
-Position 98
-Binlog_Do_DB
+Position 102
+Binlog_Do_DB <Binlog_Ignore_DB>
Binlog_Ignore_DB
set global max_binlog_size= @my_max_binlog_size;
#
diff --git a/mysql-test/r/rpl_multi_query.result b/mysql-test/r/rpl_stm_multi_query.result
index f2d8ea77536..bf914e6ce6c 100644
--- a/mysql-test/r/rpl_multi_query.result
+++ b/mysql-test/r/rpl_stm_multi_query.result
@@ -19,7 +19,7 @@ n
3
4
5
-show binlog events from 98;
+show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # drop database if exists mysqltest
master-bin.000001 # Query 1 # create database mysqltest
diff --git a/mysql-test/r/rpl_stm_mystery22.result b/mysql-test/r/rpl_stm_mystery22.result
new file mode 100644
index 00000000000..ea34b308ec2
--- /dev/null
+++ b/mysql-test/r/rpl_stm_mystery22.result
@@ -0,0 +1,31 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1(n int auto_increment primary key, s char(10));
+insert into t1 values (2,'old');
+insert into t1 values(NULL,'new');
+insert into t1 values(NULL,'new');
+select * from t1 order by n;
+n s
+1 new
+2 old
+delete from t1 where n = 2;
+start slave;
+stop slave;
+create table t2(n int);
+drop table t2;
+insert into t1 values(NULL,'new');
+set sql_log_bin=0;
+insert into t1 values(NULL,'new');
+set sql_log_bin=1;
+delete from t1 where n=4;
+start slave;
+select * from t1 order by n;
+n s
+1 new
+2 new
+3 new
+drop table t1;
diff --git a/mysql-test/r/rpl_delete_all.result b/mysql-test/r/rpl_stm_no_op.result
index 1aa556270c9..5a253d61fcb 100644
--- a/mysql-test/r/rpl_delete_all.result
+++ b/mysql-test/r/rpl_stm_no_op.result
@@ -16,16 +16,37 @@ Warnings:
Note 1051 Unknown table 't1'
select * from t1;
ERROR 42S02: Table 'test.t1' doesn't exist
-create table t1 (a int);
-insert into t1 values(1);
+create table t1 (a int, b int);
+insert into t1 values(1,1);
delete from t1;
select * from t1;
-a
-insert into t1 values(1);
-insert into t1 values(2);
+a b
+insert into t1 values(1,1);
+insert into t1 values(2,1);
+update t1 set a=2;
+select * from t1;
+a b
+2 1
+2 1
+create table t2 (a int, b int);
+delete from t1;
+insert into t1 values(1,1);
+insert into t2 values(1,1);
update t1 set a=2;
+UPDATE t1, t2 SET t1.a = t2.a;
+select * from t1;
+a b
+1 1
+select * from t2;
+a b
+1 1
+delete from t1;
+delete from t2;
+insert into t1 values(1,1);
+insert into t2 values(1,1);
+DELETE t1.*, t2.* from t1, t2;
select * from t1;
-a
-2
-2
-drop table t1;
+a b
+select * from t2;
+a b
+drop table t1, t2;
diff --git a/mysql-test/r/rpl_reset_slave.result b/mysql-test/r/rpl_stm_reset_slave.result
index ab55423b773..834b9add089 100644
--- a/mysql-test/r/rpl_reset_slave.result
+++ b/mysql-test/r/rpl_stm_reset_slave.result
@@ -6,20 +6,20 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 98 # # master-bin.000001 Yes Yes 0 0 98 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 102 # # master-bin.000001 Yes Yes # 0 0 102 # None 0 No #
stop slave;
change master to master_user='test';
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 test MASTER_PORT 1 master-bin.000001 98 # # master-bin.000001 No No 0 0 98 # None 0 No #
+# 127.0.0.1 test MASTER_PORT 1 master-bin.000001 102 # # master-bin.000001 No No # 0 0 102 # None 0 No #
reset slave;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 4 # # No No 0 0 0 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 4 # # No No # 0 0 0 # None 0 No #
start slave;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 98 # # master-bin.000001 Yes Yes 0 0 98 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 102 # # master-bin.000001 Yes Yes # 0 0 102 # None 0 No #
stop slave;
reset slave;
start slave;
diff --git a/mysql-test/r/rpl_until.result b/mysql-test/r/rpl_stm_until.result
index 60b956785ba..e8e33b66864 100644
--- a/mysql-test/r/rpl_until.result
+++ b/mysql-test/r/rpl_stm_until.result
@@ -12,17 +12,7 @@ create table t2(n int not null auto_increment primary key);
insert into t2 values (1),(2);
insert into t2 values (3),(4);
drop table t2;
-show binlog events;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 98 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 98 Query 1 219 use `test`; create table t1(n int not null auto_increment primary key)
-master-bin.000001 219 Query 1 319 use `test`; insert into t1 values (1),(2),(3),(4)
-master-bin.000001 319 Query 1 395 use `test`; drop table t1
-master-bin.000001 395 Query 1 516 use `test`; create table t2(n int not null auto_increment primary key)
-master-bin.000001 516 Query 1 608 use `test`; insert into t2 values (1),(2)
-master-bin.000001 608 Query 1 700 use `test`; insert into t2 values (3),(4)
-master-bin.000001 700 Query 1 776 use `test`; drop table t2
-start slave until master_log_file='master-bin.000001', master_log_pos=319;
+start slave until master_log_file='master-bin.000001', master_log_pos=323;
select * from t1;
n
1
@@ -36,7 +26,7 @@ Master_User root
Master_Port MASTER_MYPORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 776
+Read_Master_Log_Pos 780
Relay_Log_File slave-relay-bin.000004
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -51,11 +41,11 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 319
+Exec_Master_Log_Pos 323
Relay_Log_Space #
Until_Condition Master
Until_Log_File master-bin.000001
-Until_Log_Pos 319
+Until_Log_Pos 323
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
@@ -77,7 +67,7 @@ Master_User root
Master_Port MASTER_MYPORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 776
+Read_Master_Log_Pos 780
Relay_Log_File slave-relay-bin.000004
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -92,7 +82,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 319
+Exec_Master_Log_Pos 323
Relay_Log_Space #
Until_Condition Master
Until_Log_File master-no-such-bin.000001
@@ -116,7 +106,7 @@ Master_User root
Master_Port MASTER_MYPORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 776
+Read_Master_Log_Pos 780
Relay_Log_File slave-relay-bin.000004
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -131,7 +121,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 608
+Exec_Master_Log_Pos 612
Relay_Log_Space #
Until_Condition Relay
Until_Log_File slave-relay-bin.000004
@@ -153,7 +143,7 @@ Master_User root
Master_Port MASTER_MYPORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 776
+Read_Master_Log_Pos 780
Relay_Log_File slave-relay-bin.000004
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -168,7 +158,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 776
+Exec_Master_Log_Pos 780
Relay_Log_Space #
Until_Condition Master
Until_Log_File master-bin.000001
diff --git a/mysql-test/r/rpl_switch_stm_row_mixed.result b/mysql-test/r/rpl_switch_stm_row_mixed.result
new file mode 100644
index 00000000000..047bfe53704
--- /dev/null
+++ b/mysql-test/r/rpl_switch_stm_row_mixed.result
@@ -0,0 +1,1005 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest1;
+create database mysqltest1;
+use mysqltest1;
+set session binlog_format=row;
+set global binlog_format=row;
+show global variables like "binlog_format%";
+Variable_name Value
+binlog_format ROW
+show session variables like "binlog_format%";
+Variable_name Value
+binlog_format ROW
+select @@global.binlog_format, @@session.binlog_format;
+@@global.binlog_format @@session.binlog_format
+ROW ROW
+CREATE TABLE t1 (a varchar(100));
+prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
+set @string="emergency_1_";
+insert into t1 values("work_2_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values(concat(UUID(),"work_3_"));
+execute stmt1 using @string;
+deallocate prepare stmt1;
+insert into t1 values(concat("for_4_",UUID()));
+insert into t1 select "yesterday_5_";
+create temporary table tmp(a char(100));
+insert into tmp values("see_6_");
+set binlog_format=statement;
+ERROR HY000: Cannot switch out of the row-based binary log format when the session has open temporary tables
+insert into t1 select * from tmp;
+drop temporary table tmp;
+set binlog_format=statement;
+show global variables like "binlog_format%";
+Variable_name Value
+binlog_format ROW
+show session variables like "binlog_format%";
+Variable_name Value
+binlog_format STATEMENT
+select @@global.binlog_format, @@session.binlog_format;
+@@global.binlog_format @@session.binlog_format
+ROW STATEMENT
+set global binlog_format=statement;
+show global variables like "binlog_format%";
+Variable_name Value
+binlog_format STATEMENT
+show session variables like "binlog_format%";
+Variable_name Value
+binlog_format STATEMENT
+select @@global.binlog_format, @@session.binlog_format;
+@@global.binlog_format @@session.binlog_format
+STATEMENT STATEMENT
+prepare stmt1 from 'insert into t1 select ?';
+set @string="emergency_7_";
+insert into t1 values("work_8_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values("work_9_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+insert into t1 values("for_10_");
+insert into t1 select "yesterday_11_";
+set binlog_format=default;
+select @@global.binlog_format, @@session.binlog_format;
+@@global.binlog_format @@session.binlog_format
+STATEMENT STATEMENT
+set global binlog_format=default;
+ERROR 42000: Variable 'binlog_format' doesn't have a default value
+select @@global.binlog_format, @@session.binlog_format;
+@@global.binlog_format @@session.binlog_format
+STATEMENT STATEMENT
+prepare stmt1 from 'insert into t1 select ?';
+set @string="emergency_12_";
+insert into t1 values("work_13_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values("work_14_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+insert into t1 values("for_15_");
+insert into t1 select "yesterday_16_";
+set binlog_format=mixed;
+select @@global.binlog_format, @@session.binlog_format;
+@@global.binlog_format @@session.binlog_format
+STATEMENT MIXED
+set global binlog_format=mixed;
+select @@global.binlog_format, @@session.binlog_format;
+@@global.binlog_format @@session.binlog_format
+MIXED MIXED
+prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
+set @string="emergency_17_";
+insert into t1 values("work_18_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values(concat(UUID(),"work_19_"));
+execute stmt1 using @string;
+deallocate prepare stmt1;
+insert into t1 values(concat("for_20_",UUID()));
+insert into t1 select "yesterday_21_";
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values(concat(UUID(),"work_22_"));
+execute stmt1 using @string;
+deallocate prepare stmt1;
+insert into t1 values(concat("for_23_",UUID()));
+insert into t1 select "yesterday_24_";
+create table t2 select rpad(UUID(),100,' ');
+create table t3 select 1 union select UUID();
+create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3);
+create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
+insert into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
+create procedure foo()
+begin
+insert into t1 values("work_25_");
+insert into t1 values(concat("for_26_",UUID()));
+insert into t1 select "yesterday_27_";
+end|
+create procedure foo2()
+begin
+insert into t1 values(concat("emergency_28_",UUID()));
+insert into t1 values("work_29_");
+insert into t1 values(concat("for_30_",UUID()));
+set session binlog_format=row; # accepted for stored procs
+insert into t1 values("more work_31_");
+set session binlog_format=mixed;
+end|
+create function foo3() returns bigint unsigned
+begin
+set session binlog_format=row; # rejected for stored funcs
+insert into t1 values("alarm");
+return 100;
+end|
+create procedure foo4(x varchar(100))
+begin
+insert into t1 values(concat("work_250_",x));
+insert into t1 select "yesterday_270_";
+end|
+call foo();
+call foo2();
+call foo4("hello");
+call foo4(UUID());
+call foo4("world");
+select foo3();
+ERROR HY000: Cannot change the binary logging format inside a stored function or trigger
+select * from t1 where a="alarm";
+a
+drop function foo3;
+create function foo3() returns bigint unsigned
+begin
+insert into t1 values("foo3_32_");
+call foo();
+return 100;
+end|
+insert into t2 select foo3();
+prepare stmt1 from 'insert into t2 select foo3()';
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+create function foo4() returns bigint unsigned
+begin
+insert into t2 select foo3();
+return 100;
+end|
+select foo4();
+foo4()
+100
+prepare stmt1 from 'select foo4()';
+execute stmt1;
+foo4()
+100
+execute stmt1;
+foo4()
+100
+deallocate prepare stmt1;
+create function foo5() returns bigint unsigned
+begin
+insert into t2 select UUID();
+return 100;
+end|
+select foo5();
+foo5()
+100
+prepare stmt1 from 'select foo5()';
+execute stmt1;
+foo5()
+100
+execute stmt1;
+foo5()
+100
+deallocate prepare stmt1;
+create function foo6(x varchar(100)) returns bigint unsigned
+begin
+insert into t2 select x;
+return 100;
+end|
+select foo6("foo6_1_");
+foo6("foo6_1_")
+100
+select foo6(concat("foo6_2_",UUID()));
+foo6(concat("foo6_2_",UUID()))
+100
+prepare stmt1 from 'select foo6(concat("foo6_3_",UUID()))';
+execute stmt1;
+foo6(concat("foo6_3_",UUID()))
+100
+execute stmt1;
+foo6(concat("foo6_3_",UUID()))
+100
+deallocate prepare stmt1;
+create view v1 as select uuid();
+create table t11 (data varchar(255));
+insert into t11 select * from v1;
+insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11');
+prepare stmt1 from "insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')";
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+create trigger t11_bi before insert on t11 for each row
+begin
+set NEW.data = concat(NEW.data,UUID());
+end|
+insert into t11 values("try_560_");
+insert delayed into t2 values("delay_1_");
+insert delayed into t2 values(concat("delay_2_",UUID()));
+insert delayed into t2 values("delay_6_");
+insert delayed into t2 values(rand());
+set @a=2.345;
+insert delayed into t2 values(@a);
+create table t20 select * from t1;
+create table t21 select * from t2;
+create table t22 select * from t3;
+drop table t1,t2,t3;
+create table t1 (a int primary key auto_increment, b varchar(100));
+create table t2 (a int primary key auto_increment, b varchar(100));
+create table t3 (b varchar(100));
+create function f (x varchar(100)) returns int deterministic
+begin
+insert into t1 values(null,x);
+insert into t2 values(null,x);
+return 1;
+end|
+select f("try_41_");
+f("try_41_")
+1
+use mysqltest1;
+insert into t2 values(2,null),(3,null),(4,null);
+delete from t2 where a>=2;
+select f("try_42_");
+f("try_42_")
+1
+insert into t2 values(3,null),(4,null);
+delete from t2 where a>=3;
+prepare stmt1 from 'select f(?)';
+set @string="try_43_";
+insert into t1 values(null,"try_44_");
+execute stmt1 using @string;
+f(?)
+1
+deallocate prepare stmt1;
+create table t12 select * from t1;
+drop table t1;
+create table t1 (a int, b varchar(100), key(a));
+select f("try_45_");
+f("try_45_")
+1
+create table t13 select * from t1;
+drop table t1;
+create table t1 (a int primary key auto_increment, b varchar(100));
+drop function f;
+create table t14 (unique (a)) select * from t2;
+truncate table t2;
+create function f1 (x varchar(100)) returns int deterministic
+begin
+insert into t1 values(null,x);
+return 1;
+end|
+create function f2 (x varchar(100)) returns int deterministic
+begin
+insert into t2 values(null,x);
+return 1;
+end|
+select f1("try_46_"),f2("try_47_");
+f1("try_46_") f2("try_47_")
+1 1
+insert into t2 values(2,null),(3,null),(4,null);
+delete from t2 where a>=2;
+select f1("try_48_"),f2("try_49_");
+f1("try_48_") f2("try_49_")
+1 1
+insert into t3 values(concat("try_50_",f1("try_51_"),f2("try_52_")));
+drop function f2;
+create function f2 (x varchar(100)) returns int deterministic
+begin
+declare y int;
+insert into t1 values(null,x);
+set y = (select count(*) from t2);
+return y;
+end|
+select f1("try_53_"),f2("try_54_");
+f1("try_53_") f2("try_54_")
+1 3
+drop function f2;
+create trigger t1_bi before insert on t1 for each row
+begin
+insert into t2 values(null,"try_55_");
+end|
+insert into t1 values(null,"try_56_");
+alter table t1 modify a int, drop primary key;
+insert into t1 values(null,"try_57_");
+CREATE TEMPORARY TABLE t15 SELECT UUID();
+create table t16 like t15;
+INSERT INTO t16 SELECT * FROM t15;
+insert into t16 values("try_65_");
+drop table t15;
+insert into t16 values("try_66_");
+select count(*) from t1;
+count(*)
+7
+select count(*) from t2;
+count(*)
+5
+select count(*) from t3;
+count(*)
+1
+select count(*) from t4;
+count(*)
+29
+select count(*) from t5;
+count(*)
+58
+select count(*) from t11;
+count(*)
+8
+select count(*) from t20;
+count(*)
+66
+select count(*) from t21;
+count(*)
+19
+select count(*) from t22;
+count(*)
+2
+select count(*) from t12;
+count(*)
+4
+select count(*) from t13;
+count(*)
+1
+select count(*) from t14;
+count(*)
+4
+select count(*) from t16;
+count(*)
+3
+DROP TABLE IF EXISTS t11;
+SET SESSION BINLOG_FORMAT=STATEMENT;
+CREATE TABLE t11 (song VARCHAR(255));
+LOCK TABLES t11 WRITE;
+SET SESSION BINLOG_FORMAT=ROW;
+INSERT INTO t11 VALUES('Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict');
+SET SESSION BINLOG_FORMAT=STATEMENT;
+INSERT INTO t11 VALUES('Careful With That Axe, Eugene');
+UNLOCK TABLES;
+SELECT * FROM t11;
+song Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict
+song Careful With That Axe, Eugene
+USE mysqltest1;
+SELECT * FROM t11;
+song Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict
+song Careful With That Axe, Eugene
+DROP TABLE IF EXISTS t12;
+SET SESSION BINLOG_FORMAT=MIXED;
+CREATE TABLE t12 (data LONG);
+LOCK TABLES t12 WRITE;
+INSERT INTO t12 VALUES(UUID());
+UNLOCK TABLES;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # drop database if exists mysqltest1
+master-bin.000001 # Query 1 # create database mysqltest1
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE t1 (a varchar(100))
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_8_")
+master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F375F COLLATE latin1_swedish_ci
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_9_")
+master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F375F COLLATE latin1_swedish_ci
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("for_10_")
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_11_"
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_13_")
+master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F31325F COLLATE latin1_swedish_ci
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_14_")
+master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F31325F COLLATE latin1_swedish_ci
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("for_15_")
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_16_"
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_18_")
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F31375F COLLATE latin1_swedish_ci
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_21_"
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F31375F COLLATE latin1_swedish_ci
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_24_"
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t2` (
+ `rpad(UUID(),100,' ')` varchar(100) CHARACTER SET utf8 NOT NULL DEFAULT ''
+)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t3` (
+ `1` varbinary(36) NOT NULL DEFAULT ''
+)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t3)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t4` (
+ `a` varchar(100) DEFAULT NULL
+)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t4)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t5)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo()
+begin
+insert into t1 values("work_25_");
+insert into t1 values(concat("for_26_",UUID()));
+insert into t1 select "yesterday_27_";
+end
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo2()
+begin
+insert into t1 values(concat("emergency_28_",UUID()));
+insert into t1 values("work_29_");
+insert into t1 values(concat("for_30_",UUID()));
+set session binlog_format=row; # accepted for stored procs
+insert into t1 values("more work_31_");
+set session binlog_format=mixed;
+end
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo3() returns bigint unsigned
+begin
+set session binlog_format=row; # rejected for stored funcs
+insert into t1 values("alarm");
+return 100;
+end
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo4(x varchar(100))
+begin
+insert into t1 values(concat("work_250_",x));
+insert into t1 select "yesterday_270_";
+end
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(concat("work_250_", NAME_CONST('x',_latin1'hello')))
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_270_"
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(concat("work_250_", NAME_CONST('x',_latin1'world')))
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_270_"
+master-bin.000001 # Query 1 # use `mysqltest1`; drop function foo3
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo3() returns bigint unsigned
+begin
+insert into t1 values("foo3_32_");
+call foo();
+return 100;
+end
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo4() returns bigint unsigned
+begin
+insert into t2 select foo3();
+return 100;
+end
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo5() returns bigint unsigned
+begin
+insert into t2 select UUID();
+return 100;
+end
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo6(x varchar(100)) returns bigint unsigned
+begin
+insert into t2 select x;
+return 100;
+end
+master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `foo6`(_latin1'foo6_1_')
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select uuid()
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t11 (data varchar(255))
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t11)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger t11_bi before insert on t11 for each row
+begin
+set NEW.data = concat(NEW.data,UUID());
+end
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t11)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t20 select * from t1
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t21 select * from t2
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t22 select * from t3
+master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1,t2,t3
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100))
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t2 (a int primary key auto_increment, b varchar(100))
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t3 (b varchar(100))
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f (x varchar(100)) returns int deterministic
+begin
+insert into t1 values(null,x);
+insert into t2 values(null,x);
+return 1;
+end
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Intvar 1 # INSERT_ID=3
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(null,"try_44_")
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t12 select * from t1
+master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int, b varchar(100), key(a))
+master-bin.000001 # Intvar 1 # INSERT_ID=4
+master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `f`(_latin1'try_45_')
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t13 select * from t1
+master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100))
+master-bin.000001 # Query 1 # use `mysqltest1`; drop function f
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t14 (unique (a)) select * from t2
+master-bin.000001 # Query 1 # use `mysqltest1`; truncate table t2
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f1 (x varchar(100)) returns int deterministic
+begin
+insert into t1 values(null,x);
+return 1;
+end
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f2 (x varchar(100)) returns int deterministic
+begin
+insert into t2 values(null,x);
+return 1;
+end
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t3)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; drop function f2
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f2 (x varchar(100)) returns int deterministic
+begin
+declare y int;
+insert into t1 values(null,x);
+set y = (select count(*) from t2);
+return y;
+end
+master-bin.000001 # Intvar 1 # INSERT_ID=4
+master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `f1`(_latin1'try_53_')
+master-bin.000001 # Intvar 1 # INSERT_ID=5
+master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `f2`(_latin1'try_54_')
+master-bin.000001 # Query 1 # use `mysqltest1`; drop function f2
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger t1_bi before insert on t1 for each row
+begin
+insert into t2 values(null,"try_55_");
+end
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; alter table t1 modify a int, drop primary key
+master-bin.000001 # Intvar 1 # INSERT_ID=5
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(null,"try_57_")
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t16` (
+ `UUID()` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT ''
+)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t16)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t16)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t16 values("try_66_")
+master-bin.000001 # Query 1 # use `mysqltest1`; DROP TABLE IF EXISTS t11
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE t11 (song VARCHAR(255))
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t11)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; INSERT INTO t11 VALUES('Careful With That Axe, Eugene')
+master-bin.000001 # Query 1 # use `mysqltest1`; DROP TABLE IF EXISTS t12
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE t12 (data LONG)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t12)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # drop database if exists mysqltest1
+master-bin.000001 # Query 1 # create database mysqltest1
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE t1 (a varchar(100))
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_8_")
+master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F375F COLLATE latin1_swedish_ci
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_9_")
+master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F375F COLLATE latin1_swedish_ci
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("for_10_")
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_11_"
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_13_")
+master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F31325F COLLATE latin1_swedish_ci
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_14_")
+master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F31325F COLLATE latin1_swedish_ci
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("for_15_")
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_16_"
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_18_")
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F31375F COLLATE latin1_swedish_ci
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_21_"
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F31375F COLLATE latin1_swedish_ci
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string'
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_24_"
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t2` (
+ `rpad(UUID(),100,' ')` varchar(100) CHARACTER SET utf8 NOT NULL DEFAULT ''
+)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t3` (
+ `1` varbinary(36) NOT NULL DEFAULT ''
+)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t3)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t4` (
+ `a` varchar(100) DEFAULT NULL
+)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t4)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t5)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo()
+begin
+insert into t1 values("work_25_");
+insert into t1 values(concat("for_26_",UUID()));
+insert into t1 select "yesterday_27_";
+end
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo2()
+begin
+insert into t1 values(concat("emergency_28_",UUID()));
+insert into t1 values("work_29_");
+insert into t1 values(concat("for_30_",UUID()));
+set session binlog_format=row; # accepted for stored procs
+insert into t1 values("more work_31_");
+set session binlog_format=mixed;
+end
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo3() returns bigint unsigned
+begin
+set session binlog_format=row; # rejected for stored funcs
+insert into t1 values("alarm");
+return 100;
+end
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo4(x varchar(100))
+begin
+insert into t1 values(concat("work_250_",x));
+insert into t1 select "yesterday_270_";
+end
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(concat("work_250_", NAME_CONST('x',_latin1'hello')))
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_270_"
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(concat("work_250_", NAME_CONST('x',_latin1'world')))
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_270_"
+master-bin.000001 # Query 1 # use `mysqltest1`; drop function foo3
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo3() returns bigint unsigned
+begin
+insert into t1 values("foo3_32_");
+call foo();
+return 100;
+end
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo4() returns bigint unsigned
+begin
+insert into t2 select foo3();
+return 100;
+end
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo5() returns bigint unsigned
+begin
+insert into t2 select UUID();
+return 100;
+end
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo6(x varchar(100)) returns bigint unsigned
+begin
+insert into t2 select x;
+return 100;
+end
+master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `foo6`(_latin1'foo6_1_')
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select uuid()
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t11 (data varchar(255))
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t11)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger t11_bi before insert on t11 for each row
+begin
+set NEW.data = concat(NEW.data,UUID());
+end
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t11)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t20 select * from t1
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t21 select * from t2
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t22 select * from t3
+master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1,t2,t3
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100))
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t2 (a int primary key auto_increment, b varchar(100))
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t3 (b varchar(100))
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f (x varchar(100)) returns int deterministic
+begin
+insert into t1 values(null,x);
+insert into t2 values(null,x);
+return 1;
+end
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Intvar 1 # INSERT_ID=3
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(null,"try_44_")
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t12 select * from t1
+master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int, b varchar(100), key(a))
+master-bin.000001 # Intvar 1 # INSERT_ID=4
+master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `f`(_latin1'try_45_')
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t13 select * from t1
+master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100))
+master-bin.000001 # Query 1 # use `mysqltest1`; drop function f
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t14 (unique (a)) select * from t2
+master-bin.000001 # Query 1 # use `mysqltest1`; truncate table t2
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f1 (x varchar(100)) returns int deterministic
+begin
+insert into t1 values(null,x);
+return 1;
+end
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f2 (x varchar(100)) returns int deterministic
+begin
+insert into t2 values(null,x);
+return 1;
+end
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t3)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; drop function f2
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f2 (x varchar(100)) returns int deterministic
+begin
+declare y int;
+insert into t1 values(null,x);
+set y = (select count(*) from t2);
+return y;
+end
+master-bin.000001 # Intvar 1 # INSERT_ID=4
+master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `f1`(_latin1'try_53_')
+master-bin.000001 # Intvar 1 # INSERT_ID=5
+master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `f2`(_latin1'try_54_')
+master-bin.000001 # Query 1 # use `mysqltest1`; drop function f2
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger t1_bi before insert on t1 for each row
+begin
+insert into t2 values(null,"try_55_");
+end
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; alter table t1 modify a int, drop primary key
+master-bin.000001 # Intvar 1 # INSERT_ID=5
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(null,"try_57_")
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t16` (
+ `UUID()` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT ''
+)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t16)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t16)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t16 values("try_66_")
+master-bin.000001 # Query 1 # use `mysqltest1`; DROP TABLE IF EXISTS t11
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE t11 (song VARCHAR(255))
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t11)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `mysqltest1`; INSERT INTO t11 VALUES('Careful With That Axe, Eugene')
+master-bin.000001 # Query 1 # use `mysqltest1`; DROP TABLE IF EXISTS t12
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE t12 (data LONG)
+master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t12)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+drop database mysqltest1;
diff --git a/mysql-test/r/rpl000012.result b/mysql-test/r/rpl_temp_table.result
index 17fb53010ab..e4ca31d8908 100644
--- a/mysql-test/r/rpl000012.result
+++ b/mysql-test/r/rpl_temp_table.result
@@ -4,31 +4,42 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-create table t2 (n int);
+create table t2 (n int, PRIMARY KEY(n));
create temporary table t1 (n int);
-insert into t1 values(1),(2),(3);
-insert into t2 select * from t1;
create temporary table t3 (n int not null);
+insert into t1 values(1),(2),(3),(100),(25),(26),(200),(300);
+insert into t2 select * from t1;
alter table t3 add primary key(n);
flush logs;
-insert into t3 values (100);
+insert into t3 values (1010);
insert into t2 select * from t3;
drop table if exists t3;
-insert into t2 values (101);
+insert into t2 values (1012);
create temporary table t1 (n int);
insert into t1 values (4),(5);
insert into t2 select * from t1;
-insert into t2 values(6);
+insert into t2 values(61);
select * from t2;
n
1
2
3
-100
-101
4
5
-6
+25
+26
+61
+100
+200
+300
+1010
+1012
+select count(*) from t2;
+count(*)
+13
+select sum(n) from t2;
+sum(n)
+2749
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0
diff --git a/mysql-test/r/rpl_temporary.result b/mysql-test/r/rpl_temporary.result
index 751dc7754f7..7e7d0cebe1d 100644
--- a/mysql-test/r/rpl_temporary.result
+++ b/mysql-test/r/rpl_temporary.result
@@ -32,25 +32,10 @@ insert into t3 select * from t1 where f>=4;
drop temporary table t3;
insert into t2 select count(*) from t3;
drop temporary table t3;
-select * from t2;
+select * from t2 ORDER BY f;
f
5
7
-show binlog events;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
-master-bin.000001 # Query 1 # use `test`; drop table if exists t1,t2
-master-bin.000001 # Query 1 # use `test`; create table t1(f int)
-master-bin.000001 # Query 1 # use `test`; create table t2(f int)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10)
-master-bin.000001 # Query 1 # use `test`; create temporary table t3(f int)
-master-bin.000001 # Query 1 # use `test`; insert into t3 select * from t1 where f<6
-master-bin.000001 # Query 1 # use `test`; create temporary table t3(f int)
-master-bin.000001 # Query 1 # use `test`; insert into t2 select count(*) from t3
-master-bin.000001 # Query 1 # use `test`; insert into t3 select * from t1 where f>=4
-master-bin.000001 # Query 1 # use `test`; drop temporary table t3
-master-bin.000001 # Query 1 # use `test`; insert into t2 select count(*) from t3
-master-bin.000001 # Query 1 # use `test`; drop temporary table t3
drop table t1, t2;
use test;
SET TIMESTAMP=1040323920;
@@ -83,7 +68,7 @@ insert into t2 select count(*) from t3;
SET TIMESTAMP=1040324224;
SET @@session.pseudo_thread_id=2;
drop temporary table t3;
-select * from t2;
+select * from t2 ORDER BY f;
f
5
7
@@ -91,16 +76,11 @@ drop table t1,t2;
create temporary table t3 (f int);
create temporary table t4 (f int);
create table t5 (f int);
-drop table if exists t999;
-create temporary table t999 (f int);
-LOAD DATA INFILE "./tmp/bl_dump_thread_id" into table t999;
-drop table t999;
-insert into t4 values (1);
-kill `select id from information_schema.processlist where command='Binlog Dump'`;
+select id from information_schema.processlist where command='Binlog Dump' into @id;
+kill @id;
insert into t5 select * from t4;
select * from t5 /* must be 1 after reconnection */;
f
-1
drop temporary table t4;
drop table t5;
set @@session.pseudo_thread_id=100;
diff --git a/mysql-test/r/rpl_timezone.result b/mysql-test/r/rpl_timezone.result
index fde8709843e..47ef16b9d49 100644
--- a/mysql-test/r/rpl_timezone.result
+++ b/mysql-test/r/rpl_timezone.result
@@ -6,125 +6,102 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
set @my_time_zone= @@global.time_zone;
set timestamp=100000000;
-create table t1 (t timestamp);
-create table t2 (t char(32));
+create table t1 (t timestamp, n int not null auto_increment, PRIMARY KEY(n));
+create table t2 (t char(32), n int not null auto_increment, PRIMARY KEY(n));
select @@time_zone;
@@time_zone
Japan
select @@time_zone;
@@time_zone
Europe/Moscow
-insert into t1 values ('20050101000000'), ('20050611093902');
-set time_zone='UTC';
-insert into t1 values ('20040101000000'), ('20040611093902');
-select * from t1;
-t
-2004-12-31 21:00:00
-2005-06-11 05:39:02
-2004-01-01 00:00:00
-2004-06-11 09:39:02
-set time_zone='UTC';
-select * from t1;
-t
-2004-12-31 21:00:00
-2005-06-11 05:39:02
-2004-01-01 00:00:00
-2004-06-11 09:39:02
+insert into t1 values ('20050101000000', NULL), ('20050611093902',NULL);
+insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
+SELECT * FROM t1 ORDER BY n;
+t n
+2005-01-01 00:00:00 1
+2005-06-11 09:39:02 2
+2004-01-01 00:00:00 3
+2004-06-11 09:39:02 4
+SELECT * FROM t1 ORDER BY n;
+t n
+2005-01-01 06:00:00 1
+2005-06-11 14:39:02 2
+2004-01-01 06:00:00 3
+2004-06-11 14:39:02 4
delete from t1;
set time_zone='Europe/Moscow';
-insert into t1 values ('20040101000000'), ('20040611093902');
-select * from t1;
-t
-2004-01-01 00:00:00
-2004-06-11 09:39:02
+insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
+SELECT * FROM t1 ORDER BY n;
+t n
+2004-01-01 00:00:00 5
+2004-06-11 09:39:02 6
set time_zone='Europe/Moscow';
-select * from t1;
-t
-2004-01-01 00:00:00
-2004-06-11 09:39:02
-/*!40019 SET @@session.max_insert_delayed_threads=0*/;
-/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
-ROLLBACK;
-use test;
-SET TIMESTAMP=100000000;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
-SET @@session.sql_mode=0;
-/*!\C latin1 */;
-SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
-create table t1 (t timestamp);
-SET TIMESTAMP=100000000;
-create table t2 (t char(32));
-SET TIMESTAMP=100000000;
-SET @@session.time_zone='Europe/Moscow';
-insert into t1 values ('20050101000000'), ('20050611093902');
-SET TIMESTAMP=100000000;
-SET @@session.time_zone='UTC';
-insert into t1 values ('20040101000000'), ('20040611093902');
-SET TIMESTAMP=100000000;
-delete from t1;
-SET TIMESTAMP=100000000;
-SET @@session.time_zone='Europe/Moscow';
-insert into t1 values ('20040101000000'), ('20040611093902');
-# End of log file
-ROLLBACK /* added by mysqlbinlog */;
-/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+SELECT * FROM t1 ORDER BY n;
+t n
+2004-01-01 00:00:00 5
+2004-06-11 09:39:02 6
delete from t1;
set time_zone='UTC';
-load data infile '../std_data_ln/rpl_timezone.dat' into table t1;
-select * from t1;
-t
-2004-01-01 00:00:00
-2004-06-11 09:39:02
+load data infile '../std_data_ln/rpl_timezone2.dat' into table t1;
+Warnings:
+Warning 1265 Data truncated for column 't' at row 1
+Warning 1261 Row 1 doesn't contain data for all columns
+Warning 1265 Data truncated for column 't' at row 2
+Warning 1261 Row 2 doesn't contain data for all columns
+SELECT * FROM t1 ORDER BY n;
+t n
+0000-00-00 00:00:00 7
+0000-00-00 00:00:00 8
set time_zone='UTC';
-select * from t1;
-t
-2004-01-01 00:00:00
-2004-06-11 09:39:02
+SELECT * FROM t1 ORDER BY n;
+t n
+0000-00-00 00:00:00 7
+0000-00-00 00:00:00 8
set time_zone='Europe/Moscow';
set time_zone='Europe/Moscow';
delete from t1;
-insert into t1 values ('20040101000000'), ('20040611093902');
+insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
set time_zone='MET';
-insert into t2 (select t from t1);
-select * from t1;
-t
-2003-12-31 22:00:00
-2004-06-11 07:39:02
-select * from t2;
-t
-2003-12-31 22:00:00
-2004-06-11 07:39:02
+insert into t2 (select * from t1);
+SELECT * FROM t1 ORDER BY n;
+t n
+2003-12-31 22:00:00 9
+2004-06-11 07:39:02 10
+SELECT * FROM t2 ORDER BY n;
+t n
+2003-12-31 22:00:00 9
+2004-06-11 07:39:02 10
delete from t2;
set timestamp=1000072000;
-insert into t2 values (current_timestamp), (current_date), (current_time);
-select * from t2;
-t
-2001-09-09 23:46:40
-2001-09-09
-23:46:40
+insert into t2 values (current_timestamp,NULL), (current_date,NULL), (current_time,NULL);
+SELECT * FROM t2 ORDER BY n;
+t n
+2001-09-09 23:46:40 11
+2001-09-09 12
+23:46:40 13
delete from t2;
-insert into t2 values (from_unixtime(1000000000)),
-(unix_timestamp('2001-09-09 03:46:40'));
-select * from t2;
-t
-2001-09-09 03:46:40
-1000000000
-select * from t2;
-t
-2001-09-09 03:46:40
-1000000000
+insert into t2 values (from_unixtime(1000000000),NULL),
+(unix_timestamp('2001-09-09 03:46:40'),NULL);
+SELECT * FROM t2 ORDER BY n;
+t n
+2001-09-09 03:46:40 14
+1000000000 15
+SELECT * FROM t2 ORDER BY n;
+t n
+2001-09-09 03:46:40 14
+1000000000 15
set global time_zone='MET';
delete from t2;
set time_zone='UTC';
-insert into t2 values(convert_tz('2004-01-01 00:00:00','MET',@@time_zone));
-insert into t2 values(convert_tz('2005-01-01 00:00:00','MET','Japan'));
-select * from t2;
-t
-2003-12-31 23:00:00
-2005-01-01 08:00:00
-select * from t2;
-t
-2003-12-31 23:00:00
-2005-01-01 08:00:00
+insert into t2 values(convert_tz('2004-01-01 00:00:00','MET',@@time_zone),NULL);
+insert into t2 values(convert_tz('2005-01-01 00:00:00','MET','Japan'),NULL);
+SELECT * FROM t2 ORDER BY n;
+t n
+2003-12-31 23:00:00 16
+2005-01-01 08:00:00 17
+SELECT * FROM t2 ORDER BY n;
+t n
+2003-12-31 23:00:00 16
+2005-01-01 08:00:00 17
drop table t1, t2;
set global time_zone= @my_time_zone;
diff --git a/mysql-test/r/rpl_trigger.result b/mysql-test/r/rpl_trigger.result
index 3c740bf8e64..50bcd071d23 100644
--- a/mysql-test/r/rpl_trigger.result
+++ b/mysql-test/r/rpl_trigger.result
@@ -4,6 +4,9 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP TABLE IF EXISTS t3;
create table t1 (a int auto_increment, primary key (a), b int, rand_value double not null);
create table t2 (a int auto_increment, primary key (a), b int);
create table t3 (a int auto_increment, primary key (a), name varchar(64) not null, old_a int, old_b int, rand_value double not null);
diff --git a/mysql-test/r/rpl_truncate_2myisam.result b/mysql-test/r/rpl_truncate_2myisam.result
new file mode 100644
index 00000000000..41640a709b9
--- /dev/null
+++ b/mysql-test/r/rpl_truncate_2myisam.result
@@ -0,0 +1,202 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** On Master ****
+SET SESSION BINLOG_FORMAT=STATEMENT;
+SET GLOBAL BINLOG_FORMAT=STATEMENT;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 210 Query 1 307 use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 307 Query 1 387 use `test`; TRUNCATE TABLE t1
+master-bin.000001 387 Query 1 463 use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=MIXED;
+SET GLOBAL BINLOG_FORMAT=MIXED;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 210 Query 1 307 use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 307 Query 1 387 use `test`; TRUNCATE TABLE t1
+master-bin.000001 387 Query 1 463 use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=ROW;
+SET GLOBAL BINLOG_FORMAT=ROW;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 210 Table_map 1 250 table_id: # (test.t1)
+master-bin.000001 250 Write_rows 1 297 table_id: # flags: STMT_END_F
+master-bin.000001 297 Query 1 377 use `test`; TRUNCATE TABLE t1
+master-bin.000001 377 Query 1 453 use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=STATEMENT;
+SET GLOBAL BINLOG_FORMAT=STATEMENT;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 210 Query 1 307 use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 307 Query 1 384 use `test`; DELETE FROM t1
+master-bin.000001 384 Query 1 460 use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=MIXED;
+SET GLOBAL BINLOG_FORMAT=MIXED;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 210 Query 1 307 use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 307 Query 1 384 use `test`; DELETE FROM t1
+master-bin.000001 384 Query 1 460 use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=ROW;
+SET GLOBAL BINLOG_FORMAT=ROW;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+3 3
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 210 Table_map 1 250 table_id: # (test.t1)
+master-bin.000001 250 Write_rows 1 297 table_id: # flags: STMT_END_F
+master-bin.000001 297 Table_map 1 337 table_id: # (test.t1)
+master-bin.000001 337 Delete_rows 1 384 table_id: # flags: STMT_END_F
+master-bin.000001 384 Query 1 460 use `test`; DROP TABLE t1
diff --git a/mysql-test/r/rpl_truncate_3innodb.result b/mysql-test/r/rpl_truncate_3innodb.result
new file mode 100644
index 00000000000..062c9704ae0
--- /dev/null
+++ b/mysql-test/r/rpl_truncate_3innodb.result
@@ -0,0 +1,214 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** On Master ****
+SET SESSION BINLOG_FORMAT=STATEMENT;
+SET GLOBAL BINLOG_FORMAT=STATEMENT;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 210 Query 1 97 use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 307 Xid 1 334 COMMIT /* xid= */
+master-bin.000001 334 Query 1 80 use `test`; TRUNCATE TABLE t1
+master-bin.000001 414 Xid 1 441 COMMIT /* xid= */
+master-bin.000001 441 Query 1 517 use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=MIXED;
+SET GLOBAL BINLOG_FORMAT=MIXED;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 210 Query 1 97 use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 307 Xid 1 334 COMMIT /* xid= */
+master-bin.000001 334 Query 1 80 use `test`; TRUNCATE TABLE t1
+master-bin.000001 414 Xid 1 441 COMMIT /* xid= */
+master-bin.000001 441 Query 1 517 use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=ROW;
+SET GLOBAL BINLOG_FORMAT=ROW;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 210 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 250 Write_rows 1 87 table_id: # flags: STMT_END_F
+master-bin.000001 297 Xid 1 324 COMMIT /* xid= */
+master-bin.000001 324 Query 1 80 use `test`; TRUNCATE TABLE t1
+master-bin.000001 404 Xid 1 431 COMMIT /* xid= */
+master-bin.000001 431 Query 1 507 use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=STATEMENT;
+SET GLOBAL BINLOG_FORMAT=STATEMENT;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 210 Query 1 97 use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 307 Xid 1 334 COMMIT /* xid= */
+master-bin.000001 334 Query 1 77 use `test`; DELETE FROM t1
+master-bin.000001 411 Xid 1 438 COMMIT /* xid= */
+master-bin.000001 438 Query 1 514 use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=MIXED;
+SET GLOBAL BINLOG_FORMAT=MIXED;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 210 Query 1 97 use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 307 Xid 1 334 COMMIT /* xid= */
+master-bin.000001 334 Query 1 77 use `test`; DELETE FROM t1
+master-bin.000001 411 Xid 1 438 COMMIT /* xid= */
+master-bin.000001 438 Query 1 514 use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=ROW;
+SET GLOBAL BINLOG_FORMAT=ROW;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+3 3
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 210 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 250 Write_rows 1 87 table_id: # flags: STMT_END_F
+master-bin.000001 297 Xid 1 324 COMMIT /* xid= */
+master-bin.000001 324 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 364 Delete_rows 1 87 table_id: # flags: STMT_END_F
+master-bin.000001 411 Xid 1 438 COMMIT /* xid= */
+master-bin.000001 438 Query 1 514 use `test`; DROP TABLE t1
diff --git a/mysql-test/r/rpl_truncate_7ndb.result b/mysql-test/r/rpl_truncate_7ndb.result
new file mode 100644
index 00000000000..0e1b21d31aa
--- /dev/null
+++ b/mysql-test/r/rpl_truncate_7ndb.result
@@ -0,0 +1,91 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** On Master ****
+CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1 ORDER BY a,b;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1 ORDER BY a,b;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1 ORDER BY a,b;
+a b
+**** On Slave ****
+SELECT * FROM t1 ORDER BY a,b;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 219 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 219 Query 1 283 BEGIN
+master-bin.000001 283 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 323 Table_map 1 93 table_id: # (cluster.apply_status)
+master-bin.000001 376 Write_rows 1 135 table_id: #
+master-bin.000001 418 Write_rows 1 182 table_id: # flags: STMT_END_F
+master-bin.000001 465 Query 1 530 COMMIT
+master-bin.000001 530 Query 1 610 use `test`; TRUNCATE TABLE t1
+master-bin.000001 610 Query 1 686 use `test`; DROP TABLE t1
+**** On Master ****
+CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1 ORDER BY a,b;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1 ORDER BY a,b;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1 ORDER BY a,b;
+a b
+**** On Slave ****
+SELECT * FROM t1 ORDER BY a,b;
+a b
+3 3
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 219 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 219 Query 1 283 BEGIN
+master-bin.000001 283 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 323 Table_map 1 93 table_id: # (cluster.apply_status)
+master-bin.000001 376 Write_rows 1 135 table_id: #
+master-bin.000001 418 Write_rows 1 182 table_id: # flags: STMT_END_F
+master-bin.000001 465 Query 1 530 COMMIT
+master-bin.000001 530 Query 1 610 use `test`; TRUNCATE TABLE t1
+master-bin.000001 610 Query 1 686 use `test`; DROP TABLE t1
+master-bin.000001 686 Query 1 803 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 803 Query 1 867 BEGIN
+master-bin.000001 867 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 907 Table_map 1 93 table_id: # (cluster.apply_status)
+master-bin.000001 960 Write_rows 1 135 table_id: #
+master-bin.000001 1002 Write_rows 1 182 table_id: # flags: STMT_END_F
+master-bin.000001 1049 Query 1 1114 COMMIT
+master-bin.000001 1114 Query 1 1178 BEGIN
+master-bin.000001 1178 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 1218 Table_map 1 93 table_id: # (cluster.apply_status)
+master-bin.000001 1271 Write_rows 1 135 table_id: #
+master-bin.000001 1313 Delete_rows 1 174 table_id: # flags: STMT_END_F
+master-bin.000001 1352 Query 1 1417 COMMIT
+master-bin.000001 1417 Query 1 1493 use `test`; DROP TABLE t1
diff --git a/mysql-test/r/rpl_truncate_7ndb_2.result b/mysql-test/r/rpl_truncate_7ndb_2.result
new file mode 100644
index 00000000000..0e1b21d31aa
--- /dev/null
+++ b/mysql-test/r/rpl_truncate_7ndb_2.result
@@ -0,0 +1,91 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** On Master ****
+CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1 ORDER BY a,b;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1 ORDER BY a,b;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1 ORDER BY a,b;
+a b
+**** On Slave ****
+SELECT * FROM t1 ORDER BY a,b;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 219 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 219 Query 1 283 BEGIN
+master-bin.000001 283 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 323 Table_map 1 93 table_id: # (cluster.apply_status)
+master-bin.000001 376 Write_rows 1 135 table_id: #
+master-bin.000001 418 Write_rows 1 182 table_id: # flags: STMT_END_F
+master-bin.000001 465 Query 1 530 COMMIT
+master-bin.000001 530 Query 1 610 use `test`; TRUNCATE TABLE t1
+master-bin.000001 610 Query 1 686 use `test`; DROP TABLE t1
+**** On Master ****
+CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1 ORDER BY a,b;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1 ORDER BY a,b;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1 ORDER BY a,b;
+a b
+**** On Slave ****
+SELECT * FROM t1 ORDER BY a,b;
+a b
+3 3
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 219 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 219 Query 1 283 BEGIN
+master-bin.000001 283 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 323 Table_map 1 93 table_id: # (cluster.apply_status)
+master-bin.000001 376 Write_rows 1 135 table_id: #
+master-bin.000001 418 Write_rows 1 182 table_id: # flags: STMT_END_F
+master-bin.000001 465 Query 1 530 COMMIT
+master-bin.000001 530 Query 1 610 use `test`; TRUNCATE TABLE t1
+master-bin.000001 610 Query 1 686 use `test`; DROP TABLE t1
+master-bin.000001 686 Query 1 803 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 803 Query 1 867 BEGIN
+master-bin.000001 867 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 907 Table_map 1 93 table_id: # (cluster.apply_status)
+master-bin.000001 960 Write_rows 1 135 table_id: #
+master-bin.000001 1002 Write_rows 1 182 table_id: # flags: STMT_END_F
+master-bin.000001 1049 Query 1 1114 COMMIT
+master-bin.000001 1114 Query 1 1178 BEGIN
+master-bin.000001 1178 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 1218 Table_map 1 93 table_id: # (cluster.apply_status)
+master-bin.000001 1271 Write_rows 1 135 table_id: #
+master-bin.000001 1313 Delete_rows 1 174 table_id: # flags: STMT_END_F
+master-bin.000001 1352 Query 1 1417 COMMIT
+master-bin.000001 1417 Query 1 1493 use `test`; DROP TABLE t1
diff --git a/mysql-test/r/rpl_user_variables.result b/mysql-test/r/rpl_user_variables.result
index 45618688a33..ed0d2782394 100644
--- a/mysql-test/r/rpl_user_variables.result
+++ b/mysql-test/r/rpl_user_variables.result
@@ -21,91 +21,63 @@ set @q:='abc';
insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'));
set @a:=5;
insert into t1 values (@a),(@a);
+select * from t1 where n = '<nonexistant>';
+n
insert into t1 values (@a),(@a),(@a*5);
-select * from t1;
+SELECT * FROM t1 ORDER BY n;
n
-12345678901234
--12345678901234
-0
--1
-12.5
--12.5
-This is a test
-
-abc'def
-abc\def
-abc'def
NULL
NULL
+NULL
+NULL
+NULL
+
+-1
+-12.5
+-12345678901234
+0
0
1
+12.5
+12345678901234
2
5
+5
+5
abc
+abc'def
+abc'def
abcn1
abcn1n2
-5
-5
+abc\def
+This is a test
+SELECT * FROM t1 ORDER BY n;
+n
NULL
NULL
NULL
-select * from t1;
-n
-12345678901234
--12345678901234
-0
--1
-12.5
--12.5
-This is a test
-
-abc'def
-abc\def
-abc'def
NULL
NULL
+
+-1
+-12.5
+-12345678901234
+0
0
1
+12.5
+12345678901234
2
5
+5
+5
abc
+abc'def
+abc'def
abcn1
abcn1n2
-5
-5
-NULL
-NULL
-NULL
-show binlog events from 98;
-Log_name Pos Event_type Server_id End_log_pos Info
-slave-bin.000001 # Query 1 # use `test`; create table t1(n char(30))
-slave-bin.000001 # User var 2 # @`i1`=12345678901234
-slave-bin.000001 # User var 2 # @`i2`=-12345678901234
-slave-bin.000001 # User var 2 # @`i3`=0
-slave-bin.000001 # User var 2 # @`i4`=-1
-slave-bin.000001 # Query 1 # use `test`; insert into t1 values (@i1), (@i2), (@i3), (@i4)
-slave-bin.000001 # User var 2 # @`r1`=12.5
-slave-bin.000001 # User var 2 # @`r2`=-12.5
-slave-bin.000001 # Query 1 # use `test`; insert into t1 values (@r1), (@r2)
-slave-bin.000001 # User var 2 # @`s1`=_latin1 0x5468697320697320612074657374 COLLATE latin1_swedish_ci
-slave-bin.000001 # User var 2 # @`s2`=_latin1 "" COLLATE latin1_swedish_ci
-slave-bin.000001 # User var 2 # @`s3`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
-slave-bin.000001 # User var 2 # @`s4`=_latin1 0x6162635C646566 COLLATE latin1_swedish_ci
-slave-bin.000001 # User var 2 # @`s5`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
-slave-bin.000001 # Query 1 # use `test`; insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5)
-slave-bin.000001 # User var 2 # @`n1`=NULL
-slave-bin.000001 # Query 1 # use `test`; insert into t1 values (@n1)
-slave-bin.000001 # User var 2 # @`n2`=NULL
-slave-bin.000001 # Query 1 # use `test`; insert into t1 values (@n2)
-slave-bin.000001 # Query 1 # use `test`; insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1)
-slave-bin.000001 # User var 2 # @`a`=2
-slave-bin.000001 # Query 1 # use `test`; insert into t1 values (@a+(@b:=@a+1))
-slave-bin.000001 # User var 2 # @`q`=_latin1 0x616263 COLLATE latin1_swedish_ci
-slave-bin.000001 # Query 1 # use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'))
-slave-bin.000001 # User var 2 # @`a`=5
-slave-bin.000001 # Query 1 # use `test`; insert into t1 values (@a),(@a)
-slave-bin.000001 # User var 2 # @`a`=NULL
-slave-bin.000001 # Query 1 # use `test`; insert into t1 values (@a),(@a),(@a*5)
+abc\def
+This is a test
insert into t1 select * FROM (select @var1 union select @var2) AS t2;
drop table t1;
stop slave;
diff --git a/mysql-test/r/rpl_variables.result b/mysql-test/r/rpl_variables.result
index 6c532e33983..605a48859a0 100644
--- a/mysql-test/r/rpl_variables.result
+++ b/mysql-test/r/rpl_variables.result
@@ -16,4 +16,4 @@ slave_load_tmpdir SLAVE_LOAD_TMPDIR
show variables like 'slave_skip_errors';
Variable_name Value
slave_skip_errors 3,100,137,643,1752
-set global slave_net_timeout =@my_slave_net_timeout;
+set global slave_net_timeout=default;
diff --git a/mysql-test/r/rpl_view.result b/mysql-test/r/rpl_view.result
index be03f3f080a..f5ddb9e13ba 100644
--- a/mysql-test/r/rpl_view.result
+++ b/mysql-test/r/rpl_view.result
@@ -43,17 +43,6 @@ drop view v1;
select * from v1 order by a;
ERROR 42S02: Table 'test.v1' doesn't exist
drop table t1;
-show binlog events limit 1,100;
-Log_name Pos Event_type Server_id End_log_pos Info
-slave-bin.000001 # Query 1 # use `test`; create table t1 (a int)
-slave-bin.000001 # Query 1 # use `test`; insert into t1 values (1)
-slave-bin.000001 # Query 1 # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select a from t1
-slave-bin.000001 # Query 1 # use `test`; insert into v1 values (2)
-slave-bin.000001 # Query 1 # use `test`; update v1 set a=3 where a=1
-slave-bin.000001 # Query 1 # use `test`; delete from v1 where a=2
-slave-bin.000001 # Query 1 # use `test`; ALTER ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select a as b from t1
-slave-bin.000001 # Query 1 # use `test`; drop view v1
-slave-bin.000001 # Query 1 # use `test`; drop table t1
---> Test for BUG#20438
diff --git a/mysql-test/r/schema.result b/mysql-test/r/schema.result
index 538abd8d039..8ed1a587588 100644
--- a/mysql-test/r/schema.result
+++ b/mysql-test/r/schema.result
@@ -6,6 +6,7 @@ foo CREATE DATABASE `foo` /*!40100 DEFAULT CHARACTER SET latin1 */
show schemas;
Database
information_schema
+cluster
foo
mysql
test
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 44063c1e890..f24b109d75a 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -144,9 +144,9 @@ explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 ignore index (fld3,not_used);
-ERROR HY000: Key 'not_used' doesn't exist in table 't2'
+ERROR 42000: Key 'not_used' doesn't exist in table 't2'
explain select fld3 from t2 use index (not_used);
-ERROR HY000: Key 'not_used' doesn't exist in table 't2'
+ERROR 42000: Key 'not_used' doesn't exist in table 't2'
select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
fld3
honeysuckle
@@ -1504,8 +1504,8 @@ select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1)
count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
70 absentee vest 17788966 254128.0857 3272.5940 10709871.3069
explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>"";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where
Warnings:
Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> _latin1''))
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
@@ -2363,7 +2363,7 @@ insert into t2 values (1,3), (2,3), (3,4), (4,4);
explain select * from t1 left join t2 on a=c where d in (4);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref c,d d 5 const 2 Using where
-1 SIMPLE t1 ALL a NULL NULL NULL 3 Using where
+1 SIMPLE t1 ALL a NULL NULL NULL 4 Using where
select * from t1 left join t2 on a=c where d in (4);
a b c d
3 2 3 4
@@ -2371,7 +2371,7 @@ a b c d
explain select * from t1 left join t2 on a=c where d = 4;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref c,d d 5 const 2 Using where
-1 SIMPLE t1 ALL a NULL NULL NULL 3 Using where
+1 SIMPLE t1 ALL a NULL NULL NULL 4 Using where
select * from t1 left join t2 on a=c where d = 4;
a b c d
3 2 3 4
@@ -2726,15 +2726,9 @@ EXPLAIN SELECT * FROM t1 IGNORE INDEX (idx);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
EXPLAIN SELECT * FROM t1 IGNORE INDEX (a);
-ERROR HY000: Key 'a' doesn't exist in table 't1'
+ERROR 42000: Key 'a' doesn't exist in table 't1'
EXPLAIN SELECT * FROM t1 FORCE INDEX (a);
-ERROR HY000: Key 'a' doesn't exist in table 't1'
-DROP TABLE t1;
-CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
-INSERT INTO t1 VALUES (10);
-SELECT i='1e+01',i=1e+01, i in (1e+01,1e+01), i in ('1e+01','1e+01') FROM t1;
-i='1e+01' i=1e+01 i in (1e+01,1e+01) i in ('1e+01','1e+01')
-1 1 1 1
+ERROR 42000: Key 'a' doesn't exist in table 't1'
DROP TABLE t1;
CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES (1,1), (2,1), (4,10);
@@ -2811,6 +2805,12 @@ select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
min(key1)
0.37619999051094
DROP TABLE t1,t2;
+CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
+INSERT INTO t1 VALUES (10);
+SELECT i='1e+01',i=1e+01, i in (1e+01,1e+01), i in ('1e+01','1e+01') FROM t1;
+i='1e+01' i=1e+01 i in (1e+01,1e+01) i in ('1e+01','1e+01')
+1 1 1 1
+DROP TABLE t1;
CREATE TABLE t1 (
K2C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '',
K4N4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '0000',
@@ -3398,19 +3398,19 @@ CREATE TABLE t1 (i TINYINT UNSIGNED NOT NULL);
INSERT t1 SET i = 0;
UPDATE t1 SET i = -1;
Warnings:
-Warning 1264 Out of range value adjusted for column 'i' at row 1
+Warning 1264 Out of range value for column 'i' at row 1
SELECT * FROM t1;
i
0
UPDATE t1 SET i = CAST(i - 1 AS SIGNED);
Warnings:
-Warning 1264 Out of range value adjusted for column 'i' at row 1
+Warning 1264 Out of range value for column 'i' at row 1
SELECT * FROM t1;
i
0
UPDATE t1 SET i = i - 1;
Warnings:
-Warning 1264 Out of range value adjusted for column 'i' at row 1
+Warning 1264 Out of range value for column 'i' at row 1
SELECT * FROM t1;
i
255
@@ -3428,7 +3428,7 @@ In next EXPLAIN, B.rows must be exactly 10:
explain select * from t2 A, t2 B where A.a=5 and A.b=5 and A.C<5
and B.a=5 and B.b=A.e and (B.b =1 or B.b = 3 or B.b=5);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE A range PRIMARY PRIMARY 12 NULL 3 Using where
+1 SIMPLE A range PRIMARY PRIMARY 12 NULL 4 Using where
1 SIMPLE B ref PRIMARY PRIMARY 8 const,test.A.e 10
drop table t1, t2;
CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX(b));
@@ -3475,7 +3475,7 @@ SELECT 0.9888889889 * 1.011111411911;
0.9998769417899202067879
prepare stmt from 'select 1 as " a "';
Warnings:
-Warning 1466 Leading spaces are removed from name ' a '
+Warning 1546 Leading spaces are removed from name ' a '
execute stmt;
a
1
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 28cbdb16919..7a1ef7cedcf 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -32,7 +32,7 @@ t1 0 PRIMARY 1 a A 5 NULL NULL BTREE
t1 1 b 1 b A 1 NULL NULL BTREE
t1 1 b 2 c A 5 NULL NULL BTREE
insert into t1 values (5,5,5);
-ERROR 23000: Duplicate entry '5' for key 1
+ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
@@ -53,6 +53,7 @@ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length I
show databases;
Database
information_schema
+cluster
mysql
test
show databases like "test%";
@@ -102,21 +103,21 @@ c int not null comment 'int column',
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `test_set` set('val1','val2','val3') NOT NULL default '',
- `name` char(20) default 'O''Brien' COMMENT 'O''Brien as default',
+ `test_set` set('val1','val2','val3') NOT NULL DEFAULT '',
+ `name` char(20) DEFAULT 'O''Brien' COMMENT 'O''Brien as default',
`c` int(11) NOT NULL COMMENT 'int column',
- `c-b` int(11) default NULL COMMENT 'name with a minus',
- `space 2` int(11) default NULL COMMENT 'name with a space'
+ `c-b` int(11) DEFAULT NULL COMMENT 'name with a minus',
+ `space 2` int(11) DEFAULT NULL COMMENT 'name with a space'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table'
set sql_quote_show_create=0;
show create table t1;
Table Create Table
t1 CREATE TABLE t1 (
- test_set set('val1','val2','val3') NOT NULL default '',
- `name` char(20) default 'O''Brien' COMMENT 'O''Brien as default',
+ test_set set('val1','val2','val3') NOT NULL DEFAULT '',
+ `name` char(20) DEFAULT 'O''Brien' COMMENT 'O''Brien as default',
c int(11) NOT NULL COMMENT 'int column',
- `c-b` int(11) default NULL COMMENT 'name with a minus',
- `space 2` int(11) default NULL COMMENT 'name with a space'
+ `c-b` int(11) DEFAULT NULL COMMENT 'name with a minus',
+ `space 2` int(11) DEFAULT NULL COMMENT 'name with a space'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table'
set sql_quote_show_create=1;
show full columns from t1;
@@ -140,16 +141,20 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
- PRIMARY KEY (`a`)
+ PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
flush tables;
show open tables;
Database Table In_use Name_locked
+mysql general_log 1 0
+mysql slow_log 1 0
create table t1(n int);
insert into t1 values (1);
show open tables;
Database Table In_use Name_locked
+mysql general_log 1 0
+mysql slow_log 1 0
test t1 0 0
drop table t1;
create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed;
@@ -157,7 +162,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
- `b` varchar(10) default NULL,
+ `b` varchar(10) DEFAULT NULL,
KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test'
alter table t1 MAX_ROWS=200 ROW_FORMAT=dynamic PACK_KEYS=0;
@@ -165,7 +170,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
- `b` varchar(10) default NULL,
+ `b` varchar(10) DEFAULT NULL,
KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=200 AVG_ROW_LENGTH=10 PACK_KEYS=0 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC COMMENT='test'
ALTER TABLE t1 AVG_ROW_LENGTH=0 CHECKSUM=0 COMMENT="" MIN_ROWS=0 MAX_ROWS=0 PACK_KEYS=DEFAULT DELAY_KEY_WRITE=0 ROW_FORMAT=default;
@@ -173,7 +178,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
- `b` varchar(10) default NULL,
+ `b` varchar(10) DEFAULT NULL,
KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -222,28 +227,28 @@ index(type_short)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `type_bool` tinyint(1) NOT NULL default '0',
- `type_tiny` tinyint(4) NOT NULL auto_increment,
- `type_short` smallint(3) default NULL,
- `type_mediumint` mediumint(9) default NULL,
- `type_bigint` bigint(20) default NULL,
- `type_decimal` decimal(5,2) default NULL,
- `type_numeric` decimal(5,2) default NULL,
- `empty_char` char(0) default NULL,
- `type_char` char(2) default NULL,
- `type_varchar` varchar(10) default NULL,
- `type_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
- `type_date` date NOT NULL default '0000-00-00',
- `type_time` time NOT NULL default '00:00:00',
- `type_datetime` datetime NOT NULL default '0000-00-00 00:00:00',
- `type_year` year(4) default NULL,
- `type_enum` enum('red','green','blue') default NULL,
- `type_set` enum('red','green','blue') default NULL,
+ `type_bool` tinyint(1) NOT NULL DEFAULT '0',
+ `type_tiny` tinyint(4) NOT NULL AUTO_INCREMENT,
+ `type_short` smallint(3) DEFAULT NULL,
+ `type_mediumint` mediumint(9) DEFAULT NULL,
+ `type_bigint` bigint(20) DEFAULT NULL,
+ `type_decimal` decimal(5,2) DEFAULT NULL,
+ `type_numeric` decimal(5,2) DEFAULT NULL,
+ `empty_char` char(0) DEFAULT NULL,
+ `type_char` char(2) DEFAULT NULL,
+ `type_varchar` varchar(10) DEFAULT NULL,
+ `type_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `type_date` date NOT NULL DEFAULT '0000-00-00',
+ `type_time` time NOT NULL DEFAULT '00:00:00',
+ `type_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `type_year` year(4) DEFAULT NULL,
+ `type_enum` enum('red','green','blue') DEFAULT NULL,
+ `type_set` enum('red','green','blue') DEFAULT NULL,
`type_tinyblob` tinyblob,
`type_blob` blob,
`type_medium_blob` mediumblob,
`type_long_blob` longblob,
- PRIMARY KEY (`type_tiny`),
+ PRIMARY KEY (`type_tiny`),
KEY `type_short` (`type_short`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test'
insert into t1 (type_timestamp) values ("2003-02-07 10:00:01");
@@ -274,22 +279,56 @@ f float(3,3) YES NULL
drop table t1;
SET @old_sql_mode= @@sql_mode, sql_mode= '';
SET @old_sql_quote_show_create= @@sql_quote_show_create, sql_quote_show_create= OFF;
-CREATE TABLE `a/b` (i INT);
-ERROR 42000: Incorrect table name 'a/b'
+CREATE TABLE ```ab``cd``` (i INT);
+SHOW CREATE TABLE ```ab``cd```;
+Table Create Table
+`ab`cd` CREATE TABLE ```ab``cd``` (
+ i int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE ```ab``cd```;
+CREATE TABLE ```ab````cd``` (i INT);
+SHOW CREATE TABLE ```ab````cd```;
+Table Create Table
+`ab``cd` CREATE TABLE ```ab````cd``` (
+ i int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE ```ab````cd```;
+CREATE TABLE ```a` (i INT);
+SHOW CREATE TABLE ```a`;
+Table Create Table
+`a CREATE TABLE ```a` (
+ i int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE ```a`;
+CREATE TABLE `a.1` (i INT);
+SHOW CREATE TABLE `a.1`;
+Table Create Table
+a.1 CREATE TABLE `a.1` (
+ i int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE `a.1`;
+SET sql_mode= 'ANSI_QUOTES';
+CREATE TABLE """a" (i INT);
+SHOW CREATE TABLE """a";
+Table Create Table
+"a CREATE TABLE """a" (
+ i int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE """a";
SET sql_mode= '';
SET sql_quote_show_create= OFF;
CREATE TABLE t1 (i INT);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE t1 (
- i int(11) default NULL
+ i int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE `table` (i INT);
SHOW CREATE TABLE `table`;
Table Create Table
table CREATE TABLE `table` (
- i int(11) default NULL
+ i int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE `table`;
SET sql_quote_show_create= @old_sql_quote_show_create;
@@ -343,9 +382,9 @@ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length I
t1 MEMORY 10 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
t2 MEMORY 10 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
t3 MEMORY 10 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
-delete from t1;
-delete from t2;
-delete from t3;
+truncate table t1;
+truncate table t2;
+truncate table t3;
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MEMORY 10 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
@@ -398,7 +437,8 @@ ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysql
select * from mysqltest.t1;
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't1'
show create database mysqltest;
-ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest'
+Database Create Database
+mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */
drop table mysqltest.t1;
drop database mysqltest;
set names binary;
@@ -411,7 +451,7 @@ CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(11) default NULL,
+ `i` int(11) DEFAULT NULL,
KEY `i` (`i`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -419,23 +459,23 @@ CREATE TABLE t1 (i int, KEY USING HASH (i)) ENGINE=MEMORY;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(11) default NULL,
- KEY `i` USING HASH (`i`)
+ `i` int(11) DEFAULT NULL,
+ KEY `i` (`i`) USING HASH
) ENGINE=MEMORY DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MEMORY;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(11) default NULL,
- KEY `i` USING BTREE (`i`)
+ `i` int(11) DEFAULT NULL,
+ KEY `i` (`i`) USING BTREE
) ENGINE=MEMORY DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(11) default NULL,
+ `i` int(11) DEFAULT NULL,
KEY `i` (`i`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -443,22 +483,22 @@ CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(11) default NULL,
- KEY `i` USING BTREE (`i`)
+ `i` int(11) DEFAULT NULL,
+ KEY `i` (`i`) USING BTREE
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(11) default NULL,
+ `i` int(11) DEFAULT NULL,
KEY `i` (`i`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t1 ENGINE=MEMORY;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(11) default NULL,
+ `i` int(11) DEFAULT NULL,
KEY `i` (`i`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -466,15 +506,15 @@ CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(11) default NULL,
- KEY `i` USING BTREE (`i`)
+ `i` int(11) DEFAULT NULL,
+ KEY `i` (`i`) USING BTREE
) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t1 ENGINE=MEMORY;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(11) default NULL,
- KEY `i` USING BTREE (`i`)
+ `i` int(11) DEFAULT NULL,
+ KEY `i` (`i`) USING BTREE
) ENGINE=MEMORY DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1(
@@ -509,8 +549,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` int(11) NOT NULL,
- PRIMARY KEY USING HASH (`c1`),
- KEY `c2` USING BTREE (`c2`)
+ PRIMARY KEY (`c1`) USING HASH,
+ KEY `c2` (`c2`) USING BTREE
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
flush tables;
@@ -519,8 +559,7 @@ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length I
t1 NULL NULL NULL NULL # # # # NULL NULL NULL NULL NULL NULL NULL NULL Incorrect information in file: './test/t1.frm'
show create table t1;
ERROR HY000: Incorrect information in file: './test/t1.frm'
-drop table t1;
-End of 4.1 tests
+drop table if exists t1;
CREATE TABLE txt1(a int);
CREATE TABLE tyt2(a int);
CREATE TABLE urkunde(a int);
@@ -529,20 +568,24 @@ SELECT 1 FROM mysql.db, mysql.proc, mysql.user, mysql.time_zone, mysql.time_zone
1
SHOW OPEN TABLES;
Database Table In_use Name_locked
-mysql db 0 0
+mysql proc 0 0
test urkunde 0 0
mysql time_zone 0 0
-mysql user 0 0
+mysql db 0 0
test txt1 0 0
-mysql proc 0 0
+mysql slow_log 1 0
test tyt2 0 0
+mysql general_log 1 0
+mysql user 0 0
mysql time_zone_name 0 0
SHOW OPEN TABLES FROM mysql;
Database Table In_use Name_locked
-mysql db 0 0
+mysql proc 0 0
mysql time_zone 0 0
+mysql db 0 0
+mysql slow_log 1 0
+mysql general_log 1 0
mysql user 0 0
-mysql proc 0 0
mysql time_zone_name 0 0
SHOW OPEN TABLES FROM mysql LIKE 'u%';
Database Table In_use Name_locked
@@ -555,17 +598,22 @@ test tyt2 0 0
mysql time_zone_name 0 0
SHOW OPEN TABLES LIKE '%o%';
Database Table In_use Name_locked
-mysql time_zone 0 0
mysql proc 0 0
+mysql time_zone 0 0
+mysql slow_log 1 0
+mysql general_log 1 0
mysql time_zone_name 0 0
FLUSH TABLES;
SHOW OPEN TABLES;
Database Table In_use Name_locked
+mysql general_log 1 0
+mysql slow_log 1 0
DROP TABLE txt1;
DROP TABLE tyt2;
DROP TABLE urkunde;
SHOW TABLES FROM non_existing_database;
ERROR 42000: Unknown database 'non_existing_database'
+End of 4.1 tests
DROP VIEW IF EXISTS v1;
DROP PROCEDURE IF EXISTS p1;
CREATE VIEW v1 AS SELECT 1;
@@ -638,11 +686,49 @@ show tables;
Tables_in_test
show status like 'slow_queries';
Variable_name Value
-Slow_queries 0
+Slow_queries 1
select 1 from information_schema.tables limit 1;
1
1
show status like 'slow_queries';
Variable_name Value
-Slow_queries 1
-End of 5.0 tests
+Slow_queries 2
+End of 5.0 tests.
+SHOW AUTHORS;
+create database mysqltest;
+show create database mysqltest;
+Database Create Database
+mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */
+create table mysqltest.t1(a int);
+insert into mysqltest.t1 values(1);
+grant select on `mysqltest`.`t1` to mysqltest_4@localhost;
+show create database mysqltest;
+Database Create Database
+mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */
+delete from mysql.user where user='mysqltest_4';
+delete from mysql.db where user='mysqltest_4';
+delete from mysql.tables_priv where user='mysqltest_4';
+flush privileges;
+drop database mysqltest;
+show full plugin;
+show warnings;
+Level Code Message
+Warning 1541 The syntax 'SHOW PLUGIN' is deprecated and will be removed in MySQL 5.2. Please use 'SHOW PLUGINS' instead
+show plugin;
+show plugins;
+create database `mysqlttest\1`;
+create table `mysqlttest\1`.`a\b` (a int);
+show tables from `mysqlttest\1`;
+Tables_in_mysqlttest\1
+a\b
+show fields from `mysqlttest\1`.`a\b`;
+Field Type Null Key Default Extra
+a int(11) YES NULL
+show columns from `a\b` from `mysqlttest\1`;
+Field Type Null Key Default Extra
+a int(11) YES NULL
+show keys from `mysqlttest\1`.`a\b`;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+drop table `mysqlttest\1`.`a\b`;
+drop database `mysqlttest\1`;
+End of 5.1 tests
diff --git a/mysql-test/r/sp-dynamic.result b/mysql-test/r/sp-dynamic.result
index d9d5706cded..f1c7e6076e5 100644
--- a/mysql-test/r/sp-dynamic.result
+++ b/mysql-test/r/sp-dynamic.result
@@ -284,11 +284,11 @@ call p1()|
select * from t1|
id stmt_text status
1 select 1 supported
-2 flush tables not supported
+2 flush tables supported
3 handler t1 open as ha not supported
4 analyze table t1 supported
5 check table t1 not supported
-6 checksum table t1 not supported
+6 checksum table t1 supported
7 check table t1 not supported
8 optimize table t1 supported
9 repair table t1 supported
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
index 63fd1bfff6d..d955b69bde2 100644
--- a/mysql-test/r/sp-error.result
+++ b/mysql-test/r/sp-error.result
@@ -368,7 +368,7 @@ end|
insert into t1 values (666, 51.3)|
call bug2272()|
ERROR 42S22: Unknown column 'v' in 'field list'
-delete from t1|
+truncate table t1|
drop procedure bug2272|
create procedure bug2329_1()
begin
@@ -425,7 +425,7 @@ set y = x;
end|
set @x = 0|
call bug3279(@x)|
-ERROR 23000: Duplicate entry '6' for key 1
+ERROR 23000: Duplicate entry '6' for key 'PRIMARY'
select @x|
@x
0
@@ -520,7 +520,7 @@ declare exit handler for sqlexception select 'Error!';
open c;
fetch c into v;
end|
-delete from t1|
+truncate table t1|
call bug7299()|
ERROR 02000: No data - zero rows fetched, selected, or processed
drop procedure bug7299|
@@ -621,7 +621,7 @@ val x bug8408()
3 3.14 3
7 7 3
drop function bug8408|
-delete from t1|
+truncate table t1|
drop procedure if exists bug10537|
create procedure bug10537()
load data local infile '/tmp/somefile' into table t1|
@@ -793,7 +793,7 @@ bug11834_2()
10
drop function bug11834_1;
execute stmt;
-ERROR 42000: FUNCTION test.bug11834_1 does not exist
+ERROR 42000: FUNCTION test.bug11834_2 does not exist
deallocate prepare stmt;
drop function bug11834_2;
DROP FUNCTION IF EXISTS bug12953|
@@ -1250,3 +1250,17 @@ ERROR HY000: View's SELECT contains a variable or parameter
PREPARE stmt FROM "CREATE VIEW v AS SELECT ?";
ERROR HY000: View's SELECT contains a variable or parameter
DROP TABLE t1;
+End of 5.0 tests
+drop function if exists bug16164;
+create function bug16164() returns int
+begin
+show authors;
+return 42;
+end|
+ERROR 0A000: Not allowed to return a result set from a function
+drop function if exists bug20701;
+create function bug20701() returns varchar(25) binary return "test";
+ERROR 42000: This version of MySQL doesn't yet support 'return value collation'
+create function bug20701() returns varchar(25) return "test";
+drop function bug20701;
+End of 5.1 tests
diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result
index 1198efc4f3b..7729890ff02 100644
--- a/mysql-test/r/sp-security.result
+++ b/mysql-test/r/sp-security.result
@@ -314,16 +314,6 @@ select * from db_bug14533.t1;
ERROR 42000: SELECT command denied to user 'user_bug14533'@'localhost' for table 't1'
drop user user_bug14533@localhost;
drop database db_bug14533;
-CREATE DATABASE db_bug7787;
-use db_bug7787;
-CREATE PROCEDURE p1()
-SHOW INNODB STATUS;
-Warnings:
-Warning 1287 'SHOW INNODB STATUS' is deprecated; use 'SHOW ENGINE INNODB STATUS' instead
-GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost;
-DROP DATABASE db_bug7787;
-drop user user_bug7787@localhost;
-use test;
---> connection: root
DROP DATABASE IF EXISTS mysqltest;
@@ -451,6 +441,7 @@ SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
Host User Password
localhost user19857 *82DC221D557298F6CE9961037DB1C90604792F5C
DROP USER user19857@localhost;
+use test;
DROP TABLE IF EXISTS t1;
DROP VIEW IF EXISTS v1;
DROP FUNCTION IF EXISTS f_suid;
diff --git a/mysql-test/r/sp-vars.result b/mysql-test/r/sp-vars.result
index f362187cd14..8b59fa371cc 100644
--- a/mysql-test/r/sp-vars.result
+++ b/mysql-test/r/sp-vars.result
@@ -110,18 +110,18 @@ v7 v8 v9 v10 v11 v12 v13 v14 v15 v16
v17 v18 v19 v20
12.00 12.12 12.00 12.12
Warnings:
-Warning 1264 Out of range value adjusted for column 'v1' at row 1
-Warning 1264 Out of range value adjusted for column 'v1u' at row 1
-Warning 1264 Out of range value adjusted for column 'v2' at row 1
-Warning 1264 Out of range value adjusted for column 'v2u' at row 1
-Warning 1264 Out of range value adjusted for column 'v3' at row 1
-Warning 1264 Out of range value adjusted for column 'v3u' at row 1
-Warning 1264 Out of range value adjusted for column 'v4' at row 1
-Warning 1264 Out of range value adjusted for column 'v4u' at row 1
-Warning 1264 Out of range value adjusted for column 'v5' at row 1
-Warning 1264 Out of range value adjusted for column 'v5u' at row 1
-Warning 1264 Out of range value adjusted for column 'v6' at row 1
-Warning 1264 Out of range value adjusted for column 'v6u' at row 1
+Warning 1264 Out of range value for column 'v1' at row 1
+Warning 1264 Out of range value for column 'v1u' at row 1
+Warning 1264 Out of range value for column 'v2' at row 1
+Warning 1264 Out of range value for column 'v2u' at row 1
+Warning 1264 Out of range value for column 'v3' at row 1
+Warning 1264 Out of range value for column 'v3u' at row 1
+Warning 1264 Out of range value for column 'v4' at row 1
+Warning 1264 Out of range value for column 'v4u' at row 1
+Warning 1264 Out of range value for column 'v5' at row 1
+Warning 1264 Out of range value for column 'v5u' at row 1
+Warning 1264 Out of range value for column 'v6' at row 1
+Warning 1264 Out of range value for column 'v6u' at row 1
Warning 1366 Incorrect integer value: 'String 10 ' for column 'v10' at row 1
Warning 1366 Incorrect integer value: 'String10' for column 'v11' at row 1
Warning 1265 Data truncated for column 'v12' at row 1
@@ -143,32 +143,32 @@ d1 d2 d3
d1 d2 d3
1234.00 1234.12 1234.12
Warnings:
-Warning 1264 Out of range value adjusted for column 'i1' at row 1
-Warning 1264 Out of range value adjusted for column 'i2' at row 1
-Warning 1264 Out of range value adjusted for column 'i3' at row 1
-Warning 1264 Out of range value adjusted for column 'i4' at row 1
-Warning 1264 Out of range value adjusted for column 'i1' at row 1
-Warning 1264 Out of range value adjusted for column 'i2' at row 1
-Warning 1264 Out of range value adjusted for column 'i3' at row 1
-Warning 1264 Out of range value adjusted for column 'i4' at row 1
-Warning 1264 Out of range value adjusted for column 'u1' at row 1
-Warning 1264 Out of range value adjusted for column 'u2' at row 1
-Warning 1264 Out of range value adjusted for column 'u3' at row 1
-Warning 1264 Out of range value adjusted for column 'u4' at row 1
-Warning 1264 Out of range value adjusted for column 'u1' at row 1
-Warning 1264 Out of range value adjusted for column 'u2' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i2' at row 1
+Warning 1264 Out of range value for column 'i3' at row 1
+Warning 1264 Out of range value for column 'i4' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i2' at row 1
+Warning 1264 Out of range value for column 'i3' at row 1
+Warning 1264 Out of range value for column 'i4' at row 1
+Warning 1264 Out of range value for column 'u1' at row 1
+Warning 1264 Out of range value for column 'u2' at row 1
+Warning 1264 Out of range value for column 'u3' at row 1
+Warning 1264 Out of range value for column 'u4' at row 1
+Warning 1264 Out of range value for column 'u1' at row 1
+Warning 1264 Out of range value for column 'u2' at row 1
Note 1265 Data truncated for column 'd3' at row 1
Note 1265 Data truncated for column 'd3' at row 1
SELECT sp_vars_check_ret1();
sp_vars_check_ret1()
127
Warnings:
-Warning 1264 Out of range value adjusted for column 'sp_vars_check_ret1()' at row 1
+Warning 1264 Out of range value for column 'sp_vars_check_ret1()' at row 1
SELECT sp_vars_check_ret2();
sp_vars_check_ret2()
127
Warnings:
-Warning 1264 Out of range value adjusted for column 'sp_vars_check_ret2()' at row 1
+Warning 1264 Out of range value for column 'sp_vars_check_ret2()' at row 1
SELECT sp_vars_check_ret3();
sp_vars_check_ret3()
0
@@ -198,18 +198,18 @@ v7 v8 v9 v10 v11 v12 v13 v14 v15 v16
v17 v18 v19 v20
12.00 12.12 12.00 12.12
Warnings:
-Warning 1264 Out of range value adjusted for column 'v1' at row 1
-Warning 1264 Out of range value adjusted for column 'v1u' at row 1
-Warning 1264 Out of range value adjusted for column 'v2' at row 1
-Warning 1264 Out of range value adjusted for column 'v2u' at row 1
-Warning 1264 Out of range value adjusted for column 'v3' at row 1
-Warning 1264 Out of range value adjusted for column 'v3u' at row 1
-Warning 1264 Out of range value adjusted for column 'v4' at row 1
-Warning 1264 Out of range value adjusted for column 'v4u' at row 1
-Warning 1264 Out of range value adjusted for column 'v5' at row 1
-Warning 1264 Out of range value adjusted for column 'v5u' at row 1
-Warning 1264 Out of range value adjusted for column 'v6' at row 1
-Warning 1264 Out of range value adjusted for column 'v6u' at row 1
+Warning 1264 Out of range value for column 'v1' at row 1
+Warning 1264 Out of range value for column 'v1u' at row 1
+Warning 1264 Out of range value for column 'v2' at row 1
+Warning 1264 Out of range value for column 'v2u' at row 1
+Warning 1264 Out of range value for column 'v3' at row 1
+Warning 1264 Out of range value for column 'v3u' at row 1
+Warning 1264 Out of range value for column 'v4' at row 1
+Warning 1264 Out of range value for column 'v4u' at row 1
+Warning 1264 Out of range value for column 'v5' at row 1
+Warning 1264 Out of range value for column 'v5u' at row 1
+Warning 1264 Out of range value for column 'v6' at row 1
+Warning 1264 Out of range value for column 'v6u' at row 1
Warning 1366 Incorrect integer value: 'String 10 ' for column 'v10' at row 1
Warning 1366 Incorrect integer value: 'String10' for column 'v11' at row 1
Warning 1265 Data truncated for column 'v12' at row 1
@@ -231,32 +231,32 @@ d1 d2 d3
d1 d2 d3
1234.00 1234.12 1234.12
Warnings:
-Warning 1264 Out of range value adjusted for column 'i1' at row 1
-Warning 1264 Out of range value adjusted for column 'i2' at row 1
-Warning 1264 Out of range value adjusted for column 'i3' at row 1
-Warning 1264 Out of range value adjusted for column 'i4' at row 1
-Warning 1264 Out of range value adjusted for column 'i1' at row 1
-Warning 1264 Out of range value adjusted for column 'i2' at row 1
-Warning 1264 Out of range value adjusted for column 'i3' at row 1
-Warning 1264 Out of range value adjusted for column 'i4' at row 1
-Warning 1264 Out of range value adjusted for column 'u1' at row 1
-Warning 1264 Out of range value adjusted for column 'u2' at row 1
-Warning 1264 Out of range value adjusted for column 'u3' at row 1
-Warning 1264 Out of range value adjusted for column 'u4' at row 1
-Warning 1264 Out of range value adjusted for column 'u1' at row 1
-Warning 1264 Out of range value adjusted for column 'u2' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i2' at row 1
+Warning 1264 Out of range value for column 'i3' at row 1
+Warning 1264 Out of range value for column 'i4' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i2' at row 1
+Warning 1264 Out of range value for column 'i3' at row 1
+Warning 1264 Out of range value for column 'i4' at row 1
+Warning 1264 Out of range value for column 'u1' at row 1
+Warning 1264 Out of range value for column 'u2' at row 1
+Warning 1264 Out of range value for column 'u3' at row 1
+Warning 1264 Out of range value for column 'u4' at row 1
+Warning 1264 Out of range value for column 'u1' at row 1
+Warning 1264 Out of range value for column 'u2' at row 1
Note 1265 Data truncated for column 'd3' at row 1
Note 1265 Data truncated for column 'd3' at row 1
SELECT sp_vars_check_ret1();
sp_vars_check_ret1()
127
Warnings:
-Warning 1264 Out of range value adjusted for column 'sp_vars_check_ret1()' at row 1
+Warning 1264 Out of range value for column 'sp_vars_check_ret1()' at row 1
SELECT sp_vars_check_ret2();
sp_vars_check_ret2()
127
Warnings:
-Warning 1264 Out of range value adjusted for column 'sp_vars_check_ret2()' at row 1
+Warning 1264 Out of range value for column 'sp_vars_check_ret2()' at row 1
SELECT sp_vars_check_ret3();
sp_vars_check_ret3()
0
@@ -372,13 +372,13 @@ Calling the routines, created in TRADITIONAL mode.
---------------------------------------------------------------
CALL sp_vars_check_dflt();
-ERROR 22003: Out of range value adjusted for column 'v1' at row 1
+ERROR 22003: Out of range value for column 'v1' at row 1
CALL sp_vars_check_assignment();
-ERROR 22003: Out of range value adjusted for column 'i1' at row 1
+ERROR 22003: Out of range value for column 'i1' at row 1
SELECT sp_vars_check_ret1();
-ERROR 22003: Out of range value adjusted for column 'sp_vars_check_ret1()' at row 1
+ERROR 22003: Out of range value for column 'sp_vars_check_ret1()' at row 1
SELECT sp_vars_check_ret2();
-ERROR 22003: Out of range value adjusted for column 'sp_vars_check_ret2()' at row 1
+ERROR 22003: Out of range value for column 'sp_vars_check_ret2()' at row 1
SELECT sp_vars_check_ret3();
ERROR HY000: Incorrect integer value: 'Hello, world' for column 'sp_vars_check_ret3()' at row 1
SELECT sp_vars_check_ret4();
@@ -451,11 +451,11 @@ FF
HEX(v10)
FF
Warnings:
-Warning 1264 Out of range value adjusted for column 'v8' at row 1
-Warning 1264 Out of range value adjusted for column 'v9' at row 1
-Warning 1264 Out of range value adjusted for column 'v10' at row 1
-Warning 1264 Out of range value adjusted for column 'v1' at row 1
-Warning 1264 Out of range value adjusted for column 'v5' at row 1
+Warning 1264 Out of range value for column 'v8' at row 1
+Warning 1264 Out of range value for column 'v9' at row 1
+Warning 1264 Out of range value for column 'v10' at row 1
+Warning 1264 Out of range value for column 'v1' at row 1
+Warning 1264 Out of range value for column 'v5' at row 1
DROP PROCEDURE p1;
---------------------------------------------------------------
@@ -690,15 +690,15 @@ END|
CALL p1(NOW());
Table Create Table
t1 CREATE TABLE "t1" (
- "x" varbinary(19) default NULL
+ "x" varbinary(19) DEFAULT NULL
)
CALL p1('test');
Table Create Table
t1 CREATE TABLE "t1" (
- "x" varbinary(19) default NULL
+ "x" varbinary(19) DEFAULT NULL
)
Warnings:
-Warning 1264 Out of range value adjusted for column 'x' at row 1
+Warning 1264 Out of range value for column 'x' at row 1
DROP PROCEDURE p1;
---------------------------------------------------------------
@@ -800,9 +800,9 @@ SET var := arg;
SELECT arg, var;
END|
CALL p1();
-ERROR 22003: Out of range value adjusted for column 'v' at row 1
+ERROR 22003: Out of range value for column 'v' at row 1
CALL p2();
-ERROR 22003: Out of range value adjusted for column 'v' at row 1
+ERROR 22003: Out of range value for column 'v' at row 1
CALL p3();
ERROR 22001: Data too long for column 'v' at row 1
CALL p4('aaa');
@@ -810,7 +810,7 @@ ERROR 22001: Data too long for column 'arg' at row 1
CALL p5('aa');
ERROR 22001: Data too long for column 'var' at row 1
CALL p6(10);
-ERROR 22003: Out of range value adjusted for column 'var' at row 1
+ERROR 22003: Out of range value for column 'var' at row 1
SET @@sql_mode = 'ansi';
DROP PROCEDURE p1;
DROP PROCEDURE p2;
@@ -856,17 +856,17 @@ SELECT f1(-2500);
f1(-2500)
0
Warnings:
-Warning 1264 Out of range value adjusted for column 'arg' at row 1
+Warning 1264 Out of range value for column 'arg' at row 1
SET @@sql_mode = 'traditional';
SELECT f1(-2500);
-ERROR 22003: Out of range value adjusted for column 'arg' at row 1
+ERROR 22003: Out of range value for column 'arg' at row 1
DROP FUNCTION f1;
CREATE FUNCTION f1(arg TINYINT UNSIGNED) RETURNS TINYINT
BEGIN
RETURN arg;
END|
SELECT f1(-2500);
-ERROR 22003: Out of range value adjusted for column 'arg' at row 1
+ERROR 22003: Out of range value for column 'arg' at row 1
SET @@sql_mode = 'ansi';
DROP FUNCTION f1;
@@ -883,17 +883,17 @@ SELECT f1(8388699);
f1(8388699)
8388607
Warnings:
-Warning 1264 Out of range value adjusted for column 'arg' at row 1
+Warning 1264 Out of range value for column 'arg' at row 1
SET @@sql_mode = 'traditional';
SELECT f1(8388699);
-ERROR 22003: Out of range value adjusted for column 'arg' at row 1
+ERROR 22003: Out of range value for column 'arg' at row 1
DROP FUNCTION f1;
CREATE FUNCTION f1(arg MEDIUMINT) RETURNS MEDIUMINT
BEGIN
RETURN arg;
END|
SELECT f1(8388699);
-ERROR 22003: Out of range value adjusted for column 'arg' at row 1
+ERROR 22003: Out of range value for column 'arg' at row 1
SET @@sql_mode = 'ansi';
DROP FUNCTION f1;
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 1bb4b3a405b..aeccfd9c951 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -78,7 +78,7 @@ replace t1 set data = data, id = "bar";
update t1 set id = "kaka", data = 3 where t1.data = data;
end|
call setcontext()|
-select * from t1|
+select * from t1 order by data|
id data
foo 1
kaka 3
@@ -191,7 +191,7 @@ drop procedure if exists inc|
create procedure inc(inout io int)
set io = io + 1|
call iotest("io1", "io2", 1)|
-select * from t1|
+select * from t1 order by data desc|
id data
io2 2
io1 1
@@ -224,7 +224,7 @@ set y2 = 4711;
insert into test.t1 values ("cbv2", y1);
end|
call cbv1()|
-select * from t1|
+select * from t1 order by data|
id data
cbv2 4
cbv1 4711
@@ -251,7 +251,7 @@ call sub1("sub1c", (select i,d from t2 limit 1))|
ERROR 21000: Operand should contain 1 column(s)
call sub1("sub1d", (select 1 from (select 1) a))|
call sub2("sub2")|
-select * from t1|
+select * from t1 order by id|
id data
sub1a 7
sub1b 3
@@ -272,7 +272,7 @@ set x = x-1;
insert into test.t1 values ("a0", x);
end while|
call a0(3)|
-select * from t1|
+select * from t1 order by data desc|
id data
a0 2
a0 1
@@ -286,7 +286,7 @@ set x = x-1;
insert into test.t1 values ("a", x);
end while|
call a(3)|
-select * from t1|
+select * from t1 order by data desc|
id data
a 2
a 1
@@ -300,7 +300,7 @@ insert into test.t1 values (repeat("b",3), x);
set x = x-1;
until x = 0 end repeat|
call b(3)|
-select * from t1|
+select * from t1 order by data desc|
id data
bbb 3
bbb 2
@@ -323,7 +323,7 @@ iterate hmm;
insert into test.t1 values ("x", x);
end while hmm|
call c(3)|
-select * from t1|
+select * from t1 order by data desc|
id data
c 3
c 2
@@ -354,7 +354,7 @@ insert into test.t1 values ("e", x);
set x = x-1;
end loop foo|
call e(3)|
-select * from t1|
+select * from t1 order by data desc|
id data
e 3
e 2
@@ -373,7 +373,7 @@ end if|
call f(-2)|
call f(0)|
call f(4)|
-select * from t1|
+select * from t1 order by data|
id data
f 0
f 1
@@ -393,7 +393,7 @@ end case|
call g(-42)|
call g(0)|
call g(1)|
-select * from t1|
+select * from t1 order by data|
id data
g 0
g 1
@@ -413,7 +413,7 @@ end case|
call h(0)|
call h(1)|
call h(17)|
-select * from t1|
+select * from t1 order by data|
id data
h0 0
h1 1
@@ -441,7 +441,7 @@ insert into t2 values ("x", 9, 4.1), ("y", -1, 19.2), ("z", 3, 2.2)|
drop procedure if exists sel1|
create procedure sel1()
begin
-select * from t1;
+select * from t1 order by data;
end|
call sel1()|
id data
@@ -451,8 +451,8 @@ drop procedure sel1|
drop procedure if exists sel2|
create procedure sel2()
begin
-select * from t1;
-select * from t2;
+select * from t1 order by data;
+select * from t2 order by s;
end|
call sel2()|
id data
@@ -473,7 +473,7 @@ select id,data into x,y from test.t1 limit 1;
insert into test.t1 values (concat(x, "2"), y+2);
end|
call into_test("into", 100)|
-select * from t1|
+select * from t1 order by data|
id data
into 100
into2 102
@@ -487,7 +487,7 @@ select id,data into x,@z from test.t1 limit 1;
insert into test.t1 values (concat(x, "2"), y+2);
end|
call into_test2("into", 100)|
-select id,data,@z from t1|
+select id,data,@z from t1 order by data|
id data @z
into 100 100
into2 102 100
@@ -619,14 +619,14 @@ insert into t2 values (append("a", "b"), mul(2,mul(3,4)), fun(1.7, 4, 6))|
select * from t2 where s = append("a", "b")|
s i d
ab 24 1324.36598821719
-select * from t2 where i = mul(4,3) or i = mul(mul(3,4),2)|
+select * from t2 where i = mul(4,3) or i = mul(mul(3,4),2) order by i|
s i d
xxxyyy 12 2.71828182845905
ab 24 1324.36598821719
select * from t2 where d = e()|
s i d
xxxyyy 12 2.71828182845905
-select * from t2|
+select * from t2 order by i|
s i d
xxxyyy 12 2.71828182845905
ab 24 1324.36598821719
@@ -745,8 +745,8 @@ drop procedure if exists cur2|
create procedure cur2()
begin
declare done int default 0;
-declare c1 cursor for select id,data from test.t1;
-declare c2 cursor for select i from test.t2;
+declare c1 cursor for select id,data from test.t1 order by id,data;
+declare c2 cursor for select i from test.t2 order by i;
declare continue handler for sqlstate '02000' set done = 1;
open c1;
open c2;
@@ -769,10 +769,10 @@ close c1;
close c2;
end|
call cur2()|
-select * from t3|
+select * from t3 order by i,s|
s i
-foo 40
bar 3
+foo 40
zap 663
delete from t1|
delete from t2|
@@ -935,16 +935,16 @@ return (select sum(data) from t1)|
select f1()|
f1()
3
-select id, f1() from t1|
+select id, f1() from t1 order by id|
id f1()
a 3
b 3
create function f2() returns int
-return (select data from t1 where data <= (select sum(data) from t1) limit 1)|
+return (select data from t1 where data <= (select sum(data) from t1) order by data limit 1)|
select f2()|
f2()
1
-select id, f2() from t1|
+select id, f2() from t1 order by id|
id f2()
a 1
b 1
@@ -959,14 +959,14 @@ end|
select f3()|
f3()
1
-select id, f3() from t1|
+select id, f3() from t1 order by id|
id f3()
a 1
b 1
select f1(), f3()|
f1() f3()
3 1
-select id, f1(), f3() from t1|
+select id, f1(), f3() from t1 order by id|
id f1() f3()
a 3 1
b 3 1
@@ -975,7 +975,7 @@ return (select d from t1, t2 where t1.data = t2.i and t1.id= "b")|
select f4()|
f4()
2
-select s, f4() from t2|
+select s, f4() from t2 order by s|
s f4()
a 2
b 2
@@ -1008,7 +1008,7 @@ return (select sum(data) from t1 where data <= f1())|
select f6()|
f6()
2
-select id, f6() from t1|
+select id, f6() from t1 order by id|
id f6()
a 2
b 2
@@ -1016,7 +1016,7 @@ create view v1 (a) as select f1()|
select * from v1|
a
3
-select id, a from t1, v1|
+select id, a from t1, v1 order by id|
id a
a 3
b 3
@@ -1027,7 +1027,7 @@ create view v2 (a) as select a*10 from v1|
select * from v2|
a
30
-select id, a from t1, v2|
+select id, a from t1, v2 order by id|
id a
a 30
b 30
@@ -1072,7 +1072,7 @@ lock tables t1 read, t1 as t11 read|
select f3()|
f3()
1
-select id, f3() from t1 as t11|
+select id, f3() from t1 as t11 order by id|
id f3()
a 1
b 1
@@ -1175,8 +1175,8 @@ drop function f12_2|
drop view v0|
drop view v1|
drop view v2|
-delete from t1 |
-delete from t2 |
+truncate table t1 |
+truncate table t2 |
drop table t4|
drop table if exists t3|
create table t3 (n int unsigned not null primary key, f bigint unsigned)|
@@ -1355,7 +1355,7 @@ f
1
1
2
-delete from t3|
+truncate table t3|
insert into t3 values (0), (1)|
call fib(10)|
select * from t3 order by f asc|
@@ -1814,7 +1814,7 @@ delete from t1|
call bug822('foo', 42)|
call bug822('foo', 42)|
call bug822('bar', 666)|
-select * from t1|
+select * from t1 order by data|
id data
foo 42
bar 666
@@ -1837,7 +1837,7 @@ delete from t1 where id='foo'|
insert into t1 values ('bar', 7)|
call bug1495()|
delete from t1 where id='bar'|
-select * from t1|
+select * from t1 order by data|
id data
less 2
more 17
@@ -1857,10 +1857,10 @@ end|
insert into t1 values ("foo", 12), ("bar", 7)|
call bug1547("foo")|
call bug1547("bar")|
-select * from t1|
+select * from t1 order by id|
id data
-foo 12
bar 7
+foo 12
less 2
more 17
delete from t1|
@@ -1908,12 +1908,12 @@ insert into t2 values ("avg", 0, y);
end|
insert into t1 (data) values (3), (1), (5), (9), (4)|
call bug1874()|
-select * from t2|
+select * from t2 order by i|
s i d
-max 9 0
+avg 0 4.4
min 1 0
+max 9 0
sum 22 0
-avg 0 4.4
delete from t1|
delete from t2|
drop procedure bug1874|
@@ -2062,7 +2062,7 @@ drop procedure bug2776_2|
create table t3 (s1 smallint)|
insert into t3 values (123456789012)|
Warnings:
-Warning 1264 Out of range value adjusted for column 's1' at row 1
+Warning 1264 Out of range value for column 's1' at row 1
drop procedure if exists bug2780|
create procedure bug2780()
begin
@@ -2389,7 +2389,7 @@ create table t3 as select bug2773()|
show create table t3|
Table Create Table
t3 CREATE TABLE `t3` (
- `bug2773()` int(11) default NULL
+ `bug2773()` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t3|
drop function bug2773|
@@ -2450,7 +2450,7 @@ tinyint 1 -128 127 0 0 YES YES NO YES YES NO NULL,0 A very small integer
tinyint unsigned 1 0 255 0 0 YES YES YES YES YES NO NULL,0 A very small integer
Table Create Table
t1 CREATE TABLE `t1` (
- `id` char(16) NOT NULL default '',
+ `id` char(16) NOT NULL DEFAULT '',
`data` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
Database Create Database
@@ -2472,6 +2472,7 @@ Create view Tables To create new views
Create user Server Admin To create new users
Delete Tables To delete existing rows
Drop Databases,Tables To drop databases, tables, and views
+Event Server Admin To create, alter, drop and execute events
Execute Functions,Procedures To execute stored routines
File File access on server To read and write files on the server
Grant option Databases,Tables,Functions,Procedures To give to other users those privileges you possess
@@ -2488,6 +2489,7 @@ Show databases Server Admin To see all databases with SHOW DATABASES
Show view Tables To see views with SHOW CREATE VIEW
Shutdown Server Admin To shut down the server
Super Server Admin To use KILL thread, SET GLOBAL, CHANGE MASTER, etc.
+Trigger Tables To use triggers
Update Tables To update existing rows
Usage Server Admin No privileges - allow connect only
Variable_name Value
@@ -2502,7 +2504,7 @@ tinyint 1 -128 127 0 0 YES YES NO YES YES NO NULL,0 A very small integer
tinyint unsigned 1 0 255 0 0 YES YES YES YES YES NO NULL,0 A very small integer
Table Create Table
t1 CREATE TABLE `t1` (
- `id` char(16) NOT NULL default '',
+ `id` char(16) NOT NULL DEFAULT '',
`data` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
Database Create Database
@@ -2524,6 +2526,7 @@ Create view Tables To create new views
Create user Server Admin To create new users
Delete Tables To delete existing rows
Drop Databases,Tables To drop databases, tables, and views
+Event Server Admin To create, alter, drop and execute events
Execute Functions,Procedures To execute stored routines
File File access on server To read and write files on the server
Grant option Databases,Tables,Functions,Procedures To give to other users those privileges you possess
@@ -2540,6 +2543,7 @@ Show databases Server Admin To see all databases with SHOW DATABASES
Show view Tables To see views with SHOW CREATE VIEW
Shutdown Server Admin To shut down the server
Super Server Admin To use KILL thread, SET GLOBAL, CHANGE MASTER, etc.
+Trigger Tables To use triggers
Update Tables To update existing rows
Usage Server Admin No privileges - allow connect only
Variable_name Value
@@ -3616,12 +3620,18 @@ call bug11333(10)|
drop procedure bug11333|
drop table t3|
drop function if exists bug9048|
-create function bug9048(f1 char binary) returns char binary
+create function bug9048(f1 char binary) returns char
begin
set f1= concat( 'hello', f1 );
return f1;
end|
drop function bug9048|
+create function bug9048(f1 char binary) returns char binary
+begin
+set f1= concat( 'hello', f1 );
+return f1;
+end|
+ERROR 42000: This version of MySQL doesn't yet support 'return value collation'
drop procedure if exists bug12849_1|
create procedure bug12849_1(inout x char) select x into x|
set @var='a'|
@@ -3708,7 +3718,7 @@ begin
select bug12379();
end|
select bug12379()|
-ERROR 23000: Duplicate entry 'X' for key 1
+ERROR 23000: Duplicate entry 'X' for key 'PRIMARY'
select 1|
1
1
@@ -3725,7 +3735,7 @@ select 3|
3
3
call bug12379_3()|
-ERROR 23000: Duplicate entry 'X' for key 1
+ERROR 23000: Duplicate entry 'X' for key 'PRIMARY'
select 4|
4
4
@@ -3780,7 +3790,7 @@ s1
0
1
call bug6127()|
-ERROR 23000: Duplicate entry '0' for key 1
+ERROR 23000: Duplicate entry '0' for key 's1'
select * from t3|
s1
0
@@ -3819,20 +3829,20 @@ end|
call bug12589_1()|
Table Create Table
tm1 CREATE TEMPORARY TABLE `tm1` (
- `spv1` decimal(3,3) default NULL
+ `spv1` decimal(3,3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
Warnings:
-Warning 1264 Out of range value adjusted for column 'spv1' at row 1
+Warning 1264 Out of range value for column 'spv1' at row 1
Warning 1366 Incorrect decimal value: 'test' for column 'spv1' at row 1
call bug12589_2()|
Table Create Table
tm1 CREATE TEMPORARY TABLE `tm1` (
- `spv1` decimal(6,3) default NULL
+ `spv1` decimal(6,3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
call bug12589_3()|
Table Create Table
tm1 CREATE TEMPORARY TABLE `tm1` (
- `spv1` decimal(6,3) default NULL
+ `spv1` decimal(6,3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop procedure bug12589_1|
drop procedure bug12589_2|
@@ -4070,7 +4080,7 @@ select res;
end|
create table t3 (a int)|
insert into t3 values (0)|
-create view v1 as select a from t3;
+create view v1 as select a from t3|
create procedure bug10100pt(level int, lim int)
begin
if level < lim then
@@ -4091,7 +4101,7 @@ else
select * from v1;
end if;
end|
-prepare stmt2 from "select * from t3;";
+prepare stmt2 from "select * from t3;"|
create procedure bug10100pd(level int, lim int)
begin
if level < lim then
@@ -4418,6 +4428,8 @@ test.t3 analyze status Table is already up to date
test.v1 analyze error 'test.v1' is not BASE TABLE
Warnings:
Error 1347 'test.v1' is not BASE TABLE
+Error 1347 'test.v1' is not BASE TABLE
+Error 1347 'test.v1' is not BASE TABLE
call bug13012()|
Table Op Msg_type Msg_text
test.t1 repair status OK
@@ -4436,6 +4448,8 @@ test.t3 analyze status Table is already up to date
test.v1 analyze error 'test.v1' is not BASE TABLE
Warnings:
Error 1347 'test.v1' is not BASE TABLE
+Error 1347 'test.v1' is not BASE TABLE
+Error 1347 'test.v1' is not BASE TABLE
call bug13012()|
Table Op Msg_type Msg_text
test.t1 repair status OK
@@ -4454,9 +4468,11 @@ test.t3 analyze status Table is already up to date
test.v1 analyze error 'test.v1' is not BASE TABLE
Warnings:
Error 1347 'test.v1' is not BASE TABLE
+Error 1347 'test.v1' is not BASE TABLE
+Error 1347 'test.v1' is not BASE TABLE
drop procedure bug13012|
-drop view v1;
-select * from t1|
+drop view v1|
+select * from t1 order by data|
id data
aa 0
aa 1
@@ -4786,22 +4802,6 @@ i
0
drop table t3|
drop procedure bug16887|
-create table t3 (f1 int, f2 varchar(3), primary key(f1)) engine=innodb|
-insert into t3 values (1,'aaa'),(2,'bbb'),(3,'ccc')|
-CREATE FUNCTION bug13575 ( p1 integer )
-returns varchar(3)
-BEGIN
-DECLARE v1 VARCHAR(10) DEFAULT null;
-SELECT f2 INTO v1 FROM t3 WHERE f1 = p1;
-RETURN v1;
-END|
-select distinct f1, bug13575(f1) from t3 order by f1|
-f1 bug13575(f1)
-1 aaa
-2 bbb
-3 ccc
-drop function bug13575;
-drop table t3|
drop procedure if exists bug16474_1|
drop procedure if exists bug16474_2|
delete from t1|
@@ -4809,7 +4809,7 @@ insert into t1 values ('c', 2), ('b', 3), ('a', 1)|
create procedure bug16474_1()
begin
declare x int;
-select id from t1 order by x;
+select id from t1 order by x, id;
end|
drop procedure if exists bug14945|
create table t3 (id int not null auto_increment primary key)|
@@ -4823,30 +4823,30 @@ id
drop table t3|
drop procedure bug14945|
create procedure bug16474_2(x int)
-select id from t1 order by x|
+select id from t1 order by x, id|
call bug16474_1()|
id
-c
-b
a
+b
+c
call bug16474_2(1)|
id
-c
-b
a
+b
+c
call bug16474_2(2)|
id
-c
-b
a
+b
+c
drop procedure bug16474_1|
drop procedure bug16474_2|
set @x = 2|
-select * from t1 order by @x|
+select * from t1 order by @x, data|
id data
+a 1
c 2
b 3
-a 1
delete from t1|
drop function if exists bug15728|
drop table if exists t3|
@@ -4908,7 +4908,7 @@ create table t3 as select bug12472() as i|
show create table t3|
Table Create Table
t3 CREATE TABLE `t3` (
- `i` int(11) default NULL
+ `i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t3|
i
@@ -4919,7 +4919,7 @@ create table t3 as select * from v1|
show create table t3|
Table Create Table
t3 CREATE TABLE `t3` (
- `j` int(11) default NULL
+ `j` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t3|
j
@@ -5407,7 +5407,7 @@ drop database if exists това_е_дълго_име_за_база_данни_
create database това_е_дълго_име_за_база_данни_нали|
INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','')|
call това_е_дълго_име_за_база_данни_нали.това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго()|
-ERROR HY000: Failed to load routine това_е_дълго_име_за_база_данни_нали.това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6)
+ERROR HY000: Failed to load routine това_е_дълго_име_за_база_данни_нали.. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6)
drop database това_е_дълго_име_за_база_данни_нали|
CREATE TABLE t3 (
Member_ID varchar(15) NOT NULL,
diff --git a/mysql-test/r/sp_notembedded.result b/mysql-test/r/sp_notembedded.result
index 60e427e17a5..0b1fa565d28 100644
--- a/mysql-test/r/sp_notembedded.result
+++ b/mysql-test/r/sp_notembedded.result
@@ -23,17 +23,6 @@ call bug4902_2()|
Id User Host db Command Time State Info
# root localhost test Query # NULL show processlist
drop procedure bug4902_2|
-drop function if exists bug5278|
-create function bug5278 () returns char
-begin
-SET PASSWORD FOR 'bob'@'%.loc.gov' = PASSWORD('newpass');
-return 'okay';
-end|
-select bug5278()|
-ERROR 42000: Can't find any matching row in the user table
-select bug5278()|
-ERROR 42000: Can't find any matching row in the user table
-drop function bug5278|
drop table if exists t1|
create table t1 (
id char(16) not null default '',
diff --git a/mysql-test/r/sp_trans.result b/mysql-test/r/sp_trans.result
index 564e31c9e32..bf4c478677b 100644
--- a/mysql-test/r/sp_trans.result
+++ b/mysql-test/r/sp_trans.result
@@ -82,7 +82,7 @@ end if;
return i;
end|
insert into t1 values (bug10015_5(4)), (bug10015_5(5))|
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t1|
id
1
@@ -530,3 +530,29 @@ count(*)
drop table t3, t4|
drop procedure bug14210|
set @@session.max_heap_table_size=default|
+CREATE DATABASE db_bug7787|
+use db_bug7787|
+CREATE PROCEDURE p1()
+SHOW INNODB STATUS; |
+Warnings:
+Warning 1541 The syntax 'SHOW INNODB STATUS' is deprecated and will be removed in MySQL 5.2. Please use 'SHOW ENGINE INNODB STATUS' instead
+GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost|
+DROP DATABASE db_bug7787|
+drop user user_bug7787@localhost|
+use test|
+create table t3 (f1 int, f2 varchar(3), primary key(f1)) engine=innodb|
+insert into t3 values (1,'aaa'),(2,'bbb'),(3,'ccc')|
+CREATE FUNCTION bug13575 ( p1 integer )
+returns varchar(3)
+BEGIN
+DECLARE v1 VARCHAR(10) DEFAULT null;
+SELECT f2 INTO v1 FROM t3 WHERE f1 = p1;
+RETURN v1;
+END|
+select distinct f1, bug13575(f1) from t3 order by f1|
+f1 bug13575(f1)
+1 aaa
+2 bbb
+3 ccc
+drop function bug13575|
+drop table t3|
diff --git a/mysql-test/r/sql_mode.result b/mysql-test/r/sql_mode.result
index 474659f7dfc..c7be653ca2e 100644
--- a/mysql-test/r/sql_mode.result
+++ b/mysql-test/r/sql_mode.result
@@ -14,11 +14,11 @@ sql_mode
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL auto_increment,
- `pseudo` varchar(35) character set latin2 NOT NULL default '',
- `email` varchar(60) character set latin2 NOT NULL default '',
- PRIMARY KEY (`a`),
- UNIQUE KEY `email` USING BTREE (`email`)
+ `a` int(11) NOT NULL AUTO_INCREMENT,
+ `pseudo` varchar(35) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `email` varchar(60) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ PRIMARY KEY (`a`),
+ UNIQUE KEY `email` (`email`) USING BTREE
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
set @@sql_mode="ansi_quotes";
show variables like 'sql_mode';
@@ -27,11 +27,11 @@ sql_mode ANSI_QUOTES
show create table t1;
Table Create Table
t1 CREATE TABLE "t1" (
- "a" int(11) NOT NULL auto_increment,
- "pseudo" varchar(35) character set latin2 NOT NULL default '',
- "email" varchar(60) character set latin2 NOT NULL default '',
- PRIMARY KEY ("a"),
- UNIQUE KEY "email" USING BTREE ("email")
+ "a" int(11) NOT NULL AUTO_INCREMENT,
+ "pseudo" varchar(35) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ "email" varchar(60) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ PRIMARY KEY ("a"),
+ UNIQUE KEY "email" ("email") USING BTREE
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
set @@sql_mode="no_table_options";
show variables like 'sql_mode';
@@ -40,11 +40,11 @@ sql_mode NO_TABLE_OPTIONS
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL auto_increment,
- `pseudo` varchar(35) character set latin2 NOT NULL default '',
- `email` varchar(60) character set latin2 NOT NULL default '',
- PRIMARY KEY (`a`),
- UNIQUE KEY `email` USING BTREE (`email`)
+ `a` int(11) NOT NULL AUTO_INCREMENT,
+ `pseudo` varchar(35) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `email` varchar(60) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ PRIMARY KEY (`a`),
+ UNIQUE KEY `email` (`email`) USING BTREE
)
set @@sql_mode="no_key_options";
show variables like 'sql_mode';
@@ -53,10 +53,10 @@ sql_mode NO_KEY_OPTIONS
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL auto_increment,
- `pseudo` varchar(35) character set latin2 NOT NULL default '',
- `email` varchar(60) character set latin2 NOT NULL default '',
- PRIMARY KEY (`a`),
+ `a` int(11) NOT NULL AUTO_INCREMENT,
+ `pseudo` varchar(35) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ `email` varchar(60) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ PRIMARY KEY (`a`),
UNIQUE KEY `email` (`email`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
set @@sql_mode="no_field_options,mysql323,mysql40";
@@ -67,9 +67,9 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
- `pseudo` varchar(35) NOT NULL default '',
- `email` varchar(60) NOT NULL default '',
- PRIMARY KEY (`a`),
+ `pseudo` varchar(35) NOT NULL DEFAULT '',
+ `email` varchar(60) NOT NULL DEFAULT '',
+ PRIMARY KEY (`a`),
UNIQUE KEY `email` (`email`)
) TYPE=HEAP ROW_FORMAT=DYNAMIC
set sql_mode="postgresql,oracle,mssql,db2,maxdb";
@@ -80,9 +80,9 @@ show create table t1;
Table Create Table
t1 CREATE TABLE "t1" (
"a" int(11) NOT NULL,
- "pseudo" varchar(35) character set latin2 NOT NULL default '',
- "email" varchar(60) character set latin2 NOT NULL default '',
- PRIMARY KEY ("a"),
+ "pseudo" varchar(35) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ "email" varchar(60) CHARACTER SET latin2 NOT NULL DEFAULT '',
+ PRIMARY KEY ("a"),
UNIQUE KEY "email" ("email")
)
drop table t1;
@@ -95,25 +95,25 @@ set @@sql_mode="";
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(10) default NULL,
- `b` char(10) character set latin1 collate latin1_bin default NULL,
- `c` binary(10) default NULL
+ `a` char(10) DEFAULT NULL,
+ `b` char(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
+ `c` binary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
set @@sql_mode="mysql323";
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(10) default NULL,
- `b` char(10) binary default NULL,
- `c` binary(10) default NULL
+ `a` char(10) DEFAULT NULL,
+ `b` char(10) binary DEFAULT NULL,
+ `c` binary(10) DEFAULT NULL
) TYPE=MyISAM
set @@sql_mode="mysql40";
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(10) default NULL,
- `b` char(10) binary default NULL,
- `c` binary(10) default NULL
+ `a` char(10) DEFAULT NULL,
+ `b` char(10) binary DEFAULT NULL,
+ `c` binary(10) DEFAULT NULL
) TYPE=MyISAM
drop table t1;
set session sql_mode = '';
@@ -121,7 +121,7 @@ create table t1 ( min_num dec(6,6) default .000001);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `min_num` decimal(6,6) default '0.000001'
+ `min_num` decimal(6,6) DEFAULT '0.000001'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1 ;
set session sql_mode = 'IGNORE_SPACE';
@@ -129,14 +129,14 @@ create table t1 ( min_num dec(6,6) default 0.000001);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `min_num` decimal(6,6) default '0.000001'
+ `min_num` decimal(6,6) DEFAULT '0.000001'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1 ;
create table t1 ( min_num dec(6,6) default .000001);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `min_num` decimal(6,6) default '0.000001'
+ `min_num` decimal(6,6) DEFAULT '0.000001'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1 ;
set @@SQL_MODE=NULL;
@@ -148,17 +148,17 @@ f2 timestamp default current_timestamp on update current_timestamp);
show create table t1;
Table Create Table
t1 CREATE TABLE "t1" (
- "f1" int(11) NOT NULL auto_increment,
- "f2" timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
- PRIMARY KEY ("f1")
+ "f1" int(11) NOT NULL AUTO_INCREMENT,
+ "f2" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY ("f1")
)
set session sql_mode=no_field_options;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL,
- `f2` timestamp NOT NULL default CURRENT_TIMESTAMP,
- PRIMARY KEY (`f1`)
+ `f2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`f1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='';
@@ -423,24 +423,6 @@ a\b a\"b a'\b a'\"b
SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b";
a\b a\'b a"\b a"\'b
a\b a\'b a"\b a"\'b
-set session sql_mode = 'NO_ENGINE_SUBSTITUTION';
-create table t1 (a int) engine=isam;
-ERROR HY000: The 'ISAM' feature is disabled; you need MySQL built with 'ISAM' to have it working
-show create table t1;
-ERROR 42S02: Table 'test.t1' doesn't exist
-drop table if exists t1;
-Warnings:
-Note 1051 Unknown table 't1'
-set session sql_mode = '';
-create table t1 (a int) engine=isam;
-Warnings:
-Warning 1266 Using storage engine MyISAM for table 't1'
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-drop table t1;
SET @@SQL_MODE='';
create function `foo` () returns int return 5;
show create function `foo`;
diff --git a/mysql-test/r/ssl.result b/mysql-test/r/ssl.result
index cd8bf52139e..924300b0172 100644
--- a/mysql-test/r/ssl.result
+++ b/mysql-test/r/ssl.result
@@ -145,9 +145,9 @@ explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 ignore index (fld3,not_used);
-ERROR HY000: Key 'not_used' doesn't exist in table 't2'
+ERROR 42000: Key 'not_used' doesn't exist in table 't2'
explain select fld3 from t2 use index (not_used);
-ERROR HY000: Key 'not_used' doesn't exist in table 't2'
+ERROR 42000: Key 'not_used' doesn't exist in table 't2'
select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
fld3
honeysuckle
@@ -1505,8 +1505,8 @@ select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1)
count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
70 absentee vest 17788966 254128.0857 3272.5940 10709871.3069
explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>"";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where
Warnings:
Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> _latin1''))
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
diff --git a/mysql-test/r/ssl_compress.result b/mysql-test/r/ssl_compress.result
index 78e83dabdd5..e6066b11ed1 100644
--- a/mysql-test/r/ssl_compress.result
+++ b/mysql-test/r/ssl_compress.result
@@ -148,9 +148,9 @@ explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 ignore index (fld3,not_used);
-ERROR HY000: Key 'not_used' doesn't exist in table 't2'
+ERROR 42000: Key 'not_used' doesn't exist in table 't2'
explain select fld3 from t2 use index (not_used);
-ERROR HY000: Key 'not_used' doesn't exist in table 't2'
+ERROR 42000: Key 'not_used' doesn't exist in table 't2'
select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
fld3
honeysuckle
@@ -1508,8 +1508,8 @@ select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1)
count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
70 absentee vest 17788966 254128.0857 3272.5940 10709871.3069
explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>"";
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where
Warnings:
Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> _latin1''))
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
diff --git a/mysql-test/r/status.result b/mysql-test/r/status.result
index ca21b333a6a..e9891e4d495 100644
--- a/mysql-test/r/status.result
+++ b/mysql-test/r/status.result
@@ -3,6 +3,10 @@ show status like 'Table_lock%';
Variable_name Value
Table_locks_immediate 0
Table_locks_waited 0
+select * from information_schema.session_status where variable_name like 'Table_lock%';
+VARIABLE_NAME VARIABLE_VALUE
+TABLE_LOCKS_IMMEDIATE 0.0000000
+TABLE_LOCKS_WAITED 0.0000000
SET SQL_LOG_BIN=0;
drop table if exists t1;
create table t1(n int) engine=myisam;
@@ -16,6 +20,10 @@ show status like 'Table_lock%';
Variable_name Value
Table_locks_immediate 3
Table_locks_waited 1
+select * from information_schema.session_status where variable_name like 'Table_lock%';
+VARIABLE_NAME VARIABLE_VALUE
+TABLE_LOCKS_IMMEDIATE 3.0000000
+TABLE_LOCKS_WAITED 1.0000000
drop table t1;
select 1;
1
@@ -23,23 +31,88 @@ select 1;
show status like 'last_query_cost';
Variable_name Value
Last_query_cost 0.000000
+create table t1 (a int);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+select * from t1 where a=6;
+a
+6
+6
+6
+6
+6
+show status like 'last_query_cost';
+Variable_name Value
+Last_query_cost 12.084449
+show status like 'last_query_cost';
+Variable_name Value
+Last_query_cost 12.084449
+select 1;
+1
+1
+show status like 'last_query_cost';
+Variable_name Value
+Last_query_cost 0.000000
+drop table t1;
FLUSH STATUS;
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections 1
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
+VARIABLE_NAME VARIABLE_VALUE
+MAX_USED_CONNECTIONS 1.0000000
SET @save_thread_cache_size=@@thread_cache_size;
SET GLOBAL thread_cache_size=3;
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections 3
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
+VARIABLE_NAME VARIABLE_VALUE
+MAX_USED_CONNECTIONS 3.0000000
FLUSH STATUS;
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections 2
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
+VARIABLE_NAME VARIABLE_VALUE
+MAX_USED_CONNECTIONS 2.0000000
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections 3
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
+VARIABLE_NAME VARIABLE_VALUE
+MAX_USED_CONNECTIONS 3.0000000
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections 4
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
+VARIABLE_NAME VARIABLE_VALUE
+MAX_USED_CONNECTIONS 4.0000000
SET GLOBAL thread_cache_size=@save_thread_cache_size;
+show status like 'com_show_status';
+Variable_name Value
+Com_show_status 3
+show status like 'hand%write%';
+Variable_name Value
+Handler_write 0
+show status like '%tmp%';
+Variable_name Value
+Created_tmp_disk_tables 0
+Created_tmp_files 0
+Created_tmp_tables 0
+show status like 'hand%write%';
+Variable_name Value
+Handler_write 0
+show status like '%tmp%';
+Variable_name Value
+Created_tmp_disk_tables 0
+Created_tmp_files 0
+Created_tmp_tables 0
+show status like 'com_show_status';
+Variable_name Value
+Com_show_status 8
+rnd_diff tmp_table_diff
+20 8
diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result
index 702fc68bb25..0e21ff80e29 100644
--- a/mysql-test/r/strict.result
+++ b/mysql-test/r/strict.result
@@ -259,58 +259,58 @@ INSERT INTO t1 (col1) VALUES (CAST('2004-10-15' AS DATE));
INSERT INTO t1 (col2) VALUES (CAST('2004-10-15 10:15' AS DATETIME));
INSERT INTO t1 (col3) VALUES (CAST('2004-10-15 10:15' AS DATETIME));
INSERT INTO t1 (col1) VALUES(CAST('0000-10-31' AS DATE));
-ERROR 22007: Truncated incorrect datetime value: '0000-10-31'
+ERROR 22007: Incorrect datetime value: '0000-10-31'
INSERT INTO t1 (col1) VALUES(CAST('2004-10-0' AS DATE));
ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CAST('2004-0-10' AS DATE));
ERROR 22007: Incorrect date value: '2004-00-10' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CAST('0000-00-00' AS DATE));
-ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
+ERROR 22007: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
-ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30'
+ERROR 22007: Incorrect datetime value: '0000-10-31 15:30'
INSERT INTO t1 (col2) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME));
-ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
+ERROR 22007: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col3) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
-ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30'
+ERROR 22007: Incorrect datetime value: '0000-10-31 15:30'
INSERT INTO t1 (col3) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(CAST('0000-00-00' AS DATETIME));
-ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
+ERROR 22007: Incorrect datetime value: '0000-00-00'
drop table t1;
CREATE TABLE t1 (col1 date, col2 datetime, col3 timestamp);
INSERT INTO t1 (col1) VALUES (CONVERT('2004-10-15',DATE));
INSERT INTO t1 (col2) VALUES (CONVERT('2004-10-15 10:15',DATETIME));
INSERT INTO t1 (col3) VALUES (CONVERT('2004-10-15 10:15',DATETIME));
INSERT INTO t1 (col1) VALUES(CONVERT('0000-10-31' , DATE));
-ERROR 22007: Truncated incorrect datetime value: '0000-10-31'
+ERROR 22007: Incorrect datetime value: '0000-10-31'
INSERT INTO t1 (col1) VALUES(CONVERT('2004-10-0' , DATE));
ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CONVERT('2004-0-10' , DATE));
ERROR 22007: Incorrect date value: '2004-00-10' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE));
-ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
+ERROR 22007: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
-ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30'
+ERROR 22007: Incorrect datetime value: '0000-10-31 15:30'
INSERT INTO t1 (col2) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME));
-ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
+ERROR 22007: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col3) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
-ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30'
+ERROR 22007: Incorrect datetime value: '0000-10-31 15:30'
INSERT INTO t1 (col3) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(CONVERT('0000-00-00',DATETIME));
-ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
+ERROR 22007: Incorrect datetime value: '0000-00-00'
drop table t1;
CREATE TABLE t1(col1 TINYINT, col2 TINYINT UNSIGNED);
INSERT INTO t1 VALUES(-128,0),(0,0),(127,255),('-128','0'),('0','0'),('127','255'),(-128.0,0.0),(0.0,0.0),(127.0,255.0);
@@ -322,36 +322,36 @@ Warnings:
Error 1365 Division by 0
Error 1365 Division by 0
INSERT INTO t1 (col1) VALUES(-129);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(128);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES(-1);
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(256);
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col1) VALUES('-129');
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES('128');
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES('-1');
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES('256');
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col1) VALUES(128.0);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES(-1.0);
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(256.0);
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
SELECT MOD(col1,0) FROM t1 WHERE col1 > 0 LIMIT 1;
MOD(col1,0)
NULL
Warnings:
Error 1365 Division by 0
UPDATE t1 SET col1 = col1 - 50 WHERE col1 < 0;
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
UPDATE t1 SET col2=col2 + 50 WHERE col2 > 0;
-ERROR 22003: Out of range value adjusted for column 'col2' at row 3
+ERROR 22003: Out of range value for column 'col2' at row 3
UPDATE t1 SET col1=col1 / 0 WHERE col1 > 0;
ERROR 22012: Division by 0
set @@sql_mode='ERROR_FOR_DIVISION_BY_ZERO';
@@ -385,16 +385,16 @@ INSERT INTO t1 values (1/0,1/0);
set @@sql_mode='ansi,traditional';
INSERT IGNORE INTO t1 VALUES('-129','-1'),('128','256');
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col2' at row 1
-Warning 1264 Out of range value adjusted for column 'col1' at row 2
-Warning 1264 Out of range value adjusted for column 'col2' at row 2
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col2' at row 1
+Warning 1264 Out of range value for column 'col1' at row 2
+Warning 1264 Out of range value for column 'col2' at row 2
INSERT IGNORE INTO t1 VALUES(-129.0,-1.0),(128.0,256.0);
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col2' at row 1
-Warning 1264 Out of range value adjusted for column 'col1' at row 2
-Warning 1264 Out of range value adjusted for column 'col2' at row 2
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col2' at row 1
+Warning 1264 Out of range value for column 'col1' at row 2
+Warning 1264 Out of range value for column 'col2' at row 2
UPDATE IGNORE t1 SET col2=1/NULL where col1=0;
SELECT * FROM t1;
col1 col2
@@ -419,33 +419,33 @@ DROP TABLE t1;
CREATE TABLE t1(col1 SMALLINT, col2 SMALLINT UNSIGNED);
INSERT INTO t1 VALUES(-32768,0),(0,0),(32767,65535),('-32768','0'),('32767','65535'),(-32768.0,0.0),(32767.0,65535.0);
INSERT INTO t1 (col1) VALUES(-32769);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(32768);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES(-1);
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(65536);
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col1) VALUES('-32769');
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES('32768');
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES('-1');
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES('65536');
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col1) VALUES(-32769.0);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(32768.0);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES(-1.0);
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(65536.0);
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
UPDATE t1 SET col1 = col1 - 50 WHERE col1 < 0;
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
UPDATE t1 SET col2 = col2 + 50 WHERE col2 > 0;
-ERROR 22003: Out of range value adjusted for column 'col2' at row 3
+ERROR 22003: Out of range value for column 'col2' at row 3
UPDATE t1 SET col1 = col1 / 0 WHERE col1 > 0;
ERROR 22012: Division by 0
UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
@@ -465,22 +465,22 @@ Error 1365 Division by 0
Error 1365 Division by 0
INSERT IGNORE INTO t1 VALUES(-32769,-1),(32768,65536);
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col2' at row 1
-Warning 1264 Out of range value adjusted for column 'col1' at row 2
-Warning 1264 Out of range value adjusted for column 'col2' at row 2
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col2' at row 1
+Warning 1264 Out of range value for column 'col1' at row 2
+Warning 1264 Out of range value for column 'col2' at row 2
INSERT IGNORE INTO t1 VALUES('-32769','-1'),('32768','65536');
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col2' at row 1
-Warning 1264 Out of range value adjusted for column 'col1' at row 2
-Warning 1264 Out of range value adjusted for column 'col2' at row 2
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col2' at row 1
+Warning 1264 Out of range value for column 'col1' at row 2
+Warning 1264 Out of range value for column 'col2' at row 2
INSERT IGNORE INTO t1 VALUES(-32769,-1.0),(32768.0,65536.0);
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col2' at row 1
-Warning 1264 Out of range value adjusted for column 'col1' at row 2
-Warning 1264 Out of range value adjusted for column 'col2' at row 2
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col2' at row 1
+Warning 1264 Out of range value for column 'col1' at row 2
+Warning 1264 Out of range value for column 'col2' at row 2
UPDATE IGNORE t1 SET col2=1/NULL where col1=0;
SELECT * FROM t1;
col1 col2
@@ -503,33 +503,33 @@ DROP TABLE t1;
CREATE TABLE t1 (col1 MEDIUMINT, col2 MEDIUMINT UNSIGNED);
INSERT INTO t1 VALUES(-8388608,0),(0,0),(8388607,16777215),('-8388608','0'),('8388607','16777215'),(-8388608.0,0.0),(8388607.0,16777215.0);
INSERT INTO t1 (col1) VALUES(-8388609);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(8388608);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES(-1);
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(16777216);
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col1) VALUES('-8388609');
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES('8388608');
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES('-1');
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES('16777216');
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col1) VALUES(-8388609.0);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(8388608.0);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES(-1.0);
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(16777216.0);
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
UPDATE t1 SET col1 = col1 - 50 WHERE col1 < 0;
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
UPDATE t1 SET col2 = col2 + 50 WHERE col2 > 0;
-ERROR 22003: Out of range value adjusted for column 'col2' at row 3
+ERROR 22003: Out of range value for column 'col2' at row 3
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
ERROR 22012: Division by 0
UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
@@ -549,22 +549,22 @@ Error 1365 Division by 0
Error 1365 Division by 0
INSERT IGNORE INTO t1 VALUES(-8388609,-1),(8388608,16777216);
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col2' at row 1
-Warning 1264 Out of range value adjusted for column 'col1' at row 2
-Warning 1264 Out of range value adjusted for column 'col2' at row 2
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col2' at row 1
+Warning 1264 Out of range value for column 'col1' at row 2
+Warning 1264 Out of range value for column 'col2' at row 2
INSERT IGNORE INTO t1 VALUES('-8388609','-1'),('8388608','16777216');
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col2' at row 1
-Warning 1264 Out of range value adjusted for column 'col1' at row 2
-Warning 1264 Out of range value adjusted for column 'col2' at row 2
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col2' at row 1
+Warning 1264 Out of range value for column 'col1' at row 2
+Warning 1264 Out of range value for column 'col2' at row 2
INSERT IGNORE INTO t1 VALUES(-8388609.0,-1.0),(8388608.0,16777216.0);
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col2' at row 1
-Warning 1264 Out of range value adjusted for column 'col1' at row 2
-Warning 1264 Out of range value adjusted for column 'col2' at row 2
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col2' at row 1
+Warning 1264 Out of range value for column 'col1' at row 2
+Warning 1264 Out of range value for column 'col2' at row 2
UPDATE IGNORE t1 SET col2=1/NULL where col1=0;
SELECT * FROM t1;
col1 col2
@@ -587,33 +587,33 @@ DROP TABLE t1;
CREATE TABLE t1 (col1 INT, col2 INT UNSIGNED);
INSERT INTO t1 VALUES(-2147483648,0),(0,0),(2147483647,4294967295),('-2147483648','0'),('2147483647','4294967295'),(-2147483648.0,0.0),(2147483647.0,4294967295.0);
INSERT INTO t1 (col1) VALUES(-2147483649);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(2147643648);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES(-1);
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(4294967296);
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col1) VALUES('-2147483649');
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES('2147643648');
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES('-1');
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES('4294967296');
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col1) VALUES(-2147483649.0);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(2147643648.0);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES(-1.0);
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(4294967296.0);
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
UPDATE t1 SET col1 = col1 - 50 WHERE col1 < 0;
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
UPDATE t1 SET col2 =col2 + 50 WHERE col2 > 0;
-ERROR 22003: Out of range value adjusted for column 'col2' at row 3
+ERROR 22003: Out of range value for column 'col2' at row 3
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
ERROR 22012: Division by 0
UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
@@ -633,22 +633,22 @@ Error 1365 Division by 0
Error 1365 Division by 0
INSERT IGNORE INTO t1 values (-2147483649, -1),(2147643648,4294967296);
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col2' at row 1
-Warning 1264 Out of range value adjusted for column 'col1' at row 2
-Warning 1264 Out of range value adjusted for column 'col2' at row 2
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col2' at row 1
+Warning 1264 Out of range value for column 'col1' at row 2
+Warning 1264 Out of range value for column 'col2' at row 2
INSERT IGNORE INTO t1 values ('-2147483649', '-1'),('2147643648','4294967296');
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col2' at row 1
-Warning 1264 Out of range value adjusted for column 'col1' at row 2
-Warning 1264 Out of range value adjusted for column 'col2' at row 2
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col2' at row 1
+Warning 1264 Out of range value for column 'col1' at row 2
+Warning 1264 Out of range value for column 'col2' at row 2
INSERT IGNORE INTO t1 values (-2147483649.0, -1.0),(2147643648.0,4294967296.0);
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col2' at row 1
-Warning 1264 Out of range value adjusted for column 'col1' at row 2
-Warning 1264 Out of range value adjusted for column 'col2' at row 2
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col2' at row 1
+Warning 1264 Out of range value for column 'col1' at row 2
+Warning 1264 Out of range value for column 'col2' at row 2
UPDATE IGNORE t1 SET col2=1/NULL where col1=0;
SELECT * FROM t1;
col1 col2
@@ -673,29 +673,29 @@ INSERT INTO t1 VALUES(-9223372036854775808,0),(0,0),(9223372036854775807,1844674
INSERT INTO t1 VALUES('-9223372036854775808','0'),('9223372036854775807','18446744073709551615');
INSERT INTO t1 VALUES(-9223372036854774000.0,0.0),(9223372036854775700.0,1844674407370954000.0);
INSERT INTO t1 (col1) VALUES(-9223372036854775809);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(9223372036854775808);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES(-1);
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(18446744073709551616);
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col1) VALUES('-9223372036854775809');
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES('9223372036854775808');
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES('-1');
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES('18446744073709551616');
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col1) VALUES(-9223372036854785809.0);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(9223372036854785808.0);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES(-1.0);
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(18446744073709551616.0);
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
ERROR 22012: Division by 0
UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
@@ -715,22 +715,22 @@ Error 1365 Division by 0
Error 1365 Division by 0
INSERT IGNORE INTO t1 VALUES(-9223372036854775809,-1),(9223372036854775808,18446744073709551616);
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col2' at row 1
-Warning 1264 Out of range value adjusted for column 'col1' at row 2
-Warning 1264 Out of range value adjusted for column 'col2' at row 2
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col2' at row 1
+Warning 1264 Out of range value for column 'col1' at row 2
+Warning 1264 Out of range value for column 'col2' at row 2
INSERT IGNORE INTO t1 VALUES('-9223372036854775809','-1'),('9223372036854775808','18446744073709551616');
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col2' at row 1
-Warning 1264 Out of range value adjusted for column 'col1' at row 2
-Warning 1264 Out of range value adjusted for column 'col2' at row 2
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col2' at row 1
+Warning 1264 Out of range value for column 'col1' at row 2
+Warning 1264 Out of range value for column 'col2' at row 2
INSERT IGNORE INTO t1 VALUES(-9223372036854785809.0,-1.0),(9223372036854785808.0,18446744073709551616.0);
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col2' at row 1
-Warning 1264 Out of range value adjusted for column 'col1' at row 2
-Warning 1264 Out of range value adjusted for column 'col2' at row 2
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col2' at row 1
+Warning 1264 Out of range value for column 'col1' at row 2
+Warning 1264 Out of range value for column 'col2' at row 2
UPDATE IGNORE t1 SET col2=1/NULL where col1=0;
SELECT * FROM t1;
col1 col2
@@ -760,29 +760,29 @@ Warnings:
Note 1265 Data truncated for column 'col1' at row 2
Note 1265 Data truncated for column 'col1' at row 4
INSERT INTO t1 VALUES (101.55);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 VALUES (101);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 VALUES (-101.55);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 VALUES (1010.55);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 VALUES (1010);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 VALUES ('101.55');
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 VALUES ('101');
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 VALUES ('-101.55');
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 VALUES ('-1010.55');
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 VALUES ('-100E+1');
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 VALUES ('-100E');
ERROR HY000: Incorrect decimal value: '-100E' for column 'col1' at row 1
UPDATE t1 SET col1 =col1 * 50000 WHERE col1 =11;
-ERROR 22003: Out of range value adjusted for column 'col1' at row 6
+ERROR 22003: Out of range value for column 'col1' at row 6
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
ERROR 22012: Division by 0
UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
@@ -801,16 +801,16 @@ Warnings:
Error 1365 Division by 0
INSERT IGNORE INTO t1 VALUES(1000),(-1000);
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col1' at row 2
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col1' at row 2
INSERT IGNORE INTO t1 VALUES('1000'),('-1000');
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col1' at row 2
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col1' at row 2
INSERT IGNORE INTO t1 VALUES(1000.0),(-1000.0);
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col1' at row 2
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col1' at row 2
UPDATE IGNORE t1 SET col1=1/NULL where col1=0;
SELECT * FROM t1;
col1
@@ -841,15 +841,15 @@ INSERT INTO t1 VALUES (-1.1E-37,0),(+3.4E+38,+3.4E+38);
INSERT INTO t1 VALUES ('-1.1E-37',0),('+3.4E+38','+3.4E+38');
INSERT INTO t1 (col1) VALUES (3E-46);
INSERT INTO t1 (col1) VALUES (+3.4E+39);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES (-1.1E-3);
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col1) VALUES ('+3.4E+39');
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES ('-1.1E-3');
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
-ERROR 22003: Out of range value adjusted for column 'col1' at row 2
+ERROR 22003: Out of range value for column 'col1' at row 2
UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
ERROR 22012: Division by 0
UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
@@ -868,12 +868,12 @@ Warnings:
Error 1365 Division by 0
INSERT IGNORE INTO t1 VALUES (+3.4E+39,-3.4E+39);
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col2' at row 1
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col2' at row 1
INSERT IGNORE INTO t1 VALUES ('+3.4E+39','-3.4E+39');
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col2' at row 1
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col2' at row 1
SELECT * FROM t1;
col1 col2
-1.1e-37 0
@@ -893,13 +893,13 @@ INSERT INTO t1 (col1) VALUES (-2.2E-330);
INSERT INTO t1 (col1) VALUES (+1.7E+309);
Got one of the listed errors
INSERT INTO t1 (col2) VALUES (-1.1E-3);
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
INSERT INTO t1 (col1) VALUES ('+1.8E+309');
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES ('-1.2E-3');
-ERROR 22003: Out of range value adjusted for column 'col2' at row 1
+ERROR 22003: Out of range value for column 'col2' at row 1
UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
-ERROR 22003: Out of range value adjusted for column 'col1' at row 3
+ERROR 22003: Out of range value for column 'col1' at row 3
UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
ERROR 22012: Division by 0
UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
@@ -920,9 +920,9 @@ INSERT IGNORE INTO t1 VALUES (+1.9E+309,-1.9E+309);
ERROR 22007: Illegal double '1.9E+309' value found during parsing
INSERT IGNORE INTO t1 VALUES ('+2.0E+309','-2.0E+309');
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col2' at row 1
-Warning 1264 Out of range value adjusted for column 'col2' at row 1
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col2' at row 1
+Warning 1264 Out of range value for column 'col2' at row 1
SELECT * FROM t1;
col1 col2
-2.2e-307 0
@@ -997,16 +997,16 @@ ERROR 23000: Column 'col2' cannot be null
INSERT INTO t1 VALUES (103,'',NULL);
ERROR 23000: Column 'col3' cannot be null
UPDATE t1 SET col1=NULL WHERE col1 =100;
-ERROR 22004: Column was set to data type implicit default; NULL supplied for NOT NULL column 'col1' at row 1
+ERROR 23000: Column 'col1' cannot be null
UPDATE t1 SET col2 =NULL WHERE col2 ='hello';
-ERROR 22004: Column was set to data type implicit default; NULL supplied for NOT NULL column 'col2' at row 1
+ERROR 23000: Column 'col2' cannot be null
UPDATE t1 SET col2 =NULL where col3 IS NOT NULL;
-ERROR 22004: Column was set to data type implicit default; NULL supplied for NOT NULL column 'col2' at row 1
+ERROR 23000: Column 'col2' cannot be null
INSERT IGNORE INTO t1 values (NULL,NULL,NULL);
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'col1' at row 1
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'col2' at row 1
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'col3' at row 1
+Warning 1048 Column 'col1' cannot be null
+Warning 1048 Column 'col2' cannot be null
+Warning 1048 Column 'col3' cannot be null
SELECT * FROM t1;
col1 col2 col3
100 hello 2004-08-20
@@ -1017,7 +1017,7 @@ CREATE TABLE t1 (col1 INT NOT NULL default 99, col2 CHAR(6) NOT NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE "t1" (
- "col1" int(11) NOT NULL default '99',
+ "col1" int(11) NOT NULL DEFAULT '99',
"col2" char(6) NOT NULL
)
INSERT INTO t1 VALUES (1, 'hello');
@@ -1031,11 +1031,11 @@ ERROR HY000: Field 'col2' doesn't have a default value
INSERT INTO t1 (col1) SELECT 1;
ERROR HY000: Field 'col2' doesn't have a default value
INSERT INTO t1 SELECT 1,NULL;
-ERROR 22004: Column was set to data type implicit default; NULL supplied for NOT NULL column 'col2' at row 1
+ERROR 23000: Column 'col2' cannot be null
INSERT IGNORE INTO t1 values (NULL,NULL);
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'col1' at row 1
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'col2' at row 1
+Warning 1048 Column 'col1' cannot be null
+Warning 1048 Column 'col2' cannot be null
INSERT IGNORE INTO t1 (col1) values (3);
Warnings:
Warning 1364 Field 'col2' doesn't have a default value
@@ -1141,19 +1141,19 @@ ERROR 22007: Incorrect date value: '0' for column 'col1' at row 1
insert into t1 values (0.0,0.0,0.0);
ERROR 22007: Incorrect date value: '0' for column 'col1' at row 1
insert into t1 (col1) values (convert('0000-00-00',date));
-ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
+ERROR 22007: Incorrect datetime value: '0000-00-00'
insert into t1 (col1) values (cast('0000-00-00' as date));
-ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
+ERROR 22007: Incorrect datetime value: '0000-00-00'
set sql_mode='no_zero_date';
insert into t1 values (0,0,0);
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col2' at row 1
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col2' at row 1
Warning 1265 Data truncated for column 'col3' at row 1
insert into t1 values (0.0,0.0,0.0);
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col2' at row 1
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col2' at row 1
Warning 1265 Data truncated for column 'col3' at row 1
drop table t1;
set sql_mode='traditional';
@@ -1168,15 +1168,15 @@ Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
insert ignore into t1 (col1) values (cast('0000-00-00' as date));
Warnings:
-Warning 1292 Truncated incorrect datetime value: '0000-00-00'
+Warning 1292 Incorrect datetime value: '0000-00-00'
insert into t1 select * from t1;
ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1
alter table t1 modify col1 datetime;
ERROR 22007: Incorrect datetime value: '0000-00-00' for column 'col1' at row 1
alter ignore table t1 modify col1 datetime;
Warnings:
-Warning 1264 Out of range value adjusted for column 'col1' at row 1
-Warning 1264 Out of range value adjusted for column 'col1' at row 2
+Warning 1264 Out of range value for column 'col1' at row 1
+Warning 1264 Out of range value for column 'col1' at row 2
insert into t1 select * from t1;
ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'col1' at row 1
select * from t1;
@@ -1274,9 +1274,9 @@ alter table t1 add primary key(a);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL default '0',
- `b` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
- PRIMARY KEY (`a`)
+ `a` int(11) NOT NULL DEFAULT '0',
+ `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1(a int, b timestamp default 20050102030405);
@@ -1284,9 +1284,9 @@ alter table t1 add primary key(a);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL default '0',
- `b` timestamp NOT NULL default '2005-01-02 03:04:05',
- PRIMARY KEY (`a`)
+ `a` int(11) NOT NULL DEFAULT '0',
+ `b` timestamp NOT NULL DEFAULT '2005-01-02 03:04:05',
+ PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @@sql_mode='traditional';
@@ -1349,6 +1349,6 @@ comment '123456789*123456789*123456789*123456789*123456789*123456789*';
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(11) default NULL
+ `i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='123456789*123456789*123456789*123456789*123456789*123456789*'
drop table t1;
diff --git a/mysql-test/r/strict_autoinc_1myisam.result b/mysql-test/r/strict_autoinc_1myisam.result
index 5d3c2698cda..dcda74a19cd 100644
--- a/mysql-test/r/strict_autoinc_1myisam.result
+++ b/mysql-test/r/strict_autoinc_1myisam.result
@@ -6,21 +6,21 @@ primary key (`a`)
) engine = 'MYISAM' ;
set @@sql_mode='strict_all_tables';
insert into t1 values(1000);
-ERROR 22003: Out of range value adjusted for column 'a' at row 1
+ERROR 22003: Out of range value for column 'a' at row 1
select count(*) from t1;
count(*)
0
set auto_increment_increment=1000;
set auto_increment_offset=700;
insert into t1 values(null);
-ERROR 22003: Out of range value adjusted for column 'a' at row 1
+ERROR 22003: Out of range value for column 'a' at row 1
select count(*) from t1;
count(*)
0
set @@sql_mode=@org_mode;
insert into t1 values(null);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
a
127
diff --git a/mysql-test/r/strict_autoinc_2innodb.result b/mysql-test/r/strict_autoinc_2innodb.result
index f1936ff4de3..9e90ab886f3 100644
--- a/mysql-test/r/strict_autoinc_2innodb.result
+++ b/mysql-test/r/strict_autoinc_2innodb.result
@@ -6,21 +6,21 @@ primary key (`a`)
) engine = 'InnoDB' ;
set @@sql_mode='strict_all_tables';
insert into t1 values(1000);
-ERROR 22003: Out of range value adjusted for column 'a' at row 1
+ERROR 22003: Out of range value for column 'a' at row 1
select count(*) from t1;
count(*)
0
set auto_increment_increment=1000;
set auto_increment_offset=700;
insert into t1 values(null);
-ERROR 22003: Out of range value adjusted for column 'a' at row 1
+ERROR 22003: Out of range value for column 'a' at row 1
select count(*) from t1;
count(*)
0
set @@sql_mode=@org_mode;
insert into t1 values(null);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
a
127
diff --git a/mysql-test/r/strict_autoinc_3heap.result b/mysql-test/r/strict_autoinc_3heap.result
index aa0be270ac5..d22054eb59d 100644
--- a/mysql-test/r/strict_autoinc_3heap.result
+++ b/mysql-test/r/strict_autoinc_3heap.result
@@ -6,21 +6,21 @@ primary key (`a`)
) engine = 'MEMORY' ;
set @@sql_mode='strict_all_tables';
insert into t1 values(1000);
-ERROR 22003: Out of range value adjusted for column 'a' at row 1
+ERROR 22003: Out of range value for column 'a' at row 1
select count(*) from t1;
count(*)
0
set auto_increment_increment=1000;
set auto_increment_offset=700;
insert into t1 values(null);
-ERROR 22003: Out of range value adjusted for column 'a' at row 1
+ERROR 22003: Out of range value for column 'a' at row 1
select count(*) from t1;
count(*)
0
set @@sql_mode=@org_mode;
insert into t1 values(null);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
a
127
diff --git a/mysql-test/r/strict_autoinc_4bdb.result b/mysql-test/r/strict_autoinc_4bdb.result
index 73683b645e2..48ebe196baf 100644
--- a/mysql-test/r/strict_autoinc_4bdb.result
+++ b/mysql-test/r/strict_autoinc_4bdb.result
@@ -6,21 +6,21 @@ primary key (`a`)
) engine = 'BDB' ;
set @@sql_mode='strict_all_tables';
insert into t1 values(1000);
-ERROR 22003: Out of range value adjusted for column 'a' at row 1
+ERROR 22003: Out of range value for column 'a' at row 1
select count(*) from t1;
count(*)
0
set auto_increment_increment=1000;
set auto_increment_offset=700;
insert into t1 values(null);
-ERROR 22003: Out of range value adjusted for column 'a' at row 1
+ERROR 22003: Out of range value for column 'a' at row 1
select count(*) from t1;
count(*)
0
set @@sql_mode=@org_mode;
insert into t1 values(null);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
a
127
diff --git a/mysql-test/r/strict_autoinc_5ndb.result b/mysql-test/r/strict_autoinc_5ndb.result
index d0d62d05b32..debc7242e15 100644
--- a/mysql-test/r/strict_autoinc_5ndb.result
+++ b/mysql-test/r/strict_autoinc_5ndb.result
@@ -6,21 +6,21 @@ primary key (`a`)
) engine = 'NDB' ;
set @@sql_mode='strict_all_tables';
insert into t1 values(1000);
-ERROR 22003: Out of range value adjusted for column 'a' at row 1
+ERROR 22003: Out of range value for column 'a' at row 1
select count(*) from t1;
count(*)
0
set auto_increment_increment=1000;
set auto_increment_offset=700;
insert into t1 values(null);
-ERROR 22003: Out of range value adjusted for column 'a' at row 1
+ERROR 22003: Out of range value for column 'a' at row 1
select count(*) from t1;
count(*)
0
set @@sql_mode=@org_mode;
insert into t1 values(null);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
a
127
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index ec9fc2c307b..ecd9762dd24 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -3,8 +3,8 @@ select (select 2);
(select 2)
2
explain extended select (select 2);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1249 Select 2 was reduced during optimization
Note 1003 select 2 AS `(select 2)`
@@ -13,10 +13,10 @@ SELECT (SELECT 1) UNION SELECT (SELECT 2);
1
2
explain extended SELECT (SELECT 1) UNION SELECT (SELECT 2);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
-3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
-NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1249 Select 2 was reduced during optimization
Note 1249 Select 4 was reduced during optimization
@@ -25,11 +25,11 @@ SELECT (SELECT (SELECT 0 UNION SELECT 0));
(SELECT (SELECT 0 UNION SELECT 0))
0
explain extended SELECT (SELECT (SELECT 0 UNION SELECT 0));
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
-3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
-4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
-NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1249 Select 2 was reduced during optimization
Note 1003 select (select 0 AS `0` union select 0 AS `0`) AS `(SELECT (SELECT 0 UNION SELECT 0))`
@@ -43,10 +43,10 @@ SELECT (SELECT 1),MAX(1) FROM (SELECT 1) as a;
SELECT (SELECT a) as a;
ERROR 42S22: Reference 'a' not supported (forward reference in item list)
EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived2> system NULL NULL NULL NULL 1
-3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
-2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00
+3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1276 Field or reference 'a' of SELECT #3 was resolved in SELECT #1
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
@@ -181,12 +181,12 @@ a b
4 8
3 8
explain extended (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
-2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 Using filesort
-3 UNION t4 ALL NULL NULL NULL NULL 3 Using where
-4 SUBQUERY t2 ALL NULL NULL NULL NULL 2
-NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using filesort
+3 UNION t4 ALL NULL NULL NULL NULL 3 100.00 Using where
+4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
+NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` AS `a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) AS `max(t2.a)*4` from `test`.`t2`)) order by `a`)
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
@@ -199,10 +199,10 @@ select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
7 2
explain extended select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
(select * from t2 where a>1) as tt;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived3> system NULL NULL NULL NULL 1
-3 DERIVED t2 ALL NULL NULL NULL NULL 2 Using where
-2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 Using where; Using filesort
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived3> system NULL NULL NULL NULL 1 100.00
+3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort
Warnings:
Note 1003 select (select `test`.`t3`.`a` AS `a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
@@ -219,10 +219,10 @@ b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)
8 4.5000
9 7.5000
explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t4 ALL NULL NULL NULL NULL 3
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2
-3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
+3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1276 Field or reference 't4.a' of SELECT #3 was resolved in SELECT #1
Note 1003 select `test`.`t4`.`b` AS `b`,(select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) AS `min(t3.a)` from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) AS `avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a))` from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
@@ -267,9 +267,9 @@ a
6
7
explain extended select * from t3 where a >= any (select b from t2);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
-2 SUBQUERY t2 ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= (select min(`test`.`t2`.`b`) from `test`.`t2`)))
select * from t3 where a >= all (select b from t2);
@@ -307,11 +307,11 @@ select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)
NULL 1
2 2
explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 ALL NULL NULL NULL NULL 2
-2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1
-3 DEPENDENT UNION t5 ALL NULL NULL NULL NULL 2 Using where
-NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
+2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00
+3 DEPENDENT UNION t5 ALL NULL NULL NULL NULL 2 100.00 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 't2.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 't2.a' of SELECT #3 was resolved in SELECT #1
@@ -328,9 +328,9 @@ patient_uq clinic_uq
1 2
2 2
explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t6 ALL NULL NULL NULL NULL 4 Using where
-2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 Using index
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t6 ALL NULL NULL NULL NULL 4 100.00 Using where
+2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index
Warnings:
Note 1276 Field or reference 'clinic_uq' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where exists(select 1 AS `Not_used` from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`))
@@ -362,11 +362,11 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce','test');
INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1');
INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1');
EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 Using index
-4 SUBQUERY t8 const PRIMARY PRIMARY 37 1 Using index
-2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1
-3 SUBQUERY t8 const PRIMARY PRIMARY 37 1 Using index
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
+4 SUBQUERY t8 const PRIMARY PRIMARY 37 1 100.00 Using index
+2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00
+3 SUBQUERY t8 const PRIMARY PRIMARY 37 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t8`.`pseudo` AS `pseudo`,(select `test`.`t8`.`email` AS `email` from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
@@ -391,14 +391,14 @@ KEY `topic` (`topic`)
INSERT INTO t1 (topic,date,pseudo) VALUES
('43506','2002-10-02','joce'),('40143','2002-08-03','joce');
EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 Using where; Using index
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
Warnings:
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = 20020803)
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
-2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 Using where; Using index
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
Warnings:
Note 1003 select (select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = 20020803)) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
@@ -415,11 +415,11 @@ SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1;
SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1;
ERROR 21000: Subquery returns more than 1 row
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 index NULL topic 3 NULL 2 Using index
-2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
-3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
-NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 index NULL topic 3 NULL 2 100.00 Using index
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1003 select 1 AS `1` from `test`.`t1`
drop table t1;
@@ -538,14 +538,14 @@ INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
ERROR 21000: Subquery returns more than 1 row
EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = _latin1'1')
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 Using index
-2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = _latin1'1'))
drop table t1;
@@ -719,8 +719,8 @@ SELECT * FROM t2 WHERE id IN (SELECT 1);
id
1
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 ref id id 5 const 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 ref id id 5 const 1 100.00 Using where; Using index
Warnings:
Note 1249 Select 2 was reduced during optimization
Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = 1)
@@ -731,18 +731,18 @@ SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1));
id
2
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1));
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 ref id id 5 const 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 ref id id 5 const 1 100.00 Using where; Using index
Warnings:
Note 1249 Select 3 was reduced during optimization
Note 1249 Select 2 was reduced during optimization
Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = (1 + 1))
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 index NULL id 5 NULL 2 Using where; Using index
-2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
-3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
-NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 AS `1` having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 AS `3` having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3))))
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
@@ -865,8 +865,8 @@ select 10.5 > ANY (SELECT * from t1);
10.5 > ANY (SELECT * from t1)
1
explain extended select (select a+1) from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1276 Field or reference 'a' of SELECT #2 was resolved in SELECT #1
Note 1249 Select 2 was reduced during optimization
@@ -888,9 +888,9 @@ a t1.a in (select t2.a from t2)
3 1
4 0
explain extended SELECT t1.a, t1.a in (select t2.a from t2) FROM t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery a a 5 func 2 Using index
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
+2 DEPENDENT SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL))) AS `t1.a in (select t2.a from t2)` from `test`.`t1`
CREATE TABLE t3 (a int(11) default '0');
@@ -902,10 +902,10 @@ a t1.a in (select t2.a from t2,t3 where t3.a=t2.a)
3 1
4 0
explain extended SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 Using index
-2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 Using where; Using index
-2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
+2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
drop table t1,t2,t3;
@@ -1015,21 +1015,21 @@ i
drop table t1;
CREATE TABLE t1 (a int(1));
EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
-2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
Note 1003 select (select rand() AS `RAND()` from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1`
EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
-2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
Note 1003 select (select encrypt(_latin1'test') AS `ENCRYPT('test')` from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
-2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
Note 1003 select (select benchmark(1,1) AS `BENCHMARK(1,1)` from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1`
drop table t1;
@@ -1087,24 +1087,24 @@ CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT 1)) a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL default '0',
- `(SELECT 1)` int(1) NOT NULL default '0'
+ `a` int(1) NOT NULL DEFAULT '0',
+ `(SELECT 1)` int(1) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL default '0',
- `(SELECT a)` int(1) NOT NULL default '0'
+ `a` int(1) NOT NULL DEFAULT '0',
+ `(SELECT a)` int(1) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL default '0',
- `(SELECT a+0)` int(3) NOT NULL default '0'
+ `a` int(1) NOT NULL DEFAULT '0',
+ `(SELECT a+0)` int(3) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a;
@@ -1114,17 +1114,17 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bigint(20) NOT NULL default '0'
+ `a` bigint(20) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int);
insert into t1 values (1), (2), (3);
explain extended select a,(select (select rand() from t1 limit 1) from t1 limit 1)
from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 3
-2 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3
-3 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
+2 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00
+3 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,(select (select rand() AS `rand()` from `test`.`t1` limit 1) AS `(select rand() from t1 limit 1)` from `test`.`t1` limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from `test`.`t1`
drop table t1;
@@ -1176,9 +1176,9 @@ SELECT 0 IN (SELECT 1 FROM t1 a);
0 IN (SELECT 1 FROM t1 a)
0
EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
-2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
Warnings:
Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from `test`.`t1` `a`)) AS `0 IN (SELECT 1 FROM t1 a)`
INSERT INTO t1 (pseudo) VALUES ('test1');
@@ -1186,9 +1186,9 @@ SELECT 0 IN (SELECT 1 FROM t1 a);
0 IN (SELECT 1 FROM t1 a)
0
EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
-2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
Warnings:
Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from `test`.`t1` `a`)) AS `0 IN (SELECT 1 FROM t1 a)`
drop table t1;
@@ -1231,9 +1231,9 @@ drop table t1;
create table t1 (id int not null auto_increment primary key, salary int, key(salary));
insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000);
explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ref salary salary 5 const 1 Using where
-2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) AS `MAX(salary)` from `test`.`t1`))
drop table t1;
@@ -1293,9 +1293,9 @@ a
3
4
explain extended select * from t2 where t2.a in (select a from t1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 Using where; Using index
-2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on PRIMARY)))
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
@@ -1303,9 +1303,9 @@ a
2
4
explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 Using where; Using index
-2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index; Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on PRIMARY where (`test`.`t1`.`b` <> 30))))
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
@@ -1313,10 +1313,10 @@ a
2
3
explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 Using where; Using index
-2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 func 1 Using where
-2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where
+2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using where; Using index
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
drop table t1, t2, t3;
@@ -1332,9 +1332,9 @@ a
3
4
explain extended select * from t2 where t2.a in (select a from t1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
-2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 Using index
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a)))
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
@@ -1342,9 +1342,9 @@ a
2
4
explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
-2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 Using index; Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where (`test`.`t1`.`b` <> 30))))
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
@@ -1352,10 +1352,10 @@ a
2
3
explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
-2 DEPENDENT SUBQUERY t1 ref a a 5 func 1001 Using where; Using index
-2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 Using where; Using index
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY t1 ref a a 5 func 1001 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 100.00 Using where; Using index
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
insert into t1 values (3,31);
@@ -1369,9 +1369,9 @@ a
2
4
explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
-2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 Using index; Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where (`test`.`t1`.`b` <> 30))))
drop table t1, t2, t3;
@@ -1427,8 +1427,8 @@ select * from t1 where ('a','b')=(select 'a','b' from t1 union select 'a','b' fr
s1
tttt
explain extended (select * from t1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 1
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
Note 1003 (select `test`.`t1`.`s1` AS `s1` from `test`.`t1`)
(select * from t1);
@@ -1460,27 +1460,27 @@ a1 0
a2 1
a3 1
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 Using index
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
+2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL)))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 Using index
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
+2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 Using index
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
+2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL)))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 Using index; Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
+2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < _latin1'a2'))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
drop table t1,t2;
@@ -1493,17 +1493,17 @@ a
7
3
explain extended select * from t3 where a >= all (select b from t2);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < (select max(`test`.`t2`.`b`) from `test`.`t2`)))
select * from t3 where a >= some (select b from t2);
a
explain extended select * from t3 where a >= some (select b from t2);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= (select min(`test`.`t2`.`b`) from `test`.`t2`)))
select * from t3 where a >= all (select b from t2 group by 1);
@@ -1512,49 +1512,49 @@ a
7
3
explain extended select * from t3 where a >= all (select b from t2 group by 1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < <max>(select `test`.`t2`.`b` AS `b` from `test`.`t2` group by 1)))
select * from t3 where a >= some (select b from t2 group by 1);
a
explain extended select * from t3 where a >= some (select b from t2 group by 1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= <min>(select `test`.`t2`.`b` AS `b` from `test`.`t2` group by 1)))
select * from t3 where NULL >= any (select b from t2);
a
explain extended select * from t3 where NULL >= any (select b from t2);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3`
select * from t3 where NULL >= any (select b from t2 group by 1);
a
explain extended select * from t3 where NULL >= any (select b from t2 group by 1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3`
select * from t3 where NULL >= some (select b from t2);
a
explain extended select * from t3 where NULL >= some (select b from t2);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3`
select * from t3 where NULL >= some (select b from t2 group by 1);
a
explain extended select * from t3 where NULL >= some (select b from t2 group by 1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
-2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3`
insert into t2 values (2,2), (2,1), (3,3), (3,1);
@@ -1563,9 +1563,9 @@ a
6
7
explain extended select * from t3 where a > all (select max(b) from t2 group by a);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
-2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort
Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` <= <max>(select max(`test`.`t2`.`b`) AS `max(b)` from `test`.`t2` group by `test`.`t2`.`a`)))
drop table t2, t3;
@@ -1612,11 +1612,11 @@ select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1);
s1
e
explain extended select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 1
-2 SUBQUERY t1 system NULL NULL NULL NULL 1
-3 UNION t1 system NULL NULL NULL NULL 1
-NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
+2 SUBQUERY t1 system NULL NULL NULL NULL 1 100.00
+3 UNION t1 system NULL NULL NULL NULL 1 100.00
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1` from `test`.`t1`
drop table t1;
@@ -1733,15 +1733,15 @@ id text
11 text11
12 text12
explain extended select * from t1 where id not in (select id from t1 where id < 8);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 12 Using where
-2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index; Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where
+2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where
Warnings:
Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where not(<in_optimizer>(`test`.`t1`.`id`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`id`) in t1 on PRIMARY where (`test`.`t1`.`id` < 8)))))
explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY tt ALL NULL NULL NULL NULL 12 Using where
-2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where
+2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
Warnings:
Note 1276 Field or reference 'tt.id' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where not(exists(select `test`.`t1`.`id` AS `id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null)))
@@ -1765,10 +1765,10 @@ id text id text id text
1000 text1000 NULL NULL 1000 text1000
1001 text1001 NULL NULL 1000 text1000
explain extended select * from t1 a left join t2 b on (a.id=b.id or b.id is null) join t1 c on (if(isnull(b.id), 1000, b.id)=c.id);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE a ALL NULL NULL NULL NULL 14
-1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2
-1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE a ALL NULL NULL NULL NULL 14 100.00
+1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00
+1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where
Warnings:
Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(((`test`.`b`.`id` = `test`.`a`.`id`) or isnull(`test`.`b`.`id`))) join `test`.`t1` `c` where (if(isnull(`test`.`b`.`id`),1000,`test`.`b`.`id`) = `test`.`c`.`id`)
drop table t1,t2;
@@ -2275,9 +2275,9 @@ a b
1 2
3 4
explain extended select * from t1 up where exists (select * from t1 where t1.a=up.a);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY up ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY up ALL NULL NULL NULL NULL 2 100.00 Using where
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'up.a' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where exists(select 1 AS `Not_used` from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`))
@@ -2812,21 +2812,21 @@ one two test
10 5 NULL
10 10 NULL
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0') as 'test' from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 8
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where ((`test`.`t2`.`flag` = _latin1'0') and ((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)) and ((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))) having (<is_not_null_test>(`test`.`t2`.`one`) and <is_not_null_test>(`test`.`t2`.`two`)))) AS `test` from `test`.`t1`
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 Using where
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where ((`test`.`t2`.`flag` = _latin1'N') and (<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) and (<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`))))
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 8
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where; Using temporary; Using filesort
Warnings:
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where (`test`.`t2`.`flag` = _latin1'0') group by `test`.`t2`.`one`,`test`.`t2`.`two` having (((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)) and ((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`)) and <is_not_null_test>(`test`.`t2`.`one`) and <is_not_null_test>(`test`.`t2`.`two`)))) AS `test` from `test`.`t1`
DROP TABLE t1,t2;
diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result
index 272836c450a..efd6f8710aa 100644
--- a/mysql-test/r/symlink.result
+++ b/mysql-test/r/symlink.result
@@ -36,10 +36,10 @@ alter table t9 add column c int not null;
show create table t9;
Table Create Table
t9 CREATE TABLE `t9` (
- `a` int(11) NOT NULL auto_increment,
+ `a` int(11) NOT NULL AUTO_INCREMENT,
`b` char(16) NOT NULL,
`c` int(11) NOT NULL,
- PRIMARY KEY (`a`)
+ PRIMARY KEY (`a`)
) ENGINE=MyISAM AUTO_INCREMENT=16725 DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/'
alter table t9 rename t8, add column d int not null;
alter table t8 rename t7;
@@ -48,11 +48,11 @@ drop table t1;
SHOW CREATE TABLE t9;
Table Create Table
t9 CREATE TABLE `t9` (
- `a` int(11) NOT NULL auto_increment,
+ `a` int(11) NOT NULL AUTO_INCREMENT,
`b` char(16) NOT NULL,
`c` int(11) NOT NULL,
`d` int(11) NOT NULL,
- PRIMARY KEY (`a`)
+ PRIMARY KEY (`a`)
) ENGINE=MyISAM AUTO_INCREMENT=16725 DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/'
Got one of the listed errors
Got one of the listed errors
@@ -66,11 +66,11 @@ count(*)
show create table mysqltest.t9;
Table Create Table
t9 CREATE TABLE `t9` (
- `a` int(11) NOT NULL auto_increment,
+ `a` int(11) NOT NULL AUTO_INCREMENT,
`b` char(16) NOT NULL,
`c` int(11) NOT NULL,
`d` int(11) NOT NULL,
- PRIMARY KEY (`a`)
+ PRIMARY KEY (`a`)
) ENGINE=MyISAM AUTO_INCREMENT=16725 DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/'
drop database mysqltest;
create table t1 (a int not null) engine=myisam;
@@ -88,7 +88,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
- `b` int(11) default NULL
+ `b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
Warnings:
Warning 0 INDEX DIRECTORY option ignored
@@ -96,18 +96,18 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
- `b` int(11) default NULL
+ `b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(11) default NULL
+ `i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` int(11) default NULL
+ `i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
diff --git a/mysql-test/r/synchronization.result b/mysql-test/r/synchronization.result
index 29557b6cfd4..4543a829494 100644
--- a/mysql-test/r/synchronization.result
+++ b/mysql-test/r/synchronization.result
@@ -5,7 +5,7 @@ CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `xx` int(11) default NULL
+ `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int;
@@ -13,7 +13,7 @@ CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `xx` int(11) default NULL
+ `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int;
@@ -21,7 +21,7 @@ CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `xx` int(11) default NULL
+ `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int;
@@ -29,7 +29,7 @@ CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `xx` int(11) default NULL
+ `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int;
@@ -37,7 +37,7 @@ CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `xx` int(11) default NULL
+ `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int;
@@ -45,7 +45,7 @@ CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `xx` int(11) default NULL
+ `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int;
@@ -53,7 +53,7 @@ CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `xx` int(11) default NULL
+ `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int;
@@ -61,7 +61,7 @@ CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `xx` int(11) default NULL
+ `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int;
@@ -69,7 +69,7 @@ CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `xx` int(11) default NULL
+ `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int;
@@ -77,7 +77,7 @@ CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `xx` int(11) default NULL
+ `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int;
@@ -85,7 +85,7 @@ CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `xx` int(11) default NULL
+ `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int;
@@ -93,7 +93,7 @@ CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `xx` int(11) default NULL
+ `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int;
@@ -101,7 +101,7 @@ CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `xx` int(11) default NULL
+ `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int;
@@ -109,7 +109,7 @@ CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `xx` int(11) default NULL
+ `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int;
@@ -117,7 +117,7 @@ CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `xx` int(11) default NULL
+ `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int;
@@ -125,7 +125,7 @@ CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `xx` int(11) default NULL
+ `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int;
@@ -133,7 +133,7 @@ CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `xx` int(11) default NULL
+ `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int;
@@ -141,7 +141,7 @@ CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `xx` int(11) default NULL
+ `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int;
@@ -149,7 +149,7 @@ CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `xx` int(11) default NULL
+ `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int;
@@ -157,7 +157,7 @@ CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `xx` int(11) default NULL
+ `xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
DROP TABLE t1;
diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result
index 999f12a0573..b9d3504993c 100644
--- a/mysql-test/r/system_mysql_db.result
+++ b/mysql-test/r/system_mysql_db.result
@@ -3,14 +3,18 @@ show tables;
Tables_in_db
columns_priv
db
+event
func
+general_log
help_category
help_keyword
help_relation
help_topic
host
+plugin
proc
procs_priv
+slow_log
tables_priv
time_zone
time_zone_leap_second
@@ -21,164 +25,215 @@ user
show create table db;
Table Create Table
db CREATE TABLE `db` (
- `Host` char(60) collate utf8_bin NOT NULL default '',
- `Db` char(64) collate utf8_bin NOT NULL default '',
- `User` char(16) collate utf8_bin NOT NULL default '',
- `Select_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Insert_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Update_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Delete_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Create_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Drop_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Grant_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `References_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Index_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Alter_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Create_tmp_table_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Lock_tables_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Create_view_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Show_view_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Create_routine_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Alter_routine_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Execute_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- PRIMARY KEY (`Host`,`Db`,`User`),
+ `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ PRIMARY KEY (`Host`,`Db`,`User`),
KEY `User` (`User`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Database privileges'
show create table host;
Table Create Table
host CREATE TABLE `host` (
- `Host` char(60) collate utf8_bin NOT NULL default '',
- `Db` char(64) collate utf8_bin NOT NULL default '',
- `Select_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Insert_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Update_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Delete_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Create_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Drop_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Grant_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `References_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Index_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Alter_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Create_tmp_table_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Lock_tables_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Create_view_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Show_view_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Create_routine_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Alter_routine_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Execute_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- PRIMARY KEY (`Host`,`Db`)
+ `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ PRIMARY KEY (`Host`,`Db`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Host privileges; Merged with database privileges'
show create table user;
Table Create Table
user CREATE TABLE `user` (
- `Host` char(60) collate utf8_bin NOT NULL default '',
- `User` char(16) collate utf8_bin NOT NULL default '',
- `Password` char(41) character set latin1 collate latin1_bin NOT NULL default '',
- `Select_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Insert_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Update_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Delete_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Create_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Drop_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Reload_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Shutdown_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Process_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `File_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Grant_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `References_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Index_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Alter_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Show_db_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Super_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Create_tmp_table_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Lock_tables_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Execute_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Repl_slave_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Repl_client_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Create_view_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Show_view_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Create_routine_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Alter_routine_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Create_user_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `ssl_type` enum('','ANY','X509','SPECIFIED') character set utf8 NOT NULL default '',
+ `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Password` char(41) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
+ `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Reload_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Shutdown_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Process_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `File_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Show_db_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Super_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Repl_slave_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Repl_client_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Create_user_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8 NOT NULL DEFAULT '',
`ssl_cipher` blob NOT NULL,
`x509_issuer` blob NOT NULL,
`x509_subject` blob NOT NULL,
- `max_questions` int(11) unsigned NOT NULL default '0',
- `max_updates` int(11) unsigned NOT NULL default '0',
- `max_connections` int(11) unsigned NOT NULL default '0',
- `max_user_connections` int(11) unsigned NOT NULL default '0',
- PRIMARY KEY (`Host`,`User`)
+ `max_questions` int(11) unsigned NOT NULL DEFAULT '0',
+ `max_updates` int(11) unsigned NOT NULL DEFAULT '0',
+ `max_connections` int(11) unsigned NOT NULL DEFAULT '0',
+ `max_user_connections` int(11) unsigned NOT NULL DEFAULT '0',
+ PRIMARY KEY (`Host`,`User`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'
show create table func;
Table Create Table
func CREATE TABLE `func` (
- `name` char(64) collate utf8_bin NOT NULL default '',
- `ret` tinyint(1) NOT NULL default '0',
- `dl` char(128) collate utf8_bin NOT NULL default '',
- `type` enum('function','aggregate') character set utf8 NOT NULL,
- PRIMARY KEY (`name`)
+ `name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `ret` tinyint(1) NOT NULL DEFAULT '0',
+ `dl` char(128) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL,
+ PRIMARY KEY (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User defined functions'
show create table tables_priv;
Table Create Table
tables_priv CREATE TABLE `tables_priv` (
- `Host` char(60) collate utf8_bin NOT NULL default '',
- `Db` char(64) collate utf8_bin NOT NULL default '',
- `User` char(16) collate utf8_bin NOT NULL default '',
- `Table_name` char(64) collate utf8_bin NOT NULL default '',
- `Grantor` char(77) collate utf8_bin NOT NULL default '',
- `Timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
- `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view') character set utf8 NOT NULL default '',
- `Column_priv` set('Select','Insert','Update','References') character set utf8 NOT NULL default '',
- PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`),
+ `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '',
+ PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`),
KEY `Grantor` (`Grantor`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Table privileges'
show create table columns_priv;
Table Create Table
columns_priv CREATE TABLE `columns_priv` (
- `Host` char(60) collate utf8_bin NOT NULL default '',
- `Db` char(64) collate utf8_bin NOT NULL default '',
- `User` char(16) collate utf8_bin NOT NULL default '',
- `Table_name` char(64) collate utf8_bin NOT NULL default '',
- `Column_name` char(64) collate utf8_bin NOT NULL default '',
- `Timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
- `Column_priv` set('Select','Insert','Update','References') character set utf8 NOT NULL default '',
- PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`)
+ `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '',
+ PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges'
show create table procs_priv;
Table Create Table
procs_priv CREATE TABLE `procs_priv` (
- `Host` char(60) collate utf8_bin NOT NULL default '',
- `Db` char(64) collate utf8_bin NOT NULL default '',
- `User` char(16) collate utf8_bin NOT NULL default '',
- `Routine_name` char(64) collate utf8_bin NOT NULL default '',
- `Routine_type` enum('FUNCTION','PROCEDURE') collate utf8_bin NOT NULL,
- `Grantor` char(77) collate utf8_bin NOT NULL default '',
- `Proc_priv` set('Execute','Alter Routine','Grant') character set utf8 NOT NULL default '',
- `Timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
- PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`),
+ `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Routine_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL,
+ `Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`),
KEY `Grantor` (`Grantor`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges'
show create table proc;
Table Create Table
proc CREATE TABLE `proc` (
- `db` char(64) character set utf8 collate utf8_bin NOT NULL default '',
- `name` char(64) NOT NULL default '',
+ `db` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+ `name` char(64) NOT NULL DEFAULT '',
`type` enum('FUNCTION','PROCEDURE') NOT NULL,
- `specific_name` char(64) NOT NULL default '',
- `language` enum('SQL') NOT NULL default 'SQL',
- `sql_data_access` enum('CONTAINS_SQL','NO_SQL','READS_SQL_DATA','MODIFIES_SQL_DATA') NOT NULL default 'CONTAINS_SQL',
- `is_deterministic` enum('YES','NO') NOT NULL default 'NO',
- `security_type` enum('INVOKER','DEFINER') NOT NULL default 'DEFINER',
+ `specific_name` char(64) NOT NULL DEFAULT '',
+ `language` enum('SQL') NOT NULL DEFAULT 'SQL',
+ `sql_data_access` enum('CONTAINS_SQL','NO_SQL','READS_SQL_DATA','MODIFIES_SQL_DATA') NOT NULL DEFAULT 'CONTAINS_SQL',
+ `is_deterministic` enum('YES','NO') NOT NULL DEFAULT 'NO',
+ `security_type` enum('INVOKER','DEFINER') NOT NULL DEFAULT 'DEFINER',
`param_list` blob NOT NULL,
- `returns` char(64) NOT NULL default '',
+ `returns` char(64) NOT NULL DEFAULT '',
`body` longblob NOT NULL,
- `definer` char(77) character set utf8 collate utf8_bin NOT NULL default '',
- `created` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
- `modified` timestamp NOT NULL default '0000-00-00 00:00:00',
- `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE') NOT NULL default '',
- `comment` char(64) character set utf8 collate utf8_bin NOT NULL default '',
- PRIMARY KEY (`db`,`name`,`type`)
+ `definer` char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+ `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE') NOT NULL DEFAULT '',
+ `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+ PRIMARY KEY (`db`,`name`,`type`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stored Procedures'
+show create table event;
+Table Create Table
+event CREATE TABLE `event` (
+ `db` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+ `name` char(64) NOT NULL DEFAULT '',
+ `body` longblob NOT NULL,
+ `definer` char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+ `execute_at` datetime DEFAULT NULL,
+ `interval_value` int(11) DEFAULT NULL,
+ `interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') DEFAULT NULL,
+ `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `last_executed` datetime DEFAULT NULL,
+ `starts` datetime DEFAULT NULL,
+ `ends` datetime DEFAULT NULL,
+ `status` enum('ENABLED','DISABLED') NOT NULL DEFAULT 'ENABLED',
+ `on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP',
+ `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE') NOT NULL DEFAULT '',
+ `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+ PRIMARY KEY (`db`,`name`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events'
+show create table general_log;
+Table Create Table
+general_log CREATE TABLE `general_log` (
+ `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `user_host` mediumtext,
+ `thread_id` int(11) DEFAULT NULL,
+ `server_id` int(11) DEFAULT NULL,
+ `command_type` varchar(64) DEFAULT NULL,
+ `argument` mediumtext
+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
+show create table slow_log;
+Table Create Table
+slow_log CREATE TABLE `slow_log` (
+ `start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `user_host` mediumtext NOT NULL,
+ `query_time` time NOT NULL,
+ `lock_time` time NOT NULL,
+ `rows_sent` int(11) NOT NULL,
+ `rows_examined` int(11) NOT NULL,
+ `db` varchar(512) DEFAULT NULL,
+ `last_insert_id` int(11) DEFAULT NULL,
+ `insert_id` int(11) DEFAULT NULL,
+ `server_id` int(11) DEFAULT NULL,
+ `sql_text` mediumtext NOT NULL
+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
show tables;
Tables_in_test
diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result
index 139a7da77de..6c9a389c1f4 100644
--- a/mysql-test/r/temp_table.result
+++ b/mysql-test/r/temp_table.result
@@ -77,7 +77,7 @@ drop table t1,t2;
create temporary table t1 (a int not null);
insert into t1 values (1),(1);
alter table t1 add primary key (a);
-ERROR 23000: Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
drop table t1;
CREATE TABLE t1 (
d datetime default NULL
@@ -98,7 +98,7 @@ d
show status like "created_tmp%tables";
Variable_name Value
Created_tmp_disk_tables 0
-Created_tmp_tables 2
+Created_tmp_tables 1
drop table t1;
create temporary table v1 as select 'This is temp. table' A;
create view v1 as select 'This is view' A;
@@ -108,7 +108,7 @@ This is temp. table
show create table v1;
Table Create Table
v1 CREATE TEMPORARY TABLE `v1` (
- `A` varchar(19) NOT NULL default ''
+ `A` varchar(19) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create view v1;
View Create View
@@ -152,3 +152,14 @@ SELECT * FROM t1;
i
DROP TABLE t1;
End of 4.1 tests.
+create temporary table t1 (a int);
+insert into t1 values (4711);
+select * from t1;
+a
+4711
+truncate t1;
+insert into t1 values (42);
+select * from t1;
+a
+42
+drop table t1;
diff --git a/mysql-test/r/timezone2.result b/mysql-test/r/timezone2.result
index bb1d764ac8c..6fd67d00259 100644
--- a/mysql-test/r/timezone2.result
+++ b/mysql-test/r/timezone2.result
@@ -70,7 +70,7 @@ i ts
1067129999 2003-10-26 00:59:59
1067137200 2003-10-26 03:00:00
1067129999 2003-10-26 00:59:59
-delete from t1;
+truncate table t1;
set time_zone='Europe/Moscow';
insert into t1 (i, ts) values
(unix_timestamp('2004-01-01 00:00:00'),'2004-01-01 00:00:00'),
@@ -85,7 +85,7 @@ i ts
1080428400 2004-03-28 03:00:00
1091304000 2003-08-01 00:00:00
1099175400 2004-10-31 02:30:00
-delete from t1;
+truncate table t1;
set time_zone='leap/Europe/Moscow';
insert into t1 (i, ts) values
(unix_timestamp('2004-01-01 00:00:00'),'2004-01-01 00:00:00'),
@@ -100,7 +100,7 @@ i ts
1080428422 2004-03-28 03:00:00
1091304022 2003-08-01 00:00:00
1099175422 2004-10-31 02:30:00
-delete from t1;
+truncate table t1;
insert into t1 (i, ts) values
(unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
(unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
@@ -118,9 +118,9 @@ insert into t1 values ('0000-00-00 00:00:00'),('1969-12-31 23:59:59'),
('1970-01-01 00:00:00'),('1970-01-01 00:00:01'),
('2038-01-19 03:14:07'),('2038-01-19 03:14:08');
Warnings:
-Warning 1264 Out of range value adjusted for column 'ts' at row 2
-Warning 1264 Out of range value adjusted for column 'ts' at row 3
-Warning 1264 Out of range value adjusted for column 'ts' at row 6
+Warning 1264 Out of range value for column 'ts' at row 2
+Warning 1264 Out of range value for column 'ts' at row 3
+Warning 1264 Out of range value for column 'ts' at row 6
select * from t1;
ts
0000-00-00 00:00:00
@@ -129,15 +129,15 @@ ts
1970-01-01 00:00:01
2038-01-19 03:14:07
0000-00-00 00:00:00
-delete from t1;
+truncate table t1;
set time_zone='MET';
insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 00:30:00'),
('1970-01-01 01:00:00'),('1970-01-01 01:00:01'),
('2038-01-19 04:14:07'),('2038-01-19 04:14:08');
Warnings:
-Warning 1264 Out of range value adjusted for column 'ts' at row 2
-Warning 1264 Out of range value adjusted for column 'ts' at row 3
-Warning 1264 Out of range value adjusted for column 'ts' at row 6
+Warning 1264 Out of range value for column 'ts' at row 2
+Warning 1264 Out of range value for column 'ts' at row 3
+Warning 1264 Out of range value for column 'ts' at row 6
select * from t1;
ts
0000-00-00 00:00:00
@@ -146,15 +146,15 @@ ts
1970-01-01 01:00:01
2038-01-19 04:14:07
0000-00-00 00:00:00
-delete from t1;
+truncate table t1;
set time_zone='+01:30';
insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 01:00:00'),
('1970-01-01 01:30:00'),('1970-01-01 01:30:01'),
('2038-01-19 04:44:07'),('2038-01-19 04:44:08');
Warnings:
-Warning 1264 Out of range value adjusted for column 'ts' at row 2
-Warning 1264 Out of range value adjusted for column 'ts' at row 3
-Warning 1264 Out of range value adjusted for column 'ts' at row 6
+Warning 1264 Out of range value for column 'ts' at row 2
+Warning 1264 Out of range value for column 'ts' at row 3
+Warning 1264 Out of range value for column 'ts' at row 6
select * from t1;
ts
0000-00-00 00:00:00
diff --git a/mysql-test/r/timezone_grant.result b/mysql-test/r/timezone_grant.result
index 2f4d46dfdc0..49918038da5 100644
--- a/mysql-test/r/timezone_grant.result
+++ b/mysql-test/r/timezone_grant.result
@@ -40,7 +40,7 @@ select convert_tz('2004-11-31 12:00:00', 'Europe/Moscow', 'UTC');
convert_tz('2004-11-31 12:00:00', 'Europe/Moscow', 'UTC')
NULL
Warnings:
-Warning 1292 Truncated incorrect datetime value: '2004-11-31 12:00:00'
+Warning 1292 Incorrect datetime value: '2004-11-31 12:00:00'
select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
convert_tz(b, 'Europe/Moscow', 'UTC')
update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC')
diff --git a/mysql-test/r/trigger-compat.result b/mysql-test/r/trigger-compat.result
index 6839cacab43..068bf6c6968 100644
--- a/mysql-test/r/trigger-compat.result
+++ b/mysql-test/r/trigger-compat.result
@@ -7,8 +7,7 @@ DROP DATABASE IF EXISTS mysqltest_db1;
CREATE DATABASE mysqltest_db1;
CREATE USER mysqltest_dfn@localhost;
CREATE USER mysqltest_inv@localhost;
-GRANT SUPER ON *.* TO mysqltest_dfn@localhost;
-GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
+GRANT CREATE, TRIGGER ON mysqltest_db1.* TO mysqltest_dfn@localhost;
---> connection: wl2818_definer_con
CREATE TABLE t1(num_value INT);
diff --git a/mysql-test/r/trigger-grant.result b/mysql-test/r/trigger-grant.result
index f6384d479b7..eb211be0270 100644
--- a/mysql-test/r/trigger-grant.result
+++ b/mysql-test/r/trigger-grant.result
@@ -7,12 +7,57 @@ DROP DATABASE IF EXISTS mysqltest_db1;
CREATE DATABASE mysqltest_db1;
CREATE USER mysqltest_dfn@localhost;
CREATE USER mysqltest_inv@localhost;
-GRANT SUPER ON *.* TO mysqltest_dfn@localhost;
GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
---> connection: wl2818_definer_con
CREATE TABLE t1(num_value INT);
CREATE TABLE t2(user_str TEXT);
+
+---> connection: default
+GRANT INSERT, DELETE ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
+GRANT INSERT, DELETE ON mysqltest_db1.t2 TO mysqltest_dfn@localhost;
+
+---> connection: default
+GRANT SUPER ON *.* TO mysqltest_dfn@localhost;
+
+---> connection: wl2818_definer_con
+CREATE TRIGGER trg1 AFTER INSERT ON t1
+FOR EACH ROW
+INSERT INTO t2 VALUES(CURRENT_USER());
+ERROR 42000: TRIGGER command denied to user 'mysqltest_dfn'@'localhost' for table 't1'
+
+---> connection: default
+GRANT TRIGGER ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
+
+---> connection: wl2818_definer_con
+CREATE TRIGGER trg1 AFTER INSERT ON t1
+FOR EACH ROW
+INSERT INTO t2 VALUES(CURRENT_USER());
+
+---> connection: default
+REVOKE TRIGGER ON mysqltest_db1.t1 FROM mysqltest_dfn@localhost;
+
+---> connection: wl2818_definer_con
+DROP TRIGGER trg1;
+ERROR 42000: TRIGGER command denied to user 'mysqltest_dfn'@'localhost' for table 't1'
+
+---> connection: wl2818_definer_con
+INSERT INTO t1 VALUES(0);
+ERROR 42000: TRIGGER command denied to user 'mysqltest_dfn'@'localhost' for table 't1'
+
+---> connection: default
+GRANT TRIGGER ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
+
+---> connection: wl2818_definer_con
+INSERT INTO t1 VALUES(0);
+DROP TRIGGER trg1;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+
+---> connection: default
+REVOKE SUPER ON *.* FROM mysqltest_dfn@localhost;
+
+---> connection: wl2818_definer_con
CREATE TRIGGER trg1 AFTER INSERT ON t1
FOR EACH ROW
INSERT INTO t2 VALUES(CURRENT_USER());
@@ -72,6 +117,17 @@ CREATE DEFINER='mysqltest_inv'@'localhost'
TRIGGER trg1 BEFORE INSERT ON t1
FOR EACH ROW
SET @new_sum = 0;
+ERROR 42000: Access denied; you need the SUPER privilege for this operation
+
+---> connection: default
+use mysqltest_db1;
+GRANT SUPER ON *.* TO mysqltest_dfn@localhost;
+
+---> connection: wl2818_definer_con
+CREATE DEFINER='mysqltest_inv'@'localhost'
+ TRIGGER trg1 BEFORE INSERT ON t1
+FOR EACH ROW
+SET @new_sum = 0;
CREATE DEFINER='mysqltest_nonexs'@'localhost'
TRIGGER trg2 AFTER INSERT ON t1
FOR EACH ROW
@@ -79,7 +135,7 @@ SET @new_sum = 0;
Warnings:
Note 1449 There is no 'mysqltest_nonexs'@'localhost' registered
INSERT INTO t1 VALUES(6);
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR HY000: There is no 'mysqltest_nonexs'@'localhost' registered
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1 SET @new_sum = 0 BEFORE NULL mysqltest_inv@localhost
@@ -140,18 +196,16 @@ CREATE TABLE t3(col CHAR(20));
CREATE TABLE t4(col CHAR(20));
CREATE USER mysqltest_u1@localhost;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
-GRANT SUPER ON *.* TO mysqltest_u1@localhost;
-GRANT SELECT ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
+GRANT TRIGGER ON mysqltest_db1.* TO mysqltest_u1@localhost;
SET @mysqltest_var = NULL;
---> connection: default
use mysqltest_db1;
-REVOKE SELECT ON mysqltest_db1.t1 FROM mysqltest_u1@localhost;
GRANT DELETE ON mysqltest_db1.* TO mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
-GRANT SUPER ON *.* TO 'mysqltest_u1'@'localhost'
-GRANT DELETE ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost'
+GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
+GRANT DELETE, TRIGGER ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost'
---> connection: bug15166_u1_con
use mysqltest_db1;
@@ -322,7 +376,7 @@ CREATE TABLE t1 (i1 INT);
CREATE TABLE t2 (i1 INT);
CREATE USER mysqltest_dfn@localhost;
CREATE USER mysqltest_inv@localhost;
-GRANT EXECUTE, CREATE ROUTINE, SUPER ON *.* TO mysqltest_dfn@localhost;
+GRANT EXECUTE, CREATE ROUTINE, TRIGGER ON *.* TO mysqltest_dfn@localhost;
GRANT INSERT ON mysqltest_db1.* TO mysqltest_inv@localhost;
CREATE PROCEDURE p1(OUT i INT) DETERMINISTIC NO SQL SET i = 3;
CREATE PROCEDURE p2(INOUT i INT) DETERMINISTIC NO SQL SET i = i * 5;
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index 5d643057666..52123885772 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -619,7 +619,7 @@ set sql_mode=default;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` date default NULL
+ `a` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer
@@ -947,7 +947,7 @@ mysqltest t1_bi mysqltest t1 set @a:=new.id
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `id` int(11) default NULL
+ `id` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop trigger test.t1_bi;
ERROR HY000: Trigger does not exist
@@ -1008,9 +1008,9 @@ insert into t1 values
create function f2() returns int return (select max(b) from t2);
insert into t2 select a, f2() from t1;
load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1();
-drop table t1, t2;
drop function f1;
drop function f2;
+drop table t1, t2;
create table t1(i int not null, j int not null, n numeric(15,2), primary key(i,j));
create table t2(i int not null, n numeric(15,2), primary key(i));
create trigger t1_ai after insert on t1 for each row
diff --git a/mysql-test/r/type_binary.result b/mysql-test/r/type_binary.result
index 597defb7a9b..0b340502eaf 100644
--- a/mysql-test/r/type_binary.result
+++ b/mysql-test/r/type_binary.result
@@ -21,8 +21,8 @@ create table t1 (s1 varbinary(20), s2 varbinary(20));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `s1` varbinary(20) default NULL,
- `s2` varbinary(20) default NULL
+ `s1` varbinary(20) DEFAULT NULL,
+ `s2` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (0x41,0x4100),(0x41,0x4120),(0x4100,0x4120);
select hex(s1), hex(s2) from t1;
@@ -47,7 +47,7 @@ create table t1 (s1 binary(2) primary key);
insert into t1 values (0x01);
insert into t1 values (0x0120);
insert into t1 values (0x0100);
-ERROR 23000: Duplicate entry '' for key 1
+ERROR 23000: Duplicate entry '' for key 'PRIMARY'
select hex(s1) from t1 order by s1;
hex(s1)
0100
diff --git a/mysql-test/r/type_bit.result b/mysql-test/r/type_bit.result
index bd58e83bb3f..5c9b70fadc3 100644
--- a/mysql-test/r/type_bit.result
+++ b/mysql-test/r/type_bit.result
@@ -41,7 +41,7 @@ create table t1 (a bit(0));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bit(1) default NULL
+ `a` bit(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a bit(64));
@@ -62,7 +62,7 @@ drop table t1;
create table t1 (a bit);
insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001');
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 4
+Warning 1264 Out of range value for column 'a' at row 4
select hex(a) from t1;
hex(a)
0
@@ -71,12 +71,12 @@ hex(a)
1
1
alter table t1 add unique (a);
-ERROR 23000: Duplicate entry '' for key 1
+ERROR 23000: Duplicate entry '' for key 'a'
drop table t1;
create table t1 (a bit(2));
insert into t1 values (b'00'), (b'01'), (b'10'), (b'100');
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 4
+Warning 1264 Out of range value for column 'a' at row 4
select a+0 from t1;
a+0
0
@@ -461,7 +461,7 @@ drop table t1;
create table t1 (a bit(8)) engine=heap;
insert into t1 values ('1111100000');
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
select a+0 from t1;
a+0
255
@@ -494,7 +494,7 @@ a+0
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` bit(7) default NULL
+ `a` bit(7) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (id1 int(11), b1 bit(1));
@@ -605,7 +605,7 @@ drop table bug15583;
create table t1(a bit(1), b smallint unsigned);
insert into t1 (b, a) values ('2', '1');
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
select hex(a), b from t1;
hex(a) b
1 2
diff --git a/mysql-test/r/type_bit_innodb.result b/mysql-test/r/type_bit_innodb.result
index 1f6857277bd..8dc016d5a4a 100644
--- a/mysql-test/r/type_bit_innodb.result
+++ b/mysql-test/r/type_bit_innodb.result
@@ -41,7 +41,7 @@ create table t1 (a bit(0)) engine=innodb;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bit(1) default NULL
+ `a` bit(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a bit(64)) engine=innodb;
@@ -62,7 +62,7 @@ drop table t1;
create table t1 (a bit) engine=innodb;
insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001');
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 4
+Warning 1264 Out of range value for column 'a' at row 4
select hex(a) from t1;
hex(a)
0
@@ -71,12 +71,12 @@ hex(a)
1
1
alter table t1 add unique (a);
-ERROR 23000: Duplicate entry '' for key 1
+ERROR 23000: Duplicate entry '' for key 'a'
drop table t1;
create table t1 (a bit(2)) engine=innodb;
insert into t1 values (b'00'), (b'01'), (b'10'), (b'100');
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 4
+Warning 1264 Out of range value for column 'a' at row 4
select a+0 from t1;
a+0
0
@@ -384,22 +384,22 @@ create table t1 (a bit, b bit(10)) engine=innodb;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bit(1) default NULL,
- `b` bit(10) default NULL
+ `a` bit(1) DEFAULT NULL,
+ `b` bit(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
alter table t1 engine=heap;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bit(1) default NULL,
- `b` bit(10) default NULL
+ `a` bit(1) DEFAULT NULL,
+ `b` bit(10) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
alter table t1 engine=innodb;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bit(1) default NULL,
- `b` bit(10) default NULL
+ `a` bit(1) DEFAULT NULL,
+ `b` bit(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a bit(7)) engine=innodb;
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index 73b67a2241e..e5adad14267 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -29,7 +29,7 @@ t3 CREATE TABLE `t3` (
show create TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c` mediumtext character set utf8 NOT NULL
+ `c` mediumtext CHARACTER SET utf8 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1,t2,t3,t4;
CREATE TABLE t1 (a char(257) default "hello");
@@ -516,8 +516,8 @@ explain extended select
charset(load_file('../../std_data/words.dat')),
collation(load_file('../../std_data/words.dat')),
coercibility(load_file('../../std_data/words.dat'));
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select charset(load_file(_latin1'../../std_data/words.dat')) AS `charset(load_file('../../std_data/words.dat'))`,collation(load_file(_latin1'../../std_data/words.dat')) AS `collation(load_file('../../std_data/words.dat'))`,coercibility(load_file(_latin1'../../std_data/words.dat')) AS `coercibility(load_file('../../std_data/words.dat'))`
update t1 set imagem=load_file('../../std_data/words.dat') where id=1;
@@ -532,9 +532,9 @@ l longblob NULL YES NULL #
drop table t1;
create table t1 (id integer primary key auto_increment, txt text not null, unique index txt_index (txt (20)));
insert into t1 (txt) values ('Chevy'), ('Chevy ');
-ERROR 23000: Duplicate entry 'Chevy ' for key 2
+ERROR 23000: Duplicate entry 'Chevy ' for key 'txt_index'
insert into t1 (txt) values ('Chevy'), ('CHEVY');
-ERROR 23000: Duplicate entry 'Chevy' for key 2
+ERROR 23000: Duplicate entry 'Chevy' for key 'txt_index'
alter table t1 drop index txt_index, add index txt_index (txt(20));
insert into t1 (txt) values ('Chevy ');
select * from t1 where txt='Chevy';
@@ -711,12 +711,12 @@ alter table t1 add key (a,b,d,e);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL default '0',
- `b` int(11) NOT NULL default '0',
+ `a` int(11) NOT NULL DEFAULT '0',
+ `b` int(11) NOT NULL DEFAULT '0',
`c` tinyblob NOT NULL,
- `d` int(11) NOT NULL default '0',
- `e` int(11) default NULL,
- PRIMARY KEY (`a`,`b`,`c`(255),`d`),
+ `d` int(11) NOT NULL DEFAULT '0',
+ `e` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`,`b`,`c`(255),`d`),
KEY `a` (`a`,`b`,`d`,`e`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
index ed15293bb45..12ce742eab4 100644
--- a/mysql-test/r/type_date.result
+++ b/mysql-test/r/type_date.result
@@ -99,7 +99,7 @@ DROP TABLE t1, t2, t3;
CREATE TABLE t1 (y YEAR);
INSERT INTO t1 VALUES ('abc');
Warnings:
-Warning 1264 Out of range value adjusted for column 'y' at row 1
+Warning 1264 Out of range value for column 'y' at row 1
SELECT * FROM t1;
y
0000
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index 49e4827cb97..04b37f7ae86 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -27,7 +27,7 @@ test.t1 check status OK
delete from t1;
insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030100000000"),("20030000000000");
Warnings:
-Warning 1264 Out of range value adjusted for column 't' at row 5
+Warning 1264 Out of range value for column 't' at row 5
insert into t1 values ("2003-003-03");
insert into t1 values ("20030102T131415"),("2001-01-01T01:01:01"), ("2001-1-1T1:01:01");
select * from t1;
@@ -54,7 +54,7 @@ t
truncate table t1;
insert into t1 values("2003-0303 12:13:14");
Warnings:
-Warning 1264 Out of range value adjusted for column 't' at row 1
+Warning 1264 Out of range value for column 't' at row 1
select * from t1;
t
0000-00-00 00:00:00
@@ -115,12 +115,12 @@ create table t1 (t datetime);
insert into t1 values (20030102030460),(20030102036301),(20030102240401),
(20030132030401),(20031302030401),(100001202030401);
Warnings:
-Warning 1264 Out of range value adjusted for column 't' at row 1
-Warning 1264 Out of range value adjusted for column 't' at row 2
-Warning 1264 Out of range value adjusted for column 't' at row 3
-Warning 1264 Out of range value adjusted for column 't' at row 4
-Warning 1264 Out of range value adjusted for column 't' at row 5
-Warning 1264 Out of range value adjusted for column 't' at row 6
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't' at row 2
+Warning 1264 Out of range value for column 't' at row 3
+Warning 1264 Out of range value for column 't' at row 4
+Warning 1264 Out of range value for column 't' at row 5
+Warning 1264 Out of range value for column 't' at row 6
select * from t1;
t
0000-00-00 00:00:00
@@ -134,12 +134,12 @@ insert into t1 values
("2003-01-02 03:04:60"),("2003-01-02 03:63:01"),("2003-01-02 24:04:01"),
("2003-01-32 03:04:01"),("2003-13-02 03:04:01"), ("10000-12-02 03:04:00");
Warnings:
-Warning 1264 Out of range value adjusted for column 't' at row 1
-Warning 1264 Out of range value adjusted for column 't' at row 2
-Warning 1264 Out of range value adjusted for column 't' at row 3
-Warning 1264 Out of range value adjusted for column 't' at row 4
-Warning 1264 Out of range value adjusted for column 't' at row 5
-Warning 1264 Out of range value adjusted for column 't' at row 6
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't' at row 2
+Warning 1264 Out of range value for column 't' at row 3
+Warning 1264 Out of range value for column 't' at row 4
+Warning 1264 Out of range value for column 't' at row 5
+Warning 1264 Out of range value for column 't' at row 6
select * from t1;
t
0000-00-00 00:00:00
@@ -151,9 +151,9 @@ t
delete from t1;
insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
Warnings:
-Warning 1264 Out of range value adjusted for column 't' at row 1
-Warning 1264 Out of range value adjusted for column 't' at row 2
-select * from t1;
+Warning 1264 Out of range value for column 't' at row 1
+Warning 1264 Out of range value for column 't' at row 2
+select * from t1 order by t;
t
0000-00-00 00:00:00
2003-01-01 00:00:00
diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result
index c9c42d18d68..dfbd6619436 100644
--- a/mysql-test/r/type_decimal.result
+++ b/mysql-test/r/type_decimal.result
@@ -157,25 +157,25 @@ insert into t1 values ("-.1"),("+.1"),(".1");
insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
-Warning 1264 Out of range value adjusted for column 'a' at row 2
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 2
insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
-Warning 1264 Out of range value adjusted for column 'a' at row 2
-Warning 1264 Out of range value adjusted for column 'a' at row 3
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 2
+Warning 1264 Out of range value for column 'a' at row 3
insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 2
-Warning 1264 Out of range value adjusted for column 'a' at row 3
+Warning 1264 Out of range value for column 'a' at row 3
insert into t1 values ("1e+4294967296"),("1e-4294967296");
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 2
insert into t1 values ("1e+18446744073709551615"),("1e+18446744073709551616"),("1e-9223372036854775807"),("1e-9223372036854775809");
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column 'a' at row 2
Note 1265 Data truncated for column 'a' at row 3
Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column 'a' at row 4
@@ -221,29 +221,29 @@ drop table t1;
create table t1 (a decimal(10,2) unsigned);
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 2
-Warning 1264 Out of range value adjusted for column 'a' at row 6
+Warning 1264 Out of range value for column 'a' at row 2
+Warning 1264 Out of range value for column 'a' at row 6
insert into t1 values ("-.1"),("+.1"),(".1");
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 3
+Warning 1264 Out of range value for column 'a' at row 3
insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
-Warning 1264 Out of range value adjusted for column 'a' at row 2
-Warning 1264 Out of range value adjusted for column 'a' at row 3
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 2
+Warning 1264 Out of range value for column 'a' at row 3
insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
-Warning 1264 Out of range value adjusted for column 'a' at row 2
-Warning 1264 Out of range value adjusted for column 'a' at row 3
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 2
+Warning 1264 Out of range value for column 'a' at row 3
insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 2
-Warning 1264 Out of range value adjusted for column 'a' at row 3
+Warning 1264 Out of range value for column 'a' at row 3
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
Note 1265 Data truncated for column 'a' at row 1
@@ -280,29 +280,29 @@ drop table t1;
create table t1 (a decimal(10,2) zerofill);
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 2
-Warning 1264 Out of range value adjusted for column 'a' at row 6
+Warning 1264 Out of range value for column 'a' at row 2
+Warning 1264 Out of range value for column 'a' at row 6
insert into t1 values ("-.1"),("+.1"),(".1");
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 3
+Warning 1264 Out of range value for column 'a' at row 3
insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
-Warning 1264 Out of range value adjusted for column 'a' at row 2
-Warning 1264 Out of range value adjusted for column 'a' at row 3
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 2
+Warning 1264 Out of range value for column 'a' at row 3
insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
-Warning 1264 Out of range value adjusted for column 'a' at row 2
-Warning 1264 Out of range value adjusted for column 'a' at row 3
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 2
+Warning 1264 Out of range value for column 'a' at row 3
insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 2
-Warning 1264 Out of range value adjusted for column 'a' at row 3
+Warning 1264 Out of range value for column 'a' at row 3
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
Note 1265 Data truncated for column 'a' at row 1
@@ -342,18 +342,18 @@ insert into t1 values (-.1),(+.1),(.1);
insert into t1 values (00000000000001),(+0000000000001),(-0000000000001);
insert into t1 values (+111111111.11),(111111111.11),(-11111111.11);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
-Warning 1264 Out of range value adjusted for column 'a' at row 2
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 2
insert into t1 values (-111111111.11),(+1111111111.11),(1111111111.11);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
-Warning 1264 Out of range value adjusted for column 'a' at row 2
-Warning 1264 Out of range value adjusted for column 'a' at row 3
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 2
+Warning 1264 Out of range value for column 'a' at row 3
insert into t1 values (1e+100),(1e-100),(-1e+100);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 2
-Warning 1264 Out of range value adjusted for column 'a' at row 3
+Warning 1264 Out of range value for column 'a' at row 3
insert into t1 values (123.4e0),(123.4e+2),(123.4e-2),(123e1),(123e+0);
Warnings:
Note 1265 Data truncated for column 'a' at row 3
@@ -393,9 +393,9 @@ drop table t1;
create table t1 (a decimal);
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+12345678901'),(99999999999999);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
-Warning 1264 Out of range value adjusted for column 'a' at row 6
-Warning 1264 Out of range value adjusted for column 'a' at row 7
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 6
+Warning 1264 Out of range value for column 'a' at row 7
select * from t1;
a
-9999999999
@@ -409,9 +409,9 @@ drop table t1;
create table t1 (a decimal unsigned);
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
-Warning 1264 Out of range value adjusted for column 'a' at row 2
-Warning 1264 Out of range value adjusted for column 'a' at row 7
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 2
+Warning 1264 Out of range value for column 'a' at row 7
select * from t1;
a
0
@@ -425,9 +425,9 @@ drop table t1;
create table t1 (a decimal zerofill);
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
-Warning 1264 Out of range value adjusted for column 'a' at row 2
-Warning 1264 Out of range value adjusted for column 'a' at row 7
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 2
+Warning 1264 Out of range value for column 'a' at row 7
select * from t1;
a
0000000000
@@ -441,9 +441,9 @@ drop table t1;
create table t1 (a decimal unsigned zerofill);
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
-Warning 1264 Out of range value adjusted for column 'a' at row 2
-Warning 1264 Out of range value adjusted for column 'a' at row 7
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 2
+Warning 1264 Out of range value for column 'a' at row 7
select * from t1;
a
0000000000
@@ -457,14 +457,14 @@ drop table t1;
create table t1(a decimal(10,0));
insert into t1 values ("1e4294967295");
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
a
9999999999
delete from t1;
insert into t1 values("1e4294967297");
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
a
9999999999
@@ -709,14 +709,14 @@ create table t1 (d decimal(5));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `d` decimal(5,0) default NULL
+ `d` decimal(5,0) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (d decimal);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `d` decimal(10,0) default NULL
+ `d` decimal(10,0) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (d decimal(66,0));
@@ -786,7 +786,7 @@ select group_concat(t) from t1 group by week(date)/10;
group_concat(t)
t
Warnings:
-Warning 1292 Truncated incorrect datetime value: '0000-00-00'
-Warning 1292 Truncated incorrect datetime value: '0000-00-00'
-Warning 1292 Truncated incorrect datetime value: '0000-00-00'
+Warning 1292 Incorrect datetime value: '0000-00-00'
+Warning 1292 Incorrect datetime value: '0000-00-00'
+Warning 1292 Incorrect datetime value: '0000-00-00'
drop table t1;
diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result
index f337d87eada..b7db1d95587 100644
--- a/mysql-test/r/type_enum.result
+++ b/mysql-test/r/type_enum.result
@@ -1633,7 +1633,7 @@ create table t1 (a enum (' ','a','b ') not null default 'b ');
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` enum('','a','b') NOT NULL default 'b'
+ `a` enum('','a','b') NOT NULL DEFAULT 'b'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a enum ('0','1'));
@@ -1658,7 +1658,7 @@ a enum('','1','2') NO
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` enum('','1','2') NOT NULL default ''
+ `a` enum('','1','2') NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set names latin1;
@@ -1669,7 +1669,7 @@ b ENUM('value','_value','') character set latin1 NOT NULL
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) default '1',
+ `a` int(11) DEFAULT '1',
`b` enum('value','_value','') NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
@@ -1699,7 +1699,7 @@ a ENUM('','','') character set utf8 default ''
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` enum('','','') character set utf8 default ''
+ `a` enum('','','') CHARACTER SET utf8 DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (''), (''), ('');
select a from t1 order by a;
@@ -1717,7 +1717,7 @@ set names latin1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` enum('','','') default ''
+ `a` enum('','','') DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select a from t1 order by a;
a
@@ -1750,7 +1750,7 @@ alter table t1 add f2 enum(0xFFFF);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f1` int(11) default NULL,
- `f2` enum('') default NULL
+ `f1` int(11) DEFAULT NULL,
+ `f2` enum('') DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
index 2c794fe8f58..73f5e54ecc3 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -24,8 +24,8 @@ f1 float NULL YES NULL #
f2 double NULL YES NULL #
insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150);
Warnings:
-Warning 1264 Out of range value adjusted for column 'f1' at row 7
-Warning 1264 Out of range value adjusted for column 'f1' at row 8
+Warning 1264 Out of range value for column 'f1' at row 7
+Warning 1264 Out of range value for column 'f1' at row 8
insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150);
select * from t1;
f1 f2
@@ -91,10 +91,10 @@ col1 col2 col3 col4
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `col1` double default NULL,
- `col2` double(53,5) default NULL,
- `col3` double default NULL,
- `col4` double default NULL
+ `col1` double DEFAULT NULL,
+ `col2` double(53,5) DEFAULT NULL,
+ `col3` double DEFAULT NULL,
+ `col4` double DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1,t2;
create table t1 (a float);
@@ -149,7 +149,7 @@ create table t1 (d1 double, d2 double unsigned);
insert into t1 set d1 = -1.0;
update t1 set d2 = d1;
Warnings:
-Warning 1264 Out of range value adjusted for column 'd2' at row 1
+Warning 1264 Out of range value for column 'd2' at row 1
select * from t1;
d1 d2
-1 0
@@ -157,12 +157,12 @@ drop table t1;
create table t1 (f float(4,3));
insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
Warnings:
-Warning 1264 Out of range value adjusted for column 'f' at row 1
-Warning 1264 Out of range value adjusted for column 'f' at row 2
-Warning 1264 Out of range value adjusted for column 'f' at row 3
-Warning 1264 Out of range value adjusted for column 'f' at row 4
-Warning 1264 Out of range value adjusted for column 'f' at row 5
-Warning 1264 Out of range value adjusted for column 'f' at row 6
+Warning 1264 Out of range value for column 'f' at row 1
+Warning 1264 Out of range value for column 'f' at row 2
+Warning 1264 Out of range value for column 'f' at row 3
+Warning 1264 Out of range value for column 'f' at row 4
+Warning 1264 Out of range value for column 'f' at row 5
+Warning 1264 Out of range value for column 'f' at row 6
select * from t1;
f
-9.999
@@ -175,12 +175,12 @@ drop table if exists t1;
create table t1 (f double(4,3));
insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
Warnings:
-Warning 1264 Out of range value adjusted for column 'f' at row 1
-Warning 1264 Out of range value adjusted for column 'f' at row 2
-Warning 1264 Out of range value adjusted for column 'f' at row 3
-Warning 1264 Out of range value adjusted for column 'f' at row 4
-Warning 1264 Out of range value adjusted for column 'f' at row 5
-Warning 1264 Out of range value adjusted for column 'f' at row 6
+Warning 1264 Out of range value for column 'f' at row 1
+Warning 1264 Out of range value for column 'f' at row 2
+Warning 1264 Out of range value for column 'f' at row 3
+Warning 1264 Out of range value for column 'f' at row 4
+Warning 1264 Out of range value for column 'f' at row 5
+Warning 1264 Out of range value for column 'f' at row 6
select * from t1;
f
-9.999
@@ -237,7 +237,7 @@ d
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `d` double(22,9) default NULL
+ `d` double(22,9) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2, t3;
create table t1 select 105213674794682365.00 + 0.0 x;
diff --git a/mysql-test/r/type_nchar.result b/mysql-test/r/type_nchar.result
index f844b3b0241..95741d37e2a 100644
--- a/mysql-test/r/type_nchar.result
+++ b/mysql-test/r/type_nchar.result
@@ -3,48 +3,48 @@ create table t1 (c nchar(10));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c` char(10) character set utf8 default NULL
+ `c` char(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (c national char(10));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c` char(10) character set utf8 default NULL
+ `c` char(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (c national varchar(10));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c` varchar(10) character set utf8 default NULL
+ `c` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (c nvarchar(10));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c` varchar(10) character set utf8 default NULL
+ `c` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (c nchar varchar(10));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c` varchar(10) character set utf8 default NULL
+ `c` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (c national character varying(10));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c` varchar(10) character set utf8 default NULL
+ `c` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (c nchar varying(10));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c` varchar(10) character set utf8 default NULL
+ `c` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result
index 84d2ea47298..595c15afcc2 100644
--- a/mysql-test/r/type_newdecimal.result
+++ b/mysql-test/r/type_newdecimal.result
@@ -52,13 +52,13 @@ if(1, 1.1, 1.2) if(0, 1.1, 1.2) if(0.1, 1.1, 1.2) if(0, 1, 1.1) if(0, NULL, 1.2)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `if(1, 1.1, 1.2)` decimal(2,1) NOT NULL default '0.0',
- `if(0, 1.1, 1.2)` decimal(2,1) NOT NULL default '0.0',
- `if(0.1, 1.1, 1.2)` decimal(2,1) NOT NULL default '0.0',
- `if(0, 1, 1.1)` decimal(2,1) NOT NULL default '0.0',
- `if(0, NULL, 1.2)` decimal(2,1) default NULL,
- `if(1, 0.22e1, 1.1)` double NOT NULL default '0',
- `if(1E0, 1.1, 1.2)` decimal(2,1) NOT NULL default '0.0'
+ `if(1, 1.1, 1.2)` decimal(2,1) NOT NULL DEFAULT '0.0',
+ `if(0, 1.1, 1.2)` decimal(2,1) NOT NULL DEFAULT '0.0',
+ `if(0.1, 1.1, 1.2)` decimal(2,1) NOT NULL DEFAULT '0.0',
+ `if(0, 1, 1.1)` decimal(2,1) NOT NULL DEFAULT '0.0',
+ `if(0, NULL, 1.2)` decimal(2,1) DEFAULT NULL,
+ `if(1, 0.22e1, 1.1)` double NOT NULL DEFAULT '0',
+ `if(1E0, 1.1, 1.2)` decimal(2,1) NOT NULL DEFAULT '0.0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 select nullif(1.1, 1.1), nullif(1.1, 1.2), nullif(1.1, 0.11e1), nullif(1.0, 1), nullif(1, 1.0), nullif(1, 1.1);
@@ -68,27 +68,27 @@ NULL 1.1 NULL NULL NULL 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `nullif(1.1, 1.1)` decimal(2,1) default NULL,
- `nullif(1.1, 1.2)` decimal(2,1) default NULL,
- `nullif(1.1, 0.11e1)` decimal(2,1) default NULL,
- `nullif(1.0, 1)` decimal(2,1) default NULL,
- `nullif(1, 1.0)` int(1) default NULL,
- `nullif(1, 1.1)` int(1) default NULL
+ `nullif(1.1, 1.1)` decimal(2,1) DEFAULT NULL,
+ `nullif(1.1, 1.2)` decimal(2,1) DEFAULT NULL,
+ `nullif(1.1, 0.11e1)` decimal(2,1) DEFAULT NULL,
+ `nullif(1.0, 1)` decimal(2,1) DEFAULT NULL,
+ `nullif(1, 1.0)` int(1) DEFAULT NULL,
+ `nullif(1, 1.1)` int(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a decimal(4,2));
insert into t1 value (10000), (1.1e10), ("11111"), (100000.1);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
-Warning 1264 Out of range value adjusted for column 'a' at row 2
-Warning 1264 Out of range value adjusted for column 'a' at row 3
-Warning 1264 Out of range value adjusted for column 'a' at row 4
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 2
+Warning 1264 Out of range value for column 'a' at row 3
+Warning 1264 Out of range value for column 'a' at row 4
insert into t1 value (-10000), (-1.1e10), ("-11111"), (-100000.1);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
-Warning 1264 Out of range value adjusted for column 'a' at row 2
-Warning 1264 Out of range value adjusted for column 'a' at row 3
-Warning 1264 Out of range value adjusted for column 'a' at row 4
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 2
+Warning 1264 Out of range value for column 'a' at row 3
+Warning 1264 Out of range value for column 'a' at row 4
select a from t1;
a
99.99
@@ -103,16 +103,16 @@ drop table t1;
create table t1 (a decimal(4,2) unsigned);
insert into t1 value (10000), (1.1e10), ("11111"), (100000.1);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
-Warning 1264 Out of range value adjusted for column 'a' at row 2
-Warning 1264 Out of range value adjusted for column 'a' at row 3
-Warning 1264 Out of range value adjusted for column 'a' at row 4
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 2
+Warning 1264 Out of range value for column 'a' at row 3
+Warning 1264 Out of range value for column 'a' at row 4
insert into t1 value (-10000), (-1.1e10), ("-11111"), (-100000.1);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
-Warning 1264 Out of range value adjusted for column 'a' at row 2
-Warning 1264 Out of range value adjusted for column 'a' at row 3
-Warning 1264 Out of range value adjusted for column 'a' at row 4
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 2
+Warning 1264 Out of range value for column 'a' at row 3
+Warning 1264 Out of range value for column 'a' at row 4
select a from t1;
a
99.99
@@ -127,13 +127,13 @@ drop table t1;
create table t1 (a bigint);
insert into t1 values (18446744073709551615.0);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
insert into t1 values (9223372036854775808.0);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
insert into t1 values (-18446744073709551615.0);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
a
9223372036854775807
@@ -145,10 +145,10 @@ insert into t1 values (18446744073709551615.0);
insert into t1 values (9223372036854775808.0);
insert into t1 values (9999999999999999999999999.000);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
insert into t1 values (-1.0);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
a
18446744073709551615
@@ -159,12 +159,12 @@ drop table t1;
create table t1 (a tinyint);
insert into t1 values (18446744073709551615.0);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
insert into t1 values (9223372036854775808.0);
Warnings:
-Warning 1264 Out of range value adjusted for column 'a' at row 1
-Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
a
127
@@ -174,10 +174,10 @@ create table t1 select round(15.4,-1), truncate(-5678.123451,-3), abs(-1.1), -(-
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `round(15.4,-1)` decimal(3,0) NOT NULL default '0',
- `truncate(-5678.123451,-3)` decimal(4,0) NOT NULL default '0',
- `abs(-1.1)` decimal(3,1) NOT NULL default '0.0',
- `-(-1.1)` decimal(2,1) NOT NULL default '0.0'
+ `round(15.4,-1)` decimal(3,0) NOT NULL DEFAULT '0',
+ `truncate(-5678.123451,-3)` decimal(4,0) NOT NULL DEFAULT '0',
+ `abs(-1.1)` decimal(3,1) NOT NULL DEFAULT '0.0',
+ `-(-1.1)` decimal(2,1) NOT NULL DEFAULT '0.0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set session sql_mode='traditional';
@@ -771,7 +771,7 @@ create table t1 as select 0.5;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `0.5` decimal(2,1) NOT NULL default '0.0'
+ `0.5` decimal(2,1) NOT NULL DEFAULT '0.0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select round(1.5),round(2.5);
@@ -806,9 +806,9 @@ Warnings:
Note 1265 Data truncated for column 'col1' at row 1
INSERT INTO Sow6_2f VALUES (11);
INSERT INTO Sow6_2f VALUES (101.55);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
UPDATE Sow6_2f SET col1 = col1 * 50 WHERE col1 = 11;
-ERROR 22003: Out of range value adjusted for column 'col1' at row 5
+ERROR 22003: Out of range value for column 'col1' at row 5
UPDATE Sow6_2f SET col1 = col1 / 0 WHERE col1 > 0;
ERROR 22012: Division by 0
SELECT MOD(col1,0) FROM Sow6_2f;
@@ -872,13 +872,13 @@ NULL
set @@sql_mode='traditional';
create table t1( d1 decimal(18) unsigned, d2 decimal(20) unsigned, d3 decimal (22) unsigned);
insert into t1 values(1,-1,-1);
-ERROR 22003: Out of range value adjusted for column 'd2' at row 1
+ERROR 22003: Out of range value for column 'd2' at row 1
drop table t1;
create table t1 (col1 decimal(5,2), col2 numeric(5,2));
insert into t1 values (999.999,999.999);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
insert into t1 values (-999.999,-999.999);
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR 22003: Out of range value for column 'col1' at row 1
select * from t1;
col1 col2
drop table t1;
@@ -934,14 +934,14 @@ create table t1 (sl decimal(5, 5));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `sl` decimal(5,5) default NULL
+ `sl` decimal(5,5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (sl decimal(65, 30));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `sl` decimal(65,30) default NULL
+ `sl` decimal(65,30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (
@@ -973,8 +973,8 @@ f1 decimal (0,0) zerofill not null default 0);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f0` decimal(30,30) unsigned zerofill NOT NULL default '0.000000000000000000000000000000',
- `f1` decimal(10,0) unsigned zerofill NOT NULL default '0000000000'
+ `f0` decimal(30,30) unsigned zerofill NOT NULL DEFAULT '0.000000000000000000000000000000',
+ `f1` decimal(10,0) unsigned zerofill NOT NULL DEFAULT '0000000000'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
drop procedure if exists wg2;
@@ -1021,10 +1021,10 @@ my_decimal DECIMAL(65,30)
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `my_float` float default NULL,
- `my_double` double default NULL,
- `my_varchar` varchar(50) default NULL,
- `my_decimal` decimal(65,30) default NULL
+ `my_float` float DEFAULT NULL,
+ `my_double` double DEFAULT NULL,
+ `my_varchar` varchar(50) DEFAULT NULL,
+ `my_decimal` decimal(65,30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 SET my_float = 1.175494345e-32,
my_double = 1.175494345e-32,
@@ -1381,7 +1381,7 @@ insert into t1 values(
89000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
insert into t1 values(
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 *
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999);
@@ -1389,16 +1389,26 @@ Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
insert into t1 values(1e100);
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
+Warning 1264 Out of range value for column 'c1' at row 1
select * from t1;
c1
9999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999
drop table t1;
+create table t1(a decimal(7,2));
+insert into t1 values(123.12);
+select * from t1;
+a
+123.12
+alter table t1 modify a decimal(10,2);
+select * from t1;
+a
+123.12
+drop table t1;
create table t1 (i int, j int);
insert into t1 values (1,1), (1,2), (2,3), (2,4);
select i, count(distinct j) from t1 group by i;
@@ -1410,3 +1420,30 @@ i2 count(distinct j)
1.0 2
2.0 2
drop table t1;
+select cast(143.481 as decimal(4,1));
+cast(143.481 as decimal(4,1))
+143.5
+select cast(143.481 as decimal(4,0));
+cast(143.481 as decimal(4,0))
+143
+select cast(143.481 as decimal(2,1));
+cast(143.481 as decimal(2,1))
+9.9
+Warnings:
+Error 1264 Out of range value for column 'cast(143.481 as decimal(2,1))' at row 1
+select cast(-3.4 as decimal(2,1));
+cast(-3.4 as decimal(2,1))
+-3.4
+select cast(99.6 as decimal(2,0));
+cast(99.6 as decimal(2,0))
+99
+Warnings:
+Error 1264 Out of range value for column 'cast(99.6 as decimal(2,0))' at row 1
+select cast(-13.4 as decimal(2,1));
+cast(-13.4 as decimal(2,1))
+-9.9
+Warnings:
+Error 1264 Out of range value for column 'cast(-13.4 as decimal(2,1))' at row 1
+select cast(98.6 as decimal(2,0));
+cast(98.6 as decimal(2,0))
+99
diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result
index e949d734944..ce5bb9ceb2f 100644
--- a/mysql-test/r/type_ranges.result
+++ b/mysql-test/r/type_ranges.result
@@ -94,35 +94,35 @@ Warnings:
Warning 1265 Data truncated for column 'string' at row 1
insert into t1 values (0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,NULL,19970807,080706,19970403090807,-1,-1,-1,'-1',-1,-1);
Warnings:
-Warning 1264 Out of range value adjusted for column 'utiny' at row 1
-Warning 1264 Out of range value adjusted for column 'ushort' at row 1
-Warning 1264 Out of range value adjusted for column 'umedium' at row 1
-Warning 1264 Out of range value adjusted for column 'ulong' at row 1
-Warning 1264 Out of range value adjusted for column 'ulonglong' at row 1
+Warning 1264 Out of range value for column 'utiny' at row 1
+Warning 1264 Out of range value for column 'ushort' at row 1
+Warning 1264 Out of range value for column 'umedium' at row 1
+Warning 1264 Out of range value for column 'ulong' at row 1
+Warning 1264 Out of range value for column 'ulonglong' at row 1
Warning 1265 Data truncated for column 'options' at row 1
Warning 1265 Data truncated for column 'flags' at row 1
insert into t1 values (0,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,NULL,0,0,0,-4294967295,-4294967295,-4294967295,'-4294967295',0,"one,two,tree");
Warnings:
Warning 1265 Data truncated for column 'string' at row 1
-Warning 1264 Out of range value adjusted for column 'tiny' at row 1
-Warning 1264 Out of range value adjusted for column 'short' at row 1
-Warning 1264 Out of range value adjusted for column 'medium' at row 1
-Warning 1264 Out of range value adjusted for column 'long_int' at row 1
-Warning 1264 Out of range value adjusted for column 'utiny' at row 1
-Warning 1264 Out of range value adjusted for column 'ushort' at row 1
-Warning 1264 Out of range value adjusted for column 'umedium' at row 1
-Warning 1264 Out of range value adjusted for column 'ulong' at row 1
-Warning 1264 Out of range value adjusted for column 'ulonglong' at row 1
+Warning 1264 Out of range value for column 'tiny' at row 1
+Warning 1264 Out of range value for column 'short' at row 1
+Warning 1264 Out of range value for column 'medium' at row 1
+Warning 1264 Out of range value for column 'long_int' at row 1
+Warning 1264 Out of range value for column 'utiny' at row 1
+Warning 1264 Out of range value for column 'ushort' at row 1
+Warning 1264 Out of range value for column 'umedium' at row 1
+Warning 1264 Out of range value for column 'ulong' at row 1
+Warning 1264 Out of range value for column 'ulonglong' at row 1
Warning 1265 Data truncated for column 'options' at row 1
insert into t1 values (0,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,NULL,0,0,0,4294967295,4294967295,4294967295,'4294967295',0,0);
Warnings:
-Warning 1264 Out of range value adjusted for column 'tiny' at row 1
-Warning 1264 Out of range value adjusted for column 'short' at row 1
-Warning 1264 Out of range value adjusted for column 'medium' at row 1
-Warning 1264 Out of range value adjusted for column 'long_int' at row 1
-Warning 1264 Out of range value adjusted for column 'utiny' at row 1
-Warning 1264 Out of range value adjusted for column 'ushort' at row 1
-Warning 1264 Out of range value adjusted for column 'umedium' at row 1
+Warning 1264 Out of range value for column 'tiny' at row 1
+Warning 1264 Out of range value for column 'short' at row 1
+Warning 1264 Out of range value for column 'medium' at row 1
+Warning 1264 Out of range value for column 'long_int' at row 1
+Warning 1264 Out of range value for column 'utiny' at row 1
+Warning 1264 Out of range value for column 'ushort' at row 1
+Warning 1264 Out of range value for column 'umedium' at row 1
Warning 1265 Data truncated for column 'options' at row 1
insert into t1 (tiny) values (1);
select auto,string,tiny,short,medium,long_int,longlong,real_float,real_double,utiny,ushort,umedium,ulong,ulonglong,mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000),date_field,time_field,date_time,blob_col,tinyblob_col,mediumblob_col,longblob_col from t1;
@@ -326,7 +326,7 @@ select * from t3;
id_A id_B
1 1
2 NULL
-delete from t3;
+truncate table t3;
insert into t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 on (t1.id = t2.id);
select * from t3;
id_A id_B
diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result
index fdda4aca25c..36022383f1b 100644
--- a/mysql-test/r/type_set.result
+++ b/mysql-test/r/type_set.result
@@ -10,7 +10,7 @@ create table t1 (a set (' ','a','b ') not null default 'b ');
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` set('','a','b') NOT NULL default 'b'
+ `a` set('','a','b') NOT NULL DEFAULT 'b'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 ( user varchar(64) NOT NULL default '', path varchar(255) NOT NULL default '', privilege set('select','RESERVED30','RESERVED29','RESERVED28','RESERVED27','RESERVED26', 'RESERVED25','RESERVED24','data.delete','RESERVED22','RESERVED21', 'RESERVED20','data.insert.none','data.insert.approve', 'data.insert.delete','data.insert.move','data.insert.propose', 'data.insert.reject','RESERVED13','RESERVED12','RESERVED11','RESERVED10', 'RESERVED09','data.update','RESERVED07','RESERVED06','RESERVED05', 'RESERVED04','metadata.delete','metadata.put','RESERVED01','RESERVED00') NOT NULL default '', KEY user (user) ) ENGINE=MyISAM CHARSET=utf8;
@@ -20,7 +20,7 @@ create table t1 (s set ('a','A') character set latin1 collate latin1_bin);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `s` set('a','A') character set latin1 collate latin1_bin default NULL
+ `s` set('a','A') CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ('a'),('a,A'),('A,a'),('A');
select s from t1 order by s;
diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result
index 442435b0459..ce820c0cb8e 100644
--- a/mysql-test/r/type_time.result
+++ b/mysql-test/r/type_time.result
@@ -26,9 +26,9 @@ t
insert into t1 values("10.22.22"),(1234567),(123456789),(123456789.10),("10 22:22"),("12.45a");
Warnings:
Warning 1265 Data truncated for column 't' at row 1
-Warning 1264 Out of range value adjusted for column 't' at row 2
-Warning 1264 Out of range value adjusted for column 't' at row 3
-Warning 1264 Out of range value adjusted for column 't' at row 4
+Warning 1264 Out of range value for column 't' at row 2
+Warning 1264 Out of range value for column 't' at row 3
+Warning 1264 Out of range value for column 't' at row 4
Warning 1265 Data truncated for column 't' at row 6
select * from t1;
t
diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result
index 445ada578d0..281a5f3fab6 100644
--- a/mysql-test/r/type_timestamp.result
+++ b/mysql-test/r/type_timestamp.result
@@ -60,7 +60,7 @@ ix+0
19990501000000
19991101000000
19990501000000
-delete from t1;
+truncate table t1;
insert into t1 values ("19991101000000"),("19990102030405"),("19990630232922"),("19990601000000");
select ix+0 from t1;
ix+0
@@ -101,13 +101,13 @@ create table t1 (t2 timestamp(2), t4 timestamp(4), t6 timestamp(6),
t8 timestamp(8), t10 timestamp(10), t12 timestamp(12),
t14 timestamp(14));
Warnings:
-Warning 1287 'TIMESTAMP(2)' is deprecated; use 'TIMESTAMP' instead
-Warning 1287 'TIMESTAMP(4)' is deprecated; use 'TIMESTAMP' instead
-Warning 1287 'TIMESTAMP(6)' is deprecated; use 'TIMESTAMP' instead
-Warning 1287 'TIMESTAMP(8)' is deprecated; use 'TIMESTAMP' instead
-Warning 1287 'TIMESTAMP(10)' is deprecated; use 'TIMESTAMP' instead
-Warning 1287 'TIMESTAMP(12)' is deprecated; use 'TIMESTAMP' instead
-Warning 1287 'TIMESTAMP(14)' is deprecated; use 'TIMESTAMP' instead
+Warning 1541 The syntax 'TIMESTAMP(2)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
+Warning 1541 The syntax 'TIMESTAMP(4)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
+Warning 1541 The syntax 'TIMESTAMP(6)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
+Warning 1541 The syntax 'TIMESTAMP(8)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
+Warning 1541 The syntax 'TIMESTAMP(10)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
+Warning 1541 The syntax 'TIMESTAMP(12)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
+Warning 1541 The syntax 'TIMESTAMP(14)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
insert t1 values (0,0,0,0,0,0,0),
("1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
"1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
@@ -141,7 +141,7 @@ ix+0
0
0
0
-delete from t1;
+truncate table t1;
insert into t1 values ("00000000000000"),("20030101010160"),("20030101016001"),("20030101240101"),("20030132010101"),("20031301010101"),("20031200000000"),("20030000000000");
Warnings:
Warning 1265 Data truncated for column 'ix' at row 2
@@ -161,7 +161,7 @@ ix+0
0
0
0
-delete from t1;
+truncate table t1;
insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
Warnings:
Warning 1265 Data truncated for column 'ix' at row 1
@@ -195,9 +195,9 @@ t1 t2 t3
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `t1` timestamp NOT NULL default '2003-01-01 00:00:00',
- `t2` datetime default NULL,
- `t3` timestamp NOT NULL default '0000-00-00 00:00:00'
+ `t1` timestamp NOT NULL DEFAULT '2003-01-01 00:00:00',
+ `t2` datetime DEFAULT NULL,
+ `t3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
@@ -219,9 +219,9 @@ t1 t2 t3
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `t1` timestamp NOT NULL default CURRENT_TIMESTAMP,
- `t2` datetime default NULL,
- `t3` timestamp NOT NULL default '0000-00-00 00:00:00'
+ `t1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `t2` datetime DEFAULT NULL,
+ `t3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
@@ -246,8 +246,8 @@ t1 t2
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `t1` timestamp NOT NULL default '2003-01-01 00:00:00' on update CURRENT_TIMESTAMP,
- `t2` datetime default NULL
+ `t1` timestamp NOT NULL DEFAULT '2003-01-01 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
+ `t2` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
@@ -271,8 +271,8 @@ t1 t2
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `t1` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
- `t2` datetime default NULL
+ `t1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `t2` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
@@ -296,9 +296,9 @@ t1 t2 t3
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `t1` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
- `t2` datetime default NULL,
- `t3` timestamp NOT NULL default '0000-00-00 00:00:00'
+ `t1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `t2` datetime DEFAULT NULL,
+ `t3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
@@ -323,14 +323,14 @@ t1 t2
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `t1` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
- `t2` datetime default NULL
+ `t1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `t2` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
t1 timestamp NO CURRENT_TIMESTAMP
t2 datetime YES NULL
-delete from t1;
+truncate table t1;
insert into t1 values ('2004-04-01 00:00:00', '2004-04-01 00:00:00');
SET TIMESTAMP=1000000012;
update t1 set t1= '2004-04-02 00:00:00';
@@ -378,8 +378,8 @@ create table t1 (a timestamp null, b timestamp null);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` timestamp NULL default NULL,
- `b` timestamp NULL default NULL
+ `a` timestamp NULL DEFAULT NULL,
+ `b` timestamp NULL DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (NULL, NULL);
SET TIMESTAMP=1000000017;
@@ -393,8 +393,8 @@ create table t1 (a timestamp null default current_timestamp on update current_ti
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` timestamp NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
- `b` timestamp NULL default NULL
+ `a` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `b` timestamp NULL DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (NULL, NULL);
SET TIMESTAMP=1000000018;
@@ -408,8 +408,8 @@ create table t1 (a timestamp null default null, b timestamp null default '2003-0
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` timestamp NULL default NULL,
- `b` timestamp NULL default '2003-01-01 00:00:00'
+ `a` timestamp NULL DEFAULT NULL,
+ `b` timestamp NULL DEFAULT '2003-01-01 00:00:00'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (NULL, NULL);
insert into t1 values (DEFAULT, DEFAULT);
@@ -440,8 +440,8 @@ create table t1 (a timestamp, b timestamp(19));
show create table t1;
Table Create Table
t1 CREATE TABLE "t1" (
- "a" datetime default NULL,
- "b" datetime default NULL
+ "a" datetime DEFAULT NULL,
+ "b" datetime DEFAULT NULL
)
set sql_mode='';
drop table t1;
diff --git a/mysql-test/r/type_uint.result b/mysql-test/r/type_uint.result
index 0474f3a24f4..e08605fb237 100644
--- a/mysql-test/r/type_uint.result
+++ b/mysql-test/r/type_uint.result
@@ -4,10 +4,10 @@ create table t1 (this int unsigned);
insert into t1 values (1);
insert into t1 values (-1);
Warnings:
-Warning 1264 Out of range value adjusted for column 'this' at row 1
+Warning 1264 Out of range value for column 'this' at row 1
insert into t1 values ('5000000000');
Warnings:
-Warning 1264 Out of range value adjusted for column 'this' at row 1
+Warning 1264 Out of range value for column 'this' at row 1
select * from t1;
this
1
diff --git a/mysql-test/r/type_varchar.result b/mysql-test/r/type_varchar.result
index 1d707b83a4d..9ad3d5bb611 100644
--- a/mysql-test/r/type_varchar.result
+++ b/mysql-test/r/type_varchar.result
@@ -4,17 +4,17 @@ truncate table vchar;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` varchar(30) default NULL,
- `c` char(3) default NULL,
- `e` enum('abc','def','ghi') default NULL,
+ `v` varchar(30) DEFAULT NULL,
+ `c` char(3) DEFAULT NULL,
+ `e` enum('abc','def','ghi') DEFAULT NULL,
`t` text
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table vchar;
Table Create Table
vchar CREATE TABLE `vchar` (
- `v` varchar(30) default NULL,
- `c` char(3) default NULL,
- `e` enum('abc','def','ghi') default NULL,
+ `v` varchar(30) DEFAULT NULL,
+ `c` char(3) DEFAULT NULL,
+ `e` enum('abc','def','ghi') DEFAULT NULL,
`t` text
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ('abc', 'de', 'ghi', 'jkl');
@@ -37,11 +37,11 @@ alter table vchar add i int;
show create table vchar;
Table Create Table
vchar CREATE TABLE `vchar` (
- `v` varchar(30) default NULL,
- `c` char(3) default NULL,
- `e` enum('abc','def','ghi') default NULL,
+ `v` varchar(30) DEFAULT NULL,
+ `c` char(3) DEFAULT NULL,
+ `e` enum('abc','def','ghi') DEFAULT NULL,
`t` text,
- `i` int(11) default NULL
+ `i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select length(v),length(c),length(e),length(t) from vchar;
length(v) length(c) length(e) length(t)
@@ -62,7 +62,7 @@ binary v='a '
1
insert into t1 values('a');
alter table t1 add primary key (v);
-ERROR 23000: Duplicate entry 'a' for key 1
+ERROR 23000: Duplicate entry 'a' for key 'PRIMARY'
drop table t1;
create table t1 (v varbinary(20));
insert into t1 values('a');
@@ -397,14 +397,14 @@ create index index1 on t1(f1(10));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f1` varchar(65500) default NULL,
+ `f1` varchar(65500) DEFAULT NULL,
KEY `index1` (`f1`(10))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 modify f1 varchar(255);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f1` varchar(255) default NULL,
+ `f1` varchar(255) DEFAULT NULL,
KEY `index1` (`f1`(10))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 modify f1 tinytext;
diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result
index 8501b82fcdf..6b72dcd4f30 100644
--- a/mysql-test/r/udf.result
+++ b/mysql-test/r/udf.result
@@ -2,7 +2,7 @@ drop table if exists t1;
CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
-ERROR HY000: Can't find function 'myfunc_nonexist' in library
+ERROR HY000: Can't find symbol 'myfunc_nonexist' in library
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
CREATE FUNCTION sequence RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
CREATE FUNCTION lookup RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index dc174e35c8f..9805b788a73 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -83,10 +83,10 @@ a b
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b;
ERROR 42000: Table 't1' from one of the SELECTs cannot be used in global ORDER clause
explain extended (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 4
-2 UNION t2 ALL NULL NULL NULL NULL 4 Using filesort
-NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL Using filesort
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4 100.00
+2 UNION t2 ALL NULL NULL NULL NULL 4 100.00 Using filesort
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort
Warnings:
Note 1003 (select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` limit 2) union all (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` order by `test`.`t2`.`a` limit 1) order by `b` desc
(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
@@ -475,10 +475,10 @@ create table t2 (a int not null primary key auto_increment, b int);
insert into t1 (b) values (1),(2),(2),(3);
insert into t2 (b) values (10),(11),(12),(13);
explain extended (select * from t1 where a=1) union (select * from t2 where a=1);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1
-2 UNION t2 const PRIMARY PRIMARY 4 const 1
-NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 100.00
+2 UNION t2 const PRIMARY PRIMARY 4 const 1 100.00
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1003 (select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a` = 1)) union (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` = 1))
(select * from t1 where a=5) union (select * from t2 where a=1);
@@ -500,7 +500,7 @@ explain (select * from t1 where a=1 and b=10) union (select straight_join t1.a,t
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 UNION t1 index PRIMARY PRIMARY 4 NULL 4 Using index
-2 UNION t2 index PRIMARY PRIMARY 4 NULL 3 Using where; Using index
+2 UNION t2 index PRIMARY PRIMARY 4 NULL 4 Using where; Using index
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
explain (select * from t1 where a=1) union (select * from t1 where b=1);
id select_type table type possible_keys key key_len ref rows Extra
@@ -543,7 +543,7 @@ aa
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(2) NOT NULL default ''
+ `a` varchar(2) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT 12 as a UNION select "aa" as a;
@@ -554,7 +554,7 @@ aa
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varbinary(20) NOT NULL default ''
+ `a` varbinary(20) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT 12 as a UNION select 12.2 as a;
@@ -565,7 +565,7 @@ a
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` decimal(3,1) NOT NULL default '0.0'
+ `a` decimal(3,1) NOT NULL DEFAULT '0.0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t2 (it1 tinyint, it2 tinyint not null, i int not null, ib bigint, f float, d double, y year, da date, dt datetime, sc char(10), sv varchar(10), b blob, tx text);
@@ -578,7 +578,7 @@ NULL
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `it2` tinyint(4) default NULL
+ `it2` tinyint(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT it2 from t2 UNION select i from t2;
@@ -589,7 +589,7 @@ it2
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `it2` int(11) NOT NULL default '0'
+ `it2` int(11) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT i from t2 UNION select f from t2;
@@ -600,7 +600,7 @@ i
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` double default NULL
+ `i` double DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT f from t2 UNION select d from t2;
@@ -611,7 +611,7 @@ f
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f` double default NULL
+ `f` double DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT ib from t2 UNION select f from t2;
@@ -622,7 +622,7 @@ ib
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `ib` double default NULL
+ `ib` double DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT ib from t2 UNION select d from t2;
@@ -633,7 +633,7 @@ ib
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `ib` double default NULL
+ `ib` double DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT f from t2 UNION select y from t2;
@@ -644,7 +644,7 @@ f
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f` float default NULL
+ `f` float DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT f from t2 UNION select da from t2;
@@ -655,7 +655,7 @@ f
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f` varbinary(24) default NULL
+ `f` varbinary(24) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT y from t2 UNION select da from t2;
@@ -666,7 +666,7 @@ y
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `y` varbinary(10) default NULL
+ `y` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT y from t2 UNION select dt from t2;
@@ -677,7 +677,7 @@ y
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `y` varbinary(19) default NULL
+ `y` varbinary(19) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT da from t2 UNION select dt from t2;
@@ -688,7 +688,7 @@ da
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `da` datetime default NULL
+ `da` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT dt from t2 UNION select trim(sc) from t2;
@@ -699,7 +699,7 @@ testc
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `dt` varbinary(19) default NULL
+ `dt` varbinary(19) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT dt from t2 UNION select sv from t2;
@@ -710,7 +710,7 @@ testv
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `dt` varbinary(19) default NULL
+ `dt` varbinary(19) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT sc from t2 UNION select sv from t2;
@@ -721,7 +721,7 @@ testv
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `sc` varchar(10) default NULL
+ `sc` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT dt from t2 UNION select b from t2;
@@ -788,7 +788,7 @@ select * from t1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `1` bigint(20) NOT NULL default '0'
+ `1` bigint(20) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 select _latin1"test" union select _latin2"testt" ;
@@ -797,7 +797,7 @@ create table t1 select _latin2"test" union select _latin2"testt" ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `test` varchar(5) character set latin2 NOT NULL default ''
+ `test` varchar(5) CHARACTER SET latin2 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (s char(200));
@@ -1041,7 +1041,7 @@ create table t1 as
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `test` varchar(4) NOT NULL default ''
+ `test` varchar(4) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select count(*) from t1;
count(*)
@@ -1054,7 +1054,7 @@ create table t1 as
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `_latin1'test' collate latin1_bin` varchar(4) character set latin1 collate latin1_bin NOT NULL default ''
+ `_latin1'test' collate latin1_bin` varchar(4) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select count(*) from t1;
count(*)
@@ -1067,7 +1067,7 @@ create table t1 as
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `test` varchar(4) character set latin1 collate latin1_bin NOT NULL default ''
+ `test` varchar(4) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select count(*) from t1;
count(*)
@@ -1080,7 +1080,7 @@ create table t1 as
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `test` varchar(4) character set latin1 collate latin1_bin NOT NULL default ''
+ `test` varchar(4) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select count(*) from t1;
count(*)
@@ -1099,7 +1099,7 @@ create table t1 as
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a collate latin1_german1_ci` varchar(1) character set latin1 collate latin1_german1_ci default NULL
+ `a collate latin1_german1_ci` varchar(1) CHARACTER SET latin1 COLLATE latin1_german1_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as
@@ -1108,7 +1108,7 @@ create table t1 as
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) character set latin1 collate latin1_german1_ci default NULL
+ `a` varchar(1) CHARACTER SET latin1 COLLATE latin1_german1_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as
@@ -1118,7 +1118,7 @@ create table t1 as
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) character set latin1 collate latin1_german1_ci default NULL
+ `a` varchar(1) CHARACTER SET latin1 COLLATE latin1_german1_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
drop table t2;
@@ -1203,9 +1203,9 @@ c ENUM("one", "two")
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` enum('','','') character set utf8 NOT NULL default '',
- `b` enum('one','two') character set utf8 default NULL,
- `c` enum('one','two') default NULL
+ `a` enum('','','') CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `b` enum('one','two') CHARACTER SET utf8 DEFAULT NULL,
+ `c` enum('one','two') DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ('', 'one', 'one'), ('', 'two', 'one'), ('', NULL, NULL);
create table t2 select NULL union select a from t1;
@@ -1261,7 +1261,7 @@ create table t2 select * from t1 union select 'abcdefghijkl';
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` varchar(12) default NULL
+ `a` varchar(12) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select row_format from information_schema.TABLES where table_schema="test" and table_name="t2";
row_format
@@ -1270,7 +1270,7 @@ alter table t2 ROW_FORMAT=fixed;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` varchar(12) default NULL
+ `a` varchar(12) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED
drop table t1,t2;
CREATE TABLE t1 (a mediumtext);
@@ -1284,9 +1284,65 @@ create table t3 SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
+ `left(a,100000000)` mediumtext
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop tables t1,t2,t3;
+CREATE TABLE t1 (a longtext);
+CREATE TABLE t2 (b varchar(20));
+INSERT INTO t1 VALUES ('a'),('b');
+SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2;
+left(a,100000000)
+a
+b
+create table t3 SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2;
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
`left(a,100000000)` longtext
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop tables t1,t2,t3;
+SELECT @tmp_max:= @@max_allowed_packet;
+@tmp_max:= @@max_allowed_packet
+1048576
+SET max_allowed_packet=25000000;
+CREATE TABLE t1 (a mediumtext);
+CREATE TABLE t2 (b varchar(20));
+INSERT INTO t1 VALUES ('a');
+CREATE TABLE t3 SELECT REPEAT(a,20000000) AS a FROM t1 UNION SELECT b FROM t2;
+SHOW CREATE TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` longtext
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLES t1,t3;
+CREATE TABLE t1 (a tinytext);
+INSERT INTO t1 VALUES ('a');
+CREATE TABLE t3 SELECT REPEAT(a,2) AS a FROM t1 UNION SELECT b FROM t2;
+SHOW CREATE TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` varchar(510) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLES t1,t3;
+CREATE TABLE t1 (a mediumtext);
+INSERT INTO t1 VALUES ('a');
+CREATE TABLE t3 SELECT REPEAT(a,2) AS a FROM t1 UNION SELECT b FROM t2;
+SHOW CREATE TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` longtext
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLES t1,t3;
+CREATE TABLE t1 (a tinyblob);
+INSERT INTO t1 VALUES ('a');
+CREATE TABLE t3 SELECT REPEAT(a,2) AS a FROM t1 UNION SELECT b FROM t2;
+SHOW CREATE TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` varbinary(510) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLES t1,t2,t3;
+SET max_allowed_packet:= @tmp_max;
create table t1 ( id int not null auto_increment, primary key (id), col1 int);
insert into t1 (col1) values (2),(3),(4),(5),(6);
select 99 union all select id from t1 order by 1;
@@ -1311,14 +1367,14 @@ create table t2 as select *, f6 as f8 from t1 union select *, f7 from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `f1` char(1) default NULL,
- `f2` char(5) default NULL,
- `f3` binary(1) default NULL,
- `f4` binary(5) default NULL,
- `f5` timestamp NOT NULL default '0000-00-00 00:00:00',
- `f6` varchar(1) character set utf8 default NULL,
+ `f1` char(1) DEFAULT NULL,
+ `f2` char(5) DEFAULT NULL,
+ `f3` binary(1) DEFAULT NULL,
+ `f4` binary(5) DEFAULT NULL,
+ `f5` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `f6` varchar(1) CHARACTER SET utf8 DEFAULT NULL,
`f7` text,
- `f8` mediumtext character set utf8
+ `f8` mediumtext CHARACTER SET utf8
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
(select avg(1)) union (select avg(1)) union (select avg(1)) union
diff --git a/mysql-test/r/unsafe_binlog_innodb.result b/mysql-test/r/unsafe_binlog_innodb.result
new file mode 100644
index 00000000000..54a24a52d57
--- /dev/null
+++ b/mysql-test/r/unsafe_binlog_innodb.result
@@ -0,0 +1,123 @@
+drop table if exists t1,t2;
+create table t1 (id int not null, f_id int not null, f int not null,
+primary key(f_id, id)) engine = InnoDB;
+create table t2 (id int not null,s_id int not null,s varchar(200),
+primary key(id)) engine = InnoDB;
+INSERT INTO t1 VALUES (8, 1, 3);
+INSERT INTO t1 VALUES (1, 2, 1);
+INSERT INTO t2 VALUES (1, 0, '');
+INSERT INTO t2 VALUES (8, 1, '');
+commit;
+DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id)
+WHERE mm.id IS NULL;
+select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
+where mm.id is null lock in share mode;
+id f_id f
+drop table t1,t2;
+create table t1(a int not null, b int, primary key(a)) engine = InnoDB;
+insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
+commit;
+set autocommit = 0;
+select * from t1 lock in share mode;
+a b
+1 1
+2 2
+3 1
+4 2
+5 1
+6 2
+7 3
+update t1 set b = 5 where b = 1;
+set autocommit = 0;
+select * from t1 where a = 2 and b = 2 for update;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+commit;
+commit;
+drop table t1;
+create table t1(a int not null, b int, primary key(a)) engine = InnoDB;
+insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
+commit;
+set autocommit = 0;
+update t1 set b = 5 where b = 1;
+set autocommit = 0;
+select * from t1 where a = 7 and b = 3 for update;
+a b
+7 3
+commit;
+commit;
+drop table t1;
+create table t1(a int not null, b int, primary key(a)) engine = InnoDB;
+insert into t1 values (1,2),(5,3),(4,2);
+create table t2(d int not null, e int, primary key(d)) engine = InnoDB;
+insert into t2 values (8,6),(12,1),(3,1);
+commit;
+set autocommit = 0;
+select * from t2 for update;
+d e
+3 1
+8 6
+12 1
+set autocommit = 0;
+insert into t1 select * from t2;
+update t1 set b = (select e from t2 where a = d);
+create table t3(d int not null, e int, primary key(d)) engine = InnoDB
+select * from t2;
+commit;
+commit;
+drop table t1, t2, t3;
+SET SESSION STORAGE_ENGINE = InnoDB;
+SET SESSION STORAGE_ENGINE = InnoDB;
+SET SESSION STORAGE_ENGINE = InnoDB;
+create table t1(a int not null, b int, primary key(a)) engine = InnoDB;
+insert into t1 values (1,2),(5,3),(4,2);
+create table t2(a int not null, b int, primary key(a)) engine = InnoDB;
+insert into t2 values (8,6),(12,1),(3,1);
+create table t3(d int not null, b int, primary key(d)) engine = InnoDB;
+insert into t3 values (8,6),(12,1),(3,1);
+create table t5(a int not null, b int, primary key(a)) engine = InnoDB;
+insert into t5 values (1,2),(5,3),(4,2);
+create table t6(d int not null, e int, primary key(d)) engine = InnoDB;
+insert into t6 values (8,6),(12,1),(3,1);
+create table t8(a int not null, b int, primary key(a)) engine = InnoDB;
+insert into t8 values (1,2),(5,3),(4,2);
+create table t9(d int not null, e int, primary key(d)) engine = InnoDB;
+insert into t9 values (8,6),(12,1),(3,1);
+commit;
+set autocommit = 0;
+select * from t2 for update;
+a b
+3 1
+8 6
+12 1
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+insert into t1 select * from t2;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+update t3 set b = (select b from t2 where a = d);
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+create table t4(a int not null, b int, primary key(a)) select * from t2;
+set autocommit = 0;
+insert into t5 (select * from t2 lock in share mode);
+set autocommit = 0;
+update t6 set e = (select b from t2 where a = d lock in share mode);
+set autocommit = 0;
+create table t7(a int not null, b int, primary key(a)) select * from t2 lock in share mode;
+set autocommit = 0;
+insert into t8 (select * from t2 for update);
+set autocommit = 0;
+update t9 set e = (select b from t2 where a = d for update);
+set autocommit = 0;
+create table t10(a int not null, b int, primary key(a)) select * from t2 for update;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+commit;
+drop table t1, t2, t3, t5, t6, t8, t9;
diff --git a/mysql-test/r/upgrade.result b/mysql-test/r/upgrade.result
new file mode 100644
index 00000000000..8a2249480e9
--- /dev/null
+++ b/mysql-test/r/upgrade.result
@@ -0,0 +1,59 @@
+drop database if exists `mysqltest1`;
+drop database if exists `mysqltest-1`;
+drop database if exists `#mysql50#mysqltest-1`;
+create database `mysqltest1`;
+create database `#mysql50#mysqltest-1`;
+create table `mysqltest1`.`t1` (a int);
+create table `mysqltest1`.`#mysql50#t-1` (a int);
+create table `#mysql50#mysqltest-1`.`t1` (a int);
+create table `#mysql50#mysqltest-1`.`#mysql50#t-1` (a int);
+show create database `mysqltest1`;
+Database Create Database
+mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 */
+show create database `mysqltest-1`;
+ERROR 42000: Unknown database 'mysqltest-1'
+show create database `#mysql50#mysqltest-1`;
+Database Create Database
+#mysql50#mysqltest-1 CREATE DATABASE `#mysql50#mysqltest-1` /*!40100 DEFAULT CHARACTER SET latin1 */
+show tables in `mysqltest1`;
+Tables_in_mysqltest1
+#mysql50#t-1
+t1
+show tables in `#mysql50#mysqltest-1`;
+Tables_in_#mysql50#mysqltest-1
+#mysql50#t-1
+t1
+show create database `mysqltest1`;
+Database Create Database
+mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 */
+show create database `mysqltest-1`;
+Database Create Database
+mysqltest-1 CREATE DATABASE `mysqltest-1` /*!40100 DEFAULT CHARACTER SET latin1 */
+show create database `#mysql50#mysqltest-1`;
+ERROR 42000: Unknown database '#mysql50#mysqltest-1'
+show tables in `mysqltest1`;
+Tables_in_mysqltest1
+t1
+t-1
+show tables in `mysqltest-1`;
+Tables_in_mysqltest-1
+t1
+t-1
+drop database `mysqltest1`;
+drop database `mysqltest-1`;
+drop table if exists `txu@0023p@0023p1`;
+drop table if exists `txu#p#p1`;
+create table `txu#p#p1` (s1 int);
+insert into `txu#p#p1` values (1);
+select * from `txu@0023p@0023p1`;
+ERROR 42S02: Table 'test.txu@0023p@0023p1' doesn't exist
+create table `txu@0023p@0023p1` (s1 int);
+insert into `txu@0023p@0023p1` values (2);
+select * from `txu@0023p@0023p1`;
+s1
+2
+select * from `txu#p#p1`;
+s1
+1
+drop table `txu@0023p@0023p1`;
+drop table `txu#p#p1`;
diff --git a/mysql-test/r/user_var-binlog.result b/mysql-test/r/user_var-binlog.result
index d1555bb793f..8813d2b499f 100644
--- a/mysql-test/r/user_var-binlog.result
+++ b/mysql-test/r/user_var-binlog.result
@@ -6,13 +6,13 @@ INSERT INTO t1 VALUES(@`a b`);
set @var1= "';aaa";
SET @var2=char(ascii('a'));
insert into t1 values (@var1),(@var2);
-show binlog events from 98;
+show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 98 User var 1 139 @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci
-master-bin.000001 139 Query 1 231 use `test`; INSERT INTO t1 VALUES(@`a b`)
-master-bin.000001 231 User var 1 273 @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
-master-bin.000001 273 User var 1 311 @`var2`=_binary 0x61 COLLATE binary
-master-bin.000001 311 Query 1 411 use `test`; insert into t1 values (@var1),(@var2)
+master-bin.000001 # User var 1 # @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci
+master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES(@`a b`)
+master-bin.000001 # User var 1 # @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
+master-bin.000001 # User var 1 # @`var2`=_binary 0x61 COLLATE binary
+master-bin.000001 # Query 1 # use `test`; insert into t1 values (@var1),(@var2)
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
ROLLBACK;
diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result
index 90954fc1ede..8382f521b84 100644
--- a/mysql-test/r/user_var.result
+++ b/mysql-test/r/user_var.result
@@ -229,7 +229,7 @@ create table t1 select @first_var;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `@first_var` bigint(20) default NULL
+ `@first_var` bigint(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @first_var= NULL;
@@ -237,7 +237,7 @@ create table t1 select @first_var;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `@first_var` bigint(20) default NULL
+ `@first_var` bigint(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @first_var= concat(NULL);
diff --git a/mysql-test/r/varbinary.result b/mysql-test/r/varbinary.result
index e62051df5cd..1841dc9f0a9 100644
--- a/mysql-test/r/varbinary.result
+++ b/mysql-test/r/varbinary.result
@@ -12,8 +12,8 @@ create table t1 (ID int(8) unsigned zerofill not null auto_increment,UNIQ bigint
insert into t1 set UNIQ=0x38afba1d73e6a18a;
insert into t1 set UNIQ=123;
explain extended select * from t1 where UNIQ=0x38afba1d73e6a18a;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 const UNIQ UNIQ 8 const 1
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 const UNIQ UNIQ 8 const 1 100.00
Warnings:
Note 1003 select `test`.`t1`.`ID` AS `ID`,`test`.`t1`.`UNIQ` AS `UNIQ` from `test`.`t1` where 1
drop table t1;
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index cd834a789bd..f759e78adbf 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -72,8 +72,8 @@ select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
@t1:=(@t2:=1)+@t3:=4 @t1 @t2 @t3
5 5 1 4
explain extended select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select (@t1:=((@t2:=1) + (@t3:=4))) AS `@t1:=(@t2:=1)+@t3:=4`,(@t1) AS `@t1`,(@t2) AS `@t2`,(@t3) AS `@t3`
select @t5;
@@ -103,21 +103,36 @@ set max_join_size=100;
show variables like 'max_join_size';
Variable_name Value
max_join_size 100
+select * from information_schema.session_variables where variable_name like 'max_join_size';
+VARIABLE_NAME VARIABLE_VALUE
+MAX_JOIN_SIZE 100
show global variables like 'max_join_size';
Variable_name Value
max_join_size 10
+select * from information_schema.global_variables where variable_name like 'max_join_size';
+VARIABLE_NAME VARIABLE_VALUE
+MAX_JOIN_SIZE 10
set GLOBAL max_join_size=2000;
show global variables like 'max_join_size';
Variable_name Value
max_join_size 2000
+select * from information_schema.global_variables where variable_name like 'max_join_size';
+VARIABLE_NAME VARIABLE_VALUE
+MAX_JOIN_SIZE 2000
set max_join_size=DEFAULT;
show variables like 'max_join_size';
Variable_name Value
max_join_size 2000
+select * from information_schema.session_variables where variable_name like 'max_join_size';
+VARIABLE_NAME VARIABLE_VALUE
+MAX_JOIN_SIZE 2000
set GLOBAL max_join_size=DEFAULT;
show global variables like 'max_join_size';
Variable_name Value
max_join_size HA_POS_ERROR
+select * from information_schema.global_variables where variable_name like 'max_join_size';
+VARIABLE_NAME VARIABLE_VALUE
+MAX_JOIN_SIZE HA_POS_ERROR
set @@max_join_size=1000, @@global.max_join_size=2000;
select @@local.max_join_size, @@global.max_join_size;
@@local.max_join_size @@global.max_join_size
@@ -132,16 +147,16 @@ select last_insert_id(345);
last_insert_id(345)
345
explain extended select last_insert_id(345);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select last_insert_id(345) AS `last_insert_id(345)`
select @@IDENTITY,last_insert_id(), @@identity;
@@IDENTITY last_insert_id() @@identity
345 345 345
explain extended select @@IDENTITY,last_insert_id(), @@identity;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select 345 AS `@@IDENTITY`,last_insert_id() AS `last_insert_id()`,345 AS `@@identity`
set big_tables=OFF, big_tables=ON, big_tables=0, big_tables=1, big_tables="OFF", big_tables="ON";
@@ -149,14 +164,23 @@ set global concurrent_insert=2;
show variables like 'concurrent_insert';
Variable_name Value
concurrent_insert 2
+select * from information_schema.session_variables where variable_name like 'concurrent_insert';
+VARIABLE_NAME VARIABLE_VALUE
+CONCURRENT_INSERT 2
set global concurrent_insert=1;
show variables like 'concurrent_insert';
Variable_name Value
concurrent_insert 1
+select * from information_schema.session_variables where variable_name like 'concurrent_insert';
+VARIABLE_NAME VARIABLE_VALUE
+CONCURRENT_INSERT 1
set global concurrent_insert=0;
show variables like 'concurrent_insert';
Variable_name Value
concurrent_insert 0
+select * from information_schema.session_variables where variable_name like 'concurrent_insert';
+VARIABLE_NAME VARIABLE_VALUE
+CONCURRENT_INSERT 0
set global concurrent_insert=DEFAULT;
select @@concurrent_insert;
@@concurrent_insert
@@ -165,26 +189,44 @@ set global timed_mutexes=ON;
show variables like 'timed_mutexes';
Variable_name Value
timed_mutexes ON
+select * from information_schema.session_variables where variable_name like 'timed_mutexes';
+VARIABLE_NAME VARIABLE_VALUE
+TIMED_MUTEXES ON
set global timed_mutexes=0;
show variables like 'timed_mutexes';
Variable_name Value
timed_mutexes OFF
+select * from information_schema.session_variables where variable_name like 'timed_mutexes';
+VARIABLE_NAME VARIABLE_VALUE
+TIMED_MUTEXES OFF
set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="MERGE";
show local variables like 'storage_engine';
Variable_name Value
storage_engine MEMORY
+select * from information_schema.session_variables where variable_name like 'storage_engine';
+VARIABLE_NAME VARIABLE_VALUE
+STORAGE_ENGINE MEMORY
show global variables like 'storage_engine';
Variable_name Value
storage_engine MRG_MYISAM
+select * from information_schema.global_variables where variable_name like 'storage_engine';
+VARIABLE_NAME VARIABLE_VALUE
+STORAGE_ENGINE MRG_MYISAM
set GLOBAL query_cache_size=100000;
set GLOBAL myisam_max_sort_file_size=2000000;
show global variables like 'myisam_max_sort_file_size';
Variable_name Value
myisam_max_sort_file_size 1048576
+select * from information_schema.global_variables where variable_name like 'myisam_max_sort_file_size';
+VARIABLE_NAME VARIABLE_VALUE
+MYISAM_MAX_SORT_FILE_SIZE 1048576
set GLOBAL myisam_max_sort_file_size=default;
show variables like 'myisam_max_sort_file_size';
Variable_name Value
myisam_max_sort_file_size FILE_SIZE
+select * from information_schema.session_variables where variable_name like 'myisam_max_sort_file_size';
+VARIABLE_NAME VARIABLE_VALUE
+MYISAM_MAX_SORT_FILE_SIZE FILE_SIZE
set global net_retry_count=10, session net_retry_count=10;
set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600;
@@ -194,12 +236,24 @@ net_buffer_length 1024
net_read_timeout 300
net_retry_count 10
net_write_timeout 200
+select * from information_schema.global_variables where variable_name like 'net_%';
+VARIABLE_NAME VARIABLE_VALUE
+NET_BUFFER_LENGTH 1024
+NET_READ_TIMEOUT 300
+NET_RETRY_COUNT 10
+NET_WRITE_TIMEOUT 200
show session variables like 'net_%';
Variable_name Value
net_buffer_length 2048
net_read_timeout 600
net_retry_count 10
net_write_timeout 500
+select * from information_schema.session_variables where variable_name like 'net_%';
+VARIABLE_NAME VARIABLE_VALUE
+NET_BUFFER_LENGTH 2048
+NET_READ_TIMEOUT 600
+NET_RETRY_COUNT 10
+NET_WRITE_TIMEOUT 500
set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
show global variables like 'net_%';
Variable_name Value
@@ -207,24 +261,45 @@ net_buffer_length 1024
net_read_timeout 900
net_retry_count 10
net_write_timeout 1000
+select * from information_schema.global_variables where variable_name like 'net_%';
+VARIABLE_NAME VARIABLE_VALUE
+NET_BUFFER_LENGTH 1024
+NET_READ_TIMEOUT 900
+NET_RETRY_COUNT 10
+NET_WRITE_TIMEOUT 1000
show session variables like 'net_%';
Variable_name Value
net_buffer_length 7168
net_read_timeout 600
net_retry_count 10
net_write_timeout 500
+select * from information_schema.session_variables where variable_name like 'net_%';
+VARIABLE_NAME VARIABLE_VALUE
+NET_BUFFER_LENGTH 7168
+NET_READ_TIMEOUT 600
+NET_RETRY_COUNT 10
+NET_WRITE_TIMEOUT 500
set net_buffer_length=1;
show variables like 'net_buffer_length';
Variable_name Value
net_buffer_length 1024
+select * from information_schema.session_variables where variable_name like 'net_buffer_length';
+VARIABLE_NAME VARIABLE_VALUE
+NET_BUFFER_LENGTH 1024
set net_buffer_length=2000000000;
show variables like 'net_buffer_length';
Variable_name Value
net_buffer_length 1048576
+select * from information_schema.session_variables where variable_name like 'net_buffer_length';
+VARIABLE_NAME VARIABLE_VALUE
+NET_BUFFER_LENGTH 1048576
set character set cp1251_koi8;
show variables like "character_set_client";
Variable_name Value
character_set_client cp1251
+select * from information_schema.session_variables where variable_name like 'character_set_client';
+VARIABLE_NAME VARIABLE_VALUE
+CHARACTER_SET_CLIENT cp1251
select @@timestamp>0;
@@timestamp>0
1
@@ -239,6 +314,13 @@ query_prealloc_size 8192
range_alloc_block_size 2048
transaction_alloc_block_size 8192
transaction_prealloc_size 4096
+select * from information_schema.session_variables where variable_name like '%alloc%';
+VARIABLE_NAME VARIABLE_VALUE
+QUERY_ALLOC_BLOCK_SIZE 8192
+QUERY_PREALLOC_SIZE 8192
+RANGE_ALLOC_BLOCK_SIZE 2048
+TRANSACTION_ALLOC_BLOCK_SIZE 8192
+TRANSACTION_PREALLOC_SIZE 4096
set @@range_alloc_block_size=1024*16;
set @@query_alloc_block_size=1024*17+2;
set @@query_prealloc_size=1024*18;
@@ -254,6 +336,13 @@ query_prealloc_size 18432
range_alloc_block_size 16384
transaction_alloc_block_size 19456
transaction_prealloc_size 20480
+select * from information_schema.session_variables where variable_name like '%alloc%';
+VARIABLE_NAME VARIABLE_VALUE
+QUERY_ALLOC_BLOCK_SIZE 17408
+QUERY_PREALLOC_SIZE 18432
+RANGE_ALLOC_BLOCK_SIZE 16384
+TRANSACTION_ALLOC_BLOCK_SIZE 19456
+TRANSACTION_PREALLOC_SIZE 20480
set @@range_alloc_block_size=default;
set @@query_alloc_block_size=default, @@query_prealloc_size=default;
set transaction_alloc_block_size=default, @@transaction_prealloc_size=default;
@@ -264,6 +353,13 @@ query_prealloc_size 8192
range_alloc_block_size 2048
transaction_alloc_block_size 8192
transaction_prealloc_size 4096
+select * from information_schema.session_variables where variable_name like '%alloc%';
+VARIABLE_NAME VARIABLE_VALUE
+QUERY_ALLOC_BLOCK_SIZE 8192
+QUERY_PREALLOC_SIZE 8192
+RANGE_ALLOC_BLOCK_SIZE 2048
+TRANSACTION_ALLOC_BLOCK_SIZE 8192
+TRANSACTION_PREALLOC_SIZE 4096
SELECT @@version LIKE 'non-existent';
@@version LIKE 'non-existent'
0
@@ -413,7 +509,7 @@ set sql_safe_updates=1;
set sql_select_limit=1;
set sql_select_limit=default;
set sql_warnings=1;
-set global table_cache=100;
+set global table_open_cache=100;
set storage_engine=myisam;
set global thread_cache_size=100;
set timestamp=1, timestamp=default;
@@ -485,6 +581,9 @@ set global myisam_max_sort_file_size=4294967296;
show global variables like 'myisam_max_sort_file_size';
Variable_name Value
myisam_max_sort_file_size MAX_FILE_SIZE
+select * from information_schema.global_variables where variable_name like 'myisam_max_sort_file_size';
+VARIABLE_NAME VARIABLE_VALUE
+MYISAM_MAX_SORT_FILE_SIZE MAX_FILE_SIZE
set global myisam_max_sort_file_size=default;
select @@global.max_user_connections,@@local.max_join_size;
@@global.max_user_connections @@local.max_join_size
@@ -524,18 +623,30 @@ set @tstlw = @@log_warnings;
show global variables like 'log_warnings';
Variable_name Value
log_warnings 1
+select * from information_schema.global_variables where variable_name like 'log_warnings';
+VARIABLE_NAME VARIABLE_VALUE
+LOG_WARNINGS 1
set global log_warnings = 0;
show global variables like 'log_warnings';
Variable_name Value
log_warnings 0
+select * from information_schema.global_variables where variable_name like 'log_warnings';
+VARIABLE_NAME VARIABLE_VALUE
+LOG_WARNINGS 0
set global log_warnings = 42;
show global variables like 'log_warnings';
Variable_name Value
log_warnings 42
+select * from information_schema.global_variables where variable_name like 'log_warnings';
+VARIABLE_NAME VARIABLE_VALUE
+LOG_WARNINGS 42
set global log_warnings = @tstlw;
show global variables like 'log_warnings';
Variable_name Value
log_warnings 1
+select * from information_schema.global_variables where variable_name like 'log_warnings';
+VARIABLE_NAME VARIABLE_VALUE
+LOG_WARNINGS 1
create table t1 (
c1 tinyint,
c2 smallint,
@@ -545,11 +656,11 @@ c5 bigint);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` tinyint(4) default NULL,
- `c2` smallint(6) default NULL,
- `c3` mediumint(9) default NULL,
- `c4` int(11) default NULL,
- `c5` bigint(20) default NULL
+ `c1` tinyint(4) DEFAULT NULL,
+ `c2` smallint(6) DEFAULT NULL,
+ `c3` mediumint(9) DEFAULT NULL,
+ `c4` int(11) DEFAULT NULL,
+ `c5` bigint(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @arg00= 8, @arg01= 8.8, @arg02= 'a string', @arg03= 0.2e0;
@@ -557,21 +668,27 @@ create table t1 as select @arg00 as c1, @arg01 as c2, @arg02 as c3, @arg03 as c4
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` bigint(20) default NULL,
- `c2` decimal(65,30) default NULL,
+ `c1` bigint(20) DEFAULT NULL,
+ `c2` decimal(65,30) DEFAULT NULL,
`c3` longtext,
- `c4` double default NULL
+ `c4` double DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
SET GLOBAL MYISAM_DATA_POINTER_SIZE= 7;
SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
Variable_name Value
myisam_data_pointer_size 7
-SET GLOBAL table_cache=-1;
-SHOW VARIABLES LIKE 'table_cache';
-Variable_name Value
-table_cache 1
-SET GLOBAL table_cache=DEFAULT;
+SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'MYISAM_DATA_POINTER_SIZE';
+VARIABLE_NAME VARIABLE_VALUE
+MYISAM_DATA_POINTER_SIZE 7
+SET GLOBAL table_open_cache=-1;
+SHOW VARIABLES LIKE 'table_open_cache';
+Variable_name Value
+table_open_cache 1
+SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'table_open_cache';
+VARIABLE_NAME VARIABLE_VALUE
+TABLE_OPEN_CACHE 1
+SET GLOBAL table_open_cache=DEFAULT;
set character_set_results=NULL;
select ifnull(@@character_set_results,"really null");
ifnull(@@character_set_results,"really null")
@@ -639,21 +756,36 @@ set @@sql_big_selects = 1;
show variables like 'sql_big_selects';
Variable_name Value
sql_big_selects ON
+select * from information_schema.session_variables where variable_name like 'sql_big_selects';
+VARIABLE_NAME VARIABLE_VALUE
+SQL_BIG_SELECTS ON
set @@sql_big_selects = @old_sql_big_selects;
set @@sql_notes = 0, @@sql_warnings = 0;
show variables like 'sql_notes';
Variable_name Value
sql_notes OFF
+select * from information_schema.session_variables where variable_name like 'sql_notes';
+VARIABLE_NAME VARIABLE_VALUE
+SQL_NOTES OFF
show variables like 'sql_warnings';
Variable_name Value
sql_warnings OFF
+select * from information_schema.session_variables where variable_name like 'sql_warnings';
+VARIABLE_NAME VARIABLE_VALUE
+SQL_WARNINGS OFF
set @@sql_notes = 1, @@sql_warnings = 1;
show variables like 'sql_notes';
Variable_name Value
sql_notes ON
+select * from information_schema.session_variables where variable_name like 'sql_notes';
+VARIABLE_NAME VARIABLE_VALUE
+SQL_NOTES ON
show variables like 'sql_warnings';
Variable_name Value
sql_warnings ON
+select * from information_schema.session_variables where variable_name like 'sql_warnings';
+VARIABLE_NAME VARIABLE_VALUE
+SQL_WARNINGS ON
select @@system_time_zone;
@@system_time_zone
#
@@ -667,12 +799,21 @@ select @@basedir, @@datadir, @@tmpdir;
show variables like 'basedir';
Variable_name Value
basedir #
+select * from information_schema.session_variables where variable_name like 'basedir';
+VARIABLE_NAME VARIABLE_VALUE
+BASEDIR #
show variables like 'datadir';
Variable_name Value
datadir #
+select * from information_schema.session_variables where variable_name like 'datadir';
+VARIABLE_NAME VARIABLE_VALUE
+DATADIR #
show variables like 'tmpdir';
Variable_name Value
tmpdir #
+select * from information_schema.session_variables where variable_name like 'tmpdir';
+VARIABLE_NAME VARIABLE_VALUE
+TMPDIR #
select @@ssl_ca, @@ssl_capath, @@ssl_cert, @@ssl_cipher, @@ssl_key;
@@ssl_ca @@ssl_capath @@ssl_cert @@ssl_cipher @@ssl_key
# # # # #
@@ -683,12 +824,22 @@ ssl_capath #
ssl_cert #
ssl_cipher #
ssl_key #
+select * from information_schema.session_variables where variable_name like 'ssl%';
+VARIABLE_NAME VARIABLE_VALUE
+SSL_CA #
+SSL_CAPATH #
+SSL_CERT #
+SSL_CIPHER #
+SSL_KEY #
select @@log_queries_not_using_indexes;
@@log_queries_not_using_indexes
0
show variables like 'log_queries_not_using_indexes';
Variable_name Value
log_queries_not_using_indexes OFF
+select * from information_schema.session_variables where variable_name like 'log_queries_not_using_indexes';
+VARIABLE_NAME VARIABLE_VALUE
+LOG_QUERIES_NOT_USING_INDEXES OFF
select @@"";
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '""' at line 1
select @@&;
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 81711f95ae6..501d15efa82 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -51,8 +51,8 @@ ERROR 42S22: Unknown column 'b' in 'field list'
select v1.b from v1;
ERROR 42S22: Unknown column 'v1.b' in 'field list'
explain extended select c from v1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 5
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
Warnings:
Note 1003 select (`test`.`t1`.`b` + 1) AS `c` from `test`.`t1`
create algorithm=temptable view v2 (c) as select b+1 from t1;
@@ -67,9 +67,9 @@ c
6
11
explain extended select c from v2;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5
-2 DERIVED t1 ALL NULL NULL NULL NULL 5
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 100.00
+2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00
Warnings:
Note 1003 select `v2`.`c` AS `c` from `test`.`v2`
create view v3 (c) as select a+1 from v1;
@@ -85,8 +85,8 @@ c
7
12
explain extended select c from v3;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 5
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
Warnings:
Note 1003 select ((`test`.`t1`.`b` + 1) + 1) AS `c` from `test`.`t1`
create algorithm=temptable view v4 (c) as select c+1 from v2;
@@ -98,10 +98,10 @@ c
7
12
explain extended select c from v4;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5
-2 DERIVED <derived3> ALL NULL NULL NULL NULL 5
-3 DERIVED t1 ALL NULL NULL NULL NULL 5
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 100.00
+2 DERIVED <derived3> ALL NULL NULL NULL NULL 5 100.00
+3 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00
Warnings:
Note 1003 select `v4`.`c` AS `c` from `test`.`v4`
create view v5 (c) as select c+1 from v2;
@@ -113,9 +113,9 @@ c
7
12
explain extended select c from v5;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived3> ALL NULL NULL NULL NULL 5
-3 DERIVED t1 ALL NULL NULL NULL NULL 5
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived3> ALL NULL NULL NULL NULL 5 100.00
+3 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00
Warnings:
Note 1003 select (`v2`.`c` + 1) AS `c` from `test`.`v2`
create algorithm=temptable view v6 (c) as select c+1 from v1;
@@ -127,9 +127,9 @@ c
7
12
explain extended select c from v6;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5
-2 DERIVED t1 ALL NULL NULL NULL NULL 5
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 100.00
+2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00
Warnings:
Note 1003 select `v6`.`c` AS `c` from `test`.`v6`
show tables;
@@ -378,8 +378,8 @@ c
20
30
explain extended select * from v1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`b` AS `c` from `test`.`t1` where (`test`.`t1`.`a` < 3)
update v1 set c=c+1;
@@ -612,7 +612,7 @@ drop table t1;
create table t1 (a int, b int);
create view v1 as select a, sum(b) from t1 group by a;
select b from v1 use index (some_index) where b=1;
-ERROR HY000: Key 'some_index' doesn't exist in table 'v1'
+ERROR 42000: Key 'some_index' doesn't exist in table 'v1'
drop view v1;
drop table t1;
create table t1 (col1 char(5),col2 char(5));
@@ -791,13 +791,13 @@ test.`f``1` ()
5
drop view v1;
drop function `f``1`;
-create function x () returns int return 5;
-create view v1 as select x ();
+create function a() returns int return 5;
+create view v1 as select a();
select * from v1;
-x ()
+a()
5
drop view v1;
-drop function x;
+drop function a;
create table t2 (col1 char collate latin1_german2_ci);
create view v2 as select col1 collate latin1_german1_ci from t2;
show create view v2;
@@ -1106,21 +1106,21 @@ insert ignore into v1 SELECT a from t2;
Warnings:
Error 1369 CHECK OPTION failed 'test.v1'
Error 1369 CHECK OPTION failed 'test.v1'
-select * from t1;
+select * from t1 order by a desc;
a
1
0
update v1 set a=-1 where a=0;
update v1 set a=2 where a=1;
ERROR HY000: CHECK OPTION failed 'test.v1'
-select * from t1;
+select * from t1 order by a desc;
a
1
-1
update v1 set a=0 where a=0;
insert into t2 values (1);
update v1,t2 set v1.a=v1.a-1 where v1.a=t2.a;
-select * from t1;
+select * from t1 order by a desc;
a
0
-1
@@ -1310,12 +1310,12 @@ Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3
Error 1369 CHECK OPTION failed 'test.v1'
Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 4
Error 1369 CHECK OPTION failed 'test.v1'
-select * from t1;
+select * from t1 order by a,b;
a b
1 row 1
2 row 2
3 row 3
-select * from v1;
+select * from v1 order by a,b;
a b
1 row 1
2 row 2
@@ -1390,10 +1390,10 @@ a a b
2 2 NULL
4 NULL NULL
explain extended select * from t3 left join v3 on (t3.a = v3.a);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 ALL NULL NULL NULL NULL 3
-1 SIMPLE t1 ALL NULL NULL NULL NULL 3
-1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join `test`.`t2` on((`test`.`t1`.`a` = `test`.`t2`.`a`))) on((`test`.`t3`.`a` = `test`.`t1`.`a`)) where 1
create view v1 (a) as select a from t1;
@@ -1405,10 +1405,10 @@ a a b
2 2 NULL
4 NULL NULL
explain extended select * from t3 left join v4 on (t3.a = v4.a);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 ALL NULL NULL NULL NULL 3
-1 SIMPLE t1 ALL NULL NULL NULL NULL 3
-1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join (`test`.`t2`) on((`test`.`t1`.`a` = `test`.`t2`.`a`))) on((`test`.`t3`.`a` = `test`.`t1`.`a`)) where 1
prepare stmt1 from "select * from t3 left join v4 on (t3.a = v4.a);";
@@ -1495,7 +1495,7 @@ insert into v3(b) values (10);
insert into v3(a) select a from t2;
insert into v3(b) select b from t2;
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 2
+Warning 1048 Column 'a' cannot be null
insert into v3(a) values (1) on duplicate key update a=a+10000+VALUES(a);
select * from t1;
a b
@@ -1787,7 +1787,7 @@ drop table t1;
create view v1 as select cast(1 as decimal);
select * from v1;
cast(1 as decimal)
-1.00
+1
drop view v1;
create table t1(f1 int);
create table t2(f2 int);
diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result
index cf9ba1c604d..dfd1f16797c 100644
--- a/mysql-test/r/view_grant.result
+++ b/mysql-test/r/view_grant.result
@@ -1,3 +1,5 @@
+drop database if exists mysqltest;
+drop view if exists v1,v2,v3;
grant create view on test.* to test@localhost;
show grants for test@localhost;
Grants for test@localhost
diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result
index d0ad4ca6648..d07f90d41b9 100644
--- a/mysql-test/r/warnings.result
+++ b/mysql-test/r/warnings.result
@@ -72,13 +72,13 @@ drop table t1;
create table t1(a tinyint, b int not null, c date, d char(5));
load data infile '../std_data_ln/warnings_loaddata.dat' into table t1 fields terminated by ',';
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'b' at row 2
+Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 2
Warning 1265 Data truncated for column 'd' at row 3
Warning 1265 Data truncated for column 'c' at row 4
Warning 1261 Row 5 doesn't contain data for all columns
Warning 1265 Data truncated for column 'b' at row 6
Warning 1262 Row 7 was truncated; it contained more data than there were input columns
-Warning 1264 Out of range value adjusted for column 'a' at row 8
+Warning 1264 Out of range value for column 'a' at row 8
select @@warning_count;
@@warning_count
7
@@ -86,11 +86,11 @@ drop table t1;
create table t1(a tinyint NOT NULL, b tinyint unsigned, c char(5));
insert into t1 values(NULL,100,'mysql'),(10,-1,'mysql ab'),(500,256,'open source'),(20,NULL,'test');
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1
-Warning 1264 Out of range value adjusted for column 'b' at row 2
+Warning 1048 Column 'a' cannot be null
+Warning 1264 Out of range value for column 'b' at row 2
Warning 1265 Data truncated for column 'c' at row 2
-Warning 1264 Out of range value adjusted for column 'a' at row 3
-Warning 1264 Out of range value adjusted for column 'b' at row 3
+Warning 1264 Out of range value for column 'a' at row 3
+Warning 1264 Out of range value for column 'b' at row 3
Warning 1265 Data truncated for column 'c' at row 3
alter table t1 modify c char(4);
Warnings:
@@ -99,7 +99,7 @@ Warning 1265 Data truncated for column 'c' at row 2
alter table t1 add d char(2);
update t1 set a=NULL where a=10;
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 2
+Warning 1048 Column 'a' cannot be null
update t1 set c='mysql ab' where c='test';
Warnings:
Warning 1265 Data truncated for column 'c' at row 4
@@ -115,7 +115,7 @@ Warnings:
Warning 1265 Data truncated for column 'b' at row 1
Warning 1265 Data truncated for column 'b' at row 2
Warning 1265 Data truncated for column 'b' at row 3
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 4
+Warning 1048 Column 'a' cannot be null
Warning 1265 Data truncated for column 'b' at row 4
insert into t2(b) values('mysqlab');
Warnings:
@@ -166,13 +166,6 @@ show variables like 'max_error_count';
Variable_name Value
max_error_count 10
drop table t1;
-create table t1 (id int) engine=isam;
-Warnings:
-Warning 1266 Using storage engine MyISAM for table 't1'
-alter table t1 engine=isam;
-Warnings:
-Warning 1266 Using storage engine MyISAM for table 't1'
-drop table t1;
create table t1 (id int) engine=merge;
Warnings:
Warning 1266 Using storage engine MyISAM for table 't1'
@@ -180,16 +173,9 @@ alter table t1 engine=merge;
Warnings:
Warning 1266 Using storage engine MyISAM for table 't1'
drop table t1;
-create table t1 (id int) type=heap;
-Warnings:
-Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
-alter table t1 type=myisam;
-Warnings:
-Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
-drop table t1;
set table_type=MYISAM;
Warnings:
-Warning 1287 'table_type' is deprecated; use 'storage_engine' instead
+Warning 1541 The syntax 'table_type' is deprecated and will be removed in MySQL 5.2. Please use 'storage_engine' instead
create table t1 (a int);
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
update t1 set a='abc';
diff --git a/mysql-test/r/windows.require b/mysql-test/r/windows.require
new file mode 100644
index 00000000000..09aae1ed1d0
--- /dev/null
+++ b/mysql-test/r/windows.require
@@ -0,0 +1,2 @@
+TRUE
+1
diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result
new file mode 100644
index 00000000000..efe7d14095d
--- /dev/null
+++ b/mysql-test/r/xml.result
@@ -0,0 +1,738 @@
+SET @xml='<a aa1="aa1" aa2="aa2">a1<b ba1="ba1">b1<c>c1</c>b2</b>a2</a>';
+SELECT extractValue(@xml,'/a');
+extractValue(@xml,'/a')
+a1 a2
+SELECT extractValue(@xml,'/a/b');
+extractValue(@xml,'/a/b')
+b1 b2
+SELECT extractValue(@xml,'/a/b/c');
+extractValue(@xml,'/a/b/c')
+c1
+SELECT extractValue(@xml,'/a/@aa1');
+extractValue(@xml,'/a/@aa1')
+aa1
+SELECT extractValue(@xml,'/a/@aa2');
+extractValue(@xml,'/a/@aa2')
+aa2
+SELECT extractValue(@xml,'/a/@*');
+extractValue(@xml,'/a/@*')
+aa1 aa2
+SELECT extractValue(@xml,'//@ba1');
+extractValue(@xml,'//@ba1')
+ba1
+SELECT extractValue(@xml,'//a');
+extractValue(@xml,'//a')
+a1 a2
+SELECT extractValue(@xml,'//b');
+extractValue(@xml,'//b')
+b1 b2
+SELECT extractValue(@xml,'//c');
+extractValue(@xml,'//c')
+c1
+SELECT extractValue(@xml,'/a//b');
+extractValue(@xml,'/a//b')
+b1 b2
+SELECT extractValue(@xml,'/a//c');
+extractValue(@xml,'/a//c')
+c1
+SELECT extractValue(@xml,'//*');
+extractValue(@xml,'//*')
+a1 b1 c1 b2 a2
+SELECT extractValue(@xml,'/a//*');
+extractValue(@xml,'/a//*')
+b1 c1 b2
+SELECT extractValue(@xml,'/./a');
+extractValue(@xml,'/./a')
+a1 a2
+SELECT extractValue(@xml,'/a/b/.');
+extractValue(@xml,'/a/b/.')
+b1 b2
+SELECT extractValue(@xml,'/a/b/..');
+extractValue(@xml,'/a/b/..')
+a1 a2
+SELECT extractValue(@xml,'/a/b/../@aa1');
+extractValue(@xml,'/a/b/../@aa1')
+aa1
+SELECT extractValue(@xml,'/*');
+extractValue(@xml,'/*')
+a1 a2
+SELECT extractValue(@xml,'/*/*');
+extractValue(@xml,'/*/*')
+b1 b2
+SELECT extractValue(@xml,'/*/*/*');
+extractValue(@xml,'/*/*/*')
+c1
+SELECT extractValue(@xml,'/a/child::*');
+extractValue(@xml,'/a/child::*')
+b1 b2
+SELECT extractValue(@xml,'/a/self::*');
+extractValue(@xml,'/a/self::*')
+a1 a2
+SELECT extractValue(@xml,'/a/descendant::*');
+extractValue(@xml,'/a/descendant::*')
+b1 c1 b2
+SELECT extractValue(@xml,'/a/descendant-or-self::*');
+extractValue(@xml,'/a/descendant-or-self::*')
+a1 b1 c1 b2 a2
+SELECT extractValue(@xml,'/a/attribute::*');
+extractValue(@xml,'/a/attribute::*')
+aa1 aa2
+SELECT extractValue(@xml,'/a/b/c/parent::*');
+extractValue(@xml,'/a/b/c/parent::*')
+b1 b2
+SELECT extractValue(@xml,'/a/b/c/ancestor::*');
+extractValue(@xml,'/a/b/c/ancestor::*')
+a1 b1 b2 a2
+SELECT extractValue(@xml,'/a/b/c/ancestor-or-self::*');
+extractValue(@xml,'/a/b/c/ancestor-or-self::*')
+a1 b1 c1 b2 a2
+SELECT extractValue(@xml,'/descendant-or-self::*');
+extractValue(@xml,'/descendant-or-self::*')
+a1 b1 c1 b2 a2
+SET @xml='<a>a11<b ba="ba11" ba="ba12">b11</b><b ba="ba21" ba="ba22">b21<c>c1</c>b22</b>a12</a>';
+SELECT extractValue(@xml,'/a/b/c/ancestor-or-self::*');
+extractValue(@xml,'/a/b/c/ancestor-or-self::*')
+a11 b21 c1 b22 a12
+SELECT extractValue(@xml,'//@ba');
+extractValue(@xml,'//@ba')
+ba11 ba12 ba21 ba22
+SET @xml='<a><b>b</b><c>c</c></a>';
+SELECT extractValue(@xml,'/a/b');
+extractValue(@xml,'/a/b')
+b
+SELECT extractValue(@xml,'/a/c');
+extractValue(@xml,'/a/c')
+c
+SELECT extractValue(@xml,'/a/child::b');
+extractValue(@xml,'/a/child::b')
+b
+SELECT extractValue(@xml,'/a/child::c');
+extractValue(@xml,'/a/child::c')
+c
+SET @xml='<a><b>b1</b><c>c1</c><b>b2</b><c>c2</c></a>';
+SELECT extractValue(@xml,'/a/b[1]');
+extractValue(@xml,'/a/b[1]')
+b1
+SELECT extractValue(@xml,'/a/b[2]');
+extractValue(@xml,'/a/b[2]')
+b2
+SELECT extractValue(@xml,'/a/c[1]');
+extractValue(@xml,'/a/c[1]')
+c1
+SELECT extractValue(@xml,'/a/c[2]');
+extractValue(@xml,'/a/c[2]')
+c2
+SET @xml='<a><b x="xb1" x="xb2"/><c x="xc1" x="xc2"/></a>';
+SELECT extractValue(@xml,'/a//@x');
+extractValue(@xml,'/a//@x')
+xb1 xb2 xc1 xc2
+SELECT extractValue(@xml,'/a//@x[1]');
+extractValue(@xml,'/a//@x[1]')
+xb1 xc1
+SELECT extractValue(@xml,'/a//@x[2]');
+extractValue(@xml,'/a//@x[2]')
+xb2 xc2
+SET @xml='<a><b>b1</b><b>b2</b><c><b>c1b1</b><b>c1b2</b></c><c><b>c2b1</c></b></a>';
+SELECT extractValue(@xml,'//b[1]');
+extractValue(@xml,'//b[1]')
+b1 c1b1 c2b1
+SELECT extractValue(@xml,'/descendant::b[1]');
+extractValue(@xml,'/descendant::b[1]')
+b1
+SET @xml='<a><b>b1</b><b>b2</b></a>';
+SELECT extractValue(@xml,'/a/b[1+0]');
+extractValue(@xml,'/a/b[1+0]')
+b1
+SELECT extractValue(@xml,'/a/b[1*1]');
+extractValue(@xml,'/a/b[1*1]')
+b1
+SELECT extractValue(@xml,'/a/b[--1]');
+extractValue(@xml,'/a/b[--1]')
+b1
+SELECT extractValue(@xml,'/a/b[2*1-1]');
+extractValue(@xml,'/a/b[2*1-1]')
+b1
+SELECT extractValue(@xml,'/a/b[1+1]');
+extractValue(@xml,'/a/b[1+1]')
+b2
+SELECT extractValue(@xml,'/a/b[1*2]');
+extractValue(@xml,'/a/b[1*2]')
+b2
+SELECT extractValue(@xml,'/a/b[--2]');
+extractValue(@xml,'/a/b[--2]')
+b2
+SELECT extractValue(@xml,'/a/b[1*(3-1)]');
+extractValue(@xml,'/a/b[1*(3-1)]')
+b2
+SELECT extractValue(@xml,'//*[1=1]');
+extractValue(@xml,'//*[1=1]')
+b1 b2
+SELECT extractValue(@xml,'//*[1!=1]');
+extractValue(@xml,'//*[1!=1]')
+
+SELECT extractValue(@xml,'//*[1>1]');
+extractValue(@xml,'//*[1>1]')
+
+SELECT extractValue(@xml,'//*[2>1]');
+extractValue(@xml,'//*[2>1]')
+b1 b2
+SELECT extractValue(@xml,'//*[1>2]');
+extractValue(@xml,'//*[1>2]')
+
+SELECT extractValue(@xml,'//*[1>=1]');
+extractValue(@xml,'//*[1>=1]')
+b1 b2
+SELECT extractValue(@xml,'//*[2>=1]');
+extractValue(@xml,'//*[2>=1]')
+b1 b2
+SELECT extractValue(@xml,'//*[1>=2]');
+extractValue(@xml,'//*[1>=2]')
+
+SELECT extractValue(@xml,'//*[1<1]');
+extractValue(@xml,'//*[1<1]')
+
+SELECT extractValue(@xml,'//*[2<1]');
+extractValue(@xml,'//*[2<1]')
+
+SELECT extractValue(@xml,'//*[1<2]');
+extractValue(@xml,'//*[1<2]')
+b1 b2
+SELECT extractValue(@xml,'//*[1<=1]');
+extractValue(@xml,'//*[1<=1]')
+b1 b2
+SELECT extractValue(@xml,'//*[2<=1]');
+extractValue(@xml,'//*[2<=1]')
+
+SELECT extractValue(@xml,'//*[1<=2]');
+extractValue(@xml,'//*[1<=2]')
+b1 b2
+SET @xml='<a><b>b11<c>c11</c></b><b>b21<c>c21</c></b></a>';
+SELECT extractValue(@xml,'/a/b[c="c11"]');
+extractValue(@xml,'/a/b[c="c11"]')
+b11
+SELECT extractValue(@xml,'/a/b[c="c21"]');
+extractValue(@xml,'/a/b[c="c21"]')
+b21
+SET @xml='<a><b c="c11">b11</b><b c="c21">b21</b></a>';
+SELECT extractValue(@xml,'/a/b[@c="c11"]');
+extractValue(@xml,'/a/b[@c="c11"]')
+b11
+SELECT extractValue(@xml,'/a/b[@c="c21"]');
+extractValue(@xml,'/a/b[@c="c21"]')
+b21
+SET @xml='<a>a1<b c="c11">b11<d>d11</d></b><b c="c21">b21<d>d21</d></b></a>';
+SELECT extractValue(@xml, '/a/b[@c="c11"]/d');
+extractValue(@xml, '/a/b[@c="c11"]/d')
+d11
+SELECT extractValue(@xml, '/a/b[@c="c21"]/d');
+extractValue(@xml, '/a/b[@c="c21"]/d')
+d21
+SELECT extractValue(@xml, '/a/b[d="d11"]/@c');
+extractValue(@xml, '/a/b[d="d11"]/@c')
+c11
+SELECT extractValue(@xml, '/a/b[d="d21"]/@c');
+extractValue(@xml, '/a/b[d="d21"]/@c')
+c21
+SELECT extractValue(@xml, '/a[b="b11"]');
+extractValue(@xml, '/a[b="b11"]')
+a1
+SELECT extractValue(@xml, '/a[b/@c="c11"]');
+extractValue(@xml, '/a[b/@c="c11"]')
+a1
+SELECT extractValue(@xml, '/a[b/d="d11"]');
+extractValue(@xml, '/a[b/d="d11"]')
+a1
+SELECT extractValue(@xml, '/a[/a/b="b11"]');
+extractValue(@xml, '/a[/a/b="b11"]')
+a1
+SELECT extractValue(@xml, '/a[/a/b/@c="c11"]');
+extractValue(@xml, '/a[/a/b/@c="c11"]')
+a1
+SELECT extractValue(@xml, '/a[/a/b/d="d11"]');
+extractValue(@xml, '/a[/a/b/d="d11"]')
+a1
+SELECT extractValue('<a>a</a>', '/a[false()]');
+extractValue('<a>a</a>', '/a[false()]')
+
+SELECT extractValue('<a>a</a>', '/a[true()]');
+extractValue('<a>a</a>', '/a[true()]')
+a
+SELECT extractValue('<a>a</a>', '/a[not(false())]');
+extractValue('<a>a</a>', '/a[not(false())]')
+a
+SELECT extractValue('<a>a</a>', '/a[not(true())]');
+extractValue('<a>a</a>', '/a[not(true())]')
+
+SELECT extractValue('<a>a</a>', '/a[true() and true()]');
+extractValue('<a>a</a>', '/a[true() and true()]')
+a
+SELECT extractValue('<a>a</a>', '/a[true() and false()]');
+extractValue('<a>a</a>', '/a[true() and false()]')
+
+SELECT extractValue('<a>a</a>', '/a[false()and false()]');
+extractValue('<a>a</a>', '/a[false()and false()]')
+
+SELECT extractValue('<a>a</a>', '/a[false()and true()]');
+extractValue('<a>a</a>', '/a[false()and true()]')
+
+SELECT extractValue('<a>a</a>', '/a[true() or true()]');
+extractValue('<a>a</a>', '/a[true() or true()]')
+a
+SELECT extractValue('<a>a</a>', '/a[true() or false()]');
+extractValue('<a>a</a>', '/a[true() or false()]')
+a
+SELECT extractValue('<a>a</a>', '/a[false()or false()]');
+extractValue('<a>a</a>', '/a[false()or false()]')
+
+SELECT extractValue('<a>a</a>', '/a[false()or true()]');
+extractValue('<a>a</a>', '/a[false()or true()]')
+a
+SET @xml='<a>ab<b c="c" c="e">b1</b><b c="d">b2</b><b c="f" c="e">b3</b></a>';
+select extractValue(@xml,'/a/b[@c="c"]');
+extractValue(@xml,'/a/b[@c="c"]')
+b1
+select extractValue(@xml,'/a/b[@c="d"]');
+extractValue(@xml,'/a/b[@c="d"]')
+b2
+select extractValue(@xml,'/a/b[@c="e"]');
+extractValue(@xml,'/a/b[@c="e"]')
+b1 b3
+select extractValue(@xml,'/a/b[not(@c="e")]');
+extractValue(@xml,'/a/b[not(@c="e")]')
+b2
+select extractValue(@xml,'/a/b[@c!="e"]');
+extractValue(@xml,'/a/b[@c!="e"]')
+b1 b2 b3
+select extractValue(@xml,'/a/b[@c="c" or @c="d"]');
+extractValue(@xml,'/a/b[@c="c" or @c="d"]')
+b1 b2
+select extractValue(@xml,'/a/b[@c="c" and @c="e"]');
+extractValue(@xml,'/a/b[@c="c" and @c="e"]')
+b1
+SET @xml='<a><b c="c" d="d">b1</b><b d="d" e="e">b2</b></a>';
+select extractValue(@xml,'/a/b[@c]');
+extractValue(@xml,'/a/b[@c]')
+b1
+select extractValue(@xml,'/a/b[@d]');
+extractValue(@xml,'/a/b[@d]')
+b1 b2
+select extractValue(@xml,'/a/b[@e]');
+extractValue(@xml,'/a/b[@e]')
+b2
+select extractValue(@xml,'/a/b[not(@c)]');
+extractValue(@xml,'/a/b[not(@c)]')
+b2
+select extractValue(@xml,'/a/b[not(@d)]');
+extractValue(@xml,'/a/b[not(@d)]')
+
+select extractValue(@xml,'/a/b[not(@e)]');
+extractValue(@xml,'/a/b[not(@e)]')
+b1
+select extractValue(@xml, '/a/b[boolean(@c) or boolean(@d)]');
+extractValue(@xml, '/a/b[boolean(@c) or boolean(@d)]')
+b1 b2
+select extractValue(@xml, '/a/b[boolean(@c) or boolean(@e)]');
+extractValue(@xml, '/a/b[boolean(@c) or boolean(@e)]')
+b1 b2
+select extractValue(@xml, '/a/b[boolean(@d) or boolean(@e)]');
+extractValue(@xml, '/a/b[boolean(@d) or boolean(@e)]')
+b1 b2
+select extractValue(@xml, '/a/b[boolean(@c) and boolean(@d)]');
+extractValue(@xml, '/a/b[boolean(@c) and boolean(@d)]')
+b1
+select extractValue(@xml, '/a/b[boolean(@c) and boolean(@e)]');
+extractValue(@xml, '/a/b[boolean(@c) and boolean(@e)]')
+
+select extractValue(@xml, '/a/b[boolean(@d) and boolean(@e)]');
+extractValue(@xml, '/a/b[boolean(@d) and boolean(@e)]')
+b2
+select extractValue(@xml, '/a/b[@c or @d]');
+extractValue(@xml, '/a/b[@c or @d]')
+b1 b2
+select extractValue(@xml, '/a/b[@c or @e]');
+extractValue(@xml, '/a/b[@c or @e]')
+b1 b2
+select extractValue(@xml, '/a/b[@d or @e]');
+extractValue(@xml, '/a/b[@d or @e]')
+b1 b2
+select extractValue(@xml, '/a/b[@c and @d]');
+extractValue(@xml, '/a/b[@c and @d]')
+b1
+select extractValue(@xml, '/a/b[@c and @e]');
+extractValue(@xml, '/a/b[@c and @e]')
+
+select extractValue(@xml, '/a/b[@d and @e]');
+extractValue(@xml, '/a/b[@d and @e]')
+b2
+SET @xml='<a><b c="c">b1</b><b>b2</b></a>';
+SELECT extractValue(@xml,'/a/b[@*]');
+extractValue(@xml,'/a/b[@*]')
+b1
+SELECT extractValue(@xml,'/a/b[not(@*)]');
+extractValue(@xml,'/a/b[not(@*)]')
+b2
+SELECT extractValue('<a>a</a>', '/a[ceiling(3.1)=4]');
+extractValue('<a>a</a>', '/a[ceiling(3.1)=4]')
+a
+SELECT extractValue('<a>a</a>', '/a[floor(3.1)=3]');
+extractValue('<a>a</a>', '/a[floor(3.1)=3]')
+a
+SELECT extractValue('<a>a</a>', '/a[round(3.1)=3]');
+extractValue('<a>a</a>', '/a[round(3.1)=3]')
+a
+SELECT extractValue('<a>a</a>', '/a[round(3.8)=4]');
+extractValue('<a>a</a>', '/a[round(3.8)=4]')
+a
+SELECT extractValue('<a><b>b</b><c>c</c></a>', '/a/b | /a/c');
+extractValue('<a><b>b</b><c>c</c></a>', '/a/b | /a/c')
+b c
+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=1]');
+extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=1]')
+b1
+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=2]');
+extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=2]')
+b2
+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=3]');
+extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=3]')
+b3
+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[1=position()]');
+extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[1=position()]')
+b1
+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[2=position()]');
+extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[2=position()]')
+b2
+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[3=position()]');
+extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[3=position()]')
+b3
+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[2>=position()]');
+extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[2>=position()]')
+b1 b2
+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[2<=position()]');
+extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[2<=position()]')
+b2 b3
+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=3 or position()=2]');
+extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=3 or position()=2]')
+b2 b3
+SELECT extractValue('<a>a<b>a1<c>c1</c></b><b>a2</b></a>','/a/b[count(c)=0]');
+extractValue('<a>a<b>a1<c>c1</c></b><b>a2</b></a>','/a/b[count(c)=0]')
+a2
+SELECT extractValue('<a>a<b>a1<c>c1</c></b><b>a2</b></a>','/a/b[count(c)=1]');
+extractValue('<a>a<b>a1<c>c1</c></b><b>a2</b></a>','/a/b[count(c)=1]')
+a1
+select extractValue('<a>a1<b ba="1" ba="2">b1</b><b>b2</b>4</a>','/a/b[sum(@ba)=3]');
+extractValue('<a>a1<b ba="1" ba="2">b1</b><b>b2</b>4</a>','/a/b[sum(@ba)=3]')
+b1
+select extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[1]');
+extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[1]')
+b1
+select extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[boolean(1)]');
+extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[boolean(1)]')
+b1 b2
+select extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[true()]');
+extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[true()]')
+b1 b2
+select extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[number(true())]');
+extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[number(true())]')
+b1
+select extractValue('<a>ab</a>','/a[contains("abc","b")]');
+extractValue('<a>ab</a>','/a[contains("abc","b")]')
+ab
+select extractValue('<a>ab</a>','/a[contains(.,"a")]');
+extractValue('<a>ab</a>','/a[contains(.,"a")]')
+ab
+select extractValue('<a>ab</a>','/a[contains(.,"b")]');
+extractValue('<a>ab</a>','/a[contains(.,"b")]')
+ab
+select extractValue('<a>ab</a>','/a[contains(.,"c")]');
+extractValue('<a>ab</a>','/a[contains(.,"c")]')
+
+select extractValue('<a b="1">ab</a>','/a[concat(@b,"2")="12"]');
+extractValue('<a b="1">ab</a>','/a[concat(@b,"2")="12"]')
+ab
+SET @xml='<a b="11" b="12" b="21" b="22">ab</a>';
+select extractValue(@xml, '/a/@b[substring(.,2)="1"]');
+extractValue(@xml, '/a/@b[substring(.,2)="1"]')
+11 21
+select extractValue(@xml, '/a/@b[substring(.,2)="2"]');
+extractValue(@xml, '/a/@b[substring(.,2)="2"]')
+12 22
+select extractValue(@xml, '/a/@b[substring(.,1,1)="1"]');
+extractValue(@xml, '/a/@b[substring(.,1,1)="1"]')
+11 12
+select extractValue(@xml, '/a/@b[substring(.,1,1)="2"]');
+extractValue(@xml, '/a/@b[substring(.,1,1)="2"]')
+21 22
+select extractValue(@xml, '/a/@b[substring(.,2,1)="1"]');
+extractValue(@xml, '/a/@b[substring(.,2,1)="1"]')
+11 21
+select extractValue(@xml, '/a/@b[substring(.,2,1)="2"]');
+extractValue(@xml, '/a/@b[substring(.,2,1)="2"]')
+12 22
+SET @xml='<a><b>b1</b><b>b2</b></a>';
+SELECT extractValue(@xml, '/a/b[string-length("x")=1]');
+extractValue(@xml, '/a/b[string-length("x")=1]')
+b1 b2
+SELECT extractValue(@xml, '/a/b[string-length("xx")=2]');
+extractValue(@xml, '/a/b[string-length("xx")=2]')
+b1 b2
+SELECT extractValue(@xml, '/a/b[string-length("xxx")=2]');
+extractValue(@xml, '/a/b[string-length("xxx")=2]')
+
+SELECT extractValue(@xml, '/a/b[string-length("x")]');
+extractValue(@xml, '/a/b[string-length("x")]')
+b1
+SELECT extractValue(@xml, '/a/b[string-length("xx")]');
+extractValue(@xml, '/a/b[string-length("xx")]')
+b2
+SELECT extractValue(@xml, '/a/b[string-length()]');
+extractValue(@xml, '/a/b[string-length()]')
+b2
+SELECT extractValue(@xml, 'string-length()');
+ERROR HY000: XPATH syntax error: ''
+SELECT extractValue(@xml, 'string-length("x")');
+extractValue(@xml, 'string-length("x")')
+1
+SET @xml='<a b="b11" b="b12" b="b21" b="22"/>';
+select extractValue(@xml,'/a/@b');
+extractValue(@xml,'/a/@b')
+b11 b12 b21 22
+select extractValue(@xml,'/a/@b[contains(.,"1")]');
+extractValue(@xml,'/a/@b[contains(.,"1")]')
+b11 b12 b21
+select extractValue(@xml,'/a/@b[contains(.,"1")][contains(.,"2")]');
+extractValue(@xml,'/a/@b[contains(.,"1")][contains(.,"2")]')
+b12 b21
+select extractValue(@xml,'/a/@b[contains(.,"1")][contains(.,"2")][2]');
+extractValue(@xml,'/a/@b[contains(.,"1")][contains(.,"2")][2]')
+b21
+SET @xml='<a>a1<b>b1<c>c1</c>b2</b>a2</a>';
+select UpdateXML('<a>a1<b>b1<c>c1</c>b2</b>a2</a>','/a/b/c','+++++++++');
+UpdateXML('<a>a1<b>b1<c>c1</c>b2</b>a2</a>','/a/b/c','+++++++++')
+<a>a1<b>b1+++++++++b2</b>a2</a>
+select UpdateXML('<a>a1<b>b1<c>c1</c>b2</b>a2</a>','/a/b/c','<c1>+++++++++</c1>');
+UpdateXML('<a>a1<b>b1<c>c1</c>b2</b>a2</a>','/a/b/c','<c1>+++++++++</c1>')
+<a>a1<b>b1<c1>+++++++++</c1>b2</b>a2</a>
+select UpdateXML('<a>a1<b>b1<c>c1</c>b2</b>a2</a>','/a/b/c','<c1/>');
+UpdateXML('<a>a1<b>b1<c>c1</c>b2</b>a2</a>','/a/b/c','<c1/>')
+<a>a1<b>b1<c1/>b2</b>a2</a>
+SET @xml='<a><b>bb</b></a>';
+select UpdateXML(@xml, '/a/b', '<b>ccc</b>');
+UpdateXML(@xml, '/a/b', '<b>ccc</b>')
+<a><b>ccc</b></a>
+SET @xml='<a aa1="aa1" aa2="aa2"><b bb1="bb1" bb2="bb2">bb</b></a>';
+select UpdateXML(@xml, '/a/b', '<b>ccc</b>');
+UpdateXML(@xml, '/a/b', '<b>ccc</b>')
+<a aa1="aa1" aa2="aa2"><b>ccc</b></a>
+select UpdateXML(@xml, '/a/@aa1', '');
+UpdateXML(@xml, '/a/@aa1', '')
+<a aa2="aa2"><b bb1="bb1" bb2="bb2">bb</b></a>
+select UpdateXML(@xml, '/a/@aa1', 'aa3="aa3"');
+UpdateXML(@xml, '/a/@aa1', 'aa3="aa3"')
+<a aa3="aa3" aa2="aa2"><b bb1="bb1" bb2="bb2">bb</b></a>
+select UpdateXML(@xml, '/a/@aa2', '');
+UpdateXML(@xml, '/a/@aa2', '')
+<a aa1="aa1" ><b bb1="bb1" bb2="bb2">bb</b></a>
+select UpdateXML(@xml, '/a/@aa2', 'aa3="aa3"');
+UpdateXML(@xml, '/a/@aa2', 'aa3="aa3"')
+<a aa1="aa1" aa3="aa3"><b bb1="bb1" bb2="bb2">bb</b></a>
+select UpdateXML(@xml, '/a/b/@bb1', '');
+UpdateXML(@xml, '/a/b/@bb1', '')
+<a aa1="aa1" aa2="aa2"><b bb2="bb2">bb</b></a>
+select UpdateXML(@xml, '/a/b/@bb1', 'bb3="bb3"');
+UpdateXML(@xml, '/a/b/@bb1', 'bb3="bb3"')
+<a aa1="aa1" aa2="aa2"><b bb3="bb3" bb2="bb2">bb</b></a>
+select UpdateXML(@xml, '/a/b/@bb2', '');
+UpdateXML(@xml, '/a/b/@bb2', '')
+<a aa1="aa1" aa2="aa2"><b bb1="bb1" >bb</b></a>
+select UpdateXML(@xml, '/a/b/@bb2', 'bb3="bb3"');
+UpdateXML(@xml, '/a/b/@bb2', 'bb3="bb3"')
+<a aa1="aa1" aa2="aa2"><b bb1="bb1" bb3="bb3">bb</b></a>
+SET @xml= '<order><clerk>lesser wombat</clerk></order>';
+select extractvalue(@xml,'order/clerk');
+extractvalue(@xml,'order/clerk')
+lesser wombat
+select extractvalue(@xml,'/order/clerk');
+extractvalue(@xml,'/order/clerk')
+lesser wombat
+select extractvalue('<a><b>B</b></a>','/a|/b');
+extractvalue('<a><b>B</b></a>','/a|/b')
+
+select extractvalue('<a><b>B</b></a>','/a|b');
+extractvalue('<a><b>B</b></a>','/a|b')
+
+select extractvalue('<a>a<b>B</b></a>','/a|/b');
+extractvalue('<a>a<b>B</b></a>','/a|/b')
+a
+select extractvalue('<a>a<b>B</b></a>','/a|b');
+extractvalue('<a>a<b>B</b></a>','/a|b')
+a
+select extractvalue('<a>a<b>B</b></a>','a|/b');
+extractvalue('<a>a<b>B</b></a>','a|/b')
+a
+select extractvalue('<a>A</a>','/<a>');
+ERROR HY000: XPATH error: comparison of two nodesets is not supported: '<a>'
+select extractvalue('<a><b>b</b><b!>b!</b!></a>','//b!');
+ERROR HY000: XPATH syntax error: '!'
+select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant::*');
+extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant::*')
+B C
+select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/self::*');
+extractvalue('<a>A<b>B<c>C</c></b></a>','/a/self::*')
+A
+select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant-or-self::*');
+extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant-or-self::*')
+A B C
+select extractvalue('<A_B>A</A_B>','/A_B');
+extractvalue('<A_B>A</A_B>','/A_B')
+A
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[position()]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[position()]')
+B1 B2
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=last()]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=last()]')
+B1 B2
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()]')
+B2
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()-1]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()-1]')
+B1
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()=1]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()=1]')
+
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()=2]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()=2]')
+B1 B2
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()=position()]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()=position()]')
+B2
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)]')
+B2
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)-1]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)-1]')
+B1
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=1]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=1]')
+
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=2]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=2]')
+B1 B2
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=position()]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=position()]')
+B2
+select extractvalue('<a>Jack</a>','/a[contains(../a,"J")]');
+extractvalue('<a>Jack</a>','/a[contains(../a,"J")]')
+Jack
+select extractvalue('<a>Jack</a>','/a[contains(../a,"j")]');
+extractvalue('<a>Jack</a>','/a[contains(../a,"j")]')
+Jack
+select extractvalue('<a>Jack</a>','/a[contains(../a,"j")]' collate latin1_bin);
+extractvalue('<a>Jack</a>','/a[contains(../a,"j")]' collate latin1_bin)
+
+select extractvalue('<a>Jack</a>' collate latin1_bin,'/a[contains(../a,"j")]');
+extractvalue('<a>Jack</a>' collate latin1_bin,'/a[contains(../a,"j")]')
+
+select ExtractValue('<tag1><![CDATA[test]]></tag1>','/tag1');
+ExtractValue('<tag1><![CDATA[test]]></tag1>','/tag1')
+test
+select extractValue('<a>a','/a');
+extractValue('<a>a','/a')
+NULL
+Warnings:
+Warning 1512 Incorrect XML value: 'parse error at line 1 pos 5: unexpected END-OF-INPUT'
+select extractValue('<a>a<','/a');
+extractValue('<a>a<','/a')
+NULL
+Warnings:
+Warning 1512 Incorrect XML value: 'parse error at line 1 pos 6: END-OF-INPUT unexpected (ident or '/' wanted)'
+select extractValue('<a>a</','/a');
+extractValue('<a>a</','/a')
+NULL
+Warnings:
+Warning 1512 Incorrect XML value: 'parse error at line 1 pos 7: END-OF-INPUT unexpected (ident wanted)'
+select extractValue('<a>a</a','/a');
+extractValue('<a>a</a','/a')
+NULL
+Warnings:
+Warning 1512 Incorrect XML value: 'parse error at line 1 pos 8: END-OF-INPUT unexpected ('>' wanted)'
+select extractValue('<a>a</a></b>','/a');
+extractValue('<a>a</a></b>','/a')
+NULL
+Warnings:
+Warning 1512 Incorrect XML value: 'parse error at line 1 pos 12: '</b>' unexpected (END-OF-INPUT wanted)'
+select extractValue('<a b=>a</a>','/a');
+extractValue('<a b=>a</a>','/a')
+NULL
+Warnings:
+Warning 1512 Incorrect XML value: 'parse error at line 1 pos 7: '>' unexpected (ident or string wanted)'
+select extractValue('<e>1</e>','position()');
+ERROR HY000: XPATH syntax error: ''
+select extractValue('<e>1</e>','last()');
+ERROR HY000: XPATH syntax error: ''
+select extractValue('<e><a>1</a></e>','/e/');
+ERROR HY000: XPATH syntax error: ''
+set names utf8;
+select extractValue('<Ñ><r>r</r></Ñ>','/Ñ/r');
+extractValue('<Ñ><r>r</r></Ñ>','/Ñ/r')
+r
+select extractValue('<r><Ñ>Ñ</Ñ></r>','/r/Ñ');
+extractValue('<r><Ñ>Ñ</Ñ></r>','/r/Ñ')
+select extractValue('<Ñ r="r"/>','/Ñ/@r');
+extractValue('<Ñ r="r"/>','/Ñ/@r')
+r
+select extractValue('<r Ñ="Ñ"/>','/r/@Ñ');
+extractValue('<r Ñ="Ñ"/>','/r/@Ñ')
+DROP PROCEDURE IF EXISTS p2;
+CREATE PROCEDURE p2 ()
+BEGIN
+DECLARE p LONGTEXT CHARACTER SET UTF8 DEFAULT '<Ñ><r>A</r></Ñ>';
+SELECT EXTRACTVALUE(p,'/Ñ/r');
+END//
+CALL p2();
+EXTRACTVALUE(p,'/Ñ/r')
+A
+DROP PROCEDURE p2;
+select extractValue('<ns:element xmlns:ns="myns"/>','count(ns:element)');
+extractValue('<ns:element xmlns:ns="myns"/>','count(ns:element)')
+1
+select extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element');
+extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element')
+a
+select extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element/@xmlns:ns');
+extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element/@xmlns:ns')
+myns
+select extractValue('<foo><foo.bar>Data</foo.bar><something>Otherdata</something></foo>','/foo/foo.bar');
+extractValue('<foo><foo.bar>Data</foo.bar><something>Otherdata</something></foo>','/foo/foo.bar')
+Data
+select extractValue('<foo><foo.bar>Data</foo.bar><something>Otherdata</something></foo>','/foo/something');
+extractValue('<foo><foo.bar>Data</foo.bar><something>Otherdata</something></foo>','/foo/something')
+Otherdata
+select extractValue('<zot><tim0><01>10:39:15</01><02>140</02></tim0></zot>','/zot/tim0/02');
+ERROR HY000: XPATH syntax error: '02'
+select extractValue('<zot><tim0><01>10:39:15</01><02>140</02></tim0></zot>','//*');
+extractValue('<zot><tim0><01>10:39:15</01><02>140</02></tim0></zot>','//*')
+NULL
+Warnings:
+Warning 1512 Incorrect XML value: 'parse error at line 1 pos 13: unknown token unexpected (ident or '/' wanted)'
+select extractValue('<.>test</.>','//*');
+extractValue('<.>test</.>','//*')
+NULL
+Warnings:
+Warning 1512 Incorrect XML value: 'parse error at line 1 pos 2: unknown token unexpected (ident or '/' wanted)'
+select extractValue('<->test</->','//*');
+extractValue('<->test</->','//*')
+NULL
+Warnings:
+Warning 1512 Incorrect XML value: 'parse error at line 1 pos 2: unknown token unexpected (ident or '/' wanted)'
+select extractValue('<:>test</:>','//*');
+extractValue('<:>test</:>','//*')
+test
+select extractValue('<_>test</_>','//*');
+extractValue('<_>test</_>','//*')
+test
+select extractValue('<x.-_:>test</x.-_:>','//*');
+extractValue('<x.-_:>test</x.-_:>','//*')
+test
diff --git a/mysql-test/std_data/cacert.pem b/mysql-test/std_data/cacert.pem
new file mode 100644
index 00000000000..b445e77d7c4
--- /dev/null
+++ b/mysql-test/std_data/cacert.pem
@@ -0,0 +1,17 @@
+-----BEGIN CERTIFICATE-----
+MIICrTCCAhagAwIBAgIJAIAO/Ybiptv1MA0GCSqGSIb3DQEBBAUAMEQxCzAJBgNV
+BAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMRAwDgYDVQQHEwdVcHBzYWxhMREwDwYD
+VQQKEwhNeVNRTCBBQjAeFw0wNjA1MDMwODQ4NTRaFw0wOTAxMjcwODQ4NTRaMEQx
+CzAJBgNVBAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMRAwDgYDVQQHEwdVcHBzYWxh
+MREwDwYDVQQKEwhNeVNRTCBBQjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
++C46EQl1u7tQ6gb9eqc8V079gr8YmDPCEqtjO8bCIbchpjOpDITx0WZz36Sn9E72
+GPJwNip4FxLaPRIA3xNQHM5cE5U53qznlRx1Fc4O3hcWCvyCqNDl/vzPAh3pI6Bl
+Ku9hfHXpp93W812smVPe9haShEXGgbEPYGzvOfVdu/MCAwEAAaOBpjCBozAdBgNV
+HQ4EFgQUjIy/6OCTmqtPHBFha6/qzVk3yTcwdAYDVR0jBG0wa4AUjIy/6OCTmqtP
+HBFha6/qzVk3yTehSKRGMEQxCzAJBgNVBAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxh
+MRAwDgYDVQQHEwdVcHBzYWxhMREwDwYDVQQKEwhNeVNRTCBBQoIJAIAO/Ybiptv1
+MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEA8lD9zyB820Oq1aj7ZafX
+De/hbdt9RIl2tzgw2K3r1KZGdXJVL0vSt5fZ51Nq9lg7OPJy3iXf+caBJEp0IJpB
+uf4Gfr6zfXw+UlY6ZthRtHQHoXKcbskECjH5/ps/Uaa+dpVQ9O+Ii1rPzmgo6ztM
+s+xZ46ESBt4WiHXm8kwbU9Y=
+-----END CERTIFICATE-----
diff --git a/mysql-test/std_data/client-cert.pem b/mysql-test/std_data/client-cert.pem
new file mode 100644
index 00000000000..fdd5c86a23f
--- /dev/null
+++ b/mysql-test/std_data/client-cert.pem
@@ -0,0 +1,42 @@
+Certificate:
+ Data:
+ Version: 1 (0x0)
+ Serial Number: 1 (0x1)
+ Signature Algorithm: md5WithRSAEncryption
+ Issuer: C=SE, ST=Uppsala, L=Uppsala, O=MySQL AB
+ Validity
+ Not Before: May 3 08:55:39 2006 GMT
+ Not After : Jan 27 08:55:39 2009 GMT
+ Subject: C=SE, ST=Uppsala, L=Uppsala, O=MySQL AB/emailAddress=abstract.mysql.developer@mysql.com
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public Key: (512 bit)
+ Modulus (512 bit):
+ 00:d8:db:68:28:49:84:4d:d6:0f:5c:bc:3d:9a:ab:
+ 70:d5:3e:f5:b5:17:ba:ef:e1:f8:87:54:30:22:1f:
+ 81:07:bf:f9:24:7f:8a:54:10:e9:5f:e6:99:50:04:
+ d4:3b:55:a9:f1:52:ad:12:2b:5a:da:5c:be:8c:3e:
+ 5b:9e:b0:5a:19
+ Exponent: 65537 (0x10001)
+ Signature Algorithm: md5WithRSAEncryption
+ 07:57:bf:07:92:c2:8e:86:24:6b:0a:bf:e5:31:21:44:c3:60:
+ 02:a6:ac:9e:f7:db:7a:6e:fc:4f:d4:7b:54:18:80:47:d2:4a:
+ 63:0e:e3:f8:af:6e:58:e3:97:5a:2b:82:5d:76:20:d1:33:a0:
+ f5:43:a1:d1:51:f4:ca:c8:b3:1a:66:4e:0e:55:df:d2:e8:fa:
+ 83:18:42:f5:ec:66:40:f0:39:e8:f9:d7:cf:f6:dd:e4:7b:69:
+ dd:0c:92:d8:52:95:43:6f:29:3d:f0:8d:4c:dd:52:ea:6b:a0:
+ 39:0f:dc:59:a7:5c:37:6b:8b:05:44:b7:69:ea:a3:58:e0:4e:
+ ce:d6
+-----BEGIN CERTIFICATE-----
+MIIB5jCCAU8CAQEwDQYJKoZIhvcNAQEEBQAwRDELMAkGA1UEBhMCU0UxEDAOBgNV
+BAgTB1VwcHNhbGExEDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFC
+MB4XDTA2MDUwMzA4NTUzOVoXDTA5MDEyNzA4NTUzOVowdzELMAkGA1UEBhMCU0Ux
+EDAOBgNVBAgTB1VwcHNhbGExEDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoTCE15
+U1FMIEFCMTEwLwYJKoZIhvcNAQkBFiJhYnN0cmFjdC5teXNxbC5kZXZlbG9wZXJA
+bXlzcWwuY29tMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANjbaChJhE3WD1y8PZqr
+cNU+9bUXuu/h+IdUMCIfgQe/+SR/ilQQ6V/mmVAE1DtVqfFSrRIrWtpcvow+W56w
+WhkCAwEAATANBgkqhkiG9w0BAQQFAAOBgQAHV78HksKOhiRrCr/lMSFEw2ACpqye
+99t6bvxP1HtUGIBH0kpjDuP4r25Y45daK4JddiDRM6D1Q6HRUfTKyLMaZk4OVd/S
+6PqDGEL17GZA8Dno+dfP9t3ke2ndDJLYUpVDbyk98I1M3VLqa6A5D9xZp1w3a4sF
+RLdp6qNY4E7O1g==
+-----END CERTIFICATE-----
diff --git a/mysql-test/std_data/client-key.pem b/mysql-test/std_data/client-key.pem
new file mode 100644
index 00000000000..22f8e23ab2a
--- /dev/null
+++ b/mysql-test/std_data/client-key.pem
@@ -0,0 +1,9 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIBOgIBAAJBANjbaChJhE3WD1y8PZqrcNU+9bUXuu/h+IdUMCIfgQe/+SR/ilQQ
+6V/mmVAE1DtVqfFSrRIrWtpcvow+W56wWhkCAwEAAQJAK27WT6tZylUjQomZNQ89
+TBiOEbUtBbqWklQ0R8FTkH9uKV+8KYQ+k+tMkoAEGFfChB0YfofNQ2KZYWWw4yOB
+WQIhAPXXDQt73aou10s+cmKM3C3WzLmIZtrvm9wNBXWDGxgTAiEA4dG4cXrZfa1M
+TTbjzNU1/Jf50/M8SvZDWMPQWxJ8oqMCIH6zBpYUkHlVCsBMvsbrsc4uFfTIx7mu
+I7WVQGr/1sbhAiBf4uFirjtztgZUMx5/d3k5DH80lG/hlLf8FQl/4lWx6QIhAPHw
+CXfPUbUFl4r/i9Br5+exGol50qX4F3aP5Sh5EnZT
+-----END RSA PRIVATE KEY-----
diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-1-0.1.Data b/mysql-test/std_data/ndb_backup50/BACKUP-1-0.1.Data
new file mode 100644
index 00000000000..32494d5a1e7
--- /dev/null
+++ b/mysql-test/std_data/ndb_backup50/BACKUP-1-0.1.Data
Binary files differ
diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-1-0.2.Data b/mysql-test/std_data/ndb_backup50/BACKUP-1-0.2.Data
new file mode 100644
index 00000000000..2141fb0a6e4
--- /dev/null
+++ b/mysql-test/std_data/ndb_backup50/BACKUP-1-0.2.Data
Binary files differ
diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-1.1.ctl b/mysql-test/std_data/ndb_backup50/BACKUP-1.1.ctl
new file mode 100644
index 00000000000..cbe548e0ca5
--- /dev/null
+++ b/mysql-test/std_data/ndb_backup50/BACKUP-1.1.ctl
Binary files differ
diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-1.1.log b/mysql-test/std_data/ndb_backup50/BACKUP-1.1.log
new file mode 100644
index 00000000000..e4e114d4b46
--- /dev/null
+++ b/mysql-test/std_data/ndb_backup50/BACKUP-1.1.log
Binary files differ
diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-1.2.ctl b/mysql-test/std_data/ndb_backup50/BACKUP-1.2.ctl
new file mode 100644
index 00000000000..cbe548e0ca5
--- /dev/null
+++ b/mysql-test/std_data/ndb_backup50/BACKUP-1.2.ctl
Binary files differ
diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-1.2.log b/mysql-test/std_data/ndb_backup50/BACKUP-1.2.log
new file mode 100644
index 00000000000..a1c89b7015c
--- /dev/null
+++ b/mysql-test/std_data/ndb_backup50/BACKUP-1.2.log
Binary files differ
diff --git a/mysql-test/std_data/ndb_backup51/BACKUP-1-0.1.Data b/mysql-test/std_data/ndb_backup51/BACKUP-1-0.1.Data
new file mode 100644
index 00000000000..2407d1f261b
--- /dev/null
+++ b/mysql-test/std_data/ndb_backup51/BACKUP-1-0.1.Data
Binary files differ
diff --git a/mysql-test/std_data/ndb_backup51/BACKUP-1-0.2.Data b/mysql-test/std_data/ndb_backup51/BACKUP-1-0.2.Data
new file mode 100644
index 00000000000..f21e9886523
--- /dev/null
+++ b/mysql-test/std_data/ndb_backup51/BACKUP-1-0.2.Data
Binary files differ
diff --git a/mysql-test/std_data/ndb_backup51/BACKUP-1.1.ctl b/mysql-test/std_data/ndb_backup51/BACKUP-1.1.ctl
new file mode 100644
index 00000000000..99e2f297693
--- /dev/null
+++ b/mysql-test/std_data/ndb_backup51/BACKUP-1.1.ctl
Binary files differ
diff --git a/mysql-test/std_data/ndb_backup51/BACKUP-1.1.log b/mysql-test/std_data/ndb_backup51/BACKUP-1.1.log
new file mode 100644
index 00000000000..4448cd98c04
--- /dev/null
+++ b/mysql-test/std_data/ndb_backup51/BACKUP-1.1.log
Binary files differ
diff --git a/mysql-test/std_data/ndb_backup51/BACKUP-1.2.ctl b/mysql-test/std_data/ndb_backup51/BACKUP-1.2.ctl
new file mode 100644
index 00000000000..99e2f297693
--- /dev/null
+++ b/mysql-test/std_data/ndb_backup51/BACKUP-1.2.ctl
Binary files differ
diff --git a/mysql-test/std_data/ndb_backup51/BACKUP-1.2.log b/mysql-test/std_data/ndb_backup51/BACKUP-1.2.log
new file mode 100644
index 00000000000..3be69891402
--- /dev/null
+++ b/mysql-test/std_data/ndb_backup51/BACKUP-1.2.log
Binary files differ
diff --git a/mysql-test/std_data/rpl_timezone2.dat b/mysql-test/std_data/rpl_timezone2.dat
new file mode 100644
index 00000000000..9faeed4b207
--- /dev/null
+++ b/mysql-test/std_data/rpl_timezone2.dat
@@ -0,0 +1,2 @@
+20040101000000,NULL
+20040611093902,NULL
diff --git a/mysql-test/std_data/server-cert.pem b/mysql-test/std_data/server-cert.pem
new file mode 100644
index 00000000000..f420b4f3124
--- /dev/null
+++ b/mysql-test/std_data/server-cert.pem
@@ -0,0 +1,42 @@
+Certificate:
+ Data:
+ Version: 1 (0x0)
+ Serial Number: 1 (0x1)
+ Signature Algorithm: md5WithRSAEncryption
+ Issuer: C=SE, ST=Uppsala, L=Uppsala, O=MySQL AB
+ Validity
+ Not Before: May 3 08:54:13 2006 GMT
+ Not After : Jan 27 08:54:13 2009 GMT
+ Subject: C=SE, ST=Uppsala, L=Uppsala, O=MySQL AB, CN=localhost/emailAddress=abstract.mysql.developer@mysql.com
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public Key: (512 bit)
+ Modulus (512 bit):
+ 00:d9:fd:da:b3:fb:7c:e0:b0:03:be:97:c6:a4:36:
+ ac:71:af:bb:2d:e5:84:ed:f3:8f:2b:eb:11:e5:aa:
+ 66:ed:bf:62:6b:e3:ce:fa:80:ed:90:ff:b9:4a:39:
+ 20:40:b6:f2:99:bf:2f:33:b5:f2:ec:3a:90:60:1d:
+ 9e:94:7e:a4:1b
+ Exponent: 65537 (0x10001)
+ Signature Algorithm: md5WithRSAEncryption
+ de:5e:35:cd:7b:11:e6:7c:c5:7c:d6:27:4e:72:12:49:42:eb:
+ 6f:2c:96:f3:f4:00:78:a7:4f:9f:2d:7b:d7:30:39:af:49:4d:
+ df:b1:55:0d:30:be:23:6f:06:67:fd:dd:ba:98:66:36:c6:32:
+ b7:ed:63:fc:aa:49:cd:4f:72:98:3b:13:0e:f6:28:d7:d4:eb:
+ 04:6b:dc:e8:c7:04:80:92:e4:04:86:0b:ed:32:25:76:1d:a9:
+ 5c:a9:2c:18:2c:bd:bc:15:ed:e1:76:96:4d:bb:0d:41:44:06:
+ 2c:ad:45:bb:db:61:ad:17:11:cb:49:70:67:eb:c6:27:d3:91:
+ c8:f2
+-----BEGIN CERTIFICATE-----
+MIIB+zCCAWQCAQEwDQYJKoZIhvcNAQEEBQAwRDELMAkGA1UEBhMCU0UxEDAOBgNV
+BAgTB1VwcHNhbGExEDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFC
+MB4XDTA2MDUwMzA4NTQxM1oXDTA5MDEyNzA4NTQxM1owgYsxCzAJBgNVBAYTAlNF
+MRAwDgYDVQQIEwdVcHBzYWxhMRAwDgYDVQQHEwdVcHBzYWxhMREwDwYDVQQKEwhN
+eVNRTCBBQjESMBAGA1UEAxMJbG9jYWxob3N0MTEwLwYJKoZIhvcNAQkBFiJhYnN0
+cmFjdC5teXNxbC5kZXZlbG9wZXJAbXlzcWwuY29tMFwwDQYJKoZIhvcNAQEBBQAD
+SwAwSAJBANn92rP7fOCwA76XxqQ2rHGvuy3lhO3zjyvrEeWqZu2/YmvjzvqA7ZD/
+uUo5IEC28pm/LzO18uw6kGAdnpR+pBsCAwEAATANBgkqhkiG9w0BAQQFAAOBgQDe
+XjXNexHmfMV81idOchJJQutvLJbz9AB4p0+fLXvXMDmvSU3fsVUNML4jbwZn/d26
+mGY2xjK37WP8qknNT3KYOxMO9ijX1OsEa9zoxwSAkuQEhgvtMiV2HalcqSwYLL28
+Fe3hdpZNuw1BRAYsrUW722GtFxHLSXBn68Yn05HI8g==
+-----END CERTIFICATE-----
diff --git a/mysql-test/std_data/server-key.pem b/mysql-test/std_data/server-key.pem
new file mode 100644
index 00000000000..a4842624c0c
--- /dev/null
+++ b/mysql-test/std_data/server-key.pem
@@ -0,0 +1,9 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIBOgIBAAJBANn92rP7fOCwA76XxqQ2rHGvuy3lhO3zjyvrEeWqZu2/YmvjzvqA
+7ZD/uUo5IEC28pm/LzO18uw6kGAdnpR+pBsCAwEAAQJBAMieYdpmRoUaODf9wqh6
+ULXH/sG8i1vaXRcUHcJ50oRVfVK8/tGGvUuTDu6MeINTdahNDlYfjwOjKWVXys1w
+h6ECIQDs6s7DfczK2bKCLt0zqg24mZL3rOpGmDU+TatwN1yVgwIhAOuMzdVTX39p
+328+5WxJvBOFfxmSmqdDhIFpnRMvgguJAiByvKjT/km+970+1OllyvaIL0AA2OpA
+tBgdC0p6tyUMdwIgKuHAWzTJbu28UolVxQgLaFZmVCZ/ZzIAfnrWsLZ2a1kCIBq/
+ywJ2cpyFlgazu8AH6KCQa0ok9s70ElaB6FEC85Al
+-----END RSA PRIVATE KEY-----
diff --git a/mysql-test/std_data/words2.dat b/mysql-test/std_data/words2.dat
new file mode 100644
index 00000000000..dd52469f8e8
--- /dev/null
+++ b/mysql-test/std_data/words2.dat
@@ -0,0 +1,50 @@
+abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index cfa6182543b..168d011a2ac 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -232,9 +232,9 @@ DROP TABLE t1;
#
create table t1 (a int);
--error 1103
-alter table t1 rename to `t1\\`;
+alter table t1 rename to ``;
--error 1103
-rename table t1 to `t1\\`;
+rename table t1 to ``;
drop table t1;
#
@@ -414,6 +414,33 @@ desc t1;
drop table t1;
#
+# Some additional tests for new, faster alter table. Note that most of the
+# whole alter table code is being tested all around the test suite already.
+#
+
+create table t1 (v varchar(32));
+insert into t1 values ('def'),('abc'),('hij'),('3r4f');
+select * from t1;
+# Fast alter, no copy performed
+alter table t1 change v v2 varchar(32);
+select * from t1;
+# Fast alter, no copy performed
+alter table t1 change v2 v varchar(64);
+select * from t1;
+update t1 set v = 'lmn' where v = 'hij';
+select * from t1;
+# Regular alter table
+alter table t1 add i int auto_increment not null primary key first;
+select * from t1;
+update t1 set i=5 where i=3;
+select * from t1;
+alter table t1 change i i bigint;
+select * from t1;
+alter table t1 add unique key (i, v);
+select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn');
+drop table t1;
+
+#
# Bug#6073 "ALTER table minor glich": ALTER TABLE complains that an index
# without # prefix is not allowed for TEXT columns, while index
# is defined with prefix.
@@ -422,3 +449,90 @@ create table t1 (t varchar(255) default null, key t (t(80)))
engine=myisam default charset=latin1;
alter table t1 change t t text;
drop table t1;
+
+#
+# Bug#18038 MySQL server corrupts binary columns data
+#
+
+CREATE TABLE t1 (s CHAR(8) BINARY);
+INSERT INTO t1 VALUES ('test');
+SELECT LENGTH(s) FROM t1;
+ALTER TABLE t1 MODIFY s CHAR(10) BINARY;
+SELECT LENGTH(s) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (s BINARY(8));
+INSERT INTO t1 VALUES ('test');
+SELECT LENGTH(s) FROM t1;
+SELECT HEX(s) FROM t1;
+ALTER TABLE t1 MODIFY s BINARY(10);
+SELECT HEX(s) FROM t1;
+SELECT LENGTH(s) FROM t1;
+DROP TABLE t1;
+
+#
+# Bug#19386: Multiple alter causes crashed table
+# The trailing column would get corrupted data, or server could not even read
+# it.
+#
+
+CREATE TABLE t1 (v VARCHAR(3), b INT);
+INSERT INTO t1 VALUES ('abc', 5);
+SELECT * FROM t1;
+ALTER TABLE t1 MODIFY COLUMN v VARCHAR(4);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# End of 5.0 tests
+
+#
+# Bug#18775 - Temporary table from alter table visible to other threads
+#
+# Check if special characters work and duplicates are detected.
+--disable_warnings
+DROP TABLE IF EXISTS `t+1`, `t+2`;
+--enable_warnings
+CREATE TABLE `t+1` (c1 INT);
+ALTER TABLE `t+1` RENAME `t+2`;
+CREATE TABLE `t+1` (c1 INT);
+--error ER_TABLE_EXISTS_ERROR
+ALTER TABLE `t+1` RENAME `t+2`;
+DROP TABLE `t+1`, `t+2`;
+#
+# Same for temporary tables though these names do not become file names.
+CREATE TEMPORARY TABLE `tt+1` (c1 INT);
+ALTER TABLE `tt+1` RENAME `tt+2`;
+CREATE TEMPORARY TABLE `tt+1` (c1 INT);
+--error ER_TABLE_EXISTS_ERROR
+ALTER TABLE `tt+1` RENAME `tt+2`;
+SHOW CREATE TABLE `tt+1`;
+SHOW CREATE TABLE `tt+2`;
+DROP TABLE `tt+1`, `tt+2`;
+#
+# Check if special characters as in tmp_file_prefix work.
+CREATE TABLE `#sql1` (c1 INT);
+CREATE TABLE `@0023sql2` (c1 INT);
+SHOW TABLES;
+RENAME TABLE `#sql1` TO `@0023sql1`;
+RENAME TABLE `@0023sql2` TO `#sql2`;
+SHOW TABLES;
+ALTER TABLE `@0023sql1` RENAME `#sql-1`;
+ALTER TABLE `#sql2` RENAME `@0023sql-2`;
+SHOW TABLES;
+INSERT INTO `#sql-1` VALUES (1);
+INSERT INTO `@0023sql-2` VALUES (2);
+DROP TABLE `#sql-1`, `@0023sql-2`;
+#
+# Same for temporary tables though these names do not become file names.
+CREATE TEMPORARY TABLE `#sql1` (c1 INT);
+CREATE TEMPORARY TABLE `@0023sql2` (c1 INT);
+SHOW TABLES;
+ALTER TABLE `#sql1` RENAME `@0023sql1`;
+ALTER TABLE `@0023sql2` RENAME `#sql2`;
+SHOW TABLES;
+INSERT INTO `#sql2` VALUES (1);
+INSERT INTO `@0023sql1` VALUES (2);
+SHOW CREATE TABLE `#sql2`;
+SHOW CREATE TABLE `@0023sql1`;
+DROP TABLE `#sql2`, `@0023sql1`;
+
diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test
index f712a770712..0dccd8f111a 100644
--- a/mysql-test/t/archive.test
+++ b/mysql-test/t/archive.test
@@ -1,11 +1,12 @@
#
# Simple test for archive example
-# Taken from the select test
+# Taken FROM the select test
#
-- source include/have_archive.inc
+-- source include/have_binlog_format_mixed_or_statement.inc
--disable_warnings
-drop table if exists t1,t2;
+drop table if exists t1,t2,t3;
--enable_warnings
CREATE TABLE t1 (
@@ -15,9 +16,9 @@ CREATE TABLE t1 (
INSERT INTO t1 VALUES (9410,9412);
-select period from t1;
-select * from t1;
-select t1.* from t1;
+select period FROM t1;
+select * FROM t1;
+select t1.* FROM t1;
#
# Create test table
@@ -1243,64 +1244,64 @@ INSERT INTO t2 VALUES (1193,000000,00,'nondecreasing','implant','thrillingly',''
# Search with a key
#
-select t2.fld3 from t2 where companynr = 58 and fld3 like "%imaginable%";
-select fld3 from t2 where fld3 like "%cultivation" ;
+select t2.fld3 FROM t2 where companynr = 58 and fld3 like "%imaginable%";
+select fld3 FROM t2 where fld3 like "%cultivation" ;
#
# Search with a key using sorting and limit the same time
#
-select t2.fld3,companynr from t2 where companynr = 57+1 order by fld3;
-select fld3,companynr from t2 where companynr = 58 order by fld3;
+select t2.fld3,companynr FROM t2 where companynr = 57+1 order by fld3;
+select fld3,companynr FROM t2 where companynr = 58 order by fld3;
-select fld3 from t2 order by fld3 desc limit 10;
-select fld3 from t2 order by fld3 desc limit 5;
-select fld3 from t2 order by fld3 desc limit 5,5;
+select fld3 FROM t2 order by fld3 desc limit 10;
+select fld3 FROM t2 order by fld3 desc limit 5;
+select fld3 FROM t2 order by fld3 desc limit 5,5;
#
# Search with a key having a constant with each unique key.
# The table is read directly with read-next on fld3
#
-select t2.fld3 from t2 where fld3 = 'honeysuckle';
-select t2.fld3 from t2 where fld3 LIKE 'honeysuckl_';
-select t2.fld3 from t2 where fld3 LIKE 'hon_ysuckl_';
-select t2.fld3 from t2 where fld3 LIKE 'honeysuckle%';
-select t2.fld3 from t2 where fld3 LIKE 'h%le';
+select t2.fld3 FROM t2 where fld3 = 'honeysuckle';
+select t2.fld3 FROM t2 where fld3 LIKE 'honeysuckl_';
+select t2.fld3 FROM t2 where fld3 LIKE 'hon_ysuckl_';
+select t2.fld3 FROM t2 where fld3 LIKE 'honeysuckle%';
+select t2.fld3 FROM t2 where fld3 LIKE 'h%le';
-select t2.fld3 from t2 where fld3 LIKE 'honeysuckle_';
-select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%';
+select t2.fld3 FROM t2 where fld3 LIKE 'honeysuckle_';
+select t2.fld3 FROM t2 where fld3 LIKE 'don_t_find_me_please%';
#
# Test sorting with a used key (there is no need for sorting)
#
-select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
-select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
+select t2.fld3 FROM t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
+select fld1,fld3 FROM t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
#
# Search with a key with LIKE constant
# If the like starts with a certain letter key will be used.
#
-select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%';
-select fld3 from t2 where fld3 like "L%" and fld3 = "ok";
-select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly");
-select fld1,fld3 from t2 where fld1 like "25050%";
-select fld1,fld3 from t2 where fld1 like "25050_";
+select fld1,fld3 FROM t2 where companynr = 37 and fld3 like 'f%';
+select fld3 FROM t2 where fld3 like "L%" and fld3 = "ok";
+select fld3 FROM t2 where (fld3 like "C%" and fld3 = "Chantilly");
+select fld1,fld3 FROM t2 where fld1 like "25050%";
+select fld1,fld3 FROM t2 where fld1 like "25050_";
#
# Test rename of table
#
-create table t3 engine=archive select * from t2;
-select * from t3 where fld3='bonfire';
-select count(*) from t3;
+create table t3 engine=archive select * FROM t2;
+select * FROM t3 where fld3='bonfire';
+select count(*) FROM t3;
# Clean up path in error message
--replace_result $MYSQL_TEST_DIR . /var/master-data/ /
rename table t3 to t4;
-select * from t4 where fld3='bonfire';
-select count(*) from t4;
+select * FROM t4 where fld3='bonfire';
+select count(*) FROM t4;
# End of 4.1 tests
@@ -1346,17 +1347,156 @@ CHECK TABLE t2;
SELECT * FROM t2;
-# Just test syntax, we will never know if the output is right or wrong
-# Must be the last test
+# We won't know exactly about what is going on internally,
+# but we will see if the row makes it in!!
INSERT DELAYED INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily','');
+FLUSH TABLE t2;
+SELECT * FROM t2;
# Adding test for alter table
ALTER TABLE t2 DROP COLUMN fld6;
SHOW CREATE TABLE t2;
-SELECT * from t2;
+SELECT * FROM t2;
+
+
+# Adding tests for autoincrement
+# First the simple stuff
+
+CREATE TABLE `t5` (
+`a` int(11) NOT NULL auto_increment,
+b char(12),
+PRIMARY KEY (`a`)
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
+
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (32, "foo");
+INSERT INTO t5 VALUES (23, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+--error 1022
+INSERT INTO t5 VALUES (3, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+SELECT * FROM t5;
+
+SELECT * FROM t5 WHERE a=3;
+
+DROP TABLE t5;
+
+CREATE TABLE `t5` (
+`a` int(11) NOT NULL auto_increment,
+b char(12),
+KEY (`a`)
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 AUTO_INCREMENT=5;
+
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (32, "foo");
+INSERT INTO t5 VALUES (23, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (3, "foo");
+INSERT INTO t5 VALUES (NULL, "foo");
+SELECT * FROM t5;
+OPTIMIZE TABLE t5;
+SELECT * FROM t5;
+
+SELECT * FROM t5 WHERE a=32;
+SELECT * FROM t5 WHERE a=3;
+
+DROP TABLE t5;
+
+CREATE TABLE `t5` (
+`a` int(11) NOT NULL auto_increment,
+b blob(12),
+KEY (`a`)
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
+
+INSERT INTO t5 VALUES (NULL, "foo");
+INSERT INTO t5 VALUES (NULL, "We the people");
+INSERT INTO t5 VALUES (NULL, "in order to form a more pefect union");
+INSERT INTO t5 VALUES (NULL, "establish justice");
+INSERT INTO t5 VALUES (NULL, "foo grok ");
+INSERT INTO t5 VALUES (32, "ensure domestic tranquility");
+INSERT INTO t5 VALUES (23, "provide for the common defense");
+INSERT INTO t5 VALUES (NULL, "fo fooo");
+INSERT INTO t5 VALUES (NULL, "foo just naother bit of text");
+INSERT INTO t5 VALUES (3, "foo this is mine to think about");
+INSERT INTO t5 VALUES (NULL, "promote the general welfare");
+SELECT * FROM t5;
+SELECT b FROM t5;
+SELECT b FROM t5 WHERE a =3;
+SELECT b FROM t5 WHERE a IN (32, 23, 5);
+
+
+#More blob tests
+
+DROP TABLE t5;
+
+CREATE TABLE `t5` (
+`a` int(11) NOT NULL auto_increment,
+b blob(12),
+c blob(12),
+KEY (`a`)
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
+
+INSERT INTO t5 VALUES (NULL, "foo", "grok this!");
+INSERT INTO t5 VALUES (NULL, "We the people", NULL);
+INSERT INTO t5 VALUES (NULL, "in order to form a more peefect union", "secure the blessing of liberty");
+INSERT INTO t5 VALUES (NULL, "establish justice", "to ourselves and");
+INSERT INTO t5 VALUES (32, "ensure domestic tranquility", NULL);
+INSERT INTO t5 VALUES (23, "provide for the common defense", "posterity");
+INSERT INTO t5 VALUES (NULL, "promote the general welfare", "do ordain");
+SELECT * FROM t5;
+SELECT b FROM t5;
+SELECT b FROM t5 WHERE a =3;
+SELECT b FROM t5 WHERE a IN (32, 23, 5);
+SELECT c FROM t5;
+SELECT c FROM t5 WHERE a =3;
+SELECT c FROM t5 WHERE a IN (32, 23, 5);
+
+# Adding this in case someone tries to add fast alter table and doesn't tes
+# it.
+# Some additional tests for new, faster alter table. Note that most of the
+# whole alter table code is being tested all around the test suite already.
+#
+
+drop table t1;
+create table t1 (v varchar(32));
+insert into t1 values ('def'),('abc'),('hij'),('3r4f');
+select * from t1;
+# Fast alter, no copy performed
+alter table t1 change v v2 varchar(32);
+select * from t1;
+# Fast alter, no copy performed
+alter table t1 change v2 v varchar(64);
+select * from t1;
+update t1 set v = 'lmn' where v = 'hij';
+select * from t1;
+# Regular alter table
+alter table t1 add i int auto_increment not null primary key first;
+select * from t1;
+update t1 set i=5 where i=3;
+select * from t1;
+alter table t1 change i i bigint;
+select * from t1;
+alter table t1 add unique key (i, v);
+select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn');
+
+alter table t1 data directory="$MYSQLTEST_VARDIR/tmp";
+select * from t1;
+
#
# Cleanup, test is over
#
-drop table t1, t2, t4;
+--disable_warnings
+drop table t1, t2, t4, t5;
+--enable_warnings
diff --git a/mysql-test/t/archive_bitfield.test b/mysql-test/t/archive_bitfield.test
new file mode 100644
index 00000000000..1e4692270b5
--- /dev/null
+++ b/mysql-test/t/archive_bitfield.test
@@ -0,0 +1,98 @@
+-- source include/have_archive.inc
+-- source include/not_embedded.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+create table t1 (
+ pk1 int not null auto_increment primary key,
+ b bit(64)
+) engine=archive;
+
+show create table t1;
+insert into t1 values
+(NULL,b'1111111111111111111111111111111111111111111111111111111111111111'),
+(NULL,b'1000000000000000000000000000000000000000000000000000000000000000'),
+(NULL,b'0000000000000000000000000000000000000000000000000000000000000001'),
+(NULL,b'1010101010101010101010101010101010101010101010101010101010101010'),
+(NULL,b'0101010101010101010101010101010101010101010101010101010101010101');
+select hex(b) from t1 order by pk1;
+drop table t1;
+
+create table t1 (
+ pk1 int not null auto_increment primary key,
+ b bit(9)
+) engine=archive;
+insert into t1 values
+(NULL,b'000000000'),
+(NULL,b'000000001'),
+(NULL,b'000000010'),
+(NULL,b'000000011'),
+(NULL,b'000000100');
+select hex(b) from t1 order by pk1;
+drop table t1;
+
+create table t1 (a bit(7), b bit(9)) engine = archive;
+insert into t1 values
+(94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),
+(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),
+(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),
+(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),
+(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),
+(44, 307), (68, 454), (57, 135);
+select a+0 from t1 order by a;
+select b+0 from t1 order by b;
+drop table t1;
+
+create table t1 (
+ dummyKey INTEGER NOT NULL AUTO_INCREMENT,
+ a001 TINYINT,
+ a010 TINYINT,
+ a012 TINYINT,
+ a015 TINYINT,
+ a016 TINYINT,
+ a017 TINYINT,
+ a019 TINYINT,
+ a029 TINYINT,
+ a030 TINYINT,
+ a031 TINYINT,
+ a032 TINYINT,
+ a042 TINYINT,
+ a043 TINYINT,
+ a044 TINYINT,
+ a3001 TINYINT,
+ a3002 TINYINT,
+ a3003 TINYINT,
+ a3004 TINYINT,
+ a3005 TINYINT,
+ a3021 TINYINT,
+ a3022 TINYINT,
+ a BIT(6),
+ b BIT(6),
+ c BIT(6),
+ d TINYINT,
+ e TINYINT,
+ f TINYINT,
+ g TINYINT,
+ h TINYINT,
+ i TINYINT,
+ j TINYINT,
+ k TINYINT,
+ l TINYINT,
+ m TINYINT,
+ n TINYINT,
+ o TINYINT,
+ a034 TINYINT,
+PRIMARY KEY USING HASH (dummyKey) ) engine=archive;
+INSERT INTO `t1` VALUES
+(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000001',b'111111',b'111110',4,5,5,5,5,5,5,5,5,5,3,2,1),
+(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000010',b'000000',b'111101',4,5,5,5,5,5,5,5,5,5,3,2,1),
+(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000100',b'001111',b'111011',4,5,5,5,5,5,5,5,5,5,3,2,1),
+(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'001000',b'110000',b'110111',4,5,5,5,5,5,5,5,5,5,3,2,1),
+(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'010000',b'100001',b'101111',4,5,5,5,5,5,5,5,5,5,3,2,1),
+(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'100000',b'010010',b'011111',4,5,5,5,5,5,5,5,5,5,3,2,1),
+(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'001100',b'111111',4,5,5,5,5,5,5,5,5,5,3,2,1),
+(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
+--exec $MYSQL_DUMP --hex-blob --compact --order-by-primary --skip-extended-insert --no-create-info test t1
+drop table t1;
diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test
index 5d22bdd46a0..f869dc06187 100644
--- a/mysql-test/t/auto_increment.test
+++ b/mysql-test/t/auto_increment.test
@@ -292,3 +292,25 @@ update t1 set a=2 where a=1;
insert into t1 (val) values (1);
select * from t1;
drop table t1;
+
+#
+# Test key duplications with auto-increment in ALTER TABLE
+# bug #14573
+#
+CREATE TABLE t1 (t1 INT(10) PRIMARY KEY, t2 INT(10));
+INSERT INTO t1 VALUES(0, 0);
+INSERT INTO t1 VALUES(1, 1);
+--error ER_DUP_ENTRY
+ALTER TABLE t1 CHANGE t1 t1 INT(10) auto_increment;
+DROP TABLE t1;
+
+# Test of REPLACE when it does INSERT+DELETE and not UPDATE:
+# see if it sets LAST_INSERT_ID() ok
+create table t1 (a int primary key auto_increment, b int, c int, d timestamp default current_timestamp, unique(b),unique(c));
+insert into t1 values(null,1,1,now());
+insert into t1 values(null,0,0,null);
+# this will delete two rows
+replace into t1 values(null,1,0,null);
+select last_insert_id();
+
+drop table t1;
diff --git a/mysql-test/t/backup.test b/mysql-test/t/backup.test
index 053e83528e0..61bde0cecb0 100644
--- a/mysql-test/t/backup.test
+++ b/mysql-test/t/backup.test
@@ -10,7 +10,7 @@ connect (con2,localhost,root,,);
connection con1;
set SQL_LOG_BIN=0;
--disable_warnings
-drop table if exists t1, t2, t3;
+drop table if exists t1, t2, t3, t4;
--enable_warnings
create table t4(n int);
--replace_result ": 1" ": X" ": 2" ": X" ": 22" ": X" ": 23" ": X" $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
@@ -58,3 +58,22 @@ drop table t5;
--system rm $MYSQLTEST_VARDIR/tmp/t?.*
# End of 4.1 tests
+# End of 5.0 tests
+
+#
+# Bug#18775 - Temporary table from alter table visible to other threads
+#
+# Backup did not encode table names.
+--disable_warnings
+DROP TABLE IF EXISTS `t+1`;
+--enable_warnings
+CREATE TABLE `t+1` (c1 INT);
+INSERT INTO `t+1` VALUES (1), (2), (3);
+BACKUP TABLE `t+1` TO '../tmp';
+DROP TABLE `t+1`;
+#
+# Same for restore.
+RESTORE TABLE `t+1` FROM '../tmp';
+SELECT * FROM `t+1`;
+DROP TABLE `t+1`;
+
diff --git a/mysql-test/t/bdb-alter-table-1.test b/mysql-test/t/bdb-alter-table-1.test
deleted file mode 100644
index 9cb469a8df6..00000000000
--- a/mysql-test/t/bdb-alter-table-1.test
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Test of problem when shutting down mysqld at once after ALTER TABLE
-#
--- source include/have_bdb.inc
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) engine=BDB;
-insert into t1 values(1, 't1',4,9);
-insert into t1 values(2, 'metatable',1,9);
-insert into t1 values(3, 'metaindex',1,9 );
-select * from t1;
-alter table t1 drop column test;
-
-# Now we do a reboot and continue with the next test
-
-# End of 4.1 tests
diff --git a/mysql-test/t/bdb-alter-table-2-master.opt b/mysql-test/t/bdb-alter-table-2-master.opt
deleted file mode 100644
index c2dca33445b..00000000000
--- a/mysql-test/t/bdb-alter-table-2-master.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---force-restart
-
diff --git a/mysql-test/t/bdb-alter-table-2.test b/mysql-test/t/bdb-alter-table-2.test
deleted file mode 100644
index 15b8938a11d..00000000000
--- a/mysql-test/t/bdb-alter-table-2.test
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# Note that this test uses tables from the previous test
-# This is to test that the table t1 survives a reboot of MySQL
-# The options in the -master.opt file are just there to force the reboot
-#
--- source include/have_bdb.inc
-select * from t1;
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/bdb-crash.test b/mysql-test/t/bdb-crash.test
deleted file mode 100644
index 75f4d04d5df..00000000000
--- a/mysql-test/t/bdb-crash.test
+++ /dev/null
@@ -1,51 +0,0 @@
--- source include/have_bdb.inc
-
-# test for bug reported by Mark Steele
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-CREATE TABLE t1 (
- ChargeID int(10) unsigned NOT NULL auto_increment,
- ServiceID int(10) unsigned DEFAULT '0' NOT NULL,
- ChargeDate date DEFAULT '0000-00-00' NOT NULL,
- ChargeAmount decimal(20,2) DEFAULT '0.00' NOT NULL,
- FedTaxes decimal(20,2) DEFAULT '0.00' NOT NULL,
- ProvTaxes decimal(20,2) DEFAULT '0.00' NOT NULL,
- ChargeStatus enum('New','Auth','Unauth','Sale','Denied','Refund')
-DEFAULT 'New' NOT NULL,
- ChargeAuthorizationMessage text,
- ChargeComment text,
- ChargeTimeStamp varchar(20),
- PRIMARY KEY (ChargeID),
- KEY ServiceID (ServiceID),
- KEY ChargeDate (ChargeDate)
-) engine=BDB;
-
-BEGIN;
-INSERT INTO t1
-VALUES(NULL,1,'2001-03-01',1,1,1,'New',NULL,NULL,'now');
-COMMIT;
-
-BEGIN;
-UPDATE t1 SET ChargeAuthorizationMessage = 'blablabla' WHERE
-ChargeID = 1;
-COMMIT;
-
-INSERT INTO t1
-VALUES(NULL,1,'2001-03-01',1,1,1,'New',NULL,NULL,'now');
-select * from t1;
-drop table t1;
-
-#
-# Test for bug #2342 "Running ANALYZE TABLE on bdb table
-# inside a transaction hangs server thread"
-
-create table t1 (a int) engine=bdb;
-
-set autocommit=0;
-insert into t1 values(1);
-analyze table t1;
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/bdb-deadlock.test b/mysql-test/t/bdb-deadlock.test
deleted file mode 100644
index 88243cfc860..00000000000
--- a/mysql-test/t/bdb-deadlock.test
+++ /dev/null
@@ -1,59 +0,0 @@
-# This test doesn't work with the embedded version as this code
-# assumes that one query is running while we are doing queries on
-# a second connection.
-# This would work if mysqltest run would be threaded and handle each
-# connection in a separate thread.
-#
-
--- source include/not_embedded.inc
--- source include/have_bdb.inc
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-connection con1;
-create table t1 (id integer, x integer) engine=BDB;
-create table t2 (id integer, x integer) engine=BDB;
-insert into t1 values(0, 0);
-insert into t2 values(0, 0);
-set autocommit=0;
-update t1 set x = 1 where id = 0;
-
-connection con2;
-set autocommit=0;
-update t2 set x = 1 where id = 0;
-
-# The following query should hang because con1 is locking the page
---send
-select x from t1 where id = 0;
-
-connection con1;
-# This should generate a deadlock as we are trying to access a locked row
---send
-select x from t2 where id = 0;
-
-connection con2;
---error 1213
-reap;
-commit;
-
-connection con1;
-reap;
-commit;
-
-connection con2;
-select * from t1;
-select * from t2;
-commit;
-
-connection con1;
-select * from t1;
-select * from t2;
-commit;
-
-drop table t1,t2;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/bdb-deadlock.tminus b/mysql-test/t/bdb-deadlock.tminus
deleted file mode 100644
index 3918a8ffe9d..00000000000
--- a/mysql-test/t/bdb-deadlock.tminus
+++ /dev/null
@@ -1,59 +0,0 @@
-# This test doesn't work with the embedded version as this code
-# assumes that one query is running while we are doing queries on
-# a second connection.
-# This would work if mysqltest run would be threaded and handle each
-# connection in a separate thread.
-#
-
-#-- source include/not_embedded.inc
--- source include/have_bdb.inc
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-connection con1;
-create table t1 (id integer, x integer) engine=BDB;
-create table t2 (id integer, x integer) engine=BDB;
-insert into t1 values(0, 0);
-insert into t2 values(0, 0);
-set autocommit=0;
-update t1 set x = 1 where id = 0;
-
-connection con2;
-set autocommit=0;
-update t2 set x = 1 where id = 0;
-
-# The following query should hang because con1 is locking the page
---send
-select x from t1 where id = 0;
-
-connection con1;
-# This should generate a deadlock as we are trying to access a locked row
---send
-select x from t2 where id = 0;
-
-connection con2;
---error 1213
-reap;
-commit;
-
-connection con1;
-reap;
-commit;
-
-connection con2;
-select * from t1;
-select * from t2;
-commit;
-
-connection con1;
-select * from t1;
-select * from t2;
-commit;
-
-drop table t1,t2;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test
deleted file mode 100644
index ec05eeb3c34..00000000000
--- a/mysql-test/t/bdb.test
+++ /dev/null
@@ -1,1057 +0,0 @@
--- source include/have_bdb.inc
-
-#
-# Small basic test with ignore
-#
-
---disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8;
---enable_warnings
-create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=bdb;
-
-insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
-select id, code, name from t1 order by id;
-
-update ignore t1 set id = 8, name = 'Sinisa' where id < 3;
-select id, code, name from t1 order by id;
-update ignore t1 set id = id + 10, name = 'Ralph' where id < 4;
-select id, code, name from t1 order by id;
-
-drop table t1;
-
-#
-# A bit bigger test
-#
-
-CREATE TABLE t1 (
- id int(11) NOT NULL auto_increment,
- parent_id int(11) DEFAULT '0' NOT NULL,
- level tinyint(4) DEFAULT '0' NOT NULL,
- PRIMARY KEY (id),
- KEY parent_id (parent_id),
- KEY level (level)
-) engine=bdb;
-INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
-update t1 set parent_id=parent_id+100;
-select * from t1 where parent_id=102;
-update t1 set id=id+1000;
--- error 1062
-update t1 set id=1024 where id=1009;
-select * from t1;
-update ignore t1 set id=id+1; # This will change all rows
-select * from t1;
-update ignore t1 set id=1023 where id=1010;
-select * from t1 where parent_id=102 order by parent_id,id;
-# Here and below the differences in result are caused by difference in
-# floating point calculations performed in BDB handler.
---replace_result 5 X 6 X
-explain select level from t1 where level=1;
---replace_result 5 X 6 X
-explain select level,id from t1 where level=1;
---replace_result 5 X 6 X
-explain select level,id,parent_id from t1 where level=1;
-select level,id from t1 where level=1;
-select level,id,parent_id from t1 where level=1;
-optimize table t1;
-show keys from t1;
-drop table t1;
-
-#
-# Test replace
-#
-
-CREATE TABLE t1 (
- gesuchnr int(11) DEFAULT '0' NOT NULL,
- benutzer_id int(11) DEFAULT '0' NOT NULL,
- PRIMARY KEY (gesuchnr,benutzer_id)
-) engine=BDB;
-
-replace into t1 (gesuchnr,benutzer_id) values (2,1);
-replace into t1 (gesuchnr,benutzer_id) values (1,1);
-replace into t1 (gesuchnr,benutzer_id) values (1,1);
-select * from t1;
-drop table t1;
-
-# test for bug in replace with secondary key
-create table t1 (id int not null primary key, x int not null, key (x)) engine=bdb;
-insert into t1 (id, x) values (1, 1);
-replace into t1 (id, x) values (1, 2);
-select * from t1;
-drop table t1;
-
-#
-# test delete using hidden_primary_key
-#
-
-create table t1 (a int) engine=bdb;
-insert into t1 values (1), (2);
-optimize table t1;
-delete from t1 where a = 1;
-select * from t1;
-check table t1;
-drop table t1;
-
-create table t1 (a int,b varchar(20)) engine=bdb;
-insert into t1 values (1,""), (2,"testing");
-delete from t1 where a = 1;
-select * from t1;
-create index skr on t1 (a);
-insert into t1 values (3,""), (4,"testing");
-analyze table t1;
-show keys from t1;
-drop table t1;
-
-# Test of reading on secondary key with may be null
-
-create table t1 (a int,b varchar(20),key(a)) engine=bdb;
-insert into t1 values (1,""), (2,"testing");
-select * from t1 where a = 1;
-drop table t1;
-
-#
-# Test auto_increment on sub key
-#
-
-create table t1 (a char(10) not null, b int not null auto_increment, primary key(a,b)) engine=BDB;
-insert into t1 values ("a",1),("b",2),("a",2),("c",1);
-insert into t1 values ("a",NULL),("b",NULL),("c",NULL),("e",NULL);
-insert into t1 (a) values ("a"),("b"),("c"),("d");
-insert into t1 (a) values ('k'),('d');
-insert into t1 (a) values ("a");
-insert into t1 values ("d",last_insert_id());
-select * from t1;
-flush tables;
-select count(*) from t1;
-drop table t1;
-
-#
-# Test rollback
-#
-
-create table t1 (n int not null primary key) engine=bdb;
-set autocommit=0;
-insert into t1 values (4);
-rollback;
-select n, "after rollback" from t1;
-insert into t1 values (4);
-commit;
-select n, "after commit" from t1;
-commit;
-insert into t1 values (5);
--- error 1062
-insert into t1 values (4);
-commit;
-select n, "after commit" from t1;
-set autocommit=1;
-insert into t1 values (6);
--- error 1062
-insert into t1 values (4);
-select n from t1;
-# nop
-rollback;
-drop table t1;
-
-#
-# Testing transactions
-#
-
-create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=BDB;
-begin;
-insert into t1 values(1,'hamdouni');
-select id as afterbegin_id,nom as afterbegin_nom from t1;
-rollback;
-select id as afterrollback_id,nom as afterrollback_nom from t1;
-set autocommit=0;
-insert into t1 values(2,'mysql');
-select id as afterautocommit0_id,nom as afterautocommit0_nom from t1;
-rollback;
-select id as afterrollback_id,nom as afterrollback_nom from t1;
-set autocommit=1;
-drop table t1;
-
-#
-# Simple not autocommit test
-#
-
-CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=bdb;
-insert into t1 values ('pippo', 12);
--- error 1062
-insert into t1 values ('pippo', 12); # Gives error
-delete from t1;
-delete from t1 where id = 'pippo';
-select * from t1;
-
-insert into t1 values ('pippo', 12);
-set autocommit=0;
-delete from t1;
-rollback;
-select * from t1;
-delete from t1;
-commit;
-select * from t1;
-drop table t1;
-set autocommit=1;
-
-#
-# The following simple tests failed at some point
-#
-
-CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=BDB;
-INSERT INTO t1 VALUES (1, 'Jochen');
-select * from t1;
-drop table t1;
-
-CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=BDB;
-set autocommit=0;
-INSERT INTO t1 SET _userid='marc@anyware.co.uk';
-COMMIT;
-SELECT * FROM t1;
-SELECT _userid FROM t1 WHERE _userid='marc@anyware.co.uk';
-drop table t1;
-set autocommit=1;
-
-#
-# Test when reading on part of unique key
-#
-CREATE TABLE t1 (
- user_id int(10) DEFAULT '0' NOT NULL,
- name varchar(100),
- phone varchar(100),
- ref_email varchar(100) DEFAULT '' NOT NULL,
- detail varchar(200),
- PRIMARY KEY (user_id,ref_email)
-)engine=bdb;
-
-INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar');
-select * from t1 where user_id=10292;
-INSERT INTO t1 VALUES (10291,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10293,'shirish','2333604','shirish@yahoo.com','ddsds');
-select * from t1 where user_id=10292;
-select * from t1 where user_id>=10292;
-select * from t1 where user_id>10292;
-select * from t1 where user_id<10292;
-drop table t1;
-
-#
-# Test that keys are created in right order
-#
-
-CREATE TABLE t1 (a int not null, b int not null,c int not null,
-key(a),primary key(a,b), unique(c),key(a),unique(b));
-show index from t1;
-drop table t1;
-
-#
-# Test of ALTER TABLE and BDB tables
-#
-
-create table t1 (col1 int not null, col2 char(4) not null, primary key(col1));
-alter table t1 engine=BDB;
-insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4');
-select * from t1;
-update t1 set col2='7' where col1='4';
-select * from t1;
-alter table t1 add co3 int not null;
-select * from t1;
-update t1 set col2='9' where col1='2';
-select * from t1;
-drop table t1;
-
-#
-# INSERT INTO BDB tables
-#
-
-create table t1 (a int not null , b int, primary key (a)) engine = BDB;
-create table t2 (a int not null , b int, primary key (a)) engine = myisam;
-insert into t1 VALUES (1,3) , (2,3), (3,3);
-select * from t1;
-insert into t2 select * from t1;
-select * from t2;
-delete from t1 where b = 3;
-select * from t1;
-insert into t1 select * from t2;
-select * from t1;
-select * from t2;
-drop table t1,t2;
-
-#
-# Search on unique key
-#
-
-CREATE TABLE t1 (
- id int(11) NOT NULL auto_increment,
- ggid varchar(32) binary DEFAULT '' NOT NULL,
- email varchar(64) DEFAULT '' NOT NULL,
- passwd varchar(32) binary DEFAULT '' NOT NULL,
- PRIMARY KEY (id),
- UNIQUE ggid (ggid)
-) ENGINE=BDB;
-
-insert into t1 (ggid,passwd) values ('test1','xxx');
-insert into t1 (ggid,passwd) values ('test2','yyy');
--- error 1062
-insert into t1 (ggid,passwd) values ('test2','this will fail');
--- error 1062
-insert into t1 (ggid,id) values ('this will fail',1);
-
-select * from t1 where ggid='test1';
-select * from t1 where passwd='xxx';
-select * from t1 where id=2;
-
-replace into t1 (ggid,id) values ('this will work',1);
-replace into t1 (ggid,passwd) values ('test2','this will work');
--- error 1062
-update t1 set id=100,ggid='test2' where id=1;
-select * from t1;
-select * from t1 where id=1;
-select * from t1 where id=999;
-drop table t1;
-
-#
-# ORDER BY on not primary key
-#
-
-CREATE TABLE t1 (
- user_name varchar(12),
- password text,
- subscribed char(1),
- user_id int(11) DEFAULT '0' NOT NULL,
- quota bigint(20),
- weight double,
- access_date date,
- access_time time,
- approved datetime,
- dummy_primary_key int(11) NOT NULL auto_increment,
- PRIMARY KEY (dummy_primary_key)
-) ENGINE=BDB;
-INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1);
-INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2);
-INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3);
-INSERT INTO t1 VALUES ('user_3','somepassword','Y',3,3,1.7320508075689,'2000-09-07','23:06:59','2000-09-07 23:06:59',4);
-INSERT INTO t1 VALUES ('user_4','somepassword','N',4,4,2,'2000-09-07','23:06:59','2000-09-07 23:06:59',5);
-select user_name, password , subscribed, user_id, quota, weight, access_date, access_time, approved, dummy_primary_key from t1 order by user_name;
-drop table t1;
-
-#
-# Testing of tables without primary keys
-#
-
-CREATE TABLE t1 (
- id int(11) NOT NULL auto_increment,
- parent_id int(11) DEFAULT '0' NOT NULL,
- level tinyint(4) DEFAULT '0' NOT NULL,
- KEY (id),
- KEY parent_id (parent_id),
- KEY level (level)
-) engine=bdb;
-INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1);
-INSERT INTO t1 values (179,5,2);
-update t1 set parent_id=parent_id+100;
-select * from t1 where parent_id=102;
-update t1 set id=id+1000;
-update t1 set id=1024 where id=1009;
-select * from t1;
-update ignore t1 set id=id+1; # This will change all rows
-select * from t1;
-update ignore t1 set id=1023 where id=1010;
-select * from t1 where parent_id=102;
---replace_result 5 X 6 X
-explain select level from t1 where level=1;
-select level,id from t1 where level=1;
-select level,id,parent_id from t1 where level=1;
-select level,id from t1 where level=1 order by id;
-delete from t1 where level=1;
-select * from t1;
-drop table t1;
-
-#
-# Test of index only reads
-#
-CREATE TABLE t1 (
- sca_code char(6) NOT NULL,
- cat_code char(6) NOT NULL,
- sca_desc varchar(50),
- lan_code char(2) NOT NULL,
- sca_pic varchar(100),
- sca_sdesc varchar(50),
- sca_sch_desc varchar(16),
- PRIMARY KEY (sca_code, cat_code, lan_code),
- INDEX sca_pic (sca_pic)
-) engine = bdb ;
-
-INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
-select count(*) from t1 where sca_code = 'PD';
-select count(*) from t1 where sca_code <= 'PD';
-select count(*) from t1 where sca_pic is null;
-alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
-select count(*) from t1 where sca_code='PD' and sca_pic is null;
-select count(*) from t1 where cat_code='E';
-
-alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
-select count(*) from t1 where sca_code='PD' and sca_pic is null;
-select count(*) from t1 where sca_pic >= 'n';
-select sca_pic from t1 where sca_pic is null;
-update t1 set sca_pic="test" where sca_pic is null;
-delete from t1 where sca_code='pd';
-drop table t1;
-
-#
-# Test of opening table twice and timestamps
-#
-set @a:=now();
-CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=bdb;
-insert into t1 (a) values(1),(2),(3);
-select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
-select a from t1 natural join t1 as t2 where b >= @a order by a;
-update t1 set a=5 where a=1;
-select a from t1;
-drop table t1;
-
-#
-# Test flushing of berkeley DB logs
-#
-flush logs;
-
-#
-# Test key on blob with null values
-#
-create table t1 (b blob, i int, key (b(100)), key (i), key (i, b(20))) engine=bdb;
-insert into t1 values ('this is a blob', 1), (null, -1), (null, null),("",1),("",2),("",3);
-select b from t1 where b = 'this is a blob';
-select * from t1 where b like 't%';
-select b, i from t1 where b is not null;
-select * from t1 where b is null and i > 0;
-select * from t1 where i is NULL;
-update t1 set b='updated' where i=1;
-select * from t1;
-drop table t1;
-
-#
-# Test with variable length primary key
-#
-create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=bdb;
-insert into t1 values("hello",1),("world",2);
-select * from t1 order by b desc;
-optimize table t1;
-show keys from t1;
-drop table t1;
-
-#
-# Test of bug in create index with NULL columns
-#
-create table t1 (i int, j int )ENGINE=BDB;
-insert into t1 values (1,2);
-select * from t1 where i=1 and j=2;
-create index ax1 on t1 (i,j);
-select * from t1 where i=1 and j=2;
-drop table t1;
-
-#
-# Test of with CONST tables and TEXT columns
-# This gave a wrong result because the row information was freed too early
-#
-
-create table t1
-(
- branch_id int auto_increment primary key,
- branch_name varchar(255) not null,
- branch_active int not null default 1,
-
- unique branch_name(branch_name),
- index branch_active(branch_active)
-) engine=bdb;
-create table t2
-(
- target_id int auto_increment primary key,
- target_name varchar(255) not null,
- target_active int not null default 1,
-
- unique target_name(target_name),
- index target_active(target_active)
-) engine=bdb;
-create table t3
-(
- platform_id int auto_increment primary key,
- platform_name varchar(255) not null,
- platform_active int not null default 1,
-
- unique platform_name(platform_name),
- index platform_active(platform_active)
-) engine=bdb;
-create table t4
-(
- product_id int auto_increment primary key,
- product_name varchar(255) not null,
- version_file varchar(255) not null,
- product_active int not null default 1,
-
- unique product_name(product_name),
- index product_active(product_active)
-) engine=bdb;
-create table t5
-(
- product_file_id int auto_increment primary key,
- product_id int not null,
- file_name varchar(255) not null,
- /* cvs module used to find the file version */
- module_name varchar(255) not null,
- /* flag whether the file is still included in the product */
- file_included int not null default 1,
-
- unique product_file(product_id,file_name),
- index file_included(file_included)
-) engine=bdb;
-create table t6
-(
- file_platform_id int auto_increment primary key,
- product_file_id int not null,
- platform_id int not null,
- branch_id int not null,
- /* filename in the build system */
- build_filename varchar(255) not null,
- /* default filename in the build archive */
- archive_filename varchar(255) not null,
-
- unique file_platform(product_file_id,platform_id,branch_id)
-) engine=bdb;
-create table t8
-(
- archive_id int auto_increment primary key,
- branch_id int not null,
- target_id int not null,
- platform_id int not null,
- product_id int not null,
- status_id int not null default 1,
-
- unique archive(branch_id,target_id,platform_id,product_id),
- index status_id(status_id)
-) engine=bdb;
-create table t7
-(
- build_id int auto_increment primary key,
- branch_id int not null,
- target_id int not null,
- build_number int not null,
- build_date date not null,
- /* build system tag, e.g. 'rmanight-022301-1779' */
- build_tag varchar(255) not null,
- /* path relative to the build archive root, e.g. 'current' */
- build_path text not null,
-
- unique build(branch_id,target_id,build_number)
-) engine=bdb;
-
-insert into t1 (branch_name)
-values ('RealMedia');
-insert into t1 (branch_name)
-values ('RP8REV');
-insert into t1 (branch_name)
-values ('SERVER_8_0_GOLD');
-
-insert into t2 (target_name)
-values ('rmanight');
-insert into t2 (target_name)
-values ('playerall');
-insert into t2 (target_name)
-values ('servproxyall');
-
-insert into t3 (platform_name)
-values ('linux-2.0-libc6-i386');
-insert into t3 (platform_name)
-values ('win32-i386');
-
-insert into t4 (product_name, version_file)
-values ('realserver', 'servinst');
-insert into t4 (product_name, version_file)
-values ('realproxy', 'prxyinst');
-insert into t4 (product_name, version_file)
-values ('realplayer', 'playinst');
-insert into t4 (product_name, version_file)
-values ('plusplayer', 'plusinst');
-
-create temporary table tmp1
- select branch_id, target_id, platform_id, product_id
- from t1, t2, t3, t4 ;
-create temporary table tmp2
- select tmp1.branch_id, tmp1.target_id, tmp1.platform_id, tmp1.product_id
- from tmp1 left join t8
- using (branch_id,target_id,platform_id,product_id)
- where t8.archive_id is null ;
-insert into t8
- (branch_id, target_id, platform_id, product_id, status_id)
- select branch_id, target_id, platform_id, product_id, 1
- from tmp2 ;
-drop table tmp1 ;
-drop table tmp2 ;
-
-insert into t5 (product_id, file_name, module_name)
-values (1, 'servinst', 'server');
-
-insert into t5 (product_id, file_name, module_name)
-values (2, 'prxyinst', 'server');
-
-insert into t5 (product_id, file_name, module_name)
-values (3, 'playinst', 'rpapp');
-
-insert into t5 (product_id, file_name, module_name)
-values (4, 'plusinst', 'rpapp');
-
-insert into t6
-(product_file_id,platform_id,branch_id,build_filename,archive_filename)
-values (1, 2, 3, 'servinst.exe', 'win32-servinst.exe');
-
-insert into t6
-(product_file_id,platform_id,branch_id,build_filename,archive_filename)
-values (1, 1, 3, 'v80_linux-2.0-libc6-i386_servinst.bin', 'linux2-servinst.exe');
-
-insert into t6
-(product_file_id,platform_id,branch_id,build_filename,archive_filename)
-values (3, 2, 2, 'playinst.exe', 'win32-playinst.exe');
-
-insert into t6
-(product_file_id,platform_id,branch_id,build_filename,archive_filename)
-values (4, 2, 2, 'playinst.exe', 'win32-playinst.exe');
-
-insert into t7
-(branch_id,target_id,build_number,build_tag,build_date,build_path)
-values (2, 2, 1071, 'playerall-022101-1071', '2001-02-21', 'current');
-
-insert into t7
-(branch_id,target_id,build_number,build_tag,build_date,build_path)
-values (2, 2, 1072, 'playerall-022201-1072', '2001-02-22', 'current');
-
-insert into t7
-(branch_id,target_id,build_number,build_tag,build_date,build_path)
-values (3, 3, 388, 'servproxyall-022201-388', '2001-02-22', 'current');
-
-insert into t7
-(branch_id,target_id,build_number,build_tag,build_date,build_path)
-values (3, 3, 389, 'servproxyall-022301-389', '2001-02-23', 'current');
-
-insert into t7
-(branch_id,target_id,build_number,build_tag,build_date,build_path)
-values (4, 4, 100, 'foo target-010101-100', '2001-01-01', 'current');
-
-update t8
-set status_id=2
-where branch_id=2 and target_id=2 and platform_id=2 and product_id=1;
-
-select t7.build_path
-from
- t1,
- t7,
- t2,
- t3,
- t4,
- t5,
- t6
-where
- t7.branch_id = t1.branch_id and
- t7.target_id = t2.target_id and
- t5.product_id = t4.product_id and
- t6.product_file_id = t5.product_file_id and
- t6.platform_id = t3.platform_id and
- t6.branch_id = t6.branch_id and
- t7.build_id = 1 and
- t4.product_id = 3 and
- t5.file_name = 'playinst' and
- t3.platform_id = 2;
-
-drop table t1, t2, t3, t4, t5, t6, t7, t8;
-
-#
-# Test with blob + tinyint key
-#
-
-CREATE TABLE t1 (
- a tinytext NOT NULL,
- b tinyint(3) unsigned NOT NULL default '0',
- PRIMARY KEY (a(32),b)
-) ENGINE=BDB;
-INSERT INTO t1 VALUES ('a',1),('a',2);
-SELECT * FROM t1 WHERE a='a' AND b=2;
-SELECT * FROM t1 WHERE a='a' AND b in (2);
-SELECT * FROM t1 WHERE a='a' AND b in (1,2);
-drop table t1;
-
-#
-# Test min-max optimization
-#
-
-CREATE TABLE t1 (
- a int3 unsigned NOT NULL,
- b int1 unsigned NOT NULL,
- UNIQUE (a, b)
-) ENGINE = BDB;
-
-INSERT INTO t1 VALUES (1, 1);
-SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
-drop table t1;
-
-#
-# Test problem with BDB and lock tables with duplicate write.
-#
-
-create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb;
-insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
-LOCK TABLES t1 WRITE;
---error 1062
-insert into t1 values (99,1,2,'D'),(1,1,2,'D');
-select id from t1;
-select id from t1;
-UNLOCK TABLES;
-DROP TABLE t1;
-
-create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb;
-insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
-LOCK TABLES t1 WRITE;
-begin;
---error 1062
-insert into t1 values (99,1,2,'D'),(1,1,2,'D');
-select id from t1;
-insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
-commit;
-select id,id3 from t1;
-UNLOCK TABLES;
-DROP TABLE t1;
-
-#
-# Test with empty tables (crashed with lock error)
-#
-
-CREATE TABLE t1 (SYAIN_NO char(5) NOT NULL default '', KINMU_DATE char(6) NOT NULL default '', PRIMARY KEY (SYAIN_NO,KINMU_DATE)) ENGINE=BerkeleyDB;
-CREATE TABLE t2 ( SYAIN_NO char(5) NOT NULL default '',STR_DATE char(8) NOT NULL default '',PRIMARY KEY (SYAIN_NO,STR_DATE) ) ENGINE=BerkeleyDB;
-select T1.KINMU_DATE from t1 T1 ,t2 T2 where T1.SYAIN_NO = '12345' and T1.KINMU_DATE = '200106' and T2.SYAIN_NO = T1.SYAIN_NO;
-select T1.KINMU_DATE from t1 T1 ,t2 T2 where T1.SYAIN_NO = '12345' and T1.KINMU_DATE = '200106' and T2.SYAIN_NO = T1.SYAIN_NO;
-DROP TABLE t1,t2;
-
-#
-# Test problem with joining table to itself on a multi-part unique key
-#
-
-create table t1 (a int(11) not null, b int(11) not null, unique (a,b)) engine=bdb;
-insert into t1 values (1,1), (1,2);
-select * from t1 where a = 1;
-select t1.*, t2.* from t1, t1 t2 where t1.a = t2.a and t2.a = 1;
-select * from t1 where a = 1;
-drop table t1;
-
-#
-# This caused a deadlock in BDB internal locks
-#
-
-create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb;
-insert into t1 values (0,0,0,'ABCDEFGHIJ');
-create table t2 (id int NOT NULL,primary key (id)) engine=bdb;
-LOCK TABLES t1 WRITE, t2 WRITE;
-insert into t2 values(1);
-SELECT t1.* FROM t1 WHERE id IN (1);
-SELECT t1.* FROM t2 left outer join t1 on (t1.id=t2.id);
-delete from t1 where id3 >= 0 and id3 <= 0;
-drop table t1,t2;
-
-#
-# Test problems with NULL
-#
-
-CREATE TABLE t1 (i varchar(48) NOT NULL default '', p varchar(255) default NULL,s varchar(48) NOT NULL default '', PRIMARY KEY (i), UNIQUE(p,s)) ENGINE=BDB;
-INSERT INTO t1 VALUES ('00000000-e6c4ddeaa6-003b8-83458387','programs/xxxxxxxx.wmv','00000000-e6c4ddeb32-003bc-83458387');
-SELECT * FROM t1 WHERE p='programs/xxxxxxxx.wmv';
-drop table t1;
-
-#
-# Test problem which gave error 'Can't find record in 't1''
-#
-
-CREATE TABLE t1 ( STR_DATE varchar(8) NOT NULL default '',INFO_NOTE varchar(200) default NULL,PRIMARY KEY (STR_DATE) ) ENGINE=BerkeleyDB;
-select INFO_NOTE from t1 where STR_DATE = '20010610';
-select INFO_NOTE from t1 where STR_DATE < '20010610';
-select INFO_NOTE from t1 where STR_DATE > '20010610';
-drop table t1;
-
-#
-# Test problem with multi table delete which quickly shows up with bdb tables.
-#
-
-create table t1 (a int not null, b int, primary key (a)) engine =bdb;
-create table t2 (a int not null, b int, primary key (a)) engine =bdb;
-insert into t1 values (2, 3),(1, 7),(10, 7);
-insert into t2 values (2, 3),(1, 7),(10, 7);
-select * from t1;
-select * from t2;
-delete t1, t2 from t1, t2 where t1.a = t2.a;
-select * from t1;
-select * from t2;
-select * from t2;
-drop table t1,t2;
-
-#
-# The bug #971
-#
-
-create table t1 (x int not null, index(x)) engine=bdb;
-insert into t1 values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
-select * from t1 where x <= 10 and x >= 7;
-select * from t1 where x <= 10 and x >= 7 order by x;
-select * from t1 where x <= 10 and x >= 7 order by x desc;
-select * from t1 where x <= 8 and x >= 5 order by x desc;
-select * from t1 where x < 8 and x > 5 order by x desc;
-drop table t1;
-
-#
-# Test of multi-table-updates (bug #1980).
-#
-
-create table t1 ( c char(8) not null ) engine=bdb;
-insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
-insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
-
-alter table t1 add b char(8) not null;
-alter table t1 add a char(8) not null;
-alter table t1 add primary key (a,b,c);
-update t1 set a=c, b=c;
-
-create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=bdb;
-insert into t2 select * from t1;
-
-delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
-drop table t1,t2;
-
-#
-# Test index only read (Bug #2509)
-#
-create table t1 (a char(10), key(a), b int not null, key(b)) engine=bdb;
-insert into t1 values ('a',1),('A',2);
-explain select a from t1;
-select a from t1;
-explain select b from t1;
-select b from t1;
-alter table t1 modify a char(10) binary;
-explain select a from t1;
-select a from t1;
-drop table t1;
-
-#
-# bug#2686 - index_merge select on BerkeleyDB table with varchar PK crashes
-#
-
-create table t1(
- pk1 text not null, pk2 text not null, pk3 char(4),
- key1 int, key2 int,
- primary key(pk1(4), pk2(4), pk3), key(key1), key(key2)
-) engine=bdb;
-insert into t1 values (concat('aaa-', repeat('A', 4000)),
- concat('eee-', repeat('e', 4000)), 'a++a', 1, 1);
-insert into t1 values (concat('bbb-', repeat('B', 4000)),
- concat('ggg-', repeat('G', 4000)), 'b++b', 1, 1);
-select substring(pk1, 1, 4), substring(pk1, 4001),
- substring(pk2, 1, 4), substring(pk2, 4001), pk3, key1, key2
- from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
-drop table t1;
-
-#
-# bug#2688 - Wrong index_merge query results for BDB table with
-# variable length primary key
-#
-
-create table t1 (
- pk1 varchar(8) not null default '',
- pk2 varchar(4) not null default '',
- key1 int(11) default null,
- key2 int(11) default null,
- primary key (pk1,pk2),
- key key1 (key1),
- key key2 (key2)) engine=bdb;
-insert into t1 values ('','empt',2,2), ('a','a--a',2,2),
- ('bb','b--b',2,2), ('ccc','c--c',2,2), ('dddd','d--d',2,2);
-select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
-drop table t1;
-
-
-#
-# Bug #4000: problem with active cursor.
-#
-
-set autocommit=0;
-create table t1(b varchar(30)) engine=bdb;
-insert into t1 values ('one');
-commit;
-select b FROM t1 outer_table where
-exists (select 'two' from t1 where 'two' = outer_table.b);
-drop table t1;
-set autocommit=1;
-
-#
-# Bug #4089: subselect and open cursor.
-#
-
-create table t1(a int primary key, b varchar(30)) engine=bdb;
-insert into t1 values (1,'one'), (2,'two'), (3,'three'), (4,'four');
-create table t2 like t1;
-insert t2 select * from t1;
-select a from t1 where a in (select a from t2);
-delete from t2;
-insert into t2 (a, b)
- select a, b from t1 where (a, b) in (select a, b from t1);
-select * from t2;
-drop table t1, t2;
-
-#
-# Bug #4304: TRUNCATE <table of type BDB> , wrong result
-#
-
-create table t1 (a int, b varchar(30), primary key(a)) engine = bdb;
-insert into t1 values (1,'one');
-commit;
-truncate t1;
-select * from t1;
-drop table t1;
-
-#
-# Check that BDB works fine with a string which is
-# longer than 255 bytes for multibyte characters.
-#
-SET NAMES utf8;
-create table t1 (a varchar(255) character set utf8) engine=bdb;
-set @a:= convert(repeat(_latin1 0xFF, 255) using utf8);
-insert into t1 values (@a);
-select a, length(a), char_length(a) from t1;
-drop table t1;
-SET NAMES latin1;
-
-#
-# Bug #5832 SELECT doesn't return records in some cases
-#
-CREATE TABLE t1 (
- id int unsigned NOT NULL auto_increment,
- list_id smallint unsigned NOT NULL,
- term TEXT NOT NULL,
- PRIMARY KEY(id),
- INDEX(list_id, term(4))
-) ENGINE=BDB CHARSET=utf8;
-INSERT INTO t1 SET list_id = 1, term = "letterc";
-INSERT INTO t1 SET list_id = 1, term = "letterb";
-INSERT INTO t1 SET list_id = 1, term = "lettera";
-INSERT INTO t1 SET list_id = 1, term = "letterd";
-SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterc");
-SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterb");
-SELECT id FROM t1 WHERE (list_id = 1) AND (term = "lettera");
-SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd");
-DROP TABLE t1;
-
-#
-# Bug #15536: Crash when DELETE with subquery using BDB tables
-#
-create table t1 (a int, key(a)) engine=bdb;
-create table t2 (b int, key(b)) engine=bdb;
-insert into t1 values (1),(1),(2),(3),(4);
-insert into t2 values (1),(5),(6),(7);
-delete from t1 where (a in (select b from t2));
-select count(*) from t1;
-# INSERT also blows up
---error 1242
-insert into t1 set a=(select b from t2);
-select count(*) from t1;
-# UPDATE also blows up
-update t1 set a = a + 1 where (a in (select b from t2));
-select count(*) from t1;
-drop table t1, t2;
-
---echo End of 4.1 tests
-
-#
-# alter temp table
-#
-create temporary table t1 (a int, primary key(a)) engine=bdb;
-select * from t1;
-alter table t1 add b int;
-select * from t1;
-drop table t1;
-
-
-#
-# Test varchar
-#
-
-let $default=`select @@storage_engine`;
-set storage_engine=bdb;
-source include/varchar.inc;
-
-#
-# Some errors/warnings on create
-#
-
---replace_result 1024 MAX_KEY_LENGTH 3072 MAX_KEY_LENGTH
-create table t1 (v varchar(65530), key(v));
-drop table if exists t1;
-create table t1 (v varchar(65536));
-show create table t1;
-drop table t1;
-create table t1 (v varchar(65530) character set utf8);
-show create table t1;
-drop table t1;
-
-# End varchar test
-eval set storage_engine=$default;
-
-#
-# Test that we can create a large key
-#
-create table t1 (a varchar(255) character set utf8,
- b varchar(255) character set utf8,
- c varchar(255) character set utf8,
- d varchar(255) character set utf8,
- key (a,b,c,d)) engine=bdb;
-drop table t1;
---error ER_TOO_LONG_KEY
-create table t1 (a varchar(255) character set utf8,
- b varchar(255) character set utf8,
- c varchar(255) character set utf8,
- d varchar(255) character set utf8,
- e varchar(255) character set utf8,
- key (a,b,c,d,e)) engine=bdb;
-
-#
-# Bug #14212: Server crash after COMMIT + ALTER TABLE
-#
-set autocommit=0;
-create table t1 (a int) engine=bdb;
-commit;
-alter table t1 add primary key(a);
-drop table t1;
-
-
-#
-# Bug #16206: Superfluous COMMIT event in binlog when updating BDB in autocommit mode
-#
-set autocommit=1;
-
-let $VERSION=`select version()`;
-
-reset master;
-create table bug16206 (a int);
-insert into bug16206 values(1);
-start transaction;
-insert into bug16206 values(2);
-commit;
---replace_result $VERSION VERSION
---replace_column 1 f 2 n 5 n
-show binlog events;
-drop table bug16206;
-
-reset master;
-create table bug16206 (a int) engine= bdb;
-insert into bug16206 values(0);
-insert into bug16206 values(1);
-start transaction;
-insert into bug16206 values(2);
-commit;
-insert into bug16206 values(3);
---replace_result $VERSION VERSION
---replace_column 1 f 2 n 5 n
-show binlog events;
-drop table bug16206;
-
-set autocommit=0;
-
-
---echo End of 5.0 tests
diff --git a/mysql-test/t/bdb_cache.test b/mysql-test/t/bdb_cache.test
deleted file mode 100644
index 85328920d71..00000000000
--- a/mysql-test/t/bdb_cache.test
+++ /dev/null
@@ -1,53 +0,0 @@
--- source include/have_bdb.inc
--- source include/have_query_cache.inc
-
-#
-# Without auto_commit.
-#
---disable_warnings
-drop table if exists t1, t2, t3;
---enable_warnings
-flush status;
-set autocommit=0;
-create table t1 (a int not null) engine=bdb;
-insert into t1 values (1),(2),(3);
-select * from t1;
-show status like "Qcache_queries_in_cache";
-drop table t1;
-set autocommit=1;
-create table t1 (a int not null) engine=bdb;
-begin;
-insert into t1 values (1),(2),(3);
-select * from t1;
-show status like "Qcache_queries_in_cache";
-drop table t1;
-create table t1 (a int not null) engine=bdb;
-create table t2 (a int not null) engine=bdb;
-create table t3 (a int not null) engine=bdb;
-insert into t1 values (1),(2);
-insert into t2 values (1),(2);
-insert into t3 values (1),(2);
-select * from t1;
-select * from t2;
-select * from t3;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_hits";
-begin;
-select * from t1;
-select * from t2;
-select * from t3;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_hits";
-insert into t1 values (3);
-insert into t2 values (3);
-insert into t1 values (4);
-select * from t1;
-select * from t2;
-select * from t3;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_hits";
-commit;
-show status like "Qcache_queries_in_cache";
-drop table if exists t1, t2, t3;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/bdb_gis.test b/mysql-test/t/bdb_gis.test
deleted file mode 100644
index 88dcbb7cbe9..00000000000
--- a/mysql-test/t/bdb_gis.test
+++ /dev/null
@@ -1,3 +0,0 @@
--- source include/have_bdb.inc
-SET storage_engine=bdb;
---source include/gis_generic.inc
diff --git a/mysql-test/t/binlog.test b/mysql-test/t/binlog.test
deleted file mode 100644
index 1063940d378..00000000000
--- a/mysql-test/t/binlog.test
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# misc binlogging tests that do not require a slave running
-#
--- source include/not_embedded.inc
--- source include/have_bdb.inc
--- source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-reset master;
-
-create table t1 (a int) engine=bdb;
-create table t2 (a int) engine=innodb;
-begin;
-insert t1 values (5);
-commit;
-begin;
-insert t2 values (5);
-commit;
-# first COMMIT must be Query_log_event, second - Xid_log_event
---replace_result "xid=21" "xid=12"
---replace_column 2 # 5 #
-show binlog events from 98;
-drop table t1,t2;
-
-#
-# binlog rotation after one big transaction
-#
-reset master;
-let $1=100;
-
-create table t1 (n int) engine=innodb;
-begin;
---disable_query_log
-while ($1)
-{
- eval insert into t1 values($1 + 4);
- dec $1;
-}
---enable_query_log
-commit;
-drop table t1;
---replace_result "xid=32" "xid=19"
---replace_column 2 # 5 #
-show binlog events in 'master-bin.000001' from 98;
---replace_column 2 # 5 #
-show binlog events in 'master-bin.000002' from 98;
-
diff --git a/mysql-test/t/binlog-master.opt b/mysql-test/t/binlog_row_binlog-master.opt
index ad2c6a647b5..ad2c6a647b5 100644
--- a/mysql-test/t/binlog-master.opt
+++ b/mysql-test/t/binlog_row_binlog-master.opt
diff --git a/mysql-test/t/binlog_row_binlog.test b/mysql-test/t/binlog_row_binlog.test
new file mode 100644
index 00000000000..8adc8eee5c1
--- /dev/null
+++ b/mysql-test/t/binlog_row_binlog.test
@@ -0,0 +1,5 @@
+# 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
+-- source extra/binlog_tests/binlog.test
diff --git a/mysql-test/t/binlog_row_blackhole.test b/mysql-test/t/binlog_row_blackhole.test
new file mode 100644
index 00000000000..d5355ad1ff0
--- /dev/null
+++ b/mysql-test/t/binlog_row_blackhole.test
@@ -0,0 +1,11 @@
+# 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_ctype_cp932.test b/mysql-test/t/binlog_row_ctype_cp932.test
new file mode 100644
index 00000000000..595af5a3114
--- /dev/null
+++ b/mysql-test/t/binlog_row_ctype_cp932.test
@@ -0,0 +1,5 @@
+# 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
+-- source extra/binlog_tests/ctype_cp932.test
diff --git a/mysql-test/t/binlog_row_ctype_ucs.test b/mysql-test/t/binlog_row_ctype_ucs.test
new file mode 100644
index 00000000000..96e14ed8882
--- /dev/null
+++ b/mysql-test/t/binlog_row_ctype_ucs.test
@@ -0,0 +1,6 @@
+# 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
+-- source extra/binlog_tests/ctype_ucs_binlog.test
+
diff --git a/mysql-test/t/binlog_row_drop_tmp_tbl.test b/mysql-test/t/binlog_row_drop_tmp_tbl.test
new file mode 100644
index 00000000000..5b503b78d85
--- /dev/null
+++ b/mysql-test/t/binlog_row_drop_tmp_tbl.test
@@ -0,0 +1,5 @@
+# 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
+-- source extra/binlog_tests/drop_temp_table.test
diff --git a/mysql-test/t/binlog_row_innodb_stat-master.opt b/mysql-test/t/binlog_row_innodb_stat-master.opt
new file mode 100644
index 00000000000..4cb927540bf
--- /dev/null
+++ b/mysql-test/t/binlog_row_innodb_stat-master.opt
@@ -0,0 +1 @@
+--binlog_cache_size=32768
diff --git a/mysql-test/t/binlog_row_innodb_stat.test b/mysql-test/t/binlog_row_innodb_stat.test
new file mode 100644
index 00000000000..e4e6762226b
--- /dev/null
+++ b/mysql-test/t/binlog_row_innodb_stat.test
@@ -0,0 +1,5 @@
+# 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
+-- source extra/binlog_tests/innodb_stat.test
diff --git a/mysql-test/t/binlog_row_insert_select.test b/mysql-test/t/binlog_row_insert_select.test
new file mode 100644
index 00000000000..806d495c8fb
--- /dev/null
+++ b/mysql-test/t/binlog_row_insert_select.test
@@ -0,0 +1,10 @@
+# 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/insert_select-binlog.test
+--enable_ps_protocol
diff --git a/mysql-test/t/mix_innodb_myisam_binlog-master.opt b/mysql-test/t/binlog_row_mix_innodb_myisam-master.opt
index cb48f1aaf60..cb48f1aaf60 100644
--- a/mysql-test/t/mix_innodb_myisam_binlog-master.opt
+++ b/mysql-test/t/binlog_row_mix_innodb_myisam-master.opt
diff --git a/mysql-test/t/binlog_row_mix_innodb_myisam.test b/mysql-test/t/binlog_row_mix_innodb_myisam.test
new file mode 100644
index 00000000000..e04d53a2209
--- /dev/null
+++ b/mysql-test/t/binlog_row_mix_innodb_myisam.test
@@ -0,0 +1,31 @@
+# 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/mix_innodb_myisam_binlog.test
+
+--enable_ps_protocol
+
+# This piece below cannot be put into
+# extra/binlog_tests/mix_innodb_myisam_binlog.test
+# because the argument of --start-position differs between statement-
+# and row-based (and "eval --exec" doesn't work).
+# we check that the error code of the "ROLLBACK" event is 0 and not
+# ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction
+# and does not make slave to stop)
+--exec $MYSQL_BINLOG --start-position=516 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+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 */;%",
+@a not like "%#%error_code=%error_code=%";
+drop table t1, t2;
diff --git a/mysql-test/t/binlog_statement_insert_delayed.test b/mysql-test/t/binlog_statement_insert_delayed.test
new file mode 100644
index 00000000000..9b78296236f
--- /dev/null
+++ b/mysql-test/t/binlog_statement_insert_delayed.test
@@ -0,0 +1,9 @@
+# This test is to verify replication with INSERT DELAY through
+# unrecommended STATEMENT binlog format
+
+-- source include/not_embedded.inc
+-- source include/have_binlog_format_statement.inc
+-- disable_query_log
+reset master; # get rid of previous tests binlog
+-- enable_query_log
+-- source extra/binlog_tests/binlog_insert_delayed.test
diff --git a/mysql-test/t/binlog_stm_binlog-master.opt b/mysql-test/t/binlog_stm_binlog-master.opt
new file mode 100644
index 00000000000..ad2c6a647b5
--- /dev/null
+++ b/mysql-test/t/binlog_stm_binlog-master.opt
@@ -0,0 +1 @@
+-O max_binlog_size=4096
diff --git a/mysql-test/t/binlog_stm_binlog.test b/mysql-test/t/binlog_stm_binlog.test
new file mode 100644
index 00000000000..280b7a3aef9
--- /dev/null
+++ b/mysql-test/t/binlog_stm_binlog.test
@@ -0,0 +1,18 @@
+# REQUIREMENT
+# replace_regex should replace output of SHOW BINLOG EVENTS
+
+create table t1 (a int, b int) engine=innodb;
+begin;
+insert into t1 values (1,2);
+commit;
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
+show binlog events;
+drop table t1;
+
+# 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/not_embedded.inc
+-- source include/have_binlog_format_mixed.inc
+-- source extra/binlog_tests/binlog.test
+
diff --git a/mysql-test/t/binlog_stm_blackhole.test b/mysql-test/t/binlog_stm_blackhole.test
new file mode 100644
index 00000000000..02ba2be095b
--- /dev/null
+++ b/mysql-test/t/binlog_stm_blackhole.test
@@ -0,0 +1,6 @@
+# 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/not_embedded.inc
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source extra/binlog_tests/blackhole.test
diff --git a/mysql-test/t/binlog_stm_ctype_cp932.test b/mysql-test/t/binlog_stm_ctype_cp932.test
new file mode 100644
index 00000000000..c0791d81445
--- /dev/null
+++ b/mysql-test/t/binlog_stm_ctype_cp932.test
@@ -0,0 +1,6 @@
+# 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/not_embedded.inc
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source extra/binlog_tests/ctype_cp932.test
diff --git a/mysql-test/t/binlog_stm_ctype_ucs.test b/mysql-test/t/binlog_stm_ctype_ucs.test
new file mode 100644
index 00000000000..c8cd7e06398
--- /dev/null
+++ b/mysql-test/t/binlog_stm_ctype_ucs.test
@@ -0,0 +1,6 @@
+# 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_mixed_or_statement.inc
+-- source extra/binlog_tests/ctype_ucs_binlog.test
+
diff --git a/mysql-test/t/binlog_stm_drop_tmp_tbl.test b/mysql-test/t/binlog_stm_drop_tmp_tbl.test
new file mode 100644
index 00000000000..6017f272d01
--- /dev/null
+++ b/mysql-test/t/binlog_stm_drop_tmp_tbl.test
@@ -0,0 +1,5 @@
+# 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_mixed_or_statement.inc
+-- source extra/binlog_tests/drop_temp_table.test
diff --git a/mysql-test/t/binlog_stm_innodb_stat-master.opt b/mysql-test/t/binlog_stm_innodb_stat-master.opt
new file mode 100644
index 00000000000..4cb927540bf
--- /dev/null
+++ b/mysql-test/t/binlog_stm_innodb_stat-master.opt
@@ -0,0 +1 @@
+--binlog_cache_size=32768
diff --git a/mysql-test/t/binlog_stm_innodb_stat.test b/mysql-test/t/binlog_stm_innodb_stat.test
new file mode 100644
index 00000000000..a08039c4a41
--- /dev/null
+++ b/mysql-test/t/binlog_stm_innodb_stat.test
@@ -0,0 +1,5 @@
+# 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_mixed_or_statement.inc
+-- source extra/binlog_tests/innodb_stat.test
diff --git a/mysql-test/t/binlog_stm_insert_select.test b/mysql-test/t/binlog_stm_insert_select.test
new file mode 100644
index 00000000000..3aefa1e6cf7
--- /dev/null
+++ b/mysql-test/t/binlog_stm_insert_select.test
@@ -0,0 +1,5 @@
+# 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_mixed_or_statement.inc
+-- source extra/binlog_tests/insert_select-binlog.test
diff --git a/mysql-test/t/binlog_stm_mix_innodb_myisam-master.opt b/mysql-test/t/binlog_stm_mix_innodb_myisam-master.opt
new file mode 100644
index 00000000000..cb48f1aaf60
--- /dev/null
+++ b/mysql-test/t/binlog_stm_mix_innodb_myisam-master.opt
@@ -0,0 +1 @@
+--loose-innodb_lock_wait_timeout=2
diff --git a/mysql-test/t/binlog_stm_mix_innodb_myisam.test b/mysql-test/t/binlog_stm_mix_innodb_myisam.test
new file mode 100644
index 00000000000..cb6516a3a2f
--- /dev/null
+++ b/mysql-test/t/binlog_stm_mix_innodb_myisam.test
@@ -0,0 +1,23 @@
+# 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_mixed_or_statement.inc
+-- source extra/binlog_tests/mix_innodb_myisam_binlog.test
+
+# This piece below cannot be put into
+# extra/binlog_tests/mix_innodb_myisam_binlog.test
+# because the argument of --start-position differs between statement-
+# and row-based (and "eval --exec" doesn't work).
+# we check that the error code of the "ROLLBACK" event is 0 and not
+# ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction
+# and does not make slave to stop)
+--exec $MYSQL_BINLOG --start-position=551 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+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 */;%",
+@a not like "%#%error_code=%error_code=%";
+drop table t1, t2;
diff --git a/mysql-test/t/bdb_cache-master.opt b/mysql-test/t/cache_innodb-master.opt
index 5f0ebff98f6..5f0ebff98f6 100644
--- a/mysql-test/t/bdb_cache-master.opt
+++ b/mysql-test/t/cache_innodb-master.opt
diff --git a/mysql-test/t/cache_innodb.test b/mysql-test/t/cache_innodb.test
new file mode 100644
index 00000000000..33a328d1d6c
--- /dev/null
+++ b/mysql-test/t/cache_innodb.test
@@ -0,0 +1,16 @@
+# t/cache_innodb.test
+#
+# Last update:
+# 2006-07-26 ML test refactored (MySQL 5.1)
+# main code t/innodb_cache.test --> include/query_cache.inc
+# new wrapper t/cache_innodb.test
+#
+
+--source include/have_query_cache.inc
+
+--source include/have_innodb.inc
+let $engine_type= InnoDB;
+# InnoDB supports FOREIGN KEYs
+let $test_foreign_keys= 1;
+
+--source include/query_cache.inc
diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test
index 0e9e141f6d8..63baeebcf12 100644
--- a/mysql-test/t/case.test
+++ b/mysql-test/t/case.test
@@ -3,7 +3,7 @@
#
--disable_warnings
-drop table if exists t1;
+drop table if exists t1,t2;
--enable_warnings
select CASE "b" when "a" then 1 when "b" then 2 END;
diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test
index ecc92ed01d1..ed9fdfa087a 100644
--- a/mysql-test/t/cast.test
+++ b/mysql-test/t/cast.test
@@ -47,7 +47,7 @@ select cast('1a' as signed);
select cast('' as signed);
#
-# Character set convertion
+# Character set conversion
#
set names binary;
select cast(_latin1'test' as char character set latin2);
diff --git a/mysql-test/t/concurrent_innodb-master.opt b/mysql-test/t/concurrent_innodb-master.opt
new file mode 100644
index 00000000000..f76bada5208
--- /dev/null
+++ b/mysql-test/t/concurrent_innodb-master.opt
@@ -0,0 +1 @@
+--innodb_locks_unsafe_for_binlog
diff --git a/mysql-test/t/concurrent_innodb.test b/mysql-test/t/concurrent_innodb.test
new file mode 100644
index 00000000000..5e9258af8f1
--- /dev/null
+++ b/mysql-test/t/concurrent_innodb.test
@@ -0,0 +1,20 @@
+# t/concurrent_innodb.test
+#
+# Concurrent InnoDB tests, mainly in UPDATE's
+# Bug#3300
+# Designed and tested by Sinisa Milivojevic, sinisa@mysql.com
+#
+# two non-interfering UPDATE's not changing result set
+#
+# Last update:
+# 2006-07-26 ML test refactored (MySQL 5.1)
+# main code t/innodb_concurrent.test -> include/concurrent.inc
+# new wrapper t/concurrent_innodb.test
+
+# test takes circa 5 minutes to run, so it's big
+--source include/big_test.inc
+
+--source include/have_innodb.inc
+let $engine_type= InnoDB;
+
+--source include/concurrent.inc
diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test
index 2147d5b71af..2e66c24d877 100644
--- a/mysql-test/t/connect.test
+++ b/mysql-test/t/connect.test
@@ -5,6 +5,10 @@
# This test makes no sense with the embedded server
--source include/not_embedded.inc
+# check that CSV engine was compiled in, as the test relies on the presence
+# of the log tables (which are CSV-based). By connect mysql; show tables;
+--source include/have_csv.inc
+
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
diff --git a/mysql-test/t/contributors.test b/mysql-test/t/contributors.test
new file mode 100644
index 00000000000..e463c4a888b
--- /dev/null
+++ b/mysql-test/t/contributors.test
@@ -0,0 +1 @@
+SHOW CONTRIBUTORS;
diff --git a/mysql-test/t/crash_commit_before-master.opt b/mysql-test/t/crash_commit_before-master.opt
new file mode 100644
index 00000000000..a745693594e
--- /dev/null
+++ b/mysql-test/t/crash_commit_before-master.opt
@@ -0,0 +1,2 @@
+--skip-stack-trace --skip-core-file
+
diff --git a/mysql-test/t/crash_commit_before.test b/mysql-test/t/crash_commit_before.test
new file mode 100644
index 00000000000..757817915dd
--- /dev/null
+++ b/mysql-test/t/crash_commit_before.test
@@ -0,0 +1,31 @@
+# Don't test this under valgrind, memory leaks will occur
+--source include/not_valgrind.inc
+
+# Binary must be compiled with debug for crash to occur
+--source include/have_debug.inc
+
+--source include/have_innodb.inc
+
+CREATE TABLE t1(a int) engine=innodb;
+START TRANSACTION;
+insert into t1 values(9);
+
+# Setup the mysqld to crash at certain point
+SET SESSION debug="d,crash_commit_before";
+
+# Write file to make mysql-test-run.pl expect crash and restart
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/master0.expect
+
+# Run the crashing query
+--error 2013
+COMMIT;
+
+# Turn on reconnect
+--enable_reconnect
+
+# Call script that will poll the server waiting for it to be back online again
+--source include/wait_until_connected_again.inc
+
+SHOW CREATE TABLE t1;
+
+SELECT * FROM t1;
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 91c22001b6c..aebee0b0c6f 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -41,8 +41,11 @@ create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null
-- error 1049
create table not_existing_database.test (a int);
---error 1103
create table `a/a` (a int);
+show create table `a/a`;
+create table t1 like `a/a`;
+drop table `a/a`;
+drop table `t1`;
--error 1103
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int);
--error 1059
@@ -223,6 +226,7 @@ drop table t1;
# Test create table if not exists with duplicate key error
#
+flush status;
create table t1 (a int not null, b int, primary key (a));
insert into t1 values (1,1);
create table if not exists t1 select 2;
@@ -230,6 +234,8 @@ select * from t1;
create table if not exists t1 select 3 as 'a',4 as 'b';
--error 1062
create table if not exists t1 select 3 as 'a',3 as 'b';
+show warnings;
+show status like "Opened_tables";
select * from t1;
drop table t1;
@@ -304,8 +310,6 @@ create table non_existing_database.t1 like t1;
create table t3 like non_existing_table;
--error 1050
create temporary table t3 like t1;
---error 1103
-create table t3 like `a/a`;
drop table t1, t2, t3;
drop table t3;
drop database mysqltest;
@@ -673,3 +677,37 @@ create table t1 (upgrade int);
drop table t1;
# End of 5.0 tests
+
+#
+# Test of behaviour with CREATE ... SELECT
+#
+
+CREATE TABLE t1 (a int, b int);
+insert into t1 values (1,1),(1,2);
+--error 1062
+CREATE TABLE t2 (primary key (a)) select * from t1;
+# This should give warning
+drop table if exists t2;
+--error 1062
+CREATE TEMPORARY TABLE t2 (primary key (a)) select * from t1;
+# This should give warning
+drop table if exists t2;
+CREATE TABLE t2 (a int, b int, primary key (a));
+--error 1062
+CREATE TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
+SELECT * from t2;
+TRUNCATE table t2;
+--error 1062
+INSERT INTO t2 select * from t1;
+SELECT * from t2;
+drop table t2;
+
+CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a));
+--error 1062
+CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
+SELECT * from t2;
+TRUNCATE table t2;
+--error 1062
+INSERT INTO t2 select * from t1;
+SELECT * from t2;
+drop table t1,t2;
diff --git a/mysql-test/t/create_not_windows.test b/mysql-test/t/create_not_windows.test
index 71ad9ccd7fe..2c1700d9e49 100644
--- a/mysql-test/t/create_not_windows.test
+++ b/mysql-test/t/create_not_windows.test
@@ -18,3 +18,24 @@ show create table `about:text`;
drop table `about:text`;
# End of 5.0 tests
+
+#
+# Bug#16532:mysql server assert in debug if table det is removed
+#
+use test;
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1(a int) engine=myisam;
+insert into t1 values(1);
+--system rm -f $MYSQLTEST_VARDIR/master-data/test/t1.frm
+--echo "We get an error because the table is in the definition cache"
+--error ER_TABLE_EXISTS_ERROR
+create table t1(a int, b int);
+--echo "Flush the cache and recreate the table anew to be able to drop it"
+flush tables;
+show open tables like "t%";
+create table t1(a int, b int, c int);
+--echo "Try to select from the table. This should not crash the server"
+select count(a) from t1;
+drop table t1;
diff --git a/mysql-test/t/create_select_tmp.test b/mysql-test/t/create_select_tmp.test
index c527548e282..ba9898b7752 100644
--- a/mysql-test/t/create_select_tmp.test
+++ b/mysql-test/t/create_select_tmp.test
@@ -5,6 +5,9 @@
# binlog if it was a transactional table, it resulted in an
# inconsistency between binlog and the internal list of temp tables.
+# This does not work for RBR yet.
+--source include/have_binlog_format_mixed_or_statement.inc
+
-- source include/have_innodb.inc
--disable_warnings
drop table if exists t1, t2;
diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test
index 65173cbf355..82102a6078e 100644
--- a/mysql-test/t/csv.test
+++ b/mysql-test/t/csv.test
@@ -2,7 +2,7 @@
# Test for the CSV engine
#
--- source include/have_csv.inc
+--source include/have_csv.inc
#
# Simple select test
@@ -1354,6 +1354,154 @@ DROP TABLE bug14672;
# End of 4.1 tests
#
+# Test CONCURRENT INSERT (5.1)
+#
+
+CREATE TABLE test_concurrent_insert ( val integer ) ENGINE = CSV;
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+connection con1;
+# obtain TL_READ lock on the table
+LOCK TABLES test_concurrent_insert READ LOCAL;
+
+connection con2;
+# should pass despite of the lock
+INSERT INTO test_concurrent_insert VALUES (1);
+SELECT * FROM test_concurrent_insert;
+
+connection con1;
+# first connection should not notice the changes
+SELECT * FROM test_concurrent_insert;
+
+UNLOCK TABLES;
+
+# Now check that we see our own changes
+
+LOCK TABLES test_concurrent_insert WRITE;
+INSERT INTO test_concurrent_insert VALUES (2);
+SELECT * FROM test_concurrent_insert;
+UNLOCK TABLES;
+
+# cleanup
+DROP TABLE test_concurrent_insert;
+
+#
+# Test REPAIR/CHECK TABLE (5.1)
+#
+
+# Check that repair on the newly created table works fine
+
+CREATE TABLE test_repair_table ( val integer ) ENGINE = CSV;
+
+CHECK TABLE test_repair_table;
+REPAIR TABLE test_repair_table;
+
+DROP TABLE test_repair_table;
+
+#
+# Check autorepair. Here we also check that we can work w/o metafile
+# restore the meta-file
+#
+
+CREATE TABLE test_repair_table2 ( val integer ) ENGINE = CSV;
+--exec rm $MYSQLTEST_VARDIR/master-data/test/test_repair_table2.CSM
+
+# Should give a warning and perform autorepair. We also disable ps-protocol
+# here, as mysql-test eats up warnings in ps-protocol mode
+
+--disable_ps_protocol
+SELECT * from test_repair_table2;
+--enable_ps_protocol
+# this should work ok, as the table is already repaired
+SELECT * from test_repair_table2;
+# check that the metafile appeared again. chop the path to it
+--exec ls $MYSQLTEST_VARDIR/master-data/test/test_repair_table2.CSM | perl -pi -e "s/.*\///"
+CHECK TABLE test_repair_table2;
+DROP TABLE test_repair_table2;
+
+
+# Corrupt csv file and see if we can repair it
+CREATE TABLE test_repair_table3 ( val integer ) ENGINE = CSV;
+--exec perl -e 'print "\"1\"\n\"4\"\n\"3";' > $MYSQLTEST_VARDIR/master-data/test/test_repair_table3.CSV
+CHECK TABLE test_repair_table3;
+REPAIR TABLE test_repair_table3;
+SELECT * FROM test_repair_table3;
+DROP TABLE test_repair_table3;
+
+# Test with more sophisticated table
+
+CREATE TABLE test_repair_table4 (
+ num int not null,
+ magic_no int(4) unsigned zerofill DEFAULT '0000' NOT NULL,
+ company_name char(30) DEFAULT '' NOT NULL,
+ founded char(4) DEFAULT '' NOT NULL
+) ENGINE = CSV;
+
+--exec rm $MYSQLTEST_VARDIR/master-data/test/test_repair_table4.CSM
+--disable_ps_protocol
+SELECT * FROM test_repair_table4;
+--enable_ps_protocol
+SELECT * FROM test_repair_table4;
+CHECK TABLE test_repair_table4;
+
+INSERT INTO test_repair_table4 VALUES (2,101,'SAP','1972');
+INSERT INTO test_repair_table4 VALUES (1,101,'Microsoft','1978');
+INSERT INTO test_repair_table4 VALUES (2,101,'MySQL','1995');
+
+# list table content
+SELECT * FROM test_repair_table4;
+CHECK TABLE test_repair_table4;
+REPAIR TABLE test_repair_table4;
+# check that nothing changed
+SELECT * FROM test_repair_table4;
+# verify that check/repair did non corrupt the table itself
+CHECK TABLE test_repair_table4;
+REPAIR TABLE test_repair_table4;
+SELECT * FROM test_repair_table4;
+DROP TABLE test_repair_table4;
+
+# Run CHECK/REPAIR on the CSV file with a single row, which misses a column.
+
+CREATE TABLE test_repair_table5 (
+ num int not null,
+ magic_no int(4) unsigned zerofill DEFAULT '0000' NOT NULL,
+ company_name char(30) DEFAULT '' NOT NULL,
+ founded char(4) DEFAULT '' NOT NULL
+) ENGINE = CSV;
+
+# Corrupt a table -- put a file with wrong # of columns
+--exec perl -e 'print "\"1\",\"101\",\"IBM\"\n";' > $MYSQLTEST_VARDIR/master-data/test/test_repair_table5.CSV
+
+CHECK TABLE test_repair_table5;
+REPAIR TABLE test_repair_table5;
+SELECT * FROM test_repair_table5;
+INSERT INTO test_repair_table5 VALUES (1, 102, "CORRECT", 1876);
+SELECT * FROM test_repair_table5;
+
+# Corrupt a table -- put a row with wrong # of columns at end of file
+--exec perl -e 'print "\"1\",\"101\",\"IBM\"\n";' >> $MYSQLTEST_VARDIR/master-data/test/test_repair_table5.CSV
+
+FLUSH TABLES;
+CHECK TABLE test_repair_table5;
+REPAIR TABLE test_repair_table5;
+# The correct record inserted should still be in the file
+SELECT * FROM test_repair_table5;
+INSERT INTO test_repair_table5 VALUES (1, 102, "CORRECT2", 1876);
+SELECT * FROM test_repair_table5;
+
+# Corrupt table again -- put a row with wrong # of columns at end of file
+--exec perl -e 'print "\"1\",\"101\",\"IBM\"\n";' >> $MYSQLTEST_VARDIR/master-data/test/test_repair_table5.CSV
+
+FLUSH TABLES;
+CHECK TABLE test_repair_table5;
+REPAIR TABLE test_repair_table5;
+# The two correct records inserted should still be in the file
+SELECT * FROM test_repair_table5;
+DROP TABLE test_repair_table5;
+
+#
# BUG#13406 - incorrect amount of "records deleted"
#
@@ -1385,6 +1533,33 @@ truncate table t1; -- truncate
drop table t1;
#
+# Some additional tests for new, faster alter table. Note that most of the
+# whole alter table code is being tested all around the test suite already.
+#
+
+create table t1 (v varchar(32));
+insert into t1 values ('def'),('abc'),('hij'),('3r4f');
+select * from t1;
+# Fast alter, no copy performed
+alter table t1 change v v2 varchar(32);
+select * from t1;
+# Fast alter, no copy performed
+alter table t1 change v2 v varchar(64);
+select * from t1;
+update t1 set v = 'lmn' where v = 'hij';
+select * from t1;
+# Regular alter table
+alter table t1 add i int auto_increment not null primary key first;
+select * from t1;
+update t1 set i=5 where i=3;
+select * from t1;
+alter table t1 change i i bigint;
+select * from t1;
+alter table t1 add unique key (i, v);
+select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn');
+drop table t1;
+
+#
# Bug #15205 Select from CSV table without the datafile causes crash
#
# NOTE: the bug is not deterministic
@@ -1400,7 +1575,7 @@ create table bug15205 (val int(11) default null) engine=csv;
create table bug15205_2 (val int(11) default null) engine=csv;
--exec rm $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV
# system error (can't open the datafile)
---error ER_GET_ERRNO
+--error 13
select * from bug15205;
select * from bug15205_2;
--exec touch $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV
@@ -1408,3 +1583,25 @@ select * from bug15205;
drop table bug15205;
drop table bug15205_2;
+#
+# Bug#22080 "CHECK fails to identify some corruption"
+#
+
+create table bug22080_1 (id int,string varchar(64)) Engine=CSV;
+create table bug22080_2 (id int,string varchar(64)) Engine=CSV;
+create table bug22080_3 (id int,string varchar(64)) Engine=CSV;
+insert into bug22080_1 values(1,'string');
+insert into bug22080_1 values(2,'string');
+insert into bug22080_1 values(3,'string');
+
+# Currupt the file as described in the bug report
+--exec sed -e 's/"2"/2"/' $MYSQLTEST_VARDIR/master-data/test/bug22080_1.CSV > $MYSQLTEST_VARDIR/master-data/test/bug22080_2.CSV
+--exec sed -e 's/2","/2",/' $MYSQLTEST_VARDIR/master-data/test/bug22080_1.CSV > $MYSQLTEST_VARDIR/master-data/test/bug22080_3.CSV
+
+--exec cat $MYSQLTEST_VARDIR/master-data/test/bug22080_2.CSV
+check table bug22080_2;
+
+--exec cat $MYSQLTEST_VARDIR/master-data/test/bug22080_3.CSV
+check table bug22080_3;
+
+drop tables bug22080_1,bug22080_2,bug22080_3;
diff --git a/mysql-test/t/ctype_cp1250_ch.test b/mysql-test/t/ctype_cp1250_ch.test
index 65550e0c193..89f82d1a758 100644
--- a/mysql-test/t/ctype_cp1250_ch.test
+++ b/mysql-test/t/ctype_cp1250_ch.test
@@ -1,4 +1,7 @@
-- source include/have_cp1250_ch.inc
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
SHOW COLLATION LIKE 'cp1250_czech_cs';
diff --git a/mysql-test/t/ctype_cp932_binlog.test b/mysql-test/t/ctype_cp932_binlog.test
deleted file mode 100644
index 3bbbe94f0e3..00000000000
--- a/mysql-test/t/ctype_cp932_binlog.test
+++ /dev/null
@@ -1,57 +0,0 @@
--- source include/not_embedded.inc
--- source include/have_cp932.inc
-
---character_set cp932
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-set names cp932;
-set character_set_database = cp932;
-
-# Test prepared statement with 0x8300 sequence in parameter while
-# running with cp932 client character set.
-RESET MASTER;
-CREATE TABLE t1(f1 blob);
-PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)';
-SET @var1= x'8300';
-# TODO: Note that this doesn't actually test the code which was added for
-# bug#11338 because this syntax for prepared statements causes the PS to
-# be replicated differently than if we executed the PS from C or Java.
-# Using this syntax, variable names are inserted into the binlog instead
-# of values. The real goal of this test is to check the code that was
-# added to Item_param::query_val_str() in order to do hex encoding of
-# PS parameters when the client character set is cp932;
-# Bug#11338 has an example java program which can be used to verify this
-# code (and I have used it to test the fix) until there is some way to
-# exercise this code from mysql-test-run.
-EXECUTE stmt1 USING @var1;
-SHOW BINLOG EVENTS FROM 98;
-SELECT HEX(f1) FROM t1;
-DROP table t1;
-# end test for bug#11338
-
-# End of 4.1 tests
-
-#
-# Bug#18293: Values in stored procedure written to binlog unescaped
-#
-
-delimiter |;
-CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
- s2 CHAR(50) CHARACTER SET cp932,
- d DECIMAL(10,2))|
-CREATE PROCEDURE bug18293 (IN ins1 CHAR(50),
- IN ins2 CHAR(50) CHARACTER SET cp932,
- IN ind DECIMAL(10,2))
- BEGIN
- INSERT INTO t4 VALUES (ins1, ins2, ind);
- END|
-CALL bug18293("Foo's a Bar", _cp932 0xED40ED41ED42, 47.93)|
-SELECT HEX(s1),HEX(s2),d FROM t4|
-DROP PROCEDURE bug18293|
-DROP TABLE t4|
-SHOW BINLOG EVENTS FROM 393|
-delimiter ;|
-
-# End of 5.0 tests
diff --git a/mysql-test/t/ctype_cp932_binlog_row.test b/mysql-test/t/ctype_cp932_binlog_row.test
new file mode 100644
index 00000000000..38614ea45c0
--- /dev/null
+++ b/mysql-test/t/ctype_cp932_binlog_row.test
@@ -0,0 +1,5 @@
+# This is a wrapper for binlog.test so that the same test case can be used
+# For both statement and row based bin logs 11/07/2005 [jbm]
+
+-- source include/have_binlog_format_row.inc
+-- source extra/binlog_tests/ctype_cp932_binlog.test
diff --git a/mysql-test/t/ctype_cp932_binlog_stm.test b/mysql-test/t/ctype_cp932_binlog_stm.test
new file mode 100644
index 00000000000..6b591fbe5f5
--- /dev/null
+++ b/mysql-test/t/ctype_cp932_binlog_stm.test
@@ -0,0 +1,29 @@
+# This is a wrapper for binlog.test so that the same test case can be used
+# For both statement and row based bin logs 11/07/2005 [jbm]
+
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source extra/binlog_tests/ctype_cp932_binlog.test
+
+#
+# Bug#18293: Values in stored procedure written to binlog unescaped
+#
+
+delimiter |;
+CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
+ s2 CHAR(50) CHARACTER SET cp932,
+ d DECIMAL(10,2))|
+CREATE PROCEDURE bug18293 (IN ins1 CHAR(50),
+ IN ins2 CHAR(50) CHARACTER SET cp932,
+ IN ind DECIMAL(10,2))
+ BEGIN
+ INSERT INTO t4 VALUES (ins1, ins2, ind);
+ END|
+CALL bug18293("Foo's a Bar", _cp932 0xED40ED41ED42, 47.93)|
+SELECT HEX(s1),HEX(s2),d FROM t4|
+DROP PROCEDURE bug18293|
+DROP TABLE t4|
+SHOW BINLOG EVENTS FROM 397|
+delimiter ;|
+
+# End of 5.0 tests
+
diff --git a/mysql-test/t/ctype_filename.test b/mysql-test/t/ctype_filename.test
new file mode 100644
index 00000000000..436ccfc4f2e
--- /dev/null
+++ b/mysql-test/t/ctype_filename.test
@@ -0,0 +1,21 @@
+--disable_warnings
+drop table if exists con, aux, nul, lpt1, com1, `clock$`;
+--enable_warnings
+
+create table con (a int);
+drop table con;
+
+create table aux (a int);
+drop table aux;
+
+create table nul (a int);
+drop table nul;
+
+create table lpt1 (a int);
+drop table lpt1;
+
+create table com1 (a int);
+drop table com1;
+
+create table `clock$` (a int);
+drop table `clock$`;
diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test
index dead9a7a0bc..0a112233ffb 100644
--- a/mysql-test/t/ctype_latin1.test
+++ b/mysql-test/t/ctype_latin1.test
@@ -110,3 +110,14 @@ SELECT convert(@str collate latin1_german2_ci using utf8);
SELECT convert(@str collate latin1_swedish_ci using utf8);
# End of 4.1 tests
+
+SET NAMES latin1;
+--disable_warnings
+DROP TABLE IF EXISTS `abcdef`;
+--enable_warnings
+CREATE TABLE `abcdef` (i int);
+INSERT INTO `abcdef` VALUES (1);
+INSERT INTO abcdef VALUES (2);
+SELECT * FROM `abcdef`;
+SELECT * FROM abcdef;
+DROP TABLE `abcdef`;
diff --git a/mysql-test/t/ctype_ujis.test b/mysql-test/t/ctype_ujis.test
index 14b37569b11..347587faee6 100644
--- a/mysql-test/t/ctype_ujis.test
+++ b/mysql-test/t/ctype_ujis.test
@@ -94,7 +94,7 @@ CREATE TABLE t1
b VARCHAR(50) NOT NULL DEFAULT '',
PRIMARY KEY (a),
KEY b (b(10))
-) TYPE=InnoDB CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
+) ENGINE=InnoDB CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
--enable_warnings
INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
@@ -110,7 +110,7 @@ CREATE TABLE t1
b VARCHAR(50) NOT NULL DEFAULT '',
PRIMARY KEY (a),
KEY b (b(10))
-) TYPE=MyISAM CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
+) ENGINE=MyISAM CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
--enable_warnings
INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 812965d648a..65ee82fff23 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -360,7 +360,7 @@ drop table t1;
create table t1 (
c char(10) character set utf8,
unique key a (c(1))
-) engine=bdb;
+) engine=innodb;
--enable_warnings
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
--error 1062
@@ -483,7 +483,7 @@ drop table t1;
create table t1 (
c char(10) character set utf8 collate utf8_bin,
unique key a (c(1))
-) engine=bdb;
+) engine=innodb;
--enable_warnings
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
--error 1062
@@ -558,7 +558,7 @@ drop table t1;
create table t1 (
str varchar(255) character set utf8 not null,
key str (str(2))
-) engine=bdb;
+) engine=innodb;
--enable_warnings
INSERT INTO t1 VALUES ('str');
INSERT INTO t1 VALUES ('str2');
@@ -644,7 +644,7 @@ create table t1 (
insert into t1 values(1,'foo'),(2,'foobar');
select * from t1 where b like 'foob%';
--disable_warnings
-alter table t1 engine=bdb;
+alter table t1 engine=innodb;
--enable_warnings
select * from t1 where b like 'foob%';
drop table t1;
@@ -1149,6 +1149,7 @@ explain
select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
drop table t1;
+
# End of 4.1 tests
#
diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test
index a81487d273d..c19ebeb2e28 100644
--- a/mysql-test/t/date_formats.test
+++ b/mysql-test/t/date_formats.test
@@ -6,7 +6,9 @@
drop table if exists t1;
--enable_warnings
+--replace_result ROW <format> STATEMENT <format> MIXED <format>
SHOW GLOBAL VARIABLES LIKE "%_format%";
+--replace_result ROW <format> STATEMENT <format> MIXED <format>
SHOW SESSION VARIABLES LIKE "%_format%";
#
@@ -34,6 +36,7 @@ set datetime_format= '%H:%i:%s.%f %m-%d-%Y';
set datetime_format= '%h:%i:%s %p %Y-%m-%d';
set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
+--replace_result ROW <format> STATEMENT <format> MIXED <format>
SHOW SESSION VARIABLES LIKE "%format";
--error 1231
diff --git a/mysql-test/t/deadlock_innodb.test b/mysql-test/t/deadlock_innodb.test
new file mode 100644
index 00000000000..08e3e256790
--- /dev/null
+++ b/mysql-test/t/deadlock_innodb.test
@@ -0,0 +1,16 @@
+# t/deadlock_innodb.test
+#
+#
+# Last update:
+# 2006-07-26 ML test refactored (MySQL 5.1)
+# main code --> include/deadlock.inc
+# new wrapper t/deadlock_innodb.test
+#
+
+# Can't test this with embedded server
+-- source include/not_embedded.inc
+
+--source include/have_innodb.inc
+let $engine_type= InnoDB;
+
+--source include/deadlock.inc
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index eaea7c710b0..0d3b7cdfdeb 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -1,15 +1,34 @@
##############################################################################
#
-# List the test cases that are to be disabled temporarely.
+# List the test cases that are to be disabled temporarily.
#
# Separate the test case name and the comment with ':'.
#
-# <testcasename> : Comment test
+# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
#
-# Don't use any TAB characters for whitespace.
+# Do not use any TAB characters for whitespace.
#
##############################################################################
-
-ndb_load : Bug#17233
user_limits : Bug#23921 random failure of user_limits.test
+im_options : Bug#20294 2006-07-24 stewart Instance manager test im_options fails randomly
+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
+ndb_load : BUG#17233 2006-05-04 tomas failed load data from infile causes mysqld dbug_assert, binlog not flushed
+partition_03ndb : BUG#16385 2006-03-24 mikael Partitions: crash when updating a range partitioned NDB table
+ps_7ndb : BUG#18950 2006-02-16 jmiller create table like does not obtain LOCK_open
+rpl_ndb_2innodb : BUG#19227 2006-04-20 pekka pk delete apparently not replicated
+rpl_ndb_2myisam : BUG#19227 Seems to pass currently
+rpl_ndb_dd_partitions : BUG#19259 2006-04-21 rpl_ndb_dd_partitions fails on s/AMD
+rpl_ndb_ddl : BUG#18946 result file needs update + test needs to checked
+rpl_ndb_innodb2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement
+rpl_ndb_myisam2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement
+rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly
+rpl_sp : BUG#16456 2006-02-16 jmiller
+rpl_multi_engine : BUG#22583 2006-09-23 lars
+
+# 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
+ndb_autodiscover3 : bug#21806
diff --git a/mysql-test/t/events.test b/mysql-test/t/events.test
new file mode 100644
index 00000000000..32863308687
--- /dev/null
+++ b/mysql-test/t/events.test
@@ -0,0 +1,398 @@
+# Can't test with embedded server that doesn't support grants
+-- source include/not_embedded.inc
+
+create database if not exists events_test;
+use events_test;
+
+#
+# START: BUG #17289 Events: missing privilege check for drop database
+#
+CREATE USER pauline@localhost;
+CREATE DATABASE db_x;
+GRANT EVENT ON db_x.* TO pauline@localhost;
+USE db_x;
+CREATE TABLE x_table(a int);
+connect (priv_conn,localhost,pauline,,db_x);
+CREATE EVENT e_x1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE db_x;
+CREATE EVENT e_x2 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE x_table;
+connection default;
+SHOW DATABASES LIKE 'db_x';
+SET GLOBAL event_scheduler=1;
+--sleep 1.2
+SHOW DATABASES LIKE 'db_x';
+SHOW TABLES FROM db_x;
+SET GLOBAL event_scheduler=off;
+connection priv_conn;
+DROP EVENT e_x1;
+DROP EVENT e_x2;
+disconnect priv_conn;
+connection default;
+DROP DATABASE db_x;
+DROP USER pauline@localhost;
+USE events_test;
+#
+# END: BUG #17289 Events: missing privilege check for drop database
+#
+SET GLOBAL event_scheduler=off;
+drop event if exists event1;
+create event event1 on schedule every 15 minute starts now() ends date_add(now(), interval 5 hour) DO begin end;
+alter event event1 rename to event2 enable;
+alter event event2 disable;
+alter event event2 enable;
+alter event event2 on completion not preserve;
+delimiter __;
+alter event event2 on schedule every 1 year on completion preserve rename to event3 comment "new comment" do begin select 1; end__
+delimiter ;__
+alter event event3 rename to event2;
+
+drop event event2;
+create event event2 on schedule every 2 second starts now() ends date_add(now(), interval 5 hour) comment "some" DO begin end;
+drop event event2;
+
+#
+# BUG #16537 (Events: mysql.event.starts is null)
+#
+CREATE EVENT event_starts_test ON SCHEDULE EVERY 10 SECOND COMMENT "" DO SELECT 1;
+SELECT interval_field, interval_value, body FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
+SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
+ALTER EVENT event_starts_test ON SCHEDULE AT '2020-02-02 20:00:02';
+SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
+ALTER EVENT event_starts_test COMMENT "non-empty comment";
+SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
+ALTER EVENT event_starts_test COMMENT "";
+SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
+DROP EVENT event_starts_test;
+
+CREATE EVENT event_starts_test ON SCHEDULE EVERY 20 SECOND STARTS '2020-02-02 20:00:02' ENDS '2022-02-02 20:00:02' DO SELECT 2;
+SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
+ALTER EVENT event_starts_test COMMENT "non-empty comment";
+SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
+ALTER EVENT event_starts_test COMMENT "";
+SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
+DROP EVENT event_starts_test;
+#
+#
+create table test_nested(a int);
+create event e_43 on schedule every 1 second do set @a = 5;
+--error ER_EVENT_RECURSIVITY_FORBIDDEN
+alter event e_43 do alter event e_43 do set @a = 4;
+delimiter |;
+alter event e_43 do
+begin
+ alter event e_43 on schedule every 5 minute;
+ insert into test_nested values(1);
+end|
+delimiter ;|
+set global event_scheduler = on;
+--sleep 3
+select db, name, body, status, interval_field, interval_value from mysql.event;
+drop event e_43;
+drop table test_nested;
+
+--echo "Let's check whether we can use non-qualified names"
+create table non_qualif(a int);
+create event non_qualif_ev on schedule every 10 minute do insert into non_qualif values (800219);
+--sleep 1.1
+select * from non_qualif;
+drop event non_qualif_ev;
+drop table non_qualif;
+
+--error ER_EVENT_DOES_NOT_EXIST
+alter event non_existant rename to non_existant_too;
+
+set global event_scheduler = off;
+create event existant on schedule at now() + interval 1 year do select 12;
+--error ER_EVENT_ALREADY_EXISTS
+alter event non_existant rename to existant;
+--error ER_EVENT_SAME_NAME
+alter event existant rename to events_test.existant;
+drop event existant;
+
+
+create table t_event3 (a int, b float);
+drop event if exists event3;
+create event event3 on schedule every 50 + 10 minute starts date_add("20100101", interval 5 minute) ends date_add("20151010", interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
+select count(*) from t_event3;
+drop event event3;
+drop table t_event3;
+
+
+set names utf8;
+#
+# SHOW CREATE EVENT test begin
+#
+CREATE EVENT root6 ON SCHEDULE EVERY '10:20' MINUTE_SECOND ON COMPLETION PRESERVE ENABLE COMMENT 'some comment' DO select 1;
+SHOW CREATE EVENT root6;
+create event root7 on schedule every 2 year do select 1;
+SHOW CREATE EVENT root7;
+create event root8 on schedule every '2:5' year_month do select 1;
+SHOW CREATE EVENT root8;
+create event root8_1 on schedule every '2:15' year_month do select 1;
+SHOW CREATE EVENT root8_1;
+create event root9 on schedule every 2 week ON COMPLETION PRESERVE DISABLE COMMENT 'коментар на кирилица' do select 1;
+SHOW CREATE EVENT root9;
+create event root10 on schedule every '20:5' day_hour do select 1;
+SHOW CREATE EVENT root10;
+create event root11 on schedule every '20:25' day_hour do select 1;
+SHOW CREATE EVENT root11;
+create event root12 on schedule every '20:25' hour_minute do select 1;
+SHOW CREATE EVENT root12;
+create event root13 on schedule every '25:25' hour_minute do select 1;
+SHOW CREATE EVENT root13;
+create event root13_1 on schedule every '11:65' hour_minute do select 1;
+SHOW CREATE EVENT root13_1;
+create event root14 on schedule every '35:35' minute_second do select 1;
+SHOW CREATE EVENT root14;
+create event root15 on schedule every '35:66' minute_second do select 1;
+SHOW CREATE EVENT root15;
+create event root16 on schedule every '35:56' day_minute do select 1;
+SHOW CREATE EVENT root16;
+create event root17 on schedule every '35:12:45' day_minute do select 1;
+SHOW CREATE EVENT root17;
+create event root17_1 on schedule every '35:25:65' day_minute do select 1;
+SHOW CREATE EVENT root17_1;
+create event root18 on schedule every '35:12:45' hour_second do select 1;
+SHOW CREATE EVENT root18;
+create event root19 on schedule every '15:59:85' hour_second do select 1;
+SHOW CREATE EVENT root19;
+create event root20 on schedule every '50:20:12:45' day_second do select 1;
+SHOW CREATE EVENT root20;
+set names cp1251;
+create event 21 on schedule every '50:23:59:95' day_second COMMENT ' 1251 ' do select 1;
+SHOW CREATE EVENT 21;
+insert into mysql.event (db, name, body, definer, interval_value, interval_field) values (database(), "root22", "select 1", user(), 100, "SECOND_MICROSECOND");
+--error ER_NOT_SUPPORTED_YET
+show create event root22;
+--error ER_NOT_SUPPORTED_YET
+SHOW EVENTS;
+drop event root22;
+--error ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG
+create event root23 on schedule every -100 year do select 1;
+--error ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG
+create event root23 on schedule every 222222222222222222222 year do select 1;
+drop event root6;
+drop event root7;
+drop event root8;
+drop event root8_1;
+drop event root9;
+drop event root10;
+drop event root11;
+drop event root12;
+drop event root13;
+drop event root13_1;
+drop event root14;
+drop event root15;
+drop event root16;
+drop event root17;
+drop event root17_1;
+drop event root18;
+drop event root19;
+drop event root20;
+drop event 21;
+
+set names latin1;
+#
+# SHOW CREATE EVENT test end
+#
+
+#
+# mysql.event intact checking start
+#
+# There should be at least 1 second between the ALTERs or we can't catch the change of create_time!!
+#
+CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing";
+--replace_column 8 # 9 #
+SHOW EVENTS;
+ALTER TABLE mysql.event ADD dummy INT FIRST;
+--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED
+SHOW EVENTS;
+ALTER TABLE mysql.event DROP dummy, ADD dummy2 VARCHAR(64) FIRST;
+--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED
+SHOW EVENTS;
+ALTER TABLE mysql.event DROP dummy2;
+--replace_column 8 # 9 #
+SHOW EVENTS;
+CREATE TABLE event_like LIKE mysql.event;
+INSERT INTO event_like SELECT * FROM mysql.event;
+#sleep a bit or we won't catch the change of time
+--sleep 1.1
+ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default '';
+--error ER_CANNOT_LOAD_FROM_TABLE
+SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
+ALTER TABLE mysql.event MODIFY db char(20) character set utf8 collate utf8_bin default '';
+#wait a bit or we won't see the difference because of seconds resolution
+--sleep 1.1
+SHOW CREATE TABLE mysql.event;
+--error ER_CANNOT_LOAD_FROM_TABLE
+SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
+--sleep 1.1
+ALTER TABLE mysql.event MODIFY db char(64) character set utf8 collate utf8_bin default '';
+--sleep 1.1
+--echo "This should work"
+--replace_column 8 # 9 #
+SHOW EVENTS;
+--sleep 1.1
+ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default '';
+--error ER_CANNOT_LOAD_FROM_TABLE
+SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
+--sleep 1.1
+ALTER TABLE mysql.event MODIFY db varchar(64) character set utf8 collate utf8_bin default '';
+--sleep 1.1
+--error ER_CANNOT_LOAD_FROM_TABLE
+SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
+--sleep 1.1
+ALTER TABLE mysql.event DROP comment, DROP starts;
+--sleep 1.1
+--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED
+SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
+DROP TABLE mysql.event;
+CREATE TABLE mysql.event like event_like;
+INSERT INTO mysql.event SELECT * FROM event_like;
+DROP TABLE event_like;
+--replace_column 8 # 9 #
+SHOW EVENTS;
+DROP EVENT intact_check;
+#
+# mysql.event intact checking end
+#
+
+create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5;
+select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
+drop event e_26;
+--error ER_WRONG_VALUE
+create event e_26 on schedule at NULL disable do set @a = 5;
+--error ER_WRONG_VALUE
+create event e_26 on schedule at 'definitely not a datetime' disable do set @a = 5;
+
+set names utf8;
+create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1;
+drop event задачка;
+
+# event_scheduler is a global var
+--error ER_GLOBAL_VARIABLE
+set event_scheduler=off;
+# event_scheduler could be only either 1 or 2
+--error ER_WRONG_VALUE_FOR_VAR
+set global event_scheduler=3;
+--error ER_WRONG_VALUE_FOR_VAR
+set global event_scheduler=disabled;
+
+--echo "DISABLE the scheduler. Testing that it does not work when the variable is 0"
+set global event_scheduler=off;
+select definer, name, db from mysql.event;
+select get_lock("test_lock1", 20);
+create event закачка on schedule every 10 hour do select get_lock("test_lock1", 20);
+--echo "Should return 1 row"
+select definer, name, db from mysql.event;
+
+--echo "Should be only 1 process"
+select /*1*/ user, host, db, command, state, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
+select release_lock("test_lock1");
+drop event закачка;
+--echo "Should have 0 events"
+select count(*) from mysql.event;
+
+#
+#
+#
+--echo "ENABLE the scheduler and get a lock"
+set global event_scheduler=on;
+select get_lock("test_lock2", 20);
+--echo "Create an event which tries to acquire a mutex. The event locks on the mutex"
+create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
+--echo "Let some time pass to the event starts"
+--sleep 1
+--echo "Should have only 2 processes: the scheduler and the locked event"
+select /*2*/ user, host, db, command, state, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;--echo "Release the mutex, the event worker should finish."
+--echo "Release the mutex, the event worker should finish."
+select release_lock("test_lock2");
+drop event закачка;
+
+##
+## 1. get a lock
+## 2. create an event
+## 3. sleep so it has time to start
+## 4. should appear in processlist
+## 5. kill the scheduler, it will wait for the child to stop
+## 6. both processes should be there on show processlist
+## 7. release the lock and sleep, both scheduler and child should end
+set global event_scheduler=1;
+select get_lock("test_lock2_1", 20);
+create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
+--sleep 1
+--echo "Should have only 3 processes: the scheduler, our conn and the locked event"
+select /*3*/ user, host, db, command, state, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
+set global event_scheduler=off;
+--sleep 0.8
+--echo "Should have only our process now:"
+select /*4*/ user, host, db, command, state, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
+drop event закачка21;
+
+####
+# Bug #16410 Events: CREATE EVENT is legal in a CREATE TRIGGER statement
+#
+create table t_16 (s1 int);
+--error ER_EVENT_RECURSIVITY_FORBIDDEN
+create trigger t_16_bi before insert on t_16 for each row create event e_16 on schedule every 1 second do set @a=5;
+drop table t_16;
+#
+# end of test case
+####
+
+#
+# START: BUG #17453: Creating Event crash the server
+#
+create event white_space
+on schedule every 10 hour
+disable
+do
+select 1;
+select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
+drop event white_space;
+create event white_space on schedule every 10 hour disable do
+
+select 2;
+select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
+drop event white_space;
+create event white_space on schedule every 10 hour disable do select 3;
+select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
+drop event white_space;
+#
+# END: BUG #17453: Creating Event crash the server
+#
+
+#
+# Bug#17403 "Events: packets out of order with show create event"
+#
+create event e1 on schedule every 1 year do set @a = 5;
+create table t1 (s1 int);
+--error ER_SP_NO_RETSET
+create trigger t1_ai after insert on t1 for each row show create event e1;
+drop table t1;
+drop event e1;
+
+##set global event_scheduler=1;
+##select get_lock("test_lock3", 20);
+##create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20);
+##select sleep(2);
+##select /*5*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
+##drop event закачка;
+##select release_lock("test_lock3");
+
+#
+# test with very often occuring event
+# (disabled for now, locks)
+##select get_lock("test_lock4", 20);
+##create event закачка4 on schedule every 1 second do select get_lock("test_lock4", 20);
+##select sleep(3);
+##select /*6*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
+##drop event закачка4;
+##select release_lock("test_lock4");
+
+##set global event_scheduler=off;
+##select sleep(2);
+##--replace_column 1 # 6 #
+##show processlist;
+##select count(*) from mysql.event;
+
+drop database events_test;
diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test
new file mode 100644
index 00000000000..6223395bfd9
--- /dev/null
+++ b/mysql-test/t/events_bugs.test
@@ -0,0 +1,299 @@
+# Can't test with embedded server that doesn't support grants
+-- source include/not_embedded.inc
+
+create database if not exists events_test;
+use events_test;
+
+#
+# START - 16415: Events: event names are case sensitive
+#
+CREATE EVENT lower_case ON SCHEDULE EVERY 1 MINUTE DO SELECT 1;
+--error ER_EVENT_ALREADY_EXISTS
+CREATE EVENT Lower_case ON SCHEDULE EVERY 2 MINUTE DO SELECT 2;
+DROP EVENT Lower_case;
+SET NAMES cp1251;
+CREATE EVENT __1251 ON SCHEDULE EVERY 1 YEAR DO SELECT 100;
+--error ER_EVENT_ALREADY_EXISTS
+CREATE EVENT __1251 ON SCHEDULE EVERY 2 YEAR DO SELECT 200;
+DROP EVENT __1251;
+SET NAMES utf8;
+CREATE EVENT долен_регистър_утф8 ON SCHEDULE EVERY 3 YEAR DO SELECT 300;
+--error ER_EVENT_ALREADY_EXISTS
+CREATE EVENT ДОЛЕН_регистър_утф8 ON SCHEDULE EVERY 4 YEAR DO SELECT 400;
+DROP EVENT ДОЛЕН_регистър_утф8;
+SET NAMES latin1;
+#
+# END - 16415: Events: event names are case sensitive
+#
+
+#
+# START - BUG#16408: Events: crash for an event in a procedure
+#
+set @a=3;
+--error ER_EVENT_RECURSIVITY_FORBIDDEN
+CREATE PROCEDURE p_16 () CREATE EVENT e_16 ON SCHEDULE EVERY @a SECOND DO SET @a=5;
+#
+# END - BUG#16408: Events: crash for an event in a procedure
+#
+
+#
+# Start - 16396: Events: Distant-future dates become past dates
+#
+--error ER_WRONG_VALUE
+create event e_55 on schedule at 99990101000000 do drop table t;
+--error ER_WRONG_VALUE
+create event e_55 on schedule every 10 hour starts 99990101000000 do drop table t;
+--error ER_EVENT_ENDS_BEFORE_STARTS
+create event e_55 on schedule every 10 minute ends 99990101000000 do drop table t;
+--error ER_EVENT_EXEC_TIME_IN_THE_PAST
+create event e_55 on schedule at 10000101000000 do drop table t;
+--error ER_EVENT_EXEC_TIME_IN_THE_PAST
+create event e_55 on schedule at 20000101000000 do drop table t;
+--error ER_PARSE_ERROR
+create event e_55 on schedule at 20200101000000 starts 10000101000000 do drop table t;
+--error ER_PARSE_ERROR
+create event e_55 on schedule at 20200101000000 ends 10000101000000 do drop table t;
+--error ER_PARSE_ERROR
+create event e_55 on schedule at 20200101000000 starts 10000101000000 ends 10000101000000 do drop table t;
+--error ER_WRONG_VALUE
+create event e_55 on schedule every 10 hour starts 10000101000000 do drop table t;
+
+#
+# End - 16396: Events: Distant-future dates become past dates
+#
+
+#
+# Start - 16407: Events: Changes in sql_mode won't be taken into account
+#
+set global event_scheduler=off;
+delete from mysql.event;
+set global event_scheduler= on;
+set @old_sql_mode:=@@sql_mode;
+set sql_mode=ansi;
+select get_lock('test_bug16407', 60);
+delimiter |;
+create event e_16407 on schedule every 60 second do
+begin
+ select get_lock('test_bug16407', 60);
+ drop table "hashed_num";
+end|
+delimiter ;|
+--sleep 0.8
+--echo "Now if everything is fine the event has compiled and is locked
+select /*1*/ user, host, db, info from information_schema.processlist where command!='Daemon' and (info is null or info not like '%processlist%') order by info;
+select release_lock('test_bug16407');
+
+set global event_scheduler= off;
+
+select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
+--echo "Let's check whether we change the sql_mode on ALTER EVENT"
+set sql_mode='traditional';
+alter event e_16407 do select 1;
+select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
+drop event e_16407;
+
+set sql_mode="ansi";
+select get_lock('ee_16407_2', 60);
+
+set global event_scheduler= 1;
+--echo "Another sql_mode test"
+set sql_mode="traditional";
+create table events_smode_test(ev_name char(10), a date) engine=myisam;
+--echo "This should never insert something"
+delimiter |;
+create event ee_16407_2 on schedule every 60 second do
+begin
+ select get_lock('ee_16407_2', 60) /*ee_16407_2*/;
+ select release_lock('ee_16407_2');
+ insert into events_test.events_smode_test values('ee_16407_2','1980-19-02');
+end|
+--error ER_TRUNCATED_WRONG_VALUE
+insert into events_smode_test values ('test','1980-19-02')|
+--echo "This is ok"
+create event ee_16407_3 on schedule every 60 second do
+begin
+ select get_lock('ee_16407_2', 60) /*ee_16407_3*/;
+ select release_lock('ee_16407_2');
+ insert into events_test.events_smode_test values ('ee_16407_3','1980-02-19');
+ insert into events_test.events_smode_test values ('ee_16407_3','1980-02-29');
+end|
+set sql_mode=""|
+--echo "This will insert rows but they will be truncated"
+create event ee_16407_4 on schedule every 60 second do
+begin
+ select get_lock('ee_16407_2', 60) /*ee_16407_4*/;
+ select release_lock('ee_16407_2');
+ insert into events_test.events_smode_test values ('ee_16407_4','10-11-1956');
+end|
+delimiter ;|
+select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
+--sleep 1
+select /*2*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
+select release_lock('ee_16407_2');
+--sleep 1.2
+select /*3*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
+set global event_scheduler= off;
+select * from events_smode_test order by ev_name, a;
+--echo "OK, last check before we drop them"
+select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
+drop event ee_16407_2;
+drop event ee_16407_3;
+drop event ee_16407_4;
+
+
+--echo "And now one last test regarding sql_mode and call of SP from an event"
+delete from events_smode_test;
+set sql_mode='ansi';
+select get_lock('ee_16407_5', 60);
+
+set global event_scheduler= on;
+
+set sql_mode='traditional';
+delimiter |;
+create procedure ee_16407_5_pendant() begin insert into events_test.events_smode_test values('ee_16407_5','2001-02-29'); end|
+create procedure ee_16407_6_pendant() begin insert into events_test.events_smode_test values('ee_16407_6','2004-02-29'); end|
+create event ee_16407_5 on schedule every 60 second do
+begin
+ select get_lock('ee_16407_5', 60) /*ee_16407_5*/;
+ select release_lock('ee_16407_5');
+ call events_test.ee_16407_5_pendant();
+end|
+create event ee_16407_6 on schedule every 60 second do
+begin
+ select get_lock('ee_16407_5', 60) /*ee_16407_6*/;
+ select release_lock('ee_16407_5');
+ call events_test.ee_16407_6_pendant();
+end|
+delimiter ;|
+--sleep 1
+--echo "Should have 2 locked processes"
+select /*4*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
+select release_lock('ee_16407_5');
+--sleep 1.3
+--echo "Should have 0 processes locked"
+select /*5*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
+select * from events_smode_test order by ev_name, a;
+--echo "And here we check one more time before we drop the events"
+select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
+drop event ee_16407_5;
+drop event ee_16407_6;
+drop procedure ee_16407_5_pendant;
+drop procedure ee_16407_6_pendant;
+set global event_scheduler= off;
+drop table events_smode_test;
+set sql_mode=@old_sql_mode;
+#
+# End - 16407: Events: Changes in sql_mode won't be taken into account
+#
+
+#
+# START - 18897: Events: unauthorized action possible with alter event rename
+#
+set global event_scheduler=off;
+--disable_warnings
+delete from mysql.user where User like 'mysqltest_%';
+delete from mysql.db where User like 'mysqltest_%';
+flush privileges;
+drop database if exists mysqltest_db1;
+--enable_warnings
+create user mysqltest_user1@localhost;
+create database mysqltest_db1;
+grant event on events_test.* to mysqltest_user1@localhost;
+connect (conn2,localhost,mysqltest_user1,,events_test);
+create event mysqltest_user1 on schedule every 10 second do select 42;
+--error ER_DBACCESS_DENIED_ERROR
+alter event mysqltest_user1 rename to mysqltest_db1.mysqltest_user1;
+--echo "Let's test now rename when there is no select DB"
+disconnect conn2;
+connect (conn2,localhost,mysqltest_user1,,*NO-ONE*);
+select database();
+--error ER_NO_DB_ERROR
+alter event events_test.mysqltest_user1 rename to mysqltest_user1;
+select event_schema, event_name, definer, event_type, status from information_schema.events;
+drop event events_test.mysqltest_user1;
+disconnect conn2;
+connection default;
+drop user mysqltest_user1@localhost;
+drop database mysqltest_db1;
+#
+# END - 18897: Events: unauthorized action possible with alter event rename
+#
+
+#
+# START - BUG#16394: Events: Crash if schedule contains SELECT
+#
+--error ER_NOT_SUPPORTED_YET
+create event e_53 on schedule at (select s1 from ttx) do drop table t;
+--error ER_NOT_SUPPORTED_YET
+create event e_53 on schedule every (select s1 from ttx) second do drop table t;
+--error ER_NOT_SUPPORTED_YET
+create event e_53 on schedule every 5 second starts (select s1 from ttx) do drop table t;
+--error ER_NOT_SUPPORTED_YET
+create event e_53 on schedule every 5 second ends (select s1 from ttx) do drop table t;
+#
+# END - BUG#16394: Events: Crash if schedule contains SELECT
+#
+
+#
+# START - BUG#22397: Events: crash with procedure which alters events
+#
+--disable_warnings
+drop event if exists e_16;
+drop procedure if exists p_16;
+--enable_warnings
+create event e_16 on schedule every 1 second do set @a=5;
+create procedure p_16 () alter event e_16 on schedule every @a second;
+set @a = null;
+--error ER_WRONG_VALUE
+call p_16();
+--error ER_WRONG_VALUE
+call p_16();
+set @a= 6;
+call p_16();
+
+drop procedure p_16;
+drop event e_16;
+
+#
+# START - BUG#22830 Events: crash with procedure which alters events with function
+#
+--disable_warnings
+drop function if exists f22830;
+drop event if exists e22830;
+drop event if exists e22830_1;
+drop event if exists e22830_2;
+drop event if exists e22830_3;
+drop event if exists e22830_4;
+drop table if exists t1;
+drop table if exists t2;
+--enable_warnings
+create table t1 (a int);
+insert into t1 values (2);
+create table t2 (a char(20));
+insert into t2 values ("e22830_1");
+create function f22830 () returns int return 5;
+--error ER_NOT_SUPPORTED_YET
+create event e22830 on schedule every f22830() second do select 123;
+create event e22830_1 on schedule every 1 hour do alter event e22830_1 on schedule every (select 8 from dual) hour;
+create event e22830_2 on schedule every 1 hour do alter event e22830_2 on schedule every (select 8 from t1) hour;
+create event e22830_3 on schedule every 1 hour do alter event e22830_3 on schedule every f22830() hour;
+create event e22830_4 on schedule every 1 hour do alter event e22830_4 on schedule every (select f22830() from dual) hour;
+select event_name, event_definition, interval_value, interval_field from information_schema.events order by event_name;
+set global event_scheduler=on;
+--sleep 0.7
+set global event_scheduler=off;
+select event_name, event_definition, interval_value, interval_field from information_schema.events order by event_name;
+drop function f22830;
+--error ER_PARSE_ERROR
+drop event (select a from t2);
+drop event e22830_1;
+drop event e22830_2;
+drop event e22830_3;
+drop event e22830_4;
+drop table t1;
+drop table t2;
+
+#
+# End of tests
+#
+drop database events_test;
diff --git a/mysql-test/t/events_grant.test b/mysql-test/t/events_grant.test
new file mode 100644
index 00000000000..44288fc1ac6
--- /dev/null
+++ b/mysql-test/t/events_grant.test
@@ -0,0 +1,108 @@
+# Can't test with embedded server that doesn't support grants
+-- source include/not_embedded.inc
+
+CREATE DATABASE IF NOT EXISTS events_test;
+use events_test;
+#
+# Events grants test begin
+#
+CREATE EVENT one_event ON SCHEDULE EVERY 10 SECOND DO SELECT 123;
+--replace_column 8 # 9 #
+SHOW EVENTS;
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
+CREATE DATABASE events_test2;
+CREATE USER ev_test@localhost;
+GRANT ALL ON events_test.* to ev_test@localhost;
+GRANT ALL ON events_test2.* to ev_test@localhost;
+REVOKE EVENT ON events_test2.* FROM ev_test@localhost;
+#now we are on con1
+connect (ev_con1,localhost,ev_test,,events_test2);
+select "NEW CONNECTION";
+SELECT USER(), DATABASE();
+SHOW GRANTS;
+--echo "Here comes an error:";
+#NO EVENT_ACL on events_test2
+--error 1044
+SHOW EVENTS;
+USE events_test;
+--echo "We should see one event";
+--replace_column 8 # 9 #
+SHOW EVENTS;
+#now create an event with the same name but we are different user
+SELECT CONCAT("Let's create some new events from the name of ", USER());
+--error ER_EVENT_ALREADY_EXISTS
+CREATE EVENT one_event ON SCHEDULE EVERY 20 SECOND DO SELECT 123;
+CREATE EVENT two_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION NOT PRESERVE COMMENT "two event" DO SELECT 123;
+CREATE EVENT three_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION PRESERVE COMMENT "three event" DO SELECT 123;
+
+--echo "Now we should see 3 events:";
+--replace_column 8 # 9 #
+SHOW EVENTS;
+
+--echo "This should show us only 2 events:";
+--replace_column 8 # 9 #
+SHOW EVENTS LIKE 't%event';
+
+--echo "This should show us no events:";
+--replace_column 8 # 9 #
+SHOW EVENTS FROM test LIKE '%';
+#ok, we are back
+connection default;
+GRANT EVENT ON events_test2.* TO ev_test@localhost;
+connection ev_con1;
+USE events_test2;
+CREATE EVENT four_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
+connection default;
+USE events_test;
+--echo "We should see 4 events : one_event, two_event, three_event & four_event"
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
+DROP DATABASE events_test2;
+--echo "We should see 3 events : one_event, two_event, three_event"
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
+
+connection default;
+CREATE DATABASE events_test2;
+USE events_test2;
+CREATE EVENT five_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
+
+connection ev_con1;
+--echo "Should see 4 events - one, two, three & five"
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
+connection default;
+REVOKE EVENT ON events_test2.* FROM ev_test@localhost;
+connection ev_con1;
+USE test;
+--echo "Should see 3 events - one, two & three"
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
+--echo "Let's test ALTER EVENT which changes the definer"
+USE events_test;
+ALTER EVENT one_event ON SCHEDULE EVERY 10 SECOND;
+--echo "The definer should be ev_test@localhost"
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
+connection default;
+USE events_test;
+ALTER EVENT one_event COMMENT "comment";
+connection ev_con1;
+--echo "The definer should be root@localhost"
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
+ALTER EVENT one_event DO SELECT 12;
+--echo "The definer should be ev_test@localhost"
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
+connection default;
+--echo "make the definer again root@localhost"
+ALTER EVENT one_event COMMENT "new comment";
+connection ev_con1;
+--echo "test DROP by another user"
+DROP EVENT one_event;
+connection default;
+--echo "One event should not be there"
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
+disconnect ev_con1;
+connection default;
+DROP USER ev_test@localhost;
+DROP DATABASE events_test2;
+#
+## EVENTS grants test end
+#
+
+DROP DATABASE events_test;
diff --git a/mysql-test/t/events_logs_tests-master.opt b/mysql-test/t/events_logs_tests-master.opt
new file mode 100644
index 00000000000..35ff7911705
--- /dev/null
+++ b/mysql-test/t/events_logs_tests-master.opt
@@ -0,0 +1 @@
+--log-slow-queries
diff --git a/mysql-test/t/events_logs_tests.test b/mysql-test/t/events_logs_tests.test
new file mode 100644
index 00000000000..aee16595ef9
--- /dev/null
+++ b/mysql-test/t/events_logs_tests.test
@@ -0,0 +1,103 @@
+# Can't test with embedded server that doesn't support grants
+-- source include/not_embedded.inc
+
+CREATE DATABASE IF NOT EXISTS events_test;
+USE events_test;
+--echo "We use procedure here because its statements won't be logged into the general log"
+--echo "If we had used normal select that are logged in different ways depending on whether"
+--echo "the test suite is run in normal mode or with --ps-protocol"
+delimiter |;
+CREATE procedure select_general_log()
+BEGIN
+ SELECT user_host, argument FROM mysql.general_log WHERE argument LIKE '%alabala%';
+END|
+delimiter ;|
+--echo "Check General Query Log"
+--replace_column 1 USER_HOST
+CALL select_general_log();
+SET GLOBAL event_scheduler=on;
+TRUNCATE mysql.general_log;
+CREATE EVENT log_general ON SCHEDULE EVERY 1 MINUTE DO SELECT 'alabala', SLEEP(1) FROM DUAL;
+--echo "Wait the scheduler to start"
+--sleep 1.5
+--echo "Should see 2 rows - the 'SELECT' is in the middle. The other two are selects from general_log"
+--replace_column 1 USER_HOST
+CALL select_general_log();
+DROP PROCEDURE select_general_log;
+DROP EVENT log_general;
+SET GLOBAL event_scheduler=off;
+
+--echo "Check slow query log"
+--disable_query_log
+DELIMITER |;
+CREATE FUNCTION get_value()
+ returns INT
+ deterministic
+BEGIN
+ DECLARE var_name CHAR(255);
+ DECLARE var_val INT;
+ DECLARE done INT DEFAULT 0;
+ DECLARE cur1 CURSOR FOR SHOW GLOBAL VARIABLES LIKE 'long_query_time';
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
+ OPEN cur1;
+ FETCH cur1 INTO var_name, var_val;
+ CLOSE cur1;
+ RETURN var_val;
+end|
+DELIMITER ;|
+--enable_query_log
+--echo "Save the values"
+SET @old_global_long_query_time:=(select get_value());
+SET @old_session_long_query_time:=@@long_query_time;
+SHOW VARIABLES LIKE 'log_slow_queries';
+DROP FUNCTION get_value;
+--echo "Make it quite long"
+SET SESSION long_query_time=300;
+TRUNCATE mysql.slow_log;
+--replace_column 1 USER_HOST
+SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
+--echo "Set new values"
+SET GLOBAL long_query_time=4;
+SET SESSION long_query_time=1;
+--echo "Check that logging is working"
+SELECT SLEEP(2);
+--replace_column 1 USER_HOST 2 SLEEPVAL
+SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
+SET SESSION long_query_time=300;
+--echo "Make it quite long"
+TRUNCATE mysql.slow_log;
+CREATE TABLE slow_event_test (slo_val tinyint, val tinyint);
+SET SESSION long_query_time=1;
+--echo "This won't go to the slow log"
+SELECT * FROM slow_event_test;
+SET SESSION long_query_time=1;
+SET GLOBAL event_scheduler=on;
+CREATE EVENT long_event ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(1.5);
+--echo "Sleep some more time than the actual event run will take"
+--sleep 2
+SHOW VARIABLES LIKE 'event_scheduler';
+--echo "Check our table. Should see 1 row"
+SELECT * FROM slow_event_test;
+--echo "Check slow log. Should not see anything because 1.5 is under the threshold of 300 for GLOBAL, though over SESSION which is 2"
+SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
+--echo "This should go to the slow log"
+DROP EVENT long_event;
+SET SESSION long_query_time=10;
+SET GLOBAL long_query_time=1;
+CREATE EVENT long_event2 ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(2);
+--echo "Sleep some more time than the actual event run will take"
+--sleep 2.5
+--echo "Check our table. Should see 2 rows"
+SELECT * FROM slow_event_test;
+--echo "Check slow log. Should see 1 row because 4 is over the threshold of 3 for GLOBAL, though under SESSION which is 10"
+--replace_column 1 USER_HOST 2 SLEEPVAL
+SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
+DROP EVENT long_event2;
+--echo "Make it quite long"
+SET SESSION long_query_time=300;
+TRUNCATE mysql.slow_log;
+DROP TABLE slow_event_test;
+SET GLOBAL long_query_time =@old_global_long_query_time;
+SET SESSION long_query_time =@old_session_long_query_time;
+
+DROP DATABASE events_test;
diff --git a/mysql-test/t/events_microsec.test b/mysql-test/t/events_microsec.test
new file mode 100644
index 00000000000..3e9abf6ec56
--- /dev/null
+++ b/mysql-test/t/events_microsec.test
@@ -0,0 +1,21 @@
+# Can't test with embedded server that doesn't support grants
+-- source include/not_embedded.inc
+
+--disable_warnings
+create database if not exists events_test;
+--enable_warnings
+
+use events_test;
+
+--error ER_NOT_SUPPORTED_YET
+CREATE EVENT micro_test ON SCHEDULE EVERY 100 MICROSECOND DO SELECT 1;
+--error ER_NOT_SUPPORTED_YET
+CREATE EVENT micro_test ON SCHEDULE EVERY 100 DAY_MICROSECOND DO SELECT 1;
+--error ER_NOT_SUPPORTED_YET
+CREATE EVENT micro_test ON SCHEDULE EVERY 100 HOUR_MICROSECOND DO SELECT 1;
+--error ER_NOT_SUPPORTED_YET
+CREATE EVENT micro_test ON SCHEDULE EVERY 100 MINUTE_MICROSECOND DO SELECT 1;
+--error ER_NOT_SUPPORTED_YET
+CREATE EVENT micro_test ON SCHEDULE EVERY 100 SECOND_MICROSECOND DO SELECT 1;
+
+drop database events_test;
diff --git a/mysql-test/t/events_restart_phase0.log b/mysql-test/t/events_restart_phase0.log
new file mode 100644
index 00000000000..218b804a302
--- /dev/null
+++ b/mysql-test/t/events_restart_phase0.log
@@ -0,0 +1,22 @@
+SHOW VARIABLES LIKE 'event%';
+Variable_name Value
+event_scheduler DISABLED
+SELECT @@global.event_scheduler;
+@@global.event_scheduler
+DISABLED
+SET GLOBAL event_scheduler=on;
+ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
+SET GLOBAL event_scheduler=off;
+ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
+SET GLOBAL event_scheduler=0;
+ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
+SET GLOBAL event_scheduler=1;
+ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
+SET GLOBAL event_scheduler=2;
+ERROR 42000: Variable 'event_scheduler' can't be set to the value of '2'
+SET GLOBAL event_scheduler=SUSPEND;
+ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'SUSPEND'
+SET GLOBAL event_scheduler=SUSPENDED;
+ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'SUSPENDED'
+SET GLOBAL event_scheduler=disabled;
+ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'disabled'
diff --git a/mysql-test/t/events_restart_phase0.result b/mysql-test/t/events_restart_phase0.result
new file mode 100644
index 00000000000..218b804a302
--- /dev/null
+++ b/mysql-test/t/events_restart_phase0.result
@@ -0,0 +1,22 @@
+SHOW VARIABLES LIKE 'event%';
+Variable_name Value
+event_scheduler DISABLED
+SELECT @@global.event_scheduler;
+@@global.event_scheduler
+DISABLED
+SET GLOBAL event_scheduler=on;
+ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
+SET GLOBAL event_scheduler=off;
+ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
+SET GLOBAL event_scheduler=0;
+ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
+SET GLOBAL event_scheduler=1;
+ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
+SET GLOBAL event_scheduler=2;
+ERROR 42000: Variable 'event_scheduler' can't be set to the value of '2'
+SET GLOBAL event_scheduler=SUSPEND;
+ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'SUSPEND'
+SET GLOBAL event_scheduler=SUSPENDED;
+ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'SUSPENDED'
+SET GLOBAL event_scheduler=disabled;
+ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'disabled'
diff --git a/mysql-test/t/events_restart_phase1.test b/mysql-test/t/events_restart_phase1.test
new file mode 100644
index 00000000000..92783ddaef7
--- /dev/null
+++ b/mysql-test/t/events_restart_phase1.test
@@ -0,0 +1,19 @@
+# Can't test with embedded server that doesn't support grants
+-- source include/not_embedded.inc
+
+--disable_warnings
+create database if not exists mysqltest_events_test;
+--enable_warnings
+
+use mysqltest_events_test;
+set global event_scheduler=off;
+create table execution_log(name char(10));
+create event abc1 on schedule every 1 second do insert into execution_log value('abc1');
+create event abc2 on schedule every 1 second do insert into execution_log value('abc2');
+create event abc3 on schedule every 1 second do insert into execution_log value('abc3');
+--sleep 1.5
+select name from execution_log;
+
+insert into mysql.event values ('db1','bad','select 42','root@localhost',NULL,1000,'MICROSECOND','2006-05-05 17:39:11','2006-05-05 17:39:20','2016-05-05 15:39:24','2016-05-05 15:39:11',NULL,'ENABLED','DROP','','comment1');
+insert into mysql.event values ('db1','bad2','sect','root@localhost',NULL,1000,'SECOND','2006-05-05 17:39:11','2006-05-05 17:39:20','2016-05-05 15:39:24','2016-05-05 15:39:11',NULL,'ENABLED','DROP','','comment2');
+--echo "Now we restart the server"
diff --git a/mysql-test/t/events_restart_phase2-master.opt b/mysql-test/t/events_restart_phase2-master.opt
new file mode 100644
index 00000000000..673e87f4357
--- /dev/null
+++ b/mysql-test/t/events_restart_phase2-master.opt
@@ -0,0 +1 @@
+--event-scheduler=on
diff --git a/mysql-test/t/events_restart_phase2.test b/mysql-test/t/events_restart_phase2.test
new file mode 100644
index 00000000000..845472377ba
--- /dev/null
+++ b/mysql-test/t/events_restart_phase2.test
@@ -0,0 +1,9 @@
+# Can't test with embedded server that doesn't support grants
+-- source include/not_embedded.inc
+
+use mysqltest_events_test;
+--sleep 1.5
+--echo "Should get 0 rows because the queue aborted run
+select distinct name from execution_log order by name;
+delete from mysql.event where name like 'bad%';
+--echo "Now restart the server again"
diff --git a/mysql-test/t/events_restart_phase3-master.opt b/mysql-test/t/events_restart_phase3-master.opt
new file mode 100644
index 00000000000..656b9e1b017
--- /dev/null
+++ b/mysql-test/t/events_restart_phase3-master.opt
@@ -0,0 +1 @@
+--event-scheduler=1
diff --git a/mysql-test/t/events_restart_phase3.test b/mysql-test/t/events_restart_phase3.test
new file mode 100644
index 00000000000..76cd9d22752
--- /dev/null
+++ b/mysql-test/t/events_restart_phase3.test
@@ -0,0 +1,14 @@
+# Can't test with embedded server that doesn't support grants
+-- source include/not_embedded.inc
+
+use mysqltest_events_test;
+--sleep 2
+--echo "Should get 3 rows : abc1, abc2, abc3
+select distinct name from execution_log order by name;
+
+drop event abc1;
+drop event abc2;
+drop event abc3;
+drop table execution_log;
+
+drop database mysqltest_events_test;
diff --git a/mysql-test/t/events_scheduling.test b/mysql-test/t/events_scheduling.test
new file mode 100644
index 00000000000..0002cf9f29f
--- /dev/null
+++ b/mysql-test/t/events_scheduling.test
@@ -0,0 +1,65 @@
+# Can't test with embedded server that doesn't support grants
+-- source include/not_embedded.inc
+-- source include/not_valgrind.inc
+
+CREATE DATABASE IF NOT EXISTS events_test;
+USE events_test;
+
+SET GLOBAL event_scheduler=OFF;
+SHOW VARIABLES LIKE 'event_scheduler';
+SET GLOBAL event_scheduler=1;
+SHOW VARIABLES LIKE 'event_scheduler';
+SET GLOBAL event_scheduler=0;
+SHOW VARIABLES LIKE 'event_scheduler';
+SET GLOBAL event_scheduler=ON;
+SHOW VARIABLES LIKE 'event_scheduler';
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL event_scheduler=DISABLED;
+SHOW VARIABLES LIKE 'event_scheduler';
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL event_scheduler=-1;
+SHOW VARIABLES LIKE 'event_scheduler';
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL event_scheduler=2;
+SHOW VARIABLES LIKE 'event_scheduler';
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL event_scheduler=5;
+SHOW VARIABLES LIKE 'event_scheduler';
+
+CREATE TABLE table_1(a int);
+CREATE TABLE table_2(a int);
+CREATE TABLE table_3(a int);
+CREATE TABLE table_4(a int);
+CREATE TABLE T19170(s1 TIMESTAMP);
+SET GLOBAL event_scheduler=ON;
+# We need to have 2 to make it safe with valgrind. This is probably because
+# of when we calculate the timestamp value
+CREATE EVENT two_sec ON SCHEDULE EVERY 2 SECOND DO INSERT INTO table_1 VALUES(1);
+CREATE EVENT start_n_end
+ ON SCHEDULE EVERY 1 SECOND
+ ENDS NOW() + INTERVAL 6 SECOND
+ ON COMPLETION PRESERVE
+ DO INSERT INTO table_2 VALUES(1);
+--sleep 5
+CREATE EVENT only_one_time ON SCHEDULE EVERY 2 SECOND ENDS NOW() + INTERVAL 1 SECOND DO INSERT INTO table_3 VALUES(1);
+CREATE EVENT two_time ON SCHEDULE EVERY 1 SECOND ENDS NOW() + INTERVAL 1 SECOND ON COMPLETION PRESERVE DO INSERT INTO table_4 VALUES(1);
+--sleep 5
+SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1;
+SELECT IF(SUM(a) >= 5, 'OK', 'ERROR') FROM table_2;
+SELECT IF(SUM(a) > 0, 'OK', 'ERROR') FROM table_3;
+SELECT IF(SUM(a) > 0, 'OK', 'ERROR') FROM table_4;
+DROP EVENT two_sec;
+SELECT IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL;
+SELECT IF(LAST_EXECUTED-ENDS < 3, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL;
+DROP EVENT start_n_end;
+--echo "Already dropped because ended. Therefore an error."
+--error ER_EVENT_DOES_NOT_EXIST
+DROP EVENT only_one_time;
+--echo "Should be preserved"
+SELECT EVENT_NAME, STATUS FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_NAME;
+DROP EVENT two_time;
+DROP TABLE table_1;
+DROP TABLE table_2;
+DROP TABLE table_3;
+DROP TABLE table_4;
+DROP DATABASE events_test;
diff --git a/mysql-test/t/events_stress.test b/mysql-test/t/events_stress.test
new file mode 100644
index 00000000000..fd1ae34ac3c
--- /dev/null
+++ b/mysql-test/t/events_stress.test
@@ -0,0 +1,136 @@
+# Can't test with embedded server that doesn't support grants
+--source include/not_embedded.inc
+--source include/big_test.inc
+
+CREATE DATABASE IF NOT EXISTS events_test;
+#
+# DROP DATABASE test start (bug #16406)
+#
+CREATE DATABASE events_conn1_test2;
+# BUG#20676: MySQL in debug mode has a limit of 100 waiters
+# (in mysys/thr_lock.c), so use three different tables to insert into.
+CREATE TABLE events_test.fill_it1(test_name varchar(20), occur datetime);
+CREATE TABLE events_test.fill_it2(test_name varchar(20), occur datetime);
+CREATE TABLE events_test.fill_it3(test_name varchar(20), occur datetime);
+CREATE USER event_user2@localhost;
+CREATE DATABASE events_conn2_db;
+GRANT ALL ON *.* TO event_user2@localhost;
+CREATE USER event_user3@localhost;
+CREATE DATABASE events_conn3_db;
+GRANT ALL ON *.* TO event_user3@localhost;
+connect (conn2,localhost,event_user2,,events_conn2_db);
+--echo "In the second connection we create some events which won't be dropped till the end"
+--disable_query_log
+let $1= 50;
+while ($1)
+{
+ eval CREATE EVENT conn2_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it1 VALUES("conn2_ev$1", NOW());
+ dec $1;
+}
+--enable_query_log
+connect (conn3,localhost,event_user3,,events_conn3_db);
+--echo "In the second connection we create some events which won't be dropped till the end"
+--disable_query_log
+let $1= 50;
+while ($1)
+{
+ eval CREATE EVENT conn3_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it1 VALUES("conn3_ev$1", NOW());
+ dec $1;
+}
+--enable_query_log
+connection default;
+USE events_conn1_test2;
+CREATE EVENT ev_drop1 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1;
+CREATE EVENT ev_drop2 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1;
+CREATE EVENT ev_drop3 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1;
+USE events_test;
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS;
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
+DROP DATABASE events_conn1_test2;
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
+
+--echo "Now testing stability - dropping db -> events while they are running"
+CREATE DATABASE events_conn1_test2;
+USE events_conn1_test2;
+--disable_query_log
+let $1= 50;
+while ($1)
+{
+ eval CREATE EVENT conn1_round1_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it2 VALUES("conn1_round1_ev$1", NOW());
+ dec $1;
+}
+--enable_query_log
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
+SET GLOBAL event_scheduler=on;
+--sleep 2.5
+DROP DATABASE events_conn1_test2;
+
+SET GLOBAL event_scheduler=off;
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
+CREATE DATABASE events_conn1_test3;
+USE events_conn1_test3;
+--disable_query_log
+let $1= 50;
+while ($1)
+{
+ eval CREATE EVENT conn1_round2_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it2 VALUES("conn1_round2_ev$1", NOW());
+ dec $1;
+}
+--enable_query_log
+SET GLOBAL event_scheduler=on;
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test3';
+CREATE DATABASE events_conn1_test4;
+USE events_conn1_test4;
+--disable_query_log
+let $1= 50;
+while ($1)
+{
+ eval CREATE EVENT conn1_round3_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it3 VALUES("conn1_round3_ev$1", NOW());
+ dec $1;
+}
+--enable_query_log
+
+CREATE DATABASE events_conn1_test2;
+USE events_conn1_test2;
+--disable_query_log
+let $1= 50;
+while ($1)
+{
+ eval CREATE EVENT ev_round4_drop$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it3 VALUES("conn1_round4_ev$1", NOW());
+ dec $1;
+}
+--enable_query_log
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
+--sleep 2.5
+connection conn2;
+--send
+DROP DATABASE events_conn2_db;
+connection conn3;
+--send
+DROP DATABASE events_conn3_db;
+connection default;
+--send
+DROP DATABASE events_conn1_test2;
+DROP DATABASE events_conn1_test3;
+SET GLOBAL event_scheduler=off;
+DROP DATABASE events_conn1_test4;
+SET GLOBAL event_scheduler=on;
+connection conn2;
+reap;
+disconnect conn2;
+connection conn3;
+reap;
+disconnect conn3;
+connection default;
+USE events_test;
+DROP TABLE fill_it1;
+DROP TABLE fill_it2;
+DROP TABLE fill_it3;
+--disable_query_log
+DROP USER event_user2@localhost;
+DROP USER event_user3@localhost;
+--enable_query_log
+#
+# DROP DATABASE test end (bug #16406)
+#
+DROP DATABASE events_test;
diff --git a/mysql-test/t/exampledb.test b/mysql-test/t/exampledb.test
index 946d25325dc..fbb2a18f344 100644
--- a/mysql-test/t/exampledb.test
+++ b/mysql-test/t/exampledb.test
@@ -5,6 +5,10 @@
-- source include/have_exampledb.inc
--disable_warnings
+# Clean up if event's test fails
+drop database if exists events_test;
+drop database if exists events_test2;
+
drop table if exists t1;
--enable_warnings
diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test
index c2218b3451b..937c72e0cf6 100644
--- a/mysql-test/t/federated.test
+++ b/mysql-test/t/federated.test
@@ -1,4 +1,6 @@
-source include/federated.inc;
+# should work with embedded server after mysqltest is fixed
+--source include/not_embedded.inc
+--source include/federated.inc
connection slave;
DROP TABLE IF EXISTS federated.t1;
@@ -81,7 +83,7 @@ eval SHOW CREATE TABLE federated.t2;
INSERT INTO federated.t2 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t2 (id, name) VALUES (2, 'fee');
-SELECT * FROM federated.t2;
+SELECT * FROM federated.t2 ORDER BY id, name;
DROP TABLE federated.t2;
connection slave;
@@ -108,7 +110,7 @@ eval CREATE TABLE federated.t1 (
INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');
-SELECT * FROM federated.t1;
+SELECT * FROM federated.t1 ORDER BY id,name;
DELETE FROM federated.t1;
DROP TABLE IF EXISTS federated.t1;
@@ -123,7 +125,7 @@ eval CREATE TABLE federated.`t1%` (
INSERT INTO federated.`t1%` (id, name) VALUES (1, 'foo');
INSERT INTO federated.`t1%` (id, name) VALUES (2, 'fee');
-SELECT * FROM federated.`t1%`;
+SELECT * FROM federated.`t1%` ORDER BY id, name;
DELETE FROM federated.`t1%`;
DROP TABLE IF EXISTS federated.`t1%`;
@@ -1314,17 +1316,16 @@ connection slave;
DROP TABLE federated.bug_17377_table;
#
-# BUG 19773 Crash when using multi-table updates, deletes
-# with federated tables
+# Test multi updates and deletes without keys
#
+
+# The following can be enabled when bug #19773 has been fixed
+--disable_parsing
connection slave;
create table federated.t1 (i1 int, i2 int, i3 int);
create table federated.t2 (id int, c1 varchar(20), c2 varchar(20));
-
connection master;
---replace_result $SLAVE_MYPORT SLAVE_PORT
eval create table federated.t1 (i1 int, i2 int, i3 int) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
---replace_result $SLAVE_MYPORT SLAVE_PORT
eval create table federated.t2 (id int, c1 varchar(20), c2 varchar(20)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2';
insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2);
insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test");
@@ -1333,23 +1334,22 @@ select * from federated.t2;
update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id;
select * from federated.t1 order by i1;
select * from federated.t2 order by id;
-delete federated.t1.*,federated.t2.* from federated.t1,federated.t2 where t1.i2=t2.id;
+delete t1.*,t2.* from federated.t1,federated.t2 where t1.i2=t2.id;
select * from federated.t1 order by i1;
select * from federated.t2 order by id;
drop table federated.t1, federated.t2;
connection slave;
drop table federated.t1, federated.t2;
+connection master;
# Test multi updates and deletes with keys
+
connection slave;
create table federated.t1 (i1 int, i2 int, i3 int, primary key (i1));
create table federated.t2 (id int, c1 varchar(20), c2 varchar(20), primary key (id));
-
connection master;
---replace_result $SLAVE_MYPORT SLAVE_PORT
-eval create table federated.t1 (i1 int auto_increment not null, i2 int, i3 int, primary key (i1)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
---replace_result $SLAVE_MYPORT SLAVE_PORT
-eval create table federated.t2 (id int auto_increment not null, c1 varchar(20), c2 varchar(20), primary key(id)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2';
+eval create table federated.t1 (i1 int auto_increment not null, i2 int, i3 int, primary key (i1)) ENGINE=FEDERATED ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
+eval create table federated.t2 (id int auto_increment not null, c1 varchar(20), c2 varchar(20), primary key(id)) ENGINE=FEDERATED ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2';
insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2);
insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test");
select * from federated.t1 order by i1;
@@ -1357,13 +1357,14 @@ select * from federated.t2 order by id;
update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id;
select * from federated.t1 order by i1;
select * from federated.t2 order by id;
-delete federated.t1.*,federated.t2.* from federated.t1,federated.t2 where t1.i2=t2.id;
+delete t1.*,t2.* from federated.t1,federated.t2 where t1.i2=t2.id;
select * from federated.t1 order by i1;
select * from federated.t2 order by id;
drop table federated.t1, federated.t2;
-
connection slave;
drop table federated.t1, federated.t2;
+connection master;
+--enable_parsing
#
# BUG #18764: Delete conditions causing inconsistencies in Federated tables
@@ -1432,6 +1433,7 @@ DROP TABLE federated.test;
# for ON INSERT triggers only. Tests for other types of triggers reside
# in ndb_trigger.test.
#
+connection slave;
--disable_warnings
drop table if exists federated.t1;
--enable_warnings
@@ -1449,19 +1451,71 @@ insert into federated.t2 values (13, 17), (19, 23);
# Each of three statements should correctly set values for all three fields
# insert
insert into federated.t1 (a, b) values (1, 2), (3, 5), (7, 11);
-select * from federated.t1;
+select * from federated.t1 order by a;
delete from federated.t1;
# insert ... select
insert into federated.t1 (a, b) select * from federated.t2;
-select * from federated.t1;
+select * from federated.t1 order by a;
delete from federated.t1;
# load
load data infile '../std_data_ln/loaddata5.dat' into table federated.t1 fields terminated by '' enclosed by '' ignore 1 lines (a, b);
-select * from federated.t1;
+select * from federated.t1 order by a;
drop tables federated.t1, federated.t2;
connection slave;
drop table federated.t1;
+
+#
+# BUG 19773 Crash when using multi-table updates, deletes
+# with federated tables
+#
+connection slave;
+create table federated.t1 (i1 int, i2 int, i3 int);
+create table federated.t2 (id int, c1 varchar(20), c2 varchar(20));
+
+connection master;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval create table federated.t1 (i1 int, i2 int, i3 int) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval create table federated.t2 (id int, c1 varchar(20), c2 varchar(20)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2';
+insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2);
+insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test");
+select * from federated.t1 order by i1;
+select * from federated.t2;
+update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id;
+select * from federated.t1 order by i1;
+select * from federated.t2 order by id;
+delete federated.t1.*,federated.t2.* from federated.t1,federated.t2 where t1.i2=t2.id;
+select * from federated.t1 order by i1;
+select * from federated.t2 order by id;
+drop table federated.t1, federated.t2;
+connection slave;
+drop table federated.t1, federated.t2;
+
+# Test multi updates and deletes with keys
+connection slave;
+create table federated.t1 (i1 int, i2 int, i3 int, primary key (i1));
+create table federated.t2 (id int, c1 varchar(20), c2 varchar(20), primary key (id));
+
+connection master;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval create table federated.t1 (i1 int auto_increment not null, i2 int, i3 int, primary key (i1)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval create table federated.t2 (id int auto_increment not null, c1 varchar(20), c2 varchar(20), primary key(id)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2';
+insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2);
+insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test");
+select * from federated.t1 order by i1;
+select * from federated.t2 order by id;
+update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id;
+select * from federated.t1 order by i1;
+select * from federated.t2 order by id;
+delete federated.t1.*,federated.t2.* from federated.t1,federated.t2 where t1.i2=t2.id;
+select * from federated.t1 order by i1;
+select * from federated.t2 order by id;
+drop table federated.t1, federated.t2;
+
+connection slave;
+drop table federated.t1, federated.t2;
#
# Bug #16494: Updates that set a column to NULL fail sometimes
#
diff --git a/mysql-test/t/federated_archive.test b/mysql-test/t/federated_archive.test
index 6d80664fef7..f8df5f1c51a 100644
--- a/mysql-test/t/federated_archive.test
+++ b/mysql-test/t/federated_archive.test
@@ -1,3 +1,5 @@
+# should work with embedded server after mysqltest is fixed
+-- source include/not_embedded.inc
source include/have_archive.inc;
source include/federated.inc;
diff --git a/mysql-test/t/federated_bug_13118.test b/mysql-test/t/federated_bug_13118.test
index deec79becd2..e429a660489 100644
--- a/mysql-test/t/federated_bug_13118.test
+++ b/mysql-test/t/federated_bug_13118.test
@@ -1,3 +1,5 @@
+# should work with embedded server after mysqltest is fixed
+-- source include/not_embedded.inc
source include/federated.inc;
diff --git a/mysql-test/t/rpl000001-slave.opt b/mysql-test/t/federated_transactions-slave.opt
index 627becdbfb5..627becdbfb5 100644
--- a/mysql-test/t/rpl000001-slave.opt
+++ b/mysql-test/t/federated_transactions-slave.opt
diff --git a/mysql-test/t/federated_transactions.test b/mysql-test/t/federated_transactions.test
new file mode 100644
index 00000000000..2fc737730bf
--- /dev/null
+++ b/mysql-test/t/federated_transactions.test
@@ -0,0 +1,40 @@
+# should work with embedded server after mysqltest is fixed
+-- source include/not_embedded.inc
+source include/have_innodb.inc;
+source include/federated.inc;
+
+connection slave;
+DROP TABLE IF EXISTS federated.t1;
+#SHOW ENGINES;
+CREATE TABLE federated.t1 (
+ `id` int(20) NOT NULL,
+ `name` varchar(32) NOT NULL default ''
+ )
+ DEFAULT CHARSET=latin1 ENGINE=innodb;
+
+connection master;
+DROP TABLE IF EXISTS federated.t1;
+# # correct connection, same named tables
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE federated.t1 (
+ `id` int(20) NOT NULL,
+ `name` varchar(32) NOT NULL default ''
+ )
+ ENGINE="FEDERATED" DEFAULT CHARSET=latin1
+ CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
+
+set autocommit=0;
+INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
+INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');
+COMMIT;
+INSERT INTO federated.t1 (id, name) VALUES (3, 'fie');
+INSERT INTO federated.t1 (id, name) VALUES (4, 'fum');
+ROLLBACK;
+set autocommit=1;
+INSERT INTO federated.t1 (id, name) VALUES (5, 'foe');
+INSERT INTO federated.t1 (id, name) VALUES (6, 'fig');
+
+SELECT * FROM federated.t1;
+DELETE FROM federated.t1;
+
+source include/federated_cleanup.inc;
diff --git a/mysql-test/t/flush_table.test b/mysql-test/t/flush_table.test
index e46b67ad3d0..50e7e91419a 100644
--- a/mysql-test/t/flush_table.test
+++ b/mysql-test/t/flush_table.test
@@ -4,15 +4,70 @@
# Test of flush table
#
+# Should work in embedded server after mysqltest is fixed
+-- source include/not_embedded.inc
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
create table t1 (a int not null auto_increment primary key);
insert into t1 values(0);
+
+# Test for with read lock + flush
+
lock table t1 read;
flush table t1;
check table t1;
+unlock tables;
+
+# Test for with 2 read lock in different thread + flush
+
+lock table t1 read;
+connect (locker,localhost,root,,test);
+connection locker;
+lock table t1 read;
+connection default;
+send flush table t1;
+connection locker;
+--sleep 2
+select * from t1;
+unlock tables;
+connection default;
+reap;
+select * from t1;
+unlock tables;
+
+# Test for with a write lock and a waiting read lock + flush
+
+lock table t1 write;
+connection locker;
+send lock table t1 read;
+connection default;
+sleep 2;
+flush table t1;
+select * from t1;
+unlock tables;
+connection locker;
+reap;
+unlock tables;
+connection default;
+
+# Test for with a read lock and a waiting write lock + flush
+
+lock table t1 read;
+connection locker;
+send lock table t1 write;
+connection default;
+sleep 2;
+flush table t1;
+select * from t1;
+unlock tables;
+connection locker;
+reap;
+unlock tables;
+select * from t1;
+connection default;
drop table t1;
+disconnect locker;
#
# In the following test FLUSH TABLES produces a deadlock
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
index 0f7835e9e7e..626f5f2b81c 100644
--- a/mysql-test/t/fulltext.test
+++ b/mysql-test/t/fulltext.test
@@ -28,6 +28,12 @@ select * from t1 where MATCH(a,b) AGAINST ("collections" WITH QUERY EXPANSION);
select * from t1 where MATCH(a,b) AGAINST ("indexes" WITH QUERY EXPANSION);
select * from t1 where MATCH(a,b) AGAINST ("indexes collections" WITH QUERY EXPANSION);
+# IN NATURAL LANGUAGE MODE
+select * from t1 where MATCH(a,b) AGAINST ("indexes" IN NATURAL LANGUAGE MODE);
+select * from t1 where MATCH(a,b) AGAINST ("indexes" IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
+--error 1064
+select * from t1 where MATCH(a,b) AGAINST ("indexes" IN BOOLEAN MODE WITH QUERY EXPANSION);
+
# add_ft_keys() tests
explain select * from t1 where MATCH(a,b) AGAINST ("collections");
@@ -355,6 +361,12 @@ SET myisam_repair_threads=@@global.myisam_repair_threads;
INSERT INTO t1 VALUES('testword\'\'');
SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE);
+
+#
+# BUG#14194: Problem with fulltext boolean search and apostrophe
+#
+INSERT INTO t1 VALUES('test\'s');
+SELECT a FROM t1 WHERE MATCH a AGAINST('test' IN BOOLEAN MODE);
DROP TABLE t1;
#
diff --git a/mysql-test/t/fulltext2.test b/mysql-test/t/fulltext2.test
index fd97f795534..88967a5dd04 100644
--- a/mysql-test/t/fulltext2.test
+++ b/mysql-test/t/fulltext2.test
@@ -221,3 +221,13 @@ drop table t1;
set names latin1;
# End of 4.1 tests
+
+#
+# BUG#19580 - FULLTEXT search produces wrong results on UTF-8 columns
+#
+SET NAMES utf8;
+CREATE TABLE t1(a VARCHAR(255), FULLTEXT(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES('„MySQL“');
+SELECT a FROM t1 WHERE MATCH a AGAINST('“MySQL„' IN BOOLEAN MODE);
+DROP TABLE t1;
+SET NAMES latin1;
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index 769f10277d4..db3536c6d36 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -175,8 +175,8 @@ select t1.a, group_concat(c order by (select mid(group_concat(c order by a),1,5)
select t1.a, group_concat(c order by (select mid(group_concat(c order by a),1,5) from t2 where t2.a=t1.a) desc) as grp from t1 group by 1;
# The following returns random results as we are sorting on blob addresses
-# select group_concat(c order by (select group_concat(c order by a) from t2 where t2.a=t1.a)) as grp from t1;
-# select group_concat(c order by (select group_concat(c) from t2 where a=t1.a)) as grp from t1;
+select group_concat(c order by (select concat(5-t1.c,group_concat(c order by a)) from t2 where t2.a=t1.a)) as grp from t1;
+select group_concat(c order by (select concat(t1.c,group_concat(c)) from t2 where a=t1.a)) as grp from t1;
select a,c,(select group_concat(c order by a) from t2 where a=t1.a) as grp from t1 order by grp;
drop table t1,t2;
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 079d107fad8..78393ee1104 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -378,13 +378,15 @@ explain
select concat(min(t1.a1),min(t2.a4)) from t1, t2 where t2.a4 <> 'AME';
drop table t1, t2;
---disable_warnings
-create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
---enable_warnings
-insert into t1 values (1, 3);
-select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ;
-select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ;
-drop table t1;
+# Moved to func_group_innodb
+#--disable_warnings
+#create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
+#--enable_warnings
+#insert into t1 values (1, 3);
+#select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ;
+#select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ;
+#drop table t1;
+
create table t1 (a char(10));
insert into t1 values ('a'),('b'),('c');
@@ -539,6 +541,11 @@ INSERT INTO t1 VALUES
SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
DROP TABLE t1;
+
+#
+# Bug #12882 min/max inconsistent on empty table
+#
+# Test case moved to func_group_innodb
#
# Bug #18206: min/max optimization cannot be applied to partial index
#
diff --git a/mysql-test/t/func_group_innodb.test b/mysql-test/t/func_group_innodb.test
new file mode 100644
index 00000000000..1bdfd8f54bb
--- /dev/null
+++ b/mysql-test/t/func_group_innodb.test
@@ -0,0 +1,85 @@
+#
+# Test of group functions that depend on innodb
+#
+
+--source include/have_innodb.inc
+
+--disable_warnings
+create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
+--enable_warnings
+insert into t1 values (1, 3);
+select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ;
+select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ;
+drop table t1;
+
+
+#
+# Bug #12882 min/max inconsistent on empty table
+#
+
+--disable_warnings
+create table t1m (a int) engine=myisam;
+create table t1i (a int) engine=innodb;
+create table t2m (a int) engine=myisam;
+create table t2i (a int) engine=innodb;
+--enable_warnings
+insert into t2m values (5);
+insert into t2i values (5);
+
+# test with MyISAM
+select min(a) from t1m;
+select min(7) from t1m;
+select min(7) from DUAL;
+explain select min(7) from t2m join t1m;
+select min(7) from t2m join t1m;
+
+select max(a) from t1m;
+select max(7) from t1m;
+select max(7) from DUAL;
+explain select max(7) from t2m join t1m;
+select max(7) from t2m join t1m;
+
+select 1, min(a) from t1m where a=99;
+select 1, min(a) from t1m where 1=99;
+select 1, min(1) from t1m where a=99;
+select 1, min(1) from t1m where 1=99;
+
+select 1, max(a) from t1m where a=99;
+select 1, max(a) from t1m where 1=99;
+select 1, max(1) from t1m where a=99;
+select 1, max(1) from t1m where 1=99;
+
+# test with InnoDB
+select min(a) from t1i;
+select min(7) from t1i;
+select min(7) from DUAL;
+explain select min(7) from t2i join t1i;
+select min(7) from t2i join t1i;
+
+select max(a) from t1i;
+select max(7) from t1i;
+select max(7) from DUAL;
+explain select max(7) from t2i join t1i;
+select max(7) from t2i join t1i;
+
+select 1, min(a) from t1i where a=99;
+select 1, min(a) from t1i where 1=99;
+select 1, min(1) from t1i where a=99;
+select 1, min(1) from t1i where 1=99;
+
+select 1, max(a) from t1i where a=99;
+select 1, max(a) from t1i where 1=99;
+select 1, max(1) from t1i where a=99;
+select 1, max(1) from t1i where 1=99;
+
+# mixed MyISAM/InnoDB test
+explain select count(*), min(7), max(7) from t1m, t1i;
+select count(*), min(7), max(7) from t1m, t1i;
+
+explain select count(*), min(7), max(7) from t1m, t2i;
+select count(*), min(7), max(7) from t1m, t2i;
+
+explain select count(*), min(7), max(7) from t2m, t1i;
+select count(*), min(7), max(7) from t2m, t1i;
+
+drop table t1m, t1i, t2m, t2i;
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test
index 8ddf1fbe314..906747c2f78 100644
--- a/mysql-test/t/func_in.test
+++ b/mysql-test/t/func_in.test
@@ -232,3 +232,27 @@ select some_id from t1 where some_id not in(2,-1);
select some_id from t1 where some_id not in(-4,-1,-4);
select some_id from t1 where some_id not in(-4,-1,3423534,2342342);
drop table t1;
+
+#
+# Bug#18360: Type aggregation for IN and CASE may lead to a wrong result
+#
+create table t1(f1 char(1));
+insert into t1 values ('a'),('b'),('1');
+select f1 from t1 where f1 in ('a',1);
+select f1, case f1 when 'a' then '+' when 1 then '-' end from t1;
+create index t1f1_idx on t1(f1);
+select f1 from t1 where f1 in ('a',1);
+explain select f1 from t1 where f1 in ('a',1);
+select f1 from t1 where f1 in ('a','b');
+explain select f1 from t1 where f1 in ('a','b');
+select f1 from t1 where f1 in (2,1);
+explain select f1 from t1 where f1 in (2,1);
+create table t2(f2 int, index t2f2(f2));
+insert into t2 values(0),(1),(2);
+select f2 from t2 where f2 in ('a',2);
+explain select f2 from t2 where f2 in ('a',2);
+select f2 from t2 where f2 in ('a','b');
+explain select f2 from t2 where f2 in ('a','b');
+select f2 from t2 where f2 in (1,'b');
+explain select f2 from t2 where f2 in (1,'b');
+drop table t1, t2;
diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test
index 4e1183afeff..741ea5533da 100644
--- a/mysql-test/t/func_like.test
+++ b/mysql-test/t/func_like.test
@@ -8,8 +8,8 @@ drop table if exists t1;
create table t1 (a varchar(10), key(a));
insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
-explain select * from t1 where a like 'abc%';
-explain select * from t1 where a like concat('abc','%');
+explain extended select * from t1 where a like 'abc%';
+explain extended select * from t1 where a like concat('abc','%');
select * from t1 where a like "abc%";
select * from t1 where a like concat("abc","%");
select * from t1 where a like "ABC%";
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
index 4041c267134..09aa5751301 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -34,6 +34,11 @@ select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6)
explain extended select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6);
select degrees(pi()),radians(360);
+select format(atan(-2, 2), 6);
+select format(atan(pi(), 0), 6);
+select format(atan2(-2, 2), 6);
+select format(atan2(pi(), 0), 6);
+
#
# Bug #2338 Trignometric arithmatic problems
#
diff --git a/mysql-test/t/func_system.test b/mysql-test/t/func_system.test
index 4a526935491..a5041a83623 100644
--- a/mysql-test/t/func_system.test
+++ b/mysql-test/t/func_system.test
@@ -19,7 +19,7 @@ select version()>=_latin1"3.23.29";
select charset(version());
explain extended select database(), user();
-create table t1 (version char(40)) select database(), user(), version() as 'version';
+create table t1 (version char(60)) select database(), user(), version() as 'version';
show create table t1;
drop table t1;
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index a3985998b13..a6cbca61b84 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -528,6 +528,8 @@ DROP TABLE t1;
#
# check if SEC_TO_TIME() handles BIGINT UNSIGNED values correctly
SELECT SEC_TO_TIME(CAST(-1 AS UNSIGNED));
+
+#
# 21913: DATE_FORMAT() Crashes mysql server if I use it through
# mysql-connector-j driver.
#
@@ -545,7 +547,6 @@ DROP TABLE testBug8868;
SET NAMES DEFAULT;
-
#
# Bug #19844 time_format in Union truncates values
#
@@ -570,14 +571,6 @@ explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01')
timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2;
#
-# Bug #10568
-#
-
-select last_day('2005-00-00');
-select last_day('2005-00-01');
-select last_day('2005-01-00');
-
-#
# Bug #10590: %h, %I, and %l format specifies should all return results in
# the 0-11 range
#
@@ -590,6 +583,7 @@ select time_format('100:00:00', '%H %k %h %I %l');
create table t1 (a timestamp default '2005-05-05 01:01:01',
b timestamp default '2005-05-05 01:01:01');
delimiter //;
+drop function if exists t_slow_sysdate;
create function t_slow_sysdate() returns timestamp
begin
do sleep(2);
@@ -679,25 +673,26 @@ SELECT * FROM t1, t2
DROP TABLE t1,t2;
-# End of 5.0 tests
# Restore timezone to default
set time_zone= @@global.time_zone;
+--echo End of 5.0 tests
#
-# 21913: DATE_FORMAT() Crashes mysql server if I use it through
-# mysql-connector-j driver.
+# Bug #18997
#
-SET NAMES latin1;
-SET character_set_results = NULL;
-SHOW VARIABLES LIKE 'character_set_results';
+select date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND);
+select date_sub("0199-01-01 00:00:01",INTERVAL 2 SECOND);
+select date_add("0199-12-31 23:59:59",INTERVAL 2 SECOND);
+select date_sub("0200-01-01 00:00:01",INTERVAL 2 SECOND);
+select date_sub("0200-01-01 00:00:01",INTERVAL 1 SECOND);
+select date_sub("0200-01-01 00:00:01",INTERVAL 2 SECOND);
+select date_add("2001-01-01 23:59:59",INTERVAL -2000 YEAR);
+select date_sub("50-01-01 00:00:01",INTERVAL 2 SECOND);
+select date_sub("90-01-01 00:00:01",INTERVAL 2 SECOND);
+select date_sub("0069-01-01 00:00:01",INTERVAL 2 SECOND);
+select date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND);
-CREATE TABLE testBug8868 (field1 DATE, field2 VARCHAR(32) CHARACTER SET BINARY);
-INSERT INTO testBug8868 VALUES ('2006-09-04', 'abcd');
-SELECT DATE_FORMAT(field1,'%b-%e %l:%i%p') as fmtddate, field2 FROM testBug8868;
-
-DROP TABLE testBug8868;
-
-SET NAMES DEFAULT;
+--echo End of 5.1 tests
diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test
index 66128e56515..99da1fa1ee7 100644
--- a/mysql-test/t/grant2.test
+++ b/mysql-test/t/grant2.test
@@ -457,13 +457,10 @@ create database TESTDB;
create table t2(a int);
create temporary table t1 as select * from mysql.user;
delete from mysql.user where host='localhost';
-INSERT INTO mysql.user VALUES
-('%','mysqltest_1',password('password'),'N','N','N','N','N','N',
-'N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N',
-'','','','',0,0,0,0);
-INSERT INTO mysql.db VALUES
-('%','TESTDB','mysqltest_1','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','N','Y','Y','Y','
-Y','N');
+INSERT INTO mysql.user (host, user, password) VALUES
+('%','mysqltest_1',password('password'));
+INSERT INTO mysql.db (host, db, user, select_priv) VALUES
+('%','TESTDB','mysqltest_1','Y');
FLUSH PRIVILEGES;
connect (con1,localhost,mysqltest_1,password,TESTDB);
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 3e926fba0c6..7f887335753 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -701,3 +701,15 @@ EXPLAIN SELECT SQL_BIG_RESULT b, sum(1) FROM t1 GROUP BY b;
SELECT b, sum(1) FROM t1 GROUP BY b;
SELECT SQL_BIG_RESULT b, sum(1) FROM t1 GROUP BY b;
DROP TABLE t1;
+
+#
+# Bug #21174: Index degrades sort performance and
+# optimizer does not honor IGNORE INDEX
+#
+CREATE TABLE t1 (a INT, b INT, KEY(a));
+INSERT INTO t1 VALUES (1, 1), (2, 2), (3,3), (4,4);
+
+EXPLAIN SELECT a, SUM(b) FROM t1 GROUP BY a LIMIT 2;
+EXPLAIN SELECT a, SUM(b) FROM t1 IGNORE INDEX (a) GROUP BY a LIMIT 2;
+
+DROP TABLE t1;
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test
index 08f0f54df60..11ba6885dd1 100644
--- a/mysql-test/t/group_min_max.test
+++ b/mysql-test/t/group_min_max.test
@@ -489,7 +489,7 @@ select a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1
-- plans
explain select distinct a1,a2,b from t1;
explain select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a');
-explain select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
+explain extended select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
explain select distinct b from t1 where (a2 >= 'b') and (b = 'a');
@@ -497,7 +497,7 @@ explain select distinct b from t1 where (a2 >= 'b') and (b = 'a');
explain select distinct a1,a2,b from t2;
--replace_column 9 #
explain select distinct a1,a2,b from t2 where (a2 >= 'b') and (b = 'a');
-explain select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
+explain extended select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
--replace_column 9 #
explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
explain select distinct b from t2 where (a2 >= 'b') and (b = 'a');
@@ -568,9 +568,9 @@ select distinct b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
explain select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a');
explain select count(distinct a1,a2,b,c) from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
-explain select count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
+explain extended select count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
explain select count(distinct b) from t1 where (a2 >= 'b') and (b = 'a');
-explain select ord(a1) + count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a');
+explain extended select ord(a1) + count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a');
select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a');
select count(distinct a1,a2,b,c) from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
@@ -607,19 +607,19 @@ explain select a1,a2,b,d from t1 group by a1,a2,b;
-- predicate that references an attribute that is after the MIN/MAX argument
-- in the index
-explain select a1,a2,min(b),max(b) from t1
+explain extended select a1,a2,min(b),max(b) from t1
where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a111') group by a1,a2;
-- predicate that references a non-indexed attribute
-explain select a1,a2,b,min(c),max(c) from t1
+explain extended select a1,a2,b,min(c),max(c) from t1
where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b;
-explain select a1,a2,b,c from t1
+explain extended select a1,a2,b,c from t1
where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b,c;
-- non-equality predicate for a non-group select attribute
explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') or (b < 'b') group by a1;
-explain select a1,a2,b from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a111') group by a1,a2,b;
+explain extended select a1,a2,b from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a111') group by a1,a2,b;
-- non-group field with an equality predicate that references a keypart after the
-- MIN/MAX argument
@@ -638,8 +638,8 @@ explain select a1, a2, b, c, min(d), max(d) from t1 group by a1,a2,b,c;
-- other aggregate functions than MIN/MAX
explain select a1,a2,count(a2) from t1 group by a1,a2,b;
-explain select a1,a2,count(a2) from t1 where (a1 > 'a') group by a1,a2,b;
-explain select sum(ord(a1)) from t1 where (a1 > 'a') group by a1,a2,b;
+explain extended select a1,a2,count(a2) from t1 where (a1 > 'a') group by a1,a2,b;
+explain extended select sum(ord(a1)) from t1 where (a1 > 'a') group by a1,a2,b;
#
@@ -659,7 +659,32 @@ select a1 from t1 where a2 = 'b' group by a1;
explain select distinct a1 from t1 where a2 = 'b';
select distinct a1 from t1 where a2 = 'b';
+#
+# Bug #12672: primary key implcitly included in every innodb index
+#
+# Test case moved to group_min_max_innodb
+
+
+#
+# Bug #6142: a problem with the empty innodb table
+#
+# Test case moved to group_min_max_innodb
+
+
+#
+# Bug #9798: group by with rollup
+#
+# Test case moved to group_min_max_innodb
+
+
+#
+# Bug #13293 Wrongly used index results in endless loop.
+#
+# Test case moved to group_min_max_innodb
+
+
drop table t1,t2,t3;
+
#
# Bug #14920 Ordering aggregated result sets with composite primary keys
# corrupts resultset
diff --git a/mysql-test/t/group_min_max_innodb.test b/mysql-test/t/group_min_max_innodb.test
new file mode 100644
index 00000000000..ea2a603a8a4
--- /dev/null
+++ b/mysql-test/t/group_min_max_innodb.test
@@ -0,0 +1,95 @@
+#
+# Test file for WL#1724 (Min/Max Optimization for Queries with Group By Clause).
+# The queries in this file test query execution via QUICK_GROUP_MIN_MAX_SELECT
+# that depends on InnoDB
+#
+
+--source include/have_innodb.inc
+
+#
+# Bug #12672: primary key implcitly included in every innodb index
+#
+
+--disable_warnings
+create table t4 (
+ pk_col int auto_increment primary key, a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
+) engine=innodb;
+--enable_warnings
+
+insert into t4 (a1, a2, b, c, d) values
+('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
+('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
+('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
+('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
+('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
+('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
+('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
+('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
+('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
+('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
+('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
+('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
+('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
+('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
+('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
+('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'),
+('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
+('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
+('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
+('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
+('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
+('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
+('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
+('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
+('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
+('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
+('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
+('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
+('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
+('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
+('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
+('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4');
+
+create index idx12672_0 on t4 (a1);
+create index idx12672_1 on t4 (a1,a2,b,c);
+create index idx12672_2 on t4 (a1,a2,b);
+analyze table t4;
+
+select distinct a1 from t4 where pk_col not in (1,2,3,4);
+
+drop table t4;
+
+
+#
+# Bug #6142: a problem with the empty innodb table
+#
+
+--disable_warnings
+create table t1 (
+ a varchar(30), b varchar(30), primary key(a), key(b)
+) engine=innodb;
+--enable_warnings
+select distinct a from t1;
+drop table t1;
+
+#
+# Bug #9798: group by with rollup
+#
+
+--disable_warnings
+create table t1(a int, key(a)) engine=innodb;
+--enable_warnings
+insert into t1 values(1);
+select a, count(a) from t1 group by a with rollup;
+drop table t1;
+
+
+#
+# Bug #13293 Wrongly used index results in endless loop.
+#
+create table t1 (f1 int, f2 char(1), primary key(f1,f2)) engine=innodb;
+insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d");
+alter table t1 drop primary key, add primary key (f2, f1);
+explain select distinct f1 a, f1 b from t1;
+explain select distinct f1, f2 from t1;
+drop table t1;
diff --git a/mysql-test/t/handler_innodb.test b/mysql-test/t/handler_innodb.test
new file mode 100644
index 00000000000..02982716f78
--- /dev/null
+++ b/mysql-test/t/handler_innodb.test
@@ -0,0 +1,20 @@
+# t/handler_innodb.test
+#
+# test of HANDLER ...
+#
+# Last update:
+# 2006-07-31 ML test refactored (MySQL 5.1)
+# code of t/handler.test and t/innodb_handler.test united
+# main testing code put into include/handler.inc
+# rename t/innodb_handler.test to t/handler_innodb.test
+#
+
+# should work in embedded server after mysqltest is fixed
+--source include/not_embedded.inc
+
+--source include/have_innodb.inc
+let $engine_type= InnoDB;
+let $other_engine_type= MEMORY;
+let $other_handler_engine_type= MyISAM;
+
+--source include/handler.inc
diff --git a/mysql-test/t/handler_myisam.test b/mysql-test/t/handler_myisam.test
new file mode 100644
index 00000000000..644c28de5b2
--- /dev/null
+++ b/mysql-test/t/handler_myisam.test
@@ -0,0 +1,21 @@
+# t/handler_myisam.test
+#
+# test of HANDLER ...
+#
+# Last update:
+# 2006-07-31 ML test refactored (MySQL 5.1)
+# code of t/handler.test and t/innodb_handler.test united
+# main testing code put into include/handler.inc
+# rename t/handler.test to t/handler_myisam.test
+#
+
+# should work in embedded server after mysqltest is fixed
+--source include/not_embedded.inc
+
+let $engine_type= MyISAM;
+let $other_engine_type= MEMORY;
+# There is unfortunately no other all time available storage engine
+# which supports the handler interface
+let $other_handler_engine_type= MyISAM;
+
+--source include/handler.inc
diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test
index 9bea78a7bca..41266cc6d32 100644
--- a/mysql-test/t/having.test
+++ b/mysql-test/t/having.test
@@ -401,7 +401,7 @@ create table t1(f1 int);
select f1 from t1 having max(f1)=f1;
select f1 from t1 group by f1 having max(f1)=f1;
set session sql_mode='ONLY_FULL_GROUP_BY';
---error 1463
+--error ER_NON_GROUPING_FIELD_USED
select f1 from t1 having max(f1)=f1;
select f1 from t1 group by f1 having max(f1)=f1;
set session sql_mode='';
diff --git a/mysql-test/t/im_cmd_line.imtest b/mysql-test/t/im_cmd_line.imtest
new file mode 100644
index 00000000000..8dd348471d0
--- /dev/null
+++ b/mysql-test/t/im_cmd_line.imtest
@@ -0,0 +1,68 @@
+###########################################################################
+#
+# Tests for user-management command-line options.
+#
+###########################################################################
+
+--source include/im_check_env.inc
+
+###########################################################################
+
+# List users so we are sure about starting conditions.
+
+--echo --> Listing users...
+--exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --list-users 2>&1 >/dev/null
+--echo
+
+# Add a new user.
+
+--echo ==> Adding user 'testuser'...
+--exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --add-user --username=testuser --password=abc 2>&1 >/dev/null
+--echo
+
+--echo --> IM password file:
+--exec cat $IM_PASSWORD_PATH
+--echo --> EOF
+--echo
+
+--echo --> Printing out line for 'testuser'...
+--exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --print-password-line --username=testuser --password=abc | tail -1
+--echo
+
+--echo --> Listing users...
+--exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --list-users 2>&1 >/dev/null
+--echo
+
+# Edit user's attributes.
+
+--echo ==> Changing the password of 'testuser'...
+--exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --edit-user --username=testuser --password=xyz 2>&1 >/dev/null
+--echo
+
+--echo --> IM password file:
+--exec cat $IM_PASSWORD_PATH
+--echo --> EOF
+--echo
+
+--echo --> Printing out line for 'testuser'...
+--exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --print-password-line --username=testuser --password=xyz | tail -1
+--echo
+
+--echo --> Listing users...
+--exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --list-users 2>&1 >/dev/null
+--echo
+
+# Drop user.
+
+--echo ==> Dropping user 'testuser'...
+--exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --drop-user --username=testuser 2>&1 >/dev/null
+--echo
+
+--echo --> IM password file:
+--exec cat $IM_PASSWORD_PATH
+--echo --> EOF
+--echo
+
+--echo --> Listing users...
+--exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --list-users 2>&1 >/dev/null
+--echo
diff --git a/mysql-test/t/im_daemon_life_cycle.imtest b/mysql-test/t/im_daemon_life_cycle.imtest
index 65db9dee93f..fd19b6f8527 100644
--- a/mysql-test/t/im_daemon_life_cycle.imtest
+++ b/mysql-test/t/im_daemon_life_cycle.imtest
@@ -60,7 +60,7 @@ START INSTANCE mysqld2;
--sleep 3
---replace_column 3 VERSION
+--replace_column 3 VERSION_NUMBER 4 VERSION
SHOW INSTANCE STATUS mysqld1;
# 4. Stop mysqld2, because it will not be stopped by IM, as it is nonguarded.
diff --git a/mysql-test/t/im_instance_conf-im.opt b/mysql-test/t/im_instance_conf-im.opt
new file mode 100644
index 00000000000..34b74ce0c95
--- /dev/null
+++ b/mysql-test/t/im_instance_conf-im.opt
@@ -0,0 +1 @@
+--monitoring-interval=1
diff --git a/mysql-test/t/im_instance_conf.imtest b/mysql-test/t/im_instance_conf.imtest
new file mode 100644
index 00000000000..e7f1e511113
--- /dev/null
+++ b/mysql-test/t/im_instance_conf.imtest
@@ -0,0 +1,244 @@
+###########################################################################
+#
+# This test suite checks the following statements:
+# - CREATE INSTANCE <instance_name> [option1[=option1_value], ...];
+# - DROP INSTANCE <instance_name>;
+#
+# For CREATE INSTANCE we check that:
+# - CREATE INSTANCE succeeds for non-existing instance;
+# - CREATE INSTANCE fails for existing instance;
+# - CREATE INSTANCE can get additional options with and w/o values;
+# - CREATE INSTANCE parses options and handles grammar errors correctly.
+# Check that strings with spaces are handled correctly, unknown (for
+# mysqld) options should also be handled;
+# - CREATE INSTANCE updates both config file and internal configuration cache;
+# - CREATE INSTANCE allows to create instances only with properly formed
+# names (mysqld*);
+#
+# For DROP INSTANCE we check that:
+# - DROP INSTANCE succeeds for existing instance;
+# - DROP INSTANCE fails for non-existing instance;
+# - DROP INSTANCE fails for active instance.
+# - DROP INSTANCE updates both config file and internal configuration cache;
+#
+# NOTE: each CREATE INSTANCE statement must specify socket-file-name, otherwise
+# this results of the test can be affected by another running test suite.
+#
+###########################################################################
+
+--source include/im_check_env.inc
+
+###########################################################################
+#
+# Check starting conditions.
+#
+###########################################################################
+
+# Check that the configuration file contains only instances that we expect.
+
+--echo --------------------------------------------------------------------
+--exec grep '^server_id[^a-zA-Z0-9_\-]' $MYSQLTEST_VARDIR/im.cnf;
+--echo --------------------------------------------------------------------
+
+###########################################################################
+#
+# CREATE INSTANCE tests.
+#
+###########################################################################
+
+# Check that CREATE INSTANCE succeeds for non-existing instance and also check
+# that both config file and internal configuration cache have been updated.
+
+CREATE INSTANCE mysqld3
+ server_id = 3,
+ socket = "$MYSQL_TMP_DIR/mysqld_3.sock";
+
+SHOW INSTANCES;
+
+--echo --------------------------------------------------------------------
+--exec grep '^server_id[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
+--echo --------------------------------------------------------------------
+
+# Check that CREATE INSTANCE fails for existing instance. Let's all three
+# existing instances (running one, stopped one and just created one). Just in
+# case...
+
+--error 3012 # ER_CREATE_EXISTING_INSTANCE
+CREATE INSTANCE mysqld1;
+
+--error 3012 # ER_CREATE_EXISTING_INSTANCE
+CREATE INSTANCE mysqld2;
+
+--error 3012 # ER_CREATE_EXISTING_INSTANCE
+CREATE INSTANCE mysqld3;
+
+# Check that CREATE INSTANCE can get additional options with and w/o values.
+# Ensure that config file is updated properly.
+
+# - without values;
+
+--echo --------------------------------------------------------------------
+--exec grep "^nonguarded\$" $MYSQLTEST_VARDIR/im.cnf;
+--echo --------------------------------------------------------------------
+
+CREATE INSTANCE mysqld4
+ nonguarded,
+ server_id = 4,
+ socket = "$MYSQL_TMP_DIR/mysqld_4.sock";
+
+SHOW INSTANCES;
+
+--echo --------------------------------------------------------------------
+--exec grep "^nonguarded\$" $MYSQLTEST_VARDIR/im.cnf;
+--echo --------------------------------------------------------------------
+
+# - with value;
+
+--echo --------------------------------------------------------------------
+--exec grep '^test-A[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+--exec grep '^test-B[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+
+CREATE INSTANCE mysqld5
+ test-A = 000,
+ test-B = test,
+ server_id = 5,
+ socket = "$MYSQL_TMP_DIR/mysqld_5.sock";
+
+SHOW INSTANCES;
+
+--echo --------------------------------------------------------------------
+--exec grep '^test-A[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
+--echo --------------------------------------------------------------------
+--exec grep '^test-B[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
+--echo --------------------------------------------------------------------
+
+# Check that CREATE INSTANCE parses options and handles grammar errors
+# correctly. Check that strings with spaces are handled correctly,
+# unknown (for mysqld) options should also be handled.
+
+# - check handling of extra spaces;
+
+--echo --------------------------------------------------------------------
+--exec grep '^test-C1[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+--exec grep '^test-C2[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+
+CREATE INSTANCE mysqld6
+ test-C1 = 10 ,
+ test-C2 = 02 ,
+ server_id = 6,
+ socket = "$MYSQL_TMP_DIR/mysqld_6.sock";
+
+SHOW INSTANCES;
+
+--echo --------------------------------------------------------------------
+--exec grep '^test-C1[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
+--echo --------------------------------------------------------------------
+--exec grep '^test-C2[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
+--echo --------------------------------------------------------------------
+
+# - check handling of grammar error;
+
+--echo --------------------------------------------------------------------
+--exec grep '^test-D[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+--exec grep '^test-E[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+
+--error ER_SYNTAX_ERROR
+CREATE INSTANCE mysqld7 test-D = test-D-value ;
+SHOW INSTANCES;
+
+--error ER_SYNTAX_ERROR
+CREATE INSTANCE mysqld8 test-E 0 ;
+SHOW INSTANCES;
+
+--error ER_SYNTAX_ERROR
+CREATE INSTANCE mysqld8 test-F = ;
+SHOW INSTANCES;
+
+--echo --------------------------------------------------------------------
+--exec grep '^test-D[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+--exec grep '^test-E[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+
+# - check parsing of string option values
+
+--echo --------------------------------------------------------------------
+--exec grep '^test-1[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+--exec grep '^test-2[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+--exec grep '^test-3[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+--exec grep '^test-4[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+--exec grep '^test-5[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+--exec grep '^test-6[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+--exec grep '^test-7[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+
+CREATE INSTANCE mysqld9
+ test-1=" hello world ",
+ test-2=' ',
+ server_id = 9,
+ socket = "$MYSQL_TMP_DIR/mysqld_9.sock";
+SHOW INSTANCES;
+
+CREATE INSTANCE mysqld10
+ test-3='\b\babc\sdef',
+ server_id = 10,
+ socket = "$MYSQL_TMP_DIR/mysqld_10.sock";
+# test-3='abc def'
+SHOW INSTANCES;
+
+CREATE INSTANCE mysqld11
+ test-4='abc\tdef',
+ test-5='abc\ndef',
+ server_id = 11,
+ socket = "$MYSQL_TMP_DIR/mysqld_11.sock";
+SHOW INSTANCES;
+
+CREATE INSTANCE mysqld12
+ test-6="abc\rdef",
+ test-7="abc\\def",
+ server_id = 12,
+ socket = "$MYSQL_TMP_DIR/mysqld_12.sock";
+# test-6=abc
+SHOW INSTANCES;
+
+--error ER_SYNTAX_ERROR
+CREATE INSTANCE mysqld13 test-bad=' \ ';
+SHOW INSTANCES;
+
+--echo --------------------------------------------------------------------
+--exec grep '^test-1[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
+--echo --------------------------------------------------------------------
+--exec grep '^test-2[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
+--echo --------------------------------------------------------------------
+--exec grep '^test-3[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
+--echo --------------------------------------------------------------------
+--exec grep '^test-4[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
+--echo --------------------------------------------------------------------
+--exec grep '^test-5[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
+--echo --------------------------------------------------------------------
+--exec grep '^test-6[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
+--echo --------------------------------------------------------------------
+--exec grep '^test-7[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
+--echo --------------------------------------------------------------------
+--exec grep '^test-bad' $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+
+
+# Check that CREATE INSTANCE allows to create instances only with properly
+# formed names (mysqld*).
+
+--error 3014 # ER_MALFORMED_INSTANCE_NAME
+CREATE INSTANCE qqq1;
+
diff --git a/mysql-test/t/im_options-im.opt b/mysql-test/t/im_options-im.opt
new file mode 100644
index 00000000000..34b74ce0c95
--- /dev/null
+++ b/mysql-test/t/im_options-im.opt
@@ -0,0 +1 @@
+--monitoring-interval=1
diff --git a/mysql-test/t/im_options.imtest b/mysql-test/t/im_options.imtest
new file mode 100644
index 00000000000..b3932c446da
--- /dev/null
+++ b/mysql-test/t/im_options.imtest
@@ -0,0 +1,274 @@
+###########################################################################
+#
+# This test suite checks the following statements:
+# - SET <instance id>.<option name> = <option value>;
+# - UNSET <instance id>.<option name> = <option value>;
+# - FLUSH INSTANCES;
+#
+# For SET/UNSET we check that:
+# - SET ignores spaces correctly;
+# - UNSET does not allow option-value part (= <option value>);
+# - SET/UNSET can be applied several times w/o error;
+# - SET/UNSET is allowed only for stopped instances;
+# - SET/UNSET updates both the configuration cache in IM and
+# the configuration file;
+#
+# For FLUSH INSTANCES we check that:
+# - FLUSH INSTANCES is allowed only when all instances are stopped;
+#
+# According to the IM implementation details, we should play at least with the
+# following options:
+# - server_id
+# - port
+# - nonguarded
+#
+# Let's test SET statement on the option 'server_id'. It's expected that
+# originally the instances have the following server ids and states:
+# - mysqld1: server_id: 1; running (online)
+# - mysqld2: server_id: 2; stopped (offline)
+#
+# NOTE: each CREATE INSTANCE statement must specify socket-file-name, otherwise
+# this results of the test can be affected by another running test suite.
+#
+###########################################################################
+
+--source include/im_check_os.inc
+
+###########################################################################
+#
+# Check starting conditions.
+#
+###########################################################################
+
+# - check the configuration file;
+
+--echo --------------------------------------------------------------------
+--exec grep '^server_id[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf ;
+--echo --------------------------------------------------------------------
+
+# - check the running instances.
+
+--connect (mysql1_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK)
+
+--connection mysql1_con
+
+SHOW VARIABLES LIKE 'server_id';
+
+--connection default
+
+# - check the internal cache.
+
+SHOW INSTANCES;
+
+###########################################################################
+#
+# Check that SET/UNSET is allowed only for stopped instances.
+#
+###########################################################################
+
+# - check that SET/UNSET is denied for running instances;
+
+--error 3015 # ER_INSTANCE_IS_ACTIVE
+UNSET mysqld1.server_id;
+
+--error 3015 # ER_INSTANCE_IS_ACTIVE
+SET mysqld1.server_id = 11;
+
+# - check that SET/UNSET is denied for active instances:
+# - create dummy misconfigured instance;
+# - start it;
+# - try to set/unset options;
+
+CREATE INSTANCE mysqld3
+ datadir = '/',
+ server_id = 3,
+ socket = "$MYSQL_TMP_DIR/mysqld_3.sock";
+START INSTANCE mysqld3;
+
+# FIXME: START INSTANCE should be synchronous.
+--sleep 3
+# should be longer than monitoring interval and enough to start instance.
+
+# NOTE: We can not analyze state of the instance here -- it can be Failed or
+# Starting because Instance Manager is trying to start the misconfigured
+# instance several times.
+
+--error 3015 # ER_INSTANCE_IS_ACTIVE
+UNSET mysqld3.server_id;
+
+--error 3015 # ER_INSTANCE_IS_ACTIVE
+SET mysqld3.server_id = 11;
+
+STOP INSTANCE mysqld3;
+
+# FIXME: STOP INSTANCE should be synchronous.
+--sleep 3
+# should be longer than monitoring interval and enough to stop instance.
+
+--replace_column 3 VERSION_NUMBER 4 VERSION
+SHOW INSTANCE STATUS mysqld3;
+
+# - check that SET/UNSET succeed for stopped instances;
+# - check that SET/UNSET can be applied multiple times;
+
+UNSET mysqld2.server_id;
+UNSET mysqld2.server_id;
+
+--replace_column 2 option_value
+SHOW INSTANCE OPTIONS mysqld2;
+
+SET mysqld2.server_id = 2;
+SET mysqld2.server_id = 2;
+
+--replace_column 2 option_value
+SHOW INSTANCE OPTIONS mysqld2;
+
+# - check that UNSET does not allow option-value part (= <option value>);
+
+--error ER_SYNTAX_ERROR
+UNSET mysqld2.server_id = 11;
+
+# - check that SET/UNSET working properly with multiple options;
+
+SET mysqld2.aaa, mysqld3.bbb, mysqld2.ccc = 0010, mysqld3.ddd = 0020;
+
+--echo --------------------------------------------------------------------
+--exec grep "^aaa\$" $MYSQLTEST_VARDIR/im.cnf ;
+--echo --------------------------------------------------------------------
+--exec grep "^bbb\$" $MYSQLTEST_VARDIR/im.cnf ;
+--echo --------------------------------------------------------------------
+--exec grep '^ccc[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf ;
+--echo --------------------------------------------------------------------
+--exec grep '^ddd[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf ;
+--echo --------------------------------------------------------------------
+
+UNSET mysqld2.aaa, mysqld3.bbb, mysqld2.ccc, mysqld3.ddd;
+
+--echo --------------------------------------------------------------------
+--exec grep "^aaa\$" $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+--exec grep "^bbb\$" $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+--exec grep '^ccc[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+--exec grep '^ddd[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+
+# - check that if some instance name is invalid or the active is active,
+# whole SET-statement will not be executed;
+
+--error 3000 # ER_BAD_INSTANCE_NAME
+SET mysqld2.aaa, mysqld3.bbb, mysqld.ccc = 0010;
+
+--echo --------------------------------------------------------------------
+--exec grep "^aaa\$" $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+--exec grep "^bbb\$" $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+--exec grep '^ccc[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+
+--error 3015 # ER_INSTANCE_IS_ACTIVE
+SET mysqld2.aaa, mysqld3.bbb, mysqld1.ccc = 0010;
+
+--echo --------------------------------------------------------------------
+--exec grep "^aaa\$" $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+--exec grep "^bbb\$" $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+--exec grep '^ccc[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+
+# - check that if some instance name is invalid or the active is active,
+# whole UNSET-statement will not be executed;
+
+--error 3000 # ER_BAD_INSTANCE_NAME
+UNSET mysqld2.server_id, mysqld3.server_id, mysqld.ccc;
+
+--echo --------------------------------------------------------------------
+--exec grep '^server_id[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
+--echo --------------------------------------------------------------------
+
+--error 3015 # ER_INSTANCE_IS_ACTIVE
+UNSET mysqld2.server_id, mysqld3.server_id, mysqld1.ccc;
+
+--echo --------------------------------------------------------------------
+--exec grep '^server_id[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
+--echo --------------------------------------------------------------------
+
+DROP INSTANCE mysqld3;
+
+# - check that spaces are handled correctly;
+
+SET mysqld2.server_id=222;
+SET mysqld2.server_id = 222;
+SET mysqld2.server_id = 222 ;
+SET mysqld2 . server_id = 222 ;
+SET mysqld2 . server_id = 222 , mysqld2 . aaa , mysqld2 . bbb ;
+
+--echo --------------------------------------------------------------------
+--exec grep '^server_id[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf ;
+--echo --------------------------------------------------------------------
+--exec grep "^aaa\$" $MYSQLTEST_VARDIR/im.cnf ;
+--echo --------------------------------------------------------------------
+--exec grep "^bbb\$" $MYSQLTEST_VARDIR/im.cnf ;
+--echo --------------------------------------------------------------------
+
+UNSET mysqld2 . aaa , mysqld2 . bbb ;
+
+--echo --------------------------------------------------------------------
+--exec grep '^server_id[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf ;
+--echo --------------------------------------------------------------------
+--exec grep "^aaa\$" $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+--exec grep "^bbb\$" $MYSQLTEST_VARDIR/im.cnf || true;
+--echo --------------------------------------------------------------------
+
+###########################################################################
+#
+# Check that SET/UNSET updates both the configuration cache in IM and
+# the configuration file.
+#
+###########################################################################
+
+# - check that the configuration file has been updated (i.e. contains
+# server_id=SERVER_ID for mysqld2);
+
+--echo --------------------------------------------------------------------
+--exec grep '^server_id[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf ;
+--echo --------------------------------------------------------------------
+
+# - (for mysqld1) check that the running instance has not been affected:
+# connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id''
+# returns zero;
+
+--connection mysql1_con
+
+SHOW VARIABLES LIKE 'server_id';
+
+--connection default
+
+# - check that internal cache of Instance Manager has been affected;
+# TODO: we should check only server_id option here.
+
+# SHOW INSTANCE OPTIONS mysqld2;
+
+###########################################################################
+#
+# Check that FLUSH INSTANCES is allowed only when all instances are stopped.
+#
+###########################################################################
+
+SHOW INSTANCES;
+
+--error 3016 # ER_THERE_IS_ACTIVE_INSTACE
+FLUSH INSTANCES;
+
+STOP INSTANCE mysqld1;
+# FIXME: STOP INSTANCE should be synchronous.
+--sleep 3
+# should be longer than monitoring interval and enough to stop instance.
+
+SHOW INSTANCES;
+
+FLUSH INSTANCES;
diff --git a/mysql-test/t/im_options_set.imtest b/mysql-test/t/im_options_set.imtest
deleted file mode 100644
index 6a70c31c0a4..00000000000
--- a/mysql-test/t/im_options_set.imtest
+++ /dev/null
@@ -1,116 +0,0 @@
-###########################################################################
-#
-# This file contains test for (3) test suite.
-#
-# Consult WL#2789 for more information.
-#
-###########################################################################
-
-#
-# Check the options-management commands:
-# - SET;
-# - FLUSH INSTANCES;
-#
-# Let's test the commands on the option 'server_id'. It's expected that
-# originally the instances have the following server ids:
-# - mysqld1: 1
-# - mysqld2: 2
-#
-# 1. SET <instance_id>.server_id= SERVER_ID); where SERVER_ID is 11 or 12.
-# 1.1. check that the configuration file has been updated (i.e. contains
-# server_id=SERVER_ID for the instance);
-# 1.2. (for mysqld1) check that the running instance has not been affected:
-# connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id''
-# returns zero;
-# 1.3. check that internal cache of Instance Manager has not been affected
-# (i.e. SHOW INSTANCE OPTIONS <instance> does not contain updated value).
-#
-# 2. FLUSH INSTANCES;
-# 2.1. check that the configuration file has not been updated;
-# 2.2. (for mysqld1) check that the running instance has not been affected:
-# connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id''
-# returns zero value;
-# 2.3. check that internal cache of Instance Manager has been updated (i.e.
-# SHOW INSTANCE OPTIONS <instance> contains 'server_id=SERVER_ID' line).
-#
-# 3. Restore options.
-#
-
-###########################################################################
-
---source include/im_check_env.inc
-
-###########################################################################
-#
-# 1. SET <instance_id>.server_id= SERVER_ID); where SERVER_ID is 11 or 12.
-#
-###########################################################################
-
-# * mysqld1
-
-SET mysqld1.server_id = 11;
-
-# - check that the configuration file has been updated (i.e. contains
-# server_id=SERVER_ID for the instance);
-
---exec grep server_id $MYSQLTEST_VARDIR/im.cnf ;
-
-# - (for mysqld1) check that the running instance has not been affected:
-# connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id''
-# returns zero;
-
---connection mysql1_con
-
-SHOW VARIABLES LIKE 'server_id';
-
---connection default
-
-# - check that internal cache of Instance Manager has not been affected
-# (i.e. SHOW INSTANCE OPTIONS <instance> does not contain updated value).
-# TODO: we should check only server_id option here.
-
-# SHOW INSTANCE OPTIONS mysqld1;
-
-# * mysqld2
-
-SET mysqld2.server_id = 12;
-
-# - check that the configuration file has been updated (i.e. contains
-# server_id=SERVER_ID for the instance);
-
---exec grep server_id $MYSQLTEST_VARDIR/im.cnf ;
-
-# - check that internal cache of Instance Manager has not been affected
-# (i.e. SHOW INSTANCE OPTIONS <instance> does not contain updated value).
-# TODO: we should check only server_id option here.
-
-# SHOW INSTANCE OPTIONS mysqld2;
-
-###########################################################################
-#
-# 2. FLUSH INSTANCES;
-#
-###########################################################################
-
-FLUSH INSTANCES;
-
-# - check that the configuration file has not been updated;
-
---exec grep server_id $MYSQLTEST_VARDIR/im.cnf ;
-
-# - (for mysqld1) check that the running instance has not been affected:
-# connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id''
-# returns zero value;
-
---connection mysql1_con
-
-SHOW VARIABLES LIKE 'server_id';
-
---connection default
-
-# - check that internal cache of Instance Manager has been updated (i.e.
-# SHOW INSTANCE OPTIONS <instance> contains 'server_id=' line).
-# TODO: we should check only server_id option here.
-
-# SHOW INSTANCE OPTIONS mysqld1;
-# SHOW INSTANCE OPTIONS mysqld2;
diff --git a/mysql-test/t/im_options_unset.imtest b/mysql-test/t/im_options_unset.imtest
deleted file mode 100644
index 074c9a3b869..00000000000
--- a/mysql-test/t/im_options_unset.imtest
+++ /dev/null
@@ -1,124 +0,0 @@
-###########################################################################
-#
-# This file contains test for (3) test suite.
-#
-# Consult WL#2789 for more information.
-#
-###########################################################################
-
-#
-# Check the options-management commands:
-# - UNSET;
-# - FLUSH INSTANCES;
-#
-# Let's test the commands on the option 'server_id'. It's expected that
-# originally the instances have the following server ids:
-# - mysqld1: 1
-# - mysqld2: 2
-#
-# The test case:
-#
-# 1. UNSET <instance_id>.server_id;
-#
-# Do the step for both instances.
-#
-# 1.1. check that the configuration file has been updated (i.e. does not
-# contain 'server_id=' line for the instance);
-# 1.2. (for mysqld1) check that the running instance has not been affected:
-# connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id''
-# returns non-zero value;
-# 1.3. check that internal cache of Instance Manager is not affected (i.e.
-# SHOW INSTANCE OPTIONS <instance> contains non-zero value for server_id);
-#
-# 2. FLUSH INSTANCES;
-#
-# Do the step for both instances.
-#
-# 2.1. check that the configuration file has not been updated (i.e. does not
-# contain 'server_id=' for the instance);
-# 2.2. (for mysqld1) check that the running instance has not been affected:
-# connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id''
-# returns non-zero value;
-# 2.3. check that internal cache of Instance Manager has been updated (i.e.
-# SHOW INSTANCE OPTIONS <instance> does not contain 'server_id=' line).
-#
-
-###########################################################################
-
---source include/im_check_env.inc
-
-###########################################################################
-#
-# 1. UNSET <instance_id>.server_id;
-#
-###########################################################################
-
-# * mysqld1
-
-UNSET mysqld1.server_id;
-
-# - check that the configuration file has been updated (i.e. does not
-# contain 'server_id=' line for the instance);
-
---exec grep server_id $MYSQLTEST_VARDIR/im.cnf ;
-
-# - check that the running instance has not been affected: connect to the
-# instance and check that 'SHOW VARIABLES LIKE 'server_id'' returns non-zero
-# value;
-
---connection mysql1_con
-
-SHOW VARIABLES LIKE 'server_id';
-
---connection default
-
-# - check that internal cache of Instance Manager is not affected (i.e. SHOW
-# INSTANCE OPTIONS <instance> contains non-zero value for server_id);
-# TODO: we should check only server_id option here.
-
-# SHOW INSTANCE OPTIONS mysqld1;
-
-# * mysqld2
-
-UNSET mysqld2.server_id;
-
-# - check that the configuration file has been updated (i.e. does not
-# contain 'server_id=' line for the instance);
-
---exec grep server_id $MYSQLTEST_VARDIR/im.cnf || true;
-
-# - check that internal cache of Instance Manager is not affected (i.e. SHOW
-# INSTANCE OPTIONS <instance> contains non-zero value for server_id);
-# TODO: we should check only server_id option here.
-
-# SHOW INSTANCE OPTIONS mysqld2;
-
-###########################################################################
-#
-# 2. FLUSH INSTANCES;
-#
-###########################################################################
-
-FLUSH INSTANCES;
-
-# - check that the configuration file has not been updated (i.e. does not
-# contain 'server_id=' for the instance);
-
---exec grep server_id $MYSQLTEST_VARDIR/im.cnf || true;
-
-# - (for mysqld1) check that the running instance has not been affected:
-# connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id''
-# returns non-zero value;
-
---connection mysql1_con
-
-SHOW VARIABLES LIKE 'server_id';
-
---connection default
-
-# - check that internal cache of Instance Manager has been updated (i.e.
-# SHOW INSTANCE OPTIONS <instance> does not contain 'server_id=' line).
-# TODO: we should check only server_id option here.
-
-# SHOW INSTANCE OPTIONS mysqld1;
-# SHOW INSTANCE OPTIONS mysqld2;
diff --git a/mysql-test/t/index_merge_bdb.test b/mysql-test/t/index_merge_bdb.test
deleted file mode 100644
index c49e6ab3175..00000000000
--- a/mysql-test/t/index_merge_bdb.test
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# 2-sweeps read Index_merge test
-#
--- source include/have_bdb.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (
- pk int primary key,
- key1 int,
- key2 int,
- filler char(200),
- filler2 char(200),
- index(key1),
- index(key2)
-) engine=bdb;
-
-
---disable_query_log
-let $1=1000;
-while ($1)
-{
- eval insert into t1 values($1, $1, $1, 'filler-data','filler-data-2');
- dec $1;
-}
---enable_query_log
-
-select * from t1 where (key1 >= 2 and key1 <= 10) or (pk >= 4 and pk <=8 );
-
-set @maxv=1000;
-
-select * from t1 where
- (pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
- or key1=18 or key1=60;
-
-select * from t1 where
- (pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
- or key1 < 3 or key1 > @maxv-11;
-
-select * from t1 where
- (pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
- or
- (key1 < 5) or (key1 > 10 and key1 < 15) or (key1 >= 50 and key1 < 55 ) or (key1 > @maxv-10);
-
-select * from t1 where
- (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 )
- or
- (key1 < 5) or (key1 > @maxv-10);
-
-drop table t1;
diff --git a/mysql-test/t/index_merge_innodb.test b/mysql-test/t/index_merge_innodb.test
index 25f4e0b4e65..a3bda0ad00c 100644
--- a/mysql-test/t/index_merge_innodb.test
+++ b/mysql-test/t/index_merge_innodb.test
@@ -1,302 +1,28 @@
+# t/index_merge_innodb.test
#
# Index merge tests
#
--- source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-create table t1
-(
- key1 int not null,
- key2 int not null,
-
- INDEX i1(key1),
- INDEX i2(key2)
-) engine=innodb;
-
---disable_query_log
-let $1=200;
-while ($1)
-{
- eval insert into t1 values (200-$1, $1);
- dec $1;
-}
---enable_query_log
-
-# No primary key
-explain select * from t1 where key1 < 5 or key2 > 197;
-
-select * from t1 where key1 < 5 or key2 > 197;
-
-explain select * from t1 where key1 < 3 or key2 > 195;
-select * from t1 where key1 < 3 or key2 > 195;
-
-# Primary key as case-sensitive string with \0s.
-# also make primary key be longer then max. index length of MyISAM.
-alter table t1 add str1 char (255) not null,
- add zeroval int not null default 0,
- add str2 char (255) not null,
- add str3 char (255) not null;
-
-update t1 set str1='aaa', str2='bbb', str3=concat(key2, '-', key1 div 2, '_' ,if(key1 mod 2 = 0, 'a', 'A'));
-
-alter table t1 add primary key (str1, zeroval, str2, str3);
-
-explain select * from t1 where key1 < 5 or key2 > 197;
-
-select * from t1 where key1 < 5 or key2 > 197;
-
-explain select * from t1 where key1 < 3 or key2 > 195;
-select * from t1 where key1 < 3 or key2 > 195;
-
-# Test for BUG#5401
-drop table t1;
-create table t1 (
- pk integer not null auto_increment primary key,
- key1 integer,
- key2 integer not null,
- filler char (200),
- index (key1),
- index (key2)
-) engine=innodb;
-show warnings;
---disable_query_log
-let $1=30;
-while ($1)
-{
- eval insert into t1 (key1, key2, filler) values ($1/4, $1/8, 'filler-data');
- dec $1;
-}
---enable_query_log
-explain select pk from t1 where key1 = 1 and key2 = 1;
-select pk from t1 where key2 = 1 and key1 = 1;
-select pk from t1 ignore index(key1,key2) where key2 = 1 and key1 = 1;
-
-# More tests for BUG#5401.
-drop table t1;
-create table t1 (
- pk int primary key auto_increment,
- key1a int,
- key2a int,
- key1b int,
- key2b int,
- dummy1 int,
- dummy2 int,
- dummy3 int,
- dummy4 int,
- key3a int,
- key3b int,
- filler1 char (200),
- index i1(key1a, key1b),
- index i2(key2a, key2b),
- index i3(key3a, key3b)
-) engine=innodb;
-
-create table t2 (a int);
-insert into t2 values (0),(1),(2),(3),(4),(NULL);
-
-insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
- select A.a, B.a, C.a, D.a, C.a, D.a from t2 A,t2 B,t2 C, t2 D;
-insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
- select key1a, key1b, key2a, key2b, key3a, key3b from t1;
-insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
- select key1a, key1b, key2a, key2b, key3a, key3b from t1;
-analyze table t1;
-select count(*) from t1;
-
-explain select count(*) from t1 where
- key1a = 2 and key1b is null and key2a = 2 and key2b is null;
-
-select count(*) from t1 where
- key1a = 2 and key1b is null and key2a = 2 and key2b is null;
-
-explain select count(*) from t1 where
- key1a = 2 and key1b is null and key3a = 2 and key3b is null;
-
-select count(*) from t1 where
- key1a = 2 and key1b is null and key3a = 2 and key3b is null;
-
-drop table t1,t2;
-
-# Test for BUG#8441
-create table t1 (
- id1 int,
- id2 date ,
- index idx2 (id1,id2),
- index idx1 (id2)
-) engine = innodb;
-insert into t1 values(1,'20040101'), (2,'20040102');
-select * from t1 where id1 = 1 and id2= '20040101';
-drop table t1;
-
-# Test for BUG#12720
---disable_warnings
-drop view if exists v1;
---enable_warnings
-CREATE TABLE t1 (
- `oid` int(11) unsigned NOT NULL auto_increment,
- `fk_bbk_niederlassung` int(11) unsigned NOT NULL,
- `fk_wochentag` int(11) unsigned NOT NULL,
- `uhrzeit_von` time NOT NULL COMMENT 'HH:MM',
- `uhrzeit_bis` time NOT NULL COMMENT 'HH:MM',
- `geloescht` tinyint(4) NOT NULL,
- `version` int(5) NOT NULL,
- PRIMARY KEY (`oid`),
- KEY `fk_bbk_niederlassung` (`fk_bbk_niederlassung`),
- KEY `fk_wochentag` (`fk_wochentag`),
- KEY `ix_version` (`version`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-insert into t1 values
-(1, 38, 1, '08:00:00', '13:00:00', 0, 1),
-(2, 38, 2, '08:00:00', '13:00:00', 0, 1),
-(3, 38, 3, '08:00:00', '13:00:00', 0, 1),
-(4, 38, 4, '08:00:00', '13:00:00', 0, 1),
-(5, 38, 5, '08:00:00', '13:00:00', 0, 1),
-(6, 38, 5, '08:00:00', '13:00:00', 1, 2),
-(7, 38, 3, '08:00:00', '13:00:00', 1, 2),
-(8, 38, 1, '08:00:00', '13:00:00', 1, 2),
-(9, 38, 2, '08:00:00', '13:00:00', 1, 2),
-(10, 38, 4, '08:00:00', '13:00:00', 1, 2),
-(11, 38, 1, '08:00:00', '13:00:00', 0, 3),
-(12, 38, 2, '08:00:00', '13:00:00', 0, 3),
-(13, 38, 3, '08:00:00', '13:00:00', 0, 3),
-(14, 38, 4, '08:00:00', '13:00:00', 0, 3),
-(15, 38, 5, '08:00:00', '13:00:00', 0, 3),
-(16, 38, 4, '08:00:00', '13:00:00', 0, 4),
-(17, 38, 5, '08:00:00', '13:00:00', 0, 4),
-(18, 38, 1, '08:00:00', '13:00:00', 0, 4),
-(19, 38, 2, '08:00:00', '13:00:00', 0, 4),
-(20, 38, 3, '08:00:00', '13:00:00', 0, 4),
-(21, 7, 1, '08:00:00', '13:00:00', 0, 1),
-(22, 7, 2, '08:00:00', '13:00:00', 0, 1),
-(23, 7, 3, '08:00:00', '13:00:00', 0, 1),
-(24, 7, 4, '08:00:00', '13:00:00', 0, 1),
-(25, 7, 5, '08:00:00', '13:00:00', 0, 1);
-
-create view v1 as
-select
- zeit1.oid AS oid,
- zeit1.fk_bbk_niederlassung AS fk_bbk_niederlassung,
- zeit1.fk_wochentag AS fk_wochentag,
- zeit1.uhrzeit_von AS uhrzeit_von,
- zeit1.uhrzeit_bis AS uhrzeit_bis,
- zeit1.geloescht AS geloescht,
- zeit1.version AS version
-from
- t1 zeit1
-where
-(zeit1.version =
- (select max(zeit2.version) AS `max(version)`
- from t1 zeit2
- where
- ((zeit1.fk_bbk_niederlassung = zeit2.fk_bbk_niederlassung) and
- (zeit1.fk_wochentag = zeit2.fk_wochentag) and
- (zeit1.uhrzeit_von = zeit2.uhrzeit_von) and
- (zeit1.uhrzeit_bis = zeit2.uhrzeit_bis)
- )
- )
-)
-and (zeit1.geloescht = 0);
-
-select * from v1 where oid = 21;
-drop view v1;
-drop table t1;
-##
-CREATE TABLE t1(
- t_cpac varchar(2) NOT NULL,
- t_vers varchar(4) NOT NULL,
- t_rele varchar(2) NOT NULL,
- t_cust varchar(4) NOT NULL,
- filler1 char(250) default NULL,
- filler2 char(250) default NULL,
- PRIMARY KEY (t_cpac,t_vers,t_rele,t_cust),
- UNIQUE KEY IX_4 (t_cust,t_cpac,t_vers,t_rele),
- KEY IX_5 (t_vers,t_rele,t_cust)
-) ENGINE=InnoDB;
-
-insert into t1 values
-('tm','2.5 ','a ',' ','',''), ('tm','2.5U','a ','stnd','',''),
-('da','3.3 ','b ',' ','',''), ('da','3.3U','b ','stnd','',''),
-('tl','7.6 ','a ',' ','',''), ('tt','7.6 ','a ',' ','',''),
-('bc','B61 ','a ',' ','',''), ('bp','B61 ','a ',' ','',''),
-('ca','B61 ','a ',' ','',''), ('ci','B61 ','a ',' ','',''),
-('cp','B61 ','a ',' ','',''), ('dm','B61 ','a ',' ','',''),
-('ec','B61 ','a ',' ','',''), ('ed','B61 ','a ',' ','',''),
-('fm','B61 ','a ',' ','',''), ('nt','B61 ','a ',' ','',''),
-('qm','B61 ','a ',' ','',''), ('tc','B61 ','a ',' ','',''),
-('td','B61 ','a ',' ','',''), ('tf','B61 ','a ',' ','',''),
-('tg','B61 ','a ',' ','',''), ('ti','B61 ','a ',' ','',''),
-('tp','B61 ','a ',' ','',''), ('ts','B61 ','a ',' ','',''),
-('wh','B61 ','a ',' ','',''), ('bc','B61U','a ','stnd','',''),
-('bp','B61U','a ','stnd','',''), ('ca','B61U','a ','stnd','',''),
-('ci','B61U','a ','stnd','',''), ('cp','B61U','a ','stnd','',''),
-('dm','B61U','a ','stnd','',''), ('ec','B61U','a ','stnd','',''),
-('fm','B61U','a ','stnd','',''), ('nt','B61U','a ','stnd','',''),
-('qm','B61U','a ','stnd','',''), ('tc','B61U','a ','stnd','',''),
-('td','B61U','a ','stnd','',''), ('tf','B61U','a ','stnd','',''),
-('tg','B61U','a ','stnd','',''), ('ti','B61U','a ','stnd','',''),
-('tp','B61U','a ','stnd','',''), ('ts','B61U','a ','stnd','',''),
-('wh','B61U','a ','stnd','','');
-show create table t1;
-
-select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6';
-select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6'
- and t_rele='a' and t_cust = ' ';
-
-drop table t1;
-
-# BUG#19021: Crash in index_merge/ROR-intersection optimizer under
-# specific circumstances.
-create table t1 (
- pk int(11) not null auto_increment,
- a int(11) not null default '0',
- b int(11) not null default '0',
- c int(11) not null default '0',
-
- filler1 datetime, filler2 varchar(15),
- filler3 longtext,
-
- kp1 varchar(4), kp2 varchar(7),
- kp3 varchar(2), kp4 varchar(4),
- kp5 varchar(7),
- filler4 char(1),
-
- primary key (pk),
- key idx1(a,b,c),
- key idx2(c),
- key idx3(kp1,kp2,kp3,kp4,kp5)
-) engine=innodb default charset=latin1;
---disable_query_log
-set @fill= uncompress(unhex(concat(
-'F91D0000789CDD993D6FDB301086F7FE0A6D4E0105B8E3F1335D5BA028DA0EEDE28E1D320408',
-'52A0713BF4D7571FB62C51A475924839080307B603E77DEE787C8FA41F9E9EEF7F1F8A87A7C3',
-'AFE280C5DF9F8F7FEE9F8B1B2CB114D6902E918455245DB91300FA16E42D5201FA4EE29DA05D',
-'B9FB3718A33718A3FA8C30AEFAFDE1F317D016AA67BA7A60FDE45BF5F8BA7B5BDE8812AA9F1A',
-'069DB03C9804346644F3A3A6A1338DB572756A3C4D1BCC804CABF912C654AE9BB855A2B85962',
-'3A479259CAE6A86C0411D01AE5483581EDCBD9A39C45252D532E533979EB9F82E971D979BDB4',
-'8531105670740AFBFD1E34AAB0029E4AD0A1D46A6D0946A21A16038A5CD965CD2D524673F712',
-'20C304477315CE18405EAF9BD0AFFEAC74FDA14F1FBF5BD34C769D73FBBEDF4750ADD4E5A99C',
-'5C8DC04934AFA275D483D536D174C11B12AF27F8F888B41B6FC9DBA569E1FD7BD72D698130B7',
-'91B23A98803512B3D31881E8DCDA2AC1754E3644C4BB3A8466750B911681274A39E35E8624B7',
-'444A42AC1213F354758E3CF1A4CDD5A688C767CF1B11ABC5867CB15D8A18E0B91E9EC275BB94',
-'58F33C2936F64690D55BC29E4A293D95A798D84217736CEAAA538CE1354269EE2162053FBC66',
-'496D90CB53323CB279D3A6AF651B4B22B9E430743D83BE48E995A09D4FC9871C22D8D189B945',
-'706911BCB8C3C774B9C08D2FC6ED853ADACA37A14A4CB2E027630E5B80ECACD939431B1CDF62',
-'7D71487536EA2C678F59685E91F4B6C144BCCB94C1EBA9FA6F5552DDCA4E4539BE326A2720CB',
-'45ED028EB3616AC93C46E775FEA9FA6DA7CFCEC6DEBA5FCD1F915EED4D983BDDB881528AD9AB',
-'43C1576F29AAB35BDFBC21D422F52B307D350589D45225A887AC46C8EDD72D99EC3ED2E1BCEF',
-'7AF26FC4C74097B6768A5EDAFA660CC64278F7E63F99AC954B')));
-prepare x from @fill;
-execute x;
-deallocate prepare x;
---enable_query_log
-set @fill=NULL;
-SELECT COUNT(*) FROM t1 WHERE b = 0 AND a = 0 AND c = 13286427 AND
- kp1='279' AND kp2='ELM0678' AND kp3='6' AND kp4='10' AND kp5 = 'R ';
-
-drop table t1;
-
+# Last update:
+# 2006-08-07 ML test refactored (MySQL 5.1)
+# Main code of several index_merge tests
+# -> include/index_merge*.inc
+# wrapper t/index_merge_innodb.test sources now several
+# include/index_merge*.inc files
+#
+--source include/have_innodb.inc
+let $engine_type= InnoDB;
+# InnoDB does not support Merge tables (affects include/index_merge1.inc)
+let $merge_table_support= 0;
+
+# The first two tests are disabled because of non deterministic explain output.
+# If include/index_merge1.inc can be enabled for InnoDB and all other
+# storage engines, please remove the subtest for Bug#21277 from
+# include/index_merge2.inc.
+# This test exists already in include/index_merge1.inc.
+# --source include/index_merge1.inc
+# --source include/index_merge_ror.inc
+
+--source include/index_merge2.inc
+--source include/index_merge_2sweeps.inc
+--source include/index_merge_ror_cpk.inc
diff --git a/mysql-test/t/index_merge_myisam.test b/mysql-test/t/index_merge_myisam.test
new file mode 100644
index 00000000000..8fdda2b772b
--- /dev/null
+++ b/mysql-test/t/index_merge_myisam.test
@@ -0,0 +1,21 @@
+# t/index_merge_myisam.test
+#
+# Index merge tests
+#
+# Last update:
+# 2006-08-07 ML test refactored (MySQL 5.1)
+# Main code of several index_merge tests
+# -> include/index_merge*.inc
+# wrapper t/index_merge_innodb.test sources now several
+# include/index_merge*.inc files
+#
+
+let $engine_type= MyISAM;
+# MyISAM supports Merge tables
+let $merge_table_support= 1;
+
+--source include/index_merge1.inc
+--source include/index_merge_ror.inc
+--source include/index_merge2.inc
+--source include/index_merge_2sweeps.inc
+--source include/index_merge_ror_cpk.inc
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 27007bbe16a..4ae88736b98 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -1,6 +1,10 @@
# This test uses grants, which can't get tested for embedded server
-- source include/not_embedded.inc
+# check that CSV engine was compiled in, as the result of the test depends
+# on the presence of the log tables (which are CSV-based).
+--source include/have_csv.inc
+
# Test for information_schema.schemata &
# show databases
@@ -33,7 +37,7 @@ create table t3(a int, KEY a_data (a));
create table mysqltest.t4(a int);
create table t5 (id int auto_increment primary key);
insert into t5 values (10);
-create view v1 (c) as select table_name from information_schema.TABLES;
+create view v1 (c) as select table_name from information_schema.TABLES where table_schema!='cluster';
select * from v1;
select c,table_name from v1
@@ -76,6 +80,8 @@ connect (user4,localhost,mysqltest_3,,mysqltest);
connection user4;
select table_name, column_name, privileges from information_schema.columns
where table_schema = 'mysqltest' and table_name = 'v1';
+--error 1345
+explain select * from v1;
connection default;
drop view v1, mysqltest.v1;
@@ -442,7 +448,7 @@ drop table t1, t2;
#
# Bug #7476: crash on SELECT * FROM INFORMATION_SCHEMA.TABLES
#
-
+use test;
CREATE TABLE t_crashme ( f1 BIGINT);
CREATE VIEW a1 (t_CRASHME) AS SELECT f1 FROM t_crashme GROUP BY f1;
CREATE VIEW a2 AS SELECT t_CRASHME FROM a1;
@@ -456,7 +462,7 @@ while ($tab_count)
--disable_result_log
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES;
--enable_result_log
-SELECT count(*) FROM INFORMATION_SCHEMA.TABLES;
+SELECT count(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test';
let $tab_count= 65;
while ($tab_count)
{
@@ -522,7 +528,7 @@ flush privileges;
# Bug #9404 information_schema: Weird error messages
# with SELECT SUM() ... GROUP BY queries
#
-SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;
+SELECT table_schema, count(*) FROM information_schema.TABLES where TABLE_SCHEMA!='cluster' GROUP BY TABLE_SCHEMA;
#
@@ -853,7 +859,6 @@ select concat(@a, table_name), @a, table_name
from information_schema.tables where table_schema = 'test';
drop table t1,t2;
-
#
# Bug#20230: routine_definition is not null
#
@@ -929,7 +934,6 @@ SELECT MAX(table_name) FROM information_schema.tables;
SELECT table_name from information_schema.tables
WHERE table_name=(SELECT MAX(table_name)
FROM information_schema.tables);
-
#
# Bug #23037: Bug in field "Default" of query "SHOW COLUMNS FROM table"
#
@@ -970,7 +974,23 @@ SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), LENGTH(COLUMN_DEFAULT), COLUMN_DEFAULT=
DROP TABLE bug23037;
DROP FUNCTION get_value;
+--echo End of 5.0 tests.
+#
+# Show engines
+#
+
+select * from information_schema.engines WHERE ENGINE="MyISAM";
+
+#
+# INFORMATION_SCHEMA.PROCESSLIST
+#
+grant select on *.* to user3148@localhost;
+connect (con3148,localhost,user3148,,test);
+connection con3148;
+select user,db from information_schema.processlist;
+connection default;
+drop user user3148@localhost;
+--echo End of 5.1 tests.
-# End of 5.0 tests.
diff --git a/mysql-test/t/information_schema_inno.test b/mysql-test/t/information_schema_inno.test
index 9cd64a54ad9..195bf57a880 100644
--- a/mysql-test/t/information_schema_inno.test
+++ b/mysql-test/t/information_schema_inno.test
@@ -21,3 +21,35 @@ select * from information_schema.KEY_COLUMN_USAGE where
TABLE_SCHEMA= "test";
drop table t3, t2, t1;
+
+#
+# Test for REFERENTIAL_CONSTRAINTS table
+#
+CREATE TABLE t1(a1 INT NOT NULL, a2 INT NOT NULL,
+ PRIMARY KEY(a1, a2)) ENGINE=INNODB;
+CREATE TABLE t2(b1 INT, b2 INT, INDEX (b1, b2),
+ CONSTRAINT A1
+ FOREIGN KEY (b1, b2) REFERENCES t1(a1, a2)
+ ON UPDATE CASCADE ON DELETE NO ACTION) ENGINE=INNODB;
+CREATE TABLE t3(b1 INT, b2 INT, INDEX (b1, b2),
+ CONSTRAINT A2
+ FOREIGN KEY (b1, b2) REFERENCES t2(b1, b2)
+ ON UPDATE SET NULL ON DELETE RESTRICT) ENGINE=INNODB;
+CREATE TABLE t4(b1 INT, b2 INT, INDEX (b1, b2),
+ CONSTRAINT A3
+ FOREIGN KEY (b1, b2) REFERENCES t3(b1, b2)
+ ON UPDATE NO ACTION ON DELETE SET NULL) ENGINE=INNODB;
+CREATE TABLE t5(b1 INT, b2 INT, INDEX (b1, b2),
+ CONSTRAINT A4
+ FOREIGN KEY (b1, b2) REFERENCES t4(b1, b2)
+ ON UPDATE RESTRICT ON DELETE CASCADE) ENGINE=INNODB;
+
+
+select a.CONSTRAINT_SCHEMA, b.TABLE_NAME, CONSTRAINT_TYPE,
+ b.CONSTRAINT_NAME, UNIQUE_CONSTRAINT_SCHEMA, UNIQUE_CONSTRAINT_NAME,
+ MATCH_OPTION, UPDATE_RULE, DELETE_RULE
+from information_schema.TABLE_CONSTRAINTS a,
+ information_schema.REFERENTIAL_CONSTRAINTS b
+where a.CONSTRAINT_SCHEMA = 'test' and a.CONSTRAINT_SCHEMA = b.CONSTRAINT_SCHEMA and
+a.CONSTRAINT_NAME = b.CONSTRAINT_NAME;
+drop tables t5, t4, t3, t2, t1;
diff --git a/mysql-test/t/information_schema_part.test b/mysql-test/t/information_schema_part.test
new file mode 100644
index 00000000000..4cbf21ca1d3
--- /dev/null
+++ b/mysql-test/t/information_schema_part.test
@@ -0,0 +1,123 @@
+
+-- source include/have_partition.inc
+
+--disable_warnings
+drop table if exists t1,t2,t3,t4;
+--enable_warnings
+
+create table t1 (a int not null,b int not null,c int not null, primary key(a,b))
+partition by list (b*a)
+(partition x1 values in (1) tablespace ts1,
+ partition x2 values in (3, 11, 5, 7) tablespace ts2,
+ partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
+
+--replace_column 16 # 19 # 20 #
+select * from information_schema.partitions where table_schema="test"
+and table_name="t1";
+
+create table t2 (a int not null,b int not null,c int not null, primary key(a,b))
+partition by range (a)
+partitions 3
+(partition x1 values less than (5) tablespace ts1,
+ partition x2 values less than (10) tablespace ts2,
+ partition x3 values less than maxvalue tablespace ts3);
+--replace_column 16 # 19 # 20 #
+select * from information_schema.partitions where table_schema="test"
+and table_name="t2";
+
+create table t3 (f1 date)
+partition by hash(month(f1))
+partitions 3;
+--replace_column 16 # 19 # 20 #
+select * from information_schema.partitions where table_schema="test"
+and table_name="t3";
+
+create table t4 (f1 date, f2 int)
+partition by key(f1,f2)
+partitions 3;
+--replace_column 16 # 19 # 20 #
+select * from information_schema.partitions where table_schema="test"
+and table_name="t4";
+
+drop table t1,t2,t3,t4;
+
+create table t1 (a int not null,b int not null,c int not null,primary key (a,b))
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+ ( subpartition x11 tablespace t1,
+ subpartition x12 tablespace t2),
+ partition x2 values less than (5)
+ ( subpartition x21 tablespace t1,
+ subpartition x22 tablespace t2)
+);
+
+create table t2 (a int not null,b int not null,c int not null,primary key (a,b))
+partition by range (a)
+subpartition by key (a)
+( partition x1 values less than (1)
+ ( subpartition x11 tablespace t1,
+ subpartition x12 tablespace t2),
+ partition x2 values less than (5)
+ ( subpartition x21 tablespace t1,
+ subpartition x22 tablespace t2)
+);
+--replace_column 16 # 19 # 20 #
+select * from information_schema.partitions where table_schema="test";
+drop table t1,t2;
+
+create table t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+ ( subpartition x11 tablespace t1 nodegroup 0,
+ subpartition x12 tablespace t2 nodegroup 1),
+ partition x2 values less than (5)
+( subpartition x21 tablespace t1 nodegroup 0,
+ subpartition x22 tablespace t2 nodegroup 1)
+);
+
+--replace_column 16 # 19 # 20 #
+select * from information_schema.partitions where table_schema="test";
+show tables;
+drop table t1;
+
+create table t1(f1 int, f2 int);
+--replace_column 16 # 19 # 20 #
+select * from information_schema.partitions where table_schema="test";
+drop table t1;
+
+create table t1 (f1 date)
+partition by linear hash(month(f1))
+partitions 3;
+--replace_column 16 # 19 # 20 #
+select * from information_schema.partitions where table_schema="test"
+and table_name="t1";
+drop table t1;
+
+#
+# Bug 20161 Partitions: SUBPARTITION METHOD doesn't show LINEAR keyword
+#
+create table t1 (a int)
+PARTITION BY RANGE (a)
+SUBPARTITION BY LINEAR HASH (a)
+(PARTITION p0 VALUES LESS THAN (10));
+
+SHOW CREATE TABLE t1;
+select SUBPARTITION_METHOD FROM information_schema.partitions WHERE
+table_schema="test" AND table_name="t1";
+drop table t1;
+
+create table t1 (a int)
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN
+(10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
+ 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53));
+SHOW CREATE TABLE t1;
+SELECT PARTITION_DESCRIPTION FROM information_schema.partitions WHERE
+table_schema = "test" AND table_name = "t1";
+drop table t1;
diff --git a/mysql-test/t/innodb-big.test b/mysql-test/t/innodb-big.test
deleted file mode 100644
index ade69ffdb45..00000000000
--- a/mysql-test/t/innodb-big.test
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# Test some things that takes a long time
-
--- source include/big_test.inc
--- source include/have_innodb.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2, t3, t4;
---enable_warnings
-
-#
-# Test test how filesort and buffered-record-reads works with innodb
-#
-
-CREATE TABLE t1 (id INTEGER) ENGINE=MYISAM;
-CREATE TABLE t2 (id INTEGER primary key) ENGINE=INNODB;
-CREATE TABLE t3 (a char(32) primary key,id INTEGER) ENGINE=INNODB;
-CREATE TABLE t4 (a char(32) primary key,id INTEGER) ENGINE=MYISAM;
-
-INSERT INTO t1 (id) VALUES (1);
-INSERT INTO t1 SELECT id+1 FROM t1;
-INSERT INTO t1 SELECT id+2 FROM t1;
-INSERT INTO t1 SELECT id+4 FROM t1;
-INSERT INTO t1 SELECT id+8 FROM t1;
-INSERT INTO t1 SELECT id+16 FROM t1;
-INSERT INTO t1 SELECT id+32 FROM t1;
-INSERT INTO t1 SELECT id+64 FROM t1;
-INSERT INTO t1 SELECT id+128 FROM t1;
-INSERT INTO t1 SELECT id+256 FROM t1;
-INSERT INTO t1 SELECT id+512 FROM t1;
-INSERT INTO t1 SELECT id+1024 FROM t1;
-INSERT INTO t1 SELECT id+2048 FROM t1;
-INSERT INTO t1 SELECT id+4096 FROM t1;
-INSERT INTO t1 SELECT id+8192 FROM t1;
-INSERT INTO t1 SELECT id+16384 FROM t1;
-INSERT INTO t1 SELECT id+32768 FROM t1;
-INSERT INTO t1 SELECT id+65536 FROM t1;
-INSERT INTO t1 SELECT id+131072 FROM t1;
-INSERT INTO t1 SELECT id+262144 FROM t1;
-INSERT INTO t1 SELECT id+524288 FROM t1;
-INSERT INTO t1 SELECT id+1048576 FROM t1;
-INSERT INTO t2 SELECT * FROM t1;
-INSERT INTO t3 SELECT concat(id),id from t2 ORDER BY -id;
-INSERT INTO t4 SELECT * from t3 ORDER BY concat(a);
-select sum(id) from t3;
-drop table t1,t2,t3,t4;
diff --git a/mysql-test/t/innodb-deadlock.test b/mysql-test/t/innodb-deadlock.test
deleted file mode 100644
index 41741942963..00000000000
--- a/mysql-test/t/innodb-deadlock.test
+++ /dev/null
@@ -1,117 +0,0 @@
--- source include/have_innodb.inc
-# Can't test this with embedded server
--- source include/not_embedded.inc
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-#
-# Testing of FOR UPDATE
-#
-
-connection con1;
-create table t1 (id integer, x integer) engine=INNODB;
-insert into t1 values(0, 0);
-set autocommit=0;
-SELECT * from t1 where id = 0 FOR UPDATE;
-
-connection con2;
-set autocommit=0;
-
-# The following query should hang because con1 is locking the page
---send
-update t1 set x=2 where id = 0;
---sleep 2
-
-connection con1;
-update t1 set x=1 where id = 0;
-select * from t1;
-commit;
-
-connection con2;
-reap;
-commit;
-
-connection con1;
-select * from t1;
-commit;
-
-drop table t1;
-#
-# Testing of FOR UPDATE
-#
-
-connection con1;
-create table t1 (id integer, x integer) engine=INNODB;
-create table t2 (b integer, a integer) engine=INNODB;
-insert into t1 values(0, 0), (300, 300);
-insert into t2 values(0, 10), (1, 20), (2, 30);
-commit;
-set autocommit=0;
-select * from t2;
-update t2 set a=100 where b=(SELECT x from t1 where id = b FOR UPDATE);
-select * from t2;
-select * from t1;
-
-connection con2;
-set autocommit=0;
-
-# The following query should hang because con1 is locking the page
---send
-update t1 set x=2 where id = 0;
---sleep 2
-
-connection con1;
-update t1 set x=1 where id = 0;
-select * from t1;
-commit;
-
-connection con2;
-reap;
-commit;
-
-connection con1;
-select * from t1;
-commit;
-
-drop table t1, t2;
-create table t1 (id integer, x integer) engine=INNODB;
-create table t2 (b integer, a integer) engine=INNODB;
-insert into t1 values(0, 0), (300, 300);
-insert into t2 values(0, 0), (1, 20), (2, 30);
-commit;
-
-connection con1;
-select a,b from t2 UNION SELECT id, x from t1 FOR UPDATE;
-select * from t2;
-select * from t1;
-
-connection con2;
-
-# The following query should hang because con1 is locking the page
-update t2 set a=2 where b = 0;
-select * from t2;
---send
-update t1 set x=2 where id = 0;
---sleep 2
-
-connection con1;
-update t1 set x=1 where id = 0;
-select * from t1;
-commit;
-
-connection con2;
-reap;
-commit;
-
-connection con1;
-select * from t1;
-commit;
-
-drop table t1, t2;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/innodb-master.opt b/mysql-test/t/innodb-master.opt
index 4cb927540bf..4901efb416c 100644
--- a/mysql-test/t/innodb-master.opt
+++ b/mysql-test/t/innodb-master.opt
@@ -1 +1 @@
---binlog_cache_size=32768
+--binlog_cache_size=32768 --innodb_lock_wait_timeout=1
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 0c083ccdfd3..1a2afad3b44 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -904,20 +904,12 @@ insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
select count(*) from t1;
--replace_column 9 #
-explain select * from t1 where c between 1 and 10000;
+explain select * from t1 where c between 1 and 2500;
update t1 set c=a;
--replace_column 9 #
-explain select * from t1 where c between 1 and 10000;
+explain select * from t1 where c between 1 and 2500;
drop table t1,t2;
#
@@ -1159,6 +1151,7 @@ drop table t2, t1;
# 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";
@@ -2142,6 +2135,59 @@ disconnect a;
disconnect b;
#
+# Test that cascading updates leading to duplicate keys give the correct
+# error message (bug #9680)
+#
+
+CREATE TABLE t1 (
+ field1 varchar(8) NOT NULL DEFAULT '',
+ field2 varchar(8) NOT NULL DEFAULT '',
+ PRIMARY KEY (field1, field2)
+) ENGINE=InnoDB;
+
+CREATE TABLE t2 (
+ field1 varchar(8) NOT NULL DEFAULT '' PRIMARY KEY,
+ FOREIGN KEY (field1) REFERENCES t1 (field1)
+ ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES ('old', 'somevalu');
+INSERT INTO t1 VALUES ('other', 'anyvalue');
+
+INSERT INTO t2 VALUES ('old');
+INSERT INTO t2 VALUES ('other');
+
+--error ER_FOREIGN_DUPLICATE_KEY
+UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu';
+
+DROP TABLE t2;
+DROP TABLE t1;
+
+#
+# Bug#18477 - MySQL/InnoDB Ignoring Foreign Keys in ALTER TABLE
+#
+create table t1 (
+ c1 bigint not null,
+ c2 bigint not null,
+ primary key (c1),
+ unique key (c2)
+) engine=innodb;
+#
+create table t2 (
+ c1 bigint not null,
+ primary key (c1)
+) engine=innodb;
+#
+alter table t1 add constraint c2_fk foreign key (c2)
+ references t2(c1) on delete cascade;
+show create table t1;
+#
+alter table t1 drop foreign key c2_fk;
+show create table t1;
+#
+drop table t1, t2;
+
+#
# Bug #14360: problem with intervals
#
@@ -2153,6 +2199,256 @@ select * from t1, t2
where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
drop table t1, t2;
+create table t1 (id int not null, f_id int not null, f int not null,
+primary key(f_id, id)) engine=innodb;
+create table t2 (id int not null,s_id int not null,s varchar(200),
+primary key(id)) engine=innodb;
+INSERT INTO t1 VALUES (8, 1, 3);
+INSERT INTO t1 VALUES (1, 2, 1);
+INSERT INTO t2 VALUES (1, 0, '');
+INSERT INTO t2 VALUES (8, 1, '');
+commit;
+DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id)
+WHERE mm.id IS NULL;
+select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
+where mm.id is null lock in share mode;
+drop table t1,t2;
+
+#
+# Test case where X-locks on unused rows should be released in a
+# update (because READ COMMITTED isolation level)
+#
+
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+create table t1(a int not null, b int, primary key(a)) engine=innodb;
+insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
+commit;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+update t1 set b = 5 where b = 1;
+connection b;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+#
+# X-lock to record (7,3) should be released in a update
+#
+select * from t1 where a = 7 and b = 3 for update;
+connection a;
+commit;
+connection b;
+commit;
+drop table t1;
+connection default;
+disconnect a;
+disconnect b;
+
+#
+# Test case where no locks should be released (because we are not
+# using READ COMMITTED isolation level)
+#
+
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+create table t1(a int not null, b int, primary key(a)) engine=innodb;
+insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2);
+commit;
+set autocommit = 0;
+select * from t1 lock in share mode;
+update t1 set b = 5 where b = 1;
+connection b;
+set autocommit = 0;
+#
+# S-lock to records (2,2),(4,2), and (6,2) should not be released in a update
+#
+--error 1205
+select * from t1 where a = 2 and b = 2 for update;
+#
+# X-lock to record (1,1),(3,1),(5,1) should not be released in a update
+#
+--error 1205
+connection a;
+commit;
+connection b;
+commit;
+connection default;
+disconnect a;
+disconnect b;
+drop table t1;
+
+#
+# Consistent read should be used in following selects
+#
+# 1) INSERT INTO ... SELECT
+# 2) UPDATE ... = ( SELECT ...)
+# 3) CREATE ... SELECT
+
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+create table t1(a int not null, b int, primary key(a)) engine=innodb;
+insert into t1 values (1,2),(5,3),(4,2);
+create table t2(d int not null, e int, primary key(d)) engine=innodb;
+insert into t2 values (8,6),(12,1),(3,1);
+commit;
+set autocommit = 0;
+select * from t2 for update;
+connection b;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+insert into t1 select * from t2;
+update t1 set b = (select e from t2 where a = d);
+create table t3(d int not null, e int, primary key(d)) engine=innodb
+select * from t2;
+commit;
+connection a;
+commit;
+connection default;
+disconnect a;
+disconnect b;
+drop table t1, t2, t3;
+
+#
+# Consistent read should not be used if
+#
+# (a) isolation level is serializable OR
+# (b) select ... lock in share mode OR
+# (c) select ... for update
+#
+# in following queries:
+#
+# 1) INSERT INTO ... SELECT
+# 2) UPDATE ... = ( SELECT ...)
+# 3) CREATE ... SELECT
+
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connect (c,localhost,root,,);
+connect (d,localhost,root,,);
+connect (e,localhost,root,,);
+connect (f,localhost,root,,);
+connect (g,localhost,root,,);
+connect (h,localhost,root,,);
+connect (i,localhost,root,,);
+connect (j,localhost,root,,);
+connection a;
+create table t1(a int not null, b int, primary key(a)) engine=innodb;
+insert into t1 values (1,2),(5,3),(4,2);
+create table t2(a int not null, b int, primary key(a)) engine=innodb;
+insert into t2 values (8,6),(12,1),(3,1);
+create table t3(d int not null, b int, primary key(d)) engine=innodb;
+insert into t3 values (8,6),(12,1),(3,1);
+create table t5(a int not null, b int, primary key(a)) engine=innodb;
+insert into t5 values (1,2),(5,3),(4,2);
+create table t6(d int not null, e int, primary key(d)) engine=innodb;
+insert into t6 values (8,6),(12,1),(3,1);
+create table t8(a int not null, b int, primary key(a)) engine=innodb;
+insert into t8 values (1,2),(5,3),(4,2);
+create table t9(d int not null, e int, primary key(d)) engine=innodb;
+insert into t9 values (8,6),(12,1),(3,1);
+commit;
+set autocommit = 0;
+select * from t2 for update;
+connection b;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+--send
+insert into t1 select * from t2;
+connection c;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+--send
+update t3 set b = (select b from t2 where a = d);
+connection d;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+--send
+create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2;
+connection e;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+--send
+insert into t5 (select * from t2 lock in share mode);
+connection f;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+--send
+update t6 set e = (select b from t2 where a = d lock in share mode);
+connection g;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+--send
+create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode;
+connection h;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+--send
+insert into t8 (select * from t2 for update);
+connection i;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+--send
+update t9 set e = (select b from t2 where a = d for update);
+connection j;
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+--send
+create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update;
+
+connection b;
+--error 1205
+reap;
+
+connection c;
+--error 1205
+reap;
+
+connection d;
+--error 1205
+reap;
+
+connection e;
+--error 1205
+reap;
+
+connection f;
+--error 1205
+reap;
+
+connection g;
+--error 1205
+reap;
+
+connection h;
+--error 1205
+reap;
+
+connection i;
+--error 1205
+reap;
+
+connection j;
+--error 1205
+reap;
+
+connection a;
+commit;
+
+connection default;
+disconnect a;
+disconnect b;
+disconnect c;
+disconnect d;
+disconnect e;
+disconnect f;
+disconnect g;
+disconnect h;
+disconnect i;
+disconnect j;
+drop table t1, t2, t3, t5, t6, t8, t9;
+
# bug 18934, "InnoDB crashes when table uses column names like DB_ROW_ID"
--error 1005
CREATE TABLE t1 (DB_ROW_ID int) engine=innodb;
@@ -2197,6 +2493,16 @@ drop table t2, t1;
--error ER_TABLE_CANT_HANDLE_SPKEYS
create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
+#
+# Test optimize on table with open transaction
+#
+
+CREATE TABLE t1 ( a int ) ENGINE=innodb;
+BEGIN;
+INSERT INTO t1 VALUES (1);
+OPTIMIZE TABLE t1;
+DROP TABLE t1;
+
#######################################################################
# #
# Please, DO NOT TOUCH this file as well as the innodb.result file. #
diff --git a/mysql-test/t/innodb_cache-master.opt b/mysql-test/t/innodb_cache-master.opt
deleted file mode 100644
index 5f0ebff98f6..00000000000
--- a/mysql-test/t/innodb_cache-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---set-variable=query_cache_size=1M
diff --git a/mysql-test/t/innodb_handler.test b/mysql-test/t/innodb_handler.test
deleted file mode 100644
index 18cec97af0d..00000000000
--- a/mysql-test/t/innodb_handler.test
+++ /dev/null
@@ -1,96 +0,0 @@
--- source include/have_innodb.inc
-
-#
-# test of HANDLER ...
-#
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-create table t1 (a int, b char(10), key a(a), key b(a,b)) engine=innodb;
-insert into t1 values
-(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"),
-(14,"aaa"),(15,"bbb"),(16,"ccc"),(16,"xxx"),
-(20,"ggg"),(21,"hhh"),(22,"iii");
-handler t1 open as t2;
-handler t2 read a first;
-handler t2 read a next;
-handler t2 read a next;
-handler t2 read a prev;
-handler t2 read a last;
-handler t2 read a prev;
-handler t2 read a prev;
-
-handler t2 read a first;
-handler t2 read a prev;
-
-handler t2 read a last;
-handler t2 read a prev;
-handler t2 read a next;
-handler t2 read a next;
-
-handler t2 read a=(15);
-handler t2 read a=(16);
-
---error 1070
-handler t2 read a=(19,"fff");
-
-handler t2 read b=(19,"fff");
-handler t2 read b=(19,"yyy");
-handler t2 read b=(19);
-
---error 1109
-handler t1 read a last;
-
-handler t2 read a=(11);
-handler t2 read a>=(11);
-
-handler t2 read a=(18);
-handler t2 read a>=(18);
-handler t2 read a>(18);
-handler t2 read a<=(18);
-handler t2 read a<(18);
-
-handler t2 read a first limit 5;
-handler t2 read a next limit 3;
-handler t2 read a prev limit 10;
-
-handler t2 read a>=(16) limit 4;
-handler t2 read a>=(16) limit 2,2;
-handler t2 read a last limit 3;
-
-handler t2 read a=(19);
-handler t2 read a=(19) where b="yyy";
-
-handler t2 read first;
-handler t2 read next;
---error 1064
-handler t2 read last;
-handler t2 close;
-
-handler t1 open;
-handler t1 read a next; # this used to crash as a bug#5373
-handler t1 read a next;
-handler t1 close;
-
-handler t1 open;
-handler t1 read a prev; # this used to crash as a bug#5373
-handler t1 read a prev;
-handler t1 close;
-
-handler t1 open as t2;
-handler t2 read first;
-alter table t1 engine=innodb;
---error 1109
-handler t2 read first;
-
-drop table t1;
-CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2);
-HANDLER t1 OPEN;
-HANDLER t1 READ `primary` = (1, 1000);
-HANDLER t1 READ `primary` PREV;
-DROP TABLE t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test
index 06cfe71ef11..93495538141 100644
--- a/mysql-test/t/innodb_mysql.test
+++ b/mysql-test/t/innodb_mysql.test
@@ -1,387 +1,14 @@
--- source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-# BUG#16798: Uninitialized row buffer reads in ref-or-null optimizer
-# (repeatable only w/innodb).
-create table t1 (
- c_id int(11) not null default '0',
- org_id int(11) default null,
- unique key contacts$c_id (c_id),
- key contacts$org_id (org_id)
-) engine=innodb;
-insert into t1 values
- (2,null),(120,null),(141,null),(218,7), (128,1),
- (151,2),(234,2),(236,2),(243,2),(255,2),(259,2),(232,3),(235,3),(238,3),
- (246,3),(253,3),(269,3),(285,3),(291,3),(293,3),(131,4),(230,4),(231,4);
-
-create table t2 (
- slai_id int(11) not null default '0',
- owner_tbl int(11) default null,
- owner_id int(11) default null,
- sla_id int(11) default null,
- inc_web int(11) default null,
- inc_email int(11) default null,
- inc_chat int(11) default null,
- inc_csr int(11) default null,
- inc_total int(11) default null,
- time_billed int(11) default null,
- activedate timestamp null default null,
- expiredate timestamp null default null,
- state int(11) default null,
- sla_set int(11) default null,
- unique key t2$slai_id (slai_id),
- key t2$owner_id (owner_id),
- key t2$sla_id (sla_id)
-) engine=innodb;
-insert into t2(slai_id, owner_tbl, owner_id, sla_id) values
- (1,3,1,1), (3,3,10,2), (4,3,3,6), (5,3,2,5), (6,3,8,3), (7,3,9,7),
- (8,3,6,8), (9,3,4,9), (10,3,5,10), (11,3,11,11), (12,3,7,12);
-
-flush tables;
-select si.slai_id
-from t1 c join t2 si on
- ((si.owner_tbl = 3 and si.owner_id = c.org_id) or
- ( si.owner_tbl = 2 and si.owner_id = c.c_id))
-where
- c.c_id = 218 and expiredate is null;
-
-select * from t1 where org_id is null;
-select si.slai_id
-from t1 c join t2 si on
- ((si.owner_tbl = 3 and si.owner_id = c.org_id) or
- ( si.owner_tbl = 2 and si.owner_id = c.c_id))
-where
- c.c_id = 218 and expiredate is null;
-
-drop table t1, t2;
-
-#
-# Bug#17212: results not sorted correctly by ORDER BY when using index
-# (repeatable only w/innodb because of index props)
-#
-CREATE TABLE t1 (a int, b int, KEY b (b)) Engine=InnoDB;
-CREATE TABLE t2 (a int, b int, PRIMARY KEY (a,b)) Engine=InnoDB;
-CREATE TABLE t3 (a int, b int, c int, PRIMARY KEY (a),
- UNIQUE KEY b (b,c), KEY a (a,b,c)) Engine=InnoDB;
-
-INSERT INTO t1 VALUES (1, 1);
-INSERT INTO t1 SELECT a + 1, b + 1 FROM t1;
-INSERT INTO t1 SELECT a + 2, b + 2 FROM t1;
-
-INSERT INTO t2 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(1,8);
-INSERT INTO t2 SELECT a + 1, b FROM t2;
-DELETE FROM t2 WHERE a = 1 AND b < 2;
-
-INSERT INTO t3 VALUES (1,1,1),(2,1,2);
-INSERT INTO t3 SELECT a + 2, a + 2, 3 FROM t3;
-INSERT INTO t3 SELECT a + 4, a + 4, 3 FROM t3;
-
-# demonstrate a problem when a must-use-sort table flag
-# (sort_by_table=1) is being neglected.
-SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE
- t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2)
- ORDER BY t1.b LIMIT 2;
-
-# demonstrate the problem described in the bug report
-SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE
- t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2)
- ORDER BY t1.b LIMIT 5;
-DROP TABLE t1, t2, t3;
-
-
-# BUG#21077 (The testcase is not deterministic so correct execution doesn't
-# prove anything) For proof one should track if sequence of ha_innodb::* func
-# calls is correct.
-CREATE TABLE `t1` (`id1` INT) ;
-INSERT INTO `t1` (`id1`) VALUES (1),(5),(2);
-
-CREATE TABLE `t2` (
- `id1` INT,
- `id2` INT NOT NULL,
- `id3` INT,
- `id4` INT NOT NULL,
- UNIQUE (`id2`,`id4`),
- KEY (`id1`)
-) ENGINE=InnoDB;
-
-INSERT INTO `t2`(`id1`,`id2`,`id3`,`id4`) VALUES
-(1,1,1,0),
-(1,1,2,1),
-(5,1,2,2),
-(6,1,2,3),
-(1,2,2,2),
-(1,2,1,1);
-
-SELECT `id1` FROM `t1` WHERE `id1` NOT IN (SELECT `id1` FROM `t2` WHERE `id2` = 1 AND `id3` = 2);
-DROP TABLE t1, t2;
-
-#
-# Bug #22728 - Handler_rollback value is growing
-#
-
-let $before= `show /*!50002 GLOBAL */ status like 'Handler_rollback'`;
-create table t1 (c1 int) engine=innodb;
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-connection con2;
-handler t1 open;
-handler t1 read first;
-disconnect con2;
-connection con1;
-let $after= `show /*!50002 GLOBAL */ status like 'Handler_rollback'`;
-# Compare the before and after value, it should be equal
---disable_query_log
-eval select STRCMP("$before", "$after") as "Before and after comparison";
---enable_query_log
-connection default;
-drop table t1;
-disconnect con1;
---echo End of 4.1 tests
-#
-# Bug #12882 min/max inconsistent on empty table
-#
-
---disable_warnings
-create table t1m (a int) engine=myisam;
-create table t1i (a int) engine=innodb;
-create table t2m (a int) engine=myisam;
-create table t2i (a int) engine=innodb;
---enable_warnings
-insert into t2m values (5);
-insert into t2i values (5);
-
-# test with MyISAM
-select min(a) from t1m;
-select min(7) from t1m;
-select min(7) from DUAL;
-explain select min(7) from t2m join t1m;
-select min(7) from t2m join t1m;
-
-select max(a) from t1m;
-select max(7) from t1m;
-select max(7) from DUAL;
-explain select max(7) from t2m join t1m;
-select max(7) from t2m join t1m;
-
-select 1, min(a) from t1m where a=99;
-select 1, min(a) from t1m where 1=99;
-select 1, min(1) from t1m where a=99;
-select 1, min(1) from t1m where 1=99;
-
-select 1, max(a) from t1m where a=99;
-select 1, max(a) from t1m where 1=99;
-select 1, max(1) from t1m where a=99;
-select 1, max(1) from t1m where 1=99;
-
-# test with InnoDB
-select min(a) from t1i;
-select min(7) from t1i;
-select min(7) from DUAL;
-explain select min(7) from t2i join t1i;
-select min(7) from t2i join t1i;
-
-select max(a) from t1i;
-select max(7) from t1i;
-select max(7) from DUAL;
-explain select max(7) from t2i join t1i;
-select max(7) from t2i join t1i;
-
-select 1, min(a) from t1i where a=99;
-select 1, min(a) from t1i where 1=99;
-select 1, min(1) from t1i where a=99;
-select 1, min(1) from t1i where 1=99;
-
-select 1, max(a) from t1i where a=99;
-select 1, max(a) from t1i where 1=99;
-select 1, max(1) from t1i where a=99;
-select 1, max(1) from t1i where 1=99;
-
-# mixed MyISAM/InnoDB test
-explain select count(*), min(7), max(7) from t1m, t1i;
-select count(*), min(7), max(7) from t1m, t1i;
-
-explain select count(*), min(7), max(7) from t1m, t2i;
-select count(*), min(7), max(7) from t1m, t2i;
-
-explain select count(*), min(7), max(7) from t2m, t1i;
-select count(*), min(7), max(7) from t2m, t1i;
-
-drop table t1m, t1i, t2m, t2i;
-
-#
-# Bug #12672: primary key implcitly included in every innodb index
-# (was part of group_min_max.test)
-#
-
-create table t1 (
- a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
-);
-
-insert into t1 (a1, a2, b, c, d) values
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
-('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
-('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
-('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
-('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'),
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
-('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
-('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
-('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
-('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4');
---disable_warnings
-create table t4 (
- pk_col int auto_increment primary key, a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
-) engine=innodb;
---enable_warnings
-insert into t4 (a1, a2, b, c, d, dummy) select * from t1;
-
-create index idx12672_0 on t4 (a1);
-create index idx12672_1 on t4 (a1,a2,b,c);
-create index idx12672_2 on t4 (a1,a2,b);
-analyze table t1;
-
-select distinct a1 from t4 where pk_col not in (1,2,3,4);
-
-drop table t1,t4;
-
-
-#
-# BUG#18819: DELETE IGNORE hangs on foreign key parent delete
-#
-# The bug itself does not relate to InnoDB, but we have to use foreign
-# keys to reproduce it.
-#
---disable_warnings
-DROP TABLE IF EXISTS t2, t1;
---enable_warnings
-
-CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE= InnoDB;
-CREATE TABLE t2 (
- i INT NOT NULL,
- FOREIGN KEY (i) REFERENCES t1 (i) ON DELETE NO ACTION
-) ENGINE= InnoDB;
-
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (1);
-
-DELETE IGNORE FROM t1 WHERE i = 1;
-
-SELECT * FROM t1, t2;
-
-DROP TABLE t2, t1;
-
-
---echo End of 4.1 tests.
-
-
-#
-# Bug #6142: a problem with the empty innodb table
-# (was part of group_min_max.test)
-#
-
---disable_warnings
-create table t1 (
- a varchar(30), b varchar(30), primary key(a), key(b)
-) engine=innodb;
---enable_warnings
-select distinct a from t1;
-drop table t1;
-
-#
-# Bug #9798: group by with rollup
-# (was part of group_min_max.test)
-#
-
---disable_warnings
-create table t1(a int, key(a)) engine=innodb;
---enable_warnings
-insert into t1 values(1);
-select a, count(a) from t1 group by a with rollup;
-drop table t1;
-
+# t/innodb_mysql.test
#
-# Bug #13293 Wrongly used index results in endless loop.
-# (was part of group_min_max.test)
+# Last update:
+# 2006-07-26 ML test refactored (MySQL 5.1)
+# main testing code t/innodb_mysql.test -> include/mix1.inc
#
-create table t1 (f1 int, f2 char(1), primary key(f1,f2)) engine=innodb;
-insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d");
-alter table t1 drop primary key, add primary key (f2, f1);
-explain select distinct f1 a, f1 b from t1;
-explain select distinct f1, f2 from t1;
-drop table t1;
-
-#
-# Test for bug #17164: ORed FALSE blocked conversion of outer join into join
-#
-
-CREATE TABLE t1 (id int(11) NOT NULL PRIMARY KEY, name varchar(20),
- INDEX (name)) ENGINE=InnoDB;
-CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11),
- FOREIGN KEY (fkey) REFERENCES t2(id)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,'A1'),(2,'A2'),(3,'B');
-INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3);
-
-EXPLAIN
-SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
- WHERE t1.name LIKE 'A%';
-
-EXPLAIN
-SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
- WHERE t1.name LIKE 'A%' OR FALSE;
-
-DROP TABLE t1,t2;
-
-#
-# Bug#17530: Incorrect key truncation on table creation caused server crash.
-#
-create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
- character set utf8 collate utf8_general_ci;
-insert into t1 values('aaa');
-drop table t1;
-
-
-#
-# Bug#22781: SQL_BIG_RESULT fails to influence sort plan
-#
-CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c FLOAT, KEY b(b)) ENGINE = INNODB;
-
-INSERT INTO t1 VALUES ( 1 , 1 , 1);
-INSERT INTO t1 SELECT a + 1 , MOD(a + 1 , 20), 1 FROM t1;
-INSERT INTO t1 SELECT a + 2 , MOD(a + 2 , 20), 1 FROM t1;
-INSERT INTO t1 SELECT a + 4 , MOD(a + 4 , 20), 1 FROM t1;
-INSERT INTO t1 SELECT a + 8 , MOD(a + 8 , 20), 1 FROM t1;
-INSERT INTO t1 SELECT a + 16, MOD(a + 16, 20), 1 FROM t1;
-INSERT INTO t1 SELECT a + 32, MOD(a + 32, 20), 1 FROM t1;
-INSERT INTO t1 SELECT a + 64, MOD(a + 64, 20), 1 FROM t1;
-
-EXPLAIN SELECT b, SUM(c) FROM t1 GROUP BY b;
-EXPLAIN SELECT SQL_BIG_RESULT b, SUM(c) FROM t1 GROUP BY b;
-DROP TABLE t1;
+-- source include/have_innodb.inc
+let $engine_type= InnoDB;
+let $other_engine_type= MEMORY;
+# InnoDB does support FOREIGN KEYFOREIGN KEYs
+let $test_foreign_keys= 1;
---echo End of 5.0 tests
+--source include/mix1.inc
diff --git a/mysql-test/t/innodb_unsafe_binlog-master.opt b/mysql-test/t/innodb_unsafe_binlog-master.opt
deleted file mode 100644
index 5c0136b5db3..00000000000
--- a/mysql-test/t/innodb_unsafe_binlog-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb_locks_unsafe_for_binlog=true
diff --git a/mysql-test/t/innodb_unsafe_binlog.test b/mysql-test/t/innodb_unsafe_binlog.test
deleted file mode 100644
index fa240eb7608..00000000000
--- a/mysql-test/t/innodb_unsafe_binlog.test
+++ /dev/null
@@ -1,67 +0,0 @@
--- source include/have_innodb.inc
-#
-# Note that these tests uses a innodb_locks_unsafe_for_binlog option.
-#
-# Test cases for a bug #15650 DELETE with LEFT JOIN crashes server
-#
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-create table t1 (id int not null, f_id int not null, f int not null,
-primary key(f_id, id)) engine=innodb;
-create table t2 (id int not null,s_id int not null,s varchar(200),
-primary key(id)) engine=innodb;
-INSERT INTO t1 VALUES (8, 1, 3);
-INSERT INTO t1 VALUES (1, 2, 1);
-INSERT INTO t2 VALUES (1, 0, '');
-INSERT INTO t2 VALUES (8, 1, '');
-commit;
-DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id)
-WHERE mm.id IS NULL;
-select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
-where mm.id is null lock in share mode;
-drop table t1,t2;
-
-create table t1 (id int not null, f_id int not null, f int not null,
-primary key(id),key(f_id)) engine=innodb;
-create table t2 (id int not null,s_id int not null,s varchar(200),
-primary key(id),key(s_id)) engine=innodb;
-INSERT INTO t1 VALUES (8, 1, 3);
-INSERT INTO t1 VALUES (1, 2, 1);
-INSERT INTO t2 VALUES (1, 0, '');
-INSERT INTO t2 VALUES (8, 1, '');
-commit;
-delete ml.* from t1 as ml left join t2 as mm on (mm.s_id=ml.f_id) where mm.s is null;
-select ml.* from t1 as ml left join t2 as mm on (mm.s_id=ml.f_id) where mm.s is null lock in share mode;
-drop table t1,t2;
-
-#
-# Test case for unlock row bug where unlock releases all locks granted for
-# a row. Only the latest lock should be released.
-#
-
-connect (a,localhost,root,,);
-connect (b,localhost,root,,);
-connection a;
-create table t1(a int not null, b int, primary key(a)) engine=innodb;
-insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2);
-commit;
-set autocommit = 0;
-select * from t1 lock in share mode;
-update t1 set b = 5 where b = 1;
-connection b;
-set autocommit = 0;
-#
-# S-lock to records (2,2),(4,2), and (6,2) should not be released in a update
-#
---error 1205
-select * from t1 where a = 2 and b = 2 for update;
-connection a;
-commit;
-connection b;
-commit;
-drop table t1;
-disconnect a;
-disconnect b;
-
diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test
index ac43d0bc818..0cc25469705 100644
--- a/mysql-test/t/insert.test
+++ b/mysql-test/t/insert.test
@@ -9,8 +9,8 @@ drop table if exists t1,t2,t3;
create table t1 (a int not null);
insert into t1 values (1);
insert into t1 values (a+2);
-insert into t1 values (a+3);
-insert into t1 values (4),(a+5);
+insert into t1 values (a+3),(a+4);
+insert into t1 values (5),(a+6);
select * from t1;
drop table t1;
@@ -177,6 +177,30 @@ select count(*) from t2;
drop table t1,t2,t3;
#
+# Test different cases of duplicate fields
+#
+
+create table t1 (a int, b int);
+insert into t1 (a,b) values (a,b);
+insert into t1 SET a=1, b=a+1;
+insert into t1 (a,b) select 1,2;
+INSERT INTO t1 ( a ) SELECT 0 ON DUPLICATE KEY UPDATE a = a + VALUES (a);
+prepare stmt1 from ' replace into t1 (a,a) select 100, ''hundred'' ';
+--error 1110
+execute stmt1;
+--error 1110
+insert into t1 (a,b,b) values (1,1,1);
+--error 1136
+insert into t1 (a,a) values (1,1,1);
+--error 1110
+insert into t1 (a,a) values (1,1);
+--error 1110
+insert into t1 SET a=1,b=2,a=1;
+--error 1110
+insert into t1 (b,b) select 1,2;
+--error 1110
+INSERT INTO t1 (b,b) SELECT 0,0 ON DUPLICATE KEY UPDATE a = a + VALUES (a);
+drop table t1;
# Test for INSERT DELAYED INTO a <view>
# BUG#13683: INSERT DELAYED into a view creates an infinite loop
#
@@ -210,3 +234,10 @@ select row_count();
insert into t1 values (5, 5) on duplicate key update data= data + 10;
select row_count();
drop table t1;
+
+# Test of INSERT IGNORE and re-using auto_increment values
+create table t1 (id int primary key auto_increment, data int, unique(data));
+insert ignore into t1 values(NULL,100),(NULL,110),(NULL,120);
+insert ignore into t1 values(NULL,10),(NULL,20),(NULL,110),(NULL,120),(NULL,100),(NULL,90);
+insert ignore into t1 values(NULL,130),(NULL,140),(500,110),(550,120),(450,100),(NULL,150);
+select * from t1 order by id;
diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test
index 27558a31d68..d0005f3b8f7 100644
--- a/mysql-test/t/join.test
+++ b/mysql-test/t/join.test
@@ -520,6 +520,7 @@ select * from v1a join v1b on t1.b = t2.b;
#
# Bug #17523 natural join and information_schema
#
+--replace_column 31 #
select * from information_schema.statistics join information_schema.columns
using(table_name,column_name) where table_name='user';
@@ -589,3 +590,43 @@ select * from ((t3 natural join (t1 natural join t2)) natural join t4)
drop table t1, t2, t3, t4, t5;
# End of tests for WL#2486 - natural/using join
+
+#
+# BUG#14940: Make E(#rows) from "range" access be re-used by range optimizer
+#
+create table t1 (a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table t2 (a int, b int, filler char(100), key(a), key(b));
+create table t3 (a int, b int, filler char(100), key(a), key(b));
+
+insert into t2
+ select @a:= A.a + 10*(B.a + 10*C.a), @a, 'filler' from t1 A, t1 B, t1 C;
+insert into t3 select * from t2 where a < 800;
+
+# The order of tables must be t2,t3:
+explain select * from t2,t3 where t2.a < 200 and t2.b=t3.b;
+
+drop table t1, t2, t3;
+
+# BUG#14940 {Wrong query plan is chosen because of odd results of
+# prev_record_reads() function }
+create table t1 (a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table t2 (a int, b int, primary key(a));
+insert into t2 select @v:=A.a+10*B.a, @v from t1 A, t1 B;
+
+explain select * from t1;
+show status like '%cost%';
+select 'The cost of accessing t1 (dont care if it changes' '^';
+
+select 'vv: Following query must use ALL(t1), eq_ref(A), eq_ref(B): vv' Z;
+
+explain select * from t1, t2 A, t2 B where A.a = t1.a and B.a=A.b;
+show status like '%cost%';
+select '^^: The above should be ~= 20 + cost(select * from t1). Value less than 20 is an error' Z;
+
+
+
+drop table t1, t2;
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index 20462f2ca3f..72a2935337d 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -760,6 +760,12 @@ EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t1.a > IF(t1.a = t2.b
DROP TABLE t1,t2;
#
+# Test for bug #17164: ORed FALSE blocked conversion of outer join into join
+#
+
+# Test case moved to join_outer_innodb
+
+#
# Bug 19396: LEFT OUTER JOIN over views in curly braces
#
--disable_warnings
diff --git a/mysql-test/t/join_outer_innodb.test b/mysql-test/t/join_outer_innodb.test
new file mode 100644
index 00000000000..40add7f488f
--- /dev/null
+++ b/mysql-test/t/join_outer_innodb.test
@@ -0,0 +1,26 @@
+#
+# test of left outer join for tests that depends on innodb
+#
+
+--source include/have_innodb.inc
+
+#
+# Test for bug #17164: ORed FALSE blocked conversion of outer join into join
+#
+
+CREATE TABLE t1 (id int(11) NOT NULL PRIMARY KEY, name varchar(20),
+ INDEX (name)) ENGINE=InnoDB;
+CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11),
+ FOREIGN KEY (fkey) REFERENCES t2(id)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,'A1'),(2,'A2'),(3,'B');
+INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3);
+
+EXPLAIN
+SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
+ WHERE t1.name LIKE 'A%';
+
+EXPLAIN
+SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
+ WHERE t1.name LIKE 'A%' OR FALSE;
+
+DROP TABLE t1,t2;
diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test
index 3767f5f885e..7c6b38cb871 100644
--- a/mysql-test/t/key.test
+++ b/mysql-test/t/key.test
@@ -384,3 +384,61 @@ desc t1;
drop table t1;
# End of 4.1 tests
+
+#
+# WL#1563 - Modify MySQL to support on-line CREATE/DROP INDEX
+# To test if this really works, you need to run with --debug
+# and check the trace file.
+#
+# Create a table with named and unnamed indexes.
+create table t1 (
+ c1 int,
+ c2 char(12),
+ c3 varchar(123),
+ c4 timestamp,
+ index (c1),
+ index i1 (c1),
+ index i2 (c2),
+ index i3 (c3),
+ unique i4 (c4),
+ index i5 (c1, c2, c3, c4),
+ primary key (c2, c3),
+ index (c2, c4));
+show create table t1;
+# Some simple tests.
+alter table t1 drop index c1;
+alter table t1 add index (c1);
+# This creates index 'c1_2'.
+alter table t1 add index (c1);
+alter table t1 drop index i3;
+alter table t1 add index i3 (c3);
+# Two indexes at the same time.
+alter table t1 drop index i2, drop index i4;
+alter table t1 add index i2 (c2), add index i4 (c4);
+# Three indexes, one of them reversely.
+alter table t1 drop index i2, drop index i4, add index i6 (c2, c4);
+alter table t1 add index i2 (c2), add index i4 (c4), drop index i6;
+# include an unique index.
+alter table t1 drop index i2, drop index i4, add unique i4 (c4);
+alter table t1 add index i2 (c2), drop index i4, add index i4 (c4);
+# Modify an index by changing its definition.
+alter table t1 drop index c2, add index (c2(4),c3(7));
+# Change nothing. The new key definition is the same as the old one.
+alter table t1 drop index c2, add index (c2(4),c3(7));
+# Test primary key handling.
+alter table t1 add primary key (c1, c2), drop primary key;
+alter table t1 drop primary key;
+# Drop is checked first. Primary key must exist.
+--error 1091
+alter table t1 add primary key (c1, c2), drop primary key;
+show create table t1;
+# Insert non-unique values.
+insert into t1 values(1, 'a', 'a', NULL);
+insert into t1 values(1, 'b', 'b', NULL);
+# Drop some indexes for new adds.
+alter table t1 drop index i3, drop index i2, drop index i1;
+# Add indexes, one is unique on non-unique values.
+--error 1062
+alter table t1 add index i3 (c3), add index i2 (c2), add unique index i1 (c1);
+drop table t1;
+
diff --git a/mysql-test/t/keywords.test b/mysql-test/t/keywords.test
index de0159a950e..1af4a1354be 100644
--- a/mysql-test/t/keywords.test
+++ b/mysql-test/t/keywords.test
@@ -19,3 +19,27 @@ select events.binlog from events;
drop table events;
# End of 4.1 tests
+
+#
+# Bug#19939 "AUTHORS is not a keyword"
+#
+delimiter |;
+create procedure p1()
+begin
+ declare n int default 2;
+ authors: while n > 0 do
+ set n = n -1;
+ end while authors;
+end|
+create procedure p2()
+begin
+ declare n int default 2;
+ contributors: while n > 0 do
+ set n = n -1;
+ end while contributors;
+end|
+delimiter ;|
+drop procedure p1;
+drop procedure p2;
+
+# End of 5.1 tests
diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test
index f8ba649b3eb..53a88df7bd9 100644
--- a/mysql-test/t/kill.test
+++ b/mysql-test/t/kill.test
@@ -48,7 +48,7 @@ select 4;
drop table t1;
connection default;
---error 1064
+--error ER_NOT_SUPPORTED_YET
kill (select count(*) from mysql.user);
#
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index 27c8005ca0c..aff5efa51cb 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -92,6 +92,10 @@ load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, @b);
select * from t1;
select @a, @b;
truncate table t1;
+# Reading of all columns with set
+load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 set c=b;
+select * from t1;
+truncate table t1;
# now going to test fixed field-row file format
load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c="Wow";
select * from t1;
@@ -114,3 +118,27 @@ select * from t1;
drop table t1, t2;
# End of 5.0 tests
+
+
+#
+# Bug#12448 LOAD DATA / SELECT INTO OUTFILE
+# doesn't work with multibyte path name
+#
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (1);
+SET NAMES latin1;
+SET character_set_filesystem=filename;
+select @@character_set_filesystem;
+SELECT * INTO OUTFILE 't-1' FROM t1;
+DELETE FROM t1;
+LOAD DATA INFILE 't-1' INTO TABLE t1;
+SELECT * FROM t1;
+DELETE FROM t1;
+SET character_set_filesystem=latin1;
+select @@character_set_filesystem;
+LOAD DATA INFILE 't@002d1' INTO TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+--exec rm $MYSQLTEST_VARDIR/master-data/test/t@002d1
+SET character_set_filesystem=default;
+select @@character_set_filesystem;
diff --git a/mysql-test/t/lock.test b/mysql-test/t/lock.test
index 8300219b3d4..fb5e45433e9 100644
--- a/mysql-test/t/lock.test
+++ b/mysql-test/t/lock.test
@@ -93,3 +93,18 @@ delete t2 from t1,t2 where t1.a=t2.a;
drop table t1,t2;
# End of 4.1 tests
+
+#
+# Bug#18884 "lock table + global read lock = crash"
+# The bug is not repeatable, just add the test case.
+#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1 (a int);
+lock table t1 write;
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
+flush tables with read lock;
+unlock tables;
+drop table t1;
+
diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test
index 33e268ccb11..765da1ee18d 100644
--- a/mysql-test/t/lock_multi.test
+++ b/mysql-test/t/lock_multi.test
@@ -95,6 +95,25 @@ reap;
connection locker;
drop table t1;
+#
+# Same test as above, but with the dropped table locked twice
+#
+
+connection locker;
+create table t1 (a int);
+create table t2 (a int);
+lock table t1 write, t2 write, t1 as t1_2 write, t2 as t2_2 write;
+connection reader;
+send insert t1 select * from t2;
+connection locker;
+drop table t2;
+connection reader;
+--error 1146
+reap;
+connection locker;
+drop table t1;
+
+
# End of 4.1 tests
#
@@ -109,40 +128,6 @@ unlock tables;
drop table t1;
#
-# Bug#19815 - CREATE/RENAME/DROP DATABASE can deadlock on a global read lock
-#
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-#
-connection con1;
-CREATE DATABASE mysqltest_1;
-FLUSH TABLES WITH READ LOCK;
-#
-# With bug in place: acquire LOCK_mysql_create_table and
-# wait in wait_if_global_read_lock().
-connection con2;
-send DROP DATABASE mysqltest_1;
---sleep 1
-#
-# With bug in place: try to acquire LOCK_mysql_create_table...
-# When fixed: Reject dropping db because of the read lock.
-connection con1;
---error ER_CANT_UPDATE_WITH_READLOCK
-DROP DATABASE mysqltest_1;
-UNLOCK TABLES;
-#
-connection con2;
-reap;
-#
-connection default;
-disconnect con1;
-disconnect con2;
-# This must have been dropped by connection 2 already,
-# which waited until the global read lock was released.
---error ER_DB_DROP_EXISTS
-DROP DATABASE mysqltest_1;
-
-#
# Bug#16986 - Deadlock condition with MyISAM tables
#
connection locker;
@@ -222,6 +207,40 @@ connection default;
DROP TABLE t1;
#
+# Bug#19815 - CREATE/RENAME/DROP DATABASE can deadlock on a global read lock
+#
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+#
+connection con1;
+CREATE DATABASE mysqltest_1;
+FLUSH TABLES WITH READ LOCK;
+#
+# With bug in place: acquire LOCK_mysql_create_table and
+# wait in wait_if_global_read_lock().
+connection con2;
+send DROP DATABASE mysqltest_1;
+--sleep 1
+#
+# With bug in place: try to acquire LOCK_mysql_create_table...
+# When fixed: Reject dropping db because of the read lock.
+connection con1;
+--error ER_CANT_UPDATE_WITH_READLOCK
+DROP DATABASE mysqltest_1;
+UNLOCK TABLES;
+#
+connection con2;
+reap;
+#
+connection default;
+disconnect con1;
+disconnect con2;
+# This must have been dropped by connection 2 already,
+# which waited until the global read lock was released.
+--error ER_DB_DROP_EXISTS
+DROP DATABASE mysqltest_1;
+
+#
# Bug #17264: MySQL Server freeze
#
connection locker;
@@ -251,3 +270,4 @@ connection locker;
drop table t1;
# End of 5.0 tests
+
diff --git a/mysql-test/t/log_state-master.opt b/mysql-test/t/log_state-master.opt
new file mode 100644
index 00000000000..445c6223d47
--- /dev/null
+++ b/mysql-test/t/log_state-master.opt
@@ -0,0 +1 @@
+--log-output=TABLE,FILE --log --general-log=0 --log-slow-queries --slow-query-log=0
diff --git a/mysql-test/t/log_state.test b/mysql-test/t/log_state.test
new file mode 100644
index 00000000000..6fc0f3421a7
--- /dev/null
+++ b/mysql-test/t/log_state.test
@@ -0,0 +1,123 @@
+-- source include/not_embedded.inc
+--source include/have_csv.inc
+
+--disable_ps_protocol
+set global general_log= OFF;
+truncate table mysql.general_log;
+truncate table mysql.slow_log;
+show global variables
+where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
+Variable_name = 'general_log' or Variable_name = 'slow_query_log';
+flush logs;
+set global general_log= ON;
+create table t1(f1 int);
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
+select * from mysql.general_log;
+set global general_log= OFF;
+drop table t1;
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
+select * from mysql.general_log;
+set global general_log= ON;
+flush logs;
+show global variables
+where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
+Variable_name = 'general_log' or Variable_name = 'slow_query_log';
+
+connect (con1,localhost,root,,);
+connection con1;
+set session long_query_time=1;
+select sleep(2);
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME
+select * from mysql.slow_log;
+connection default;
+
+set global slow_query_log= ON;
+connection con1;
+set session long_query_time=1;
+select sleep(2);
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME
+select * from mysql.slow_log;
+disconnect con1;
+connection default;
+show global variables
+where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
+Variable_name = 'general_log' or Variable_name = 'slow_query_log';
+
+set global general_log= ON;
+set global general_log= OFF;
+set global general_log= OFF;
+set global slow_query_log= ON;
+set global slow_query_log= OFF;
+set global slow_query_log= OFF;
+
+set global general_log= ON;
+truncate table mysql.general_log;
+create table t1(f1 int);
+drop table t1;
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
+select * from mysql.general_log;
+set global general_log= OFF;
+truncate table mysql.general_log;
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
+select * from mysql.general_log;
+set global general_log= ON;
+show global variables
+where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
+Variable_name = 'general_log' or Variable_name = 'slow_query_log';
+
+--replace_column 2 #
+show variables like 'general_log_file';
+--replace_column 2 #
+show variables like 'slow_query_log_file';
+show variables like 'log_output';
+
+--error 1231
+set global general_log_file='/not exiting path/log.master';
+--error 1231
+set global general_log_file='/tmp';
+--error 1231
+set global general_log_file='';
+--replace_column 2 #
+show variables like 'general_log_file';
+set global general_log= OFF;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval set global general_log_file='$MYSQLTEST_VARDIR/tmp/log.master';
+set global general_log= ON;
+create table t1(f1 int);
+drop table t1;
+set global general_log= OFF;
+set global general_log_file=default;
+set global general_log= ON;
+create table t1(f1 int);
+drop table t1;
+--replace_column 2 #
+show variables like 'general_log_file';
+--replace_column 2 #
+show variables like 'slow_query_log_file';
+
+set global general_log= default;
+set global slow_query_log= default;
+set global general_log_file= default;
+set global slow_query_log_file= default;
+show variables like 'general_log';
+show variables like 'slow_query_log';
+set global general_log=ON;
+set global log_output=default;
+show variables like 'log_output';
+set global general_log=OFF;
+set global log_output=FILE;
+truncate table mysql.general_log;
+show variables like 'log_output';
+set global general_log=ON;
+create table t1(f1 int);
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
+select * from mysql.general_log;
+set global general_log=OFF;
+set global log_output="FILE,TABLE";
+show variables like 'log_output';
+set global general_log=ON;
+drop table t1;
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
+select * from mysql.general_log;
+
+--enable_ps_protocol
diff --git a/mysql-test/t/log_tables-master.opt b/mysql-test/t/log_tables-master.opt
new file mode 100644
index 00000000000..35ff7911705
--- /dev/null
+++ b/mysql-test/t/log_tables-master.opt
@@ -0,0 +1 @@
+--log-slow-queries
diff --git a/mysql-test/t/log_tables.test b/mysql-test/t/log_tables.test
new file mode 100644
index 00000000000..f1ff91a6d1d
--- /dev/null
+++ b/mysql-test/t/log_tables.test
@@ -0,0 +1,404 @@
+# this test needs multithreaded mysqltest
+-- source include/not_embedded.inc
+#
+# Basic log tables test
+#
+
+# check that CSV engine was compiled in
+--source include/have_csv.inc
+
+--disable_ps_protocol
+use mysql;
+
+#
+# Check that log tables work and we can do basic selects. This also
+# tests truncate, which works in a special mode with the log tables
+#
+
+truncate table general_log;
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 THREAD_ID
+select * from general_log;
+truncate table slow_log;
+--replace_column 1 TIMESTAMP 2 USER_HOST
+select * from slow_log;
+
+#
+# We want to check that a record newly written to a log table shows up for
+# the query: since log tables use concurrent insert machinery and log tables
+# are always locked by artificial THD, this feature requires additional
+# check in ha_tina::write_row. This simple test should prove that the
+# log table flag in the table handler is triggered and working.
+#
+
+truncate table general_log;
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 THREAD_ID
+select * from general_log where argument like '%general_log%';
+
+
+#
+# Check some basic queries interfering with the log tables.
+# In our test we'll use a tbale with verbose comments to the short
+# command type names, used in the tables
+#
+
+create table join_test (verbose_comment varchar (80), command_type varchar(64));
+
+insert into join_test values ("User performed a usual SQL query", "Query");
+insert into join_test values ("New DB connection was registered", "Connect");
+insert into join_test values ("Get the table info", "Field List");
+
+--replace_column 2 USER_HOST
+select verbose_comment, user_host, argument
+ from mysql.general_log join join_test
+ on (mysql.general_log.command_type = join_test.command_type);
+
+drop table join_test;
+
+#
+# check that flush of the log table work fine
+#
+
+flush logs;
+
+#
+# check locking of the log tables
+#
+
+--error ER_CANT_WRITE_LOCK_LOG_TABLE
+lock tables mysql.general_log WRITE;
+
+--error ER_CANT_WRITE_LOCK_LOG_TABLE
+lock tables mysql.slow_log WRITE;
+
+#
+# This attemts to get TL_READ_NO_INSERT lock, which is incompatible with
+# TL_WRITE_CONCURRENT_INSERT. This should fail. We issue this error as log
+# tables are always opened and locked by the logger.
+#
+
+--error ER_CANT_READ_LOCK_LOG_TABLE
+lock tables mysql.general_log READ;
+
+--error ER_CANT_READ_LOCK_LOG_TABLE
+lock tables mysql.slow_log READ;
+
+#
+# This call should result in TL_READ lock on the log table. This is ok and
+# should pass.
+#
+
+lock tables mysql.slow_log READ LOCAL, mysql.general_log READ LOCAL;
+
+unlock tables;
+
+#
+# check that FLUSH LOGS waits for all readers of the log table to vanish
+#
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+connection con1;
+
+lock tables mysql.general_log READ LOCAL;
+
+connection con2;
+
+# this should wait for log tables to unlock
+send flush logs;
+
+connection con1;
+
+unlock tables;
+
+# this connection should be alive by the time
+connection con2;
+
+reap;
+
+select "Mark that we woke up from flush logs in the test"
+ as "test passed";
+
+#
+# perform the same check for TRUNCATE: it should also wait for readers
+# to disappear
+#
+
+connection con1;
+
+lock tables mysql.general_log READ LOCAL;
+
+connection con2;
+
+# this should wait for log tables to unlock
+send truncate mysql.general_log;
+
+connection con1;
+
+unlock tables;
+
+# this connection should be alive by the time
+connection con2;
+
+reap;
+
+select "Mark that we woke up from TRUNCATE in the test"
+ as "test passed";
+
+connection con1;
+
+use test;
+
+#
+# Bug #16905 Log tables: unicode statements are logged incorrectly
+#
+
+truncate table mysql.general_log;
+set names utf8;
+create table bug16905 (s char(15) character set utf8 default 'пусто');
+insert into bug16905 values ('новое');
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 THREAD_ID
+select * from mysql.general_log;
+drop table bug16905;
+
+#
+# Bug #17600: Invalid data logged into mysql.slow_log
+#
+
+truncate table mysql.slow_log;
+set session long_query_time=1;
+select sleep(2);
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME
+select * from mysql.slow_log;
+
+#
+# Bug #18559 log tables cannot change engine, and gets deadlocked when
+# dropping w/ log on
+#
+
+# check that appropriate error messages are given when one attempts to alter
+# or drop a log tables, while corresponding logs are enabled
+--error ER_BAD_LOG_STATEMENT
+alter table mysql.general_log engine=myisam;
+--error ER_BAD_LOG_STATEMENT
+alter table mysql.slow_log engine=myisam;
+
+--error ER_BAD_LOG_STATEMENT
+drop table mysql.general_log;
+--error ER_BAD_LOG_STATEMENT
+drop table mysql.slow_log;
+
+# check that one can alter log tables to MyISAM
+set global general_log='OFF';
+
+# cannot convert another log table
+--error ER_BAD_LOG_STATEMENT
+alter table mysql.slow_log engine=myisam;
+
+# alter both tables
+set global slow_query_log='OFF';
+# check that both tables use CSV engine
+show create table mysql.general_log;
+show create table mysql.slow_log;
+
+alter table mysql.general_log engine=myisam;
+alter table mysql.slow_log engine=myisam;
+
+# check that the tables were converted
+show create table mysql.general_log;
+show create table mysql.slow_log;
+
+# enable log tables and chek that new tables indeed work
+set global general_log='ON';
+set global slow_query_log='ON';
+
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 THREAD_ID
+select * from mysql.general_log;
+
+# check that flush of myisam-based log tables work fine
+flush logs;
+
+# check locking of myisam-based log tables
+
+--error ER_CANT_WRITE_LOCK_LOG_TABLE
+lock tables mysql.general_log WRITE;
+
+--error ER_CANT_WRITE_LOCK_LOG_TABLE
+lock tables mysql.slow_log WRITE;
+
+#
+# This attemts to get TL_READ_NO_INSERT lock, which is incompatible with
+# TL_WRITE_CONCURRENT_INSERT. This should fail. We issue this error as log
+# tables are always opened and locked by the logger.
+#
+
+--error ER_CANT_READ_LOCK_LOG_TABLE
+lock tables mysql.general_log READ;
+
+--error ER_CANT_READ_LOCK_LOG_TABLE
+lock tables mysql.slow_log READ;
+
+#
+# This call should result in TL_READ lock on the log table. This is ok and
+# should pass.
+#
+
+lock tables mysql.slow_log READ LOCAL, mysql.general_log READ LOCAL;
+
+unlock tables;
+
+# check that we can drop them
+set global general_log='OFF';
+set global slow_query_log='OFF';
+
+# check that alter table doesn't work for other engines
+--error ER_UNSUPORTED_LOG_ENGINE
+alter table mysql.slow_log engine=ndb;
+--error ER_UNSUPORTED_LOG_ENGINE
+alter table mysql.slow_log engine=innodb;
+--error ER_UNSUPORTED_LOG_ENGINE
+alter table mysql.slow_log engine=archive;
+--error ER_UNSUPORTED_LOG_ENGINE
+alter table mysql.slow_log engine=blackhole;
+
+drop table mysql.slow_log;
+drop table mysql.general_log;
+
+# check that table share cleanup is performed correctly (double drop)
+
+--error ER_BAD_TABLE_ERROR
+drop table mysql.general_log;
+--error ER_BAD_TABLE_ERROR
+drop table mysql.slow_log;
+
+# recreate tables and enable logs
+
+use mysql;
+
+CREATE TABLE `general_log` (
+ `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+ ON UPDATE CURRENT_TIMESTAMP,
+ `user_host` mediumtext,
+ `thread_id` int(11) DEFAULT NULL,
+ `server_id` int(11) DEFAULT NULL,
+ `command_type` varchar(64) DEFAULT NULL,
+ `argument` mediumtext
+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log';
+
+CREATE TABLE `slow_log` (
+ `start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+ ON UPDATE CURRENT_TIMESTAMP,
+ `user_host` mediumtext NOT NULL,
+ `query_time` time NOT NULL,
+ `lock_time` time NOT NULL,
+ `rows_sent` int(11) NOT NULL,
+ `rows_examined` int(11) NOT NULL,
+ `db` varchar(512) DEFAULT NULL,
+ `last_insert_id` int(11) DEFAULT NULL,
+ `insert_id` int(11) DEFAULT NULL,
+ `server_id` int(11) DEFAULT NULL,
+ `sql_text` mediumtext NOT NULL
+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
+
+set global general_log='ON';
+set global slow_query_log='ON';
+use test;
+
+#
+# Bug #20139 Infinite loop after "FLUSH" and "LOCK tabX, general_log"
+#
+
+flush tables with read lock;
+unlock tables;
+use mysql;
+lock tables general_log read local, help_category read local;
+unlock tables;
+
+#
+# Bug #17544 Cannot do atomic log rotate and
+# Bug #21785 Server crashes after rename of the log table
+#
+
+use mysql;
+# Should result in error
+--error ER_CANT_RENAME_LOG_TABLE
+RENAME TABLE general_log TO renamed_general_log;
+--error ER_CANT_RENAME_LOG_TABLE
+RENAME TABLE slow_log TO renamed_slow_log;
+
+#check rotate logs
+truncate table general_log;
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 THREAD_ID
+select * from general_log;
+
+truncate table slow_log;
+--replace_column 1 TIMESTAMP 2 USER_HOST
+select * from slow_log;
+
+create table general_log_new like general_log;
+rename table general_log TO renamed_general_log, general_log_new TO general_log;
+
+create table slow_log_new like slow_log;
+rename table slow_log TO renamed_slow_log, slow_log_new TO slow_log;
+
+# check that rename checks more then first table in the list
+--error ER_CANT_RENAME_LOG_TABLE
+rename table general_log TO general_log_new, renamed_general_log TO general_log, slow_log to renamed_slow_log;
+
+# now check the content of tables
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 THREAD_ID
+select * from general_log;
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 THREAD_ID
+select * from renamed_general_log;
+
+# the content of the slow log is empty, but we will try a select anyway
+--replace_column 1 TIMESTAMP 2 USER_HOST
+select * from slow_log;
+--replace_column 1 TIMESTAMP 2 USER_HOST
+select * from renamed_slow_log;
+
+# check that we can do whatever we want with disabled log
+set global general_log='OFF';
+RENAME TABLE general_log TO general_log2;
+
+set global slow_query_log='OFF';
+RENAME TABLE slow_log TO slow_log2;
+
+# this should fail
+--error ER_CANT_ACTIVATE_LOG
+set global general_log='ON';
+--error ER_CANT_ACTIVATE_LOG
+set global slow_query_log='ON';
+
+RENAME TABLE general_log2 TO general_log;
+RENAME TABLE slow_log2 TO slow_log;
+
+# this should work
+set global general_log='ON';
+set global slow_query_log='ON';
+# now check flush logs
+flush logs;
+flush logs;
+drop table renamed_general_log, renamed_slow_log;
+use test;
+
+#
+# Bug #21966 Strange warnings on repair of the log tables
+#
+
+use mysql;
+# check that no warning occurs on repair of the log tables
+repair table general_log;
+repair table slow_log;
+# check that no warning occurs on "create like" for the log tables
+create table general_log_new like general_log;
+create table slow_log_new like slow_log;
+show tables like "%log%";
+drop table slow_log_new, general_log_new;
+use test;
+
+# kill all connections
+disconnect con1;
+disconnect con2;
+--enable_ps_protocol
+
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index 1308b0b83a4..5498468d902 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -51,6 +51,9 @@ create table t4 (a int not null, b char(10), key(a)) engine=MERGE UNION=(t1,t2);
select * from t4;
--error 1168
alter table t4 add column c int;
+flush tables;
+--error 1168
+select * from t4;
#
# Test tables in different databases
@@ -121,6 +124,7 @@ drop table t3,t2,t1;
# Test table without unions
#
create table t1 (a int not null, key(a)) engine=merge;
+--error 1030
select * from t1;
drop table t1;
diff --git a/mysql-test/t/mix2_myisam.test b/mysql-test/t/mix2_myisam.test
new file mode 100644
index 00000000000..afb3caca0ea
--- /dev/null
+++ b/mysql-test/t/mix2_myisam.test
@@ -0,0 +1,26 @@
+# t/mix2_myisam.test
+#
+# Last update: 2006-07-26 ML create this test as derivate from innodb.test
+#
+
+let $engine_type= MyISAM;
+let $other_engine_type= MEMORY;
+# There are unfortunately only MyISAM and MEMORY all time available
+# Therefore use here MEMORY again.
+let $other_engine_type1= MEMORY;
+let $other_non_trans_engine_type= MEMORY;
+let $other_non_live_chks_engine_type= MEMORY;
+# Therefore use here MyISAM again.
+let $other_live_chks_engine_type= MyISAM;
+# MyISAM does not support transactions
+let $test_transactions= 0;
+# MyISAM does not support FOREIGN KEYFOREIGN KEYs
+let $test_foreign_keys= 0;
+# MyISAM supports fulltext queries
+let $fulltext_query_unsupported= 0;
+# MyISAM internal autoincrement values are updated during updates
+let $no_autoinc_update= 0;
+# MyISAM supports keys on spatial data types
+let $no_spatial_key= 0;
+
+-- source include/mix2.inc
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index da19a18c73a..9cd93f2c7dd 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -485,7 +485,7 @@ delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
drop table t1,t2;
--disable_warnings
-create table t1 ( c char(8) not null ) engine=bdb;
+create table t1 ( c char(8) not null ) engine=innodb;
--enable_warnings
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
@@ -503,6 +503,11 @@ delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
drop table t1,t2;
+#
+# Test alter table and a concurrent multi update
+# (This will force update to reopen tables)
+#
+
create table t1 (a int, b int);
insert into t1 values (1, 2), (2, 3), (3, 4);
create table t2 (a int);
@@ -519,6 +524,7 @@ send alter table t1 add column c int default 100 after a;
connect (updater,localhost,root,,test);
connection updater;
+sleep 2;
send update t1, v1 set t1.b=t1.a+t1.b+v1.b where t1.a=v1.a;
connection locker;
@@ -534,3 +540,33 @@ select * from t1;
select * from t2;
drop view v1;
drop table t1, t2;
+
+#
+# Test multi updates and deletes using primary key and without.
+#
+create table t1 (i1 int, i2 int, i3 int);
+create table t2 (id int, c1 varchar(20), c2 varchar(20));
+insert into t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2);
+insert into t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test");
+select * from t1 order by i1;
+select * from t2;
+update t1,t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id;
+select * from t1 order by i1;
+select * from t2 order by id;
+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;
+create table t1 (i1 int auto_increment not null, i2 int, i3 int, primary key (i1));
+create table t2 (id int auto_increment not null, c1 varchar(20), c2 varchar(20), primary key(id));
+insert into t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2);
+insert into t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test");
+select * from t1 order by i1;
+select * from t2 order by id;
+update t1,t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id;
+select * from t1 order by i1;
+select * from t2 order by id;
+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;
diff --git a/mysql-test/t/myisam-system.test b/mysql-test/t/myisam-system.test
new file mode 100644
index 00000000000..43fbaabf698
--- /dev/null
+++ b/mysql-test/t/myisam-system.test
@@ -0,0 +1,21 @@
+#
+# Test how DROP TABLE works if the index or data file doesn't exists
+
+# Initialise
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+create table t1 (a int) engine=myisam;
+system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
+drop table if exists t1;
+create table t1 (a int) engine=myisam;
+system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
+--error 1051,6
+drop table t1;
+create table t1 (a int) engine=myisam;
+system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYD ;
+--error 1105,6,29
+drop table t1;
+--error 1051
+drop table t1;
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index d785002abdd..5a663718878 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -873,23 +873,6 @@ create table t1 (v varchar(65535));
eval set storage_engine=$default;
#
-# Test how DROP TABLE works if the index or data file doesn't exists
-
-create table t1 (a int) engine=myisam;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
-drop table if exists t1;
-create table t1 (a int) engine=myisam;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
---error 1051,6
-drop table t1;
-create table t1 (a int) engine=myisam;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYD ;
---error 1105,6,29
-drop table t1;
---error 1051
-drop table t1;
-
-#
# Test concurrent insert
# First with static record length
#
@@ -959,16 +942,6 @@ alter table t1 enable keys;
show keys from t1;
drop table t1;
-
-#
-# Bug#10056 - PACK_KEYS option take values greater than 1 while creating table
-#
-create table t1 (c1 int) engine=myisam pack_keys=0;
-create table t2 (c1 int) engine=myisam pack_keys=1;
-create table t3 (c1 int) engine=myisam pack_keys=default;
---error 1064
-create table t4 (c1 int) engine=myisam pack_keys=2;
-drop table t1, t2, t3;
#
# Bug#8706 - temporary table with data directory option fails
#
@@ -1004,4 +977,81 @@ connection default;
select * from t1;
drop table t1;
-# End of 4.1 tests
+--echo End of 4.1 tests
+
+#
+# Bug#10056 - PACK_KEYS option take values greater than 1 while creating table
+#
+create table t1 (c1 int) engine=myisam pack_keys=0;
+create table t2 (c1 int) engine=myisam pack_keys=1;
+create table t3 (c1 int) engine=myisam pack_keys=default;
+--error 1064
+create table t4 (c1 int) engine=myisam pack_keys=2;
+drop table t1, t2, t3;
+
+--echo End of 5.0 tests
+
+#
+# Test of key_block_size
+#
+
+create table t1 (a int not null, key `a` (a) key_block_size=1024);
+show create table t1;
+drop table t1;
+
+create table t1 (a int not null, key `a` (a) key_block_size=2048);
+show create table t1;
+drop table t1;
+
+create table t1 (a varchar(2048), key `a` (a));
+show create table t1;
+drop table t1;
+
+create table t1 (a varchar(2048), key `a` (a) key_block_size=1024);
+show create table t1;
+drop table t1;
+
+create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=1024;
+show create table t1;
+alter table t1 key_block_size=2048;
+show create table t1;
+alter table t1 add c int, add key (c);
+show create table t1;
+alter table t1 key_block_size=0;
+alter table t1 add d int, add key (d);
+show create table t1;
+drop table t1;
+
+create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=8192;
+show create table t1;
+drop table t1;
+
+create table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) key_block_size=8192;
+show create table t1;
+drop table t1;
+
+create table t1 (a int not null, b int, key (a) key_block_size=1024, key(b) key_block_size=8192) key_block_size=16384;
+show create table t1;
+drop table t1;
+
+
+# Test limits and errors of key_block_size
+
+create table t1 (a int not null, key `a` (a) key_block_size=512);
+show create table t1;
+drop table t1;
+
+create table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000);
+show create table t1;
+drop table t1;
+
+create table t1 (a int not null, key `a` (a) key_block_size=1025);
+show create table t1;
+drop table t1;
+
+--error 1064
+create table t1 (a int not null, key key_block_size=1024 (a));
+--error 1064
+create table t1 (a int not null, key `a` key_block_size=1024 (a));
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/mysql_client_test-master.opt b/mysql-test/t/mysql_client_test-master.opt
new file mode 100644
index 00000000000..3711946168d
--- /dev/null
+++ b/mysql-test/t/mysql_client_test-master.opt
@@ -0,0 +1 @@
+--log --log-output=FILE
diff --git a/mysql-test/t/mysql_client_test.opt b/mysql-test/t/mysql_client_test.opt
deleted file mode 100644
index 968ba95c6cc..00000000000
--- a/mysql-test/t/mysql_client_test.opt
+++ /dev/null
@@ -1 +0,0 @@
---log
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index 0691cb7c76b..8e2035f45b0 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -1,4 +1,6 @@
# We are using .opt file since we need small binlog size
+# TODO: Need to look at making a row based version once the new row based client is completed. [jbm]
+-- source include/have_binlog_format_mixed_or_statement.inc
# Embedded server doesn't support binlogging
-- source include/not_embedded.inc
@@ -63,7 +65,7 @@ select "--- --database --" as "";
select "--- --position --" as "";
--enable_query_log
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=231 $MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=235 $MYSQLTEST_VARDIR/log/master-bin.000002
# These are tests for remote binlog.
# They should return the same as previous test.
@@ -95,7 +97,7 @@ select "--- --database --" as "";
select "--- --position --" as "";
--enable_query_log
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=231 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=235 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
# Bug#7853 (mysqlbinlog does not accept input from stdin)
--disable_query_log
diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test
index 6afae538f04..69cd5d90453 100644
--- a/mysql-test/t/mysqlbinlog2.test
+++ b/mysql-test/t/mysqlbinlog2.test
@@ -1,6 +1,9 @@
# Test for the new options --start-datetime, stop-datetime,
# and a few others.
+# TODO: Need to look at making row based version once new binlog client is complete.
+-- source include/have_binlog_format_mixed_or_statement.inc
+
# Embedded server doesn't support binlogging
-- source include/not_embedded.inc
@@ -49,11 +52,11 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=600 $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --start-position=604 $MYSQLTEST_VARDIR/log/master-bin.000001
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=600 $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --stop-position=604 $MYSQLTEST_VARDIR/log/master-bin.000001
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
@@ -78,11 +81,11 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=600 $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --start-position=604 $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=126 $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --stop-position=130 $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
@@ -105,11 +108,11 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=600 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+--exec $MYSQL_BINLOG --short-form --start-position=604 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=600 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+--exec $MYSQL_BINLOG --short-form --stop-position=604 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
@@ -132,11 +135,11 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=600 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
+--exec $MYSQL_BINLOG --short-form --start-position=604 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=126 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
+--exec $MYSQL_BINLOG --short-form --stop-position=130 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
diff --git a/mysql-test/t/mysqlbinlog_base64.test b/mysql-test/t/mysqlbinlog_base64.test
new file mode 100644
index 00000000000..66aaff83254
--- /dev/null
+++ b/mysql-test/t/mysqlbinlog_base64.test
@@ -0,0 +1,38 @@
+-- source include/have_binlog_format_row.inc
+#
+# Write different events to binlog
+#
+create table t1 (a int);
+insert into t1 values (1);
+insert into t1 values (2);
+insert into t1 values (3);
+update t1 set a=a+2 where a=2;
+update t1 set a=a+2 where a=3;
+
+create table t2 (word varchar(20));
+load data infile '../std_data_ln/words.dat' into table t2;
+
+#
+# Save binlog
+#
+--exec $MYSQL_BINLOG --hexdump $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
+
+#
+# Clear database and restore from binlog
+#
+drop table t1;
+drop table t2;
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
+
+#
+# Verify that all binlog events have been executed
+#
+select * from t1;
+select * from t2;
+
+#
+# Test cleanup
+#
+--exec rm $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
+drop table t1;
+drop table t2;
diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test
index 338e16363ea..074faa48021 100644
--- a/mysql-test/t/mysqlcheck.test
+++ b/mysql-test/t/mysqlcheck.test
@@ -1,6 +1,17 @@
# Embedded server doesn't support external clients
--source include/not_embedded.inc
+# check that CSV engine was compiled in, as the result of the test
+# depends on the presence of the log tables (which are CSV-based).
+--source include/have_csv.inc
+
+--disable_warnings
+drop database if exists client_test_db;
+--enable_warnings
+
+DROP SCHEMA test;
+CREATE SCHEMA test;
+use test;
#
# Bug #13783 mysqlcheck tries to optimize and analyze information_schema
#
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 5e604061744..99e8e48df1f 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -11,7 +11,7 @@ drop view if exists v1, v2, v3;
# XML output
-CREATE TABLE t1(a int);
+CREATE TABLE t1(a int, key (a)) key_block_size=1024;
INSERT INTO t1 VALUES (1), (2);
--exec $MYSQL_DUMP --skip-create --skip-comments -X test t1
DROP TABLE t1;
@@ -775,9 +775,10 @@ drop table t1, t2;
drop database db1;
use test;
-#
-# dump of view
-#
+--echo #
+--echo # dump of view
+--echo #
+
create table t1(a int);
create view v1 as select * from t1;
--exec $MYSQL_DUMP --skip-comments test
@@ -958,7 +959,7 @@ CREATE FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11) RETURN a+b //
CREATE PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT)
BEGIN SELECT a+b INTO c; end //
-create function bug9056_func2(f1 char binary) returns char binary
+create function bug9056_func2(f1 char binary) returns char
begin
set f1= concat( 'hello', f1 );
return f1;
@@ -1061,7 +1062,6 @@ create view v2 as select * from v0;
select * from v2;
--exec $MYSQL_DUMP -x --skip-comments --databases test
-
drop view v2;
drop view v0;
drop view v1;
@@ -1323,7 +1323,9 @@ grant RELOAD on *.* to mysqltest_1@localhost;
grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
# Execute mysqldump, should now succeed
+--disable_result_log
--exec $MYSQL_DUMP --compact --master-data -u mysqltest_1 test 2>&1
+--enable_result_log
# Clean up
drop table t1;
@@ -1430,3 +1432,118 @@ DROP TABLE t1;
--echo #
--echo # End of 5.0 tests
--echo #
+
+# Check new --replace option
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+CREATE TABLE t1(a int, b int);
+INSERT INTO t1 VALUES (1,1);
+INSERT INTO t1 VALUES (2,3);
+INSERT INTO t1 VALUES (3,4), (4,5);
+--exec $MYSQL_DUMP --replace --skip-comments test t1
+DROP TABLE t1;
+
+#
+# Added for use-thread option
+#
+create table t1 (a text , b text);
+create table t2 (a text , b text);
+insert t1 values ("Duck, Duck", "goose");
+insert t1 values ("Duck, Duck", "pidgeon");
+insert t2 values ("We the people", "in order to perform");
+insert t2 values ("a more perfect", "union");
+select * from t1;
+select * from t2;
+--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ test
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/t1.sql
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/t2.sql
+# The first load tests the pausing code
+--exec $MYSQL_IMPORT --use-threads=1 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt
+# Now we test with multiple threads!
+--exec $MYSQL_IMPORT --silent --use-threads=5 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt
+select * from t1;
+select * from t2;
+# Now we test with multiple threads, but less threads than files.
+create table words(a varchar(255));
+create table words2(b varchar(255));
+--exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data_ln/words.dat $MYSQLTEST_VARDIR/std_data_ln/words2.dat
+select * from t1;
+select * from t2;
+select * from words;
+select * from words2;
+
+# Drop table "words" and run with threads, should fail
+drop table words;
+--replace_regex /.*mysqlimport(\.exe)*/mysql-import/
+--error 1
+--exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data_ln/words.dat $MYSQLTEST_VARDIR/std_data_ln/words2.dat 2>&1
+
+drop table t1;
+drop table t2;
+
+drop table words2;
+
+--echo #
+--echo # BUG# 16853: mysqldump doesn't show events
+--echo #
+
+create database first;
+use first;
+set time_zone = 'UTC';
+
+## prove one works (with spaces and tabs on the end)
+create event ee1 on schedule at '2035-12-31 20:01:23' do set @a=5;
+show events;
+show create event ee1;
+--exec $MYSQL_DUMP --events first > $MYSQLTEST_VARDIR/tmp/bug16853-1.sql
+drop database first;
+
+create database second;
+use second;
+--exec $MYSQL second < $MYSQLTEST_VARDIR/tmp/bug16853-1.sql
+show events;
+show create event ee1;
+
+## prove three works (with spaces and tabs on the end)
+# start with one from the previous restore
+create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5;
+create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5;
+show events;
+--exec $MYSQL_DUMP --events second > $MYSQLTEST_VARDIR/tmp/bug16853-2.sql
+drop database second;
+
+create database third;
+use third;
+--exec $MYSQL third < $MYSQLTEST_VARDIR/tmp/bug16853-2.sql
+show events;
+drop database third;
+
+# revert back to normal settings
+set time_zone = 'SYSTEM';
+use test;
+
+--echo #
+--echo # BUG#17201 Spurious 'DROP DATABASE' in output,
+--echo # also confusion between tables and views.
+--echo # Example code from Markus Popp
+--echo #
+
+create database mysqldump_test_db;
+use mysqldump_test_db;
+create table t1 (id int);
+create view v1 as select * from t1;
+insert into t1 values (1232131);
+insert into t1 values (4711);
+insert into t1 values (3231);
+insert into t1 values (0815);
+--exec $MYSQL_DUMP --skip-comments --add-drop-database --databases mysqldump_test_db
+drop view v1;
+drop table t1;
+drop database mysqldump_test_db;
+
+--echo #
+--echo # End of 5.1 tests
+--echo #
diff --git a/mysql-test/t/mysqlslap.test b/mysql-test/t/mysqlslap.test
new file mode 100644
index 00000000000..01add0d7da8
--- /dev/null
+++ b/mysql-test/t/mysqlslap.test
@@ -0,0 +1,16 @@
+# Can't run test of external client with embedded server
+--source include/not_embedded.inc
+--source include/not_windows.inc
+
+--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=20 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql
+
+--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=20 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --use-threads
+
+--exec $MYSQL_SLAP --only-print --iterations=20 --query="select * from t1" --create="CREATE TABLE t1 (id int, name varchar(64)); INSERT INTO t1 VALUES (1, 'This is a test')" --delimiter=";"
+--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=20 --query="select * from t1" --create="CREATE TABLE t1 (id int, name varchar(64)); INSERT INTO t1 VALUES (1, 'This is a test')" --delimiter=";"
+
+--exec $MYSQL_SLAP --only-print --delimiter=";" --query="select * from t1;select * from t2" --create="CREATE TABLE t1 (id int, name varchar(64)); create table t2(foo1 varchar(32), foo2 varchar(32)); INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2')" --engine="heap,myisam"
+
+--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=20 --delimiter=";" --query="select * from t1;select * from t2" --create="CREATE TABLE t1 (id int, name varchar(64)); create table t2(foo1 varchar(32), foo2 varchar(32)); INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2')"
+
+--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=20 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --create-schema=test_env
diff --git a/mysql-test/t/ndb_alter_table.test b/mysql-test/t/ndb_alter_table.test
index 957b95c6fd9..fde9f1479f8 100644
--- a/mysql-test/t/ndb_alter_table.test
+++ b/mysql-test/t/ndb_alter_table.test
@@ -56,12 +56,12 @@ col3 varchar (20) not null,
col4 varchar(4) not null,
col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
col6 int not null, to_be_deleted int) ENGINE=ndbcluster;
---replace_column 7 # 8 # 10 # 12 # 13 # 14 # 18 #
+--replace_column 6 # 7 # 8 # 10 # 12 # 13 # 14 # 18 #
show table status;
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
insert into t1 values
(0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7);
---replace_column 7 # 8 # 10 # 12 # 13 # 14 # 18 #
+--replace_column 6 # 7 # 8 # 10 # 12 # 13 # 14 # 18 #
show table status;
select * from t1 order by col1;
alter table t1
@@ -70,11 +70,11 @@ add column col7 varchar(30) not null after col5,
add column col8 datetime not null, drop column to_be_deleted,
change column col2 fourth varchar(30) not null after col3,
modify column col6 int not null first;
---replace_column 7 # 8 # 10 # 12 # 13 # 14 # 18 #
+--replace_column 6 # 7 # 8 # 10 # 12 # 13 # 14 # 18 #
show table status;
select * from t1 order by col1;
insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
---replace_column 7 # 8 # 10 # 12 # 13 # 14 # 18 #
+--replace_column 6 # 7 # 8 # 10 # 12 # 13 # 14 # 18 #
show table status;
select * from t1 order by col1;
delete from t1;
@@ -142,23 +142,19 @@ INSERT INTO t1 VALUES (1,2,0),(18,19,4),(20,21,0);
select c from t1 order by c;
drop table t1;
---disable_ps_protocol
-create table t1 ( a int primary key, b varchar(10), c varchar(10), index (b) )
-engine=ndb;
-insert into t1 values (1,'one','one'), (2,'two','two'), (3,'three','three');
-create index c on t1(c);
-connection server2;
-select * from t1 where b = 'two';
-connection server1;
-alter table t1 drop index c;
-connection server2;
-# This should fail since index information is not automatically refreshed
---error 1015
-select * from t1 where b = 'two';
-select * from t1 where b = 'two';
-connection server1;
-drop table t1;
---enable_ps_protocol
+## Test moved to ndb_alter_table_row|stmt respectively as behaviour differs
+#create table t1 ( a int primary key, b varchar(10), c varchar(10), index (b) )
+#engine=ndb;
+#insert into t1 values (1,'one','one'), (2,'two','two'), (3,'three','three');
+#create index c on t1(c);
+#connection server2;
+#select * from t1 where c = 'two';
+#connection server1;
+#alter table t1 drop index c;
+#connection server2;
+#select * from t1 where c = 'two';
+#connection server1;
+#drop table t1;
#--disable_warnings
#DROP TABLE IF EXISTS t2;
@@ -183,29 +179,32 @@ drop table t1;
#select count(*) from t2;
#drop table t2;
-connection server1;
-create table t3 (a int primary key) engine=ndbcluster;
-
-connection server2;
-begin;
-insert into t3 values (1);
-
-connection server1;
-alter table t3 rename t4;
-
-connection server2;
-# This should work as transaction is ongoing...
-delete from t3;
-insert into t3 values (1);
-commit;
-
-# This should fail as its a new transaction
---error 1015
-select * from t3;
-select * from t4;
-drop table t4;
-show tables;
-connection server1;
+## Test moved to ndb_alter_table_row|stmt respectively as behaviour differs
+#connection server1;
+#create table t3 (a int primary key) engine=ndbcluster;
+
+#connection server2;
+#begin;
+#insert into t3 values (1);
+
+#connection server1;
+#alter table t3 rename t4;
+
+#connection server2;
+## with rbr the below will not work as the "alter" event
+## explicitly invalidates the dictionary cache.
+### This should work as transaction is ongoing...
+##delete from t3;
+##insert into t3 values (1);
+#commit;
+
+## This should fail as its a new transaction
+#--error 1146
+#select * from t3;
+#select * from t4;
+#drop table t4;
+#show tables;
+#connection server1;
create table t1 (
ai bigint auto_increment,
@@ -326,6 +325,77 @@ on t1 (c010, c011, c012, c013);
drop table t1;
+# End of 4.1 tests
+
+# On-line alter table
+
+
+CREATE TABLE t1 (
+ auto int(5) unsigned NOT NULL auto_increment,
+ string char(10),
+ vstring varchar(10),
+ bin binary(2),
+ vbin varbinary(7),
+ tiny tinyint(4) DEFAULT '0' NOT NULL ,
+ short smallint(6) DEFAULT '1' NOT NULL ,
+ medium mediumint(8) DEFAULT '0' NOT NULL,
+ long_int int(11) DEFAULT '0' NOT NULL,
+ longlong bigint(13) DEFAULT '0' NOT NULL,
+ real_float float(13,1) DEFAULT 0.0 NOT NULL,
+ real_double double(16,4),
+ real_decimal decimal(16,4),
+ utiny tinyint(3) unsigned DEFAULT '0' NOT NULL,
+ ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
+ umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
+ ulong int(11) unsigned DEFAULT '0' NOT NULL,
+ ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
+ bits bit(3),
+ options enum('zero','one','two','three','four') not null,
+ flags set('zero','one','two','three','four') not null,
+ date_field date,
+ year_field year,
+ time_field time,
+ date_time datetime,
+ time_stamp timestamp,
+ PRIMARY KEY (auto)
+) engine=ndb;
+
+CREATE TEMPORARY TABLE ndb_show_tables (id INT, type VARCHAR(20), state VARCHAR(20), logging VARCHAR(20), _database VARCHAR(255), _schema VARCHAR(20), name VARCHAR(255));
+
+--disable_warnings
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+--enable_warnings
+
+# Ndb doesn't support renaming attributes on-line
+set @t1_id = (select id from ndb_show_tables where name like '%t1%');
+truncate ndb_show_tables;
+
+alter table t1 change tiny new_tiny tinyint(4) DEFAULT '0' NOT NULL;
+--disable_warnings
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+--enable_warnings
+
+select 'no_copy' from ndb_show_tables where id = @t1_id and name like '%t1%';
+
+set @t1_id = (select id from ndb_show_tables where name like '%t1%');
+truncate ndb_show_tables;
+
+create index i1 on t1(medium);
+alter table t1 add index i2(new_tiny);
+drop index i1 on t1;
+
+--disable_warnings
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
+--exec rm $MYSQLTEST_VARDIR/master-data/test/tmp.dat || true
+--enable_warnings
+
+select 'no_copy' from ndb_show_tables where id = @t1_id and name like '%t1%';
+
+DROP TABLE t1, ndb_show_tables;
+
# simple test that auto incr is not lost at rename or alter
create table t1 (a int primary key auto_increment, b int) engine=ndb;
insert into t1 (b) values (101),(102),(103);
@@ -340,6 +410,3 @@ alter table t2 rename t1;
insert into t1 (b) values (401),(402),(403);
select * from t1 where a = 12;
drop table t1;
-
-# End of 4.1 tests
-
diff --git a/mysql-test/t/ndb_alter_table2.test b/mysql-test/t/ndb_alter_table2.test
index 3861fcc6c9d..afe6e44f698 100644
--- a/mysql-test/t/ndb_alter_table2.test
+++ b/mysql-test/t/ndb_alter_table2.test
@@ -72,8 +72,10 @@ CREATE TABLE t1 (
connection server1;
---error 1296
+--disable_result_log
+--error 0,1412
select * from t1;
+--enable_result_log
select * from t1;
select * from t1;
select * from t1;
diff --git a/mysql-test/t/ndb_alter_table3.test b/mysql-test/t/ndb_alter_table3.test
new file mode 100644
index 00000000000..a5fe613adcf
--- /dev/null
+++ b/mysql-test/t/ndb_alter_table3.test
@@ -0,0 +1,49 @@
+-- source include/have_ndb.inc
+-- source include/have_multi_ndb.inc
+-- source include/not_embedded.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+connection server1;
+create table t1 ( a int primary key, b varchar(10), c varchar(10), index (b) )
+engine=ndb;
+insert into t1 values (1,'one','one'), (2,'two','two'), (3,'three','three');
+create index c on t1(c);
+connection server2;
+show indexes from t1;
+select * from t1 where c = 'two';
+connection server1;
+alter table t1 drop index c;
+connection server2;
+show indexes from t1;
+select * from t1 where c = 'two';
+connection server1;
+drop table t1;
+
+connection server1;
+create table t3 (a int primary key) engine=ndbcluster;
+
+connection server2;
+begin;
+insert into t3 values (1);
+
+connection server1;
+alter table t3 rename t4;
+
+connection server2;
+# with rbr the below will not work as the "alter" event
+# explicitly invalidates the dictionary cache.
+## This should work as transaction is ongoing...
+#delete from t3;
+#insert into t3 values (1);
+commit;
+
+# This should fail as its a new transaction
+--error 1146
+select * from t3;
+select * from t4;
+drop table t4;
+show tables;
+connection server1;
diff --git a/mysql-test/t/ndb_autodiscover.test b/mysql-test/t/ndb_autodiscover.test
index 6eb039c2df2..7424687cd8a 100644
--- a/mysql-test/t/ndb_autodiscover.test
+++ b/mysql-test/t/ndb_autodiscover.test
@@ -177,7 +177,7 @@ show status like 'handler_discover%';
flush tables;
system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm ;
---replace_column 7 # 8 # 9 # 12 # 13 # 15 # 18 #
+--replace_column 6 # 7 # 8 # 9 # 12 # 13 # 15 # 18 #
show table status;
show status like 'handler_discover%';
@@ -543,6 +543,6 @@ create table t10 (
insert into t10 values (1, 'kalle');
---exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test `$NDB_TOOLS_DIR/ndb_show_tables --no-defaults | grep BLOB` >> $NDB_TOOLS_OUTPUT 2>&1 || true
+--exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test `$NDB_TOOLS_DIR/ndb_show_tables --no-defaults | grep BLOB | while read a b c d e f g; do echo $g; done` >> $NDB_TOOLS_OUTPUT 2>&1 || true
# End of 4.1 tests
diff --git a/mysql-test/t/ndb_autodiscover3.test b/mysql-test/t/ndb_autodiscover3.test
index 73b4bf8b94f..4c072ada0ec 100644
--- a/mysql-test/t/ndb_autodiscover3.test
+++ b/mysql-test/t/ndb_autodiscover3.test
@@ -2,6 +2,8 @@
-- source include/have_multi_ndb.inc
-- source include/not_embedded.inc
+# see bug#21563
+-- source include/have_binlog_format_row.inc
--disable_warnings
drop table if exists t1, t2;
@@ -18,7 +20,9 @@ insert into t1 values (1);
--exec $NDB_MGM --no-defaults -e "all restart" >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT
-
+# Wait for mysqld to reconnect and exit from readonly mode
+# Should preferrably be a "while (!"select ndb_readonly")" loop
+sleep 2;
--error 1297
insert into t1 values (2);
--error 1296
@@ -36,23 +40,33 @@ select * from t2 order by a limit 3;
--exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT
-
+# to ensure mysqld has connected again, and recreated system tables
+--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -r 30 -d cluster apply_status >> $NDB_TOOLS_OUTPUT
+sleep 2;
--connection server2
+--error ER_NO_SUCH_TABLE
+select * from t2;
+show tables like 't2';
+reset master;
create table t2 (a int key) engine=ndbcluster;
insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
select * from t2 order by a limit 3;
# server 1 should have a stale cache, and in this case wrong frm, transaction must be retried
--connection server1
---error 1015
-select * from t2 order by a limit 3;
select * from t2 order by a limit 3;
+reset master;
--exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT
-
+# to ensure mysqld has connected again, and recreated system tables
+--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -r 30 -d cluster apply_status >> $NDB_TOOLS_OUTPUT
+sleep 2;
--connection server1
-show tables;
+--error ER_NO_SUCH_TABLE
+select * from t2;
+show tables like 't2';
+reset master;
create table t2 (a int key) engine=ndbcluster;
insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
select * from t2 order by a limit 3;
@@ -60,6 +74,7 @@ select * from t2 order by a limit 3;
# server 2 should have a stale cache, but with right frm, transaction need not be retried
--connection server2
select * from t2 order by a limit 3;
+reset master;
drop table t2;
# End of 4.1 tests
diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test
index 6c1a4e44f4b..bbe5d263e36 100644
--- a/mysql-test/t/ndb_basic.test
+++ b/mysql-test/t/ndb_basic.test
@@ -6,6 +6,17 @@ DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
drop database if exists mysqltest;
--enable_warnings
+## workaround for bug#16445
+## remove to reproduce bug and run tests from ndb start
+## and with ndb_autodiscover disabled. Fails on Linux 50 % of the times
+#CREATE TABLE t1 (
+# pk1 INT NOT NULL PRIMARY KEY,
+# attr1 INT NOT NULL,
+# attr2 INT,
+# attr3 VARCHAR(10)
+#) ENGINE=ndbcluster;
+#drop table t1;
+
#
# Basic test to show that the NDB
# table handler is working
@@ -393,7 +404,9 @@ drop table t1;
#
# test the limit of no of attributes in one table
#
-
+# also tests bug#17179, more than 31 attributes in
+# a partitioned table
+#
create table t1 (
c1 int,
c2 int,
@@ -523,7 +536,7 @@ c125 int,
c126 int,
c127 int,
c128 int,
-primary key(c1)) engine=ndb;
+primary key using hash(c1)) engine=ndb partition by key(c1);
drop table t1;
#
@@ -537,6 +550,7 @@ index(a12345678901234567890123456789a1234567890)
) engine=ndb;
show tables;
insert into t1 values (1,1),(2,1),(3,1),(4,1),(5,2),(6,1),(7,1);
+--replace_column 9 #
explain select * from t1 where a12345678901234567890123456789a1234567890=2;
select * from t1 where a12345678901234567890123456789a1234567890=2;
drop table t1;
@@ -700,8 +714,6 @@ select * from t1 order by f1;
select * from t1 order by f2;
select * from t1 order by f3;
drop table t1;
-
-#
# Bug#16561 Unknown ERROR msg "ERROR 1186 (HY000): Binlog closed" by perror
#
@@ -710,3 +722,20 @@ drop table t1;
--error 1
--exec $MY_PERROR --ndb 1186 2>&1
+--echo End of 5.0 tests
+
+#
+# Bug #18483 Cannot create table with FK constraint
+# ndb does not support foreign key constraint, it is silently ignored
+# in line with other storage engines
+#
+CREATE TABLE t1 (a VARCHAR(255) NOT NULL,
+ CONSTRAINT pk_a PRIMARY KEY (a))engine=ndb;
+CREATE TABLE t2(a VARCHAR(255) NOT NULL,
+ b VARCHAR(255) NOT NULL,
+ c VARCHAR(255) NOT NULL,
+ CONSTRAINT pk_b_c_id PRIMARY KEY (b,c),
+ CONSTRAINT fk_a FOREIGN KEY(a) REFERENCES t1(a))engine=ndb;
+drop table t1, t2;
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/ndb_binlog_basic.test b/mysql-test/t/ndb_binlog_basic.test
new file mode 100644
index 00000000000..3886900037d
--- /dev/null
+++ b/mysql-test/t/ndb_binlog_basic.test
@@ -0,0 +1,72 @@
+-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
+
+--disable_warnings
+drop table if exists t1, t2;
+drop database if exists mysqltest;
+create database mysqltest;
+use mysqltest;
+drop database mysqltest;
+use test;
+--enable_warnings
+
+#
+# basic insert, update, delete test, alter, rename, drop
+# check that binlog_index gets the right info
+#
+
+create table t1 (a int primary key) engine=ndb;
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+save_master_pos;
+--replace_column 1 #
+select @max_epoch:=max(epoch)-1 from cluster.binlog_index;
+
+delete from t1;
+alter table t1 add (b int);
+insert into t1 values (3,3),(4,4);
+alter table t1 rename t2;
+
+# get all in one epoch
+begin;
+insert into t2 values (1,1),(2,2);
+update t2 set b=1 where a=3;
+delete from t2 where a=4;
+commit;
+drop table t2;
+
+# check that above is ok
+# (save_master_pos waits for last gcp to complete, ensuring that we have
+# the expected data in the binlog)
+save_master_pos;
+select inserts from cluster.binlog_index where epoch > @max_epoch and inserts > 5;
+select deletes from cluster.binlog_index where epoch > @max_epoch and deletes > 5;
+select inserts,updates,deletes from
+ cluster.binlog_index where epoch > @max_epoch and updates > 0;
+
+#
+# check that purge clears the binlog_index
+#
+flush logs;
+--sleep 1
+purge master logs before now();
+select count(*) from cluster.binlog_index;
+
+#
+# several tables in different databases
+# check that same table name in different databases don't mix up
+#
+create table t1 (a int primary key, b int) engine=ndb;
+create database mysqltest;
+use mysqltest;
+create table t1 (c int, d int primary key) engine=ndb;
+use test;
+
+insert into mysqltest.t1 values (2,1),(2,2);
+save_master_pos;
+--replace_column 1 #
+select @max_epoch:=max(epoch)-1 from cluster.binlog_index;
+
+drop table t1;
+drop database mysqltest;
+select inserts,updates,deletes from
+ cluster.binlog_index where epoch > @max_epoch and inserts > 0;
diff --git a/mysql-test/t/ndb_binlog_basic2.test b/mysql-test/t/ndb_binlog_basic2.test
new file mode 100644
index 00000000000..9fa9f2f965a
--- /dev/null
+++ b/mysql-test/t/ndb_binlog_basic2.test
@@ -0,0 +1,14 @@
+-- source include/have_ndb.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_ddl_multi.test b/mysql-test/t/ndb_binlog_ddl_multi.test
new file mode 100644
index 00000000000..78cec137159
--- /dev/null
+++ b/mysql-test/t/ndb_binlog_ddl_multi.test
@@ -0,0 +1,191 @@
+-- source include/have_ndb.inc
+-- source include/have_multi_ndb.inc
+-- source include/have_binlog_format_row.inc
+
+--disable_warnings
+connection server2;
+drop database if exists mysqltest;
+drop table if exists t1,t2,t3;
+connection server1;
+drop database if exists mysqltest;
+drop table if exists t1,t2,t3;
+--connection server1
+reset master;
+--connection server2
+reset master;
+--enable_warnings
+
+#
+# basic test to see if ddl distribution works across
+# multiple binlogs
+#
+
+# create database
+--connection server1
+create database mysqltest;
+
+# create table
+--connection server1
+use mysqltest;
+create table t1 (a int primary key) engine=ndb;
+
+--connection server2
+create table t2 (a int primary key) engine=ndb;
+--source include/show_binlog_events.inc
+
+--connection server1
+--source include/show_binlog_events.inc
+
+# alter table
+--connection server1
+reset master;
+--connection server2
+reset master;
+
+--connection server2
+alter table t2 add column (b int);
+
+--connections server1
+--source include/show_binlog_events.inc
+
+# alter database
+--connection server1
+reset master;
+--connection server2
+reset master;
+
+--connection server2
+ALTER DATABASE mysqltest CHARACTER SET latin1;
+
+
+# having drop here instead of below sometimes triggers bug#18976
+## drop table and drop should come after data events
+--connection server2
+drop table mysqltest.t1;
+
+--connection server1
+--source include/show_binlog_events.inc
+# to track down bug#18976
+--real_sleep 10
+--source include/show_binlog_events.inc
+
+#--connection server2
+#drop table mysqltest.t1;
+
+# drop database and drop should come after data events
+--connection server1
+reset master;
+--connection server2
+reset master;
+
+--connection server1
+use test;
+insert into t2 values (1,2);
+drop database mysqltest;
+create table t1 (a int primary key) engine=ndb;
+
+--connection server2
+--source include/show_binlog_events.inc
+
+--connection server2
+drop table t2;
+
+# logfile groups and table spaces
+--connection server1
+reset master;
+--connection server2
+reset master;
+
+--connection server1
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE = 4M
+ENGINE=NDB;
+
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M
+ENGINE NDB;
+
+ALTER TABLESPACE ts1
+ADD DATAFILE 'datafile02.dat'
+INITIAL_SIZE = 4M
+ENGINE=NDB;
+
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile.dat'
+ENGINE = NDB;
+
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile02.dat'
+ENGINE = NDB;
+
+DROP TABLESPACE ts1
+ENGINE = NDB;
+
+DROP LOGFILE GROUP lg1
+ENGINE =NDB;
+
+# having drop here instead of below sometimes triggers bug#18976
+#drop table t1;
+
+--connection server2
+--source include/show_binlog_events.inc
+# to track down bug#18976
+--real_sleep 10
+--source include/show_binlog_events.inc
+
+drop table t1;
+
+#
+# Bug #17827 cluster: rename of several tables in one statement,
+# gets multiply logged
+#
+--connection server1
+reset master;
+show tables;
+--connection server2
+reset master;
+show tables;
+
+--connection server1
+create table t1 (a int key) engine=ndb;
+create table t2 (a int key) engine=ndb;
+create table t3 (a int key) engine=ndb;
+rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
+--connection server2
+--source include/show_binlog_events.inc
+
+drop table t1;
+drop table t2;
+drop table t3;
+
+#
+# Bug #17838 binlog not setup on seconday master after rename
+#
+#
+--connection server1
+reset master;
+show tables;
+--connection server2
+reset master;
+show tables;
+
+--connection server1
+create table t1 (a int key) engine=ndb;
+insert into t1 values(1);
+rename table t1 to t2;
+insert into t2 values(2);
+
+# now we should see data in table t1 _and_ t2
+# prior to bug fix, data was missing for t2
+--connection server2
+drop table t2;
+--source include/show_binlog_events.inc
diff --git a/mysql-test/t/ndb_binlog_discover.test b/mysql-test/t/ndb_binlog_discover.test
new file mode 100644
index 00000000000..88126cc1c23
--- /dev/null
+++ b/mysql-test/t/ndb_binlog_discover.test
@@ -0,0 +1,33 @@
+-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Bug #14516 Restart of cluster can cause NDB API replication failure
+#
+create table t1 (a int key) engine=ndb;
+reset master;
+--exec $NDB_MGM --no-defaults -e "all restart -n" > /dev/null
+--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --not-started > /dev/null
+--exec $NDB_MGM --no-defaults -e "all start" > /dev/null
+--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults > /dev/null
+
+--disable_query_log
+let $mysql_errno= 1;
+while ($mysql_errno)
+{
+ # Table t1 is readonly until the mysqld has reconnected properly
+ --error 0,1036,1296
+ insert into t1 values(1);
+ if ($mysql_errno)
+ {
+ --sleep 0.1
+ }
+}
+--enable_query_log
+
+--source include/show_binlog_events.inc
+drop table t1;
diff --git a/mysql-test/t/ndb_binlog_ignore_db-master.opt b/mysql-test/t/ndb_binlog_ignore_db-master.opt
new file mode 100644
index 00000000000..e3947c0eeed
--- /dev/null
+++ b/mysql-test/t/ndb_binlog_ignore_db-master.opt
@@ -0,0 +1 @@
+--binlog-ignore-db=mysqltest
diff --git a/mysql-test/t/ndb_binlog_ignore_db.test b/mysql-test/t/ndb_binlog_ignore_db.test
new file mode 100644
index 00000000000..a4090bbb62b
--- /dev/null
+++ b/mysql-test/t/ndb_binlog_ignore_db.test
@@ -0,0 +1,15 @@
+-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
+
+--disable_warnings
+drop table if exists t1;
+drop database if exists mysqltest;
+--enable_warnings
+
+create database mysqltest;
+use mysqltest;
+create table t1 (a int primary key, b int) engine=ndb;
+insert into t1 values (1, 1);
+-- source include/show_binlog_events.inc
+
+drop database mysqltest;
diff --git a/mysql-test/t/ndb_binlog_multi.test b/mysql-test/t/ndb_binlog_multi.test
new file mode 100644
index 00000000000..e023a54b61c
--- /dev/null
+++ b/mysql-test/t/ndb_binlog_multi.test
@@ -0,0 +1,83 @@
+-- source include/have_ndb.inc
+-- source include/have_multi_ndb.inc
+-- source include/have_binlog_format_row.inc
+
+--disable_warnings
+connection server2;
+drop table if exists t1,t2,t3;
+connection server1;
+drop table if exists t1,t2,t3;
+--enable_warnings
+
+# Dummy table create/drop to avoid a race where table is created
+# before event subscription is set up, causing test failure (BUG#20677).
+connection server2;
+CREATE TABLE t3 (dummy INT PRIMARY KEY) ENGINE = NDB;
+connection server1;
+DROP TABLE t3;
+
+# reset for test
+connection server1;
+reset master;
+connection server2;
+reset master;
+
+#
+# basic test to see if one server sees the table from the other
+# and sets up the replication correctly
+#
+
+# create table on the other server
+connection server2;
+CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB;
+
+# insert something on server2
+INSERT INTO t2 VALUES (1,1),(2,2);
+# verify that we get the data in the binlog
+--source include/show_binlog_events.inc
+select * from t2 order by a;
+--replace_column 1 <the_epoch>
+SELECT @the_epoch:=epoch,inserts,updates,deletes,schemaops FROM
+ cluster.binlog_index ORDER BY epoch DESC LIMIT 1;
+let $the_epoch= `SELECT @the_epoch`;
+
+# see if we got something on server1
+connection server1;
+SELECT * FROM t2 ORDER BY a;
+# doing drop table will ensure that all the events have been received
+DROP TABLE t2;
+# verify thar we have table and data in binlog
+--source include/show_binlog_events.inc
+--replace_result $the_epoch <the_epoch>
+eval SELECT inserts,updates,deletes,schemaops FROM
+ cluster.binlog_index WHERE epoch=$the_epoch;
+
+# reset for next test
+connection server1;
+reset master;
+connection server2;
+reset master;
+
+# single schema ops will not show
+connection server2;
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB;
+INSERT INTO t1 VALUES (1),(2);
+--source include/show_binlog_events.inc
+--replace_column 1 <the_epoch2>
+SELECT @the_epoch2:=epoch,inserts,updates,deletes,schemaops FROM
+ cluster.binlog_index ORDER BY epoch DESC LIMIT 1;
+let $the_epoch2= `SELECT @the_epoch2`;
+
+--replace_result $the_epoch <the_epoch> $the_epoch2 <the_epoch2>
+eval SELECT inserts,updates,deletes,schemaops FROM
+ cluster.binlog_index WHERE epoch > $the_epoch AND epoch <= $the_epoch2;
+
+# now see that we have the events on the other server
+connection server2;
+# doing drop table will ensure that all the events have been received
+drop table t1;
+# verify thar we have table and data in binlog
+--source include/show_binlog_events.inc
+--replace_result $the_epoch <the_epoch> $the_epoch2 <the_epoch2>
+eval SELECT inserts,updates,deletes,schemaops FROM
+ cluster.binlog_index WHERE epoch > $the_epoch AND epoch <= $the_epoch2;
diff --git a/mysql-test/t/ndb_bitfield.test b/mysql-test/t/ndb_bitfield.test
index 59d6e56577e..de0ae23bfe6 100644
--- a/mysql-test/t/ndb_bitfield.test
+++ b/mysql-test/t/ndb_bitfield.test
@@ -104,6 +104,7 @@ create table t1 (
pk1 bit(9) not null primary key,
b int
) engine=ndbcluster;
+show warnings;
--error 1005
create table t1 (
@@ -111,6 +112,7 @@ create table t1 (
b bit(9),
key(b)
) engine=ndbcluster;
+show warnings;
# bug#16125
create table t1 (
diff --git a/mysql-test/t/ndb_blob.test b/mysql-test/t/ndb_blob.test
index d6e0edc89f0..fb0536f0d10 100644
--- a/mysql-test/t/ndb_blob.test
+++ b/mysql-test/t/ndb_blob.test
@@ -65,6 +65,7 @@ select length(@x0),length(@b2),length(@d2) from dual;
insert into t1 values(1,@b1,111,@d1);
insert into t1 values(2,@b2,222,@d2);
commit;
+--replace_column 9 #
explain select * from t1 where a = 1;
# pk read
@@ -108,6 +109,7 @@ select count(*) from t1;
replace t1 set a=1,b=@b1,c=111,d=@d1;
replace t1 set a=2,b=@b2,c=222,d=@d2;
commit;
+--replace_column 9 #
explain select * from t1 where a = 1;
# pk read
@@ -150,6 +152,7 @@ select count(*) from t1;
insert into t1 values(1,@b1,111,@d1);
insert into t1 values(2,@b2,222,@d2);
commit;
+--replace_column 9 #
explain select * from t1 where c = 111;
# hash key read
@@ -190,6 +193,7 @@ insert into t1 values(7,'b7',777,'dd7');
insert into t1 values(8,'b8',888,'dd8');
insert into t1 values(9,'b9',999,'dd9');
commit;
+--replace_column 9 #
explain select * from t1;
# table scan read
@@ -210,6 +214,7 @@ select count(*) from t1;
insert into t1 values(1,@b1,111,@d1);
insert into t1 values(2,@b2,222,@d2);
commit;
+--replace_column 9 #
explain select * from t1;
# table scan read
@@ -239,6 +244,7 @@ insert into t1 values(7,'b7',777,'dd7');
insert into t1 values(8,'b8',888,'dd8');
insert into t1 values(9,'b9',999,'dd9');
commit;
+--replace_column 9 #
explain select * from t1 where c >= 100 order by a;
# range scan read
@@ -260,6 +266,7 @@ select count(*) from t1;
insert into t1 values(1,@b1,111,@d1);
insert into t1 values(2,@b2,222,@d2);
commit;
+--replace_column 9 #
explain select * from t1 where c >= 100 order by a;
# range scan read
diff --git a/mysql-test/t/ndb_blob_partition.test b/mysql-test/t/ndb_blob_partition.test
new file mode 100644
index 00000000000..6173c9d9851
--- /dev/null
+++ b/mysql-test/t/ndb_blob_partition.test
@@ -0,0 +1,97 @@
+--source include/have_ndb.inc
+-- source include/not_embedded.inc
+
+--disable_query_log
+set new=on;
+--enable_query_log
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Minimal NDB blobs test with range partitions.
+#
+
+create table t1 (
+ a mediumint not null,
+ b text not null,
+ c int not null,
+ d longblob,
+ primary key using hash (a,c),
+ unique key (c)
+)
+ engine=ndb
+ partition by range (c)
+ partitions 3
+ ( partition p1 values less than (200),
+ partition p2 values less than (300),
+ partition p3 values less than (400));
+
+--disable_query_log
+sleep 1;
+
+# length 61
+set @s0 = 'rggurloniukyehuxdbfkkyzlceixzrehqhvxvxbpwizzvjzpucqmzrhzxzfau';
+set @s1 = 'ykyymbzqgqlcjhlhmyqelfoaaohvtbekvifukdtnvcrrjveevfakxarxexomz';
+set @s2 = 'dbnfqyzgtqxalcrwtfsqabknvtfcbpoonxsjiqvmhnfikxxhcgoexlkoezvah';
+
+set @v1 = repeat(@s0, 100); -- 1d42dd9090cf78314a06665d4ea938c35cc760f4
+set @v2 = repeat(@s1, 200); -- 10d3c783026b310218d10b7188da96a2401648c6
+set @v3 = repeat(@s2, 300); -- a33549d9844092289a58ac348dd59f09fc28406a
+set @v4 = repeat(@s0, 400); -- daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
+set @v5 = repeat(@s1, 500); -- 70fc9a7d08beebc522258bfb02000a30c77a8f1d
+set @v6 = repeat(@s2, 600); -- 090565c580809efed3d369481a4bbb168b20713e
+set @v7 = repeat(@s0, 700); -- 1e0070bec426871a46291de27b9bd6e4255ab4e5
+set @v8 = repeat(@s1, 800); -- acbaba01bc2e682f015f40e79d9cbe475db3002e
+set @v9 = repeat(@s2, 900); -- 9ee30d99162574f79c66ae95cdf132dcf9cbc259
+--enable_query_log
+
+# -- insert --
+insert into t1 values (1, @v1, 101, @v2);
+insert into t1 values (1, @v2, 102, @v3);
+insert into t1 values (1, @v3, 103, @v4);
+insert into t1 values (2, @v4, 201, @v5);
+insert into t1 values (2, @v5, 202, @v6);
+insert into t1 values (2, @v6, 203, @v7);
+insert into t1 values (3, @v7, 301, @v8);
+insert into t1 values (3, @v8, 302, @v9);
+insert into t1 values (3, @v9, 303, @v1);
+select a, sha1(b), c, sha1(d) from t1 order by a;
+
+# -- pk read --
+select a, sha1(b), c, sha1(d) from t1 where a = 1 and c = 101;
+select a, sha1(b), c, sha1(d) from t1 where a = 2 and c = 201;
+select a, sha1(b), c, sha1(d) from t1 where a = 3 and c = 301;
+
+# -- pk update --
+update t1 set b = @v3, d = @v4 where a = 1 and c = 102;
+update t1 set b = @v6, d = @v7 where a = 2 and c = 202;
+update t1 set b = @v9, d = @v1 where a = 3 and c = 302;
+select a, sha1(b), c, sha1(d) from t1 order by a;
+
+# -- hash index update --
+update t1 set b = @v4, d = @v5 where c = 103;
+update t1 set b = @v7, d = @v8 where c = 203;
+update t1 set b = @v1, d = @v2 where c = 303;
+select a, sha1(b), c, sha1(d) from t1 order by a;
+
+# -- full scan update --
+update t1 set b = @v5, d = @v6;
+select a, sha1(b), c, sha1(d) from t1 order by a;
+
+# -- range scan update
+update t1 set b = @v1, d = @v2 where 100 < c and c < 200;
+update t1 set b = @v4, d = @v5 where 200 < c and c < 300;
+update t1 set b = @v7, d = @v8 where 300 < c and c < 400;
+select a, sha1(b), c, sha1(d) from t1 order by a;
+
+# -- delete --
+delete from t1 where a = 1 and c = 101;
+delete from t1 where c = 102;
+# delete from t1 where c < 300; # XXX coredump
+delete from t1;
+select a, sha1(b), c, sha1(d) from t1 order by a;
+
+# -- clean up --
+drop table t1;
diff --git a/mysql-test/t/ndb_cache_multi.test b/mysql-test/t/ndb_cache_multi.test
index beb8e4bc2ac..404393c211e 100644
--- a/mysql-test/t/ndb_cache_multi.test
+++ b/mysql-test/t/ndb_cache_multi.test
@@ -63,3 +63,10 @@ show status like "Qcache_hits";
drop table t1, t2;
+# Turn off query cache on server1
+connection server1;
+set GLOBAL query_cache_size=0;
+
+# Turn off query cache on server2
+connection server2;
+set GLOBAL query_cache_size=0;
diff --git a/mysql-test/t/ndb_charset.test b/mysql-test/t/ndb_charset.test
index 5941e5750db..a429ee5e1dc 100644
--- a/mysql-test/t/ndb_charset.test
+++ b/mysql-test/t/ndb_charset.test
@@ -159,8 +159,9 @@ insert into t1 values(5, 'aaa');
insert into t1 values(6, 'AAA');
# 6
select * from t1 order by p;
-# plan
-explain select * from t1 where a = 'zZz' order by p;
+# plan too flaky
+#--replace_column 9 #
+#explain select * from t1 where a = 'zZz' order by p;
# 2
select * from t1 where a = 'aAa' order by p;
# 2
@@ -187,8 +188,9 @@ insert into t1 values(5, 'aaa');
insert into t1 values(6, 'AAA');
# 6
select * from t1 order by p;
-# plan
-explain select * from t1 where a = 'zZz' order by p;
+# plan too flaky
+#--replace_column 9 #
+#explain select * from t1 where a = 'zZz' order by p;
# 6
select * from t1 where a = 'aAa' order by p;
# 6
diff --git a/mysql-test/t/ndb_condition_pushdown.test b/mysql-test/t/ndb_condition_pushdown.test
index 748c26e2a9a..ab56430ac1d 100644
--- a/mysql-test/t/ndb_condition_pushdown.test
+++ b/mysql-test/t/ndb_condition_pushdown.test
@@ -2,7 +2,7 @@
-- source include/not_embedded.inc
--disable_warnings
-DROP TABLE IF EXISTS t1,t2;
+DROP TABLE IF EXISTS t1,t2,t3,t4;
--enable_warnings
#
@@ -456,6 +456,7 @@ select * from t3,t4 where t4.attr1 > 1 and t4.attr2 = t3.attr2 and t4.attr3 < 5
set engine_condition_pushdown = on;
# Test all types and compare operators
+--replace_column 9 #
explain
select auto from t1 where
string = "aaaa" and
@@ -511,6 +512,7 @@ time_field = '01:01:01' and
date_time = '1901-01-01 01:01:01'
order by auto;
+--replace_column 9 #
explain
select auto from t1 where
string != "aaaa" and
@@ -566,6 +568,7 @@ time_field != '01:01:01' and
date_time != '1901-01-01 01:01:01'
order by auto;
+--replace_column 9 #
explain
select auto from t1 where
string > "aaaa" and
@@ -621,6 +624,7 @@ time_field > '01:01:01' and
date_time > '1901-01-01 01:01:01'
order by auto;
+--replace_column 9 #
explain
select auto from t1 where
string >= "aaaa" and
@@ -676,6 +680,7 @@ time_field >= '01:01:01' and
date_time >= '1901-01-01 01:01:01'
order by auto;
+--replace_column 9 #
explain
select auto from t1 where
string < "dddd" and
@@ -731,6 +736,7 @@ time_field < '04:04:04' and
date_time < '1904-04-04 04:04:04'
order by auto;
+--replace_column 9 #
explain
select auto from t1 where
string <= "dddd" and
@@ -790,6 +796,7 @@ order by auto;
create index medium_index on t1(medium);
# Test all types and compare operators
+--replace_column 9 #
explain
select auto from t1 where
string = "aaaa" and
@@ -845,6 +852,7 @@ time_field = '01:01:01' and
date_time = '1901-01-01 01:01:01'
order by auto;
+--replace_column 9 #
explain
select auto from t1 where
string != "aaaa" and
@@ -900,6 +908,7 @@ time_field != '01:01:01' and
date_time != '1901-01-01 01:01:01'
order by auto;
+--replace_column 9 #
explain
select auto from t1 where
string > "aaaa" and
@@ -955,6 +964,7 @@ time_field > '01:01:01' and
date_time > '1901-01-01 01:01:01'
order by auto;
+--replace_column 9 #
explain
select auto from t1 where
string >= "aaaa" and
@@ -1010,6 +1020,7 @@ time_field >= '01:01:01' and
date_time >= '1901-01-01 01:01:01'
order by auto;
+--replace_column 9 #
explain
select auto from t1 where
string < "dddd" and
@@ -1065,6 +1076,7 @@ time_field < '04:04:04' and
date_time < '1904-04-04 04:04:04'
order by auto;
+--replace_column 9 #
explain
select auto from t1 where
string <= "dddd" and
@@ -1121,6 +1133,7 @@ date_time <= '1904-04-04 04:04:04'
order by auto;
# Test LIKE/NOT LIKE
+--replace_column 9 #
explain
select auto from t1 where
string like "b%" and
@@ -1136,6 +1149,7 @@ bin like concat(0xBB, '%') and
vbin like concat(0xBB, '%')
order by auto;
+--replace_column 9 #
explain
select auto from t1 where
string not like "b%" and
@@ -1152,6 +1166,7 @@ vbin not like concat(0xBB, '%')
order by auto;
# BETWEEN
+--replace_column 9 #
explain
select auto from t1 where
(string between "aaaa" and "cccc") and
@@ -1201,6 +1216,7 @@ select auto from t1 where
(date_time between '1901-01-01 01:01:01' and '1903-03-03 03:03:03')
order by auto;
+--replace_column 9 #
explain
select auto from t1 where
("aaaa" between string and string) and
@@ -1251,6 +1267,7 @@ select auto from t1 where
order by auto;
# NOT BETWEEN
+--replace_column 9 #
explain
select auto from t1 where
(string not between "aaaa" and "cccc") and
@@ -1300,6 +1317,7 @@ select auto from t1 where
(date_time not between '1901-01-01 01:01:01' and '1903-03-03 03:03:03')
order by auto;
+--replace_column 9 #
explain
select auto from t1 where
("aaaa" not between string and string) and
@@ -1350,6 +1368,7 @@ select auto from t1 where
order by auto;
# IN
+--replace_column 9 #
explain
select auto from t1 where
string in("aaaa","cccc") and
@@ -1399,6 +1418,7 @@ time_field in('01:01:01','03:03:03') and
date_time in('1901-01-01 01:01:01','1903-03-03 03:03:03')
order by auto;
+--replace_column 9 #
explain
select auto from t1 where
"aaaa" in(string) and
@@ -1449,6 +1469,7 @@ select auto from t1 where
order by auto;
# NOT IN
+--replace_column 9 #
explain
select auto from t1 where
string not in("aaaa","cccc") and
@@ -1498,6 +1519,7 @@ time_field not in('01:01:01','03:03:03') and
date_time not in('1901-01-01 01:01:01','1903-03-03 03:03:03')
order by auto;
+--replace_column 9 #
explain
select auto from t1 where
"aaaa" not in(string) and
@@ -1607,35 +1629,44 @@ date_time = '1901-01-01 01:01:01';
select count(*) from t1;
# Various tests
+--replace_column 9 #
explain
select * from t2 where attr3 is null or attr1 > 2 and pk1= 3 order by pk1;
select * from t2 where attr3 is null or attr1 > 2 and pk1= 3 order by pk1;
+--replace_column 9 #
explain
select * from t2 where attr3 is not null and attr1 > 2 order by pk1;
select * from t2 where attr3 is not null and attr1 > 2 order by pk1;
+--replace_column 9 #
explain
select * from t3 where attr2 > 9223372036854775803 and attr3 != 3 order by pk1;
select * from t3 where attr2 > 9223372036854775803 and attr3 != 3 order by pk1;
+--replace_column 9 #
explain
select * from t2,t3 where t2.attr1 < 1 and t2.attr2 = t3.attr2 and t3.attr1 < 5 order by t2.pk1;
select * from t2,t3 where t2.attr1 < 1 and t2.attr2 = t3.attr2 and t3.attr1 < 5 order by t2.pk1;
+--replace_column 9 #
explain
select * from t4 where attr1 < 5 and attr2 > 9223372036854775803 and attr3 != 3 order by t4.pk1;
select * from t4 where attr1 < 5 and attr2 > 9223372036854775803 and attr3 != 3 order by t4.pk1;
+--replace_column 9 #
explain
select * from t3,t4 where t4.attr1 > 1 and t4.attr2 = t3.attr2 and t4.attr3 < 5 order by t4.pk1;
select * from t3,t4 where t4.attr1 > 1 and t4.attr2 = t3.attr2 and t4.attr3 < 5 order by t4.pk1;
# Some tests that are currently not supported and should not push condition
+--replace_column 9 #
explain
select auto from t1 where string = "aaaa" collate latin1_general_ci order by auto;
+--replace_column 9 #
explain
select * from t2 where (attr1 < 2) = (attr2 < 2) order by pk1;
+--replace_column 9 #
explain
select * from t3 left join t4 on t4.attr2 = t3.attr2 where t4.attr1 > 1 and t4.attr3 < 5 or t4.attr1 is null order by t4.pk1;
@@ -1646,6 +1677,7 @@ insert into t5 (b) values ('jonas'), ('jensing'), ('johan');
set engine_condition_pushdown = off;
select * from t5 where b like '%jo%' order by a;
set engine_condition_pushdown = on;
+--replace_column 9 #
explain select * from t5 where b like '%jo%';
select * from t5 where b like '%jo%' order by a;
@@ -1654,8 +1686,10 @@ set engine_condition_pushdown = off;
select auto from t1 where date_time like '1902-02-02 %' order by auto;
select auto from t1 where date_time not like '1902-02-02 %' order by auto;
set engine_condition_pushdown = on;
+--replace_column 9 #
explain select auto from t1 where date_time like '1902-02-02 %';
select auto from t1 where date_time like '1902-02-02 %' order by auto;
+--replace_column 9 #
explain select auto from t1 where date_time not like '1902-02-02 %';
select auto from t1 where date_time not like '1902-02-02 %' order by auto;
diff --git a/mysql-test/t/ndb_config2.test b/mysql-test/t/ndb_config2.test
new file mode 100644
index 00000000000..170f1b2e5e7
--- /dev/null
+++ b/mysql-test/t/ndb_config2.test
@@ -0,0 +1,7 @@
+-- source include/have_ndb.inc
+-- source include/ndb_default_cluster.inc
+-- source include/not_embedded.inc
+
+# Following doesn't work in all configurations (if shm is not defined)
+
+--exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster2 --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --ndb-shm --connections --query=type,nodeid1,nodeid2,group,nodeidserver --mycnf 2> /dev/null
diff --git a/mysql-test/t/ndb_database.test b/mysql-test/t/ndb_database.test
index 2e924ba2dcc..8bfdf40de88 100644
--- a/mysql-test/t/ndb_database.test
+++ b/mysql-test/t/ndb_database.test
@@ -1,13 +1,7 @@
-- source include/have_ndb.inc
--- source include/have_multi_ndb.inc
-- source include/not_embedded.inc
--disable_warnings
-connection server1;
-drop table if exists t1;
-drop database if exists mysqltest;
-connection server2;
-drop table if exists t1;
drop database if exists mysqltest;
--enable_warnings
@@ -15,38 +9,16 @@ drop database if exists mysqltest;
# Check that all tables in a database are dropped when database is dropped
#
-connection server1;
-create database mysqltest;
-
-connection server2;
create database mysqltest;
create table mysqltest.t1 (a int primary key, b int) engine=ndb;
use mysqltest;
show tables;
-connection server1;
drop database mysqltest;
-
-connection server2;
-use mysqltest;
-show tables;
-
-connection server1;
create database mysqltest;
-create table mysqltest.t1 (c int, d int primary key) engine=ndb;
use mysqltest;
show tables;
-connection server2;
drop database mysqltest;
-connection server1;
-use mysqltest;
-show tables;
-
---disable_warnings
-drop table if exists t1;
-drop database if exists mysqltest;
---enable_warnings
-
# End of 4.1 tests
diff --git a/mysql-test/t/ndb_dd_alter.test b/mysql-test/t/ndb_dd_alter.test
new file mode 100644
index 00000000000..4eb76fc1ad6
--- /dev/null
+++ b/mysql-test/t/ndb_dd_alter.test
@@ -0,0 +1,247 @@
+##############################################################
+# Author: JBM
+# Date: 2006-01-12
+# Purpose: To test using ndb memory and disk tables together.
+##############################################################
+
+##############################################################
+# Author: Nikolay
+# Date: 2006-05-12
+# Purpose: To test using ndb memory and disk tables together.
+#
+# Select from disk into memory table
+# Select from disk into memory table
+# Create test that loads data, use mysql dump to dump data, drop table,
+# create table and load from mysql dump.
+# Use group by asc and dec; Use having; Use order by
+# ALTER Tests (Meta data testing):
+# ALTER from InnoDB to Cluster Disk Data
+# ALTER from MyISAM to Cluster Disk Data
+# ALTER from Cluster Disk Data to InnoDB
+# ALTER from Cluster Disk Data to MyISAM
+# ALTER DD Tables and add columns
+# ALTER DD Tables and add Indexes
+# ALTER DD Tables and drop columns
+#
+##############################################################
+# Author: Jonathan
+# Date 2006-08-28
+# Purpose: To take out some of the test that are already
+# Covered by other tests. Per Jonas
+# The new purpose of this test is testing "Alter"
+# Statements. Therefore the name is changed to
+# ndb_dd_alter.test
+# Removed tests include:
+# Select from disk into memory table
+# Select from disk into memory table
+# Create test that loads data, use mysql dump to dump data, drop table,
+# create table and load from mysql dump.
+# Use group by asc and dec; Use having; Use order by
+##############################################################
+
+-- source include/have_ndb.inc
+-- source include/have_innodb.inc
+-- source include/not_embedded.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+--enable_warnings
+
+############ Test Setup Section #############
+-- echo **** Test Setup Section ****
+################## ALTER Tests (Meta data testing) ####################
+
+ CREATE LOGFILE GROUP lg
+ ADD UNDOFILE './lg_group/undofile.dat'
+ INITIAL_SIZE 16M
+ UNDO_BUFFER_SIZE = 1M
+ ENGINE=NDB;
+
+ CREATE TABLESPACE ts
+ ADD DATAFILE './table_space/datafile.dat'
+ USE LOGFILE GROUP lg
+ INITIAL_SIZE 12M
+ ENGINE NDB;
+
+#### Try to ALTER from InnoDB to Cluster Disk Data
+
+CREATE TABLE test.t1 (
+ a1 smallint NOT NULL,
+ a2 int NOT NULL,
+ a3 bigint NOT NULL,
+ a4 char(10),
+ a5 decimal(5,1),
+ a6 time,
+ a7 date,
+ a8 datetime,
+ a9 VARCHAR(255),
+ a10 blob,
+ PRIMARY KEY(a1)
+) ENGINE=InnoDB;
+
+let $1=20;
+disable_query_log;
+while ($1)
+{
+ eval insert into test.t1 values($1, $1+1, $1+2000000000, "aaa$1", 34.2, '4:3:2', '2006-1-1', '1971-5-28 16:55:03', "bbbbbbbbbbbbb$1", "binary data");
+ dec $1;
+}
+enable_query_log;
+
+SHOW CREATE TABLE test.t1;
+SELECT * FROM test.t1 ORDER BY a1;
+ALTER TABLE test.t1 TABLESPACE ts STORAGE DISK ENGINE=NDB;
+SHOW CREATE TABLE test.t1;
+SELECT * FROM test.t1 ORDER BY a1;
+DROP TABLE test.t1;
+
+#### Try to ALTER from MyISAM to Cluster Disk Data
+
+CREATE TABLE test.t1 (
+ a1 smallint NOT NULL,
+ a2 int NOT NULL,
+ a3 bigint NOT NULL,
+ a4 char(10),
+ a5 decimal(5,1),
+ a6 time,
+ a7 date,
+ a8 datetime,
+ a9 VARCHAR(255),
+ a10 blob,
+ PRIMARY KEY(a1)
+) ENGINE=MyISAM;
+
+let $1=20;
+disable_query_log;
+while ($1)
+{
+ eval insert into test.t1 values($1, $1+1, $1+2000000000, "aaa$1", 34.2, '4:3:2', '2006-1-1', '1971-5-28 16:55:03', "bbbbbbbbbbbbb$1", "binary data");
+ dec $1;
+}
+enable_query_log;
+
+SHOW CREATE TABLE test.t1;
+SELECT * FROM test.t1 ORDER BY a1;
+ALTER TABLE test.t1 TABLESPACE ts STORAGE DISK ENGINE=NDB;
+SHOW CREATE TABLE test.t1;
+SELECT * FROM test.t1 ORDER BY a1;
+
+#### Try to ALTER from Cluster Disk Data to InnoDB
+
+ALTER TABLE test.t1 ENGINE=InnoDB;
+SHOW CREATE TABLE test.t1;
+SELECT * FROM test.t1 ORDER BY a1;
+ALTER TABLE test.t1 TABLESPACE ts STORAGE DISK ENGINE=NDB;
+
+#### Try to ALTER from Cluster Disk Data to MyISAM
+
+SHOW CREATE TABLE test.t1;
+ALTER TABLE test.t1 ENGINE=MyISAM;
+SHOW CREATE TABLE test.t1;
+DROP TABLE test.t1;
+
+#### Try to ALTER DD Tables and add columns
+
+CREATE TABLE test.t1 (a1 INT PRIMARY KEY) TABLESPACE ts STORAGE DISK ENGINE=NDB;
+
+let $1=20;
+disable_query_log;
+while ($1)
+{
+ eval insert into test.t1 values($1);
+ dec $1;
+}
+enable_query_log;
+
+SELECT * FROM test.t1 ORDER BY a1;
+
+ALTER TABLE test.t1 ADD a2 FLOAT, ADD a3 DOUBLE;
+
+let $1=20;
+disable_query_log;
+while ($1)
+{
+ eval update test.t1 set a2 = $1+1.2345, a3 = $1+20000000.00 where a1 = $1;
+ dec $1;
+}
+enable_query_log;
+
+SELECT * FROM test.t1 ORDER BY a1;
+
+ALTER TABLE test.t1 ADD a4 BIT, ADD a5 TINYINT, ADD a6 BIGINT, ADD a7 DATE, ADD a8 TIME;
+
+let $1=20;
+disable_query_log;
+while ($1)
+{
+ eval update test.t1 set a4 = 0, a5 = 1, a6 = $1+23456, a7 = '2006-1-1',
+ a8 = '07:04:00' where a1 = $1;
+ dec $1;
+}
+enable_query_log;
+
+SELECT a1,a2,a3,hex(a4), a5,a6,a7,a8 FROM test.t1 ORDER BY a1;
+
+ALTER TABLE test.t1 ADD a9 DATETIME, ADD a10 TINYTEXT, ADD a11 MEDIUMTEXT, ADD a12 LONGTEXT, ADD a13 TEXT, ADD a14 BLOB;
+
+disable_query_log;
+set @d2 = 'dd2';
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+enable_query_log;
+
+let $1=20;
+disable_query_log;
+while ($1)
+{
+ eval update test.t1 set a9 = '1971-5-28 16:55:03', a10 = 'abc', a11 = 'abcdefg',
+ a12 = 'LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL', a13 = 'Text Field',
+ a14 = @d2 where a1 = $1;
+ dec $1;
+}
+enable_query_log;
+
+SELECT a1, a2,a3,hex(a4),a5,a6,a7,a8,a9,a10,a11,a12,a13 FROM test.t1 ORDER BY a1;
+SHOW CREATE TABLE test.t1;
+
+#### Try to ALTER DD Tables and add Indexes
+
+ALTER TABLE test.t1 ADD INDEX a2_i (a2), ADD INDEX a3_i (a3);
+
+SHOW CREATE TABLE test.t1;
+
+ALTER TABLE test.t1 DROP INDEX a2_i;
+
+SHOW CREATE TABLE test.t1;
+
+
+#### Try to ALTER DD Tables and drop columns
+
+
+ALTER TABLE test.t1 DROP a14;
+ALTER TABLE test.t1 DROP a13;
+ALTER TABLE test.t1 DROP a12;
+ALTER TABLE test.t1 DROP a11;
+ALTER TABLE test.t1 DROP a10;
+ALTER TABLE test.t1 DROP a9;
+ALTER TABLE test.t1 DROP a8;
+ALTER TABLE test.t1 DROP a7;
+ALTER TABLE test.t1 DROP a6;
+ALTER TABLE test.t1 DROP PRIMARY KEY;
+
+SHOW CREATE TABLE test.t1;
+
+DROP TABLE test.t1;
+
+ ALTER TABLESPACE ts
+ DROP DATAFILE './table_space/datafile.dat'
+ ENGINE NDB;
+ DROP TABLESPACE ts ENGINE NDB;
+ DROP LOGFILE GROUP lg ENGINE=NDB;
+
+####################### End section 4 #########################
+#End 5.1 test case
+
diff --git a/mysql-test/t/ndb_dd_backuprestore.test b/mysql-test/t/ndb_dd_backuprestore.test
new file mode 100644
index 00000000000..48db8ec3e0b
--- /dev/null
+++ b/mysql-test/t/ndb_dd_backuprestore.test
@@ -0,0 +1,349 @@
+########################################
+# Author: JBM
+# Date: 2006-01-24
+# Purpose: Test CDD backup and restore
+########################################
+
+-- source include/have_ndb.inc
+-- source include/ndb_default_cluster.inc
+-- source include/not_embedded.inc
+
+--disable_query_log
+set new=on;
+--enable_query_log
+
+--disable_warnings
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+DROP TABLE IF EXISTS test.t4;
+DROP TABLE IF EXISTS test.t5;
+DROP TABLE IF EXISTS test.t6;
+--enable_warnings
+
+############ Test 1 Simple DD backup and restore #############
+-- echo **** Test 1 Simple DD backup and restore ****
+
+CREATE LOGFILE GROUP log_group1
+ADD UNDOFILE './log_group1/undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+
+CREATE TABLESPACE table_space1
+ADD DATAFILE './table_space1/datafile.dat'
+USE LOGFILE GROUP log_group1
+INITIAL_SIZE 12M
+ENGINE NDB;
+
+
+CREATE TABLE test.t1
+(pk1 MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 CHAR(50) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL) TABLESPACE table_space1 STORAGE DISK ENGINE=NDB;
+
+let $j= 500;
+--disable_query_log
+while ($j)
+{
+ eval INSERT INTO test.t1 VALUES (NULL, "Sweden", $j, b'1');
+ dec $j;
+}
+--enable_query_log
+SELECT COUNT(*) FROM test.t1;
+SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
+
+-- source include/ndb_backup.inc
+
+DROP TABLE test.t1;
+
+ALTER TABLESPACE table_space1
+DROP DATAFILE './table_space1/datafile.dat'
+ENGINE = NDB;
+
+DROP TABLESPACE table_space1
+ENGINE = NDB;
+
+DROP LOGFILE GROUP log_group1
+ENGINE =NDB;
+
+-- source include/ndb_restore_master.inc
+
+SELECT COUNT(*) FROM test.t1;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
+
+################# Mixed Cluster Test ############################
+-- echo **** Test 2 Mixed Cluster Test backup and restore ****
+
+CREATE TABLE test.t2
+(pk1 MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 VARCHAR(200) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL)ENGINE=NDB;
+
+let $j= 500;
+--disable_query_log
+while ($j)
+{
+ eval INSERT INTO test.t2 VALUES (NULL, "Sweden, Texas", $j, b'0');
+ dec $j;
+}
+--enable_query_log
+
+CREATE TABLE test.t3 (c1 int not null auto_increment, data LONGBLOB, PRIMARY KEY(c1))TABLESPACE table_space1 STORAGE DISK ENGINE=NDB;
+
+CREATE TABLE test.t4 (c1 int not null auto_increment, data LONGBLOB, PRIMARY KEY(c1))ENGINE=NDB;
+
+let $j= 50;
+--disable_query_log
+while ($j)
+{
+ INSERT INTO test.t3 VALUES (NULL, repeat('a',1*1024));
+ INSERT INTO test.t3 VALUES (NULL, repeat('b',16*1024));
+ INSERT INTO test.t4 VALUES (NULL, repeat('a',1*1024));
+ INSERT INTO test.t4 VALUES (NULL, repeat('b',16*1024));
+ dec $j;
+}
+--enable_query_log
+
+SELECT COUNT(*) FROM test.t1;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t2;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY pk1 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t3;
+
+SELECT LENGTH(data) FROM test.t3 WHERE c1 = 1;
+
+SELECT LENGTH(data) FROM test.t3 WHERE c1 = 2;
+
+SELECT COUNT(*) FROM test.t4;
+
+SELECT LENGTH(data) FROM test.t4 WHERE c1 = 1;
+
+SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2;
+
+-- source include/ndb_backup.inc
+
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
+DROP TABLE test.t4;
+
+ALTER TABLESPACE table_space1
+DROP DATAFILE './table_space1/datafile.dat'
+ENGINE = NDB;
+
+DROP TABLESPACE table_space1
+ENGINE = NDB;
+
+DROP LOGFILE GROUP log_group1
+ENGINE =NDB;
+
+-- source include/ndb_restore_master.inc
+
+SELECT COUNT(*) FROM test.t1;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t2;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY pk1 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t3;
+
+SELECT LENGTH(data) FROM test.t3 WHERE c1 = 1;
+
+SELECT LENGTH(data) FROM test.t3 WHERE c1 = 2;
+
+SELECT COUNT(*) FROM test.t4;
+
+SELECT LENGTH(data) FROM test.t4 WHERE c1 = 1;
+
+SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2;
+
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
+DROP TABLE test.t4;
+###################### Adding partition #################################
+-- echo **** Test 3 Adding partition Test backup and restore ****
+
+CREATE TABLESPACE table_space2
+ADD DATAFILE './table_space2/datafile.dat'
+USE LOGFILE GROUP log_group1
+INITIAL_SIZE 12M
+ENGINE NDB;
+
+CREATE TABLE test.t1 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(150) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space1 STORAGE DISK ENGINE=NDB PARTITION BY HASH(c3) PARTITIONS 4;
+
+CREATE TABLE test.t4 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(180) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY HASH(c3) PARTITIONS 2;
+
+CREATE TABLE test.t2 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space2 STORAGE DISK ENGINE=NDB PARTITION BY KEY(c3) (PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
+
+CREATE TABLE test.t5 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY KEY(pk1) (PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
+
+CREATE TABLE test.t3 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(202) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space2 STORAGE DISK ENGINE=NDB PARTITION BY RANGE (c3) PARTITIONS 3 (PARTITION x1 VALUES LESS THAN (105), PARTITION x2 VALUES LESS THAN (333), PARTITION x3 VALUES LESS THAN (720));
+
+CREATE TABLE test.t6 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(220) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY RANGE (pk1) PARTITIONS 2 (PARTITION x1 VALUES LESS THAN (333), PARTITION x2 VALUES LESS THAN (720));
+
+SHOW CREATE TABLE test.t1;
+
+SHOW CREATE TABLE test.t2;
+
+SHOW CREATE TABLE test.t3;
+
+SHOW CREATE TABLE test.t4;
+
+SHOW CREATE TABLE test.t5;
+
+SHOW CREATE TABLE test.t6;
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't1';
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't2';
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't3';
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't4';
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't5';
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't6';
+
+
+let $j= 500;
+--disable_query_log
+while ($j)
+{
+ eval INSERT INTO test.t1 VALUES (NULL, "Sweden, Texas", $j, b'0');
+ eval INSERT INTO test.t4 VALUES (NULL, "Sweden, Texas", $j, b'0');
+ dec $j;
+ eval INSERT INTO test.t2 VALUES (NULL, "Sweden, Texas, ITALY, Kyle, JO, JBM,TU", $j, b'1');
+ eval INSERT INTO test.t5 VALUES (NULL, "Sweden, Texas, ITALY, Kyle, JO, JBM,TU", $j, b'1');
+ dec $j;
+ eval INSERT INTO test.t3 VALUES (NULL, "TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU", $j, b'1');
+ eval INSERT INTO test.t6 VALUES (NULL, "TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU", $j, b'1'); } --enable_query_log
+
+SELECT COUNT(*) FROM test.t1;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY c3 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t2;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY c3 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t3;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t3 ORDER BY c3 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t4;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t4 ORDER BY c3 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t5;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t5 ORDER BY c3 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t6;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t6 ORDER BY c3 LIMIT 5;
+
+-- source include/ndb_backup.inc
+
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
+DROP TABLE test.t4;
+DROP TABLE test.t5;
+DROP TABLE test.t6;
+
+ALTER TABLESPACE table_space1
+DROP DATAFILE './table_space1/datafile.dat'
+ENGINE = NDB;
+
+ALTER TABLESPACE table_space2
+DROP DATAFILE './table_space2/datafile.dat'
+ENGINE = NDB;
+
+DROP TABLESPACE table_space1
+ENGINE = NDB;
+
+DROP TABLESPACE table_space2
+ENGINE = NDB;
+
+DROP LOGFILE GROUP log_group1
+ENGINE =NDB;
+
+-- source include/ndb_restore_master.inc
+
+
+SHOW CREATE TABLE test.t1;
+
+SHOW CREATE TABLE test.t2;
+
+SHOW CREATE TABLE test.t3;
+
+SHOW CREATE TABLE test.t4;
+
+SHOW CREATE TABLE test.t5;
+
+SHOW CREATE TABLE test.t6;
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't1';
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't2';
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't3';
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't4';
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't5';
+
+SELECT * FROM information_schema.partitions WHERE table_name= 't6';
+
+SELECT COUNT(*) FROM test.t1;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY c3 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t2;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY c3 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t3;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t3 ORDER BY c3 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t4;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t4 ORDER BY c3 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t5;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t5 ORDER BY c3 LIMIT 5;
+
+SELECT COUNT(*) FROM test.t6;
+
+SELECT pk1, c2, c3, hex(c4) FROM test.t6 ORDER BY c3 LIMIT 5;
+
+# Cleanup
+
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
+DROP TABLE test.t4;
+DROP TABLE test.t5;
+DROP TABLE test.t6;
+
+ALTER TABLESPACE table_space1 DROP DATAFILE './table_space1/datafile.dat' ENGINE=NDB;
+
+ALTER TABLESPACE table_space2 DROP DATAFILE './table_space2/datafile.dat' ENGINE=NDB;
+
+DROP TABLESPACE table_space1 ENGINE = NDB;
+
+DROP TABLESPACE table_space2 ENGINE = NDB;
+
+DROP LOGFILE GROUP log_group1 ENGINE = NDB;
+
+#End 5.1 test case
+
+
diff --git a/mysql-test/t/ndb_dd_basic.test b/mysql-test/t/ndb_dd_basic.test
new file mode 100644
index 00000000000..5d43d7997b0
--- /dev/null
+++ b/mysql-test/t/ndb_dd_basic.test
@@ -0,0 +1,406 @@
+#################################
+# Author: JO
+# Org Date: ?
+# Purpose: To test basic Cluster Disk Data
+#################################
+# Change Author: JBM
+# Change Date: 2006-01-11
+# Change: Cleanup and test rename
+#################################
+
+-- source include/have_ndb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# some negative tests
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=MYISAM;
+
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE = 4M
+ENGINE=XYZ;
+
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M;
+
+##################################
+# Basic test of disk tables for NDB
+# Start by creating a logfile group
+##################################
+
+set storage_engine=ndb;
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M;
+
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE = 4M
+ENGINE=NDB;
+
+###################################################
+# Create a tablespace connected to the logfile group
+###################################################
+
+set storage_engine=myisam;
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M
+ENGINE NDB;
+
+ALTER TABLESPACE ts1
+ADD DATAFILE 'datafile02.dat'
+INITIAL_SIZE = 4M
+ENGINE=NDB;
+
+########################################
+# Create a table using this tablespace
+########################################
+
+CREATE TABLE t1
+(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
+TABLESPACE ts1 STORAGE DISK
+ENGINE=NDB;
+
+SHOW CREATE TABLE t1;
+
+INSERT INTO t1 VALUES (0, 0, 0);
+SELECT * FROM t1;
+
+INSERT INTO t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
+(11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15),
+(16,16,16),(17,17,17),(18,18,18),(19,19,19),(20,20,20),
+(21,21,21),(22,22,22),(23,23,23),(24,24,24),(25,25,25),
+(26,26,26),(27,27,27),(28,28,28),(29,29,29),(30,30,30),
+(31,31,31),(32,32,32),(33,33,33),(34,34,34),(35,35,35),
+(36,36,36),(37,37,37),(38,38,38),(39,39,39),(40,40,40),
+(41,41,41),(42,42,42),(43,43,43),(44,44,44),(45,45,45),
+(46,46,46),(47,47,47),(48,48,48),(49,49,49),(50,50,50),
+(51,51,51),(52,52,52),(53,53,53),(54,54,54),(55,55,55),
+(56,56,56),(57,57,57),(58,58,58),(59,59,59),(60,60,60),
+(61,61,61),(62,62,62),(63,63,63),(64,64,64),(65,65,65),
+(66,66,66),(67,67,67),(68,68,68),(69,69,69),(70,70,70),
+(71,71,71),(72,72,72),(73,73,73),(74,74,74),(75,75,75),
+(76,76,76),(77,77,77),(78,78,78),(79,79,79),(80,80,80),
+(81,81,81),(82,82,82),(83,83,83),(84,84,84),(85,85,85),
+(86,86,86),(87,87,87),(88,88,88),(89,89,89),(90,90,90),
+(91,91,91),(92,92,92),(93,93,93),(94,94,94),(95,95,95),
+(96,96,96),(97,97,97),(98,98,98),(99,99,99),(100,100,100),
+(101,101,101),(102,102,102),(103,103,103),(104,104,104),(105,105,105),
+(106,106,106),(107,107,107),(108,108,108),(109,109,109),(110,110,110),
+(111,111,111),(112,112,112),(113,113,113),(114,114,114),(115,115,115),
+(116,116,116),(117,117,117),(118,118,118),(119,119,119),(120,120,120),
+(121,121,121),(122,122,122),(123,123,123),(124,124,124),(125,125,125),
+(126,126,126),(127,127,127),(128,128,128),(129,129,129),(130,130,130),
+(131,131,131),(132,132,132),(133,133,133),(134,134,134),(135,135,135),
+(136,136,136),(137,137,137),(138,138,138),(139,139,139),(140,140,140),
+(141,141,141),(142,142,142),(143,143,143),(144,144,144),(145,145,145),
+(146,146,146),(147,147,147),(148,148,148),(149,149,149),(150,150,150),
+(151,151,151),(152,152,152),(153,153,153),(154,154,154),(155,155,155),
+(156,156,156),(157,157,157),(158,158,158),(159,159,159),(160,160,160),
+(161,161,161),(162,162,162),(163,163,163),(164,164,164),(165,165,165),
+(166,166,166),(167,167,167),(168,168,168),(169,169,169),(170,170,170),
+(171,171,171),(172,172,172),(173,173,173),(174,174,174),(175,175,175),
+(176,176,176),(177,177,177),(178,178,178),(179,179,179),(180,180,180),
+(181,181,181),(182,182,182),(183,183,183),(184,184,184),(185,185,185),
+(186,186,186),(187,187,187),(188,188,188),(189,189,189),(190,190,190),
+(191,191,191),(192,192,192),(193,193,193),(194,194,194),(195,195,195),
+(196,196,196),(197,197,197),(198,198,198),(199,199,199),(200,200,200),
+(201,201,201),(202,202,202),(203,203,203),(204,204,204),(205,205,205),
+(206,206,206),(207,207,207),(208,208,208),(209,209,209),(210,210,210),
+(211,211,211),(212,212,212),(213,213,213),(214,214,214),(215,215,215),
+(216,216,216),(217,217,217),(218,218,218),(219,219,219),(220,220,220),
+(221,221,221),(222,222,222),(223,223,223),(224,224,224),(225,225,225),
+(226,226,226),(227,227,227),(228,228,228),(229,229,229),(230,230,230),
+(231,231,231),(232,232,232),(233,233,233),(234,234,234),(235,235,235),
+(236,236,236),(237,237,237),(238,238,238),(239,239,239),(240,240,240),
+(241,241,241),(242,242,242),(243,243,243),(244,244,244),(245,245,245),
+(246,246,246),(247,247,247),(248,248,248),(249,249,249),(250,250,250),
+(251,251,251),(252,252,252),(253,253,253),(254,254,254),(255,255,255),
+(256,256,256),(257,257,257),(258,258,258),(259,259,259),(260,260,260),
+(261,261,261),(262,262,262),(263,263,263),(264,264,264),(265,265,265),
+(266,266,266),(267,267,267),(268,268,268),(269,269,269),(270,270,270),
+(271,271,271),(272,272,272),(273,273,273),(274,274,274),(275,275,275),
+(276,276,276),(277,277,277),(278,278,278),(279,279,279),(280,280,280),
+(281,281,281),(282,282,282),(283,283,283),(284,284,284),(285,285,285),
+(286,286,286),(287,287,287),(288,288,288),(289,289,289),(290,290,290),
+(291,291,291),(292,292,292),(293,293,293),(294,294,294),(295,295,295),
+(296,296,296),(297,297,297),(298,298,298),(299,299,299),(300,300,300),
+(301,301,301),(302,302,302),(303,303,303),(304,304,304),(305,305,305),
+(306,306,306),(307,307,307),(308,308,308),(309,309,309),(310,310,310),
+(311,311,311),(312,312,312),(313,313,313),(314,314,314),(315,315,315),
+(316,316,316),(317,317,317),(318,318,318),(319,319,319),(320,320,320),
+(321,321,321),(322,322,322),(323,323,323),(324,324,324),(325,325,325),
+(326,326,326),(327,327,327),(328,328,328),(329,329,329),(330,330,330),
+(331,331,331),(332,332,332),(333,333,333),(334,334,334),(335,335,335),
+(336,336,336),(337,337,337),(338,338,338),(339,339,339),(340,340,340),
+(341,341,341),(342,342,342),(343,343,343),(344,344,344),(345,345,345),
+(346,346,346),(347,347,347),(348,348,348),(349,349,349),(350,350,350),
+(351,351,351),(352,352,352),(353,353,353),(354,354,354),(355,355,355),
+(356,356,356),(357,357,357),(358,358,358),(359,359,359),(360,360,360),
+(361,361,361),(362,362,362),(363,363,363),(364,364,364),(365,365,365),
+(366,366,366),(367,367,367),(368,368,368),(369,369,369),(370,370,370),
+(371,371,371),(372,372,372),(373,373,373),(374,374,374),(375,375,375),
+(376,376,376),(377,377,377),(378,378,378),(379,379,379),(380,380,380),
+(381,381,381),(382,382,382),(383,383,383),(384,384,384),(385,385,385),
+(386,386,386),(387,387,387),(388,388,388),(389,389,389),(390,390,390),
+(391,391,391),(392,392,392),(393,393,393),(394,394,394),(395,395,395),
+(396,396,396),(397,397,397),(398,398,398),(399,399,399),(400,400,400),
+(401,401,401),(402,402,402),(403,403,403),(404,404,404),(405,405,405),
+(406,406,406),(407,407,407),(408,408,408),(409,409,409),(410,410,410),
+(411,411,411),(412,412,412),(413,413,413),(414,414,414),(415,415,415),
+(416,416,416),(417,417,417),(418,418,418),(419,419,419),(420,420,420),
+(421,421,421),(422,422,422),(423,423,423),(424,424,424),(425,425,425),
+(426,426,426),(427,427,427),(428,428,428),(429,429,429),(430,430,430),
+(431,431,431),(432,432,432),(433,433,433),(434,434,434),(435,435,435),
+(436,436,436),(437,437,437),(438,438,438),(439,439,439),(440,440,440),
+(441,441,441),(442,442,442),(443,443,443),(444,444,444),(445,445,445),
+(446,446,446),(447,447,447),(448,448,448),(449,449,449),(450,450,450),
+(451,451,451),(452,452,452),(453,453,453),(454,454,454),(455,455,455),
+(456,456,456),(457,457,457),(458,458,458),(459,459,459),(460,460,460),
+(461,461,461),(462,462,462),(463,463,463),(464,464,464),(465,465,465),
+(466,466,466),(467,467,467),(468,468,468),(469,469,469),(470,470,470),
+(471,471,471),(472,472,472),(473,473,473),(474,474,474),(475,475,475),
+(476,476,476),(477,477,477),(478,478,478),(479,479,479),(480,480,480),
+(481,481,481),(482,482,482),(483,483,483),(484,484,484),(485,485,485),
+(486,486,486),(487,487,487),(488,488,488),(489,489,489),(490,490,490),
+(491,491,491),(492,492,492),(493,493,493),(494,494,494),(495,495,495),
+(496,496,496),(497,497,497),(498,498,498),(499,499,499),(500, 500, 500);
+
+SELECT COUNT(*) FROM t1;
+
+####################################
+# Test error cases with size numbers
+####################################
+--error ER_WRONG_SIZE_NUMBER
+CREATE LOGFILE GROUP lg2
+ADD UNDOFILE 'x.dat'
+INITIAL_SIZE 10y
+ENGINE = NDB;
+
+--error ER_WRONG_SIZE_NUMBER
+CREATE LOGFILE GROUP lg2
+ADD UNDOFILE 'x.dat'
+INITIAL_SIZE 10MB
+ENGINE = NDB;
+
+--error 1064
+CREATE LOGFILE GROUP lg2
+ADD UNDOFILE 'x.dat'
+INITIAL_SIZE 10 MB
+ENGINE = NDB;
+
+--error 1064
+CREATE LOGFILE GROUP lg2
+ADD UNDOFILE 'x.dat'
+INITIAL_SIZE 10 M
+ENGINE = NDB;
+
+--error ER_SIZE_OVERFLOW_ERROR
+CREATE LOGFILE GROUP lg2
+ADD UNDOFILE 'x.dat'
+INITIAL_SIZE 1000000000000K
+ENGINE = NDB;
+
+DROP TABLE t1;
+
+############################
+# Test update of mm/dd part
+############################
+
+CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(4) NOT NULL, c CHAR(4) NOT NULL, KEY(b)) TABLESPACE ts1 STORAGE DISK ENGINE = NDB;
+INSERT INTO t1 VALUES (1,'1','1'), (2,'2','2'), (3,'3','3');
+BEGIN;
+UPDATE t1 SET b = '2' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+SELECT * FROM t1 WHERE a = 1;
+UPDATE t1 SET c = '2' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+SELECT * FROM t1 WHERE a = 1;
+UPDATE t1 SET b = '3' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+SELECT * FROM t1 WHERE a = 1;
+COMMIT;
+SELECT * FROM t1 ORDER BY 1;
+BEGIN;
+UPDATE t1 SET c = '3' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+SELECT * FROM t1 WHERE a = 1;
+UPDATE t1 SET b = '4' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+SELECT * FROM t1 WHERE a = 1;
+UPDATE t1 SET c = '4' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+SELECT * FROM t1 WHERE a = 1;
+COMMIT;
+SELECT * FROM t1 ORDER BY 1;
+UPDATE t1 SET b = '5' WHERE a = 1;
+SELECT * FROM t1 ORDER BY 1;
+UPDATE t1 SET b = '6' WHERE b = '5';
+SELECT * FROM t1 ORDER BY 1;
+UPDATE t1 SET b = '7'WHERE c = '4';
+SELECT * FROM t1 ORDER BY 1;
+UPDATE t1 SET c = '5' WHERE a = 1;
+SELECT * FROM t1 ORDER BY 1;
+UPDATE t1 SET c = '6' WHERE b = '7';
+SELECT * FROM t1 ORDER BY 1;
+UPDATE t1 SET c = '7' WHERE c = '6';
+SELECT * FROM t1 ORDER BY 1;
+DROP TABLE t1;
+
+#####
+
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(4) NOT NULL, c CHAR(4) NOT NULL, KEY(b)) TABLESPACE ts1 STORAGE DISK ENGINE NDB;
+INSERT INTO t1 VALUE (1,'1','1'), (2,'2','2'), (3,'3','3');
+BEGIN;
+UPDATE t1 SET b = '2' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+SELECT * FROM t1 WHERE a = 1;
+UPDATE t1 SET c = '2' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+SELECT * FROM t1 WHERE a = 1;
+UPDATE t1 SET b = '3' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+SELECT * FROM t1 WHERE a = 1;
+COMMIT;
+SELECT * FROM t1 ORDER BY 1;
+BEGIN;
+UPDATE t1 SET c = '3' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+SELECT * FROM t1 WHERE a = 1;
+UPDATE t1 SET b = '4' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+SELECT * FROM t1 WHERE a = 1;
+UPDATE t1 SET c = '4' WHERE a = 1;
+SELECT b FROM t1 WHERE a = 1;
+SELECT * FROM t1 WHERE a = 1;
+COMMIT;
+SELECT * FROM t1 ORDER BY 1;
+UPDATE t1 SET b = '5' WHERE a = 1;
+SELECT * FROM t1 ORDER BY 1;
+UPDATE t1 SET b = '6' WHERE b = '5';
+SELECT * FROM t1 ORDER BY 1;
+UPDATE t1 SET b = '7' WHERE c = '4';
+SELECT * FROM t1 ORDER BY 1;
+UPDATE t1 SET c = '5' WHERE a = 1;
+SELECT * FROM t1 ORDER BY 1;
+UPDATE t1 SET c = '6' WHERE b = '7';
+SELECT * FROM t1 ORDER BY 1;
+UPDATE t1 SET c = '7' WHERE c = '6';
+SELECT * FROM t1 ORDER BY 1;
+DROP TABLE t1;
+
+########################
+# Test for blobs...
+########################
+
+CREATE TABLE t1 (
+ a INT NOT NULL PRIMARY KEY,
+ b TEXT NOT NULL
+) TABLESPACE ts1 STORAGE DISK ENGINE=NDBCLUSTER;
+
+# b1 length 2000+256 (blob part aligned)
+#########################################
+set @x0 = '01234567012345670123456701234567';
+set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@x0);
+# b2 length 20000
+##########################################
+set @b2 = 'b2';
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+
+INSERT INTO t1 VALUES(1,@b1);
+INSERT INTO t1 VALUES(2,@b2);
+SELECT a,length(b),substr(b,1+2*900,2) FROM t1 WHERE a=1;
+SELECT a,length(b),substr(b,1+2*9000,2) FROM t1 WHERE a=2;
+UPDATE t1 SET b=@b2 WHERE a=1;
+UPDATE t1 SET b=@b1 WHERE a=2;
+SELECT a,length(b),substr(b,1+2*9000,2) FROM t1 WHERE a=1;
+SELECT a,length(b),substr(b,1+2*900,2) FROM t1 WHERE a=2;
+UPDATE t1 SET b=concat(b,b) WHERE a=1;
+UPDATE t1 SET b=concat(b,b) WHERE a=2;
+SELECT a,length(b),substr(b,1+4*9000,2) FROM t1 WHERE a=1;
+SELECT a,length(b),substr(b,1+4*900,2) FROM t1 WHERE a=2;
+DELETE FROM t1 WHERE a=1;
+DELETE FROM t1 WHERE a=2;
+SELECT COUNT(*) FROM t1;
+DROP TABLE t1;
+
+# bug#20612 INS-DEL bug (not pgman bug)
+# found via disk data assert but is not pgman or disk data related
+
+CREATE TABLE t1 (
+ a int NOT NULL,
+ b varchar(4000), -- must use 2 pages undo
+ PRIMARY KEY using hash (a)
+)
+TABLESPACE ts1 STORAGE DISK ENGINE=NDBCLUSTER;
+
+set autocommit = 0;
+insert into t1 values(0,'x');
+insert into t1 values(1,'x');
+insert into t1 values(2,'x');
+insert into t1 values(3,'x');
+insert into t1 values(4,'x');
+insert into t1 values(5,'x');
+insert into t1 values(6,'x');
+insert into t1 values(7,'x');
+insert into t1 values(8,'x');
+delete from t1 where a = 0;
+commit;
+set autocommit = 1;
+
+drop table t1;
+#############################
+# Customer posted order by test case
+# Org in ndb_dd_advance.test
+#############################
+
+create table test.t1 (f1 varchar(50) primary key, f2 text,f3 int)
+TABLESPACE ts1 STORAGE DISK engine=NDB;
+insert into test.t1 (f1,f2,f3)VALUES("111111","aaaaaa",1);
+insert into test.t1 (f1,f2,f3)VALUES("222222","bbbbbb",2);
+select * from test.t1 order by f1;
+select f1,f2 from test.t1 order by f2;
+select f2 from test.t1 order by f2;
+select f1,f2 from test.t1 order by f1;
+drop table test.t1;
+
+###################
+# Test Cleanup
+###################
+
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile.dat'
+ENGINE = NDB;
+
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile02.dat'
+ENGINE = NDB;
+
+DROP TABLESPACE ts1
+ENGINE = NDB;
+
+DROP LOGFILE GROUP lg1
+ENGINE =NDB;
+
+#End 5.1 test case
diff --git a/mysql-test/t/ndb_dd_ddl.test b/mysql-test/t/ndb_dd_ddl.test
new file mode 100644
index 00000000000..1a470d52c6c
--- /dev/null
+++ b/mysql-test/t/ndb_dd_ddl.test
@@ -0,0 +1,354 @@
+#########################################
+# Author: JBM
+# Date: 2006-01-03
+# Purpose: Test the NDB engine reaction to duplicate
+# Table spaces and log groups. Also to test
+# Statement mixed case.
+############################################
+# Change Author:JBM
+# Change Date 2006-01-19
+# Change: Adding to test cases feedback from OB
+# 1) The 'duplicate' tests.
+# a) The test is using the default (test) database and is not
+# attempting to create databases (only logs, table spaces and
+# tables). Is this intentional?
+# b) What about a duplication of table name when one exists on disk and
+# you are trying to create it again in memory?
+#
+#2) 'CaSE SensiTiVE' tests
+# a) Suggest you include a test case where the case difference is in
+# the file name. I know this is not an issue for *nix systems but
+# will be when we expand to Windows and Mac. Better put it in now.
+############################################
+#
+# Jonas 2006-03-10
+# Add verification that ndb currently is limited to 1 logfile group
+#
+
+
+-- source include/have_ndb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP DATABASE IF EXISTS mysqltest;
+CREATE DATABASE mysqltest;
+--enable_warnings
+
+############## Duplcate Statement Testing #########
+
+--echo **** Begin Duplicate Statement Testing ****
+
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 1M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+
+# Verify that one currently can create only 1 logfile group
+--error ER_CREATE_FILEGROUP_FAILED
+CREATE LOGFILE GROUP lg2
+ADD UNDOFILE 'undofile2.dat'
+INITIAL_SIZE 1M
+UNDO_BUFFER_SIZE 1M
+ENGINE NDB;
+SHOW WARNINGS;
+
+--error ER_CREATE_FILEGROUP_FAILED
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 1M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE 1M ENGINE NDB;
+
+--error ER_ALTER_FILEGROUP_FAILED
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE 1M ENGINE=NDB;
+
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 1M
+ENGINE NDB;
+
+--error ER_CREATE_FILEGROUP_FAILED
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 1M
+ENGINE NDB;
+
+
+ALTER TABLESPACE ts1
+ADD DATAFILE 'datafile2.dat'
+INITIAL_SIZE 1M
+ENGINE=NDB;
+
+--error ER_ALTER_FILEGROUP_FAILED
+ALTER TABLESPACE ts1
+ADD DATAFILE 'datafile2.dat'
+INITIAL_SIZE 1M
+ENGINE=NDB;
+
+CREATE TABLE mysqltest.t1
+(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
+TABLESPACE ts1 STORAGE DISK
+ENGINE=NDB;
+
+--error ER_TABLE_EXISTS_ERROR
+CREATE TABLE mysqltest.t1
+(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
+TABLESPACE ts1 STORAGE DISK
+ENGINE=NDB;
+
+--error ER_TABLE_EXISTS_ERROR
+CREATE TABLE mysqltest.t1
+(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
+ENGINE=NDB;
+
+
+DROP TABLE mysqltest.t1;
+
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile2.dat'
+ENGINE=NDB;
+
+--error ER_ALTER_FILEGROUP_FAILED
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile2.dat'
+ENGINE=NDB;
+
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile.dat'
+ENGINE=NDB;
+
+--error ER_ALTER_FILEGROUP_FAILED
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile.dat'
+ENGINE=NDB;
+
+DROP TABLESPACE ts1
+ENGINE=NDB;
+
+--error ER_DROP_FILEGROUP_FAILED
+DROP TABLESPACE ts1
+ENGINE=NDB;
+
+DROP LOGFILE GROUP lg1
+ENGINE=NDB;
+
+--error ER_DROP_FILEGROUP_FAILED
+DROP LOGFILE GROUP lg1
+ENGINE=NDB;
+
+DROP DATABASE IF EXISTS mysqltest;
+
+--echo **** End Duplicate Statement Testing ****
+############# End Duplicate Statments ############
+--echo
+############ Begin CaSe Testing ##################
+--echo **** Begin Statment CaSe Testing ****
+
+creaTE LOgfilE GrOuP lg1
+adD undoFILE 'undofile.dat'
+initiAL_siZE 1M
+UnDo_BuFfEr_SiZe = 1M
+ENGInE=NDb;
+
+altER LOgFiLE GrOUp lg1
+AdD UnDOfILe 'uNdOfiLe02.daT'
+INItIAl_SIzE 1M ENgINE nDB;
+
+CrEAtE TABLEspaCE ts1
+ADD DATAfilE 'datafile.dat'
+UsE LoGFiLE GRoUP lg1
+INITiaL_SizE 1M
+ENGiNe NDb;
+
+AlTeR tAbLeSpAcE ts1
+AdD DaTaFiLe 'dAtAfiLe2.daT'
+InItIaL_SiZe 1M
+EnGiNe=NDB;
+
+CREATE TABLE t1
+(pk1 int not null primary key, b int not null, c int not null)
+TABLEspace ts1 storAGE dISk
+ENGine nDb;
+
+DROP TABLE t1;
+
+AlteR TAblespaCE ts1
+droP DATAfile 'dAtAfiLe2.daT'
+ENGINE=NDB;
+
+ALter tablesPACE ts1
+dROp dAtAfIlE 'datafile.dat'
+ENGine=Ndb;
+
+DrOp TaBleSpAcE ts1
+engINE=ndB;
+
+DrOp lOgFiLe GrOuP lg1
+EnGiNe=nDb;
+
+--echo **** End Statment CaSe Testing ****
+############ End CaSe Testing ##################
+--echo
+############ Begin = and no = Testing ##########
+--echo **** Begin = And No = Testing ****
+
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE=1M
+UNDO_BUFFER_SIZE=1M
+ENGINE=NDB;
+
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE=1M
+ENGINE=NDB;
+
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE=1M
+ENGINE=NDB;
+
+ALTER TABLESPACE ts1
+ADD DATAFILE 'datafile2.dat'
+INITIAL_SIZE=1M
+ENGINE=NDB;
+
+CREATE TABLE t1
+(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
+TABLESPACE ts1 STORAGE DISK
+ENGINE=NDB;
+
+DROP TABLE t1;
+
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile2.dat'
+ENGINE=NDB;
+
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile.dat'
+ENGINE=NDB;
+
+DROP TABLESPACE ts1
+ENGINE=NDB;
+
+DROP LOGFILE GROUP lg1
+ENGINE=NDB;
+
+--echo
+--echo **** End of = ****
+--echo
+
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 1M
+UNDO_BUFFER_SIZE 1M
+ENGINE NDB;
+
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE 1M
+ENGINE NDB;
+
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 1M
+ENGINE NDB;
+
+ALTER TABLESPACE ts1
+ADD DATAFILE 'datafile2.dat'
+INITIAL_SIZE 1M
+ENGINE NDB;
+
+CREATE TABLE t1
+(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
+TABLESPACE ts1 STORAGE DISK
+ENGINE NDB;
+
+CREATE INDEX b_i on t1(b);
+CREATE INDEX bc_i on t1(b, c);
+
+DROP TABLE t1;
+
+# bug#20053
+
+CREATE TABLESPACE ts2
+ADD DATAFILE 'datafile3.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 1M
+ENGINE NDB;
+
+--error ER_ALTER_FILEGROUP_FAILED
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile3.dat'
+ENGINE NDB;
+
+--error ER_ALTER_FILEGROUP_FAILED
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile2.dat'
+ENGINE NDB;
+# bug#20053
+
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile2.dat'
+ENGINE NDB;
+
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile.dat'
+ENGINE NDB;
+
+DROP TABLESPACE ts1
+ENGINE NDB;
+
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile3.dat'
+ENGINE NDB;
+
+DROP TABLESPACE ts2
+ENGINE NDB;
+
+DROP LOGFILE GROUP lg1
+ENGINE NDB;
+
+--echo **** End = And No = ****
+############ End = And No = ##################
+
+###
+#
+# bug#16341
+create table t1 (a int primary key) engine = myisam;
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--error ER_CREATE_FILEGROUP_FAILED
+--eval create logfile group lg1 add undofile '$MYSQLTEST_VARDIR/master-data/test/t1.frm' initial_size 1M undo_buffer_size = 1M engine=ndb;
+
+create logfile group lg1
+add undofile 'undofile.dat'
+initial_size 1M
+undo_buffer_size = 1M
+engine=ndb;
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--error ER_CREATE_FILEGROUP_FAILED
+--eval create tablespace ts1 add datafile '$MYSQLTEST_VARDIR/master-data/test/t1.frm' use logfile group lg1 initial_size 1M engine ndb;
+
+--error ER_DROP_FILEGROUP_FAILED
+drop tablespace ts1
+engine ndb;
+
+drop logfile group lg1
+engine ndb;
+
+drop table t1;
+
+# End 5.1 test
diff --git a/mysql-test/t/ndb_dd_disk2memory.test b/mysql-test/t/ndb_dd_disk2memory.test
new file mode 100644
index 00000000000..0f819b54fb2
--- /dev/null
+++ b/mysql-test/t/ndb_dd_disk2memory.test
@@ -0,0 +1,292 @@
+########################################
+# Author: JBM
+# Date: 2006-01-12
+# Purpose: To test using ndb memory and
+# disk tables together.
+########################################
+
+-- source include/have_ndb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+--enable_warnings
+
+############ Test Setup Section #############
+-- echo **** Test Setup Section ****
+
+CREATE LOGFILE GROUP log_group1
+ADD UNDOFILE './log_group1/undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+
+CREATE TABLESPACE table_space1
+ADD DATAFILE './table_space1/datafile.dat'
+USE LOGFILE GROUP log_group1
+INITIAL_SIZE 12M
+ENGINE NDB;
+
+
+CREATE TABLE test.t1
+(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
+TABLESPACE table_space1 STORAGE DISK
+ENGINE=NDB;
+
+CREATE TABLE test.t2
+(pk2 INT NOT NULL PRIMARY KEY, b2 INT NOT NULL, c2 INT NOT NULL)
+ENGINE=NDB;
+
+--echo
+##################### Data load for first test ####################
+--echo **** Data load for first test ****
+
+INSERT INTO test.t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
+(11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15),
+(16,16,16),(17,17,17),(18,18,18),(19,19,19),(20,20,20),
+(21,21,21),(22,22,22),(23,23,23),(24,24,24),(25,25,25),
+(26,26,26),(27,27,27),(28,28,28),(29,29,29),(30,30,30),
+(31,31,31),(32,32,32),(33,33,33),(34,34,34),(35,35,35),
+(36,36,36),(37,37,37),(38,38,38),(39,39,39),(40,40,40),
+(41,41,41),(42,42,42),(43,43,43),(44,44,44),(45,45,45),
+(46,46,46),(47,47,47),(48,48,48),(49,49,49),(50,50,50),
+(51,51,51),(52,52,52),(53,53,53),(54,54,54),(55,55,55),
+(56,56,56),(57,57,57),(58,58,58),(59,59,59),(60,60,60),
+(61,61,61),(62,62,62),(63,63,63),(64,64,64),(65,65,65),
+(66,66,66),(67,67,67),(68,68,68),(69,69,69),(70,70,70),
+(71,71,71),(72,72,72),(73,73,73),(74,74,74),(75,75,75);
+
+
+INSERT INTO test.t2 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
+(11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15),
+(16,16,16),(17,17,17),(18,18,18),(19,19,19),(20,20,20),
+(21,21,21),(22,22,22),(23,23,23),(24,24,24),(25,25,25),
+(26,26,26),(27,27,27),(28,28,28),(29,29,29),(30,30,30),
+(31,31,31),(32,32,32),(33,33,33),(34,34,34),(35,35,35),
+(36,36,36),(37,37,37),(38,38,38),(39,39,39),(40,40,40),
+(41,41,41),(42,42,42),(43,43,43),(44,44,44),(45,45,45),
+(46,46,46),(47,47,47),(48,48,48),(49,49,49),(50,50,50),
+(51,51,51),(52,52,52),(53,53,53),(54,54,54),(55,55,55),
+(56,56,56),(57,57,57),(58,58,58),(59,59,59),(60,60,60),
+(61,61,61),(62,62,62),(63,63,63),(64,64,64),(65,65,65),
+(66,66,66),(67,67,67),(68,68,68),(69,69,69),(70,70,70),
+(71,71,71),(72,72,72),(73,73,73),(74,74,74),(75,75,75);
+
+--echo
+##################### Test 1 Section Begins ###############
+--echo *** Test 1 Section Begins ***
+SELECT COUNT(*) FROM test.t2 LEFT JOIN test.t1 ON pk2=pk1 WHERE b2 IN (4);
+SELECT * FROM test.t2 LEFT JOIN test.t1 ON pk2=pk1 WHERE b2 IN (4);
+SELECT COUNT(*) FROM test.t1 LEFT JOIN test.t2 ON pk1=pk2 WHERE b IN (4);
+SELECT COUNT(*) FROM test.t1 LEFT JOIN test.t2 ON b=b2 WHERE pk1 IN (75);
+SELECT b, c FROM test.t1 LEFT JOIN test.t2 ON pk1=pk2 ORDER BY b;
+--echo
+####################### Test 1 Section End ################
+
+##################### Setup for test 2 ####################
+--echo *** Setup for test 2 ****
+DELETE FROM test.t1;
+INSERT INTO test.t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
+(11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15),
+(16,16,16),(17,17,17),(18,18,18),(19,19,19),(20,20,20),
+(21,21,21),(22,22,22),(23,23,23),(24,24,24),(25,25,25),
+(26,26,26),(27,27,27),(28,28,28),(29,29,29),(30,30,30),
+(31,31,31),(32,32,32),(33,33,33),(34,34,34),(35,35,35),
+(36,36,36),(37,37,37),(38,38,38),(39,39,39),(40,40,40),
+(41,41,41),(42,42,42),(43,43,43),(44,44,44),(45,45,45);
+--echo
+############################# Test Section 2 ###############
+--echo **** Test Section 2 ****
+SELECT b, c FROM test.t1 LEFT JOIN test.t2 ON pk1=pk2 ORDER BY b;
+SELECT COUNT(*) FROM test.t1 LEFT JOIN test.t2 ON b=b2;
+SELECT COUNT(*) FROM test.t1 RIGHT JOIN test.t2 ON b=b2;
+SHOW CREATE TABLE test.t2;
+SHOW CREATE TABLE test.t1;
+ALTER TABLE test.t2 TABLESPACE table_space1 STORAGE DISK
+ENGINE=NDB;
+SHOW CREATE TABLE test.t2;
+ALTER TABLE test.t1 ENGINE=NDBCLUSTER;
+SHOW CREATE TABLE test.t1;
+--echo
+######################### End Test Section 2 #################
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+##################### Setup for Test Section 3 ###############
+--echo *** Setup for Test Section 3 ***
+CREATE TABLE test.t1 (
+ usr_id INT unsigned NOT NULL,
+ uniq_id INT unsigned NOT NULL AUTO_INCREMENT,
+ start_num INT unsigned NOT NULL DEFAULT 1,
+ increment INT unsigned NOT NULL DEFAULT 1,
+ PRIMARY KEY (uniq_id),
+ INDEX usr_uniq_idx (usr_id, uniq_id),
+ INDEX uniq_usr_idx (uniq_id, usr_id))
+TABLESPACE table_space1 STORAGE DISK
+ENGINE=NDB;
+
+
+CREATE TABLE test.t2 (
+ id INT unsigned NOT NULL DEFAULT 0,
+ usr2_id INT unsigned NOT NULL DEFAULT 0,
+ max INT unsigned NOT NULL DEFAULT 0,
+ c_amount INT unsigned NOT NULL DEFAULT 0,
+ d_max INT unsigned NOT NULL DEFAULT 0,
+ d_num INT unsigned NOT NULL DEFAULT 0,
+ orig_time INT unsigned NOT NULL DEFAULT 0,
+ c_time INT unsigned NOT NULL DEFAULT 0,
+ active ENUM ("no","yes") NOT NULL,
+ PRIMARY KEY (id,usr2_id),
+ INDEX id_idx (id),
+ INDEX usr2_idx (usr2_id))
+ENGINE=NDB;
+
+INSERT INTO test.t1 VALUES (3,NULL,0,50),(3,NULL,0,200),(3,NULL,0,25),(3,NULL,0,84676),(3,NULL,0,235),(3,NULL,0,10),(3,NULL,0,3098),(3,NULL,0,2947),(3,NULL,0,8987),(3,NULL,0,8347654),(3,NULL,0,20398),(3,NULL,0,8976),(3,NULL,0,500),(3,NULL,0,198);
+
+--echo
+###################### Test Section 3 ######################
+--echo **** Test Section 3 ****
+SELECT test.t1.usr_id,test.t1.uniq_id,test.t1.increment,
+test.t2.usr2_id,test.t2.c_amount,test.t2.max
+FROM test.t1
+LEFT JOIN test.t2 ON test.t2.id = test.t1.uniq_id
+WHERE test.t1.uniq_id = 4
+ORDER BY test.t2.c_amount;
+
+INSERT INTO test.t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes');
+INSERT INTO test.t2 VALUES (4,3,3000,6000,0,0,746584,837484,'yes');
+INSERT INTO test.t2 VALUES (7,3,1000,2000,0,0,746294,937484,'yes');
+
+SELECT test.t1.usr_id,test.t1.uniq_id,test.t1.increment,
+test.t2.usr2_id,test.t2.c_amount,test.t2.max
+FROM test.t1
+LEFT JOIN test.t2 ON test.t2.id = test.t1.uniq_id
+WHERE test.t1.uniq_id = 4
+ORDER BY test.t2.c_amount;
+--echo
+####################### End Section 3 #########################
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+
+########## Test that use to be in ndb_dd_advance.test #########
+########## ndb_dd_advance.test is now ndb_dd_alter.test #######
+#### Use group by asc and dec; Use having; Use order by. ####
+
+CREATE TABLE test.t1 (
+ a1 smallint NOT NULL,
+ a2 int NOT NULL,
+ a3 bigint NOT NULL,
+ a4 char(10),
+ a5 decimal(5,1),
+ a6 time,
+ a7 date,
+ a8 datetime,
+ a9 VARCHAR(255),
+ a10 blob,
+ PRIMARY KEY(a1)
+) TABLESPACE table_space1 STORAGE DISK ENGINE=NDB;
+
+CREATE TABLE test.t2 (
+ b1 smallint NOT NULL,
+ b2 int NOT NULL,
+ b3 bigint NOT NULL,
+ b4 char(10),
+ b5 decimal(5,1),
+ b6 time,
+ b7 date,
+ b8 datetime,
+ b9 VARCHAR(255),
+ b10 blob,
+ PRIMARY KEY(b1)
+) ENGINE=NDB;
+
+### ADD Some DATA to tables ######
+
+
+let $1=20;
+disable_query_log;
+while ($1)
+{
+ eval insert into test.t1 values($1, $1+1, $1+2000000000, "aaa$1", 34.2, '4:3:2', '2006-1-1', '1971-5-28 16:55:03', "bbbbbbbbbbbbb$1", "binary data");
+ eval insert into test.t2 values($1+2, $1+3, $1+3000000000, "aaa$1", 35.2, '4:3:2', '2006-1-1', '1971-5-28 16:55:03', "bbbbbbbbbbbbb$1", "binary data");
+ dec $1;
+}
+
+ALTER TABLE test.t1 ADD INDEX (a2), ADD INDEX (a3), ADD INDEX (a8);
+ALTER TABLE test.t2 ADD INDEX (b2), ADD INDEX (b3), ADD INDEX (b8);
+SHOW CREATE TABLE test.t1;
+SHOW CREATE TABLE test.t2;
+SELECT * FROM test.t1 order by a1;
+SELECT * FROM test.t2 order by b1;
+SELECT COUNT(a1), a1, COUNT(a1)*a1 FROM test.t1 GROUP BY a1;
+SELECT COUNT(a2), (a2+1), COUNT(a2)*(a2+0) FROM test.t1 GROUP BY a2;
+
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+
+CREATE TABLE test.t1 (a INT NOT NULL,
+b CHAR(5), c TEXT, d INT NOT NULL PRIMARY KEY) TABLESPACE
+table_space1 STORAGE DISK ENGINE=NDB;
+
+insert into test.t1 (a,b,c,d) values (1,'a','Jonas',1),(2,'b','Tomas',2),
+(3,'c','Pekka',3),(4,'d','Martin',4),(5,'e','Stewart',5),(6,'f','Jeb',6),
+(7,'g','Serge',7),(8,'h','Clavin',8);
+select distinct a from test.t1 group by b,a having a > 4 order by a desc;
+select distinct a,c from test.t1 group by b,c,a having a > 2 order by a desc;
+select distinct a from test.t1 group by b,a having a > 1 order by a asc;
+select distinct a,c from test.t1 group by b,c,a having a > 3 order by a asc;
+drop table test.t1;
+
+create table test.t1 (a char(1), key(a)) TABLESPACE table_space1
+STORAGE DISK ENGINE=NDB;
+insert into test.t1 values('1'),('1'),('1'),('2'),('2'),('3'),('3');
+select * from test.t1 where a >= '1' order by a;
+select distinct a from test.t1 order by a desc;
+select distinct a from test.t1 where a >= '1' order by a desc;
+select distinct a from test.t1 where a >= '1' order by a asc;
+drop table test.t1;
+
+CREATE TABLE test.t1 (email varchar(50), infoID BIGINT, dateentered DATETIME)
+TABLESPACE table_space1 STORAGE DISK ENGINE=NDB;
+CREATE TABLE test.t2 (infoID BIGINT, shipcode varchar(10)) ENGINE=NDB;
+
+INSERT INTO test.t1 (email, infoID, dateentered) VALUES
+ ('test1@testdomain.com', 1, '2002-07-30 22:56:38'),
+ ('test1@testdomain.com', 1, '2002-07-27 22:58:16'),
+ ('test2@testdomain.com', 1, '2002-06-19 15:22:19'),
+ ('test2@testdomain.com', 2, '2002-06-18 14:23:47'),
+ ('test3@testdomain.com', 1, '2002-05-19 22:17:32');
+
+INSERT INTO test.t2(infoID, shipcode) VALUES
+ (1, 'Z001'),
+ (2, 'R002');
+
+SELECT DISTINCTROW email, shipcode FROM test.t1, test.t2
+WHERE t1.infoID=t2.infoID order by email, shipcode;
+SELECT DISTINCTROW email FROM test.t1 ORDER BY dateentered DESC;
+SELECT DISTINCTROW email, shipcode FROM test.t1, test.t2
+WHERE test.t1.infoID=test.t2.infoID ORDER BY dateentered DESC;
+
+DROP TABLE test.t1,test.t2;
+
+#################
+# Test Cleanup
+#################
+
+ALTER TABLESPACE table_space1
+DROP DATAFILE './table_space1/datafile.dat'
+ENGINE = NDB;
+
+DROP TABLESPACE table_space1
+ENGINE = NDB;
+
+DROP LOGFILE GROUP log_group1
+ENGINE =NDB;
+
+#End 5.1 test case
+
diff --git a/mysql-test/t/ndb_dd_dump.test b/mysql-test/t/ndb_dd_dump.test
new file mode 100644
index 00000000000..38ceafb7d80
--- /dev/null
+++ b/mysql-test/t/ndb_dd_dump.test
@@ -0,0 +1,288 @@
+-- source include/have_ndb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2, t3;
+--enable_warnings
+
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile_lg1_01.dat'
+INITIAL_SIZE 2M
+UNDO_BUFFER_SIZE = 1M
+ENGINE NDB;
+
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile_lg1_02.dat'
+INITIAL_SIZE = 4M
+ENGINE NDB;
+
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile_ts1_01.dat'
+USE LOGFILE GROUP lg1
+EXTENT_SIZE 1M
+INITIAL_SIZE 2M
+ENGINE NDB;
+
+ALTER TABLESPACE ts1
+ADD DATAFILE 'datafile_ts1_02.dat'
+INITIAL_SIZE = 1M
+ENGINE=NDB;
+
+CREATE TABLESPACE ts2
+ADD DATAFILE 'datafile_ts2_01.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 2M
+ENGINE NDB;
+
+CREATE TABLESPACE ts3
+ADD DATAFILE 'datafile_ts3_01.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 4M
+ENGINE NDB;
+
+########################################
+# Create a table using this tablespace
+########################################
+
+CREATE TABLE t1
+(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
+TABLESPACE ts1 STORAGE DISK
+ENGINE=NDB;
+
+CREATE TABLE t2
+(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
+TABLESPACE ts2 STORAGE DISK
+ENGINE=NDB;
+
+CREATE TABLE t3
+(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
+TABLESPACE ts3 STORAGE DISK
+ENGINE=NDB;
+
+INSERT INTO t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
+(11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15),
+(16,16,16),(17,17,17),(18,18,18),(19,19,19),(20,20,20),
+(21,21,21),(22,22,22),(23,23,23),(24,24,24),(25,25,25),
+(26,26,26),(27,27,27),(28,28,28),(29,29,29),(30,30,30),
+(31,31,31),(32,32,32),(33,33,33),(34,34,34),(35,35,35),
+(36,36,36),(37,37,37),(38,38,38),(39,39,39),(40,40,40),
+(41,41,41),(42,42,42),(43,43,43),(44,44,44),(45,45,45),
+(46,46,46),(47,47,47),(48,48,48),(49,49,49),(50,50,50),
+(51,51,51),(52,52,52),(53,53,53),(54,54,54),(55,55,55),
+(56,56,56),(57,57,57),(58,58,58),(59,59,59),(60,60,60),
+(61,61,61),(62,62,62),(63,63,63),(64,64,64),(65,65,65),
+(66,66,66),(67,67,67),(68,68,68),(69,69,69),(70,70,70),
+(71,71,71),(72,72,72),(73,73,73),(74,74,74),(75,75,75),
+(76,76,76),(77,77,77),(78,78,78),(79,79,79),(80,80,80),
+(81,81,81),(82,82,82),(83,83,83),(84,84,84),(85,85,85),
+(86,86,86),(87,87,87),(88,88,88),(89,89,89),(90,90,90),
+(91,91,91),(92,92,92),(93,93,93),(94,94,94),(95,95,95),
+(96,96,96),(97,97,97),(98,98,98),(99,99,99),(100,100,100),
+(101,101,101),(102,102,102),(103,103,103),(104,104,104),(105,105,105),
+(106,106,106),(107,107,107),(108,108,108),(109,109,109),(110,110,110),
+(111,111,111),(112,112,112),(113,113,113),(114,114,114),(115,115,115),
+(116,116,116),(117,117,117),(118,118,118),(119,119,119),(120,120,120),
+(121,121,121),(122,122,122),(123,123,123),(124,124,124),(125,125,125),
+(126,126,126),(127,127,127),(128,128,128),(129,129,129),(130,130,130),
+(131,131,131),(132,132,132),(133,133,133),(134,134,134),(135,135,135),
+(136,136,136),(137,137,137),(138,138,138),(139,139,139),(140,140,140),
+(141,141,141),(142,142,142),(143,143,143),(144,144,144),(145,145,145),
+(146,146,146),(147,147,147),(148,148,148),(149,149,149),(150,150,150),
+(151,151,151),(152,152,152),(153,153,153),(154,154,154),(155,155,155),
+(156,156,156),(157,157,157),(158,158,158),(159,159,159),(160,160,160),
+(161,161,161),(162,162,162),(163,163,163),(164,164,164),(165,165,165),
+(166,166,166),(167,167,167),(168,168,168),(169,169,169),(170,170,170),
+(171,171,171),(172,172,172),(173,173,173),(174,174,174),(175,175,175),
+(176,176,176),(177,177,177),(178,178,178),(179,179,179),(180,180,180),
+(181,181,181),(182,182,182),(183,183,183),(184,184,184),(185,185,185),
+(186,186,186),(187,187,187),(188,188,188),(189,189,189),(190,190,190),
+(191,191,191),(192,192,192),(193,193,193),(194,194,194),(195,195,195),
+(196,196,196),(197,197,197),(198,198,198),(199,199,199),(200,200,200),
+(201,201,201),(202,202,202),(203,203,203),(204,204,204),(205,205,205),
+(206,206,206),(207,207,207),(208,208,208),(209,209,209),(210,210,210),
+(211,211,211),(212,212,212),(213,213,213),(214,214,214),(215,215,215),
+(216,216,216),(217,217,217),(218,218,218),(219,219,219),(220,220,220),
+(221,221,221),(222,222,222),(223,223,223),(224,224,224),(225,225,225),
+(226,226,226),(227,227,227),(228,228,228),(229,229,229),(230,230,230),
+(231,231,231),(232,232,232),(233,233,233),(234,234,234),(235,235,235),
+(236,236,236),(237,237,237),(238,238,238),(239,239,239),(240,240,240),
+(241,241,241),(242,242,242),(243,243,243),(244,244,244),(245,245,245),
+(246,246,246),(247,247,247),(248,248,248),(249,249,249),(250,250,250),
+(251,251,251),(252,252,252),(253,253,253),(254,254,254),(255,255,255),
+(256,256,256),(257,257,257),(258,258,258),(259,259,259),(260,260,260),
+(261,261,261),(262,262,262),(263,263,263),(264,264,264),(265,265,265),
+(266,266,266),(267,267,267),(268,268,268),(269,269,269),(270,270,270),
+(271,271,271),(272,272,272),(273,273,273),(274,274,274),(275,275,275),
+(276,276,276),(277,277,277),(278,278,278),(279,279,279),(280,280,280),
+(281,281,281),(282,282,282),(283,283,283),(284,284,284),(285,285,285),
+(286,286,286),(287,287,287),(288,288,288),(289,289,289),(290,290,290),
+(291,291,291),(292,292,292),(293,293,293),(294,294,294),(295,295,295),
+(296,296,296),(297,297,297),(298,298,298),(299,299,299),(300,300,300),
+(301,301,301),(302,302,302),(303,303,303),(304,304,304),(305,305,305),
+(306,306,306),(307,307,307),(308,308,308),(309,309,309),(310,310,310),
+(311,311,311),(312,312,312),(313,313,313),(314,314,314),(315,315,315),
+(316,316,316),(317,317,317),(318,318,318),(319,319,319),(320,320,320),
+(321,321,321),(322,322,322),(323,323,323),(324,324,324),(325,325,325),
+(326,326,326),(327,327,327),(328,328,328),(329,329,329),(330,330,330),
+(331,331,331),(332,332,332),(333,333,333),(334,334,334),(335,335,335),
+(336,336,336),(337,337,337),(338,338,338),(339,339,339),(340,340,340),
+(341,341,341),(342,342,342),(343,343,343),(344,344,344),(345,345,345),
+(346,346,346),(347,347,347),(348,348,348),(349,349,349),(350,350,350),
+(351,351,351),(352,352,352),(353,353,353),(354,354,354),(355,355,355),
+(356,356,356),(357,357,357),(358,358,358),(359,359,359),(360,360,360),
+(361,361,361),(362,362,362),(363,363,363),(364,364,364),(365,365,365),
+(366,366,366),(367,367,367),(368,368,368),(369,369,369),(370,370,370),
+(371,371,371),(372,372,372),(373,373,373),(374,374,374),(375,375,375),
+(376,376,376),(377,377,377),(378,378,378),(379,379,379),(380,380,380),
+(381,381,381),(382,382,382),(383,383,383),(384,384,384),(385,385,385),
+(386,386,386),(387,387,387),(388,388,388),(389,389,389),(390,390,390),
+(391,391,391),(392,392,392),(393,393,393),(394,394,394),(395,395,395),
+(396,396,396),(397,397,397),(398,398,398),(399,399,399),(400,400,400),
+(401,401,401),(402,402,402),(403,403,403),(404,404,404),(405,405,405),
+(406,406,406),(407,407,407),(408,408,408),(409,409,409),(410,410,410),
+(411,411,411),(412,412,412),(413,413,413),(414,414,414),(415,415,415),
+(416,416,416),(417,417,417),(418,418,418),(419,419,419),(420,420,420),
+(421,421,421),(422,422,422),(423,423,423),(424,424,424),(425,425,425),
+(426,426,426),(427,427,427),(428,428,428),(429,429,429),(430,430,430),
+(431,431,431),(432,432,432),(433,433,433),(434,434,434),(435,435,435),
+(436,436,436),(437,437,437),(438,438,438),(439,439,439),(440,440,440),
+(441,441,441),(442,442,442),(443,443,443),(444,444,444),(445,445,445),
+(446,446,446),(447,447,447),(448,448,448),(449,449,449),(450,450,450),
+(451,451,451),(452,452,452),(453,453,453),(454,454,454),(455,455,455),
+(456,456,456),(457,457,457),(458,458,458),(459,459,459),(460,460,460),
+(461,461,461),(462,462,462),(463,463,463),(464,464,464),(465,465,465),
+(466,466,466),(467,467,467),(468,468,468),(469,469,469),(470,470,470),
+(471,471,471),(472,472,472),(473,473,473),(474,474,474),(475,475,475),
+(476,476,476),(477,477,477),(478,478,478),(479,479,479),(480,480,480),
+(481,481,481),(482,482,482),(483,483,483),(484,484,484),(485,485,485),
+(486,486,486),(487,487,487),(488,488,488),(489,489,489),(490,490,490),
+(491,491,491),(492,492,492),(493,493,493),(494,494,494),(495,495,495),
+(496,496,496),(497,497,497),(498,498,498),(499,499,499),(500, 500, 500);
+
+INSERT INTO t2 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5);
+
+INSERT INTO t3 VALUES
+(1,1,1);
+
+--exec $MYSQL_DUMP --skip-comments --compact -Y test > $MYSQLTEST_VARDIR/tmp/ndb_dd_dump.sql
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile_ts1_01.dat'
+ENGINE = NDB;
+
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile_ts1_02.dat'
+ENGINE = NDB;
+
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile_ts2_01.dat'
+ENGINE = NDB;
+
+ALTER TABLESPACE ts3
+DROP DATAFILE 'datafile_ts3_01.dat'
+ENGINE = NDB;
+
+DROP TABLESPACE ts1 ENGINE = NDB;
+DROP TABLESPACE ts2 ENGINE = NDB;
+DROP TABLESPACE ts3 ENGINE = NDB;
+
+DROP LOGFILE GROUP lg1 ENGINE = NDB;
+
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ndb_dd_dump.sql
+
+SELECT DISTINCT
+ LOGFILE_GROUP_NAME,
+ FILE_NAME,
+ TOTAL_EXTENTS,
+ INITIAL_SIZE,
+ ENGINE
+FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE="UNDO LOG" ORDER BY FILE_NAME;
+
+SELECT DISTINCT
+ TABLESPACE_NAME,
+ LOGFILE_GROUP_NAME,
+ FILE_NAME,
+ EXTENT_SIZE,
+ INITIAL_SIZE,
+ ENGINE
+FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE="DATAFILE" ORDER BY FILE_NAME;
+
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM t2;
+SELECT COUNT(*) FROM t3;
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+
+#### BUG 18856 test case comented out
+##### Use "SELECT * INTO OUTFILE" to dump data and "LOAD DATA INFILE" to load ##### data back to the data file.
+
+#CREATE TABLE test.t (
+# a smallint NOT NULL,
+# b int NOT NULL,
+# c bigint NOT NULL,
+# d char(10),
+# e TEXT,
+# f VARCHAR(255),
+# PRIMARY KEY(a)
+#) TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+
+# ALTER TABLE test.t ADD INDEX (d), ADD INDEX (f);
+# SHOW CREATE TABLE test.t;
+
+# insert records into tables
+
+# let $1=100;
+# disable_query_log;
+# while ($1)
+# {
+# eval insert into test.t values($1, $1+1, $1+2, "aaa$1", "bbb$1", "ccccc$1");
+# dec $1;
+# }
+# enable_query_log;
+
+# SELECT * FROM test.t order by a;
+
+# SELECT * INTO OUTFILE 't_backup' FROM test.t;
+# TRUNCATE test.t;
+
+#'TRUNCATE test.t' failed: 1205: Lock wait timeout exceeded; try restarting #transaction. TABLESPACE ts STORAGE DISK ENGINE=NDB;
+
+# SELECT count(*) FROM test.t;
+# LOAD DATA INFILE 't_backup' INTO TABLE test.t;
+
+# SELECT * FROM test.t order by a;
+
+# DROP TABLE test.t;
+
+
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile_ts1_01.dat'
+ENGINE = NDB;
+
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile_ts1_02.dat'
+ENGINE = NDB;
+
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile_ts2_01.dat'
+ENGINE = NDB;
+
+ALTER TABLESPACE ts3
+DROP DATAFILE 'datafile_ts3_01.dat'
+ENGINE = NDB;
+
+DROP TABLESPACE ts1 ENGINE = NDB;
+DROP TABLESPACE ts2 ENGINE = NDB;
+DROP TABLESPACE ts3 ENGINE = NDB;
+
+DROP LOGFILE GROUP lg1 ENGINE = NDB;
+
+#End 5.1 test case
diff --git a/mysql-test/t/ndb_dd_sql_features.test b/mysql-test/t/ndb_dd_sql_features.test
new file mode 100644
index 00000000000..f46cb217ab4
--- /dev/null
+++ b/mysql-test/t/ndb_dd_sql_features.test
@@ -0,0 +1,551 @@
+##############################################################
+# Author: Nikolay
+# Date: 2006-04-01
+# Purpose: Specific Blob and Varchar testing using disk tables.
+##############################################################
+# Create Stored procedures that use disk based tables.
+# Create function that operate on disk based tables.
+# Create triggers that operate on disk based tables.
+# Create views that operate on disk based tables.
+# Try to create FK constraints on disk based tables.
+# Create and use disk based table that use auto inc.
+# Create test that use transaction (commit, rollback)
+# Create large disk base table, do random queries, check cache hits,
+# do same query 10 times check cache hits.
+# Create test that uses COUNT(), SUM(), MAX(), MIN(),
+# NOW(), USER(), ... other built in # SQL functions
+# Create test that uses locks.
+# Create test using truncate.
+##############################################################
+# Author: Jonathan
+# Date: 2006-08-28
+# Change: Remove all the create and drop LFG and TS except
+# The first create and the last drop to make test
+# run faster.
+# In addition, renamed test to be to a name that
+# gives a better idea of what the test is about
+###########################################################
+-- source include/have_ndb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+--enable_warnings
+
+#### Copy data from table in one table space to table in ###
+#### different table space. ####
+--echo *****
+--echo **** Copy data from table in one table space to table
+--echo **** in different table space
+--echo *****
+
+ CREATE LOGFILE GROUP lg
+ ADD UNDOFILE './lg_group/undofile.dat'
+ INITIAL_SIZE 16M
+ UNDO_BUFFER_SIZE = 1M
+ ENGINE=NDB;
+
+ CREATE TABLESPACE ts1
+ ADD DATAFILE './table_space1/datafile.dat'
+ USE LOGFILE GROUP lg
+ INITIAL_SIZE 25M
+ ENGINE NDB;
+
+ CREATE TABLESPACE ts2
+ ADD DATAFILE './table_space2/datafile.dat'
+ USE LOGFILE GROUP lg
+ INITIAL_SIZE 20M
+ ENGINE NDB;
+
+ CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(256), a3 BLOB)
+ TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+ CREATE TABLE test.t2 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(256), a3 BLOB)
+ TABLESPACE ts2 STORAGE DISK ENGINE=NDB;
+
+ SHOW CREATE TABLE test.t1;
+ SHOW CREATE TABLE test.t2;
+
+ INSERT INTO test.t1 VALUES (1,'111111','aaaaaaaa');
+ INSERT INTO test.t1 VALUES (2,'222222','bbbbbbbb');
+ SELECT * FROM test.t1 ORDER BY a1;
+ INSERT INTO test.t2(a1,a2,a3) SELECT * FROM test.t1;
+ SELECT * FROM test.t2 ORDER BY a1;
+
+ DROP TABLE test.t1, test.t2;
+
+ # populate BLOB field with large data
+
+set @vc1 = repeat('a', 200);
+set @vc2 = repeat('b', 500);
+set @vc3 = repeat('c', 1000);
+set @vc4 = repeat('d', 4000);
+
+# x0 size 256
+set @x0 = '01234567012345670123456701234567';
+set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
+
+# b1 length 2000+256
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@x0);
+# d1 length 3000
+set @d1 = 'dd1';
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+
+# b2 length 20000
+set @b2 = 'b2';
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+# d2 length 30000
+set @d2 = 'dd2';
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+
+select length(@x0),length(@b1),length(@d1) from dual;
+select length(@x0),length(@b2),length(@d2) from dual;
+
+ CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(5000), a3 BLOB)
+ TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+ CREATE TABLE test.t2 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(5000), a3 BLOB)
+ TABLESPACE ts2 STORAGE DISK ENGINE=NDB;
+
+ SHOW CREATE TABLE test.t1;
+ SHOW CREATE TABLE test.t2;
+
+ INSERT INTO test.t1 VALUES (1,@vc1,@d1);
+ INSERT INTO test.t1 VALUES (2,@vc2,@b1);
+ INSERT INTO test.t1 VALUES (3,@vc3,@d2);
+ INSERT INTO test.t1 VALUES (4,@vc4,@b2);
+
+ SELECT a1,length(a2),substr(a2,180,2),length(a3),substr(a3,1+3*900,3)
+ FROM test.t1 WHERE a1=1;
+ SELECT a1,length(a2),substr(a2,480,2),length(a3),substr(a3,1+2*900,3)
+ FROM test.t1 where a1=2;
+
+ INSERT INTO test.t2(a1,a2,a3) SELECT * FROM test.t1;
+ SELECT a1,length(a2),substr(a2,180,2),length(a3),substr(a3,1+3*900,3)
+ FROM test.t2 WHERE a1=1;
+ SELECT a1,length(a2),substr(a2,480,2),length(a3),substr(a3,1+2*900,3)
+ FROM test.t2 where a1=2;
+
+
+ DROP TABLE test.t1, test.t2;
+
+#### Insert, Update, Delete from NDB table with BLOB fields ####
+--echo *****
+--echo **** Insert, Update, Delete from NDB table with BLOB fields
+--echo *****
+
+set @vc1 = repeat('a', 200);
+set @vc2 = repeat('b', 500);
+set @vc3 = repeat('c', 1000);
+set @vc4 = repeat('d', 4000);
+set @vc5 = repeat('d', 5000);
+
+set @bb1 = repeat('1', 2000);
+set @bb2 = repeat('2', 5000);
+set @bb3 = repeat('3', 10000);
+set @bb4 = repeat('4', 40000);
+set @bb5 = repeat('5', 50000);
+
+select length(@vc1),length(@vc2),length(@vc3),length(@vc4),length(@vc5)
+from dual;
+select length(@bb1),length(@bb2),length(@bb3),length(@bb4),length(@bb5)
+from dual;
+
+ CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(5000), a3 BLOB)
+ TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+# CREATE TABLE test.t2 (a1 int NOT NULL, a2 VARCHAR(5000), a3 BLOB)
+# TABLESPACE ts2 STORAGE DISK ENGINE=NDB;
+
+ INSERT INTO test.t1 VALUES (1,@vc1,@bb1);
+ INSERT INTO test.t1 VALUES (2,@vc2,@bb2);
+ INSERT INTO test.t1 VALUES (3,@vc3,@bb3);
+ INSERT INTO test.t1 VALUES (4,@vc4,@bb4);
+ INSERT INTO test.t1 VALUES (5,@vc5,@bb5);
+
+ UPDATE test.t1 SET a2=@vc5, a3=@bb5 WHERE a1=1;
+ SELECT a1,length(a2),substr(a2,4998,2),length(a3),substr(a3,49997,3)
+ FROM test.t1 WHERE a1=1;
+
+ UPDATE test.t1 SET a2=@vc4, a3=@bb4 WHERE a1=2;
+ SELECT a1,length(a2),substr(a2,3998,2),length(a3),substr(a3,39997,3)
+ FROM test.t1 WHERE a1=2;
+
+ UPDATE test.t1 SET a2=@vc2, a3=@bb2 WHERE a1=3;
+ SELECT a1,length(a2),substr(a2,498,2),length(a3),substr(a3,3997,3)
+ FROM test.t1 WHERE a1=3;
+
+ UPDATE test.t1 SET a2=@vc3, a3=@bb3 WHERE a1=4;
+ SELECT a1,length(a2),substr(a2,998,2),length(a3),substr(a3,9997,3)
+ FROM test.t1 WHERE a1=4;
+
+ UPDATE test.t1 SET a2=@vc1, a3=@bb1 WHERE a1=5;
+ SELECT a1,length(a2),substr(a2,198,2),length(a3),substr(a3,1997,3)
+ FROM test.t1 WHERE a1=5;
+
+ DELETE FROM test.t1 where a1=5;
+ SELECT count(*) from test.t1;
+ DELETE FROM test.t1 where a1=4;
+ SELECT count(*) from test.t1;
+ DELETE FROM test.t1 where a1=3;
+ SELECT count(*) from test.t1;
+ DELETE FROM test.t1 where a1=2;
+ SELECT count(*) from test.t1;
+ DELETE FROM test.t1 where a1=1;
+ SELECT count(*) from test.t1;
+
+ DROP TABLE test.t1;
+
+##### Create Stored procedures that use disk based tables #####
+--echo *****
+--echo **** Create Stored procedures that use disk based tables
+--echo *****
+
+delimiter //;
+ CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(256), a3 BLOB)
+ TABLESPACE ts1 STORAGE DISK ENGINE=NDB//
+ CREATE PROCEDURE test.sp1()
+ BEGIN
+ INSERT INTO test.t1 values (1,'111111','aaaaaaaa');
+ END//
+delimiter ;//
+
+ CALL test.sp1();
+ SELECT * FROM test.t1;
+
+delimiter //;
+ CREATE PROCEDURE test.sp2(n INT, vc VARCHAR(256), blb BLOB)
+ BEGIN
+ UPDATE test.t1 SET a2=vc, a3=blb where a1=n;
+ END//
+delimiter ;//
+
+ CALL test.sp2(1,'222222','bbbbbbbb');
+ SELECT * FROM test.t1;
+
+ DELETE FROM test.t1;
+ DROP PROCEDURE test.sp1;
+ DROP PROCEDURE test.sp2;
+ DROP TABLE test.t1;
+
+
+#### Create function that operate on disk based tables ####
+--echo *****
+--echo ***** Create function that operate on disk based tables
+--echo *****
+
+ CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(256), a3 BLOB)
+ TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+ let $1=100;
+ disable_query_log;
+ while ($1)
+ {
+ eval insert into test.t1 values($1, "aaaaa$1", "bbbbb$1");
+ dec $1;
+ }
+ enable_query_log;
+
+ delimiter //;
+ CREATE FUNCTION test.fn1(n INT) RETURNS INT
+ BEGIN
+ DECLARE v INT;
+ SELECT a1 INTO v FROM test.t1 WHERE a1=n;
+ RETURN v;
+ END//
+ delimiter ;//
+
+delimiter //;
+ CREATE FUNCTION test.fn2(n INT, blb BLOB) RETURNS BLOB
+ BEGIN
+ DECLARE vv BLOB;
+ UPDATE test.t1 SET a3=blb where a1=n;
+ SELECT a3 INTO vv FROM test.t1 WHERE a1=n;
+ RETURN vv;
+ END//
+ delimiter ;//
+
+ SELECT test.fn1(10) FROM DUAL;
+ SELECT test.fn2(50, 'new BLOB content') FROM DUAL;
+
+ DELETE FROM test.t1;
+ DROP FUNCTION test.fn1;
+ DROP FUNCTION test.fn2;
+ DROP TABLE test.t1;
+
+#### Create triggers that operate on disk based tables ####
+--echo *****
+--echo ***** Create triggers that operate on disk based tables
+--echo *****
+
+ CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(256), a3 BLOB)
+ TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+
+ delimiter //;
+ CREATE TRIGGER test.trg1 BEFORE INSERT ON test.t1 FOR EACH ROW
+ BEGIN
+ if isnull(new.a2) then
+ set new.a2:= 'trg1 works on a2 field';
+ end if;
+ if isnull(new.a3) then
+ set new.a3:= 'trg1 works on a3 field';
+ end if;
+ end//
+ insert into test.t1 (a1) values (1)//
+ insert into test.t1 (a1,a2) values (2, 'ccccccc')//
+ select * from test.t1 order by a1//
+ delimiter ;//
+
+ DELETE FROM test.t1;
+ DROP TRIGGER test.trg1;
+ DROP TABLE test.t1;
+
+#### Create, update views that operate on disk based tables ####
+--echo *****
+--echo ***** Create, update views that operate on disk based tables
+--echo *****
+
+
+ CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(256), a3 BLOB)
+ TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+ let $1=10;
+ disable_query_log;
+ while ($1)
+ {
+ eval insert into test.t1 values($1, "aaaaa$1", "bbbbb$1");
+ dec $1;
+ }
+ enable_query_log;
+ CREATE VIEW test.v1 AS SELECT * FROM test.t1;
+ SELECT * FROM test.v1 order by a1;
+ CHECK TABLE test.v1, test.t1;
+
+ UPDATE test.v1 SET a2='zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz' WHERE a1=5;
+ SELECT * FROM test.v1 order by a1;
+
+ DROP VIEW test.v1;
+ DELETE FROM test.t1;
+ DROP TABLE test.t1;
+
+#### Create and use disk based table that use auto inc ####
+--echo *****
+--echo ***** Create and use disk based table that use auto inc
+--echo *****
+
+ CREATE TABLE test.t1 (a1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ a2 VARCHAR(256), a3 BLOB)
+ TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+ let $1=10;
+ disable_query_log;
+ while ($1)
+ {
+ eval insert into test.t1 values(NULL, "aaaaa$1", "bbbbb$1");
+ dec $1;
+ }
+ enable_query_log;
+ SELECT * FROM test.t1 ORDER BY a1;
+ DELETE FROM test.t1;
+ DROP TABLE test.t1;
+
+
+#### Create test that use transaction (commit, rollback) ####
+--echo *****
+--echo ***** Create test that use transaction (commit, rollback)
+--echo *****
+
+ SET AUTOCOMMIT=0;
+ CREATE TABLE test.t1 (a1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ a2 VARCHAR(256), a3 BLOB)
+ TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+
+ INSERT INTO test.t1 VALUES(NULL, "aaaaa1", "bbbbb1");
+ COMMIT;
+ SELECT * FROM test.t1 ORDER BY a1;
+ INSERT INTO test.t1 VALUES(NULL, "aaaaa2", "bbbbb2");
+ ROLLBACK;
+ SELECT * FROM test.t1 ORDER BY a1;
+
+ DELETE FROM test.t1;
+ DROP TABLE test.t1;
+ SET AUTOCOMMIT=1;
+
+# Now do the same thing with START TRANSACTION without using AUTOCOMMIT.
+
+ CREATE TABLE test.t1 (a1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ a2 VARCHAR(256), a3 BLOB)
+ TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+
+ START TRANSACTION;
+ INSERT INTO test.t1 VALUES(NULL, "aaaaa1", "bbbbb1");
+ COMMIT;
+ SELECT * FROM test.t1 ORDER BY a1;
+
+ START TRANSACTION;
+ INSERT INTO test.t1 VALUES(NULL, "aaaaa2", "bbbbb2");
+ ROLLBACK;
+ SELECT * FROM test.t1 ORDER BY a1;
+
+ DELETE FROM test.t1;
+ DROP TABLE test.t1;
+
+#### Create test that uses locks ####
+--echo *****
+--echo ***** Create test that uses locks
+--echo *****
+
+ connect (con1,localhost,root,,);
+ connect (con2,localhost,root,,);
+
+# connection con1;
+--disable_warnings
+ drop table if exists test.t1;
+ CREATE TABLE test.t1 (a1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ a2 VARCHAR(256), a3 BLOB)
+ TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+--enable_warnings
+
+ LOCK TABLES test.t1 write;
+ INSERT INTO test.t1 VALUES(NULL, "aaaaa1", "bbbbb1");
+ INSERT INTO test.t1 VALUES(NULL, "aaaaa2", "bbbbb2");
+ SELECT * FROM test.t1 ORDER BY a1;
+
+ connection con2;
+ SELECT * FROM test.t1 ORDER BY a1;
+ INSERT INTO test.t1 VALUES(NULL, "aaaaa3", "bbbbb3");
+
+ connection con1;
+ UNLOCK TABLES;
+
+ connection con2;
+ INSERT INTO test.t1 VALUES(NULL, "aaaaa3", "bbbbb3");
+ SELECT * FROM test.t1 ORDER BY a1;
+ DELETE FROM test.t1;
+ DROP TABLE test.t1;
+
+ #connection defualt;
+
+#### Create large disk base table, do random queries, check cache hits ####
+--echo *****
+--echo ***** Create large disk base table, do random queries, check cache hits
+--echo *****
+
+set @vc1 = repeat('a', 200);
+SELECT @vc1 FROM DUAL;
+set @vc2 = repeat('b', 500);
+set @vc3 = repeat('b', 998);
+
+# x0 size 256
+set @x0 = '01234567012345670123456701234567';
+set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
+
+# b1 length 2000+256 (blob part aligned)
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@x0);
+# d1 length 3000
+set @d1 = 'dd1';
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+
+# b2 length 20000
+set @b2 = 'b2';
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+# d2 length 30000
+set @d2 = 'dd2';
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+
+select length(@x0),length(@b1),length(@d1) from dual;
+select length(@x0),length(@b2),length(@d2) from dual;
+
+ CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(1000), a3 BLOB)
+ TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+
+ INSERT INTO test.t1 values(1,@vc1,@d1);
+ INSERT INTO test.t1 values(2,@vc2,@d2);
+ --replace_column 9 #
+ explain SELECT * from test.t1 WHERE a1 = 1;
+
+ SELECT a1,length(a2),substr(a2,1+2*900,2),length(a3),substr(a3,1+3*900,3)
+ FROM test.t1 WHERE a1=1 ORDER BY a1;
+ SELECT a1,length(a2),substr(a2,1+2*9000,2),length(a3),substr(a3,1+3*9000,3)
+ FROM test.t1 where a1=2 ORDER BY a1;
+
+ UPDATE test.t1 set a2=@vc2,a3=@d2 where a1=1;
+ UPDATE test.t1 set a2=@vc1,a3=@d1 where a1=2;
+
+ SELECT a1,length(a2),substr(a2,1+2*9000,2),length(a3),substr(a3,1+3*9000,3)
+ FROM test.t1 where a1=1;
+ SELECT a1,length(a2),substr(a2,1+2*900,2),length(a3),substr(a3,1+3*900,3)
+ FROM test.t1 where a1=2;
+
+ #SHOW VARIABLES LIKE 'have_query_cache';
+ #SHOW STATUS LIKE 'Qcache%';
+
+ DELETE FROM test.t1;
+ DROP TABLE test.t1;
+
+#### Create test that uses COUNT(), SUM(), MAX(), ####
+##### MIN(), NOW(), USER(), TRUNCATE ####
+--echo *****
+--echo ***** Create test that uses COUNT(), SUM(), MAX(), MIN(), NOW(),
+--echo ***** USER(), TRUNCATE
+--echo *****
+
+ CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(256),
+ a3 BLOB, a4 DATE, a5 CHAR(250))
+ TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
+ let $1=100;
+ disable_query_log;
+ while ($1)
+ {
+ eval insert into test.t1 values($1, "aaaaaaaaaaaaaaaa$1",
+ "bbbbbbbbbbbbbbbbbb$1", '2006-06-20' , USER());
+ dec $1;
+ }
+ enable_query_log;
+
+ SELECT COUNT(*) from test.t1;
+ SELECT SUM(a1) from test.t1;
+ SELECT MIN(a1) from test.t1;
+ SELECT MAX(a1) from test.t1;
+ SELECT a5 from test.t1 where a1=50;
+
+
+ SELECT * from test.t1 order by a1;
+
+ DROP TABLE test.t1;
+
+ ALTER TABLESPACE ts1
+ DROP DATAFILE './table_space1/datafile.dat'
+ ENGINE=NDB;
+ DROP TABLESPACE ts1 ENGINE=NDB;
+
+ ALTER TABLESPACE ts2
+ DROP DATAFILE './table_space2/datafile.dat'
+ ENGINE=NDB;
+ DROP TABLESPACE ts2 ENGINE=NDB;
+
+ DROP LOGFILE GROUP lg
+ ENGINE=NDB;
+
+
+#End 5.1 test case
+
diff --git a/mysql-test/t/ndb_index_ordered.test b/mysql-test/t/ndb_index_ordered.test
index e6827bdbe12..a03e0729ece 100644
--- a/mysql-test/t/ndb_index_ordered.test
+++ b/mysql-test/t/ndb_index_ordered.test
@@ -354,5 +354,79 @@ create table t1 (a int, c varchar(10),
primary key using hash (a), index(c)) engine=ndb;
insert into t1 (a, c) values (1,'aaa'),(3,'bbb');
select count(*) from t1 where c<'bbb';
+drop table t1;
+
+# -- index statistics --
+
+set autocommit=1;
+show session variables like 'ndb_index_stat_%';
+
+set ndb_index_stat_enable = off;
+show session variables like 'ndb_index_stat_%';
+
+create table t1 (a int, b int, c varchar(10) not null,
+ primary key using hash (a), index(b,c)) engine=ndb;
+insert into t1 values
+ (1,10,'aaa'),(2,10,'bbb'),(3,10,'ccc'),
+ (4,20,'aaa'),(5,20,'bbb'),(6,20,'ccc'),
+ (7,30,'aaa'),(8,30,'bbb'),(9,30,'ccc');
+select count(*) from t1 where b < 10;
+select count(*) from t1 where b >= 10 and c >= 'bbb';
+select count(*) from t1 where b > 10;
+select count(*) from t1 where b <= 20 and c < 'ccc';
+select count(*) from t1 where b = 20 and c = 'ccc';
+select count(*) from t1 where b > 20;
+select count(*) from t1 where b = 30 and c > 'aaa';
+select count(*) from t1 where b <= 20;
+select count(*) from t1 where b >= 20 and c > 'aaa';
+drop table t1;
+
+set ndb_index_stat_enable = on;
+set ndb_index_stat_cache_entries = 0;
+show session variables like 'ndb_index_stat_%';
+
+create table t1 (a int, b int, c varchar(10) not null,
+ primary key using hash (a), index(b,c)) engine=ndb;
+insert into t1 values
+ (1,10,'aaa'),(2,10,'bbb'),(3,10,'ccc'),
+ (4,20,'aaa'),(5,20,'bbb'),(6,20,'ccc'),
+ (7,30,'aaa'),(8,30,'bbb'),(9,30,'ccc');
+select count(*) from t1 where b < 10;
+select count(*) from t1 where b >= 10 and c >= 'bbb';
+select count(*) from t1 where b > 10;
+select count(*) from t1 where b <= 20 and c < 'ccc';
+select count(*) from t1 where b = 20 and c = 'ccc';
+select count(*) from t1 where b > 20;
+select count(*) from t1 where b = 30 and c > 'aaa';
+select count(*) from t1 where b <= 20;
+select count(*) from t1 where b >= 20 and c > 'aaa';
+drop table t1;
+
+set ndb_index_stat_enable = on;
+set ndb_index_stat_cache_entries = 4;
+set ndb_index_stat_update_freq = 2;
+show session variables like 'ndb_index_stat_%';
+
+create table t1 (a int, b int, c varchar(10) not null,
+ primary key using hash (a), index(b,c)) engine=ndb;
+insert into t1 values
+ (1,10,'aaa'),(2,10,'bbb'),(3,10,'ccc'),
+ (4,20,'aaa'),(5,20,'bbb'),(6,20,'ccc'),
+ (7,30,'aaa'),(8,30,'bbb'),(9,30,'ccc');
+select count(*) from t1 where b < 10;
+select count(*) from t1 where b >= 10 and c >= 'bbb';
+select count(*) from t1 where b > 10;
+select count(*) from t1 where b <= 20 and c < 'ccc';
+select count(*) from t1 where b = 20 and c = 'ccc';
+select count(*) from t1 where b > 20;
+select count(*) from t1 where b = 30 and c > 'aaa';
+select count(*) from t1 where b <= 20;
+select count(*) from t1 where b >= 20 and c > 'aaa';
+drop table t1;
+
+set ndb_index_stat_enable = @@global.ndb_index_stat_enable;
+set ndb_index_stat_cache_entries = @@global.ndb_index_stat_cache_entries;
+set ndb_index_stat_update_freq = @@global.ndb_index_stat_update_freq;
+show session variables like 'ndb_index_stat_%';
# End of 4.1 tests
diff --git a/mysql-test/t/ndb_index_unique.test b/mysql-test/t/ndb_index_unique.test
index 8561b3794c4..94bba98662c 100644
--- a/mysql-test/t/ndb_index_unique.test
+++ b/mysql-test/t/ndb_index_unique.test
@@ -10,10 +10,10 @@ drop table if exists t1, t2, t3, t4, t5, t6, t7, t8;
#
CREATE TABLE t1 (
- a int unsigned NOT NULL PRIMARY KEY,
- b int unsigned not null,
- c int unsigned,
- UNIQUE(b)
+ a int NOT NULL PRIMARY KEY,
+ b int not null,
+ c int,
+ UNIQUE ib(b)
) engine=ndbcluster;
insert t1 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
@@ -29,6 +29,12 @@ delete from t1 where a = 1;
insert into t1 values(8, 2, 3);
select * from t1 order by a;
+alter table t1 drop index ib;
+insert into t1 values(1, 2, 3);
+# Bug# #18129
+--error 1169
+create unique index ib on t1(b);
+
drop table t1;
#
@@ -66,7 +72,7 @@ CREATE TABLE t2 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned not null,
- UNIQUE USING HASH (b, c)
+ UNIQUE (b, c) USING HASH
) engine=ndbcluster;
insert t2 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
@@ -90,7 +96,7 @@ CREATE TABLE t2 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned,
- UNIQUE USING HASH (b, c)
+ UNIQUE (b, c) USING HASH
) engine=ndbcluster;
#
@@ -101,7 +107,7 @@ CREATE TABLE t3 (
a int unsigned NOT NULL,
b int unsigned not null,
c int unsigned,
- PRIMARY KEY USING HASH (a, b)
+ PRIMARY KEY (a, b) USING HASH
) engine=ndbcluster;
insert t3 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
@@ -323,4 +329,12 @@ select a, sha1(b) from t1;
drop table t1;
+# bug#21873 MySQLD Crash on ALTER...ADD..UNIQUE..USING HASH statement for NDB backed table
+
+create table t1(id int not null) engine = NDB;
+
+alter table t1 add constraint uk_test unique (id) using hash;
+
+drop table t1;
+
# End of 4.1 tests
diff --git a/mysql-test/t/ndb_lock.test b/mysql-test/t/ndb_lock.test
index 48a8b77dcd7..474155e06f4 100644
--- a/mysql-test/t/ndb_lock.test
+++ b/mysql-test/t/ndb_lock.test
@@ -194,3 +194,39 @@ commit;
drop table t1;
# End of 4.1 tests
+
+#
+# Bug #17812 Previous lock table for write causes "stray" lock
+# although table is recreated
+#
+# this creating, locking, and dropping causes a subsequent hang
+# on the delete below waiting for table t2 the locking in the
+# "other" connection is relevant, as without it there is no problem
+#
+connection con1;
+create table t3 (id2 int) engine=ndb;
+
+connection con2;
+lock tables t3 write;
+unlock tables;
+
+connection con1;
+drop table t3;
+
+connection con1;
+create table t2 (id int, j int) engine=ndb;
+insert into t2 values (2, 2);
+create table t3 (id int) engine=ndb;
+
+connection con2;
+lock tables t3 read;
+
+connection con1;
+# here we get a hang before bugfix although we shouldn't
+delete t2 from t2, t3 where t2.id = t3.id;
+
+connection con2;
+unlock tables;
+
+connection con1;
+drop table t2, t3;
diff --git a/mysql-test/t/ndb_multi.test b/mysql-test/t/ndb_multi.test
index 3bc735b60d4..0f098c96fa8 100644
--- a/mysql-test/t/ndb_multi.test
+++ b/mysql-test/t/ndb_multi.test
@@ -2,8 +2,10 @@
-- source include/have_multi_ndb.inc
-- source include/not_embedded.inc
-
--disable_warnings
+connection server2;
+drop table if exists t1, t2, t3, t4;
+connection server1;
drop table if exists t1, t2, t3, t4;
--enable_warnings
@@ -37,7 +39,7 @@ drop table t1;
create table t1 (a int) engine=ndbcluster;
insert into t1 value (2);
connection server1;
-flush table t1;
+select * from t1;
select * from t1;
# Connect to server2 and use the tables from there
@@ -57,15 +59,10 @@ create table t4 (pk int primary key, b int) engine=ndb;
connection server1;
select * from t1;
select * from t3;
-show status like 'handler_discover%';
show tables like 't4';
-show status like 'handler_discover%';
show tables;
drop table t1, t2, t3, t4;
-connection server2;
-drop table t1, t3, t4;
-
# bug#21378
connection server1;
create table t1(c1 int key)ENGINE=MyISAM;
@@ -73,6 +70,7 @@ insert into t1 values(1),(3),(5);
select * from t1 order by c1;
connection server2;
+show tables;
create table t1(c1 int key)ENGINE=MyISAM;
insert into t1 values(100),(344),(533);
select * from t1 order by c1;
diff --git a/mysql-test/t/ndb_multi_row.test b/mysql-test/t/ndb_multi_row.test
new file mode 100644
index 00000000000..05a0944e99a
--- /dev/null
+++ b/mysql-test/t/ndb_multi_row.test
@@ -0,0 +1,76 @@
+-- source include/have_ndb.inc
+-- source include/have_multi_ndb.inc
+-- source include/not_embedded.inc
+-- source include/have_binlog_format_row.inc
+
+
+--disable_warnings
+connection server2;
+drop table if exists t1, t2, t3, t4;
+connection server1;
+drop table if exists t1, t2, t3, t4;
+--enable_warnings
+
+flush status;
+
+# Create test tables on server1
+create table t1 (a int) engine=ndbcluster;
+create table t2 (a int) engine=ndbcluster;
+insert into t1 value (2);
+insert into t2 value (3);
+select * from t1;
+select * from t2;
+show status like 'handler_discover%';
+
+# Check dropping and recreating table on same server
+connect (con1,localhost,,,test);
+connect (con2,localhost,,,test);
+connection con1;
+select * from t1;
+connection con2;
+drop table t1;
+create table t1 (a int) engine=ndbcluster;
+insert into t1 value (2);
+connection con1;
+select * from t1;
+
+# Check dropping and recreating table on different server
+connection server2;
+show status like 'handler_discover%';
+drop table t1;
+create table t1 (a int) engine=ndbcluster;
+insert into t1 value (2);
+connection server1;
+## Currently a retry is required remotely
+#--error 1412
+#select * from t1;
+#show warnings;
+#flush table t1;
+# Table definition change should be propagated automatically
+select * from t1;
+
+# Connect to server2 and use the tables from there
+connection server2;
+flush status;
+select * from t1;
+update t1 set a=3 where a=2;
+show status like 'handler_discover%';
+
+# Create a new table on server2
+create table t3 (a int not null primary key, b varchar(22),
+c int, last_col text) engine=ndb;
+insert into t3 values(1, 'Hi!', 89, 'Longtext column');
+create table t4 (pk int primary key, b int) engine=ndb;
+
+# Check that the tables are accessible from server1
+connection server1;
+select * from t1;
+select * from t3;
+show tables like 't4';
+show tables;
+
+drop table t1, t2, t3, t4;
+connection server2;
+drop table if exists t1, t3, t4;
+
+# End of 4.1 tests
diff --git a/mysql-test/t/ndb_partition_error.test b/mysql-test/t/ndb_partition_error.test
new file mode 100644
index 00000000000..9db2a6a6f6d
--- /dev/null
+++ b/mysql-test/t/ndb_partition_error.test
@@ -0,0 +1,74 @@
+-- source include/have_ndb.inc
+#--disable_abort_on_error
+#
+# Simple test for the partition storage engine
+# Focuses on range partitioning tests
+#
+#-- source include/have_partition.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+--disable_query_log
+set new=on;
+--enable_query_log
+#
+# Partition by range, generate node group error
+#
+--error 1005
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b),
+index (a))
+engine = ndb
+partition by range (a)
+partitions 3
+(partition x1 values less than (5) nodegroup 12,
+ partition x2 values less than (10) nodegroup 13,
+ partition x3 values less than (20) nodegroup 14);
+show warnings;
+
+#
+# Partition by range, create normal valid table
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a))
+engine = ndb
+partition by range (a)
+partitions 3
+(partition x1 values less than (5),
+ partition x2 values less than (10),
+ partition x3 values less than (20));
+
+drop table t1;
+
+#
+# Bug #17763 mysqld cores with list partitioning if update to missing partition
+#
+CREATE TABLE t1 (id INT) ENGINE=NDB
+ PARTITION BY LIST(id)
+ (PARTITION p0 VALUES IN (2, 4),
+ PARTITION p1 VALUES IN (42, 142));
+INSERT INTO t1 VALUES (2);
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+UPDATE t1 SET id=5 WHERE id=2;
+DROP TABLE t1;
+
+#
+# NULL for LIST partition
+#
+create table t1 (a int,b int, c int)
+engine = ndb
+partition by list(a)
+partitions 2
+(partition x123 values in (11, 12),
+ partition x234 values in (5, 1));
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+insert into t1 values (NULL,1,1);
+drop table t1;
diff --git a/mysql-test/t/ndb_partition_key.test b/mysql-test/t/ndb_partition_key.test
new file mode 100644
index 00000000000..d8c1b61b94f
--- /dev/null
+++ b/mysql-test/t/ndb_partition_key.test
@@ -0,0 +1,201 @@
+-- source include/have_ndb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+#
+# Basic syntax test
+#
+
+# Support for partition key verified
+CREATE TABLE t1 (a int, b int, c int, d int, PRIMARY KEY(a,b,c))
+ ENGINE = NDB
+ PARTITION BY KEY (a,b);
+
+insert into t1 values (1,1,1,1);
+select * from t1;
+update t1 set d = 2 where a = 1 and b = 1 and c = 1;
+select * from t1;
+delete from t1;
+select * from t1;
+
+drop table t1;
+
+# only support for partition key on primary key
+--error ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF
+CREATE TABLE t1 (a int, b int, c int, d int, PRIMARY KEY(a,b))
+ ENGINE = NDB
+ PARTITION BY KEY (c);
+
+CREATE TABLE t1 (a int, b int, c int, PRIMARY KEY(a,b))
+ ENGINE = NDB
+ PARTITION BY KEY (a);
+
+insert into t1 values
+ (1,1,3),(1,2,3),(1,3,3),(1,4,3),(1,5,3),(1,6,3),
+ (1,7,3),(1,8,3),(1,9,3),(1,10,3),(1,11,3),(1,12,3);
+
+select * from t1 order by b;
+
+DROP TABLE t1;
+
+#
+# Test partition and char support
+#
+
+CREATE TABLE t1 (a INT, b CHAR(10) COLLATE latin1_bin, c INT, d INT,
+ PRIMARY KEY (a,b,c) USING HASH)
+ ENGINE=NDB
+ DEFAULT CHARSET=latin1
+ PARTITION BY KEY (b);
+
+insert into t1 values (1,"a",1,1),(2,"a",1,1),(3,"a",1,1);
+
+# should show only one attribute with DISTRIBUTION KEY
+--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | sed 's/Version: [0-9]*//' | sed 's/\(Length of frm data: \)[0-9]*/\1#/'
+
+#
+# Test that explicit partition info is not shown in show create table
+# result should not contain (PARTITION P0 ... etc) since this is what shows up in
+# mysqldump, and we don't want that info there
+#
+show create table t1;
+
+DROP TABLE t1;
+
+#
+# Bug #13155: Problem in Create Table using SHOW CREATE TABLE syntax
+#
+CREATE TABLE t1 (a int not null primary key)
+PARTITION BY KEY(a)
+(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
+
+drop table t1;
+
+CREATE TABLE t1 (a int not null primary key);
+ALTER TABLE t1
+PARTITION BY KEY(a)
+(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
+
+drop table t1;
+
+#
+# Bug #17754 Improper handling of removal of partitioning in ALTER TABLE
+# Also added a number of general test cases in the same area
+#
+create table t1 (a int)
+engine=ndb
+partition by key(a)
+(partition p0, partition p1);
+show create table t1;
+
+alter table t1 engine=heap;
+show create table t1;
+
+alter table t1 engine=ndb;
+show create table t1;
+
+alter table t1 engine=heap remove partitioning;
+show create table t1;
+
+alter table t1 engine=ndb
+partition by key(a)
+(partition p0, partition p1 engine = ndb);
+show create table t1;
+
+alter table t1
+partition by key (a)
+(partition p0 engine=ndb, partition p1 engine=ndb);
+show create table t1;
+
+alter table t1 remove partitioning;
+show create table t1;
+
+--error ER_MIX_HANDLER_ERROR
+alter table t1
+partition by key(a)
+(partition p0 engine=ndb, partition p1);
+
+alter table t1
+engine=ndb
+partition by key(a)
+(partition p0 engine=ndb, partition p1 engine = ndb);
+show create table t1;
+
+drop table t1;
+
+#
+# BUG 16810 Out of memory when coalesce partition
+#
+CREATE TABLE t1 (
+ c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
+ c2 TEXT NOT NULL,
+ c3 INT NOT NULL,
+ c4 BIT NOT NULL,
+ c5 FLOAT,
+ c6 VARCHAR(255),
+ c7 TIMESTAMP,
+ PRIMARY KEY(c1,c3))
+ ENGINE=NDB
+ PARTITION BY KEY(c3) PARTITIONS 5;
+
+let $j= 11;
+--disable_query_log
+while ($j)
+{
+ eval INSERT INTO t1 VALUES (NULL, "Tested Remotely from Texas, USA", $j,
+b'0',
+ $j.00,"By JBM $j","2006-01-26");
+ dec $j;
+}
+--enable_query_log
+ALTER TABLE t1 COALESCE PARTITION 4;
+
+DROP TABLE t1;
+
+#
+# Bug 16822: OPTIMIZE TABLE hangs test
+#
+CREATE TABLE t1 (a int primary key)
+ENGINE=NDB
+PARTITION BY KEY(a);
+--error 1031
+ALTER TABLE t1 OPTIMIZE PARTITION p0;
+--error 1031
+ALTER TABLE t1 CHECK PARTITION p0;
+--error 1031
+ALTER TABLE t1 REPAIR PARTITION p0;
+--error 1031
+ALTER TABLE t1 ANALYZE PARTITION p0;
+--error 1031
+ALTER TABLE t1 REBUILD PARTITION p0;
+DROP TABLE t1;
+
+#
+# BUG 16806: ALTER TABLE fails
+#
+CREATE TABLE t1 (
+ c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
+ c2 TEXT NOT NULL,
+ c3 INT NOT NULL,
+ PRIMARY KEY(c1,c3))
+ ENGINE=NDB
+ PARTITION BY KEY(c3) PARTITIONS 5;
+
+ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
+ c2 TEXT NOT NULL,
+ c3 INT NOT NULL,
+ PRIMARY KEY(c1,c3))
+ ENGINE=NDB
+ PARTITION BY KEY(c3)
+ (PARTITION p0 NODEGROUP 0, PARTITION p1 NODEGROUP 0);
+
+ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1;
+SELECT NODEGROUP,PARTITION_NAME FROM information_schema.partitions WHERE
+table_name = "t1";
+DROP TABLE t1;
diff --git a/mysql-test/t/ndb_partition_list.test b/mysql-test/t/ndb_partition_list.test
new file mode 100644
index 00000000000..ccfcdbc84f4
--- /dev/null
+++ b/mysql-test/t/ndb_partition_list.test
@@ -0,0 +1,68 @@
+--source include/have_ndb.inc
+#
+# Simple test for the partition storage engine
+# Focuses on range partitioning tests
+#
+#-- source include/have_partition.inc
+
+--disable_query_log
+set new=on;
+--enable_query_log
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Partition by list, basic
+#
+
+CREATE TABLE t1 ( f_int1 INTEGER NOT NULL, f_int2 INTEGER NOT NULL,
+ f_char1 CHAR(10),
+ f_char2 CHAR(10), f_charbig VARCHAR(1000),
+PRIMARY KEY (f_int1,f_int2))
+ENGINE = NDB
+PARTITION BY LIST(MOD(f_int1 + f_int2,4))
+(PARTITION part_3 VALUES IN (-3),
+ PARTITION part_2 VALUES IN (-2),
+ PARTITION part_1 VALUES IN (-1),
+ PARTITION part0 VALUES IN (0),
+ PARTITION part1 VALUES IN (1),
+ PARTITION part2 VALUES IN (2),
+ PARTITION part3 VALUES IN (3,4,5));
+
+INSERT INTO t1 SET f_int1 = -2, f_int2 = 20, f_char1 = '20', f_char2 = '20', f_charbig = '===20===';
+INSERT INTO t1 SET f_int1 = 1, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 2, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 3, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 4, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 5, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 20, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+
+SELECT * FROM t1 ORDER BY f_int1;
+
+DROP TABLE t1;
+
+#
+# Partition by list, no pk
+#
+
+CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(10),
+ f_char2 CHAR(10), f_charbig VARCHAR(1000))
+ENGINE = NDB
+PARTITION BY LIST(f_int1)
+(PARTITION part_1 VALUES IN (-1),
+ PARTITION part0 VALUES IN (0,1),
+ PARTITION part1 VALUES IN (2));
+
+INSERT INTO t1 SET f_int1 = -1, f_int2 = 20, f_char1 = '20', f_char2 = '20', f_charbig = '===20===';
+INSERT INTO t1 SET f_int1 = 0, f_int2 = 20, f_char1 = '20', f_char2 = '20', f_charbig = '===20===';
+INSERT INTO t1 SET f_int1 = 1, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+INSERT INTO t1 SET f_int1 = 2, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+INSERT INTO t1 SET f_int1 = 20, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
+
+SELECT * FROM t1 ORDER BY f_int1;
+
+DROP TABLE t1;
+
diff --git a/mysql-test/t/ndb_partition_range.test b/mysql-test/t/ndb_partition_range.test
new file mode 100644
index 00000000000..7952ba502d2
--- /dev/null
+++ b/mysql-test/t/ndb_partition_range.test
@@ -0,0 +1,264 @@
+-- source include/have_ndb.inc
+#--disable_abort_on_error
+#
+# Simple test for the partition storage engine
+# Focuses on range partitioning tests
+#
+#-- source include/have_partition.inc
+
+--disable_query_log
+set new=on;
+--enable_query_log
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Partition by range, basic
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b),
+index (a))
+engine = ndb
+partition by range (a)
+partitions 3
+(partition x1 values less than (5),
+ partition x2 values less than (10),
+ partition x3 values less than (20));
+
+# Simple insert and verify test
+INSERT into t1 values (1, 1, 1);
+INSERT into t1 values (6, 1, 1);
+INSERT into t1 values (10, 1, 1);
+INSERT into t1 values (15, 1, 1);
+
+--replace_column 16 # 19 # 20 #
+select * from information_schema.partitions where table_name= 't1';
+
+select * from t1 order by a;
+
+select * from t1 where a=1 order by a;
+select * from t1 where a=15 and b=1 order by a;
+select * from t1 where a=21 and b=1 order by a;
+select * from t1 where a=21 order by a;
+select * from t1 where a in (1,6,10,21) order by a;
+select * from t1 where b=1 and a in (1,6,10,21) order by a;
+
+drop table t1;
+
+#
+# Partition by range, basic
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(b),
+unique (a))
+engine = ndb
+partition by range (b)
+partitions 3
+(partition x1 values less than (5),
+ partition x2 values less than (10),
+ partition x3 values less than (20));
+
+# Simple insert and verify test
+INSERT into t1 values (1, 1, 1);
+INSERT into t1 values (2, 6, 1);
+INSERT into t1 values (3, 10, 1);
+INSERT into t1 values (4, 15, 1);
+
+select * from t1 order by a;
+UPDATE t1 set a = 5 WHERE b = 15;
+select * from t1 order by a;
+UPDATE t1 set a = 6 WHERE a = 5;
+select * from t1 order by a;
+
+select * from t1 where b=1 order by b;
+select * from t1 where b=15 and a=1 order by b;
+select * from t1 where b=21 and a=1 order by b;
+select * from t1 where b=21 order by b;
+select * from t1 where b in (1,6,10,21) order by b;
+select * from t1 where a in (1,2,5,6) order by b;
+select * from t1 where a=1 and b in (1,6,10,21) order by b;
+
+DELETE from t1 WHERE b = 6;
+DELETE from t1 WHERE a = 6;
+
+#
+# Test that explicit partition info _is_ shown in show create table
+# result _should_ contain (PARTITION x1 ... etc)
+#
+show create table t1;
+
+drop table t1;
+
+#
+# Bug #17499, #17687
+# Alter partitioned NDB table causes mysqld to core
+#
+
+CREATE TABLE t1
+ (id MEDIUMINT NOT NULL,
+ b1 BIT(8),
+ vc VARCHAR(255),
+ bc CHAR(255),
+ d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0,
+ total BIGINT UNSIGNED,
+ y YEAR,
+ t DATE) ENGINE=NDB
+ PARTITION BY RANGE (YEAR(t))
+ (PARTITION p0 VALUES LESS THAN (1901),
+ PARTITION p1 VALUES LESS THAN (1946),
+ PARTITION p2 VALUES LESS THAN (1966),
+ PARTITION p3 VALUES LESS THAN (1986),
+ PARTITION p4 VALUES LESS THAN (2005),
+ PARTITION p5 VALUES LESS THAN MAXVALUE);
+
+INSERT INTO t1 VALUES (0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+SELECT * FROM t1;
+ALTER TABLE t1 ENGINE=MYISAM;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE LOGFILE GROUP lg1
+ ADD UNDOFILE 'undofile.dat'
+ INITIAL_SIZE 16M
+ UNDO_BUFFER_SIZE=1M
+ ENGINE=NDB;
+
+CREATE TABLESPACE ts1
+ ADD DATAFILE 'datafile.dat'
+ USE LOGFILE GROUP lg1
+ INITIAL_SIZE 12M
+ ENGINE NDB;
+
+CREATE TABLE test.t1 (
+ a1 INT,
+ a2 TEXT NOT NULL,
+ a3 BIT NOT NULL,
+ a4 DECIMAL(8,3),
+ a5 INT NOT NULL,
+ a6 INT,
+ PRIMARY KEY(a1))
+ TABLESPACE ts1 STORAGE DISK ENGINE=NDB
+ PARTITION BY LIST (a1)
+ (PARTITION p0 VALUES IN (1,2,3,4,5),
+ PARTITION p1 VALUES IN (6,7,8,9, 10),
+ PARTITION p2 VALUES IN (11, 12, 13, 14, 15));
+
+# Alter table directly without any statements inbetween
+ALTER TABLE test.t1 DROP COLUMN a6;
+ALTER TABLE test.t1 ADD COLUMN a6 VARCHAR(255);
+
+let $j= 15;
+--disable_query_log
+while ($j)
+{
+eval INSERT INTO test.t1 VALUES ($j, "Tested Remotely from Texas, USA",
+b'1',$j.00,$j+1,"By NIK $j");
+dec $j;
+}
+--enable_query_log
+SELECT COUNT(*) FROM test.t1;
+
+ALTER TABLE test.t1 DROP COLUMN a4;
+SELECT COUNT(*) FROM test.t1;
+
+DROP TABLE t1;
+
+CREATE TABLE test.t1 (
+ a1 INT,
+ a2 TEXT NOT NULL,
+ a3 BIT NOT NULL,
+ a4 DECIMAL(8,3),
+ a5 INT NOT NULL,
+ a6 VARCHAR(255),
+ PRIMARY KEY(a1))
+ TABLESPACE ts1 STORAGE DISK ENGINE=NDB
+ PARTITION BY HASH(a1)
+ PARTITIONS 4;
+
+let $j= 15;
+--disable_query_log
+while ($j)
+{
+eval INSERT INTO test.t1 VALUES ($j, "Tested Remotely from Texas, USA",
+b'1',$j.00,$j+1,"By NIK $j");
+dec $j;
+}
+--enable_query_log
+SELECT COUNT(*) FROM test.t1;
+
+ALTER TABLE test.t1 DROP COLUMN a4;
+SELECT COUNT(*) FROM test.t1;
+
+DROP TABLE t1;
+
+ALTER TABLESPACE ts1
+ DROP DATAFILE 'datafile.dat'
+ ENGINE=NDB;
+DROP TABLESPACE ts1 ENGINE=NDB;
+DROP LOGFILE GROUP lg1 ENGINE=NDB;
+
+
+#
+# Bug #17701 ALTER TABLE t1 ADD PARTITION for PARTITION BY LIST hangs test
+#
+
+CREATE TABLE t1
+ (id MEDIUMINT NOT NULL,
+ b1 BIT(8),
+ vc VARCHAR(255),
+ bc CHAR(255),
+ d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0,
+ total BIGINT UNSIGNED,
+ y YEAR,
+ t DATE) ENGINE=NDB
+ PARTITION BY LIST(id)
+ (PARTITION p0 VALUES IN (2, 4),
+ PARTITION p1 VALUES IN (42, 142));
+
+INSERT INTO t1 VALUES (2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+SELECT * FROM t1;
+ALTER TABLE t1 ADD PARTITION
+ (PARTITION p2 VALUES IN (412));
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# Bug #17806 Update on NDB table with list partition causes mysqld to core
+# Bug #16385 Partitions: crash when updating a range partitioned NDB table
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null)
+partition by list(a)
+partitions 2
+(partition x123 values in (1,5,6),
+ partition x234 values in (4,7,8));
+INSERT into t1 VALUES (5,1,1);
+select * from t1;
+UPDATE t1 SET a=8 WHERE a=5 AND b=1;
+select * from t1;
+drop table t1;
+
+CREATE TABLE t1 ( f1 INTEGER, f2 char(20)) engine=ndb
+PARTITION BY RANGE(f1)
+( PARTITION part1 VALUES LESS THAN (2),
+PARTITION part2 VALUES LESS THAN (1000));
+INSERT INTO t1 VALUES(1, '---1---');
+INSERT INTO t1 VALUES(2, '---2---');
+select * from t1 order by f1;
+UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 2;
+select * from t1 order by f1;
+UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 1;
+select * from t1 order by f1;
+drop table t1;
diff --git a/mysql-test/t/ndb_read_multi_range.test b/mysql-test/t/ndb_read_multi_range.test
index 855f7789032..8cdba49fb92 100644
--- a/mysql-test/t/ndb_read_multi_range.test
+++ b/mysql-test/t/ndb_read_multi_range.test
@@ -228,13 +228,32 @@ INSERT INTO t1 VALUES
(148812,67,'2005-10-25 15:30:01'),(245651,67,'2005-12-08 15:58:27'),
(154503,67,'2005-10-28 11:52:38');
-create table t11 select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) order by 3 asc;
-create table t12 select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) order by 3 desc;
+create table t11 engine = ndbcluster select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) order by 3 asc;
+create table t12 engine = ndbcluster select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) order by 3 desc;
create table t21 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08') order by 3 asc;
-create table t22 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08') order by 3 desc;
+create table t22 engine = ndbcluster select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08') order by 3 desc;
select * from t11 order by 1,2,3;
select * from t12 order by 1,2,3;
select * from t21 order by 1,2,3;
select * from t22 order by 1,2,3;
+
+# join tests
+select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null order by t12.a;
+
+update t22 set c = '2005-12-08 15:58:27' where a = 255;
+select * from t22 order by 1,2,3;
+select t21.* from t21,t22 where t21.a = t22.a and
+t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null) and t22.c is null order by t21.a;
+
+delete from t22 where a > 245651;
+update t22 set b = a + 1;
+select * from t22 order by 1,2,3;
+select c, count(*)
+from t21
+inner join t22 using (a)
+where t22.b in (2,256,257,1121,1134,4102,9200,223457,245652)
+group by c
+order by c;
+
DROP TABLE t1, t11, t12, t21, t22;
diff --git a/mysql-test/t/ndb_rename.test b/mysql-test/t/ndb_rename.test
index 99c344bc29e..7f9fd0e6984 100644
--- a/mysql-test/t/ndb_rename.test
+++ b/mysql-test/t/ndb_rename.test
@@ -21,10 +21,14 @@ CREATE TABLE t1 (
INDEX i1(attr1)
) ENGINE=ndbcluster;
+INSERT INTO t1 VALUES (0,0,0,"zero"),(1,1,1,"one"),(2,2,2,"two");
+SELECT * FROM t1 WHERE attr1 = 1;
alter table t1 rename t2;
+SELECT * FROM t2 WHERE attr1 = 1;
create database ndbtest;
alter table t2 rename ndbtest.t2;
+SELECT * FROM ndbtest.t2 WHERE attr1 = 1;
drop table ndbtest.t2;
drop database ndbtest;
diff --git a/mysql-test/t/ndb_restore.test b/mysql-test/t/ndb_restore.test
index 39c7ab67efb..9030dfbe304 100644
--- a/mysql-test/t/ndb_restore.test
+++ b/mysql-test/t/ndb_restore.test
@@ -8,15 +8,15 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
--enable_warnings
-CREATE TABLE `t1` (
+CREATE TABLE `t1_c` (
`capgoaledatta` smallint(5) unsigned NOT NULL auto_increment,
`goaledatta` char(2) NOT NULL default '',
`maturegarbagefa` varchar(32) NOT NULL default '',
PRIMARY KEY (`capgoaledatta`,`goaledatta`,`maturegarbagefa`)
-) ENGINE=myisam DEFAULT CHARSET=latin1;
-INSERT INTO `t1` VALUES (2,'3','q3plus.qt'),(4,'4','q3plus.qt'),(1,'3','q3.net'),(3,'4','q3.net'),(3,'20','threetrees.qt');
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t1_c` VALUES (2,'3','q3plus.qt'),(4,'4','q3plus.qt'),(1,'3','q3.net'),(3,'4','q3.net'),(3,'20','threetrees.qt');
-CREATE TABLE `t2` (
+CREATE TABLE `t2_c` (
`capgotod` smallint(5) unsigned NOT NULL auto_increment,
`gotod` smallint(5) unsigned NOT NULL default '0',
`goaledatta` char(2) default NULL,
@@ -25,17 +25,17 @@ CREATE TABLE `t2` (
`svcutonsa` varchar(64) NOT NULL default '',
PRIMARY KEY (`capgotod`),
KEY `i_quadaddsvr` (`gotod`)
-) ENGINE=myisam DEFAULT CHARSET=latin1;
-INSERT INTO `t2` VALUES (5,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST');
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t2_c` VALUES (5,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST');
-CREATE TABLE `t3` (
+CREATE TABLE `t3_c` (
`CapGoaledatta` smallint(5) unsigned NOT NULL default '0',
`capgotod` smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (`capgotod`,`CapGoaledatta`)
-) ENGINE=myisam DEFAULT CHARSET=latin1;
-INSERT INTO `t3` VALUES (5,3),(2,4),(5,4),(1,3);
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t3_c` VALUES (5,3),(2,4),(5,4),(1,3);
-CREATE TABLE `t4` (
+CREATE TABLE `t4_c` (
`capfa` bigint(20) unsigned NOT NULL auto_increment,
`realm` varchar(32) NOT NULL default '',
`authpwchap` varchar(32) default NULL,
@@ -45,26 +45,26 @@ CREATE TABLE `t4` (
PRIMARY KEY (`fa`,`realm`),
KEY `capfa` (`capfa`),
KEY `i_quadentity` (`fa`,`realm`)
-) ENGINE=myisam DEFAULT CHARSET=latin1;
-INSERT INTO `t4` VALUES (18,'john.smith','q3.net','dessjohn.smith',0,NULL),(21,'quad_katt_with_brandtad','q3.net','acne',0,NULL),(22,'quad_katt_carattoaa','q3.net','acne',0,NULL),(26,'436462612809','sqasdt.q3.net','N/A',0,'6'),(19,'john','smith.qt','dessjohn',0,NULL),(33,'436643196120','sqasdt.q3.net','N/A',1,'6'),(28,'436642900019','sqasdt.q3.net','N/A',0,'6'),(30,'436462900209','sqasdt.q3.net','N/A',0,'6'),(16,'436640006666','sqasdt.q3.net','',0,NULL),(19,'dette','el-redun.com','dessdette',0,NULL),(12,'quad_kattPP','q3.net','acne',2,NULL),(14,'436640008888','sqasdt.q3.net','',0,NULL),(29,'463624900028','sqasdt.q3.net','N/A',0,'6'),(15,'436640099099','sqasdt.q3.net','',0,NULL),(13,'pap','q3plus.qt','acne',1,NULL),(19,'436642612091','sqasdt.q3.net','N/A',0,'6'),(12,'quad_katt','q3.net','acne',0,NULL),(11,'quad_kattVK','q3.net','acne',1,NULL),(32,'463641969502','sqasdt.q3.net','N/A',1,'6'),(20,'joe','q3.net','joedesswd',0,NULL),(29,'436642900034','sqasdt.q3.net','N/A',0,'6'),(25,'contind','armerde.qt','acne',1,NULL);
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t4_c` VALUES (18,'john.smith','q3.net','dessjohn.smith',0,NULL),(21,'quad_katt_with_brandtad','q3.net','acne',0,NULL),(22,'quad_katt_carattoaa','q3.net','acne',0,NULL),(26,'436462612809','sqasdt.q3.net','N/A',0,'6'),(19,'john','smith.qt','dessjohn',0,NULL),(33,'436643196120','sqasdt.q3.net','N/A',1,'6'),(28,'436642900019','sqasdt.q3.net','N/A',0,'6'),(30,'436462900209','sqasdt.q3.net','N/A',0,'6'),(16,'436640006666','sqasdt.q3.net','',0,NULL),(19,'dette','el-redun.com','dessdette',0,NULL),(12,'quad_kattPP','q3.net','acne',2,NULL),(14,'436640008888','sqasdt.q3.net','',0,NULL),(29,'463624900028','sqasdt.q3.net','N/A',0,'6'),(15,'436640099099','sqasdt.q3.net','',0,NULL),(13,'pap','q3plus.qt','acne',1,NULL),(19,'436642612091','sqasdt.q3.net','N/A',0,'6'),(12,'quad_katt','q3.net','acne',0,NULL),(11,'quad_kattVK','q3.net','acne',1,NULL),(32,'463641969502','sqasdt.q3.net','N/A',1,'6'),(20,'joe','q3.net','joedesswd',0,NULL),(29,'436642900034','sqasdt.q3.net','N/A',0,'6'),(25,'contind','armerde.qt','acne',1,NULL);
-CREATE TABLE `t5` (
+CREATE TABLE `t5_c` (
`capfa` bigint(20) unsigned NOT NULL default '0',
`gotod` smallint(5) unsigned NOT NULL default '0',
`orderutonsa` varchar(64) NOT NULL default '',
PRIMARY KEY (`capfa`,`gotod`,`orderutonsa`)
-) ENGINE=myisam DEFAULT CHARSET=latin1;
-INSERT INTO `t5` VALUES (21,2,''),(21,1,''),(22,4,'');
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t5_c` VALUES (21,2,''),(21,1,''),(22,4,'');
-CREATE TABLE `t6` (
+CREATE TABLE `t6_c` (
`capfa_parent` bigint(20) unsigned NOT NULL default '0',
`capfa_child` bigint(20) unsigned NOT NULL default '0',
`relatta` smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (`capfa_child`,`capfa_parent`,`relatta`)
-) ENGINE=myisam DEFAULT CHARSET=latin1;
-INSERT INTO `t6` VALUES (15,16,0),(19,20,0),(18326932092909551615,30,0),(26,29,0),(18326932092909551615,29,0),(19,18,0),(26,28,0),(12,14,0);
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t6_c` VALUES (15,16,0),(19,20,0),(18326932092909551615,30,0),(26,29,0),(18326932092909551615,29,0),(19,18,0),(26,28,0),(12,14,0);
-CREATE TABLE `t7` (
+CREATE TABLE `t7_c` (
`dardpo` char(15) NOT NULL default '',
`dardtestard` tinyint(3) unsigned NOT NULL default '0',
`FastFA` char(5) NOT NULL default '',
@@ -73,10 +73,10 @@ CREATE TABLE `t7` (
`Fastmag` char(1) NOT NULL default '',
`Beareratta` char(2) NOT NULL default '',
PRIMARY KEY (`dardpo`,`dardtestard`)
-) ENGINE=myisam DEFAULT CHARSET=latin1;
-INSERT INTO `t7` VALUES ('2.6.2.4',24,'CECHP','54545','0','0','5'),('2.2.5.4',26,'CANFA','33223','1','1','4'),('4.3.2.4',28,'ITALD','54222','1','0','5'),('129..0.0.eins',28,'G','99999','1','1','5'),('1.1.1.1',24,'AUTPT','32323','0','1','3');
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t7_c` VALUES ('2.6.2.4',24,'CECHP','54545','0','0','5'),('2.2.5.4',26,'CANFA','33223','1','1','4'),('4.3.2.4',28,'ITALD','54222','1','0','5'),('129..0.0.eins',28,'G','99999','1','1','5'),('1.1.1.1',24,'AUTPT','32323','0','1','3');
-CREATE TABLE `t8` (
+CREATE TABLE `t8_c` (
`kattjame` varchar(32) NOT NULL default '',
`realm` varchar(32) NOT NULL default '',
`realm_entered` varchar(32) NOT NULL default '',
@@ -102,10 +102,10 @@ CREATE TABLE `t8` (
`acctinputoctets` bigint(20) unsigned default NULL,
PRIMARY KEY (`kattjame`,`hunderaaarbagefa`,`hassetistart`,`hassetino`),
KEY `squardporoot` (`squardporoot`)
-) ENGINE=myisam DEFAULT CHARSET=latin1;
-INSERT INTO `t8` VALUES ('4tt45345235','pap','q3plus.qt','q3plus.qt','q3.net','436643196120','436643196929','8956234534568968','5524595699','uxasmt21.net.acne.qt/481889229462692422','','1.1.1.1','2.2.4.6','4','86989','34','x','x','2012-03-12 12:55:34','2012-12-05 11:20:04',3223433,3369,9565),('4545435545','john','q3.net','q3.net','acne.li','436643196120','436643196929','45345234568968','995696699','uxasmt21.net.acne.qt/481889229462692423','','1.1.1.1','2.2.9.8','2','86989','34','x','x','2012-03-12 11:35:03','2012-12-05 08:50:04',8821923,169,3565),('versteckter_q3net_katt','joe','q3.net','elredun.com','q3.net','436643196120','436643196939','91341234568968','695595699','uxasmt21.net.acne.qt/481889229462692421','','1.1.1.1','2.5.2.5','3','86989','34','x','x','2012-03-12 18:35:04','2012-12-05 12:35:04',1923123,9569,6565);
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t8_c` VALUES ('4tt45345235','pap','q3plus.qt','q3plus.qt','q3.net','436643196120','436643196929','8956234534568968','5524595699','uxasmt21.net.acne.qt/481889229462692422','','1.1.1.1','2.2.4.6','4','86989','34','x','x','2012-03-12 12:55:34','2012-12-05 11:20:04',3223433,3369,9565),('4545435545','john','q3.net','q3.net','acne.li','436643196120','436643196929','45345234568968','995696699','uxasmt21.net.acne.qt/481889229462692423','','1.1.1.1','2.2.9.8','2','86989','34','x','x','2012-03-12 11:35:03','2012-12-05 08:50:04',8821923,169,3565),('versteckter_q3net_katt','joe','q3.net','elredun.com','q3.net','436643196120','436643196939','91341234568968','695595699','uxasmt21.net.acne.qt/481889229462692421','','1.1.1.1','2.5.2.5','3','86989','34','x','x','2012-03-12 18:35:04','2012-12-05 12:35:04',1923123,9569,6565);
-CREATE TABLE `t9` (
+CREATE TABLE `t9_c` (
`kattjame` varchar(32) NOT NULL default '',
`kattjame_entered` varchar(32) NOT NULL default '',
`realm` varchar(32) NOT NULL default '',
@@ -129,35 +129,35 @@ CREATE TABLE `t9` (
`actinputocctets` bigint(20) unsigned default NULL,
`terminateraste` tinyint(3) unsigned default NULL,
PRIMARY KEY (`kattjame`,`hunderaaarbagefa`,`hassetistart`,`hassetino`)
-) ENGINE=myisam DEFAULT CHARSET=latin1;
-INSERT INTO `t9` VALUES ('3g4jh8gar2t','joe','q3.net','elredun.com','q3.net','436643316120','436643316939','91341234568968','695595699','1.1.1.1','2.2.6.2','3','86989','34','x','x','2012-03-12 18:35:04','2012-12-05 12:35:04',3123123,9569,6565,1),('4tt45345235','pap','q3plus.qt','q3plus.qt','q3.net','436643316120','436643316939','8956234534568968','5254595969','1.1.1.1','8.6.2.2','4','86989','34','x','x','2012-03-12 12:55:34','2012-12-05 11:20:04',3223433,3369,9565,2),('4545435545','john','q3.net','q3.net','acne.li','436643316120','436643316939','45345234568968','995696699','1.1.1.1','2.9.9.2','2','86998','34','x','x','2012-03-12 11:35:03','2012-12-05 08:50:04',8823123,169,3565,3);
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t9_c` VALUES ('3g4jh8gar2t','joe','q3.net','elredun.com','q3.net','436643316120','436643316939','91341234568968','695595699','1.1.1.1','2.2.6.2','3','86989','34','x','x','2012-03-12 18:35:04','2012-12-05 12:35:04',3123123,9569,6565,1),('4tt45345235','pap','q3plus.qt','q3plus.qt','q3.net','436643316120','436643316939','8956234534568968','5254595969','1.1.1.1','8.6.2.2','4','86989','34','x','x','2012-03-12 12:55:34','2012-12-05 11:20:04',3223433,3369,9565,2),('4545435545','john','q3.net','q3.net','acne.li','436643316120','436643316939','45345234568968','995696699','1.1.1.1','2.9.9.2','2','86998','34','x','x','2012-03-12 11:35:03','2012-12-05 08:50:04',8823123,169,3565,3);
# Bug #20820
# auto inc table not handled correctly when restored from cluster backup
# - before fix ndb_restore would not set auto inc value correct,
# seen by select below
-create table t10 (a int auto_increment key);
-insert into t10 values (1),(2),(3);
+CREATE TABLE t10_c (a INT AUTO_INCREMENT KEY) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO t10_c VALUES (1),(2),(3);
-create table t1_c engine=ndbcluster as select * from t1;
-create table t2_c engine=ndbcluster as select * from t2;
-create table t3_c engine=ndbcluster as select * from t3;
-create table t4_c engine=ndbcluster as select * from t4;
-create table t5_c engine=ndbcluster as select * from t5;
-create table t6_c engine=ndbcluster as select * from t6;
-create table t7_c engine=ndbcluster as select * from t7;
-create table t8_c engine=ndbcluster as select * from t8;
-create table t9_c engine=ndbcluster as select * from t9;
-create table t10_c engine=ndbcluster as select * from t10;
+create table t1 engine=myisam as select * from t1_c;
+create table t2 engine=myisam as select * from t2_c;
+create table t3 engine=myisam as select * from t3_c;
+create table t4 engine=myisam as select * from t4_c;
+create table t5 engine=myisam as select * from t5_c;
+create table t6 engine=myisam as select * from t6_c;
+create table t7 engine=myisam as select * from t7_c;
+create table t8 engine=myisam as select * from t8_c;
+create table t9 engine=myisam as select * from t9_c;
+create table t10 engine=myisam as select * from t10_c;
---exec $NDB_MGM --no-defaults -e "start backup" >> $NDB_TOOLS_OUTPUT
-drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c, t10_c;
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-1 >> $NDB_TOOLS_OUTPUT
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-1 >> $NDB_TOOLS_OUTPUT
-
-show tables;
+--source include/ndb_backup.inc
+drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+# random output order??
+#show tables;
select count(*) from t1;
select count(*) from t1_c;
@@ -216,15 +216,152 @@ select count(*)
# Bug #20820 cont'd
select * from t10_c order by a;
+#
+# Try Partitioned tables as well
+#
+ALTER TABLE t7_c
+PARTITION BY LINEAR KEY (`dardtestard`);
+
+--source include/ndb_backup.inc
+drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+
+select count(*) from t1;
+select count(*) from t1_c;
+select count(*)
+ from (select * from t1 union
+ select * from t1_c) a;
+
+select count(*) from t2;
+select count(*) from t2_c;
+select count(*)
+ from (select * from t2 union
+ select * from t2_c) a;
+
+select count(*) from t3;
+select count(*) from t3_c;
+select count(*)
+ from (select * from t3 union
+ select * from t3_c) a;
+
+select count(*) from t4;
+select count(*) from t4_c;
+select count(*)
+ from (select * from t4 union
+ select * from t4_c) a;
+
+select count(*) from t5;
+select count(*) from t5_c;
+select count(*)
+ from (select * from t5 union
+ select * from t5_c) a;
+
+select count(*) from t6;
+select count(*) from t6_c;
+select count(*)
+ from (select * from t6 union
+ select * from t6_c) a;
+
+select count(*) from t7;
+select count(*) from t7_c;
+select count(*)
+ from (select * from t7 union
+ select * from t7_c) a;
+
+select count(*) from t8;
+select count(*) from t8_c;
+select count(*)
+ from (select * from t8 union
+ select * from t8_c) a;
+
+select count(*) from t9;
+select count(*) from t9_c;
+select count(*)
+ from (select * from t9 union
+ select * from t9_c) a;
+
+drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 1 -m -r --ndb-nodegroup_map '(0,0)' --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+
+select count(*) from t1;
+select count(*) from t1_c;
+select count(*)
+ from (select * from t1 union
+ select * from t1_c) a;
+
+select count(*) from t2;
+select count(*) from t2_c;
+select count(*)
+ from (select * from t2 union
+ select * from t2_c) a;
+
+select count(*) from t3;
+select count(*) from t3_c;
+select count(*)
+ from (select * from t3 union
+ select * from t3_c) a;
+
+select count(*) from t4;
+select count(*) from t4_c;
+select count(*)
+ from (select * from t4 union
+ select * from t4_c) a;
+
+select count(*) from t5;
+select count(*) from t5_c;
+select count(*)
+ from (select * from t5 union
+ select * from t5_c) a;
+
+select count(*) from t6;
+select count(*) from t6_c;
+select count(*)
+ from (select * from t6 union
+ select * from t6_c) a;
+
+select count(*) from t7;
+select count(*) from t7_c;
+select count(*)
+ from (select * from t7 union
+ select * from t7_c) a;
+
+select count(*) from t8;
+select count(*) from t8_c;
+select count(*)
+ from (select * from t8 union
+ select * from t8_c) a;
+
+select count(*) from t9;
+select count(*) from t9_c;
+select count(*)
+ from (select * from t9 union
+ select * from t9_c) a;
+
+#
+# Drop all table except t2_c
+# This to make sure that error returned from ndb_restore above is
+# guaranteed to be from t2_c, this since order of tables in backup
+# is none deterministic
+#
+drop table t1_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
+--source include/ndb_backup.inc
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --core=0 -b $the_backup_id -n 1 -m -r --ndb-nodegroup_map '(0,1)' $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id 2>&1 | grep Translate || true
+
+#
+# Cleanup
+#
+
--disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9, t10;
-drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c, t10_c;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+drop table if exists t2_c;
--enable_warnings
#
# Test BUG#10287
#
---exec $NDB_TOOLS_DIR/ndb_select_all --no-defaults -d sys -D , SYSTAB_0 | grep 520093696
+--exec $NDB_TOOLS_DIR/ndb_select_all --no-defaults -d sys -D , SYSTAB_0 | grep 520093696, | sed "s/,$the_backup_id/,<the_backup_id>/"
# End of 5.0 tests (4.1 test intermixed to save test time)
diff --git a/mysql-test/t/ndb_restore_compat.test b/mysql-test/t/ndb_restore_compat.test
new file mode 100644
index 00000000000..774011e362d
--- /dev/null
+++ b/mysql-test/t/ndb_restore_compat.test
@@ -0,0 +1,43 @@
+-- source include/have_ndb.inc
+-- source include/not_embedded.inc
+-- source include/have_case_sensitive_file_system.inc
+
+# This test currently requires case sensitive file system as the tables
+# are originally stored with uppercase
+
+#
+# Bug #18594 ndb_restore log boken in 5.1
+#
+
+--disable_warnings
+DROP DATABASE IF EXISTS BANK;
+--enable_warnings
+CREATE DATABASE BANK default charset=latin1 default collate=latin1_bin;
+USE BANK;
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -p 1 -m -r $MYSQL_TEST_DIR/std_data/ndb_backup51 >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -e -b 1 -n 2 -p 1 -r $MYSQL_TEST_DIR/std_data/ndb_backup51 >> $NDB_TOOLS_OUTPUT
+SHOW TABLES;
+SELECT * FROM GL ORDER BY TIME,ACCOUNT_TYPE;
+SELECT * FROM ACCOUNT ORDER BY ACCOUNT_ID;
+SELECT COUNT(*) FROM TRANSACTION;
+SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID;
+SELECT * FROM cluster.apply_status WHERE server_id=0;
+
+#
+# verify restore of 5.0 backup
+# here we must use the already created tables as restoring the old
+# table definitions will not work
+#
+TRUNCATE GL;
+TRUNCATE ACCOUNT;
+TRUNCATE TRANSACTION;
+TRUNCATE SYSTEM_VALUES;
+TRUNCATE ACCOUNT_TYPE;
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -p 1 -r $MYSQL_TEST_DIR/std_data/ndb_backup50 >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -e -b 1 -n 2 -p 1 -r $MYSQL_TEST_DIR/std_data/ndb_backup50 >> $NDB_TOOLS_OUTPUT
+SELECT * FROM GL ORDER BY TIME,ACCOUNT_TYPE;
+SELECT * FROM ACCOUNT ORDER BY ACCOUNT_ID;
+SELECT COUNT(*) FROM TRANSACTION;
+SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID;
+SELECT * FROM cluster.apply_status WHERE server_id=0;
+DROP DATABASE BANK;
diff --git a/mysql-test/t/ndb_restore_partition-master.opt b/mysql-test/t/ndb_restore_partition-master.opt
new file mode 100644
index 00000000000..075c6392dde
--- /dev/null
+++ b/mysql-test/t/ndb_restore_partition-master.opt
@@ -0,0 +1 @@
+--new
diff --git a/mysql-test/t/ndb_restore_partition.test b/mysql-test/t/ndb_restore_partition.test
new file mode 100644
index 00000000000..f11324492c2
--- /dev/null
+++ b/mysql-test/t/ndb_restore_partition.test
@@ -0,0 +1,375 @@
+-- source include/have_ndb.inc
+-- source include/ndb_default_cluster.inc
+-- source include/not_embedded.inc
+
+--disable_warnings
+use test;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+--enable_warnings
+
+CREATE TABLE `t1_c` (
+ `capgoaledatta` smallint(5) unsigned NOT NULL auto_increment,
+ `goaledatta` char(2) NOT NULL default '',
+ `maturegarbagefa` varchar(32) NOT NULL default '',
+ PRIMARY KEY (`capgoaledatta`,`goaledatta`,`maturegarbagefa`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t1_c` VALUES (2,'3','q3plus.qt'),(4,'4','q3plus.qt'),(1,'3','q3.net'),(3,'4','q3.net'),(3,'20','threetrees.qt');
+
+CREATE TABLE `t2_c` (
+ `capgotod` smallint(5) unsigned NOT NULL auto_increment,
+ `gotod` smallint(5) unsigned NOT NULL default '0',
+ `goaledatta` char(2) default NULL,
+ `maturegarbagefa` varchar(32) default NULL,
+ `descrpooppo` varchar(64) default NULL,
+ `svcutonsa` varchar(64) NOT NULL default '',
+ PRIMARY KEY (`capgotod`),
+ KEY `i_quadaddsvr` (`gotod`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t2_c` VALUES (5,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST');
+
+CREATE TABLE `t3_c` (
+ `CapGoaledatta` smallint(5) unsigned NOT NULL default '0',
+ `capgotod` smallint(5) unsigned NOT NULL default '0',
+ PRIMARY KEY (`capgotod`,`CapGoaledatta`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t3_c` VALUES (5,3),(2,4),(5,4),(1,3);
+
+CREATE TABLE `t4_c` (
+ `capfa` bigint(20) unsigned NOT NULL auto_increment,
+ `realm` varchar(32) NOT NULL default '',
+ `authpwchap` varchar(32) default NULL,
+ `fa` varchar(32) NOT NULL default '',
+ `payyingatta` tinyint(4) NOT NULL default '0',
+ `status` char(1) default NULL,
+ PRIMARY KEY (`fa`,`realm`),
+ KEY `capfa` (`capfa`),
+ KEY `i_quadentity` (`fa`,`realm`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t4_c` VALUES (18,'john.smith','q3.net','dessjohn.smith',0,NULL),(21,'quad_katt_with_brandtad','q3.net','acne',0,NULL),(22,'quad_katt_carattoaa','q3.net','acne',0,NULL),(26,'436462612809','sqasdt.q3.net','N/A',0,'6'),(19,'john','smith.qt','dessjohn',0,NULL),(33,'436643196120','sqasdt.q3.net','N/A',1,'6'),(28,'436642900019','sqasdt.q3.net','N/A',0,'6'),(30,'436462900209','sqasdt.q3.net','N/A',0,'6'),(16,'436640006666','sqasdt.q3.net','',0,NULL),(19,'dette','el-redun.com','dessdette',0,NULL),(12,'quad_kattPP','q3.net','acne',2,NULL),(14,'436640008888','sqasdt.q3.net','',0,NULL),(29,'463624900028','sqasdt.q3.net','N/A',0,'6'),(15,'436640099099','sqasdt.q3.net','',0,NULL),(13,'pap','q3plus.qt','acne',1,NULL),(19,'436642612091','sqasdt.q3.net','N/A',0,'6'),(12,'quad_katt','q3.net','acne',0,NULL),(11,'quad_kattVK','q3.net','acne',1,NULL),(32,'463641969502','sqasdt.q3.net','N/A',1,'6'),(20,'joe','q3.net','joedesswd',0,NULL),(29,'436642900034','sqasdt.q3.net','N/A',0,'6'),(25,'contind','armerde.qt','acne',1,NULL);
+
+CREATE TABLE `t5_c` (
+ `capfa` bigint(20) unsigned NOT NULL default '0',
+ `gotod` smallint(5) unsigned NOT NULL default '0',
+ `orderutonsa` varchar(64) NOT NULL default '',
+ PRIMARY KEY (`capfa`,`gotod`,`orderutonsa`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t5_c` VALUES (21,2,''),(21,1,''),(22,4,'');
+
+CREATE TABLE `t6_c` (
+ `capfa_parent` bigint(20) unsigned NOT NULL default '0',
+ `capfa_child` bigint(20) unsigned NOT NULL default '0',
+ `relatta` smallint(5) unsigned NOT NULL default '0',
+ PRIMARY KEY (`capfa_child`,`capfa_parent`,`relatta`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t6_c` VALUES (15,16,0),(19,20,0),(18326932092909551615,30,0),(26,29,0),(18326932092909551615,29,0),(19,18,0),(26,28,0),(12,14,0);
+
+CREATE TABLE `t7_c` (
+ `dardpo` char(15) NOT NULL default '',
+ `dardtestard` tinyint(3) unsigned NOT NULL default '0',
+ `FastFA` char(5) NOT NULL default '',
+ `FastCode` char(6) NOT NULL default '',
+ `Fastca` char(1) NOT NULL default '',
+ `Fastmag` char(1) NOT NULL default '',
+ `Beareratta` char(2) NOT NULL default '',
+ PRIMARY KEY (`dardpo`,`dardtestard`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t7_c` VALUES ('2.6.2.4',24,'CECHP','54545','0','0','5'),('2.2.5.4',26,'CANFA','33223','1','1','4'),('4.3.2.4',28,'ITALD','54222','1','0','5'),('129..0.0.eins',28,'G','99999','1','1','5'),('1.1.1.1',24,'AUTPT','32323','0','1','3');
+
+CREATE TABLE `t8_c` (
+ `kattjame` varchar(32) NOT NULL default '',
+ `realm` varchar(32) NOT NULL default '',
+ `realm_entered` varchar(32) NOT NULL default '',
+ `maturegarbagefa` varchar(32) NOT NULL default '',
+ `hunderaaarbagefa_parent` varchar(32) NOT NULL default '',
+ `kattjame_entered` varchar(32) NOT NULL default '',
+ `hunderaaarbagefa` varchar(32) NOT NULL default '',
+ `gest` varchar(16) default NULL,
+ `hassetino` varchar(16) NOT NULL default '',
+ `aaaproxysessfa` varchar(255) default NULL,
+ `autologonallowed` char(1) default NULL,
+ `squardporoot` varchar(15) NOT NULL default '',
+ `naspo` varchar(15) default NULL,
+ `beareratta` char(2) default NULL,
+ `fastCode` varchar(6) default NULL,
+ `fastFA` varchar(5) default NULL,
+ `fastca` char(1) default NULL,
+ `fastmag` char(1) default NULL,
+ `lastupdate` datetime default NULL,
+ `hassetistart` datetime NOT NULL default '0000-00-00 00:00:00',
+ `accthassetitime` int(10) unsigned default NULL,
+ `acctoutputoctets` bigint(20) unsigned default NULL,
+ `acctinputoctets` bigint(20) unsigned default NULL,
+ PRIMARY KEY (`kattjame`,`hunderaaarbagefa`,`hassetistart`,`hassetino`),
+ KEY `squardporoot` (`squardporoot`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t8_c` VALUES ('4tt45345235','pap','q3plus.qt','q3plus.qt','q3.net','436643196120','436643196929','8956234534568968','5524595699','uxasmt21.net.acne.qt/481889229462692422','','1.1.1.1','2.2.4.6','4','86989','34','x','x','2012-03-12 12:55:34','2012-12-05 11:20:04',3223433,3369,9565),('4545435545','john','q3.net','q3.net','acne.li','436643196120','436643196929','45345234568968','995696699','uxasmt21.net.acne.qt/481889229462692423','','1.1.1.1','2.2.9.8','2','86989','34','x','x','2012-03-12 11:35:03','2012-12-05 08:50:04',8821923,169,3565),('versteckter_q3net_katt','joe','q3.net','elredun.com','q3.net','436643196120','436643196939','91341234568968','695595699','uxasmt21.net.acne.qt/481889229462692421','','1.1.1.1','2.5.2.5','3','86989','34','x','x','2012-03-12 18:35:04','2012-12-05 12:35:04',1923123,9569,6565);
+
+CREATE TABLE `t9_c` (
+ `kattjame` varchar(32) NOT NULL default '',
+ `kattjame_entered` varchar(32) NOT NULL default '',
+ `realm` varchar(32) NOT NULL default '',
+ `realm_entered` varchar(32) NOT NULL default '',
+ `maturegarbagefa` varchar(32) NOT NULL default '',
+ `hunderaaarbagefa` varchar(32) NOT NULL default '',
+ `hunderaaarbagefa_parent` varchar(32) NOT NULL default '',
+ `gest` varchar(16) default NULL,
+ `hassetino` varchar(16) NOT NULL default '',
+ `squardporoot` varchar(15) NOT NULL default '',
+ `naspo` varchar(15) default NULL,
+ `beareratta` char(2) default NULL,
+ `fastCode` varchar(6) default NULL,
+ `fastFA` varchar(5) default NULL,
+ `fastca` char(1) default NULL,
+ `fastmag` char(1) default NULL,
+ `lastupdate` datetime default NULL,
+ `hassetistart` datetime NOT NULL default '0000-00-00 00:00:00',
+ `accthassetitime` int(10) unsigned default NULL,
+ `actcoutpuocttets` bigint(20) unsigned default NULL,
+ `actinputocctets` bigint(20) unsigned default NULL,
+ `terminateraste` tinyint(3) unsigned default NULL,
+ PRIMARY KEY (`kattjame`,`hunderaaarbagefa`,`hassetistart`,`hassetino`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t9_c` VALUES ('3g4jh8gar2t','joe','q3.net','elredun.com','q3.net','436643316120','436643316939','91341234568968','695595699','1.1.1.1','2.2.6.2','3','86989','34','x','x','2012-03-12 18:35:04','2012-12-05 12:35:04',3123123,9569,6565,1),('4tt45345235','pap','q3plus.qt','q3plus.qt','q3.net','436643316120','436643316939','8956234534568968','5254595969','1.1.1.1','8.6.2.2','4','86989','34','x','x','2012-03-12 12:55:34','2012-12-05 11:20:04',3223433,3369,9565,2),('4545435545','john','q3.net','q3.net','acne.li','436643316120','436643316939','45345234568968','995696699','1.1.1.1','2.9.9.2','2','86998','34','x','x','2012-03-12 11:35:03','2012-12-05 08:50:04',8823123,169,3565,3);
+
+create table t1 engine=myisam as select * from t1_c;
+create table t2 engine=myisam as select * from t2_c;
+create table t3 engine=myisam as select * from t3_c;
+create table t4 engine=myisam as select * from t4_c;
+create table t5 engine=myisam as select * from t5_c;
+create table t6 engine=myisam as select * from t6_c;
+create table t7 engine=myisam as select * from t7_c;
+create table t8 engine=myisam as select * from t8_c;
+create table t9 engine=myisam as select * from t9_c;
+
+
+--source include/ndb_backup.inc
+drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+
+# random output order??
+#show tables;
+
+select count(*) from t1;
+select count(*) from t1_c;
+select count(*)
+ from (select * from t1 union
+ select * from t1_c) a;
+
+select count(*) from t2;
+select count(*) from t2_c;
+select count(*)
+ from (select * from t2 union
+ select * from t2_c) a;
+
+select count(*) from t3;
+select count(*) from t3_c;
+select count(*)
+ from (select * from t3 union
+ select * from t3_c) a;
+
+select count(*) from t4;
+select count(*) from t4_c;
+select count(*)
+ from (select * from t4 union
+ select * from t4_c) a;
+
+select count(*) from t5;
+select count(*) from t5_c;
+select count(*)
+ from (select * from t5 union
+ select * from t5_c) a;
+
+select count(*) from t6;
+select count(*) from t6_c;
+select count(*)
+ from (select * from t6 union
+ select * from t6_c) a;
+
+select count(*) from t7;
+select count(*) from t7_c;
+select count(*)
+ from (select * from t7 union
+ select * from t7_c) a;
+
+select count(*) from t8;
+select count(*) from t8_c;
+select count(*)
+ from (select * from t8 union
+ select * from t8_c) a;
+
+select count(*) from t9;
+select count(*) from t9_c;
+select count(*)
+ from (select * from t9 union
+ select * from t9_c) a;
+
+#
+# Try Partitioned tables as well
+#
+ALTER TABLE t1_c
+PARTITION BY RANGE (`capgoaledatta`)
+(PARTITION p0 VALUES LESS THAN MAXVALUE);
+
+ALTER TABLE t2_c
+PARTITION BY LIST(`capgotod`)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6));
+
+ALTER TABLE t3_c
+PARTITION BY HASH (`CapGoaledatta`);
+
+ALTER TABLE t5_c
+PARTITION BY HASH (`capfa`)
+PARTITIONS 4;
+
+ALTER TABLE t6_c
+PARTITION BY LINEAR HASH (`relatta`)
+PARTITIONS 4;
+
+ALTER TABLE t7_c
+PARTITION BY LINEAR KEY (`dardtestard`);
+
+--source include/ndb_backup.inc
+drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+
+select count(*) from t1;
+select count(*) from t1_c;
+select count(*)
+ from (select * from t1 union
+ select * from t1_c) a;
+
+select count(*) from t2;
+select count(*) from t2_c;
+select count(*)
+ from (select * from t2 union
+ select * from t2_c) a;
+
+select count(*) from t3;
+select count(*) from t3_c;
+select count(*)
+ from (select * from t3 union
+ select * from t3_c) a;
+
+select count(*) from t4;
+select count(*) from t4_c;
+select count(*)
+ from (select * from t4 union
+ select * from t4_c) a;
+
+select count(*) from t5;
+select count(*) from t5_c;
+select count(*)
+ from (select * from t5 union
+ select * from t5_c) a;
+
+select count(*) from t6;
+select count(*) from t6_c;
+select count(*)
+ from (select * from t6 union
+ select * from t6_c) a;
+
+select count(*) from t7;
+select count(*) from t7_c;
+select count(*)
+ from (select * from t7 union
+ select * from t7_c) a;
+
+select count(*) from t8;
+select count(*) from t8_c;
+select count(*)
+ from (select * from t8 union
+ select * from t8_c) a;
+
+select count(*) from t9;
+select count(*) from t9_c;
+select count(*)
+ from (select * from t9 union
+ select * from t9_c) a;
+
+drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 1 -m -r --ndb-nodegroup_map '(0,0)' --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+
+select count(*) from t1;
+select count(*) from t1_c;
+select count(*)
+ from (select * from t1 union
+ select * from t1_c) a;
+
+select count(*) from t2;
+select count(*) from t2_c;
+select count(*)
+ from (select * from t2 union
+ select * from t2_c) a;
+
+select count(*) from t3;
+select count(*) from t3_c;
+select count(*)
+ from (select * from t3 union
+ select * from t3_c) a;
+
+select count(*) from t4;
+select count(*) from t4_c;
+select count(*)
+ from (select * from t4 union
+ select * from t4_c) a;
+
+select count(*) from t5;
+select count(*) from t5_c;
+select count(*)
+ from (select * from t5 union
+ select * from t5_c) a;
+
+select count(*) from t6;
+select count(*) from t6_c;
+select count(*)
+ from (select * from t6 union
+ select * from t6_c) a;
+
+select count(*) from t7;
+select count(*) from t7_c;
+select count(*)
+ from (select * from t7 union
+ select * from t7_c) a;
+
+select count(*) from t8;
+select count(*) from t8_c;
+select count(*)
+ from (select * from t8 union
+ select * from t8_c) a;
+
+select count(*) from t9;
+select count(*) from t9_c;
+select count(*)
+ from (select * from t9 union
+ select * from t9_c) a;
+
+#
+# Drop all table except t2_c
+# This to make sure that error returned from ndb_restore above is
+# guaranteed to be from t2_c, this since order of tables in backup
+# is none deterministic
+#
+drop table t1_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+--source include/ndb_backup.inc
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --core=0 -b $the_backup_id -n 1 -m -r --ndb-nodegroup_map '(0,1)' $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id 2>&1 | grep Translate || true
+
+#
+# Cleanup
+#
+
+--disable_warnings
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+drop table if exists t2_c;
+--enable_warnings
+
+#
+# Test BUG#10287
+#
+
+--exec $NDB_TOOLS_DIR/ndb_select_all --no-defaults -d sys -D , SYSTAB_0 | grep 520093696, | sed "s/,$the_backup_id/,<the_backup_id>/"
+
+# End of 4.1 tests
diff --git a/mysql-test/t/ndb_subquery.test b/mysql-test/t/ndb_subquery.test
index 93c45c521a0..9cf6527dd98 100644
--- a/mysql-test/t/ndb_subquery.test
+++ b/mysql-test/t/ndb_subquery.test
@@ -18,18 +18,22 @@ insert into t1 values (1,1,1),(2,2,2),(3,3,3);
insert into t2 values (1,1,1),(2,2,2),(3,3,3), (4,4,4), (5,5,5);
# Use pk
+--replace_column 9 #
explain select * from t2 where p NOT IN (select p from t1);
select * from t2 where p NOT IN (select p from t1) order by p;
# Use unique index
+--replace_column 9 #
explain select * from t2 where p NOT IN (select u from t1);
select * from t2 where p NOT IN (select u from t1) order by p;
# Use ordered index
+--replace_column 9 #
explain select * from t2 where p NOT IN (select o from t1);
select * from t2 where p NOT IN (select o from t1) order by p;
# Use scan
+--replace_column 9 #
explain select * from t2 where p NOT IN (select p+0 from t1);
select * from t2 where p NOT IN (select p+0 from t1) order by p;
diff --git a/mysql-test/t/ndb_temporary.test b/mysql-test/t/ndb_temporary.test
new file mode 100644
index 00000000000..7f6902bf745
--- /dev/null
+++ b/mysql-test/t/ndb_temporary.test
@@ -0,0 +1,38 @@
+-- source include/have_ndb.inc
+-- source include/not_embedded.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+#
+# creating a temporary table with engine=ndb should give an error
+#
+--error ER_ILLEGAL_HA_CREATE_OPTION
+create temporary table t1 (a int key) engine=ndb;
+
+
+#
+# alter temporary table to engine=ndb should give an error
+#
+create temporary table t1 (a int key) engine=myisam;
+--error ER_ILLEGAL_HA_CREATE_OPTION
+alter table t1 engine=ndb;
+drop table t1;
+
+
+#
+# if default storage engine=ndb, temporary tables
+# without explicit engine= should be created as myisam
+#
+SET SESSION storage_engine=NDBCLUSTER;
+create table t1 (a int key);
+
+# verify that we have a ndb table
+select engine from information_schema.tables where table_name = 't1';
+drop table t1;
+
+# verify that we have a myisam table
+create temporary table t1 (a int key);
+show create table t1;
+drop table t1;
diff --git a/mysql-test/t/ndb_view.test b/mysql-test/t/ndb_view.test
new file mode 100644
index 00000000000..3b8fc330b40
--- /dev/null
+++ b/mysql-test/t/ndb_view.test
@@ -0,0 +1,29 @@
+-- source include/have_ndb.inc
+-- source include/not_embedded.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2,t3;
+DROP VIEW IF EXISTS v1,v2,v3;
+--enable_warnings
+
+#
+# simple operations via view
+#
+
+create table t1 (a int, b int, c int, d int) engine=ndb;
+insert into t1 values (1,2,3,4),(5,6,7,8);
+
+create view v1 as select t1.c as a, t1.a as b, t1.d as c, t1.a+t1.b+t1.c as d from t1;
+select * from v1 order by a,b,c;
+
+update v1 set a=a+100 where b=1;
+select * from v1 order by a,b,c;
+
+drop view v1;
+
+create view v1 as select t1.c as a from t1;
+insert into v1 values (200);
+select * from t1 order by a,b,c,d;
+
+drop view v1;
+drop table t1;
diff --git a/mysql-test/t/ndbapi.test b/mysql-test/t/ndbapi.test
new file mode 100644
index 00000000000..3424513f8af
--- /dev/null
+++ b/mysql-test/t/ndbapi.test
@@ -0,0 +1,44 @@
+-- source include/have_ndb.inc
+-- source include/have_ndbapi_examples.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t0;
+drop database if exists mysqltest;
+--enable_warnings
+
+--exec echo Running ndbapi_simple
+--exec $NDB_EXAMPLES_DIR/ndbapi_simple/ndbapi_simple $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT
+
+--exec echo Running ndbapi_simple_index
+--exec $NDB_EXAMPLES_DIR/ndbapi_simple_index/ndbapi_simple_index $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT
+
+--exec echo Running ndbapi_scan
+--exec $NDB_EXAMPLES_DIR/ndbapi_scan/ndbapi_scan $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT
+
+--exec echo Running ndbapi_retries
+--exec $NDB_EXAMPLES_DIR/ndbapi_retries/ndbapi_retries $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT
+
+--exec echo Running ndbapi_async
+--exec $NDB_EXAMPLES_DIR/ndbapi_async/ndbapi_async $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT
+
+--exec echo Running ndbapi_async1
+--exec $NDB_EXAMPLES_DIR/ndbapi_async1/ndbapi_async1 $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT
+
+use TEST_DB;
+create table t0(c0 int, c1 int, c2 char(4), c3 char(4), c4 text,
+ primary key(c0, c2)) engine ndb charset latin1;
+#--exec echo Running ndbapi_event
+#--exec $NDB_EXAMPLES_DIR/ndbapi_event/ndbapi_event "localhost:$NDBCLUSTER_PORT" 1 >> $NDB_EXAMPLES_OUTPUT
+insert into t0 values (1, 2, 'a', 'b', null);
+insert into t0 values (3, 4, 'c', 'd', null);
+update t0 set c3 = 'e' where c0 = 1 and c2 = 'a'; -- use pk
+update t0 set c3 = 'f'; -- use scan
+update t0 set c3 = 'F'; -- use scan update to 'same'
+update t0 set c2 = 'g' where c0 = 1; -- update pk part
+update t0 set c2 = 'G' where c0 = 1; -- update pk part to 'same'
+update t0 set c0 = 5, c2 = 'H' where c0 = 3; -- update full PK
+delete from t0;
+drop table t0;
+
+--exec echo Running mgmapi_logevent
+--exec $NDB_EXAMPLES_DIR/mgmapi_logevent/mgmapi_logevent "localhost:$NDBCLUSTER_PORT" 1 >> $NDB_EXAMPLES_OUTPUT
diff --git a/mysql-test/t/not_embedded_server.test b/mysql-test/t/not_embedded_server.test
index 83ec03d6706..5beee5967a3 100644
--- a/mysql-test/t/not_embedded_server.test
+++ b/mysql-test/t/not_embedded_server.test
@@ -9,10 +9,15 @@
# To not show other connections, this must be the first test and we must
# have a server restart before this one
#
+# We don't have any 4.1 tests as we use I_S to query the PROCESSLIST to
+# exclude system threads that may/may not be active in the server
+# (namely the ndb injector thread)
+#
+# End of 4.1 tests
-prepare stmt1 from ' show full processlist ';
+prepare stmt1 from ' SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!=\'Daemon\' ';
--replace_column 1 number 6 time 3 localhost
execute stmt1;
deallocate prepare stmt1;
-# End of 4.1 tests
+# End of 5.1 tests
diff --git a/mysql-test/t/not_partition.test b/mysql-test/t/not_partition.test
new file mode 100644
index 00000000000..992615c06f4
--- /dev/null
+++ b/mysql-test/t/not_partition.test
@@ -0,0 +1,62 @@
+--disable_abort_on_error
+# Run this tets only when mysqld don't has partitioning
+# the statements are not expected to work, just check that we
+# can't crash the server
+-- require r/not_partition.require
+disable_query_log;
+show variables like "have_partitioning";
+enable_query_log;
+
+
+--error ER_FEATURE_DISABLED
+CREATE TABLE t1 (
+ firstname VARCHAR(25) NOT NULL,
+ lastname VARCHAR(25) NOT NULL,
+ username VARCHAR(16) NOT NULL,
+ email VARCHAR(35),
+ joined DATE NOT NULL
+)
+PARTITION BY KEY(joined)
+PARTITIONS 6;
+
+--error ER_FEATURE_DISABLED
+ALTER TABLE t1 PARTITION BY KEY(joined) PARTITIONS 2;
+
+--error ER_BAD_TABLE_ERROR
+drop table t1;
+
+--error ER_FEATURE_DISABLED
+CREATE TABLE t1 (
+ firstname VARCHAR(25) NOT NULL,
+ lastname VARCHAR(25) NOT NULL,
+ username VARCHAR(16) NOT NULL,
+ email VARCHAR(35),
+ joined DATE NOT NULL
+)
+PARTITION BY RANGE( YEAR(joined) ) (
+ PARTITION p0 VALUES LESS THAN (1960),
+ PARTITION p1 VALUES LESS THAN (1970),
+ PARTITION p2 VALUES LESS THAN (1980),
+ PARTITION p3 VALUES LESS THAN (1990),
+ PARTITION p4 VALUES LESS THAN MAXVALUE
+);
+--error ER_BAD_TABLE_ERROR
+drop table t1;
+
+--error ER_FEATURE_DISABLED
+CREATE TABLE t1 (id INT, purchased DATE)
+ PARTITION BY RANGE( YEAR(purchased) )
+ SUBPARTITION BY HASH( TO_DAYS(purchased) )
+ SUBPARTITIONS 2 (
+ PARTITION p0 VALUES LESS THAN (1990),
+ PARTITION p1 VALUES LESS THAN (2000),
+ PARTITION p2 VALUES LESS THAN MAXVALUE
+ );
+--error ER_BAD_TABLE_ERROR
+drop table t1;
+
+# Create a table without partitions to test "EXPLAIN PARTITIONS"
+create table t1 (a varchar(10) charset latin1 collate latin1_bin);
+insert into t1 values (''),(' '),('a'),('a '),('a ');
+explain partitions select * from t1 where a='a ' OR a='a';
+drop table t1;
diff --git a/mysql-test/t/parser.test b/mysql-test/t/parser.test
new file mode 100644
index 00000000000..11af7c691d8
--- /dev/null
+++ b/mysql-test/t/parser.test
@@ -0,0 +1,510 @@
+#
+# This file contains tests covering the parser
+#
+
+#=============================================================================
+# LEXICAL PARSER (lex)
+#=============================================================================
+
+SET @save_sql_mode=@@sql_mode;
+
+#
+# Documenting the current behavior, to detect incompatible changes.
+# In each cases:
+# - no error is the correct result
+# - an error is the expected result with the current implementation,
+# and is a limitation.
+
+set SQL_MODE='';
+
+create table ADDDATE(a int);
+drop table ADDDATE;
+create table ADDDATE (a int);
+drop table ADDDATE;
+
+--error ER_PARSE_ERROR
+create table BIT_AND(a int);
+create table BIT_AND (a int);
+drop table BIT_AND;
+
+--error ER_PARSE_ERROR
+create table BIT_OR(a int);
+create table BIT_OR (a int);
+drop table BIT_OR;
+
+--error ER_PARSE_ERROR
+create table BIT_XOR(a int);
+create table BIT_XOR (a int);
+drop table BIT_XOR;
+
+--error ER_PARSE_ERROR
+create table CAST(a int);
+create table CAST (a int);
+drop table CAST;
+
+--error ER_PARSE_ERROR
+create table COUNT(a int);
+create table COUNT (a int);
+drop table COUNT;
+
+--error ER_PARSE_ERROR
+create table CURDATE(a int);
+create table CURDATE (a int);
+drop table CURDATE;
+
+--error ER_PARSE_ERROR
+create table CURTIME(a int);
+create table CURTIME (a int);
+drop table CURTIME;
+
+--error ER_PARSE_ERROR
+create table DATE_ADD(a int);
+create table DATE_ADD (a int);
+drop table DATE_ADD;
+
+--error ER_PARSE_ERROR
+create table DATE_SUB(a int);
+create table DATE_SUB (a int);
+drop table DATE_SUB;
+
+--error ER_PARSE_ERROR
+create table EXTRACT(a int);
+create table EXTRACT (a int);
+drop table EXTRACT;
+
+--error ER_PARSE_ERROR
+create table GROUP_CONCAT(a int);
+create table GROUP_CONCAT (a int);
+drop table GROUP_CONCAT;
+
+--error ER_PARSE_ERROR
+create table GROUP_UNIQUE_USERS(a int);
+create table GROUP_UNIQUE_USERS (a int);
+drop table GROUP_UNIQUE_USERS;
+
+--error ER_PARSE_ERROR
+create table MAX(a int);
+create table MAX (a int);
+drop table MAX;
+
+--error ER_PARSE_ERROR
+create table MID(a int);
+create table MID (a int);
+drop table MID;
+
+--error ER_PARSE_ERROR
+create table MIN(a int);
+create table MIN (a int);
+drop table MIN;
+
+--error ER_PARSE_ERROR
+create table NOW(a int);
+create table NOW (a int);
+drop table NOW;
+
+--error ER_PARSE_ERROR
+create table POSITION(a int);
+create table POSITION (a int);
+drop table POSITION;
+
+create table SESSION_USER(a int);
+drop table SESSION_USER;
+create table SESSION_USER (a int);
+drop table SESSION_USER;
+
+--error ER_PARSE_ERROR
+create table STD(a int);
+create table STD (a int);
+drop table STD;
+
+--error ER_PARSE_ERROR
+create table STDDEV(a int);
+create table STDDEV (a int);
+drop table STDDEV;
+
+--error ER_PARSE_ERROR
+create table STDDEV_POP(a int);
+create table STDDEV_POP (a int);
+drop table STDDEV_POP;
+
+--error ER_PARSE_ERROR
+create table STDDEV_SAMP(a int);
+create table STDDEV_SAMP (a int);
+drop table STDDEV_SAMP;
+
+create table SUBDATE(a int);
+drop table SUBDATE;
+create table SUBDATE (a int);
+drop table SUBDATE;
+
+--error ER_PARSE_ERROR
+create table SUBSTR(a int);
+create table SUBSTR (a int);
+drop table SUBSTR;
+
+--error ER_PARSE_ERROR
+create table SUBSTRING(a int);
+create table SUBSTRING (a int);
+drop table SUBSTRING;
+
+--error ER_PARSE_ERROR
+create table SUM(a int);
+create table SUM (a int);
+drop table SUM;
+
+--error ER_PARSE_ERROR
+create table SYSDATE(a int);
+create table SYSDATE (a int);
+drop table SYSDATE;
+
+create table SYSTEM_USER(a int);
+drop table SYSTEM_USER;
+create table SYSTEM_USER (a int);
+drop table SYSTEM_USER;
+
+--error ER_PARSE_ERROR
+create table TRIM(a int);
+create table TRIM (a int);
+drop table TRIM;
+
+--error ER_PARSE_ERROR
+create table UNIQUE_USERS(a int);
+create table UNIQUE_USERS (a int);
+drop table UNIQUE_USERS;
+
+--error ER_PARSE_ERROR
+create table VARIANCE(a int);
+create table VARIANCE (a int);
+drop table VARIANCE;
+
+--error ER_PARSE_ERROR
+create table VAR_POP(a int);
+create table VAR_POP (a int);
+drop table VAR_POP;
+
+--error ER_PARSE_ERROR
+create table VAR_SAMP(a int);
+create table VAR_SAMP (a int);
+drop table VAR_SAMP;
+
+set SQL_MODE='IGNORE_SPACE';
+
+create table ADDDATE(a int);
+drop table ADDDATE;
+create table ADDDATE (a int);
+drop table ADDDATE;
+
+--error ER_PARSE_ERROR
+create table BIT_AND(a int);
+--error ER_PARSE_ERROR
+create table BIT_AND (a int);
+
+--error ER_PARSE_ERROR
+create table BIT_OR(a int);
+--error ER_PARSE_ERROR
+create table BIT_OR (a int);
+
+--error ER_PARSE_ERROR
+create table BIT_XOR(a int);
+--error ER_PARSE_ERROR
+create table BIT_XOR (a int);
+
+--error ER_PARSE_ERROR
+create table CAST(a int);
+--error ER_PARSE_ERROR
+create table CAST (a int);
+
+--error ER_PARSE_ERROR
+create table COUNT(a int);
+--error ER_PARSE_ERROR
+create table COUNT (a int);
+
+--error ER_PARSE_ERROR
+create table CURDATE(a int);
+--error ER_PARSE_ERROR
+create table CURDATE (a int);
+
+--error ER_PARSE_ERROR
+create table CURTIME(a int);
+--error ER_PARSE_ERROR
+create table CURTIME (a int);
+
+--error ER_PARSE_ERROR
+create table DATE_ADD(a int);
+--error ER_PARSE_ERROR
+create table DATE_ADD (a int);
+
+--error ER_PARSE_ERROR
+create table DATE_SUB(a int);
+--error ER_PARSE_ERROR
+create table DATE_SUB (a int);
+
+--error ER_PARSE_ERROR
+create table EXTRACT(a int);
+--error ER_PARSE_ERROR
+create table EXTRACT (a int);
+
+--error ER_PARSE_ERROR
+create table GROUP_CONCAT(a int);
+--error ER_PARSE_ERROR
+create table GROUP_CONCAT (a int);
+
+--error ER_PARSE_ERROR
+create table GROUP_UNIQUE_USERS(a int);
+--error ER_PARSE_ERROR
+create table GROUP_UNIQUE_USERS (a int);
+
+--error ER_PARSE_ERROR
+create table MAX(a int);
+--error ER_PARSE_ERROR
+create table MAX (a int);
+
+--error ER_PARSE_ERROR
+create table MID(a int);
+--error ER_PARSE_ERROR
+create table MID (a int);
+
+--error ER_PARSE_ERROR
+create table MIN(a int);
+--error ER_PARSE_ERROR
+create table MIN (a int);
+
+--error ER_PARSE_ERROR
+create table NOW(a int);
+--error ER_PARSE_ERROR
+create table NOW (a int);
+
+--error ER_PARSE_ERROR
+create table POSITION(a int);
+--error ER_PARSE_ERROR
+create table POSITION (a int);
+
+create table SESSION_USER(a int);
+drop table SESSION_USER;
+create table SESSION_USER (a int);
+drop table SESSION_USER;
+
+--error ER_PARSE_ERROR
+create table STD(a int);
+--error ER_PARSE_ERROR
+create table STD (a int);
+
+--error ER_PARSE_ERROR
+create table STDDEV(a int);
+--error ER_PARSE_ERROR
+create table STDDEV (a int);
+
+--error ER_PARSE_ERROR
+create table STDDEV_POP(a int);
+--error ER_PARSE_ERROR
+create table STDDEV_POP (a int);
+
+--error ER_PARSE_ERROR
+create table STDDEV_SAMP(a int);
+--error ER_PARSE_ERROR
+create table STDDEV_SAMP (a int);
+
+create table SUBDATE(a int);
+drop table SUBDATE;
+create table SUBDATE (a int);
+drop table SUBDATE;
+
+--error ER_PARSE_ERROR
+create table SUBSTR(a int);
+--error ER_PARSE_ERROR
+create table SUBSTR (a int);
+
+--error ER_PARSE_ERROR
+create table SUBSTRING(a int);
+--error ER_PARSE_ERROR
+create table SUBSTRING (a int);
+
+--error ER_PARSE_ERROR
+create table SUM(a int);
+--error ER_PARSE_ERROR
+create table SUM (a int);
+
+--error ER_PARSE_ERROR
+create table SYSDATE(a int);
+--error ER_PARSE_ERROR
+create table SYSDATE (a int);
+
+create table SYSTEM_USER(a int);
+drop table SYSTEM_USER;
+create table SYSTEM_USER (a int);
+drop table SYSTEM_USER;
+
+--error ER_PARSE_ERROR
+create table TRIM(a int);
+--error ER_PARSE_ERROR
+create table TRIM (a int);
+
+--error ER_PARSE_ERROR
+create table UNIQUE_USERS(a int);
+--error ER_PARSE_ERROR
+create table UNIQUE_USERS (a int);
+
+--error ER_PARSE_ERROR
+create table VARIANCE(a int);
+--error ER_PARSE_ERROR
+create table VARIANCE (a int);
+
+--error ER_PARSE_ERROR
+create table VAR_POP(a int);
+--error ER_PARSE_ERROR
+create table VAR_POP (a int);
+
+--error ER_PARSE_ERROR
+create table VAR_SAMP(a int);
+--error ER_PARSE_ERROR
+create table VAR_SAMP (a int);
+
+SET @@sql_mode=@save_sql_mode;
+
+#=============================================================================
+# SYNTACTIC PARSER (bison)
+#=============================================================================
+
+#
+#
+# Bug#21114 (Foreign key creation fails to table with name format)
+#
+
+# Test coverage with edge conditions
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select pi(3.14);
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select tan();
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select tan(1, 2);
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select makedate(1);
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select makedate(1, 2, 3);
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select maketime();
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select maketime(1);
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select maketime(1, 2);
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select maketime(1, 2, 3, 4);
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select atan();
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select atan2(1, 2, 3);
+
+select benchmark(10, 1+1);
+
+-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
+select benchmark(5+5, 2);
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select concat();
+select concat("foo");
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select concat_ws();
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select concat_ws("foo");
+
+set @pwd="my password";
+-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
+select encode("secret", @pwd);
+-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
+select decode("encoded-secret", @pwd);
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select encrypt();
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select encrypt(1, 2, 3);
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select des_encrypt("p1", "p2", "not expected");
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select des_decrypt("p1", "p2", "not expected");
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select elt();
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select elt(1);
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select export_set();
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select export_set("p1");
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select export_set("p1", "p2");
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select export_set("p1", "p2", "p3", "p4", "p5", "p6");
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select field();
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select field("p1");
+
+set @dec=2;
+-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
+select format(pi(), @dec);
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select from_unixtime();
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select from_unixtime(1, 2, 3);
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select unix_timestamp(1, 2);
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select greatest();
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select greatest(12);
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select last_insert_id(1, 2);
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select least();
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select least(12);
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select locate();
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select locate(1);
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select locate(1, 2, 3, 4);
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select log();
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select log(1, 2, 3);
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select make_set();
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select make_set(1);
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select master_pos_wait();
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select master_pos_wait(1);
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select master_pos_wait(1, 2, 3, 4);
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select rand(1, 2, 3);
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select round(1, 2, 3);
+
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select yearweek();
+-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+select yearweek(1, 2, 3);
+
diff --git a/mysql-test/t/parser_bug21114_innodb.test b/mysql-test/t/parser_bug21114_innodb.test
new file mode 100644
index 00000000000..969eea2da40
--- /dev/null
+++ b/mysql-test/t/parser_bug21114_innodb.test
@@ -0,0 +1,422 @@
+-- source include/have_innodb.inc
+
+let $engine_type=InnoDb;
+
+#
+# Bug#21114 (Foreign key creation fails to table with name format)
+#
+
+# Testing with the full log for only a few functions,
+# including FORMAT for witch the bug was reported.
+
+let $verbose=1;
+
+let $FCT=abs;
+-- source include/parser_bug21114.inc
+let $FCT=field;
+-- source include/parser_bug21114.inc
+let $FCT=format;
+-- source include/parser_bug21114.inc
+
+# Ignoring the result of SHOW CREATE (this generates too much noise)
+# Tests will fail if the create table statement can not be parsed
+
+let verbose=0;
+
+let $FCT=acos;
+-- source include/parser_bug21114.inc
+let $FCT=adddate;
+-- source include/parser_bug21114.inc
+let $FCT=addtime;
+-- source include/parser_bug21114.inc
+let $FCT=aes_decrypt;
+-- source include/parser_bug21114.inc
+let $FCT=aes_encrypt;
+-- source include/parser_bug21114.inc
+let $FCT=area;
+-- source include/parser_bug21114.inc
+let $FCT=asbinary;
+-- source include/parser_bug21114.inc
+let $FCT=asin;
+-- source include/parser_bug21114.inc
+let $FCT=astext;
+-- source include/parser_bug21114.inc
+let $FCT=aswkb;
+-- source include/parser_bug21114.inc
+let $FCT=aswkt;
+-- source include/parser_bug21114.inc
+let $FCT=atan;
+-- source include/parser_bug21114.inc
+let $FCT=atan2;
+-- source include/parser_bug21114.inc
+let $FCT=benchmark;
+-- source include/parser_bug21114.inc
+let $FCT=bin;
+-- source include/parser_bug21114.inc
+let $FCT=bit_count;
+-- source include/parser_bug21114.inc
+let $FCT=bit_length;
+-- source include/parser_bug21114.inc
+let $FCT=ceil;
+-- source include/parser_bug21114.inc
+let $FCT=ceiling;
+-- source include/parser_bug21114.inc
+let $FCT=centroid;
+-- source include/parser_bug21114.inc
+let $FCT=character_length;
+-- source include/parser_bug21114.inc
+let $FCT=char_length;
+-- source include/parser_bug21114.inc
+let $FCT=coercibility;
+-- source include/parser_bug21114.inc
+let $FCT=compress;
+-- source include/parser_bug21114.inc
+let $FCT=concat;
+-- source include/parser_bug21114.inc
+let $FCT=concat_ws;
+-- source include/parser_bug21114.inc
+let $FCT=connection_id;
+-- source include/parser_bug21114.inc
+let $FCT=conv;
+-- source include/parser_bug21114.inc
+let $FCT=convert_tz;
+-- source include/parser_bug21114.inc
+let $FCT=cos;
+-- source include/parser_bug21114.inc
+let $FCT=cot;
+-- source include/parser_bug21114.inc
+let $FCT=crc32;
+-- source include/parser_bug21114.inc
+let $FCT=crosses;
+-- source include/parser_bug21114.inc
+let $FCT=datediff;
+-- source include/parser_bug21114.inc
+let $FCT=date_format;
+-- source include/parser_bug21114.inc
+let $FCT=dayname;
+-- source include/parser_bug21114.inc
+let $FCT=dayofmonth;
+-- source include/parser_bug21114.inc
+let $FCT=dayofweek;
+-- source include/parser_bug21114.inc
+let $FCT=dayofyear;
+-- source include/parser_bug21114.inc
+let $FCT=decode;
+-- source include/parser_bug21114.inc
+let $FCT=degrees;
+-- source include/parser_bug21114.inc
+let $FCT=des_decrypt;
+-- source include/parser_bug21114.inc
+let $FCT=des_encrypt;
+-- source include/parser_bug21114.inc
+let $FCT=dimension;
+-- source include/parser_bug21114.inc
+let $FCT=disjoint;
+-- source include/parser_bug21114.inc
+let $FCT=elt;
+-- source include/parser_bug21114.inc
+let $FCT=encode;
+-- source include/parser_bug21114.inc
+let $FCT=encrypt;
+-- source include/parser_bug21114.inc
+let $FCT=endpoint;
+-- source include/parser_bug21114.inc
+let $FCT=envelope;
+-- source include/parser_bug21114.inc
+let $FCT=equals;
+-- source include/parser_bug21114.inc
+let $FCT=exp;
+-- source include/parser_bug21114.inc
+let $FCT=export_set;
+-- source include/parser_bug21114.inc
+let $FCT=exteriorring;
+-- source include/parser_bug21114.inc
+let $FCT=extractvalue;
+-- source include/parser_bug21114.inc
+let $FCT=find_in_set;
+-- source include/parser_bug21114.inc
+let $FCT=floor;
+-- source include/parser_bug21114.inc
+let $FCT=found_rows;
+-- source include/parser_bug21114.inc
+let $FCT=from_days;
+-- source include/parser_bug21114.inc
+let $FCT=from_unixtime;
+-- source include/parser_bug21114.inc
+let $FCT=geomcollfromtext;
+-- source include/parser_bug21114.inc
+let $FCT=geomcollfromwkb;
+-- source include/parser_bug21114.inc
+let $FCT=geometrycollectionfromtext;
+-- source include/parser_bug21114.inc
+let $FCT=geometrycollectionfromwkb;
+-- source include/parser_bug21114.inc
+let $FCT=geometryfromtext;
+-- source include/parser_bug21114.inc
+let $FCT=geometryfromwkb;
+-- source include/parser_bug21114.inc
+let $FCT=geometryn;
+-- source include/parser_bug21114.inc
+let $FCT=geometrytype;
+-- source include/parser_bug21114.inc
+let $FCT=geomfromtext;
+-- source include/parser_bug21114.inc
+let $FCT=geomfromwkb;
+-- source include/parser_bug21114.inc
+let $FCT=get_lock;
+-- source include/parser_bug21114.inc
+let $FCT=glength;
+-- source include/parser_bug21114.inc
+let $FCT=greatest;
+-- source include/parser_bug21114.inc
+let $FCT=hex;
+-- source include/parser_bug21114.inc
+let $FCT=ifnull;
+-- source include/parser_bug21114.inc
+let $FCT=inet_aton;
+-- source include/parser_bug21114.inc
+let $FCT=inet_ntoa;
+-- source include/parser_bug21114.inc
+let $FCT=instr;
+-- source include/parser_bug21114.inc
+let $FCT=interiorringn;
+-- source include/parser_bug21114.inc
+let $FCT=intersects;
+-- source include/parser_bug21114.inc
+let $FCT=isclosed;
+-- source include/parser_bug21114.inc
+let $FCT=isempty;
+-- source include/parser_bug21114.inc
+let $FCT=isnull;
+-- source include/parser_bug21114.inc
+let $FCT=issimple;
+-- source include/parser_bug21114.inc
+let $FCT=is_free_lock;
+-- source include/parser_bug21114.inc
+let $FCT=is_used_lock;
+-- source include/parser_bug21114.inc
+let $FCT=last_day;
+-- source include/parser_bug21114.inc
+let $FCT=last_insert_id;
+-- source include/parser_bug21114.inc
+let $FCT=lcase;
+-- source include/parser_bug21114.inc
+let $FCT=least;
+-- source include/parser_bug21114.inc
+let $FCT=length;
+-- source include/parser_bug21114.inc
+let $FCT=linefromtext;
+-- source include/parser_bug21114.inc
+let $FCT=linefromwkb;
+-- source include/parser_bug21114.inc
+let $FCT=linestringfromtext;
+-- source include/parser_bug21114.inc
+let $FCT=linestringfromwkb;
+-- source include/parser_bug21114.inc
+let $FCT=ln;
+-- source include/parser_bug21114.inc
+let $FCT=load_file;
+-- source include/parser_bug21114.inc
+let $FCT=locate;
+-- source include/parser_bug21114.inc
+let $FCT=log;
+-- source include/parser_bug21114.inc
+let $FCT=log10;
+-- source include/parser_bug21114.inc
+let $FCT=log2;
+-- source include/parser_bug21114.inc
+let $FCT=lower;
+-- source include/parser_bug21114.inc
+let $FCT=lpad;
+-- source include/parser_bug21114.inc
+let $FCT=ltrim;
+-- source include/parser_bug21114.inc
+let $FCT=makedate;
+-- source include/parser_bug21114.inc
+let $FCT=maketime;
+-- source include/parser_bug21114.inc
+let $FCT=make_set;
+-- source include/parser_bug21114.inc
+let $FCT=master_pos_wait;
+-- source include/parser_bug21114.inc
+let $FCT=mbrcontains;
+-- source include/parser_bug21114.inc
+let $FCT=mbrdisjoint;
+-- source include/parser_bug21114.inc
+let $FCT=mbrequal;
+-- source include/parser_bug21114.inc
+let $FCT=mbrintersects;
+-- source include/parser_bug21114.inc
+let $FCT=mbroverlaps;
+-- source include/parser_bug21114.inc
+let $FCT=mbrtouches;
+-- source include/parser_bug21114.inc
+let $FCT=mbrwithin;
+-- source include/parser_bug21114.inc
+let $FCT=md5;
+-- source include/parser_bug21114.inc
+let $FCT=mlinefromtext;
+-- source include/parser_bug21114.inc
+let $FCT=mlinefromwkb;
+-- source include/parser_bug21114.inc
+let $FCT=monthname;
+-- source include/parser_bug21114.inc
+let $FCT=mpointfromtext;
+-- source include/parser_bug21114.inc
+let $FCT=mpointfromwkb;
+-- source include/parser_bug21114.inc
+let $FCT=mpolyfromtext;
+-- source include/parser_bug21114.inc
+let $FCT=mpolyfromwkb;
+-- source include/parser_bug21114.inc
+let $FCT=multilinestringfromtext;
+-- source include/parser_bug21114.inc
+let $FCT=multilinestringfromwkb;
+-- source include/parser_bug21114.inc
+let $FCT=multipointfromtext;
+-- source include/parser_bug21114.inc
+let $FCT=multipointfromwkb;
+-- source include/parser_bug21114.inc
+let $FCT=multipolygonfromtext;
+-- source include/parser_bug21114.inc
+let $FCT=multipolygonfromwkb;
+-- source include/parser_bug21114.inc
+let $FCT=name_const;
+-- source include/parser_bug21114.inc
+let $FCT=nullif;
+-- source include/parser_bug21114.inc
+let $FCT=numgeometries;
+-- source include/parser_bug21114.inc
+let $FCT=numinteriorrings;
+-- source include/parser_bug21114.inc
+let $FCT=numpoints;
+-- source include/parser_bug21114.inc
+let $FCT=oct;
+-- source include/parser_bug21114.inc
+let $FCT=octet_length;
+-- source include/parser_bug21114.inc
+let $FCT=ord;
+-- source include/parser_bug21114.inc
+let $FCT=overlaps;
+-- source include/parser_bug21114.inc
+let $FCT=period_add;
+-- source include/parser_bug21114.inc
+let $FCT=period_diff;
+-- source include/parser_bug21114.inc
+let $FCT=pi;
+-- source include/parser_bug21114.inc
+let $FCT=pointfromtext;
+-- source include/parser_bug21114.inc
+let $FCT=pointfromwkb;
+-- source include/parser_bug21114.inc
+let $FCT=pointn;
+-- source include/parser_bug21114.inc
+let $FCT=polyfromtext;
+-- source include/parser_bug21114.inc
+let $FCT=polyfromwkb;
+-- source include/parser_bug21114.inc
+let $FCT=polygonfromtext;
+-- source include/parser_bug21114.inc
+let $FCT=polygonfromwkb;
+-- source include/parser_bug21114.inc
+let $FCT=pow;
+-- source include/parser_bug21114.inc
+let $FCT=power;
+-- source include/parser_bug21114.inc
+let $FCT=quote;
+-- source include/parser_bug21114.inc
+let $FCT=radians;
+-- source include/parser_bug21114.inc
+let $FCT=rand;
+-- source include/parser_bug21114.inc
+let $FCT=release_lock;
+-- source include/parser_bug21114.inc
+let $FCT=reverse;
+-- source include/parser_bug21114.inc
+let $FCT=round;
+-- source include/parser_bug21114.inc
+let $FCT=row_count;
+-- source include/parser_bug21114.inc
+let $FCT=rpad;
+-- source include/parser_bug21114.inc
+let $FCT=rtrim;
+-- source include/parser_bug21114.inc
+let $FCT=sec_to_time;
+-- source include/parser_bug21114.inc
+let $FCT=session_user;
+-- source include/parser_bug21114.inc
+let $FCT=sha;
+-- source include/parser_bug21114.inc
+let $FCT=sha1;
+-- source include/parser_bug21114.inc
+let $FCT=sign;
+-- source include/parser_bug21114.inc
+let $FCT=sin;
+-- source include/parser_bug21114.inc
+let $FCT=sleep;
+-- source include/parser_bug21114.inc
+let $FCT=soundex;
+-- source include/parser_bug21114.inc
+let $FCT=space;
+-- source include/parser_bug21114.inc
+let $FCT=sqrt;
+-- source include/parser_bug21114.inc
+let $FCT=srid;
+-- source include/parser_bug21114.inc
+let $FCT=startpoint;
+-- source include/parser_bug21114.inc
+let $FCT=strcmp;
+-- source include/parser_bug21114.inc
+let $FCT=str_to_date;
+-- source include/parser_bug21114.inc
+let $FCT=subdate;
+-- source include/parser_bug21114.inc
+let $FCT=substring_index;
+-- source include/parser_bug21114.inc
+let $FCT=subtime;
+-- source include/parser_bug21114.inc
+let $FCT=system_user;
+-- source include/parser_bug21114.inc
+let $FCT=tan;
+-- source include/parser_bug21114.inc
+let $FCT=timediff;
+-- source include/parser_bug21114.inc
+let $FCT=time_format;
+-- source include/parser_bug21114.inc
+let $FCT=time_to_sec;
+-- source include/parser_bug21114.inc
+let $FCT=touches;
+-- source include/parser_bug21114.inc
+let $FCT=to_days;
+-- source include/parser_bug21114.inc
+let $FCT=ucase;
+-- source include/parser_bug21114.inc
+let $FCT=uncompress;
+-- source include/parser_bug21114.inc
+let $FCT=uncompressed_length;
+-- source include/parser_bug21114.inc
+let $FCT=unhex;
+-- source include/parser_bug21114.inc
+let $FCT=unix_timestamp;
+-- source include/parser_bug21114.inc
+let $FCT=updatexml;
+-- source include/parser_bug21114.inc
+let $FCT=upper;
+-- source include/parser_bug21114.inc
+let $FCT=uuid;
+-- source include/parser_bug21114.inc
+let $FCT=version;
+-- source include/parser_bug21114.inc
+let $FCT=weekday;
+-- source include/parser_bug21114.inc
+let $FCT=weekofyear;
+-- source include/parser_bug21114.inc
+let $FCT=within;
+-- source include/parser_bug21114.inc
+let $FCT=x;
+-- source include/parser_bug21114.inc
+let $FCT=y;
+-- source include/parser_bug21114.inc
+let $FCT=yearweek;
+-- source include/parser_bug21114.inc
+
diff --git a/mysql-test/t/partition-master.opt b/mysql-test/t/partition-master.opt
new file mode 100644
index 00000000000..b1392bfd485
--- /dev/null
+++ b/mysql-test/t/partition-master.opt
@@ -0,0 +1 @@
+--symbolic-links=1
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
new file mode 100644
index 00000000000..8cb5e76d85b
--- /dev/null
+++ b/mysql-test/t/partition.test
@@ -0,0 +1,1357 @@
+#--disable_abort_on_error
+#
+# Simple test for the partition storage engine
+# Taken fromm the select test
+#
+-- source include/have_partition.inc
+
+#
+# This test is disabled on Windows due to BUG#19107
+#
+-- source include/not_windows.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Bug 15890: Strange number of partitions accepted
+#
+-- error 1064
+create table t1 (a int)
+partition by key(a)
+partitions 0.2+e1;
+-- error 1064
+create table t1 (a int)
+partition by key(a)
+partitions -1;
+-- error 1064
+create table t1 (a int)
+partition by key(a)
+partitions 1.5;
+-- error 1064
+create table t1 (a int)
+partition by key(a)
+partitions 1e+300;
+
+#
+# Bug 21350: Data Directory problems
+#
+-- error 1103
+create table t1 (a int)
+partition by key (a)
+(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
+
+#
+# Insert a test that manages to create the first partition and fails with
+# the second, ensure that we clean up afterwards in a proper manner.
+#
+--error 1103
+create table t1 (a int)
+partition by key (a)
+(partition p0,
+ partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
+
+#
+# Bug 19309 Partitions: Crash if double procedural alter
+#
+create table t1 (a int)
+partition by list (a)
+(partition p0 values in (1));
+
+create procedure pz()
+alter table t1 engine = myisam;
+
+call pz();
+call pz();
+drop procedure pz;
+drop table t1;
+
+#
+# Bug 19307: CSV engine crashes
+#
+--error ER_PARTITION_MERGE_ERROR
+create table t1 (a int)
+engine = csv
+partition by list (a)
+(partition p0 values in (null));
+
+#
+# BUG 16002: Handle unsigned integer functions properly
+#
+--error 1064
+create table t1 (a bigint)
+partition by range (a)
+(partition p0 values less than (0xFFFFFFFFFFFFFFFF),
+ partition p1 values less than (10));
+--error 1064
+create table t1 (a bigint)
+partition by list (a)
+(partition p0 values in (0xFFFFFFFFFFFFFFFF),
+ partition p1 values in (10));
+
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (100),
+ partition p1 values less than MAXVALUE);
+insert into t1 values (1);
+drop table t1;
+
+create table t1 (a bigint unsigned)
+partition by hash (a);
+insert into t1 values (0xFFFFFFFFFFFFFFFD);
+insert into t1 values (0xFFFFFFFFFFFFFFFE);
+select * from t1 where (a + 1) < 10;
+select * from t1 where (a + 1) > 10;
+drop table t1;
+
+#
+# Bug 19307: CSV engine crashes
+#
+--error ER_PARTITION_MERGE_ERROR
+create table t1 (a int)
+engine = csv
+partition by list (a)
+(partition p0 values in (null));
+
+#
+# Added test case
+#
+create table t1 (a int)
+partition by key(a)
+(partition p0 engine = MEMORY);
+drop table t1;
+
+#
+# BUG 19067 ALTER TABLE .. ADD PARTITION for subpartitioned table crashes
+#
+create table t1 (a int)
+partition by range (a)
+subpartition by key (a)
+(partition p0 values less than (1));
+alter table t1 add partition (partition p1 values less than (2));
+show create table t1;
+alter table t1 reorganize partition p1 into (partition p1 values less than (3));
+show create table t1;
+drop table t1;
+
+#
+# Partition by key no partition defined => OK
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by key (a);
+
+#
+# Bug 13323: Select count(*) on empty table returns 2
+#
+select count(*) from t1;
+
+#
+# Test SHOW CREATE TABLE
+#
+show create table t1;
+
+drop table t1;
+#
+# Partition by key no partition, list of fields
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by key (a, b);
+
+drop table t1;
+#
+# Partition by key specified 3 partitions and defined 3 => ok
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by key (a)
+partitions 3
+(partition x1, partition x2, partition x3);
+
+drop table t1;
+#
+# Partition by key specifying nodegroup
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by key (a)
+partitions 3
+(partition x1 nodegroup 0,
+ partition x2 nodegroup 1,
+ partition x3 nodegroup 2);
+
+drop table t1;
+#
+# Partition by key specifying engine
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by key (a)
+partitions 3
+(partition x1 engine myisam,
+ partition x2 engine myisam,
+ partition x3 engine myisam);
+
+drop table t1;
+#
+# Partition by key specifying tablespace
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by key (a)
+partitions 3
+(partition x1 tablespace ts1,
+ partition x2 tablespace ts2,
+ partition x3 tablespace ts3);
+
+CREATE TABLE t2 LIKE t1;
+
+drop table t2;
+drop table t1;
+
+#
+# Partition by key list, basic
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a)
+partitions 3
+(partition x1 values in (1,2,9,4) tablespace ts1,
+ partition x2 values in (3, 11, 5, 7) tablespace ts2,
+ partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
+
+drop table t1;
+#
+# Partition by key list, list function
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (b*a)
+partitions 3
+(partition x1 values in (1,2,9,4) tablespace ts1,
+ partition x2 values in (3, 11, 5, 7) tablespace ts2,
+ partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
+
+drop table t1;
+
+#
+# Partition by key list, list function, no spec of #partitions
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (b*a)
+(partition x1 values in (1) tablespace ts1,
+ partition x2 values in (3, 11, 5, 7) tablespace ts2,
+ partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
+
+drop table t1;
+
+#
+# Bug 13154: Insert crashes due to bad calculation of partition id
+# for PARTITION BY KEY and SUBPARTITION BY KEY
+#
+CREATE TABLE t1 (
+a int not null)
+partition by key(a);
+
+LOCK TABLES t1 WRITE;
+insert into t1 values (1);
+insert into t1 values (2);
+insert into t1 values (3);
+insert into t1 values (4);
+UNLOCK TABLES;
+
+drop table t1;
+
+#
+# Bug #13644 DROP PARTITION NULL's DATE column
+#
+CREATE TABLE t1 (a int, name VARCHAR(50), purchased DATE)
+PARTITION BY RANGE (a)
+(PARTITION p0 VALUES LESS THAN (3),
+ PARTITION p1 VALUES LESS THAN (7),
+ PARTITION p2 VALUES LESS THAN (9),
+ PARTITION p3 VALUES LESS THAN (11));
+INSERT INTO t1 VALUES
+(1, 'desk organiser', '2003-10-15'),
+(2, 'CD player', '1993-11-05'),
+(3, 'TV set', '1996-03-10'),
+(4, 'bookcase', '1982-01-10'),
+(5, 'exercise bike', '2004-05-09'),
+(6, 'sofa', '1987-06-05'),
+(7, 'popcorn maker', '2001-11-22'),
+(8, 'acquarium', '1992-08-04'),
+(9, 'study desk', '1984-09-16'),
+(10, 'lava lamp', '1998-12-25');
+
+SELECT * from t1 ORDER BY a;
+ALTER TABLE t1 DROP PARTITION p0;
+SELECT * from t1 ORDER BY a;
+
+drop table t1;
+
+#
+# Bug #13442; Truncate Partitioned table doesn't work
+#
+
+CREATE TABLE t1 (a int)
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (1,2,3), PARTITION p1 VALUES IN (4,5,6));
+
+insert into t1 values (1),(2),(3),(4),(5),(6);
+select * from t1;
+truncate t1;
+select * from t1;
+truncate t1;
+select * from t1;
+drop table t1;
+
+#
+# Bug #13445 Partition by KEY method crashes server
+#
+CREATE TABLE t1 (a int, b int, primary key(a,b))
+PARTITION BY KEY(b,a) PARTITIONS 4;
+
+insert into t1 values (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6);
+select * from t1 where a = 4;
+
+drop table t1;
+
+#
+# Bug #13438: Engine clause in PARTITION clause causes crash
+#
+CREATE TABLE t1 (a int)
+PARTITION BY LIST (a)
+PARTITIONS 1
+(PARTITION x1 VALUES IN (1) ENGINE=MEMORY);
+
+show create table t1;
+drop table t1;
+
+#
+# Bug #13440: REPLACE causes crash in partitioned table
+#
+CREATE TABLE t1 (a int, unique(a))
+PARTITION BY LIST (a)
+(PARTITION x1 VALUES IN (10), PARTITION x2 VALUES IN (20));
+
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+REPLACE t1 SET a = 4;
+drop table t1;
+
+#
+# Bug #14365: Crash if value too small in list partitioned table
+#
+CREATE TABLE t1 (a int)
+PARTITION BY LIST (a)
+(PARTITION x1 VALUES IN (2), PARTITION x2 VALUES IN (3));
+
+insert into t1 values (2), (3);
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+insert into t1 values (4);
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+insert into t1 values (1);
+drop table t1;
+
+#
+# Bug 14327: PARTITIONS clause gets lost in SHOW CREATE TABLE
+#
+CREATE TABLE t1 (a int)
+PARTITION BY HASH(a)
+PARTITIONS 5;
+
+SHOW CREATE TABLE t1;
+
+drop table t1;
+
+#
+# Bug #13446: Update to value outside of list values doesn't give error
+#
+CREATE TABLE t1 (a int)
+PARTITION BY RANGE (a)
+(PARTITION x1 VALUES LESS THAN (2));
+
+insert into t1 values (1);
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+update t1 set a = 5;
+
+drop table t1;
+
+#
+# Bug #13441: Analyze on partitioned table didn't work
+#
+CREATE TABLE t1 (a int)
+PARTITION BY LIST (a)
+(PARTITION x1 VALUES IN (10), PARTITION x2 VALUES IN (20));
+
+analyze table t1;
+
+drop table t1;
+
+#
+# BUG 14524
+#
+CREATE TABLE `t1` (
+ `id` int(11) default NULL
+) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 PARTITION BY HASH (id) ;
+SELECT * FROM t1;
+
+drop table t1;
+
+#
+# BUG 14524
+#
+CREATE TABLE `t1` (
+ `id` int(11) default NULL
+) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 PARTITION BY HASH (id) ;
+SELECT * FROM t1;
+
+drop table t1;
+
+#
+# BUG 15221 (Cannot reorganize with the same name)
+#
+create table t1
+(a int)
+partition by range (a)
+ ( partition p0 values less than(10),
+ partition p1 values less than (20),
+ partition p2 values less than (25));
+
+alter table t1 reorganize partition p2 into (partition p2 values less than (30));
+show create table t1;
+drop table t1;
+
+CREATE TABLE t1 (a int, b int)
+PARTITION BY RANGE (a)
+(PARTITION x0 VALUES LESS THAN (2),
+ PARTITION x1 VALUES LESS THAN (4),
+ PARTITION x2 VALUES LESS THAN (6),
+ PARTITION x3 VALUES LESS THAN (8),
+ PARTITION x4 VALUES LESS THAN (10),
+ PARTITION x5 VALUES LESS THAN (12),
+ PARTITION x6 VALUES LESS THAN (14),
+ PARTITION x7 VALUES LESS THAN (16),
+ PARTITION x8 VALUES LESS THAN (18),
+ PARTITION x9 VALUES LESS THAN (20));
+
+ALTER TABLE t1 REORGANIZE PARTITION x0,x1,x2 INTO
+(PARTITION x1 VALUES LESS THAN (6));
+show create table t1;
+drop table t1;
+
+# Testcase for BUG#15819
+create table t1 (a int not null, b int not null) partition by LIST (a+b) (
+ partition p0 values in (12),
+ partition p1 values in (14)
+);
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+insert into t1 values (10,1);
+
+drop table t1;
+
+#
+# Bug#16901 Partitions: crash, SELECT, column of part.
+# function=first column of primary key
+#
+create table t1 (f1 integer,f2 integer, f3 varchar(10), primary key(f1,f2))
+partition by range(f1) subpartition by hash(f2) subpartitions 2
+(partition p1 values less than (0),
+ partition p2 values less than (2),
+ partition p3 values less than (2147483647));
+
+insert into t1 values(10,10,'10');
+insert into t1 values(2,2,'2');
+select * from t1 where f1 = 2;
+drop table t1;
+
+#
+# Bug #16907 Partitions: crash, SELECT goes into last partition, UNIQUE INDEX
+#
+create table t1 (f1 integer,f2 integer, unique index(f1))
+partition by range(f1 div 2)
+subpartition by hash(f1) subpartitions 2
+(partition partb values less than (2),
+partition parte values less than (4),
+partition partf values less than (10000));
+insert into t1 values(10,1);
+select * from t1 where f1 = 10;
+drop table t1;
+
+#
+# Bug #16775: Wrong engine type stored for subpartition
+#
+set session storage_engine= 'memory';
+create table t1 (f_int1 int(11) default null) engine = memory
+ partition by range (f_int1) subpartition by hash (f_int1)
+ (partition part1 values less than (1000)
+ (subpartition subpart11 engine = memory));
+drop table t1;
+set session storage_engine='myisam';
+
+#
+# Bug #16782: Crash using REPLACE on table with primary key
+#
+create table t1 (f_int1 integer, f_int2 integer, primary key (f_int1))
+ partition by hash(f_int1) partitions 2;
+insert into t1 values (1,1),(2,2);
+replace into t1 values (1,1),(2,2);
+drop table t1;
+
+#
+# Bug #17169: Partitions: out of memory if add partition and unique
+#
+create table t1 (s1 int, unique (s1)) partition by list (s1) (partition x1 VALUES in (10), partition x2 values in (20));
+alter table t1 add partition (partition x3 values in (30));
+drop table t1;
+
+#
+# Bug #17754 Change to explicit removal of partitioning scheme
+# Also added a number of tests to ensure that proper engine is
+# choosen in all kinds of scenarios.
+#
+
+create table t1 (a int)
+partition by key(a)
+partitions 2
+(partition p0 engine=myisam, partition p1 engine=myisam);
+show create table t1;
+
+alter table t1;
+show create table t1;
+
+alter table t1 engine=myisam;
+show create table t1;
+
+alter table t1 engine=heap;
+show create table t1;
+
+alter table t1 remove partitioning;
+show create table t1;
+
+drop table t1;
+
+create table t1 (a int)
+engine=myisam
+partition by key(a)
+partitions 2
+(partition p0 engine=myisam, partition p1 engine=myisam);
+show create table t1;
+
+alter table t1 add column b int remove partitioning;
+show create table t1;
+
+alter table t1
+engine=myisam
+partition by key(a)
+(partition p0 engine=myisam, partition p1);
+show create table t1;
+
+alter table t1
+engine=heap
+partition by key(a)
+(partition p0, partition p1 engine=heap);
+show create table t1;
+
+alter table t1 engine=myisam, add column c int remove partitioning;
+show create table t1;
+
+alter table t1
+engine=heap
+partition by key (a)
+(partition p0, partition p1);
+show create table t1;
+
+alter table t1
+partition by key (a)
+(partition p0, partition p1);
+show create table t1;
+
+alter table t1
+engine=heap
+partition by key (a)
+(partition p0, partition p1);
+show create table t1;
+
+--error ER_MIX_HANDLER_ERROR
+alter table t1
+partition by key(a)
+(partition p0, partition p1 engine=heap);
+
+--error ER_MIX_HANDLER_ERROR
+alter table t1
+partition by key(a)
+(partition p0 engine=heap, partition p1);
+
+--error ER_MIX_HANDLER_ERROR
+alter table t1
+engine=heap
+partition by key (a)
+(partition p0 engine=heap, partition p1 engine=myisam);
+
+--error ER_MIX_HANDLER_ERROR
+alter table t1
+partition by key (a)
+(partition p0 engine=heap, partition p1 engine=myisam);
+
+drop table t1;
+
+# Bug #17432: Partition functions containing NULL values should return
+# LONGLONG_MIN
+#
+CREATE TABLE t1 (
+ f_int1 INTEGER, f_int2 INTEGER,
+ f_char1 CHAR(10), f_char2 CHAR(10), f_charbig VARCHAR(1000)
+ )
+ PARTITION BY RANGE(f_int1 DIV 2)
+ SUBPARTITION BY HASH(f_int1)
+ SUBPARTITIONS 2
+ (PARTITION parta VALUES LESS THAN (0),
+ PARTITION partb VALUES LESS THAN (5),
+ PARTITION parte VALUES LESS THAN (10),
+ PARTITION partf VALUES LESS THAN (2147483647));
+INSERT INTO t1 SET f_int1 = NULL , f_int2 = -20, f_char1 = CAST(-20 AS CHAR),
+ f_char2 = CAST(-20 AS CHAR), f_charbig = '#NULL#';
+SELECT * FROM t1 WHERE f_int1 IS NULL;
+SELECT * FROM t1;
+drop table t1;
+
+#
+# Bug 17430: Crash when SELECT * from t1 where field IS NULL
+#
+
+CREATE TABLE t1 (
+ f_int1 INTEGER, f_int2 INTEGER,
+ f_char1 CHAR(10), f_char2 CHAR(10), f_charbig VARCHAR(1000) )
+ PARTITION BY LIST(MOD(f_int1,2))
+ SUBPARTITION BY KEY(f_int1)
+ (PARTITION part1 VALUES IN (-1) (SUBPARTITION sp1, SUBPARTITION sp2),
+ PARTITION part2 VALUES IN (0) (SUBPARTITION sp3, SUBPARTITION sp5),
+ PARTITION part3 VALUES IN (1) (SUBPARTITION sp4, SUBPARTITION sp6));
+
+INSERT INTO t1 SET f_int1 = 2, f_int2 = 2, f_char1 = '2', f_char2 = '2', f_charbig = '===2===';
+INSERT INTO t1 SET f_int1 = 2, f_int2 = 2, f_char1 = '2', f_char2 = '2', f_charbig = '===2===';
+
+SELECT * FROM t1 WHERE f_int1 IS NULL;
+drop table t1;
+
+#
+# Bug#14363 Partitions: failure if create in stored procedure
+#
+delimiter //;
+
+create procedure p ()
+begin
+create table t1 (s1 mediumint,s2 mediumint)
+partition by list (s2)
+(partition p1 values in (0),
+ partition p2 values in (1));
+end//
+
+call p()//
+drop procedure p//
+drop table t1;
+
+create procedure p ()
+begin
+create table t1 (a int not null,b int not null,c int not null,primary key (a,b))
+partition by range (a)
+subpartition by hash (a+b)
+(partition x1 values less than (1)
+ (subpartition x11,
+ subpartition x12),
+ partition x2 values less than (5)
+ (subpartition x21,
+ subpartition x22));
+end//
+
+call p()//
+drop procedure p//
+drop table t1//
+delimiter ;//
+
+#
+# Bug #15447 Partitions: NULL is treated as zero
+#
+
+# NULL for RANGE partition
+create table t1 (a int,b int,c int,key(a,b))
+partition by range (a)
+partitions 3
+(partition x1 values less than (0) tablespace ts1,
+ partition x2 values less than (10) tablespace ts2,
+ partition x3 values less than maxvalue tablespace ts3);
+
+insert into t1 values (NULL, 1, 1);
+insert into t1 values (0, 1, 1);
+insert into t1 values (12, 1, 1);
+
+select partition_name, partition_description, table_rows
+from information_schema.partitions where table_schema ='test';
+drop table t1;
+
+# NULL for LIST partition
+--error ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR
+create table t1 (a int,b int, c int)
+partition by list(a)
+partitions 2
+(partition x123 values in (11,12),
+ partition x234 values in (1 ,NULL, NULL));
+
+--error ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR
+create table t1 (a int,b int, c int)
+partition by list(a)
+partitions 2
+(partition x123 values in (11, NULL),
+ partition x234 values in (1 ,NULL));
+
+create table t1 (a int,b int, c int)
+partition by list(a)
+partitions 2
+(partition x123 values in (11, 12),
+ partition x234 values in (5, 1));
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+insert into t1 values (NULL,1,1);
+drop table t1;
+
+create table t1 (a int,b int, c int)
+partition by list(a)
+partitions 2
+(partition x123 values in (11, 12),
+ partition x234 values in (NULL, 1));
+
+insert into t1 values (11,1,6);
+insert into t1 values (NULL,1,1);
+
+select partition_name, partition_description, table_rows
+from information_schema.partitions where table_schema ='test';
+drop table t1;
+
+#
+# BUG 17947 Crash with REBUILD PARTITION
+#
+create table t1 (a int)
+partition by list (a)
+(partition p0 values in (1));
+
+--error 1064
+alter table t1 rebuild partition;
+
+drop table t1;
+
+#
+# BUG 15253 Insert that should fail doesn't
+#
+create table t1 (a int)
+partition by list (a)
+(partition p0 values in (5));
+
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+insert into t1 values (0);
+
+drop table t1;
+
+#
+# BUG #16370 Subpartitions names not shown in SHOW CREATE TABLE output
+#
+create table t1 (a int)
+partition by range (a) subpartition by hash (a)
+(partition p0 values less than (100));
+
+show create table t1;
+alter table t1 add partition (partition p1 values less than (200)
+(subpartition subpart21));
+
+show create table t1;
+
+drop table t1;
+
+create table t1 (a int)
+partition by key (a);
+
+show create table t1;
+alter table t1 add partition (partition p1);
+show create table t1;
+
+drop table t1;
+
+#
+# BUG 15407 Crash with subpartition
+#
+--error 1064
+create table t1 (a int, b int)
+partition by range (a)
+subpartition by hash(a)
+(partition p0 values less than (0) (subpartition sp0),
+ partition p1 values less than (1));
+
+--error 1064
+create table t1 (a int, b int)
+partition by range (a)
+subpartition by hash(a)
+(partition p0 values less than (0),
+ partition p1 values less than (1) (subpartition sp0));
+
+#
+# BUG 15961 No error when subpartition defined without subpartition by clause
+#
+--error ER_SUBPARTITION_ERROR
+create table t1 (a int)
+partition by hash (a)
+(partition p0 (subpartition sp0));
+
+#
+# Bug 17127
+#
+create table t1 (a int)
+partition by range (a)
+(partition p0 values less than (1));
+
+--error ER_PARTITION_WRONG_VALUES_ERROR
+alter table t1 add partition (partition p1 values in (2));
+--error ER_PARTITION_REQUIRES_VALUES_ERROR
+alter table t1 add partition (partition p1);
+
+drop table t1;
+
+create table t1 (a int)
+partition by list (a)
+(partition p0 values in (1));
+
+--error ER_PARTITION_WRONG_VALUES_ERROR
+alter table t1 add partition (partition p1 values less than (2));
+--error ER_PARTITION_REQUIRES_VALUES_ERROR
+alter table t1 add partition (partition p1);
+
+drop table t1;
+
+create table t1 (a int)
+partition by hash (a)
+(partition p0);
+
+--error ER_PARTITION_WRONG_VALUES_ERROR
+alter table t1 add partition (partition p1 values less than (2));
+--error ER_PARTITION_WRONG_VALUES_ERROR
+alter table t1 add partition (partition p1 values in (2));
+
+drop table t1;
+
+#
+# BUG 17947 Crash with REBUILD PARTITION
+#
+create table t1 (a int)
+partition by list (a)
+(partition p0 values in (1));
+
+--error 1064
+alter table t1 rebuild partition;
+
+drop table t1;
+
+#
+# Bug #14526: Partitions: indexed searches fail
+#
+create table t2 (s1 int not null auto_increment, primary key (s1)) partition by list (s1) (partition p1 values in (1),partition p2 values in (2),partition p3 values in (3),partition p4 values in (4));
+insert into t2 values (null),(null),(null);
+select * from t2;
+select * from t2 where s1 < 2;
+update t2 set s1 = s1 + 1 order by s1 desc;
+select * from t2 where s1 < 3;
+select * from t2 where s1 = 2;
+drop table t2;
+
+#
+# Bug #17497: Partitions: crash if add partition on temporary table
+#
+--error ER_PARTITION_NO_TEMPORARY
+create temporary table t1 (a int) partition by hash(a);
+
+#
+# Bug #17097: Partitions: failing ADD PRIMARY KEY leads to temporary rotten
+# metadata,crash
+#
+create table t1 (a int, b int) partition by list (a)
+ (partition p1 values in (1), partition p2 values in (2));
+--error ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF
+alter table t1 add primary key (b);
+show create table t1;
+drop table t1;
+
+############################################
+#
+# Author: Mikael Ronstrom
+# Date: 2006-03-01
+# Purpose
+# Bug 17772: Crash at ALTER TABLE with rename
+# and add column + comment on
+# partitioned table
+#
+############################################
+create table t1 (a int unsigned not null auto_increment primary key)
+partition by key(a);
+alter table t1 rename t2, add c char(10), comment "no comment";
+show create table t2;
+
+drop table t2;
+
+#
+# Bug#15336 Partitions: crash if create table as select
+#
+create table t1 (f1 int) partition by hash (f1) as select 1;
+drop table t1;
+
+#
+# bug #14350 Partitions: crash if prepared statement
+#
+prepare stmt1 from 'create table t1 (s1 int) partition by hash (s1)';
+execute stmt1;
+--error 1050
+execute stmt1;
+drop table t1;
+
+#
+# bug 17290 SP with delete, create and rollback to save point causes MySQLD core
+#
+delimiter |;
+eval CREATE PROCEDURE test.p1(IN i INT)
+BEGIN
+ DECLARE CONTINUE HANDLER FOR sqlexception BEGIN END;
+ DROP TABLE IF EXISTS t1;
+ CREATE TABLE t1 (num INT,PRIMARY KEY(num));
+ START TRANSACTION;
+ INSERT INTO t1 VALUES(i);
+ savepoint t1_save;
+ INSERT INTO t1 VALUES (14);
+ ROLLBACK to savepoint t1_save;
+ COMMIT;
+END|
+delimiter ;|
+CALL test.p1(12);
+CALL test.p1(13);
+drop table t1;
+drop procedure test.p1;
+
+#
+# Bug 13520: Problem with delimiters in COMMENT DATA DIRECTORY ..
+#
+CREATE TABLE t1 (a int not null)
+partition by key(a)
+(partition p0 COMMENT='first partition');
+drop table t1;
+
+#
+# Bug 13433: Problem with delimited identifiers
+#
+CREATE TABLE t1 (`a b` int not null)
+partition by key(`a b`);
+drop table t1;
+
+CREATE TABLE t1 (`a b` int not null)
+partition by hash(`a b`);
+drop table t1;
+
+#
+# Bug#18053 Partitions: crash if null
+# Bug#18070 Partitions: wrong result on WHERE ... IS NULL
+#
+create table t1 (f1 integer) partition by range(f1)
+(partition p1 values less than (0), partition p2 values less than (10));
+insert into t1 set f1 = null;
+select * from t1 where f1 is null;
+explain partitions select * from t1 where f1 is null;
+drop table t1;
+
+create table t1 (f1 integer) partition by list(f1)
+(partition p1 values in (1), partition p2 values in (null));
+insert into t1 set f1 = null;
+insert into t1 set f1 = 1;
+select * from t1 where f1 is null or f1 = 1;
+drop table t1;
+
+create table t1 (f1 smallint)
+partition by list (f1) (partition p0 values in (null));
+insert into t1 values (null);
+select * from t1 where f1 is null;
+select * from t1 where f1 < 1;
+select * from t1 where f1 <= NULL;
+select * from t1 where f1 < NULL;
+select * from t1 where f1 >= NULL;
+select * from t1 where f1 > NULL;
+select * from t1 where f1 > 1;
+drop table t1;
+
+create table t1 (f1 smallint)
+partition by range (f1) (partition p0 values less than (0));
+insert into t1 values (null);
+select * from t1 where f1 is null;
+drop table t1;
+
+create table t1 (f1 integer) partition by list(f1)
+(
+ partition p1 values in (1),
+ partition p2 values in (NULL),
+ partition p3 values in (2),
+ partition p4 values in (3),
+ partition p5 values in (4)
+);
+
+insert into t1 values (1),(2),(3),(4),(null);
+select * from t1 where f1 < 3;
+explain partitions select * from t1 where f1 < 3;
+select * from t1 where f1 is null;
+explain partitions select * from t1 where f1 is null;
+drop table t1;
+
+create table t1 (f1 int) partition by list(f1 div 2)
+(
+ partition p1 values in (1),
+ partition p2 values in (NULL),
+ partition p3 values in (2),
+ partition p4 values in (3),
+ partition p5 values in (4)
+);
+
+insert into t1 values (2),(4),(6),(8),(null);
+select * from t1 where f1 < 3;
+explain partitions select * from t1 where f1 < 3;
+select * from t1 where f1 is null;
+explain partitions select * from t1 where f1 is null;
+drop table t1;
+
+create table t1 (a int) partition by LIST(a) (
+ partition pn values in (NULL),
+ partition p0 values in (0),
+ partition p1 values in (1),
+ partition p2 values in (2)
+);
+insert into t1 values (NULL),(0),(1),(2);
+select * from t1 where a is null or a < 2;
+explain partitions select * from t1 where a is null or a < 2;
+select * from t1 where a is null or a < 0 or a > 1;
+explain partitions select * from t1 where a is null or a < 0 or a > 1;
+drop table t1;
+
+#
+#Bug# 17631 SHOW TABLE STATUS reports wrong engine
+#
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, name VARCHAR(20))
+ENGINE=MyISAM DEFAULT CHARSET=latin1
+PARTITION BY RANGE(id)
+(PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM,
+PARTITION p1 VALUES LESS THAN (20) ENGINE = MyISAM,
+PARTITION p2 VALUES LESS THAN (30) ENGINE = MyISAM);
+--replace_column 6 0 7 0 8 0 9 0 12 NULL 13 NULL 14 NULL
+SHOW TABLE STATUS;
+DROP TABLE t1;
+
+#
+#BUG 16002 Erroneus handling of unsigned partition functions
+#
+--error ER_PARTITION_CONST_DOMAIN_ERROR
+create table t1 (a bigint unsigned)
+partition by list (a)
+(partition p0 values in (0-1));
+
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (10));
+
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+insert into t1 values (0xFFFFFFFFFFFFFFFF);
+
+drop table t1;
+
+#
+#BUG 18750 Problems with partition names
+#
+create table t1 (a int)
+partition by list (a)
+(partition `s1 s2` values in (0));
+drop table t1;
+
+create table t1 (a int)
+partition by list (a)
+(partition `7` values in (0));
+drop table t1;
+
+--error ER_WRONG_PARTITION_NAME
+create table t1 (a int)
+partition by list (a)
+(partition `s1 s2 ` values in (0));
+
+--error ER_WRONG_PARTITION_NAME
+create table t1 (a int)
+partition by list (a)
+subpartition by hash (a)
+(partition p1 values in (0) (subpartition `p1 p2 `));
+
+#
+# BUG 18752 SHOW CREATE TABLE doesn't show NULL value in SHOW CREATE TABLE
+#
+CREATE TABLE t1 (a int)
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (NULL));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--error 1064
+CREATE TABLE t1 (a int)
+PARTITION BY RANGE(a)
+(PARTITION p0 VALUES LESS THAN (NULL));
+
+#
+# Bug#18753 Partitions: auto_increment fails
+#
+create table t1 (s1 int auto_increment primary key)
+partition by list (s1)
+(partition p1 values in (1),
+ partition p2 values in (2),
+ partition p3 values in (3));
+insert into t1 values (null);
+insert into t1 values (null);
+insert into t1 values (null);
+select auto_increment from information_schema.tables where table_name='t1';
+select * from t1;
+drop table t1;
+
+#
+# BUG 19140 Partitions: Create index for partitioned table crashes
+#
+create table t1 (a int) engine=memory
+partition by key(a);
+insert into t1 values (1);
+create index inx1 on t1(a);
+drop table t1;
+
+#
+# Bug 19695 Partitions: SHOW CREATE TABLE shows table options even when it
+# shouldn't
+#
+create table t1 (a int)
+PARTITION BY KEY (a)
+(PARTITION p0);
+set session sql_mode='no_table_options';
+show create table t1;
+set session sql_mode='';
+drop table t1;
+
+#
+# BUG 19304 Partitions: MERGE handler not allowed in partitioned tables
+#
+--error ER_PARTITION_MERGE_ERROR
+create table t1 (a int)
+partition by key (a)
+(partition p0 engine = MERGE);
+
+#
+# BUG 19062 Partition clause ignored if CREATE TABLE ... AS SELECT ...;
+#
+create table t1 (a varchar(1))
+partition by key (a)
+as select 'a';
+
+show create table t1;
+drop table t1;
+
+#
+# BUG 19501 Partitions: SHOW TABLE STATUS shows wrong Data_free
+#
+CREATE TABLE t1 (a int) ENGINE = MYISAM PARTITION BY KEY(a);
+INSERT into t1 values (1), (2);
+--replace_column 9 0 12 NULL 13 NULL 14 NULL
+SHOW TABLE STATUS;
+DELETE from t1 where a = 1;
+--replace_column 9 0 12 NULL 13 NULL 14 NULL
+SHOW TABLE STATUS;
+ALTER TABLE t1 OPTIMIZE PARTITION p0;
+--replace_column 12 NULL 13 NULL 14 NULL
+SHOW TABLE STATUS;
+DROP TABLE t1;
+
+#
+# BUG 19502: ENABLE/DISABLE Keys don't work for partitioned tables
+#
+CREATE TABLE t1 (a int, index(a)) PARTITION BY KEY(a);
+ALTER TABLE t1 DISABLE KEYS;
+ALTER TABLE t1 ENABLE KEYS;
+DROP TABLE t1;
+
+#
+# Bug 17455 Partitions: Wrong message and error when using Repair/Optimize
+# table on partitioned table
+#
+create table t1 (a int)
+engine=MEMORY
+partition by key (a);
+
+REPAIR TABLE t1;
+OPTIMIZE TABLE t1;
+
+drop table t1;
+
+#
+# Bug 17310 Partitions: Bugs with archived partitioned tables
+#
+create database db99;
+use db99;
+create table t1 (a int not null)
+engine=archive
+partition by list (a)
+(partition p0 values in (1), partition p1 values in (2));
+insert into t1 values (1), (2);
+--error 0, 1005
+create index inx on t1 (a);
+alter table t1 add partition (partition p2 values in (3));
+alter table t1 drop partition p2;
+use test;
+drop database db99;
+
+#
+#BUG 17138 Problem with stored procedure and analyze partition
+#
+--disable_warnings
+drop procedure if exists mysqltest_1;
+--enable_warnings
+
+create table t1 (a int)
+partition by list (a)
+(partition p0 values in (0));
+
+insert into t1 values (0);
+delimiter //;
+
+create procedure mysqltest_1 ()
+begin
+ begin
+ declare continue handler for sqlexception begin end;
+ update ignore t1 set a = 1 where a = 0;
+ end;
+ prepare stmt1 from 'alter table t1';
+ execute stmt1;
+end//
+
+call mysqltest_1()//
+delimiter ;//
+drop table t1;
+drop procedure mysqltest_1;
+
+#
+# Bug 20583 Partitions: Crash using index_last
+#
+create table t1 (a int, index(a))
+partition by hash(a);
+insert into t1 values (1),(2);
+select * from t1 ORDER BY a DESC;
+drop table t1;
+
+#
+# Bug 20770 Partitions: DATA DIRECTORY clause change in reorganize
+# doesn't remove old directory
+#
+--disable_query_log
+--exec mkdir $MYSQLTEST_VARDIR/master-data/tmpdata || true
+eval SET @data_dir = 'DATA DIRECTORY = ''$MYSQLTEST_VARDIR/master-data/tmpdata''';
+let $data_directory = `select @data_dir`;
+
+--exec mkdir $MYSQLTEST_VARDIR/master-data/tmpinx || true
+eval SET @inx_dir = 'INDEX DIRECTORY = ''$MYSQLTEST_VARDIR/master-data/tmpinx''';
+let $inx_directory = `select @inx_dir`;
+--enable_query_log
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval create table t1 (a int) engine myisam
+partition by range (a)
+subpartition by hash (a)
+(partition p0 VALUES LESS THAN (1) $data_directory $inx_directory
+ (SUBPARTITION subpart00, SUBPARTITION subpart01));
+
+--echo Checking if file exists before alter
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1.frm
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1.par
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart00.MYD
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart00.MYI
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart01.MYD
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart01.MYI
+--file_exists $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p0#SP#subpart00.MYD
+--file_exists $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p0#SP#subpart01.MYD
+--file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/t1#P#p0#SP#subpart00.MYI
+--file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/t1#P#p0#SP#subpart01.MYI
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
+(partition p1 VALUES LESS THAN (1) $data_directory $inx_directory
+ (SUBPARTITION subpart10, SUBPARTITION subpart11),
+ partition p2 VALUES LESS THAN (2) $data_directory $inx_directory
+ (SUBPARTITION subpart20, SUBPARTITION subpart21));
+
+--echo Checking if file exists after alter
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1.frm
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1.par
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1#SP#subpart10.MYD
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1#SP#subpart10.MYI
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1#SP#subpart11.MYD
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1#SP#subpart11.MYI
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart20.MYD
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart20.MYI
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart21.MYD
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart21.MYI
+--file_exists $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p1#SP#subpart10.MYD
+--file_exists $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p1#SP#subpart11.MYD
+--file_exists $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p2#SP#subpart20.MYD
+--file_exists $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p2#SP#subpart21.MYD
+--file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/t1#P#p1#SP#subpart10.MYI
+--file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/t1#P#p1#SP#subpart11.MYI
+--file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/t1#P#p2#SP#subpart20.MYI
+--file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/t1#P#p2#SP#subpart21.MYI
+
+drop table t1;
+--exec rmdir $MYSQLTEST_VARDIR/master-data/tmpdata || true
+--exec rmdir $MYSQLTEST_VARDIR/master-data/tmpinx || true
+
+#
+# Bug 21388: Bigint fails to find record
+#
+create table t1 (a bigint unsigned not null, primary key(a))
+engine = myisam
+partition by key (a)
+partitions 10;
+
+show create table t1;
+insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE),
+(18446744073709551613), (18446744073709551612);
+select * from t1;
+select * from t1 where a = 18446744073709551615;
+delete from t1 where a = 18446744073709551615;
+select * from t1;
+drop table t1;
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/partition_02myisam.test b/mysql-test/t/partition_02myisam.test
new file mode 100644
index 00000000000..107d0b89cea
--- /dev/null
+++ b/mysql-test/t/partition_02myisam.test
@@ -0,0 +1,25 @@
+###############################################
+# #
+# Partition tests MyISAM tables #
+# #
+###############################################
+
+#
+# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
+# NON STORAGE SPECIFIC TESTCASES SHOULD BE ADDED IN
+# THE SOURCED FIELS ONLY.
+#
+
+# Storage engine to be tested
+let $engine= 'MYISAM';
+eval SET SESSION storage_engine=$engine;
+
+
+# Other storage engine <> storage engine to be tested
+let $engine_other= 'MEMORY';
+# number of rows for the INSERT/UPDATE/DELETE/SELECT experiments
+# on partioned tables
+# Attention: In the moment the result files fit to @max_row = 200 only
+SET @max_row = 200;
+
+-- source include/partition_1.inc
diff --git a/mysql-test/t/partition_03ndb.test b/mysql-test/t/partition_03ndb.test
new file mode 100644
index 00000000000..3190ab9dfc7
--- /dev/null
+++ b/mysql-test/t/partition_03ndb.test
@@ -0,0 +1,26 @@
+###############################################
+# #
+# Partition tests NDB tables #
+# #
+###############################################
+
+#
+# NOTE: PLEASE DO NOT ADD NOT NDB SPECIFIC TESTCASES HERE !
+# NON STORAGE SPECIFIC TESTCASES SHOULD BE ADDED IN
+# THE SOURCED FIELS ONLY.
+#
+
+# Storage engine to be tested
+let $engine= 'NDB' ;
+-- source include/have_ndb.inc
+eval SET SESSION storage_engine=$engine;
+
+
+# Other storage engine <> storage engine to be tested
+let $engine_other= 'MEMORY';
+# number of rows for the INSERT/UPDATE/DELETE/SELECT experiments
+# on partioned tables
+# Attention: In the moment the result files fit to @max_row = 200 only
+SET @max_row = 200;
+
+-- source include/partition_1.inc
diff --git a/mysql-test/t/partition_charset.test b/mysql-test/t/partition_charset.test
new file mode 100644
index 00000000000..27d0dc87b89
--- /dev/null
+++ b/mysql-test/t/partition_charset.test
@@ -0,0 +1,21 @@
+#
+# Test for character set related things in combination
+# with the partition storage engine
+#
+-- source include/have_partition.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+set names utf8;
+create table t1 (s1 int)
+ partition by list (s1)
+ (partition c values in (1),
+ partition Ç values in (3));
+insert into t1 values (1),(3);
+select * from t1;
+flush tables;
+set names latin1;
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test
new file mode 100644
index 00000000000..20703b979f1
--- /dev/null
+++ b/mysql-test/t/partition_error.test
@@ -0,0 +1,797 @@
+#
+# Simple test for the erroneos create statements using the
+# partition storage engine
+#
+-- source include/have_partition.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Partition by key stand-alone error
+#
+--error 1064
+partition by list (a)
+partitions 3
+(partition x1 values in (1,2,9,4) tablespace ts1,
+ partition x2 values in (3, 11, 5, 7) tablespace ts2,
+ partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
+
+#
+# Partition by key list, number of partitions defined, no partition defined
+#
+--error ER_PARTITIONS_MUST_BE_DEFINED_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a)
+partitions 2;
+
+#
+# Partition by key list, wrong result type
+#
+--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (sin(a))
+partitions 3
+(partition x1 values in (1,2,9,4) tablespace ts1,
+ partition x2 values in (3, 11, 5, 7) tablespace ts2,
+ partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
+
+#
+# Partition by key, partition function not allowed
+#
+--error 1064
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by key (a+2)
+partitions 3
+(partition x1 tablespace ts1,
+ partition x2 tablespace ts2,
+ partition x3 tablespace ts3);
+
+#
+# Partition by key, no partition name
+#
+--error 1064
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by key (a)
+partitions 3
+(partition tablespace ts1,
+ partition x2 tablespace ts2,
+ partition x3 tablespace ts3);
+
+#
+# Partition by key, invalid field in field list
+#
+--error ER_FIELD_NOT_FOUND_PART_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by key (a,d)
+partitions 3
+(partition x1 tablespace ts1,
+ partition x2 tablespace ts2,
+ partition x3 tablespace ts3);
+
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+#
+# Partition by hash, invalid field in function
+#
+--error 1054
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by hash (a + d)
+partitions 3
+(partition x1 tablespace ts1,
+ partition x2 tablespace ts2,
+ partition x3 tablespace ts3);
+
+#
+# Partition by hash, invalid result type
+#
+--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by hash (sin(a))
+partitions 3
+(partition x1 tablespace ts1,
+ partition x2 tablespace ts2,
+ partition x3 tablespace ts3);
+
+#
+# Partition by key specified 3 partitions but only defined 2 => error
+#
+--error 1064
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by key (a)
+partitions 3
+(partition x1, partition x2);
+
+#
+# Partition by key specified 3 partitions but only defined 2 => error
+#
+--error 1064
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by hash (rand(a))
+partitions 2
+(partition x1, partition x2);
+
+#
+# Partition by key specified 3 partitions but only defined 2 => error
+#
+--error 1064
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (rand(a))
+partitions 2
+(partition x1 values less than (0), partition x2 values less than (2));
+
+#
+# Partition by key specified 3 partitions but only defined 2 => error
+#
+--error 1064
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (rand(a))
+partitions 2
+(partition x1 values in (1), partition x2 values in (2));
+
+#
+# Partition by hash, values less than error
+#
+--error ER_PARTITION_WRONG_VALUES_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by hash (a)
+partitions 2
+(partition x1 values less than (4),
+ partition x2 values less than (5));
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+
+#
+# Partition by hash, values in error
+#
+--error ER_PARTITION_WRONG_VALUES_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by hash (a)
+partitions 2
+(partition x1 values in (4),
+ partition x2 values in (5));
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+
+#
+# Partition by hash, values in error
+#
+--error ER_PARTITION_WRONG_VALUES_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by hash (a)
+partitions 2
+(partition x1 values in (4,6),
+ partition x2 values in (5,7));
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+
+#
+# Subpartition by key, no partitions defined, single field
+#
+--error ER_SUBPARTITION_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by key (a)
+subpartition by key (b);
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+
+#
+# Subpartition by key, no partitions defined, list of fields
+#
+--error ER_SUBPARTITION_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by key (a)
+subpartition by key (a, b);
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+
+#
+# Subpartition by hash, no partitions defined
+#
+--error ER_SUBPARTITION_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by key (a)
+subpartition by hash (a+b);
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+
+#
+# Subpartition by key, no partitions defined, single field
+#
+--error ER_SUBPARTITION_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by key (a)
+subpartition by key (b);
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+
+#
+# Subpartition by key, no partitions defined, list of fields
+#
+--error ER_SUBPARTITION_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by key (a)
+subpartition by key (a, b);
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+
+#
+# Subpartition by hash, no partitions defined
+#
+--error ER_SUBPARTITION_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by key (a)
+subpartition by hash (a+b);
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+
+#
+# Subpartition by hash, no partitions defined, wrong subpartition function
+#
+--error 1064
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by key (a)
+subpartition by hash (rand(a+b));
+
+#
+# Subpartition by hash, wrong subpartition function
+#
+--error ER_SUBPARTITION_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by key (a)
+subpartition by hash (sin(a+b))
+(partition x1 (subpartition x11, subpartition x12),
+ partition x2 (subpartition x21, subpartition x22));
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+
+#
+# Subpartition by hash, no partitions defined, wrong subpartition function
+#
+--error 1064
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by range (a)
+subpartition by key (a+b)
+(partition x1 values less than (1) (subpartition x11, subpartition x12),
+ partition x2 values less than (2) (subpartition x21, subpartition x22));
+
+#
+# Subpartition by hash, no partitions defined, wrong subpartition function
+#
+--error ER_FIELD_NOT_FOUND_PART_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by range (a)
+subpartition by key (a,d)
+(partition x1 values less than (1) (subpartition x11, subpartition x12),
+ partition x2 values less than (2) (subpartition x21, subpartition x22));
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+
+#
+# Subpartition by hash, no partitions defined, wrong subpartition function
+#
+--error ER_SUBPARTITION_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by key (a)
+subpartition by hash (3+4);
+
+#
+# Subpartition by hash, no partitions defined, wrong subpartition function
+#
+--error 1054
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by range (a)
+subpartition by hash (a+d)
+(partition x1 values less than (1) (subpartition x11, subpartition x12),
+ partition x2 values less than (2) (subpartition x21, subpartition x22));
+
+#
+# Partition by range, no partition => error
+#
+--error ER_PARTITIONS_MUST_BE_DEFINED_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a);
+select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+
+#
+# Partition by range, invalid field in function
+#
+--error 1054
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a+d)
+partitions 2
+(partition x1 values less than (4) tablespace ts1,
+ partition x2 values less than (8) tablespace ts2);
+
+#
+# Partition by range, inconsistent partition function and constants
+#
+--error 1064
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (4.0) tablespace ts1,
+ partition x2 values less than (8) tablespace ts2);
+
+#
+# Partition by range, constant partition function not allowed
+#
+--error ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (3+4)
+partitions 2
+(partition x1 values less than (4) tablespace ts1,
+ partition x2 values less than (8) tablespace ts2);
+
+#
+# Partition by range, no values less than definition
+#
+--error ER_PARTITION_REQUIRES_VALUES_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (4),
+ partition x2);
+
+#
+# Partition by range, no values in definition allowed
+#
+--error ER_PARTITION_WRONG_VALUES_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a)
+partitions 2
+(partition x1 values in (4),
+ partition x2);
+
+#
+# Partition by range, values in error
+#
+--error ER_PARTITION_WRONG_VALUES_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a)
+partitions 2
+(partition x1 values in (4),
+ partition x2 values less than (5));
+
+#
+# Partition by range, missing parenthesis
+#
+--error 1064
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a)
+partitions 2
+(partition x1 values less than 4,
+ partition x2 values less than (5));
+
+#
+# Partition by range, maxvalue in wrong place
+#
+--error 1064
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a)
+partitions 2
+(partition x1 values less than maxvalue,
+ partition x2 values less than (5));
+
+#
+# Partition by range, maxvalue in several places
+#
+--error 1064
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a)
+partitions 2
+(partition x1 values less than maxvalue,
+ partition x2 values less than maxvalue);
+
+#
+# Partition by range, not increasing ranges
+#
+--error ER_RANGE_NOT_INCREASING_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (4),
+ partition x2 values less than (3));
+
+#
+# Partition by range, wrong result type of partition function
+#
+--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (sin(a))
+partitions 2
+(partition x1 values less than (4),
+ partition x2 values less than (5));
+
+#
+# Subpartition by hash, wrong number of subpartitions
+#
+--error 1064
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by list (a)
+subpartition by hash (a+b)
+subpartitions 3
+( partition x1 values in (1,2,4)
+ ( subpartition x11 nodegroup 0,
+ subpartition x12 nodegroup 1),
+ partition x2 values in (3,5,6)
+ ( subpartition x21 nodegroup 0,
+ subpartition x22 nodegroup 1)
+);
+
+#
+# Subpartition by hash, wrong number of subpartitions
+#
+--error 1064
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by list (a)
+subpartition by hash (a+b)
+( partition x1 values in (1)
+ ( subpartition x11 nodegroup 0,
+ subpartition xextra,
+ subpartition x12 nodegroup 1),
+ partition x2 values in (2)
+ ( subpartition x21 nodegroup 0,
+ subpartition x22 nodegroup 1)
+);
+
+#
+# Subpartition by list => error
+#
+--error 1064
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by key (a)
+subpartition by list (a+b)
+( partition x1
+ ( subpartition x11 engine myisam,
+ subpartition x12 engine myisam),
+ partition x2
+ ( subpartition x21 engine myisam,
+ subpartition x22 engine myisam)
+);
+
+#
+# Subpartition by list => error
+#
+--error 1064
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by key (a)
+subpartition by list (a+b)
+( partition x1
+ ( subpartition x11 engine myisam values in (0),
+ subpartition x12 engine myisam values in (1)),
+ partition x2
+ ( subpartition x21 engine myisam values in (0),
+ subpartition x22 engine myisam values in (1))
+);
+
+#
+# Partition by list, no partition => error
+#
+--error ER_PARTITIONS_MUST_BE_DEFINED_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a);
+
+#
+# Partition by list, constant partition function not allowed
+#
+--error ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (3+4)
+partitions 2
+(partition x1 values in (4) tablespace ts1,
+ partition x2 values in (8) tablespace ts2);
+
+#
+# Partition by list, invalid field in function
+#
+--error 1054
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a+d)
+partitions 2
+(partition x1 values in (4) tablespace ts1,
+ partition x2 values in (8) tablespace ts2);
+
+#
+# Partition by list, no values in definition
+#
+--error ER_PARTITION_REQUIRES_VALUES_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a)
+partitions 2
+(partition x1 values in (4),
+ partition x2);
+
+#
+# Partition by list, values less than error
+#
+--error ER_PARTITION_WRONG_VALUES_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a)
+partitions 2
+(partition x1 values in (4),
+ partition x2 values less than (5));
+
+#
+# Partition by list, no values in definition
+#
+--error ER_PARTITION_REQUIRES_VALUES_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a)
+partitions 2
+(partition x1 values in (4,6),
+ partition x2);
+
+#
+# Partition by list, duplicate values
+#
+--error ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a)
+partitions 2
+(partition x1 values in (4, 12+9),
+ partition x2 values in (3, 21));
+
+#
+# Partition by list, wrong constant result type (not INT)
+#
+--error 1064
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a)
+partitions 2
+(partition x1 values in (4.0, 12+8),
+ partition x2 values in (3, 21));
+
+#
+# Partition by list, missing parenthesis
+#
+--error 1064
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a)
+partitions 2
+(partition x1 values in 4,
+ partition x2 values in (5));
+
+#
+# Bug #13439: Crash when LESS THAN (non-literal)
+#
+--error 1054
+CREATE TABLE t1 (a int)
+PARTITION BY RANGE (a)
+(PARTITION p0 VALUES LESS THAN (x1));
+
+#
+# No partition for the given value
+#
+CREATE TABLE t1(a int)
+ PARTITION BY RANGE (a) (PARTITION p1 VALUES LESS THAN(5));
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+insert into t1 values (10);
+drop table t1;
+
+--error ER_PARTITION_CONST_DOMAIN_ERROR
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (-1));
+#
+# Bug 18198 Partitions: Verify that erroneus partition functions doesn't work
+#
+create table t1 (v varchar(12))
+partition by range (ascii(v))
+(partition p0 values less than (10));
+drop table t1;
+
+-- error 1064
+create table t1 (a int)
+partition by hash (rand(a));
+-- error 1064
+create table t1 (a int)
+partition by hash(CURTIME() + a);
+-- error 1064
+create table t1 (a int)
+partition by hash (NOW()+a);
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (a int)
+partition by hash (extract(hour from convert_tz(a, '+00:00', '+00:00')));
+-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (a int)
+partition by range (a + (select count(*) from t1))
+(partition p1 values less than (1));
+-- error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR
+create table t1 (a char(10))
+partition by hash (extractvalue(a,'a'));
+
+
diff --git a/mysql-test/t/partition_grant.test b/mysql-test/t/partition_grant.test
new file mode 100644
index 00000000000..ee7c71b497a
--- /dev/null
+++ b/mysql-test/t/partition_grant.test
@@ -0,0 +1,59 @@
+-- source include/have_partition.inc
+# Grant tests not performed with embedded server
+-- source include/not_embedded.inc
+
+--disable_warnings
+drop schema if exists mysqltest_1;
+--enable_warnings
+
+
+#
+# Bug #17139: ALTER TABLE ... DROP PARTITION should require DROP privilege
+#
+
+create schema mysqltest_1;
+use mysqltest_1;
+
+create table t1 (a int) partition by list (a) (partition p1 values in (1), partition p2 values in (2), partition p3 values in (3));
+insert into t1 values (1),(2);
+
+# We don't have DROP USER IF EXISTS. Use this workaround to
+# cleanup possible grants for mysqltest_1 left by previous tests
+# and ensure consistent results of SHOW GRANTS command below.
+--disable_warnings
+grant usage on *.* to mysqltest_1@localhost;
+revoke all privileges on *.* from mysqltest_1@localhost;
+--enable_warnings
+
+grant select,alter on mysqltest_1.* to mysqltest_1@localhost;
+
+connect (conn1,localhost,mysqltest_1,,mysqltest_1);
+show grants for current_user;
+alter table t1 add b int;
+--error ER_TABLEACCESS_DENIED_ERROR
+alter table t1 drop partition p2;
+disconnect conn1;
+
+connection default;
+grant drop on mysqltest_1.* to mysqltest_1@localhost;
+
+connect (conn2,localhost,mysqltest_1,,mysqltest_1);
+alter table t1 drop partition p2;
+disconnect conn2;
+
+connection default;
+revoke alter on mysqltest_1.* from mysqltest_1@localhost;
+
+connect (conn3,localhost,mysqltest_1,,mysqltest_1);
+--error ER_TABLEACCESS_DENIED_ERROR
+alter table t1 drop partition p3;
+disconnect conn3;
+
+connection default;
+
+revoke select,alter,drop on mysqltest_1.* from mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
+drop table t1;
+drop schema mysqltest_1;
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/partition_hash.test b/mysql-test/t/partition_hash.test
new file mode 100644
index 00000000000..d3f1a5f4892
--- /dev/null
+++ b/mysql-test/t/partition_hash.test
@@ -0,0 +1,153 @@
+#--disable_abort_on_error
+#
+# Simple test for the partition storage engine
+# Taken fromm the select test
+#
+-- source include/have_partition.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# BUG 18198: Partition functions handling
+#
+create table t1 (a varchar(10) charset latin1 collate latin1_bin)
+partition by hash(length(a))
+partitions 10;
+insert into t1 values (''),(' '),('a'),('a '),('a ');
+explain partitions select * from t1 where a='a ';
+explain partitions select * from t1 where a='a';
+explain partitions select * from t1 where a='a ' OR a='a';
+drop table t1;
+
+#
+# More partition pruning tests, especially on interval walking
+#
+create table t1 (a int unsigned)
+partition by hash(a div 2)
+partitions 4;
+insert into t1 values (null),(0),(1),(2),(3),(4),(5),(6),(7);
+select * from t1 where a < 0;
+select * from t1 where a is null or (a >= 5 and a <= 7);
+select * from t1 where a is null;
+select * from t1 where a is not null;
+select * from t1 where a >= 1 and a < 3;
+select * from t1 where a >= 3 and a <= 5;
+select * from t1 where a > 2 and a < 4;
+select * from t1 where a > 3 and a <= 6;
+select * from t1 where a > 5;
+select * from t1 where a >= 1 and a <= 5;
+explain partitions select * from t1 where a < 0;
+explain partitions select * from t1 where a is null or (a >= 5 and a <= 7);
+explain partitions select * from t1 where a is null;
+explain partitions select * from t1 where a is not null;
+explain partitions select * from t1 where a >= 1 and a < 3;
+explain partitions select * from t1 where a >= 3 and a <= 5;
+explain partitions select * from t1 where a > 2 and a < 4;
+explain partitions select * from t1 where a > 3 and a <= 6;
+explain partitions select * from t1 where a > 5;
+explain partitions select * from t1 where a >= 1 and a <= 5;
+
+drop table t1;
+
+#
+# Partition by hash, basic
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by hash (a + 2)
+partitions 3
+(partition x1 tablespace ts1,
+ partition x2 tablespace ts2,
+ partition x3 tablespace ts3);
+
+insert into t1 values (1,1,1);
+insert into t1 values (2,1,1);
+insert into t1 values (3,1,1);
+insert into t1 values (4,1,1);
+insert into t1 values (5,1,1);
+
+select * from t1;
+
+update t1 set c=3 where b=1;
+select * from t1;
+
+select b from t1 where a=3;
+select b,c from t1 where a=1 AND b=1;
+
+delete from t1 where a=1;
+delete from t1 where c=3;
+
+select * from t1;
+
+ALTER TABLE t1
+partition by hash (a + 3)
+partitions 3
+(partition x1 tablespace ts1,
+ partition x2 tablespace ts2,
+ partition x3 tablespace ts3);
+select * from t1;
+drop table t1;
+
+#
+# Partition by hash, only one partition
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by hash (a)
+(partition x1);
+
+drop table t1;
+#
+# Partition by key, only one partition
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by key (a)
+(partition x1);
+
+drop table t1;
+
+#
+# Bug# 15968 - crash when INSERT with f1 = -1 into partition by hash(f1)
+#
+CREATE TABLE t1 (f1 INTEGER, f2 char(20)) ENGINE = 'MYISAM' PARTITION BY HASH(f1) PARTITIONS 2;
+INSERT INTO t1 SET f1 = 0 - 1, f2 = '#######';
+select * from t1;
+drop table t1;
+
+#
+# BUG# 14524 Partitions: crash if blackhole
+#
+CREATE TABLE t1 (s1 int) ENGINE=BLACKHOLE PARTITION BY HASH (s1);
+INSERT INTO t1 VALUES (0);
+DROP TABLE t1;
+
+#
+# BUG 18423 Hash partitioning can lose rows in some queries
+#
+create table t1 (c1 int DEFAULT NULL,
+ c2 varchar (30) DEFAULT NULL,
+ c3 date DEFAULT NULL)
+engine = myisam
+partition by hash (to_days(c3))
+partitions 12;
+
+insert into t1 values
+(136,'abc','2002-01-05'),(142,'abc','2002-02-14'),(162,'abc','2002-06-28'),
+(182,'abc','2002-11-09'),(158,'abc','2002-06-01'),(184,'abc','2002-11-22');
+select * from t1;
+select * from t1 where c3 between '2002-01-01' and '2002-12-31';
+
+drop table t1;
+
diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test
new file mode 100644
index 00000000000..782e204742f
--- /dev/null
+++ b/mysql-test/t/partition_innodb.test
@@ -0,0 +1,78 @@
+--source include/have_partition.inc
+--source include/have_innodb.inc
+
+#
+# Bug #14673: Wrong InnoDB default row format
+#
+create table t1 (a int) engine=innodb partition by hash(a) ;
+show table status like 't1';
+drop table t1;
+
+#
+# Bug 21173: SHOW TABLE STATUS crashes server in InnoDB
+#
+create table t1 (a int)
+engine = innodb
+partition by key (a);
+show table status;
+insert into t1 values (0), (1), (2), (3);
+show table status;
+drop table t1;
+
+create table t1 (a int auto_increment primary key)
+engine = innodb
+partition by key (a);
+show table status;
+insert into t1 values (NULL), (NULL), (NULL), (NULL);
+show table status;
+insert into t1 values (NULL), (NULL), (NULL), (NULL);
+show table status;
+drop table t1;
+
+#
+# BUG 19122 Crash after ALTER TABLE t1 REBUILD PARTITION p1
+#
+create table t1 (a int)
+partition by key (a)
+(partition p1 engine = innodb);
+
+alter table t1 rebuild partition p1;
+alter table t1 rebuild partition p1;
+alter table t1 rebuild partition p1;
+alter table t1 rebuild partition p1;
+alter table t1 rebuild partition p1;
+alter table t1 rebuild partition p1;
+alter table t1 rebuild partition p1;
+drop table t1;
+
+#
+# Bug 21339: Crash in Explain Partitions
+#
+create table t1 (a date)
+engine = innodb
+partition by range (year(a))
+(partition p0 values less than (2006),
+ partition p1 values less than (2007));
+explain partitions select * from t1
+where a between '2006-01-01' and '2007-06-01';
+drop table t1;
+
+#
+# Bug 20397: Partitions: Crash when using non-existing engine
+#
+create table t1 (a int)
+engine = x
+partition by key (a);
+show create table t1;
+drop table t1;
+
+create table t1 (a int)
+engine = innodb
+partition by list (a)
+(partition p0 values in (0));
+
+alter table t1 engine = x;
+show create table t1;
+drop table t1;
+
+
diff --git a/mysql-test/t/partition_list.test b/mysql-test/t/partition_list.test
new file mode 100644
index 00000000000..1e420cfe6ed
--- /dev/null
+++ b/mysql-test/t/partition_list.test
@@ -0,0 +1,182 @@
+#--disable_abort_on_error
+#
+# Simple test for the partition storage engine
+# testing list partitioning
+#
+-- source include/have_partition.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Bug 20733: Zerofill columns gives wrong result with partitioned tables
+#
+create table t1 (a int unsigned)
+partition by list (a)
+(partition p0 values in (0),
+ partition p1 values in (1),
+ partition pnull values in (null),
+ partition p2 values in (2));
+
+insert into t1 values (null),(0),(1),(2);
+select * from t1 where a < 2;
+select * from t1 where a <= 0;
+select * from t1 where a < 1;
+select * from t1 where a > 0;
+select * from t1 where a > 1;
+select * from t1 where a >= 0;
+select * from t1 where a >= 1;
+select * from t1 where a is null;
+select * from t1 where a is not null;
+select * from t1 where a is null or a > 0;
+drop table t1;
+
+create table t1 (a int unsigned, b int)
+partition by list (a)
+subpartition by hash (b)
+subpartitions 2
+(partition p0 values in (0),
+ partition p1 values in (1),
+ partition pnull values in (null, 2),
+ partition p3 values in (3));
+insert into t1 values (0,0),(0,1),(1,0),(1,1),(null,0),(null,1);
+insert into t1 values (2,0),(2,1),(3,0),(3,1);
+
+explain partitions select * from t1 where a is null;
+select * from t1 where a is null;
+explain partitions select * from t1 where a = 2;
+select * from t1 where a = 2;
+select * from t1 where a <= 0;
+select * from t1 where a < 3;
+select * from t1 where a >= 1 or a is null;
+drop table t1;
+
+#
+# Test ordinary list partitioning that it works ok
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null)
+partition by list(a)
+partitions 2
+(partition x123 values in (1,5,6),
+ partition x234 values in (4,7,8));
+
+INSERT into t1 VALUES (1,1,1);
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+INSERT into t1 VALUES (2,1,1);
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+INSERT into t1 VALUES (3,1,1);
+INSERT into t1 VALUES (4,1,1);
+INSERT into t1 VALUES (5,1,1);
+INSERT into t1 VALUES (6,1,1);
+INSERT into t1 VALUES (7,1,1);
+INSERT into t1 VALUES (8,1,1);
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+INSERT into t1 VALUES (9,1,1);
+INSERT into t1 VALUES (1,2,1);
+INSERT into t1 VALUES (1,3,1);
+INSERT into t1 VALUES (1,4,1);
+INSERT into t1 VALUES (7,2,1);
+INSERT into t1 VALUES (7,3,1);
+INSERT into t1 VALUES (7,4,1);
+
+SELECT * from t1;
+SELECT * from t1 WHERE a=1;
+SELECT * from t1 WHERE a=7;
+SELECT * from t1 WHERE b=2;
+
+UPDATE t1 SET a=8 WHERE a=7 AND b=3;
+SELECT * from t1;
+UPDATE t1 SET a=8 WHERE a=5 AND b=1;
+SELECT * from t1;
+
+DELETE from t1 WHERE a=8;
+SELECT * from t1;
+DELETE from t1 WHERE a=2;
+SELECT * from t1;
+DELETE from t1 WHERE a=5 OR a=6;
+SELECT * from t1;
+
+ALTER TABLE t1
+partition by list(a)
+partitions 2
+(partition x123 values in (1,5,6),
+ partition x234 values in (4,7,8));
+SELECT * from t1;
+INSERT into t1 VALUES (6,2,1);
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+INSERT into t1 VALUES (2,2,1);
+
+drop table t1;
+#
+# Subpartition by hash, two partitions and two subpartitions
+# Defined node group
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by list (a)
+subpartition by hash (a+b)
+( partition x1 values in (1,2,3)
+ ( subpartition x11 nodegroup 0,
+ subpartition x12 nodegroup 1),
+ partition x2 values in (4,5,6)
+ ( subpartition x21 nodegroup 0,
+ subpartition x22 nodegroup 1)
+);
+
+INSERT into t1 VALUES (1,1,1);
+INSERT into t1 VALUES (4,1,1);
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+INSERT into t1 VALUES (7,1,1);
+UPDATE t1 SET a=5 WHERE a=1;
+SELECT * from t1;
+UPDATE t1 SET a=6 WHERE a=4;
+SELECT * from t1;
+DELETE from t1 WHERE a=6;
+SELECT * from t1;
+
+drop table t1;
+
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by list (a)
+(partition x1 values in (1,2,9,4) tablespace ts1);
+
+drop table t1;
+
+#
+#Bug #17173 Partitions: less-than search fails
+#
+CREATE TABLE t1 (s1 int) PARTITION BY LIST (s1)
+(PARTITION p1 VALUES IN (1),
+PARTITION p2 VALUES IN (2),
+PARTITION p3 VALUES IN (3),
+PARTITION p4 VALUES IN (4),
+PARTITION p5 VALUES IN (5));
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
+SELECT COUNT(*) FROM t1 WHERE s1 < 3;
+DROP TABLE t1;
+
+#
+# Bug 19281 Partitions: Auto-increment value lost
+#
+create table t1 (a int auto_increment primary key)
+auto_increment=100
+partition by list (a)
+(partition p0 values in (1, 100));
+create index inx on t1 (a);
+insert into t1 values (null);
+select * from t1;
+drop table t1;
+
+
diff --git a/mysql-test/t/partition_mgm.test b/mysql-test/t/partition_mgm.test
new file mode 100644
index 00000000000..8458d47d634
--- /dev/null
+++ b/mysql-test/t/partition_mgm.test
@@ -0,0 +1,53 @@
+-- source include/have_partition.inc
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+#
+# Bug 21143: mysqld hang when error in number of subparts in
+# REORGANIZE command
+#
+create table t1 (a int)
+partition by range (a)
+subpartition by key (a)
+(partition p0 values less than (10) (subpartition sp00, subpartition sp01),
+ partition p1 values less than (20) (subpartition sp10, subpartition sp11));
+
+-- error ER_PARTITION_WRONG_NO_SUBPART_ERROR
+alter table t1 reorganize partition p0 into
+(partition p0 values less than (10) (subpartition sp00,
+subpartition sp01, subpartition sp02));
+drop table t1;
+
+CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30))
+PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2;
+SHOW CREATE TABLE t1;
+
+--replace_result $MYSQLTEST_VARDIR "hello"
+--exec ls $MYSQLTEST_VARDIR/master-data/test/t1#*
+--replace_result $MYSQLTEST_VARDIR "hello"
+--exec ls $MYSQLTEST_VARDIR/master-data/test/t1.*
+ALTER TABLE t1 COALESCE PARTITION 1;
+SHOW CREATE TABLE t1;
+--replace_result $MYSQLTEST_VARDIR "hello"
+--exec ls $MYSQLTEST_VARDIR/master-data/test/t1#*
+--replace_result $MYSQLTEST_VARDIR "hello"
+--exec ls $MYSQLTEST_VARDIR/master-data/test/t1.*
+drop table t1;
+#
+# Bug 20767: REORGANIZE partition crashes
+#
+create table t1 (a int)
+partition by list (a)
+subpartition by hash (a)
+(partition p11 values in (1,2),
+ partition p12 values in (3,4));
+
+alter table t1 REORGANIZE partition p11, p12 INTO
+(partition p1 values in (1,2,3,4));
+
+alter table t1 REORGANIZE partition p1 INTO
+(partition p11 values in (1,2),
+ partition p12 values in (3,4));
+
+drop table t1;
diff --git a/mysql-test/t/partition_mgm_err.test b/mysql-test/t/partition_mgm_err.test
new file mode 100644
index 00000000000..8573fd59f2f
--- /dev/null
+++ b/mysql-test/t/partition_mgm_err.test
@@ -0,0 +1,213 @@
+#
+# Simple test for the erroneos create statements using the
+# partition storage engine
+#
+-- source include/have_partition.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Try faulty DROP PARTITION and COALESCE PARTITION
+#
+CREATE TABLE t1 (a int, b int)
+PARTITION BY RANGE (a)
+(PARTITION x0 VALUES LESS THAN (2),
+ PARTITION x1 VALUES LESS THAN (4),
+ PARTITION x2 VALUES LESS THAN (6),
+ PARTITION x3 VALUES LESS THAN (8),
+ PARTITION x4 VALUES LESS THAN (10),
+ PARTITION x5 VALUES LESS THAN (12),
+ PARTITION x6 VALUES LESS THAN (14),
+ PARTITION x7 VALUES LESS THAN (16),
+ PARTITION x8 VALUES LESS THAN (18),
+ PARTITION x9 VALUES LESS THAN (20));
+
+--error ER_REORG_OUTSIDE_RANGE
+ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
+(PARTITION x01 VALUES LESS THAN (2),
+ PARTITION x11 VALUES LESS THAN (5));
+
+--error ER_DROP_PARTITION_NON_EXISTENT
+ALTER TABLE t1 DROP PARTITION x0, x1, x2, x3, x3;
+
+--error ER_DROP_PARTITION_NON_EXISTENT
+ALTER TABLE t1 DROP PARTITION x0, x1, x2, x10;
+
+--error ER_DROP_PARTITION_NON_EXISTENT
+ALTER TABLE t1 DROP PARTITION x10, x1, x2, x1;
+
+--error ER_DROP_PARTITION_NON_EXISTENT
+ALTER TABLE t1 DROP PARTITION x10, x1, x2, x3;
+
+--error ER_REORG_PARTITION_NOT_EXIST
+ALTER TABLE t1 REORGANIZE PARTITION x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10 INTO
+(PARTITION x11 VALUES LESS THAN (22));
+
+--error ER_SAME_NAME_PARTITION
+ALTER TABLE t1 REORGANIZE PARTITION x0,x1,x2 INTO
+(PARTITION x3 VALUES LESS THAN (6));
+
+--error ER_CONSECUTIVE_REORG_PARTITIONS
+ALTER TABLE t1 REORGANIZE PARTITION x0, x2 INTO
+(PARTITION x11 VALUES LESS THAN (2));
+
+--error ER_DROP_PARTITION_NON_EXISTENT
+ALTER TABLE t1 REORGANIZE PARTITION x0, x1, x1 INTO
+(PARTITION x11 VALUES LESS THAN (4));
+
+--error ER_REORG_OUTSIDE_RANGE
+ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
+(PARTITION x01 VALUES LESS THAN (5));
+
+--error ER_REORG_OUTSIDE_RANGE
+ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
+(PARTITION x01 VALUES LESS THAN (4),
+ PARTITION x11 VALUES LESS THAN (2));
+
+--error ER_RANGE_NOT_INCREASING_ERROR
+ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
+(PARTITION x01 VALUES LESS THAN (6),
+ PARTITION x11 VALUES LESS THAN (4));
+
+DROP TABLE t1;
+
+CREATE TABLE t1 (a int)
+PARTITION BY KEY (a)
+PARTITIONS 2;
+
+--error ER_SAME_NAME_PARTITION
+ALTER TABLE t1 ADD PARTITION (PARTITION p1);
+
+DROP TABLE t1;
+
+--error ER_SAME_NAME_PARTITION
+CREATE TABLE t1 (a int)
+PARTITION BY KEY (a)
+(PARTITION x0, PARTITION x1, PARTITION x2, PARTITION x3, PARTITION x3);
+
+CREATE TABLE t1 (a int)
+PARTITION BY RANGE (a)
+SUBPARTITION BY KEY (a)
+SUBPARTITIONS 2
+(PARTITION x0 VALUES LESS THAN (4),
+ PARTITION x1 VALUES LESS THAN (8));
+
+--error ER_RANGE_NOT_INCREASING_ERROR
+ALTER TABLE t1 ADD PARTITION (PARTITION x2 VALUES LESS THAN (5)
+(SUBPARTITION sp0, SUBPARTITION sp1));
+
+--error ER_ADD_PARTITION_SUBPART_ERROR
+ALTER TABLE t1 ADD PARTITION (PARTITION x2 VALUES LESS THAN (12)
+(SUBPARTITION sp0, SUBPARTITION sp1, SUBPARTITION sp2));
+
+DROP TABLE t1;
+
+CREATE TABLE t1 (a int)
+PARTITION BY LIST (a)
+(PARTITION x0 VALUES IN (1,2,3),
+ PARTITION x1 VALUES IN (4,5,6));
+
+--error ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR
+ALTER TABLE t1 ADD PARTITION (PARTITION x2 VALUES IN (3,4));
+
+DROP TABLE t1;
+
+CREATE TABLE t1 (a int);
+
+--error ER_PARTITION_MGMT_ON_NONPARTITIONED
+ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
+
+--error ER_PARTITION_MGMT_ON_NONPARTITIONED
+ALTER TABLE t1 DROP PARTITION x1;
+
+--error ER_PARTITION_MGMT_ON_NONPARTITIONED
+ALTER TABLE t1 COALESCE PARTITION 1;
+
+DROP TABLE t1;
+
+CREATE TABLE t1 (a int)
+PARTITION BY KEY (a)
+(PARTITION x0, PARTITION x1);
+
+--error ER_ADD_PARTITION_NO_NEW_PARTITION
+ALTER TABLE t1 ADD PARTITION PARTITIONS 0;
+
+--error ER_TOO_MANY_PARTITIONS_ERROR
+ALTER TABLE t1 ADD PARTITION PARTITIONS 1024;
+
+--error ER_ONLY_ON_RANGE_LIST_PARTITION
+ALTER TABLE t1 DROP PARTITION x0;
+
+ALTER TABLE t1 COALESCE PARTITION 1;
+
+--error ER_DROP_LAST_PARTITION
+ALTER TABLE t1 COALESCE PARTITION 1;
+
+DROP TABLE t1;
+
+CREATE TABLE t1 (a int)
+PARTITION BY RANGE (a)
+(PARTITION x0 VALUES LESS THAN (4),
+ PARTITION x1 VALUES LESS THAN (8));
+
+--error ER_PARTITIONS_MUST_BE_DEFINED_ERROR
+ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
+
+--error ER_DROP_PARTITION_NON_EXISTENT
+ALTER TABLE t1 DROP PARTITION x2;
+
+--error ER_COALESCE_ONLY_ON_HASH_PARTITION
+ALTER TABLE t1 COALESCE PARTITION 1;
+
+ALTER TABLE t1 DROP PARTITION x1;
+
+--error ER_DROP_LAST_PARTITION
+ALTER TABLE t1 DROP PARTITION x0;
+
+DROP TABLE t1;
+
+#
+# Bug# 16534 - Trying to add multiple partitions crashes server
+#
+CREATE TABLE t1 ( id INT NOT NULL,
+ fname VARCHAR(50) NOT NULL,
+ lname VARCHAR(50) NOT NULL,
+ hired DATE NOT NULL )
+PARTITION BY RANGE(YEAR(hired)) (
+ PARTITION p1 VALUES LESS THAN (1991),
+ PARTITION p2 VALUES LESS THAN (1996),
+ PARTITION p3 VALUES LESS THAN (2001),
+ PARTITION p4 VALUES LESS THAN (2005));
+ALTER TABLE t1 ADD PARTITION (
+ PARTITION p5 VALUES LESS THAN (2010),
+ PARTITION p6 VALUES LESS THAN MAXVALUE);
+DROP TABLE t1;
+
+#
+#BUG 15523 ALTER TABLE ... PARTITION BY does not work
+#
+CREATE TABLE t1 (a INT);
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 PARTITION BY KEY(a) PARTITIONS 2;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+#
+#BUG 15820 create table with 1 partition, doing ALTER TABLE ADD PARTITION fails
+#
+CREATE TABLE t1 (a INT) PARTITION BY HASH(a);
+ALTER TABLE t1 ADD PARTITION PARTITIONS 4;
+DROP TABLE t1;
+
+#
+#BUG 15408: Partitions: subpartition names are not unique
+#
+--error ER_SAME_NAME_PARTITION
+CREATE TABLE t1 (s1 int, s2 int)
+PARTITION BY LIST (s1)
+SUBPARTITION BY KEY (s2) (
+PARTITION p1 VALUES IN (0) (SUBPARTITION p1b),
+PARTITION p2 VALUES IN (2) (SUBPARTITION p1b)
+);
diff --git a/mysql-test/t/partition_mgm_err2.test b/mysql-test/t/partition_mgm_err2.test
new file mode 100644
index 00000000000..925178a720d
--- /dev/null
+++ b/mysql-test/t/partition_mgm_err2.test
@@ -0,0 +1,31 @@
+#
+# Test of partitions that require symlinks
+#
+-- source include/have_partition.inc
+
+#
+# This test is disabled on windows due to BUG#19107
+#
+-- source include/not_windows.inc
+-- require r/have_symlink.require
+
+disable_query_log;
+show variables like "have_symlink";
+enable_query_log;
+
+#
+# BUG: 14354 Partitions: data directory clause fails
+#
+--system rm -rf $MYSQLTEST_VARDIR/tmp/bug14354
+--system mkdir $MYSQLTEST_VARDIR/tmp/bug14354
+disable_query_log;
+eval CREATE TABLE t1 (id int) PARTITION BY RANGE(id) (
+PARTITION p1 VALUES LESS THAN (20) ENGINE=myisam
+DATA DIRECTORY="$MYSQLTEST_VARDIR/tmp/bug14354"
+INDEX DIRECTORY="$MYSQLTEST_VARDIR/tmp/bug14354");
+enable_query_log;
+INSERT INTO t1 VALUES (15);
+--system test -f $MYSQLTEST_VARDIR/tmp/bug14354/t1#P#p1.MYD
+--system test -f $MYSQLTEST_VARDIR/tmp/bug14354/t1#P#p1.MYI
+DROP TABLE t1;
+--system rm -rf $MYSQLTEST_VARDIR/tmp/bug14354
diff --git a/mysql-test/t/partition_order.test b/mysql-test/t/partition_order.test
new file mode 100644
index 00000000000..ad956361d00
--- /dev/null
+++ b/mysql-test/t/partition_order.test
@@ -0,0 +1,844 @@
+#--disable_abort_on_error
+#
+# Simple test for the partition storage engine
+# Focuses on tests of ordered index read
+#
+-- source include/have_partition.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Ordered index read, int type
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+
+select * from t1 order by b;
+
+select * from t1 force index (b) where b > 0 order by b;
+
+drop table t1;
+
+#
+# Ordered index read, unsigned int type
+#
+CREATE TABLE t1 (
+a int not null,
+b int unsigned not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+
+select * from t1 force index (b) where b > 0 order by b;
+
+drop table t1;
+
+#
+# Ordered index read, tiny int type
+#
+CREATE TABLE t1 (
+a int not null,
+b tinyint not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+
+select * from t1 force index (b) where b > 0 order by b;
+
+drop table t1;
+
+#
+# Ordered index read, unsigned tinyint type
+#
+CREATE TABLE t1 (
+a int not null,
+b tinyint unsigned not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+
+select * from t1 force index (b) where b > 0 order by b;
+
+drop table t1;
+
+#
+# Ordered index read, smallint type
+#
+CREATE TABLE t1 (
+a int not null,
+b smallint not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+
+select * from t1 force index (b) where b > 0 order by b;
+
+drop table t1;
+
+#
+# Ordered index read, unsigned smallint type
+#
+CREATE TABLE t1 (
+a int not null,
+b smallint unsigned not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+
+select * from t1 force index (b) where b > 0 order by b;
+
+drop table t1;
+#
+# Ordered index read, mediumint type
+#
+CREATE TABLE t1 (
+a int not null,
+b mediumint not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+
+select * from t1 force index (b) where b > 0 order by b;
+
+drop table t1;
+
+#
+# Ordered index read, unsigned int type
+#
+CREATE TABLE t1 (
+a int not null,
+b mediumint unsigned not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+
+select * from t1 force index (b) where b > 0 order by b;
+
+drop table t1;
+
+#
+# Ordered index read, unsigned bigint type
+#
+CREATE TABLE t1 (
+a int not null,
+b bigint unsigned not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+
+select * from t1 force index (b) where b > 0 order by b;
+
+drop table t1;
+
+#
+# Ordered index read, bigint type
+#
+CREATE TABLE t1 (
+a int not null,
+b bigint not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+
+select * from t1 force index (b) where b > 0 order by b;
+
+drop table t1;
+#
+# Ordered index read, bigint type
+#
+CREATE TABLE t1 (
+a int not null,
+b bigint not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+
+select * from t1 force index (b) where b > 0 order by b;
+
+drop table t1;
+
+#
+# Ordered index read, float type
+#
+CREATE TABLE t1 (
+a int not null,
+b float not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+
+select * from t1 force index (b) where b > 0 order by b;
+
+drop table t1;
+
+#
+# Ordered index read, double type
+#
+CREATE TABLE t1 (
+a int not null,
+b double not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+
+select * from t1 force index (b) where b > 0 order by b;
+
+drop table t1;
+
+#
+# Ordered index read, unsigned double type
+#
+CREATE TABLE t1 (
+a int not null,
+b double unsigned not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+
+select * from t1 force index (b) where b > 0 order by b;
+
+drop table t1;
+
+#
+# Ordered index read, unsigned float type
+#
+CREATE TABLE t1 (
+a int not null,
+b float unsigned not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+
+select * from t1 force index (b) where b > 0 order by b;
+
+drop table t1;
+
+#
+# Ordered index read, double precision type
+#
+CREATE TABLE t1 (
+a int not null,
+b double precision not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+
+select * from t1 force index (b) where b > 0 order by b;
+
+drop table t1;
+#
+# Ordered index read, unsigned double precision type
+#
+CREATE TABLE t1 (
+a int not null,
+b double precision unsigned not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+
+select * from t1 force index (b) where b > 0 order by b;
+
+drop table t1;
+
+#
+# Ordered index read, decimal type
+#
+CREATE TABLE t1 (
+a int not null,
+b decimal not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, 1);
+INSERT into t1 values (2, 5);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+
+select * from t1 force index (b) where b > 0 order by b;
+
+drop table t1;
+#
+# Ordered index read, char type
+#
+CREATE TABLE t1 (
+a int not null,
+b char(10) not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, '1');
+INSERT into t1 values (2, '5');
+INSERT into t1 values (30, '4');
+INSERT into t1 values (35, '2');
+
+select * from t1 force index (b) where b > 0 order by b;
+
+drop table t1;
+
+#
+# Ordered index read, varchar type
+#
+CREATE TABLE t1 (
+a int not null,
+b varchar(10) not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, '1');
+INSERT into t1 values (2, '5');
+INSERT into t1 values (30, '4');
+INSERT into t1 values (35, '2');
+
+select * from t1 force index (b) where b > '0' order by b;
+
+drop table t1;
+#
+# Ordered index read, varchar type limited index size
+#
+CREATE TABLE t1 (
+a int not null,
+b varchar(10) not null,
+primary key(a),
+index (b(5)))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, '1');
+INSERT into t1 values (2, '5');
+INSERT into t1 values (30, '4');
+INSERT into t1 values (35, '2');
+
+select * from t1 force index (b) where b > '0' order by b;
+
+drop table t1;
+
+#
+# Ordered index read, varchar binary type
+#
+CREATE TABLE t1 (
+a int not null,
+b varchar(10) binary not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, '1');
+INSERT into t1 values (2, '5');
+INSERT into t1 values (30, '4');
+INSERT into t1 values (35, '2');
+
+select * from t1 force index (b) where b > '0' order by b;
+
+drop table t1;
+
+#
+# Ordered index read, tinytext type
+#
+CREATE TABLE t1 (
+a int not null,
+b tinytext not null,
+primary key(a),
+index (b(10)))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, '1');
+INSERT into t1 values (2, '5');
+INSERT into t1 values (30, '4');
+INSERT into t1 values (35, '2');
+
+select * from t1 force index (b) where b > '0' order by b;
+
+drop table t1;
+#
+# Ordered index read, text type
+#
+CREATE TABLE t1 (
+a int not null,
+b text not null,
+primary key(a),
+index (b(10)))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, '1');
+INSERT into t1 values (2, '5');
+INSERT into t1 values (30, '4');
+INSERT into t1 values (35, '2');
+
+select * from t1 force index (b) where b > '0' order by b;
+
+drop table t1;
+
+#
+# Ordered index read, mediumtext type
+#
+CREATE TABLE t1 (
+a int not null,
+b mediumtext not null,
+primary key(a),
+index (b(10)))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, '1');
+INSERT into t1 values (2, '5');
+INSERT into t1 values (30, '4');
+INSERT into t1 values (35, '2');
+
+select * from t1 force index (b) where b > '0' order by b;
+
+drop table t1;
+#
+# Ordered index read, longtext type
+#
+CREATE TABLE t1 (
+a int not null,
+b longtext not null,
+primary key(a),
+index (b(10)))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, '1');
+INSERT into t1 values (2, '5');
+INSERT into t1 values (30, '4');
+INSERT into t1 values (35, '2');
+
+select * from t1 force index (b) where b > '0' order by b;
+
+drop table t1;
+#
+# Ordered index read, enum type
+#
+CREATE TABLE t1 (
+a int not null,
+b enum('1','2', '4', '5') not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, '1');
+INSERT into t1 values (2, '5');
+INSERT into t1 values (30, '4');
+INSERT into t1 values (35, '2');
+
+select * from t1 force index (b) where b >= '1' order by b;
+
+drop table t1;
+#
+# Ordered index read, set type
+#
+CREATE TABLE t1 (
+a int not null,
+b set('1','2', '4', '5') not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, '1');
+INSERT into t1 values (2, '5');
+INSERT into t1 values (30, '4');
+INSERT into t1 values (35, '2');
+
+select * from t1 force index (b) where b >= '1' order by b;
+
+drop table t1;
+#
+# Ordered index read, date type
+#
+CREATE TABLE t1 (
+a int not null,
+b date not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, '2001-01-01');
+INSERT into t1 values (2, '2005-01-01');
+INSERT into t1 values (30, '2004-01-01');
+INSERT into t1 values (35, '2002-01-01');
+
+select * from t1 force index (b) where b > '2000-01-01' order by b;
+
+drop table t1;
+#
+# Ordered index read, datetime type
+#
+CREATE TABLE t1 (
+a int not null,
+b datetime not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, '2001-01-01 00:00:00');
+INSERT into t1 values (2, '2005-01-01 00:00:00');
+INSERT into t1 values (30, '2004-01-01 00:00:00');
+INSERT into t1 values (35, '2002-01-01 00:00:00');
+
+select * from t1 force index (b) where b > '2000-01-01 00:00:00' order by b;
+
+drop table t1;
+#
+# Ordered index read, timestamp type
+#
+CREATE TABLE t1 (
+a int not null,
+b timestamp not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, '2001-01-01 00:00:00');
+INSERT into t1 values (2, '2005-01-01 00:00:00');
+INSERT into t1 values (30, '2004-01-01 00:00:00');
+INSERT into t1 values (35, '2002-01-01 00:00:00');
+
+select * from t1 force index (b) where b > '2000-01-01 00:00:00' order by b;
+
+drop table t1;
+#
+# Ordered index read, time type
+#
+CREATE TABLE t1 (
+a int not null,
+b time not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, '01:00:00');
+INSERT into t1 values (2, '05:00:00');
+INSERT into t1 values (30, '04:00:00');
+INSERT into t1 values (35, '02:00:00');
+
+select * from t1 force index (b) where b > '00:00:00' order by b;
+
+drop table t1;
+#
+# Ordered index read, year type
+#
+CREATE TABLE t1 (
+a int not null,
+b year not null,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, 2001);
+INSERT into t1 values (2, 2005);
+INSERT into t1 values (30, 2004);
+INSERT into t1 values (35, 2002);
+
+select * from t1 force index (b) where b > 2000 order by b;
+
+drop table t1;
+#
+# Ordered index read, bit(5) type
+#
+CREATE TABLE t1 (
+a int not null,
+b bit(5) not null,
+c int,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, b'00001', NULL);
+INSERT into t1 values (2, b'00101', 2);
+INSERT into t1 values (30, b'00100', 2);
+INSERT into t1 values (35, b'00010', NULL);
+
+select a from t1 force index (b) where b > b'00000' order by b;
+
+drop table t1;
+#
+# Ordered index read, bit(15) type
+#
+CREATE TABLE t1 (
+a int not null,
+b bit(15) not null,
+c int,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, b'000000000000001', NULL);
+INSERT into t1 values (2, b'001010000000101', 2);
+INSERT into t1 values (30, b'001000000000100', 2);
+INSERT into t1 values (35, b'000100000000010', NULL);
+
+select a from t1 force index (b) where b > b'000000000000000' order by b;
+
+drop table t1;
+
+#
+# Ordered index read, NULL values
+#
+CREATE TABLE t1 (
+a int not null,
+b int,
+primary key(a),
+index (b))
+partition by range (a)
+partitions 2
+(partition x1 values less than (25),
+ partition x2 values less than (100));
+
+# Insert a couple of tuples
+INSERT into t1 values (1, 1);
+INSERT into t1 values (5, NULL);
+INSERT into t1 values (2, 4);
+INSERT into t1 values (3, 3);
+INSERT into t1 values (4, 5);
+INSERT into t1 values (7, 1);
+INSERT into t1 values (6, 6);
+INSERT into t1 values (30, 4);
+INSERT into t1 values (35, 2);
+INSERT into t1 values (40, NULL);
+
+select * from t1 force index (b) where b < 10 OR b IS NULL order by b;
+select * from t1 force index (b) where b < 10 ORDER BY b;
+select * from t1 force index (b) where b < 10 ORDER BY b DESC;
+drop table t1;
+
+create table t1 (a int not null, b int, c varchar(20), key (a,b,c))
+partition by range (b)
+(partition p0 values less than (5),
+ partition p1 values less than (10));
+INSERT into t1 values (1,1,'1'),(2,2,'2'),(1,3,'3'),(2,4,'4'),(1,5,'5');
+INSERT into t1 values (2,6,'6'),(1,7,'7'),(2,8,'8'),(1,9,'9');
+INSERT into t1 values (1, NULL, NULL), (2, NULL, '10');
+select * from t1 where a = 1 order by a desc, b desc;
+select * from t1 where a = 1 order by b desc;
+drop table t1;
diff --git a/mysql-test/t/partition_pruning.test b/mysql-test/t/partition_pruning.test
new file mode 100644
index 00000000000..a60846f18ff
--- /dev/null
+++ b/mysql-test/t/partition_pruning.test
@@ -0,0 +1,737 @@
+#
+# Partition pruning tests. Currently we only detect which partitions to
+# prune, so the test is EXPLAINs.
+#
+-- source include/have_partition.inc
+
+--disable_warnings
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+--enable_warnings
+
+
+# Check if we can infer from condition on partition fields that
+# no records will match.
+create table t1 ( a int not null) partition by hash(a) partitions 2;
+insert into t1 values (1),(2),(3);
+explain select * from t1 where a=5 and a=6;
+drop table t1;
+
+# Simple HASH partitioning
+create table t1 (
+ a int(11) not null
+) partition by hash (a) partitions 2;
+insert into t1 values (1),(2),(3);
+
+explain partitions select * from t1 where a=1;
+explain partitions select * from t1 where a=2;
+explain partitions select * from t1 where a=1 or a=2;
+
+# Partitioning over several fields
+create table t2 (
+ a int not null,
+ b int not null
+) partition by key(a,b) partitions 2;
+insert into t2 values (1,1),(2,2),(3,3);
+
+explain partitions select * from t2 where a=1;
+explain partitions select * from t2 where b=1;
+
+explain partitions select * from t2 where a=1 and b=1;
+
+# RANGE(expr) partitioning
+create table t3 (
+ a int
+)
+partition by range (a*1) (
+ partition p0 values less than (10),
+ partition p1 values less than (20)
+);
+insert into t3 values (5),(15);
+
+explain partitions select * from t3 where a=11;
+explain partitions select * from t3 where a=10;
+explain partitions select * from t3 where a=20;
+
+explain partitions select * from t3 where a=30;
+
+# LIST(expr) partitioning
+create table t4 (a int not null, b int not null) partition by LIST (a+b) (
+ partition p0 values in (12),
+ partition p1 values in (14)
+);
+insert into t4 values (10,2), (10,4);
+
+# empty OR one
+explain partitions select * from t4 where (a=10 and b=1) or (a=10 and b=2);
+
+# empty OR one OR empty
+explain partitions select * from t4
+ where (a=10 and b=1) or (a=10 and b=2) or (a=10 and b = 3);
+
+# one OR empty OR one
+explain partitions select * from t4 where (a=10 and b=2) or (a=10 and b=3)
+ or (a=10 and b = 4);
+
+# empty OR full
+explain partitions select * from t4 where (a=10 and b=1) or a=11;
+
+# one OR full
+explain partitions select * from t4 where (a=10 and b=2) or a=11;
+
+drop table t1, t2, t3, t4;
+
+# LIST(expr)/HASH subpartitioning.
+create table t5 (a int not null, b int not null,
+ c int not null, d int not null)
+partition by LIST(a+b) subpartition by HASH (c+d) subpartitions 2
+(
+ partition p0 values in (12),
+ partition p1 values in (14)
+);
+
+insert into t5 values (10,2,0,0), (10,4,0,0), (10,2,0,1), (10,4,0,1);
+explain partitions select * from t5;
+
+# empty OR one OR empty
+explain partitions select * from t5
+ where (a=10 and b=1) or (a=10 and b=2) or (a=10 and b = 3);
+
+# one OR empty OR one
+explain partitions select * from t5 where (a=10 and b=2) or (a=10 and b=3)
+ or (a=10 and b = 4);
+
+# conditions on subpartitions only
+explain partitions select * from t5 where (c=1 and d=1);
+explain partitions select * from t5 where (c=2 and d=1);
+
+# mixed partition/subpartitions.
+explain partitions select * from t5 where (a=10 and b=2 and c=1 and d=1) or
+(c=2 and d=1);
+
+# same as above
+explain partitions select * from t5 where (a=10 and b=2 and c=1 and d=1) or
+(b=2 and c=2 and d=1);
+
+# LIST(field) partitioning, interval analysis.
+create table t6 (a int not null) partition by LIST(a) (
+ partition p1 values in (1),
+ partition p3 values in (3),
+ partition p5 values in (5),
+ partition p7 values in (7),
+ partition p9 values in (9)
+);
+insert into t6 values (1),(3),(5);
+
+explain partitions select * from t6 where a < 1;
+explain partitions select * from t6 where a <= 1;
+explain partitions select * from t6 where a > 9;
+explain partitions select * from t6 where a >= 9;
+
+explain partitions select * from t6 where a > 0 and a < 5;
+explain partitions select * from t6 where a > 5 and a < 12;
+explain partitions select * from t6 where a > 3 and a < 8 ;
+
+explain partitions select * from t6 where a >= 0 and a <= 5;
+explain partitions select * from t6 where a >= 5 and a <= 12;
+explain partitions select * from t6 where a >= 3 and a <= 8;
+
+explain partitions select * from t6 where a > 3 and a < 5;
+
+drop table t6;
+
+create table t6 (a int unsigned not null) partition by LIST(a) (
+ partition p1 values in (1),
+ partition p3 values in (3),
+ partition p5 values in (5),
+ partition p7 values in (7),
+ partition p9 values in (9)
+);
+insert into t6 values (1),(3),(5);
+
+explain partitions select * from t6 where a < 1;
+explain partitions select * from t6 where a <= 1;
+explain partitions select * from t6 where a > 9;
+explain partitions select * from t6 where a >= 9;
+
+explain partitions select * from t6 where a > 0 and a < 5;
+explain partitions select * from t6 where a > 5 and a < 12;
+explain partitions select * from t6 where a > 3 and a < 8 ;
+
+explain partitions select * from t6 where a >= 0 and a <= 5;
+explain partitions select * from t6 where a >= 5 and a <= 12;
+explain partitions select * from t6 where a >= 3 and a <= 8;
+
+explain partitions select * from t6 where a > 3 and a < 5;
+
+# RANGE(field) partitioning, interval analysis.
+create table t7 (a int not null) partition by RANGE(a) (
+ partition p10 values less than (10),
+ partition p30 values less than (30),
+ partition p50 values less than (50),
+ partition p70 values less than (70),
+ partition p90 values less than (90)
+);
+insert into t7 values (10),(30),(50);
+
+# leftmost intervals
+explain partitions select * from t7 where a < 5;
+explain partitions select * from t7 where a < 10;
+explain partitions select * from t7 where a <= 10;
+explain partitions select * from t7 where a = 10;
+
+#rightmost intervals
+explain partitions select * from t7 where a < 90;
+explain partitions select * from t7 where a = 90;
+explain partitions select * from t7 where a > 90;
+explain partitions select * from t7 where a >= 90;
+
+# misc intervals
+explain partitions select * from t7 where a > 11 and a < 29;
+
+drop table t7;
+
+create table t7 (a int unsigned not null) partition by RANGE(a) (
+ partition p10 values less than (10),
+ partition p30 values less than (30),
+ partition p50 values less than (50),
+ partition p70 values less than (70),
+ partition p90 values less than (90)
+);
+insert into t7 values (10),(30),(50);
+
+# leftmost intervals
+explain partitions select * from t7 where a < 5;
+explain partitions select * from t7 where a < 10;
+explain partitions select * from t7 where a <= 10;
+explain partitions select * from t7 where a = 10;
+
+#rightmost intervals
+explain partitions select * from t7 where a < 90;
+explain partitions select * from t7 where a = 90;
+explain partitions select * from t7 where a > 90;
+explain partitions select * from t7 where a >= 90;
+
+# misc intervals
+explain partitions select * from t7 where a > 11 and a < 29;
+
+# LIST(monontonic_func) partitioning
+create table t8 (a date not null) partition by RANGE(YEAR(a)) (
+ partition p0 values less than (1980),
+ partition p1 values less than (1990),
+ partition p2 values less than (2000)
+);
+insert into t8 values ('1985-05-05'),('1995-05-05');
+
+explain partitions select * from t8 where a < '1980-02-02';
+
+# LIST(strict_monotonic_func) partitioning
+create table t9 (a date not null) partition by RANGE(TO_DAYS(a)) (
+ partition p0 values less than (732299), -- 2004-12-19
+ partition p1 values less than (732468), -- 2005-06-06
+ partition p2 values less than (732664) -- 2005-12-19
+);
+insert into t9 values ('2005-05-05'), ('2005-04-04');
+
+explain partitions select * from t9 where a < '2004-12-19';
+explain partitions select * from t9 where a <= '2004-12-19';
+
+drop table t5,t6,t7,t8,t9;
+
+# Test the case where we can't create partitioning 'index'
+#
+# Not supported after bug#18198 is fixed
+#
+#create table t1 (a enum('a','b','c','d') default 'a')
+# partition by hash (ascii(a)) partitions 2;
+#insert into t1 values ('a'),('b'),('c');
+#explain partitions select * from t1 where a='b';
+#drop table t1;
+
+#
+# Test cases for bugs found in code review:
+#
+create table t1 (
+ a1 int not null
+)
+partition by range (a1) (
+ partition p0 values less than (3),
+ partition p1 values less than (6),
+ partition p2 values less than (9)
+);
+insert into t1 values (1),(2),(3);
+explain partitions select * from t1 where a1 > 3;
+explain partitions select * from t1 where a1 >= 3;
+
+explain partitions select * from t1 where a1 < 3 and a1 > 3;
+drop table t1;
+
+#
+create table t3 (a int, b int)
+ partition by list(a) subpartition by hash(b) subpartitions 4 (
+ partition p0 values in (1),
+ partition p1 values in (2),
+ partition p2 values in (3),
+ partition p3 values in (4)
+ );
+insert into t3 values (1,1),(2,2),(3,3);
+
+explain partitions select * from t3 where a=2 or b=1;
+explain partitions select * from t3 where a=4 or b=2;
+explain partitions select * from t3 where (a=2 or b=1) and (a=4 or b=2) ;
+drop table t3;
+
+# Test for NULLs
+create table t1 (a int) partition by hash(a) partitions 2;
+insert into t1 values (1),(2);
+explain partitions select * from t1 where a is null;
+
+# this uses both partitions
+explain partitions select * from t1 where a is not null;
+drop table t1;
+
+# Join tests
+create table t1 (a int not null, b int not null, key(a), key(b))
+ partition by hash(a) partitions 4;
+insert into t1 values (1,1),(2,2),(3,3),(4,4);
+
+explain partitions
+select * from t1 X, t1 Y
+where X.b = Y.b and (X.a=1 or X.a=2) and (Y.a=2 or Y.a=3);
+
+explain partitions
+select * from t1 X, t1 Y where X.a = Y.a and (X.a=1 or X.a=2);
+
+drop table t1;
+
+# Tests for "short ranges"
+create table t1 (a int) partition by hash(a) partitions 20;
+insert into t1 values (1),(2),(3);
+explain partitions select * from t1 where a > 1 and a < 3;
+explain partitions select * from t1 where a >= 1 and a < 3;
+explain partitions select * from t1 where a > 1 and a <= 3;
+explain partitions select * from t1 where a >= 1 and a <= 3;
+drop table t1;
+
+create table t1 (a int, b int)
+ partition by list(a) subpartition by hash(b) subpartitions 20
+(
+ partition p0 values in (0),
+ partition p1 values in (1),
+ partition p2 values in (2),
+ partition p3 values in (3)
+);
+insert into t1 values (1,1),(2,2),(3,3);
+
+explain partitions select * from t1 where b > 1 and b < 3;
+explain partitions select * from t1 where b > 1 and b < 3 and (a =1 or a =2);
+drop table t1;
+
+# Test partition pruning for single-table UPDATE/DELETE.
+# TODO: Currently we test only "all partitions pruned away" case. Add more
+# tests when the patch that makes use of partition pruning results at
+# execution phase is pushed.
+
+create table t1 (a int) partition by list(a) (
+ partition p0 values in (1,2),
+ partition p1 values in (3,4)
+);
+insert into t1 values (1),(1),(2),(2),(3),(4),(3),(4);
+
+# This won't do any table access
+flush status;
+update t1 set a=100 where a=5;
+show status like 'Handler_read_rnd_next';
+
+# ... as compared to this, which will scan both partitions
+flush status;
+update t1 set a=100 where a+1=5+1;
+show status like 'Handler_read_rnd_next';
+
+# Same as above for DELETE:
+flush status;
+delete from t1 where a=5;
+show status like 'Handler_read_rnd_next';
+
+flush status;
+delete from t1 where a+1=5+1;
+show status like 'Handler_read_rnd_next';
+
+# Same as above multi-table UPDATE/DELETE
+create table t2 like t1;
+insert into t2 select * from t2;
+
+flush status;
+update t1,t2 set t1.a=1000, t2.a=1000 where t1.a=5 and t2.a=5;
+show status like 'Handler_read_rnd_next';
+# ^ This shows 3 accesses, these are caused by const table reads.
+# They should vanish when partition pruning results are used.
+
+flush status;
+delete t1,t2 from t1, t2 where t1.a=5 and t2.a=5;
+show status like 'Handler_read_rnd_next';
+drop table t1,t2;
+
+#
+# WL#2986 Tests (Checking if partition pruning results are used at query
+# execution phase)
+#
+CREATE TABLE `t1` (
+ `a` int(11) default NULL
+);
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+CREATE TABLE `t2` (
+ `a` int(11) default NULL,
+ KEY `a` (`a`)
+) ;
+
+insert into t2 select A.a + 10*(B.a + 10* C.a) from t1 A, t1 B, t1 C ;
+insert into t1 select a from t2;
+
+drop table t2;
+CREATE TABLE `t2` (
+ `a` int(11) default NULL,
+ `b` int(11) default NULL
+)
+PARTITION BY RANGE (a) (
+PARTITION p0 VALUES LESS THAN (200),
+PARTITION p1 VALUES LESS THAN (400),
+PARTITION p2 VALUES LESS THAN (600),
+PARTITION p3 VALUES LESS THAN (800),
+PARTITION p4 VALUES LESS THAN (1001));
+
+insert into t2 select a,1 from t1 where a < 200;
+insert into t2 select a,2 from t1 where a >= 200 and a < 400;
+insert into t2 select a,3 from t1 where a >= 400 and a < 600;
+insert into t2 select a,4 from t1 where a >= 600 and a < 800;
+insert into t2 select a,5 from t1 where a >= 800 and a < 1001;
+
+explain partitions select * from t2;
+explain partitions select * from t2 where a < 801 and a > 200;
+explain partitions select * from t2 where a < 801 and a > 800;
+explain partitions select * from t2 where a > 600;
+explain partitions select * from t2 where a > 600 and b = 1;
+explain partitions select * from t2 where a > 600 and b = 4;
+explain partitions select * from t2 where a > 600 and b = 5;
+explain partitions select * from t2 where b = 5;
+
+flush status;
+update t2 set b = 100 where b = 6;
+show status like 'Handler_read_rnd_next';
+flush status;
+update t2 set a = 1002 where a = 1001;
+show status like 'Handler_read_rnd_next';
+flush status;
+update t2 set b = 6 where a = 600;
+show status like 'Handler_read_rnd_next';
+flush status;
+update t2 set b = 6 where a > 600 and a < 800;
+show status like 'Handler_read_rnd_next';
+flush status;
+delete from t2 where a > 600;
+show status like 'Handler_read_rnd_next';
+
+drop table t2;
+CREATE TABLE `t2` (
+ `a` int(11) default NULL,
+ `b` int(11) default NULL,
+ index (b)
+)
+PARTITION BY RANGE (a) (
+PARTITION p0 VALUES LESS THAN (200),
+PARTITION p1 VALUES LESS THAN (400),
+PARTITION p2 VALUES LESS THAN (600),
+PARTITION p3 VALUES LESS THAN (800),
+PARTITION p4 VALUES LESS THAN (1001));
+
+insert into t2 select a,1 from t1 where a < 100;
+insert into t2 select a,2 from t1 where a >= 200 and a < 300;
+insert into t2 select a,3 from t1 where a >= 300 and a < 400;
+insert into t2 select a,4 from t1 where a >= 400 and a < 500;
+insert into t2 select a,5 from t1 where a >= 500 and a < 600;
+insert into t2 select a,6 from t1 where a >= 600 and a < 700;
+insert into t2 select a,7 from t1 where a >= 700 and a < 800;
+insert into t2 select a,8 from t1 where a >= 800 and a < 900;
+insert into t2 select a,9 from t1 where a >= 900 and a < 1001;
+
+explain partitions select * from t2;
+# not using indexes
+explain partitions select * from t2 where a = 101;
+explain partitions select * from t2 where a = 550;
+explain partitions select * from t2 where a = 833;
+explain partitions select * from t2 where (a = 100 OR a = 900);
+explain partitions select * from t2 where (a > 100 AND a < 600);
+explain partitions select * from t2 where b = 4;
+
+explain extended select * from t2 where b = 6;
+explain partitions select * from t2 where b = 6;
+
+explain extended select * from t2 where b in (1,3,5);
+explain partitions select * from t2 where b in (1,3,5);
+
+explain extended select * from t2 where b in (2,4,6);
+explain partitions select * from t2 where b in (2,4,6);
+
+explain extended select * from t2 where b in (7,8,9);
+explain partitions select * from t2 where b in (7,8,9);
+
+explain extended select * from t2 where b > 5;
+explain partitions select * from t2 where b > 5;
+
+explain extended select * from t2 where b > 5 and b < 8;
+explain partitions select * from t2 where b > 5 and b < 8;
+
+explain extended select * from t2 where b > 5 and b < 7;
+explain partitions select * from t2 where b > 5 and b < 7;
+
+explain extended select * from t2 where b > 0 and b < 5;
+explain partitions select * from t2 where b > 0 and b < 5;
+
+flush status;
+update t2 set a = 111 where b = 10;
+show status like 'Handler_read_rnd_next';
+show status like 'Handler_read_key';
+flush status;
+update t2 set a = 111 where b in (5,6);
+show status like 'Handler_read_rnd_next';
+show status like 'Handler_read_key';
+flush status;
+update t2 set a = 222 where b = 7;
+show status like 'Handler_read_rnd_next';
+show status like 'Handler_read_key';
+flush status;
+delete from t2 where b = 7;
+show status like 'Handler_read_rnd_next';
+show status like 'Handler_read_key';
+flush status;
+delete from t2 where b > 5;
+show status like 'Handler_read_rnd_next';
+show status like 'Handler_read_key';
+show status like 'Handler_read_prev';
+show status like 'Handler_read_next';
+flush status;
+delete from t2 where b < 5 or b > 3;
+show status like 'Handler_read_rnd_next';
+show status like 'Handler_read_key';
+show status like 'Handler_read_prev';
+show status like 'Handler_read_next';
+
+drop table t1, t2;
+
+# BUG#18025
+# part1: mediumint columns
+create table t1 ( f_int1 mediumint, f_int2 integer)
+partition by list(mod(f_int1,4)) (
+ partition p_3 values in (-3),
+ partition p_2 values in (-2),
+ partition p_1 values in (-1),
+ partition p0 values in (0),
+ partition p1 values in (1),
+ partition p2 values in (2),
+ partition p3 values in (3)
+);
+
+insert into t1 values (9, 9), (8, 8), (7, 7), (6, 6), (5, 5),
+ (4, 4), (3, 3), (2, 2), (1, 1);
+select * from t1 where f_int1 between 5 and 15 order by f_int1;
+
+drop table t1;
+
+# part2: bug in pruning code
+create table t1 (a char(10) binary)
+partition by list(length(a))
+ (partition p1 values in (1),
+ partition p2 values in (2),
+ partition p3 values in (3),
+ partition p4 values in (4),
+ partition p5 values in (5)
+);
+insert into t1 values ('a'),('bb'),('ccc'),('dddd'),('eeEee');
+select * from t1 where a>='a' and a <= 'dddd';
+explain partitions select * from t1 where a>='a' and a <= 'dddd';
+drop table t1;
+
+# BUG#18659: Assertion failure when subpartitioning is used and partition is
+# "IS NULL"
+create table t1 (f_int1 integer) partition by list(abs(mod(f_int1,2)))
+ subpartition by hash(f_int1) subpartitions 2
+(
+ partition part1 values in (0),
+ partition part2 values in (1),
+ partition part4 values in (null)
+);
+insert into t1 set f_int1 = null;
+
+select * from t1 where f_int1 is null;
+explain partitions select * from t1 where f_int1 is null;
+drop table t1;
+
+#
+# BUG#18558
+#
+create table t1 (a int not null, b int not null)
+partition by list(a)
+ subpartition by hash(b) subpartitions 4
+(
+ partition p0 values in (1),
+ partition p1 values in (2),
+ partition p2 values in (3)
+);
+insert into t1 values (1,1),(1,2),(1,3),(1,4),
+ (2,1),(2,2),(2,3),(2,4);
+explain partitions select * from t1 where a=1 AND (b=1 OR b=2);
+drop table t1;
+
+create table t1 (a int, b int not null)
+partition by list(a)
+ subpartition by hash(b) subpartitions 2
+(
+ partition p0 values in (1),
+ partition p1 values in (2),
+ partition p2 values in (3),
+ partition pn values in (NULL)
+);
+insert into t1 values (1,1),(1,2),(1,3),(1,4),
+ (2,1),(2,2),(2,3),(2,4), (NULL,1);
+
+explain partitions select * from t1 where a IS NULL AND (b=1 OR b=2);
+
+explain partitions select * from t1 where (a IS NULL or a < 1) AND (b=1 OR b=2);
+explain partitions select * from t1 where (a IS NULL or a < 2) AND (b=1 OR b=2);
+explain partitions select * from t1 where (a IS NULL or a <= 1) AND (b=1 OR b=2);
+
+drop table t1;
+
+create table t1 ( a int) partition by list (MOD(a, 10))
+( partition p0 values in (0), partition p1 values in (1),
+ partition p2 values in (2), partition p3 values in (3),
+ partition p4 values in (4), partition p5 values in (5),
+ partition p6 values in (6), partition pn values in (NULL)
+);
+insert into t1 values (NULL), (0),(1),(2),(3),(4),(5),(6);
+explain partitions select * from t1 where a is null or a < 2;
+drop table t1;
+
+# Testcase from BUG#18751
+create table t1 (s1 int) partition by list (s1)
+ (partition p1 values in (0),
+ partition p2 values in (1),
+ partition p3 values in (null));
+
+insert into t1 values (0),(1),(null);
+
+select count(*) from t1 where s1 < 0 or s1 is null;
+explain partitions select count(*) from t1 where s1 < 0 or s1 is null;
+drop table t1;
+
+# No tests for NULLs in RANGE(monotonic_expr()) - they depend on BUG#15447
+# being fixed.
+
+#
+# BUG#17946 Like searches fail with partitioning
+#
+create table t1 (a char(32) primary key)
+partition by key()
+partitions 100;
+insert into t1 values ('na');
+select * from t1;
+select * from t1 where a like 'n%';
+drop table t1;
+
+
+# BUG#19055 Crashes for varchar_col=NUMBER or varchar_col IS NULL
+create table t1 (s1 varchar(15)) partition by key (s1);
+select * from t1 where s1 = 0 or s1 is null;
+insert into t1 values ('aa'),('bb'),('0');
+explain partitions select * from t1 where s1 = 0 or s1 is null;
+drop table t1;
+
+#
+# BUG#19684: EXPLAIN PARTITIONS produces garbage in 'partitions' column when
+# the length of string to be displayed exceeds some limit.
+create table t2 (a int, b int)
+ partition by LIST(a)
+ subpartition by HASH(b) subpartitions 40
+( partition p_0_long_partition_name values in(1),
+ partition p_1_long_partition_name values in(2));
+
+insert into t2 values (1,1),(2,2);
+
+--vertical_results
+explain partitions select * from t2;
+--horizontal_results
+drop table t2;
+
+
+# BUG#20484 "Partitions: crash with explain and union"
+create table t1 (s1 int);
+explain partitions select 1 from t1 union all select 2;
+drop table t1;
+
+
+# BUG#20257: partition pruning test coverage for BIGINT UNSIGNED
+create table t1 (a bigint unsigned not null) partition by range(a) (
+ partition p0 values less than (10),
+ partition p1 values less than (100),
+ partition p2 values less than (1000),
+ partition p3 values less than (18446744073709551000),
+ partition p4 values less than (18446744073709551614)
+);
+insert into t1 values (5),(15),(105),(1005);
+insert into t1 values (18446744073709551000+1);
+insert into t1 values (18446744073709551614-1);
+
+explain partitions select * from t1 where a < 10;
+explain partitions select * from t1
+ where a >= 18446744073709551000-1 and a <= 18446744073709551000+1;
+
+explain partitions select * from t1
+ where a between 18446744073709551001 and 18446744073709551002;
+
+explain partitions select * from t1 where a = 18446744073709551000;
+explain partitions select * from t1 where a = 18446744073709551613;
+explain partitions select * from t1 where a = 18446744073709551614;
+drop table t1;
+
+create table t1 (a int)
+ partition by range((a & 0xFF) << 56) (
+ partition p0 values less than (0x40 << 56),
+ partition p1 values less than (0x80 << 56),
+ partition p2 values less than (0xFF << 56)
+);
+
+insert into t1 values (0x20), (0x20), (0x41), (0x41), (0xFE), (0xFE);
+explain partitions select * from t1 where a=0;
+explain partitions select * from t1 where a=0xFE;
+explain partitions select * from t1 where a>0xFE and a<= 0xFF;
+drop table t1;
+
+create table t1(a bigint unsigned not null) partition by range(a+0) (
+ partition p1 values less than (10),
+ partition p2 values less than (20),
+ partition p3 values less than (2305561538531885056),
+ partition p4 values less than (2305561538531950591)
+);
+
+insert into t1 values (9),(19),(0xFFFF0000FFFF000-1), (0xFFFF0000FFFFFFF-1);
+insert into t1 values (9),(19),(0xFFFF0000FFFF000-1), (0xFFFF0000FFFFFFF-1);
+
+explain partitions select * from t1 where
+ a >= 2305561538531885056-10 and a <= 2305561538531885056-8;
+
+explain partitions select * from t1 where
+ a > 0xFFFFFFFFFFFFFFEC and a < 0xFFFFFFFFFFFFFFEE;
+
+explain partitions select * from t1 where a>=0 and a <= 0xFFFFFFFFFFFFFFFF;
+drop table t1;
+
+create table t1 (a bigint) partition by range(a+0) (
+ partition p1 values less than (-1000),
+ partition p2 values less than (-10),
+ partition p3 values less than (10),
+ partition p4 values less than (1000)
+);
+insert into t1 values (-15),(-5),(5),(15),(-15),(-5),(5),(15);
+explain partitions select * from t1 where a>-2 and a <=0;
+drop table t1;
+
diff --git a/mysql-test/t/partition_range.test b/mysql-test/t/partition_range.test
new file mode 100644
index 00000000000..84f67febe8b
--- /dev/null
+++ b/mysql-test/t/partition_range.test
@@ -0,0 +1,761 @@
+#--disable_abort_on_error
+#
+# Simple test for the partition storage engine
+# Focuses on range partitioning tests
+#
+-- source include/have_partition.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# BUG 18198: Various tests for partition functions
+#
+create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int)
+partition by range (length(a) * b)
+(partition p0 values less than (2), partition p1 values less than (400));
+insert into t1 values ('a ', 2),('a',3);
+drop table t1;
+
+create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int)
+partition by range (b* length(a) * b)
+(partition p0 values less than (2), partition p1 values less than (400));
+insert into t1 values ('a ', 2),('a',3);
+drop table t1;
+
+create table t1 (a varchar(10) charset latin1 collate latin1_bin,
+ b varchar(10) charset latin1 collate latin1_bin)
+partition by range (length(b) * length(a))
+(partition p0 values less than (2), partition p1 values less than (400));
+insert into t1 values ('a ', 'b '),('a','b');
+drop table t1;
+
+create table t1 (a varchar(10) charset latin1 collate latin1_bin,
+ b varchar(10) charset latin1 collate latin1_bin)
+partition by range (length(a) * length(b))
+(partition p0 values less than (2), partition p1 values less than (400));
+insert into t1 values ('a ', 'b '),('a','b');
+drop table t1;
+
+create table t1 (a varchar(10) charset latin1 collate latin1_bin,
+ b varchar(10) charset latin1 collate latin1_bin, c int)
+partition by range (length(a) * c)
+(partition p0 values less than (2), partition p1 values less than (400));
+insert into t1 values ('a ', 'b ', 2),('a','b', 3);
+drop table t1;
+
+create table t1 (a varchar(10) charset latin1 collate latin1_bin,
+ b varchar(10) charset latin1 collate latin1_bin, c int)
+partition by range (c * length(a))
+(partition p0 values less than (2), partition p1 values less than (400));
+insert into t1 values ('a ', 'b ', 2),('a','b', 3);
+drop table t1;
+
+#
+# More checks for partition pruning
+#
+create table t1 (a int unsigned)
+partition by range (a)
+(partition pnull values less than (0),
+ partition p0 values less than (1),
+ partition p1 values less than(2));
+insert into t1 values (null),(0),(1);
+
+select * from t1 where a is null;
+select * from t1 where a >= 0;
+select * from t1 where a < 0;
+select * from t1 where a <= 0;
+select * from t1 where a > 1;
+explain partitions select * from t1 where a is null;
+explain partitions select * from t1 where a >= 0;
+explain partitions select * from t1 where a < 0;
+explain partitions select * from t1 where a <= 0;
+explain partitions select * from t1 where a > 1;
+drop table t1;
+
+create table t1 (a int unsigned, b int unsigned)
+partition by range (a)
+subpartition by hash (b)
+subpartitions 2
+(partition pnull values less than (0),
+ partition p0 values less than (1),
+ partition p1 values less than(2));
+insert into t1 values (null,0),(null,1),(0,0),(0,1),(1,0),(1,1);
+
+select * from t1 where a is null;
+select * from t1 where a >= 0;
+select * from t1 where a < 0;
+select * from t1 where a <= 0;
+select * from t1 where a > 1;
+explain partitions select * from t1 where a is null;
+explain partitions select * from t1 where a >= 0;
+explain partitions select * from t1 where a < 0;
+explain partitions select * from t1 where a <= 0;
+explain partitions select * from t1 where a > 1;
+
+drop table t1;
+
+#
+# Partition by range, basic
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a)
+partitions 3
+(partition x1 values less than (5) tablespace ts1,
+ partition x2 values less than (10) tablespace ts2,
+ partition x3 values less than maxvalue tablespace ts3);
+
+# Simple insert and verify test
+INSERT into t1 values (1, 1, 1);
+INSERT into t1 values (6, 1, 1);
+INSERT into t1 values (10, 1, 1);
+INSERT into t1 values (15, 1, 1);
+
+select * from t1;
+show create table t1;
+
+ALTER TABLE t1
+partition by range (a)
+partitions 3
+(partition x1 values less than (5) tablespace ts1,
+ partition x2 values less than (10) tablespace ts2,
+ partition x3 values less than maxvalue tablespace ts3);
+
+select * from t1;
+show create table t1;
+
+drop table if exists t1;
+
+#
+# Partition by range, basic
+# No primary key
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null)
+partition by range (a)
+partitions 3
+(partition x1 values less than (5) tablespace ts1,
+ partition x2 values less than (10) tablespace ts2,
+ partition x3 values less than maxvalue tablespace ts3);
+
+# Simple insert and verify test
+INSERT into t1 values (1, 1, 1);
+INSERT into t1 values (6, 1, 1);
+INSERT into t1 values (10, 1, 1);
+INSERT into t1 values (15, 1, 1);
+
+select * from t1;
+
+ALTER TABLE t1
+partition by range (a)
+partitions 3
+(partition x1 values less than (5) tablespace ts1,
+ partition x2 values less than (10) tablespace ts2,
+ partition x3 values less than maxvalue tablespace ts3);
+
+select * from t1;
+
+drop table if exists t1;
+
+#
+# Partition by range, basic
+# No max value used
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a)
+partitions 3
+(partition x1 values less than (5) tablespace ts1,
+ partition x2 values less than (10) tablespace ts2,
+ partition x3 values less than (15) tablespace ts3);
+
+
+# Simple insert and verify test
+INSERT into t1 values (1, 1, 1);
+INSERT into t1 values (6, 1, 1);
+INSERT into t1 values (10, 1, 1);
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+INSERT into t1 values (15, 1, 1);
+
+select * from t1;
+
+ALTER TABLE t1
+partition by range (a)
+partitions 3
+(partition x1 values less than (5) tablespace ts1,
+ partition x2 values less than (10) tablespace ts2,
+ partition x3 values less than (15) tablespace ts3);
+
+select * from t1;
+
+drop table t1;
+
+#
+# Partition by range, only one partition
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range (a)
+(partition x1 values less than (1));
+
+drop table t1;
+
+#
+# Subpartition by hash, two partitions and two subpartitions
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+ ( subpartition x11,
+ subpartition x12),
+ partition x2 values less than (5)
+ ( subpartition x21,
+ subpartition x22)
+);
+
+SELECT * from t1;
+show create table t1;
+
+ALTER TABLE t1 ADD COLUMN d int;
+show create table t1;
+
+drop table t1;
+
+#
+# Subpartition by hash, two partitions and two subpartitions
+# Defined tablespace, engine and node group
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+ ( subpartition x11 tablespace t1 engine myisam nodegroup 0,
+ subpartition x12 tablespace t2 engine myisam nodegroup 1),
+ partition x2 values less than (5)
+ ( subpartition x21 tablespace t1 engine myisam nodegroup 0,
+ subpartition x22 tablespace t2 engine myisam nodegroup 1)
+);
+
+SELECT * from t1;
+
+drop table t1;
+
+#
+# Subpartition by hash, two partitions and two subpartitions
+# Defined tablespace, node group
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+ ( subpartition x11 tablespace t1 nodegroup 0,
+ subpartition x12 tablespace t2 nodegroup 1),
+ partition x2 values less than (5)
+ ( subpartition x21 tablespace t1 nodegroup 0,
+ subpartition x22 tablespace t2 nodegroup 1)
+);
+
+SELECT * from t1;
+
+drop table t1;
+
+#
+# Subpartition by hash, two partitions and two subpartitions
+# Defined engine and node group
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+ ( subpartition x11 engine myisam nodegroup 0,
+ subpartition x12 engine myisam nodegroup 1),
+ partition x2 values less than (5)
+ ( subpartition x21 engine myisam nodegroup 0,
+ subpartition x22 engine myisam nodegroup 1)
+);
+
+INSERT into t1 VALUES (1,1,1);
+INSERT into t1 VALUES (4,1,1);
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+INSERT into t1 VALUES (5,1,1);
+
+SELECT * from t1;
+
+ALTER TABLE t1
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+ ( subpartition x11 engine myisam nodegroup 0,
+ subpartition x12 engine myisam nodegroup 1),
+ partition x2 values less than (5)
+ ( subpartition x21 engine myisam nodegroup 0,
+ subpartition x22 engine myisam nodegroup 1)
+);
+
+SELECT * from t1;
+
+drop table t1;
+
+#
+# Subpartition by hash, two partitions and two subpartitions
+# Defined tablespace, engine
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+ ( subpartition x11 tablespace t1 engine myisam,
+ subpartition x12 tablespace t2 engine myisam),
+ partition x2 values less than (5)
+ ( subpartition x21 tablespace t1 engine myisam,
+ subpartition x22 tablespace t2 engine myisam)
+);
+
+INSERT into t1 VALUES (1,1,1);
+INSERT into t1 VALUES (4,1,1);
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+INSERT into t1 VALUES (5,1,1);
+
+SELECT * from t1;
+
+ALTER TABLE t1
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+ ( subpartition x11 tablespace t1 engine myisam,
+ subpartition x12 tablespace t2 engine myisam),
+ partition x2 values less than (5)
+ ( subpartition x21 tablespace t1 engine myisam,
+ subpartition x22 tablespace t2 engine myisam)
+);
+
+SELECT * from t1;
+
+drop table t1;
+
+#
+# Subpartition by hash, two partitions and two subpartitions
+# Defined tablespace
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+ ( subpartition x11 tablespace t1,
+ subpartition x12 tablespace t2),
+ partition x2 values less than (5)
+ ( subpartition x21 tablespace t1,
+ subpartition x22 tablespace t2)
+);
+
+INSERT into t1 VALUES (1,1,1);
+INSERT into t1 VALUES (4,1,1);
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+INSERT into t1 VALUES (5,1,1);
+
+SELECT * from t1;
+
+ALTER TABLE t1
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+ ( subpartition x11 tablespace t1 engine myisam,
+ subpartition x12 tablespace t2 engine myisam),
+ partition x2 values less than (5)
+ ( subpartition x21 tablespace t1 engine myisam,
+ subpartition x22 tablespace t2 engine myisam)
+);
+
+SELECT * from t1;
+
+drop table t1;
+
+#
+# Subpartition by hash, two partitions and two subpartitions
+# Defined engine
+#
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key (a,b))
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+ ( subpartition x11 engine myisam,
+ subpartition x12 engine myisam),
+ partition x2 values less than (5)
+ ( subpartition x21 engine myisam,
+ subpartition x22 engine myisam)
+);
+
+INSERT into t1 VALUES (1,1,1);
+INSERT into t1 VALUES (4,1,1);
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+INSERT into t1 VALUES (5,1,1);
+
+SELECT * from t1;
+
+ALTER TABLE t1
+partition by range (a)
+subpartition by hash (a+b)
+( partition x1 values less than (1)
+ ( subpartition x11 engine myisam,
+ subpartition x12 engine myisam),
+ partition x2 values less than (5)
+ ( subpartition x21 engine myisam,
+ subpartition x22 engine myisam)
+);
+
+SELECT * from t1;
+
+drop table t1;
+
+#
+# Bug #17894 Comparison with "less than" operator fails with Range partition
+#
+CREATE TABLE t1 (c1 int default NULL, c2 varchar(30) default NULL,
+c3 date default NULL) engine=myisam
+PARTITION BY RANGE (year(c3)) (PARTITION p0 VALUES LESS THAN (1995),
+PARTITION p1 VALUES LESS THAN (1996) , PARTITION p2 VALUES LESS THAN (1997) ,
+PARTITION p3 VALUES LESS THAN (1998) , PARTITION p4 VALUES LESS THAN (1999) ,
+PARTITION p5 VALUES LESS THAN (2000) , PARTITION p6 VALUES LESS THAN (2001) ,
+PARTITION p7 VALUES LESS THAN (2002) , PARTITION p8 VALUES LESS THAN (2003) ,
+PARTITION p9 VALUES LESS THAN (2004) , PARTITION p10 VALUES LESS THAN (2010),
+PARTITION p11 VALUES LESS THAN MAXVALUE );
+INSERT INTO t1 VALUES (1, 'testing partitions', '1995-07-17'),
+(3, 'testing partitions','1995-07-31'),
+(5, 'testing partitions','1995-08-13'),
+(7, 'testing partitions','1995-08-26'),
+(9, 'testing partitions','1995-09-09'),
+(0, 'testing partitions','2000-07-10'),
+(2, 'testing partitions','2000-07-23'),
+(4, 'testing partitions','2000-08-05'),
+(6, 'testing partitions','2000-08-19'),
+(8, 'testing partitions','2000-09-01');
+SELECT COUNT(*) FROM t1 WHERE c3 BETWEEN '1996-12-31' AND '2000-12-31';
+SELECT COUNT(*) FROM t1 WHERE c3 < '2000-12-31';
+DROP TABLE t1;
+
+#
+# BUG 16002: Unsigned partition functions not handled correctly
+#
+--error ER_RANGE_NOT_INCREASING_ERROR
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (10),
+ partition p1 values less than (0));
+
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (0),
+ partition p1 values less than (10));
+show create table t1;
+drop table t1;
+
+create table t1 (a bigint unsigned)
+partition by range (a)
+(partition p0 values less than (2),
+ partition p1 values less than (10));
+show create table t1;
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+insert into t1 values (0xFFFFFFFFFFFFFFFF);
+drop table t1;
+
+#
+# BUG 18962 Errors in DROP PARTITION
+#
+create table t1 (a int)
+partition by range (MOD(a,3))
+subpartition by hash(a)
+subpartitions 2
+(partition p0 values less than (1),
+ partition p1 values less than (2),
+ partition p2 values less than (3),
+ partition p3 values less than (4));
+ALTER TABLE t1 DROP PARTITION p3;
+ALTER TABLE t1 DROP PARTITION p1;
+ALTER TABLE t1 DROP PARTITION p2;
+drop table t1;
+
+create table t1 (a int)
+partition by range (MOD(a,3))
+subpartition by hash(a)
+subpartitions 2
+(partition p0 values less than (1),
+ partition p1 values less than (2),
+ partition p2 values less than (3),
+ partition p3 values less than (4));
+ALTER TABLE t1 DROP PARTITION p0;
+ALTER TABLE t1 DROP PARTITION p1;
+ALTER TABLE t1 DROP PARTITION p2;
+drop table t1;
+
+#
+# Bug 19830: ALTER TABLE t1 REORGANIZE PARTITION crashes
+#
+create table t1 (a int DEFAULT NULL,
+ b varchar(30) DEFAULT NULL,
+ c date DEFAULT NULL)
+ENGINE=MYISAM DEFAULT CHARSET=latin1;
+
+insert into t1 values (1, 'abc', '1995-01-01');
+insert into t1 values (1, 'abc', '1995-01-02');
+insert into t1 values (1, 'abc', '1995-01-03');
+insert into t1 values (1, 'abc', '1995-01-04');
+insert into t1 values (1, 'abc', '1995-01-05');
+insert into t1 values (1, 'abc', '1995-01-06');
+insert into t1 values (1, 'abc', '1995-01-07');
+insert into t1 values (1, 'abc', '1995-01-08');
+insert into t1 values (1, 'abc', '1995-01-09');
+insert into t1 values (1, 'abc', '1995-01-10');
+insert into t1 values (1, 'abc', '1995-01-11');
+insert into t1 values (1, 'abc', '1995-01-12');
+insert into t1 values (1, 'abc', '1995-01-13');
+insert into t1 values (1, 'abc', '1995-01-14');
+insert into t1 values (1, 'abc', '1995-01-15');
+insert into t1 values (1, 'abc', '1997-01-01');
+insert into t1 values (1, 'abc', '1997-01-02');
+insert into t1 values (1, 'abc', '1997-01-03');
+insert into t1 values (1, 'abc', '1997-01-04');
+insert into t1 values (1, 'abc', '1997-01-05');
+insert into t1 values (1, 'abc', '1997-01-06');
+insert into t1 values (1, 'abc', '1997-01-07');
+insert into t1 values (1, 'abc', '1997-01-08');
+insert into t1 values (1, 'abc', '1997-01-09');
+insert into t1 values (1, 'abc', '1997-01-10');
+insert into t1 values (1, 'abc', '1997-01-11');
+insert into t1 values (1, 'abc', '1997-01-12');
+insert into t1 values (1, 'abc', '1997-01-13');
+insert into t1 values (1, 'abc', '1997-01-14');
+insert into t1 values (1, 'abc', '1997-01-15');
+insert into t1 values (1, 'abc', '1998-01-01');
+insert into t1 values (1, 'abc', '1998-01-02');
+insert into t1 values (1, 'abc', '1998-01-03');
+insert into t1 values (1, 'abc', '1998-01-04');
+insert into t1 values (1, 'abc', '1998-01-05');
+insert into t1 values (1, 'abc', '1998-01-06');
+insert into t1 values (1, 'abc', '1998-01-07');
+insert into t1 values (1, 'abc', '1998-01-08');
+insert into t1 values (1, 'abc', '1998-01-09');
+insert into t1 values (1, 'abc', '1998-01-10');
+insert into t1 values (1, 'abc', '1998-01-11');
+insert into t1 values (1, 'abc', '1998-01-12');
+insert into t1 values (1, 'abc', '1998-01-13');
+insert into t1 values (1, 'abc', '1998-01-14');
+insert into t1 values (1, 'abc', '1998-01-15');
+insert into t1 values (1, 'abc', '1999-01-01');
+insert into t1 values (1, 'abc', '1999-01-02');
+insert into t1 values (1, 'abc', '1999-01-03');
+insert into t1 values (1, 'abc', '1999-01-04');
+insert into t1 values (1, 'abc', '1999-01-05');
+insert into t1 values (1, 'abc', '1999-01-06');
+insert into t1 values (1, 'abc', '1999-01-07');
+insert into t1 values (1, 'abc', '1999-01-08');
+insert into t1 values (1, 'abc', '1999-01-09');
+insert into t1 values (1, 'abc', '1999-01-10');
+insert into t1 values (1, 'abc', '1999-01-11');
+insert into t1 values (1, 'abc', '1999-01-12');
+insert into t1 values (1, 'abc', '1999-01-13');
+insert into t1 values (1, 'abc', '1999-01-14');
+insert into t1 values (1, 'abc', '1999-01-15');
+insert into t1 values (1, 'abc', '2000-01-01');
+insert into t1 values (1, 'abc', '2000-01-02');
+insert into t1 values (1, 'abc', '2000-01-03');
+insert into t1 values (1, 'abc', '2000-01-04');
+insert into t1 values (1, 'abc', '2000-01-05');
+insert into t1 values (1, 'abc', '2000-01-06');
+insert into t1 values (1, 'abc', '2000-01-07');
+insert into t1 values (1, 'abc', '2000-01-08');
+insert into t1 values (1, 'abc', '2000-01-09');
+insert into t1 values (1, 'abc', '2000-01-15');
+insert into t1 values (1, 'abc', '2000-01-11');
+insert into t1 values (1, 'abc', '2000-01-12');
+insert into t1 values (1, 'abc', '2000-01-13');
+insert into t1 values (1, 'abc', '2000-01-14');
+insert into t1 values (1, 'abc', '2000-01-15');
+insert into t1 values (1, 'abc', '2001-01-01');
+insert into t1 values (1, 'abc', '2001-01-02');
+insert into t1 values (1, 'abc', '2001-01-03');
+insert into t1 values (1, 'abc', '2001-01-04');
+insert into t1 values (1, 'abc', '2001-01-05');
+insert into t1 values (1, 'abc', '2001-01-06');
+insert into t1 values (1, 'abc', '2001-01-07');
+insert into t1 values (1, 'abc', '2001-01-08');
+insert into t1 values (1, 'abc', '2001-01-09');
+insert into t1 values (1, 'abc', '2001-01-15');
+insert into t1 values (1, 'abc', '2001-01-11');
+insert into t1 values (1, 'abc', '2001-01-12');
+insert into t1 values (1, 'abc', '2001-01-13');
+insert into t1 values (1, 'abc', '2001-01-14');
+insert into t1 values (1, 'abc', '2001-01-15');
+
+alter table t1
+partition by range (year(c))
+(partition p5 values less than (2000), partition p10 values less than (2010));
+
+alter table t1
+reorganize partition p5 into
+(partition p1 values less than (1996),
+ partition p2 values less than (1997),
+ partition p3 values less than (1998),
+ partition p4 values less than (1999),
+ partition p5 values less than (2000));
+
+drop table t1;
+
+#
+# New test cases for date based partitioning
+#
+CREATE TABLE t1 (a date)
+PARTITION BY RANGE (TO_DAYS(a))
+(PARTITION p3xx VALUES LESS THAN (TO_DAYS('2004-01-01')),
+ PARTITION p401 VALUES LESS THAN (TO_DAYS('2004-02-01')),
+ PARTITION p402 VALUES LESS THAN (TO_DAYS('2004-03-01')),
+ PARTITION p403 VALUES LESS THAN (TO_DAYS('2004-04-01')),
+ PARTITION p404 VALUES LESS THAN (TO_DAYS('2004-05-01')),
+ PARTITION p405 VALUES LESS THAN (TO_DAYS('2004-06-01')),
+ PARTITION p406 VALUES LESS THAN (TO_DAYS('2004-07-01')),
+ PARTITION p407 VALUES LESS THAN (TO_DAYS('2004-08-01')),
+ PARTITION p408 VALUES LESS THAN (TO_DAYS('2004-09-01')),
+ PARTITION p409 VALUES LESS THAN (TO_DAYS('2004-10-01')),
+ PARTITION p410 VALUES LESS THAN (TO_DAYS('2004-11-01')),
+ PARTITION p411 VALUES LESS THAN (TO_DAYS('2004-12-01')),
+ PARTITION p412 VALUES LESS THAN (TO_DAYS('2005-01-01')),
+ PARTITION p501 VALUES LESS THAN (TO_DAYS('2005-02-01')),
+ PARTITION p502 VALUES LESS THAN (TO_DAYS('2005-03-01')),
+ PARTITION p503 VALUES LESS THAN (TO_DAYS('2005-04-01')),
+ PARTITION p504 VALUES LESS THAN (TO_DAYS('2005-05-01')),
+ PARTITION p505 VALUES LESS THAN (TO_DAYS('2005-06-01')),
+ PARTITION p506 VALUES LESS THAN (TO_DAYS('2005-07-01')),
+ PARTITION p507 VALUES LESS THAN (TO_DAYS('2005-08-01')),
+ PARTITION p508 VALUES LESS THAN (TO_DAYS('2005-09-01')),
+ PARTITION p509 VALUES LESS THAN (TO_DAYS('2005-10-01')),
+ PARTITION p510 VALUES LESS THAN (TO_DAYS('2005-11-01')),
+ PARTITION p511 VALUES LESS THAN (TO_DAYS('2005-12-01')),
+ PARTITION p512 VALUES LESS THAN (TO_DAYS('2006-01-01')),
+ PARTITION p601 VALUES LESS THAN (TO_DAYS('2006-02-01')),
+ PARTITION p602 VALUES LESS THAN (TO_DAYS('2006-03-01')),
+ PARTITION p603 VALUES LESS THAN (TO_DAYS('2006-04-01')),
+ PARTITION p604 VALUES LESS THAN (TO_DAYS('2006-05-01')),
+ PARTITION p605 VALUES LESS THAN (TO_DAYS('2006-06-01')),
+ PARTITION p606 VALUES LESS THAN (TO_DAYS('2006-07-01')),
+ PARTITION p607 VALUES LESS THAN (TO_DAYS('2006-08-01')));
+
+INSERT INTO t1 VALUES ('2003-01-13'),('2003-06-20'),('2003-08-30');
+INSERT INTO t1 VALUES ('2003-04-13'),('2003-07-20'),('2003-10-30');
+INSERT INTO t1 VALUES ('2003-05-13'),('2003-11-20'),('2003-12-30');
+
+INSERT INTO t1 VALUES ('2004-01-13'),('2004-01-20'),('2004-01-30');
+INSERT INTO t1 VALUES ('2004-02-13'),('2004-02-20'),('2004-02-28');
+INSERT INTO t1 VALUES ('2004-03-13'),('2004-03-20'),('2004-03-30');
+INSERT INTO t1 VALUES ('2004-04-13'),('2004-04-20'),('2004-04-30');
+INSERT INTO t1 VALUES ('2004-05-13'),('2004-05-20'),('2004-05-30');
+INSERT INTO t1 VALUES ('2004-06-13'),('2004-06-20'),('2004-06-30');
+INSERT INTO t1 VALUES ('2004-07-13'),('2004-07-20'),('2004-07-30');
+INSERT INTO t1 VALUES ('2004-08-13'),('2004-08-20'),('2004-08-30');
+INSERT INTO t1 VALUES ('2004-09-13'),('2004-09-20'),('2004-09-30');
+INSERT INTO t1 VALUES ('2004-10-13'),('2004-10-20'),('2004-10-30');
+INSERT INTO t1 VALUES ('2004-11-13'),('2004-11-20'),('2004-11-30');
+INSERT INTO t1 VALUES ('2004-12-13'),('2004-12-20'),('2004-12-30');
+
+INSERT INTO t1 VALUES ('2005-01-13'),('2005-01-20'),('2005-01-30');
+INSERT INTO t1 VALUES ('2005-02-13'),('2005-02-20'),('2005-02-28');
+INSERT INTO t1 VALUES ('2005-03-13'),('2005-03-20'),('2005-03-30');
+INSERT INTO t1 VALUES ('2005-04-13'),('2005-04-20'),('2005-04-30');
+INSERT INTO t1 VALUES ('2005-05-13'),('2005-05-20'),('2005-05-30');
+INSERT INTO t1 VALUES ('2005-06-13'),('2005-06-20'),('2005-06-30');
+INSERT INTO t1 VALUES ('2005-07-13'),('2005-07-20'),('2005-07-30');
+INSERT INTO t1 VALUES ('2005-08-13'),('2005-08-20'),('2005-08-30');
+INSERT INTO t1 VALUES ('2005-09-13'),('2005-09-20'),('2005-09-30');
+INSERT INTO t1 VALUES ('2005-10-13'),('2005-10-20'),('2005-10-30');
+INSERT INTO t1 VALUES ('2005-11-13'),('2005-11-20'),('2005-11-30');
+INSERT INTO t1 VALUES ('2005-12-13'),('2005-12-20'),('2005-12-30');
+
+INSERT INTO t1 VALUES ('2006-01-13'),('2006-01-20'),('2006-01-30');
+INSERT INTO t1 VALUES ('2006-02-13'),('2006-02-20'),('2006-02-28');
+INSERT INTO t1 VALUES ('2006-03-13'),('2006-03-20'),('2006-03-30');
+INSERT INTO t1 VALUES ('2006-04-13'),('2006-04-20'),('2006-04-30');
+INSERT INTO t1 VALUES ('2006-05-13'),('2006-05-20'),('2006-05-30');
+INSERT INTO t1 VALUES ('2006-06-13'),('2006-06-20'),('2006-06-30');
+INSERT INTO t1 VALUES ('2006-07-13'),('2006-07-20'),('2006-07-30');
+
+SELECT * FROM t1
+WHERE a >= '2004-07-01' AND a <= '2004-09-30';
+EXPLAIN PARTITIONS SELECT * FROM t1
+WHERE a >= '2004-07-01' AND a <= '2004-09-30';
+SELECT * from t1
+WHERE (a >= '2004-07-01' AND a <= '2004-09-30') OR
+ (a >= '2005-07-01' AND a <= '2005-09-30');
+EXPLAIN PARTITIONS SELECT * from t1
+WHERE (a >= '2004-07-01' AND a <= '2004-09-30') OR
+ (a >= '2005-07-01' AND a <= '2005-09-30');
+DROP TABLE t1;
+
+#
+# Bug 18198: Try with a couple of cases using VARCHAR fields in
+# partition function.
+create table t1 (a varchar(20))
+partition by range (crc32(md5(a)))
+(partition p0 values less than (100),
+ partition p1 values less than maxvalue);
+
+insert into t1 values ("12345678901234567890");
+insert into t1 values ("A2345678901234567890");
+insert into t1 values ("B2345678901234567890");
+insert into t1 values ("1234567890123456789");
+insert into t1 values ("1234567890123456");
+select * from t1;
+explain partitions select * from t1 where a = "12345678901234567890";
+explain partitions select * from t1 where a = "12345678901234567890" OR
+ a = "A2345678901234567890" OR
+ a = "B2345678901234567890" OR
+ a = "C2345678901234567890";
+explain partitions select * from t1 where a = "01234567890123456";
+select * from t1 where a = "01234567890123456";
+select * from t1 where a = "12345678901234567890" OR
+ a = "A2345678901234567890" OR
+ a = "B2345678901234567890" OR
+ a = "C2345678901234567890";
+select * from t1 where a = "12345678901234567890";
+
+
+drop table t1;
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 8d01277b515..1a19355406a 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -2,7 +2,7 @@
# SQL Syntax for Prepared Statements test
#
--disable_warnings
-drop table if exists t1,t2;
+drop table if exists t1,t2,t3,t4;
# Avoid wrong warnings if mysql_client_test fails
drop database if exists client_test_db;
@@ -523,8 +523,9 @@ deallocate prepare stmt;
#
create table t1 (a varchar(20));
insert into t1 values ('foo');
---error 1305
prepare stmt FROM 'SELECT char_length (a) FROM t1';
+-- error ER_SP_DOES_NOT_EXIST
+prepare stmt2 FROM 'SELECT not_a_function (a) FROM t1';
drop table t1;
#
@@ -1041,7 +1042,6 @@ EXECUTE STMT USING @id,@id;
DEALLOCATE PREPARE STMT;
DROP TABLE t1;
-
#
# BUG#21354: (COUNT(*) = 1) not working in SELECT inside prepared
# statement
@@ -1127,8 +1127,9 @@ DROP TABLE t1;
#
create table t1 (a varchar(20));
insert into t1 values ('foo');
---error 1305
prepare stmt FROM 'SELECT char_length (a) FROM t1';
+-- error ER_SP_DOES_NOT_EXIST
+prepare stmt2 FROM 'SELECT not_a_function (a) FROM t1';
drop table t1;
#
@@ -1547,3 +1548,869 @@ deallocate prepare no_index;
deallocate prepare sq;
--echo End of 5.0 tests.
+
+#
+# Bug #20665: All commands supported in Stored Procedures should work in
+# Prepared Statements
+#
+create procedure proc_1() reset query cache;
+call proc_1();
+call proc_1();
+call proc_1();
+delimiter |;
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+create function func_1() returns int begin reset query cache; return 1; end|
+create function func_1() returns int begin call proc_1(); return 1; end|
+delimiter ;|
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+select func_1(), func_1(), func_1() from dual;
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "reset query cache";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+
+
+create procedure proc_1() reset master;
+delimiter |;
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+create function func_1() returns int begin reset master; return 1; end|
+create function func_1() returns int begin call proc_1(); return 1; end|
+delimiter ;|
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+select func_1(), func_1(), func_1() from dual;
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "reset master";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+
+
+create procedure proc_1() reset slave;
+call proc_1();
+call proc_1();
+call proc_1();
+delimiter |;
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+create function func_1() returns int begin reset slave; return 1; end|
+create function func_1() returns int begin call proc_1(); return 1; end|
+delimiter ;|
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+select func_1(), func_1(), func_1() from dual;
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "reset slave";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+
+
+create procedure proc_1(a integer) kill a;
+--error ER_NO_SUCH_THREAD
+call proc_1(0);
+--error ER_NO_SUCH_THREAD
+call proc_1(0);
+--error ER_NO_SUCH_THREAD
+call proc_1(0);
+drop procedure proc_1;
+delimiter |;
+create function func_1() returns int begin kill 0; return 1; end|
+delimiter ;|
+--error ER_NO_SUCH_THREAD
+select func_1() from dual;
+--error ER_NO_SUCH_THREAD
+select func_1() from dual;
+--error ER_NO_SUCH_THREAD
+select func_1() from dual;
+drop function func_1;
+prepare abc from "kill 0";
+--error ER_NO_SUCH_THREAD
+execute abc;
+--error ER_NO_SUCH_THREAD
+execute abc;
+--error ER_NO_SUCH_THREAD
+execute abc;
+deallocate prepare abc;
+
+
+create procedure proc_1() flush hosts;
+call proc_1();
+call proc_1();
+call proc_1();
+call proc_1();
+delimiter |;
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+create function func_1() returns int begin flush hosts; return 1; end|
+create function func_1() returns int begin call proc_1(); return 1; end|
+delimiter ;|
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+select func_1(), func_1(), func_1() from dual;
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "flush hosts";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+
+
+create procedure proc_1() flush privileges;
+call proc_1();
+call proc_1();
+call proc_1();
+delimiter |;
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+create function func_1() returns int begin flush privileges; return 1; end|
+create function func_1() returns int begin call proc_1(); return 1; end|
+delimiter ;|
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+select func_1(), func_1(), func_1() from dual;
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "flush privileges";
+deallocate prepare abc;
+
+
+create procedure proc_1() flush tables with read lock;
+call proc_1();
+unlock tables;
+call proc_1();
+unlock tables;
+call proc_1();
+unlock tables;
+delimiter |;
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+create function func_1() returns int begin flush tables with read lock; return 1; end|
+create function func_1() returns int begin call proc_1(); return 1; end|
+delimiter ;|
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+select func_1(), func_1(), func_1() from dual;
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "flush tables with read lock";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+unlock tables;
+
+
+create procedure proc_1() flush tables;
+call proc_1();
+call proc_1();
+call proc_1();
+delimiter |;
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+create function func_1() returns int begin flush tables; return 1; end|
+create function func_1() returns int begin call proc_1(); return 1; end|
+delimiter ;|
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+select func_1(), func_1(), func_1() from dual;
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "flush tables";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+
+
+create procedure proc_1() flush tables;
+flush tables;
+show open tables from mysql;
+select Host, User from mysql.user limit 0;
+select Host, Db from mysql.host limit 0;
+show open tables from mysql;
+call proc_1();
+show open tables from mysql;
+select Host, User from mysql.user limit 0;
+select Host, Db from mysql.host limit 0;
+show open tables from mysql;
+call proc_1();
+show open tables from mysql;
+select Host, User from mysql.user limit 0;
+select Host, Db from mysql.host limit 0;
+show open tables from mysql;
+call proc_1();
+show open tables from mysql;
+select Host, User from mysql.user limit 0;
+select Host, Db from mysql.host limit 0;
+show open tables from mysql;
+flush tables;
+delimiter |;
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+create function func_1() returns int begin flush tables; return 1; end|
+create function func_1() returns int begin call proc_1(); return 1; end|
+delimiter ;|
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+select func_1(), func_1(), func_1() from dual;
+drop function func_1;
+drop procedure proc_1;
+flush tables;
+select Host, User from mysql.user limit 0;
+select Host, Db from mysql.host limit 0;
+show open tables from mysql;
+prepare abc from "flush tables";
+execute abc;
+show open tables from mysql;
+select Host, User from mysql.user limit 0;
+select Host, Db from mysql.host limit 0;
+show open tables from mysql;
+execute abc;
+show open tables from mysql;
+select Host, User from mysql.user limit 0;
+select Host, Db from mysql.host limit 0;
+show open tables from mysql;
+execute abc;
+show open tables from mysql;
+select Host, User from mysql.user limit 0;
+select Host, Db from mysql.host limit 0;
+show open tables from mysql;
+flush tables;
+deallocate prepare abc;
+
+
+create procedure proc_1() flush logs;
+call proc_1();
+call proc_1();
+call proc_1();
+delimiter |;
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+create function func_1() returns int begin flush logs; return 1; end|
+create function func_1() returns int begin call proc_1(); return 1; end|
+delimiter ;|
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+select func_1(), func_1(), func_1() from dual;
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "flush logs";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+
+
+create procedure proc_1() flush status;
+call proc_1();
+call proc_1();
+call proc_1();
+delimiter |;
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+create function func_1() returns int begin flush status; return 1; end|
+create function func_1() returns int begin call proc_1(); return 1; end|
+delimiter ;|
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+select func_1(), func_1(), func_1() from dual;
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "flush status";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+
+
+create procedure proc_1() flush slave;
+call proc_1();
+call proc_1();
+call proc_1();
+delimiter |;
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+create function func_1() returns int begin flush slave; return 1; end|
+create function func_1() returns int begin call proc_1(); return 1; end|
+delimiter ;|
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+select func_1(), func_1(), func_1() from dual;
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "flush slave";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+
+
+create procedure proc_1() flush master;
+delimiter |;
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+create function func_1() returns int begin flush master; return 1; end|
+create function func_1() returns int begin call proc_1(); return 1; end|
+delimiter ;|
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+select func_1(), func_1(), func_1() from dual;
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "flush master";
+deallocate prepare abc;
+
+
+create procedure proc_1() flush des_key_file;
+call proc_1();
+call proc_1();
+call proc_1();
+delimiter |;
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+create function func_1() returns int begin flush des_key_file; return 1; end|
+create function func_1() returns int begin call proc_1(); return 1; end|
+delimiter ;|
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+select func_1(), func_1(), func_1() from dual;
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "flush des_key_file";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+
+
+create procedure proc_1() flush user_resources;
+call proc_1();
+call proc_1();
+call proc_1();
+delimiter |;
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+create function func_1() returns int begin flush user_resources; return 1; end|
+create function func_1() returns int begin call proc_1(); return 1; end|
+delimiter ;|
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+select func_1(), func_1(), func_1() from dual;
+drop function func_1;
+drop procedure proc_1;
+prepare abc from "flush user_resources";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+
+
+create procedure proc_1() start slave;
+drop procedure proc_1;
+delimiter |;
+create function func_1() returns int begin start slave; return 1; end|
+delimiter ;|
+drop function func_1;
+prepare abc from "start slave";
+deallocate prepare abc;
+
+
+create procedure proc_1() stop slave;
+drop procedure proc_1;
+delimiter |;
+create function func_1() returns int begin stop slave; return 1; end|
+delimiter ;|
+drop function func_1;
+prepare abc from "stop slave";
+deallocate prepare abc;
+
+
+create procedure proc_1() show binlog events;
+drop procedure proc_1;
+delimiter |;
+--error ER_SP_NO_RETSET
+create function func_1() returns int begin show binlog events; return 1; end|
+delimiter ;|
+--error ER_SP_DOES_NOT_EXIST
+select func_1(), func_1(), func_1() from dual;
+--error ER_SP_DOES_NOT_EXIST
+drop function func_1;
+prepare abc from "show binlog events";
+deallocate prepare abc;
+
+
+create procedure proc_1() show slave status;
+drop procedure proc_1;
+delimiter |;
+--error ER_SP_NO_RETSET
+create function func_1() returns int begin show slave status; return 1; end|
+delimiter ;|
+--error ER_SP_DOES_NOT_EXIST
+select func_1(), func_1(), func_1() from dual;
+--error ER_SP_DOES_NOT_EXIST
+drop function func_1;
+prepare abc from "show slave status";
+deallocate prepare abc;
+
+
+create procedure proc_1() show master status;
+drop procedure proc_1;
+delimiter |;
+--error ER_SP_NO_RETSET
+create function func_1() returns int begin show master status; return 1; end|
+delimiter ;|
+--error ER_SP_DOES_NOT_EXIST
+select func_1(), func_1(), func_1() from dual;
+--error ER_SP_DOES_NOT_EXIST
+drop function func_1;
+prepare abc from "show master status";
+deallocate prepare abc;
+
+
+create procedure proc_1() show master logs;
+drop procedure proc_1;
+delimiter |;
+--error ER_SP_NO_RETSET
+create function func_1() returns int begin show master logs; return 1; end|
+delimiter ;|
+--error ER_SP_DOES_NOT_EXIST
+select func_1(), func_1(), func_1() from dual;
+--error ER_SP_DOES_NOT_EXIST
+drop function func_1;
+prepare abc from "show master logs";
+deallocate prepare abc;
+
+
+create procedure proc_1() show events;
+call proc_1();
+call proc_1();
+call proc_1();
+drop procedure proc_1;
+delimiter |;
+--error ER_SP_NO_RETSET
+create function func_1() returns int begin show events; return 1; end|
+delimiter ;|
+--error ER_SP_DOES_NOT_EXIST
+select func_1(), func_1(), func_1() from dual;
+--error ER_SP_DOES_NOT_EXIST
+drop function func_1;
+prepare abc from "show events";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+
+
+--disable_warnings
+drop procedure if exists a;
+--enable_warnings
+create procedure a() select 42;
+create procedure proc_1(a char(2)) show create procedure a;
+call proc_1("bb");
+call proc_1("bb");
+call proc_1("bb");
+drop procedure proc_1;
+delimiter |;
+--error ER_SP_NO_RETSET
+create function func_1() returns int begin show create procedure a; return 1; end|
+delimiter ;|
+--error ER_SP_DOES_NOT_EXIST
+select func_1(), func_1(), func_1() from dual;
+--error ER_SP_DOES_NOT_EXIST
+drop function func_1;
+prepare abc from "show create procedure a";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+drop procedure a;
+
+
+--disable_warnings
+drop function if exists a;
+--enable_warnings
+create function a() returns int return 42+13;
+create procedure proc_1(a char(2)) show create function a;
+call proc_1("bb");
+call proc_1("bb");
+call proc_1("bb");
+drop procedure proc_1;
+delimiter |;
+--error ER_SP_NO_RETSET
+create function func_1() returns int begin show create function a; return 1; end|
+delimiter ;|
+--error ER_SP_DOES_NOT_EXIST
+select func_1(), func_1(), func_1() from dual;
+--error ER_SP_DOES_NOT_EXIST
+drop function func_1;
+prepare abc from "show create function a";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+drop function a;
+
+
+--disable_warnings
+drop table if exists tab1;
+--enable_warnings
+create table tab1(a int, b char(1), primary key(a,b));
+create procedure proc_1() show create table tab1;
+call proc_1();
+call proc_1();
+call proc_1();
+drop procedure proc_1;
+delimiter |;
+--error ER_SP_NO_RETSET
+create function func_1() returns int begin show create table tab1; return 1; end|
+delimiter ;|
+--error ER_SP_DOES_NOT_EXIST
+select func_1(), func_1(), func_1() from dual;
+--error ER_SP_DOES_NOT_EXIST
+drop function func_1;
+prepare abc from "show create table tab1";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+drop table tab1;
+
+
+--disable_warnings
+drop view if exists v1;
+drop table if exists t1;
+--enable_warnings
+create table t1(a int, b char(5));
+insert into t1 values (1, "one"), (1, "edno"), (2, "two"), (2, "dve");
+create view v1 as
+ (select a, count(*) from t1 group by a)
+ union all
+ (select b, count(*) from t1 group by b);
+create procedure proc_1() show create view v1;
+call proc_1();
+call proc_1();
+call proc_1();
+drop procedure proc_1;
+delimiter |;
+--error ER_SP_NO_RETSET
+create function func_1() returns int begin show create view v1; return 1; end|
+delimiter ;|
+--error ER_SP_DOES_NOT_EXIST
+select func_1(), func_1(), func_1() from dual;
+--error ER_SP_DOES_NOT_EXIST
+drop function func_1;
+prepare abc from "show create view v1";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+drop view v1;
+drop table t1;
+
+
+create procedure proc_1() install plugin my_plug soname '/root/some_plugin.so';
+--error ER_UDF_NO_PATHS
+call proc_1();
+--error ER_UDF_NO_PATHS
+call proc_1();
+--error ER_UDF_NO_PATHS
+call proc_1();
+drop procedure proc_1;
+create procedure proc_1() install plugin my_plug soname 'some_plugin.so';
+--replace_regex /(Can\'t open shared library).*$/\1/
+--error ER_CANT_OPEN_LIBRARY
+call proc_1();
+--replace_regex /(Can\'t open shared library).*$/\1/
+--error ER_CANT_OPEN_LIBRARY
+call proc_1();
+--replace_regex /(Can\'t open shared library).*$/\1/
+--error ER_CANT_OPEN_LIBRARY
+call proc_1();
+drop procedure proc_1;
+delimiter |;
+--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
+create function func_1() returns int begin install plugin my_plug soname '/tmp/plugin'; return 1; end|
+delimiter ;|
+--error ER_SP_DOES_NOT_EXIST
+select func_1(), func_1(), func_1() from dual;
+--error ER_SP_DOES_NOT_EXIST
+drop function func_1;
+prepare abc from "install plugin my_plug soname '/root/some_plugin.so'";
+--error ER_UDF_NO_PATHS
+execute abc;
+--error ER_UDF_NO_PATHS
+execute abc;
+deallocate prepare abc;
+prepare abc from "install plugin my_plug soname 'some_plugin.so'";
+deallocate prepare abc;
+
+
+create procedure proc_1() uninstall plugin my_plug;
+--error ER_SP_DOES_NOT_EXIST
+call proc_1();
+--error ER_SP_DOES_NOT_EXIST
+call proc_1();
+--error ER_SP_DOES_NOT_EXIST
+call proc_1();
+drop procedure proc_1;
+delimiter |;
+--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
+create function func_1() returns int begin uninstall plugin my_plug; return 1; end|
+delimiter ;|
+--error ER_SP_DOES_NOT_EXIST
+select func_1(), func_1(), func_1() from dual;
+--error ER_SP_DOES_NOT_EXIST
+drop function func_1;
+prepare abc from "uninstall plugin my_plug";
+--error ER_SP_DOES_NOT_EXIST
+execute abc;
+--error ER_SP_DOES_NOT_EXIST
+execute abc;
+--error ER_SP_DOES_NOT_EXIST
+execute abc;
+deallocate prepare abc;
+
+
+--disable_warnings
+drop database if exists mysqltest_xyz;
+--enable_warnings
+create procedure proc_1() create database mysqltest_xyz;
+call proc_1();
+drop database if exists mysqltest_xyz;
+call proc_1();
+--error ER_DB_CREATE_EXISTS
+call proc_1();
+drop database if exists mysqltest_xyz;
+call proc_1();
+drop database if exists mysqltest_xyz;
+drop procedure proc_1;
+delimiter |;
+--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
+create function func_1() returns int begin create database mysqltest_xyz; return 1; end|
+delimiter ;|
+--error ER_SP_DOES_NOT_EXIST
+select func_1(), func_1(), func_1() from dual;
+--error ER_SP_DOES_NOT_EXIST
+drop function func_1;
+prepare abc from "create database mysqltest_xyz";
+execute abc;
+drop database if exists mysqltest_xyz;
+execute abc;
+--error ER_DB_CREATE_EXISTS
+execute abc;
+drop database if exists mysqltest_xyz;
+execute abc;
+drop database if exists mysqltest_xyz;
+deallocate prepare abc;
+
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1 (a int, b char(5));
+insert into t1 values (1, "one"), (2, "two"), (3, "three");
+create procedure proc_1() checksum table xyz;
+call proc_1();
+call proc_1();
+call proc_1();
+drop procedure proc_1;
+delimiter |;
+--error ER_SP_NO_RETSET
+create function func_1() returns int begin checksum table t1; return 1; end|
+delimiter ;|
+--error ER_SP_DOES_NOT_EXIST
+select func_1(), func_1(), func_1() from dual;
+--error ER_SP_DOES_NOT_EXIST
+drop function func_1;
+prepare abc from "checksum table t1";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+
+
+create procedure proc_1() create user pstest_xyz@localhost;
+call proc_1();
+drop user pstest_xyz@localhost;
+call proc_1();
+--error ER_CANNOT_USER
+call proc_1();
+drop user pstest_xyz@localhost;
+call proc_1();
+drop user pstest_xyz@localhost;
+drop procedure proc_1;
+delimiter |;
+--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
+create function func_1() returns int begin create user pstest_xyz@localhost; return 1; end|
+delimiter ;|
+--error ER_SP_DOES_NOT_EXIST
+select func_1(), func_1(), func_1() from dual;
+--error ER_SP_DOES_NOT_EXIST
+drop function func_1;
+prepare abc from "create user pstest_xyz@localhost";
+execute abc;
+drop user pstest_xyz@localhost;
+execute abc;
+--error ER_CANNOT_USER
+execute abc;
+drop user pstest_xyz@localhost;
+execute abc;
+drop user pstest_xyz@localhost;
+deallocate prepare abc;
+
+
+--disable_warnings
+drop event if exists xyz;
+--enable_warnings
+#create procedure proc_1() create event xyz on schedule every 5 minute disable do select 123;
+#call proc_1();
+#drop event xyz;
+#call proc_1();
+#--error ER_EVENT_ALREADY_EXISTS
+#call proc_1();
+#drop event xyz;
+#call proc_1();
+#drop event xyz;
+#drop procedure proc_1;
+delimiter |;
+--error ER_EVENT_RECURSIVITY_FORBIDDEN
+create function func_1() returns int begin create event xyz on schedule at now() do select 123; return 1; end|
+delimiter ;|
+--error ER_SP_DOES_NOT_EXIST
+select func_1(), func_1(), func_1() from dual;
+--error ER_SP_DOES_NOT_EXIST
+drop function func_1;
+--error ER_UNSUPPORTED_PS
+prepare abc from "create event xyz on schedule at now() do select 123";
+--error ER_UNKNOWN_STMT_HANDLER
+deallocate prepare abc;
+
+
+--disable_warnings
+drop event if exists xyz;
+create event xyz on schedule every 5 minute disable do select 123;
+--enable_warnings
+create procedure proc_1() alter event xyz comment 'xyz';
+call proc_1();
+drop event xyz;
+create event xyz on schedule every 5 minute disable do select 123;
+call proc_1();
+drop event xyz;
+create event xyz on schedule every 5 minute disable do select 123;
+call proc_1();
+drop event xyz;
+drop procedure proc_1;
+delimiter |;
+--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
+create function func_1() returns int begin alter event xyz comment 'xyz'; return 1; end|
+delimiter ;|
+--error ER_UNSUPPORTED_PS
+prepare abc from "alter event xyz comment 'xyz'";
+--error ER_UNKNOWN_STMT_HANDLER
+deallocate prepare abc;
+
+
+--disable_warnings
+drop event if exists xyz;
+create event xyz on schedule every 5 minute disable do select 123;
+--enable_warnings
+create procedure proc_1() drop event xyz;
+call proc_1();
+create event xyz on schedule every 5 minute disable do select 123;
+call proc_1();
+--error ER_EVENT_DOES_NOT_EXIST
+call proc_1();
+drop procedure proc_1;
+delimiter |;
+--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
+create function func_1() returns int begin drop event xyz; return 1; end|
+delimiter ;|
+--error ER_UNSUPPORTED_PS
+prepare abc from "drop event xyz";
+--error ER_UNKNOWN_STMT_HANDLER
+deallocate prepare abc;
+
+
+--disable_warnings
+drop table if exists t1;
+create table t1 (a int, b char(5)) engine=myisam;
+insert into t1 values (1, "one"), (2, "two"), (3, "three");
+--enable_warnings
+SET GLOBAL new_cache.key_buffer_size=128*1024;
+create procedure proc_1() cache index t1 in new_cache;
+call proc_1();
+call proc_1();
+call proc_1();
+drop procedure proc_1;
+SET GLOBAL second_cache.key_buffer_size=128*1024;
+prepare abc from "cache index t1 in second_cache";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+drop table t1;
+
+--disable_warnings
+drop table if exists t1;
+drop table if exists t2;
+create table t1 (a int, b char(5)) engine=myisam;
+insert into t1 values (1, "one"), (2, "two"), (3, "three");
+create table t2 (a int, b char(5)) engine=myisam;
+insert into t2 values (1, "one"), (2, "two"), (3, "three");
+--enable_warnings
+create procedure proc_1() load index into cache t1 ignore leaves;
+call proc_1();
+call proc_1();
+call proc_1();
+drop procedure proc_1;
+delimiter |;
+--error ER_SP_NO_RETSET
+create function func_1() returns int begin load index into cache t1 ignore leaves; return 1; end|
+delimiter ;|
+prepare abc from "load index into cache t2 ignore leaves";
+execute abc;
+execute abc;
+execute abc;
+deallocate prepare abc;
+drop table t1, t2;
+
+#
+# Bug #21422: GRANT/REVOKE possible inside stored function, probably in a trigger
+# This is disabled for now till it is resolved in 5.0
+#
+
+#create procedure proc_1() grant all on *.* to abc@host;
+#drop procedure proc_1;
+#delimiter |;
+#--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
+#create function func_1() returns int begin grant all on *.* to abc@host; return 1; end|
+#delimiter ;|
+#prepare abc from "grant all on *.* to abc@host";
+#
+#create procedure proc_1() revoke all on *.* from abc@host;
+#drop procedure proc_1;
+#delimiter |;#--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
+#create function func_1() returns int begin revoke all on *.* from abc@host; return 1; end|
+#delimiter ;|
+#prepare abc from "revoke all on *.* from abc@host";
+
+create procedure proc_1() show errors;
+call proc_1();
+call proc_1();
+call proc_1();
+drop procedure proc_1;
+delimiter |;
+--error ER_SP_NO_RETSET
+create function func_1() returns int begin show errors; return 1; end|
+delimiter ;|
+prepare abc from "show errors";
+deallocate prepare abc;
+
+--disable_warnings
+drop table if exists t1;
+drop table if exists t2;
+--enable_warnings
+create procedure proc_1() show warnings;
+drop table if exists t1;
+call proc_1();
+drop table if exists t2;
+call proc_1();
+drop table if exists t1, t2;
+call proc_1();
+drop procedure proc_1;
+delimiter |;
+--error ER_SP_NO_RETSET
+create function func_1() returns int begin show warnings; return 1; end|
+delimiter ;|
+prepare abc from "show warnings";
+drop table if exists t1;
+execute abc;
+drop table if exists t2;
+execute abc;
+drop table if exists t1, t2;
+execute abc;
+deallocate prepare abc;
diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test
index 33b86dde9ed..4c0f411c758 100644
--- a/mysql-test/t/ps_1general.test
+++ b/mysql-test/t/ps_1general.test
@@ -321,30 +321,27 @@ prepare stmt4 from ' show status like ''Threads_running'' ';
execute stmt4;
prepare stmt4 from ' show variables like ''sql_mode'' ';
execute stmt4;
-prepare stmt4 from ' show engine bdb logs ';
-# The output depends on the history (actions of the bdb engine).
+# The output depends on the bdb being enabled and on the history
+# history (actions of the bdb engine).
# That is the reason why, we switch the output here off.
# (The real output will be tested in ps_6bdb.test)
-# --replace_result $MYSQL_TEST_DIR TEST_DIR
--disable_result_log
+prepare stmt4 from ' show engine bdb logs ';
execute stmt4;
--enable_result_log
prepare stmt4 from ' show grants for user ';
---error 1295
prepare stmt4 from ' show create table t2 ';
---error 1295
prepare stmt4 from ' show master status ';
---error 1295
prepare stmt4 from ' show master logs ';
---error 1295
prepare stmt4 from ' show slave status ';
---error 1295
prepare stmt4 from ' show warnings limit 20 ';
---error 1295
prepare stmt4 from ' show errors limit 20 ';
prepare stmt4 from ' show storage engines ';
---replace_column 2 YES/NO
+# The output depends upon the precise order in which
+# storage engines are registered, so we switch off the output.
+--disable_result_log
execute stmt4;
+--enable_result_log
################ MISC STUFF ################
## get a warning and an error
@@ -424,14 +421,12 @@ prepare stmt1 from ' execute stmt2 ' ;
prepare stmt1 from ' deallocate prepare never_prepared ' ;
## switch the database connection
---error 1295
+--error ER_UNSUPPORTED_PS
prepare stmt4 from ' use test ' ;
## create/drop database
---error 1295
prepare stmt3 from ' create database mysqltest ';
create database mysqltest ;
---error 1295
prepare stmt3 from ' drop database mysqltest ';
drop database mysqltest ;
@@ -443,12 +438,12 @@ drop table t2 ;
--error 1146
execute stmt3;
## lock/unlock
---error 1295
+--error ER_UNSUPPORTED_PS
prepare stmt3 from ' lock tables t1 read ' ;
---error 1295
+--error ER_UNSUPPORTED_PS
prepare stmt3 from ' unlock tables ' ;
## Load/Unload table contents
---error 1295
+--error ER_UNSUPPORTED_PS
prepare stmt1 from ' load data infile ''data.txt''
into table t1 fields terminated by ''\t'' ';
prepare stmt1 from ' select * into outfile ''data.txt'' from t1 ';
@@ -456,13 +451,12 @@ execute stmt1 ;
##
prepare stmt1 from ' optimize table t1 ' ;
prepare stmt1 from ' analyze table t1 ' ;
---error 1295
prepare stmt1 from ' checksum table t1 ' ;
prepare stmt1 from ' repair table t1 ' ;
---error 1295
+--error ER_UNSUPPORTED_PS
prepare stmt1 from ' restore table t1 from ''data.txt'' ' ;
## handler
---error 1295
+--error ER_UNSUPPORTED_PS
prepare stmt1 from ' handler t1 open ';
@@ -488,11 +482,8 @@ SET sql_mode=ansi;
execute stmt5;
SET sql_mode="";
---error 1295
prepare stmt1 from ' flush local privileges ' ;
---error 1295
prepare stmt1 from ' reset query cache ' ;
---error 1295
prepare stmt1 from ' KILL 0 ';
## simple explain
diff --git a/mysql-test/t/ps_6bdb.test b/mysql-test/t/ps_6bdb.test
deleted file mode 100644
index 49dd7aa924b..00000000000
--- a/mysql-test/t/ps_6bdb.test
+++ /dev/null
@@ -1,25 +0,0 @@
-###############################################
-# #
-# Prepared Statements test on BDB tables #
-# #
-###############################################
-
-#
-# NOTE: PLEASE SEE ps_1general.test (bottom)
-# BEFORE ADDING NEW TEST CASES HERE !!!
-
-use test;
-
--- source include/have_bdb.inc
-let $type= 'BDB' ;
--- source include/ps_create.inc
--- source include/ps_renew.inc
-
--- source include/ps_query.inc
--- source include/ps_modify.inc
--- source include/ps_modify1.inc
--- source include/ps_conv.inc
-
-drop table t1, t9;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/ps_grant.test b/mysql-test/t/ps_grant.test
index 22ac8675328..b25facdb418 100644
--- a/mysql-test/t/ps_grant.test
+++ b/mysql-test/t/ps_grant.test
@@ -117,15 +117,12 @@ drop database mysqltest;
#
# grant/revoke + drop user
#
---error 1295
prepare stmt3 from ' grant all on test.t1 to drop_user@localhost
identified by ''looser'' ';
grant all on test.t1 to drop_user@localhost
identified by 'looser' ;
---error 1295
prepare stmt3 from ' revoke all privileges on test.t1 from
drop_user@localhost ';
revoke all privileges on test.t1 from drop_user@localhost ;
---error 1295
prepare stmt3 from ' drop user drop_user@localhost ';
drop user drop_user@localhost;
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index d86f1a464b1..67c4c4cb20b 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -12,8 +12,12 @@ flush query cache; # This crashed in some versions
reset query cache;
flush status;
--disable_warnings
-drop table if exists t1,t2,t3,t4,t11,t21;
+drop table if exists t1,t2,t3,t4,t11,t21,t1_1,t1_2,t9,t9_1,t9_2;
drop database if exists mysqltest;
+
+# Fix possible left overs from other tests
+drop table if exists ```a`;
+drop view if exists v1;
--enable_warnings
#
@@ -203,7 +207,7 @@ show status like "Qcache_queries_in_cache";
drop table t1;
#
-# Charset convertion (cp1251_koi8 always present)
+# Charset conversion (cp1251_koi8 always present)
#
create table t1 (a char(1) not null collate koi8r_general_ci);
insert into t1 values(_koi8r"");
@@ -761,6 +765,9 @@ drop table t1;
create table t1 (a int);
insert into t1 values (1),(2);
+--disable_warnings
+drop procedure if exists p1;
+--enable_warnings
delimiter //;
CREATE PROCEDURE `p1`()
begin
diff --git a/mysql-test/t/raid.test b/mysql-test/t/raid.test
deleted file mode 100644
index 3ca5adaaaea..00000000000
--- a/mysql-test/t/raid.test
+++ /dev/null
@@ -1,224 +0,0 @@
--- require r/have_raid.require
-disable_query_log;
-show variables like "have_raid";
-enable_query_log;
-
-#
-# Test of raided tables
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1,t2;
-DROP DATABASE IF EXISTS test_$1;
---enable_warnings
-
-#
-# Test dropping database with raid tables
-#
-
-create database test_$1;
-create table test_$1.r1 (i int) raid_type=1;
-create table test_$1.r2 (i int) raid_type=1 raid_chunks=32;
-drop database test_$1;
-
-#
-# Bug #3182: Test using more than 257 raid chunks
-#
-create database test_$1;
-create table test_$1.r2 (i int) raid_type=1 raid_chunks=257;
-show create table test_$1.r2;
-drop database test_$1;
-
-#
-# Test that data is spread over different raid directories
-#
-
-CREATE TABLE t1 (
-id int unsigned not null auto_increment primary key,
-c char(255) not null
-) RAID_TYPE=STRIPED RAID_CHUNKS=2 RAID_CHUNKSIZE=123;
-INSERT INTO t1 VALUES
-(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
-(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
-(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
-(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
-(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
-(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
-(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
-(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
-(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
-(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
-(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
-(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
-(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
-(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
-(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
-INSERT INTO t1 VALUES
-(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
-(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
-(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
-(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
-(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
-(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
-(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
-(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
-(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
-(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
-(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
-(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
-(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
-(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
-(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
-INSERT INTO t1 VALUES
-(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
-(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
-(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
-(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
-(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
-(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
-(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
-(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
-(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
-(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
-(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
-(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
-(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
-(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
-(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
-INSERT INTO t1 VALUES
-(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
-(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
-(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
-(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
-(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
-(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
-(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
-(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
-(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
-(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
-(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
-(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
-(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
-(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
-(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
-INSERT INTO t1 VALUES
-(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
-(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
-(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
-(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
-(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
-(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
-(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
-(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
-(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
-(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
-(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
-(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
-(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
-(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
-(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
-select count(*) from t1;
-ALTER TABLE t1 ADD COLUMN x INT UNSIGNED NOT NULL;
-ALTER TABLE t1 ADD KEY c (c);
-ALTER TABLE t1 DROP KEY c;
-ALTER TABLE t1 DROP COLUMN x;
-ALTER TABLE t1 RENAME t2;
-select count(*) from t2;
-DROP TABLE t2;
-
-/* variable rows */
-CREATE TABLE t1 (
-id int unsigned not null auto_increment primary key,
-c varchar(255) not null
-) RAID_TYPE=STRIPED RAID_CHUNKS=5 RAID_CHUNKSIZE=121;
-INSERT INTO t1 VALUES
-(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
-(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
-(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
-(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
-(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
-(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
-(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
-(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
-(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
-(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
-(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
-(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
-(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
-(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
-(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
-INSERT INTO t1 VALUES
-(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
-(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
-(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
-(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
-(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
-(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
-(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
-(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
-(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
-(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
-(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
-(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
-(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
-(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
-(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
-INSERT INTO t1 VALUES
-(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
-(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
-(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
-(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
-(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
-(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
-(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
-(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
-(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
-(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
-(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
-(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
-(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
-(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
-(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
-INSERT INTO t1 VALUES
-(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
-(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
-(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
-(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
-(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
-(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
-(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
-(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
-(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
-(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
-(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
-(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
-(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
-(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
-(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
-INSERT INTO t1 VALUES
-(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'),
-(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'),
-(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'),
-(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'),
-(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'),
-(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'),
-(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'),
-(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'),
-(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'),
-(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'),
-(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'),
-(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'),
-(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'),
-(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'),
-(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a');
-select count(*) from t1;
-ALTER TABLE t1 ADD COLUMN x INT UNSIGNED NOT NULL;
-ALTER TABLE t1 ADD KEY c (c);
-ALTER TABLE t1 DROP KEY c;
-ALTER TABLE t1 DROP COLUMN x;
-ALTER TABLE t1 RENAME t2;
-ALTER TABLE t2 CHANGE COLUMN c c VARCHAR(251) NOT NULL;
-select count(*) from t2;
-DROP TABLE t2;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index 5a146bbcf86..400e28c3e28 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -370,7 +370,7 @@ insert into t2(uid, name) values
(25, CHAR(64+25)),
(26, CHAR(64+26));
-insert into t1(uid, name) select uid, name from t2;
+insert into t1(uid, name) select uid, name from t2 order by uid;
delete from t2;
insert into t2(id, uid, name) select id, uid, name from t1;
@@ -750,3 +750,30 @@ SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00';
DROP TABLE t1;
# End of 5.0 tests
+
+# BUG#22393 fix: Adjust 'ref' estimate if we have 'range' estimate for
+# a smaller scan interval
+create table t1 (a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table t2 (a int, b int, filler char(100));
+insert into t2 select A.a + 10 * (B.a + 10 * C.a), 10, 'filler' from t1 A,
+t1 B, t1 C where A.a < 5;
+
+insert into t2 select 1000, b, 'filler' from t2;
+alter table t2 add index (a,b);
+# t2 values
+# ( 1 , 10, 'filler')
+# ( 2 , 10, 'filler')
+# ( 3 , 10, 'filler')
+# (... , 10, 'filler')
+# ...
+# (1000, 10, 'filler') - 500 times
+
+# 500 rows, 1 row
+
+select 'In following EXPLAIN the access method should be ref, #rows~=500 (and not 2)' Z;
+explain select * from t2 where a=1000 and b<11;
+
+drop table t1, t2;
+
diff --git a/mysql-test/t/read_many_rows_innodb.test b/mysql-test/t/read_many_rows_innodb.test
new file mode 100644
index 00000000000..ed86275447f
--- /dev/null
+++ b/mysql-test/t/read_many_rows_innodb.test
@@ -0,0 +1,17 @@
+# t/read_many_rows_innodb.test
+#
+# Check how filesort and buffered-record-reads works with InnoDB.
+# This test takes a long time.
+#
+# Last update:
+# 2006-08-03 ML test refactored (MySQL 5.1)
+# main code --> include/read_many_rows_innodb.inc
+#
+
+--source include/big_test.inc
+
+--source include/have_innodb.inc
+let $engine_type= InnoDB;
+let $other_engine_type= MyISAM;
+
+--source include/read_many_rows.inc
diff --git a/mysql-test/t/renamedb.test b/mysql-test/t/renamedb.test
new file mode 100644
index 00000000000..1e71adb3bf3
--- /dev/null
+++ b/mysql-test/t/renamedb.test
@@ -0,0 +1,26 @@
+--disable_warnings
+drop database if exists testdb1;
+--enable_warnings
+
+create database testdb1 default character set latin2;
+use testdb1;
+create table t1 (a int);
+insert into t1 values (1),(2),(3);
+show create database testdb1;
+show tables;
+rename database testdb1 to testdb2;
+--error 1049
+show create database testdb1;
+show create database testdb2;
+select database();
+show tables;
+select a from t1 order by a;
+drop database testdb2;
+
+#
+# Bug#19392 Rename Database: Crash if case change
+#
+create database testdb1;
+--error 1007
+rename database testdb1 to testdb1;
+drop database testdb1;
diff --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test
index f2e4c328218..6ef21cde465 100644
--- a/mysql-test/t/repair.test
+++ b/mysql-test/t/repair.test
@@ -84,3 +84,16 @@ SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
DROP TABLE t1;
# End of 4.1 tests
+# End of 5.0 tests
+
+#
+# Bug#18775 - Temporary table from alter table visible to other threads
+#
+# REPAIR TABLE ... USE_FRM on temporary table crashed the table or server.
+--disable_warnings
+DROP TABLE IF EXISTS tt1;
+--enable_warnings
+CREATE TEMPORARY TABLE tt1 (c1 INT);
+REPAIR TABLE tt1 USE_FRM;
+DROP TABLE tt1;
+
diff --git a/mysql-test/t/rowid_order_innodb.test b/mysql-test/t/rowid_order_innodb.test
index fb4959d78e6..152eb28d388 100644
--- a/mysql-test/t/rowid_order_innodb.test
+++ b/mysql-test/t/rowid_order_innodb.test
@@ -1,108 +1,14 @@
+# t/rowid_order_innodb.test
#
# Test for rowid ordering (and comparison) functions.
# do index_merge select for tables with PK of various types.
#
---disable_warnings
-drop table if exists t1, t2, t3,t4;
---enable_warnings
-
--- source include/have_innodb.inc
-
-# Signed number as rowid
-create table t1 (
- pk1 int not NULL,
- key1 int(11),
- key2 int(11),
- PRIMARY KEY (pk1),
- KEY key1 (key1),
- KEY key2 (key2)
-) engine=innodb;
-insert into t1 values (-5, 1, 1),
- (-100, 1, 1),
- (3, 1, 1),
- (0, 1, 1),
- (10, 1, 1);
-explain select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
-select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
-drop table t1;
-
-# Unsigned numbers as rowids
-create table t1 (
- pk1 int unsigned not NULL,
- key1 int(11),
- key2 int(11),
- PRIMARY KEY (pk1),
- KEY key1 (key1),
- KEY key2 (key2)
-) engine=innodb;
-insert into t1 values (0, 1, 1),
- (0xFFFFFFFF, 1, 1),
- (0xFFFFFFFE, 1, 1),
- (1, 1, 1),
- (2, 1, 1);
-select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
-drop table t1;
-
-# Case-insensitive char(N)
-create table t1 (
- pk1 char(4) not NULL,
- key1 int(11),
- key2 int(11),
- PRIMARY KEY (pk1),
- KEY key1 (key1),
- KEY key2 (key2)
-) engine=innodb collate latin2_general_ci;
-insert into t1 values ('a1', 1, 1),
- ('b2', 1, 1),
- ('A3', 1, 1),
- ('B4', 1, 1);
-select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
-drop table t1;
-
-# Multi-part PK
-create table t1 (
- pk1 int not NULL,
- pk2 char(4) not NULL collate latin1_german1_ci,
- pk3 char(4) not NULL collate latin1_bin,
- key1 int(11),
- key2 int(11),
- PRIMARY KEY (pk1,pk2,pk3),
- KEY key1 (key1),
- KEY key2 (key2)
-) engine=innodb;
-insert into t1 values
- (1, 'u', 'u', 1, 1),
- (1, 'u', char(0xEC), 1, 1),
- (1, 'u', 'x', 1, 1);
-insert ignore into t1 select pk1, char(0xEC), pk3, key1, key2 from t1;
-insert ignore into t1 select pk1, 'x', pk3, key1, key2 from t1 where pk2='u';
-insert ignore into t1 select 2, pk2, pk3, key1, key2 from t1;
-select * from t1;
-select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
-
-# Hidden PK
-alter table t1 drop primary key;
-select * from t1;
-select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
-drop table t1;
-
-# Variable-length PK
-# this is also test for Bug#2688
-create table t1 (
- pk1 varchar(8) NOT NULL default '',
- pk2 varchar(4) NOT NULL default '',
- key1 int(11),
- key2 int(11),
- primary key(pk1, pk2),
- KEY key1 (key1),
- KEY key2 (key2)
-) engine=innodb;
-insert into t1 values ('','empt',2,2),
- ('a','a--a',2,2),
- ('bb','b--b',2,2),
- ('ccc','c--c',2,2),
- ('dddd','d--d',2,2);
-select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
+# Last update:
+# 2006-07-28 ML test refactored (MySQL 5.1)
+# main code t/rowid_order_innodb.test -> include/rowid_order.inc
+#
-drop table t1;
+--source include/have_innodb.inc
+let $engine_type= InnoDB;
+--source include/rowid_order.inc
diff --git a/mysql-test/t/rpl000004.test b/mysql-test/t/rpl000004.test
deleted file mode 100644
index 9c8c535c67d..00000000000
--- a/mysql-test/t/rpl000004.test
+++ /dev/null
@@ -1,25 +0,0 @@
-source include/master-slave.inc;
-
-set SQL_LOG_BIN=0;
-create table t1 (word char(20) not null, index(word));
-load data infile '../std_data_ln/words.dat' into table t1;
-create table t2 (word char(20) not null);
-load data infile '../std_data_ln/words.dat' into table t2;
-create table t3 (word char(20) not null primary key);
-connection slave;
-load table t1 from master;
-load table t2 from master;
-load table t3 from master;
-check table t1;
-select count(*) from t2;
-select count(*) from t3;
-connection master;
-set SQL_LOG_BIN=1;
-drop table if exists t1,t2,t3;
-save_master_pos;
-connection slave;
-sync_with_master;
-create table t1(n int);
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl000005.test b/mysql-test/t/rpl000005.test
deleted file mode 100644
index e81ad739402..00000000000
--- a/mysql-test/t/rpl000005.test
+++ /dev/null
@@ -1,24 +0,0 @@
-source include/master-slave.inc;
-
-#
-# Bug#7100 relay_log_space_max missing from SHOW VARIABLES
-#
-SHOW VARIABLES LIKE 'relay_log_space_limit';
-
-CREATE TABLE t1 (name varchar(64), age smallint(3));
-INSERT INTO t1 SET name='Andy', age=31;
-INSERT t1 SET name='Jacob', age=2;
-INSERT into t1 SET name='Caleb', age=1;
-ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY;
-select * from t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from t1;
-connection master;
-drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl000006.test b/mysql-test/t/rpl000006.test
deleted file mode 100644
index 334ed575835..00000000000
--- a/mysql-test/t/rpl000006.test
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# Test forced timestamp
-#
-source include/master-slave.inc;
-
-# Don't log table creating to the slave as we want to test LOAD TABLE
-set SQL_LOG_BIN=0,timestamp=200006;
-create table t1(t timestamp not null,a char(1));
-insert into t1 ( a) values ('F');
-select unix_timestamp(t) from t1;
-connection slave;
-load table t1 from master;
-select unix_timestamp(t) from t1;
-
-# Delete the created table on master and slave
-connection master;
-set SQL_LOG_BIN=1,timestamp=default;
-drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-connection master;
-
-#
-# Test copying table with checksum
-#
-
-# Don't log table creating to the slave as we want to test LOAD TABLE
-set SQL_LOG_BIN=0;
-
-CREATE TABLE t1 (
- a int not null
-) ENGINE=MyISAM MAX_ROWS=4000 CHECKSUM=1;
-INSERT INTO t1 VALUES (1);
-save_master_pos;
-connection slave;
-sync_with_master;
-load table t1 from master;
-check table t1;
-drop table t1;
-connection master;
-drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl000013-slave.opt b/mysql-test/t/rpl000013-slave.opt
deleted file mode 100644
index 2662c695b41..00000000000
--- a/mysql-test/t/rpl000013-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---abort-slave-event-count=1
diff --git a/mysql-test/t/rpl000013.test b/mysql-test/t/rpl000013.test
index eca4803c6bc..69a102e84ce 100644
--- a/mysql-test/t/rpl000013.test
+++ b/mysql-test/t/rpl000013.test
@@ -1,3 +1,13 @@
+# This test is to verify that DROP TEMPORARY TABLE
+# is automatically binlogged and sent to slave
+# when a temp table is dropped by disconnection
+# of a master's conection.
+# So it does not apply to row-based, where we neither need
+# nor do this automatic binlogging. And if we run this test
+# in row-based, it hangs waiting for an offset which is never
+# reached (the "sync_with_master 1"), logically.
+
+--source include/have_binlog_format_mixed_or_statement.inc
source include/master-slave.inc;
save_master_pos;
connection slave;
diff --git a/mysql-test/t/rpl000017.test b/mysql-test/t/rpl000017.test
index 866b7fd1c25..2ba321cd8c3 100644
--- a/mysql-test/t/rpl000017.test
+++ b/mysql-test/t/rpl000017.test
@@ -1,7 +1,7 @@
-connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
-connect (slave,localhost,root,,test,$SLAVE_MYPORT,slave.sock);
+source include/master-slave.inc;
+connection slave;
+stop slave;
connection master;
-reset master;
grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab';
grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab';
connection slave;
diff --git a/mysql-test/t/rpl000015-slave.sh b/mysql-test/t/rpl_000015-slave.sh
index 7deeca3d2d6..7deeca3d2d6 100755
--- a/mysql-test/t/rpl000015-slave.sh
+++ b/mysql-test/t/rpl_000015-slave.sh
diff --git a/mysql-test/t/rpl000015.slave-mi b/mysql-test/t/rpl_000015.slave-mi
index 28bc753dd56..28bc753dd56 100644
--- a/mysql-test/t/rpl000015.slave-mi
+++ b/mysql-test/t/rpl_000015.slave-mi
diff --git a/mysql-test/t/rpl000015.test b/mysql-test/t/rpl_000015.test
index df4bf6f977b..cf93beb2bfe 100644
--- a/mysql-test/t/rpl000015.test
+++ b/mysql-test/t/rpl_000015.test
@@ -1,3 +1,9 @@
+#####################
+# Change Author: JBM
+# Change Date: 2006-01-17
+# Change: added order by in select
+#####################
+
connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connect (slave,localhost,root,,test,$SLAVE_MYPORT,slave.sock);
connection master;
@@ -30,12 +36,12 @@ connection master;
--disable_warnings
drop table if exists t1;
--enable_warnings
-create table t1 (n int);
+create table t1 (n int, PRIMARY KEY(n));
insert into t1 values (10),(45),(90);
sync_slave_with_master;
-select * from t1;
+connection slave;
+SELECT * FROM t1 ORDER BY n;
connection master;
+SELECT * FROM t1 ORDER BY n;
drop table t1;
sync_slave_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl_EE_err.test b/mysql-test/t/rpl_EE_err.test
new file mode 100644
index 00000000000..6d064ae3197
--- /dev/null
+++ b/mysql-test/t/rpl_EE_err.test
@@ -0,0 +1,7 @@
+########################################################
+# By JBM 2006-02-14 Wrapped to share test code between #
+# engines. Added to skip test when NDB is default #
+########################################################
+-- source include/not_ndb_default.inc
+let $engine_type=myisam;
+-- source extra/rpl_tests/rpl_EE_err.test
diff --git a/mysql-test/t/rpl_EE_error.test b/mysql-test/t/rpl_EE_error.test
deleted file mode 100644
index 640a2b1a88c..00000000000
--- a/mysql-test/t/rpl_EE_error.test
+++ /dev/null
@@ -1,32 +0,0 @@
-# See if an EE_ error in one event of the master's binlog stops replication
-# (it should not: in this configuration the EE_ error is probably not
-# critical). Example: you do a DROP TABLE on a table which has no MYI file
-# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and
-# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986).
-
-source include/master-slave.inc;
-
-create table t1 (a int) engine=myisam;
-flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
-drop table if exists t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# Now a real error.
-
-connection master;
-create table t1 (a int, unique(a)) engine=myisam;
-set sql_log_bin=0;
-insert into t1 values(2);
-set sql_log_bin=1;
-save_master_pos;
---error 1062
-insert into t1 values(1),(2);
-drop table t1;
-save_master_pos;
-connection slave;
-wait_for_slave_to_stop;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl_LD_INFILE.test b/mysql-test/t/rpl_LD_INFILE.test
new file mode 100644
index 00000000000..bace5d4c1f5
--- /dev/null
+++ b/mysql-test/t/rpl_LD_INFILE.test
@@ -0,0 +1,38 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/18/2005 #
+#############################################################################
+# TEST: To test the LOAD DATA INFILE in rbr #
+#############################################################################
+
+# Includes
+-- source include/master-slave.inc
+
+# Begin clean up test section
+--disable_warnings
+connection master;
+DROP TABLE IF EXISTS test.t1;
+--enable_warnings
+
+# Section 1 test
+CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a));
+LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1;
+DELETE FROM test.t1 WHERE a = 'abashed';
+DELETE FROM test.t1;
+LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1;
+
+
+SELECT * FROM test.t1 ORDER BY a DESC;
+save_master_pos;
+sync_slave_with_master;
+connection slave;
+SELECT * FROM test.t1 ORDER BY a DESC;
+
+# Cleanup
+#show binlog events;
+connection master;
+DROP TABLE test.t1;
+sync_slave_with_master;
+
+# End of 5.0 test case
+
diff --git a/mysql-test/t/rpl_alter_db.test b/mysql-test/t/rpl_alter_db.test
new file mode 100644
index 00000000000..5ac8a2f4018
--- /dev/null
+++ b/mysql-test/t/rpl_alter_db.test
@@ -0,0 +1,10 @@
+source include/master-slave.inc;
+connection master;
+use mysql; # to be different from initial `test' db of mysqltest client
+alter database collate latin1_bin;
+save_master_pos;
+
+connection slave;
+sync_with_master;
+
+
diff --git a/mysql-test/t/rpl_auto_increment-slave.opt b/mysql-test/t/rpl_auto_increment-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_auto_increment-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_auto_increment.test b/mysql-test/t/rpl_auto_increment.test
index caa2b79feb5..19770ffbdc0 100644
--- a/mysql-test/t/rpl_auto_increment.test
+++ b/mysql-test/t/rpl_auto_increment.test
@@ -1,142 +1,12 @@
-#
-# Test of auto_increment with offset
-#
-source include/have_innodb.inc;
-source include/master-slave.inc;
-
-create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam auto_increment=3;
-insert into t1 values (NULL,1),(NULL,2),(NULL,3);
-select * from t1;
-
-sync_slave_with_master;
-select * from t1;
-connection master;
-drop table t1;
-
-create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam;
-insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4);
-delete from t1 where b=4;
-insert into t1 values (NULL,5),(NULL,6);
-select * from t1;
-
-sync_slave_with_master;
-select * from t1;
-connection master;
-
-drop table t1;
-
-set @@session.auto_increment_increment=100, @@session.auto_increment_offset=10;
-show variables like "%auto_inc%";
-
-create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
-# Insert with 2 insert statements to get better testing of logging
-insert into t1 values (NULL),(5),(NULL);
-insert into t1 values (250),(NULL);
-select * from t1;
-insert into t1 values (1000);
-set @@insert_id=400;
-insert into t1 values(NULL),(NULL);
-select * from t1;
-
-sync_slave_with_master;
-select * from t1;
-connection master;
-drop table t1;
-
-#
-# Same test with innodb (as the innodb code is a bit different)
-#
-create table t1 (a int not null auto_increment, primary key (a)) engine=innodb;
-# Insert with 2 insert statements to get better testing of logging
-insert into t1 values (NULL),(5),(NULL);
-insert into t1 values (250),(NULL);
-select * from t1;
-insert into t1 values (1000);
-set @@insert_id=400;
-insert into t1 values(NULL),(NULL);
-select * from t1;
-
-sync_slave_with_master;
-select * from t1;
-connection master;
-drop table t1;
-
-set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
-create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
-# Insert with 2 insert statements to get better testing of logging
-insert into t1 values (NULL),(5),(NULL),(NULL);
-insert into t1 values (500),(NULL),(502),(NULL),(NULL);
-select * from t1;
-set @@insert_id=600;
---error 1062
-insert into t1 values(600),(NULL),(NULL);
-set @@insert_id=600;
-insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL);
-select * from t1;
-
-sync_slave_with_master;
-select * from t1;
-connection master;
-drop table t1;
-
-#
-# Test that auto-increment works when slave has rows in the table
-#
-set @@session.auto_increment_increment=10, @@session.auto_increment_offset=1;
-
-create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
-
-sync_slave_with_master;
-insert into t1 values(2),(12),(22),(32),(42);
-connection master;
-
-insert into t1 values (NULL),(NULL);
-insert into t1 values (3),(NULL),(NULL);
-select * from t1;
-
-sync_slave_with_master;
-select * from t1;
-
-# Test for BUG#20524 "auto_increment_* not observed when inserting
-# a too large value". When an autogenerated value was bigger than the
-# maximum possible value of the field, it was truncated to that max
-# possible value, without being "rounded down" to still honour
-# auto_increment_* variables.
-
-connection master;
-drop table t1;
-create table t1 (a tinyint not null auto_increment primary key) engine=myisam;
-insert into t1 values(103);
-set auto_increment_increment=11;
-set auto_increment_offset=4;
-insert into t1 values(null);
-insert into t1 values(null);
---error 1062
-insert into t1 values(null);
-select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t1 order by a;
-
-# same but with a larger value
-create table t2 (a tinyint unsigned not null auto_increment primary key) engine=myisam;
-set auto_increment_increment=10;
-set auto_increment_offset=1;
-set insert_id=1000;
-insert into t2 values(null);
-select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t2 order by a;
-
-# An offset so big that even first value does not fit
-create table t3 like t1;
-set auto_increment_increment=1000;
-set auto_increment_offset=700;
-insert into t3 values(null);
-select * from t3 order by a;
-sync_slave_with_master;
-select * from t1 order by a;
-select * from t2 order by a;
-select * from t3 order by a;
-
-connection master;
-
-drop table t1,t2,t3;
-
-# End cleanup
-sync_slave_with_master;
+#####################################
+# Wrapper for rpl_auto_increment.test#
+#####################################
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/not_ndb_default.inc
+-- source include/have_innodb.inc
+let $engine_type=innodb;
+let $engine_type2=myisam;
+-- source extra/rpl_tests/rpl_auto_increment.test
diff --git a/mysql-test/t/rpl_bit.test b/mysql-test/t/rpl_bit.test
new file mode 100644
index 00000000000..07b0778296c
--- /dev/null
+++ b/mysql-test/t/rpl_bit.test
@@ -0,0 +1,94 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Sept/15/2005 #
+#############################################################################
+# Test: To test the replication of the bit field #
+#############################################################################
+# Change Author: JBM
+# Change Date: 2006-01-16
+# Change: Added Order by for NDB
+##########
+
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS test.t1;
+--enable_warnings
+# End of cleanup
+
+# Begin test section 1
+
+CREATE TABLE test.t1 (
+ dummyKey INTEGER NOT NULL,
+ f01 TINYINT,
+ f10 TINYINT,
+ f12 TINYINT,
+ f15 TINYINT,
+ f16 TINYINT,
+ f7 TINYINT,
+ f9 TINYINT,
+ f29 TINYINT,
+ f0 TINYINT,
+ fA1 TINYINT,
+ C32 TINYINT,
+ A42 TINYINT,
+ CA3 TINYINT,
+ A044 TINYINT,
+ f001 TINYINT,
+ A3002 TINYINT,
+ fC003 TINYINT,
+ CA300 TINYINT,
+ A305 TINYINT,
+ CA321 TINYINT,
+ r001 TINYINT,
+ bit1 BIT(6),
+ bit2 BIT(6),
+ bit3 BIT(6),
+ State1 TINYINT,
+ State2 TINYINT,
+ State3 TINYINT,
+ State4 TINYINT,
+ SubState TINYINT,
+ gState TINYINT,
+ oSupp TINYINT,
+ tSupp TINYINT,
+ sSuppD TINYINT,
+ mSuppf TINYINT,
+ GSuppDf TINYINT,
+ VNotSupp TINYINT,
+ x034 TINYINT,
+PRIMARY KEY USING HASH (dummyKey) );
+
+LOCK TABLES test.t1 WRITE;
+INSERT INTO test.t1 VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'111110',b'110101',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'100100',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'101010',b'010101',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'101010',b'111111',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+UNLOCK TABLES;
+
+
+SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1;
+SELECT hex(bit1) FROM test.t1 ORDER BY bit1;
+SELECT hex(bit2) from test.t1 ORDER BY bit2;
+SELECT hex(bit3) from test.t1 ORDER BY bit3;
+save_master_pos;
+
+connection slave;
+sync_with_master;
+SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1;
+SELECT hex(bit1) FROM test.t1 ORDER BY bit1;
+SELECT hex(bit2) from test.t1 ORDER BY bit2;
+SELECT hex(bit3) from test.t1 ORDER BY bit3;
+
+connection master;
+DROP TABLE IF EXISTS test.t1;
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_bit_npk.test b/mysql-test/t/rpl_bit_npk.test
new file mode 100644
index 00000000000..12b587919f9
--- /dev/null
+++ b/mysql-test/t/rpl_bit_npk.test
@@ -0,0 +1,116 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Sept/15/2005 #
+#############################################################################
+# Test: To test the replication of the bit field #
+#############################################################################
+
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS test.t1;
+--enable_warnings
+# End of cleanup
+
+# Begin test section 1
+
+CREATE TABLE test.t1 (
+ dummyKey INTEGER NOT NULL,
+ f01 TINYINT,
+ f10 TINYINT,
+ f12 TINYINT,
+ f15 TINYINT,
+ f16 TINYINT,
+ f7 TINYINT,
+ f9 TINYINT,
+ f29 TINYINT,
+ f0 TINYINT,
+ fA1 TINYINT,
+ C32 TINYINT,
+ A42 TINYINT,
+ CA3 TINYINT,
+ A044 TINYINT,
+ f001 TINYINT,
+ A3002 TINYINT,
+ fC003 TINYINT,
+ CA300 TINYINT,
+ A305 TINYINT,
+ CA321 TINYINT,
+ r001 TINYINT,
+ bit1 BIT(6),
+ bit2 BIT(6),
+ bit3 BIT(6),
+ State1 TINYINT,
+ State2 TINYINT,
+ State3 TINYINT,
+ State4 TINYINT,
+ SubState TINYINT,
+ gState TINYINT,
+ oSupp TINYINT,
+ tSupp TINYINT,
+ sSuppD TINYINT,
+ mSuppf TINYINT,
+ GSuppDf TINYINT,
+ VNotSupp TINYINT,
+ x034 TINYINT);
+
+LOCK TABLES test.t1 WRITE;
+INSERT INTO test.t1 VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'111110',b'110101',4,5,5,5,5,5,5,5,5,5,3,NULL,1);
+INSERT INTO test.t1 VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'100100',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'101010',b'010101',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'101010',b'111111',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'0',1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+UNLOCK TABLES;
+
+UPDATE test.t1 set x034 = 50 where bit3 = b'000000';
+UPDATE test.t1 set VNotSupp = 33 where bit1 = b'0';
+SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034
+ FROM test.t1
+ ORDER BY oSupp, sSuppD, GSuppDf, VNotSupp, x034;
+SELECT hex(bit1) from test.t1 ORDER BY bit1;
+SELECT hex(bit2) from test.t1 ORDER BY bit2;
+SELECT hex(bit3) from test.t1 ORDER BY bit3;
+save_master_pos;
+
+connection slave;
+sync_with_master;
+SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034
+ FROM test.t1
+ ORDER BY oSupp, sSuppD, GSuppDf, VNotSupp, x034;
+SELECT hex(bit1) from test.t1 ORDER BY bit1;
+SELECT hex(bit2) from test.t1 ORDER BY bit2;
+SELECT hex(bit3) from test.t1 ORDER BY bit3;
+
+connection master;
+CREATE TABLE test.t2 (a INT, b BIT(1));
+INSERT INTO test.t2 VALUES (1, b'0');
+INSERT INTO test.t2 VALUES (1, b'1');
+UPDATE test.t2 SET a = 2 WHERE b = b'1';
+
+CREATE TABLE test.t3 (a INT, b INT);
+INSERT INTO test.t3 VALUES (1, NULL);
+INSERT INTO test.t3 VALUES (1, 0);
+UPDATE test.t3 SET a = 2 WHERE b = 0;
+
+SELECT a, hex(b) FROM test.t2 ORDER BY a,b;
+SELECT * FROM test.t3 ORDER BY a,b;
+save_master_pos;
+
+connection slave;
+sync_with_master;
+SELECT a, hex(b) FROM test.t2 ORDER BY a,b;
+SELECT * FROM test.t3 ORDER BY a,b;
+
+connection master;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_change_master.test b/mysql-test/t/rpl_change_master.test
index 6c055a81ceb..c031464c95e 100644
--- a/mysql-test/t/rpl_change_master.test
+++ b/mysql-test/t/rpl_change_master.test
@@ -19,11 +19,11 @@ 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 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 7 # 8 # 9 # 23 # 33 #
show slave status;
change master to master_user='root';
--replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 7 # 8 # 9 # 23 # 33 #
show slave status;
start slave;
sync_with_master;
diff --git a/mysql-test/t/rpl_commit_after_flush.test b/mysql-test/t/rpl_commit_after_flush.test
index 6129e5485a6..7a924ddb11e 100644
--- a/mysql-test/t/rpl_commit_after_flush.test
+++ b/mysql-test/t/rpl_commit_after_flush.test
@@ -1,19 +1,11 @@
-source include/master-slave.inc;
-source include/have_innodb.inc;
-create table t1 (a int) engine=innodb;
-begin;
-insert into t1 values(1);
-flush tables with read lock;
-commit;
-save_master_pos;
-connection slave;
-sync_with_master;
-# cleanup
-connection master;
-unlock tables;
-drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
+#####################################
+# Wrapper for rpl_commit_after_flush#
+#####################################
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/not_ndb_default.inc
+-- source include/have_innodb.inc
+let $engine_type=innodb;
+-- source extra/rpl_tests/rpl_commit_after_flush.test
diff --git a/mysql-test/t/rpl_create_database.test b/mysql-test/t/rpl_create_database.test
index cfccc4567b5..70cff8daca2 100644
--- a/mysql-test/t/rpl_create_database.test
+++ b/mysql-test/t/rpl_create_database.test
@@ -55,14 +55,13 @@ CREATE DATABASE mysqltest_sisyfos;
USE mysqltest_sisyfos;
CREATE TABLE t2 (a INT);
let $VERSION=`select version()`;
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
-SHOW BINLOG EVENTS;
SHOW DATABASES;
sync_slave_with_master;
SHOW DATABASES;
-SHOW CREATE TABLE mysqltest_prometheus.t1;
-SHOW CREATE TABLE mysqltest_sisyfos.t2;
+USE mysqltest_prometheus;
+SHOW TABLES;
+USE mysqltest_sisyfos;
+SHOW TABLES;
connection master;
DROP DATABASE IF EXISTS mysqltest_prometheus;
diff --git a/mysql-test/t/rpl_ddl.test b/mysql-test/t/rpl_ddl.test
index d2a41a305b6..ca1c25c5f09 100644
--- a/mysql-test/t/rpl_ddl.test
+++ b/mysql-test/t/rpl_ddl.test
@@ -24,487 +24,11 @@
#
# 3. The assignment of the DDL command to be tested to $my_stmt can
# be a bit difficult. "'" must be avoided, because the test
-# routine "include/rpl_stmt_seq.inc" performs a
+# routine "include/rpl_stmt_seq.inc" performs a
# eval SELECT CONCAT('######## ','$my_stmt',' ########') as "";
#
-
+--source include/not_ndb_default.inc
--source include/have_innodb.inc
--source include/master-slave.inc
-
-###############################################################
-# Some preparations
-###############################################################
-# The sync_slave_with_master is needed to make the xids deterministic.
-sync_slave_with_master;
-connection master;
-
-SET AUTOCOMMIT = 1;
-#
-# 1. DROP all objects, which probably already exist, but must be created here
-#
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1;
-DROP DATABASE IF EXISTS mysqltest2;
-DROP DATABASE IF EXISTS mysqltest3;
---enable_warnings
-#
-# 2. CREATE all objects needed
-# working database is mysqltest1
-# working (transactional!) is mysqltest1.t1
-#
-CREATE DATABASE mysqltest1;
-CREATE DATABASE mysqltest2;
-CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE= "InnoDB";
-INSERT INTO mysqltest1.t1 SET f1= 0;
-CREATE TABLE mysqltest1.t2 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t3 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t4 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t5 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t6 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE INDEX my_idx6 ON mysqltest1.t6(f1);
-CREATE TABLE mysqltest1.t7 (f1 BIGINT) ENGINE= "InnoDB";
-INSERT INTO mysqltest1.t7 SET f1= 0;
-CREATE TABLE mysqltest1.t8 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t9 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t10 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t11 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t12 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t13 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t14 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t15 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t16 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t17 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t18 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TABLE mysqltest1.t19 (f1 BIGINT) ENGINE= "InnoDB";
-CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT);
-
-#
-# 3. master sessions: never do AUTOCOMMIT
-# slave sessions: never do AUTOCOMMIT
-#
-SET AUTOCOMMIT = 0;
-use mysqltest1;
-sync_slave_with_master;
-connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
-SET AUTOCOMMIT = 0;
-use mysqltest1;
-connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
-
-
-# We don't want to abort the whole test if one statement sent
-# to the server gets an error, because the following test
-# sequences are nearly independend of the previous statements.
---disable_abort_on_error
-
-###############################################################
-# Banal case: (explicit) COMMIT and ROLLBACK
-# Just for checking if the test sequence is usable
-###############################################################
-
-let $my_stmt= COMMIT;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-
-let $my_stmt= ROLLBACK;
-let $my_master_commit= false;
-let $my_slave_commit= false;
---source include/rpl_stmt_seq.inc
-
-###############################################################
-# Cases with commands very similar to COMMIT
-###############################################################
-
-let $my_stmt= SET AUTOCOMMIT=1;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SET AUTOCOMMIT=0;
-
-let $my_stmt= START TRANSACTION;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-
-let $my_stmt= BEGIN;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-
-###############################################################
-# Cases with (BASE) TABLES and (UPDATABLE) VIEWs
-###############################################################
-
-let $my_stmt= DROP TABLE mysqltest1.t2;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SHOW TABLES LIKE 't2';
-connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
-SHOW TABLES LIKE 't2';
-connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
-
-# Note: Since this test is executed with a skip-innodb slave, the
-# slave incorrectly commits the insert. One can *not* have InnoDB on
-# master and MyISAM on slave and expect that a transactional rollback
-# after a CREATE TEMPORARY TABLE should work correctly on the slave.
-# For this to work properly the handler on the slave must be able to
-# handle transactions (e.g. InnoDB or NDB).
-let $my_stmt= DROP TEMPORARY TABLE mysqltest1.t23;
-let $my_master_commit= false;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SHOW TABLES LIKE 't23';
-connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
-SHOW TABLES LIKE 't23';
-connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
-
-let $my_stmt= RENAME TABLE mysqltest1.t3 to mysqltest1.t20;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SHOW TABLES LIKE 't20';
-connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
-SHOW TABLES LIKE 't20';
-connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
-
-let $my_stmt= ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-describe mysqltest1.t4;
-connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
-describe mysqltest1.t4;
-connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
-
-let $my_stmt= CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= "InnoDB";
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-
-# Note: Since this test is executed with a skip-innodb slave, the
-# slave incorrectly commits the insert. One can *not* have InnoDB on
-# master and MyISAM on slave and expect that a transactional rollback
-# after a CREATE TEMPORARY TABLE should work correctly on the slave.
-# For this to work properly the handler on the slave must be able to
-# handle transactions (e.g. InnoDB or NDB).
-let $my_stmt= CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT);
-let $my_master_commit= false;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-
-let $my_stmt= TRUNCATE TABLE mysqltest1.t7;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SELECT * FROM mysqltest1.t7;
-connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
-SELECT * FROM mysqltest1.t7;
-connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
-
-###############################################################
-# Cases with LOCK/UNLOCK
-###############################################################
-
-# MySQL insists in locking mysqltest1.t1, because rpl_stmt_seq performs an
-# INSERT into this table.
-let $my_stmt= LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-UNLOCK TABLES;
-
-# No prior locking
-let $my_stmt= UNLOCK TABLES;
-let $my_master_commit= false;
-let $my_slave_commit= false;
---source include/rpl_stmt_seq.inc
-
-# With prior read locking
-# Note that this test generate an error since the rpl_stmt_seq.inc
-# tries to insert into t1.
-LOCK TABLES mysqltest1.t1 READ;
-let $my_stmt= UNLOCK TABLES;
-let $my_master_commit= false;
-let $my_slave_commit= false;
---source include/rpl_stmt_seq.inc
-
-# With prior write locking
-LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ;
-let $my_stmt= UNLOCK TABLES;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-
-###############################################################
-# Cases with INDEXES
-###############################################################
-
-let $my_stmt= DROP INDEX my_idx6 ON mysqltest1.t6;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SHOW INDEX FROM mysqltest1.t6;
-connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
-SHOW INDEX FROM mysqltest1.t6;
-connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
-
-let $my_stmt= CREATE INDEX my_idx5 ON mysqltest1.t5(f1);
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SHOW INDEX FROM mysqltest1.t5;
-connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
-SHOW INDEX FROM mysqltest1.t5;
-connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
-
-###############################################################
-# Cases with DATABASE
-###############################################################
-
-let $my_stmt= DROP DATABASE mysqltest2;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SHOW DATABASES LIKE "mysqltest2";
-connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
-SHOW DATABASES LIKE "mysqltest2";
-connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
-
-let $my_stmt= CREATE DATABASE mysqltest3;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SHOW DATABASES LIKE "mysqltest3";
-connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
-SHOW DATABASES LIKE "mysqltest3";
-connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
-
-# End of 4.1 tests
-
-###############################################################
-# Cases with stored procedures
-###############################################################
-let $my_stmt= CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1";
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
---vertical_results
---replace_column 5 # 6 #
-SHOW PROCEDURE STATUS LIKE 'p1';
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
-connection slave;
---replace_column 5 # 6 #
-SHOW PROCEDURE STATUS LIKE 'p1';
-connection master;
---horizontal_results
-
-let $my_stmt= ALTER PROCEDURE p1 COMMENT "I have been altered";
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
---vertical_results
---replace_column 5 # 6 #
-SHOW PROCEDURE STATUS LIKE 'p1';
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
-connection slave;
---replace_column 5 # 6 #
-SHOW PROCEDURE STATUS LIKE 'p1';
-connection master;
---horizontal_results
-
-let $my_stmt= DROP PROCEDURE p1;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
---vertical_results
-SHOW PROCEDURE STATUS LIKE 'p1';
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
-connection slave;
-SHOW PROCEDURE STATUS LIKE 'p1';
-connection master;
---horizontal_results
-
-###############################################################
-# Cases with VIEWs
-###############################################################
-let $my_stmt= CREATE OR REPLACE VIEW v1 as select * from t1;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SHOW CREATE VIEW v1;
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
-connection slave;
-SHOW CREATE VIEW v1;
-connection master;
-
-let $my_stmt= ALTER VIEW v1 AS select f1 from t1;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SHOW CREATE VIEW v1;
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
-connection slave;
-SHOW CREATE VIEW v1;
-connection master;
-
-let $my_stmt= DROP VIEW IF EXISTS v1;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
---error 1146
-SHOW CREATE VIEW v1;
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
-connection slave;
---error 1146
-SHOW CREATE VIEW v1;
-connection master;
-
-###############################################################
-# Cases with TRIGGERs
-###############################################################
-let $my_stmt= CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SHOW TRIGGERS;
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
-connection slave;
-SHOW TRIGGERS;
-connection master;
-
-let $my_stmt= DROP TRIGGER trg1;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SHOW TRIGGERS;
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
-connection slave;
-SHOW TRIGGERS;
-connection master;
-
-###############################################################
-# Cases with USERs
-###############################################################
-let $my_stmt= CREATE USER user1@localhost;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SELECT user FROM mysql.user WHERE user = 'user1';
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
-connection slave;
-SELECT user FROM mysql.user WHERE user = 'user1';
-connection master;
-
-let $my_stmt= RENAME USER user1@localhost TO rename1@localhost;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SELECT user FROM mysql.user WHERE user = 'rename1';
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
-connection slave;
-SELECT user FROM mysql.user WHERE user = 'rename1';
-connection master;
-
-let $my_stmt= DROP USER rename1@localhost;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SELECT user FROM mysql.user WHERE user = 'rename1';
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
-connection slave;
-SELECT user FROM mysql.user WHERE user = 'rename1';
-connection master;
-
-###############################################################
-# Cleanup
-###############################################################
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1;
-DROP DATABASE IF EXISTS mysqltest2;
-DROP DATABASE IF EXISTS mysqltest3;
---enable_warnings
-
-
+let $engine_type= "InnoDB";
+-- source extra/rpl_tests/rpl_ddl.test
diff --git a/mysql-test/t/rpl_deadlock-slave.opt b/mysql-test/t/rpl_deadlock_innodb-slave.opt
index f4a8c640458..f4a8c640458 100644
--- a/mysql-test/t/rpl_deadlock-slave.opt
+++ b/mysql-test/t/rpl_deadlock_innodb-slave.opt
diff --git a/mysql-test/t/rpl_deadlock_innodb.test b/mysql-test/t/rpl_deadlock_innodb.test
new file mode 100644
index 00000000000..ee907f81b22
--- /dev/null
+++ b/mysql-test/t/rpl_deadlock_innodb.test
@@ -0,0 +1,11 @@
+################################
+# Wrapper for rpl_deadlock.test#
+################################
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/not_ndb_default.inc
+-- source include/have_innodb.inc
+let $engine_type=innodb;
+-- source extra/rpl_tests/rpl_deadlock.test
diff --git a/mysql-test/t/rpl_delete_all.test b/mysql-test/t/rpl_delete_all.test
deleted file mode 100644
index e0c0757bbc2..00000000000
--- a/mysql-test/t/rpl_delete_all.test
+++ /dev/null
@@ -1,43 +0,0 @@
-source include/master-slave.inc;
-
-connection slave;
-create database mysqltest;
-connection master;
-drop database if exists mysqltest;
-sync_slave_with_master;
-# can't read dir
---replace_result "Errcode: 1" "Errcode: X" "Errcode: 2" "Errcode: X" \\ /
---error 1049
-show tables from mysqltest;
-
-connection slave;
-create table t1 (a int);
-connection master;
-drop table if exists t1;
-sync_slave_with_master;
-# table does not exist
---error 1146
-select * from t1;
-
-connection master;
-create table t1 (a int);
-sync_slave_with_master;
-insert into t1 values(1);
-connection master;
-delete from t1;
-sync_slave_with_master;
-select * from t1;
-
-insert into t1 values(1);
-connection master;
-insert into t1 values(2);
-update t1 set a=2;
-sync_slave_with_master;
-select * from t1;
-
-# cleanup
-connection master;
-drop table t1;
-sync_slave_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl_delete_no_where.test b/mysql-test/t/rpl_delete_no_where.test
new file mode 100644
index 00000000000..11adb2e6dd5
--- /dev/null
+++ b/mysql-test/t/rpl_delete_no_where.test
@@ -0,0 +1,6 @@
+###################################################
+# By JBM 2006-02-14 added to skip test when NDB #
+##################################################
+-- source include/not_ndb_default.inc
+let $engine_type=myisam;
+-- source extra/rpl_tests/rpl_delete_no_where.test
diff --git a/mysql-test/t/rpl_do_grant.test b/mysql-test/t/rpl_do_grant.test
index 54287a67657..8d6f99e4bf1 100644
--- a/mysql-test/t/rpl_do_grant.test
+++ b/mysql-test/t/rpl_do_grant.test
@@ -1,6 +1,7 @@
-# Test that GRANT and SET PASSWORD are replicated to the slave
+# Works in statement-based and row-based binlogging.
+# Test that GRANT and other user management commands are replicated to the slave
-source include/master-slave.inc;
+-- source include/master-slave.inc
# do not be influenced by other tests.
connection master;
@@ -46,3 +47,52 @@ sync_with_master;
flush privileges;
# End of 4.1 tests
+
+connection master;
+--error 1141
+show grants for rpl_do_grant@localhost;
+connection slave;
+--error 1141
+show grants for rpl_do_grant@localhost;
+
+connection master;
+create user rpl_do_grant@localhost;
+show grants for rpl_do_grant@localhost;
+--error 1141
+show grants for rpl_do_grant2@localhost;
+sync_slave_with_master;
+show grants for rpl_do_grant@localhost;
+--error 1141
+show grants for rpl_do_grant2@localhost;
+
+connection master;
+rename user rpl_do_grant@localhost to rpl_do_grant2@localhost;
+show grants for rpl_do_grant2@localhost;
+sync_slave_with_master;
+show grants for rpl_do_grant2@localhost;
+
+connection master;
+grant DELETE,INSERT on mysqltest1.* to rpl_do_grant2@localhost;
+show grants for rpl_do_grant2@localhost;
+sync_slave_with_master;
+show grants for rpl_do_grant2@localhost;
+
+connection master;
+revoke DELETE on mysqltest1.* from rpl_do_grant2@localhost;
+show grants for rpl_do_grant2@localhost;
+sync_slave_with_master;
+show grants for rpl_do_grant2@localhost;
+
+connection master;
+revoke all privileges, grant option from rpl_do_grant2@localhost;
+show grants for rpl_do_grant2@localhost;
+sync_slave_with_master;
+show grants for rpl_do_grant2@localhost;
+
+connection master;
+drop user rpl_do_grant2@localhost;
+--error 1141
+show grants for rpl_do_grant2@localhost;
+sync_slave_with_master;
+--error 1141
+show grants for rpl_do_grant2@localhost;
diff --git a/mysql-test/t/rpl_drop.test b/mysql-test/t/rpl_drop.test
index ebb33c92a20..b38007a755f 100644
--- a/mysql-test/t/rpl_drop.test
+++ b/mysql-test/t/rpl_drop.test
@@ -12,3 +12,5 @@ connection slave;
sync_with_master;
# End of 4.1 tests
+
+
diff --git a/mysql-test/t/rpl_drop_db.test b/mysql-test/t/rpl_drop_db.test
index f14c9bc0164..40b8520a601 100644
--- a/mysql-test/t/rpl_drop_db.test
+++ b/mysql-test/t/rpl_drop_db.test
@@ -46,8 +46,9 @@ show tables;
use test;
select * from t1;
+system rm $MYSQLTEST_VARDIR/master-data/mysqltest1/f1.txt;
connection master;
-drop table t1;
+DROP DATABASE mysqltest1;
sync_slave_with_master;
#cleanup
@@ -60,3 +61,6 @@ connection master;
--remove_file $MYSQLTEST_VARDIR/master-data/mysqltest1/f1.txt
drop database mysqltest1;
+use test;
+drop table t1;
+
diff --git a/mysql-test/t/rpl_drop_temp.test b/mysql-test/t/rpl_drop_temp.test
index 55a4e741d7c..305c78d3f06 100644
--- a/mysql-test/t/rpl_drop_temp.test
+++ b/mysql-test/t/rpl_drop_temp.test
@@ -1,17 +1,27 @@
+##############################################
+# Change Author: JBM
+# Change Date: 2006-02-07
+# Change: Added ENGINE=MyISAM
+# Purpose: According to TU in 16552 This is how
+# to work around NDB's issue with temp tables
+##############################################
source include/master-slave.inc;
--disable_warnings
create database if not exists mysqltest;
--enable_warnings
-create temporary table mysqltest.t1 (n int);
-create temporary table mysqltest.t2 (n int);
+create temporary table mysqltest.t1 (n int)ENGINE=MyISAM;
+create temporary table mysqltest.t2 (n int)ENGINE=MyISAM;
sync_slave_with_master;
connection master;
disconnect master;
connection slave;
--real_sleep 3 # time for DROP to be written
show status like 'Slave_open_temp_tables';
+
+# Cleanup
connection default;
drop database mysqltest;
+sync_slave_with_master;
# End of 4.1 tests
diff --git a/mysql-test/t/rpl_empty_master_crash.test b/mysql-test/t/rpl_empty_master_crash.test
index 5f26bedc9fe..707d1eca8c2 100644
--- a/mysql-test/t/rpl_empty_master_crash.test
+++ b/mysql-test/t/rpl_empty_master_crash.test
@@ -1,6 +1,6 @@
source include/master-slave.inc;
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
#
diff --git a/mysql-test/t/rpl_error_ignored_table-slave.opt b/mysql-test/t/rpl_err_ignoredtable-slave.opt
index cb49119bfcb..cb49119bfcb 100644
--- a/mysql-test/t/rpl_error_ignored_table-slave.opt
+++ b/mysql-test/t/rpl_err_ignoredtable-slave.opt
diff --git a/mysql-test/t/rpl_error_ignored_table.test b/mysql-test/t/rpl_err_ignoredtable.test
index 339d966dbb3..42ca8cf2e8b 100644
--- a/mysql-test/t/rpl_error_ignored_table.test
+++ b/mysql-test/t/rpl_err_ignoredtable.test
@@ -1,24 +1,27 @@
# Test for
# Bug #797: If a query is ignored on slave (replicate-ignore-table) the slave
# still checks that it has the same error as on the master.
+##########################################################################
+# 2006-02-07 JBM Added error code 1022 for NDB Engine + ORDER BY
+##########################################################################
+
+-- source include/master-slave.inc
-source include/master-slave.inc;
connection master;
create table t1 (a int primary key);
+create table t4 (a int primary key);
# generate an error that goes to the binlog
---error 1062
+--error 1022, 1062
insert into t1 values (1),(1);
+insert into t4 values (1),(2);
save_master_pos;
connection slave;
# as the t1 table is ignored on the slave, the slave should be able to sync
sync_with_master;
-# The port number is different when doing the release build with
-# Do-compile, hence we have to replace the port number here accordingly
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
# check that the table has been ignored, because otherwise the test is nonsense
show tables like 't1';
+show tables like 't4';
+SELECT * FROM test.t4 ORDER BY a;
connection master;
drop table t1;
save_master_pos;
@@ -44,17 +47,20 @@ real_sleep 2;
select (@id := id) - id from t3;
kill @id;
drop table t2,t3;
+insert into t4 values (3),(4);
connection master;
--error 0,1053,2013
reap;
connection master1;
---replace_column 2 # 5 #
-show binlog events from 98;
save_master_pos;
connection slave;
-# SQL slave thread should not have stopped (because table of the killed
-# query is in the ignore list).
sync_with_master;
+SELECT * FROM test.t4 ORDER BY a;
+connection master1;
+DROP TABLE test.t4;
+save_master_pos;
+connection slave;
+sync_with_master;
# End of 4.1 tests
# Adding comment for force manual merge 5.0 -> wl1012. delete me if needed
diff --git a/mysql-test/t/rpl_failed_optimize.test b/mysql-test/t/rpl_failed_optimize.test
index 8c4698c0d9b..81e8342b5c0 100644
--- a/mysql-test/t/rpl_failed_optimize.test
+++ b/mysql-test/t/rpl_failed_optimize.test
@@ -1,23 +1,11 @@
-source include/have_innodb.inc;
-source include/master-slave.inc;
-
-#
-# BUG#5551 "Failed OPTIMIZE TABLE is logged to binary log"
-# Replication should work when OPTIMIZE TABLE timeouts, and
-# when OPTIMIZE TABLE is executed on a non-existing table
-#
-
-CREATE TABLE t1 ( a int ) ENGINE=InnoDB;
-BEGIN;
-INSERT INTO t1 VALUES (1);
-
-connection master1;
-OPTIMIZE TABLE t1;
-
-OPTIMIZE TABLE non_existing;
-sync_slave_with_master;
-
-connection master;
-drop table t1;
-sync_slave_with_master;
-# End of 4.1 tests
+#######################################
+# Wrapper for rpl_failed_optimize.test#
+#######################################
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/not_ndb_default.inc
+-- source include/have_innodb.inc
+let $engine_type=InnoDB;
+-- source extra/rpl_tests/rpl_failed_optimize.test
diff --git a/mysql-test/t/rpl_flush_log_loop-master.opt b/mysql-test/t/rpl_flushlog_loop-master.opt
index a4d1d403dc9..a4d1d403dc9 100644
--- a/mysql-test/t/rpl_flush_log_loop-master.opt
+++ b/mysql-test/t/rpl_flushlog_loop-master.opt
diff --git a/mysql-test/t/rpl_flush_log_loop-master.sh b/mysql-test/t/rpl_flushlog_loop-master.sh
index a321dd690cd..a321dd690cd 100755
--- a/mysql-test/t/rpl_flush_log_loop-master.sh
+++ b/mysql-test/t/rpl_flushlog_loop-master.sh
diff --git a/mysql-test/t/rpl_flush_log_loop-slave.opt b/mysql-test/t/rpl_flushlog_loop-slave.opt
index 95839c831c9..95839c831c9 100644
--- a/mysql-test/t/rpl_flush_log_loop-slave.opt
+++ b/mysql-test/t/rpl_flushlog_loop-slave.opt
diff --git a/mysql-test/t/rpl_flush_log_loop-slave.sh b/mysql-test/t/rpl_flushlog_loop-slave.sh
index e46ea6d400b..e46ea6d400b 100755
--- a/mysql-test/t/rpl_flush_log_loop-slave.sh
+++ b/mysql-test/t/rpl_flushlog_loop-slave.sh
diff --git a/mysql-test/t/rpl_flush_log_loop.test b/mysql-test/t/rpl_flushlog_loop.test
index 6e45047bd30..ded111d769f 100644
--- a/mysql-test/t/rpl_flush_log_loop.test
+++ b/mysql-test/t/rpl_flushlog_loop.test
@@ -1,24 +1,47 @@
# Testing if "flush logs" command bouncing resulting in logs created in a loop
# in case of bi-directional replication
+-- source include/master-slave.inc
-source include/master-slave.inc;
-
+#
+# Start replication master -> slave
+#
connection slave;
+--disable_warnings
stop slave;
+--enable_warnings
--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;
start slave;
+
+#
+# Start replication slave -> master
+#
connection master;
+--disable_warnings
+stop slave;
+--enable_warnings
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$SLAVE_MYPORT;
start slave;
-sleep 5;
+
+#
+# Wait for start of slave IO and SQL threads
+#
+let $result_pattern= '%127.0.0.1%root%slave-bin.000001%slave-bin.000001%Yes%Yes%0%0%None%';
+--source include/wait_slave_status.inc
+
+#
+# Flush logs of slave
+#
flush logs;
sleep 5;
---replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-# End of 4.1 tests
+#
+# Show status of slave
+#
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
+--vertical_results
+SHOW SLAVE STATUS;
diff --git a/mysql-test/t/rpl_foreign_key_innodb-slave.opt b/mysql-test/t/rpl_foreign_key_innodb-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_foreign_key_innodb-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_foreign_key_innodb.test b/mysql-test/t/rpl_foreign_key_innodb.test
new file mode 100644
index 00000000000..d085bff2012
--- /dev/null
+++ b/mysql-test/t/rpl_foreign_key_innodb.test
@@ -0,0 +1,11 @@
+###################################
+# Wrapper for rpl_foreign_key.test#
+###################################
+# Change Author: JBM
+# Change Date: 2006-01-17
+# Change: FK not supported, skip test when NDB is forced
+####################################
+-- source include/not_ndb_default.inc
+-- source include/have_innodb.inc
+let $engine_type=INNODB;
+-- source extra/rpl_tests/rpl_foreign_key.test
diff --git a/mysql-test/t/rpl_ignore_table.test b/mysql-test/t/rpl_ignore_table.test
index bc651779208..84b0a4cde38 100644
--- a/mysql-test/t/rpl_ignore_table.test
+++ b/mysql-test/t/rpl_ignore_table.test
@@ -23,6 +23,8 @@ UPDATE test.t4 NATURAL JOIN test.t1 SET t1.a=5;
sync_slave_with_master;
SELECT * FROM t4;
+# Cleanup
connection master;
DROP TABLE t1;
DROP TABLE t4;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl000008-slave.opt b/mysql-test/t/rpl_ignore_table_update-slave.opt
index 177f89e0910..177f89e0910 100644
--- a/mysql-test/t/rpl000008-slave.opt
+++ b/mysql-test/t/rpl_ignore_table_update-slave.opt
diff --git a/mysql-test/t/rpl000008.test b/mysql-test/t/rpl_ignore_table_update.test
index fe030f90411..fe030f90411 100644
--- a/mysql-test/t/rpl000008.test
+++ b/mysql-test/t/rpl_ignore_table_update.test
diff --git a/mysql-test/t/rpl_insert.test b/mysql-test/t/rpl_insert.test
new file mode 100644
index 00000000000..0d471a0e0a9
--- /dev/null
+++ b/mysql-test/t/rpl_insert.test
@@ -0,0 +1,44 @@
+--echo #
+--echo # Bug#20821: INSERT DELAYED fails to write some rows to binlog
+--echo #
+
+--source include/master-slave.inc
+--source include/not_embedded.inc
+--source include/not_windows.inc
+
+--disable_warnings
+CREATE SCHEMA IF NOT EXISTS mysqlslap;
+USE mysqlslap;
+--enable_warnings
+
+CREATE TABLE t1 (id INT, name VARCHAR(64));
+
+let $query = "INSERT DELAYED INTO t1 VALUES (1, 'Dr. No'), (2, 'From Russia With Love'), (3, 'Goldfinger'), (4, 'Thunderball'), (5, 'You Only Live Twice')";
+--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=200 --query=$query --delimiter=";"
+
+# Wait until all the 5000 inserts has been inserted into the table
+--disable_query_log
+let $counter= 300; # Max 30 seconds wait
+while (`select count(*)!=5000 from mysqlslap.t1`)
+{
+ sleep 0.1;
+ dec $counter;
+ if (!$counter)
+ {
+ Number of records in t1 didnt reach 5000;
+ }
+}
+--enable_query_log
+
+SELECT COUNT(*) FROM mysqlslap.t1;
+sync_slave_with_master;
+SELECT COUNT(*) FROM mysqlslap.t1;
+
+--echo #
+--echo # Cleanup
+--echo #
+
+connection master;
+USE test;
+DROP SCHEMA mysqlslap;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_insert_id.test b/mysql-test/t/rpl_insert_id.test
index 331a913256c..bfd66431d3c 100644
--- a/mysql-test/t/rpl_insert_id.test
+++ b/mysql-test/t/rpl_insert_id.test
@@ -1,382 +1,11 @@
---echo #
---echo # Setup
---echo #
-
-source include/master-slave.inc;
-source include/have_innodb.inc;
-use test;
---disable_warnings
-drop table if exists t1, t2, t3;
---enable_warnings
-
---echo #
---echo # See if queries that use both auto_increment and LAST_INSERT_ID()
---echo # are replicated well
---echo #
---echo # We also check how the foreign_key_check variable is replicated
---echo #
-
-connection master;
-create table t1(a int auto_increment, key(a));
-create table t2(b int auto_increment, c int, key(b));
-insert into t1 values (1),(2),(3);
-insert into t1 values (null);
-insert into t2 values (null,last_insert_id());
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from t1;
-select * from t2;
-connection master;
-#check if multi-line inserts,
-#which set last_insert_id to the first id inserted,
-#are replicated the same way
-drop table t1;
-drop table t2;
---disable_warnings
-create table t1(a int auto_increment, key(a)) engine=innodb;
-create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=innodb;
---enable_warnings
-SET FOREIGN_KEY_CHECKS=0;
-insert into t1 values (10);
-insert into t1 values (null),(null),(null);
-insert into t2 values (5,0);
-insert into t2 values (null,last_insert_id());
-SET FOREIGN_KEY_CHECKS=1;
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from t1;
-select * from t2;
-connection master;
-
---echo #
---echo # check if INSERT SELECT in auto_increment is well replicated (bug #490)
---echo #
-
-drop table t2;
-drop table t1;
-create table t1(a int auto_increment, key(a));
-create table t2(b int auto_increment, c int, key(b));
-insert into t1 values (10);
-insert into t1 values (null),(null),(null);
-insert into t2 values (5,0);
-insert into t2 (c) select * from t1;
-select * from t2;
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from t1;
-select * from t2;
-connection master;
-drop table t1;
-drop table t2;
-save_master_pos;
-connection slave;
-sync_with_master;
-
---echo #
---echo # Bug#8412: Error codes reported in binary log for CHARACTER SET,
---echo # FOREIGN_KEY_CHECKS
---echo #
-
-connection master;
-SET TIMESTAMP=1000000000;
-CREATE TABLE t1 ( a INT UNIQUE );
-SET FOREIGN_KEY_CHECKS=0;
---error 1062
-INSERT INTO t1 VALUES (1),(1);
-sync_slave_with_master;
-
-connection master;
-drop table t1;
-sync_slave_with_master;
-
---echo #
---echo # Bug#14553: NULL in WHERE resets LAST_INSERT_ID
---echo #
-
-connection master;
-create table t1(a int auto_increment, key(a));
-create table t2(a int);
-insert into t1 (a) values (null);
-insert into t2 (a) select a from t1 where a is null;
-insert into t2 (a) select a from t1 where a is null;
-select * from t2;
-sync_slave_with_master;
-connection slave;
-select * from t2;
-connection master;
-drop table t1;
-drop table t2;
-sync_slave_with_master;
-
---echo #
---echo # End of 4.1 tests
---echo #
-
-#
-# BUG#15728: LAST_INSERT_ID function inside a stored function returns 0
-#
-# The solution is not to reset last_insert_id on enter to sub-statement.
-#
-connection master;
---disable_warnings
-drop function if exists bug15728;
-drop function if exists bug15728_insert;
-drop table if exists t1, t2;
---enable_warnings
-
-create table t1 (
- id int not null auto_increment,
- last_id int,
- primary key (id)
-);
-create function bug15728() returns int(11)
- return last_insert_id();
-
-insert into t1 (last_id) values (0);
-insert into t1 (last_id) values (last_insert_id());
-insert into t1 (last_id) values (bug15728());
-
-# Check that nested call replicates too.
-create table t2 (
- id int not null auto_increment,
- last_id int,
- primary key (id)
-);
-delimiter |;
-create function bug15728_insert() returns int(11) modifies sql data
-begin
- insert into t2 (last_id) values (bug15728());
- return bug15728();
-end|
-create trigger t1_bi before insert on t1 for each row
-begin
- declare res int;
- select bug15728_insert() into res;
- set NEW.last_id = res;
-end|
-delimiter ;|
-
-insert into t1 (last_id) values (0);
-
-drop trigger t1_bi;
-
-# Check that nested call doesn't affect outer context.
-select last_insert_id();
-select bug15728_insert();
-select last_insert_id();
-insert into t1 (last_id) values (bug15728());
-# This should be exactly one greater than in the previous call.
-select last_insert_id();
-
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from t1;
-select * from t2;
-connection master;
-
-drop function bug15728;
-drop function bug15728_insert;
-drop table t1, t2;
-
-# test of BUG#20188 REPLACE or ON DUPLICATE KEY UPDATE in
-# auto_increment breaks binlog
-
-create table t1 (n int primary key auto_increment not null,
-b int, unique(b));
-
-# First, test that we do not call restore_auto_increment() too early
-# in write_record():
-set sql_log_bin=0;
-insert into t1 values(null,100);
-replace into t1 values(null,50),(null,100),(null,150);
-select * from t1 order by n;
-truncate table t1;
-set sql_log_bin=1;
-
-insert into t1 values(null,100);
-select * from t1 order by n;
-sync_slave_with_master;
-# make slave's table autoinc counter bigger
-insert into t1 values(null,200),(null,300);
-delete from t1 where b <> 100;
-# check that slave's table content is identical to master
-select * from t1 order by n;
-# only the auto_inc counter differs.
-
-connection master;
-replace into t1 values(null,100),(null,350);
-select * from t1 order by n;
-sync_slave_with_master;
-select * from t1 order by n;
-
-# Same test as for REPLACE, but for ON DUPLICATE KEY UPDATE
-
-# We first check that if we update a row using a value larger than the
-# table's counter, the counter for next row is bigger than the
-# after-value of the updated row.
-connection master;
-insert into t1 values (NULL,400),(3,500),(NULL,600) on duplicate key UPDATE n=1000;
-select * from t1 order by n;
-sync_slave_with_master;
-select * from t1 order by n;
-
-# and now test for the bug:
-connection master;
-drop table t1;
-create table t1 (n int primary key auto_increment not null,
-b int, unique(b));
-insert into t1 values(null,100);
-select * from t1 order by n;
-sync_slave_with_master;
-insert into t1 values(null,200),(null,300);
-delete from t1 where b <> 100;
-select * from t1 order by n;
-
-connection master;
-insert into t1 values(null,100),(null,350) on duplicate key update n=2;
-select * from t1 order by n;
-sync_slave_with_master;
-select * from t1 order by n;
-
-connection master;
-drop table t1;
-
-#
-# BUG#20339: stored procedure using LAST_INSERT_ID() does not
-# replicate statement-based
-#
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-# Reset result of LAST_INSERT_ID().
-SELECT LAST_INSERT_ID(0);
-
-CREATE TABLE t1 (
- id INT NOT NULL DEFAULT 0,
- last_id INT,
- PRIMARY KEY (id)
-);
-
-CREATE TABLE t2 (
- id INT NOT NULL AUTO_INCREMENT,
- last_id INT,
- PRIMARY KEY (id)
-);
-
-delimiter |;
-CREATE PROCEDURE p1()
-BEGIN
- INSERT INTO t2 (last_id) VALUES (LAST_INSERT_ID());
- INSERT INTO t1 (last_id) VALUES (LAST_INSERT_ID());
-END|
-delimiter ;|
-
-CALL p1();
-SELECT * FROM t1;
-SELECT * FROM t2;
-
-sync_slave_with_master;
-SELECT * FROM t1;
-SELECT * FROM t2;
-
-connection master;
-
-DROP PROCEDURE p1;
-DROP TABLE t1, t2;
-
-
-#
-# BUG#21726: Incorrect result with multiple invocations of
-# LAST_INSERT_ID
-#
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
-DROP FUNCTION IF EXISTS f1;
-DROP FUNCTION IF EXISTS f2;
-DROP FUNCTION IF EXISTS f3;
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-CREATE TABLE t1 (
- i INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
- j INT DEFAULT 0
-);
-CREATE TABLE t2 (i INT);
-
-delimiter |;
-CREATE PROCEDURE p1()
-BEGIN
- INSERT INTO t1 (i) VALUES (NULL);
- INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
- INSERT INTO t1 (i) VALUES (NULL), (NULL);
- INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
-END |
-
-CREATE FUNCTION f1() RETURNS INT MODIFIES SQL DATA
-BEGIN
- INSERT INTO t1 (i) VALUES (NULL);
- INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
- INSERT INTO t1 (i) VALUES (NULL), (NULL);
- INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
- RETURN 0;
-END |
-
-CREATE FUNCTION f2() RETURNS INT NOT DETERMINISTIC
- RETURN LAST_INSERT_ID() |
-
-CREATE FUNCTION f3() RETURNS INT MODIFIES SQL DATA
-BEGIN
- INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
- RETURN 0;
-END |
-delimiter ;|
-
-INSERT INTO t1 VALUES (NULL, -1);
-CALL p1();
-SELECT f1();
-INSERT INTO t1 VALUES (NULL, f2()), (NULL, LAST_INSERT_ID()),
- (NULL, LAST_INSERT_ID()), (NULL, f2()), (NULL, f2());
-INSERT INTO t1 VALUES (NULL, f2());
-INSERT INTO t1 VALUES (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID(5)),
- (NULL, @@LAST_INSERT_ID);
-# Test replication of substitution "IS NULL" -> "= LAST_INSERT_ID".
-INSERT INTO t1 VALUES (NULL, 0), (NULL, LAST_INSERT_ID());
-UPDATE t1 SET j= -1 WHERE i IS NULL;
-
-# Test statement-based replication of function calls.
-INSERT INTO t1 (i) VALUES (NULL);
-
-connection master1;
-INSERT INTO t1 (i) VALUES (NULL);
-
-connection master;
-SELECT f3();
-
-SELECT * FROM t1;
-SELECT * FROM t2;
-
-sync_slave_with_master;
-SELECT * FROM t1;
-SELECT * FROM t2;
-
-connection master;
-DROP PROCEDURE p1;
-DROP FUNCTION f1;
-DROP FUNCTION f2;
-DROP FUNCTION f3;
-DROP TABLE t1, t2;
-
-
-sync_slave_with_master;
-
---echo
---echo # End of 5.0 tests
---echo
-
-
+#################################
+# Wrapper for rpl_insert_id.test#
+#################################
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/not_ndb_default.inc
+-- source include/have_innodb.inc
+let $engine_type=innodb;
+-- source extra/rpl_tests/rpl_insert_id.test
diff --git a/mysql-test/t/rpl_insert_id_pk-slave.opt b/mysql-test/t/rpl_insert_id_pk-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_insert_id_pk-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_insert_id_pk.test b/mysql-test/t/rpl_insert_id_pk.test
new file mode 100644
index 00000000000..01f30b78ac5
--- /dev/null
+++ b/mysql-test/t/rpl_insert_id_pk.test
@@ -0,0 +1,11 @@
+#################################
+# Wrapper for rpl_insert_id.test#
+#################################
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/not_ndb_default.inc
+-- source include/have_innodb.inc
+let $engine_type=innodb;
+-- source extra/rpl_tests/rpl_insert_id_pk.test
diff --git a/mysql-test/t/rpl_insert_ignore.test b/mysql-test/t/rpl_insert_ignore.test
index a6cc69b1df8..dc8994b82f3 100644
--- a/mysql-test/t/rpl_insert_ignore.test
+++ b/mysql-test/t/rpl_insert_ignore.test
@@ -1,73 +1,8 @@
-# Testcase for BUG#6287 "Slave skips auto_increment values in Replication with InnoDB"
-# The bug was that if on master, INSERT IGNORE ignored some
-# rows, and the table was InnoDB with auto_inc column, then on slave
-# some rows received an auto_inc bigger than on master.
-# Slave needs to be started with --innodb to store table in InnoDB.
-# Same test for MyISAM (which had no bug).
-
+#####################################
+# Wrapper for rpl_insert_ignore.test#
+#####################################
+-- source include/not_ndb_default.inc
-- source include/have_innodb.inc
-
--- source include/master-slave.inc
-
-CREATE TABLE t1 (
- a int unsigned not null auto_increment primary key,
- b int unsigned,
- unique (b)
-) ENGINE=innodb;
-
-CREATE TABLE t2 (
- a int unsigned, # to force INSERT SELECT to have a certain order
- b int unsigned
-) ENGINE=innodb;
-
-
-INSERT INTO t1 VALUES (NULL, 1);
-INSERT INTO t1 VALUES (NULL, 2);
-INSERT INTO t1 VALUES (NULL, 3);
-INSERT INTO t1 VALUES (NULL, 4);
-
-# An alternation of values which will conflict in t1 and will not.
-
-INSERT INTO t2 VALUES (1, 1);
-INSERT INTO t2 VALUES (2, 2);
-INSERT INTO t2 VALUES (3, 5);
-INSERT INTO t2 VALUES (4, 3);
-INSERT INTO t2 VALUES (5, 4);
-INSERT INTO t2 VALUES (6, 6);
-
-INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
-
-# Compare results
-
-SELECT * FROM t1 ORDER BY a;
-
-sync_slave_with_master;
-SELECT * FROM t1 ORDER BY a;
-
-# Now do the same for MyISAM
-
-connection master;
-drop table t1;
-CREATE TABLE t1 (
- a int unsigned not null auto_increment primary key,
- b int unsigned,
- unique (b)
-) ENGINE=myisam;
-
-INSERT INTO t1 VALUES (1, 1);
-INSERT INTO t1 VALUES (2, 2);
-INSERT INTO t1 VALUES (3, 3);
-INSERT INTO t1 VALUES (4, 4);
-
-INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
-
-SELECT * FROM t1 ORDER BY a;
-
-sync_slave_with_master;
-SELECT * FROM t1 ORDER BY a;
-
-connection master;
-drop table t1, t2;
-sync_slave_with_master;
-
-# End of 4.1 tests
+let $engine_type=innodb;
+let $engine_type2=myisam;
+-- source extra/rpl_tests/rpl_insert_ignore.test
diff --git a/mysql-test/t/rpl000009-slave.opt b/mysql-test/t/rpl_load_from_master-slave.opt
index c015c02ba78..c015c02ba78 100644
--- a/mysql-test/t/rpl000009-slave.opt
+++ b/mysql-test/t/rpl_load_from_master-slave.opt
diff --git a/mysql-test/t/rpl000009.test b/mysql-test/t/rpl_load_from_master.test
index 161e01ad293..9bab7d5696e 100644
--- a/mysql-test/t/rpl000009.test
+++ b/mysql-test/t/rpl_load_from_master.test
@@ -1,5 +1,11 @@
# This one assumes we are ignoring updates on tables in database mysqltest2,
# but doing the ones in database mysqltest
+#################################################################
+# Change Author: JBM
+# Change Date: 2006-02-02
+# Change: Added ENGINE=MyISAM
+# Reason: LOAD from master is only supported by MyISAM
+#################################################################
source include/master-slave.inc;
--disable_warnings
@@ -19,12 +25,12 @@ save_master_pos;
connection slave;
sync_with_master;
create database mysqltest2;
-create table mysqltest2.foo (n int);
+create table mysqltest2.foo (n int)ENGINE=MyISAM;
insert into mysqltest2.foo values(4);
connection master;
-create table mysqltest2.foo (n int);
+create table mysqltest2.foo (n int)ENGINE=MyISAM;
insert into mysqltest2.foo values(5);
-create table mysqltest.bar (m int);
+create table mysqltest.bar (m int)ENGINE=MyISAM;
insert into mysqltest.bar values(15);
save_master_pos;
connection slave;
@@ -49,13 +55,13 @@ set sql_log_bin = 0;
create database mysqltest2;
create database mysqltest;
show databases;
-create table mysqltest2.t1(n int, s char(20));
-create table mysqltest2.t2(n int, s text);
+create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM;
+create table mysqltest2.t2(n int, s text)ENGINE=MyISAM;
insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three');
insert into mysqltest2.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen');
-create table mysqltest.t1(n int, s char(20));
-create table mysqltest.t2(n int, s text);
+create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM;
+create table mysqltest.t2(n int, s text)ENGINE=MyISAM;
insert into mysqltest.t1 values (1, 'one test'), (2, 'two test'), (3, 'three test');
insert into mysqltest.t2 values (11, 'eleven test'), (12, 'twelve test'),
(13, 'thirteen test');
@@ -69,21 +75,21 @@ show databases;
# Create mysqltest2 and mysqltest3 on slave; we expect that LOAD DATA FROM
# MASTER will neither touch database mysqltest nor mysqltest3
create database mysqltest2;
-create table mysqltest2.t1(n int, s char(20));
+create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM;
insert into mysqltest2.t1 values (1, 'original foo.t1');
-create table mysqltest2.t3(n int, s char(20));
+create table mysqltest2.t3(n int, s char(20))ENGINE=MyISAM;
insert into mysqltest2.t3 values (1, 'original foo.t3');
create database mysqltest3;
-create table mysqltest3.t1(n int, s char(20));
+create table mysqltest3.t1(n int, s char(20))ENGINE=MyISAM;
insert into mysqltest3.t1 values (1, 'original foo2.t1');
# Create mysqltest, and mysqltest.t1, to check that it gets replaced,
# and mysqltest.t3 to check that it is not touched (there is no
# mysqltest.t3 on master)
create database mysqltest;
-create table mysqltest.t1(n int, s char(20));
+create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM;
insert into mysqltest.t1 values (1, 'original bar.t1');
-create table mysqltest.t3(n int, s char(20));
+create table mysqltest.t3(n int, s char(20))ENGINE=MyISAM;
insert into mysqltest.t3 values (1, 'original bar.t3');
load data from master;
diff --git a/mysql-test/t/rpl_load_table_from_master.test b/mysql-test/t/rpl_load_table_from_master.test
new file mode 100644
index 00000000000..b9cec3858a9
--- /dev/null
+++ b/mysql-test/t/rpl_load_table_from_master.test
@@ -0,0 +1,98 @@
+###########################################################
+# Change Author: JBM
+# Change Date: 2006-2-2
+# Change: Added ENGINE=$engine_type for first create table
+# Reason: Only MyISAM supports load from master no need to
+# run test case for other engines, in addition test will
+# fail if other engines are set as default engine
+###########################################################
+# Change Author: JBM
+# Change Date: 2006-2-3
+# Change: removed ENGINE=$engine_type for first create table
+# and renamed test file to rpl_load_table_from_master.test.
+# In addition added test requirements.
+# Reason: Request from review.
+############################################################
+# REQUIREMENT TEST 1:
+# LOAD TABLE FROM MASTER must work with a forced timestamp.
+############################################################
+#
+# Test forced timestamp
+#
+-- source include/master-slave.inc
+
+-- echo "******************** Test Requirment 1 *************"
+
+# Don't log table creating to the slave as we want to test LOAD TABLE
+SET SQL_LOG_BIN=0,timestamp=200006;
+eval CREATE TABLE t1(t TIMESTAMP NOT NULL,a CHAR(1))ENGINE=MyISAM;
+INSERT INTO t1 ( a) VALUE ('F');
+select unix_timestamp(t) from t1;
+connection slave;
+load table t1 from master;
+select unix_timestamp(t) from t1;
+
+# Delete the created table on master and slave
+connection master;
+set SQL_LOG_BIN=1,timestamp=default;
+drop table t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+connection master;
+
+#
+# Test copying table with checksum
+#
+
+# Don't log table creating to the slave as we want to test LOAD TABLE
+set SQL_LOG_BIN=0;
+
+#######################################################
+# REQUIREMENTi TEST 2:
+#LOAD TABLE FROM MASTER must work with table checksum
+#######################################################
+-- echo "******************** Test Requirment 2 *************"
+
+eval CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM MAX_ROWS=4000 CHECKSUM=1;
+INSERT INTO t1 VALUES (1);
+save_master_pos;
+connection slave;
+sync_with_master;
+load table t1 from master;
+check table t1;
+drop table t1;
+connection master;
+drop table t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+connection master;
+set SQL_LOG_BIN=0;
+create table t1 (word char(20) not null, index(word))ENGINE=MyISAM;
+load data infile '../std_data_ln/words.dat' into table t1;
+create table t2 (word char(20) not null)ENGINE=MyISAM;
+load data infile '../std_data_ln/words.dat' into table t2;
+create table t3 (word char(20) not null primary key)ENGINE=MyISAM;
+connection slave;
+load table t1 from master;
+load table t2 from master;
+load table t3 from master;
+check table t1;
+select count(*) from t2;
+select count(*) from t3;
+connection master;
+set SQL_LOG_BIN=1;
+drop table if exists t1,t2,t3;
+save_master_pos;
+connection slave;
+sync_with_master;
+create table t1(n int);
+drop table t1;
+
+
+
+
+
+# End of 4.1 tests
diff --git a/mysql-test/t/rpl_loaddata.test b/mysql-test/t/rpl_loaddata.test
index 5ebdec6f761..6f9ee4ef80a 100644
--- a/mysql-test/t/rpl_loaddata.test
+++ b/mysql-test/t/rpl_loaddata.test
@@ -1,154 +1,7 @@
-# See if replication of a "LOAD DATA in an autoincrement column"
-# Honours autoincrement values
-# i.e. if the master and slave have the same sequence
-#
-# check replication of load data for temporary tables with additional
-# parameters
-#
-# check if duplicate entries trigger an error (they should unless IGNORE or
-# REPLACE was used on the master) (bug 571).
-#
-# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and
-# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986)
-
-source include/master-slave.inc;
-
-connection slave;
-reset master;
-connection master;
-
-create table t1(a int not null auto_increment, b int, primary key(a) );
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
-
-create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
-load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
-
-create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
-insert into t3 select * from t2;
-
-save_master_pos;
-connection slave;
-sync_with_master;
-
-select * from t1;
-select * from t3;
-# We want to be sure that LOAD DATA is in the slave's binlog.
-# But we can't simply read this binlog, because as the slave has not been
-# restarted for this test, the file_id is uncertain (would cause test
-# failures). So instead, we test if the binlog looks long enough to
-# contain LOAD DATA. Since 5.0.3 we assume that binlog of 1292 is ok.
-# If LOAD DATA was not logged, the binlog would be shorter.
-show master status;
-
-connection master;
-
-drop table t1;
-drop table t2;
-drop table t3;
-create table t1(a int, b int, unique(b));
-
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# See if slave stops when there's a duplicate entry for key error in LOAD DATA
-
-insert into t1 values(1,10);
-
-connection master;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
-
-save_master_pos;
-connection slave;
-# The SQL slave thread should be stopped now.
-wait_for_slave_to_stop;
-
-# Skip the bad event and see if error is cleared in SHOW SLAVE STATUS by START
-# SLAVE, even though we are not executing any event (as sql_slave_skip_counter
-# takes us directly to the end of the relay log).
-
-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 #
-show slave status;
-
-# Trigger error again to test CHANGE MASTER
-
-connection master;
-set sql_log_bin=0;
-delete from t1;
-set sql_log_bin=1;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
-save_master_pos;
-connection slave;
-# The SQL slave thread should be stopped now.
-# Exec_Master_Log_Pos should point to the start of Execute event
-# for last load data.
-wait_for_slave_to_stop;
-
-# CHANGE MASTER and see if error is cleared in SHOW SLAVE STATUS.
-stop slave;
-change master to master_user='test';
-change master to master_user='root';
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-
-# Trigger error again to test RESET SLAVE
-
-set global sql_slave_skip_counter=1;
-start slave;
-sync_with_master;
-connection master;
-set sql_log_bin=0;
-delete from t1;
-set sql_log_bin=1;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
-save_master_pos;
-connection slave;
-# The SQL slave thread should be stopped now.
-wait_for_slave_to_stop;
-
-# RESET SLAVE and see if error is cleared in SHOW SLAVE STATUS.
-stop slave;
-reset slave;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-
-# Finally, see if logging is done ok on master for a failing LOAD DATA INFILE
-
-connection master;
-reset master;
-create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
-unique(day)) engine=MyISAM; # no transactions
---error 1062
-load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
-terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
-'\n##\n' starting by '>' ignore 1 lines;
-select * from t2;
-save_master_pos;
-connection slave;
-start slave;
-sync_with_master;
-select * from t2;
-
-# verify that if no error on slave, this is an error
-
-alter table t2 drop key day;
-connection master;
-delete from t2;
---error 1062
-load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
-terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
-'\n##\n' starting by '>' ignore 1 lines;
-connection slave;
-wait_for_slave_to_stop;
-drop table t2;
-connection master;
-drop table t2;
-drop table t1;
-sync_with_master;
-# End of 4.1 tests
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/not_ndb_default.inc
+let $engine_type=MyISAM;
+-- source extra/rpl_tests/rpl_loaddata.test
diff --git a/mysql-test/t/rpl_loaddata2.test b/mysql-test/t/rpl_loaddata2.test
new file mode 100644
index 00000000000..9e908cac677
--- /dev/null
+++ b/mysql-test/t/rpl_loaddata2.test
@@ -0,0 +1,14 @@
+--source include/master-slave.inc
+
+CREATE TABLE t1 (word CHAR(20) NOT NULL);
+LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
+SELECT * FROM t1 ORDER BY word;
+sync_slave_with_master;
+
+# Check
+SELECT * FROM t1 ORDER BY word;
+
+# Cleanup
+connection master;
+drop table t1;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_loaddata_rule_m-master.opt b/mysql-test/t/rpl_loaddata_m-master.opt
index 9d4a8f0b95e..9d4a8f0b95e 100644
--- a/mysql-test/t/rpl_loaddata_rule_m-master.opt
+++ b/mysql-test/t/rpl_loaddata_m-master.opt
diff --git a/mysql-test/t/rpl_loaddata_m.test b/mysql-test/t/rpl_loaddata_m.test
new file mode 100644
index 00000000000..537d4c163ef
--- /dev/null
+++ b/mysql-test/t/rpl_loaddata_m.test
@@ -0,0 +1,52 @@
+# See if the master logs LOAD DATA INFILE correctly when binlog_*_db rules
+# exist.
+# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
+######################################################
+# Change Author: JBM
+# Change Date: 2005-12-22
+# Change: Test rewritten to remove show binlog events
+# and to test the option better + Cleanup
+######################################################
+-- source include/master-slave.inc
+
+--disable_warnings
+drop database if exists mysqltest;
+--enable_warnings
+
+connection master;
+# 'test' database should be ignored by the slave
+USE test;
+CREATE TABLE t1(a INT, b INT, UNIQUE(b));
+LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE test.t1;
+SELECT COUNT(*) FROM test.t1;
+
+# 'mysqltest' database should NOT be ignored by the slave
+CREATE DATABASE mysqltest;
+USE mysqltest;
+CREATE TABLE t1(a INT, b INT, UNIQUE(b));
+LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
+SELECT COUNT(*) FROM mysqltest.t1;
+
+# Now lets check the slave to see what we have :-)
+save_master_pos;
+connection slave;
+sync_with_master;
+
+SHOW DATABASES;
+
+USE test;
+SHOW TABLES;
+
+USE mysqltest;
+SHOW TABLES;
+SELECT COUNT(*) FROM mysqltest.t1;
+
+#show binlog events;
+
+# Cleanup
+connection master;
+DROP DATABASE mysqltest;
+DROP TABLE test.t1;
+sync_slave_with_master;
+
+# End of test
diff --git a/mysql-test/t/rpl_loaddata_rule_m.test b/mysql-test/t/rpl_loaddata_rule_m.test
deleted file mode 100644
index 4b8e5326c98..00000000000
--- a/mysql-test/t/rpl_loaddata_rule_m.test
+++ /dev/null
@@ -1,33 +0,0 @@
-# See if the master logs LOAD DATA INFILE correctly when binlog_*_db rules
-# exist.
-# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
-
-source include/master-slave.inc;
-
---disable_warnings
-drop database if exists mysqltest;
---enable_warnings
-
-connection slave;
-stop slave; # don't need slave for this test
-
-# Test logging on master
-
-connection master;
-# 'test' is the current database
-create database mysqltest;
-create table t1(a int, b int, unique(b));
-use mysqltest;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table test.t1;
-# Starting from 5.0.3 LOAD DATA is replicated much in the same way as ordinary
-# query so "show binlog ..." should show two events (before 5.0.3 no events
-# were returned).
---replace_column 2 # 5 #
-show binlog events from 98;
-
-drop database mysqltest;
-use test;
-drop table t1;
-
-# End of 4.1 tests
-# Adding comment for force manual merge 5.0 -> wl1012: Delete me
diff --git a/mysql-test/t/rpl_loaddata_rule_s.test b/mysql-test/t/rpl_loaddata_rule_s.test
deleted file mode 100644
index 2061e898811..00000000000
--- a/mysql-test/t/rpl_loaddata_rule_s.test
+++ /dev/null
@@ -1,25 +0,0 @@
-# See if the slave logs (in its own binlog, with --log-slave-updates) a
-# replicated LOAD DATA INFILE correctly when it has binlog_*_db rules.
-# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
-
-source include/master-slave.inc;
-connection slave;
-reset master;
-
-connection master;
-# 'test' is the current database
-create table t1(a int, b int, unique(b));
-load data infile '../std_data_ln/rpl_loaddata.dat' into table test.t1;
-
-# Test logging on slave;
-
-save_master_pos;
-connection slave;
-sync_with_master;
-select count(*) from t1; # check that LOAD was replicated
-show binlog events from 98; # should be nothing
-
-connection master;
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl_loaddata_rule_s-slave.opt b/mysql-test/t/rpl_loaddata_s-slave.opt
index 9d4a8f0b95e..9d4a8f0b95e 100644
--- a/mysql-test/t/rpl_loaddata_rule_s-slave.opt
+++ b/mysql-test/t/rpl_loaddata_s-slave.opt
diff --git a/mysql-test/t/rpl_loaddata_s.test b/mysql-test/t/rpl_loaddata_s.test
new file mode 100644
index 00000000000..2c94c8ef953
--- /dev/null
+++ b/mysql-test/t/rpl_loaddata_s.test
@@ -0,0 +1,30 @@
+# See if the slave logs (in its own binlog, with --log-slave-updates) a
+# replicated LOAD DATA INFILE correctly when it has binlog_*_db rules.
+# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
+
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/master-slave.inc
+
+connection slave;
+# Not sure why we connect to slave and then try to reset master, but I will leave it [JBM]
+reset master;
+
+connection master;
+# 'test' is the current database
+create table test.t1(a int, b int, unique(b));
+load data infile '../std_data_ln/rpl_loaddata.dat' into table test.t1;
+
+# Test logging on slave;
+
+save_master_pos;
+connection slave;
+sync_with_master;
+select count(*) from test.t1; # check that LOAD was replicated
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
+show binlog events from 102; # should be nothing
+
+# Cleanup
+connection master;
+drop table test.t1;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_loaddatalocal.test b/mysql-test/t/rpl_loaddatalocal.test
index af4fd0106bd..758ac94af24 100644
--- a/mysql-test/t/rpl_loaddatalocal.test
+++ b/mysql-test/t/rpl_loaddatalocal.test
@@ -53,11 +53,11 @@ create table t1(a int primary key);
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1;
system rm $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile ;
-select * from t1;
+SELECT * FROM t1 ORDER BY a;
save_master_pos;
connection slave;
sync_with_master;
-select * from t1;
+SELECT * FROM t1 ORDER BY a;
connection master;
drop table t1;
save_master_pos;
diff --git a/mysql-test/t/rpl_loadfile.test b/mysql-test/t/rpl_loadfile.test
new file mode 100644
index 00000000000..a671bab15bb
--- /dev/null
+++ b/mysql-test/t/rpl_loadfile.test
@@ -0,0 +1,52 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/18/2005 #
+#############################################################################
+# TEST: To test the LOAD_FILE() in rbr #
+#############################################################################
+# Change Author: JBM
+# Change Date: 2006-01-16
+# Change: Added Order by for NDB
+##########
+
+# Includes
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+--disable_warnings
+connection master;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
+--enable_warnings
+
+# Section 1 test
+
+CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a));
+INSERT INTO test.t1 VALUES(1,'test');
+UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=1;
+delimiter |;
+create procedure test.p1()
+begin
+ INSERT INTO test.t1 VALUES(2,'test');
+ UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=2;
+end|
+delimiter ;|
+
+CALL test.p1();
+SELECT * FROM test.t1 ORDER BY blob_column;
+save_master_pos;
+# Need to allow some time when NDB engine is used for
+# the injector thread to have time to populate binlog
+sleep 10;
+sync_slave_with_master;
+connection slave;
+SELECT * FROM test.t1 ORDER BY blob_column;
+
+# Cleanup
+connection master;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE test.t1;
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_log_pos.test b/mysql-test/t/rpl_log_pos.test
index 979b146bb22..61c24da514e 100644
--- a/mysql-test/t/rpl_log_pos.test
+++ b/mysql-test/t/rpl_log_pos.test
@@ -1,19 +1,29 @@
+##########
+# Change Author: JBM
+# Change Date: 2006-01-16
+# Change: Added Order by for NDB
+##########
+
#
# Testing of setting slave to wrong log position with master_log_pos
#
+
+# Passes with rbr no problem, removed statement include [jbm]
+
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=73;
+change master to master_log_pos=74;
start slave;
sleep 5;
stop slave;
-change master to master_log_pos=73;
+change master to master_log_pos=74;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
show slave status;
@@ -23,13 +33,14 @@ sleep 5;
--replace_column 1 # 8 # 9 # 23 # 33 #
show slave status;
stop slave;
-change master to master_log_pos=173;
+change master to master_log_pos=177;
start slave;
sleep 2;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
show slave status;
connection master;
+--replace_column 3 <Binlog_Ignore_DB>
show master status;
create table if not exists t1 (n int);
drop table if exists t1;
@@ -38,10 +49,10 @@ insert into t1 values (1),(2),(3);
save_master_pos;
connection slave;
stop slave;
-change master to master_log_pos=98;
+change master to master_log_pos=102;
start slave;
sync_with_master;
-select * from t1;
+select * from t1 ORDER BY n;
connection master;
drop table t1;
sync_slave_with_master;
diff --git a/mysql-test/t/rpl000002.test b/mysql-test/t/rpl_mixed_ddl_dml.test
index bafd8a30159..6a1f81abed3 100644
--- a/mysql-test/t/rpl000002.test
+++ b/mysql-test/t/rpl_mixed_ddl_dml.test
@@ -1,3 +1,8 @@
+# Mixed DDL-DML (CREATE ... SELECT ...) statements can only be
+# replicated properly in statement-based replication.
+# Currently statement based due to bug 12345
+--source include/have_binlog_format_mixed_or_statement.inc
+
source include/master-slave.inc;
# Test replication of auto_increment
diff --git a/mysql-test/t/rpl_multi_delete.test b/mysql-test/t/rpl_multi_delete.test
index 4a8c0ab6912..a251cbf8833 100644
--- a/mysql-test/t/rpl_multi_delete.test
+++ b/mysql-test/t/rpl_multi_delete.test
@@ -1,10 +1,11 @@
source include/master-slave.inc;
-create table t1 (a int);
+create table t1 (a int primary key);
create table t2 (a int);
insert into t1 values (1);
insert into t2 values (1);
+
delete t1.* from t1, t2 where t1.a = t2.a;
save_master_pos;
@@ -16,26 +17,10 @@ sync_with_master;
select * from t1;
select * from t2;
-# End of 4.1 tests
-
-# Check if deleting 0 rows is binlogged (BUG#13348)
-
-connection master;
-delete from t1;
-delete from t2;
-
-sync_slave_with_master;
-# force a difference to see if master's multi-DELETE will correct it
-insert into t1 values(1);
-insert into t2 values(1);
-
-connection master;
-DELETE t1.*, t2.* from t1, t2;
-
-sync_slave_with_master;
-select * from t1;
-select * from t2;
-
connection master;
drop table t1,t2;
-sync_slave_with_master;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/t/rpl_multi_delete2.test b/mysql-test/t/rpl_multi_delete2.test
index c50311de363..81379d4056b 100644
--- a/mysql-test/t/rpl_multi_delete2.test
+++ b/mysql-test/t/rpl_multi_delete2.test
@@ -36,7 +36,7 @@ select * from a;
# BUG#3461
connection master;
-create table t1 (a int);
+create table t1 (a int primary key);
create table t2 (a int);
insert into t1 values (1);
diff --git a/mysql-test/t/rpl_multi_engine-slave.opt b/mysql-test/t/rpl_multi_engine-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_multi_engine-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_multi_engine.test b/mysql-test/t/rpl_multi_engine.test
new file mode 100644
index 00000000000..10780c765f7
--- /dev/null
+++ b/mysql-test/t/rpl_multi_engine.test
@@ -0,0 +1,108 @@
+# See if replication between MyISAM, MEMORY and InnoDB works.
+
+#This test case is not written for NDB, result files do not
+#match when NDB is the default engine
+-- source include/not_ndb_default.inc
+
+-- source include/master-slave.inc
+
+connection slave;
+-- source include/have_innodb.inc
+
+connection master;
+-- source include/have_innodb.inc
+--disable_warnings
+create database if not exists mysqltest1;
+use mysqltest1;
+drop table if exists t1;
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc
+VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT
+0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
+
+sync_slave_with_master;
+use mysqltest1;
+
+# MyISAM to MyISAM then InnoDB then MEMORY
+
+connection master;
+alter table t1 engine=myisam;
+show create table t1;
+sync_slave_with_master;
+
+connection slave;
+alter table t1 engine=myisam;
+show create table t1;
+
+--source include/rpl_multi_engine.inc
+
+connection slave;
+alter table t1 engine=innodb;
+show create table t1;
+
+--source include/rpl_multi_engine.inc
+
+connection slave;
+alter table t1 engine=memory;
+show create table t1;
+
+--source include/rpl_multi_engine.inc
+
+# MEMORY to ...
+
+connection master;
+alter table t1 engine=memory;
+show create table t1;
+sync_slave_with_master;
+
+connection slave;
+alter table t1 engine=myisam;
+show create table t1;
+
+--source include/rpl_multi_engine.inc
+
+connection slave;
+alter table t1 engine=innodb;
+show create table t1;
+
+--source include/rpl_multi_engine.inc
+
+connection slave;
+alter table t1 engine=memory;
+show create table t1;
+
+--source include/rpl_multi_engine.inc
+
+# InnoDB to ...
+
+connection master;
+alter table t1 engine=innodb;
+show create table t1;
+sync_slave_with_master;
+
+connection slave;
+alter table t1 engine=myisam;
+show create table t1;
+
+--source include/rpl_multi_engine.inc
+
+connection slave;
+alter table t1 engine=innodb;
+show create table t1;
+
+--source include/rpl_multi_engine.inc
+
+connection slave;
+alter table t1 engine=memory;
+show create table t1;
+
+--source include/rpl_multi_engine.inc
+
+# cleanup
+connection master;
+DROP TABLE t1;
+# Need to drop mysqltest1 as well so other test will pass.
+DROP DATABASE mysqltest1;
+sync_slave_with_master;
+
+# End of 5.1 test case
diff --git a/mysql-test/t/rpl_multi_update.test b/mysql-test/t/rpl_multi_update.test
index f6a960434ad..a6111455d16 100644
--- a/mysql-test/t/rpl_multi_update.test
+++ b/mysql-test/t/rpl_multi_update.test
@@ -1,49 +1,7 @@
-source include/master-slave.inc;
-
-CREATE TABLE t1 (
- a int unsigned not null auto_increment primary key,
- b int unsigned
-) ENGINE=MyISAM;
-
-CREATE TABLE t2 (
- a int unsigned not null auto_increment primary key,
- b int unsigned
-) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES (NULL, 0);
-INSERT INTO t1 SELECT NULL, 0 FROM t1;
-
-INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
-
-SELECT * FROM t1 ORDER BY a;
-SELECT * FROM t2 ORDER BY a;
-
-UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
-
-# Check if updating 0 rows is binlogged (BUG#13348)
-
-connection master;
-delete from t1;
-delete from t2;
-insert into t1 values(1,1);
-insert into t2 values(1,1);
-
-sync_slave_with_master;
-# force a difference to see if master's multi-UPDATE will correct it
-update t1 set a=2;
-
-connection master;
-UPDATE t1, t2 SET t1.a = t2.a;
-
-sync_slave_with_master;
-select * from t1;
-select * from t2;
-
-connection master;
-drop table t1, t2;
-sync_slave_with_master;
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/not_ndb_default.inc
+let $engine_type=MyISAM;
+-- source extra/rpl_tests/rpl_multi_update.test
diff --git a/mysql-test/t/rpl_multi_update2.test b/mysql-test/t/rpl_multi_update2.test
index a78b1901f51..7401786501e 100644
--- a/mysql-test/t/rpl_multi_update2.test
+++ b/mysql-test/t/rpl_multi_update2.test
@@ -1,62 +1,9 @@
-# Let's verify that multi-update is not always skipped by slave if
-# some replicate-* rules exist.
-# (BUG#7011)
-
-source include/master-slave.inc;
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-CREATE TABLE t1 (
- a int unsigned not null auto_increment primary key,
- b int unsigned
-) ENGINE=MyISAM;
-
-CREATE TABLE t2 (
- a int unsigned not null auto_increment primary key,
- b int unsigned
-) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES (NULL, 0);
-INSERT INTO t1 SELECT NULL, 0 FROM t1;
-
-INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
-
-SELECT * FROM t1 ORDER BY a;
-SELECT * FROM t2 ORDER BY a;
-
-UPDATE t1, t2 SET t1.b = (t2.b+4) WHERE t1.a = t2.a;
-SELECT * FROM t1 ORDER BY a;
-SELECT * FROM t2 ORDER BY a;
-
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM t1 ORDER BY a;
-SELECT * FROM t2 ORDER BY a;
-
-connection master;
-drop table t1,t2;
-sync_slave_with_master;
-
-#
-# BUG#13236 multi-update with subquery & --replicate-ignore-table
-#
-reset master;
-
-connection master;
-CREATE TABLE t1 ( a INT );
-INSERT INTO t1 VALUES (0);
-UPDATE t1, (SELECT 3 as b) AS x SET t1.a = x.b;
-select * from t1;
-sync_slave_with_master;
-
-connection slave;
-select * from t1;
-
-connection master;
-drop table t1;
-sync_slave_with_master;
-
-# End of 4.1 tests
+#######################################################
+# Wrapper for rpl_multi_update2.test to allow multi #
+# Engines to reuse test code. By JBM 2006-02-15 #
+# Added comments section and to skip when ndb is #
+# Default engine. #
+#######################################################
+--source include/not_ndb_default.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 8d566764ad9..438a644729c 100644
--- a/mysql-test/t/rpl_multi_update3.test
+++ b/mysql-test/t/rpl_multi_update3.test
@@ -1,223 +1,9 @@
-source include/master-slave.inc;
-
-##############################################################################
-#
-# Let's verify that multi-update with a subselect does not cause the slave to crash
-# (BUG#10442)
-#
---disable_query_log
-SELECT '-------- Test for BUG#9361 --------' as "";
---enable_query_log
-
-CREATE TABLE t1 (
- a int unsigned not null auto_increment primary key,
- b int unsigned
-) ENGINE=MyISAM;
-
-CREATE TABLE t2 (
- a int unsigned not null auto_increment primary key,
- b int unsigned
-) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES (NULL, 0);
-INSERT INTO t1 SELECT NULL, 0 FROM t1;
-
-INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
-
-SELECT * FROM t1 ORDER BY a;
-SELECT * FROM t2 ORDER BY a;
-
-UPDATE t2, (SELECT a FROM t1) AS t SET t2.b = t.a+5 ;
-SELECT * FROM t1 ORDER BY a;
-SELECT * FROM t2 ORDER BY a;
-
-sync_slave_with_master;
-connection slave;
-SELECT * FROM t1 ORDER BY a;
-SELECT * FROM t2 ORDER BY a;
-
-connection master;
-drop table t1,t2;
-
-##############################################################################
-#
-# Test for BUG#9361:
-# Subselects should work inside multi-updates
-#
---disable_query_log
-SELECT '-------- Test 1 for BUG#9361 --------' as "";
---enable_query_log
-
-connection master;
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
---enable_warnings
-
-CREATE TABLE t1 (
- a1 char(30),
- a2 int,
- a3 int,
- a4 char(30),
- a5 char(30)
-);
-
-CREATE TABLE t2 (
- b1 int,
- b2 char(30)
-);
-
-# Insert one row per table
-INSERT INTO t1 VALUES ('Yes', 1, NULL, 'foo', 'bar');
-INSERT INTO t2 VALUES (1, 'baz');
-
-# This should update the row in t1
-UPDATE t1 a, t2
- SET a.a1 = 'No'
- WHERE a.a2 =
- (SELECT b1
- FROM t2
- WHERE b2 = 'baz')
- AND a.a3 IS NULL
- AND a.a4 = 'foo'
- AND a.a5 = 'bar';
-
-sync_slave_with_master;
-connection slave;
-SELECT * FROM t1;
-SELECT * FROM t2;
-
-connection master;
-DROP TABLE t1, t2;
-
-##############################################################################
-#
-# Second test for BUG#9361
-#
-
---disable_query_log
-SELECT '-------- Test 2 for BUG#9361 --------' as "";
---enable_query_log
-
-connection master;
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
-DROP TABLE IF EXISTS t3;
---enable_warnings
-
-CREATE TABLE t1 (
- i INT,
- j INT,
- x INT,
- y INT,
- z INT
-);
-
-CREATE TABLE t2 (
- i INT,
- k INT,
- x INT,
- y INT,
- z INT
-);
-
-CREATE TABLE t3 (
- j INT,
- k INT,
- x INT,
- y INT,
- z INT
-);
-
-INSERT INTO t1 VALUES ( 1, 2,13,14,15);
-INSERT INTO t2 VALUES ( 1, 3,23,24,25);
-INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
-
-UPDATE t1 AS a
-INNER JOIN t2 AS b
- ON a.i = b.i
-INNER JOIN t3 AS c
- ON a.j = c.j AND b.k = c.k
-SET a.x = b.x,
- a.y = b.y,
- a.z = (
- SELECT sum(z)
- FROM t3
- WHERE y = 34
- )
-WHERE b.x = 23;
-
-sync_slave_with_master;
-connection slave;
-
-SELECT * FROM t1;
-
-connection master;
-DROP TABLE t1, t2, t3;
-
-##############################################################################
-#
-# BUG#12618
-#
-# TEST: Replication of a statement containing a join in a multi-update.
-
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
-
-CREATE TABLE t1 (
- idp int(11) NOT NULL default '0',
- idpro int(11) default NULL,
- price decimal(19,4) default NULL,
- PRIMARY KEY (idp)
-);
-
-CREATE TABLE t2 (
- idpro int(11) NOT NULL default '0',
- price decimal(19,4) default NULL,
- nbprice int(11) default NULL,
- PRIMARY KEY (idpro)
-);
-
-INSERT INTO t1 VALUES
- (1,1,'3.0000'),
- (2,2,'1.0000'),
- (3,1,'1.0000'),
- (4,1,'4.0000'),
- (5,3,'2.0000'),
- (6,2,'4.0000');
-
-INSERT INTO t2 VALUES
- (1,'0.0000',0),
- (2,'0.0000',0),
- (3,'0.0000',0);
-
-# This update sets t2 to the minimal prices for each product
-update
- t2
- join
- ( select idpro, min(price) as min_price, count(*) as nbr_price
- from t1
- where idpro>0 and price>0
- group by idpro
- ) as table_price
-on t2.idpro = table_price.idpro
-set t2.price = table_price.min_price,
- t2.nbprice = table_price.nbr_price;
-
-select "-- MASTER AFTER JOIN --" as "";
-select * from t1;
-select * from t2;
-
-sync_slave_with_master;
-
-select "-- SLAVE AFTER JOIN --" as "";
-select * from t1;
-select * from t2;
-
-connection master;
-drop table t1, t2;
-sync_slave_with_master;
-# End of 4.1 tests
+#######################################################
+# Wrapper for rpl_multi_update3.test to allow multi #
+# Engines to reuse test code. By JBM 2006-02-15 #
+# Added comments section and to skip when ndb is #
+# Default engine. #
+#######################################################
+--source include/not_ndb_default.inc
+let $engine_type=MyISAM;
+-- source extra/rpl_tests/rpl_multi_update3.test
diff --git a/mysql-test/t/rpl_multi_update4.test b/mysql-test/t/rpl_multi_update4.test
index 3d909b8e5cd..4991a385f6f 100644
--- a/mysql-test/t/rpl_multi_update4.test
+++ b/mysql-test/t/rpl_multi_update4.test
@@ -15,7 +15,7 @@ connection slave;
drop database if exists d2;
--enable_warnings
-### Test
+### Do on master
connection master;
create database d1; # accepted by slave
@@ -30,15 +30,16 @@ insert into t2 select id + 3 from t1;
update t1 join t2 using (id) set t1.id = 0;
insert into d1.t0 values (0); # replication works
+### Check on slave
+
sync_slave_with_master;
use d1;
-#connection slave;
select * from t0 where id=0; # must find
### Clean-up
connection master;
drop database d1;
drop database d2;
-
+sync_slave_with_master;
# End of test
diff --git a/mysql-test/t/rpl_mystery22.test b/mysql-test/t/rpl_mystery22.test
deleted file mode 100644
index f190968a03c..00000000000
--- a/mysql-test/t/rpl_mystery22.test
+++ /dev/null
@@ -1,40 +0,0 @@
-# test case to make slave thread get ahead by 22 bytes
-
-source include/master-slave.inc;
-
-# first, cause a duplicate key problem on the slave
-create table t1(n int auto_increment primary key);
-sync_slave_with_master;
-insert into t1 values (2);
-connection master;
-insert into t1 values(NULL);
-insert into t1 values(NULL);
-save_master_pos;
-connection slave;
-sleep 3; # there is no way around this sleep - we have to wait until
-# the slave tries to run the query, fails and aborts slave thread
-delete from t1 where n = 2;
-start slave;
-sync_with_master;
-#now the buggy slave would be confused on the offset but it can replicate
-#in order to make it break, we need to stop/start the slave one more time
-stop slave;
-connection master;
-# to be able to really confuse the slave, we need some non-auto-increment
-# events in the log
-create table t2(n int);
-drop table t2;
-insert into t1 values(NULL);
-save_master_pos;
-connection slave;
-start slave;
-#now the truth comes out - if the slave is buggy, it will never sync because
-#the slave thread is not able to read events
-sync_with_master;
-select * from t1;
-#clean up
-connection master;
-drop table t1;
-sync_slave_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl_ndb_2innodb-master.opt b/mysql-test/t/rpl_ndb_2innodb-master.opt
new file mode 100644
index 00000000000..701dddb075b
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_2innodb-master.opt
@@ -0,0 +1 @@
+--default-storage-engine=ndbcluster
diff --git a/mysql-test/t/rpl_ndb_2innodb-slave.opt b/mysql-test/t/rpl_ndb_2innodb-slave.opt
new file mode 100644
index 00000000000..d8857e54be2
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_2innodb-slave.opt
@@ -0,0 +1 @@
+--innodb --default-storage-engine=innodb
diff --git a/mysql-test/t/rpl_ndb_2innodb.test b/mysql-test/t/rpl_ndb_2innodb.test
new file mode 100644
index 00000000000..e09d8b6685b
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_2innodb.test
@@ -0,0 +1,16 @@
+#############################################################
+# Author: JBM
+# Date: 2006-02-24
+# Purpose: Trying to test ability to replicate from cluster
+# to innodb, or myisam, or replicate from innodb/myisam to
+# cluster slave. Due to limitations I have created wrappers
+# to be able to use the same code for all these different
+# test and to have control over the tests.
+##############################################################
+-- source include/have_ndb.inc
+-- source include/master-slave.inc
+connection slave;
+-- source include/have_innodb.inc
+connection master;
+SET storage_engine=ndb;
+--source extra/rpl_tests/rpl_ndb_2multi_eng.test
diff --git a/mysql-test/t/rpl_ndb_2myisam-master.opt b/mysql-test/t/rpl_ndb_2myisam-master.opt
new file mode 100644
index 00000000000..701dddb075b
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_2myisam-master.opt
@@ -0,0 +1 @@
+--default-storage-engine=ndbcluster
diff --git a/mysql-test/t/rpl_ndb_2myisam-slave.opt b/mysql-test/t/rpl_ndb_2myisam-slave.opt
new file mode 100644
index 00000000000..6035ce27c46
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_2myisam-slave.opt
@@ -0,0 +1 @@
+--default-storage-engine=myisam
diff --git a/mysql-test/t/rpl_ndb_2myisam.test b/mysql-test/t/rpl_ndb_2myisam.test
new file mode 100644
index 00000000000..abbe419bc02
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_2myisam.test
@@ -0,0 +1,13 @@
+#############################################################
+# Author: JBM
+# Date: 2006-02-24
+# Purpose: Trying to test ability to replicate from cluster
+# to innodb, or myisam, or replicate from innodb/myisam to
+# cluster slave. Due to limitations I have created wrappers
+# to be able to use the same code for all these different
+# test and to have control over the tests.
+##############################################################
+-- source include/have_ndb.inc
+-- source include/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
new file mode 100644
index 00000000000..c6fc218beed
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_UUID.test
@@ -0,0 +1,6 @@
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+########################################################
+--source include/have_ndb.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
new file mode 100644
index 00000000000..53bb7e764f1
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_auto_inc.test
@@ -0,0 +1,118 @@
+#
+# Test of auto_increment in CRBR
+#
+#####################################
+# By: JBM
+# Date: 2006-02-10
+# 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
+
+--echo ***************** Test 1 ************************
+--echo
+CREATE TABLE t1 (a INT NOT NULL auto_increment,b INT, PRIMARY KEY (a)) ENGINE=NDB auto_increment=3;
+insert into t1 values (NULL,1),(NULL,2),(NULL,3);
+--echo ******* Select from Master *************
+--echo
+select * from t1 ORDER BY a;
+
+
+sync_slave_with_master;
+--echo ******* Select from Slave *************
+--echo
+select * from t1 ORDER BY a;
+connection master;
+drop table t1;
+
+create table t1 (a int not null auto_increment,b int, primary key (a)) engine=NDB;
+insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4);
+delete from t1 where b=4;
+insert into t1 values (NULL,5),(NULL,6);
+--echo ******* Select from Master *************
+--echo
+select * from t1 ORDER BY a;
+
+sync_slave_with_master;
+--echo ******* Select from Slave *************
+--echo
+select * from t1 ORDER BY a;
+connection master;
+
+drop table t1;
+
+create table t1 (a int not null auto_increment, primary key (a)) engine=NDB;
+# Insert with 2 insert statements to get better testing of logging
+insert into t1 values (NULL),(5),(NULL);
+insert into t1 values (250),(NULL);
+--echo ******* Select from Master *************
+--echo
+select * from t1 ORDER BY a;
+insert into t1 values (1000);
+set @@insert_id=400;
+insert into t1 values(NULL),(NULL);
+--echo ******* Select from Master *************
+--echo
+select * from t1 ORDER BY a;
+
+sync_slave_with_master;
+--echo ******* Select from Slave *************
+--echo
+select * from t1 ORDER BY a;
+connection master;
+drop table t1;
+
+create table t1 (a int not null auto_increment, primary key (a)) engine=NDB;
+# Insert with 2 insert statements to get better testing of logging
+insert into t1 values (NULL),(5),(NULL),(NULL);
+insert into t1 values (500),(NULL),(502),(NULL),(600);
+--echo ******* Select from Master *************
+--echo
+select * from t1 ORDER BY a;
+set @@insert_id=600;
+# We expect a duplicate key error that we will ignore below
+--error 1022
+insert into t1 values(600),(NULL),(NULL);
+set @@insert_id=600;
+insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL);
+--echo ******* Select from Master *************
+--echo
+select * from t1 ORDER BY a;
+
+sync_slave_with_master;
+--echo ******* Select from Slave *************
+--echo
+select * from t1 ORDER BY a;
+connection master;
+drop table t1;
+
+#
+# Test that auto-increment works when slave has rows in the table
+#
+
+create table t1 (a int not null auto_increment, primary key (a)) engine=NDB;
+
+sync_slave_with_master;
+insert into t1 values(2),(12),(22),(32),(42);
+connection master;
+
+insert into t1 values (NULL),(NULL);
+insert into t1 values (3),(NULL),(NULL);
+--echo ******* Select from Master *************
+--echo
+select * from t1 ORDER BY a;
+
+sync_slave_with_master;
+--echo ******* Select from Slave *************
+--echo
+--echo ** Slave should have 2, 12, 22, 32, 42 **
+--echo ** Master will have 2 but not 12, 22, 32, 42 **
+--echo
+select * from t1 ORDER BY a;
+connection master;
+
+drop table t1;
+
+# End cleanup
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_ndb_bank.test b/mysql-test/t/rpl_ndb_bank.test
new file mode 100644
index 00000000000..d6a10e4ccac
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_bank.test
@@ -0,0 +1,181 @@
+#
+# Currently this test only runs in the source tree with the
+# ndb/test programs compiled.
+# invoke with: ./mysql-test-run --ndb-extra-test --do-test=rpl_ndb_bank
+#
+# 1. start a "bank" application running on the master cluster
+# 2. perform online sync of slave
+# 3. periodically check consistency of slave
+# 4. stop the bank application
+# 5. check that the slave and master BANK databases are the same
+#
+
+--source include/have_ndb.inc
+--source include/have_ndb_extra.inc
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+# kill any trailing processes
+--system killall lt-bankTransactionMaker lt-bankTimer lt-bankMakeGL || true
+
+--disable_warnings
+# initialize master
+--connection master
+CREATE DATABASE IF NOT EXISTS BANK;
+DROP DATABASE BANK;
+CREATE DATABASE BANK default charset=latin1 default collate=latin1_bin;
+--enable_warnings
+
+#
+# These tables should correspond to the table definitions in
+# storage/ndb/test/src/NDBT_Tables.cpp
+#
+--connection master
+USE BANK;
+CREATE TABLE GL ( TIME BIGINT UNSIGNED NOT NULL,
+ ACCOUNT_TYPE INT UNSIGNED NOT NULL,
+ BALANCE INT UNSIGNED NOT NULL,
+ DEPOSIT_COUNT INT UNSIGNED NOT NULL,
+ DEPOSIT_SUM INT UNSIGNED NOT NULL,
+ WITHDRAWAL_COUNT INT UNSIGNED NOT NULL,
+ WITHDRAWAL_SUM INT UNSIGNED NOT NULL,
+ PURGED INT UNSIGNED NOT NULL,
+ PRIMARY KEY USING HASH (TIME,ACCOUNT_TYPE))
+ ENGINE = NDB;
+
+CREATE TABLE ACCOUNT ( ACCOUNT_ID INT UNSIGNED NOT NULL,
+ OWNER INT UNSIGNED NOT NULL,
+ BALANCE INT UNSIGNED NOT NULL,
+ ACCOUNT_TYPE INT UNSIGNED NOT NULL,
+ PRIMARY KEY USING HASH (ACCOUNT_ID))
+ ENGINE = NDB;
+
+CREATE TABLE TRANSACTION ( TRANSACTION_ID BIGINT UNSIGNED NOT NULL,
+ ACCOUNT INT UNSIGNED NOT NULL,
+ ACCOUNT_TYPE INT UNSIGNED NOT NULL,
+ OTHER_ACCOUNT INT UNSIGNED NOT NULL,
+ TRANSACTION_TYPE INT UNSIGNED NOT NULL,
+ TIME BIGINT UNSIGNED NOT NULL,
+ AMOUNT INT UNSIGNED NOT NULL,
+ PRIMARY KEY USING HASH (TRANSACTION_ID,ACCOUNT))
+ ENGINE = NDB;
+
+CREATE TABLE SYSTEM_VALUES ( SYSTEM_VALUES_ID INT UNSIGNED NOT NULL,
+ VALUE BIGINT UNSIGNED NOT NULL,
+ PRIMARY KEY USING HASH (SYSTEM_VALUES_ID))
+ ENGINE = NDB;
+
+CREATE TABLE ACCOUNT_TYPE ( ACCOUNT_TYPE_ID INT UNSIGNED NOT NULL,
+ DESCRIPTION CHAR(64) NOT NULL,
+ PRIMARY KEY USING HASH (ACCOUNT_TYPE_ID))
+ ENGINE = NDB;
+
+#
+# create "BANK" application
+#
+--exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/bank/bankCreator >> $NDB_TOOLS_OUTPUT
+
+#
+# start main loop
+# repeat backup-restore-check
+#
+
+# set this high if testing to run many syncs in loop
+--let $2=1
+while ($2)
+{
+
+#
+# start "BANK" application
+#
+--exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/bank/bankTimer -w 5 >> $NDB_TOOLS_OUTPUT &
+--exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/bank/bankMakeGL >> $NDB_TOOLS_OUTPUT &
+--exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/bank/bankTransactionMaker >> $NDB_TOOLS_OUTPUT &
+
+#
+# let the "BANK" run for a while
+#
+--sleep 5
+
+--disable_warnings
+# initialize slave for sync
+--connection slave
+STOP SLAVE;
+RESET SLAVE;
+# to make sure we drop any ndbcluster tables
+CREATE DATABASE IF NOT EXISTS BANK;
+DROP DATABASE BANK;
+# create database
+CREATE DATABASE BANK;
+--enable_warnings
+
+#
+# Time to sync the slave:
+# start by taking a backup on master
+--connection master
+RESET MASTER;
+--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT
+
+# there is no neat way to find the backupid, this is a hack to find it...
+--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat
+CREATE TABLE IF NOT EXISTS cluster.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM cluster.backup_info;
+LOAD DATA INFILE '../tmp.dat' INTO TABLE cluster.backup_info FIELDS TERMINATED BY ',';
+--exec rm $MYSQLTEST_VARDIR/tmp.dat || true
+--replace_column 1 <the_backup_id>
+SELECT @the_backup_id:=backup_id FROM cluster.backup_info;
+let the_backup_id=`select @the_backup_id`;
+
+# restore on slave, first check that nothing is there
+--connection slave
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 8 -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+
+#
+# now setup replication to continue from last epoch
+--source include/ndb_setup_slave.inc
+--connection slave
+START SLAVE;
+
+
+#
+# Now loop and check consistency every 2 seconds on slave
+#
+--connection slave
+--let $1=10
+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>
+ SHOW SLAVE STATUS;
+ STOP SLAVE;
+ --exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT_SLAVE ../storage/ndb/test/ndbapi/bank/bankValidateAllGLs >> $NDB_TOOLS_OUTPUT
+ START SLAVE;
+ --dec $1
+}
+
+#
+# Stop transactions
+#
+--exec killall lt-bankTransactionMaker lt-bankTimer lt-bankMakeGL
+
+#
+# Check that the databases are the same on slave and master
+# 1. dump database BANK on both master and slave
+# 2. compare, there should be no difference
+#
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info BANK ACCOUNT_TYPE ACCOUNT GL TRANSACTION > $MYSQLTEST_VARDIR/tmp/master_BANK.sql
+--connection master
+use test;
+create table t1 (a int primary key) engine=ndb;
+insert into t1 values (1);
+--sync_slave_with_master
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info BANK ACCOUNT_TYPE ACCOUNT GL TRANSACTION > $MYSQLTEST_VARDIR/tmp/slave_BANK.sql
+--connection master
+drop table t1;
+
+--exec diff $MYSQLTEST_VARDIR/tmp/master_BANK.sql $MYSQLTEST_VARDIR/tmp/slave_BANK.sql
+
+ --dec $2
+}
diff --git a/mysql-test/t/rpl_ndb_basic.test b/mysql-test/t/rpl_ndb_basic.test
new file mode 100644
index 00000000000..5290dc377c2
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_basic.test
@@ -0,0 +1,187 @@
+--source include/have_ndb.inc
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+
+
+#
+# Bug #11087
+#
+# connect to the master and create tabe t1 in gotoslave database
+--connection master
+CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
+ `nom` char(4) default NULL,
+ `prenom` char(4) default NULL,
+ PRIMARY KEY (`nid`))
+ ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+
+INSERT INTO t1 VALUES(1,"XYZ1","ABC1");
+select * from t1 order by nid;
+
+--sync_slave_with_master
+# connect to slave and ensure data it there.
+--connection slave
+select * from t1 order by nid;
+
+--connection master
+delete from t1;
+INSERT INTO t1 VALUES(1,"XYZ2","ABC2");
+# Make sure all rows are on the master
+select * from t1 order by nid;
+
+# make sure all rows are on the slave.
+--sync_slave_with_master
+--connection slave
+# Bug #11087 would have row with nid 2 missing
+select * from t1 order by nid;
+
+--connection master
+DROP table t1;
+
+#
+# Test replication of table with no primary key
+#
+--connection master
+CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
+ `nom` char(4) default NULL,
+ `prenom` char(4) default NULL)
+ ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+
+INSERT INTO t1 VALUES(1,"XYZ1","ABC1"),(2,"AAA","BBB"),(3,"CCC","DDD");
+select * from t1 order by nid;
+
+--sync_slave_with_master
+# connect to slave and ensure data it there.
+--connection slave
+select * from t1 order by nid;
+
+--connection master
+delete from t1 where nid = 2;
+INSERT INTO t1 VALUES(4,"EEE","FFF");
+# Make sure all rows are on the master
+select * from t1 order by nid;
+
+# make sure all rows are on the slave.
+--sync_slave_with_master
+--connection slave
+select * from t1 order by nid;
+
+--connection master
+UPDATE t1 set nid=nid+1;
+UPDATE t1 set nom="CCP" where nid = 4;
+select * from t1 order by nid;
+
+# make sure all rows are on the slave.
+--sync_slave_with_master
+--connection slave
+select * from t1 order by nid;
+
+--connection master
+DROP table t1;
+
+##################################################################
+#
+# Check that retries are made on the slave on some temporary errors
+#
+
+#
+# 1. Deadlock
+#
+--connection master
+CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
+ `nom` char(4) default NULL,
+ `prenom` char(4) default NULL,
+ PRIMARY KEY USING HASH (`nid`))
+ ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES(1,"XYZ1","ABC1");
+
+# cause a lock on that row on the slave
+--sync_slave_with_master
+--connection slave
+--echo **** On Slave ****
+BEGIN;
+UPDATE t1 SET `nom`="LOCK" WHERE `nid`=1;
+
+# set number of retries low so we fail the retries
+set GLOBAL slave_transaction_retries=1;
+
+# now do a change to this row on the master
+# will deadlock on the slave because of lock above
+--connection master
+--echo **** On Master ****
+UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1;
+
+# wait for deadlock to be detected
+# sleep longer than dead lock detection timeout in config
+# we do this 2 times, once with few retries to verify that we
+# get a failure with the set sleep, and once with the _same_
+# sleep, but with more retries to get it to succeed
+--sleep 5
+
+# replication should have stopped, since max retries where not enough
+# verify with show slave status
+--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> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master>
+--query_vertical SHOW SLAVE STATUS;
+
+# now set max retries high enough to succeed, and start slave again
+set GLOBAL slave_transaction_retries=10;
+START SLAVE;
+# wait for deadlock to be detected and retried
+# should be the same sleep as above for test to be valid
+--sleep 5
+
+# commit transaction to release lock on row and let replication succeed
+select * from t1 order by nid;
+COMMIT;
+
+# verify that the row succeded to be applied on the slave
+--connection master
+--sync_slave_with_master
+--connection slave
+select * from t1 order by nid;
+
+# cleanup
+--connection master
+DROP TABLE t1;
+
+
+#
+# BUG#18094
+# Slave caches invalid table definition after atlters causes select failure
+#
+--connection master
+CREATE TABLE t1 (c1 INT KEY) ENGINE=NDB;
+
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+ALTER TABLE t1 ADD c2 INT;
+
+--sync_slave_with_master
+connection slave;
+SELECT * FROM t1 ORDER BY c1;
+
+connection master;
+ALTER TABLE t1 CHANGE c2 c2 TEXT CHARACTER SET utf8;
+ALTER TABLE t1 CHANGE c2 c2 BLOB;
+
+--sync_slave_with_master
+connection slave;
+# here we would get error 1412 prior to bug
+SELECT * FROM t1 ORDER BY c1 LIMIT 5;
+
+--connection master
+TRUNCATE t1;
+SELECT count(*) FROM t1;
+INSERT INTO t1 VALUES (101,NULL),(102,NULL),(103,NULL),(104,NULL),(105,NULL),(106,NULL),(107,NULL),(108,NULL),(109,NULL),(1010,NULL);
+--sync_slave_with_master
+connection slave;
+SELECT count(*) FROM t1;
+SELECT c1 FROM t1 ORDER BY c1 LIMIT 5;
+
+# cleanup
+--connection master
+DROP TABLE t1;
+-- source include/master-slave-end.inc
diff --git a/mysql-test/t/rpl_ndb_blob.test b/mysql-test/t/rpl_ndb_blob.test
new file mode 100644
index 00000000000..94af986b222
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_blob.test
@@ -0,0 +1,142 @@
+--source include/have_ndb.inc
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+#
+# basic test of blob replication for NDB
+#
+
+# easy test
+
+--connection master
+create table t1 (
+ a int not null primary key,
+ b text not null
+) engine=ndb;
+
+insert into t1 values(1, repeat('abc',10));
+insert into t1 values(2, repeat('def',200));
+insert into t1 values(3, repeat('ghi',3000));
+
+select 'M', a, sha1(b) from t1
+order by a;
+
+--sync_slave_with_master
+--sleep 5
+--connection slave
+select 'S', a, sha1(b) from t1
+order by a;
+
+--connection master
+drop table t1;
+--sync_slave_with_master
+
+# hard test
+
+--connection master
+create table t1 (
+ a int not null primary key,
+ b text not null,
+ c int,
+ d longblob,
+ e tinyblob
+) engine=ndbcluster;
+
+--disable_query_log
+# length 61
+set @s0 = 'rggurloniukyehuxdbfkkyzlceixzrehqhvxvxbpwizzvjzpucqmzrhzxzfau';
+set @s1 = 'ykyymbzqgqlcjhlhmyqelfoaaohvtbekvifukdtnvcrrjveevfakxarxexomz';
+set @s2 = 'dbnfqyzgtqxalcrwtfsqabknvtfcbpoonxsjiqvmhnfikxxhcgoexlkoezvah';
+--enable_query_log
+
+insert into t1 values (
+ 0, repeat(@s2,454), 100, repeat(@s2,345), NULL);
+insert into t1 values (
+ 1, repeat(@s0,504), NULL, repeat(@s1,732), repeat(@s1,1));
+insert into t1 values (
+ 2, '', 102, '', repeat(@s2,1));
+insert into t1 values (
+ 3, repeat(@s0,545), 103, repeat(@s2,788), repeat(@s0,1));
+insert into t1 values (
+ 4, repeat(@s1,38), 104, repeat(@s0,260), repeat(@s0,1));
+insert into t1 values (
+ 5, repeat(@s2,12), 105, repeat(@s2,40), repeat(@s1,1));
+insert into t1 values (
+ 6, repeat(@s1,242), 106, NULL, repeat(@s1,1));
+insert into t1 values (
+ 7, repeat(@s1,30), 107, repeat(@s0,161), '');
+insert into t1 values (
+ 8, repeat(@s1,719), 108, repeat(@s2,104), NULL);
+insert into t1 values (
+ 9, repeat(@s2,427), NULL, NULL, NULL);
+
+select 'M', a, sha1(b), c, sha1(d), sha1(e)
+from t1 order by a;
+
+--sync_slave_with_master
+--sleep 5
+--connection slave
+select 'S', a, sha1(b), c, sha1(d), sha1(e)
+from t1 order by a;
+
+--connection master
+drop table t1;
+--sync_slave_with_master
+
+# table with varsize key (future cluster/schema)
+
+# sql/ha_ndbcluster_binlog.cc
+--connection master
+CREATE TABLE IF NOT EXISTS t1 (
+ db VARBINARY(63) NOT NULL,
+ name VARBINARY(63) NOT NULL,
+ slock BINARY(32) NOT NULL,
+ query BLOB NOT NULL,
+ node_id INT UNSIGNED NOT NULL,
+ epoch BIGINT UNSIGNED NOT NULL,
+ id INT UNSIGNED NOT NULL,
+ version INT UNSIGNED NOT NULL,
+ type INT UNSIGNED NOT NULL,
+ PRIMARY KEY USING HASH (db,name))
+ENGINE=NDB;
+
+insert into t1 values ('test','t1',
+ 'abc',repeat(@s0,10), 11,12,13,14,15);
+insert into t1 values ('test','t2',
+ 'def',repeat(@s1,100), 21,22,23,24,25);
+insert into t1 values ('test','t3',
+ 'ghi',repeat(@s2,1000),31,32,33,34,35);
+insert into t1 values ('testtttttttttt','t1',
+ 'abc',repeat(@s0,10), 11,12,13,14,15);
+insert into t1 values ('testttttttttttt','t1',
+ 'def',repeat(@s1,100), 21,22,23,24,25);
+insert into t1 values ('testtttttttttttt','t1',
+ 'ghi',repeat(@s2,1000),31,32,33,34,35);
+insert into t1 values ('t','t11111111111',
+ 'abc',repeat(@s0,10), 11,12,13,14,15);
+insert into t1 values ('t','t111111111111',
+ 'def',repeat(@s1,100), 21,22,23,24,25);
+insert into t1 values ('t','t1111111111111',
+ 'ghi',repeat(@s2,1000),31,32,33,34,35);
+
+select 'M', db, name, sha1(query), node_id, epoch, id, version, type
+from t1 order by db, name;
+
+--sync_slave_with_master
+--sleep 5
+--connection slave
+select 'S', db, name, sha1(query), node_id, epoch, id, version, type
+from t1 order by db, name;
+
+--connection master
+drop table t1;
+--sync_slave_with_master
+
+#
+# view the binlog - not deterministic (mats)
+#
+
+#--connection master
+#let $VERSION=`select version()`;
+#--replace_result $VERSION VERSION
+#show binlog events;
diff --git a/mysql-test/t/rpl_ndb_blob2.test b/mysql-test/t/rpl_ndb_blob2.test
new file mode 100644
index 00000000000..2e8f02eaf75
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_blob2.test
@@ -0,0 +1,9 @@
+#################################
+# Wrapper for rpl_row_blob.test #
+# Using wrapper to share test #
+# code between engine tests #
+#################################
+-- source include/have_ndb.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
new file mode 100644
index 00000000000..eb412a0349a
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_charset.test
@@ -0,0 +1,6 @@
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+########################################################
+--source include/have_ndb.inc
+let $engine_type=NDB;
+-- source extra/rpl_tests/rpl_row_charset.test
diff --git a/mysql-test/t/rpl_ndb_commit_afterflush.test b/mysql-test/t/rpl_ndb_commit_afterflush.test
new file mode 100644
index 00000000000..ce2a4d9506c
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_commit_afterflush.test
@@ -0,0 +1,9 @@
+#####################################
+# Wrapper for rpl_commit_after_flush#
+# Wrapped to reuse test code on #
+# Different engines #
+# By JBM 2004-02-15 #
+#####################################
+-- source include/have_ndb.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
new file mode 100644
index 00000000000..1fe36ecd8a1
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_dd_advance.test
@@ -0,0 +1,580 @@
+###############################################
+# Author: JBM #
+# Date: 2006-03-07 #
+# Purpose: To test advance DD and replication #
+###############################################
+
+#### Include Section ####
+--source include/have_ndb.inc
+--source include/have_binlog_format_row.inc
+--source include/ndb_default_cluster.inc
+--source include/not_embedded.inc
+#--source include/have_ndb_extra.inc
+--source include/master-slave.inc
+
+#### Test start cleanup section #####
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2, t3;
+--enable_warnings
+
+######################################################
+# Requirment: Cluster DD and replication must be able#
+# to handle ALTER tables and indexes and must rpl #
+# to the slave correctly #
+######################################################
+
+## Test #1 replication of CDD and Alter Tables #####
+--echo ***** Test 1 RPL of CDD and Alter *****
+--echo ***** Test 1 setup *****
+
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE 4M
+ENGINE=NDB;
+
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M
+ENGINE=NDB;
+
+ALTER TABLESPACE ts1
+ADD DATAFILE 'datafile02.dat'
+INITIAL_SIZE 4M
+ENGINE=NDB;
+
+CREATE TABLE t1
+ (c1 INT NOT NULL PRIMARY KEY,
+ c2 INT NOT NULL,
+ c3 INT NOT NULL)
+ TABLESPACE ts1 STORAGE DISK
+ ENGINE=NDB;
+
+--echo ***** insert some data *****
+
+let $j= 900;
+--disable_query_log
+while ($j)
+{
+ eval INSERT INTO t1 VALUES($j,$j*2,$j+3);
+ dec $j;
+}
+--enable_query_log
+
+--echo ***** Select from Master *****
+
+SELECT * FROM t1 ORDER BY c1 LIMIT 5;
+
+--echo ***** Select from Slave *****
+--sync_slave_with_master
+connection slave;
+SELECT * FROM t1 ORDER BY c1 LIMIT 5;
+
+###################################
+# Just to some File Schema check #
+###################################
+
+--disable_query_log
+SELECT DISTINCT FILE_NAME, FILE_TYPE, TABLESPACE_NAME, LOGFILE_GROUP_NAME
+ FROM INFORMATION_SCHEMA.FILES
+ WHERE ENGINE="ndbcluster" ORDER BY FILE_NAME;
+--enable_query_log
+
+--echo **** Do First Set of ALTERs in the master table ****
+###################################################
+# On this first set of alters I expect:
+# 1. To be able to create and index on 2 columns
+# 2. To be able to create a unique index
+# 3. To be able to add two columns and have
+# it all replicated correctly to the slave cluster.
+###################################################
+connection master;
+CREATE INDEX t1_i ON t1(c2, c3);
+#Bug 18039
+#CREATE UNIQUE INDEX t1_i2 ON t1(c2);
+ALTER TABLE t1 ADD c4 TIMESTAMP;
+ALTER TABLE t1 ADD c5 DOUBLE;
+ALTER TABLE t1 ADD INDEX (c5);
+SHOW CREATE TABLE t1;
+
+--echo **** Show first set of ALTERs on SLAVE ****
+--sync_slave_with_master
+connection slave;
+SHOW CREATE TABLE t1;
+
+--echo **** Second set of alters test 1 ****
+############################################
+# With this next set of alters we have had
+# Some issues with renames of tables. So this
+# test renames our main table, drop and index off
+# of it, creates another table with then name
+# of the orginal table, inserts a row, drops
+# the table and renames the orginal table back.
+# I want to make sure that 1) the cluster does
+# okay with this and 2) that it is replicated
+# correctly.
+#############################################
+connection master;
+ALTER TABLE t1 RENAME t2;
+ALTER TABLE t2 DROP INDEX c5;
+CREATE TABLE t1(c1 INT)ENGINE=NDB;
+INSERT INTO t1 VALUES(1);
+DROP TABLE t1;
+ALTER TABLE t2 RENAME t1;
+
+--echo **** Show second set of ALTERs on MASTER ****
+
+SHOW CREATE TABLE t1;
+
+--echo **** Show second set of ALTERs on SLAVE ****
+--sync_slave_with_master
+connection slave;
+SHOW CREATE TABLE t1;
+
+--echo **** Third and last set of alters for test1 ****
+#########################################################
+# In this last set of alters, we are messing with the
+# cluster ability to rebuild indexes, drop a column that make up
+# an index with another column and change types several times in
+# a row. I have choosen the BLOB as it seems to have had many
+# issues in this release. I want to make sure that the cluster
+# deals with these radical changes and that the replication to
+# the slave cluster is dones correctly.
+###########################################################
+connection master;
+ALTER TABLE t1 CHANGE c1 c1 DOUBLE;
+ALTER TABLE t1 CHANGE c2 c2 DECIMAL(10,2);
+ALTER TABLE t1 DROP COLUMN c3;
+ALTER TABLE t1 CHANGE c4 c4 TEXT CHARACTER SET utf8;
+ALTER TABLE t1 CHANGE c4 c4 BLOB;
+ALTER TABLE t1 CHANGE c4 c3 BLOB;
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+UPDATE t1 SET c3=@b1 where c1 = 1;
+UPDATE t1 SET c3=@b1 where c1 = 2;
+
+--echo **** Show last set of ALTERs on MASTER ****
+
+SHOW CREATE TABLE t1;
+SELECT * FROM t1 ORDER BY c1 LIMIT 5;
+
+--echo **** Show last set of ALTERs on SLAVE ****
+--sync_slave_with_master
+connection slave;
+SHOW CREATE TABLE t1;
+# Bug 18094
+#SELECT * FROM t1 ORDER BY c1 LIMIT 5;
+SELECT * FROM t1 where c1 = 1;
+
+connection master;
+DROP TABLE t1;
+--sync_slave_with_master
+connection slave;
+STOP SLAVE;
+RESET SLAVE;
+connection master;
+RESET MASTER;
+connection slave;
+START SLAVE;
+
+################### TEST 2 TPCB for disk data ###########################
+# Requirement: To have Stored Procedures and Functions that are used to #
+# populate and post transactions to the data base using CDD that span #
+# 2 tables spaces and also use a memory only cluster tables. In addition#
+# The slave is to be stopped, cleaned and restored and synced with the #
+# Master cluster #
+#########################################################################
+
+--echo ******** Create additional TABLESPACE test 2 **************
+
+connection master;
+CREATE TABLESPACE ts2
+ADD DATAFILE 'datafile03.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M
+ENGINE=NDB;
+
+ALTER TABLESPACE ts2
+ADD DATAFILE 'datafile04.dat'
+INITIAL_SIZE 12M
+ENGINE=NDB;
+
+###### CLEAN UP SECTION ##############
+DROP DATABASE IF EXISTS tpcb;
+CREATE DATABASE tpcb;
+######## Creat Table Section #########
+--echo *********** Create TPCB Tables *****************
+CREATE TABLE tpcb.account
+ (id INT, bid INT, balance DECIMAL(10,2),
+ filler CHAR(255), PRIMARY KEY(id))
+ TABLESPACE ts1 STORAGE DISK
+ ENGINE=NDB;
+
+CREATE TABLE tpcb.branch
+ (bid INT, balance DECIMAL(10,2), filler VARCHAR(255),
+ PRIMARY KEY(bid))
+ ENGINE=NDB;
+
+CREATE TABLE tpcb.teller
+ (tid INT, balance DECIMAL(10,2), filler VARCHAR(255),
+ PRIMARY KEY(tid))
+ TABLESPACE ts2 STORAGE DISK
+ ENGINE=NDB;
+
+CREATE TABLE tpcb.history
+ (id MEDIUMINT NOT NULL AUTO_INCREMENT,aid INT,
+ tid INT, bid INT, amount DECIMAL(10,2),
+ tdate DATETIME, teller CHAR(20), uuidf LONGBLOB,
+ filler CHAR(80),PRIMARY KEY (id))
+ TABLESPACE ts2 STORAGE DISK
+ ENGINE=NDB;
+
+--echo ********* Create Procedures and Functions ************
+delimiter |;
+CREATE PROCEDURE tpcb.load()
+BEGIN
+ DECLARE acct INT DEFAULT 1000;
+ DECLARE brch INT DEFAULT 100;
+ DECLARE tell INT DEFAULT 1000;
+ DECLARE tmp INT DEFAULT 100;
+ WHILE brch > 0 DO
+ SET tmp = 100;
+ WHILE tmp > 0 DO
+ INSERT INTO tpcb.account VALUES (acct, brch, 0.0, "FRESH ACCOUNT");
+ SET acct = acct - 1;
+ SET tmp = tmp -1;
+ END WHILE;
+ INSERT INTO tpcb.branch VALUES (brch, 0.0, "FRESH BRANCH");
+ SET brch = brch - 1;
+ END WHILE;
+ WHILE tell > 0 DO
+ INSERT INTO tpcb.teller VALUES (tell, 0.0, "FRESH TELLER");
+ SET tell = tell - 1;
+ END WHILE;
+END|
+
+CREATE FUNCTION tpcb.account_id () RETURNS INT
+BEGIN
+ DECLARE num INT;
+ DECLARE ran INT;
+ SELECT RAND() * 10 INTO ran;
+ IF (ran < 2)
+ THEN
+ SELECT RAND() * 10 INTO num;
+ ELSEIF (ran < 4)
+ THEN
+ SELECT RAND() * 100 INTO num;
+ ELSE
+ SELECT RAND() * 1000 INTO num;
+ END IF;
+ IF (num < 1)
+ THEN
+ RETURN 1;
+ END IF;
+ RETURN num;
+END|
+
+CREATE FUNCTION tpcb.teller_id () RETURNS INT
+BEGIN
+ DECLARE num INT;
+ DECLARE ran INT;
+ SELECT RAND() * 10 INTO ran;
+ IF (ran < 2)
+ THEN
+ SELECT RAND() * 10 INTO num;
+ ELSEIF (ran < 5)
+ THEN
+ SELECT RAND() * 100 INTO num;
+ ELSE
+ SELECT RAND() * 1000 INTO num;
+ END IF;
+ IF (num < 1)
+ THEN
+ RETURN 1;
+ END IF;
+ RETURN num;
+END|
+
+CREATE PROCEDURE tpcb.trans()
+BEGIN
+ DECLARE acct INT DEFAULT 0;
+ DECLARE brch INT DEFAULT 0;
+ DECLARE tell INT DEFAULT 0;
+ DECLARE bal DECIMAL(10,2) DEFAULT 0.0;
+ DECLARE amount DECIMAL(10,2) DEFAULT 1.00;
+ DECLARE test INT DEFAULT 0;
+ DECLARE bbal DECIMAL(10,2) DEFAULT 0.0;
+ DECLARE tbal DECIMAL(10,2) DEFAULT 0.0;
+ DECLARE local_uuid VARCHAR(255);
+ DECLARE local_user VARCHAR(255);
+ DECLARE local_time TIMESTAMP;
+
+ SELECT RAND() * 10 INTO test;
+ SELECT tpcb.account_id() INTO acct;
+ SELECT tpcb.teller_id() INTO tell;
+
+ SELECT account.balance INTO bal FROM tpcb.account WHERE id = acct;
+ SELECT account.bid INTO brch FROM tpcb.account WHERE id = acct;
+ SELECT teller.balance INTO tbal FROM tpcb.teller WHERE tid = tell;
+ SELECT branch.balance INTO bbal FROM tpcb.branch WHERE bid = brch;
+
+ IF (test < 5)
+ THEN
+ SET bal = bal + amount;
+ SET bbal = bbal + amount;
+ SET tbal = tbal + amount;
+ UPDATE tpcb.account SET balance = bal, filler = 'account updated'
+ WHERE id = acct;
+ UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated'
+ WHERE bid = brch;
+ UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated'
+ WHERE tid = tell;
+ ELSE
+ SET bal = bal - amount;
+ SET bbal = bbal - amount;
+ SET tbal = tbal - amount;
+ UPDATE tpcb.account SET balance = bal, filler = 'account updated'
+ WHERE id = acct;
+ UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated'
+ WHERE bid = brch;
+ UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated'
+ WHERE tid = tell;
+ END IF;
+
+ SET local_uuid=UUID();
+ SET local_user=USER();
+ SET local_time= NOW();
+ INSERT INTO tpcb.history VALUES(NULL,acct,tell,brch,amount, local_time,local_user,
+ local_uuid,'completed trans');
+END|
+delimiter ;|
+
+--echo ****** TEST 2 test time *********************************
+USE tpcb;
+
+--echo *********** Load up the database ******************
+CALL tpcb.load();
+
+--echo ********** Check load master and slave **************
+SELECT COUNT(*) FROM account;
+--sync_slave_with_master
+connection slave;
+USE tpcb;
+SELECT COUNT(*) FROM account;
+
+--echo ******** Run in some transactions ***************
+
+connection master;
+let $j= 1000;
+--disable_query_log
+while ($j)
+{
+ CALL tpcb.trans();
+ dec $j;
+}
+--enable_query_log
+
+--echo ***** Time to try slave sync ***********
+--echo **** Must make sure slave is clean *****
+--connection slave
+STOP SLAVE;
+RESET SLAVE;
+DROP PROCEDURE tpcb.load;
+DROP PROCEDURE tpcb.trans;
+DROP TABLE tpcb.account;
+DROP TABLE tpcb.teller;
+DROP TABLE tpcb.branch;
+DROP TABLE tpcb.history;
+DROP DATABASE tpcb;
+
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile.dat'
+ENGINE=NDB;
+
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile02.dat'
+ENGINE=NDB;
+
+DROP TABLESPACE ts1 ENGINE=NDB;
+
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile03.dat'
+ENGINE=NDB;
+
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile04.dat'
+ENGINE=NDB;
+
+DROP TABLESPACE ts2 ENGINE=NDB;
+
+DROP LOGFILE GROUP lg1 ENGINE=NDB;
+
+--echo ********** Take a backup of the Master *************
+connection master;
+
+SELECT COUNT(*) FROM history;
+
+let $j= 1000;
+--disable_query_log
+while ($j)
+{
+ CALL tpcb.trans();
+ dec $j;
+}
+--enable_query_log
+
+SELECT COUNT(*) FROM history;
+
+#RESET MASTER;
+--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT
+
+--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat
+
+CREATE TEMPORARY TABLE IF NOT EXISTS cluster.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+
+DELETE FROM cluster.backup_info;
+
+LOAD DATA INFILE '../tmp.dat' INTO TABLE cluster.backup_info FIELDS TERMINATED BY ',';
+--exec rm $MYSQLTEST_VARDIR/tmp.dat || true
+--replace_column 1 <the_backup_id>
+
+SELECT @the_backup_id:=backup_id FROM cluster.backup_info;
+
+let the_backup_id=`select @the_backup_id`;
+
+DROP TABLE IF EXISTS cluster.backup_info;
+#RESET MASTER;
+
+--echo ************ Restore the slave ************************
+connection slave;
+CREATE DATABASE tpcb;
+--source include/ndb_restore_slave_eoption.inc
+
+--echo ***** Check a few slave restore values ***************
+connection slave;
+USE tpcb;
+SELECT COUNT(*) FROM account;
+
+--echo ***** Add some more records to master *********
+connection master;
+let $j= 1000;
+--disable_query_log
+while ($j)
+{
+ CALL tpcb.trans();
+ dec $j;
+}
+--enable_query_log
+
+#
+# now setup replication to continue from last epoch
+# 1. get apply_status epoch from slave
+# 2. get corresponding _next_ binlog postition from master
+# 3. change master on slave
+# 4. add some transaction for slave to process
+# 5. start the replication
+
+--echo ***** Finsh the slave sync process *******
+--disable_query_log
+# 1. 2. 3.
+--source include/ndb_setup_slave.inc
+--enable_query_log
+
+# 4.
+--echo * 4. *
+connection master;
+let $j= 1000;
+--disable_query_log
+while ($j)
+{
+ CALL tpcb.trans();
+ dec $j;
+}
+--enable_query_log
+
+# 5.
+--echo * 5. *
+connection slave;
+START SLAVE;
+
+--echo **** We should be ready to continue on *************
+
+connection master;
+let $j= 50;
+--disable_query_log
+while ($j)
+{
+ CALL tpcb.trans();
+ dec $j;
+}
+--enable_query_log
+
+--echo ****** Let's make sure we match *******
+--echo ***** MASTER *******
+USE tpcb;
+SELECT COUNT(*) FROM history;
+
+--echo ****** SLAVE ********
+--sync_slave_with_master
+connection slave;
+USE tpcb;
+SELECT COUNT(*) FROM history;
+
+--echo *** DUMP MASTER & SLAVE FOR COMPARE ********
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert tpcb account teller branch history > $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_M.sql
+
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert tpcb account teller branch history > $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_S.sql
+
+--echo *************** TEST 2 CLEANUP SECTION ********************
+connection master;
+DROP PROCEDURE tpcb.load;
+DROP PROCEDURE tpcb.trans;
+DROP TABLE tpcb.account;
+DROP TABLE tpcb.teller;
+DROP TABLE tpcb.branch;
+DROP TABLE tpcb.history;
+DROP DATABASE tpcb;
+
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile.dat'
+ENGINE=NDB;
+
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile02.dat'
+ENGINE=NDB;
+
+DROP TABLESPACE ts1 ENGINE=NDB;
+
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile03.dat'
+ENGINE=NDB;
+
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile04.dat'
+ENGINE=NDB;
+
+DROP TABLESPACE ts2 ENGINE=NDB;
+
+DROP LOGFILE GROUP lg1 ENGINE=NDB;
+
+--sync_slave_with_master
+
+connection master;
+
+--echo ****** Do dumps compare ************
+
+--exec diff $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_M.sql $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_S.sql
+
+## Note: Ths files should only get removed, if the above diff succeeds.
+
+--exec rm $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_M.sql
+--exec rm $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_S.sql
+
+# End 5.1 test case
diff --git a/mysql-test/t/rpl_ndb_dd_basic.test b/mysql-test/t/rpl_ndb_dd_basic.test
new file mode 100644
index 00000000000..104be91e6e4
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_dd_basic.test
@@ -0,0 +1,85 @@
+--source include/have_ndb.inc
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+#
+# Basic test of disk tables for NDB
+#
+
+#
+# Start by creating a logfile group
+#
+
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+
+alter logfile group lg1
+add undofile 'undofile02.dat'
+initial_size 4M engine=ndb;
+
+#
+# Create a tablespace connected to the logfile group
+#
+
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M
+ENGINE NDB;
+
+alter tablespace ts1
+add datafile 'datafile02.dat'
+initial_size 4M engine=ndb;
+
+#
+# Create a table using this tablespace
+#
+
+CREATE TABLE t1
+(pk1 int not null primary key, b int not null, c int not null)
+tablespace ts1 storage disk
+engine ndb;
+
+#
+# insert some data
+#
+
+insert into t1 values (1,2,3);
+select * from t1 order by pk1;
+
+#
+# check that the data is also on the slave
+#
+
+--sync_slave_with_master
+--connection slave
+select * from t1 order by pk1;
+
+#
+# view the binlog
+#
+
+--connection master
+-- source include/show_binlog_events.inc
+
+#
+# cleanup
+#
+
+drop table t1;
+alter tablespace ts1
+drop datafile 'datafile.dat'
+engine=ndb;
+alter tablespace ts1
+drop datafile 'datafile02.dat'
+engine=ndb;
+DROP TABLESPACE ts1 ENGINE=NDB;
+DROP LOGFILE GROUP lg1 ENGINE=NDB;
+-- source include/master-slave-end.inc
diff --git a/mysql-test/t/rpl_ndb_dd_partitions.test b/mysql-test/t/rpl_ndb_dd_partitions.test
new file mode 100644
index 00000000000..9291f38e8db
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_dd_partitions.test
@@ -0,0 +1,310 @@
+#######################################
+# Author: JBM #
+# Date: 2006-03-09 #
+# Purpose: To test the replication of #
+# Cluster Disk Data using partitions #
+#######################################
+
+--source include/have_ndb.inc
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+--echo --- Doing pre test cleanup ---
+
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_query_log
+
+
+# Start by creating a logfile group
+##################################
+
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+
+ALTER LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile02.dat'
+INITIAL_SIZE = 4M
+ENGINE=NDB;
+
+###################################################
+# Create a tablespace connected to the logfile group
+###################################################
+
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M
+ENGINE NDB;
+
+ALTER TABLESPACE ts1
+ADD DATAFILE 'datafile02.dat'
+INITIAL_SIZE = 4M
+ENGINE=NDB;
+
+#################################################################
+
+--echo --- Start test 2 partition RANGE testing --
+--echo --- Do setup --
+
+
+#################################################
+# Requirment: Create table that is partitioned #
+# by range on year i.e. year(t) and replicate #
+# basice operations such at insert, update #
+# delete between 2 different storage engines #
+# Alter table and ensure table is handled #
+# Correctly on the slave #
+#################################################
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63),
+ bc CHAR(63), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE)
+ TABLESPACE ts1 STORAGE DISK
+ ENGINE=NDB
+ PARTITION BY RANGE (YEAR(t))
+ (PARTITION p0 VALUES LESS THAN (1901),
+ PARTITION p1 VALUES LESS THAN (1946),
+ PARTITION p2 VALUES LESS THAN (1966),
+ PARTITION p3 VALUES LESS THAN (1986),
+ PARTITION p4 VALUES LESS THAN (2005),
+ PARTITION p5 VALUES LESS THAN MAXVALUE);
+
+--echo --- Show table on master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Show table on slave --
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 MODIFY vc VARCHAR(255);
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still same engine ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+--enable_query_log
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- End test 2 partition RANGE testing ---
+--echo --- Do Cleanup ---
+
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+--echo --- Start test 3 partition LIST testing ---
+--echo --- Do setup ---
+#################################################
+
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63),
+ bc CHAR(63), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE)
+ TABLESPACE ts1 STORAGE DISK
+ ENGINE=NDB
+ PARTITION BY LIST(id)
+ (PARTITION p0 VALUES IN (2, 4),
+ PARTITION p1 VALUES IN (42, 142));
+
+--echo --- Test 3 Alter to add partition ---
+
+ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412));
+
+--echo --- Show table on master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Show table on slave ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 MODIFY vc VARCHAR(255);
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still same engine ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- End test 3 partition LIST testing ---
+--echo --- Do Cleanup --
+
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+--echo --- Start test 4 partition HASH testing ---
+--echo --- Do setup ---
+#################################################
+
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63),
+ bc CHAR(63), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE)
+ TABLESPACE ts1 STORAGE DISK
+ ENGINE=NDB
+ PARTITION BY HASH( YEAR(t) )
+ PARTITIONS 4;
+
+--echo --- show that tables have been created correctly ---
+
+SHOW CREATE TABLE t1;
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 MODIFY vc VARCHAR(255);
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still same engine ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- End test 4 partition HASH testing ---
+--echo --- Do Cleanup --
+
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+--echo --- Start test 5 partition by key testing ---
+--echo --- Create Table Section ---
+
+#################################################
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63),
+ bc CHAR(63), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE,PRIMARY KEY(id))
+ TABLESPACE ts1 STORAGE DISK
+ ENGINE=NDB
+ PARTITION BY KEY()
+ PARTITIONS 4;
+
+--echo --- Show that tables on master are ndbcluster tables ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Show that tables on slave ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+# Okay lets see how it holds up to table changes
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still right type ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- Check that simple Alter statements are replicated correctly ---
+
+ALTER TABLE t1 MODIFY vc VARCHAR(255);
+
+--echo --- Show the new improved table on the master ---
+
+SHOW CREATE TABLE t1;
+
+--echo --- Make sure that our tables on slave are still same engine ---
+--echo --- and that the alter statements replicated correctly ---
+
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--echo --- Perform basic operation on master ---
+--echo --- and ensure replicated correctly ---
+
+--source include/rpl_multi_engine3.inc
+
+--echo --- End test 5 key partition testing ---
+--echo --- Do Cleanup ---
+
+DROP TABLE IF EXISTS t1;
+alter tablespace ts1
+drop datafile 'datafile.dat'
+engine=ndb;
+alter tablespace ts1
+drop datafile 'datafile02.dat'
+engine=ndb;
+DROP TABLESPACE ts1 ENGINE=NDB;
+DROP LOGFILE GROUP lg1 ENGINE=NDB;
+--sync_slave_with_master
+
+# End of 5.1 test case
diff --git a/mysql-test/t/rpl_ndb_ddl.test b/mysql-test/t/rpl_ndb_ddl.test
new file mode 100644
index 00000000000..b3d32232518
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_ddl.test
@@ -0,0 +1,34 @@
+######################## rpl_ddl.test ########################
+# #
+# DDL statements (sometimes with implicit COMMIT) executed #
+# by the master and it's propagation into the slave #
+# #
+##############################################################
+
+#
+# NOTE, PLEASE BE CAREFUL, WHEN MODIFYING THE TESTS !!
+#
+# 1. !All! objects to be dropped, renamed, altered ... must be created
+# in AUTOCOMMIT= 1 mode before AUTOCOMMIT is set to 0 and the test
+# sequences start.
+#
+# 2. Never use a test object, which was direct or indirect affected by a
+# preceeding test sequence again.
+# Except table d1.t1 where ONLY DML is allowed.
+#
+# If one preceeding test sequence hits a (sometimes not good visible,
+# because the sql error code of the statement might be 0) bug
+# and these rules are ignored, a following test sequence might earn ugly
+# effects like failing 'sync_slave_with_master', crashes of the slave or
+# abort of the test case etc..
+#
+# 3. The assignment of the DDL command to be tested to $my_stmt can
+# be a bit difficult. "'" must be avoided, because the test
+# routine "include/rpl_stmt_seq.inc" performs a
+# eval SELECT CONCAT('######## ','$my_stmt',' ########') as "";
+#
+
+--source include/have_ndb.inc
+--source include/master-slave.inc
+let $engine_type= "NDB";
+-- source extra/rpl_tests/rpl_ddl.test
diff --git a/mysql-test/t/rpl_ndb_delete_nowhere.test b/mysql-test/t/rpl_ndb_delete_nowhere.test
new file mode 100644
index 00000000000..92ceddf7f5c
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_delete_nowhere.test
@@ -0,0 +1,8 @@
+#########################################
+# By JBM 2006-02-14 Test wrapping to #
+# Share test code between engine tests #
+#########################################
+--source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
+let $engine_type=NDB;
+-- source extra/rpl_tests/rpl_delete_no_where.test
diff --git a/mysql-test/t/rpl_ndb_func003.test b/mysql-test/t/rpl_ndb_func003.test
new file mode 100644
index 00000000000..a19de7d3d6b
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_func003.test
@@ -0,0 +1,12 @@
+###################################
+# Wrapper for rpl_row_func003.test#
+# This test was orginally designed#
+# To test InnoDB using RBR, but #
+# It can also be used to test NDB #
+# So this wrapper is being used to#
+# reduce test case code #
+###################################
+-- source include/have_ndb.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
new file mode 100644
index 00000000000..eb47ec08695
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_idempotent.test
@@ -0,0 +1,117 @@
+--source include/have_ndb.inc
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+#
+# Currently test only works with ndb since it retrieves "old"
+# binlog positions with cluster.binlog_index and apply_status;
+#
+
+# create a table with one row
+CREATE TABLE t1 (c1 CHAR(15), c2 CHAR(15), c3 INT, PRIMARY KEY (c3)) ENGINE = NDB ;
+INSERT INTO t1 VALUES ("row1","will go away",1);
+SELECT * FROM t1 ORDER BY c3;
+
+# sync slave and retrieve epoch
+sync_slave_with_master;
+--replace_column 1 <the_epoch>
+SELECT @the_epoch:=MAX(epoch) FROM cluster.apply_status;
+let $the_epoch= `select @the_epoch` ;
+SELECT * FROM t1 ORDER BY c3;
+
+# get the master binlog pos from the epoch
+connection master;
+--replace_result $the_epoch <the_epoch>
+--replace_column 1 <the_pos>
+eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+ FROM cluster.binlog_index WHERE epoch = $the_epoch ;
+let $the_pos= `SELECT @the_pos` ;
+let $the_file= `SELECT @the_file` ;
+
+# insert some more values
+INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
+DELETE FROM t1 WHERE c3 = 1;
+UPDATE t1 SET c2="should go away" WHERE c3 = 2;
+UPDATE t1 SET c2="C" WHERE c3 = 3;
+DELETE FROM t1 WHERE c3 = 2;
+
+SELECT * FROM t1 ORDER BY c3;
+
+# check that we have it on the slave
+--sync_slave_with_master
+--connection slave
+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>
+SHOW SLAVE STATUS;
+
+# stop slave and reset position to before the last changes
+STOP SLAVE;
+--replace_result $the_pos <the_pos>
+eval CHANGE MASTER TO
+ master_log_file = '$the_file',
+ 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>
+SHOW SLAVE STATUS;
+
+# start the slave again
+# -> same events should have been applied again
+# e.g. inserting rows that already there
+# deleting a row which is not there
+# updating a row which is not there
+START SLAVE;
+
+--connection master
+SELECT * FROM t1 ORDER BY c3;
+--sync_slave_with_master
+--connection slave
+SELECT * FROM t1 ORDER BY c3;
+
+STOP SLAVE;
+
+#
+# cleanup
+#
+--connection master
+DROP TABLE t1;
+RESET master;
+--connection slave
+DROP TABLE t1;
+RESET slave;
+
+START SLAVE;
+
+#
+# Test that we can handle update of a row that does not exist on the slave
+# will trigger usage of AO_IgnoreError on slave side so that the INSERT
+# still succeeds even if the replication of the UPDATE generates an error.
+#
+--connection master
+CREATE TABLE t1 (c1 CHAR(15) NOT NULL, c2 CHAR(15) NOT NULL, c3 INT NOT NULL, PRIMARY KEY (c3)) ENGINE = NDB ;
+INSERT INTO t1 VALUES ("row1","remove on slave",1);
+
+--sync_slave_with_master
+--connection slave
+DELETE FROM t1;
+
+--connection master
+BEGIN;
+UPDATE t1 SET c2="does not exist" WHERE c3=1;
+INSERT INTO t1 VALUES ("row2","new on slave",2);
+COMMIT;
+
+--sync_slave_with_master
+--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>
+SHOW SLAVE STATUS;
+
+connection master;
+DROP TABLE IF EXISTS t1;
+
+# End of 5.1 Test
+-- source include/master-slave-end.inc
diff --git a/mysql-test/t/rpl_ndb_innodb2ndb-master.opt b/mysql-test/t/rpl_ndb_innodb2ndb-master.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_innodb2ndb-master.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_ndb_innodb2ndb-slave.opt b/mysql-test/t/rpl_ndb_innodb2ndb-slave.opt
new file mode 100644
index 00000000000..7f9eb96dff1
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_innodb2ndb-slave.opt
@@ -0,0 +1 @@
+--default-storage-engine=ndbcluster
diff --git a/mysql-test/t/rpl_ndb_innodb2ndb.test b/mysql-test/t/rpl_ndb_innodb2ndb.test
new file mode 100644
index 00000000000..229ee11353b
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_innodb2ndb.test
@@ -0,0 +1,16 @@
+#############################################################
+# Author: JBM
+# Date: 2006-02-24
+# Purpose: Trying to test ability to replicate from cluster
+# to innodb, or myisam, or replicate from innodb/myisam to
+# cluster slave. Due to limitations I have created wrappers
+# 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;
+SET storage_engine=innodb;
+--source extra/rpl_tests/rpl_ndb_2multi_eng.test
diff --git a/mysql-test/t/rpl_ndb_insert_ignore.test b/mysql-test/t/rpl_ndb_insert_ignore.test
new file mode 100644
index 00000000000..17acb5983f4
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_insert_ignore.test
@@ -0,0 +1,8 @@
+#####################################
+# Wrapper for rpl_insert_ignore.test#
+#####################################
+-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.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
new file mode 100644
index 00000000000..2ee540afd18
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_load.test
@@ -0,0 +1,66 @@
+#
+# Currently this test only runs in the source tree with the
+# ndb/test programs compiled.
+# invoke with: ./mysql-test-run --ndb-extra-test --do-test=rpl_ndb_load
+#
+
+--source include/have_ndb.inc
+--source include/have_ndb_extra.inc
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+--disable_warnings
+# reset master
+connection master;
+DROP DATABASE IF EXISTS TEST_DB;
+CREATE DATABASE TEST_DB;
+--enable_warnings
+
+#
+# These tables should correspond to the table definitions in
+# storage/ndb/test/ndbapi/bench/
+#
+connection master;
+USE TEST_DB;
+CREATE TABLE SUBSCRIBER
+ ( NUMBER CHAR(12) BINARY NOT NULL,
+ NAME CHAR(32) BINARY NOT NULL,
+ GROUP_ID INT UNSIGNED NOT NULL,
+ LOCATION INT UNSIGNED NOT NULL,
+ SESSIONS INT UNSIGNED NOT NULL,
+ CHANGED_BY CHAR(32) BINARY NOT NULL,
+ CHANGED_TIME CHAR(32) BINARY NOT NULL,
+ PRIMARY KEY USING HASH (NUMBER))
+ ENGINE = NDB;
+
+CREATE TABLE GROUP_T
+ ( GROUP_ID INT UNSIGNED NOT NULL,
+ GROUP_NAME CHAR(32) BINARY NOT NULL,
+ ALLOW_READ CHAR(1) BINARY NOT NULL,
+ ALLOW_INSERT INT UNSIGNED NOT NULL,
+ ALLOW_DELETE INT UNSIGNED NOT NULL,
+ PRIMARY KEY USING HASH (GROUP_ID))
+ ENGINE = NDB;
+
+CREATE TABLE SESSION
+ ( NUMBER CHAR(12) BINARY NOT NULL,
+ SERVER_ID INT UNSIGNED NOT NULL,
+ DATA VARBINARY(1998) NOT NULL,
+ PRIMARY KEY USING HASH (NUMBER,SERVER_ID))
+ ENGINE = NDB;
+
+CREATE TABLE SERVER
+ ( SUFFIX CHAR(2) BINARY NOT NULL,
+ SERVER_ID INT UNSIGNED NOT NULL,
+ NAME CHAR(32) BINARY NOT NULL,
+ NO_OF_READ INT UNSIGNED NOT NULL,
+ NO_OF_INSERT INT UNSIGNED NOT NULL,
+ NO_OF_DELETE INT UNSIGNED NOT NULL,
+ PRIMARY KEY USING HASH (SUFFIX, SERVER_ID))
+ ENGINE = NDB;
+
+#
+# start "load" application
+#
+--exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/DbCreate >> $NDB_TOOLS_OUTPUT
+--exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/DbAsyncGenerator >> $NDB_TOOLS_OUTPUT
diff --git a/mysql-test/t/rpl_ndb_log-master.opt b/mysql-test/t/rpl_ndb_log-master.opt
new file mode 100644
index 00000000000..e0d075c3fbd
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_log-master.opt
@@ -0,0 +1 @@
+--skip-external-locking
diff --git a/mysql-test/t/rpl_ndb_log.test b/mysql-test/t/rpl_ndb_log.test
new file mode 100644
index 00000000000..e883d24b977
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_log.test
@@ -0,0 +1,12 @@
+###################################
+# Wrapper for rpl_row_log.test #
+# Added wrapper so that MyISAM & #
+# Innodb and NDB could all use the#
+# Same test. NDB produced a diff #
+# bin-log #
+###################################
+-- source include/have_binlog_format_row.inc
+-- source include/have_ndb.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
new file mode 100644
index 00000000000..fc7ecab00ac
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_multi.test
@@ -0,0 +1,71 @@
+--source include/have_ndb.inc
+--source include/have_multi_ndb.inc
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+# note: server2 is another "master" connected to the master cluster
+
+#
+# Currently test only works with ndb since it retrieves "old"
+# binlog positions with cluster.binlog_index and apply_status;
+#
+
+# create a table with one row, and make sure the other "master" gets it
+CREATE TABLE t1 (c1 CHAR(15), c2 CHAR(15), c3 INT, PRIMARY KEY (c3)) ENGINE = NDB ;
+connection server2;
+reset master;
+SHOW TABLES;
+connection master;
+INSERT INTO t1 VALUES ("row1","will go away",1);
+SELECT * FROM t1 ORDER BY c3;
+connection server2;
+SELECT * FROM t1 ORDER BY c3;
+
+# sync slave and retrieve epoch and stop the slave
+connection master;
+sync_slave_with_master;
+--replace_column 1 <the_epoch>
+SELECT @the_epoch:=MAX(epoch) FROM cluster.apply_status;
+let $the_epoch= `select @the_epoch` ;
+SELECT * FROM t1 ORDER BY c3;
+stop slave;
+
+# get the master binlog pos from the epoch, from the _other_ "master", server2
+connection server2;
+--replace_result $the_epoch <the_epoch>
+eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+ FROM cluster.binlog_index WHERE epoch = $the_epoch ;
+let $the_pos= `SELECT @the_pos` ;
+let $the_file= `SELECT @the_file` ;
+
+# now connect the slave to the _other_ "master"
+connection slave;
+--replace_result $MASTER_MYPORT1 <MASTER_PORT1>
+eval CHANGE MASTER TO
+ master_port=$MASTER_MYPORT1,
+ master_log_file = '$the_file',
+ master_log_pos = $the_pos ;
+start slave;
+
+# insert some more values on the first master
+connection master;
+INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
+DELETE FROM t1 WHERE c3 = 1;
+UPDATE t1 SET c2="should go away" WHERE c3 = 2;
+UPDATE t1 SET c2="C" WHERE c3 = 3;
+DELETE FROM t1 WHERE c3 = 2;
+
+SELECT * FROM t1 ORDER BY c3;
+
+save_master_pos;
+
+# insert another row, and check that we have it on the slave
+connection server2;
+INSERT INTO t1 VALUES ("row5","E",5);
+SELECT * FROM t1 ORDER BY c3;
+#sync_slave_with_master;
+connection slave;
+--sleep 2
+SELECT * FROM t1 ORDER BY c3;
+
+STOP SLAVE;
diff --git a/mysql-test/t/rpl_ndb_multi_update2-slave.opt b/mysql-test/t/rpl_ndb_multi_update2-slave.opt
new file mode 100644
index 00000000000..17d4171af0e
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_multi_update2-slave.opt
@@ -0,0 +1 @@
+--replicate-ignore-table=nothing.sensible
diff --git a/mysql-test/t/rpl_ndb_multi_update2.test b/mysql-test/t/rpl_ndb_multi_update2.test
new file mode 100644
index 00000000000..df4f0eec39d
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_multi_update2.test
@@ -0,0 +1,12 @@
+############################################################
+# By JBM 2006-02-15 Wrapper for rpl_multi_update2.test #
+# to reuse test code between engine runs #
+############################################################
+-- source include/have_ndb.inc
+
+# 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
+
+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
new file mode 100644
index 00000000000..008e2143987
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_multi_update3.test
@@ -0,0 +1,8 @@
+############################################################
+# By JBM 2006-02-15 Wrapper for rpl_multi_update3.test #
+# to reuse test code between engine runs #
+############################################################
+-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
+let $engine_type=NDB;
+-- source extra/rpl_tests/rpl_multi_update3.test
diff --git a/mysql-test/t/rpl_ndb_myisam2ndb-master.opt b/mysql-test/t/rpl_ndb_myisam2ndb-master.opt
new file mode 100644
index 00000000000..83ed8522e72
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_myisam2ndb-master.opt
@@ -0,0 +1 @@
+--binlog-format=row
diff --git a/mysql-test/t/rpl_ndb_myisam2ndb-slave.opt b/mysql-test/t/rpl_ndb_myisam2ndb-slave.opt
new file mode 100644
index 00000000000..701dddb075b
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_myisam2ndb-slave.opt
@@ -0,0 +1 @@
+--default-storage-engine=ndbcluster
diff --git a/mysql-test/t/rpl_ndb_myisam2ndb.test b/mysql-test/t/rpl_ndb_myisam2ndb.test
new file mode 100644
index 00000000000..0c2df6441cb
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_myisam2ndb.test
@@ -0,0 +1,15 @@
+#############################################################
+# Author: JBM
+# Date: 2006-02-24
+# Purpose: Trying to test ability to replicate from cluster
+# to innodb, or myisam, or replicate from innodb/myisam to
+# cluster slave. Due to limitations I have created wrappers
+# 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;
+SET storage_engine=myisam;
+--source extra/rpl_tests/rpl_ndb_2multi_eng.test
diff --git a/mysql-test/t/rpl_ndb_relayrotate-slave.opt b/mysql-test/t/rpl_ndb_relayrotate-slave.opt
new file mode 100644
index 00000000000..3a4abbf091e
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_relayrotate-slave.opt
@@ -0,0 +1,3 @@
+-O max_relay_log_size=16384
+--innodb
+--log-warnings
diff --git a/mysql-test/t/rpl_ndb_relayrotate.test b/mysql-test/t/rpl_ndb_relayrotate.test
new file mode 100644
index 00000000000..c5ec0e1d21b
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_relayrotate.test
@@ -0,0 +1,8 @@
+############################################################
+# By JBM 2006-02-15 Wrapper for rpl_relayrotate.test #
+# to reuse test code between engine runs #
+############################################################
+-- source include/have_ndb.inc
+-- source include/have_ndb_extra.inc
+let $engine_type=NDB;
+-- source extra/rpl_tests/rpl_relayrotate.test
diff --git a/mysql-test/t/rpl_ndb_row_001.test b/mysql-test/t/rpl_ndb_row_001.test
new file mode 100644
index 00000000000..1e2a4ec02df
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_row_001.test
@@ -0,0 +1,6 @@
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+########################################################
+--source include/have_ndb.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
new file mode 100644
index 00000000000..75ad9f0a488
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_sp003.test
@@ -0,0 +1,9 @@
+#################################
+# Wrapper for rpl_row_sp003.test#
+# These tests have been wrapped #
+# so the same code can be used #
+# For different engines #
+#################################
+-- source include/have_ndb.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
new file mode 100644
index 00000000000..590facc3648
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_sp006.test
@@ -0,0 +1,9 @@
+#################################
+# Wrapper for rpl_row_sp006.test#
+# These tests have been wrapped #
+# so the same code can be used #
+# For different engines #
+#################################
+-- source include/have_ndb.inc
+let $engine_type=NDBCLUSTER;
+-- source extra/rpl_tests/rpl_row_sp006.test
diff --git a/mysql-test/t/rpl_ndb_sync.test b/mysql-test/t/rpl_ndb_sync.test
new file mode 100644
index 00000000000..20d4f5707f8
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_sync.test
@@ -0,0 +1,104 @@
+--source include/have_ndb.inc
+--source include/ndb_default_cluster.inc
+--source include/not_embedded.inc
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+#
+# Currently test only works with ndb since it retrieves "old"
+# binlog positions with cluster.binlog_index and apply_status;
+#
+
+# stop the save
+--connection slave
+STOP SLAVE;
+CREATE DATABASE ndbsynctest;
+USE ndbsynctest;
+
+# get some data on the master
+--connection master
+CREATE DATABASE ndbsynctest;
+USE ndbsynctest;
+CREATE TABLE t1 (c1 BIT(1) NOT NULL, c2 BIT(1) NOT NULL, c3 CHAR(15), PRIMARY KEY(c3)) ENGINE = NDB ;
+INSERT INTO t1 VALUES (1,1,"row1"),(0,1,"row2"),(1,0,"row3"),(0,0,"row4");
+CREATE TABLE t2 (c1 CHAR(15), c2 BIT(1) NOT NULL, c3 BIT(1) NOT NULL, PRIMARY KEY(c1)) ENGINE = NDB ;
+INSERT INTO t2 VALUES ("ABC",1,1),("BCDEF",0,1),("CD",1,0),("DEFGHIJKL",0,0);
+SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
+SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1;
+
+# take a backup on master
+--source include/ndb_backup.inc
+
+# update a row
+UPDATE t1 SET c2=0 WHERE c3="row2";
+SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
+
+# restore on slave, first check that nothing is there
+--connection slave
+
+# we should have no tables
+SHOW TABLES;
+
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+
+#
+# BUG#11960
+# prior to bugfix "DROP DATABASE" would give a warning since
+# the events were not created by ndb_restore
+#
+DROP DATABASE ndbsynctest;
+CREATE DATABASE ndbsynctest;
+USE ndbsynctest;
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+
+# continue test
+SHOW TABLES;
+
+SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
+SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1;
+
+#
+# now setup replication to continue from last epoch
+--source include/ndb_setup_slave.inc
+--connection slave
+START SLAVE;
+
+#
+#
+#
+--connection master
+--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;
+
+SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
+SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1;
+
+#
+# Cleanup
+#
+
+--connection master
+DROP DATABASE ndbsynctest;
+--sync_slave_with_master
+--connection slave
+STOP SLAVE;
+
+#
+# Test some replication commands
+#
+--connection master
+reset master;
+# should now contain nothing
+select * from cluster.binlog_index;
+
+--connection slave
+reset slave;
+# should now contain nothing
+select * from cluster.apply_status;
+
+# End 5.1 Test
diff --git a/mysql-test/t/rpl_ndb_trig004.test b/mysql-test/t/rpl_ndb_trig004.test
new file mode 100644
index 00000000000..7439da563a6
--- /dev/null
+++ b/mysql-test/t/rpl_ndb_trig004.test
@@ -0,0 +1,15 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: 2006-02-14 #
+#############################################################################
+# TEST: Use before insert triggers and has the second insert fail #
+# Test is wrapped to save code and share between engines #
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/have_ndb.inc
+-- source include/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
new file mode 100644
index 00000000000..62b83f0557a
--- /dev/null
+++ b/mysql-test/t/rpl_ndbapi_multi.test
@@ -0,0 +1,11 @@
+-- source include/have_ndb.inc
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+-- source include/have_ndbapi_examples.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
+
+--exec echo Running mgmapi_logevent
+--exec $NDB_EXAMPLES_DIR/mgmapi_logevent/mgmapi_logevent "localhost:$NDBCLUSTER_PORT" "localhost:$NDBCLUSTER_PORT_SLAVE" 1 >> $NDB_EXAMPLES_OUTPUT
+
diff --git a/mysql-test/t/rpl_openssl.test b/mysql-test/t/rpl_openssl.test
index af70a1a9453..313e22193f5 100644
--- a/mysql-test/t/rpl_openssl.test
+++ b/mysql-test/t/rpl_openssl.test
@@ -49,7 +49,7 @@ select * from t1;
#checking show slave status
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 #
show slave status;
#checking if replication works without ssl also performing clean up
@@ -63,7 +63,7 @@ save_master_pos;
connection slave;
sync_with_master;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 #
show slave status;
# End of 4.1 tests
diff --git a/mysql-test/t/rpl_optimize.test b/mysql-test/t/rpl_optimize.test
index 6858f52abab..80f0c052fc8 100644
--- a/mysql-test/t/rpl_optimize.test
+++ b/mysql-test/t/rpl_optimize.test
@@ -1,8 +1,17 @@
# Test for BUG#1858 "OPTIMIZE TABLE done by a client
# thread stops the slave SQL thread".
# You can replace OPTIMIZE by REPAIR.
-
-source include/master-slave.inc;
+#####################################
+# Change Author: JBM
+# Change Date: 2006-02-09
+# Change: NDB does not and will not support
+# OPTIMIZE for memory tables. If and when
+# it does support for Disk Data, a new
+# version of this test will be need.
+# Skipping this test if default engine = ndb
+#####################################
+-- source include/not_ndb_default.inc
+-- source include/master-slave.inc
create table t1 (a int not null auto_increment primary key, b int, key(b));
INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
diff --git a/mysql-test/t/rpl_ps.test b/mysql-test/t/rpl_ps.test
index adf39b1e4ab..b8792722192 100644
--- a/mysql-test/t/rpl_ps.test
+++ b/mysql-test/t/rpl_ps.test
@@ -1,6 +1,9 @@
#
# Test of replicating user variables
#
+###########################################################
+# 2006-02-08 By JBM added order by for use w/ NDB engine
+###########################################################
source include/master-slave.inc;
#save_master_pos;
@@ -20,7 +23,7 @@ set @var1= "from-master-1";
execute stmt1 using @var1;
set @var1= "from-master-2-'',";
execute stmt1 using @var1;
-select * from t1;
+SELECT * FROM t1 ORDER BY n;
set @var2= 'insert into t1 values (concat("from-var-", ?))';
prepare stmt2 from @var2;
@@ -30,7 +33,7 @@ execute stmt2 using @var1;
save_master_pos;
connection slave;
sync_with_master;
-select * from t1;
+SELECT * FROM t1 ORDER BY n;
connection master;
@@ -42,3 +45,7 @@ sync_with_master;
stop slave;
# End of 4.1 tests
+
+reset master;
+reset slave;
+disconnect master;
diff --git a/mysql-test/t/rpl_rbr_to_sbr.test b/mysql-test/t/rpl_rbr_to_sbr.test
new file mode 100644
index 00000000000..0c5368197b3
--- /dev/null
+++ b/mysql-test/t/rpl_rbr_to_sbr.test
@@ -0,0 +1,48 @@
+-- source include/have_row_based.inc
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/not_ndb_default.inc
+-- source include/master-slave.inc
+
+# Test that the slave temporarily switches to ROW when seeing binrow
+# events when it is in STATEMENT or MIXED mode
+
+SET BINLOG_FORMAT=MIXED;
+SET GLOBAL BINLOG_FORMAT=MIXED;
+SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT;
+
+--echo **** On Master ****
+CREATE TABLE t1 (a INT, b LONG);
+INSERT INTO t1 VALUES (1,1), (2,2);
+INSERT INTO t1 VALUES (3,UUID()), (4,UUID());
+let $VERSION=`select version()`;
+--replace_result $VERSION VERSION
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS;
+sync_slave_with_master;
+--echo **** On Slave ****
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+--replace_result $VERSION VERSION
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS;
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql
+
+connection master;
+DROP TABLE IF EXISTS t1;
+
+# Let's compare. Note: If they match test will pass, if they do not match
+# the test will show that the diff statement failed and not reject file
+# will be created. You will need to go to the mysql-test dir and diff
+# the files your self to see what is not matching
+
+--exec diff $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql;
+
+# If all is good, we can remove the files
+
+system rm $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql;
+system rm $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql;
diff --git a/mysql-test/t/rpl_redirect.test b/mysql-test/t/rpl_redirect.test
index beb18348b40..078d1048794 100644
--- a/mysql-test/t/rpl_redirect.test
+++ b/mysql-test/t/rpl_redirect.test
@@ -14,7 +14,7 @@ sync_with_master;
#discover slaves
connection master;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
SHOW SLAVE STATUS;
--replace_result $SLAVE_MYPORT SLAVE_PORT
SHOW SLAVE HOSTS;
@@ -32,14 +32,16 @@ insert into t1 values(5);
connection master;
enable_rpl_parse;
# The first of the queries will be sent to the slave, the second to the master.
-select * from t1;
-select * from t1;
+SELECT * FROM t1 ORDER BY n;
+SELECT * FROM t1 ORDER BY n;
disable_rpl_parse;
-select * from t1;
+SELECT * FROM t1 ORDER BY n;
connection slave;
-select * from t1;
-drop table t1;
+SELECT * FROM t1 ORDER BY n;
+
+# Cleanup
connection master;
drop table t1;
+sync_slave_with_master;
# End of 4.1 tests
diff --git a/mysql-test/t/rpl_relay_space_innodb-master.opt b/mysql-test/t/rpl_relay_space_innodb-master.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_relay_space_innodb-master.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_relay_space_innodb-slave.opt b/mysql-test/t/rpl_relay_space_innodb-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_relay_space_innodb-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_relay_space_innodb.test b/mysql-test/t/rpl_relay_space_innodb.test
new file mode 100644
index 00000000000..156d53ef856
--- /dev/null
+++ b/mysql-test/t/rpl_relay_space_innodb.test
@@ -0,0 +1,22 @@
+###################################
+# Wrapper rpl_sv_relay_space.test #
+# This test has to be wrapped as #
+# It tests ndb, innodb and MyISAM.#
+# By Wrapping we are saving some #
+# space and making the test more #
+# Maintainable by only having one #
+# test file and reusing the code #
+# In Addition, INNODB has to have #
+# Option files during this test #
+# to force innodb on the slave #
+# else the test will fail #
+###################################
+#Change Author: JBM #
+#Change Date: 2006-02-03 #
+#Change: Added Comments #
+###################################
+-- source include/not_ndb_default.inc
+-- source include/have_innodb.inc
+let $engine_type=InnoDB;
+-- source extra/rpl_tests/rpl_sv_relay_space.test
+
diff --git a/mysql-test/t/rpl_relay_space_myisam.test b/mysql-test/t/rpl_relay_space_myisam.test
new file mode 100644
index 00000000000..1d8563e7fd9
--- /dev/null
+++ b/mysql-test/t/rpl_relay_space_myisam.test
@@ -0,0 +1,21 @@
+###################################
+# Wrapper rpl_sv_relay_space.test #
+# This test has to be wrapped as #
+# It tests ndb, innodb and MyISAM.#
+# By Wrapping we are saving some #
+# space and making the test more #
+# Maintainable by only having one #
+# test file and reusing the code #
+# In Addition, INNODB has to have #
+# Option files during this test #
+# to force innodb on the slave #
+# else the test will fail #
+###################################
+#Change Author: JBM #
+#Change Date: 2006-02-03 #
+#Change: Added Comments #
+###################################
+-- source include/not_ndb_default.inc
+let $engine_type=MyISAM;
+-- source extra/rpl_tests/rpl_sv_relay_space.test
+
diff --git a/mysql-test/t/rpl_relayrotate.test b/mysql-test/t/rpl_relayrotate.test
index 04f03367e20..46d54aea1d2 100644
--- a/mysql-test/t/rpl_relayrotate.test
+++ b/mysql-test/t/rpl_relayrotate.test
@@ -1,75 +1,10 @@
-# When the relay log gets rotated while the I/O thread
-# is reading a transaction, the transaction spans on two or more
-# relay logs. If STOP SLAVE occurs while the SQL thread is
-# executing a part of the transaction in the non-first relay logs,
-# we test if START SLAVE will resume in the beginning of the
-# transaction (i.e., step back to the first relay log)
-
-# The slave is started with max_binlog_size=16384 bytes,
-# to force many rotations (approximately 30 rotations)
-
-source include/have_innodb.inc;
-source include/master-slave.inc;
-connection slave;
-stop slave;
-connection master;
---disable_warnings
-create table t1 (a int) engine=innodb;
---enable_warnings
-let $1=8000;
-disable_query_log;
-begin;
-while ($1)
-{
-# eval means expand $ expressions
- eval insert into t1 values( $1 );
- dec $1;
-}
-commit;
-# This will generate a 500kB master's binlog,
-# which corresponds to 30 slave's relay logs.
-enable_query_log;
-save_master_pos;
-connection slave;
-reset slave;
-start slave;
-# We wait 1 sec for the SQL thread to be somewhere in
-# the middle of the transaction, hopefully not in
-# the first relay log, and hopefully before the COMMIT.
-# Usually it stops when the SQL thread is around the 15th relay log.
-# We cannot use MASTER_POS_WAIT() as master's position
-# increases only when the slave executes the COMMIT.
-# Note that except when using Valgrind, 1 second is enough for the I/O slave
-# thread to fetch the whole master's binlog.
-sleep 1;
-stop slave;
-# We suppose the SQL thread stopped before COMMIT.
-# If so the transaction was rolled back
-# and the table is now empty.
-# Now restart
-start slave;
-# And see if the table contains '8000'
-# which proves that the transaction restarted at
-# the right place.
-# We must wait for the transaction to commit before
-# reading:
-sync_with_master;
-select max(a) from t1;
-connection master;
-
-# The following DROP is a very important cleaning task:
-# imagine the next test is run with --skip-innodb: it will do
-# DROP TABLE IF EXISTS t1; but this will delete the frm and leave
-# some data in the InnoDB datafile (because at that time mysqld
-# does not know about InnoDB : --skip-innodb). So if later in the
-# test suite a test wants to create an InnoDB table called t1, it
-# will fail with
-# InnoDB: Error: table t1 already exists in InnoDB internal
-# InnoDB: data dictionary. Have you deleted the .frm file etc
-drop table t1;
-# wait until this drop is executed on slave
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
+#######################################################
+# Wrapper for rpl_relayrotate.test to allow multi #
+# Engines to reuse test code. By JBM 2006-02-15 #
+# Added comments section and to skip when ndb is #
+# Default engine. #
+#######################################################
+-- source include/not_ndb_default.inc
+-- source include/have_innodb.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 9dec8c06c79..e7141c3f905 100644
--- a/mysql-test/t/rpl_replicate_do.test
+++ b/mysql-test/t/rpl_replicate_do.test
@@ -1,6 +1,5 @@
# This test assumes we are ignoring updates on table t2, but doing
# updates on t1
-
source include/master-slave.inc;
--disable_warnings
drop table if exists t11;
@@ -22,7 +21,7 @@ create table t11 select * from t1;
save_master_pos;
connection slave;
sync_with_master;
-select * from t1;
+select * from t1 ORDER BY m;
select * from t2;
--error 1146
select * from t11;
@@ -33,7 +32,7 @@ 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 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 #
show slave status;
#
diff --git a/mysql-test/t/rpl_replicate_ignore_db-slave.opt b/mysql-test/t/rpl_replicate_ignore_db-slave.opt
new file mode 100644
index 00000000000..6e3aed44f78
--- /dev/null
+++ b/mysql-test/t/rpl_replicate_ignore_db-slave.opt
@@ -0,0 +1 @@
+--replicate_ignore_db=mysqltest1
diff --git a/mysql-test/t/rpl_replicate_ignore_db.test b/mysql-test/t/rpl_replicate_ignore_db.test
new file mode 100644
index 00000000000..bcfef919fad
--- /dev/null
+++ b/mysql-test/t/rpl_replicate_ignore_db.test
@@ -0,0 +1,30 @@
+# see if --replicate-ignore-db works
+
+--source include/master-slave.inc
+
+--disable_warnings
+drop database if exists mysqltest1;
+drop database if exists mysqltest2;
+--enable_warnings
+create database mysqltest1;
+create database mysqltest2;
+
+use mysqltest1;
+create table t1 (a int);
+insert into t1 values(1);
+sync_slave_with_master;
+--error 1146
+select * from mysqltest1.t1;
+
+connection master;
+use mysqltest2;
+create table t1 (a int);
+insert into t1 values(1);
+sync_slave_with_master;
+select * from mysqltest2.t1;
+
+# cleanup
+connection master;
+drop database mysqltest1;
+drop database mysqltest2;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_rewrite_db-slave.opt b/mysql-test/t/rpl_rewrt_db-slave.opt
index a462ad19ba0..a462ad19ba0 100644
--- a/mysql-test/t/rpl_rewrite_db-slave.opt
+++ b/mysql-test/t/rpl_rewrt_db-slave.opt
diff --git a/mysql-test/t/rpl_rewrite_db.test b/mysql-test/t/rpl_rewrt_db.test
index 6b8624aff39..52f04e073dd 100644
--- a/mysql-test/t/rpl_rewrite_db.test
+++ b/mysql-test/t/rpl_rewrt_db.test
@@ -1,4 +1,7 @@
-source include/master-slave.inc;
+# TBF - difference in row level logging
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/master-slave.inc
+
--disable_warnings
drop database if exists mysqltest1;
--enable_warnings
diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test
index ee49f92910a..2249dff1449 100644
--- a/mysql-test/t/rpl_rotate_logs.test
+++ b/mysql-test/t/rpl_rotate_logs.test
@@ -12,6 +12,9 @@
# changes
# - Test creating a duplicate key error and recover from it
+# Requires statement logging
+-- source include/have_binlog_format_mixed_or_statement.inc
+
connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
--disable_warnings
drop table if exists t1, t2, t3, t4;
@@ -59,7 +62,7 @@ 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 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
select * from t1;
connection master;
@@ -112,7 +115,7 @@ show binary logs;
insert into t2 values (65);
sync_slave_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
select * from t2;
@@ -144,7 +147,7 @@ sync_with_master;
select * from t4;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
# because of concurrent insert, the table may not be up to date
# if we do not lock
diff --git a/mysql-test/t/rpl_row_001.test b/mysql-test/t/rpl_row_001.test
new file mode 100644
index 00000000000..639c55362a5
--- /dev/null
+++ b/mysql-test/t/rpl_row_001.test
@@ -0,0 +1,7 @@
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/not_ndb_default.inc
+let $engine_type=MYISAM;
+-- source extra/rpl_tests/rpl_row_001.test
diff --git a/mysql-test/t/rpl_row_4_bytes-master.opt b/mysql-test/t/rpl_row_4_bytes-master.opt
new file mode 100644
index 00000000000..0e1929507f7
--- /dev/null
+++ b/mysql-test/t/rpl_row_4_bytes-master.opt
@@ -0,0 +1 @@
+--loose-debug=d,"old_row_based_repl_4_byte_map_id_master"
diff --git a/mysql-test/t/rpl_row_4_bytes.test b/mysql-test/t/rpl_row_4_bytes.test
new file mode 100644
index 00000000000..73ef6dd2345
--- /dev/null
+++ b/mysql-test/t/rpl_row_4_bytes.test
@@ -0,0 +1,33 @@
+# This test is to make sure that slaves can read a binlog containining
+# table map ids stored in 4 bytes, even though we now store them in 6
+# bytes. This is for backward-compatibility.
+# If the slave does not detect that the master stores the table map id
+# in 4 bytes, slave will read 6 bytes, and so will read the 2 bytes of
+# flags at the place where there actually is data, so the test should
+# fail.
+
+-- source include/have_binlog_format_row.inc
+-- source include/have_debug.inc
+-- source include/master-slave.inc
+
+connection master;
+--disable_warnings
+drop database if exists mysqltest1;
+create database mysqltest1;
+--enable_warnings
+use mysqltest1;
+CREATE TABLE t1 (a char(3));
+CREATE TABLE t2 (a char(3));
+insert into t1 values("ANN");
+insert into t1 values("GUI");
+insert into t2 values("LIL");
+insert into t2 values("ABE");
+insert into t2 values("ANG");
+sync_slave_with_master;
+use mysqltest1;
+select * from t1 order by a;
+select * from t2 order by a;
+
+connection master;
+DROP DATABASE mysqltest1;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_row_NOW.test b/mysql-test/t/rpl_row_NOW.test
new file mode 100644
index 00000000000..24a8774284a
--- /dev/null
+++ b/mysql-test/t/rpl_row_NOW.test
@@ -0,0 +1,73 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/18/2005 #
+# Updated 08/30/2005 Added dumps and diff #
+#############################################################################
+#TEST: Taken and modfied from http://bugs.mysql.com/bug.php?id=12480 #
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+create database if not exists mysqltest1;
+DROP TABLE IF EXISTS mysqltest1.t1;
+--enable_warnings
+
+
+# Begin test section 1
+CREATE TABLE mysqltest1.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT,
+ a TIMESTAMP DEFAULT '2005-05-05 01:01:01',
+ b TIMESTAMP DEFAULT '2005-05-05 01:01:01',
+ PRIMARY KEY(n));
+delimiter |;
+CREATE FUNCTION mysqltest1.f1() RETURNS TIMESTAMP
+BEGIN
+ DECLARE v1 INT DEFAULT 300;
+ WHILE v1 > 0 DO
+ SET v1 = v1 - 1;
+ END WHILE;
+ RETURN NOW();
+END|
+delimiter ;|
+
+INSERT INTO mysqltest1.t1 VALUES(NULL,NOW(),mysqltest1.f1());
+
+delimiter |;
+CREATE TRIGGER mysqltest1.trig1 BEFORE INSERT ON mysqltest1.t1
+FOR EACH ROW BEGIN
+ SET new.b = mysqltest1.f1();
+END|
+delimiter ;|
+
+INSERT INTO mysqltest1.t1 SET n = NULL, a = now();
+
+sync_slave_with_master;
+
+connection master;
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/NOW_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/NOW_slave.sql
+
+# lets cleanup
+DROP TABLE IF EXISTS mysqltest1.t1;
+DROP FUNCTION mysqltest1.f1;
+
+# Lets compare. Note: If they match test will pass, if they do not match
+# the test will show that the diff statement failed and not reject file
+# will be created. You will need to go to the mysql-test dir and diff
+# the files your self to see what is not matching :-) The failed dump
+# files will be located in $MYSQLTEST_VARDIR/tmp
+
+exec diff $MYSQLTEST_VARDIR/tmp/NOW_master.sql $MYSQLTEST_VARDIR/tmp/NOW_slave.sql;
+
+# If all is good, when can cleanup our dump files.
+system rm $MYSQLTEST_VARDIR/tmp/NOW_master.sql;
+system rm $MYSQLTEST_VARDIR/tmp/NOW_slave.sql;
+
+sync_slave_with_master;
+# End of 5.1 test case
diff --git a/mysql-test/t/rpl_row_USER.test b/mysql-test/t/rpl_row_USER.test
new file mode 100644
index 00000000000..a099a35ec27
--- /dev/null
+++ b/mysql-test/t/rpl_row_USER.test
@@ -0,0 +1,58 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/18/2005 #
+#############################################################################
+# TEST: To test the UUID() in rbr #
+#############################################################################
+# Change Author: JBM
+# Change Date: 2006-01-16
+# Change: Added Order by for NDB
+##########
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1;
+CREATE DATABASE mysqltest1;
+--enable_warnings
+
+# Section 1 test
+CREATE USER tester IDENTIFIED BY 'test';
+GRANT ALL ON mysqltest1.* TO 'tester'@'%' IDENTIFIED BY 'test';
+GRANT ALL ON mysqltest1.* TO ''@'localhost%';
+FLUSH PRIVILEGES;
+connect (m_1,localhost,tester,,mysqltest1);
+
+connection m_1;
+CREATE TABLE mysqltest1.t1 (a INT, users VARCHAR(255), PRIMARY KEY(a));
+INSERT INTO mysqltest1.t1 VALUES(1,USER());
+INSERT INTO mysqltest1.t1 VALUES(2,CURRENT_USER());
+delimiter |;
+create procedure mysqltest1.p1()
+begin
+ INSERT INTO mysqltest1.t1 VALUES(3,USER());
+ INSERT INTO mysqltest1.t1 VALUES(4,CURRENT_USER());
+end|
+delimiter ;|
+
+CALL mysqltest1.p1();
+connection master;
+SELECT * FROM mysqltest1.t1 ORDER BY a;
+sync_slave_with_master;
+SELECT * FROM mysqltest1.t1 ORDER BY a;
+
+connection master;
+# Lets cleanup
+#show binlog events;
+
+DROP DATABASE mysqltest1;
+REVOKE ALL ON mysqltest1.* FROM 'tester'@'%';
+REVOKE ALL ON mysqltest1.* FROM ''@'localhost%';
+
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_UUID.test b/mysql-test/t/rpl_row_UUID.test
new file mode 100644
index 00000000000..6ead7c2ee9b
--- /dev/null
+++ b/mysql-test/t/rpl_row_UUID.test
@@ -0,0 +1,7 @@
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/not_ndb_default.inc
+let $engine_type=myisam;
+--source extra/rpl_tests/rpl_row_UUID.test
diff --git a/mysql-test/t/rpl_row_basic_11bugs-master.opt b/mysql-test/t/rpl_row_basic_11bugs-master.opt
new file mode 100644
index 00000000000..ad03cdaa6d1
--- /dev/null
+++ b/mysql-test/t/rpl_row_basic_11bugs-master.opt
@@ -0,0 +1 @@
+--binlog_ignore_db=test_ignore
diff --git a/mysql-test/t/rpl_row_basic_11bugs.test b/mysql-test/t/rpl_row_basic_11bugs.test
new file mode 100644
index 00000000000..37bfd01e260
--- /dev/null
+++ b/mysql-test/t/rpl_row_basic_11bugs.test
@@ -0,0 +1,116 @@
+--source include/have_row_based.inc
+--source include/have_binlog_format_row.inc
+
+
+let $SERVER_VERSION=`select version()`;
+
+#This test case is not written for NDB, the result files
+#will not match when NDB is the default engine
+-- source include/not_ndb_default.inc
+
+--source include/master-slave.inc
+
+# Bug#15942 (RBR ignores --binlog_ignore_db and tries to map to table
+# on slave for writes)
+
+CREATE DATABASE test_ignore; # --binlog_ignore_db=mysqltest_ignore
+
+--echo **** On Master ****
+SHOW DATABASES;
+USE test;
+CREATE TABLE t1 (a INT, b INT);
+SHOW TABLES;
+INSERT INTO t1 VALUES (1,1), (2,2);
+USE test_ignore;
+CREATE TABLE t2 (a INT, b INT);
+SHOW TABLES;
+INSERT INTO t2 VALUES (3,3), (4,4);
+--replace_regex /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS FROM 102;
+sync_slave_with_master;
+--echo **** On Slave ****
+SHOW DATABASES;
+USE test;
+SHOW TABLES;
+--error 1049
+USE test_ignore;
+
+connection master;
+DROP DATABASE test_ignore;
+sync_slave_with_master;
+
+# Bug#19995: Extreneous table maps generated for statements that does
+# not generate rows
+--disable_query_log
+--source include/master-slave-reset.inc
+--enable_query_log
+
+connection master;
+CREATE TABLE t1 (a INT);
+DELETE FROM t1;
+INSERT INTO t1 VALUES (1),(2);
+DELETE FROM t1 WHERE a = 0;
+UPDATE t1 SET a=99 WHERE a = 0;
+--replace_result $SERVER_VERSION SERVER_VERSION
+--replace_regex /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS;
+
+DROP TABLE t1;
+
+# BUG#17620: Replicate (Row Based) Fails when Query Cache enabled on
+# slave
+--echo ================ Test for BUG#17620 ================
+--disable_query_log
+--source include/master-slave-reset.inc
+--enable_query_log
+
+--echo **** On Slave ****
+connection slave;
+SET GLOBAL QUERY_CACHE_SIZE=0;
+
+--echo **** On Master ****
+connection master;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+
+--echo **** On Slave ****
+sync_slave_with_master;
+SET GLOBAL QUERY_CACHE_SIZE=16*1024*1024;
+
+--echo **** On Master ****
+connection master;
+INSERT INTO t1 VALUES (4),(5),(6);
+
+--echo **** On Slave ****
+sync_slave_with_master;
+SELECT * FROM t1;
+
+--echo **** On Master ****
+connection master;
+INSERT INTO t1 VALUES (7),(8),(9);
+
+--echo **** On Slave ****
+sync_slave_with_master;
+SELECT * FROM t1;
+
+# Bug#22550: Replication of BIT columns failing
+--echo ================ Test for BUG#22550 ================
+--disable_query_log
+--source include/master-slave-reset.inc
+--enable_query_log
+
+connection master;
+CREATE TABLE t1 (a BIT(1), b INT) ENGINE=MYISAM;
+sync_slave_with_master;
+
+connection master;
+INSERT INTO t1 VALUES(1,2);
+SELECT HEX(a),b FROM t1;
+sync_slave_with_master;
+SELECT HEX(a),b FROM t1;
+
+connection master;
+UPDATE t1 SET a=0 WHERE b=2;
+SELECT HEX(a),b FROM t1;
+sync_slave_with_master;
+SELECT HEX(a),b FROM t1;
diff --git a/mysql-test/t/rpl_row_basic_2myisam.test b/mysql-test/t/rpl_row_basic_2myisam.test
new file mode 100644
index 00000000000..c2cef800ec8
--- /dev/null
+++ b/mysql-test/t/rpl_row_basic_2myisam.test
@@ -0,0 +1,3 @@
+let $type= 'MYISAM' ;
+let $extra_index= ;
+-- source extra/rpl_tests/rpl_row_basic.test
diff --git a/mysql-test/t/rpl_row_basic_3innodb-slave.opt b/mysql-test/t/rpl_row_basic_3innodb-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_row_basic_3innodb-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_row_basic_3innodb.test b/mysql-test/t/rpl_row_basic_3innodb.test
new file mode 100644
index 00000000000..89effc4b3bb
--- /dev/null
+++ b/mysql-test/t/rpl_row_basic_3innodb.test
@@ -0,0 +1,6 @@
+-- source include/have_innodb.inc
+
+let $type= 'INNODB' ;
+let $extra_index= ;
+-- source extra/rpl_tests/rpl_row_basic.test
+
diff --git a/mysql-test/t/rpl_row_basic_7ndb.test b/mysql-test/t/rpl_row_basic_7ndb.test
new file mode 100644
index 00000000000..1ec2fb333ae
--- /dev/null
+++ b/mysql-test/t/rpl_row_basic_7ndb.test
@@ -0,0 +1,5 @@
+-- source include/have_ndb.inc
+let $type= 'NDB' ;
+let $extra_index= ;
+-- source extra/rpl_tests/rpl_row_basic.test
+-- source include/master-slave-end.inc
diff --git a/mysql-test/t/rpl_row_basic_8partition.test b/mysql-test/t/rpl_row_basic_8partition.test
new file mode 100644
index 00000000000..f262ef05c58
--- /dev/null
+++ b/mysql-test/t/rpl_row_basic_8partition.test
@@ -0,0 +1,211 @@
+############################################################
+# Author: MATZ #
+# Date: 2006-03-22 #
+# Purpose: See if replication of partition tables work #
+# Most of this test is copied from the rpl_xxx2yyy tests, #
+# but here we just test some simple basic replication of #
+# partition tables with same engine (MyISAM) in both ends. #
+############################################################
+
+--source include/have_row_based.inc
+--source include/have_binlog_format_row.inc
+--source include/have_partition.inc
+--source include/not_ndb_default.inc
+--source include/master-slave.inc
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+
+let $maybe_ro_var = @@BINLOG_FORMAT;
+let $val4var = ROW;
+--source include/safe_set_to_maybe_ro_var.inc
+
+--echo **** Partition RANGE testing ****
+
+# Create table that is partitioned by range on year i.e. year(t) and
+# replicate basice operations such at insert, update delete between 2
+# different storage engines Alter table and ensure table is handled
+# Correctly on the slave
+# Note that the storage engine should not be explicit: the default
+# storage engine is used on master and slave.
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+ bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE)
+ PARTITION BY RANGE (YEAR(t))
+ (PARTITION p0 VALUES LESS THAN (1901),
+ PARTITION p1 VALUES LESS THAN (1946),
+ PARTITION p2 VALUES LESS THAN (1966),
+ PARTITION p3 VALUES LESS THAN (1986),
+ PARTITION p4 VALUES LESS THAN (2005),
+ PARTITION p5 VALUES LESS THAN MAXVALUE);
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave --
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--source include/rpl_multi_engine3.inc
+
+connection master;
+# Check that simple Alter statements are replicated correctly
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+# Perform basic operation on master and ensure replicated correctly
+--source include/rpl_multi_engine3.inc
+
+connection master;
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+--echo **** Partition LIST testing ****
+
+# Create table that is partitioned by list on id i.e. (2,4). Pretend
+# that we missed one and alter to add. Then replicate basice
+# operations such at insert, update delete between 2 different storage
+# engines Alter table and ensure table is handled Correctly on the
+# slave.
+
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+ bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE)
+ PARTITION BY LIST(id)
+ (PARTITION p0 VALUES IN (2, 4),
+ PARTITION p1 VALUES IN (42, 142),
+ PARTITION p2 VALUES IN (412));
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+# Perform basic operation on master and ensure replicated correctly
+--source include/rpl_multi_engine3.inc
+
+connection master;
+# Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+# Perform basic operation on master and ensure replicated correctly
+--source include/rpl_multi_engine3.inc
+
+connection master;
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+--echo **** Partition HASH testing ****
+
+# Create table that is partitioned by hash on year i.e. YEAR(t). Then
+# replicate basice operations such at insert, update delete between 2
+# different storage engines Alter table and ensure table is handled
+# Correctly on the slave
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+ bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE)
+ PARTITION BY HASH( YEAR(t) )
+ PARTITIONS 4;
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--source include/rpl_multi_engine3.inc
+
+# Check that simple Alter statements are replicated correctly
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--source include/rpl_multi_engine3.inc
+
+connection master;
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+# This part does not work
+--echo **** Partition by KEY ****
+
+# Create table that is partitioned by key on id with 4 parts. Then
+# replicate basice operations such at insert, update delete between 2
+# different storage engines Alter table and ensure table is handled
+# Correctly on the slave
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+ bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE,PRIMARY KEY(id))
+ PARTITION BY KEY()
+ PARTITIONS 4;
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--source include/rpl_multi_engine3.inc
+
+connection master;
+# Check that simple Alter statements are replicated correctly
+ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--source include/rpl_multi_engine3.inc
+
+connection master;
+# Check that simple Alter statements are replicated correctly
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--source include/rpl_multi_engine3.inc
+
+DROP TABLE IF EXISTS t1;
+
+# End of 5.1 test case
diff --git a/mysql-test/t/rpl_row_blob_innodb-slave.opt b/mysql-test/t/rpl_row_blob_innodb-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_row_blob_innodb-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_row_blob_innodb.test b/mysql-test/t/rpl_row_blob_innodb.test
new file mode 100644
index 00000000000..0bce657f9f9
--- /dev/null
+++ b/mysql-test/t/rpl_row_blob_innodb.test
@@ -0,0 +1,12 @@
+#################################
+# Wrapper for rpl_row_blob.test#
+#################################
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/not_ndb_default.inc
+-- source include/have_innodb.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
new file mode 100644
index 00000000000..a470c36f9f8
--- /dev/null
+++ b/mysql-test/t/rpl_row_blob_myisam.test
@@ -0,0 +1,11 @@
+#################################
+# Wrapper for rpl_row_blob.test#
+#################################
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/not_ndb_default.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
new file mode 100644
index 00000000000..9737c52c70f
--- /dev/null
+++ b/mysql-test/t/rpl_row_charset.test
@@ -0,0 +1,7 @@
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/not_ndb_default.inc
+let $engine_type=myisam;
+-- source extra/rpl_tests/rpl_row_charset.test
diff --git a/mysql-test/t/rpl_row_create_table.test b/mysql-test/t/rpl_row_create_table.test
new file mode 100644
index 00000000000..3a711e5b496
--- /dev/null
+++ b/mysql-test/t/rpl_row_create_table.test
@@ -0,0 +1,120 @@
+# Testing table creations for row-based replication.
+
+--source include/have_binlog_format_row.inc
+--source include/master-slave.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
+
+--disable_query_log
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
+--enable_warnings
+--enable_query_log
+
+# Set the default storage engine to different values on master and
+# slave. We need to stop the slave for the server variable to take
+# effect, since the variable is only read on start-up.
+connection slave;
+--disable_query_log
+set @storage_engine = @@global.storage_engine;
+STOP SLAVE;
+SET GLOBAL storage_engine=memory;
+START SLAVE;
+--enable_query_log
+
+connection master;
+CREATE TABLE t1 (a INT, b INT);
+CREATE TABLE t2 (a INT, b INT) ENGINE=Merge;
+CREATE TABLE t3 (a INT, b INT) CHARSET=utf8;
+CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8;
+--replace_column 1 # 4 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
+--query_vertical SHOW BINLOG EVENTS FROM 212
+--echo **** On Master ****
+--query_vertical SHOW CREATE TABLE t1
+--query_vertical SHOW CREATE TABLE t2
+--query_vertical SHOW CREATE TABLE t3
+sync_slave_with_master;
+--echo **** On Slave ****
+--query_vertical SHOW CREATE TABLE t1
+--query_vertical SHOW CREATE TABLE t2
+--query_vertical SHOW CREATE TABLE t3
+
+connection master;
+CREATE TABLE t5 (b INT, c INT) SELECT * FROM t3;
+
+CREATE TEMPORARY TABLE tt3 (a INT, b INT);
+INSERT INTO tt3 VALUES (1,2), (2,4), (3,6), (4,2), (5,10), (6,12);
+CREATE TABLE t6 (b INT, c INT) SELECT * FROM tt3;
+--echo **** On Master ****
+--query_vertical SHOW CREATE TABLE t5
+SELECT * FROM t5 ORDER BY a,b,c;
+--query_vertical SHOW CREATE TABLE t6
+SELECT * FROM t6 ORDER BY a,b,c;
+sync_slave_with_master;
+--echo **** On Slave ****
+--query_vertical SHOW CREATE TABLE t5
+SELECT * FROM t5 ORDER BY a,b,c;
+--query_vertical SHOW CREATE TABLE t6
+SELECT * FROM t6 ORDER BY a,b,c;
+
+connection master;
+# Test for erroneous constructions
+--error 1062
+CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
+# Shouldn't be written to the binary log
+--replace_regex /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS FROM 1256;
+
+# Test that INSERT-SELECT works the same way as for SBR.
+CREATE TABLE t7 (a INT, b INT UNIQUE);
+--error 1062
+INSERT INTO t7 SELECT a,b FROM tt3;
+SELECT * FROM t7 ORDER BY a,b;
+# Should be written to the binary log
+--replace_regex /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS FROM 1118;
+sync_slave_with_master;
+SELECT * FROM t7 ORDER BY a,b;
+
+connection master;
+CREATE TEMPORARY TABLE tt4 (a INT, b INT);
+INSERT INTO tt4 VALUES (4,8), (5,10), (6,12);
+BEGIN;
+INSERT INTO t7 SELECT a,b FROM tt4;
+ROLLBACK;
+--replace_regex /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS FROM 1314;
+SELECT * FROM t7 ORDER BY a,b;
+sync_slave_with_master;
+SELECT * FROM t7 ORDER BY a,b;
+
+connection master;
+CREATE TABLE t8 LIKE t4;
+CREATE TABLE t9 LIKE tt4;
+CREATE TEMPORARY TABLE tt5 LIKE t4;
+CREATE TEMPORARY TABLE tt6 LIKE tt4;
+CREATE TEMPORARY TABLE tt7 SELECT 1;
+--echo **** On Master ****
+--query_vertical SHOW CREATE TABLE t8
+--query_vertical SHOW CREATE TABLE t9
+--replace_regex /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS FROM 1410;
+sync_slave_with_master;
+--echo **** On Slave ****
+--query_vertical SHOW CREATE TABLE t8
+--query_vertical SHOW CREATE TABLE t9
+
+connection master;
+--disable_query_log
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
+sync_slave_with_master;
+# Here we reset the value of the default storage engine
+STOP SLAVE;
+SET GLOBAL storage_engine=@storage_engine;
+START SLAVE;
+--enable_query_log
+--enable_ps_protocol
diff --git a/mysql-test/t/rpl_row_delayed_ins.test b/mysql-test/t/rpl_row_delayed_ins.test
new file mode 100644
index 00000000000..a0e74567349
--- /dev/null
+++ b/mysql-test/t/rpl_row_delayed_ins.test
@@ -0,0 +1,7 @@
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/not_ndb_default.inc
+let $engine_type=myisam;
+-- source extra/rpl_tests/rpl_row_delayed_ins.test
diff --git a/mysql-test/t/rpl_row_drop.test b/mysql-test/t/rpl_row_drop.test
new file mode 100644
index 00000000000..20c217a7c3a
--- /dev/null
+++ b/mysql-test/t/rpl_row_drop.test
@@ -0,0 +1,48 @@
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+# Bug#12415: DROP of temporary table on master stops slave
+connection master;
+--echo **** On Master ****
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (a int);
+CREATE TEMPORARY TABLE t2 (a int, b int);
+SHOW TABLES;
+sync_slave_with_master;
+--echo **** On Slave ****
+SHOW TABLES;
+connection master;
+--echo **** On Master ****
+DROP TABLE t2; # Dropping the temporary table
+SHOW TABLES;
+sync_slave_with_master;
+--echo **** On Slave ****
+SHOW TABLES; # There should be two tables on the slave
+
+connection master;
+--echo **** On Master ****
+CREATE TEMPORARY TABLE t2 (a int, b int);
+SHOW TABLES;
+sync_slave_with_master;
+--echo **** On Slave ****
+SHOW TABLES;
+connection master;
+--echo **** On Master ****
+# Should drop the non-temporary table t1 and the temporary table t2
+DROP TABLE t1,t2;
+let $VERSION=`select version()`;
+--replace_result $VERSION VERSION
+--replace_regex /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS;
+SHOW TABLES;
+sync_slave_with_master;
+--echo **** On Slave ****
+SHOW TABLES;
+
+--disable_query_log
+--disable_warnings
+connection master;
+DROP TABLE IF EXISTS t2;
+sync_slave_with_master;
+--enable_warnings
+--enable_query_log
diff --git a/mysql-test/t/rpl_row_err_daisychain-master.opt b/mysql-test/t/rpl_row_err_daisychain-master.opt
new file mode 100644
index 00000000000..83ed8522e72
--- /dev/null
+++ b/mysql-test/t/rpl_row_err_daisychain-master.opt
@@ -0,0 +1 @@
+--binlog-format=row
diff --git a/mysql-test/t/rpl_row_err_daisychain-slave.opt b/mysql-test/t/rpl_row_err_daisychain-slave.opt
new file mode 100644
index 00000000000..4cb7a31da81
--- /dev/null
+++ b/mysql-test/t/rpl_row_err_daisychain-slave.opt
@@ -0,0 +1 @@
+--binlog-format=statement --log-slave-updates
diff --git a/mysql-test/t/rpl_row_flsh_tbls.test b/mysql-test/t/rpl_row_flsh_tbls.test
new file mode 100644
index 00000000000..9e8efc1ac9c
--- /dev/null
+++ b/mysql-test/t/rpl_row_flsh_tbls.test
@@ -0,0 +1,17 @@
+# depends on the binlog output
+-- source include/have_binlog_format_row.inc
+
+let $rename_event_pos= 615;
+
+# 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.
+
+# Merge tables are not supported in NDB
+-- source include/not_ndb_default.inc
+
+
+--disable_ps_protocol
+-- source extra/rpl_tests/rpl_flsh_tbls.test
+--enable_ps_protocol
+
diff --git a/mysql-test/t/rpl_row_func001.test b/mysql-test/t/rpl_row_func001.test
new file mode 100644
index 00000000000..53fb55118e6
--- /dev/null
+++ b/mysql-test/t/rpl_row_func001.test
@@ -0,0 +1,57 @@
+#############################################################################
+# This test is being created to test out the non deterministic items with #
+# row based replication. #
+# Original Author: JBM #
+# Original Date: Aug/10/2005 #
+# Update: 08/29/2005 change name to initails #
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+--error 0,1305
+DROP FUNCTION test.f1;
+DROP TABLE IF EXISTS test.t1;
+
+
+--enable_warnings
+
+# Section 1 test from bug #12487 Uses stored function to insert rows to see what is replicated.
+
+create table test.t1 (a int, PRIMARY KEY(a));
+
+delimiter //;
+create function test.f1(i int) returns int
+begin
+insert into test.t1 values(i);
+return 0;
+end//
+delimiter ;//
+
+select test.f1(1);
+select test.f1(2);
+select * from test.t1;
+
+save_master_pos;
+sync_slave_with_master;
+connection slave;
+#show create table test.t1;
+select * from test.t1;
+
+connection master;
+
+#Used for debugging
+#show binlog events;
+
+# Cleanup
+
+DROP FUNCTION test.f1;
+DROP TABLE test.t1;
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_func002.test b/mysql-test/t/rpl_row_func002.test
new file mode 100644
index 00000000000..46767abd529
--- /dev/null
+++ b/mysql-test/t/rpl_row_func002.test
@@ -0,0 +1,103 @@
+#############################################################################
+# This test is being created to test out the non deterministic items with #
+# row based replication. #
+# Original Author: JBM #
+# Original Date: Aug/10/2005 #
+# Update: 08/29/2005 Turn on diff #
+#############################################################################
+# Note: Many lines are commented out in this test case. These were used for #
+# creating the test case and debugging and are being left for #
+# debugging, but they can not be used for the regular testing as the #
+# Time changes and is not deteministic, so instead we dump both the #
+# master and slave and diff the dumps. If the dumps differ then the #
+# test case will fail. To run during diff failuers, comment out the #
+# diff. #
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+--error 0,1305
+DROP FUNCTION test.f1;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+
+--enable_warnings
+
+# Section 1 test from Peter G. This test changes uses a stored function to update rows and return the timestamp. We change the value of the time stamp on the master to see what is replicated.
+
+CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, t TIMESTAMP, t2 TIMESTAMP, PRIMARY KEY(a));
+CREATE TABLE test.t2 (a INT NOT NULL AUTO_INCREMENT, t TIMESTAMP, t2 TIMESTAMP, PRIMARY KEY(a));
+
+delimiter //;
+create function test.f1() RETURNS TIMESTAMP
+BEGIN
+UPDATE test.t1 SET t = CURRENT_TIMESTAMP;
+RETURN CURRENT_TIMESTAMP;
+END//
+delimiter ;//
+
+INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
+#select * from test.t1;
+#save_master_pos;
+#sync_slave_with_master;
+#connection slave;
+#select * from test.t1;
+#connection master;
+
+
+SET TIMESTAMP=2;
+INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
+#select * from test.t1;
+#save_master_pos;
+#sync_slave_with_master;
+#connection slave;
+#select * from test.t1;
+#connection master;
+
+#sleep 3;
+SET TIMESTAMP=1;
+INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
+#select * from test.t1;
+#save_master_pos;
+#sync_slave_with_master;
+#connection slave;
+#select * from test.t1;
+#connection master;
+
+
+SET TIMESTAMP=333300000;
+INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
+
+# We need a sync to ensure that the slave has caught up before
+# dumping the database.
+sync_slave_with_master;
+
+connection master;
+#Used for debugging
+#show binlog events;
+
+# time to dump the databases and so we can see if they match
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/func002_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/func002_slave.sql
+
+# Cleanup
+DROP FUNCTION test.f1;
+DROP TABLE test.t1;
+sync_slave_with_master;
+
+# the test will show that the diff statement failed and no reject file
+# will be created. You will need to go to the mysql-test dir and diff
+# the files your self to see what is not matching :-). The files are located
+# in mysql-test/var/tmp
+
+exec diff $MYSQLTEST_VARDIR/tmp/func002_master.sql $MYSQLTEST_VARDIR/tmp/func002_slave.sql;
+
+# End of 5.0 test case
+
diff --git a/mysql-test/t/rpl_row_func003-slave.opt b/mysql-test/t/rpl_row_func003-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_row_func003-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_row_func003.test b/mysql-test/t/rpl_row_func003.test
new file mode 100644
index 00000000000..abfadfe1a1a
--- /dev/null
+++ b/mysql-test/t/rpl_row_func003.test
@@ -0,0 +1,11 @@
+###################################
+# Wrapper for rpl_row_func003.test#
+###################################
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/not_ndb_default.inc
+-- source include/have_innodb.inc
+let $engine_type=INNODB;
+-- source extra/rpl_tests/rpl_row_func003.test
diff --git a/mysql-test/t/rpl_row_inexist_tbl-slave.opt b/mysql-test/t/rpl_row_inexist_tbl-slave.opt
new file mode 100644
index 00000000000..abd717f8222
--- /dev/null
+++ b/mysql-test/t/rpl_row_inexist_tbl-slave.opt
@@ -0,0 +1 @@
+--replicate-ignore-table=test.t2
diff --git a/mysql-test/t/rpl_row_inexist_tbl.test b/mysql-test/t/rpl_row_inexist_tbl.test
new file mode 100644
index 00000000000..741cc8b7ba3
--- /dev/null
+++ b/mysql-test/t/rpl_row_inexist_tbl.test
@@ -0,0 +1,35 @@
+# Test to see what slave says when master is updating a table it does
+# not have
+--source include/have_binlog_format_row.inc
+
+source include/master-slave.inc;
+
+connection master;
+create table t1 (a int not null primary key);
+insert into t1 values (1);
+create table t2 (a int);
+insert into t2 values (1);
+update t1, t2 set t1.a = 0 where t1.a = t2.a;
+
+sync_slave_with_master;
+# t2 should not have been replicated
+# t1 should have been properly updated
+show tables;
+select * from t1;
+drop table t1;
+
+connection master;
+insert into t1 values (1);
+
+connection slave;
+# slave should have stopped because can't find table t1
+wait_for_slave_to_stop;
+# see if we have a good error message:
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 7 # 8 # 9 # 23 # 33 #
+--vertical_results
+show slave status;
+
+# cleanup
+connection master;
+drop table t1, t2;
diff --git a/mysql-test/t/rpl_row_log-master.opt b/mysql-test/t/rpl_row_log-master.opt
new file mode 100644
index 00000000000..e0d075c3fbd
--- /dev/null
+++ b/mysql-test/t/rpl_row_log-master.opt
@@ -0,0 +1 @@
+--skip-external-locking
diff --git a/mysql-test/t/rpl_log-slave.opt b/mysql-test/t/rpl_row_log-slave.opt
index 8b137891791..8b137891791 100644
--- a/mysql-test/t/rpl_log-slave.opt
+++ b/mysql-test/t/rpl_row_log-slave.opt
diff --git a/mysql-test/t/rpl_row_log.test b/mysql-test/t/rpl_row_log.test
new file mode 100644
index 00000000000..3253ae9ecba
--- /dev/null
+++ b/mysql-test/t/rpl_row_log.test
@@ -0,0 +1,16 @@
+###################################
+# Wrapper for rpl_row_log.test #
+# Added wrapper so that MyISAM & #
+# Innodb and NDB could all use the#
+# Same test. NDB produced a diff #
+# bin-log #
+###################################
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/not_ndb_default.inc
+-- source include/have_binlog_format_row.inc
+let $engine_type=MyISAM;
+-- source extra/rpl_tests/rpl_log.test
+
diff --git a/mysql-test/t/rpl_row_log_innodb-master.opt b/mysql-test/t/rpl_row_log_innodb-master.opt
new file mode 100644
index 00000000000..e0d075c3fbd
--- /dev/null
+++ b/mysql-test/t/rpl_row_log_innodb-master.opt
@@ -0,0 +1 @@
+--skip-external-locking
diff --git a/mysql-test/t/rpl_row_log_innodb-slave.opt b/mysql-test/t/rpl_row_log_innodb-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_row_log_innodb-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_row_log_innodb.test b/mysql-test/t/rpl_row_log_innodb.test
new file mode 100644
index 00000000000..5e5182e3519
--- /dev/null
+++ b/mysql-test/t/rpl_row_log_innodb.test
@@ -0,0 +1,13 @@
+###################################
+# Wrapper for rpl_row_log.test #
+# Added wrapper so that MyISAM & #
+# Innodb and NDB could all use the#
+# Same test. NDB produced a diff #
+# bin-log #
+###################################
+-- source include/not_ndb_default.inc
+-- source include/have_binlog_format_row.inc
+-- source include/have_innodb.inc
+let $engine_type=InnoDB;
+-- source extra/rpl_tests/rpl_log.test
+
diff --git a/mysql-test/t/rpl_row_max_relay_size.test b/mysql-test/t/rpl_row_max_relay_size.test
new file mode 100644
index 00000000000..eb3f63db8aa
--- /dev/null
+++ b/mysql-test/t/rpl_row_max_relay_size.test
@@ -0,0 +1,12 @@
+# Test of options max_binlog_size and max_relay_log_size and
+# how they act (if max_relay_log_size == 0, use max_binlog_size
+# for relay logs too).
+# Test of manual relay log rotation with FLUSH LOGS.
+
+# Requires statement logging
+-- source include/not_ndb_default.inc
+-- source include/have_row_based.inc
+SET SESSION BINLOG_FORMAT=ROW;
+SET GLOBAL BINLOG_FORMAT=ROW;
+-- source extra/rpl_tests/rpl_max_relay_size.test
+
diff --git a/mysql-test/t/rpl_row_mysqlbinlog-master.opt b/mysql-test/t/rpl_row_mysqlbinlog-master.opt
new file mode 100644
index 00000000000..07d12817f5f
--- /dev/null
+++ b/mysql-test/t/rpl_row_mysqlbinlog-master.opt
@@ -0,0 +1 @@
+--max-binlog-size=1040384
diff --git a/mysql-test/t/rpl_row_mysqlbinlog.test b/mysql-test/t/rpl_row_mysqlbinlog.test
new file mode 100644
index 00000000000..3b4c8db86d8
--- /dev/null
+++ b/mysql-test/t/rpl_row_mysqlbinlog.test
@@ -0,0 +1,319 @@
+##################################################################
+# Author: JBM #
+# Date: 2006-02-22 #
+# Purpose: To test changes to mysqlbinlog for row based bin logs #
+# We are using .opt file since we need small binlog size #
+##################################################################
+# Include Section
+# Make sure that we have row based bin log
+-- source include/have_binlog_format_row.inc
+# Embedded server doesn't support binlogging
+-- source include/not_embedded.inc
+-- source include/master-slave.inc
+
+# Setup Section
+# we need this for getting fixed timestamps inside of this test
+
+--disable_query_log
+select "---Setup Section --" as "";
+--enable_query_log
+
+set timestamp=1000000000;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2,t3;
+--enable_warnings
+
+connection master;
+CREATE TABLE t1(word VARCHAR(20));
+CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY);
+CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT);
+
+
+# Test Section
+# Lets start by putting some data into the tables.
+
+--disable_query_log
+INSERT INTO t1 VALUES ("abirvalg");
+LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
+LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
+LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
+LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
+LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
+
+# d1 length 3000
+set @d1 = 'dd1';
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+
+let $count=500;
+while ($count)
+{
+ INSERT INTO t2 VALUES (NULL);
+ eval INSERT INTO t3 VALUES ($count,@d1,'20060222000000','Tested in Texas',$count*2.2);
+ dec $count;
+}
+--enable_query_log
+
+
+--disable_query_log
+select "---Test1 check table load --" as "";
+--enable_query_log
+
+# Lets Check the tables on the Master
+SELECT COUNT(*) from t1;
+SELECT COUNT(*) from t2;
+SELECT COUNT(*) from t3;
+SELECT * FROM t1 ORDER BY word LIMIT 5;
+SELECT * FROM t2 ORDER BY id LIMIT 5;
+SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
+
+# Should have the same on the slave;
+
+sync_slave_with_master;
+SELECT COUNT(*) from t1;
+SELECT COUNT(*) from t2;
+SELECT COUNT(*) from t3;
+SELECT * FROM t1 ORDER BY word LIMIT 5;
+SELECT * FROM t2 ORDER BY id LIMIT 5;
+SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
+
+# Okay time to get busy, back to master
+
+connection master;
+
+# simple query to show more in second binlog
+insert into t1 values ("Alas");
+flush logs;
+
+# delimiters are for easier debugging in future
+--disable_query_log
+select "--- Test 1 Dump binlog to file --" as "";
+--enable_query_log
+
+#
+# Prepare local temporary file to recreate what we have currently.
+
+--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/master.sql
+
+--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/master.sql
+
+# Now that we have our file, lets get rid of the current database.
+# Cleanup the master and the slave and try to recreate.
+--disable_query_log
+select "--- Test 1 delete tables, clean master and slave --" as "";
+--enable_query_log
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+
+sync_slave_with_master;
+#we expect STOP SLAVE to produce a warning as the slave is stopped
+#(the server was started with skip-slave-start)
+--disable_warnings
+stop slave;
+--enable_warnings
+--require r/slave-stopped.result
+show status like 'Slave_running';
+connection master;
+reset master;
+connection slave;
+reset slave;
+start slave;
+--require r/slave-running.result
+show status like 'Slave_running';
+connection master;
+
+# We should be clean at this point, now we will run in the file from above.
+--disable_query_log
+select "--- Test 1 Load from Dump binlog file --" as "";
+--enable_query_log
+
+--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/master.sql"
+
+--disable_query_log
+select "--- Test 1 Check Load Results --" as "";
+--enable_query_log
+
+# Lets Check the tables on the Master
+SELECT COUNT(*) from t1;
+SELECT COUNT(*) from t2;
+SELECT COUNT(*) from t3;
+SELECT * FROM t1 ORDER BY word LIMIT 5;
+SELECT * FROM t2 ORDER BY id LIMIT 5;
+SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
+
+# Should have the same on the slave;
+
+sync_slave_with_master;
+SELECT COUNT(*) from t1;
+SELECT COUNT(*) from t2;
+SELECT COUNT(*) from t3;
+SELECT * FROM t1 ORDER BY word LIMIT 5;
+SELECT * FROM t2 ORDER BY id LIMIT 5;
+SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
+connection master;
+
+# We should be gold by the time, so I will get rid of our file.
+
+--exec rm $MYSQLTEST_VARDIR/tmp/master.sql
+
+
+# this test for position option
+# By setting this position to 412, we should only get the create of t3
+--disable_query_log
+select "--- Test 2 position test --" as "";
+--enable_query_log
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=412 $MYSQLTEST_VARDIR/log/master-bin.000001
+
+# These are tests for remote binlog.
+# They should return the same as previous test.
+
+--disable_query_log
+select "--- Test 3 First Remote test --" as "";
+--enable_query_log
+
+# This is broken now
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+
+# This part is disabled due to bug #17654
+################### Start Bug 17654 ######################
+#--disable_query_log
+#select "--- Test 4 Second Remote test --" as "";
+#--enable_query_log
+#--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql
+
+#--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/remote.sql
+
+# Now that we have our file, lets get rid of the current database.
+# Cleanup the master and the slave and try to recreate.
+
+#DROP TABLE t1;
+#DROP TABLE t2;
+#DROP TABLE t3;
+
+#sync_slave_with_master;
+
+#we expect STOP SLAVE to produce a warning as the slave is stopped
+#(the server was started with skip-slave-start)
+
+#--disable_warnings
+#stop slave;
+#--enable_warnings
+#--require r/slave-stopped.result
+#show status like 'Slave_running';
+#connection master;
+#reset master;
+#connection slave;
+#reset slave;
+#start slave;
+#--require r/slave-running.result
+#show status like 'Slave_running';
+#connection master;
+
+# We should be clean at this point, now we will run in the file from above.
+
+#--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/remote.sql"
+
+# Lets Check the tables on the Master
+
+#SELECT COUNT(*) from t1;
+#SELECT COUNT(*) from t2;
+#SELECT COUNT(*) from t3;
+#SELECT * FROM t1 ORDER BY word LIMIT 5;
+#SELECT * FROM t2 ORDER BY id LIMIT 5;
+#SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
+
+# Should have the same on the slave;
+
+#sync_slave_with_master;
+#SELECT COUNT(*) from t1;
+#SELECT COUNT(*) from t2;
+#SELECT COUNT(*) from t3;
+#SELECT * FROM t1 ORDER BY word LIMIT 5;
+#SELECT * FROM t2 ORDER BY id LIMIT 5;
+#SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
+#connection master;
+
+# We should be gold by the time, so I will get rid of our file.
+
+#--exec rm $MYSQLTEST_VARDIR/tmp/remote.sql
+################### End Bug 17654 ######################
+
+# LOAD DATA
+--disable_query_log
+select "--- Test 5 LOAD DATA --" as "";
+--enable_query_log
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
+
+# Bug#7853 (mysqlbinlog does not accept input from stdin)
+
+--disable_query_log
+select "--- Test 6 reading stdin --" as "";
+--enable_query_log
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+--exec $MYSQL_BINLOG --short-form - < $MYSQLTEST_VARDIR/log/master-bin.000001
+
+--disable_query_log
+select "--- Test 7 reading stdin w/position --" as "";
+--enable_query_log
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+--exec $MYSQL_BINLOG --short-form --position=412 - < $MYSQLTEST_VARDIR/log/master-bin.000001
+
+# Bug#16217 (mysql client did not know how not switch its internal charset)
+--disable_query_log
+select "--- Test 8 switch internal charset --" as "";
+--enable_query_log
+sync_slave_with_master;
+
+#we expect STOP SLAVE to produce a warning as the slave is stopped
+#(the server was started with skip-slave-start)
+
+--disable_warnings
+stop slave;
+--enable_warnings
+--require r/slave-stopped.result
+show status like 'Slave_running';
+connection master;
+reset master;
+connection slave;
+reset slave;
+start slave;
+--require r/slave-running.result
+show status like 'Slave_running';
+connection master;
+
+create table t4 (f text character set utf8);
+create table t5 (f text character set cp932);
+--exec $MYSQL --default-character-set=utf8 test -e "insert into t4 values(_utf8'ソ')"
+--exec $MYSQL --default-character-set=cp932 test -e "insert into t5 values(_cp932'\');"
+flush logs;
+rename table t4 to t04, t5 to t05;
+--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 | $MYSQL --default-character-set=utf8
+# original and recovered data must be equal
+select HEX(f) from t04;
+select HEX(f) from t4;
+select HEX(f) from t05;
+select HEX(f) from t5;
+
+# slave should have same
+sync_slave_with_master;
+select HEX(f) from t04;
+select HEX(f) from t4;
+select HEX(f) from t05;
+select HEX(f) from t5;
+
+--disable_query_log
+select "--- Test cleanup --" as "";
+--enable_query_log
+# clean up
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5;
+sync_slave_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/t/rpl_row_mystery22.test b/mysql-test/t/rpl_row_mystery22.test
new file mode 100644
index 00000000000..9933fec22fc
--- /dev/null
+++ b/mysql-test/t/rpl_row_mystery22.test
@@ -0,0 +1,45 @@
+# Originally taken from rpl_mystery22.test,
+# but this row-based-replication test has a totally different spirit:
+# slave will not stop because of dup key,
+# instead we test if it does overwrite the dup key
+# as expected.
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+# first, cause a duplicate key problem on the slave
+create table t1(n int auto_increment primary key, s char(10));
+sync_slave_with_master;
+insert into t1 values (2,'old');
+connection master;
+insert into t1 values(NULL,'new');
+insert into t1 values(NULL,'new');
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from t1 order by n;
+delete from t1 where n = 2;
+--disable_warnings
+start slave;
+--enable_warnings
+sync_with_master;
+stop slave;
+connection master;
+create table t2(n int);
+drop table t2;
+insert into t1 values(NULL,'new');
+# what happens when we delete a row which does not exist on slave?
+set sql_log_bin=0;
+insert into t1 values(NULL,'new');
+set sql_log_bin=1;
+delete from t1 where n=4;
+save_master_pos;
+connection slave;
+--disable_warnings
+start slave;
+--enable_warnings
+sync_with_master;
+select * from t1 order by n;
+#clean up
+connection master;
+drop table t1;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_row_reset_slave.test b/mysql-test/t/rpl_row_reset_slave.test
new file mode 100644
index 00000000000..a970c161153
--- /dev/null
+++ b/mysql-test/t/rpl_row_reset_slave.test
@@ -0,0 +1,5 @@
+# TBF - difference in row level logging
+# Temp tables are not replicated in rbr, but it is still good to hit rbr with everthing
+-- source include/have_binlog_format_row.inc
+-- source extra/rpl_tests/rpl_reset_slave.test
+
diff --git a/mysql-test/t/rpl_row_sp001.test b/mysql-test/t/rpl_row_sp001.test
new file mode 100644
index 00000000000..8e01cbc4f44
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp001.test
@@ -0,0 +1,146 @@
+#############################################################################
+# This test is being created to test out the non deterministic items with #
+# row based replication. #
+# Original Author: JBM #
+# Original Date: Aug/09/2005 #
+# Updated: Aug/29/2005
+#############################################################################
+# Test: Includes two stored procedure tests. First test uses SP to insert #
+# values from RAND() and NOW() into a table. #
+# The second test uses SP with CASE structure to decide what to text #
+# to update a given table with. #
+############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+-- disable_query_log
+-- disable_result_log
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+
+-- enable_query_log
+-- enable_result_log
+
+# Begin test section 1 for non deterministic SP
+let $message=<Begin test section 1 (non deterministic SP)>;
+--source include/show_msg.inc
+
+create table test.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
+
+delimiter //;
+create procedure test.p1()
+begin
+ INSERT INTO test.t1 (f,d) VALUES (RAND(),NOW());
+end//
+delimiter ;//
+
+# show binlog events;
+
+-- disable_query_log
+-- disable_result_log
+let $1=10;
+while ($1)
+{
+ call test.p1();
+ sleep 1;
+ dec $1;
+}
+-- enable_result_log
+-- enable_query_log
+
+## Used for debugging
+#show binlog events;
+#select * from test.t1;
+#sync_slave_with_master;
+#select * from test.t1;
+#connection master;
+
+let $message=<End test section 1 (non deterministic SP)>;
+--source include/show_msg.inc
+
+
+CREATE TABLE test.t2 (a INT NOT NULL AUTO_INCREMENT, t CHAR(4), PRIMARY KEY(a));
+
+delimiter //;
+CREATE PROCEDURE test.p2(n int)
+begin
+CASE n
+WHEN 1 THEN
+ UPDATE test.t2 set t ='Tex';
+WHEN 2 THEN
+ UPDATE test.t2 set t ='SQL';
+ELSE
+ UPDATE test.t2 set t ='NONE';
+END CASE;
+end//
+delimiter ;//
+
+INSERT INTO test.t2 VALUES(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW');
+
+SELECT * FROM t2 ORDER BY a;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM t2 ORDER BY a;
+
+connection master;
+call test.p2(1);
+SELECT * FROM t2 ORDER BY a;
+sync_slave_with_master;
+SELECT * FROM t2 ORDER BY a;
+
+
+connection master;
+call test.p2(2);
+SELECT * FROM t2 ORDER BY a;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM t2 ORDER BY a;
+
+connection master;
+call test.p2(3);
+SELECT * FROM t2 ORDER BY a;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM t2 ORDER BY a;
+
+##Used for debugging
+#show binlog events;
+
+# time to dump the databases and so we can see if they match
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp001_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp001_slave.sql
+
+# First lets cleanup
+
+connection master;
+DROP PROCEDURE test.p1;
+DROP PROCEDURE test.p2;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+sync_slave_with_master;
+
+# Lets compare. Note: If they match test will pass, if they do not match
+# the test will show that the diff statement failed and not reject file
+# will be created. You will need to go to the mysql-test dir and diff
+# the files your self to see what is not matching :-) Failed dump files
+# will be located in $MYSQLTEST_VARDIR/tmp
+
+--exec diff $MYSQLTEST_VARDIR/tmp/sp001_master.sql $MYSQLTEST_VARDIR/tmp/sp001_slave.sql;
+
+# If all is good, when can cleanup our dump files.
+system rm $MYSQLTEST_VARDIR/tmp/sp001_master.sql;
+system rm $MYSQLTEST_VARDIR/tmp/sp001_slave.sql;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_sp002_innodb-master.opt b/mysql-test/t/rpl_row_sp002_innodb-master.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp002_innodb-master.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_row_sp002_innodb-slave.opt b/mysql-test/t/rpl_row_sp002_innodb-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp002_innodb-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_row_sp002_innodb.test b/mysql-test/t/rpl_row_sp002_innodb.test
new file mode 100644
index 00000000000..e272e34e715
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp002_innodb.test
@@ -0,0 +1,11 @@
+#################################
+# Wrapper for rpl_row_sp002.test#
+#################################
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/not_ndb_default.inc
+-- source include/have_innodb.inc
+let $engine_type=INNODB;
+-- source extra/rpl_tests/rpl_row_sp002.test
diff --git a/mysql-test/t/rpl_row_sp003-master.opt b/mysql-test/t/rpl_row_sp003-master.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp003-master.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_row_sp003-slave.opt b/mysql-test/t/rpl_row_sp003-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp003-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_row_sp003.test b/mysql-test/t/rpl_row_sp003.test
new file mode 100644
index 00000000000..99b30253c8a
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp003.test
@@ -0,0 +1,11 @@
+#################################
+# Wrapper for rpl_row_sp003.test#
+#################################
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/not_ndb_default.inc
+-- source include/have_innodb.inc
+let $engine_type=INNODB;
+-- source extra/rpl_tests/rpl_row_sp003.test
diff --git a/mysql-test/t/rpl_row_sp005.test b/mysql-test/t/rpl_row_sp005.test
new file mode 100644
index 00000000000..054fa02f514
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp005.test
@@ -0,0 +1,110 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/15/2005 #
+# Updated: Aug/29/2005: Removed sleeps #
+#############################################################################
+# Test: Tests SPs with cursors, flow logic, and alter sp. In addition the #
+# tests SPs with insert and update operations. #
+#############################################################################
+# 2006-02-08 By JBM added ORDER BY for use with NDB engine
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t3;
+--enable_warnings
+# End of cleanup
+
+# Begin test section 1
+CREATE TABLE IF NOT EXISTS test.t1(id INT, data CHAR(16),PRIMARY KEY(id));
+CREATE TABLE IF NOT EXISTS test.t2(id2 INT,PRIMARY KEY(id2));
+CREATE TABLE IF NOT EXISTS test.t3(id3 INT,PRIMARY KEY(id3), c CHAR(16));
+
+delimiter |;
+CREATE PROCEDURE test.p1()
+BEGIN
+DECLARE done INT DEFAULT 0;
+ DECLARE spa CHAR(16);
+ DECLARE spb,spc INT;
+ DECLARE cur1 CURSOR FOR SELECT id,data FROM test.t1 ORDER BY id;
+ DECLARE cur2 CURSOR FOR SELECT id2 FROM test.t2 ORDER BY id2;
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
+
+ OPEN cur1;
+ OPEN cur2;
+
+ REPEAT
+ FETCH cur1 INTO spb, spa;
+ FETCH cur2 INTO spc;
+ IF NOT done THEN
+ IF spb < spc THEN
+ INSERT INTO test.t3 VALUES (spb,spa);
+ ELSE
+ INSERT INTO test.t3 VALUES (spc,spa);
+ END IF;
+ END IF;
+ UNTIL done END REPEAT;
+
+ CLOSE cur1;
+ CLOSE cur2;
+END|
+CREATE PROCEDURE test.p2()
+BEGIN
+ INSERT INTO test.t1 VALUES (4,'MySQL'),(20,'ROCKS'),(11,'Texas'),(10,'kyle');
+ INSERT INTO test.t2 VALUES (4),(2),(1),(3);
+ UPDATE test.t1 SET id=id+4 WHERE id=4;
+END|
+delimiter ;|
+
+let $message=< ---- Master selects-- >;
+--source include/show_msg.inc
+CALL test.p2();
+SELECT * FROM test.t1 ORDER BY id;
+SELECT * FROM test.t2 ORDER BY id2;
+
+let $message=< ---- Slave selects-- >;
+--source include/show_msg.inc
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t1 ORDER BY id;
+SELECT * FROM test.t2 ORDER BY id2;
+
+let $message=< ---- Master selects-- >;
+--source include/show_msg.inc
+connection master;
+CALL test.p1();
+sleep 6;
+SELECT * FROM test.t3 ORDER BY id3;
+
+let $message=< ---- Slave selects-- >;
+--source include/show_msg.inc
+connection slave;
+SELECT * FROM test.t3 ORDER BY id3;
+
+connection master;
+
+ALTER PROCEDURE test.p1 MODIFIES SQL DATA;
+#show binlog events;
+
+# Cleanup
+
+connection master;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_sp006_InnoDB-slave.opt b/mysql-test/t/rpl_row_sp006_InnoDB-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp006_InnoDB-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_row_sp006_InnoDB.test b/mysql-test/t/rpl_row_sp006_InnoDB.test
new file mode 100644
index 00000000000..f7e59440027
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp006_InnoDB.test
@@ -0,0 +1,11 @@
+#################################
+# Wrapper for rpl_row_sp006.test#
+#################################
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/not_ndb_default.inc
+-- source include/have_innodb.inc
+let $engine_type=InnoDB;
+-- source extra/rpl_tests/rpl_row_sp006.test
diff --git a/mysql-test/t/rpl_row_sp007_innodb-slave.opt b/mysql-test/t/rpl_row_sp007_innodb-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp007_innodb-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_row_sp007_innodb.test b/mysql-test/t/rpl_row_sp007_innodb.test
new file mode 100644
index 00000000000..41af5a5f997
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp007_innodb.test
@@ -0,0 +1,11 @@
+#################################
+# Wrapper for rpl_row_sp007.test#
+#################################
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/not_ndb_default.inc
+-- source include/have_innodb.inc
+let $engine_type=INNODB;
+-- source extra/rpl_tests/rpl_row_sp007.test
diff --git a/mysql-test/t/rpl_row_sp008.test b/mysql-test/t/rpl_row_sp008.test
new file mode 100644
index 00000000000..8e8e709a2d9
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp008.test
@@ -0,0 +1,56 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/15/2005 #
+# Update: 08/29/2005 Remove sleep #
+#############################################################################
+# TEST: Use SQL_CALC_FOUND_ROWS and insert results into a table inside a sp #
+#############################################################################
+
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t2;
+--enable_warnings
+# End of cleanup
+
+
+
+# Begin test section 1
+CREATE TABLE test.t1 (a INT,PRIMARY KEY(a));
+CREATE TABLE test.t2 (a INT,PRIMARY KEY(a));
+INSERT INTO test.t1 VALUES(1),(2);
+
+delimiter |;
+CREATE PROCEDURE test.p1()
+BEGIN
+ SELECT SQL_CALC_FOUND_ROWS * FROM test.t1 LIMIT 1;
+ INSERT INTO test.t2 VALUES(FOUND_ROWS());
+END|
+delimiter ;|
+
+let $message=< ---- Master selects-- >;
+--source include/show_msg.inc
+CALL test.p1();
+SELECT * FROM test.t2;
+
+let $message=< ---- Slave selects-- >;
+--source include/show_msg.inc
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t2;
+
+# Cleanup
+
+connection master;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_sp009.test b/mysql-test/t/rpl_row_sp009.test
new file mode 100644
index 00000000000..92d47c6f50f
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp009.test
@@ -0,0 +1,105 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/18/2005 #
+# Updated: 08/29/2005 removed sleeps and added master pos save and snyc #
+#############################################################################
+#TEST: Taken and modfied from http://bugs.mysql.com/bug.php?id=12168 #
+#############################################################################
+# 2006-02-08 By JBM : Added order by for ndb engine use
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+
+
+# Begin test section 1
+CREATE TABLE test.t1 (a INT, PRIMARY KEY(a));
+INSERT INTO test.t1 VALUES (1),(2),(3),(4);
+CREATE TABLE test.t2 (a INT, PRIMARY KEY(a));
+
+delimiter |;
+CREATE PROCEDURE test.p1 (arg1 CHAR(1))
+BEGIN
+ DECLARE b, c INT;
+ IF arg1 = 'a' THEN
+ BEGIN
+ DECLARE cur1 CURSOR FOR SELECT A FROM test.t1 WHERE a % 2;
+ DECLARE continue handler for not found set b = 1;
+ SET b = 0;
+ OPEN cur1;
+ c1_repeat: REPEAT
+ FETCH cur1 INTO c;
+ IF (b = 1) THEN
+ LEAVE c1_repeat;
+ END IF;
+
+ INSERT INTO test.t2 VALUES (c);
+ UNTIL b = 1
+ END REPEAT;
+ CLOSE cur1;
+ END;
+ END IF;
+ IF arg1 = 'b' THEN
+ BEGIN
+ DECLARE cur2 CURSOR FOR SELECT a FROM test.t1 WHERE NOT a % 2;
+ DECLARE continue handler for not found set b = 1;
+ SET b = 0;
+ OPEN cur2;
+ c2_repeat: REPEAT
+ FETCH cur2 INTO c;
+ IF (b = 1) THEN
+ LEAVE c2_repeat;
+ END IF;
+
+ INSERT INTO test.t2 VALUES (c);
+ UNTIL b = 1
+ END REPEAT;
+ CLOSE cur2;
+ END;
+ END IF;
+END|
+delimiter ;|
+
+CALL test.p1('a');
+SELECT * FROM test.t2 ORDER BY a;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t2 ORDER BY a;
+connection master;
+truncate test.t2;
+
+# this next call fails, but should not
+call test.p1('b');
+select * from test.t2 ORDER BY a;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t2 ORDER BY a;
+
+connection master;
+truncate test.t2;
+SELECT * FROM test.t2 ORDER BY a;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t2 ORDER BY a;
+
+# Cleanup
+connection master;
+#show binlog events;
+DROP PROCEDURE test.p1;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_sp010.test b/mysql-test/t/rpl_row_sp010.test
new file mode 100644
index 00000000000..28b82217517
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp010.test
@@ -0,0 +1,80 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/18/2005 #
+# Update: 08/29/2005 remove sleep added master pos save and sync #
+#############################################################################
+#TEST: Taken and modfied from http://bugs.mysql.com/bug.php?id=11126 #
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p4;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+
+
+# Begin test section 1
+delimiter |;
+CREATE PROCEDURE test.p1()
+BEGIN
+ INSERT INTO test.t1 VALUES(2);
+END|
+CREATE PROCEDURE test.p2()
+BEGIN
+ DROP TEMPORARY TABLE IF EXISTS test.t1;
+ CREATE TEMPORARY TABLE test.t1 (a int, PRIMARY KEY(a));
+ INSERT INTO test.t1 VALUES(1);
+ CALL test.p1();
+END|
+delimiter ;|
+CALL test.p2();
+SELECT * FROM test.t1 ORDER BY a;
+
+save_master_pos;
+connection slave;
+sync_with_master;
+show tables;
+
+connection master;
+delimiter |;
+CREATE PROCEDURE test.p3()
+BEGIN
+ INSERT INTO test.t2 VALUES(7);
+END|
+CREATE PROCEDURE test.p4()
+BEGIN
+ DROP TABLE IF EXISTS test.t2;
+ CREATE TABLE test.t2 (a int, PRIMARY KEY(a));
+ INSERT INTO test.t2 VALUES(6);
+ CALL test.p3();
+END|
+delimiter ;|
+CALL test.p4();
+SELECT * FROM test.t2 ORDER BY a;
+
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t2 ORDER BY a;
+
+# Cleanup
+connection master;
+#show binlog events;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p4;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_sp011.test b/mysql-test/t/rpl_row_sp011.test
new file mode 100644
index 00000000000..54e708492d1
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp011.test
@@ -0,0 +1,111 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/18/2005 #
+# Updated: 08/29/2005 turned on diff and commented out debug SQL statements#
+#############################################################################
+#TEST: SP to test alter table and nested SP calls #
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p4;
+DROP PROCEDURE IF EXISTS test.p5;
+DROP PROCEDURE IF EXISTS test.p6;
+DROP PROCEDURE IF EXISTS test.p7;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+
+
+# Begin test section 1
+CREATE TABLE test.t1 (a int, PRIMARY KEY(a));
+INSERT INTO test.t1 VALUES (1);
+
+delimiter |;
+CREATE PROCEDURE test.p1()
+BEGIN
+ ALTER TABLE test.t1 ADD COLUMN b CHAR(4) AFTER a;
+ UPDATE test.t1 SET b = 'rbr' WHERE a = 1;
+ CALL test.p2();
+END|
+CREATE PROCEDURE test.p2()
+BEGIN
+ ALTER TABLE test.t1 ADD COLUMN f FLOAT AFTER b;
+ UPDATE test.t1 SET f = RAND() WHERE a = 1;
+ CALL test.p3();
+END|
+CREATE PROCEDURE test.p3()
+BEGIN
+ ALTER TABLE test.t1 RENAME test.t2;
+ CALL test.p4();
+END|
+CREATE PROCEDURE test.p4()
+BEGIN
+ ALTER TABLE test.t2 ADD INDEX (f);
+ ALTER TABLE test.t2 CHANGE a a INT UNSIGNED NOT NULL AUTO_INCREMENT;
+ INSERT INTO test.t2 VALUES (NULL,'TEST',RAND());
+ CALL test.p5();
+END|
+CREATE PROCEDURE test.p5()
+BEGIN
+ ALTER TABLE test.t2 ORDER BY f;
+ INSERT INTO test.t2 VALUES (NULL,'STM',RAND());
+ CALL test.p6();
+END|
+CREATE PROCEDURE test.p6()
+BEGIN
+ ALTER TABLE test.t2 ADD COLUMN b2 CHAR(4) FIRST;
+ ALTER TABLE test.t2 ADD COLUMN to_drop BIT(8) AFTER b2;
+ INSERT INTO test.t2 VALUES ('new',1,NULL,'STM',RAND());
+ CALL test.p7();
+END|
+CREATE PROCEDURE test.p7()
+BEGIN
+ ALTER TABLE test.t2 DROP COLUMN to_drop;
+ INSERT INTO test.t2 VALUES ('gone',NULL,'STM',RAND());
+END|
+delimiter ;|
+CALL test.p1();
+
+#SELECT * FROM test.t2;
+sync_slave_with_master;
+#SELECT * FROM test.t2;
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp011_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp011_slave.sql
+
+# Cleanup
+connection master;
+#show binlog events;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p4;
+DROP PROCEDURE IF EXISTS test.p5;
+DROP PROCEDURE IF EXISTS test.p6;
+DROP PROCEDURE IF EXISTS test.p7;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+sync_slave_with_master;
+
+# Lets compare. Note: If they match test will pass, if they do not match
+# the test will show that the diff statement failed and not reject file
+# will be created. You will need to go to the mysql-test dir and diff
+# the files your self to see what is not matching :-) Failed test
+# Will leave dump files in $MYSQLTEST_VARDIR/tmp
+
+exec diff $MYSQLTEST_VARDIR/tmp/sp011_master.sql $MYSQLTEST_VARDIR/tmp/sp011_slave.sql;
+
+# If all is good, when can cleanup our dump files.
+system rm $MYSQLTEST_VARDIR/tmp/sp011_master.sql;
+system rm $MYSQLTEST_VARDIR/tmp/sp011_slave.sql;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_sp012.test b/mysql-test/t/rpl_row_sp012.test
new file mode 100644
index 00000000000..5b6fc139577
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp012.test
@@ -0,0 +1,74 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/22/2005 #
+# Update: 08/29/2005 Added save pos and sync #
+#############################################################################
+#TEST: SP to test security and current_user and user #
+#############################################################################
+
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/not_embedded.inc
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+
+
+# Begin test section 1
+# Create user user1 with no particular access rights
+grant usage on *.* to user1@localhost;
+flush privileges;
+
+SELECT CURRENT_USER();
+SELECT USER();
+CREATE PROCEDURE test.p1 () SQL SECURITY INVOKER SELECT CURRENT_USER(), USER();
+CREATE PROCEDURE test.p2 () SQL SECURITY DEFINER CALL test.p1();
+CREATE PROCEDURE test.p3 () SQL SECURITY INVOKER CALL test.p1();
+GRANT EXECUTE ON PROCEDURE p1 TO user1@localhost;
+GRANT EXECUTE ON PROCEDURE p2 TO user1@localhost;
+GRANT EXECUTE ON PROCEDURE p3 TO user1@localhost;
+
+# Need to wait for the rights to be applied at the slave
+sync_slave_with_master;
+
+let $message=<******** Master user1 p3 & p2 calls *******>;
+--source include/show_msg.inc
+connect (muser1,localhost,user1,,);
+connection muser1;
+SELECT CURRENT_USER();
+SELECT USER();
+CALL test.p3();
+CALL test.p2();
+
+let $message=<******** Slave user1 p3 & p2 calls *******>;
+--source include/show_msg.inc
+connect (suser1,127.0.0.1,user1,,test,$SLAVE_MYPORT,);
+
+connection master;
+save_master_pos;
+connection suser1;
+sync_with_master;
+
+SELECT CURRENT_USER();
+SELECT USER();
+CALL test.p3();
+CALL test.p2();
+
+# Cleanup
+connection master;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+sync_slave_with_master;
+
+# End of 5.0 test case
+
diff --git a/mysql-test/t/rpl_row_stop_middle.test b/mysql-test/t/rpl_row_stop_middle.test
new file mode 100644
index 00000000000..da363736100
--- /dev/null
+++ b/mysql-test/t/rpl_row_stop_middle.test
@@ -0,0 +1,44 @@
+# Test for BUG#11729: see if, when STOP SLAVE occurs while the slave
+# SQL thread has processed a Table_map_log_event but has not processed
+# the last Rows_log_event associated to it, the slave thread does not
+# forget to close its tables.
+
+# Can be run with statement-based but no interest (and long test)
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+connection master;
+create table t1 (a int not null auto_increment primary key, b int, key(b));
+sync_slave_with_master;
+stop slave;
+connection master;
+INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+
+connection slave;
+start slave;
+
+# hope one second is not enough for slave to reach the last
+# Rows_log_event, so that test actually tests something.
+
+real_sleep 1;
+stop slave;
+
+# see if slave hangs on DROP TABLE
+
+drop table t1;
+
+connection master; # cleanup
+drop table t1;
diff --git a/mysql-test/t/rpl_row_stop_middle_update-master.opt b/mysql-test/t/rpl_row_stop_middle_update-master.opt
new file mode 100644
index 00000000000..b7db8f97bdd
--- /dev/null
+++ b/mysql-test/t/rpl_row_stop_middle_update-master.opt
@@ -0,0 +1 @@
+--loose-binlog-row-event-max-size=256
diff --git a/mysql-test/t/rpl_row_stop_middle_update-slave.opt b/mysql-test/t/rpl_row_stop_middle_update-slave.opt
new file mode 100644
index 00000000000..ea49a27adf4
--- /dev/null
+++ b/mysql-test/t/rpl_row_stop_middle_update-slave.opt
@@ -0,0 +1 @@
+--loose-debug=d,STOP_SLAVE_after_first_Rows_event
diff --git a/mysql-test/t/rpl_row_stop_middle_update.test b/mysql-test/t/rpl_row_stop_middle_update.test
new file mode 100644
index 00000000000..29b3008e822
--- /dev/null
+++ b/mysql-test/t/rpl_row_stop_middle_update.test
@@ -0,0 +1,31 @@
+-- source include/have_binlog_format_row.inc
+-- source include/have_debug.inc
+-- source include/master-slave.inc
+
+# master is asked to create small Rows events: if only one event is
+# created, stopping slave at the end of that one will show no bug, we
+# need at least two (and stop after first); in this test we use three.
+
+connection master;
+create table t1 (words varchar(20)) engine=myisam;
+
+load data infile '../std_data_ln/words.dat' into table t1 (words);
+select count(*) from t1;
+save_master_pos;
+
+connection slave;
+
+# slave will automatically tell itself to stop thanks to the .opt
+# file; it will initiate the stop request after the first
+# Rows_log_event (out of 3) but should wait until the last one is
+# executed before stopping.
+
+wait_for_slave_to_stop;
+
+# check that we inserted all rows (waited until the last Rows event)
+select count(*) from t1;
+
+connection master;
+drop table t1;
+connection slave; # slave SQL thread is stopped
+drop table t1;
diff --git a/mysql-test/t/rpl_row_tabledefs_2myisam.test b/mysql-test/t/rpl_row_tabledefs_2myisam.test
new file mode 100644
index 00000000000..ab4914e15fa
--- /dev/null
+++ b/mysql-test/t/rpl_row_tabledefs_2myisam.test
@@ -0,0 +1,8 @@
+
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+let $engine_type = 'MyISAM';
+-- source extra/rpl_tests/rpl_row_tabledefs.test
+
+
diff --git a/mysql-test/t/rpl_row_tabledefs_3innodb.test b/mysql-test/t/rpl_row_tabledefs_3innodb.test
new file mode 100644
index 00000000000..7824fbfb663
--- /dev/null
+++ b/mysql-test/t/rpl_row_tabledefs_3innodb.test
@@ -0,0 +1,9 @@
+
+-- 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_row_tabledefs.test
+
+
diff --git a/mysql-test/t/rpl_row_trig001.test b/mysql-test/t/rpl_row_trig001.test
new file mode 100644
index 00000000000..931cab95948
--- /dev/null
+++ b/mysql-test/t/rpl_row_trig001.test
@@ -0,0 +1,100 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/09/2005 #
+#############################################################################
+# TEST: Use after insert and before inset triggers and stored procdures to #
+# Update and insert data #
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+-- disable_query_log
+-- disable_result_log
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+--error 0,1360
+DROP TRIGGER test.t2_ai;
+--error 0,1360
+DROP TRIGGER test.t3_bi_t2;
+--error 0,1360
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+
+
+# test section 1, lets add a trigger to the mix. Taken from bug #12280
+let $message=<Begin test section 1 (Tiggers & SP)>;
+--source include/show_msg.inc
+
+CREATE TABLE test.t1 (n MEDIUMINT NOT NULL, d DATETIME, PRIMARY KEY(n));
+CREATE TABLE test.t2 (n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
+CREATE TABLE test.t3 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d DATETIME, PRIMARY KEY(n));
+
+INSERT INTO test.t1 VALUES (1,NOW());
+
+delimiter //;
+CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t1 SET d=NOW() where n = 1;//
+CREATE PROCEDURE test.p3()
+BEGIN
+ INSERT INTO test.t3 (d) VALUES (NOW());
+END//
+CREATE TRIGGER test.t3_bi_t2 BEFORE INSERT ON test.t2 FOR EACH ROW CALL test.p3()//
+CREATE PROCEDURE test.p2()
+BEGIN
+ INSERT INTO test.t2 (f,d) VALUES (RAND(),NOW());
+END//
+delimiter ;//
+
+-- disable_query_log
+-- disable_result_log
+let $1=10;
+while ($1)
+{
+ CALL test.p2();
+ sleep 1;
+ dec $1;
+}
+-- enable_result_log
+-- enable_query_log
+
+#show binlog events;
+#select * from test.t2;
+#select * from test.t3;
+#connection slave;
+#select * from test.t2;
+#select * from test.t3;
+
+let $message=<End test section 2 (Tiggers & SP)>;
+--source include/show_msg.inc
+
+# time to dump the databases and so we can see if they match
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trig001_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trig001_slave.sql
+
+# Cleanup
+connection master;
+DROP PROCEDURE test.p2;
+DROP PROCEDURE test.p3;
+DROP TRIGGER test.t2_ai;
+DROP TRIGGER test.t3_bi_t2;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
+sync_slave_with_master;
+
+# Lets compare. Note: If they match test will pass, if they do not match
+# the test will show that the diff statement failed and not reject file
+# will be created. You will need to go to the mysql-test dir and diff
+# the files your self to see what is not matching :-) Failed tests
+# will leave dump files in $MYSQLTEST_VARDIR/tmp
+
+exec diff $MYSQLTEST_VARDIR/tmp/trig001_master.sql $MYSQLTEST_VARDIR/tmp/trig001_slave.sql;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_trig002.test b/mysql-test/t/rpl_row_trig002.test
new file mode 100644
index 00000000000..7ca8a68f060
--- /dev/null
+++ b/mysql-test/t/rpl_row_trig002.test
@@ -0,0 +1,80 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/14/2005 #
+# Updated: 08/29/2005 added save master pos and sync with master #
+#############################################################################
+# TEST: Taken and modified from BUG#12048 After Insert updates replication #
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+#-- disable_query_log
+#-- disable_result_log
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+--error 0,1360
+DROP TRIGGER test.t2_ai;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+--enable_warnings
+
+# test section 1, Taken from bug #12408
+
+CREATE TABLE test.t2 (value CHAR(30),domain_id INT, mailaccount_id INT, program CHAR(30),keey CHAR(30),PRIMARY KEY(domain_id));
+
+CREATE TABLE test.t3 (value CHAR(30),domain_id INT, mailaccount_id INT, program CHAR(30),keey CHAR(30),PRIMARY KEY(domain_id));
+
+CREATE TABLE test.t1 (id INT,domain CHAR(30),PRIMARY KEY(id));
+
+delimiter |;
+CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t3 ms, test.t1 d SET ms.value='No' WHERE ms.domain_id = (SELECT max(id) FROM test.t1 WHERE domain='example.com') AND ms.mailaccount_id IS NULL AND ms.program='spamfilter' AND ms.keey='scan_incoming'|
+delimiter ;|
+
+INSERT INTO test.t1 VALUES (1, 'example.com'),(2, 'mysql.com'),(3, 'earthmotherwear.com'), (4, 'yahoo.com'),(5, 'example.com');
+
+SELECT * FROM test.t1 ORDER BY id;
+#show binlog events;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t1 ORDER BY id;
+connection master;
+
+INSERT INTO test.t3 VALUES ('Yes', 5, NULL, 'spamfilter','scan_incoming');
+INSERT INTO test.t3 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
+INSERT INTO test.t2 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
+
+select * from test.t2;
+select * from test.t3;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from test.t2;
+select * from test.t3;
+connection master;
+
+DELETE FROM test.t1 WHERE id = 1;
+
+SELECT * FROM test.t1 ORDER BY id;
+connection master;
+SELECT * FROM test.t1 ORDER BY id;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t1 ORDER BY id;
+
+# Cleanup
+connection master;
+#show binlog events;
+DROP TRIGGER test.t2_ai;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_trig003.test b/mysql-test/t/rpl_row_trig003.test
new file mode 100644
index 00000000000..d4570afd094
--- /dev/null
+++ b/mysql-test/t/rpl_row_trig003.test
@@ -0,0 +1,152 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/16/2005 #
+# Updated: 8/29/2005 Remove sleep calls add dump and diff #
+#############################################################################
+# TEST: This test includes all trigger types. BEFORE/AFTER INSERT, UPDATE & #
+# DELETE. In addition, includes cursor, bit, varchar, flow control, #
+# looping, ROUND(), NOW(), YEAR(), TIMESTAMP #
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+#-- disable_query_log
+#-- disable_result_log
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+--error 0,1360
+DROP TRIGGER test.t1_bi;
+--error 0,1360
+DROP TRIGGER test.t2_ai;
+--error 0,1360
+DROP TRIGGER test.t1_bu;
+--error 0,1360
+DROP TRIGGER test.t2_au;
+--error 0,1360
+DROP TRIGGER test.t1_bd;
+--error 0,1360
+DROP TRIGGER test.t2_ad;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+--enable_warnings
+
+# test section 1
+
+CREATE TABLE test.t1 (id MEDIUMINT NOT NULL AUTO_INCREMENT, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
+CREATE TABLE test.t2 (id MEDIUMINT NOT NULL AUTO_INCREMENT, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
+CREATE TABLE test.t3 (id MEDIUMINT NOT NULL AUTO_INCREMENT, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
+
+# Note Most of these cause the slave to core or do not produce desired results. Currently commenting out the ones not working until they are fixed.
+
+delimiter |;
+CREATE TRIGGER test.t1_bi BEFORE INSERT ON test.t1 FOR EACH ROW UPDATE test.t3 SET b1=1 and y=YEAR(NOW())|
+CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW BEGIN
+ INSERT INTO test.t3 VALUES(NULL,0,'MySQL Replication team rocks!', 'Dark beer in prague is #1',12345.34,12.51,0,1965,NOW());
+ UPDATE test.t3 SET f = ROUND(f);
+END|
+CREATE TRIGGER test.t1_bu BEFORE UPDATE on test.t1 FOR EACH ROW BEGIN
+ UPDATE test.t3 SET y = '2000';
+ INSERT INTO test.t3 VALUES(NULL,1,'Testing MySQL databases before update ', 'Insert should work',621.43, 0105.21,0,1974,NOW());
+END|
+CREATE TRIGGER test.t2_au AFTER UPDATE on test.t2 FOR EACH ROW BEGIN
+ DECLARE done INT DEFAULT 0;
+ DECLARE a DECIMAL(10,4);
+ DECLARE b FLOAT;
+ DECLARE num MEDIUMINT;
+ DECLARE cur1 CURSOR FOR SELECT t2.id, t2.d, t2.f FROM test.t2;
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
+
+ OPEN cur1;
+
+ REPEAT
+ FETCH cur1 INTO num, a, b;
+ IF NOT done THEN
+ UPDATE test.t3 SET total =(a*b) WHERE ID = num;
+ END IF;
+ UNTIL done END REPEAT;
+ CLOSE cur1;
+END|
+CREATE TRIGGER test.t1_bd BEFORE DELETE on test.t1 FOR EACH ROW BEGIN
+ DECLARE done INT DEFAULT 0;
+ DECLARE a BIT(8);
+ DECLARE b VARCHAR(255);
+ DECLARE c CHAR(255);
+ DECLARE d DECIMAL(10,4);
+ DECLARE e FLOAT;
+ DECLARE f BIGINT UNSIGNED;
+ DECLARE g YEAR;
+ DECLARE h TIMESTAMP;
+ DECLARE cur1 CURSOR FOR SELECT t1.b1, t1.vc, t1.bc, t1.d, t1.f, t1.total, t1.y, t1.t FROM test.t1;
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
+
+ OPEN cur1;
+
+ REPEAT
+ FETCH cur1 INTO a, b, c, d, e, f, g, h;
+ IF NOT done THEN
+ INSERT INTO test.t3 VALUES(NULL, a, b, c, d, e, f, g, h);
+ END IF;
+ UNTIL done END REPEAT;
+ CLOSE cur1;
+END|
+CREATE TRIGGER test.t2_ad AFTER DELETE ON test.t2 FOR EACH ROW
+ DELETE FROM test.t1|
+delimiter ;|
+
+INSERT INTO test.t1 VALUES(NULL,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,NOW());
+INSERT INTO test.t2 VALUES(NULL,0,'Testing MySQL databases is a cool ', 'MySQL Customers ROCK!',654321.4321,1.24521,0,YEAR(NOW()),NOW());
+
+UPDATE test.t1 SET b1 = 0 WHERE b1 = 1;
+
+INSERT INTO test.t2 VALUES(NULL,1,'This is an after update test.', 'If this works, total will not be zero on the master or slave',1.4321,5.221,0,YEAR(NOW()),NOW());
+UPDATE test.t2 SET b1 = 0 WHERE b1 = 1;
+
+INSERT INTO test.t1 VALUES(NULL,1,'add some more test data test.', 'and hope for the best', 3.321,5.221,0,YEAR(NOW()),NOW());
+
+# To make sure BUG#14698 is gone, we sleep 2 seconds before calling trigger
+# (with the bug in, that caused differences in TIMESTAMP columns).
+# We just need to let the machine's clock advance, it's not
+# to do synchronization, so real_sleep is good.
+real_sleep 2;
+
+DELETE FROM test.t1 WHERE id = 1;
+
+DELETE FROM test.t2 WHERE id = 1;
+
+save_master_pos;
+connection slave;
+sync_with_master;
+connection master;
+
+# time to dump the databases and so we can see if they match
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trg003_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trg003_slave.sql
+
+# cleanup
+--disable_warnings
+--error 0,1360
+DROP TRIGGER test.t1_bi;
+--error 0,1360
+DROP TRIGGER test.t2_ai;
+--error 0,1360
+DROP TRIGGER test.t1_bu;
+--error 0,1360
+DROP TRIGGER test.t2_au;
+--error 0,1360
+DROP TRIGGER test.t1_bd;
+--error 0,1360
+DROP TRIGGER test.t2_ad;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+--enable_warnings
+
+exec diff $MYSQLTEST_VARDIR/tmp/trg003_master.sql $MYSQLTEST_VARDIR/tmp/trg003_slave.sql;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_trig004.test b/mysql-test/t/rpl_row_trig004.test
new file mode 100644
index 00000000000..a918c602d56
--- /dev/null
+++ b/mysql-test/t/rpl_row_trig004.test
@@ -0,0 +1,18 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Oct/18/2005 #
+#############################################################################
+# TEST: Use before insert triggers and has the second insert fail #
+#############################################################################
+# Change by JBM 2006-02-14 added to skip when NDB default engine #
+# This test has been wrapped to allow multipal engines to use same code #
+#############################################################################
+
+# Includes
+-- 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_trig004.test
+
diff --git a/mysql-test/t/rpl_row_until.test b/mysql-test/t/rpl_row_until.test
new file mode 100644
index 00000000000..f2a4229cdc4
--- /dev/null
+++ b/mysql-test/t/rpl_row_until.test
@@ -0,0 +1,87 @@
+-- source include/not_ndb_default.inc
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+# Test is dependent on binlog positions
+
+# prepare version for substitutions
+let $VERSION=`select version()`;
+
+# stop slave before he will start replication also sync with master
+# for avoiding undetermenistic behaviour
+save_master_pos;
+connection slave;
+sync_with_master;
+stop slave;
+
+connection master;
+# create some events on master
+create table t1(n int not null auto_increment primary key);
+insert into t1 values (1),(2),(3),(4);
+drop table t1;
+create table t2(n int not null auto_increment primary key);
+insert into t2 values (1),(2);
+insert into t2 values (3),(4);
+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;
+# here table should be still not deleted
+select * from t1;
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 9 # 11 # 23 # 33 #
+show slave status;
+
+# this should fail right after start
+start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
+# 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 #
+show slave status;
+
+# 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;
+select * from t2;
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 9 # 11 # 23 # 33 #
+show slave status;
+
+# clean up
+start slave;
+connection master;
+save_master_pos;
+connection slave;
+sync_with_master;
+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;
+# 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 #
+show slave status;
+
+#testing various error conditions
+--error 1277
+start slave until master_log_file='master-bin', master_log_pos=561;
+--error 1277
+start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
+--error 1277
+start slave until master_log_file='master-bin.000001';
+--error 1277
+start slave until relay_log_file='slave-relay-bin.000002';
+--error 1277
+start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
+# Warning should be given for second command
+start slave sql_thread;
+start slave until master_log_file='master-bin.000001', master_log_pos=740;
diff --git a/mysql-test/t/rpl_row_view01.test b/mysql-test/t/rpl_row_view01.test
new file mode 100644
index 00000000000..895a922fef8
--- /dev/null
+++ b/mysql-test/t/rpl_row_view01.test
@@ -0,0 +1,88 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/19/2005 #
+# Updated: 08/29/2005 Remove sleeps #
+#############################################################################
+#TEST: row based replication of views #
+#############################################################################
+# 2006-02-08 By JBM added order by and sleep for use with ndb engine
+#############################################################################
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+create database if not exists mysqltest1;
+DROP VIEW IF EXISTS mysqltest1.v1;
+DROP VIEW IF EXISTS mysqltest1.v2;
+DROP VIEW IF EXISTS mysqltest1.v3;
+DROP VIEW IF EXISTS mysqltest1.v4;
+DROP TABLE IF EXISTS mysqltest1.t3;
+DROP TABLE IF EXISTS mysqltest1.t1;
+DROP TABLE IF EXISTS mysqltest1.t2;
+DROP TABLE IF EXISTS mysqltest1.t4;
+
+# Begin test section 1
+CREATE TABLE mysqltest1.t1 (a INT, c CHAR(6),PRIMARY KEY(a));
+CREATE TABLE mysqltest1.t2 (a INT, c CHAR(6),PRIMARY KEY(a));
+CREATE TABLE mysqltest1.t3 (a INT, c CHAR(6), c2 CHAR(6), PRIMARY KEY(a));
+CREATE TABLE mysqltest1.t4 (a INT, qty INT, price INT,PRIMARY KEY(a));
+CREATE TABLE mysqltest1.t5 (qty INT, price INT, total INT, PRIMARY KEY(qty));
+INSERT INTO mysqltest1.t1 VALUES (1,'Thank'),(2,'it'),(3,'Friday');
+INSERT INTO mysqltest1.t2 VALUES (1,'GOD'),(2,'is'),(3,'TGIF');
+INSERT INTO mysqltest1.t4 VALUES(1, 3, 50),(2, 18, 3),(4, 4, 4);
+
+
+CREATE VIEW mysqltest1.v2 AS SELECT qty, price, qty*price AS value FROM mysqltest1.t4 ORDER BY qty;
+CREATE VIEW mysqltest1.v1 AS SELECT t1.a, t1.c, t2.c as c2 FROM mysqltest1.t1 as t1, mysqltest1.t2 AS t2 WHERE mysqltest1.t1.a = mysqltest1.t2.a ORDER BY a;
+CREATE VIEW mysqltest1.v3 AS SELECT * FROM mysqltest1.t1;
+CREATE VIEW mysqltest1.v4 AS SELECT * FROM mysqltest1.v3 WHERE a > 1 WITH LOCAL CHECK OPTION;
+
+
+SELECT * FROM mysqltest1.v2;
+SELECT * FROM mysqltest1.v1;
+# Had to add a sleep for use with NDB
+# engine. Injector thread would have not
+# populated biblog and data would not be on
+# the slave.
+sleep 10;
+sync_slave_with_master;
+SELECT * FROM mysqltest1.v2;
+SELECT * FROM mysqltest1.v1;
+connection master;
+
+INSERT INTO mysqltest1.t5 SELECT * FROM mysqltest1.v2;
+INSERT INTO mysqltest1.t3 SELECT * FROM mysqltest1.v1;
+
+SELECT * FROM mysqltest1.t5 ORDER BY qty;
+SELECT * FROM mysqltest1.t3 ORDER BY a;
+sync_slave_with_master;
+SELECT * FROM mysqltest1.t5 ORDER BY qty;
+SELECT * FROM mysqltest1.t3 ORDER BY a;
+connection master;
+
+INSERT INTO mysqltest1.v4 VALUES (4,'TEST');
+
+SELECT * FROM mysqltest1.t1 ORDER BY a;
+SELECT * FROM mysqltest1.v4 ORDER BY a;
+sync_slave_with_master;
+SELECT * FROM mysqltest1.t1 ORDER BY a;
+SELECT * FROM mysqltest1.v4 ORDER BY a;
+
+connection master;
+
+# lets cleanup
+DROP VIEW IF EXISTS mysqltest1.v1;
+DROP VIEW IF EXISTS mysqltest1.v2;
+DROP VIEW IF EXISTS mysqltest1.v3;
+DROP VIEW IF EXISTS mysqltest1.v4;
+DROP TABLE IF EXISTS mysqltest1.t3;
+DROP TABLE IF EXISTS mysqltest1.t1;
+DROP TABLE IF EXISTS mysqltest1.t2;
+DROP TABLE IF EXISTS mysqltest1.t4;
+sync_slave_with_master;
+
+# End of 5.1 test case
+
diff --git a/mysql-test/t/rpl_server_id1.test b/mysql-test/t/rpl_server_id1.test
index 3583f05284c..71310750b60 100644
--- a/mysql-test/t/rpl_server_id1.test
+++ b/mysql-test/t/rpl_server_id1.test
@@ -13,7 +13,7 @@ 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 #
+--replace_column 16 # 18 #
show slave status;
start slave;
insert into t1 values (1);
diff --git a/mysql-test/t/rpl_skip_error.test b/mysql-test/t/rpl_skip_error.test
index f6fc73f58f2..ff81e2f010e 100644
--- a/mysql-test/t/rpl_skip_error.test
+++ b/mysql-test/t/rpl_skip_error.test
@@ -1,3 +1,7 @@
+##########################################
+# 2006-02-07 By JBM: Added order by
+#########################################
+# Note that errors are ignored by opt file.
source include/master-slave.inc;
create table t1 (n int not null primary key);
@@ -6,14 +10,20 @@ connection slave;
sync_with_master;
insert into t1 values (1);
connection master;
+# Here we expect (ignored) error, since 1 is already in slave table
insert into t1 values (1);
+
+# These should work fine
insert into t1 values (2),(3);
+
save_master_pos;
connection slave;
sync_with_master;
-select * from t1;
+select * from t1 ORDER BY n;
+# Cleanup
connection master;
drop table t1;
-sync_with_master;
+sync_slave_with_master;
+
# End of 4.1 tests
diff --git a/mysql-test/t/rpl_slave_status.test b/mysql-test/t/rpl_slave_status.test
index b97b769d181..f98cc7a7d14 100644
--- a/mysql-test/t/rpl_slave_status.test
+++ b/mysql-test/t/rpl_slave_status.test
@@ -1,11 +1,21 @@
-# Test case for BUG #10780
--source include/master-slave.inc
+
+############################################################################
+# Test case for BUG#10780
+#
+# REQUIREMENT
+# A slave without replication privileges should have Slave_IO_Running = No
+
+# 1. Create new replication user
connection master;
grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
+
connection slave;
stop slave;
change master to master_user='rpl',master_password='rpl';
start slave;
+
+# 2. Do replication as new user
connection master;
--disable_warnings
drop table if exists t1;
@@ -16,12 +26,19 @@ save_master_pos;
connection slave;
sync_with_master;
select * from t1;
+
+# 3. Delete new replication user
connection master;
delete from mysql.user where user='rpl';
flush privileges;
connection slave;
+
+# 4. Restart slave without privileges
+# (slave.err will contain access denied error for this START SLAVE command)
stop slave;
start slave;
+
+# 5. Make sure Slave_IO_Running = No
--replace_result $MASTER_MYPORT MASTER_MYPORT
# Column 1 is replaced, since the output can be either
# "Connecting to master" or "Waiting for master update"
@@ -29,8 +46,12 @@ start slave;
--vertical_results
show slave status;
+# Cleanup (Note that slave IO thread is not running)
+connection slave;
+drop table t1;
connection master;
drop table t1;
-sync_with_master;
+
+# end of test case for BUG#10780
# end of 4.1 tests
diff --git a/mysql-test/t/rpl_sp.test b/mysql-test/t/rpl_sp.test
index b2a34a63735..f99b7178ece 100644
--- a/mysql-test/t/rpl_sp.test
+++ b/mysql-test/t/rpl_sp.test
@@ -1,3 +1,5 @@
+# row-based and statement have expected binlog difference in result files
+
# Test of replication of stored procedures (WL#2146 for MySQL 5.0)
# Modified by WL#2971.
@@ -339,7 +341,8 @@ drop trigger trg;
insert into t1 values (1);
select * from t1;
--replace_column 2 # 5 #
-show binlog events in 'master-bin.000001' from 98;
+--replace_regex /table_id: [0-9]+/table_id: #/
+show binlog events in 'master-bin.000001' from 102;
sync_slave_with_master;
select * from t1;
@@ -425,14 +428,10 @@ CALL p1('test');
SELECT * FROM t1;
sync_slave_with_master;
-connection slave;
-
SELECT * FROM t1;
-# Cleanup.
-
+# Cleanup
connection master;
-
DROP PROCEDURE p1;
@@ -524,4 +523,6 @@ sync_slave_with_master;
set global log_bin_trust_function_creators=0;
connection master;
set global log_bin_trust_function_creators=0;
+--echo End of 5.0 tests
+--echo End of 5.1 tests
diff --git a/mysql-test/t/rpl_sp004.test b/mysql-test/t/rpl_sp004.test
new file mode 100644
index 00000000000..055a13cc157
--- /dev/null
+++ b/mysql-test/t/rpl_sp004.test
@@ -0,0 +1,97 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/14/2005 #
+#############################################################################
+# Test: This test contains two sp that create and drop tables, insert and #
+# updated data and uses the NOW() function. #
+#############################################################################
+
+
+# Includes
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t3;
+--enable_warnings
+# End of cleanup
+
+# Begin test section 1
+
+delimiter |;
+CREATE PROCEDURE test.p1()
+BEGIN
+ CREATE TABLE IF NOT EXISTS test.t1(a INT,PRIMARY KEY(a));
+ CREATE TABLE IF NOT EXISTS test.t2(a INT,PRIMARY KEY(a));
+ INSERT INTO test.t1 VALUES (4),(2),(1),(3);
+ UPDATE test.t1 SET a=a+4 WHERE a=4;
+ INSERT INTO test.t2 (a) SELECT t1.a FROM test.t1;
+ UPDATE test.t1 SET a=a+4 WHERE a=8;
+ CREATE TABLE IF NOT EXISTS test.t3(n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
+END|
+CREATE PROCEDURE test.p2()
+BEGIN
+ DROP TABLE IF EXISTS test.t1;
+ DROP TABLE IF EXISTS test.t2;
+ INSERT INTO test.t3 VALUES(NULL,11111111.233333,NOW());
+END|
+delimiter ;|
+
+CALL test.p1();
+SELECT * FROM test.t1 ORDER BY a;
+SELECT * FROM test.t2 ORDER BY a;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t1 ORDER BY a;
+SELECT * FROM test.t2 ORDER BY a;
+
+connection master;
+CALL test.p2();
+USE test;
+SHOW TABLES;
+#SELECT * FROM test.t3;
+save_master_pos;
+connection slave;
+sync_with_master;
+USE test;
+SHOW TABLES;
+#SELECT * FROM test.t3;
+
+connection master;
+CALL test.p1();
+SELECT * FROM test.t1 ORDER BY a;
+SELECT * FROM test.t2 ORDER BY a;
+#SELECT * FROM test.t3;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t1 ORDER BY a;
+SELECT * FROM test.t2 ORDER BY a;
+#SELECT * FROM test.t3;
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp004_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp004_slave.sql
+
+# Cleanup
+connection master;
+#show binlog events;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+sync_slave_with_master;
+
+# If the test fails, you will need to diff the dumps to see why.
+
+-- exec diff $MYSQLTEST_VARDIR/tmp/sp004_master.sql $MYSQLTEST_VARDIR/tmp/sp004_slave.sql
+
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_sp_effects.test b/mysql-test/t/rpl_sp_effects.test
index 9da5723b993..e1746682b76 100644
--- a/mysql-test/t/rpl_sp_effects.test
+++ b/mysql-test/t/rpl_sp_effects.test
@@ -1,6 +1,11 @@
-# Test of replication of stored procedures (WL#2146 for MySQL 5.0)
+##########################################
+# Change Author: JBM
+# Change Date: 2006-05-02
+# Change: Added Order By for NDB testing
+##########################################
-source include/master-slave.inc;
+# Test of replication of stored procedures (WL#2146 for MySQL 5.0)
+-- source include/master-slave.inc
# ****************************************************************
connection master;
@@ -31,9 +36,9 @@ call p1();
sync_slave_with_master;
connection slave;
-select * from t1;
+SELECT * FROM t1 ORDER BY a;
connection master;
-delete from t1;
+SELECT * FROM t1 ORDER BY a;
# 2. Test SP variable name
delimiter //;
@@ -45,10 +50,10 @@ end//
delimiter ;//
call p2();
-select * from t2;
+SELECT * FROM t2 ORDER BY a;
sync_slave_with_master;
connection slave;
-select * from t2;
+SELECT * FROM t2 ORDER BY a;
connection master;
drop procedure p1;
@@ -79,19 +84,19 @@ end//
delimiter ;//
call p1(f1(1), f1(2));
-select * from t1;
+SELECT * FROM t1 ORDER BY a;
create table t2(a int);
insert into t2 values (10),(11);
-select a,f1(a) from t2;
+SELECT a,f1(a) FROM t2 ORDER BY a;
# This shouldn't put separate 'call f1(3)' into binlog:
insert into t2 select f1(3);
-select 'master:',a from t1;
+SELECT 'master:',a FROM t1 ORDER BY a;
sync_slave_with_master;
connection slave;
-select 'slave:',a from t1;
+SELECT 'slave:',a FROM t1 ORDER BY a;
connection master;
drop procedure p1;
@@ -101,13 +106,13 @@ delete from t2;
# 4. VIEWs
delete from t1;
insert into t2 values(1),(2);
-create view v1 as select f1(a) from t2;
-select * from v1;
-select 'master:',a from t1;
+create view v1 as select f1(a) as f from t2;
+select * from v1 order by f;
+SELECT 'master:',a FROM t1 ORDER BY a;
sync_slave_with_master;
connection slave;
-select 'slave:',a from t1;
+SELECT 'slave:',a FROM t1 ORDER BY a;
connection master;
drop view v1;
@@ -117,11 +122,11 @@ delete from t1;
prepare s1 from 'select f1(?)';
set @xx=123;
execute s1 using @xx;
-select 'master:',a from t1;
+SELECT 'master:',a FROM t1 ORDER BY a;
sync_slave_with_master;
connection slave;
-select 'slave:',a from t1;
+SELECT 'slave:',a FROM t1 ORDER BY a;
connection master;
delete from t1;
@@ -140,12 +145,11 @@ begin
end while;
end//
delimiter ;//
-
call p1(15);
-select 'master:',a from t1;
+SELECT 'master:',a FROM t1 ORDER BY a;
sync_slave_with_master;
connection slave;
-select 'slave:',a from t1;
+SELECT 'slave:',a FROM t1 ORDER BY a;
connection master;
drop procedure p1;
@@ -190,10 +194,10 @@ select f1();
set @x=30;
call p1();
-select 'master', a from t1;
+SELECT 'master', a FROM t1 ORDER BY a;
sync_slave_with_master;
connection slave;
-select 'slave', a from t1;
+SELECT 'slave', a FROM t1 ORDER BY a;
connection master;
drop table t1;
diff --git a/mysql-test/t/rpl_sporadic_master.test b/mysql-test/t/rpl_sporadic_master.test
index 26b633a1c4f..824f7abc9f5 100644
--- a/mysql-test/t/rpl_sporadic_master.test
+++ b/mysql-test/t/rpl_sporadic_master.test
@@ -1,3 +1,6 @@
+#############################################################
+# 2006-02-07 By JBM added order by
+#############################################################
# test to see if replication can continue when master sporadically fails on
# COM_BINLOG_DUMP and additionally limits the number of events per dump
@@ -18,7 +21,7 @@ flush logs;
truncate table t1;
insert into t1 values (10),(NULL),(NULL),(NULL),(NULL),(NULL);
sync_slave_with_master;
-select * from t1;
+select * from t1 ORDER BY n;
connection master;
drop table t1,t2;
sync_slave_with_master;
diff --git a/mysql-test/t/rpl_stm_000001-slave.opt b/mysql-test/t/rpl_stm_000001-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_stm_000001-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_stm_000001.test b/mysql-test/t/rpl_stm_000001.test
new file mode 100644
index 00000000000..aee067b2d4a
--- /dev/null
+++ b/mysql-test/t/rpl_stm_000001.test
@@ -0,0 +1,2 @@
+let $engine_type=myisam;
+-- source extra/rpl_tests/rpl_stm_000001.test
diff --git a/mysql-test/t/rpl_stm_EE_err2.test b/mysql-test/t/rpl_stm_EE_err2.test
new file mode 100644
index 00000000000..face651b9a1
--- /dev/null
+++ b/mysql-test/t/rpl_stm_EE_err2.test
@@ -0,0 +1,8 @@
+#############################
+# Author: JBM
+# Date: 2006-01-11
+# Purpose: Engine Wrapper for rpl_stm_EE_err2.test
+##############################
+-- source include/have_binlog_format_mixed_or_statement.inc
+let $engine_type=myisam;
+-- source extra/rpl_tests/rpl_stm_EE_err2.test
diff --git a/mysql-test/t/rpl_stm_charset.test b/mysql-test/t/rpl_stm_charset.test
new file mode 100644
index 00000000000..b103a47d78c
--- /dev/null
+++ b/mysql-test/t/rpl_stm_charset.test
@@ -0,0 +1,2 @@
+let $engine_type=myisam;
+-- source extra/rpl_tests/rpl_stm_charset.test
diff --git a/mysql-test/t/rpl_stm_flsh_tbls.test b/mysql-test/t/rpl_stm_flsh_tbls.test
new file mode 100644
index 00000000000..43a5234ccc7
--- /dev/null
+++ b/mysql-test/t/rpl_stm_flsh_tbls.test
@@ -0,0 +1,8 @@
+# depends on the binlog output
+--source include/have_binlog_format_mixed_or_statement.inc
+
+let $rename_event_pos= 652;
+-- source extra/rpl_tests/rpl_flsh_tbls.test
+
+# End of 4.1 tests
+# Adding comment for force manual merge 5.0 -> wl1012. Delete me if needed.
diff --git a/mysql-test/t/rpl_log-master.opt b/mysql-test/t/rpl_stm_log-master.opt
index cef79bc8585..cef79bc8585 100644
--- a/mysql-test/t/rpl_log-master.opt
+++ b/mysql-test/t/rpl_stm_log-master.opt
diff --git a/mysql-test/t/rpl_stm_log-slave.opt b/mysql-test/t/rpl_stm_log-slave.opt
new file mode 100644
index 00000000000..8b137891791
--- /dev/null
+++ b/mysql-test/t/rpl_stm_log-slave.opt
@@ -0,0 +1 @@
+
diff --git a/mysql-test/t/rpl_stm_log.test b/mysql-test/t/rpl_stm_log.test
new file mode 100644
index 00000000000..5a1e0facc83
--- /dev/null
+++ b/mysql-test/t/rpl_stm_log.test
@@ -0,0 +1,8 @@
+# Requires statement logging
+-- source include/have_binlog_format_mixed_or_statement.inc
+let $engine_type=MyISAM;
+-- source extra/rpl_tests/rpl_log.test
+
+
+# End of 4.1 tests
+# Adding comment for force manual merge 5.0 -> wl1012: Delete me
diff --git a/mysql-test/t/rpl_stm_max_relay_size.test b/mysql-test/t/rpl_stm_max_relay_size.test
new file mode 100644
index 00000000000..950aa8b322a
--- /dev/null
+++ b/mysql-test/t/rpl_stm_max_relay_size.test
@@ -0,0 +1,11 @@
+# Test of options max_binlog_size and max_relay_log_size and
+# how they act (if max_relay_log_size == 0, use max_binlog_size
+# for relay logs too).
+# Test of manual relay log rotation with FLUSH LOGS.
+
+# Requires statement logging
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source extra/rpl_tests/rpl_max_relay_size.test
+
+# End of 4.1 tests
+#
diff --git a/mysql-test/t/rpl_stm_multi_query.test b/mysql-test/t/rpl_stm_multi_query.test
new file mode 100644
index 00000000000..c39d1fad015
--- /dev/null
+++ b/mysql-test/t/rpl_stm_multi_query.test
@@ -0,0 +1,12 @@
+# Test for BUG#8436: verify that a multi-query (i.e. one query
+# containing several queries (assuming client has
+# CLIENT_MULTI_STATEMENTS) will be binlogged ONE-query-per-event (not
+# one binlog event containing all queries)
+
+# Requires statement logging
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source extra/rpl_tests/rpl_multi_query.test
+
+
+# End of 4.1 tests
+#
diff --git a/mysql-test/t/rpl_stm_mystery22.test b/mysql-test/t/rpl_stm_mystery22.test
new file mode 100644
index 00000000000..017593fdfba
--- /dev/null
+++ b/mysql-test/t/rpl_stm_mystery22.test
@@ -0,0 +1,66 @@
+################################
+# Change Author: JBM
+# Change Date: 2006-01-12
+# Change: Added back have stm binlog
+# and added requirments comments
+################################
+# test case to make slave thread get ahead by 22 bytes
+################################
+#REQUIREMENT: If there is a faked slave duplicate key insert
+#error and the slave is restarted, the replication should
+#proceed in a correct way.
+################################
+#REQUIREMENT: If there is a faked slave non-existing record
+#delete error and the slave is restarted, then the replication
+#should proceed in a correct way.
+#################################
+
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/master-slave.inc
+
+# first, cause a duplicate key problem on the slave
+create table t1(n int auto_increment primary key, s char(10));
+sync_slave_with_master;
+insert into t1 values (2,'old');
+connection master;
+insert into t1 values(NULL,'new');
+insert into t1 values(NULL,'new');
+save_master_pos;
+connection slave;
+# wait until the slave tries to run the query, fails and aborts slave thread
+wait_for_slave_to_stop;
+select * from t1 order by n;
+delete from t1 where n = 2;
+--disable_warnings
+start slave;
+--enable_warnings
+sync_with_master;
+#now the buggy slave would be confused on the offset but it can replicate
+#in order to make it break, we need to stop/start the slave one more time
+stop slave;
+connection master;
+# to be able to really confuse the slave, we need some non-auto-increment
+# events in the log
+create table t2(n int);
+drop table t2;
+insert into t1 values(NULL,'new');
+# what happens when we delete a row which does not exist on slave?
+set sql_log_bin=0;
+insert into t1 values(NULL,'new');
+set sql_log_bin=1;
+delete from t1 where n=4;
+save_master_pos;
+connection slave;
+--disable_warnings
+start slave;
+--enable_warnings
+#now the truth comes out - if the slave is buggy, it will never sync because
+#the slave thread is not able to read events
+sync_with_master;
+select * from t1 order by n;
+#clean up
+connection master;
+drop table t1;
+sync_slave_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/t/rpl_stm_no_op.test b/mysql-test/t/rpl_stm_no_op.test
new file mode 100644
index 00000000000..66dc89bd712
--- /dev/null
+++ b/mysql-test/t/rpl_stm_no_op.test
@@ -0,0 +1,93 @@
+# It's true only in statement-based replication that a statement which
+# updates no rows (UPDATE/DELETE) is binlogged; in row-based
+# replication, as we log modified rows, nothing is binlogged in this
+# case. So this test is meaningul only in statement-based (and if it was
+# enabled in row-based, it would fail as expected).
+
+-- source include/have_binlog_format_mixed_or_statement.inc
+
+source include/master-slave.inc;
+
+# see if DROP DATABASE is binlogged even if no effect
+connection slave;
+create database mysqltest;
+connection master;
+drop database if exists mysqltest;
+sync_slave_with_master;
+# can't read dir
+--replace_result "Errcode: 1" "Errcode: X" "Errcode: 2" "Errcode: X" \\ /
+--error 1049
+show tables from mysqltest;
+
+# see if DROP TABLE is binlogged even if no effect
+connection slave;
+create table t1 (a int);
+connection master;
+drop table if exists t1;
+sync_slave_with_master;
+# table does not exist
+--error 1146
+select * from t1;
+
+# see if single-table DELETE is binlogged even if no effect
+connection master;
+create table t1 (a int, b int);
+sync_slave_with_master;
+insert into t1 values(1,1);
+connection master;
+delete from t1;
+sync_slave_with_master;
+select * from t1;
+
+# see if single-table UPDATE is binlogged even if no effect
+insert into t1 values(1,1);
+connection master;
+insert into t1 values(2,1);
+update t1 set a=2;
+sync_slave_with_master;
+select * from t1;
+
+# End of 4.1 tests
+
+# see if multi-table UPDATE is binlogged even if no effect (BUG#13348)
+
+connection master;
+create table t2 (a int, b int);
+delete from t1;
+insert into t1 values(1,1);
+insert into t2 values(1,1);
+
+sync_slave_with_master;
+# force a difference to see if master's multi-UPDATE will correct it
+update t1 set a=2;
+
+connection master;
+UPDATE t1, t2 SET t1.a = t2.a;
+
+sync_slave_with_master;
+select * from t1;
+select * from t2;
+
+# See if multi-table DELETE is binlogged even if no effect
+
+connection master;
+delete from t1;
+delete from t2;
+
+sync_slave_with_master;
+# force a difference to see if master's multi-DELETE will correct it
+insert into t1 values(1,1);
+insert into t2 values(1,1);
+
+connection master;
+DELETE t1.*, t2.* from t1, t2;
+
+sync_slave_with_master;
+select * from t1;
+select * from t2;
+
+
+# cleanup
+connection master;
+drop table t1, t2;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_stm_reset_slave.test b/mysql-test/t/rpl_stm_reset_slave.test
new file mode 100644
index 00000000000..6a99d4e1613
--- /dev/null
+++ b/mysql-test/t/rpl_stm_reset_slave.test
@@ -0,0 +1,6 @@
+# TBF - difference in row level logging
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source extra/rpl_tests/rpl_reset_slave.test
+
+# End of 4.1 tests
+#
diff --git a/mysql-test/t/rpl_until.test b/mysql-test/t/rpl_stm_until.test
index c404ea7e58b..f42965c0eb0 100644
--- a/mysql-test/t/rpl_until.test
+++ b/mysql-test/t/rpl_stm_until.test
@@ -1,4 +1,7 @@
-source include/master-slave.inc;
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/master-slave.inc
+
+# Test is dependent on binlog positions
# prepare version for substitutions
let $VERSION=`select version()`;
@@ -19,12 +22,10 @@ create table t2(n int not null auto_increment primary key);
insert into t2 values (1),(2);
insert into t2 values (3),(4);
drop table t2;
---replace_result $VERSION VERSION
-show binlog events;
# try to replicate all queries until drop of t1
connection slave;
-start slave until master_log_file='master-bin.000001', master_log_pos=319;
+start slave until master_log_file='master-bin.000001', master_log_pos=323;
sleep 2;
wait_for_slave_to_stop;
# here table should be still not deleted
@@ -43,7 +44,7 @@ wait_for_slave_to_stop;
--replace_column 1 # 9 # 11 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
-# try replicate all until second insert to t2;
+# 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;
diff --git a/mysql-test/t/rpl_switch_stm_row_mixed.test b/mysql-test/t/rpl_switch_stm_row_mixed.test
new file mode 100644
index 00000000000..d345b62b8eb
--- /dev/null
+++ b/mysql-test/t/rpl_switch_stm_row_mixed.test
@@ -0,0 +1,545 @@
+-- source include/have_row_based.inc
+-- source include/not_ndb_default.inc
+-- source include/master-slave.inc
+
+connection master;
+--disable_warnings
+drop database if exists mysqltest1;
+create database mysqltest1;
+--enable_warnings
+use mysqltest1;
+
+set session binlog_format=row;
+set global binlog_format=row;
+
+show global variables like "binlog_format%";
+show session variables like "binlog_format%";
+select @@global.binlog_format, @@session.binlog_format;
+
+CREATE TABLE t1 (a varchar(100));
+
+prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
+set @string="emergency_1_";
+insert into t1 values("work_2_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values(concat(UUID(),"work_3_"));
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+insert into t1 values(concat("for_4_",UUID()));
+insert into t1 select "yesterday_5_";
+
+# verify that temp tables prevent a switch to SBR
+create temporary table tmp(a char(100));
+insert into tmp values("see_6_");
+--error ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR
+set binlog_format=statement;
+insert into t1 select * from tmp;
+drop temporary table tmp;
+
+# Now we go to SBR
+set binlog_format=statement;
+show global variables like "binlog_format%";
+show session variables like "binlog_format%";
+select @@global.binlog_format, @@session.binlog_format;
+set global binlog_format=statement;
+show global variables like "binlog_format%";
+show session variables like "binlog_format%";
+select @@global.binlog_format, @@session.binlog_format;
+
+prepare stmt1 from 'insert into t1 select ?';
+set @string="emergency_7_";
+insert into t1 values("work_8_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values("work_9_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+insert into t1 values("for_10_");
+insert into t1 select "yesterday_11_";
+
+# test SET DEFAULT (=statement at this point of test)
+set binlog_format=default;
+select @@global.binlog_format, @@session.binlog_format;
+# due to cluster it's hard to set back to default
+--error ER_NO_DEFAULT
+set global binlog_format=default;
+select @@global.binlog_format, @@session.binlog_format;
+
+prepare stmt1 from 'insert into t1 select ?';
+set @string="emergency_12_";
+insert into t1 values("work_13_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values("work_14_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+insert into t1 values("for_15_");
+insert into t1 select "yesterday_16_";
+
+# and now the mixed mode
+
+set binlog_format=mixed;
+select @@global.binlog_format, @@session.binlog_format;
+set global binlog_format=mixed;
+select @@global.binlog_format, @@session.binlog_format;
+
+prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
+set @string="emergency_17_";
+insert into t1 values("work_18_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values(concat(UUID(),"work_19_"));
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+insert into t1 values(concat("for_20_",UUID()));
+insert into t1 select "yesterday_21_";
+
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values(concat(UUID(),"work_22_"));
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+insert into t1 values(concat("for_23_",UUID()));
+insert into t1 select "yesterday_24_";
+
+# Test of CREATE TABLE SELECT
+
+create table t2 select rpad(UUID(),100,' ');
+create table t3 select 1 union select UUID();
+create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3);
+create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
+# what if UUID() is first:
+insert into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
+
+# inside a stored procedure
+
+delimiter |;
+create procedure foo()
+begin
+insert into t1 values("work_25_");
+insert into t1 values(concat("for_26_",UUID()));
+insert into t1 select "yesterday_27_";
+end|
+create procedure foo2()
+begin
+insert into t1 values(concat("emergency_28_",UUID()));
+insert into t1 values("work_29_");
+insert into t1 values(concat("for_30_",UUID()));
+set session binlog_format=row; # accepted for stored procs
+insert into t1 values("more work_31_");
+set session binlog_format=mixed;
+end|
+create function foo3() returns bigint unsigned
+begin
+ set session binlog_format=row; # rejected for stored funcs
+ insert into t1 values("alarm");
+ return 100;
+end|
+create procedure foo4(x varchar(100))
+begin
+insert into t1 values(concat("work_250_",x));
+insert into t1 select "yesterday_270_";
+end|
+delimiter ;|
+call foo();
+call foo2();
+call foo4("hello");
+call foo4(UUID());
+call foo4("world");
+
+# test that can't SET in a stored function
+--error ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT
+select foo3();
+select * from t1 where a="alarm";
+
+# Tests of stored functions/triggers/views for BUG#20930 "Mixed
+# binlogging mode does not work with stored functions, triggers,
+# views"
+
+# Function which calls procedure
+drop function foo3;
+delimiter |;
+create function foo3() returns bigint unsigned
+begin
+ insert into t1 values("foo3_32_");
+ call foo();
+ return 100;
+end|
+delimiter ;|
+insert into t2 select foo3();
+
+prepare stmt1 from 'insert into t2 select foo3()';
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+
+# Test if stored function calls stored function which calls procedure
+# which requires row-based.
+
+delimiter |;
+create function foo4() returns bigint unsigned
+begin
+ insert into t2 select foo3();
+ return 100;
+end|
+delimiter ;|
+select foo4();
+
+prepare stmt1 from 'select foo4()';
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+
+# A simple stored function
+delimiter |;
+create function foo5() returns bigint unsigned
+begin
+ insert into t2 select UUID();
+ return 100;
+end|
+delimiter ;|
+select foo5();
+
+prepare stmt1 from 'select foo5()';
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+
+# A simple stored function where UUID() is in the argument
+delimiter |;
+create function foo6(x varchar(100)) returns bigint unsigned
+begin
+ insert into t2 select x;
+ return 100;
+end|
+delimiter ;|
+select foo6("foo6_1_");
+select foo6(concat("foo6_2_",UUID()));
+
+prepare stmt1 from 'select foo6(concat("foo6_3_",UUID()))';
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+
+
+# Test of views using UUID()
+
+create view v1 as select uuid();
+create table t11 (data varchar(255));
+insert into t11 select * from v1;
+# Test of querying INFORMATION_SCHEMA which parses the view's body,
+# to verify that it binlogs statement-based (is not polluted by
+# the parsing of the view's body).
+insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11');
+prepare stmt1 from "insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')";
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+
+# Test of triggers with UUID()
+delimiter |;
+create trigger t11_bi before insert on t11 for each row
+begin
+ set NEW.data = concat(NEW.data,UUID());
+end|
+delimiter ;|
+insert into t11 values("try_560_");
+
+# Test that INSERT DELAYED works in mixed mode (BUG#20649)
+insert delayed into t2 values("delay_1_");
+insert delayed into t2 values(concat("delay_2_",UUID()));
+insert delayed into t2 values("delay_6_");
+
+# Test for BUG#20633 (INSERT DELAYED RAND()/user_variable does not
+# replicate fine in statement-based ; we test that in mixed mode it
+# works).
+insert delayed into t2 values(rand());
+set @a=2.345;
+insert delayed into t2 values(@a);
+
+sleep 4; # time for the delayed inserts to reach disk
+
+# If you want to do manual testing of the mixed mode regarding UDFs (not
+# testable automatically as quite platform- and compiler-dependent),
+# you just need to set the variable below to 1, and to
+# "make udf_example.so" in sql/, and to copy sql/udf_example.so to
+# MYSQL_TEST_DIR/lib/mysql.
+let $you_want_to_test_UDF=0;
+if ($you_want_to_test_UDF)
+{
+ CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so';
+ prepare stmt1 from 'insert into t1 select metaphon(?)';
+ set @string="emergency_133_";
+ insert into t1 values("work_134_");
+ execute stmt1 using @string;
+ deallocate prepare stmt1;
+ prepare stmt1 from 'insert into t1 select ?';
+ insert into t1 values(metaphon("work_135_"));
+ execute stmt1 using @string;
+ deallocate prepare stmt1;
+ insert into t1 values(metaphon("for_136_"));
+ insert into t1 select "yesterday_137_";
+ create table t6 select metaphon("for_138_");
+ create table t7 select 1 union select metaphon("for_139_");
+ create table t8 select * from t1 where 3 in (select 1 union select 2 union select metaphon("for_140_") union select 3);
+ create table t9 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
+}
+
+create table t20 select * from t1; # save for comparing later
+create table t21 select * from t2;
+create table t22 select * from t3;
+drop table t1,t2,t3;
+
+# This tests the fix to
+# BUG#19630 stored function inserting into two auto_increment breaks statement-based binlog
+# We verify that under the mixed binlog mode, a stored function
+# modifying at least two tables having an auto_increment column,
+# is binlogged row-based. Indeed in statement-based binlogging,
+# only the auto_increment value generated for the first table
+# is recorded in the binlog, the value generated for the 2nd table
+# lacking.
+
+create table t1 (a int primary key auto_increment, b varchar(100));
+create table t2 (a int primary key auto_increment, b varchar(100));
+create table t3 (b varchar(100));
+delimiter |;
+create function f (x varchar(100)) returns int deterministic
+begin
+ insert into t1 values(null,x);
+ insert into t2 values(null,x);
+ return 1;
+end|
+delimiter ;|
+select f("try_41_");
+# Two operations which compensate each other except that their net
+# effect is that they advance the auto_increment counter of t2 on slave:
+sync_slave_with_master;
+use mysqltest1;
+insert into t2 values(2,null),(3,null),(4,null);
+delete from t2 where a>=2;
+
+connection master;
+# this is the call which didn't replicate well
+select f("try_42_");
+sync_slave_with_master;
+
+# now use prepared statement and test again, just to see that the RBB
+# mode isn't set at PREPARE but at EXECUTE.
+
+insert into t2 values(3,null),(4,null);
+delete from t2 where a>=3;
+
+connection master;
+prepare stmt1 from 'select f(?)';
+set @string="try_43_";
+insert into t1 values(null,"try_44_"); # should be SBB
+execute stmt1 using @string; # should be RBB
+deallocate prepare stmt1;
+sync_slave_with_master;
+
+# verify that if only one table has auto_inc, it does not trigger RBB
+# (we'll check in binlog further below)
+
+connection master;
+create table t12 select * from t1; # save for comparing later
+drop table t1;
+create table t1 (a int, b varchar(100), key(a));
+select f("try_45_");
+
+# restore table's key
+create table t13 select * from t1;
+drop table t1;
+create table t1 (a int primary key auto_increment, b varchar(100));
+
+# now test if it's two functions, each of them inserts in one table
+
+drop function f;
+# we need a unique key to have sorting of rows by mysqldump
+create table t14 (unique (a)) select * from t2;
+truncate table t2;
+delimiter |;
+create function f1 (x varchar(100)) returns int deterministic
+begin
+ insert into t1 values(null,x);
+ return 1;
+end|
+create function f2 (x varchar(100)) returns int deterministic
+begin
+ insert into t2 values(null,x);
+ return 1;
+end|
+delimiter ;|
+select f1("try_46_"),f2("try_47_");
+
+sync_slave_with_master;
+insert into t2 values(2,null),(3,null),(4,null);
+delete from t2 where a>=2;
+
+connection master;
+# Test with SELECT and INSERT
+select f1("try_48_"),f2("try_49_");
+insert into t3 values(concat("try_50_",f1("try_51_"),f2("try_52_")));
+sync_slave_with_master;
+
+# verify that if f2 does only read on an auto_inc table, this does not
+# switch to RBB
+connection master;
+drop function f2;
+delimiter |;
+create function f2 (x varchar(100)) returns int deterministic
+begin
+ declare y int;
+ insert into t1 values(null,x);
+ set y = (select count(*) from t2);
+ return y;
+end|
+delimiter ;|
+select f1("try_53_"),f2("try_54_");
+sync_slave_with_master;
+
+# And now, a normal statement with a trigger (no stored functions)
+
+connection master;
+drop function f2;
+delimiter |;
+create trigger t1_bi before insert on t1 for each row
+begin
+ insert into t2 values(null,"try_55_");
+end|
+delimiter ;|
+insert into t1 values(null,"try_56_");
+# and now remove one auto_increment and verify SBB
+alter table t1 modify a int, drop primary key;
+insert into t1 values(null,"try_57_");
+sync_slave_with_master;
+
+# Test for BUG#20499 "mixed mode with temporary table breaks binlog"
+# Slave used to have only 2 rows instead of 3.
+connection master;
+CREATE TEMPORARY TABLE t15 SELECT UUID();
+create table t16 like t15;
+INSERT INTO t16 SELECT * FROM t15;
+# we'll verify that this one is done RBB
+insert into t16 values("try_65_");
+drop table t15;
+# we'll verify that this one is done SBB
+insert into t16 values("try_66_");
+sync_slave_with_master;
+
+# and now compare:
+
+connection master;
+
+# first check that data on master is sensible
+select count(*) from t1;
+select count(*) from t2;
+select count(*) from t3;
+select count(*) from t4;
+select count(*) from t5;
+select count(*) from t11;
+select count(*) from t20;
+select count(*) from t21;
+select count(*) from t22;
+select count(*) from t12;
+select count(*) from t13;
+select count(*) from t14;
+select count(*) from t16;
+if ($you_want_to_test_UDF)
+{
+ select count(*) from t6;
+ select count(*) from t7;
+ select count(*) from t8;
+ select count(*) from t9;
+}
+
+sync_slave_with_master;
+
+#
+# Bug#20863 If binlog format is changed between update and unlock of
+# tables, wrong binlog
+#
+
+connection master;
+DROP TABLE IF EXISTS t11;
+SET SESSION BINLOG_FORMAT=STATEMENT;
+CREATE TABLE t11 (song VARCHAR(255));
+LOCK TABLES t11 WRITE;
+SET SESSION BINLOG_FORMAT=ROW;
+INSERT INTO t11 VALUES('Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict');
+SET SESSION BINLOG_FORMAT=STATEMENT;
+INSERT INTO t11 VALUES('Careful With That Axe, Eugene');
+UNLOCK TABLES;
+
+--query_vertical SELECT * FROM t11
+sync_slave_with_master;
+USE mysqltest1;
+--query_vertical SELECT * FROM t11
+
+connection master;
+DROP TABLE IF EXISTS t12;
+SET SESSION BINLOG_FORMAT=MIXED;
+CREATE TABLE t12 (data LONG);
+LOCK TABLES t12 WRITE;
+INSERT INTO t12 VALUES(UUID());
+UNLOCK TABLES;
+
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
+show binlog events from 102;
+sync_slave_with_master;
+
+# as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql
+
+# Let's compare. Note: If they match test will pass, if they do not match
+# the test will show that the diff statement failed and not reject file
+# will be created. You will need to go to the mysql-test dir and diff
+# the files your self to see what is not matching
+
+--exec diff $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql;
+
+connection master;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
+show binlog events from 102;
+
+# Now test that mysqlbinlog works fine on a binlog generated by the
+# mixed mode
+
+# BUG#11312 "DELIMITER is not written to the binary log that causes
+# syntax error" makes that mysqlbinlog will fail if we pass it the
+# text of queries; this forces us to use --base64-output here.
+
+# BUG#20929 "BINLOG command causes invalid free plus assertion
+# failure" makes mysqld segfault when receiving --base64-output
+
+# So I can't enable this piece of test
+# SIGH
+
+if ($enable_when_11312_or_20929_fixed)
+{
+--exec $MYSQL_BINLOG --base64-output $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql
+drop database mysqltest1;
+--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql
+# the old mysqldump output on slave is the same as what it was on
+# master before restoring on master.
+--exec diff $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql;
+}
+
+drop database mysqltest1;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl000012.test b/mysql-test/t/rpl_temp_table.test
index 2c1c65e4202..9b73961aeea 100644
--- a/mysql-test/t/rpl000012.test
+++ b/mysql-test/t/rpl_temp_table.test
@@ -1,37 +1,53 @@
-source include/master-slave.inc;
-connection master;
+# drop table t1 t2 t3 are included int master-slave.inc
+# meaningful only in statement-based:
-create table t2 (n int);
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/master-slave.inc
+
+
+create table t2 (n int, PRIMARY KEY(n));
create temporary table t1 (n int);
-insert into t1 values(1),(2),(3);
-insert into t2 select * from t1;
create temporary table t3 (n int not null);
+
+insert into t1 values(1),(2),(3),(100),(25),(26),(200),(300);
+insert into t2 select * from t1;
alter table t3 add primary key(n);
+
flush logs;
-insert into t3 values (100);
+insert into t3 values (1010);
insert into t2 select * from t3;
+
drop table if exists t3;
-insert into t2 values (101);
+insert into t2 values (1012);
+
connection master1;
create temporary table t1 (n int);
insert into t1 values (4),(5);
insert into t2 select * from t1;
+
save_master_pos;
disconnect master;
-connection slave;
+connection slave;
#add 1 to the saved position, so we will catch drop table on disconnect
#for sure
sync_with_master 1;
+
connection master1;
-insert into t2 values(6);
+insert into t2 values(61);
+
save_master_pos;
disconnect master1;
+
connection slave;
#same trick - make sure we catch drop of temporary table on disconnect
sync_with_master 1;
+
select * from t2;
+select count(*) from t2;
+select sum(n) from t2;
show status like 'Slave_open_temp_tables';
+
#
# Clean up
#
@@ -41,5 +57,3 @@ drop table if exists t1,t2;
save_master_pos;
connection slave;
sync_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl_temporary.test b/mysql-test/t/rpl_temporary.test
index 81f0e8a0af7..fc336db1a3a 100644
--- a/mysql-test/t/rpl_temporary.test
+++ b/mysql-test/t/rpl_temporary.test
@@ -1,4 +1,5 @@
-source include/master-slave.inc;
+
+-- source include/master-slave.inc
# Clean up old slave's binlogs.
# The slave is started with --log-slave-updates
@@ -79,11 +80,12 @@ connection con2;
insert into t2 select count(*) from t3;
drop temporary table t3;
-select * from t2;
+select * from t2 ORDER BY f;
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
-show binlog events;
+# Commented out 8/30/2005 to make compatable with both sbr and rbr
+#--replace_result $VERSION VERSION
+#--replace_column 2 # 5 #
+#show binlog events;
drop table t1, t2;
@@ -120,7 +122,7 @@ SET TIMESTAMP=1040324224;
SET @@session.pseudo_thread_id=2;
drop temporary table t3;
-select * from t2;
+select * from t2 ORDER BY f;
drop table t1,t2;
# Create last a temporary table that is not dropped at end to ensure that we
@@ -140,11 +142,8 @@ create temporary table t4 (f int);
create table t5 (f int);
sync_with_master;
# find dumper's $id
-source include/get_binlog_dump_thread_id.inc;
-insert into t4 values (1);
-# a hint how to do that in 5.1
---replace_result $id "`select id from information_schema.processlist where command='Binlog Dump'`"
-eval kill $id; # to stimulate reconnection by slave w/o timeout
+select id from information_schema.processlist where command='Binlog Dump' into @id;
+kill @id; # to stimulate reconnection by slave w/o timeout
insert into t5 select * from t4;
save_master_pos;
@@ -201,4 +200,4 @@ select * from t1;
connection master;
drop table t1;
-# End of 5.0 tests
+# End of 5.1 tests
diff --git a/mysql-test/t/rpl_timezone.test b/mysql-test/t/rpl_timezone.test
index 6ed5b21ace0..4b8c8152c82 100644
--- a/mysql-test/t/rpl_timezone.test
+++ b/mysql-test/t/rpl_timezone.test
@@ -1,5 +1,10 @@
+#######################################
+# Change Author: JBM
+# Change Date: 2006-01-17
+# Change: Added order by
+#######################################
# Test of replication of time zones.
-
+######################################
# There is currently some bug possibly in prepared statements (this
# test fails with --ps-protocol): sys_var_thd_time_zone::value_ptr()
# is called only at prepare time, not at execution time. So,
@@ -18,68 +23,73 @@ set @my_time_zone= @@global.time_zone;
# Some preparations
let $VERSION=`select version()`;
set timestamp=100000000; # for fixed output of mysqlbinlog
-create table t1 (t timestamp);
-create table t2 (t char(32));
+create table t1 (t timestamp, n int not null auto_increment, PRIMARY KEY(n));
+create table t2 (t char(32), n int not null auto_increment, PRIMARY KEY(n));
connection slave;
select @@time_zone;
-
+#set time_zone='UTC';
+#select @@time_zone;
#
# Let us check how well replication works when we are saving datetime
# value in TIMESTAMP field.
#
connection master;
select @@time_zone;
-insert into t1 values ('20050101000000'), ('20050611093902');
-set time_zone='UTC';
-insert into t1 values ('20040101000000'), ('20040611093902');
-select * from t1;
+#set time_zone='UTC';
+#select @@time_zone;
+insert into t1 values ('20050101000000', NULL), ('20050611093902',NULL);
+insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
+SELECT * FROM t1 ORDER BY n;
sync_slave_with_master;
-set time_zone='UTC';
-select * from t1;
+#set time_zone='UTC';
+SELECT * FROM t1 ORDER BY n;
# Let us check also that setting of time_zone back to default also works
# well
connection master;
delete from t1;
set time_zone='Europe/Moscow';
-insert into t1 values ('20040101000000'), ('20040611093902');
-select * from t1;
+insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
+SELECT * FROM t1 ORDER BY n;
sync_slave_with_master;
set time_zone='Europe/Moscow';
-select * from t1;
+SELECT * FROM t1 ORDER BY n;
connection master;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001
+# Change Author: JBM
+# Change Date: 2005-12-22
+# Change: Comment out the exec of the binlog so test works for both SBR and RBR
+#--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+#--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001
# Let us check with LOAD DATA INFILE
# (we do it after mysqlbinlog because the temp files names are not constant)
connection master;
delete from t1;
set time_zone='UTC';
-load data infile '../std_data_ln/rpl_timezone.dat' into table t1;
-select * from t1;
+load data infile '../std_data_ln/rpl_timezone2.dat' into table t1;
+SELECT * FROM t1 ORDER BY n;
sync_slave_with_master;
set time_zone='UTC';
-select * from t1;
+SELECT * FROM t1 ORDER BY n;
set time_zone='Europe/Moscow';
# Put back values of before the LOAD
connection master;
set time_zone='Europe/Moscow';
delete from t1;
-insert into t1 values ('20040101000000'), ('20040611093902');
+insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
#
# Now let us check how well we replicate statments reading TIMESTAMP fields
-# (We should see the same data on master and on slave but it should differ
+# (We should see the same data on master and on slave but it should differ
# from originally inserted)
#
set time_zone='MET';
-insert into t2 (select t from t1);
-select * from t1;
+insert into t2 (select * from t1);
+SELECT * FROM t1 ORDER BY n;
sync_slave_with_master;
-select * from t2;
+SELECT * FROM t2 ORDER BY n;
#
# Now let us check how well we replicate various CURRENT_* functions
@@ -87,21 +97,21 @@ select * from t2;
connection master;
delete from t2;
set timestamp=1000072000;
-insert into t2 values (current_timestamp), (current_date), (current_time);
+insert into t2 values (current_timestamp,NULL), (current_date,NULL), (current_time,NULL);
sync_slave_with_master;
-select * from t2;
+SELECT * FROM t2 ORDER BY n;
#
# At last let us check replication of FROM_UNIXTIME/UNIX_TIMESTAMP functions.
#
connection master;
delete from t2;
-insert into t2 values (from_unixtime(1000000000)),
- (unix_timestamp('2001-09-09 03:46:40'));
-select * from t2;
+insert into t2 values (from_unixtime(1000000000),NULL),
+ (unix_timestamp('2001-09-09 03:46:40'),NULL);
+SELECT * FROM t2 ORDER BY n;
sync_slave_with_master;
# We should get same result on slave as on master
-select * from t2;
+SELECT * FROM t2 ORDER BY n;
#
# Let us check that we are allowing to set global time_zone with
@@ -115,18 +125,17 @@ set global time_zone='MET';
#
delete from t2;
set time_zone='UTC';
-insert into t2 values(convert_tz('2004-01-01 00:00:00','MET',@@time_zone));
-insert into t2 values(convert_tz('2005-01-01 00:00:00','MET','Japan'));
-select * from t2;
+insert into t2 values(convert_tz('2004-01-01 00:00:00','MET',@@time_zone),NULL);
+insert into t2 values(convert_tz('2005-01-01 00:00:00','MET','Japan'),NULL);
+SELECT * FROM t2 ORDER BY n;
sync_slave_with_master;
-select * from t2;
+SELECT * FROM t2 ORDER BY n;
# Clean up
connection master;
drop table t1, t2;
sync_slave_with_master;
-# End of 4.1 tests
# Restore original timezone
connection master;
diff --git a/mysql-test/t/rpl_trigger.test b/mysql-test/t/rpl_trigger.test
index d6e9410b1d3..6ec0021635a 100644
--- a/mysql-test/t/rpl_trigger.test
+++ b/mysql-test/t/rpl_trigger.test
@@ -1,8 +1,16 @@
#
# Test of triggers with replication
-#
+# Adding statement include due to Bug 12574
+# TODO: Remove statement include once 12574 is patched
+--source include/have_binlog_format_mixed_or_statement.inc
+--source include/master-slave.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP TABLE IF EXISTS t3;
-source include/master-slave.inc;
+--enable_warnings
#
# #12482: Triggers has side effects with auto_increment values
diff --git a/mysql-test/t/rpl_trunc_temp.test b/mysql-test/t/rpl_trunc_temp.test
index b4ea3c318da..28bcb0c06c3 100644
--- a/mysql-test/t/rpl_trunc_temp.test
+++ b/mysql-test/t/rpl_trunc_temp.test
@@ -1,3 +1,6 @@
+# Requires statement logging
+-- source include/have_binlog_format_mixed_or_statement.inc
+
source include/master-slave.inc;
#
diff --git a/mysql-test/t/rpl_truncate_2myisam.test b/mysql-test/t/rpl_truncate_2myisam.test
new file mode 100644
index 00000000000..a0f0ea04f44
--- /dev/null
+++ b/mysql-test/t/rpl_truncate_2myisam.test
@@ -0,0 +1,4 @@
+--source include/not_ndb_default.inc
+let $engine=MyISAM;
+--source extra/rpl_tests/rpl_truncate.test
+
diff --git a/mysql-test/t/rpl_truncate_3innodb.test b/mysql-test/t/rpl_truncate_3innodb.test
new file mode 100644
index 00000000000..a31fd62a29a
--- /dev/null
+++ b/mysql-test/t/rpl_truncate_3innodb.test
@@ -0,0 +1,6 @@
+
+--source include/have_innodb.inc
+--source include/not_ndb_default.inc
+
+let $engine=InnoDB;
+--source extra/rpl_tests/rpl_truncate.test
diff --git a/mysql-test/t/rpl_truncate_7ndb.test b/mysql-test/t/rpl_truncate_7ndb.test
new file mode 100644
index 00000000000..1d69eee5dd0
--- /dev/null
+++ b/mysql-test/t/rpl_truncate_7ndb.test
@@ -0,0 +1,71 @@
+
+--source include/have_ndb.inc
+--source include/master-slave.inc
+--source include/have_binlog_format_mixed_or_row.inc
+
+--disable_query_log
+--disable_warnings
+connection slave;
+STOP SLAVE;
+connection master;
+DROP TABLE IF EXISTS t1;
+RESET MASTER;
+connection slave;
+DROP TABLE IF EXISTS t1;
+RESET SLAVE;
+START SLAVE;
+--enable_warnings
+--enable_query_log
+
+--echo **** On Master ****
+connection master;
+CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1 ORDER BY a,b;
+--echo **** On Slave ****
+# This is silly, but NDB doesn't add to the binlog fast enough
+--real_sleep 10
+sync_slave_with_master;
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1 ORDER BY a,b;
+--echo **** On Master ****
+connection master;
+TRUNCATE TABLE t1;
+SELECT * FROM t1 ORDER BY a,b;
+--echo **** On Slave ****
+sync_slave_with_master;
+# Should be empty
+SELECT * FROM t1 ORDER BY a,b;
+--echo **** On Master ****
+connection master;
+DROP TABLE t1;
+let SERVER_VERSION=`select version()`;
+--replace_regex /\/\* xid=[0-9]+ \*\//\/* xid= *\// /table_id: [0-9]+/table_id: #/
+--replace_result $SERVER_VERSION SERVER_VERSION
+SHOW BINLOG EVENTS;
+
+--echo **** On Master ****
+connection master;
+CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1 ORDER BY a,b;
+--echo **** On Slave ****
+sync_slave_with_master;
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1 ORDER BY a,b;
+--echo **** On Master ****
+connection master;
+DELETE FROM t1;
+SELECT * FROM t1 ORDER BY a,b;
+--echo **** On Slave ****
+sync_slave_with_master;
+# Should be empty
+SELECT * FROM t1 ORDER BY a,b;
+--echo **** On Master ****
+connection master;
+DROP TABLE t1;
+--replace_regex /table_id: [0-9]+/table_id: #/
+--replace_result $SERVER_VERSION SERVER_VERSION
+SHOW BINLOG EVENTS;
+
+-- source include/master-slave-end.inc
diff --git a/mysql-test/t/rpl_truncate_7ndb_2-master.opt b/mysql-test/t/rpl_truncate_7ndb_2-master.opt
new file mode 100644
index 00000000000..01cf3e0520f
--- /dev/null
+++ b/mysql-test/t/rpl_truncate_7ndb_2-master.opt
@@ -0,0 +1 @@
+--binlog-format=mixed
diff --git a/mysql-test/t/rpl_truncate_7ndb_2.test b/mysql-test/t/rpl_truncate_7ndb_2.test
new file mode 100644
index 00000000000..4ee6c98d463
--- /dev/null
+++ b/mysql-test/t/rpl_truncate_7ndb_2.test
@@ -0,0 +1,6 @@
+# Same test as rpl_truncate_7ndb.test, but with mixed mode
+# This is marked with 'big_test' just because the rpl_truncate_7ndb test is
+# so slow...
+
+--source include/big_test.inc
+--source t/rpl_truncate_7ndb.test
diff --git a/mysql-test/t/rpl_user_variables.test b/mysql-test/t/rpl_user_variables.test
index dbe75a15038..08717fce114 100644
--- a/mysql-test/t/rpl_user_variables.test
+++ b/mysql-test/t/rpl_user_variables.test
@@ -1,7 +1,10 @@
+###################################
#
# Test of replicating user variables
#
-source include/master-slave.inc;
+###################################
+
+-- source include/master-slave.inc
# Disable PS as the log positions differs
--disable_ps_protocol
@@ -39,26 +42,16 @@ set @q:='abc';
insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'));
set @a:=5;
insert into t1 values (@a),(@a);
+# To flush the pending event, we add the following statement. RBR can
+# concatenate the result of several statements, which SBR cannot.
+select * from t1 where n = '<nonexistant>';
connection master1; # see if variable is reset in binlog when thread changes
insert into t1 values (@a),(@a),(@a*5);
-select * from t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from t1;
---replace_column 2 # 5 #
-show binlog events from 98;
-#
-# BUG19136: Crashing log-bin and uninitialized user variables in a derived table
-# just to check nothing bad happens anymore
-#
+SELECT * FROM t1 ORDER BY n;
+sync_slave_with_master;
+SELECT * FROM t1 ORDER BY n;
connection master;
insert into t1 select * FROM (select @var1 union select @var2) AS t2;
drop table t1;
-save_master_pos;
-
-connection slave;
-sync_with_master;
+sync_slave_with_master;
stop slave;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl_variables.test b/mysql-test/t/rpl_variables.test
index d0801e524e4..84dc3acfe6e 100644
--- a/mysql-test/t/rpl_variables.test
+++ b/mysql-test/t/rpl_variables.test
@@ -16,5 +16,5 @@ show variables like 'slave_load_tmpdir';
# that a list of values works correctly
show variables like 'slave_skip_errors';
-# Restore touched values
-set global slave_net_timeout =@my_slave_net_timeout;
+# Cleanup
+set global slave_net_timeout=default;
diff --git a/mysql-test/t/rpl_view.test b/mysql-test/t/rpl_view.test
index 812e5d44d58..3eff8f7550a 100644
--- a/mysql-test/t/rpl_view.test
+++ b/mysql-test/t/rpl_view.test
@@ -1,3 +1,5 @@
+# NYI - row-based cannot use CREATE ... SELECT
+
source include/master-slave.inc;
--disable_warnings
drop table if exists t1,v1;
@@ -7,7 +9,7 @@ reset master;
--enable_warnings
#
-# Check that createion drop of view is replicated, also check replication of
+# Check that creation drop of view is replicated, also check replication of
# updating of view
#
connection master;
@@ -43,10 +45,11 @@ select * from v1 order by a;
connection master;
drop table t1;
sync_slave_with_master;
---replace_column 2 # 5 #
-show binlog events limit 1,100;
-
-
+# Change Author: JBM
+# Change Date: 2005-12-22
+# Change: Commented out binlog events to work with SBR and RBR
+#--replace_column 2 # 5 #
+# show binlog events limit 1,100;
#
# BUG#20438: CREATE statements for views, stored routines and triggers can be
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 0f096d97d25..bc0dfd6de76 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -2286,25 +2286,6 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX (a);
DROP TABLE t1;
#
-# Bug #18759 "Incorrect string to numeric conversion"
-#
-# This test is here so that the behavior will not be changed to 4.1
-# and not to 5.0 either. In 4.1 and 5.0 sending an integer as a string
-# will be converted internally to real (double) value and it is not
-# as accurate as bigint (longlong) for integers. Thus the results may
-# vary. In 5.1 internally it is decimal, which is a string type and
-# will be more accurate. Due to rather big changes needed to fix this
-# in 4.1 or 5.0 it is not desired to do it in the stable versions.
-#
-# This test is here only to make sure that behavior is not changed in
-# 4.1 and 5.0
-#
-CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
-INSERT INTO t1 VALUES (10);
-SELECT i='1e+01',i=1e+01, i in (1e+01,1e+01), i in ('1e+01','1e+01') FROM t1;
-DROP TABLE t1;
-
-#
# Bug #21019: First result of SELECT COUNT(*) different than consecutive runs
#
CREATE TABLE t1 (a int, b int);
@@ -2319,6 +2300,7 @@ SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NUL
EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
DROP TABLE IF EXISTS t1,t2;
+
#
# Bug #20954 "avg(keyval) retuns 0.38 but max(keyval) returns an empty set"
#
@@ -2349,6 +2331,25 @@ select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
DROP TABLE t1,t2;
--enable_ps_protocol
+#
+# Bug #18759 "Incorrect string to numeric conversion"
+#
+# This test is here so that the behavior will not be changed to 4.1
+# and not to 5.0 either. In 4.1 and 5.0 sending an integer as a string
+# will be converted internally to real (double) value and it is not
+# as accurate as bigint (longlong) for integers. Thus the results may
+# vary. In 5.1 internally it is decimal, which is a string type and
+# will be more accurate. Due to rather big changes needed to fix this
+# in 4.1 or 5.0 it is not desired to do it in the stable versions.
+#
+# This test is here only to make sure that behavior is not changed in
+# 4.1 and 5.0
+#
+CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
+INSERT INTO t1 VALUES (10);
+SELECT i='1e+01',i=1e+01, i in (1e+01,1e+01), i in ('1e+01','1e+01') FROM t1;
+DROP TABLE t1;
+
# End of 4.1 tests
#
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index 849be577893..7d4ad099e6f 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -2,6 +2,10 @@
# embedded server testing
-- source include/not_embedded.inc
+# check that CSV engine was compiled in, as the result of the test
+# depends on the presence of the log tables (which are CSV-based).
+--source include/have_csv.inc
+
#
# Test of some show commands
#
@@ -162,33 +166,28 @@ drop table t1;
SET @old_sql_mode= @@sql_mode, sql_mode= '';
SET @old_sql_quote_show_create= @@sql_quote_show_create, sql_quote_show_create= OFF;
-######### hook for WL#1324 #
---error 1103
-CREATE TABLE `a/b` (i INT);
-# the above test should WORK when WL#1324 is done,
-# it should be removed and
-# the following part should be uncommented then
-#########################################################
-# begin of part that must be uncommented when WL#1324 is done
-#########################################################
-#CREATE TABLE ```ab``cd``` (i INT);
-#SHOW CREATE TABLE ```ab``cd```;
-#DROP TABLE ```ab``cd```;
-
-#CREATE TABLE ```ab````cd``` (i INT);
-#SHOW CREATE TABLE ```ab````cd```;
-#DROP TABLE ```ab````cd```;
-#
-#CREATE TABLE ```a` (i INT);
-#SHOW CREATE TABLE ```a`;
-#DROP TABLE ```a`;
-#
-#SET sql_mode= 'ANSI_QUOTES';
-#
-#CREATE TABLE """a" (i INT);
-#SHOW CREATE TABLE """a";
-#DROP TABLE """a";
-#
+CREATE TABLE ```ab``cd``` (i INT);
+SHOW CREATE TABLE ```ab``cd```;
+DROP TABLE ```ab``cd```;
+
+CREATE TABLE ```ab````cd``` (i INT);
+SHOW CREATE TABLE ```ab````cd```;
+DROP TABLE ```ab````cd```;
+
+CREATE TABLE ```a` (i INT);
+SHOW CREATE TABLE ```a`;
+DROP TABLE ```a`;
+
+CREATE TABLE `a.1` (i INT);
+SHOW CREATE TABLE `a.1`;
+DROP TABLE `a.1`;
+
+SET sql_mode= 'ANSI_QUOTES';
+
+CREATE TABLE """a" (i INT);
+SHOW CREATE TABLE """a";
+DROP TABLE """a";
+
#Bug #4374 SHOW TABLE STATUS FROM ignores collation_connection
#set names latin1;
#create database ``;
@@ -196,9 +195,6 @@ CREATE TABLE `a/b` (i INT);
#--replace_column 7 # 8 # 9 #
#show table status from `` LIKE '';
#drop database ``;
-#########################################################
-# end of part that must be uncommented when WL#1324 is done
-#########################################################
# to test quotes around keywords.. :
@@ -259,9 +255,9 @@ delete from t2 where b=3;
delete from t3 where a=3;
--replace_column 6 # 7 # 8 # 9 # 10 #
show table status;
-delete from t1;
-delete from t2;
-delete from t3;
+truncate table t1;
+truncate table t2;
+truncate table t3;
--replace_column 6 # 7 # 8 # 9 #
show table status;
insert into t1 values (5);
@@ -313,7 +309,6 @@ connect (con3,localhost,mysqltest_3,,test);
connection con3;
--error 1142
select * from mysqltest.t1;
---error 1044
show create database mysqltest;
drop table mysqltest.t1;
drop database mysqltest;
@@ -397,14 +392,13 @@ system echo "this is a junk file for test" >> $MYSQLTEST_VARDIR/master-data/test
SHOW TABLE STATUS like 't1';
--error 1033
show create table t1;
-drop table t1;
-
-
---echo End of 4.1 tests
+drop table if exists t1;
+system rm -f $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
#
# BUG 12183 - SHOW OPEN TABLES behavior doesn't match grammar
# First we close all open tables with FLUSH tables and then we open some.
+#
CREATE TABLE txt1(a int);
CREATE TABLE tyt2(a int);
CREATE TABLE urkunde(a int);
@@ -426,6 +420,7 @@ DROP TABLE urkunde;
--error 1049
SHOW TABLES FROM non_existing_database;
+--echo End of 4.1 tests
#
# Bug#17203: "sql_no_cache sql_cache" in views created from prepared
@@ -519,4 +514,54 @@ show status like 'slow_queries';
select 1 from information_schema.tables limit 1;
show status like 'slow_queries';
---echo End of 5.0 tests
+--echo End of 5.0 tests.
+
+--disable_result_log
+SHOW AUTHORS;
+--enable_result_log
+
+#
+# Test for bug #9785 SELECT privilege for the whole database is needed to do SHOW CREATE DATABASE
+#
+create database mysqltest;
+show create database mysqltest;
+create table mysqltest.t1(a int);
+insert into mysqltest.t1 values(1);
+grant select on `mysqltest`.`t1` to mysqltest_4@localhost;
+connect (con4,localhost,mysqltest_4,,mysqltest);
+connection con4;
+show create database mysqltest;
+connection default;
+delete from mysql.user where user='mysqltest_4';
+delete from mysql.db where user='mysqltest_4';
+delete from mysql.tables_priv where user='mysqltest_4';
+flush privileges;
+drop database mysqltest;
+
+#
+# Ensure that show plugin code is tested
+#
+
+--disable_result_log
+show full plugin;
+--enable_result_log
+show warnings;
+--disable_result_log
+show plugin;
+show plugins;
+--enable_result_log
+
+#
+# Bug #19874: SHOW COLUMNS and SHOW KEYS handle identifiers containing
+# \ incorrectly
+#
+create database `mysqlttest\1`;
+create table `mysqlttest\1`.`a\b` (a int);
+show tables from `mysqlttest\1`;
+show fields from `mysqlttest\1`.`a\b`;
+show columns from `a\b` from `mysqlttest\1`;
+show keys from `mysqlttest\1`.`a\b`;
+drop table `mysqlttest\1`.`a\b`;
+drop database `mysqlttest\1`;
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test
index 4f5f1cdcb9b..375d2289459 100644
--- a/mysql-test/t/sp-destruct.test
+++ b/mysql-test/t/sp-destruct.test
@@ -7,6 +7,11 @@
# In the case of trouble you might want to skip this.
#
+# embedded server returns different paths in error messages
+# in lines like 'call bug14233();'
+# mysqltest should be fixed to allow REPLACE_RESULT in error message
+-- source include/not_embedded.inc
+
# We're using --system things that probably doesn't work on Windows.
--source include/not_windows.inc
@@ -35,10 +40,13 @@ create trigger t1_ai after insert on t1 for each row call bug14233();
# Unsupported tampering with the mysql.proc definition
alter table mysql.proc drop type;
+--replace_result $MYSQL_TEST_DIR .
--error ER_SP_PROC_TABLE_CORRUPT
call bug14233();
+--replace_result $MYSQL_TEST_DIR .
--error ER_SP_PROC_TABLE_CORRUPT
create view v1 as select bug14233_f();
+--replace_result $MYSQL_TEST_DIR .
--error ER_SP_PROC_TABLE_CORRUPT
insert into t1 values (0);
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index 77bd5259eb5..456a23123d3 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -508,7 +508,7 @@ end|
insert into t1 values (666, 51.3)|
--error 1054
call bug2272()|
-delete from t1|
+truncate table t1|
drop procedure bug2272|
#
@@ -742,7 +742,7 @@ begin
fetch c into v;
end|
-delete from t1|
+truncate table t1|
--error ER_SP_FETCH_NO_DATA
call bug7299()|
drop procedure bug7299|
@@ -871,7 +871,7 @@ insert into t1 value (2, 2.7), (3, 3.14), (7, 7.0)|
select *,bug8408() from t1|
drop function bug8408|
-delete from t1|
+truncate table t1|
#
@@ -1114,6 +1114,10 @@ execute stmt;
drop function bug11834_1;
# Attempt to execute statement should return proper error and
# should not crash server.
+
+# NOTE! The error we get from the below query indicates that the sp bug11834_2
+# does not exist(this is wrong but can be accepted)
+# This behaviour has been reported as bug#21294
--error ER_SP_DOES_NOT_EXIST
execute stmt;
deallocate prepare stmt;
@@ -1744,7 +1748,7 @@ drop function if exists bug16896;
--error ER_SP_NO_AGGREGATE
create aggregate function bug16896() returns int return 1;
-
+#
#
# BUG#14702: misleading error message when syntax error in CREATE
# PROCEDURE
@@ -1809,9 +1813,52 @@ DROP TABLE t1;
#
+# End of 5.0 tests
+#
+--echo End of 5.0 tests
+
+#
+# Bug#16164 "Easter egg": check that SHOW AUTHORS is disabled in
+# stored functions/triggers
+#
+--disable_warnings
+drop function if exists bug16164;
+--enable_warnings
+delimiter |;
+--error ER_SP_NO_RETSET
+create function bug16164() returns int
+begin
+ show authors;
+ return 42;
+end|
+delimiter ;|
+
+
+#
+# BUG#20701: BINARY keyword should be forbidden in stored routines
+#
+--disable_warnings
+drop function if exists bug20701;
+--enable_warnings
+#
+# This was disabled in 5.1.12. See bug #20701
+# When collation support in SP is implemented, then this test should
+# be removed.
+#
+--error ER_NOT_SUPPORTED_YET
+create function bug20701() returns varchar(25) binary return "test";
+create function bug20701() returns varchar(25) return "test";
+drop function bug20701;
+
+
+--echo End of 5.1 tests
+
+#
# BUG#NNNN: New bug synopsis
#
#--disable_warnings
-#drop procedure if exists bugNNNN|
+#drop procedure if exists bugNNNN;
+#drop function if exists bugNNNN;
#--enable_warnings
#create procedure bugNNNN...
+#create function bugNNNN...
diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test
index a5d509f29b7..f994f61a665 100644
--- a/mysql-test/t/sp-security.test
+++ b/mysql-test/t/sp-security.test
@@ -527,29 +527,6 @@ drop database db_bug14533;
#
-# BUG#7787: Stored procedures: improper warning for "grant execute" statement
-#
-
-# Prepare.
-
-CREATE DATABASE db_bug7787;
-use db_bug7787;
-
-# Test.
-
-CREATE PROCEDURE p1()
- SHOW INNODB STATUS;
-
-GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost;
-
-# Cleanup.
-
-DROP DATABASE db_bug7787;
-drop user user_bug7787@localhost;
-use test;
-
-
-#
# WL#2897: Complete definer support in the stored routines.
#
# The following cases are tested:
@@ -743,7 +720,6 @@ DROP USER mysqltest_2@localhost;
DROP DATABASE mysqltest;
-
#
# Bug#19857 - When a user with CREATE ROUTINE priv creates a routine,
# it results in NULL p/w
@@ -792,7 +768,7 @@ DROP USER user19857@localhost;
--disconnect con1root
--connection default
-
+use test;
#
# BUG#18630: Arguments of suid routine calculated in wrong security
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index fc6e8714a65..bb18c0e5858 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -139,7 +139,7 @@ begin
end|
call setcontext()|
-select * from t1|
+select * from t1 order by data|
delete from t1|
drop procedure setcontext|
@@ -283,7 +283,7 @@ create procedure inc(inout io int)
set io = io + 1|
call iotest("io1", "io2", 1)|
-select * from t1|
+select * from t1 order by data desc|
delete from t1|
drop procedure iotest|
drop procedure inc2|
@@ -329,7 +329,7 @@ begin
end|
call cbv1()|
-select * from t1|
+select * from t1 order by data|
delete from t1|
drop procedure cbv1|
drop procedure cbv2|
@@ -367,7 +367,7 @@ call sub1("sub1b", (select max(i) from t2))|
call sub1("sub1c", (select i,d from t2 limit 1))|
call sub1("sub1d", (select 1 from (select 1) a))|
call sub2("sub2")|
-select * from t1|
+select * from t1 order by id|
select sub3((select max(i) from t2))|
drop procedure sub1|
drop procedure sub2|
@@ -388,7 +388,7 @@ while x do
end while|
call a0(3)|
-select * from t1|
+select * from t1 order by data desc|
delete from t1|
drop procedure a0|
@@ -404,7 +404,7 @@ while x > 0 do
end while|
call a(3)|
-select * from t1|
+select * from t1 order by data desc|
delete from t1|
drop procedure a|
@@ -420,7 +420,7 @@ repeat
until x = 0 end repeat|
call b(3)|
-select * from t1|
+select * from t1 order by data desc|
delete from t1|
drop procedure b|
@@ -452,7 +452,7 @@ hmm: while x > 0 do
end while hmm|
call c(3)|
-select * from t1|
+select * from t1 order by data desc|
delete from t1|
drop procedure c|
@@ -489,7 +489,7 @@ foo: loop
end loop foo|
call e(3)|
-select * from t1|
+select * from t1 order by data desc|
delete from t1|
drop procedure e|
@@ -510,7 +510,7 @@ end if|
call f(-2)|
call f(0)|
call f(4)|
-select * from t1|
+select * from t1 order by data|
delete from t1|
drop procedure f|
@@ -532,7 +532,7 @@ end case|
call g(-42)|
call g(0)|
call g(1)|
-select * from t1|
+select * from t1 order by data|
delete from t1|
drop procedure g|
@@ -554,7 +554,7 @@ end case|
call h(0)|
call h(1)|
call h(17)|
-select * from t1|
+select * from t1 order by data|
delete from t1|
drop procedure h|
@@ -588,7 +588,7 @@ drop procedure if exists sel1|
--enable_warnings
create procedure sel1()
begin
- select * from t1;
+ select * from t1 order by data;
end|
call sel1()|
@@ -599,8 +599,8 @@ drop procedure if exists sel2|
--enable_warnings
create procedure sel2()
begin
- select * from t1;
- select * from t2;
+ select * from t1 order by data;
+ select * from t2 order by s;
end|
call sel2()|
@@ -620,7 +620,7 @@ begin
end|
call into_test("into", 100)|
-select * from t1|
+select * from t1 order by data|
delete from t1|
drop procedure into_test|
@@ -637,7 +637,7 @@ begin
end|
call into_test2("into", 100)|
-select id,data,@z from t1|
+select id,data,@z from t1 order by data|
delete from t1|
drop procedure into_test2|
@@ -815,9 +815,9 @@ insert into t2 values (append("a", "b"), mul(2,mul(3,4)), fun(1.7, 4, 6))|
# Disable PS because double's give a bit different values
--disable_ps_protocol
select * from t2 where s = append("a", "b")|
-select * from t2 where i = mul(4,3) or i = mul(mul(3,4),2)|
+select * from t2 where i = mul(4,3) or i = mul(mul(3,4),2) order by i|
select * from t2 where d = e()|
-select * from t2|
+select * from t2 order by i|
--enable_ps_protocol
delete from t2|
@@ -972,8 +972,8 @@ drop procedure if exists cur2|
create procedure cur2()
begin
declare done int default 0;
- declare c1 cursor for select id,data from test.t1;
- declare c2 cursor for select i from test.t2;
+ declare c1 cursor for select id,data from test.t1 order by id,data;
+ declare c2 cursor for select i from test.t2 order by i;
declare continue handler for sqlstate '02000' set done = 1;
open c1;
@@ -999,7 +999,7 @@ begin
end|
call cur2()|
-select * from t3|
+select * from t3 order by i,s|
delete from t1|
delete from t2|
drop table t3|
@@ -1174,13 +1174,13 @@ create function f1() returns int
return (select sum(data) from t1)|
select f1()|
# This should work too (and give 2 rows as result)
-select id, f1() from t1|
+select id, f1() from t1 order by id|
# Function which uses two instances of table simultaneously
create function f2() returns int
- return (select data from t1 where data <= (select sum(data) from t1) limit 1)|
+ return (select data from t1 where data <= (select sum(data) from t1) order by data limit 1)|
select f2()|
-select id, f2() from t1|
+select id, f2() from t1 order by id|
# Function which uses the same table twice in different queries
create function f3() returns int
@@ -1192,17 +1192,17 @@ begin
return n < m;
end|
select f3()|
-select id, f3() from t1|
+select id, f3() from t1 order by id|
# Calling two functions using same table
select f1(), f3()|
-select id, f1(), f3() from t1|
+select id, f1(), f3() from t1 order by id|
# Function which uses two different tables
create function f4() returns double
return (select d from t1, t2 where t1.data = t2.i and t1.id= "b")|
select f4()|
-select s, f4() from t2|
+select s, f4() from t2 order by s|
# Recursive functions which due to this recursion require simultaneous
# access to several instance of the same table won't work
@@ -1235,7 +1235,7 @@ end|
create function f7() returns int
return (select sum(data) from t1 where data <= f1())|
select f6()|
-select id, f6() from t1|
+select id, f6() from t1 order by id|
#
# Let us test how new locking work with views
@@ -1243,12 +1243,12 @@ select id, f6() from t1|
# The most trivial view
create view v1 (a) as select f1()|
select * from v1|
-select id, a from t1, v1|
+select id, a from t1, v1 order by id|
select * from v1, v1 as v|
# A bit more complex construction
create view v2 (a) as select a*10 from v1|
select * from v2|
-select id, a from t1, v2|
+select id, a from t1, v2 order by id|
select * from v1, v2|
# Nice example where the same view is used on
@@ -1293,7 +1293,7 @@ select *, f0() from v0|
lock tables t1 read, t1 as t11 read|
# These should work well
select f3()|
-select id, f3() from t1 as t11|
+select id, f3() from t1 as t11 order by id|
# Degenerate cases work too :)
select f0()|
select * from v0|
@@ -1403,8 +1403,8 @@ drop function f12_2|
drop view v0|
drop view v1|
drop view v2|
-delete from t1 |
-delete from t2 |
+truncate table t1 |
+truncate table t2 |
drop table t4|
# End of non-bug tests
@@ -1442,11 +1442,11 @@ end|
call ifac(20)|
select * from t3|
drop table t3|
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
show function status like '%f%'|
drop procedure ifac|
drop function fac|
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
show function status like '%f%'|
@@ -1592,7 +1592,7 @@ call fib(3)|
select * from t3 order by f asc|
-delete from t3|
+truncate table t3|
# The original test, 20 levels, ran into memory limits on some machines
# and builds. Try 10 instead...
@@ -1689,7 +1689,6 @@ begin
end if;
return x;
end|
-
select * from t1 where data = getcount("bar")|
select * from t3|
select getcount("zip")|
@@ -2116,7 +2115,7 @@ delete from t1|
call bug822('foo', 42)|
call bug822('foo', 42)|
call bug822('bar', 666)|
-select * from t1|
+select * from t1 order by data|
delete from t1|
drop procedure bug822|
@@ -2144,7 +2143,7 @@ delete from t1 where id='foo'|
insert into t1 values ('bar', 7)|
call bug1495()|
delete from t1 where id='bar'|
-select * from t1|
+select * from t1 order by data|
delete from t1|
drop procedure bug1495|
@@ -2169,7 +2168,7 @@ end|
insert into t1 values ("foo", 12), ("bar", 7)|
call bug1547("foo")|
call bug1547("bar")|
-select * from t1|
+select * from t1 order by id|
delete from t1|
drop procedure bug1547|
@@ -2236,7 +2235,7 @@ end|
insert into t1 (data) values (3), (1), (5), (9), (4)|
call bug1874()|
-select * from t2|
+select * from t2 order by i|
delete from t1|
delete from t2|
drop procedure bug1874|
@@ -2940,6 +2939,7 @@ begin
show warnings;
end|
--disable_parsing
+--replace_regex /table_id: [0-9]+/table_id: #/
show binlog events|
show storage engines|
show master status|
@@ -4377,12 +4377,23 @@ drop table t3|
--disable_warnings
drop function if exists bug9048|
--enable_warnings
-create function bug9048(f1 char binary) returns char binary
+create function bug9048(f1 char binary) returns char
begin
set f1= concat( 'hello', f1 );
return f1;
end|
drop function bug9048|
+#
+# This was disabled in 5.1.12. See bug #20701
+# When collation support in SP is implemented, then this test should
+# be removed.
+#
+--error ER_NOT_SUPPORTED_YET
+create function bug9048(f1 char binary) returns char binary
+begin
+ set f1= concat( 'hello', f1 );
+ return f1;
+end|
# Bug #12849 Stored Procedure: Crash on procedure call with CHAR type
# 'INOUT' parameter
@@ -4495,9 +4506,13 @@ end|
--error 1062
select bug12379()|
select 1|
+# statement-based binlogging will show warning which row-based won't;
+# so we hide it (this warning is already tested in rpl_stm_sp.test)
+--disable_warnings
call bug12379_1()|
select 2|
call bug12379_2()|
+--enable_warnings
select 3|
--error 1062
call bug12379_3()|
@@ -4932,7 +4947,7 @@ end|
# a procedure which use tables and recursion
create table t3 (a int)|
insert into t3 values (0)|
-create view v1 as select a from t3;
+create view v1 as select a from t3|
create procedure bug10100pt(level int, lim int)
begin
if level < lim then
@@ -4955,7 +4970,7 @@ begin
end if;
end|
# dynamic sql & recursion
-prepare stmt2 from "select * from t3;";
+prepare stmt2 from "select * from t3;"|
create procedure bug10100pd(level int, lim int)
begin
if level < lim then
@@ -5228,7 +5243,7 @@ drop procedure bug5967|
#
--disable_warnings
drop procedure if exists bug13012|
---enable_warnings
+# Disable warnings also for BACKUP/RESTORE: they are deprecated.
create procedure bug13012()
BEGIN
REPAIR TABLE t1;
@@ -5237,6 +5252,7 @@ BEGIN
RESTORE TABLE t1 FROM '../tmp';
END|
call bug13012()|
+--enable_warnings
drop procedure bug13012|
create view v1 as select * from t1|
create procedure bug13012()
@@ -5249,8 +5265,8 @@ call bug13012()|
call bug13012()|
call bug13012()|
drop procedure bug13012|
-drop view v1;
-select * from t1|
+drop view v1|
+select * from t1 order by data|
#
# A test case for Bug#15392 "Server crashes during prepared statement
@@ -5627,26 +5643,6 @@ drop table t3|
drop procedure bug16887|
#
-# Bug#13575 SP funcs in select with distinct/group and order by can
-# produce bad data
-#
-# Disable warnings to allow test to run also without InnoDB
---disable_warnings
-create table t3 (f1 int, f2 varchar(3), primary key(f1)) engine=innodb|
---enable_warnings
-insert into t3 values (1,'aaa'),(2,'bbb'),(3,'ccc')|
-CREATE FUNCTION bug13575 ( p1 integer )
-returns varchar(3)
-BEGIN
-DECLARE v1 VARCHAR(10) DEFAULT null;
-SELECT f2 INTO v1 FROM t3 WHERE f1 = p1;
-RETURN v1;
-END|
-select distinct f1, bug13575(f1) from t3 order by f1|
-drop function bug13575;
-drop table t3|
-
-#
# BUG#16474: SP crashed MySQL
# (when using "order by localvar", where 'localvar' is just that.
#
@@ -5662,7 +5658,7 @@ create procedure bug16474_1()
begin
declare x int;
- select id from t1 order by x;
+ select id from t1 order by x, id;
end|
#
@@ -5682,7 +5678,7 @@ drop procedure bug14945|
# This does NOT order by column index; variable is an expression.
create procedure bug16474_2(x int)
- select id from t1 order by x|
+ select id from t1 order by x, id|
call bug16474_1()|
call bug16474_2(1)|
@@ -5692,7 +5688,7 @@ drop procedure bug16474_2|
# For reference: user variables are expressions too and do not affect ordering.
set @x = 2|
-select * from t1 order by @x|
+select * from t1 order by @x, data|
delete from t1|
@@ -6261,6 +6257,8 @@ SELECT bug19862(a) FROM t12 ORDER BY 1|
SELECT * FROM t11|
DROP TABLE t11, t12|
DROP FUNCTION bug19862|
+
+
# Bug#21002 "Derived table not selecting from a "real" table fails in JOINs"
#
# A regression caused by the fix for Bug#18444: for derived tables we should
@@ -6286,10 +6284,8 @@ use test|
drop table t3|
-#
# Test for BUG#16899: Possible buffer overflow in handling of DEFINER-clause.
#
-
# Prepare.
--disable_warnings
diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test
index 4e18e69d3d2..6335ad55606 100644
--- a/mysql-test/t/sp_notembedded.test
+++ b/mysql-test/t/sp_notembedded.test
@@ -46,6 +46,8 @@ call bug4902_2()|
drop procedure bug4902_2|
+# Disable until bug#17244 is fixed
+--disable_parsing
#
# BUG#5278: Stored procedure packets out of order if SET PASSWORD.
#
@@ -63,7 +65,7 @@ select bug5278()|
--error 1133
select bug5278()|
drop function bug5278|
-
+--enable_parsing
--disable_warnings
drop table if exists t1|
diff --git a/mysql-test/t/sp_trans.test b/mysql-test/t/sp_trans.test
index 1ea32316f1e..325e11b1ec9 100644
--- a/mysql-test/t/sp_trans.test
+++ b/mysql-test/t/sp_trans.test
@@ -552,6 +552,45 @@ drop table t3, t4|
drop procedure bug14210|
set @@session.max_heap_table_size=default|
+#
+# BUG#7787: Stored procedures: improper warning for "grant execute" statement
+#
+
+# Prepare.
+
+CREATE DATABASE db_bug7787|
+use db_bug7787|
+
+# Test.
+
+CREATE PROCEDURE p1()
+ SHOW INNODB STATUS; |
+
+GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost|
+
+# Cleanup.
+
+DROP DATABASE db_bug7787|
+drop user user_bug7787@localhost|
+use test|
+
+#
+# Bug#13575 SP funcs in select with distinct/group and order by can
+# produce bad data
+#
+create table t3 (f1 int, f2 varchar(3), primary key(f1)) engine=innodb|
+insert into t3 values (1,'aaa'),(2,'bbb'),(3,'ccc')|
+CREATE FUNCTION bug13575 ( p1 integer )
+returns varchar(3)
+BEGIN
+DECLARE v1 VARCHAR(10) DEFAULT null;
+SELECT f2 INTO v1 FROM t3 WHERE f1 = p1;
+RETURN v1;
+END|
+select distinct f1, bug13575(f1) from t3 order by f1|
+drop function bug13575|
+drop table t3|
+
#
# BUG#NNNN: New bug synopsis
diff --git a/mysql-test/t/sql_mode.test b/mysql-test/t/sql_mode.test
index 2699cb66471..8542c2b7927 100644
--- a/mysql-test/t/sql_mode.test
+++ b/mysql-test/t/sql_mode.test
@@ -209,18 +209,18 @@ SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b";
# is not available
#
-set session sql_mode = 'NO_ENGINE_SUBSTITUTION';
---error 1289
-create table t1 (a int) engine=isam;
---error 1146
-show create table t1;
-drop table if exists t1;
-
-# for comparison, lets see the warnings...
-set session sql_mode = '';
-create table t1 (a int) engine=isam;
-show create table t1;
-drop table t1;
+#set session sql_mode = 'NO_ENGINE_SUBSTITUTION';
+#--error 1289
+#create table t1 (a int) engine=isam;
+#--error 1146
+#show create table t1;
+#drop table if exists t1;
+#
+## for comparison, lets see the warnings...
+#set session sql_mode = '';
+#create table t1 (a int) engine=isam;
+#show create table t1;
+#drop table t1;
#
# Bug #6903: ANSI_QUOTES does not come into play with SHOW CREATE FUNCTION
diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test
index 1a71425d2a7..2afcd49962c 100644
--- a/mysql-test/t/status.test
+++ b/mysql-test/t/status.test
@@ -13,6 +13,7 @@ connect (con2,localhost,root,,);
flush status;
show status like 'Table_lock%';
+select * from information_schema.session_status where variable_name like 'Table_lock%';
connection con1;
SET SQL_LOG_BIN=0;
--disable_warnings
@@ -34,6 +35,7 @@ unlock tables;
connection con1;
reap;
show status like 'Table_lock%';
+select * from information_schema.session_status where variable_name like 'Table_lock%';
drop table t1;
disconnect con2;
@@ -48,6 +50,19 @@ connection default;
select 1;
show status like 'last_query_cost';
+create table t1 (a int);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+select * from t1 where a=6;
+show status like 'last_query_cost';
+# Ensure value dosn't change by second status call
+show status like 'last_query_cost';
+select 1;
+show status like 'last_query_cost';
+drop table t1;
#
# Test for Bug #15933 max_used_connections is wrong after FLUSH STATUS
@@ -89,6 +104,7 @@ while ($wait_more)
# Prerequisite.
SHOW STATUS LIKE 'max_used_connections';
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
# Save original setting.
SET @save_thread_cache_size=@@thread_cache_size;
@@ -102,6 +118,7 @@ disconnect con2;
# Check that max_used_connections still reflects maximum value.
SHOW STATUS LIKE 'max_used_connections';
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
# Check that after flush max_used_connections equals to current number
# of connections. First wait for previous disconnect to finish.
@@ -125,15 +142,18 @@ while ($wait_more)
--enable_result_log
# Check that we don't count disconnected thread any longer.
SHOW STATUS LIKE 'max_used_connections';
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
# Check that max_used_connections is updated when cached thread is
# reused...
connect (con2,localhost,root,,);
SHOW STATUS LIKE 'max_used_connections';
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
# ...and when new thread is created.
connect (con3,localhost,root,,);
SHOW STATUS LIKE 'max_used_connections';
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
# Restore original setting.
connection default;
@@ -144,3 +164,24 @@ disconnect con2;
disconnect con1;
# End of 5.0 tests
+
+#
+# Ensure that SHOW STATUS only changes global status variables
+#
+
+connect (con1,localhost,root,,);
+let $rnd_next = `show global status like 'handler_read_rnd_next'`;
+let $tmp_table = `show global status like 'Created_tmp_tables'`;
+show status like 'com_show_status';
+show status like 'hand%write%';
+show status like '%tmp%';
+show status like 'hand%write%';
+show status like '%tmp%';
+show status like 'com_show_status';
+let $rnd_next2 = `show global status like 'handler_read_rnd_next'`;
+let $tmp_table2 = `show global status like 'Created_tmp_tables'`;
+--disable_query_log
+eval select substring_index('$rnd_next2',0x9,-1)-substring_index('$rnd_next',0x9,-1) as rnd_diff, substring_index('$tmp_table2',0x9,-1)-substring_index('$tmp_table',0x9,-1) as tmp_table_diff;
+--enable_query_log
+
+# End of 5.1 tests
diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test
index 6ebbb53ed8e..ae5e4365af3 100644
--- a/mysql-test/t/strict.test
+++ b/mysql-test/t/strict.test
@@ -898,11 +898,11 @@ INSERT INTO t1 (col1,col2,col3) VALUES (NULL, '', '2004-01-01');
INSERT INTO t1 (col1,col2,col3) VALUES (102, NULL, '2004-01-01');
--error 1048
INSERT INTO t1 VALUES (103,'',NULL);
---error 1263
+--error 1048
UPDATE t1 SET col1=NULL WHERE col1 =100;
---error 1263
+--error 1048
UPDATE t1 SET col2 =NULL WHERE col2 ='hello';
---error 1263
+--error 1048
UPDATE t1 SET col2 =NULL where col3 IS NOT NULL;
INSERT IGNORE INTO t1 values (NULL,NULL,NULL);
SELECT * FROM t1;
@@ -922,7 +922,7 @@ INSERT INTO t1 (col1) VALUES (2);
INSERT INTO t1 VALUES(default(col1),default(col2));
--error 1364
INSERT INTO t1 (col1) SELECT 1;
---error 1263
+--error 1048
INSERT INTO t1 SELECT 1,NULL;
INSERT IGNORE INTO t1 values (NULL,NULL);
INSERT IGNORE INTO t1 (col1) values (3);
diff --git a/mysql-test/t/strict_autoinc_4bdb.test b/mysql-test/t/strict_autoinc_4bdb.test
deleted file mode 100644
index 10d6bfd41e7..00000000000
--- a/mysql-test/t/strict_autoinc_4bdb.test
+++ /dev/null
@@ -1,10 +0,0 @@
--- source include/have_bdb.inc
-
-#
-# Bug#20573 Strict mode auto-increment
-#
-
-let $type= 'BDB' ;
---source include/strict_autoinc.inc
-
-# end of test
diff --git a/mysql-test/t/system_mysql_db.test b/mysql-test/t/system_mysql_db.test
index 27c17da2731..e3d58ab7139 100644
--- a/mysql-test/t/system_mysql_db.test
+++ b/mysql-test/t/system_mysql_db.test
@@ -2,6 +2,10 @@
# This test must examine integrity of system database "mysql"
#
+# check that CSV engine was compiled in, as the result of the test
+# depends on the presence of the log tables (which are CSV-based).
+--source include/have_csv.inc
+
# First delete some tables maybe left over from previous tests
--disable_warnings
drop table if exists t1,t1aa,t2aa;
diff --git a/mysql-test/t/system_mysql_db_fix.test b/mysql-test/t/system_mysql_db_fix.test
index c50b641b7e2..3956e26e9cc 100644
--- a/mysql-test/t/system_mysql_db_fix.test
+++ b/mysql-test/t/system_mysql_db_fix.test
@@ -4,6 +4,10 @@
# Windows doesn't support execution of shell scripts (to fix!!)
--source include/not_windows.inc
+# check that CSV engine was compiled in, as the test relies on the presence
+# of the log tables (which are CSV-based)
+--source include/have_csv.inc
+
#
# This is the test for mysql_fix_privilege_tables
#
@@ -37,7 +41,7 @@ CREATE TABLE db (
PRIMARY KEY Host (Host,Db,User),
KEY User (User)
)
-type=ISAM;
+engine=MyISAM;
--enable_warnings
INSERT INTO db VALUES ('%','test', '','Y','Y','Y','Y','Y','Y');
@@ -55,7 +59,7 @@ CREATE TABLE host (
Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,
PRIMARY KEY Host (Host,Db)
)
-type=ISAM;
+engine=MyISAM;
--enable_warnings
--disable_warnings
@@ -74,7 +78,7 @@ CREATE TABLE user (
Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,
PRIMARY KEY Host (Host,User)
)
-type=ISAM;
+engine=MyISAM;
--enable_warnings
INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y');
@@ -89,7 +93,10 @@ INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N','
-- disable_query_log
-DROP TABLE db, host, user, func, tables_priv, columns_priv, procs_priv, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type;
+DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv,
+procs_priv, help_category, help_keyword, help_relation, help_topic, proc,
+time_zone, time_zone_leap_second, time_zone_name, time_zone_transition,
+time_zone_transition_type, general_log, slow_log, event;
-- enable_query_log
diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test
index 8cb9e34ca08..123007b10c7 100644
--- a/mysql-test/t/temp_table.test
+++ b/mysql-test/t/temp_table.test
@@ -163,3 +163,16 @@ DROP TABLE t1;
--echo End of 4.1 tests.
+
+
+#
+# Test truncate with temporary tables
+#
+
+create temporary table t1 (a int);
+insert into t1 values (4711);
+select * from t1;
+truncate t1;
+insert into t1 values (42);
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/timezone2.test b/mysql-test/t/timezone2.test
index 75e5d4bfe81..862b9cc58d1 100644
--- a/mysql-test/t/timezone2.test
+++ b/mysql-test/t/timezone2.test
@@ -69,7 +69,7 @@ set time_zone='UTC';
select * from t1;
-delete from t1;
+truncate table t1;
# Simple check for 'Europe/Moscow' time zone just for showing that it works
set time_zone='Europe/Moscow';
@@ -79,7 +79,7 @@ insert into t1 (i, ts) values
(unix_timestamp('2004-08-01 00:00:00'),'2003-08-01 00:00:00'),
(unix_timestamp('2004-10-31 02:30:00'),'2004-10-31 02:30:00');
select * from t1;
-delete from t1;
+truncate table t1;
#
@@ -94,7 +94,7 @@ insert into t1 (i, ts) values
(unix_timestamp('2004-08-01 00:00:00'),'2003-08-01 00:00:00'),
(unix_timestamp('2004-10-31 02:30:00'),'2004-10-31 02:30:00');
select * from t1;
-delete from t1;
+truncate table t1;
# Let us test leap jump
insert into t1 (i, ts) values
(unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
@@ -115,14 +115,14 @@ insert into t1 values ('0000-00-00 00:00:00'),('1969-12-31 23:59:59'),
('1970-01-01 00:00:00'),('1970-01-01 00:00:01'),
('2038-01-19 03:14:07'),('2038-01-19 03:14:08');
select * from t1;
-delete from t1;
+truncate table t1;
# MET time zone has range shifted by one hour
set time_zone='MET';
insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 00:30:00'),
('1970-01-01 01:00:00'),('1970-01-01 01:00:01'),
('2038-01-19 04:14:07'),('2038-01-19 04:14:08');
select * from t1;
-delete from t1;
+truncate table t1;
# same for +01:30 time zone
set time_zone='+01:30';
insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 01:00:00'),
diff --git a/mysql-test/t/trigger-compat.test b/mysql-test/t/trigger-compat.test
index f2e350cb161..9f7fd8bc505 100644
--- a/mysql-test/t/trigger-compat.test
+++ b/mysql-test/t/trigger-compat.test
@@ -35,8 +35,7 @@ CREATE DATABASE mysqltest_db1;
CREATE USER mysqltest_dfn@localhost;
CREATE USER mysqltest_inv@localhost;
-GRANT SUPER ON *.* TO mysqltest_dfn@localhost;
-GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
+GRANT CREATE, TRIGGER ON mysqltest_db1.* TO mysqltest_dfn@localhost;
#
# Create a table and the first trigger.
diff --git a/mysql-test/t/trigger-grant.test b/mysql-test/t/trigger-grant.test
index 12b929898a8..6dd0c83dc92 100644
--- a/mysql-test/t/trigger-grant.test
+++ b/mysql-test/t/trigger-grant.test
@@ -44,9 +44,124 @@ CREATE DATABASE mysqltest_db1;
CREATE USER mysqltest_dfn@localhost;
CREATE USER mysqltest_inv@localhost;
-GRANT SUPER ON *.* TO mysqltest_dfn@localhost;
GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
+--connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
+--connection wl2818_definer_con
+--echo
+--echo ---> connection: wl2818_definer_con
+
+CREATE TABLE t1(num_value INT);
+CREATE TABLE t2(user_str TEXT);
+
+--disconnect wl2818_definer_con
+
+--connection default
+--echo
+--echo ---> connection: default
+
+GRANT INSERT, DELETE ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
+GRANT INSERT, DELETE ON mysqltest_db1.t2 TO mysqltest_dfn@localhost;
+
+#
+# Check that the user must have TRIGGER privilege to create a trigger.
+#
+
+--connection default
+--echo
+--echo ---> connection: default
+
+GRANT SUPER ON *.* TO mysqltest_dfn@localhost;
+
+--connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
+--connection wl2818_definer_con
+--echo
+--echo ---> connection: wl2818_definer_con
+
+--error ER_TABLEACCESS_DENIED_ERROR
+CREATE TRIGGER trg1 AFTER INSERT ON t1
+ FOR EACH ROW
+ INSERT INTO t2 VALUES(CURRENT_USER());
+
+--disconnect wl2818_definer_con
+
+#
+# Check that the user must have TRIGGER privilege to drop a trigger.
+#
+
+--connection default
+--echo
+--echo ---> connection: default
+
+GRANT TRIGGER ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
+
+--connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
+--connection wl2818_definer_con
+--echo
+--echo ---> connection: wl2818_definer_con
+
+CREATE TRIGGER trg1 AFTER INSERT ON t1
+ FOR EACH ROW
+ INSERT INTO t2 VALUES(CURRENT_USER());
+
+--disconnect wl2818_definer_con
+
+--connection default
+--echo
+--echo ---> connection: default
+
+REVOKE TRIGGER ON mysqltest_db1.t1 FROM mysqltest_dfn@localhost;
+
+--connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
+--connection wl2818_definer_con
+--echo
+--echo ---> connection: wl2818_definer_con
+
+--error ER_TABLEACCESS_DENIED_ERROR
+DROP TRIGGER trg1;
+
+--disconnect wl2818_definer_con
+
+#
+# Check that the definer must have TRIGGER privilege to activate a trigger.
+#
+
+--connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
+--connection wl2818_definer_con
+--echo
+--echo ---> connection: wl2818_definer_con
+
+--error ER_TABLEACCESS_DENIED_ERROR
+INSERT INTO t1 VALUES(0);
+
+--disconnect wl2818_definer_con
+
+--connection default
+--echo
+--echo ---> connection: default
+
+GRANT TRIGGER ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
+
+--connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
+--connection wl2818_definer_con
+--echo
+--echo ---> connection: wl2818_definer_con
+
+INSERT INTO t1 VALUES(0);
+
+# Cleanup for further tests.
+DROP TRIGGER trg1;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+
+--disconnect wl2818_definer_con
+
+--connection default
+--echo
+--echo ---> connection: default
+
+REVOKE SUPER ON *.* FROM mysqltest_dfn@localhost;
+
#
# Check that triggers are executed under the authorization of the definer:
# - create two tables under "definer";
@@ -64,9 +179,6 @@ GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
--echo
--echo ---> connection: wl2818_definer_con
-CREATE TABLE t1(num_value INT);
-CREATE TABLE t2(user_str TEXT);
-
CREATE TRIGGER trg1 AFTER INSERT ON t1
FOR EACH ROW
INSERT INTO t2 VALUES(CURRENT_USER());
@@ -145,10 +257,6 @@ SELECT * FROM t2;
#
# Check DEFINER clause of CREATE TRIGGER statement.
#
-# NOTE: there is no dedicated TRIGGER privilege for CREATE TRIGGER statement.
-# SUPER privilege is used instead. I.e., if one invokes CREATE TRIGGER, it should
-# have SUPER privilege, so this test is meaningless right now.
-#
# - Check that SUPER privilege required to create a trigger with different
# definer:
# - try to create a trigger with DEFINER="definer@localhost" under
@@ -174,7 +282,26 @@ use mysqltest_db1;
DROP TRIGGER trg1;
# Check that SUPER is required to specify different DEFINER.
-# NOTE: meaningless at the moment
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+CREATE DEFINER='mysqltest_inv'@'localhost'
+ TRIGGER trg1 BEFORE INSERT ON t1
+ FOR EACH ROW
+ SET @new_sum = 0;
+
+--connection default
+--echo
+--echo ---> connection: default
+
+use mysqltest_db1;
+
+GRANT SUPER ON *.* TO mysqltest_dfn@localhost;
+
+--disconnect wl2818_definer_con
+--connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
+--connection wl2818_definer_con
+--echo
+--echo ---> connection: wl2818_definer_con
CREATE DEFINER='mysqltest_inv'@'localhost'
TRIGGER trg1 BEFORE INSERT ON t1
@@ -190,7 +317,7 @@ CREATE DEFINER='mysqltest_nonexs'@'localhost'
# Check that trg2 will not be activated.
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
+--error ER_NO_SUCH_USER
INSERT INTO t1 VALUES(6);
#
@@ -257,6 +384,7 @@ DROP USER mysqltest_inv@localhost;
DROP DATABASE mysqltest_db1;
+
###########################################################################
#
# BUG#15166: Wrong update [was: select/update] permissions required to execute
@@ -294,8 +422,7 @@ CREATE TABLE t4(col CHAR(20)); # table for "write-value" trigger
CREATE USER mysqltest_u1@localhost;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
-GRANT SUPER ON *.* TO mysqltest_u1@localhost;
-GRANT SELECT ON mysqltest_db1.t1 TO mysqltest_u1@localhost; # to allow connect
+GRANT TRIGGER ON mysqltest_db1.* TO mysqltest_u1@localhost;
SET @mysqltest_var = NULL;
@@ -311,7 +438,6 @@ SET @mysqltest_var = NULL;
use mysqltest_db1;
-REVOKE SELECT ON mysqltest_db1.t1 FROM mysqltest_u1@localhost;
GRANT DELETE ON mysqltest_db1.* TO mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -592,7 +718,7 @@ CREATE TABLE t2 (i1 INT);
CREATE USER mysqltest_dfn@localhost;
CREATE USER mysqltest_inv@localhost;
-GRANT EXECUTE, CREATE ROUTINE, SUPER ON *.* TO mysqltest_dfn@localhost;
+GRANT EXECUTE, CREATE ROUTINE, TRIGGER ON *.* TO mysqltest_dfn@localhost;
GRANT INSERT ON mysqltest_db1.* TO mysqltest_inv@localhost;
connect (definer,localhost,mysqltest_dfn,,mysqltest_db1);
diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test
index 92320648033..8242c614d0a 100644
--- a/mysql-test/t/trigger.test
+++ b/mysql-test/t/trigger.test
@@ -1193,9 +1193,9 @@ insert into t1 values
create function f2() returns int return (select max(b) from t2);
insert into t2 select a, f2() from t1;
load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1();
-drop table t1, t2;
drop function f1;
drop function f2;
+drop table t1, t2;
#
# Test for bug #16021 "Wrong index given to function in trigger" which
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index cdf73bf6c89..09576d415e5 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -98,7 +98,7 @@ insert into t1 values
select * from t1;
delete from t1;
insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
-select * from t1;
+select * from t1 order by t;
drop table t1;
#
diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test
index e4843c3b83e..1b80a15e4ff 100644
--- a/mysql-test/t/type_newdecimal.test
+++ b/mysql-test/t/type_newdecimal.test
@@ -1101,6 +1101,17 @@ select * from t1;
drop table t1;
#
+# Bug #18014: problem with 'alter table'
+#
+
+create table t1(a decimal(7,2));
+insert into t1 values(123.12);
+select * from t1;
+alter table t1 modify a decimal(10,2);
+select * from t1;
+drop table t1;
+
+#
# Bug#19667 group by a decimal expression yields wrong result
#
create table t1 (i int, j int);
@@ -1108,3 +1119,14 @@ insert into t1 values (1,1), (1,2), (2,3), (2,4);
select i, count(distinct j) from t1 group by i;
select i+0.0 as i2, count(distinct j) from t1 group by i2;
drop table t1;
+
+#
+# Bug#16172 DECIMAL data type processed incorrectly
+#
+select cast(143.481 as decimal(4,1));
+select cast(143.481 as decimal(4,0));
+select cast(143.481 as decimal(2,1));
+select cast(-3.4 as decimal(2,1));
+select cast(99.6 as decimal(2,0));
+select cast(-13.4 as decimal(2,1));
+select cast(98.6 as decimal(2,0));
diff --git a/mysql-test/t/type_ranges.test b/mysql-test/t/type_ranges.test
index 03ee91f14d8..4a897c1e440 100644
--- a/mysql-test/t/type_ranges.test
+++ b/mysql-test/t/type_ranges.test
@@ -162,7 +162,7 @@ select t1.id as id_A, t2.id as id_B from t1 left join t2 on (t1.id = t2.id);
create table t3 (id_A integer unsigned not null, id_B integer unsigned null );
insert into t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );
select * from t3;
-delete from t3;
+truncate table t3;
insert into t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 on (t1.id = t2.id);
select * from t3;
drop table t3;
diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test
index 7b4af9e0c69..27922a16a37 100644
--- a/mysql-test/t/type_timestamp.test
+++ b/mysql-test/t/type_timestamp.test
@@ -44,7 +44,7 @@ drop table t1;
create table t1 (ix timestamp);
insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000);
select ix+0 from t1;
-delete from t1;
+truncate table t1;
insert into t1 values ("19991101000000"),("19990102030405"),("19990630232922"),("19990601000000");
select ix+0 from t1;
drop table t1;
@@ -85,10 +85,10 @@ drop table t1;
create table t1 (ix timestamp);
insert into t1 values (0),(20030101010160),(20030101016001),(20030101240101),(20030132010101),(20031301010101),(20031200000000),(20030000000000);
select ix+0 from t1;
-delete from t1;
+truncate table t1;
insert into t1 values ("00000000000000"),("20030101010160"),("20030101016001"),("20030101240101"),("20030132010101"),("20031301010101"),("20031200000000"),("20030000000000");
select ix+0 from t1;
-delete from t1;
+truncate table t1;
insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
select ix+0 from t1;
drop table t1;
@@ -189,7 +189,7 @@ insert into t1 (t1) values (default);
select * from t1;
show create table t1;
show columns from t1;
-delete from t1;
+truncate table t1;
#
# Let us test some cases when auto-set should be disabled or influence
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index bf5c5e066f0..2bdf8420d6d 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -774,6 +774,7 @@ drop table t1,t2;
#
# correct conversion long string to TEXT (BUG#10025)
#
+
CREATE TABLE t1 (a mediumtext);
CREATE TABLE t2 (b varchar(20));
INSERT INTO t1 VALUES ('a'),('b');
@@ -783,6 +784,50 @@ show create table t3;
drop tables t1,t2,t3;
#
+# Extended fix to Bug#10025 - the test above should result to mediumtext
+# and the one below to longtext. Earlier above test resulted to longtext
+# type also.
+#
+
+CREATE TABLE t1 (a longtext);
+CREATE TABLE t2 (b varchar(20));
+INSERT INTO t1 VALUES ('a'),('b');
+SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2;
+create table t3 SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2;
+show create table t3;
+drop tables t1,t2,t3;
+
+#
+# Testing here that mediumtext converts into longtext if the result
+# exceeds mediumtext maximum length
+#
+
+SELECT @tmp_max:= @@max_allowed_packet;
+SET max_allowed_packet=25000000;
+CREATE TABLE t1 (a mediumtext);
+CREATE TABLE t2 (b varchar(20));
+INSERT INTO t1 VALUES ('a');
+CREATE TABLE t3 SELECT REPEAT(a,20000000) AS a FROM t1 UNION SELECT b FROM t2;
+SHOW CREATE TABLE t3;
+DROP TABLES t1,t3;
+CREATE TABLE t1 (a tinytext);
+INSERT INTO t1 VALUES ('a');
+CREATE TABLE t3 SELECT REPEAT(a,2) AS a FROM t1 UNION SELECT b FROM t2;
+SHOW CREATE TABLE t3;
+DROP TABLES t1,t3;
+CREATE TABLE t1 (a mediumtext);
+INSERT INTO t1 VALUES ('a');
+CREATE TABLE t3 SELECT REPEAT(a,2) AS a FROM t1 UNION SELECT b FROM t2;
+SHOW CREATE TABLE t3;
+DROP TABLES t1,t3;
+CREATE TABLE t1 (a tinyblob);
+INSERT INTO t1 VALUES ('a');
+CREATE TABLE t3 SELECT REPEAT(a,2) AS a FROM t1 UNION SELECT b FROM t2;
+SHOW CREATE TABLE t3;
+DROP TABLES t1,t2,t3;
+SET max_allowed_packet:= @tmp_max;
+
+#
# Bug #10032 Bug in parsing UNION with ORDER BY when one node does not use FROM
#
diff --git a/mysql-test/t/unsafe_binlog_innodb-master.opt b/mysql-test/t/unsafe_binlog_innodb-master.opt
new file mode 100644
index 00000000000..9581c225d6d
--- /dev/null
+++ b/mysql-test/t/unsafe_binlog_innodb-master.opt
@@ -0,0 +1 @@
+--innodb_locks_unsafe_for_binlog=true --innodb_lock_wait_timeout=1
diff --git a/mysql-test/t/unsafe_binlog_innodb.test b/mysql-test/t/unsafe_binlog_innodb.test
new file mode 100644
index 00000000000..a0516749451
--- /dev/null
+++ b/mysql-test/t/unsafe_binlog_innodb.test
@@ -0,0 +1,16 @@
+# t/unsafe_binlog_innodb.test
+#
+# Note that this test uses at least in case of InnoDB options
+# innodb_locks_unsafe_for_binlog = true
+# innodb_lock_timeout = 5
+#
+# Last update:
+# 2006-08-02 ML test refactored
+# old name was innodb_unsafe_binlog.test
+# main code went into include/unsafe_binlog.inc
+#
+
+--source include/have_innodb.inc
+let $engine_type= InnoDB;
+
+--source include/unsafe_binlog.inc
diff --git a/mysql-test/t/upgrade.test b/mysql-test/t/upgrade.test
new file mode 100644
index 00000000000..5c5046cf7e9
--- /dev/null
+++ b/mysql-test/t/upgrade.test
@@ -0,0 +1,49 @@
+-- source include/not_embedded.inc
+
+--disable_warnings
+drop database if exists `mysqltest1`;
+drop database if exists `mysqltest-1`;
+drop database if exists `#mysql50#mysqltest-1`;
+--enable_warnings
+
+create database `mysqltest1`;
+create database `#mysql50#mysqltest-1`;
+create table `mysqltest1`.`t1` (a int);
+create table `mysqltest1`.`#mysql50#t-1` (a int);
+create table `#mysql50#mysqltest-1`.`t1` (a int);
+create table `#mysql50#mysqltest-1`.`#mysql50#t-1` (a int);
+show create database `mysqltest1`;
+--error 1049
+show create database `mysqltest-1`;
+show create database `#mysql50#mysqltest-1`;
+show tables in `mysqltest1`;
+show tables in `#mysql50#mysqltest-1`;
+
+--exec $MYSQL_CHECK --all-databases --fix-db-names --fix-table-names
+
+show create database `mysqltest1`;
+show create database `mysqltest-1`;
+--error 1049
+show create database `#mysql50#mysqltest-1`;
+show tables in `mysqltest1`;
+show tables in `mysqltest-1`;
+drop database `mysqltest1`;
+drop database `mysqltest-1`;
+
+#
+# Bug#17142: Crash if create with encoded name
+#
+--disable_warnings
+drop table if exists `txu@0023p@0023p1`;
+drop table if exists `txu#p#p1`;
+--enable_warnings
+create table `txu#p#p1` (s1 int);
+insert into `txu#p#p1` values (1);
+--error 1146
+select * from `txu@0023p@0023p1`;
+create table `txu@0023p@0023p1` (s1 int);
+insert into `txu@0023p@0023p1` values (2);
+select * from `txu@0023p@0023p1`;
+select * from `txu#p#p1`;
+drop table `txu@0023p@0023p1`;
+drop table `txu#p#p1`;
diff --git a/mysql-test/t/user_var-binlog.test b/mysql-test/t/user_var-binlog.test
index 12a5e616fa2..6615e48ca42 100644
--- a/mysql-test/t/user_var-binlog.test
+++ b/mysql-test/t/user_var-binlog.test
@@ -1,3 +1,6 @@
+# Requires statement logging
+-- source include/have_binlog_format_mixed_or_statement.inc
+# TODO: Create row based version once $MYSQL_BINLOG has new RB version
# Embedded server does not support binlogging
--source include/not_embedded.inc
@@ -10,7 +13,9 @@ INSERT INTO t1 VALUES(@`a b`);
set @var1= "';aaa";
SET @var2=char(ascii('a'));
insert into t1 values (@var1),(@var2);
-show binlog events from 98;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
+show binlog events from 102;
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
# absolutely need variables names to be quoted and strings to be
# escaped).
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index d855b4d8266..7cbc7ee153b 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -83,16 +83,24 @@ drop table t1;
set GLOBAL max_join_size=10;
set max_join_size=100;
show variables like 'max_join_size';
+select * from information_schema.session_variables where variable_name like 'max_join_size';
--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
show global variables like 'max_join_size';
+--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
+select * from information_schema.global_variables where variable_name like 'max_join_size';
set GLOBAL max_join_size=2000;
show global variables like 'max_join_size';
+select * from information_schema.global_variables where variable_name like 'max_join_size';
set max_join_size=DEFAULT;
--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
show variables like 'max_join_size';
+--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
+select * from information_schema.session_variables where variable_name like 'max_join_size';
set GLOBAL max_join_size=DEFAULT;
--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
show global variables like 'max_join_size';
+--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
+select * from information_schema.global_variables where variable_name like 'max_join_size';
set @@max_join_size=1000, @@global.max_join_size=2000;
select @@local.max_join_size, @@global.max_join_size;
select @@identity, length(@@version)>0;
@@ -106,50 +114,68 @@ set big_tables=OFF, big_tables=ON, big_tables=0, big_tables=1, big_tables="OFF",
set global concurrent_insert=2;
show variables like 'concurrent_insert';
+select * from information_schema.session_variables where variable_name like 'concurrent_insert';
set global concurrent_insert=1;
show variables like 'concurrent_insert';
+select * from information_schema.session_variables where variable_name like 'concurrent_insert';
set global concurrent_insert=0;
show variables like 'concurrent_insert';
+select * from information_schema.session_variables where variable_name like 'concurrent_insert';
set global concurrent_insert=DEFAULT;
select @@concurrent_insert;
set global timed_mutexes=ON;
show variables like 'timed_mutexes';
+select * from information_schema.session_variables where variable_name like 'timed_mutexes';
set global timed_mutexes=0;
show variables like 'timed_mutexes';
+select * from information_schema.session_variables where variable_name like 'timed_mutexes';
set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="MERGE";
show local variables like 'storage_engine';
+select * from information_schema.session_variables where variable_name like 'storage_engine';
show global variables like 'storage_engine';
+select * from information_schema.global_variables where variable_name like 'storage_engine';
set GLOBAL query_cache_size=100000;
set GLOBAL myisam_max_sort_file_size=2000000;
show global variables like 'myisam_max_sort_file_size';
+select * from information_schema.global_variables where variable_name like 'myisam_max_sort_file_size';
set GLOBAL myisam_max_sort_file_size=default;
--replace_result 2147483647 FILE_SIZE 9223372036854775807 FILE_SIZE
show variables like 'myisam_max_sort_file_size';
+--replace_result 2147483647 FILE_SIZE 9223372036854775807 FILE_SIZE
+select * from information_schema.session_variables where variable_name like 'myisam_max_sort_file_size';
set global net_retry_count=10, session net_retry_count=10;
set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600;
show global variables like 'net_%';
+select * from information_schema.global_variables where variable_name like 'net_%';
show session variables like 'net_%';
+select * from information_schema.session_variables where variable_name like 'net_%';
set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
show global variables like 'net_%';
+select * from information_schema.global_variables where variable_name like 'net_%';
show session variables like 'net_%';
+select * from information_schema.session_variables where variable_name like 'net_%';
set net_buffer_length=1;
show variables like 'net_buffer_length';
+select * from information_schema.session_variables where variable_name like 'net_buffer_length';
set net_buffer_length=2000000000;
show variables like 'net_buffer_length';
+select * from information_schema.session_variables where variable_name like 'net_buffer_length';
set character set cp1251_koi8;
show variables like "character_set_client";
+select * from information_schema.session_variables where variable_name like 'character_set_client';
select @@timestamp>0;
set @@rand_seed1=10000000,@@rand_seed2=1000000;
select ROUND(RAND(),5);
show variables like '%alloc%';
+select * from information_schema.session_variables where variable_name like '%alloc%';
set @@range_alloc_block_size=1024*16;
set @@query_alloc_block_size=1024*17+2;
set @@query_prealloc_size=1024*18;
@@ -157,10 +183,12 @@ set @@transaction_alloc_block_size=1024*20-1;
set @@transaction_prealloc_size=1024*21-1;
select @@query_alloc_block_size;
show variables like '%alloc%';
+select * from information_schema.session_variables where variable_name like '%alloc%';
set @@range_alloc_block_size=default;
set @@query_alloc_block_size=default, @@query_prealloc_size=default;
set transaction_alloc_block_size=default, @@transaction_prealloc_size=default;
show variables like '%alloc%';
+select * from information_schema.session_variables where variable_name like '%alloc%';
#
# Bug #10904 Illegal mix of collations between
@@ -292,7 +320,7 @@ set sql_select_limit=1;
# reset it, so later tests don't get confused
set sql_select_limit=default;
set sql_warnings=1;
-set global table_cache=100;
+set global table_open_cache=100;
set storage_engine=myisam;
set global thread_cache_size=100;
set timestamp=1, timestamp=default;
@@ -363,6 +391,8 @@ set global ft_boolean_syntax = @@init_connect;
set global myisam_max_sort_file_size=4294967296;
--replace_result 4294967296 MAX_FILE_SIZE 2146435072 MAX_FILE_SIZE
show global variables like 'myisam_max_sort_file_size';
+--replace_result 4294967296 MAX_FILE_SIZE 2146435072 MAX_FILE_SIZE
+select * from information_schema.global_variables where variable_name like 'myisam_max_sort_file_size';
set global myisam_max_sort_file_size=default;
#
@@ -398,12 +428,16 @@ SELECT @@global.local.key_buffer_size;
# BUG#5135: cannot turn on log_warnings with SET in 4.1 (and 4.0)
set @tstlw = @@log_warnings;
show global variables like 'log_warnings';
+select * from information_schema.global_variables where variable_name like 'log_warnings';
set global log_warnings = 0;
show global variables like 'log_warnings';
+select * from information_schema.global_variables where variable_name like 'log_warnings';
set global log_warnings = 42;
show global variables like 'log_warnings';
+select * from information_schema.global_variables where variable_name like 'log_warnings';
set global log_warnings = @tstlw;
show global variables like 'log_warnings';
+select * from information_schema.global_variables where variable_name like 'log_warnings';
#
# BUG#4788 show create table provides incorrect statement
@@ -435,14 +469,16 @@ drop table t1;
SET GLOBAL MYISAM_DATA_POINTER_SIZE= 7;
SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
+SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'MYISAM_DATA_POINTER_SIZE';
#
# Bug #6958: negative arguments to integer options wrap around
#
-SET GLOBAL table_cache=-1;
-SHOW VARIABLES LIKE 'table_cache';
-SET GLOBAL table_cache=DEFAULT;
+SET GLOBAL table_open_cache=-1;
+SHOW VARIABLES LIKE 'table_open_cache';
+SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'table_open_cache';
+SET GLOBAL table_open_cache=DEFAULT;
#
# Bugs12363: character_set_results is nullable,
@@ -527,6 +563,7 @@ select @@global.character_set_filesystem;
set @old_sql_big_selects = @@sql_big_selects;
set @@sql_big_selects = 1;
show variables like 'sql_big_selects';
+select * from information_schema.session_variables where variable_name like 'sql_big_selects';
set @@sql_big_selects = @old_sql_big_selects;
#
@@ -535,10 +572,14 @@ set @@sql_big_selects = @old_sql_big_selects;
#
set @@sql_notes = 0, @@sql_warnings = 0;
show variables like 'sql_notes';
+select * from information_schema.session_variables where variable_name like 'sql_notes';
show variables like 'sql_warnings';
+select * from information_schema.session_variables where variable_name like 'sql_warnings';
set @@sql_notes = 1, @@sql_warnings = 1;
show variables like 'sql_notes';
+select * from information_schema.session_variables where variable_name like 'sql_notes';
show variables like 'sql_warnings';
+select * from information_schema.session_variables where variable_name like 'sql_warnings';
#
# Bug #12792: @@system_time_zone is not SELECTable.
@@ -565,9 +606,15 @@ select @@basedir, @@datadir, @@tmpdir;
--replace_column 2 #
show variables like 'basedir';
--replace_column 2 #
+select * from information_schema.session_variables where variable_name like 'basedir';
+--replace_column 2 #
show variables like 'datadir';
--replace_column 2 #
+select * from information_schema.session_variables where variable_name like 'datadir';
+--replace_column 2 #
show variables like 'tmpdir';
+--replace_column 2 #
+select * from information_schema.session_variables where variable_name like 'tmpdir';
#
# Bug #19606: make ssl settings available via SHOW VARIABLES and @@variables
@@ -577,6 +624,8 @@ show variables like 'tmpdir';
select @@ssl_ca, @@ssl_capath, @@ssl_cert, @@ssl_cipher, @@ssl_key;
--replace_column 2 #
show variables like 'ssl%';
+--replace_column 2 #
+select * from information_schema.session_variables where variable_name like 'ssl%';
#
# Bug #19616: make log_queries_not_using_indexes available in SHOW VARIABLES
@@ -584,6 +633,7 @@ show variables like 'ssl%';
#
select @@log_queries_not_using_indexes;
show variables like 'log_queries_not_using_indexes';
+select * from information_schema.session_variables where variable_name like 'log_queries_not_using_indexes';
#
# Bug#20908: Crash if select @@""
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 8473458ae15..fa3ddd28489 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -350,13 +350,13 @@ create view v3 (x,y,z) as select b, a, b from t1;
create view v4 (x,y,z) as select c+1, b, a from t1;
create algorithm=temptable view v5 (x,y,z) as select c, b, a from t1;
# try insert to VIEW with fields duplicate
--- error 1471
+-- error ER_NON_INSERTABLE_TABLE
insert into v3 values (-60,4,30);
# try insert to VIEW with expression in SELECT list
--- error 1471
+-- error ER_NON_INSERTABLE_TABLE
insert into v4 values (-60,4,30);
# try insert to VIEW using temporary table algorithm
--- error 1471
+-- error ER_NON_INSERTABLE_TABLE
insert into v5 values (-60,4,30);
insert into v1 values (-60,4,30);
insert into v1 (z,y,x) values (50,6,-100);
@@ -378,13 +378,13 @@ create view v3 (x,y,z) as select b, a, b from t1;
create view v4 (x,y,z) as select c+1, b, a from t1;
create algorithm=temptable view v5 (x,y,z) as select c, b, a from t1;
# try insert to VIEW with fields duplicate
--- error 1471
+-- error ER_NON_INSERTABLE_TABLE
insert into v3 select c, b, a from t2;
# try insert to VIEW with expression in SELECT list
--- error 1471
+-- error ER_NON_INSERTABLE_TABLE
insert into v4 select c, b, a from t2;
# try insert to VIEW using temporary table algorithm
--- error 1471
+-- error ER_NON_INSERTABLE_TABLE
insert into v5 select c, b, a from t2;
insert into v1 select c, b, a from t2;
insert into v1 (z,y,x) select a+20,b+2,-100 from t2;
@@ -698,11 +698,11 @@ drop function `f``1`;
#
# tested problem when function name length close to ALIGN_SIZE
#
-create function x () returns int return 5;
-create view v1 as select x ();
+create function a() returns int return 5;
+create view v1 as select a();
select * from v1;
drop view v1;
-drop function x;
+drop function a;
#
# VIEW with collation
@@ -1027,18 +1027,18 @@ create table t2 (a int);
insert into t2 values (2),(3),(0);
# INSERT SELECT with ignore test
insert ignore into v1 SELECT a from t2;
-select * from t1;
+select * from t1 order by a desc;
#simple UPDATE test
update v1 set a=-1 where a=0;
-- error 1369
update v1 set a=2 where a=1;
-select * from t1;
+select * from t1 order by a desc;
# prepare data for next check
update v1 set a=0 where a=0;
insert into t2 values (1);
# multiupdate test
update v1,t2 set v1.a=v1.a-1 where v1.a=t2.a;
-select * from t1;
+select * from t1 order by a desc;
# prepare data for next check
update v1 set a=a+1;
# multiupdate with ignore test
@@ -1218,8 +1218,8 @@ select * from t1;
select * from v1;
delete from t1;
load data infile '../std_data_ln/loaddata3.dat' ignore into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
-select * from t1;
-select * from v1;
+select * from t1 order by a,b;
+select * from v1 order by a,b;
drop view v1;
drop table t1;
# variable length fields
@@ -1241,14 +1241,14 @@ drop table t1;
#
create table t1 (s1 smallint);
create view v1 as select * from t1 where 20 < (select (s1) from t1);
--- error 1471
+-- error ER_NON_INSERTABLE_TABLE
insert into v1 values (30);
create view v2 as select * from t1;
create view v3 as select * from t1 where 20 < (select (s1) from v2);
--- error 1471
+-- error ER_NON_INSERTABLE_TABLE
insert into v3 values (30);
create view v4 as select * from v2 where 20 < (select (s1) from t1);
--- error 1471
+-- error ER_NON_INSERTABLE_TABLE
insert into v4 values (30);
drop view v4, v3, v2, v1;
drop table t1;
@@ -2067,6 +2067,7 @@ order by users_names;
drop view v1, v2;
drop table t1, t2;
+#
# Bug #6808 - Views: CREATE VIEW v ... FROM t AS v fails
#
@@ -2430,7 +2431,7 @@ DROP TABLE t1, t2;
#
# Bug #16069: VIEW does return the same results as underlying SELECT
# with WHERE condition containing BETWEEN over dates
-
+# Dates as strings should be casted to date type
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY,
td date DEFAULT NULL, KEY idx(td));
@@ -2589,7 +2590,6 @@ SELECT * FROM t2;
DROP VIEW v1;
DROP TABLE t1,t2;
-
#
# Bug#16110: insert permitted into view col w/o default value
#
@@ -2849,7 +2849,7 @@ DROP TABLE t1;
#
create table t1 (s1 int);
create view v1 as select s1 as a, s1 as b from t1;
---error 1471
+--error ER_NON_INSERTABLE_TABLE
insert into v1 values (1,1);
update v1 set a = 5;
drop view v1;
@@ -2873,7 +2873,6 @@ SHOW CREATE VIEW v1;
DROP VIEW v1;
DROP TABLE t1, t2;
-
#
# Bug#19111: TRIGGERs selecting from a VIEW on the firing base table
# fail
@@ -2907,7 +2906,6 @@ DROP FUNCTION f1;
DROP VIEW v1;
DROP TABLE t1;
-#
# Bug #16813 (WITH CHECK OPTION doesn't work with UPDATE)
#
CREATE TABLE t1(id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, val INT UNSIGNED NOT NULL);
diff --git a/mysql-test/t/view_grant.test b/mysql-test/t/view_grant.test
index 9a4b75add13..ecd10384870 100644
--- a/mysql-test/t/view_grant.test
+++ b/mysql-test/t/view_grant.test
@@ -1,6 +1,12 @@
# Can't test with embedded server
-- source include/not_embedded.inc
+--disable_warnings
+drop database if exists mysqltest;
+drop view if exists v1,v2,v3;
+--enable_warnings
+
+
# simple test of grants
grant create view on test.* to test@localhost;
show grants for test@localhost;
diff --git a/mysql-test/t/wait_timeout.test b/mysql-test/t/wait_timeout.test
index 67ed8fedfeb..bdff72cdc76 100644
--- a/mysql-test/t/wait_timeout.test
+++ b/mysql-test/t/wait_timeout.test
@@ -42,6 +42,9 @@ while (!`select @aborted_clients`)
}
}
--enable_query_log
+# The server has disconnected, add small sleep to make sure
+# the disconnect has reached client
+sleep 1;
connection default;
# When the connection is closed in this way, the error code should
@@ -86,6 +89,9 @@ while (!`select @aborted_clients`)
}
}
--enable_query_log
+# The server has disconnected, add small sleep to make sure
+# the disconnect has reached client
+sleep 1;
connection con1;
# When the connection is closed in this way, the error code should
diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test
index 5e9d25aa09b..a8b8e5f5103 100644
--- a/mysql-test/t/warnings.test
+++ b/mysql-test/t/warnings.test
@@ -113,23 +113,14 @@ show variables like 'max_error_count';
# Test for handler type
#
drop table t1;
-create table t1 (id int) engine=isam;
-alter table t1 engine=isam;
-drop table t1;
-
+#create table t1 (id int) engine=isam;
+#alter table t1 engine=isam;
+#drop table t1;
create table t1 (id int) engine=merge;
alter table t1 engine=merge;
drop table t1;
#
-# Test for deprecated TYPE= syntax
-#
-
-create table t1 (id int) type=heap;
-alter table t1 type=myisam;
-drop table t1;
-
-#
# Test for deprecated table_type variable
#
set table_type=MYISAM;
diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test
new file mode 100644
index 00000000000..3347573b4b7
--- /dev/null
+++ b/mysql-test/t/xml.test
@@ -0,0 +1,378 @@
+SET @xml='<a aa1="aa1" aa2="aa2">a1<b ba1="ba1">b1<c>c1</c>b2</b>a2</a>';
+SELECT extractValue(@xml,'/a');
+SELECT extractValue(@xml,'/a/b');
+SELECT extractValue(@xml,'/a/b/c');
+SELECT extractValue(@xml,'/a/@aa1');
+SELECT extractValue(@xml,'/a/@aa2');
+SELECT extractValue(@xml,'/a/@*');
+SELECT extractValue(@xml,'//@ba1');
+
+SELECT extractValue(@xml,'//a');
+SELECT extractValue(@xml,'//b');
+SELECT extractValue(@xml,'//c');
+SELECT extractValue(@xml,'/a//b');
+SELECT extractValue(@xml,'/a//c');
+SELECT extractValue(@xml,'//*');
+SELECT extractValue(@xml,'/a//*');
+SELECT extractValue(@xml,'/./a');
+SELECT extractValue(@xml,'/a/b/.');
+SELECT extractValue(@xml,'/a/b/..');
+SELECT extractValue(@xml,'/a/b/../@aa1');
+SELECT extractValue(@xml,'/*');
+SELECT extractValue(@xml,'/*/*');
+SELECT extractValue(@xml,'/*/*/*');
+
+SELECT extractValue(@xml,'/a/child::*');
+SELECT extractValue(@xml,'/a/self::*');
+SELECT extractValue(@xml,'/a/descendant::*');
+SELECT extractValue(@xml,'/a/descendant-or-self::*');
+SELECT extractValue(@xml,'/a/attribute::*');
+SELECT extractValue(@xml,'/a/b/c/parent::*');
+SELECT extractValue(@xml,'/a/b/c/ancestor::*');
+SELECT extractValue(@xml,'/a/b/c/ancestor-or-self::*');
+SELECT extractValue(@xml,'/descendant-or-self::*');
+
+SET @xml='<a>a11<b ba="ba11" ba="ba12">b11</b><b ba="ba21" ba="ba22">b21<c>c1</c>b22</b>a12</a>';
+SELECT extractValue(@xml,'/a/b/c/ancestor-or-self::*');
+SELECT extractValue(@xml,'//@ba');
+
+SET @xml='<a><b>b</b><c>c</c></a>';
+SELECT extractValue(@xml,'/a/b');
+SELECT extractValue(@xml,'/a/c');
+SELECT extractValue(@xml,'/a/child::b');
+SELECT extractValue(@xml,'/a/child::c');
+
+SET @xml='<a><b>b1</b><c>c1</c><b>b2</b><c>c2</c></a>';
+SELECT extractValue(@xml,'/a/b[1]');
+SELECT extractValue(@xml,'/a/b[2]');
+SELECT extractValue(@xml,'/a/c[1]');
+SELECT extractValue(@xml,'/a/c[2]');
+
+SET @xml='<a><b x="xb1" x="xb2"/><c x="xc1" x="xc2"/></a>';
+SELECT extractValue(@xml,'/a//@x');
+SELECT extractValue(@xml,'/a//@x[1]');
+SELECT extractValue(@xml,'/a//@x[2]');
+
+SET @xml='<a><b>b1</b><b>b2</b><c><b>c1b1</b><b>c1b2</b></c><c><b>c2b1</c></b></a>';
+SELECT extractValue(@xml,'//b[1]');
+SELECT extractValue(@xml,'/descendant::b[1]');
+
+SET @xml='<a><b>b1</b><b>b2</b></a>';
+SELECT extractValue(@xml,'/a/b[1+0]');
+SELECT extractValue(@xml,'/a/b[1*1]');
+SELECT extractValue(@xml,'/a/b[--1]');
+SELECT extractValue(@xml,'/a/b[2*1-1]');
+
+SELECT extractValue(@xml,'/a/b[1+1]');
+SELECT extractValue(@xml,'/a/b[1*2]');
+SELECT extractValue(@xml,'/a/b[--2]');
+SELECT extractValue(@xml,'/a/b[1*(3-1)]');
+
+SELECT extractValue(@xml,'//*[1=1]');
+SELECT extractValue(@xml,'//*[1!=1]');
+SELECT extractValue(@xml,'//*[1>1]');
+SELECT extractValue(@xml,'//*[2>1]');
+SELECT extractValue(@xml,'//*[1>2]');
+SELECT extractValue(@xml,'//*[1>=1]');
+SELECT extractValue(@xml,'//*[2>=1]');
+SELECT extractValue(@xml,'//*[1>=2]');
+SELECT extractValue(@xml,'//*[1<1]');
+SELECT extractValue(@xml,'//*[2<1]');
+SELECT extractValue(@xml,'//*[1<2]');
+SELECT extractValue(@xml,'//*[1<=1]');
+SELECT extractValue(@xml,'//*[2<=1]');
+SELECT extractValue(@xml,'//*[1<=2]');
+
+SET @xml='<a><b>b11<c>c11</c></b><b>b21<c>c21</c></b></a>';
+SELECT extractValue(@xml,'/a/b[c="c11"]');
+SELECT extractValue(@xml,'/a/b[c="c21"]');
+
+SET @xml='<a><b c="c11">b11</b><b c="c21">b21</b></a>';
+SELECT extractValue(@xml,'/a/b[@c="c11"]');
+SELECT extractValue(@xml,'/a/b[@c="c21"]');
+
+SET @xml='<a>a1<b c="c11">b11<d>d11</d></b><b c="c21">b21<d>d21</d></b></a>';
+SELECT extractValue(@xml, '/a/b[@c="c11"]/d');
+SELECT extractValue(@xml, '/a/b[@c="c21"]/d');
+SELECT extractValue(@xml, '/a/b[d="d11"]/@c');
+SELECT extractValue(@xml, '/a/b[d="d21"]/@c');
+SELECT extractValue(@xml, '/a[b="b11"]');
+SELECT extractValue(@xml, '/a[b/@c="c11"]');
+SELECT extractValue(@xml, '/a[b/d="d11"]');
+SELECT extractValue(@xml, '/a[/a/b="b11"]');
+SELECT extractValue(@xml, '/a[/a/b/@c="c11"]');
+SELECT extractValue(@xml, '/a[/a/b/d="d11"]');
+
+SELECT extractValue('<a>a</a>', '/a[false()]');
+SELECT extractValue('<a>a</a>', '/a[true()]');
+SELECT extractValue('<a>a</a>', '/a[not(false())]');
+SELECT extractValue('<a>a</a>', '/a[not(true())]');
+SELECT extractValue('<a>a</a>', '/a[true() and true()]');
+SELECT extractValue('<a>a</a>', '/a[true() and false()]');
+SELECT extractValue('<a>a</a>', '/a[false()and false()]');
+SELECT extractValue('<a>a</a>', '/a[false()and true()]');
+SELECT extractValue('<a>a</a>', '/a[true() or true()]');
+SELECT extractValue('<a>a</a>', '/a[true() or false()]');
+SELECT extractValue('<a>a</a>', '/a[false()or false()]');
+SELECT extractValue('<a>a</a>', '/a[false()or true()]');
+
+SET @xml='<a>ab<b c="c" c="e">b1</b><b c="d">b2</b><b c="f" c="e">b3</b></a>';
+select extractValue(@xml,'/a/b[@c="c"]');
+select extractValue(@xml,'/a/b[@c="d"]');
+select extractValue(@xml,'/a/b[@c="e"]');
+select extractValue(@xml,'/a/b[not(@c="e")]');
+select extractValue(@xml,'/a/b[@c!="e"]');
+select extractValue(@xml,'/a/b[@c="c" or @c="d"]');
+select extractValue(@xml,'/a/b[@c="c" and @c="e"]');
+
+SET @xml='<a><b c="c" d="d">b1</b><b d="d" e="e">b2</b></a>';
+select extractValue(@xml,'/a/b[@c]');
+select extractValue(@xml,'/a/b[@d]');
+select extractValue(@xml,'/a/b[@e]');
+select extractValue(@xml,'/a/b[not(@c)]');
+select extractValue(@xml,'/a/b[not(@d)]');
+select extractValue(@xml,'/a/b[not(@e)]');
+
+select extractValue(@xml, '/a/b[boolean(@c) or boolean(@d)]');
+select extractValue(@xml, '/a/b[boolean(@c) or boolean(@e)]');
+select extractValue(@xml, '/a/b[boolean(@d) or boolean(@e)]');
+select extractValue(@xml, '/a/b[boolean(@c) and boolean(@d)]');
+select extractValue(@xml, '/a/b[boolean(@c) and boolean(@e)]');
+select extractValue(@xml, '/a/b[boolean(@d) and boolean(@e)]');
+
+select extractValue(@xml, '/a/b[@c or @d]');
+select extractValue(@xml, '/a/b[@c or @e]');
+select extractValue(@xml, '/a/b[@d or @e]');
+select extractValue(@xml, '/a/b[@c and @d]');
+select extractValue(@xml, '/a/b[@c and @e]');
+select extractValue(@xml, '/a/b[@d and @e]');
+
+SET @xml='<a><b c="c">b1</b><b>b2</b></a>';
+SELECT extractValue(@xml,'/a/b[@*]');
+SELECT extractValue(@xml,'/a/b[not(@*)]');
+
+SELECT extractValue('<a>a</a>', '/a[ceiling(3.1)=4]');
+SELECT extractValue('<a>a</a>', '/a[floor(3.1)=3]');
+SELECT extractValue('<a>a</a>', '/a[round(3.1)=3]');
+SELECT extractValue('<a>a</a>', '/a[round(3.8)=4]');
+
+SELECT extractValue('<a><b>b</b><c>c</c></a>', '/a/b | /a/c');
+
+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=1]');
+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=2]');
+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=3]');
+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[1=position()]');
+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[2=position()]');
+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[3=position()]');
+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[2>=position()]');
+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[2<=position()]');
+select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=3 or position()=2]');
+
+SELECT extractValue('<a>a<b>a1<c>c1</c></b><b>a2</b></a>','/a/b[count(c)=0]');
+SELECT extractValue('<a>a<b>a1<c>c1</c></b><b>a2</b></a>','/a/b[count(c)=1]');
+select extractValue('<a>a1<b ba="1" ba="2">b1</b><b>b2</b>4</a>','/a/b[sum(@ba)=3]');
+
+select extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[1]');
+select extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[boolean(1)]');
+select extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[true()]');
+select extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[number(true())]');
+
+select extractValue('<a>ab</a>','/a[contains("abc","b")]');
+select extractValue('<a>ab</a>','/a[contains(.,"a")]');
+select extractValue('<a>ab</a>','/a[contains(.,"b")]');
+select extractValue('<a>ab</a>','/a[contains(.,"c")]');
+
+select extractValue('<a b="1">ab</a>','/a[concat(@b,"2")="12"]');
+
+SET @xml='<a b="11" b="12" b="21" b="22">ab</a>';
+select extractValue(@xml, '/a/@b[substring(.,2)="1"]');
+select extractValue(@xml, '/a/@b[substring(.,2)="2"]');
+select extractValue(@xml, '/a/@b[substring(.,1,1)="1"]');
+select extractValue(@xml, '/a/@b[substring(.,1,1)="2"]');
+select extractValue(@xml, '/a/@b[substring(.,2,1)="1"]');
+select extractValue(@xml, '/a/@b[substring(.,2,1)="2"]');
+
+#
+# Bug#16319: XML: extractvalue() returns syntax errors for some functions
+#
+SET @xml='<a><b>b1</b><b>b2</b></a>';
+SELECT extractValue(@xml, '/a/b[string-length("x")=1]');
+SELECT extractValue(@xml, '/a/b[string-length("xx")=2]');
+SELECT extractValue(@xml, '/a/b[string-length("xxx")=2]');
+SELECT extractValue(@xml, '/a/b[string-length("x")]');
+SELECT extractValue(@xml, '/a/b[string-length("xx")]');
+SELECT extractValue(@xml, '/a/b[string-length()]');
+--error 1105
+SELECT extractValue(@xml, 'string-length()');
+SELECT extractValue(@xml, 'string-length("x")');
+
+SET @xml='<a b="b11" b="b12" b="b21" b="22"/>';
+select extractValue(@xml,'/a/@b');
+select extractValue(@xml,'/a/@b[contains(.,"1")]');
+select extractValue(@xml,'/a/@b[contains(.,"1")][contains(.,"2")]');
+select extractValue(@xml,'/a/@b[contains(.,"1")][contains(.,"2")][2]');
+
+SET @xml='<a>a1<b>b1<c>c1</c>b2</b>a2</a>';
+select UpdateXML('<a>a1<b>b1<c>c1</c>b2</b>a2</a>','/a/b/c','+++++++++');
+select UpdateXML('<a>a1<b>b1<c>c1</c>b2</b>a2</a>','/a/b/c','<c1>+++++++++</c1>');
+select UpdateXML('<a>a1<b>b1<c>c1</c>b2</b>a2</a>','/a/b/c','<c1/>');
+
+SET @xml='<a><b>bb</b></a>';
+select UpdateXML(@xml, '/a/b', '<b>ccc</b>');
+
+SET @xml='<a aa1="aa1" aa2="aa2"><b bb1="bb1" bb2="bb2">bb</b></a>';
+select UpdateXML(@xml, '/a/b', '<b>ccc</b>');
+select UpdateXML(@xml, '/a/@aa1', '');
+select UpdateXML(@xml, '/a/@aa1', 'aa3="aa3"');
+select UpdateXML(@xml, '/a/@aa2', '');
+select UpdateXML(@xml, '/a/@aa2', 'aa3="aa3"');
+select UpdateXML(@xml, '/a/b/@bb1', '');
+select UpdateXML(@xml, '/a/b/@bb1', 'bb3="bb3"');
+select UpdateXML(@xml, '/a/b/@bb2', '');
+select UpdateXML(@xml, '/a/b/@bb2', 'bb3="bb3"');
+
+#
+# Bug#16234 XML: Crash if ExtractValue()
+#
+SET @xml= '<order><clerk>lesser wombat</clerk></order>';
+select extractvalue(@xml,'order/clerk');
+select extractvalue(@xml,'/order/clerk');
+
+#
+# Bug#16314 XML: extractvalue() crash if vertical bar
+#
+select extractvalue('<a><b>B</b></a>','/a|/b');
+select extractvalue('<a><b>B</b></a>','/a|b');
+select extractvalue('<a>a<b>B</b></a>','/a|/b');
+select extractvalue('<a>a<b>B</b></a>','/a|b');
+select extractvalue('<a>a<b>B</b></a>','a|/b');
+
+#
+# Bug#16312 XML: extractvalue() crash if angle brackets
+#
+--error 1105
+select extractvalue('<a>A</a>','/<a>');
+
+#
+# Bug#16313 XML: extractvalue() ignores '!' in names
+#
+--error 1105
+select extractvalue('<a><b>b</b><b!>b!</b!></a>','//b!');
+
+#
+# Bug #16315 XML: extractvalue() handles self badly
+#
+select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant::*');
+select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/self::*');
+select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant-or-self::*');
+# Bug #16320 XML: extractvalue() won't accept names containing underscores
+#
+select extractvalue('<A_B>A</A_B>','/A_B');
+
+#
+# Bug#16318: XML: extractvalue() incorrectly returns last() = 1
+#
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[position()]');
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=last()]');
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()]');
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()-1]');
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()=1]');
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()=2]');
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()=position()]');
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)]');
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)-1]');
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=1]');
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=2]');
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=position()]');
+#
+# Bug#16316: XML: extractvalue() is case-sensitive with contains()
+#
+select extractvalue('<a>Jack</a>','/a[contains(../a,"J")]');
+select extractvalue('<a>Jack</a>','/a[contains(../a,"j")]');
+select extractvalue('<a>Jack</a>','/a[contains(../a,"j")]' collate latin1_bin);
+select extractvalue('<a>Jack</a>' collate latin1_bin,'/a[contains(../a,"j")]');
+
+#
+# Bug#18285: ExtractValue not returning character
+# data within <![CDATA[]]> as expected
+#
+select ExtractValue('<tag1><![CDATA[test]]></tag1>','/tag1');
+
+#
+# Bug#18201: XML: ExtractValue works even if the xml fragment
+# is not well-formed xml
+#
+select extractValue('<a>a','/a');
+select extractValue('<a>a<','/a');
+select extractValue('<a>a</','/a');
+select extractValue('<a>a</a','/a');
+select extractValue('<a>a</a></b>','/a');
+select extractValue('<a b=>a</a>','/a');
+
+#
+# Bug #18171 XML: ExtractValue: the XPath position()
+# function crashes the server!
+#
+--error 1105
+select extractValue('<e>1</e>','position()');
+--error 1105
+select extractValue('<e>1</e>','last()');
+
+
+#
+# Bug #18172 XML: Extractvalue() accepts mallformed
+# XPath without a XPath syntax error
+#
+--error 1105
+select extractValue('<e><a>1</a></e>','/e/');
+
+#
+# Bug#16233: XML: ExtractValue() fails with special characters
+#
+set names utf8;
+select extractValue('<Ñ><r>r</r></Ñ>','/Ñ/r');
+select extractValue('<r><Ñ>Ñ</Ñ></r>','/r/Ñ');
+select extractValue('<Ñ r="r"/>','/Ñ/@r');
+select extractValue('<r Ñ="Ñ"/>','/r/@Ñ');
+--disable_warnings
+DROP PROCEDURE IF EXISTS p2;
+--enable_warnings
+DELIMITER //;
+CREATE PROCEDURE p2 ()
+BEGIN
+ DECLARE p LONGTEXT CHARACTER SET UTF8 DEFAULT '<Ñ><r>A</r></Ñ>';
+ SELECT EXTRACTVALUE(p,'/Ñ/r');
+END//
+DELIMITER ;//
+CALL p2();
+DROP PROCEDURE p2;
+
+#
+# Bug#18170: XML: ExtractValue():
+# XPath expression can't use QNames (colon in names)
+#
+select extractValue('<ns:element xmlns:ns="myns"/>','count(ns:element)');
+select extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element');
+select extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element/@xmlns:ns');
+
+#
+# Bug#20795 extractvalue() won't accept names containing a dot (.)
+#
+select extractValue('<foo><foo.bar>Data</foo.bar><something>Otherdata</something></foo>','/foo/foo.bar');
+select extractValue('<foo><foo.bar>Data</foo.bar><something>Otherdata</something></foo>','/foo/something');
+
+#
+# Bug#20854 XML functions: wrong result in ExtractValue
+#
+--error 1105
+select extractValue('<zot><tim0><01>10:39:15</01><02>140</02></tim0></zot>','/zot/tim0/02');
+select extractValue('<zot><tim0><01>10:39:15</01><02>140</02></tim0></zot>','//*');
+# dot and dash are bad identtifier start character
+select extractValue('<.>test</.>','//*');
+select extractValue('<->test</->','//*');
+# semicolon is good identifier start character
+select extractValue('<:>test</:>','//*');
+# underscore is good identifier start character
+select extractValue('<_>test</_>','//*');
+# dot, dash, underscore and semicolon are good identifier middle characters
+select extractValue('<x.-_:>test</x.-_:>','//*');
diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp
index f7eb9baa4c7..e88df49a707 100644
--- a/mysql-test/valgrind.supp
+++ b/mysql-test/valgrind.supp
@@ -20,6 +20,47 @@
fun:calloc
fun:_dl_allocate_tls
fun:pthread_create*
+
+}
+
+{
+ pthead_exit memory loss 1
+ Memcheck:Leak
+ fun:malloc
+ fun:_dl_new_object
+ fun:_dl_map_object_from_fd
+}
+
+{
+ pthread_exit memory loss 2
+ Memcheck:Leak
+ fun:malloc
+ fun:_dl_map_object
+ fun:dl_open_worker
+}
+
+{
+ pthread_exit memory loss 3
+ Memcheck:Leak
+ fun:malloc
+ fun:_dl_map_object_deps
+ fun:dl_open_worker
+}
+
+{
+ pthread_exit memory loss 4
+ Memcheck:Leak
+ fun:calloc
+ fun:_dl_check_map_versions
+ fun:dl_open_worker
+}
+
+{
+ pthread_exit memory loss 5
+ Memcheck:Leak
+ fun:calloc
+ fun:_dl_new_object
+ fun:_dl_map_object_from_fd
}
{
@@ -72,6 +113,26 @@
}
{
+ pthread strstr uninit
+ Memcheck:Cond
+ fun:strstr
+ obj:/lib/tls/libpthread.so.*
+ obj:/lib/tls/libpthread.so.*
+ fun:call_init
+ fun:_dl_init
+ obj:/lib/ld-*.so
+}
+
+{
+ strlen/_dl_init_paths/dl_main/_dl_sysdep_start(Cond)
+ Memcheck:Cond
+ fun:strlen
+ fun:_dl_init_paths
+ fun:dl_main
+ fun:_dl_sysdep_start
+}
+
+{
pthread errno
Memcheck:Leak
fun:calloc
@@ -141,6 +202,24 @@
}
{
+ libz longest_match3
+ Memcheck:Cond
+ fun:longest_match
+ fun:deflate_slow
+ fun:deflate
+ fun:azflush
+}
+
+{
+ libz longest_match3
+ Memcheck:Cond
+ fun:longest_match
+ fun:deflate_slow
+ fun:deflate
+ fun:azclose
+}
+
+{
libz deflate
Memcheck:Cond
obj:*/libz.so.*
@@ -159,6 +238,34 @@
fun:gzflush
}
+{
+ libz deflate3
+ Memcheck:Cond
+ obj:*/libz.so.*
+ obj:*/libz.so.*
+ fun:deflate
+ fun:do_flush
+}
+
+#
+# Warning from my_thread_init becasue mysqld dies before kill thread exists
+#
+
+{
+ my_thread_init kill thread memory loss second
+ Memcheck:Leak
+ fun:calloc
+ fun:my_thread_init
+ fun:kill_server_thread
+}
+
+
+# Red Hat AS 4 32 bit
+{
+ dl_relocate_object
+ Memcheck:Cond
+ fun:_dl_relocate_object
+}
#
# Warning from my_thread_init becasue mysqld dies before kill thread exists
@@ -320,7 +427,6 @@
}
-
#
# This is seen internally in the system libraries on 64-bit RHAS3.
#
@@ -346,3 +452,38 @@
fun:_ZN19TransporterRegistry11performSendEv
fun:_ZN19TransporterRegistry14forceSendCheckEi
}
+# Warning when printing stack trace (to suppress some not needed warnings)
+#
+
+{
+ vprintf on stacktrace
+ Memcheck:Cond
+ fun:vfprintf
+ fun:uffered_vfprintf
+ fun:vfprintf
+ fun:fprintf
+ fun:print_stacktrace
+}
+
+#
+# Safe warnings, that may happen because of thread scheduling
+#
+
+{
+ dbug initialization
+ Memcheck:Leak
+ fun:malloc
+ fun:DbugMalloc
+ fun:ListAdd
+ fun:_db_set_
+}
+
+{
+ dbug initialization by kill_server
+ Memcheck:Leak
+ fun:malloc
+ fun:DbugMalloc
+ fun:code_state
+ fun:_db_enter_
+ fun:kill_server
+}
diff --git a/mysql-test/valgrind.supp.orig b/mysql-test/valgrind.supp.orig
new file mode 100644
index 00000000000..1a08abcf953
--- /dev/null
+++ b/mysql-test/valgrind.supp.orig
@@ -0,0 +1,189 @@
+#
+# Suppress some common (not fatal) errors in system libraries found by valgrind
+#
+
+#
+# Pthread doesn't free all thread specific memory before program exists
+#
+{
+ pthread allocate_tls memory loss
+ Memcheck:Leak
+ fun:calloc
+ fun:_dl_allocate_tls
+ fun:allocate_stack
+ fun:pthread_create@@GLIBC_2.1
+}
+
+{
+ pthread allocate_dtv memory loss
+ Memcheck:Leak
+ fun:calloc
+ fun:allocate_dtv
+ fun:_dl_allocate_tls_storage
+ fun:__GI__dl_allocate_tls
+ fun:pthread_create
+}
+
+{
+ pthread allocate_dtv memory loss second
+ Memcheck:Leak
+ fun:calloc
+ fun:allocate_dtv
+ fun:_dl_allocate_tls
+ fun:pthread_create*
+}
+
+{
+ pthread allocate_dtv memory loss second
+ Memcheck:Leak
+ fun:calloc
+ fun:allocate_dtv
+ fun:_dl_allocate_tls
+ fun:pthread_create*
+}
+
+{
+ pthread memalign memory loss
+ Memcheck:Leak
+ fun:memalign
+ fun:_dl_allocate_tls_storage
+ fun:__GI__dl_allocate_tls
+ fun:pthread_create
+}
+
+{
+ pthread pthread_key_create
+ Memcheck:Leak
+ fun:malloc
+ fun:*
+ fun:*
+ fun:pthread_key_create
+ fun:my_thread_global_init
+}
+
+{
+ pthread strstr uninit
+ Memcheck:Cond
+ fun:strstr
+ obj:/lib/tls/libpthread.so.*
+ obj:/lib/tls/libpthread.so.*
+ fun:call_init
+ fun:_dl_init
+ obj:/lib/ld-*.so
+}
+
+{
+ pthread strstr uninit
+ Memcheck:Cond
+ fun:strstr
+ obj:/lib/tls/libpthread.so.*
+ obj:/lib/tls/libpthread.so.*
+ fun:call_init
+ fun:_dl_init
+ obj:/lib/ld-*.so
+}
+
+{
+ pthread errno
+ Memcheck:Leak
+ fun:calloc
+ fun:_dlerror_run
+ fun:dlsym
+ fun:__errno_location
+}
+
+
+#
+# Warnings in libz becasue it works with aligned memory(?)
+#
+
+{
+ libz tr_flush_block
+ Memcheck:Cond
+ fun:_tr_flush_block
+ fun:deflate_slow
+ fun:deflate
+ fun:do_flush
+ fun:gzclose
+}
+
+{
+ libz tr_flush_block2
+ Memcheck:Cond
+ fun:_tr_flush_block
+ fun:deflate_slow
+ fun:deflate
+ fun:compress2
+}
+
+{
+ libz longest_match
+ Memcheck:Cond
+ fun:longest_match
+ fun:deflate_slow
+ fun:deflate
+ fun:do_flush
+}
+
+{
+ libz longest_match2
+ Memcheck:Cond
+ fun:longest_match
+ fun:deflate_slow
+ fun:deflate
+ fun:compress2
+}
+
+{
+ libz deflate
+ Memcheck:Cond
+ obj:*/libz.so.*
+ obj:*/libz.so.*
+ fun:deflate
+ fun:compress2
+}
+
+{
+ libz deflate2
+ Memcheck:Cond
+ obj:*/libz.so.*
+ obj:*/libz.so.*
+ fun:deflate
+ obj:*/libz.so.*
+ fun:gzflush
+}
+
+{
+ libz deflate3
+ Memcheck:Cond
+ obj:*/libz.so.*
+ obj:*/libz.so.*
+ fun:deflate
+ fun:do_flush
+}
+
+#
+# Warning from my_thread_init becasue mysqld dies before kill thread exists
+#
+
+{
+ my_thread_init kill thread memory loss second
+ Memcheck:Leak
+ fun:calloc
+ fun:my_thread_init
+ fun:kill_server_thread
+}
+
+#
+# Warning when printing stack trace (to suppress some not needed warnings)
+#
+
+{
+ vprintf on stacktrace
+ Memcheck:Cond
+ fun:vfprintf
+ fun:uffered_vfprintf
+ fun:vfprintf
+ fun:fprintf
+ fun:print_stacktrace
+}